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

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

Issue 1270803003: VM: More abstract interface for generating stub calls. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 const ExternalLabel* stub_entry; 996 const StubEntry* stub_entry = NULL;
997 if (is_bootstrap_native() || is_leaf_call) { 997 if (is_bootstrap_native() || is_leaf_call) {
998 stub_entry = &StubCode::CallBootstrapCFunctionLabel(); 998 stub_entry = StubCode::CallBootstrapCFunction_entry();
999 #if defined(USING_SIMULATOR) 999 #if defined(USING_SIMULATOR)
1000 entry = Simulator::RedirectExternalReference( 1000 entry = Simulator::RedirectExternalReference(
1001 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); 1001 entry, Simulator::kBootstrapNativeCall, function().NumParameters());
1002 #endif 1002 #endif
1003 } else { 1003 } else {
1004 // In the case of non bootstrap native methods the CallNativeCFunction 1004 // In the case of non bootstrap native methods the CallNativeCFunction
1005 // stub generates the redirection address when running under the simulator 1005 // stub generates the redirection address when running under the simulator
1006 // and hence we do not change 'entry' here. 1006 // and hence we do not change 'entry' here.
1007 stub_entry = &StubCode::CallNativeCFunctionLabel(); 1007 stub_entry = StubCode::CallNativeCFunction_entry();
1008 #if defined(USING_SIMULATOR) 1008 #if defined(USING_SIMULATOR)
1009 if (!function().IsNativeAutoSetupScope()) { 1009 if (!function().IsNativeAutoSetupScope()) {
1010 entry = Simulator::RedirectExternalReference( 1010 entry = Simulator::RedirectExternalReference(
1011 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); 1011 entry, Simulator::kBootstrapNativeCall, function().NumParameters());
1012 } 1012 }
1013 #endif 1013 #endif
1014 } 1014 }
1015 __ LoadImmediate(T5, entry); 1015 __ LoadImmediate(T5, entry);
1016 __ LoadImmediate(A1, argc_tag); 1016 __ LoadImmediate(A1, argc_tag);
1017 compiler->GenerateCall(token_pos(), 1017 compiler->GenerateCall(token_pos(),
1018 stub_entry, 1018 *stub_entry,
1019 RawPcDescriptors::kOther, 1019 RawPcDescriptors::kOther,
1020 locs()); 1020 locs());
1021 __ Pop(result); 1021 __ Pop(result);
1022 } 1022 }
1023 1023
1024 1024
1025 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(Zone* zone, 1025 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(Zone* zone,
1026 bool opt) const { 1026 bool opt) const {
1027 const intptr_t kNumInputs = 1; 1027 const intptr_t kNumInputs = 1;
1028 // TODO(fschneider): Allow immediate operands for the char code. 1028 // TODO(fschneider): Allow immediate operands for the char code.
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
1840 Isolate* isolate = compiler->isolate(); 1840 Isolate* isolate = compiler->isolate();
1841 1841
1842 if (Assembler::EmittingComments()) { 1842 if (Assembler::EmittingComments()) {
1843 __ Comment("%s slow path allocation of %s", 1843 __ Comment("%s slow path allocation of %s",
1844 instruction_->DebugName(), 1844 instruction_->DebugName(),
1845 String::Handle(cls_.PrettyName()).ToCString()); 1845 String::Handle(cls_.PrettyName()).ToCString());
1846 } 1846 }
1847 __ Bind(entry_label()); 1847 __ Bind(entry_label());
1848 const Code& stub = 1848 const Code& stub =
1849 Code::Handle(isolate, StubCode::GetAllocationStubForClass(cls_)); 1849 Code::Handle(isolate, StubCode::GetAllocationStubForClass(cls_));
1850 const ExternalLabel label(stub.EntryPoint()); 1850 const StubEntry stub_entry(stub);
1851 1851
1852 LocationSummary* locs = instruction_->locs(); 1852 LocationSummary* locs = instruction_->locs();
1853 locs->live_registers()->Remove(Location::RegisterLocation(result_)); 1853 locs->live_registers()->Remove(Location::RegisterLocation(result_));
1854 1854
1855 compiler->SaveLiveRegisters(locs); 1855 compiler->SaveLiveRegisters(locs);
1856 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. 1856 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position.
1857 &label, 1857 stub_entry,
1858 RawPcDescriptors::kOther, 1858 RawPcDescriptors::kOther,
1859 locs); 1859 locs);
1860 compiler->AddStubCallTarget(stub); 1860 compiler->AddStubCallTarget(stub);
1861 if (result_ != V0) { 1861 if (result_ != V0) {
1862 __ mov(result_, V0); 1862 __ mov(result_, V0);
1863 } 1863 }
1864 compiler->RestoreLiveRegisters(locs); 1864 compiler->RestoreLiveRegisters(locs);
1865 __ b(exit_label()); 1865 __ b(exit_label());
1866 } 1866 }
1867 1867
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
2239 2, 2239 2,
2240 locs()); 2240 locs());
2241 __ Drop(2); 2241 __ Drop(2);
2242 __ Pop(kResultReg); 2242 __ Pop(kResultReg);
2243 __ Bind(&done); 2243 __ Bind(&done);
2244 return; 2244 return;
2245 } 2245 }
2246 } 2246 }
2247 2247
2248 __ Bind(&slow_path); 2248 __ Bind(&slow_path);
2249 const ExternalLabel label(StubCode::AllocateArrayEntryPoint());
2250 compiler->GenerateCall(token_pos(), 2249 compiler->GenerateCall(token_pos(),
2251 &label, 2250 *StubCode::AllocateArray_entry(),
2252 RawPcDescriptors::kOther, 2251 RawPcDescriptors::kOther,
2253 locs()); 2252 locs());
2254 __ Bind(&done); 2253 __ Bind(&done);
2255 ASSERT(locs()->out(0).reg() == kResultReg); 2254 ASSERT(locs()->out(0).reg() == kResultReg);
2256 } 2255 }
2257 2256
2258 2257
2259 LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, 2258 LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone,
2260 bool opt) const { 2259 bool opt) const {
2261 const intptr_t kNumInputs = 1; 2260 const intptr_t kNumInputs = 1;
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
2489 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 2488 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
2490 __ Comment("AllocateContextSlowPath"); 2489 __ Comment("AllocateContextSlowPath");
2491 __ Bind(entry_label()); 2490 __ Bind(entry_label());
2492 2491
2493 LocationSummary* locs = instruction_->locs(); 2492 LocationSummary* locs = instruction_->locs();
2494 locs->live_registers()->Remove(locs->out(0)); 2493 locs->live_registers()->Remove(locs->out(0));
2495 2494
2496 compiler->SaveLiveRegisters(locs); 2495 compiler->SaveLiveRegisters(locs);
2497 2496
2498 __ LoadImmediate(T1, instruction_->num_context_variables()); 2497 __ LoadImmediate(T1, instruction_->num_context_variables());
2499 const ExternalLabel label(StubCode::AllocateContextEntryPoint());
2500 compiler->GenerateCall(instruction_->token_pos(), 2498 compiler->GenerateCall(instruction_->token_pos(),
2501 &label, 2499 *StubCode::AllocateContext_entry(),
2502 RawPcDescriptors::kOther, 2500 RawPcDescriptors::kOther,
2503 locs); 2501 locs);
2504 ASSERT(instruction_->locs()->out(0).reg() == V0); 2502 ASSERT(instruction_->locs()->out(0).reg() == V0);
2505 compiler->RestoreLiveRegisters(instruction_->locs()); 2503 compiler->RestoreLiveRegisters(instruction_->locs());
2506 __ b(exit_label()); 2504 __ b(exit_label());
2507 } 2505 }
2508 2506
2509 private: 2507 private:
2510 AllocateUninitializedContextInstr* instruction_; 2508 AllocateUninitializedContextInstr* instruction_;
2511 }; 2509 };
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2547 return locs; 2545 return locs;
2548 } 2546 }
2549 2547
2550 2548
2551 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2549 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2552 ASSERT(locs()->temp(0).reg() == T1); 2550 ASSERT(locs()->temp(0).reg() == T1);
2553 ASSERT(locs()->out(0).reg() == V0); 2551 ASSERT(locs()->out(0).reg() == V0);
2554 2552
2555 __ Comment("AllocateContextInstr"); 2553 __ Comment("AllocateContextInstr");
2556 __ LoadImmediate(T1, num_context_variables()); 2554 __ LoadImmediate(T1, num_context_variables());
2557 const ExternalLabel label(StubCode::AllocateContextEntryPoint());
2558 compiler->GenerateCall(token_pos(), 2555 compiler->GenerateCall(token_pos(),
2559 &label, 2556 *StubCode::AllocateContext_entry(),
2560 RawPcDescriptors::kOther, 2557 RawPcDescriptors::kOther,
2561 locs()); 2558 locs());
2562 } 2559 }
2563 2560
2564 2561
2565 LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone, 2562 LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone,
2566 bool opt) const { 2563 bool opt) const {
2567 const intptr_t kNumInputs = 1; 2564 const intptr_t kNumInputs = 1;
2568 const intptr_t kNumTemps = 1; 2565 const intptr_t kNumTemps = 1;
2569 LocationSummary* locs = new(zone) LocationSummary( 2566 LocationSummary* locs = new(zone) LocationSummary(
(...skipping 2968 matching lines...) Expand 10 before | Expand all | Expand 10 after
5538 bool opt) const { 5535 bool opt) const {
5539 return MakeCallSummary(zone); 5536 return MakeCallSummary(zone);
5540 } 5537 }
5541 5538
5542 5539
5543 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5540 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5544 __ Comment("AllocateObjectInstr"); 5541 __ Comment("AllocateObjectInstr");
5545 Isolate* isolate = compiler->isolate(); 5542 Isolate* isolate = compiler->isolate();
5546 const Code& stub = Code::Handle(isolate, 5543 const Code& stub = Code::Handle(isolate,
5547 StubCode::GetAllocationStubForClass(cls())); 5544 StubCode::GetAllocationStubForClass(cls()));
5548 const ExternalLabel label(stub.EntryPoint()); 5545 const StubEntry stub_entry(stub);
5549 compiler->GenerateCall(token_pos(), 5546 compiler->GenerateCall(token_pos(),
5550 &label, 5547 stub_entry,
5551 RawPcDescriptors::kOther, 5548 RawPcDescriptors::kOther,
5552 locs()); 5549 locs());
5553 compiler->AddStubCallTarget(stub); 5550 compiler->AddStubCallTarget(stub);
5554 __ Drop(ArgumentCount()); // Discard arguments. 5551 __ Drop(ArgumentCount()); // Discard arguments.
5555 } 5552 }
5556 5553
5557 5554
5558 void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5555 void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5559 ASSERT(!compiler->is_optimizing()); 5556 ASSERT(!compiler->is_optimizing());
5560 const ExternalLabel label(StubCode::DebugStepCheckEntryPoint()); 5557 compiler->GenerateCall(
5561 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 5558 token_pos(), *StubCode::DebugStepCheck_entry(), stub_kind_, locs());
5562 } 5559 }
5563 5560
5564 5561
5565 LocationSummary* GrowRegExpStackInstr::MakeLocationSummary( 5562 LocationSummary* GrowRegExpStackInstr::MakeLocationSummary(
5566 Zone* zone, bool opt) const { 5563 Zone* zone, bool opt) const {
5567 const intptr_t kNumInputs = 1; 5564 const intptr_t kNumInputs = 1;
5568 const intptr_t kNumTemps = 0; 5565 const intptr_t kNumTemps = 0;
5569 LocationSummary* locs = new(zone) LocationSummary( 5566 LocationSummary* locs = new(zone) LocationSummary(
5570 zone, kNumInputs, kNumTemps, LocationSummary::kCall); 5567 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
5571 locs->set_in(0, Location::RegisterLocation(T0)); 5568 locs->set_in(0, Location::RegisterLocation(T0));
(...skipping 16 matching lines...) Expand all
5588 1, 5585 1,
5589 locs()); 5586 locs());
5590 __ lw(result, Address(SP, 1 * kWordSize)); 5587 __ lw(result, Address(SP, 1 * kWordSize));
5591 __ addiu(SP, SP, Immediate(2 * kWordSize)); 5588 __ addiu(SP, SP, Immediate(2 * kWordSize));
5592 } 5589 }
5593 5590
5594 5591
5595 } // namespace dart 5592 } // namespace dart
5596 5593
5597 #endif // defined TARGET_ARCH_MIPS 5594 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698