OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/cha.h" | 9 #include "vm/cha.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 } | 542 } |
543 | 543 |
544 intptr_t register_bit_count = bitmap->Length() - StackSize(); | 544 intptr_t register_bit_count = bitmap->Length() - StackSize(); |
545 stackmap_table_builder_->AddEntry(assembler()->CodeSize(), | 545 stackmap_table_builder_->AddEntry(assembler()->CodeSize(), |
546 bitmap, | 546 bitmap, |
547 register_bit_count); | 547 register_bit_count); |
548 } | 548 } |
549 } | 549 } |
550 | 550 |
551 | 551 |
552 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and | 552 // This function must be kept in sync with: |
553 // FlowGraphCompiler::SaveLiveRegisters. | 553 // |
| 554 // FlowGraphCompiler::RecordSafepoint |
| 555 // FlowGraphCompiler::SaveLiveRegisters |
| 556 // MaterializeObjectInstr::RemapRegisters |
| 557 // |
554 Environment* FlowGraphCompiler::SlowPathEnvironmentFor( | 558 Environment* FlowGraphCompiler::SlowPathEnvironmentFor( |
555 Instruction* instruction) { | 559 Instruction* instruction) { |
556 if (instruction->env() == NULL) return NULL; | 560 if (instruction->env() == NULL) { |
| 561 ASSERT(!is_optimizing()); |
| 562 return NULL; |
| 563 } |
557 | 564 |
558 Environment* env = instruction->env()->DeepCopy(); | 565 Environment* env = instruction->env()->DeepCopy(); |
559 // 1. Iterate the registers in the order they will be spilled to compute | 566 // 1. Iterate the registers in the order they will be spilled to compute |
560 // the slots they will be spilled to. | 567 // the slots they will be spilled to. |
561 intptr_t next_slot = StackSize(); | 568 intptr_t next_slot = StackSize(); |
562 RegisterSet* regs = instruction->locs()->live_registers(); | 569 RegisterSet* regs = instruction->locs()->live_registers(); |
563 intptr_t fpu_reg_slots[kNumberOfFpuRegisters]; | 570 intptr_t fpu_reg_slots[kNumberOfFpuRegisters]; |
564 intptr_t cpu_reg_slots[kNumberOfCpuRegisters]; | 571 intptr_t cpu_reg_slots[kNumberOfCpuRegisters]; |
565 const intptr_t kFpuRegisterSpillFactor = kFpuRegisterSize / kWordSize; | 572 const intptr_t kFpuRegisterSpillFactor = kFpuRegisterSize / kWordSize; |
566 // FPU registers are spilled first from highest to lowest register number. | 573 // FPU registers are spilled first from highest to lowest register number. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 it.SetCurrentLocation(Location::DoubleStackSlot(index)); | 611 it.SetCurrentLocation(Location::DoubleStackSlot(index)); |
605 break; | 612 break; |
606 case kUnboxedFloat32x4: | 613 case kUnboxedFloat32x4: |
607 case kUnboxedInt32x4: | 614 case kUnboxedInt32x4: |
608 case kUnboxedFloat64x2: | 615 case kUnboxedFloat64x2: |
609 it.SetCurrentLocation(Location::QuadStackSlot(index)); | 616 it.SetCurrentLocation(Location::QuadStackSlot(index)); |
610 break; | 617 break; |
611 default: | 618 default: |
612 UNREACHABLE(); | 619 UNREACHABLE(); |
613 } | 620 } |
| 621 } else if (loc.IsInvalid()) { |
| 622 Definition* def = |
| 623 it.CurrentValue()->definition(); |
| 624 ASSERT(def != NULL); |
| 625 if (def->IsMaterializeObject()) { |
| 626 def->AsMaterializeObject()->RemapRegisters(fpu_reg_slots, |
| 627 cpu_reg_slots); |
| 628 } |
614 } | 629 } |
615 } | 630 } |
616 | |
617 return env; | 631 return env; |
618 } | 632 } |
619 | 633 |
620 | 634 |
621 Label* FlowGraphCompiler::AddDeoptStub(intptr_t deopt_id, | 635 Label* FlowGraphCompiler::AddDeoptStub(intptr_t deopt_id, |
622 DeoptReasonId reason) { | 636 DeoptReasonId reason) { |
623 ASSERT(is_optimizing_); | 637 ASSERT(is_optimizing_); |
624 CompilerDeoptInfoWithStub* stub = | 638 CompilerDeoptInfoWithStub* stub = |
625 new CompilerDeoptInfoWithStub(deopt_id, | 639 new CompilerDeoptInfoWithStub(deopt_id, |
626 reason, | 640 reason, |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 | 1295 |
1282 for (int i = 0; i < len; i++) { | 1296 for (int i = 0; i < len; i++) { |
1283 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), | 1297 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), |
1284 &Function::ZoneHandle(ic_data.GetTargetAt(i)), | 1298 &Function::ZoneHandle(ic_data.GetTargetAt(i)), |
1285 ic_data.GetCountAt(i))); | 1299 ic_data.GetCountAt(i))); |
1286 } | 1300 } |
1287 sorted->Sort(HighestCountFirst); | 1301 sorted->Sort(HighestCountFirst); |
1288 } | 1302 } |
1289 | 1303 |
1290 } // namespace dart | 1304 } // namespace dart |
OLD | NEW |