| 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 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 } else { | 876 } else { |
| 877 __ AddImmediate(A2, FP, kFirstLocalSlotFromFp * kWordSize); | 877 __ AddImmediate(A2, FP, kFirstLocalSlotFromFp * kWordSize); |
| 878 } | 878 } |
| 879 // Compute the effective address. When running under the simulator, | 879 // Compute the effective address. When running under the simulator, |
| 880 // this is a redirection address that forces the simulator to call | 880 // this is a redirection address that forces the simulator to call |
| 881 // into the runtime system. | 881 // into the runtime system. |
| 882 uword entry = reinterpret_cast<uword>(native_c_function()); | 882 uword entry = reinterpret_cast<uword>(native_c_function()); |
| 883 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); | 883 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); |
| 884 const bool is_leaf_call = | 884 const bool is_leaf_call = |
| 885 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; | 885 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; |
| 886 StubCode* stub_code = compiler->isolate()->stub_code(); |
| 886 const ExternalLabel* stub_entry; | 887 const ExternalLabel* stub_entry; |
| 887 if (is_bootstrap_native() || is_leaf_call) { | 888 if (is_bootstrap_native() || is_leaf_call) { |
| 888 stub_entry = &StubCode::CallBootstrapCFunctionLabel(); | 889 stub_entry = &stub_code->CallBootstrapCFunctionLabel(); |
| 889 #if defined(USING_SIMULATOR) | 890 #if defined(USING_SIMULATOR) |
| 890 entry = Simulator::RedirectExternalReference( | 891 entry = Simulator::RedirectExternalReference( |
| 891 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); | 892 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); |
| 892 #endif | 893 #endif |
| 893 } else { | 894 } else { |
| 894 // In the case of non bootstrap native methods the CallNativeCFunction | 895 // In the case of non bootstrap native methods the CallNativeCFunction |
| 895 // stub generates the redirection address when running under the simulator | 896 // stub generates the redirection address when running under the simulator |
| 896 // and hence we do not change 'entry' here. | 897 // and hence we do not change 'entry' here. |
| 897 stub_entry = &StubCode::CallNativeCFunctionLabel(); | 898 stub_entry = &stub_code->CallNativeCFunctionLabel(); |
| 898 #if defined(USING_SIMULATOR) | 899 #if defined(USING_SIMULATOR) |
| 899 if (!function().IsNativeAutoSetupScope()) { | 900 if (!function().IsNativeAutoSetupScope()) { |
| 900 entry = Simulator::RedirectExternalReference( | 901 entry = Simulator::RedirectExternalReference( |
| 901 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); | 902 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); |
| 902 } | 903 } |
| 903 #endif | 904 #endif |
| 904 } | 905 } |
| 905 __ LoadImmediate(T5, entry); | 906 __ LoadImmediate(T5, entry); |
| 906 __ LoadImmediate(A1, argc_tag); | 907 __ LoadImmediate(A1, argc_tag); |
| 907 compiler->GenerateCall(token_pos(), | 908 compiler->GenerateCall(token_pos(), |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1715 } | 1716 } |
| 1716 | 1717 |
| 1717 | 1718 |
| 1718 class StoreInstanceFieldSlowPath : public SlowPathCode { | 1719 class StoreInstanceFieldSlowPath : public SlowPathCode { |
| 1719 public: | 1720 public: |
| 1720 StoreInstanceFieldSlowPath(StoreInstanceFieldInstr* instruction, | 1721 StoreInstanceFieldSlowPath(StoreInstanceFieldInstr* instruction, |
| 1721 const Class& cls) | 1722 const Class& cls) |
| 1722 : instruction_(instruction), cls_(cls) { } | 1723 : instruction_(instruction), cls_(cls) { } |
| 1723 | 1724 |
| 1724 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 1725 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1726 Isolate* isolate = compiler->isolate(); |
| 1727 StubCode* stub_code = isolate->stub_code(); |
| 1728 |
| 1725 __ Comment("StoreInstanceFieldSlowPath"); | 1729 __ Comment("StoreInstanceFieldSlowPath"); |
| 1726 __ Bind(entry_label()); | 1730 __ Bind(entry_label()); |
| 1727 const Code& stub = | 1731 const Code& stub = |
| 1728 Code::Handle(StubCode::GetAllocationStubForClass(cls_)); | 1732 Code::Handle(isolate, stub_code->GetAllocationStubForClass(cls_)); |
| 1729 const ExternalLabel label(stub.EntryPoint()); | 1733 const ExternalLabel label(stub.EntryPoint()); |
| 1730 | 1734 |
| 1731 LocationSummary* locs = instruction_->locs(); | 1735 LocationSummary* locs = instruction_->locs(); |
| 1732 locs->live_registers()->Remove(locs->out(0)); | 1736 locs->live_registers()->Remove(locs->out(0)); |
| 1733 | 1737 |
| 1734 compiler->SaveLiveRegisters(locs); | 1738 compiler->SaveLiveRegisters(locs); |
| 1735 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. | 1739 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. |
| 1736 &label, | 1740 &label, |
| 1737 PcDescriptors::kOther, | 1741 PcDescriptors::kOther, |
| 1738 locs); | 1742 locs); |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2104 2, | 2108 2, |
| 2105 locs()); | 2109 locs()); |
| 2106 __ Drop(2); | 2110 __ Drop(2); |
| 2107 __ Pop(kResultReg); | 2111 __ Pop(kResultReg); |
| 2108 __ Bind(&done); | 2112 __ Bind(&done); |
| 2109 return; | 2113 return; |
| 2110 } | 2114 } |
| 2111 } | 2115 } |
| 2112 | 2116 |
| 2113 __ Bind(&slow_path); | 2117 __ Bind(&slow_path); |
| 2118 StubCode* stub_code = compiler->isolate()->stub_code(); |
| 2114 compiler->GenerateCall(token_pos(), | 2119 compiler->GenerateCall(token_pos(), |
| 2115 &StubCode::AllocateArrayLabel(), | 2120 &stub_code->AllocateArrayLabel(), |
| 2116 PcDescriptors::kOther, | 2121 PcDescriptors::kOther, |
| 2117 locs()); | 2122 locs()); |
| 2118 __ Bind(&done); | 2123 __ Bind(&done); |
| 2119 ASSERT(locs()->out(0).reg() == kResultReg); | 2124 ASSERT(locs()->out(0).reg() == kResultReg); |
| 2120 } | 2125 } |
| 2121 | 2126 |
| 2122 | 2127 |
| 2123 class BoxDoubleSlowPath : public SlowPathCode { | 2128 class BoxDoubleSlowPath : public SlowPathCode { |
| 2124 public: | 2129 public: |
| 2125 explicit BoxDoubleSlowPath(Instruction* instruction) | 2130 explicit BoxDoubleSlowPath(Instruction* instruction) |
| 2126 : instruction_(instruction) { } | 2131 : instruction_(instruction) { } |
| 2127 | 2132 |
| 2128 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 2133 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2129 __ Comment("BoxDoubleSlowPath"); | 2134 __ Comment("BoxDoubleSlowPath"); |
| 2130 __ Bind(entry_label()); | 2135 __ Bind(entry_label()); |
| 2136 Isolate* isolate = compiler->isolate(); |
| 2137 StubCode* stub_code = isolate->stub_code(); |
| 2131 const Class& double_class = compiler->double_class(); | 2138 const Class& double_class = compiler->double_class(); |
| 2132 const Code& stub = | 2139 const Code& stub = |
| 2133 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); | 2140 Code::Handle(isolate, |
| 2141 stub_code->GetAllocationStubForClass(double_class)); |
| 2134 const ExternalLabel label(stub.EntryPoint()); | 2142 const ExternalLabel label(stub.EntryPoint()); |
| 2135 | 2143 |
| 2136 LocationSummary* locs = instruction_->locs(); | 2144 LocationSummary* locs = instruction_->locs(); |
| 2137 locs->live_registers()->Remove(locs->out(0)); | 2145 locs->live_registers()->Remove(locs->out(0)); |
| 2138 | 2146 |
| 2139 compiler->SaveLiveRegisters(locs); | 2147 compiler->SaveLiveRegisters(locs); |
| 2140 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. | 2148 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. |
| 2141 &label, | 2149 &label, |
| 2142 PcDescriptors::kOther, | 2150 PcDescriptors::kOther, |
| 2143 locs); | 2151 locs); |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2378 } | 2386 } |
| 2379 | 2387 |
| 2380 | 2388 |
| 2381 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2389 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2382 Register temp = T1; | 2390 Register temp = T1; |
| 2383 ASSERT(locs()->temp(0).reg() == temp); | 2391 ASSERT(locs()->temp(0).reg() == temp); |
| 2384 ASSERT(locs()->out(0).reg() == V0); | 2392 ASSERT(locs()->out(0).reg() == V0); |
| 2385 | 2393 |
| 2386 __ TraceSimMsg("AllocateContextInstr"); | 2394 __ TraceSimMsg("AllocateContextInstr"); |
| 2387 __ LoadImmediate(temp, num_context_variables()); | 2395 __ LoadImmediate(temp, num_context_variables()); |
| 2388 const ExternalLabel label(StubCode::AllocateContextEntryPoint()); | 2396 StubCode* stub_code = compiler->isolate()->stub_code(); |
| 2397 const ExternalLabel label(stub_code->AllocateContextEntryPoint()); |
| 2389 compiler->GenerateCall(token_pos(), | 2398 compiler->GenerateCall(token_pos(), |
| 2390 &label, | 2399 &label, |
| 2391 PcDescriptors::kOther, | 2400 PcDescriptors::kOther, |
| 2392 locs()); | 2401 locs()); |
| 2393 } | 2402 } |
| 2394 | 2403 |
| 2395 | 2404 |
| 2396 LocationSummary* CloneContextInstr::MakeLocationSummary(Isolate* isolate, | 2405 LocationSummary* CloneContextInstr::MakeLocationSummary(Isolate* isolate, |
| 2397 bool opt) const { | 2406 bool opt) const { |
| 2398 const intptr_t kNumInputs = 1; | 2407 const intptr_t kNumInputs = 1; |
| (...skipping 2273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4672 | 4681 |
| 4673 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Isolate* isolate, | 4682 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Isolate* isolate, |
| 4674 bool opt) const { | 4683 bool opt) const { |
| 4675 return MakeCallSummary(); | 4684 return MakeCallSummary(); |
| 4676 } | 4685 } |
| 4677 | 4686 |
| 4678 | 4687 |
| 4679 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4688 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4680 __ TraceSimMsg("AllocateObjectInstr"); | 4689 __ TraceSimMsg("AllocateObjectInstr"); |
| 4681 __ Comment("AllocateObjectInstr"); | 4690 __ Comment("AllocateObjectInstr"); |
| 4682 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls())); | 4691 Isolate* isolate = compiler->isolate(); |
| 4692 StubCode* stub_code = isolate->stub_code(); |
| 4693 const Code& stub = Code::Handle(isolate, |
| 4694 stub_code->GetAllocationStubForClass(cls())); |
| 4683 const ExternalLabel label(stub.EntryPoint()); | 4695 const ExternalLabel label(stub.EntryPoint()); |
| 4684 compiler->GenerateCall(token_pos(), | 4696 compiler->GenerateCall(token_pos(), |
| 4685 &label, | 4697 &label, |
| 4686 PcDescriptors::kOther, | 4698 PcDescriptors::kOther, |
| 4687 locs()); | 4699 locs()); |
| 4688 __ Drop(ArgumentCount()); // Discard arguments. | 4700 __ Drop(ArgumentCount()); // Discard arguments. |
| 4689 } | 4701 } |
| 4690 | 4702 |
| 4691 | 4703 |
| 4692 void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4704 void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4693 ASSERT(!compiler->is_optimizing()); | 4705 ASSERT(!compiler->is_optimizing()); |
| 4694 const ExternalLabel label(StubCode::DebugStepCheckEntryPoint()); | 4706 StubCode* stub_code = compiler->isolate()->stub_code(); |
| 4707 const ExternalLabel label(stub_code->DebugStepCheckEntryPoint()); |
| 4695 __ LoadImmediate(S4, 0); | 4708 __ LoadImmediate(S4, 0); |
| 4696 __ LoadImmediate(S5, 0); | 4709 __ LoadImmediate(S5, 0); |
| 4697 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 4710 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); |
| 4698 #if defined(DEBUG) | 4711 #if defined(DEBUG) |
| 4699 __ LoadImmediate(S4, kInvalidObjectPointer); | 4712 __ LoadImmediate(S4, kInvalidObjectPointer); |
| 4700 __ LoadImmediate(S5, kInvalidObjectPointer); | 4713 __ LoadImmediate(S5, kInvalidObjectPointer); |
| 4701 #endif | 4714 #endif |
| 4702 } | 4715 } |
| 4703 | 4716 |
| 4704 } // namespace dart | 4717 } // namespace dart |
| 4705 | 4718 |
| 4706 #endif // defined TARGET_ARCH_MIPS | 4719 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |