OLD | NEW |
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 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 } else { | 935 } else { |
936 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize); | 936 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize); |
937 } | 937 } |
938 // Compute the effective address. When running under the simulator, | 938 // Compute the effective address. When running under the simulator, |
939 // this is a redirection address that forces the simulator to call | 939 // this is a redirection address that forces the simulator to call |
940 // into the runtime system. | 940 // into the runtime system. |
941 uword entry = reinterpret_cast<uword>(native_c_function()); | 941 uword entry = reinterpret_cast<uword>(native_c_function()); |
942 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); | 942 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); |
943 const bool is_leaf_call = | 943 const bool is_leaf_call = |
944 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; | 944 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; |
945 const ExternalLabel* stub_entry; | 945 const StubEntry* stub_entry = NULL; |
946 if (is_bootstrap_native() || is_leaf_call) { | 946 if (is_bootstrap_native() || is_leaf_call) { |
947 stub_entry = &StubCode::CallBootstrapCFunctionLabel(); | 947 stub_entry = StubCode::CallBootstrapCFunction_entry(); |
948 #if defined(USING_SIMULATOR) | 948 #if defined(USING_SIMULATOR) |
949 entry = Simulator::RedirectExternalReference( | 949 entry = Simulator::RedirectExternalReference( |
950 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); | 950 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); |
951 #endif | 951 #endif |
952 } else { | 952 } else { |
953 // In the case of non bootstrap native methods the CallNativeCFunction | 953 // In the case of non bootstrap native methods the CallNativeCFunction |
954 // stub generates the redirection address when running under the simulator | 954 // stub generates the redirection address when running under the simulator |
955 // and hence we do not change 'entry' here. | 955 // and hence we do not change 'entry' here. |
956 stub_entry = &StubCode::CallNativeCFunctionLabel(); | 956 stub_entry = StubCode::CallNativeCFunction_entry(); |
957 #if defined(USING_SIMULATOR) | 957 #if defined(USING_SIMULATOR) |
958 if (!function().IsNativeAutoSetupScope()) { | 958 if (!function().IsNativeAutoSetupScope()) { |
959 entry = Simulator::RedirectExternalReference( | 959 entry = Simulator::RedirectExternalReference( |
960 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); | 960 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); |
961 } | 961 } |
962 #endif | 962 #endif |
963 } | 963 } |
964 __ LoadImmediate(R5, entry); | 964 __ LoadImmediate(R5, entry); |
965 __ LoadImmediate(R1, argc_tag); | 965 __ LoadImmediate(R1, argc_tag); |
966 compiler->GenerateCall(token_pos(), | 966 compiler->GenerateCall(token_pos(), |
967 stub_entry, | 967 *stub_entry, |
968 RawPcDescriptors::kOther, | 968 RawPcDescriptors::kOther, |
969 locs()); | 969 locs()); |
970 __ Pop(result); | 970 __ Pop(result); |
971 } | 971 } |
972 | 972 |
973 | 973 |
974 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(Zone* zone, | 974 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(Zone* zone, |
975 bool opt) const { | 975 bool opt) const { |
976 const intptr_t kNumInputs = 1; | 976 const intptr_t kNumInputs = 1; |
977 // TODO(fschneider): Allow immediate operands for the char code. | 977 // TODO(fschneider): Allow immediate operands for the char code. |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1814 Isolate* isolate = compiler->isolate(); | 1814 Isolate* isolate = compiler->isolate(); |
1815 | 1815 |
1816 if (Assembler::EmittingComments()) { | 1816 if (Assembler::EmittingComments()) { |
1817 __ Comment("%s slow path allocation of %s", | 1817 __ Comment("%s slow path allocation of %s", |
1818 instruction_->DebugName(), | 1818 instruction_->DebugName(), |
1819 String::Handle(cls_.PrettyName()).ToCString()); | 1819 String::Handle(cls_.PrettyName()).ToCString()); |
1820 } | 1820 } |
1821 __ Bind(entry_label()); | 1821 __ Bind(entry_label()); |
1822 const Code& stub = | 1822 const Code& stub = |
1823 Code::Handle(isolate, StubCode::GetAllocationStubForClass(cls_)); | 1823 Code::Handle(isolate, StubCode::GetAllocationStubForClass(cls_)); |
1824 const ExternalLabel label(stub.EntryPoint()); | 1824 const StubEntry stub_entry(stub); |
1825 | 1825 |
1826 LocationSummary* locs = instruction_->locs(); | 1826 LocationSummary* locs = instruction_->locs(); |
1827 | 1827 |
1828 locs->live_registers()->Remove(Location::RegisterLocation(result_)); | 1828 locs->live_registers()->Remove(Location::RegisterLocation(result_)); |
1829 | 1829 |
1830 compiler->SaveLiveRegisters(locs); | 1830 compiler->SaveLiveRegisters(locs); |
1831 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. | 1831 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. |
1832 &label, | 1832 stub_entry, |
1833 RawPcDescriptors::kOther, | 1833 RawPcDescriptors::kOther, |
1834 locs); | 1834 locs); |
1835 compiler->AddStubCallTarget(stub); | 1835 compiler->AddStubCallTarget(stub); |
1836 __ MoveRegister(result_, R0); | 1836 __ MoveRegister(result_, R0); |
1837 compiler->RestoreLiveRegisters(locs); | 1837 compiler->RestoreLiveRegisters(locs); |
1838 __ b(exit_label()); | 1838 __ b(exit_label()); |
1839 } | 1839 } |
1840 | 1840 |
1841 static void Allocate(FlowGraphCompiler* compiler, | 1841 static void Allocate(FlowGraphCompiler* compiler, |
1842 Instruction* instruction, | 1842 Instruction* instruction, |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2386 deopt_id(), | 2386 deopt_id(), |
2387 kAllocateArrayRuntimeEntry, | 2387 kAllocateArrayRuntimeEntry, |
2388 2, | 2388 2, |
2389 locs()); | 2389 locs()); |
2390 __ Drop(2); | 2390 __ Drop(2); |
2391 __ Pop(kResultReg); | 2391 __ Pop(kResultReg); |
2392 __ Bind(&done); | 2392 __ Bind(&done); |
2393 return; | 2393 return; |
2394 } | 2394 } |
2395 } | 2395 } |
2396 const ExternalLabel label(StubCode::AllocateArrayEntryPoint()); | |
2397 compiler->GenerateCall(token_pos(), | 2396 compiler->GenerateCall(token_pos(), |
2398 &label, | 2397 *StubCode::AllocateArray_entry(), |
2399 RawPcDescriptors::kOther, | 2398 RawPcDescriptors::kOther, |
2400 locs()); | 2399 locs()); |
2401 ASSERT(locs()->out(0).reg() == kResultReg); | 2400 ASSERT(locs()->out(0).reg() == kResultReg); |
2402 } | 2401 } |
2403 | 2402 |
2404 | 2403 |
2405 LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, | 2404 LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, |
2406 bool opt) const { | 2405 bool opt) const { |
2407 const intptr_t kNumInputs = 1; | 2406 const intptr_t kNumInputs = 1; |
2408 const intptr_t kNumTemps = | 2407 const intptr_t kNumTemps = |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2674 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 2673 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
2675 __ Comment("AllocateContextSlowPath"); | 2674 __ Comment("AllocateContextSlowPath"); |
2676 __ Bind(entry_label()); | 2675 __ Bind(entry_label()); |
2677 | 2676 |
2678 LocationSummary* locs = instruction_->locs(); | 2677 LocationSummary* locs = instruction_->locs(); |
2679 locs->live_registers()->Remove(locs->out(0)); | 2678 locs->live_registers()->Remove(locs->out(0)); |
2680 | 2679 |
2681 compiler->SaveLiveRegisters(locs); | 2680 compiler->SaveLiveRegisters(locs); |
2682 | 2681 |
2683 __ LoadImmediate(R1, instruction_->num_context_variables()); | 2682 __ LoadImmediate(R1, instruction_->num_context_variables()); |
2684 const ExternalLabel label(StubCode::AllocateContextEntryPoint()); | |
2685 compiler->GenerateCall(instruction_->token_pos(), | 2683 compiler->GenerateCall(instruction_->token_pos(), |
2686 &label, | 2684 *StubCode::AllocateContext_entry(), |
2687 RawPcDescriptors::kOther, | 2685 RawPcDescriptors::kOther, |
2688 locs); | 2686 locs); |
2689 ASSERT(instruction_->locs()->out(0).reg() == R0); | 2687 ASSERT(instruction_->locs()->out(0).reg() == R0); |
2690 compiler->RestoreLiveRegisters(instruction_->locs()); | 2688 compiler->RestoreLiveRegisters(instruction_->locs()); |
2691 __ b(exit_label()); | 2689 __ b(exit_label()); |
2692 } | 2690 } |
2693 | 2691 |
2694 private: | 2692 private: |
2695 AllocateUninitializedContextInstr* instruction_; | 2693 AllocateUninitializedContextInstr* instruction_; |
2696 }; | 2694 }; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2731 locs->set_out(0, Location::RegisterLocation(R0)); | 2729 locs->set_out(0, Location::RegisterLocation(R0)); |
2732 return locs; | 2730 return locs; |
2733 } | 2731 } |
2734 | 2732 |
2735 | 2733 |
2736 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2734 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2737 ASSERT(locs()->temp(0).reg() == R1); | 2735 ASSERT(locs()->temp(0).reg() == R1); |
2738 ASSERT(locs()->out(0).reg() == R0); | 2736 ASSERT(locs()->out(0).reg() == R0); |
2739 | 2737 |
2740 __ LoadImmediate(R1, num_context_variables()); | 2738 __ LoadImmediate(R1, num_context_variables()); |
2741 const ExternalLabel label(StubCode::AllocateContextEntryPoint()); | |
2742 compiler->GenerateCall(token_pos(), | 2739 compiler->GenerateCall(token_pos(), |
2743 &label, | 2740 *StubCode::AllocateContext_entry(), |
2744 RawPcDescriptors::kOther, | 2741 RawPcDescriptors::kOther, |
2745 locs()); | 2742 locs()); |
2746 } | 2743 } |
2747 | 2744 |
2748 | 2745 |
2749 LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone, | 2746 LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone, |
2750 bool opt) const { | 2747 bool opt) const { |
2751 const intptr_t kNumInputs = 1; | 2748 const intptr_t kNumInputs = 1; |
2752 const intptr_t kNumTemps = 1; | 2749 const intptr_t kNumTemps = 1; |
2753 LocationSummary* locs = new(zone) LocationSummary( | 2750 LocationSummary* locs = new(zone) LocationSummary( |
(...skipping 4050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6804 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Zone* zone, | 6801 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Zone* zone, |
6805 bool opt) const { | 6802 bool opt) const { |
6806 return MakeCallSummary(zone); | 6803 return MakeCallSummary(zone); |
6807 } | 6804 } |
6808 | 6805 |
6809 | 6806 |
6810 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6807 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
6811 Isolate* isolate = compiler->isolate(); | 6808 Isolate* isolate = compiler->isolate(); |
6812 const Code& stub = Code::Handle(isolate, | 6809 const Code& stub = Code::Handle(isolate, |
6813 StubCode::GetAllocationStubForClass(cls())); | 6810 StubCode::GetAllocationStubForClass(cls())); |
6814 const ExternalLabel label(stub.EntryPoint()); | 6811 const StubEntry stub_entry(stub); |
6815 compiler->GenerateCall(token_pos(), | 6812 compiler->GenerateCall(token_pos(), |
6816 &label, | 6813 stub_entry, |
6817 RawPcDescriptors::kOther, | 6814 RawPcDescriptors::kOther, |
6818 locs()); | 6815 locs()); |
6819 compiler->AddStubCallTarget(stub); | 6816 compiler->AddStubCallTarget(stub); |
6820 __ Drop(ArgumentCount()); // Discard arguments. | 6817 __ Drop(ArgumentCount()); // Discard arguments. |
6821 } | 6818 } |
6822 | 6819 |
6823 | 6820 |
6824 void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6821 void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
6825 ASSERT(!compiler->is_optimizing()); | 6822 ASSERT(!compiler->is_optimizing()); |
6826 const ExternalLabel label(StubCode::DebugStepCheckEntryPoint()); | 6823 compiler->GenerateCall( |
6827 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 6824 token_pos(), *StubCode::DebugStepCheck_entry(), stub_kind_, locs()); |
6828 } | 6825 } |
6829 | 6826 |
6830 | 6827 |
6831 LocationSummary* GrowRegExpStackInstr::MakeLocationSummary( | 6828 LocationSummary* GrowRegExpStackInstr::MakeLocationSummary( |
6832 Zone* zone, bool opt) const { | 6829 Zone* zone, bool opt) const { |
6833 const intptr_t kNumInputs = 1; | 6830 const intptr_t kNumInputs = 1; |
6834 const intptr_t kNumTemps = 0; | 6831 const intptr_t kNumTemps = 0; |
6835 LocationSummary* locs = new(zone) LocationSummary( | 6832 LocationSummary* locs = new(zone) LocationSummary( |
6836 zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 6833 zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
6837 locs->set_in(0, Location::RegisterLocation(R0)); | 6834 locs->set_in(0, Location::RegisterLocation(R0)); |
(...skipping 13 matching lines...) Expand all Loading... |
6851 1, | 6848 1, |
6852 locs()); | 6849 locs()); |
6853 __ Drop(1); | 6850 __ Drop(1); |
6854 __ Pop(result); | 6851 __ Pop(result); |
6855 } | 6852 } |
6856 | 6853 |
6857 | 6854 |
6858 } // namespace dart | 6855 } // namespace dart |
6859 | 6856 |
6860 #endif // defined TARGET_ARCH_ARM | 6857 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |