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

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

Issue 365983002: Make isolate specific stub code accessors instance methods instead (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
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_ia32.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
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 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 } else { 766 } else {
767 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize, PP); 767 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize, PP);
768 } 768 }
769 // Compute the effective address. When running under the simulator, 769 // Compute the effective address. When running under the simulator,
770 // this is a redirection address that forces the simulator to call 770 // this is a redirection address that forces the simulator to call
771 // into the runtime system. 771 // into the runtime system.
772 uword entry = reinterpret_cast<uword>(native_c_function()); 772 uword entry = reinterpret_cast<uword>(native_c_function());
773 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); 773 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function());
774 const bool is_leaf_call = 774 const bool is_leaf_call =
775 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; 775 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0;
776 StubCode* stub_code = compiler->isolate()->stub_code();
776 const ExternalLabel* stub_entry; 777 const ExternalLabel* stub_entry;
777 if (is_bootstrap_native() || is_leaf_call) { 778 if (is_bootstrap_native() || is_leaf_call) {
778 stub_entry = &StubCode::CallBootstrapCFunctionLabel(); 779 stub_entry = &stub_code->CallBootstrapCFunctionLabel();
779 #if defined(USING_SIMULATOR) 780 #if defined(USING_SIMULATOR)
780 entry = Simulator::RedirectExternalReference( 781 entry = Simulator::RedirectExternalReference(
781 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); 782 entry, Simulator::kBootstrapNativeCall, function().NumParameters());
782 #endif 783 #endif
783 } else { 784 } else {
784 // In the case of non bootstrap native methods the CallNativeCFunction 785 // In the case of non bootstrap native methods the CallNativeCFunction
785 // stub generates the redirection address when running under the simulator 786 // stub generates the redirection address when running under the simulator
786 // and hence we do not change 'entry' here. 787 // and hence we do not change 'entry' here.
787 stub_entry = &StubCode::CallNativeCFunctionLabel(); 788 stub_entry = &stub_code->CallNativeCFunctionLabel();
788 #if defined(USING_SIMULATOR) 789 #if defined(USING_SIMULATOR)
789 if (!function().IsNativeAutoSetupScope()) { 790 if (!function().IsNativeAutoSetupScope()) {
790 entry = Simulator::RedirectExternalReference( 791 entry = Simulator::RedirectExternalReference(
791 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); 792 entry, Simulator::kBootstrapNativeCall, function().NumParameters());
792 } 793 }
793 #endif 794 #endif
794 } 795 }
795 __ LoadImmediate(R5, entry, PP); 796 __ LoadImmediate(R5, entry, PP);
796 __ LoadImmediate(R1, argc_tag, PP); 797 __ LoadImmediate(R1, argc_tag, PP);
797 compiler->GenerateCall(token_pos(), 798 compiler->GenerateCall(token_pos(),
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 } 1600 }
1600 1601
1601 1602
1602 class StoreInstanceFieldSlowPath : public SlowPathCode { 1603 class StoreInstanceFieldSlowPath : public SlowPathCode {
1603 public: 1604 public:
1604 StoreInstanceFieldSlowPath(StoreInstanceFieldInstr* instruction, 1605 StoreInstanceFieldSlowPath(StoreInstanceFieldInstr* instruction,
1605 const Class& cls) 1606 const Class& cls)
1606 : instruction_(instruction), cls_(cls) { } 1607 : instruction_(instruction), cls_(cls) { }
1607 1608
1608 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 1609 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
1610 Isolate* isolate = compiler->isolate();
1611 StubCode* stub_code = isolate->stub_code();
1612
1609 __ Comment("StoreInstanceFieldSlowPath"); 1613 __ Comment("StoreInstanceFieldSlowPath");
1610 __ Bind(entry_label()); 1614 __ Bind(entry_label());
1611 1615
1612 const Code& stub = 1616 const Code& stub =
1613 Code::Handle(StubCode::GetAllocationStubForClass(cls_)); 1617 Code::Handle(isolate, stub_code->GetAllocationStubForClass(cls_));
1614 const ExternalLabel label(stub.EntryPoint()); 1618 const ExternalLabel label(stub.EntryPoint());
1615 1619
1616 LocationSummary* locs = instruction_->locs(); 1620 LocationSummary* locs = instruction_->locs();
1617 locs->live_registers()->Remove(locs->out(0)); 1621 locs->live_registers()->Remove(locs->out(0));
1618 1622
1619 compiler->SaveLiveRegisters(locs); 1623 compiler->SaveLiveRegisters(locs);
1620 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. 1624 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position.
1621 &label, 1625 &label,
1622 PcDescriptors::kOther, 1626 PcDescriptors::kOther,
1623 locs); 1627 locs);
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
1955 locs->set_in(kLengthPos, Location::RegisterLocation(R2)); 1959 locs->set_in(kLengthPos, Location::RegisterLocation(R2));
1956 locs->set_out(0, Location::RegisterLocation(R0)); 1960 locs->set_out(0, Location::RegisterLocation(R0));
1957 return locs; 1961 return locs;
1958 } 1962 }
1959 1963
1960 1964
1961 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1965 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1962 // Allocate the array. R2 = length, R1 = element type. 1966 // Allocate the array. R2 = length, R1 = element type.
1963 ASSERT(locs()->in(kElementTypePos).reg() == R1); 1967 ASSERT(locs()->in(kElementTypePos).reg() == R1);
1964 ASSERT(locs()->in(kLengthPos).reg() == R2); 1968 ASSERT(locs()->in(kLengthPos).reg() == R2);
1969 StubCode* stub_code = compiler->isolate()->stub_code();
1965 compiler->GenerateCall(token_pos(), 1970 compiler->GenerateCall(token_pos(),
1966 &StubCode::AllocateArrayLabel(), 1971 &stub_code->AllocateArrayLabel(),
1967 PcDescriptors::kOther, 1972 PcDescriptors::kOther,
1968 locs()); 1973 locs());
1969 ASSERT(locs()->out(0).reg() == R0); 1974 ASSERT(locs()->out(0).reg() == R0);
1970 } 1975 }
1971 1976
1972 1977
1973 class BoxDoubleSlowPath : public SlowPathCode { 1978 class BoxDoubleSlowPath : public SlowPathCode {
1974 public: 1979 public:
1975 explicit BoxDoubleSlowPath(Instruction* instruction) 1980 explicit BoxDoubleSlowPath(Instruction* instruction)
1976 : instruction_(instruction) { } 1981 : instruction_(instruction) { }
1977 1982
1978 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 1983 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
1979 __ Comment("BoxDoubleSlowPath"); 1984 __ Comment("BoxDoubleSlowPath");
1980 __ Bind(entry_label()); 1985 __ Bind(entry_label());
1986 Isolate* isolate = compiler->isolate();
1987 StubCode* stub_code = isolate->stub_code();
1981 const Class& double_class = compiler->double_class(); 1988 const Class& double_class = compiler->double_class();
1982 const Code& stub = 1989 const Code& stub =
1983 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); 1990 Code::Handle(isolate,
1991 stub_code->GetAllocationStubForClass(double_class));
1984 const ExternalLabel label(stub.EntryPoint()); 1992 const ExternalLabel label(stub.EntryPoint());
1985 1993
1986 LocationSummary* locs = instruction_->locs(); 1994 LocationSummary* locs = instruction_->locs();
1987 locs->live_registers()->Remove(locs->out(0)); 1995 locs->live_registers()->Remove(locs->out(0));
1988 1996
1989 compiler->SaveLiveRegisters(locs); 1997 compiler->SaveLiveRegisters(locs);
1990 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. 1998 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position.
1991 &label, 1999 &label,
1992 PcDescriptors::kOther, 2000 PcDescriptors::kOther,
1993 locs); 2001 locs);
1994 __ mov(locs->out(0).reg(), R0); 2002 __ mov(locs->out(0).reg(), R0);
1995 compiler->RestoreLiveRegisters(locs); 2003 compiler->RestoreLiveRegisters(locs);
1996 2004
1997 __ b(exit_label()); 2005 __ b(exit_label());
1998 } 2006 }
1999 2007
2000 private: 2008 private:
2001 Instruction* instruction_; 2009 Instruction* instruction_;
2002 }; 2010 };
2003 2011
2004 2012
2005 class BoxFloat32x4SlowPath : public SlowPathCode { 2013 class BoxFloat32x4SlowPath : public SlowPathCode {
2006 public: 2014 public:
2007 explicit BoxFloat32x4SlowPath(Instruction* instruction) 2015 explicit BoxFloat32x4SlowPath(Instruction* instruction)
2008 : instruction_(instruction) { } 2016 : instruction_(instruction) { }
2009 2017
2010 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 2018 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
2011 __ Comment("BoxFloat32x4SlowPath"); 2019 __ Comment("BoxFloat32x4SlowPath");
2012 __ Bind(entry_label()); 2020 __ Bind(entry_label());
2021 Isolate* isolate = compiler->isolate();
2022 StubCode* stub_code = isolate->stub_code();
2013 const Class& float32x4_class = compiler->float32x4_class(); 2023 const Class& float32x4_class = compiler->float32x4_class();
2014 const Code& stub = 2024 const Code& stub =
2015 Code::Handle(StubCode::GetAllocationStubForClass(float32x4_class)); 2025 Code::Handle(isolate,
2026 stub_code->GetAllocationStubForClass(float32x4_class));
2016 const ExternalLabel label(stub.EntryPoint()); 2027 const ExternalLabel label(stub.EntryPoint());
2017 2028
2018 LocationSummary* locs = instruction_->locs(); 2029 LocationSummary* locs = instruction_->locs();
2019 locs->live_registers()->Remove(locs->out(0)); 2030 locs->live_registers()->Remove(locs->out(0));
2020 2031
2021 compiler->SaveLiveRegisters(locs); 2032 compiler->SaveLiveRegisters(locs);
2022 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. 2033 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position.
2023 &label, 2034 &label,
2024 PcDescriptors::kOther, 2035 PcDescriptors::kOther,
2025 locs); 2036 locs);
2026 __ mov(locs->out(0).reg(), R0); 2037 __ mov(locs->out(0).reg(), R0);
2027 compiler->RestoreLiveRegisters(locs); 2038 compiler->RestoreLiveRegisters(locs);
2028 2039
2029 __ b(exit_label()); 2040 __ b(exit_label());
2030 } 2041 }
2031 2042
2032 private: 2043 private:
2033 Instruction* instruction_; 2044 Instruction* instruction_;
2034 }; 2045 };
2035 2046
2036 2047
2037 class BoxFloat64x2SlowPath : public SlowPathCode { 2048 class BoxFloat64x2SlowPath : public SlowPathCode {
2038 public: 2049 public:
2039 explicit BoxFloat64x2SlowPath(Instruction* instruction) 2050 explicit BoxFloat64x2SlowPath(Instruction* instruction)
2040 : instruction_(instruction) { } 2051 : instruction_(instruction) { }
2041 2052
2042 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 2053 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
2043 __ Comment("BoxFloat64x2SlowPath"); 2054 __ Comment("BoxFloat64x2SlowPath");
2044 __ Bind(entry_label()); 2055 __ Bind(entry_label());
2056 Isolate* isolate = compiler->isolate();
2057 StubCode* stub_code = isolate->stub_code();
2045 const Class& float64x2_class = compiler->float64x2_class(); 2058 const Class& float64x2_class = compiler->float64x2_class();
2046 const Code& stub = 2059 const Code& stub =
2047 Code::Handle(StubCode::GetAllocationStubForClass(float64x2_class)); 2060 Code::Handle(isolate,
2061 stub_code->GetAllocationStubForClass(float64x2_class));
2048 const ExternalLabel label(stub.EntryPoint()); 2062 const ExternalLabel label(stub.EntryPoint());
2049 2063
2050 LocationSummary* locs = instruction_->locs(); 2064 LocationSummary* locs = instruction_->locs();
2051 locs->live_registers()->Remove(locs->out(0)); 2065 locs->live_registers()->Remove(locs->out(0));
2052 2066
2053 compiler->SaveLiveRegisters(locs); 2067 compiler->SaveLiveRegisters(locs);
2054 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. 2068 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position.
2055 &label, 2069 &label,
2056 PcDescriptors::kOther, 2070 PcDescriptors::kOther,
2057 locs); 2071 locs);
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
2319 locs->set_out(0, Location::RegisterLocation(R0)); 2333 locs->set_out(0, Location::RegisterLocation(R0));
2320 return locs; 2334 return locs;
2321 } 2335 }
2322 2336
2323 2337
2324 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2338 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2325 ASSERT(locs()->temp(0).reg() == R1); 2339 ASSERT(locs()->temp(0).reg() == R1);
2326 ASSERT(locs()->out(0).reg() == R0); 2340 ASSERT(locs()->out(0).reg() == R0);
2327 2341
2328 __ LoadImmediate(R1, num_context_variables(), PP); 2342 __ LoadImmediate(R1, num_context_variables(), PP);
2329 const ExternalLabel label(StubCode::AllocateContextEntryPoint()); 2343 StubCode* stub_code = compiler->isolate()->stub_code();
2344 const ExternalLabel label(stub_code->AllocateContextEntryPoint());
2330 compiler->GenerateCall(token_pos(), 2345 compiler->GenerateCall(token_pos(),
2331 &label, 2346 &label,
2332 PcDescriptors::kOther, 2347 PcDescriptors::kOther,
2333 locs()); 2348 locs());
2334 } 2349 }
2335 2350
2336 2351
2337 LocationSummary* CloneContextInstr::MakeLocationSummary(Isolate* isolate, 2352 LocationSummary* CloneContextInstr::MakeLocationSummary(Isolate* isolate,
2338 bool opt) const { 2353 bool opt) const {
2339 const intptr_t kNumInputs = 1; 2354 const intptr_t kNumInputs = 1;
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
3190 3205
3191 3206
3192 class BoxInt32x4SlowPath : public SlowPathCode { 3207 class BoxInt32x4SlowPath : public SlowPathCode {
3193 public: 3208 public:
3194 explicit BoxInt32x4SlowPath(BoxInt32x4Instr* instruction) 3209 explicit BoxInt32x4SlowPath(BoxInt32x4Instr* instruction)
3195 : instruction_(instruction) { } 3210 : instruction_(instruction) { }
3196 3211
3197 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 3212 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
3198 __ Comment("BoxInt32x4SlowPath"); 3213 __ Comment("BoxInt32x4SlowPath");
3199 __ Bind(entry_label()); 3214 __ Bind(entry_label());
3215 Isolate* isolate = compiler->isolate();
3216 StubCode* stub_code = isolate->stub_code();
3200 const Class& int32x4_class = compiler->int32x4_class(); 3217 const Class& int32x4_class = compiler->int32x4_class();
3201 const Code& stub = 3218 const Code& stub =
3202 Code::Handle(StubCode::GetAllocationStubForClass(int32x4_class)); 3219 Code::Handle(isolate,
3220 stub_code->GetAllocationStubForClass(int32x4_class));
3203 const ExternalLabel label(stub.EntryPoint()); 3221 const ExternalLabel label(stub.EntryPoint());
3204 3222
3205 LocationSummary* locs = instruction_->locs(); 3223 LocationSummary* locs = instruction_->locs();
3206 locs->live_registers()->Remove(locs->out(0)); 3224 locs->live_registers()->Remove(locs->out(0));
3207 3225
3208 compiler->SaveLiveRegisters(locs); 3226 compiler->SaveLiveRegisters(locs);
3209 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. 3227 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position.
3210 &label, 3228 &label,
3211 PcDescriptors::kOther, 3229 PcDescriptors::kOther,
3212 locs); 3230 locs);
(...skipping 2112 matching lines...) Expand 10 before | Expand all | Expand 10 after
5325 } 5343 }
5326 5344
5327 5345
5328 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Isolate* isolate, 5346 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Isolate* isolate,
5329 bool opt) const { 5347 bool opt) const {
5330 return MakeCallSummary(); 5348 return MakeCallSummary();
5331 } 5349 }
5332 5350
5333 5351
5334 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5352 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5335 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls())); 5353 Isolate* isolate = compiler->isolate();
5354 StubCode* stub_code = isolate->stub_code();
5355 const Code& stub = Code::Handle(isolate,
5356 stub_code->GetAllocationStubForClass(cls()));
5336 const ExternalLabel label(stub.EntryPoint()); 5357 const ExternalLabel label(stub.EntryPoint());
5337 compiler->GenerateCall(token_pos(), 5358 compiler->GenerateCall(token_pos(),
5338 &label, 5359 &label,
5339 PcDescriptors::kOther, 5360 PcDescriptors::kOther,
5340 locs()); 5361 locs());
5341 __ Drop(ArgumentCount()); // Discard arguments. 5362 __ Drop(ArgumentCount()); // Discard arguments.
5342 } 5363 }
5343 5364
5344 5365
5345 void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5366 void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5346 ASSERT(!compiler->is_optimizing()); 5367 ASSERT(!compiler->is_optimizing());
5347 const ExternalLabel label(StubCode::DebugStepCheckEntryPoint()); 5368 StubCode* stub_code = compiler->isolate()->stub_code();
5369 const ExternalLabel label(stub_code->DebugStepCheckEntryPoint());
5348 __ LoadImmediate(R4, 0, kNoPP); 5370 __ LoadImmediate(R4, 0, kNoPP);
5349 __ LoadImmediate(R5, 0, kNoPP); 5371 __ LoadImmediate(R5, 0, kNoPP);
5350 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 5372 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
5351 #if defined(DEBUG) 5373 #if defined(DEBUG)
5352 __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP); 5374 __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP);
5353 __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP); 5375 __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP);
5354 #endif 5376 #endif
5355 } 5377 }
5356 5378
5357 } // namespace dart 5379 } // namespace dart
5358 5380
5359 #endif // defined TARGET_ARCH_ARM64 5381 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698