Chromium Code Reviews| Index: runtime/vm/flow_graph_compiler.cc |
| diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc |
| index a9361c12cb132519d4ba68cf76f0d01d89935e3e..459c3075a3872b6535e6f7a21a3216a95ac566cd 100644 |
| --- a/runtime/vm/flow_graph_compiler.cc |
| +++ b/runtime/vm/flow_graph_compiler.cc |
| @@ -9,6 +9,7 @@ |
| #include "vm/dart_entry.h" |
| #include "vm/debugger.h" |
| #include "vm/deopt_instructions.h" |
| +#include "vm/flow_graph_allocator.h" |
| #include "vm/il_printer.h" |
| #include "vm/intrinsifier.h" |
| #include "vm/locations.h" |
| @@ -252,8 +253,43 @@ void FlowGraphCompiler::RecordSafepoint(LocationSummary* locs) { |
| if (is_optimizing()) { |
| BitmapBuilder* bitmap = locs->stack_bitmap(); |
| ASSERT(bitmap != NULL); |
| + ASSERT(bitmap->Length() <= StackSize()); |
| + // Pad the bitmap out to describe all the spill slots. |
| bitmap->SetLength(StackSize()); |
| - stackmap_table_builder_->AddEntry(assembler()->CodeSize(), bitmap); |
| + |
| + // Slow path code can have registers at the safepoint. |
| + if (!locs->always_calls()) { |
| + // Mark the bits in the stack map in the same order we push registers |
|
Vyacheslav Egorov (Google)
2012/08/30 09:24:35
this does not actually match with that order: when
Kevin Millikin (Google)
2012/08/30 10:02:21
You're right and it's a bit fishy. I've made it m
|
| + // in slow path code (see FlowGraphCompiler::SaveLiveRegisters). |
| + RegisterSet* regs = locs->live_registers(); |
| + if (regs->xmm_regs_count() > 0) { |
| + // Denote XMM registers with 0 bits in the stackmap. Based on the |
| + // assumption that there are normally few live XMM registers, this |
|
Vyacheslav Egorov (Google)
2012/08/30 09:24:35
s/live XMM/live XMM/
Kevin Millikin (Google)
2012/08/30 10:02:21
You don't like the fully justified comments?
|
| + // encoding is simpler and roughly as compact as storing a separate |
| + // count of XMM registers. |
| + for (intptr_t i = 0; i < kNumberOfXmmRegisters; ++i) { |
| + XmmRegister reg = static_cast<XmmRegister>(i); |
| + if (regs->ContainsXmmRegister(reg)) { |
| + for (intptr_t j = 0; |
| + j < FlowGraphAllocator::kDoubleSpillSlotFactor; |
| + ++j) { |
| + bitmap->Set(bitmap->Length(), false); |
| + } |
| + } |
| + } |
| + } |
| + for (intptr_t i = 0; i < kNumberOfCpuRegisters; ++i) { |
| + Register reg = static_cast<Register>(i); |
| + if (locs->live_registers()->ContainsRegister(reg)) { |
| + bitmap->Set(bitmap->Length(), true); |
| + } |
| + } |
| + } |
| + |
| + intptr_t register_bit_count = bitmap->Length() - StackSize(); |
| + stackmap_table_builder_->AddEntry(assembler()->CodeSize(), |
| + bitmap, |
| + register_bit_count); |
| } |
| } |