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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
7 | 7 |
8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1641 class BoxAllocationSlowPath : public SlowPathCode { | 1641 class BoxAllocationSlowPath : public SlowPathCode { |
1642 public: | 1642 public: |
1643 BoxAllocationSlowPath(Instruction* instruction, | 1643 BoxAllocationSlowPath(Instruction* instruction, |
1644 const Class& cls, | 1644 const Class& cls, |
1645 Register result) | 1645 Register result) |
1646 : instruction_(instruction), | 1646 : instruction_(instruction), |
1647 cls_(cls), | 1647 cls_(cls), |
1648 result_(result) { } | 1648 result_(result) { } |
1649 | 1649 |
1650 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 1650 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
1651 Isolate* isolate = compiler->isolate(); | |
1652 | |
1653 if (Assembler::EmittingComments()) { | 1651 if (Assembler::EmittingComments()) { |
1654 __ Comment("%s slow path allocation of %s", | 1652 __ Comment("%s slow path allocation of %s", |
1655 instruction_->DebugName(), | 1653 instruction_->DebugName(), |
1656 String::Handle(cls_.PrettyName()).ToCString()); | 1654 String::Handle(cls_.PrettyName()).ToCString()); |
1657 } | 1655 } |
1658 __ Bind(entry_label()); | 1656 __ Bind(entry_label()); |
1659 const Code& stub = | 1657 const Code& stub = Code::ZoneHandle( |
1660 Code::Handle(isolate, StubCode::GetAllocationStubForClass(cls_)); | 1658 compiler->zone(), StubCode::GetAllocationStubForClass(cls_)); |
1661 const StubEntry stub_entry(stub); | 1659 const StubEntry stub_entry(stub); |
1662 | 1660 |
1663 LocationSummary* locs = instruction_->locs(); | 1661 LocationSummary* locs = instruction_->locs(); |
1664 | 1662 |
1665 locs->live_registers()->Remove(Location::RegisterLocation(result_)); | 1663 locs->live_registers()->Remove(Location::RegisterLocation(result_)); |
1666 | 1664 |
1667 compiler->SaveLiveRegisters(locs); | 1665 compiler->SaveLiveRegisters(locs); |
1668 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. | 1666 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. |
1669 stub_entry, | 1667 stub_entry, |
1670 RawPcDescriptors::kOther, | 1668 RawPcDescriptors::kOther, |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2121 2, | 2119 2, |
2122 locs()); | 2120 locs()); |
2123 __ Drop(2); | 2121 __ Drop(2); |
2124 __ popl(kResultReg); | 2122 __ popl(kResultReg); |
2125 __ Bind(&done); | 2123 __ Bind(&done); |
2126 return; | 2124 return; |
2127 } | 2125 } |
2128 } | 2126 } |
2129 | 2127 |
2130 __ Bind(&slow_path); | 2128 __ Bind(&slow_path); |
2131 const Code& stub = Code::Handle(compiler->isolate(), | 2129 const Code& stub = Code::ZoneHandle(compiler->zone(), |
2132 StubCode::AllocateArray_entry()->code()); | 2130 StubCode::AllocateArray_entry()->code()); |
2133 compiler->AddStubCallTarget(stub); | 2131 compiler->AddStubCallTarget(stub); |
2134 compiler->GenerateCall(token_pos(), | 2132 compiler->GenerateCall(token_pos(), |
2135 *StubCode::AllocateArray_entry(), | 2133 *StubCode::AllocateArray_entry(), |
2136 RawPcDescriptors::kOther, | 2134 RawPcDescriptors::kOther, |
2137 locs()); | 2135 locs()); |
2138 __ Bind(&done); | 2136 __ Bind(&done); |
2139 ASSERT(locs()->out(0).reg() == kResultReg); | 2137 ASSERT(locs()->out(0).reg() == kResultReg); |
2140 } | 2138 } |
2141 | 2139 |
2142 | 2140 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2396 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 2394 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
2397 __ Comment("AllocateContextSlowPath"); | 2395 __ Comment("AllocateContextSlowPath"); |
2398 __ Bind(entry_label()); | 2396 __ Bind(entry_label()); |
2399 | 2397 |
2400 LocationSummary* locs = instruction_->locs(); | 2398 LocationSummary* locs = instruction_->locs(); |
2401 ASSERT(!locs->live_registers()->Contains(locs->out(0))); | 2399 ASSERT(!locs->live_registers()->Contains(locs->out(0))); |
2402 | 2400 |
2403 compiler->SaveLiveRegisters(locs); | 2401 compiler->SaveLiveRegisters(locs); |
2404 | 2402 |
2405 __ movl(EDX, Immediate(instruction_->num_context_variables())); | 2403 __ movl(EDX, Immediate(instruction_->num_context_variables())); |
2406 const Code& stub = Code::Handle(compiler->isolate(), | 2404 const Code& stub = Code::ZoneHandle( |
2407 StubCode::AllocateContext_entry()->code()); | 2405 compiler->zone(), StubCode::AllocateContext_entry()->code()); |
2408 compiler->AddStubCallTarget(stub); | 2406 compiler->AddStubCallTarget(stub); |
2409 compiler->GenerateCall(instruction_->token_pos(), | 2407 compiler->GenerateCall(instruction_->token_pos(), |
2410 *StubCode::AllocateContext_entry(), | 2408 *StubCode::AllocateContext_entry(), |
2411 RawPcDescriptors::kOther, | 2409 RawPcDescriptors::kOther, |
2412 locs); | 2410 locs); |
2413 ASSERT(instruction_->locs()->out(0).reg() == EAX); | 2411 ASSERT(instruction_->locs()->out(0).reg() == EAX); |
2414 compiler->RestoreLiveRegisters(instruction_->locs()); | 2412 compiler->RestoreLiveRegisters(instruction_->locs()); |
2415 __ jmp(exit_label()); | 2413 __ jmp(exit_label()); |
2416 } | 2414 } |
2417 | 2415 |
(...skipping 4389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6807 } | 6805 } |
6808 | 6806 |
6809 | 6807 |
6810 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Zone* zone, | 6808 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Zone* zone, |
6811 bool opt) const { | 6809 bool opt) const { |
6812 return MakeCallSummary(zone); | 6810 return MakeCallSummary(zone); |
6813 } | 6811 } |
6814 | 6812 |
6815 | 6813 |
6816 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6814 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
6817 Isolate* isolate = compiler->isolate(); | 6815 const Code& stub = Code::ZoneHandle( |
6818 const Code& stub = Code::Handle(isolate, | 6816 compiler->zone(), StubCode::GetAllocationStubForClass(cls())); |
6819 StubCode::GetAllocationStubForClass(cls())); | |
6820 const StubEntry stub_entry(stub); | 6817 const StubEntry stub_entry(stub); |
6821 compiler->GenerateCall(token_pos(), | 6818 compiler->GenerateCall(token_pos(), |
6822 stub_entry, | 6819 stub_entry, |
6823 RawPcDescriptors::kOther, | 6820 RawPcDescriptors::kOther, |
6824 locs()); | 6821 locs()); |
6825 compiler->AddStubCallTarget(stub); | 6822 compiler->AddStubCallTarget(stub); |
6826 __ Drop(ArgumentCount()); // Discard arguments. | 6823 __ Drop(ArgumentCount()); // Discard arguments. |
6827 } | 6824 } |
6828 | 6825 |
6829 | 6826 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6861 __ Drop(1); | 6858 __ Drop(1); |
6862 __ popl(result); | 6859 __ popl(result); |
6863 } | 6860 } |
6864 | 6861 |
6865 | 6862 |
6866 } // namespace dart | 6863 } // namespace dart |
6867 | 6864 |
6868 #undef __ | 6865 #undef __ |
6869 | 6866 |
6870 #endif // defined TARGET_ARCH_IA32 | 6867 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |