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

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

Issue 1247783002: Make array allocation stub shared between isolates. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 } else { 785 } else {
786 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize, PP); 786 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize, PP);
787 } 787 }
788 // Compute the effective address. When running under the simulator, 788 // Compute the effective address. When running under the simulator,
789 // this is a redirection address that forces the simulator to call 789 // this is a redirection address that forces the simulator to call
790 // into the runtime system. 790 // into the runtime system.
791 uword entry = reinterpret_cast<uword>(native_c_function()); 791 uword entry = reinterpret_cast<uword>(native_c_function());
792 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); 792 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function());
793 const bool is_leaf_call = 793 const bool is_leaf_call =
794 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; 794 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0;
795 StubCode* stub_code = compiler->isolate()->stub_code();
796 const ExternalLabel* stub_entry; 795 const ExternalLabel* stub_entry;
797 if (is_bootstrap_native() || is_leaf_call) { 796 if (is_bootstrap_native() || is_leaf_call) {
798 stub_entry = &stub_code->CallBootstrapCFunctionLabel(); 797 stub_entry = &StubCode::CallBootstrapCFunctionLabel();
799 #if defined(USING_SIMULATOR) 798 #if defined(USING_SIMULATOR)
800 entry = Simulator::RedirectExternalReference( 799 entry = Simulator::RedirectExternalReference(
801 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); 800 entry, Simulator::kBootstrapNativeCall, function().NumParameters());
802 #endif 801 #endif
803 } else { 802 } else {
804 // In the case of non bootstrap native methods the CallNativeCFunction 803 // In the case of non bootstrap native methods the CallNativeCFunction
805 // stub generates the redirection address when running under the simulator 804 // stub generates the redirection address when running under the simulator
806 // and hence we do not change 'entry' here. 805 // and hence we do not change 'entry' here.
807 stub_entry = &stub_code->CallNativeCFunctionLabel(); 806 stub_entry = &StubCode::CallNativeCFunctionLabel();
808 #if defined(USING_SIMULATOR) 807 #if defined(USING_SIMULATOR)
809 if (!function().IsNativeAutoSetupScope()) { 808 if (!function().IsNativeAutoSetupScope()) {
810 entry = Simulator::RedirectExternalReference( 809 entry = Simulator::RedirectExternalReference(
811 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); 810 entry, Simulator::kBootstrapNativeCall, function().NumParameters());
812 } 811 }
813 #endif 812 #endif
814 } 813 }
815 __ LoadImmediate(R5, entry, PP); 814 __ LoadImmediate(R5, entry, PP);
816 __ LoadImmediate(R1, argc_tag, PP); 815 __ LoadImmediate(R1, argc_tag, PP);
817 compiler->GenerateCall(token_pos(), 816 compiler->GenerateCall(token_pos(),
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
1658 public: 1657 public:
1659 BoxAllocationSlowPath(Instruction* instruction, 1658 BoxAllocationSlowPath(Instruction* instruction,
1660 const Class& cls, 1659 const Class& cls,
1661 Register result) 1660 Register result)
1662 : instruction_(instruction), 1661 : instruction_(instruction),
1663 cls_(cls), 1662 cls_(cls),
1664 result_(result) { } 1663 result_(result) { }
1665 1664
1666 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 1665 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
1667 Isolate* isolate = compiler->isolate(); 1666 Isolate* isolate = compiler->isolate();
1668 StubCode* stub_code = isolate->stub_code();
1669 1667
1670 if (Assembler::EmittingComments()) { 1668 if (Assembler::EmittingComments()) {
1671 __ Comment("%s slow path allocation of %s", 1669 __ Comment("%s slow path allocation of %s",
1672 instruction_->DebugName(), 1670 instruction_->DebugName(),
1673 String::Handle(cls_.PrettyName()).ToCString()); 1671 String::Handle(cls_.PrettyName()).ToCString());
1674 } 1672 }
1675 __ Bind(entry_label()); 1673 __ Bind(entry_label());
1676 const Code& stub = 1674 const Code& stub =
1677 Code::Handle(isolate, stub_code->GetAllocationStubForClass(cls_)); 1675 Code::Handle(isolate, StubCode::GetAllocationStubForClass(cls_));
1678 const ExternalLabel label(stub.EntryPoint()); 1676 const ExternalLabel label(stub.EntryPoint());
1679 1677
1680 LocationSummary* locs = instruction_->locs(); 1678 LocationSummary* locs = instruction_->locs();
1681 1679
1682 locs->live_registers()->Remove(Location::RegisterLocation(result_)); 1680 locs->live_registers()->Remove(Location::RegisterLocation(result_));
1683 1681
1684 compiler->SaveLiveRegisters(locs); 1682 compiler->SaveLiveRegisters(locs);
1685 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. 1683 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position.
1686 &label, 1684 &label,
1687 RawPcDescriptors::kOther, 1685 RawPcDescriptors::kOther,
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
2123 deopt_id(), 2121 deopt_id(),
2124 kAllocateArrayRuntimeEntry, 2122 kAllocateArrayRuntimeEntry,
2125 2, 2123 2,
2126 locs()); 2124 locs());
2127 __ Drop(2); 2125 __ Drop(2);
2128 __ Pop(kResultReg); 2126 __ Pop(kResultReg);
2129 __ Bind(&done); 2127 __ Bind(&done);
2130 return; 2128 return;
2131 } 2129 }
2132 } 2130 }
2133 Isolate* isolate = compiler->isolate(); 2131 const ExternalLabel label(StubCode::AllocateArrayEntryPoint());
2134 const Code& stub = Code::Handle(
2135 isolate, isolate->stub_code()->GetAllocateArrayStub());
2136 const ExternalLabel label(stub.EntryPoint());
2137 compiler->GenerateCall(token_pos(), 2132 compiler->GenerateCall(token_pos(),
2138 &label, 2133 &label,
2139 RawPcDescriptors::kOther, 2134 RawPcDescriptors::kOther,
2140 locs()); 2135 locs());
2141 compiler->AddStubCallTarget(stub);
2142 ASSERT(locs()->out(0).reg() == kResultReg); 2136 ASSERT(locs()->out(0).reg() == kResultReg);
2143 } 2137 }
2144 2138
2145 2139
2146 LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, 2140 LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone,
2147 bool opt) const { 2141 bool opt) const {
2148 const intptr_t kNumInputs = 1; 2142 const intptr_t kNumInputs = 1;
2149 const intptr_t kNumTemps = 2143 const intptr_t kNumTemps =
2150 (IsUnboxedLoad() && opt) ? 1 : 2144 (IsUnboxedLoad() && opt) ? 1 :
2151 ((IsPotentialUnboxedLoad()) ? 1 : 0); 2145 ((IsPotentialUnboxedLoad()) ? 1 : 0);
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
2403 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 2397 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
2404 __ Comment("AllocateContextSlowPath"); 2398 __ Comment("AllocateContextSlowPath");
2405 __ Bind(entry_label()); 2399 __ Bind(entry_label());
2406 2400
2407 LocationSummary* locs = instruction_->locs(); 2401 LocationSummary* locs = instruction_->locs();
2408 locs->live_registers()->Remove(locs->out(0)); 2402 locs->live_registers()->Remove(locs->out(0));
2409 2403
2410 compiler->SaveLiveRegisters(locs); 2404 compiler->SaveLiveRegisters(locs);
2411 2405
2412 __ LoadImmediate(R1, instruction_->num_context_variables(), PP); 2406 __ LoadImmediate(R1, instruction_->num_context_variables(), PP);
2413 StubCode* stub_code = compiler->isolate()->stub_code(); 2407 const ExternalLabel label(StubCode::AllocateContextEntryPoint());
2414 const ExternalLabel label(stub_code->AllocateContextEntryPoint());
2415 compiler->GenerateCall(instruction_->token_pos(), 2408 compiler->GenerateCall(instruction_->token_pos(),
2416 &label, 2409 &label,
2417 RawPcDescriptors::kOther, 2410 RawPcDescriptors::kOther,
2418 locs); 2411 locs);
2419 ASSERT(instruction_->locs()->out(0).reg() == R0); 2412 ASSERT(instruction_->locs()->out(0).reg() == R0);
2420 compiler->RestoreLiveRegisters(instruction_->locs()); 2413 compiler->RestoreLiveRegisters(instruction_->locs());
2421 __ b(exit_label()); 2414 __ b(exit_label());
2422 } 2415 }
2423 2416
2424 private: 2417 private:
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2462 locs->set_out(0, Location::RegisterLocation(R0)); 2455 locs->set_out(0, Location::RegisterLocation(R0));
2463 return locs; 2456 return locs;
2464 } 2457 }
2465 2458
2466 2459
2467 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2460 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2468 ASSERT(locs()->temp(0).reg() == R1); 2461 ASSERT(locs()->temp(0).reg() == R1);
2469 ASSERT(locs()->out(0).reg() == R0); 2462 ASSERT(locs()->out(0).reg() == R0);
2470 2463
2471 __ LoadImmediate(R1, num_context_variables(), PP); 2464 __ LoadImmediate(R1, num_context_variables(), PP);
2472 StubCode* stub_code = compiler->isolate()->stub_code(); 2465 const ExternalLabel label(StubCode::AllocateContextEntryPoint());
2473 const ExternalLabel label(stub_code->AllocateContextEntryPoint());
2474 compiler->GenerateCall(token_pos(), 2466 compiler->GenerateCall(token_pos(),
2475 &label, 2467 &label,
2476 RawPcDescriptors::kOther, 2468 RawPcDescriptors::kOther,
2477 locs()); 2469 locs());
2478 } 2470 }
2479 2471
2480 LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone, 2472 LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone,
2481 bool opt) const { 2473 bool opt) const {
2482 const intptr_t kNumInputs = 1; 2474 const intptr_t kNumInputs = 1;
2483 const intptr_t kNumTemps = 1; 2475 const intptr_t kNumTemps = 1;
(...skipping 3091 matching lines...) Expand 10 before | Expand all | Expand 10 after
5575 5567
5576 5568
5577 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Zone* zone, 5569 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Zone* zone,
5578 bool opt) const { 5570 bool opt) const {
5579 return MakeCallSummary(zone); 5571 return MakeCallSummary(zone);
5580 } 5572 }
5581 5573
5582 5574
5583 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5575 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5584 Isolate* isolate = compiler->isolate(); 5576 Isolate* isolate = compiler->isolate();
5585 StubCode* stub_code = isolate->stub_code();
5586 const Code& stub = Code::Handle(isolate, 5577 const Code& stub = Code::Handle(isolate,
5587 stub_code->GetAllocationStubForClass(cls())); 5578 StubCode::GetAllocationStubForClass(cls()));
5588 const ExternalLabel label(stub.EntryPoint()); 5579 const ExternalLabel label(stub.EntryPoint());
5589 compiler->GenerateCall(token_pos(), 5580 compiler->GenerateCall(token_pos(),
5590 &label, 5581 &label,
5591 RawPcDescriptors::kOther, 5582 RawPcDescriptors::kOther,
5592 locs()); 5583 locs());
5593 compiler->AddStubCallTarget(stub); 5584 compiler->AddStubCallTarget(stub);
5594 __ Drop(ArgumentCount()); // Discard arguments. 5585 __ Drop(ArgumentCount()); // Discard arguments.
5595 } 5586 }
5596 5587
5597 5588
5598 void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5589 void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5599 ASSERT(!compiler->is_optimizing()); 5590 ASSERT(!compiler->is_optimizing());
5600 StubCode* stub_code = compiler->isolate()->stub_code(); 5591 const ExternalLabel label(StubCode::DebugStepCheckEntryPoint());
5601 const ExternalLabel label(stub_code->DebugStepCheckEntryPoint());
5602 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 5592 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
5603 } 5593 }
5604 5594
5605 5595
5606 LocationSummary* GrowRegExpStackInstr::MakeLocationSummary( 5596 LocationSummary* GrowRegExpStackInstr::MakeLocationSummary(
5607 Zone* zone, bool opt) const { 5597 Zone* zone, bool opt) const {
5608 const intptr_t kNumInputs = 1; 5598 const intptr_t kNumInputs = 1;
5609 const intptr_t kNumTemps = 0; 5599 const intptr_t kNumTemps = 0;
5610 LocationSummary* locs = new(zone) LocationSummary( 5600 LocationSummary* locs = new(zone) LocationSummary(
5611 zone, kNumInputs, kNumTemps, LocationSummary::kCall); 5601 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
(...skipping 14 matching lines...) Expand all
5626 1, 5616 1,
5627 locs()); 5617 locs());
5628 __ Drop(1); 5618 __ Drop(1);
5629 __ Pop(result); 5619 __ Pop(result);
5630 } 5620 }
5631 5621
5632 5622
5633 } // namespace dart 5623 } // namespace dart
5634 5624
5635 #endif // defined TARGET_ARCH_ARM64 5625 #endif // defined TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698