| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // where PushArgument is handled by BindInstr::EmitNativeCode. | 56 // where PushArgument is handled by BindInstr::EmitNativeCode. |
| 57 if (compiler->is_optimizing()) { | 57 if (compiler->is_optimizing()) { |
| 58 Location value = locs()->in(0); | 58 Location value = locs()->in(0); |
| 59 if (value.IsRegister()) { | 59 if (value.IsRegister()) { |
| 60 __ Push(value.reg()); | 60 __ Push(value.reg()); |
| 61 } else if (value.IsConstant()) { | 61 } else if (value.IsConstant()) { |
| 62 __ PushObject(value.constant()); | 62 __ PushObject(value.constant()); |
| 63 } else { | 63 } else { |
| 64 ASSERT(value.IsStackSlot()); | 64 ASSERT(value.IsStackSlot()); |
| 65 const intptr_t value_offset = value.ToStackSlotOffset(); | 65 const intptr_t value_offset = value.ToStackSlotOffset(); |
| 66 __ LoadFromOffset(kWord, IP, FP, value_offset); | 66 __ LoadFromOffset(kWord, IP, value.base_reg(), value_offset); |
| 67 __ Push(IP); | 67 __ Push(IP); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 | 72 |
| 73 LocationSummary* ReturnInstr::MakeLocationSummary(Isolate* isolate, | 73 LocationSummary* ReturnInstr::MakeLocationSummary(Isolate* isolate, |
| 74 bool opt) const { | 74 bool opt) const { |
| 75 const intptr_t kNumInputs = 1; | 75 const intptr_t kNumInputs = 1; |
| 76 const intptr_t kNumTemps = 0; | 76 const intptr_t kNumTemps = 0; |
| 77 LocationSummary* locs = new(isolate) LocationSummary( | 77 LocationSummary* locs = new(isolate) LocationSummary( |
| 78 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 78 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 79 locs->set_in(0, Location::RegisterLocation(R0)); | 79 locs->set_in(0, Location::RegisterLocation(R0)); |
| 80 return locs; | 80 return locs; |
| 81 } | 81 } |
| 82 | 82 |
| 83 | 83 |
| 84 // Attempt optimized compilation at return instruction instead of at the entry. | 84 // Attempt optimized compilation at return instruction instead of at the entry. |
| 85 // The entry needs to be patchable, no inlined objects are allowed in the area | 85 // The entry needs to be patchable, no inlined objects are allowed in the area |
| 86 // that will be overwritten by the patch instructions: a branch macro sequence. | 86 // that will be overwritten by the patch instructions: a branch macro sequence. |
| 87 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 87 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 88 const Register result = locs()->in(0).reg(); | 88 const Register result = locs()->in(0).reg(); |
| 89 ASSERT(result == R0); | 89 ASSERT(result == R0); |
| 90 |
| 91 if (compiler->intrinsic_mode()) { |
| 92 // Intrinsics don't have a frame. |
| 93 __ Ret(); |
| 94 return; |
| 95 } |
| 96 |
| 90 #if defined(DEBUG) | 97 #if defined(DEBUG) |
| 91 Label stack_ok; | 98 Label stack_ok; |
| 92 __ Comment("Stack Check"); | 99 __ Comment("Stack Check"); |
| 93 const intptr_t fp_sp_dist = | 100 const intptr_t fp_sp_dist = |
| 94 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; | 101 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
| 95 ASSERT(fp_sp_dist <= 0); | 102 ASSERT(fp_sp_dist <= 0); |
| 96 __ sub(R2, SP, Operand(FP)); | 103 __ sub(R2, SP, Operand(FP)); |
| 97 __ CompareImmediate(R2, fp_sp_dist); | 104 __ CompareImmediate(R2, fp_sp_dist); |
| 98 __ b(&stack_ok, EQ); | 105 __ b(&stack_ok, EQ); |
| 99 __ bkpt(0); | 106 __ bkpt(0); |
| (...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1830 Smi::RawValue(field().guarded_list_length())); | 1837 Smi::RawValue(field().guarded_list_length())); |
| 1831 __ b(deopt, NE); | 1838 __ b(deopt, NE); |
| 1832 } | 1839 } |
| 1833 } | 1840 } |
| 1834 | 1841 |
| 1835 | 1842 |
| 1836 class BoxAllocationSlowPath : public SlowPathCode { | 1843 class BoxAllocationSlowPath : public SlowPathCode { |
| 1837 public: | 1844 public: |
| 1838 BoxAllocationSlowPath(Instruction* instruction, | 1845 BoxAllocationSlowPath(Instruction* instruction, |
| 1839 const Class& cls, | 1846 const Class& cls, |
| 1840 Register result) | 1847 Register result, |
| 1848 bool is_intrinsic) |
| 1841 : instruction_(instruction), | 1849 : instruction_(instruction), |
| 1842 cls_(cls), | 1850 cls_(cls), |
| 1843 result_(result) { } | 1851 result_(result), |
| 1852 is_intrinsic_(is_intrinsic) { } |
| 1844 | 1853 |
| 1845 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 1854 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1846 Isolate* isolate = compiler->isolate(); | 1855 Isolate* isolate = compiler->isolate(); |
| 1847 StubCode* stub_code = isolate->stub_code(); | 1856 StubCode* stub_code = isolate->stub_code(); |
| 1848 | 1857 |
| 1849 if (Assembler::EmittingComments()) { | 1858 if (Assembler::EmittingComments()) { |
| 1850 __ Comment("%s slow path allocation of %s", | 1859 __ Comment("%s slow path allocation of %s", |
| 1851 instruction_->DebugName(), | 1860 instruction_->DebugName(), |
| 1852 String::Handle(cls_.PrettyName()).ToCString()); | 1861 String::Handle(cls_.PrettyName()).ToCString()); |
| 1853 } | 1862 } |
| 1854 __ Bind(entry_label()); | 1863 __ Bind(entry_label()); |
| 1855 | 1864 |
| 1865 if (is_intrinsic_) { |
| 1866 __ EnterStubFrame(true); |
| 1867 } |
| 1868 |
| 1856 const Code& stub = | 1869 const Code& stub = |
| 1857 Code::Handle(isolate, stub_code->GetAllocationStubForClass(cls_)); | 1870 Code::Handle(isolate, stub_code->GetAllocationStubForClass(cls_)); |
| 1858 const ExternalLabel label(stub.EntryPoint()); | 1871 const ExternalLabel label(stub.EntryPoint()); |
| 1859 | 1872 |
| 1860 LocationSummary* locs = instruction_->locs(); | 1873 LocationSummary* locs = instruction_->locs(); |
| 1861 | 1874 |
| 1862 locs->live_registers()->Remove(Location::RegisterLocation(result_)); | 1875 locs->live_registers()->Remove(Location::RegisterLocation(result_)); |
| 1863 | 1876 |
| 1864 compiler->SaveLiveRegisters(locs); | 1877 compiler->SaveLiveRegisters(locs); |
| 1865 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. | 1878 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. |
| 1866 &label, | 1879 &label, |
| 1867 RawPcDescriptors::kOther, | 1880 RawPcDescriptors::kOther, |
| 1868 locs); | 1881 locs); |
| 1869 __ MoveRegister(result_, R0); | 1882 __ MoveRegister(result_, R0); |
| 1870 compiler->RestoreLiveRegisters(locs); | 1883 compiler->RestoreLiveRegisters(locs); |
| 1871 | 1884 |
| 1885 if (is_intrinsic_) { |
| 1886 __ LeaveStubFrame(); |
| 1887 } |
| 1872 __ b(exit_label()); | 1888 __ b(exit_label()); |
| 1873 } | 1889 } |
| 1874 | 1890 |
| 1875 static void Allocate(FlowGraphCompiler* compiler, | 1891 static void Allocate(FlowGraphCompiler* compiler, |
| 1876 Instruction* instruction, | 1892 Instruction* instruction, |
| 1877 const Class& cls, | 1893 const Class& cls, |
| 1878 Register result, | 1894 Register result, |
| 1879 Register temp) { | 1895 Register temp) { |
| 1880 BoxAllocationSlowPath* slow_path = | 1896 BoxAllocationSlowPath* slow_path = |
| 1881 new BoxAllocationSlowPath(instruction, cls, result); | 1897 new BoxAllocationSlowPath(instruction, cls, result, |
| 1898 compiler->intrinsic_mode()); |
| 1882 compiler->AddSlowPathCode(slow_path); | 1899 compiler->AddSlowPathCode(slow_path); |
| 1883 | 1900 |
| 1884 __ TryAllocate(cls, | 1901 __ TryAllocate(cls, |
| 1885 slow_path->entry_label(), | 1902 slow_path->entry_label(), |
| 1886 result, | 1903 result, |
| 1887 temp); | 1904 temp); |
| 1888 __ Bind(slow_path->exit_label()); | 1905 __ Bind(slow_path->exit_label()); |
| 1889 } | 1906 } |
| 1890 | 1907 |
| 1891 private: | 1908 private: |
| 1892 Instruction* instruction_; | 1909 Instruction* instruction_; |
| 1893 const Class& cls_; | 1910 const Class& cls_; |
| 1894 Register result_; | 1911 Register result_; |
| 1912 bool is_intrinsic_; |
| 1895 }; | 1913 }; |
| 1896 | 1914 |
| 1897 | 1915 |
| 1898 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Isolate* isolate, | 1916 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Isolate* isolate, |
| 1899 bool opt) const { | 1917 bool opt) const { |
| 1900 const intptr_t kNumInputs = 2; | 1918 const intptr_t kNumInputs = 2; |
| 1901 const intptr_t kNumTemps = | 1919 const intptr_t kNumTemps = |
| 1902 (IsUnboxedStore() && opt) ? 2 : | 1920 (IsUnboxedStore() && opt) ? 2 : |
| 1903 ((IsPotentialUnboxedStore()) ? 3 : 0); | 1921 ((IsPotentialUnboxedStore()) ? 3 : 0); |
| 1904 LocationSummary* summary = new(isolate) LocationSummary( | 1922 LocationSummary* summary = new(isolate) LocationSummary( |
| (...skipping 5316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7221 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 7239 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); |
| 7222 #if defined(DEBUG) | 7240 #if defined(DEBUG) |
| 7223 __ LoadImmediate(R4, kInvalidObjectPointer); | 7241 __ LoadImmediate(R4, kInvalidObjectPointer); |
| 7224 __ LoadImmediate(R5, kInvalidObjectPointer); | 7242 __ LoadImmediate(R5, kInvalidObjectPointer); |
| 7225 #endif | 7243 #endif |
| 7226 } | 7244 } |
| 7227 | 7245 |
| 7228 } // namespace dart | 7246 } // namespace dart |
| 7229 | 7247 |
| 7230 #endif // defined TARGET_ARCH_ARM | 7248 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |