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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
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 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 } else { | 986 } else { |
987 __ AddImmediate(A2, FP, kFirstLocalSlotFromFp * kWordSize); | 987 __ AddImmediate(A2, FP, kFirstLocalSlotFromFp * kWordSize); |
988 } | 988 } |
989 // Compute the effective address. When running under the simulator, | 989 // Compute the effective address. When running under the simulator, |
990 // this is a redirection address that forces the simulator to call | 990 // this is a redirection address that forces the simulator to call |
991 // into the runtime system. | 991 // into the runtime system. |
992 uword entry = reinterpret_cast<uword>(native_c_function()); | 992 uword entry = reinterpret_cast<uword>(native_c_function()); |
993 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); | 993 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); |
994 const bool is_leaf_call = | 994 const bool is_leaf_call = |
995 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; | 995 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; |
996 StubCode* stub_code = compiler->isolate()->stub_code(); | |
997 const ExternalLabel* stub_entry; | 996 const ExternalLabel* stub_entry; |
998 if (is_bootstrap_native() || is_leaf_call) { | 997 if (is_bootstrap_native() || is_leaf_call) { |
999 stub_entry = &stub_code->CallBootstrapCFunctionLabel(); | 998 stub_entry = &StubCode::CallBootstrapCFunctionLabel(); |
1000 #if defined(USING_SIMULATOR) | 999 #if defined(USING_SIMULATOR) |
1001 entry = Simulator::RedirectExternalReference( | 1000 entry = Simulator::RedirectExternalReference( |
1002 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); | 1001 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); |
1003 #endif | 1002 #endif |
1004 } else { | 1003 } else { |
1005 // In the case of non bootstrap native methods the CallNativeCFunction | 1004 // In the case of non bootstrap native methods the CallNativeCFunction |
1006 // stub generates the redirection address when running under the simulator | 1005 // stub generates the redirection address when running under the simulator |
1007 // and hence we do not change 'entry' here. | 1006 // and hence we do not change 'entry' here. |
1008 stub_entry = &stub_code->CallNativeCFunctionLabel(); | 1007 stub_entry = &StubCode::CallNativeCFunctionLabel(); |
1009 #if defined(USING_SIMULATOR) | 1008 #if defined(USING_SIMULATOR) |
1010 if (!function().IsNativeAutoSetupScope()) { | 1009 if (!function().IsNativeAutoSetupScope()) { |
1011 entry = Simulator::RedirectExternalReference( | 1010 entry = Simulator::RedirectExternalReference( |
1012 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); | 1011 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); |
1013 } | 1012 } |
1014 #endif | 1013 #endif |
1015 } | 1014 } |
1016 __ LoadImmediate(T5, entry); | 1015 __ LoadImmediate(T5, entry); |
1017 __ LoadImmediate(A1, argc_tag); | 1016 __ LoadImmediate(A1, argc_tag); |
1018 compiler->GenerateCall(token_pos(), | 1017 compiler->GenerateCall(token_pos(), |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1831 public: | 1830 public: |
1832 BoxAllocationSlowPath(Instruction* instruction, | 1831 BoxAllocationSlowPath(Instruction* instruction, |
1833 const Class& cls, | 1832 const Class& cls, |
1834 Register result) | 1833 Register result) |
1835 : instruction_(instruction), | 1834 : instruction_(instruction), |
1836 cls_(cls), | 1835 cls_(cls), |
1837 result_(result) { } | 1836 result_(result) { } |
1838 | 1837 |
1839 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 1838 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
1840 Isolate* isolate = compiler->isolate(); | 1839 Isolate* isolate = compiler->isolate(); |
1841 StubCode* stub_code = isolate->stub_code(); | |
1842 | 1840 |
1843 if (Assembler::EmittingComments()) { | 1841 if (Assembler::EmittingComments()) { |
1844 __ Comment("%s slow path allocation of %s", | 1842 __ Comment("%s slow path allocation of %s", |
1845 instruction_->DebugName(), | 1843 instruction_->DebugName(), |
1846 String::Handle(cls_.PrettyName()).ToCString()); | 1844 String::Handle(cls_.PrettyName()).ToCString()); |
1847 } | 1845 } |
1848 __ Bind(entry_label()); | 1846 __ Bind(entry_label()); |
1849 const Code& stub = | 1847 const Code& stub = |
1850 Code::Handle(isolate, stub_code->GetAllocationStubForClass(cls_)); | 1848 Code::Handle(isolate, StubCode::GetAllocationStubForClass(cls_)); |
1851 const ExternalLabel label(stub.EntryPoint()); | 1849 const ExternalLabel label(stub.EntryPoint()); |
1852 | 1850 |
1853 LocationSummary* locs = instruction_->locs(); | 1851 LocationSummary* locs = instruction_->locs(); |
1854 locs->live_registers()->Remove(Location::RegisterLocation(result_)); | 1852 locs->live_registers()->Remove(Location::RegisterLocation(result_)); |
1855 | 1853 |
1856 compiler->SaveLiveRegisters(locs); | 1854 compiler->SaveLiveRegisters(locs); |
1857 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. | 1855 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. |
1858 &label, | 1856 &label, |
1859 RawPcDescriptors::kOther, | 1857 RawPcDescriptors::kOther, |
1860 locs); | 1858 locs); |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2239 2, | 2237 2, |
2240 locs()); | 2238 locs()); |
2241 __ Drop(2); | 2239 __ Drop(2); |
2242 __ Pop(kResultReg); | 2240 __ Pop(kResultReg); |
2243 __ Bind(&done); | 2241 __ Bind(&done); |
2244 return; | 2242 return; |
2245 } | 2243 } |
2246 } | 2244 } |
2247 | 2245 |
2248 __ Bind(&slow_path); | 2246 __ Bind(&slow_path); |
2249 Isolate* isolate = compiler->isolate(); | 2247 const ExternalLabel label(StubCode::AllocateArrayEntryPoint()); |
2250 const Code& stub = Code::Handle( | |
2251 isolate, isolate->stub_code()->GetAllocateArrayStub()); | |
2252 const ExternalLabel label(stub.EntryPoint()); | |
2253 compiler->GenerateCall(token_pos(), | 2248 compiler->GenerateCall(token_pos(), |
2254 &label, | 2249 &label, |
2255 RawPcDescriptors::kOther, | 2250 RawPcDescriptors::kOther, |
2256 locs()); | 2251 locs()); |
2257 compiler->AddStubCallTarget(stub); | |
2258 __ Bind(&done); | 2252 __ Bind(&done); |
2259 ASSERT(locs()->out(0).reg() == kResultReg); | 2253 ASSERT(locs()->out(0).reg() == kResultReg); |
2260 } | 2254 } |
2261 | 2255 |
2262 | 2256 |
2263 LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, | 2257 LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, |
2264 bool opt) const { | 2258 bool opt) const { |
2265 const intptr_t kNumInputs = 1; | 2259 const intptr_t kNumInputs = 1; |
2266 const intptr_t kNumTemps = | 2260 const intptr_t kNumTemps = |
2267 (IsUnboxedLoad() && opt) ? 1 : | 2261 (IsUnboxedLoad() && opt) ? 1 : |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2493 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 2487 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
2494 __ Comment("AllocateContextSlowPath"); | 2488 __ Comment("AllocateContextSlowPath"); |
2495 __ Bind(entry_label()); | 2489 __ Bind(entry_label()); |
2496 | 2490 |
2497 LocationSummary* locs = instruction_->locs(); | 2491 LocationSummary* locs = instruction_->locs(); |
2498 locs->live_registers()->Remove(locs->out(0)); | 2492 locs->live_registers()->Remove(locs->out(0)); |
2499 | 2493 |
2500 compiler->SaveLiveRegisters(locs); | 2494 compiler->SaveLiveRegisters(locs); |
2501 | 2495 |
2502 __ LoadImmediate(T1, instruction_->num_context_variables()); | 2496 __ LoadImmediate(T1, instruction_->num_context_variables()); |
2503 StubCode* stub_code = compiler->isolate()->stub_code(); | 2497 const ExternalLabel label(StubCode::AllocateContextEntryPoint()); |
2504 const ExternalLabel label(stub_code->AllocateContextEntryPoint()); | |
2505 compiler->GenerateCall(instruction_->token_pos(), | 2498 compiler->GenerateCall(instruction_->token_pos(), |
2506 &label, | 2499 &label, |
2507 RawPcDescriptors::kOther, | 2500 RawPcDescriptors::kOther, |
2508 locs); | 2501 locs); |
2509 ASSERT(instruction_->locs()->out(0).reg() == V0); | 2502 ASSERT(instruction_->locs()->out(0).reg() == V0); |
2510 compiler->RestoreLiveRegisters(instruction_->locs()); | 2503 compiler->RestoreLiveRegisters(instruction_->locs()); |
2511 __ b(exit_label()); | 2504 __ b(exit_label()); |
2512 } | 2505 } |
2513 | 2506 |
2514 private: | 2507 private: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2552 return locs; | 2545 return locs; |
2553 } | 2546 } |
2554 | 2547 |
2555 | 2548 |
2556 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2549 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2557 ASSERT(locs()->temp(0).reg() == T1); | 2550 ASSERT(locs()->temp(0).reg() == T1); |
2558 ASSERT(locs()->out(0).reg() == V0); | 2551 ASSERT(locs()->out(0).reg() == V0); |
2559 | 2552 |
2560 __ Comment("AllocateContextInstr"); | 2553 __ Comment("AllocateContextInstr"); |
2561 __ LoadImmediate(T1, num_context_variables()); | 2554 __ LoadImmediate(T1, num_context_variables()); |
2562 StubCode* stub_code = compiler->isolate()->stub_code(); | 2555 const ExternalLabel label(StubCode::AllocateContextEntryPoint()); |
2563 const ExternalLabel label(stub_code->AllocateContextEntryPoint()); | |
2564 compiler->GenerateCall(token_pos(), | 2556 compiler->GenerateCall(token_pos(), |
2565 &label, | 2557 &label, |
2566 RawPcDescriptors::kOther, | 2558 RawPcDescriptors::kOther, |
2567 locs()); | 2559 locs()); |
2568 } | 2560 } |
2569 | 2561 |
2570 | 2562 |
2571 LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone, | 2563 LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone, |
2572 bool opt) const { | 2564 bool opt) const { |
2573 const intptr_t kNumInputs = 1; | 2565 const intptr_t kNumInputs = 1; |
(...skipping 2963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5537 | 5529 |
5538 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Zone* zone, | 5530 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Zone* zone, |
5539 bool opt) const { | 5531 bool opt) const { |
5540 return MakeCallSummary(zone); | 5532 return MakeCallSummary(zone); |
5541 } | 5533 } |
5542 | 5534 |
5543 | 5535 |
5544 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5536 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
5545 __ Comment("AllocateObjectInstr"); | 5537 __ Comment("AllocateObjectInstr"); |
5546 Isolate* isolate = compiler->isolate(); | 5538 Isolate* isolate = compiler->isolate(); |
5547 StubCode* stub_code = isolate->stub_code(); | |
5548 const Code& stub = Code::Handle(isolate, | 5539 const Code& stub = Code::Handle(isolate, |
5549 stub_code->GetAllocationStubForClass(cls())); | 5540 StubCode::GetAllocationStubForClass(cls())); |
5550 const ExternalLabel label(stub.EntryPoint()); | 5541 const ExternalLabel label(stub.EntryPoint()); |
5551 compiler->GenerateCall(token_pos(), | 5542 compiler->GenerateCall(token_pos(), |
5552 &label, | 5543 &label, |
5553 RawPcDescriptors::kOther, | 5544 RawPcDescriptors::kOther, |
5554 locs()); | 5545 locs()); |
5555 compiler->AddStubCallTarget(stub); | 5546 compiler->AddStubCallTarget(stub); |
5556 __ Drop(ArgumentCount()); // Discard arguments. | 5547 __ Drop(ArgumentCount()); // Discard arguments. |
5557 } | 5548 } |
5558 | 5549 |
5559 | 5550 |
5560 void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5551 void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
5561 ASSERT(!compiler->is_optimizing()); | 5552 ASSERT(!compiler->is_optimizing()); |
5562 StubCode* stub_code = compiler->isolate()->stub_code(); | 5553 const ExternalLabel label(StubCode::DebugStepCheckEntryPoint()); |
5563 const ExternalLabel label(stub_code->DebugStepCheckEntryPoint()); | |
5564 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 5554 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); |
5565 } | 5555 } |
5566 | 5556 |
5567 | 5557 |
5568 LocationSummary* GrowRegExpStackInstr::MakeLocationSummary( | 5558 LocationSummary* GrowRegExpStackInstr::MakeLocationSummary( |
5569 Zone* zone, bool opt) const { | 5559 Zone* zone, bool opt) const { |
5570 const intptr_t kNumInputs = 1; | 5560 const intptr_t kNumInputs = 1; |
5571 const intptr_t kNumTemps = 0; | 5561 const intptr_t kNumTemps = 0; |
5572 LocationSummary* locs = new(zone) LocationSummary( | 5562 LocationSummary* locs = new(zone) LocationSummary( |
5573 zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 5563 zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
(...skipping 17 matching lines...) Expand all Loading... |
5591 1, | 5581 1, |
5592 locs()); | 5582 locs()); |
5593 __ lw(result, Address(SP, 1 * kWordSize)); | 5583 __ lw(result, Address(SP, 1 * kWordSize)); |
5594 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 5584 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
5595 } | 5585 } |
5596 | 5586 |
5597 | 5587 |
5598 } // namespace dart | 5588 } // namespace dart |
5599 | 5589 |
5600 #endif // defined TARGET_ARCH_MIPS | 5590 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |