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

Side by Side Diff: runtime/vm/intermediate_language_arm.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) 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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 } else { 931 } else {
932 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize); 932 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize);
933 } 933 }
934 // Compute the effective address. When running under the simulator, 934 // Compute the effective address. When running under the simulator,
935 // this is a redirection address that forces the simulator to call 935 // this is a redirection address that forces the simulator to call
936 // into the runtime system. 936 // into the runtime system.
937 uword entry = reinterpret_cast<uword>(native_c_function()); 937 uword entry = reinterpret_cast<uword>(native_c_function());
938 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); 938 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function());
939 const bool is_leaf_call = 939 const bool is_leaf_call =
940 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; 940 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0;
941 StubCode* stub_code = compiler->isolate()->stub_code();
942 const ExternalLabel* stub_entry; 941 const ExternalLabel* stub_entry;
943 if (is_bootstrap_native() || is_leaf_call) { 942 if (is_bootstrap_native() || is_leaf_call) {
944 stub_entry = &stub_code->CallBootstrapCFunctionLabel(); 943 stub_entry = &StubCode::CallBootstrapCFunctionLabel();
945 #if defined(USING_SIMULATOR) 944 #if defined(USING_SIMULATOR)
946 entry = Simulator::RedirectExternalReference( 945 entry = Simulator::RedirectExternalReference(
947 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); 946 entry, Simulator::kBootstrapNativeCall, function().NumParameters());
948 #endif 947 #endif
949 } else { 948 } else {
950 // In the case of non bootstrap native methods the CallNativeCFunction 949 // In the case of non bootstrap native methods the CallNativeCFunction
951 // stub generates the redirection address when running under the simulator 950 // stub generates the redirection address when running under the simulator
952 // and hence we do not change 'entry' here. 951 // and hence we do not change 'entry' here.
953 stub_entry = &stub_code->CallNativeCFunctionLabel(); 952 stub_entry = &StubCode::CallNativeCFunctionLabel();
954 #if defined(USING_SIMULATOR) 953 #if defined(USING_SIMULATOR)
955 if (!function().IsNativeAutoSetupScope()) { 954 if (!function().IsNativeAutoSetupScope()) {
956 entry = Simulator::RedirectExternalReference( 955 entry = Simulator::RedirectExternalReference(
957 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); 956 entry, Simulator::kBootstrapNativeCall, function().NumParameters());
958 } 957 }
959 #endif 958 #endif
960 } 959 }
961 __ LoadImmediate(R5, entry); 960 __ LoadImmediate(R5, entry);
962 __ LoadImmediate(R1, argc_tag); 961 __ LoadImmediate(R1, argc_tag);
963 compiler->GenerateCall(token_pos(), 962 compiler->GenerateCall(token_pos(),
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
1801 public: 1800 public:
1802 BoxAllocationSlowPath(Instruction* instruction, 1801 BoxAllocationSlowPath(Instruction* instruction,
1803 const Class& cls, 1802 const Class& cls,
1804 Register result) 1803 Register result)
1805 : instruction_(instruction), 1804 : instruction_(instruction),
1806 cls_(cls), 1805 cls_(cls),
1807 result_(result) { } 1806 result_(result) { }
1808 1807
1809 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 1808 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
1810 Isolate* isolate = compiler->isolate(); 1809 Isolate* isolate = compiler->isolate();
1811 StubCode* stub_code = isolate->stub_code();
1812 1810
1813 if (Assembler::EmittingComments()) { 1811 if (Assembler::EmittingComments()) {
1814 __ Comment("%s slow path allocation of %s", 1812 __ Comment("%s slow path allocation of %s",
1815 instruction_->DebugName(), 1813 instruction_->DebugName(),
1816 String::Handle(cls_.PrettyName()).ToCString()); 1814 String::Handle(cls_.PrettyName()).ToCString());
1817 } 1815 }
1818 __ Bind(entry_label()); 1816 __ Bind(entry_label());
1819 const Code& stub = 1817 const Code& stub =
1820 Code::Handle(isolate, stub_code->GetAllocationStubForClass(cls_)); 1818 Code::Handle(isolate, StubCode::GetAllocationStubForClass(cls_));
1821 const ExternalLabel label(stub.EntryPoint()); 1819 const ExternalLabel label(stub.EntryPoint());
1822 1820
1823 LocationSummary* locs = instruction_->locs(); 1821 LocationSummary* locs = instruction_->locs();
1824 1822
1825 locs->live_registers()->Remove(Location::RegisterLocation(result_)); 1823 locs->live_registers()->Remove(Location::RegisterLocation(result_));
1826 1824
1827 compiler->SaveLiveRegisters(locs); 1825 compiler->SaveLiveRegisters(locs);
1828 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. 1826 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position.
1829 &label, 1827 &label,
1830 RawPcDescriptors::kOther, 1828 RawPcDescriptors::kOther,
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
2382 deopt_id(), 2380 deopt_id(),
2383 kAllocateArrayRuntimeEntry, 2381 kAllocateArrayRuntimeEntry,
2384 2, 2382 2,
2385 locs()); 2383 locs());
2386 __ Drop(2); 2384 __ Drop(2);
2387 __ Pop(kResultReg); 2385 __ Pop(kResultReg);
2388 __ Bind(&done); 2386 __ Bind(&done);
2389 return; 2387 return;
2390 } 2388 }
2391 } 2389 }
2392 Isolate* isolate = compiler->isolate(); 2390 const ExternalLabel label(StubCode::AllocateArrayEntryPoint());
2393 const Code& stub = Code::Handle(
2394 isolate, isolate->stub_code()->GetAllocateArrayStub());
2395 const ExternalLabel label(stub.EntryPoint());
2396 compiler->GenerateCall(token_pos(), 2391 compiler->GenerateCall(token_pos(),
2397 &label, 2392 &label,
2398 RawPcDescriptors::kOther, 2393 RawPcDescriptors::kOther,
2399 locs()); 2394 locs());
2400 compiler->AddStubCallTarget(stub);
2401 ASSERT(locs()->out(0).reg() == kResultReg); 2395 ASSERT(locs()->out(0).reg() == kResultReg);
2402 } 2396 }
2403 2397
2404 2398
2405 LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, 2399 LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone,
2406 bool opt) const { 2400 bool opt) const {
2407 const intptr_t kNumInputs = 1; 2401 const intptr_t kNumInputs = 1;
2408 const intptr_t kNumTemps = 2402 const intptr_t kNumTemps =
2409 (IsUnboxedLoad() && opt) ? 1 : 2403 (IsUnboxedLoad() && opt) ? 1 :
2410 ((IsPotentialUnboxedLoad()) ? 3 : 0); 2404 ((IsPotentialUnboxedLoad()) ? 3 : 0);
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
2674 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 2668 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
2675 __ Comment("AllocateContextSlowPath"); 2669 __ Comment("AllocateContextSlowPath");
2676 __ Bind(entry_label()); 2670 __ Bind(entry_label());
2677 2671
2678 LocationSummary* locs = instruction_->locs(); 2672 LocationSummary* locs = instruction_->locs();
2679 locs->live_registers()->Remove(locs->out(0)); 2673 locs->live_registers()->Remove(locs->out(0));
2680 2674
2681 compiler->SaveLiveRegisters(locs); 2675 compiler->SaveLiveRegisters(locs);
2682 2676
2683 __ LoadImmediate(R1, instruction_->num_context_variables()); 2677 __ LoadImmediate(R1, instruction_->num_context_variables());
2684 StubCode* stub_code = compiler->isolate()->stub_code(); 2678 const ExternalLabel label(StubCode::AllocateContextEntryPoint());
2685 const ExternalLabel label(stub_code->AllocateContextEntryPoint());
2686 compiler->GenerateCall(instruction_->token_pos(), 2679 compiler->GenerateCall(instruction_->token_pos(),
2687 &label, 2680 &label,
2688 RawPcDescriptors::kOther, 2681 RawPcDescriptors::kOther,
2689 locs); 2682 locs);
2690 ASSERT(instruction_->locs()->out(0).reg() == R0); 2683 ASSERT(instruction_->locs()->out(0).reg() == R0);
2691 compiler->RestoreLiveRegisters(instruction_->locs()); 2684 compiler->RestoreLiveRegisters(instruction_->locs());
2692 __ b(exit_label()); 2685 __ b(exit_label());
2693 } 2686 }
2694 2687
2695 private: 2688 private:
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2732 locs->set_out(0, Location::RegisterLocation(R0)); 2725 locs->set_out(0, Location::RegisterLocation(R0));
2733 return locs; 2726 return locs;
2734 } 2727 }
2735 2728
2736 2729
2737 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2730 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2738 ASSERT(locs()->temp(0).reg() == R1); 2731 ASSERT(locs()->temp(0).reg() == R1);
2739 ASSERT(locs()->out(0).reg() == R0); 2732 ASSERT(locs()->out(0).reg() == R0);
2740 2733
2741 __ LoadImmediate(R1, num_context_variables()); 2734 __ LoadImmediate(R1, num_context_variables());
2742 StubCode* stub_code = compiler->isolate()->stub_code(); 2735 const ExternalLabel label(StubCode::AllocateContextEntryPoint());
2743 const ExternalLabel label(stub_code->AllocateContextEntryPoint());
2744 compiler->GenerateCall(token_pos(), 2736 compiler->GenerateCall(token_pos(),
2745 &label, 2737 &label,
2746 RawPcDescriptors::kOther, 2738 RawPcDescriptors::kOther,
2747 locs()); 2739 locs());
2748 } 2740 }
2749 2741
2750 2742
2751 LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone, 2743 LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone,
2752 bool opt) const { 2744 bool opt) const {
2753 const intptr_t kNumInputs = 1; 2745 const intptr_t kNumInputs = 1;
(...skipping 4045 matching lines...) Expand 10 before | Expand all | Expand 10 after
6799 6791
6800 6792
6801 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Zone* zone, 6793 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Zone* zone,
6802 bool opt) const { 6794 bool opt) const {
6803 return MakeCallSummary(zone); 6795 return MakeCallSummary(zone);
6804 } 6796 }
6805 6797
6806 6798
6807 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6799 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6808 Isolate* isolate = compiler->isolate(); 6800 Isolate* isolate = compiler->isolate();
6809 StubCode* stub_code = isolate->stub_code();
6810 const Code& stub = Code::Handle(isolate, 6801 const Code& stub = Code::Handle(isolate,
6811 stub_code->GetAllocationStubForClass(cls())); 6802 StubCode::GetAllocationStubForClass(cls()));
6812 const ExternalLabel label(stub.EntryPoint()); 6803 const ExternalLabel label(stub.EntryPoint());
6813 compiler->GenerateCall(token_pos(), 6804 compiler->GenerateCall(token_pos(),
6814 &label, 6805 &label,
6815 RawPcDescriptors::kOther, 6806 RawPcDescriptors::kOther,
6816 locs()); 6807 locs());
6817 compiler->AddStubCallTarget(stub); 6808 compiler->AddStubCallTarget(stub);
6818 __ Drop(ArgumentCount()); // Discard arguments. 6809 __ Drop(ArgumentCount()); // Discard arguments.
6819 } 6810 }
6820 6811
6821 6812
6822 void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6813 void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6823 ASSERT(!compiler->is_optimizing()); 6814 ASSERT(!compiler->is_optimizing());
6824 StubCode* stub_code = compiler->isolate()->stub_code(); 6815 const ExternalLabel label(StubCode::DebugStepCheckEntryPoint());
6825 const ExternalLabel label(stub_code->DebugStepCheckEntryPoint());
6826 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 6816 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
6827 } 6817 }
6828 6818
6829 6819
6830 LocationSummary* GrowRegExpStackInstr::MakeLocationSummary( 6820 LocationSummary* GrowRegExpStackInstr::MakeLocationSummary(
6831 Zone* zone, bool opt) const { 6821 Zone* zone, bool opt) const {
6832 const intptr_t kNumInputs = 1; 6822 const intptr_t kNumInputs = 1;
6833 const intptr_t kNumTemps = 0; 6823 const intptr_t kNumTemps = 0;
6834 LocationSummary* locs = new(zone) LocationSummary( 6824 LocationSummary* locs = new(zone) LocationSummary(
6835 zone, kNumInputs, kNumTemps, LocationSummary::kCall); 6825 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
(...skipping 14 matching lines...) Expand all
6850 1, 6840 1,
6851 locs()); 6841 locs());
6852 __ Drop(1); 6842 __ Drop(1);
6853 __ Pop(result); 6843 __ Pop(result);
6854 } 6844 }
6855 6845
6856 6846
6857 } // namespace dart 6847 } // namespace dart
6858 6848
6859 #endif // defined TARGET_ARCH_ARM 6849 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698