| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 __ ret(); | 100 __ ret(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 | 103 |
| 104 LocationSummary* LoadLocalInstr::MakeLocationSummary(Isolate* isolate, | 104 LocationSummary* LoadLocalInstr::MakeLocationSummary(Isolate* isolate, |
| 105 bool opt) const { | 105 bool opt) const { |
| 106 const intptr_t kNumInputs = 0; | 106 const intptr_t kNumInputs = 0; |
| 107 const intptr_t stack_index = (local().index() < 0) | 107 const intptr_t stack_index = (local().index() < 0) |
| 108 ? kFirstLocalSlotFromFp - local().index() | 108 ? kFirstLocalSlotFromFp - local().index() |
| 109 : kParamEndSlotFromFp - local().index(); | 109 : kParamEndSlotFromFp - local().index(); |
| 110 return LocationSummary::Make(kNumInputs, | 110 return LocationSummary::Make(isolate, |
| 111 kNumInputs, |
| 111 Location::StackSlot(stack_index), | 112 Location::StackSlot(stack_index), |
| 112 LocationSummary::kNoCall); | 113 LocationSummary::kNoCall); |
| 113 } | 114 } |
| 114 | 115 |
| 115 | 116 |
| 116 void LoadLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 117 void LoadLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 117 ASSERT(!compiler->is_optimizing()); | 118 ASSERT(!compiler->is_optimizing()); |
| 118 // Nothing to do. | 119 // Nothing to do. |
| 119 } | 120 } |
| 120 | 121 |
| 121 | 122 |
| 122 LocationSummary* StoreLocalInstr::MakeLocationSummary(Isolate* isolate, | 123 LocationSummary* StoreLocalInstr::MakeLocationSummary(Isolate* isolate, |
| 123 bool opt) const { | 124 bool opt) const { |
| 124 const intptr_t kNumInputs = 1; | 125 const intptr_t kNumInputs = 1; |
| 125 return LocationSummary::Make(kNumInputs, | 126 return LocationSummary::Make(isolate, |
| 127 kNumInputs, |
| 126 Location::SameAsFirstInput(), | 128 Location::SameAsFirstInput(), |
| 127 LocationSummary::kNoCall); | 129 LocationSummary::kNoCall); |
| 128 } | 130 } |
| 129 | 131 |
| 130 | 132 |
| 131 void StoreLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 133 void StoreLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 132 Register value = locs()->in(0).reg(); | 134 Register value = locs()->in(0).reg(); |
| 133 Register result = locs()->out(0).reg(); | 135 Register result = locs()->out(0).reg(); |
| 134 ASSERT(result == value); // Assert that register assignment is correct. | 136 ASSERT(result == value); // Assert that register assignment is correct. |
| 135 __ movl(Address(EBP, local().index() * kWordSize), value); | 137 __ movl(Address(EBP, local().index() * kWordSize), value); |
| 136 } | 138 } |
| 137 | 139 |
| 138 | 140 |
| 139 LocationSummary* ConstantInstr::MakeLocationSummary(Isolate* isolate, | 141 LocationSummary* ConstantInstr::MakeLocationSummary(Isolate* isolate, |
| 140 bool opt) const { | 142 bool opt) const { |
| 141 const intptr_t kNumInputs = 0; | 143 const intptr_t kNumInputs = 0; |
| 142 return LocationSummary::Make(kNumInputs, | 144 return LocationSummary::Make(isolate, |
| 145 kNumInputs, |
| 143 Location::RequiresRegister(), | 146 Location::RequiresRegister(), |
| 144 LocationSummary::kNoCall); | 147 LocationSummary::kNoCall); |
| 145 } | 148 } |
| 146 | 149 |
| 147 | 150 |
| 148 void ConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 151 void ConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 149 // The register allocator drops constant definitions that have no uses. | 152 // The register allocator drops constant definitions that have no uses. |
| 150 if (!locs()->out(0).IsInvalid()) { | 153 if (!locs()->out(0).IsInvalid()) { |
| 151 Register result = locs()->out(0).reg(); | 154 Register result = locs()->out(0).reg(); |
| 152 __ LoadObjectSafely(result, value()); | 155 __ LoadObjectSafely(result, value()); |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 const intptr_t offset = Instance::DataOffsetFor(cid); | 829 const intptr_t offset = Instance::DataOffsetFor(cid); |
| 827 const int64_t displacement = index * scale + offset; | 830 const int64_t displacement = index * scale + offset; |
| 828 return Utils::IsInt(32, displacement); | 831 return Utils::IsInt(32, displacement); |
| 829 } | 832 } |
| 830 | 833 |
| 831 | 834 |
| 832 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(Isolate* isolate, | 835 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(Isolate* isolate, |
| 833 bool opt) const { | 836 bool opt) const { |
| 834 const intptr_t kNumInputs = 1; | 837 const intptr_t kNumInputs = 1; |
| 835 // TODO(fschneider): Allow immediate operands for the char code. | 838 // TODO(fschneider): Allow immediate operands for the char code. |
| 836 return LocationSummary::Make(kNumInputs, | 839 return LocationSummary::Make(isolate, |
| 840 kNumInputs, |
| 837 Location::RequiresRegister(), | 841 Location::RequiresRegister(), |
| 838 LocationSummary::kNoCall); | 842 LocationSummary::kNoCall); |
| 839 } | 843 } |
| 840 | 844 |
| 841 | 845 |
| 842 void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 846 void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 843 Register char_code = locs()->in(0).reg(); | 847 Register char_code = locs()->in(0).reg(); |
| 844 Register result = locs()->out(0).reg(); | 848 Register result = locs()->out(0).reg(); |
| 845 __ movl(result, | 849 __ movl(result, |
| 846 Immediate(reinterpret_cast<uword>(Symbols::PredefinedAddress()))); | 850 Immediate(reinterpret_cast<uword>(Symbols::PredefinedAddress()))); |
| 847 __ movl(result, Address(result, | 851 __ movl(result, Address(result, |
| 848 char_code, | 852 char_code, |
| 849 TIMES_HALF_WORD_SIZE, // Char code is a smi. | 853 TIMES_HALF_WORD_SIZE, // Char code is a smi. |
| 850 Symbols::kNullCharCodeSymbolOffset * kWordSize)); | 854 Symbols::kNullCharCodeSymbolOffset * kWordSize)); |
| 851 } | 855 } |
| 852 | 856 |
| 853 | 857 |
| 854 LocationSummary* StringToCharCodeInstr::MakeLocationSummary(Isolate* isolate, | 858 LocationSummary* StringToCharCodeInstr::MakeLocationSummary(Isolate* isolate, |
| 855 bool opt) const { | 859 bool opt) const { |
| 856 const intptr_t kNumInputs = 1; | 860 const intptr_t kNumInputs = 1; |
| 857 return LocationSummary::Make(kNumInputs, | 861 return LocationSummary::Make(isolate, |
| 862 kNumInputs, |
| 858 Location::RequiresRegister(), | 863 Location::RequiresRegister(), |
| 859 LocationSummary::kNoCall); | 864 LocationSummary::kNoCall); |
| 860 } | 865 } |
| 861 | 866 |
| 862 | 867 |
| 863 void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 868 void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 864 ASSERT(cid_ == kOneByteStringCid); | 869 ASSERT(cid_ == kOneByteStringCid); |
| 865 Register str = locs()->in(0).reg(); | 870 Register str = locs()->in(0).reg(); |
| 866 Register result = locs()->out(0).reg(); | 871 Register result = locs()->out(0).reg(); |
| 867 Label is_one, done; | 872 Label is_one, done; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 kNumberOfArguments, | 905 kNumberOfArguments, |
| 901 kNoArgumentNames, | 906 kNoArgumentNames, |
| 902 locs()); | 907 locs()); |
| 903 ASSERT(locs()->out(0).reg() == EAX); | 908 ASSERT(locs()->out(0).reg() == EAX); |
| 904 } | 909 } |
| 905 | 910 |
| 906 | 911 |
| 907 LocationSummary* LoadUntaggedInstr::MakeLocationSummary(Isolate* isolate, | 912 LocationSummary* LoadUntaggedInstr::MakeLocationSummary(Isolate* isolate, |
| 908 bool opt) const { | 913 bool opt) const { |
| 909 const intptr_t kNumInputs = 1; | 914 const intptr_t kNumInputs = 1; |
| 910 return LocationSummary::Make(kNumInputs, | 915 return LocationSummary::Make(isolate, |
| 916 kNumInputs, |
| 911 Location::RequiresRegister(), | 917 Location::RequiresRegister(), |
| 912 LocationSummary::kNoCall); | 918 LocationSummary::kNoCall); |
| 913 } | 919 } |
| 914 | 920 |
| 915 | 921 |
| 916 void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 922 void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 917 Register object = locs()->in(0).reg(); | 923 Register object = locs()->in(0).reg(); |
| 918 Register result = locs()->out(0).reg(); | 924 Register result = locs()->out(0).reg(); |
| 919 __ movl(result, FieldAddress(object, offset())); | 925 __ movl(result, FieldAddress(object, offset())); |
| 920 } | 926 } |
| 921 | 927 |
| 922 | 928 |
| 923 LocationSummary* LoadClassIdInstr::MakeLocationSummary(Isolate* isolate, | 929 LocationSummary* LoadClassIdInstr::MakeLocationSummary(Isolate* isolate, |
| 924 bool opt) const { | 930 bool opt) const { |
| 925 const intptr_t kNumInputs = 1; | 931 const intptr_t kNumInputs = 1; |
| 926 return LocationSummary::Make(kNumInputs, | 932 return LocationSummary::Make(isolate, |
| 933 kNumInputs, |
| 927 Location::RequiresRegister(), | 934 Location::RequiresRegister(), |
| 928 LocationSummary::kNoCall); | 935 LocationSummary::kNoCall); |
| 929 } | 936 } |
| 930 | 937 |
| 931 | 938 |
| 932 void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 939 void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 933 Register object = locs()->in(0).reg(); | 940 Register object = locs()->in(0).reg(); |
| 934 Register result = locs()->out(0).reg(); | 941 Register result = locs()->out(0).reg(); |
| 935 Label load, done; | 942 Label load, done; |
| 936 __ testl(object, Immediate(kSmiTagMask)); | 943 __ testl(object, Immediate(kSmiTagMask)); |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1792 public: | 1799 public: |
| 1793 StoreInstanceFieldSlowPath(StoreInstanceFieldInstr* instruction, | 1800 StoreInstanceFieldSlowPath(StoreInstanceFieldInstr* instruction, |
| 1794 const Class& cls) | 1801 const Class& cls) |
| 1795 : instruction_(instruction), cls_(cls) { } | 1802 : instruction_(instruction), cls_(cls) { } |
| 1796 | 1803 |
| 1797 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 1804 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1798 __ Comment("StoreInstanceFieldSlowPath"); | 1805 __ Comment("StoreInstanceFieldSlowPath"); |
| 1799 __ Bind(entry_label()); | 1806 __ Bind(entry_label()); |
| 1800 const Code& stub = | 1807 const Code& stub = |
| 1801 Code::Handle(StubCode::GetAllocationStubForClass(cls_)); | 1808 Code::Handle(StubCode::GetAllocationStubForClass(cls_)); |
| 1802 const ExternalLabel label(cls_.ToCString(), stub.EntryPoint()); | 1809 const ExternalLabel label(stub.EntryPoint()); |
| 1803 | 1810 |
| 1804 LocationSummary* locs = instruction_->locs(); | 1811 LocationSummary* locs = instruction_->locs(); |
| 1805 locs->live_registers()->Remove(locs->out(0)); | 1812 locs->live_registers()->Remove(locs->out(0)); |
| 1806 compiler->SaveLiveRegisters(locs); | 1813 compiler->SaveLiveRegisters(locs); |
| 1807 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. | 1814 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. |
| 1808 &label, | 1815 &label, |
| 1809 PcDescriptors::kOther, | 1816 PcDescriptors::kOther, |
| 1810 locs); | 1817 locs); |
| 1811 __ MoveRegister(locs->temp(0).reg(), EAX); | 1818 __ MoveRegister(locs->temp(0).reg(), EAX); |
| 1812 compiler->RestoreLiveRegisters(locs); | 1819 compiler->RestoreLiveRegisters(locs); |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2281 public: | 2288 public: |
| 2282 explicit BoxDoubleSlowPath(Instruction* instruction) | 2289 explicit BoxDoubleSlowPath(Instruction* instruction) |
| 2283 : instruction_(instruction) { } | 2290 : instruction_(instruction) { } |
| 2284 | 2291 |
| 2285 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 2292 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2286 __ Comment("BoxDoubleSlowPath"); | 2293 __ Comment("BoxDoubleSlowPath"); |
| 2287 __ Bind(entry_label()); | 2294 __ Bind(entry_label()); |
| 2288 const Class& double_class = compiler->double_class(); | 2295 const Class& double_class = compiler->double_class(); |
| 2289 const Code& stub = | 2296 const Code& stub = |
| 2290 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); | 2297 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); |
| 2291 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint()); | 2298 const ExternalLabel label(stub.EntryPoint()); |
| 2292 | 2299 |
| 2293 LocationSummary* locs = instruction_->locs(); | 2300 LocationSummary* locs = instruction_->locs(); |
| 2294 locs->live_registers()->Remove(locs->out(0)); | 2301 locs->live_registers()->Remove(locs->out(0)); |
| 2295 | 2302 |
| 2296 compiler->SaveLiveRegisters(locs); | 2303 compiler->SaveLiveRegisters(locs); |
| 2297 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. | 2304 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. |
| 2298 &label, | 2305 &label, |
| 2299 PcDescriptors::kOther, | 2306 PcDescriptors::kOther, |
| 2300 locs); | 2307 locs); |
| 2301 __ MoveRegister(locs->out(0).reg(), EAX); | 2308 __ MoveRegister(locs->out(0).reg(), EAX); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2313 public: | 2320 public: |
| 2314 explicit BoxFloat32x4SlowPath(Instruction* instruction) | 2321 explicit BoxFloat32x4SlowPath(Instruction* instruction) |
| 2315 : instruction_(instruction) { } | 2322 : instruction_(instruction) { } |
| 2316 | 2323 |
| 2317 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 2324 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2318 __ Comment("BoxFloat32x4SlowPath"); | 2325 __ Comment("BoxFloat32x4SlowPath"); |
| 2319 __ Bind(entry_label()); | 2326 __ Bind(entry_label()); |
| 2320 const Class& float32x4_class = compiler->float32x4_class(); | 2327 const Class& float32x4_class = compiler->float32x4_class(); |
| 2321 const Code& stub = | 2328 const Code& stub = |
| 2322 Code::Handle(StubCode::GetAllocationStubForClass(float32x4_class)); | 2329 Code::Handle(StubCode::GetAllocationStubForClass(float32x4_class)); |
| 2323 const ExternalLabel label(float32x4_class.ToCString(), stub.EntryPoint()); | 2330 const ExternalLabel label(stub.EntryPoint()); |
| 2324 | 2331 |
| 2325 LocationSummary* locs = instruction_->locs(); | 2332 LocationSummary* locs = instruction_->locs(); |
| 2326 locs->live_registers()->Remove(locs->out(0)); | 2333 locs->live_registers()->Remove(locs->out(0)); |
| 2327 | 2334 |
| 2328 compiler->SaveLiveRegisters(locs); | 2335 compiler->SaveLiveRegisters(locs); |
| 2329 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. | 2336 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. |
| 2330 &label, | 2337 &label, |
| 2331 PcDescriptors::kOther, | 2338 PcDescriptors::kOther, |
| 2332 locs); | 2339 locs); |
| 2333 __ MoveRegister(locs->out(0).reg(), EAX); | 2340 __ MoveRegister(locs->out(0).reg(), EAX); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2345 public: | 2352 public: |
| 2346 explicit BoxFloat64x2SlowPath(Instruction* instruction) | 2353 explicit BoxFloat64x2SlowPath(Instruction* instruction) |
| 2347 : instruction_(instruction) { } | 2354 : instruction_(instruction) { } |
| 2348 | 2355 |
| 2349 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 2356 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2350 __ Comment("BoxFloat64x2SlowPath"); | 2357 __ Comment("BoxFloat64x2SlowPath"); |
| 2351 __ Bind(entry_label()); | 2358 __ Bind(entry_label()); |
| 2352 const Class& float64x2_class = compiler->float64x2_class(); | 2359 const Class& float64x2_class = compiler->float64x2_class(); |
| 2353 const Code& stub = | 2360 const Code& stub = |
| 2354 Code::Handle(StubCode::GetAllocationStubForClass(float64x2_class)); | 2361 Code::Handle(StubCode::GetAllocationStubForClass(float64x2_class)); |
| 2355 const ExternalLabel label(float64x2_class.ToCString(), stub.EntryPoint()); | 2362 const ExternalLabel label(stub.EntryPoint()); |
| 2356 | 2363 |
| 2357 LocationSummary* locs = instruction_->locs(); | 2364 LocationSummary* locs = instruction_->locs(); |
| 2358 locs->live_registers()->Remove(locs->out(0)); | 2365 locs->live_registers()->Remove(locs->out(0)); |
| 2359 | 2366 |
| 2360 compiler->SaveLiveRegisters(locs); | 2367 compiler->SaveLiveRegisters(locs); |
| 2361 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. | 2368 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. |
| 2362 &label, | 2369 &label, |
| 2363 PcDescriptors::kOther, | 2370 PcDescriptors::kOther, |
| 2364 locs); | 2371 locs); |
| 2365 __ MoveRegister(locs->out(0).reg(), EAX); | 2372 __ MoveRegister(locs->out(0).reg(), EAX); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2653 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 2660 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2654 __ Comment("AllocateContextSlowPath"); | 2661 __ Comment("AllocateContextSlowPath"); |
| 2655 __ Bind(entry_label()); | 2662 __ Bind(entry_label()); |
| 2656 | 2663 |
| 2657 LocationSummary* locs = instruction_->locs(); | 2664 LocationSummary* locs = instruction_->locs(); |
| 2658 locs->live_registers()->Remove(locs->out(0)); | 2665 locs->live_registers()->Remove(locs->out(0)); |
| 2659 | 2666 |
| 2660 compiler->SaveLiveRegisters(locs); | 2667 compiler->SaveLiveRegisters(locs); |
| 2661 | 2668 |
| 2662 __ movl(EDX, Immediate(instruction_->num_context_variables())); | 2669 __ movl(EDX, Immediate(instruction_->num_context_variables())); |
| 2663 const ExternalLabel label("alloc_context", | 2670 const ExternalLabel label(StubCode::AllocateContextEntryPoint()); |
| 2664 StubCode::AllocateContextEntryPoint()); | |
| 2665 compiler->GenerateCall(instruction_->token_pos(), | 2671 compiler->GenerateCall(instruction_->token_pos(), |
| 2666 &label, | 2672 &label, |
| 2667 PcDescriptors::kOther, | 2673 PcDescriptors::kOther, |
| 2668 locs); | 2674 locs); |
| 2669 ASSERT(instruction_->locs()->out(0).reg() == EAX); | 2675 ASSERT(instruction_->locs()->out(0).reg() == EAX); |
| 2670 compiler->RestoreLiveRegisters(instruction_->locs()); | 2676 compiler->RestoreLiveRegisters(instruction_->locs()); |
| 2671 __ jmp(exit_label()); | 2677 __ jmp(exit_label()); |
| 2672 } | 2678 } |
| 2673 | 2679 |
| 2674 private: | 2680 private: |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2744 } | 2750 } |
| 2745 // EAX: new object. | 2751 // EAX: new object. |
| 2746 __ Bind(slow_path->exit_label()); | 2752 __ Bind(slow_path->exit_label()); |
| 2747 return; | 2753 return; |
| 2748 } | 2754 } |
| 2749 | 2755 |
| 2750 ASSERT(locs()->temp(0).reg() == EDX); | 2756 ASSERT(locs()->temp(0).reg() == EDX); |
| 2751 ASSERT(locs()->out(0).reg() == EAX); | 2757 ASSERT(locs()->out(0).reg() == EAX); |
| 2752 | 2758 |
| 2753 __ movl(EDX, Immediate(num_context_variables())); | 2759 __ movl(EDX, Immediate(num_context_variables())); |
| 2754 const ExternalLabel label("alloc_context", | 2760 const ExternalLabel label(StubCode::AllocateContextEntryPoint()); |
| 2755 StubCode::AllocateContextEntryPoint()); | |
| 2756 compiler->GenerateCall(token_pos(), | 2761 compiler->GenerateCall(token_pos(), |
| 2757 &label, | 2762 &label, |
| 2758 PcDescriptors::kOther, | 2763 PcDescriptors::kOther, |
| 2759 locs()); | 2764 locs()); |
| 2760 } | 2765 } |
| 2761 | 2766 |
| 2762 | 2767 |
| 2763 LocationSummary* CloneContextInstr::MakeLocationSummary(Isolate* isolate, | 2768 LocationSummary* CloneContextInstr::MakeLocationSummary(Isolate* isolate, |
| 2764 bool opt) const { | 2769 bool opt) const { |
| 2765 const intptr_t kNumInputs = 1; | 2770 const intptr_t kNumInputs = 1; |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3689 public: | 3694 public: |
| 3690 explicit BoxInt32x4SlowPath(BoxInt32x4Instr* instruction) | 3695 explicit BoxInt32x4SlowPath(BoxInt32x4Instr* instruction) |
| 3691 : instruction_(instruction) { } | 3696 : instruction_(instruction) { } |
| 3692 | 3697 |
| 3693 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 3698 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3694 __ Comment("BoxInt32x4SlowPath"); | 3699 __ Comment("BoxInt32x4SlowPath"); |
| 3695 __ Bind(entry_label()); | 3700 __ Bind(entry_label()); |
| 3696 const Class& int32x4_class = compiler->int32x4_class(); | 3701 const Class& int32x4_class = compiler->int32x4_class(); |
| 3697 const Code& stub = | 3702 const Code& stub = |
| 3698 Code::Handle(StubCode::GetAllocationStubForClass(int32x4_class)); | 3703 Code::Handle(StubCode::GetAllocationStubForClass(int32x4_class)); |
| 3699 const ExternalLabel label(int32x4_class.ToCString(), stub.EntryPoint()); | 3704 const ExternalLabel label(stub.EntryPoint()); |
| 3700 | 3705 |
| 3701 LocationSummary* locs = instruction_->locs(); | 3706 LocationSummary* locs = instruction_->locs(); |
| 3702 locs->live_registers()->Remove(locs->out(0)); | 3707 locs->live_registers()->Remove(locs->out(0)); |
| 3703 | 3708 |
| 3704 compiler->SaveLiveRegisters(locs); | 3709 compiler->SaveLiveRegisters(locs); |
| 3705 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. | 3710 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. |
| 3706 &label, | 3711 &label, |
| 3707 PcDescriptors::kOther, | 3712 PcDescriptors::kOther, |
| 3708 locs); | 3713 locs); |
| 3709 __ MoveRegister(locs->out(0).reg(), EAX); | 3714 __ MoveRegister(locs->out(0).reg(), EAX); |
| (...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4920 __ cmovgel(result, right); | 4925 __ cmovgel(result, right); |
| 4921 } else { | 4926 } else { |
| 4922 __ cmovlessl(result, right); | 4927 __ cmovlessl(result, right); |
| 4923 } | 4928 } |
| 4924 } | 4929 } |
| 4925 | 4930 |
| 4926 | 4931 |
| 4927 LocationSummary* UnarySmiOpInstr::MakeLocationSummary(Isolate* isolate, | 4932 LocationSummary* UnarySmiOpInstr::MakeLocationSummary(Isolate* isolate, |
| 4928 bool opt) const { | 4933 bool opt) const { |
| 4929 const intptr_t kNumInputs = 1; | 4934 const intptr_t kNumInputs = 1; |
| 4930 return LocationSummary::Make(kNumInputs, | 4935 return LocationSummary::Make(isolate, |
| 4936 kNumInputs, |
| 4931 Location::SameAsFirstInput(), | 4937 Location::SameAsFirstInput(), |
| 4932 LocationSummary::kNoCall); | 4938 LocationSummary::kNoCall); |
| 4933 } | 4939 } |
| 4934 | 4940 |
| 4935 | 4941 |
| 4936 void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4942 void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4937 Register value = locs()->in(0).reg(); | 4943 Register value = locs()->in(0).reg(); |
| 4938 ASSERT(value == locs()->out(0).reg()); | 4944 ASSERT(value == locs()->out(0).reg()); |
| 4939 switch (op_kind()) { | 4945 switch (op_kind()) { |
| 4940 case Token::kNEGATE: { | 4946 case Token::kNEGATE: { |
| (...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5763 explicit BoxIntegerSlowPath(BoxIntegerInstr* instruction) | 5769 explicit BoxIntegerSlowPath(BoxIntegerInstr* instruction) |
| 5764 : instruction_(instruction) { } | 5770 : instruction_(instruction) { } |
| 5765 | 5771 |
| 5766 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 5772 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5767 __ Comment("BoxIntegerSlowPath"); | 5773 __ Comment("BoxIntegerSlowPath"); |
| 5768 __ Bind(entry_label()); | 5774 __ Bind(entry_label()); |
| 5769 const Class& mint_class = | 5775 const Class& mint_class = |
| 5770 Class::ZoneHandle(Isolate::Current()->object_store()->mint_class()); | 5776 Class::ZoneHandle(Isolate::Current()->object_store()->mint_class()); |
| 5771 const Code& stub = | 5777 const Code& stub = |
| 5772 Code::Handle(StubCode::GetAllocationStubForClass(mint_class)); | 5778 Code::Handle(StubCode::GetAllocationStubForClass(mint_class)); |
| 5773 const ExternalLabel label(mint_class.ToCString(), stub.EntryPoint()); | 5779 const ExternalLabel label(stub.EntryPoint()); |
| 5774 | 5780 |
| 5775 LocationSummary* locs = instruction_->locs(); | 5781 LocationSummary* locs = instruction_->locs(); |
| 5776 locs->live_registers()->Remove(locs->out(0)); | 5782 locs->live_registers()->Remove(locs->out(0)); |
| 5777 | 5783 |
| 5778 compiler->SaveLiveRegisters(locs); | 5784 compiler->SaveLiveRegisters(locs); |
| 5779 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. | 5785 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. |
| 5780 &label, | 5786 &label, |
| 5781 PcDescriptors::kOther, | 5787 PcDescriptors::kOther, |
| 5782 locs); | 5788 locs); |
| 5783 __ MoveRegister(locs->out(0).reg(), EAX); | 5789 __ MoveRegister(locs->out(0).reg(), EAX); |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6126 // We can fall through if the successor is the next block in the list. | 6132 // We can fall through if the successor is the next block in the list. |
| 6127 // Otherwise, we need a jump. | 6133 // Otherwise, we need a jump. |
| 6128 if (!compiler->CanFallThroughTo(successor())) { | 6134 if (!compiler->CanFallThroughTo(successor())) { |
| 6129 __ jmp(compiler->GetJumpLabel(successor())); | 6135 __ jmp(compiler->GetJumpLabel(successor())); |
| 6130 } | 6136 } |
| 6131 } | 6137 } |
| 6132 | 6138 |
| 6133 | 6139 |
| 6134 LocationSummary* CurrentContextInstr::MakeLocationSummary(Isolate* isolate, | 6140 LocationSummary* CurrentContextInstr::MakeLocationSummary(Isolate* isolate, |
| 6135 bool opt) const { | 6141 bool opt) const { |
| 6136 return LocationSummary::Make(0, | 6142 return LocationSummary::Make(isolate, |
| 6143 0, |
| 6137 Location::RequiresRegister(), | 6144 Location::RequiresRegister(), |
| 6138 LocationSummary::kNoCall); | 6145 LocationSummary::kNoCall); |
| 6139 } | 6146 } |
| 6140 | 6147 |
| 6141 | 6148 |
| 6142 void CurrentContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6149 void CurrentContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6143 __ MoveRegister(locs()->out(0).reg(), CTX); | 6150 __ MoveRegister(locs()->out(0).reg(), CTX); |
| 6144 } | 6151 } |
| 6145 | 6152 |
| 6146 | 6153 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6335 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 6342 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
| 6336 deopt_id_after, | 6343 deopt_id_after, |
| 6337 token_pos()); | 6344 token_pos()); |
| 6338 } | 6345 } |
| 6339 __ Drop(argument_count); | 6346 __ Drop(argument_count); |
| 6340 } | 6347 } |
| 6341 | 6348 |
| 6342 | 6349 |
| 6343 LocationSummary* BooleanNegateInstr::MakeLocationSummary(Isolate* isolate, | 6350 LocationSummary* BooleanNegateInstr::MakeLocationSummary(Isolate* isolate, |
| 6344 bool opt) const { | 6351 bool opt) const { |
| 6345 return LocationSummary::Make(1, | 6352 return LocationSummary::Make(isolate, |
| 6353 1, |
| 6346 Location::RequiresRegister(), | 6354 Location::RequiresRegister(), |
| 6347 LocationSummary::kNoCall); | 6355 LocationSummary::kNoCall); |
| 6348 } | 6356 } |
| 6349 | 6357 |
| 6350 | 6358 |
| 6351 void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6359 void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6352 Register value = locs()->in(0).reg(); | 6360 Register value = locs()->in(0).reg(); |
| 6353 Register result = locs()->out(0).reg(); | 6361 Register result = locs()->out(0).reg(); |
| 6354 | 6362 |
| 6355 Label done; | 6363 Label done; |
| 6356 __ LoadObject(result, Bool::True()); | 6364 __ LoadObject(result, Bool::True()); |
| 6357 __ CompareRegisters(result, value); | 6365 __ CompareRegisters(result, value); |
| 6358 __ j(NOT_EQUAL, &done, Assembler::kNearJump); | 6366 __ j(NOT_EQUAL, &done, Assembler::kNearJump); |
| 6359 __ LoadObject(result, Bool::False()); | 6367 __ LoadObject(result, Bool::False()); |
| 6360 __ Bind(&done); | 6368 __ Bind(&done); |
| 6361 } | 6369 } |
| 6362 | 6370 |
| 6363 | 6371 |
| 6364 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Isolate* isolate, | 6372 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Isolate* isolate, |
| 6365 bool opt) const { | 6373 bool opt) const { |
| 6366 return MakeCallSummary(); | 6374 return MakeCallSummary(); |
| 6367 } | 6375 } |
| 6368 | 6376 |
| 6369 | 6377 |
| 6370 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6378 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6371 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls())); | 6379 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls())); |
| 6372 const ExternalLabel label(cls().ToCString(), stub.EntryPoint()); | 6380 const ExternalLabel label(stub.EntryPoint()); |
| 6373 compiler->GenerateCall(token_pos(), | 6381 compiler->GenerateCall(token_pos(), |
| 6374 &label, | 6382 &label, |
| 6375 PcDescriptors::kOther, | 6383 PcDescriptors::kOther, |
| 6376 locs()); | 6384 locs()); |
| 6377 __ Drop(ArgumentCount()); // Discard arguments. | 6385 __ Drop(ArgumentCount()); // Discard arguments. |
| 6378 } | 6386 } |
| 6379 | 6387 |
| 6380 } // namespace dart | 6388 } // namespace dart |
| 6381 | 6389 |
| 6382 #undef __ | 6390 #undef __ |
| 6383 | 6391 |
| 6384 #endif // defined TARGET_ARCH_IA32 | 6392 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |