| 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 __ LoadObject(S4, arguments_descriptor); | 232 __ LoadObject(S4, arguments_descriptor); |
| 233 | 233 |
| 234 // Load closure function code in T2. | 234 // Load closure function code in T2. |
| 235 // S4: arguments descriptor array. | 235 // S4: arguments descriptor array. |
| 236 // S5: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). | 236 // S5: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). |
| 237 ASSERT(locs()->in(0).reg() == T0); | 237 ASSERT(locs()->in(0).reg() == T0); |
| 238 __ LoadImmediate(S5, 0); | 238 __ LoadImmediate(S5, 0); |
| 239 __ lw(T2, FieldAddress(T0, Function::instructions_offset())); | 239 __ lw(T2, FieldAddress(T0, Function::instructions_offset())); |
| 240 __ AddImmediate(T2, Instructions::HeaderSize() - kHeapObjectTag); | 240 __ AddImmediate(T2, Instructions::HeaderSize() - kHeapObjectTag); |
| 241 __ jalr(T2); | 241 __ jalr(T2); |
| 242 compiler->AddCurrentDescriptor(PcDescriptors::kClosureCall, | 242 compiler->AddCurrentDescriptor(RawPcDescriptors::kClosureCall, |
| 243 deopt_id(), | 243 deopt_id(), |
| 244 token_pos()); | 244 token_pos()); |
| 245 compiler->RecordSafepoint(locs()); | 245 compiler->RecordSafepoint(locs()); |
| 246 // Marks either the continuation point in unoptimized code or the | 246 // Marks either the continuation point in unoptimized code or the |
| 247 // deoptimization point in optimized code, after call. | 247 // deoptimization point in optimized code, after call. |
| 248 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id()); | 248 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id()); |
| 249 if (compiler->is_optimizing()) { | 249 if (compiler->is_optimizing()) { |
| 250 compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos()); | 250 compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos()); |
| 251 } else { | 251 } else { |
| 252 // Add deoptimization continuation point after the call and before the | 252 // Add deoptimization continuation point after the call and before the |
| 253 // arguments are removed. | 253 // arguments are removed. |
| 254 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 254 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
| 255 deopt_id_after, | 255 deopt_id_after, |
| 256 token_pos()); | 256 token_pos()); |
| 257 } | 257 } |
| 258 __ Drop(argument_count); | 258 __ Drop(argument_count); |
| 259 } | 259 } |
| 260 | 260 |
| 261 | 261 |
| 262 LocationSummary* LoadLocalInstr::MakeLocationSummary(Isolate* isolate, | 262 LocationSummary* LoadLocalInstr::MakeLocationSummary(Isolate* isolate, |
| 263 bool opt) const { | 263 bool opt) const { |
| 264 return LocationSummary::Make(isolate, | 264 return LocationSummary::Make(isolate, |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 if (!function().IsNativeAutoSetupScope()) { | 899 if (!function().IsNativeAutoSetupScope()) { |
| 900 entry = Simulator::RedirectExternalReference( | 900 entry = Simulator::RedirectExternalReference( |
| 901 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); | 901 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); |
| 902 } | 902 } |
| 903 #endif | 903 #endif |
| 904 } | 904 } |
| 905 __ LoadImmediate(T5, entry); | 905 __ LoadImmediate(T5, entry); |
| 906 __ LoadImmediate(A1, argc_tag); | 906 __ LoadImmediate(A1, argc_tag); |
| 907 compiler->GenerateCall(token_pos(), | 907 compiler->GenerateCall(token_pos(), |
| 908 stub_entry, | 908 stub_entry, |
| 909 PcDescriptors::kOther, | 909 RawPcDescriptors::kOther, |
| 910 locs()); | 910 locs()); |
| 911 __ Pop(result); | 911 __ Pop(result); |
| 912 } | 912 } |
| 913 | 913 |
| 914 | 914 |
| 915 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(Isolate* isolate, | 915 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(Isolate* isolate, |
| 916 bool opt) const { | 916 bool opt) const { |
| 917 const intptr_t kNumInputs = 1; | 917 const intptr_t kNumInputs = 1; |
| 918 // TODO(fschneider): Allow immediate operands for the char code. | 918 // TODO(fschneider): Allow immediate operands for the char code. |
| 919 return LocationSummary::Make(isolate, | 919 return LocationSummary::Make(isolate, |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1727 const Code& stub = | 1727 const Code& stub = |
| 1728 Code::Handle(StubCode::GetAllocationStubForClass(cls_)); | 1728 Code::Handle(StubCode::GetAllocationStubForClass(cls_)); |
| 1729 const ExternalLabel label(stub.EntryPoint()); | 1729 const ExternalLabel label(stub.EntryPoint()); |
| 1730 | 1730 |
| 1731 LocationSummary* locs = instruction_->locs(); | 1731 LocationSummary* locs = instruction_->locs(); |
| 1732 locs->live_registers()->Remove(locs->out(0)); | 1732 locs->live_registers()->Remove(locs->out(0)); |
| 1733 | 1733 |
| 1734 compiler->SaveLiveRegisters(locs); | 1734 compiler->SaveLiveRegisters(locs); |
| 1735 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. | 1735 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. |
| 1736 &label, | 1736 &label, |
| 1737 PcDescriptors::kOther, | 1737 RawPcDescriptors::kOther, |
| 1738 locs); | 1738 locs); |
| 1739 __ mov(locs->temp(0).reg(), V0); | 1739 __ mov(locs->temp(0).reg(), V0); |
| 1740 compiler->RestoreLiveRegisters(locs); | 1740 compiler->RestoreLiveRegisters(locs); |
| 1741 | 1741 |
| 1742 __ b(exit_label()); | 1742 __ b(exit_label()); |
| 1743 } | 1743 } |
| 1744 | 1744 |
| 1745 private: | 1745 private: |
| 1746 StoreInstanceFieldInstr* instruction_; | 1746 StoreInstanceFieldInstr* instruction_; |
| 1747 const Class& cls_; | 1747 const Class& cls_; |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2106 __ Drop(2); | 2106 __ Drop(2); |
| 2107 __ Pop(kResultReg); | 2107 __ Pop(kResultReg); |
| 2108 __ Bind(&done); | 2108 __ Bind(&done); |
| 2109 return; | 2109 return; |
| 2110 } | 2110 } |
| 2111 } | 2111 } |
| 2112 | 2112 |
| 2113 __ Bind(&slow_path); | 2113 __ Bind(&slow_path); |
| 2114 compiler->GenerateCall(token_pos(), | 2114 compiler->GenerateCall(token_pos(), |
| 2115 &StubCode::AllocateArrayLabel(), | 2115 &StubCode::AllocateArrayLabel(), |
| 2116 PcDescriptors::kOther, | 2116 RawPcDescriptors::kOther, |
| 2117 locs()); | 2117 locs()); |
| 2118 __ Bind(&done); | 2118 __ Bind(&done); |
| 2119 ASSERT(locs()->out(0).reg() == kResultReg); | 2119 ASSERT(locs()->out(0).reg() == kResultReg); |
| 2120 } | 2120 } |
| 2121 | 2121 |
| 2122 | 2122 |
| 2123 class BoxDoubleSlowPath : public SlowPathCode { | 2123 class BoxDoubleSlowPath : public SlowPathCode { |
| 2124 public: | 2124 public: |
| 2125 explicit BoxDoubleSlowPath(Instruction* instruction) | 2125 explicit BoxDoubleSlowPath(Instruction* instruction) |
| 2126 : instruction_(instruction) { } | 2126 : instruction_(instruction) { } |
| 2127 | 2127 |
| 2128 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 2128 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2129 __ Comment("BoxDoubleSlowPath"); | 2129 __ Comment("BoxDoubleSlowPath"); |
| 2130 __ Bind(entry_label()); | 2130 __ Bind(entry_label()); |
| 2131 const Class& double_class = compiler->double_class(); | 2131 const Class& double_class = compiler->double_class(); |
| 2132 const Code& stub = | 2132 const Code& stub = |
| 2133 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); | 2133 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); |
| 2134 const ExternalLabel label(stub.EntryPoint()); | 2134 const ExternalLabel label(stub.EntryPoint()); |
| 2135 | 2135 |
| 2136 LocationSummary* locs = instruction_->locs(); | 2136 LocationSummary* locs = instruction_->locs(); |
| 2137 locs->live_registers()->Remove(locs->out(0)); | 2137 locs->live_registers()->Remove(locs->out(0)); |
| 2138 | 2138 |
| 2139 compiler->SaveLiveRegisters(locs); | 2139 compiler->SaveLiveRegisters(locs); |
| 2140 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. | 2140 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. |
| 2141 &label, | 2141 &label, |
| 2142 PcDescriptors::kOther, | 2142 RawPcDescriptors::kOther, |
| 2143 locs); | 2143 locs); |
| 2144 if (locs->out(0).reg() != V0) { | 2144 if (locs->out(0).reg() != V0) { |
| 2145 __ mov(locs->out(0).reg(), V0); | 2145 __ mov(locs->out(0).reg(), V0); |
| 2146 } | 2146 } |
| 2147 compiler->RestoreLiveRegisters(locs); | 2147 compiler->RestoreLiveRegisters(locs); |
| 2148 | 2148 |
| 2149 __ b(exit_label()); | 2149 __ b(exit_label()); |
| 2150 } | 2150 } |
| 2151 | 2151 |
| 2152 private: | 2152 private: |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2381 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2381 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2382 Register temp = T1; | 2382 Register temp = T1; |
| 2383 ASSERT(locs()->temp(0).reg() == temp); | 2383 ASSERT(locs()->temp(0).reg() == temp); |
| 2384 ASSERT(locs()->out(0).reg() == V0); | 2384 ASSERT(locs()->out(0).reg() == V0); |
| 2385 | 2385 |
| 2386 __ TraceSimMsg("AllocateContextInstr"); | 2386 __ TraceSimMsg("AllocateContextInstr"); |
| 2387 __ LoadImmediate(temp, num_context_variables()); | 2387 __ LoadImmediate(temp, num_context_variables()); |
| 2388 const ExternalLabel label(StubCode::AllocateContextEntryPoint()); | 2388 const ExternalLabel label(StubCode::AllocateContextEntryPoint()); |
| 2389 compiler->GenerateCall(token_pos(), | 2389 compiler->GenerateCall(token_pos(), |
| 2390 &label, | 2390 &label, |
| 2391 PcDescriptors::kOther, | 2391 RawPcDescriptors::kOther, |
| 2392 locs()); | 2392 locs()); |
| 2393 } | 2393 } |
| 2394 | 2394 |
| 2395 | 2395 |
| 2396 LocationSummary* CloneContextInstr::MakeLocationSummary(Isolate* isolate, | 2396 LocationSummary* CloneContextInstr::MakeLocationSummary(Isolate* isolate, |
| 2397 bool opt) const { | 2397 bool opt) const { |
| 2398 const intptr_t kNumInputs = 1; | 2398 const intptr_t kNumInputs = 1; |
| 2399 const intptr_t kNumTemps = 0; | 2399 const intptr_t kNumTemps = 0; |
| 2400 LocationSummary* locs = new(isolate) LocationSummary( | 2400 LocationSummary* locs = new(isolate) LocationSummary( |
| 2401 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); | 2401 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2506 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); | 2506 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); |
| 2507 compiler->pending_deoptimization_env_ = env; | 2507 compiler->pending_deoptimization_env_ = env; |
| 2508 compiler->GenerateRuntimeCall(instruction_->token_pos(), | 2508 compiler->GenerateRuntimeCall(instruction_->token_pos(), |
| 2509 instruction_->deopt_id(), | 2509 instruction_->deopt_id(), |
| 2510 kStackOverflowRuntimeEntry, | 2510 kStackOverflowRuntimeEntry, |
| 2511 0, | 2511 0, |
| 2512 instruction_->locs()); | 2512 instruction_->locs()); |
| 2513 | 2513 |
| 2514 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) { | 2514 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) { |
| 2515 // In unoptimized code, record loop stack checks as possible OSR entries. | 2515 // In unoptimized code, record loop stack checks as possible OSR entries. |
| 2516 compiler->AddCurrentDescriptor(PcDescriptors::kOsrEntry, | 2516 compiler->AddCurrentDescriptor(RawPcDescriptors::kOsrEntry, |
| 2517 instruction_->deopt_id(), | 2517 instruction_->deopt_id(), |
| 2518 0); // No token position. | 2518 0); // No token position. |
| 2519 } | 2519 } |
| 2520 compiler->pending_deoptimization_env_ = NULL; | 2520 compiler->pending_deoptimization_env_ = NULL; |
| 2521 compiler->RestoreLiveRegisters(instruction_->locs()); | 2521 compiler->RestoreLiveRegisters(instruction_->locs()); |
| 2522 __ b(exit_label()); | 2522 __ b(exit_label()); |
| 2523 } | 2523 } |
| 2524 | 2524 |
| 2525 Label* osr_entry_label() { | 2525 Label* osr_entry_label() { |
| 2526 ASSERT(FLAG_use_osr); | 2526 ASSERT(FLAG_use_osr); |
| (...skipping 1976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4503 | 4503 |
| 4504 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4504 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4505 __ Bind(compiler->GetJumpLabel(this)); | 4505 __ Bind(compiler->GetJumpLabel(this)); |
| 4506 if (!compiler->is_optimizing()) { | 4506 if (!compiler->is_optimizing()) { |
| 4507 if (compiler->NeedsEdgeCounter(this)) { | 4507 if (compiler->NeedsEdgeCounter(this)) { |
| 4508 compiler->EmitEdgeCounter(); | 4508 compiler->EmitEdgeCounter(); |
| 4509 } | 4509 } |
| 4510 // On MIPS the deoptimization descriptor points after the edge counter | 4510 // On MIPS the deoptimization descriptor points after the edge counter |
| 4511 // code so that we can reuse the same pattern matching code as at call | 4511 // code so that we can reuse the same pattern matching code as at call |
| 4512 // sites, which matches backwards from the end of the pattern. | 4512 // sites, which matches backwards from the end of the pattern. |
| 4513 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 4513 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
| 4514 deopt_id_, | 4514 deopt_id_, |
| 4515 Scanner::kNoSourcePos); | 4515 Scanner::kNoSourcePos); |
| 4516 } | 4516 } |
| 4517 if (HasParallelMove()) { | 4517 if (HasParallelMove()) { |
| 4518 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 4518 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
| 4519 } | 4519 } |
| 4520 } | 4520 } |
| 4521 | 4521 |
| 4522 | 4522 |
| 4523 LocationSummary* GotoInstr::MakeLocationSummary(Isolate* isolate, | 4523 LocationSummary* GotoInstr::MakeLocationSummary(Isolate* isolate, |
| 4524 bool opt) const { | 4524 bool opt) const { |
| 4525 return new(isolate) LocationSummary(isolate, 0, 0, LocationSummary::kNoCall); | 4525 return new(isolate) LocationSummary(isolate, 0, 0, LocationSummary::kNoCall); |
| 4526 } | 4526 } |
| 4527 | 4527 |
| 4528 | 4528 |
| 4529 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4529 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4530 __ TraceSimMsg("GotoInstr"); | 4530 __ TraceSimMsg("GotoInstr"); |
| 4531 if (!compiler->is_optimizing()) { | 4531 if (!compiler->is_optimizing()) { |
| 4532 if (FLAG_emit_edge_counters) { | 4532 if (FLAG_emit_edge_counters) { |
| 4533 compiler->EmitEdgeCounter(); | 4533 compiler->EmitEdgeCounter(); |
| 4534 } | 4534 } |
| 4535 // Add a deoptimization descriptor for deoptimizing instructions that | 4535 // Add a deoptimization descriptor for deoptimizing instructions that |
| 4536 // may be inserted before this instruction. On MIPS this descriptor | 4536 // may be inserted before this instruction. On MIPS this descriptor |
| 4537 // points after the edge counter code so that we can reuse the same | 4537 // points after the edge counter code so that we can reuse the same |
| 4538 // pattern matching code as at call sites, which matches backwards from | 4538 // pattern matching code as at call sites, which matches backwards from |
| 4539 // the end of the pattern. | 4539 // the end of the pattern. |
| 4540 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 4540 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
| 4541 GetDeoptId(), | 4541 GetDeoptId(), |
| 4542 Scanner::kNoSourcePos); | 4542 Scanner::kNoSourcePos); |
| 4543 } | 4543 } |
| 4544 if (HasParallelMove()) { | 4544 if (HasParallelMove()) { |
| 4545 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 4545 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
| 4546 } | 4546 } |
| 4547 | 4547 |
| 4548 // We can fall through if the successor is the next block in the list. | 4548 // We can fall through if the successor is the next block in the list. |
| 4549 // Otherwise, we need a jump. | 4549 // Otherwise, we need a jump. |
| 4550 if (!compiler->CanFallThroughTo(successor())) { | 4550 if (!compiler->CanFallThroughTo(successor())) { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4676 } | 4676 } |
| 4677 | 4677 |
| 4678 | 4678 |
| 4679 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4679 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4680 __ TraceSimMsg("AllocateObjectInstr"); | 4680 __ TraceSimMsg("AllocateObjectInstr"); |
| 4681 __ Comment("AllocateObjectInstr"); | 4681 __ Comment("AllocateObjectInstr"); |
| 4682 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls())); | 4682 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls())); |
| 4683 const ExternalLabel label(stub.EntryPoint()); | 4683 const ExternalLabel label(stub.EntryPoint()); |
| 4684 compiler->GenerateCall(token_pos(), | 4684 compiler->GenerateCall(token_pos(), |
| 4685 &label, | 4685 &label, |
| 4686 PcDescriptors::kOther, | 4686 RawPcDescriptors::kOther, |
| 4687 locs()); | 4687 locs()); |
| 4688 __ Drop(ArgumentCount()); // Discard arguments. | 4688 __ Drop(ArgumentCount()); // Discard arguments. |
| 4689 } | 4689 } |
| 4690 | 4690 |
| 4691 | 4691 |
| 4692 void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4692 void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4693 ASSERT(!compiler->is_optimizing()); | 4693 ASSERT(!compiler->is_optimizing()); |
| 4694 const ExternalLabel label(StubCode::DebugStepCheckEntryPoint()); | 4694 const ExternalLabel label(StubCode::DebugStepCheckEntryPoint()); |
| 4695 __ LoadImmediate(S4, 0); | 4695 __ LoadImmediate(S4, 0); |
| 4696 __ LoadImmediate(S5, 0); | 4696 __ LoadImmediate(S5, 0); |
| 4697 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 4697 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); |
| 4698 #if defined(DEBUG) | 4698 #if defined(DEBUG) |
| 4699 __ LoadImmediate(S4, kInvalidObjectPointer); | 4699 __ LoadImmediate(S4, kInvalidObjectPointer); |
| 4700 __ LoadImmediate(S5, kInvalidObjectPointer); | 4700 __ LoadImmediate(S5, kInvalidObjectPointer); |
| 4701 #endif | 4701 #endif |
| 4702 } | 4702 } |
| 4703 | 4703 |
| 4704 } // namespace dart | 4704 } // namespace dart |
| 4705 | 4705 |
| 4706 #endif // defined TARGET_ARCH_MIPS | 4706 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |