| 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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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 1640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1651 class BoxAllocationSlowPath : public SlowPathCode { | 1651 class BoxAllocationSlowPath : public SlowPathCode { |
| 1652 public: | 1652 public: |
| 1653 BoxAllocationSlowPath(Instruction* instruction, | 1653 BoxAllocationSlowPath(Instruction* instruction, |
| 1654 const Class& cls, | 1654 const Class& cls, |
| 1655 Register result) | 1655 Register result) |
| 1656 : instruction_(instruction), | 1656 : instruction_(instruction), |
| 1657 cls_(cls), | 1657 cls_(cls), |
| 1658 result_(result) { } | 1658 result_(result) { } |
| 1659 | 1659 |
| 1660 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 1660 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1661 Isolate* isolate = compiler->isolate(); | |
| 1662 | |
| 1663 if (Assembler::EmittingComments()) { | 1661 if (Assembler::EmittingComments()) { |
| 1664 __ Comment("%s slow path allocation of %s", | 1662 __ Comment("%s slow path allocation of %s", |
| 1665 instruction_->DebugName(), | 1663 instruction_->DebugName(), |
| 1666 String::Handle(cls_.PrettyName()).ToCString()); | 1664 String::Handle(cls_.PrettyName()).ToCString()); |
| 1667 } | 1665 } |
| 1668 __ Bind(entry_label()); | 1666 __ Bind(entry_label()); |
| 1669 const Code& stub = | 1667 const Code& stub = Code::ZoneHandle(compiler->zone(), |
| 1670 Code::Handle(isolate, StubCode::GetAllocationStubForClass(cls_)); | 1668 StubCode::GetAllocationStubForClass(cls_)); |
| 1671 const StubEntry stub_entry(stub); | 1669 const StubEntry stub_entry(stub); |
| 1672 | 1670 |
| 1673 LocationSummary* locs = instruction_->locs(); | 1671 LocationSummary* locs = instruction_->locs(); |
| 1674 | 1672 |
| 1675 locs->live_registers()->Remove(Location::RegisterLocation(result_)); | 1673 locs->live_registers()->Remove(Location::RegisterLocation(result_)); |
| 1676 | 1674 |
| 1677 compiler->SaveLiveRegisters(locs); | 1675 compiler->SaveLiveRegisters(locs); |
| 1678 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. | 1676 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. |
| 1679 stub_entry, | 1677 stub_entry, |
| 1680 RawPcDescriptors::kOther, | 1678 RawPcDescriptors::kOther, |
| (...skipping 440 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 __ popq(kResultReg); | 2122 __ popq(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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2394 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 2392 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2395 __ Comment("AllocateContextSlowPath"); | 2393 __ Comment("AllocateContextSlowPath"); |
| 2396 __ Bind(entry_label()); | 2394 __ Bind(entry_label()); |
| 2397 | 2395 |
| 2398 LocationSummary* locs = instruction_->locs(); | 2396 LocationSummary* locs = instruction_->locs(); |
| 2399 locs->live_registers()->Remove(locs->out(0)); | 2397 locs->live_registers()->Remove(locs->out(0)); |
| 2400 | 2398 |
| 2401 compiler->SaveLiveRegisters(locs); | 2399 compiler->SaveLiveRegisters(locs); |
| 2402 | 2400 |
| 2403 __ LoadImmediate(R10, Immediate(instruction_->num_context_variables())); | 2401 __ LoadImmediate(R10, Immediate(instruction_->num_context_variables())); |
| 2404 const Code& stub = Code::Handle(compiler->isolate(), | 2402 const Code& stub = Code::ZoneHandle( |
| 2405 StubCode::AllocateContext_entry()->code()); | 2403 compiler->zone(), StubCode::AllocateContext_entry()->code()); |
| 2406 compiler->AddStubCallTarget(stub); | 2404 compiler->AddStubCallTarget(stub); |
| 2407 compiler->GenerateCall(instruction_->token_pos(), | 2405 compiler->GenerateCall(instruction_->token_pos(), |
| 2408 *StubCode::AllocateContext_entry(), | 2406 *StubCode::AllocateContext_entry(), |
| 2409 RawPcDescriptors::kOther, | 2407 RawPcDescriptors::kOther, |
| 2410 locs); | 2408 locs); |
| 2411 ASSERT(instruction_->locs()->out(0).reg() == RAX); | 2409 ASSERT(instruction_->locs()->out(0).reg() == RAX); |
| 2412 compiler->RestoreLiveRegisters(instruction_->locs()); | 2410 compiler->RestoreLiveRegisters(instruction_->locs()); |
| 2413 __ jmp(exit_label()); | 2411 __ jmp(exit_label()); |
| 2414 } | 2412 } |
| 2415 | 2413 |
| (...skipping 3967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6383 } | 6381 } |
| 6384 | 6382 |
| 6385 | 6383 |
| 6386 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Zone* zone, | 6384 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Zone* zone, |
| 6387 bool opt) const { | 6385 bool opt) const { |
| 6388 return MakeCallSummary(zone); | 6386 return MakeCallSummary(zone); |
| 6389 } | 6387 } |
| 6390 | 6388 |
| 6391 | 6389 |
| 6392 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6390 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6393 Isolate* isolate = compiler->isolate(); | 6391 const Code& stub = Code::ZoneHandle( |
| 6394 const Code& stub = Code::Handle(isolate, | 6392 compiler->zone(), StubCode::GetAllocationStubForClass(cls())); |
| 6395 StubCode::GetAllocationStubForClass(cls())); | |
| 6396 const StubEntry stub_entry(stub); | 6393 const StubEntry stub_entry(stub); |
| 6397 compiler->GenerateCall(token_pos(), | 6394 compiler->GenerateCall(token_pos(), |
| 6398 stub_entry, | 6395 stub_entry, |
| 6399 RawPcDescriptors::kOther, | 6396 RawPcDescriptors::kOther, |
| 6400 locs()); | 6397 locs()); |
| 6401 compiler->AddStubCallTarget(stub); | 6398 compiler->AddStubCallTarget(stub); |
| 6402 __ Drop(ArgumentCount()); // Discard arguments. | 6399 __ Drop(ArgumentCount()); // Discard arguments. |
| 6403 } | 6400 } |
| 6404 | 6401 |
| 6405 | 6402 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 6436 __ Drop(1); | 6433 __ Drop(1); |
| 6437 __ popq(result); | 6434 __ popq(result); |
| 6438 } | 6435 } |
| 6439 | 6436 |
| 6440 | 6437 |
| 6441 } // namespace dart | 6438 } // namespace dart |
| 6442 | 6439 |
| 6443 #undef __ | 6440 #undef __ |
| 6444 | 6441 |
| 6445 #endif // defined TARGET_ARCH_X64 | 6442 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |