mirror of
https://github.com/dart-lang/sdk
synced 2024-11-05 18:22:09 +00:00
When a value has been optimized away by the compiler, set its value to
"<optimized out>". This will make it less confusing for people using the debugger. - Added constant_dead() to the flow graph. - Added Symbols::OptimizedOut(). R=fschneider@google.com Review URL: https://codereview.chromium.org//27339003 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28671 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
2f900dab13
commit
2ad40bc29b
4 changed files with 18 additions and 12 deletions
|
@ -453,13 +453,10 @@ static void InspectStackTest(bool optimize) {
|
|||
dart_args[1] = Dart_NewInteger(kLowThreshold);
|
||||
EXPECT_VALID(Dart_Invoke(script_lib, NewString("test"), 2, dart_args));
|
||||
if (optimize) {
|
||||
// Note that several variables have the value 'null' in the
|
||||
// optimized case. This is because these values were determined
|
||||
// to be dead by the optimizing compiler and their values were not
|
||||
// preserved by the deopt information.
|
||||
EXPECT_STREQ("[0] breakpointNow { }\n"
|
||||
"[1] helper { a = 5 b = 99 stop = null }\n"
|
||||
"[2] anotherMiddleMan { one = null two = null stop = null }\n"
|
||||
"[1] helper { a = 5 b = 99 stop = <optimized out> }\n"
|
||||
"[2] anotherMiddleMan { one = <optimized out> "
|
||||
"two = <optimized out> stop = <optimized out> }\n"
|
||||
"[3] middleMan { x = 5 limit = 100 stop = true value = 24255"
|
||||
" i = 99 }\n"
|
||||
"[4] test { stop = true limit = 100 }\n",
|
||||
|
@ -549,10 +546,10 @@ static void InspectStackWithClosureTest(bool optimize) {
|
|||
EXPECT_VALID(Dart_Invoke(script_lib, NewString("test"), 2, dart_args));
|
||||
if (optimize) {
|
||||
EXPECT_STREQ("[0] breakpointNow { }\n"
|
||||
"[1] helper { a = 50 b = 99 stop = null }\n"
|
||||
"[1] helper { a = 50 b = 99 stop = <optimized out> }\n"
|
||||
"[2] <anonymous closure> { x = 5 i = 99 stop = true"
|
||||
" value = null }\n"
|
||||
"[3] anotherMiddleMan { func = null }\n"
|
||||
" value = <optimized out> }\n"
|
||||
"[3] anotherMiddleMan { func = <optimized out> }\n"
|
||||
"[4] middleMan { x = 5 limit = 100 stop = true"
|
||||
" value = 242550 i = 99 }\n"
|
||||
"[5] test { stop = true limit = 100 }\n",
|
||||
|
|
|
@ -34,6 +34,8 @@ FlowGraph::FlowGraph(const FlowGraphBuilder& builder,
|
|||
postorder_(),
|
||||
reverse_postorder_(),
|
||||
optimized_block_order_(),
|
||||
constant_null_(NULL),
|
||||
constant_dead_(NULL),
|
||||
block_effects_(NULL),
|
||||
licm_allowed_(true),
|
||||
use_far_branches_(false),
|
||||
|
@ -706,6 +708,7 @@ void FlowGraph::Rename(GrowableArray<PhiInstr*>* live_phis,
|
|||
|
||||
// Add global constants to the initial definitions.
|
||||
constant_null_ = GetConstant(Object::ZoneHandle());
|
||||
constant_dead_ = GetConstant(Symbols::OptimizedOut());
|
||||
|
||||
// Add parameters to the initial definitions and renaming environment.
|
||||
if (inlining_parameters != NULL) {
|
||||
|
@ -804,7 +807,7 @@ void FlowGraph::RenameRecursive(BlockEntryInstr* block_entry,
|
|||
BitVector* live_in = variable_liveness->GetLiveInSet(block_entry);
|
||||
for (intptr_t i = 0; i < variable_count(); i++) {
|
||||
if (!live_in->Contains(i)) {
|
||||
(*env)[i] = constant_null();
|
||||
(*env)[i] = constant_dead();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -875,7 +878,7 @@ void FlowGraph::RenameRecursive(BlockEntryInstr* block_entry,
|
|||
if (variable_liveness->IsStoreAlive(block_entry, store)) {
|
||||
(*env)[index] = result;
|
||||
} else {
|
||||
(*env)[index] = constant_null();
|
||||
(*env)[index] = constant_dead();
|
||||
}
|
||||
} else if (load != NULL) {
|
||||
// The graph construction ensures we do not have an unused LoadLocal
|
||||
|
@ -891,7 +894,7 @@ void FlowGraph::RenameRecursive(BlockEntryInstr* block_entry,
|
|||
}
|
||||
|
||||
if (variable_liveness->IsLastLoad(block_entry, load)) {
|
||||
(*env)[index] = constant_null();
|
||||
(*env)[index] = constant_dead();
|
||||
}
|
||||
} else if (push != NULL) {
|
||||
result = push->value()->definition();
|
||||
|
|
|
@ -114,6 +114,10 @@ class FlowGraph : public ZoneAllocated {
|
|||
return constant_null_;
|
||||
}
|
||||
|
||||
ConstantInstr* constant_dead() const {
|
||||
return constant_dead_;
|
||||
}
|
||||
|
||||
intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; }
|
||||
|
||||
intptr_t InstructionCount() const;
|
||||
|
@ -269,6 +273,7 @@ class FlowGraph : public ZoneAllocated {
|
|||
GrowableArray<BlockEntryInstr*> reverse_postorder_;
|
||||
GrowableArray<BlockEntryInstr*> optimized_block_order_;
|
||||
ConstantInstr* constant_null_;
|
||||
ConstantInstr* constant_dead_;
|
||||
|
||||
BlockEffects* block_effects_;
|
||||
bool licm_allowed_;
|
||||
|
|
|
@ -288,6 +288,7 @@ class ObjectPointerVisitor;
|
|||
V(_LocalTypeVariableMirrorImpl, "_LocalTypeVariableMirrorImpl") \
|
||||
V(hashCode, "get:hashCode") \
|
||||
V(_leftShiftWithMask32, "_leftShiftWithMask32") \
|
||||
V(OptimizedOut, "<optimized out>") \
|
||||
|
||||
|
||||
// Contains a list of frequently used strings in a canonicalized form. This
|
||||
|
|
Loading…
Reference in a new issue