Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(897)

Side by Side Diff: runtime/vm/intermediate_language_mips.cc

Issue 356923006: Iterate over PcDescriptors only via iterators, not via an index. (preparation for more compression … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
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
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
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
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 1970 matching lines...) Expand 10 before | Expand all | Expand 10 after
4497 4497
4498 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4498 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4499 __ Bind(compiler->GetJumpLabel(this)); 4499 __ Bind(compiler->GetJumpLabel(this));
4500 if (!compiler->is_optimizing()) { 4500 if (!compiler->is_optimizing()) {
4501 if (compiler->NeedsEdgeCounter(this)) { 4501 if (compiler->NeedsEdgeCounter(this)) {
4502 compiler->EmitEdgeCounter(); 4502 compiler->EmitEdgeCounter();
4503 } 4503 }
4504 // On MIPS the deoptimization descriptor points after the edge counter 4504 // On MIPS the deoptimization descriptor points after the edge counter
4505 // code so that we can reuse the same pattern matching code as at call 4505 // code so that we can reuse the same pattern matching code as at call
4506 // sites, which matches backwards from the end of the pattern. 4506 // sites, which matches backwards from the end of the pattern.
4507 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, 4507 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
4508 deopt_id_, 4508 deopt_id_,
4509 Scanner::kNoSourcePos); 4509 Scanner::kNoSourcePos);
4510 } 4510 }
4511 if (HasParallelMove()) { 4511 if (HasParallelMove()) {
4512 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 4512 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
4513 } 4513 }
4514 } 4514 }
4515 4515
4516 4516
4517 LocationSummary* GotoInstr::MakeLocationSummary(Isolate* isolate, 4517 LocationSummary* GotoInstr::MakeLocationSummary(Isolate* isolate,
4518 bool opt) const { 4518 bool opt) const {
4519 return new(isolate) LocationSummary(isolate, 0, 0, LocationSummary::kNoCall); 4519 return new(isolate) LocationSummary(isolate, 0, 0, LocationSummary::kNoCall);
4520 } 4520 }
4521 4521
4522 4522
4523 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4523 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4524 __ TraceSimMsg("GotoInstr"); 4524 __ TraceSimMsg("GotoInstr");
4525 if (!compiler->is_optimizing()) { 4525 if (!compiler->is_optimizing()) {
4526 if (FLAG_emit_edge_counters) { 4526 if (FLAG_emit_edge_counters) {
4527 compiler->EmitEdgeCounter(); 4527 compiler->EmitEdgeCounter();
4528 } 4528 }
4529 // Add a deoptimization descriptor for deoptimizing instructions that 4529 // Add a deoptimization descriptor for deoptimizing instructions that
4530 // may be inserted before this instruction. On MIPS this descriptor 4530 // may be inserted before this instruction. On MIPS this descriptor
4531 // points after the edge counter code so that we can reuse the same 4531 // points after the edge counter code so that we can reuse the same
4532 // pattern matching code as at call sites, which matches backwards from 4532 // pattern matching code as at call sites, which matches backwards from
4533 // the end of the pattern. 4533 // the end of the pattern.
4534 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, 4534 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
4535 GetDeoptId(), 4535 GetDeoptId(),
4536 Scanner::kNoSourcePos); 4536 Scanner::kNoSourcePos);
4537 } 4537 }
4538 if (HasParallelMove()) { 4538 if (HasParallelMove()) {
4539 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 4539 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
4540 } 4540 }
4541 4541
4542 // We can fall through if the successor is the next block in the list. 4542 // We can fall through if the successor is the next block in the list.
4543 // Otherwise, we need a jump. 4543 // Otherwise, we need a jump.
4544 if (!compiler->CanFallThroughTo(successor())) { 4544 if (!compiler->CanFallThroughTo(successor())) {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
4670 } 4670 }
4671 4671
4672 4672
4673 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4673 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4674 __ TraceSimMsg("AllocateObjectInstr"); 4674 __ TraceSimMsg("AllocateObjectInstr");
4675 __ Comment("AllocateObjectInstr"); 4675 __ Comment("AllocateObjectInstr");
4676 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls())); 4676 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls()));
4677 const ExternalLabel label(stub.EntryPoint()); 4677 const ExternalLabel label(stub.EntryPoint());
4678 compiler->GenerateCall(token_pos(), 4678 compiler->GenerateCall(token_pos(),
4679 &label, 4679 &label,
4680 PcDescriptors::kOther, 4680 RawPcDescriptors::kOther,
4681 locs()); 4681 locs());
4682 __ Drop(ArgumentCount()); // Discard arguments. 4682 __ Drop(ArgumentCount()); // Discard arguments.
4683 } 4683 }
4684 4684
4685 4685
4686 void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4686 void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4687 ASSERT(!compiler->is_optimizing()); 4687 ASSERT(!compiler->is_optimizing());
4688 const ExternalLabel label(StubCode::DebugStepCheckEntryPoint()); 4688 const ExternalLabel label(StubCode::DebugStepCheckEntryPoint());
4689 __ LoadImmediate(S4, 0); 4689 __ LoadImmediate(S4, 0);
4690 __ LoadImmediate(S5, 0); 4690 __ LoadImmediate(S5, 0);
4691 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 4691 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
4692 #if defined(DEBUG) 4692 #if defined(DEBUG)
4693 __ LoadImmediate(S4, kInvalidObjectPointer); 4693 __ LoadImmediate(S4, kInvalidObjectPointer);
4694 __ LoadImmediate(S5, kInvalidObjectPointer); 4694 __ LoadImmediate(S5, kInvalidObjectPointer);
4695 #endif 4695 #endif
4696 } 4696 }
4697 4697
4698 } // namespace dart 4698 } // namespace dart
4699 4699
4700 #endif // defined TARGET_ARCH_MIPS 4700 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698