Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. |
| 6 | 6 |
| 7 #include "vm/flow_graph_compiler.h" | 7 #include "vm/flow_graph_compiler.h" |
| 8 | 8 |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/debugger.h" | 10 #include "vm/debugger.h" |
| 11 #include "vm/deopt_instructions.h" | 11 #include "vm/deopt_instructions.h" |
| 12 #include "vm/flow_graph_allocator.h" | |
| 12 #include "vm/il_printer.h" | 13 #include "vm/il_printer.h" |
| 13 #include "vm/intrinsifier.h" | 14 #include "vm/intrinsifier.h" |
| 14 #include "vm/locations.h" | 15 #include "vm/locations.h" |
| 15 #include "vm/longjump.h" | 16 #include "vm/longjump.h" |
| 16 #include "vm/object_store.h" | 17 #include "vm/object_store.h" |
| 17 #include "vm/parser.h" | 18 #include "vm/parser.h" |
| 18 #include "vm/stub_code.h" | 19 #include "vm/stub_code.h" |
| 19 #include "vm/symbols.h" | 20 #include "vm/symbols.h" |
| 20 | 21 |
| 21 namespace dart { | 22 namespace dart { |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 245 deopt_id, | 246 deopt_id, |
| 246 token_pos, | 247 token_pos, |
| 247 deopt_index); | 248 deopt_index); |
| 248 } | 249 } |
| 249 | 250 |
| 250 | 251 |
| 251 void FlowGraphCompiler::RecordSafepoint(LocationSummary* locs) { | 252 void FlowGraphCompiler::RecordSafepoint(LocationSummary* locs) { |
| 252 if (is_optimizing()) { | 253 if (is_optimizing()) { |
| 253 BitmapBuilder* bitmap = locs->stack_bitmap(); | 254 BitmapBuilder* bitmap = locs->stack_bitmap(); |
| 254 ASSERT(bitmap != NULL); | 255 ASSERT(bitmap != NULL); |
| 256 ASSERT(bitmap->Length() <= StackSize()); | |
| 257 // Pad the bitmap out to describe all the spill slots. | |
| 255 bitmap->SetLength(StackSize()); | 258 bitmap->SetLength(StackSize()); |
| 256 stackmap_table_builder_->AddEntry(assembler()->CodeSize(), bitmap); | 259 |
| 260 // Slow path code can have registers at the safepoint. | |
| 261 if (!locs->always_calls()) { | |
| 262 // 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
| |
| 263 // in slow path code (see FlowGraphCompiler::SaveLiveRegisters). | |
| 264 RegisterSet* regs = locs->live_registers(); | |
| 265 if (regs->xmm_regs_count() > 0) { | |
| 266 // Denote XMM registers with 0 bits in the stackmap. Based on the | |
| 267 // 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?
| |
| 268 // encoding is simpler and roughly as compact as storing a separate | |
| 269 // count of XMM registers. | |
| 270 for (intptr_t i = 0; i < kNumberOfXmmRegisters; ++i) { | |
| 271 XmmRegister reg = static_cast<XmmRegister>(i); | |
| 272 if (regs->ContainsXmmRegister(reg)) { | |
| 273 for (intptr_t j = 0; | |
| 274 j < FlowGraphAllocator::kDoubleSpillSlotFactor; | |
| 275 ++j) { | |
| 276 bitmap->Set(bitmap->Length(), false); | |
| 277 } | |
| 278 } | |
| 279 } | |
| 280 } | |
| 281 for (intptr_t i = 0; i < kNumberOfCpuRegisters; ++i) { | |
| 282 Register reg = static_cast<Register>(i); | |
| 283 if (locs->live_registers()->ContainsRegister(reg)) { | |
| 284 bitmap->Set(bitmap->Length(), true); | |
| 285 } | |
| 286 } | |
| 287 } | |
| 288 | |
| 289 intptr_t register_bit_count = bitmap->Length() - StackSize(); | |
| 290 stackmap_table_builder_->AddEntry(assembler()->CodeSize(), | |
| 291 bitmap, | |
| 292 register_bit_count); | |
| 257 } | 293 } |
| 258 } | 294 } |
| 259 | 295 |
| 260 | 296 |
| 261 Label* FlowGraphCompiler::AddDeoptStub(intptr_t deopt_id, | 297 Label* FlowGraphCompiler::AddDeoptStub(intptr_t deopt_id, |
| 262 DeoptReasonId reason) { | 298 DeoptReasonId reason) { |
| 263 DeoptimizationStub* stub = new DeoptimizationStub(deopt_id, reason); | 299 DeoptimizationStub* stub = new DeoptimizationStub(deopt_id, reason); |
| 264 ASSERT(is_optimizing_); | 300 ASSERT(is_optimizing_); |
| 265 ASSERT(pending_deoptimization_env_ != NULL); | 301 ASSERT(pending_deoptimization_env_ != NULL); |
| 266 stub->set_deoptimization_env(pending_deoptimization_env_); | 302 stub->set_deoptimization_env(pending_deoptimization_env_); |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 747 return; | 783 return; |
| 748 } | 784 } |
| 749 } | 785 } |
| 750 | 786 |
| 751 // This move is not blocked. | 787 // This move is not blocked. |
| 752 EmitMove(index); | 788 EmitMove(index); |
| 753 } | 789 } |
| 754 | 790 |
| 755 | 791 |
| 756 } // namespace dart | 792 } // namespace dart |
| OLD | NEW |