Index: runtime/vm/flow_graph_compiler.cc |
diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc |
index b4339603ebfb4461d1755e46667d6f4334df41b4..304b92dc730f2c6e733c559a1773eda83150b66f 100644 |
--- a/runtime/vm/flow_graph_compiler.cc |
+++ b/runtime/vm/flow_graph_compiler.cc |
@@ -77,7 +77,7 @@ FlowGraphCompiler::FlowGraphCompiler( |
current_block_(NULL), |
exception_handlers_list_(NULL), |
pc_descriptors_list_(NULL), |
- stackmap_table_builder_(NULL), |
+ stackmap_table_builder_(is_ssa ? new StackmapTableBuilder() : NULL), |
block_info_(block_order.length()), |
deopt_stubs_(), |
object_table_(GrowableObjectArray::Handle(GrowableObjectArray::New())), |
@@ -143,9 +143,8 @@ void FlowGraphCompiler::VisitBlocks() { |
set_current_block(entry); |
entry->PrepareEntry(this); |
// Compile all successors until an exit, branch, or a block entry. |
- Instruction* instr = entry; |
for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) { |
- instr = it.Current(); |
+ Instruction* instr = it.Current(); |
if (FLAG_code_comments) EmitComment(instr); |
if (instr->IsParallelMove()) { |
parallel_move_resolver_.EmitNativeCode(instr->AsParallelMove()); |
@@ -156,14 +155,6 @@ void FlowGraphCompiler::VisitBlocks() { |
instr->EmitNativeCode(this); |
} |
} |
- if (instr->next() != NULL) { |
- BlockEntryInstr* successor = instr->next()->AsBlockEntry(); |
- ASSERT(successor != NULL); |
- frame_register_allocator()->Spill(); |
- if (!IsNextBlock(successor)) { |
- assembler()->jmp(GetBlockLabel(successor)); |
- } |
- } |
} |
} |
@@ -294,6 +285,7 @@ void FlowGraphCompiler::FinalizeStackmaps(const Code& code) { |
// Finalize the stack map array and add it to the code object. |
code.set_stackmaps( |
Array::Handle(stackmap_table_builder_->FinalizeStackmaps(code))); |
+ ASSERT(is_ssa() && is_optimizing()); |
} |
} |
@@ -359,7 +351,8 @@ void FlowGraphCompiler::GenerateInstanceCall( |
const String& function_name, |
intptr_t argument_count, |
const Array& argument_names, |
- intptr_t checked_argument_count) { |
+ intptr_t checked_argument_count, |
+ BitmapBuilder* stack_bitmap) { |
ASSERT(!IsLeaf()); |
ASSERT(frame_register_allocator()->IsSpilled()); |
ICData& ic_data = |
@@ -386,6 +379,9 @@ void FlowGraphCompiler::GenerateInstanceCall( |
ic_data, |
arguments_descriptor, |
argument_count); |
+ if (is_ssa() && (stack_bitmap != NULL)) { |
+ stackmap_table_builder_->AddEntry(descr_offset, stack_bitmap); |
+ } |
pc_descriptors_list()->AddDescriptor(PcDescriptors::kIcCall, |
descr_offset, |
deopt_id, |
@@ -399,7 +395,8 @@ void FlowGraphCompiler::GenerateStaticCall(intptr_t deopt_id, |
intptr_t try_index, |
const Function& function, |
intptr_t argument_count, |
- const Array& argument_names) { |
+ const Array& argument_names, |
+ BitmapBuilder* stack_bitmap) { |
ASSERT(frame_register_allocator()->IsSpilled()); |
const Array& arguments_descriptor = |
@@ -407,6 +404,9 @@ void FlowGraphCompiler::GenerateStaticCall(intptr_t deopt_id, |
const intptr_t descr_offset = EmitStaticCall(function, |
arguments_descriptor, |
argument_count); |
+ if (is_ssa() && (stack_bitmap != NULL)) { |
Vyacheslav Egorov (Google)
2012/08/13 12:54:46
we should make as hard as possible to pass NULLs f
Kevin Millikin (Google)
2012/08/13 15:10:37
Agreed. I think we'll actually want to just make
|
+ stackmap_table_builder_->AddEntry(descr_offset, stack_bitmap); |
+ } |
pc_descriptors_list()->AddDescriptor(PcDescriptors::kFuncCall, |
descr_offset, |
deopt_id, |
@@ -485,7 +485,8 @@ void FlowGraphCompiler::EmitLoadIndexedGeneric(LoadIndexedComp* comp) { |
function_name, |
kNumArguments, |
Array::ZoneHandle(), // No optional arguments. |
- kNumArgsChecked); |
+ kNumArgsChecked, |
+ comp->locs()->stack_bitmap()); |
} |
@@ -497,7 +498,8 @@ void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data, |
Label* done, |
intptr_t deopt_id, |
intptr_t token_index, |
- intptr_t try_index) { |
+ intptr_t try_index, |
+ BitmapBuilder* stack_bitmap) { |
ASSERT(!ic_data.IsNull() && (ic_data.NumberOfChecks() > 0)); |
Label match_found; |
for (intptr_t i = 0; i < ic_data.NumberOfChecks(); i++) { |
@@ -515,7 +517,8 @@ void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data, |
try_index, |
target, |
arg_count, |
- arg_names); |
+ arg_names, |
+ stack_bitmap); |
if (!is_last_check) { |
assembler()->jmp(&match_found); |
} |