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

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

Issue 855533002: Isolate/Thread split: Isolate -> Zone for LocationSummary. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language_arm64.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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 14 matching lines...) Expand all
25 DECLARE_FLAG(bool, emit_edge_counters); 25 DECLARE_FLAG(bool, emit_edge_counters);
26 DECLARE_FLAG(bool, enable_asserts); 26 DECLARE_FLAG(bool, enable_asserts);
27 DECLARE_FLAG(bool, enable_type_checks); 27 DECLARE_FLAG(bool, enable_type_checks);
28 DECLARE_FLAG(int, optimization_counter_threshold); 28 DECLARE_FLAG(int, optimization_counter_threshold);
29 DECLARE_FLAG(bool, propagate_ic_data); 29 DECLARE_FLAG(bool, propagate_ic_data);
30 DECLARE_FLAG(bool, use_osr); 30 DECLARE_FLAG(bool, use_osr);
31 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); 31 DECLARE_FLAG(bool, throw_on_javascript_int_overflow);
32 32
33 // Generic summary for call instructions that have all arguments pushed 33 // Generic summary for call instructions that have all arguments pushed
34 // on the stack and return the result in a fixed register EAX. 34 // on the stack and return the result in a fixed register EAX.
35 LocationSummary* Instruction::MakeCallSummary(Isolate* isolate) { 35 LocationSummary* Instruction::MakeCallSummary(Zone* zone) {
36 const intptr_t kNumInputs = 0; 36 const intptr_t kNumInputs = 0;
37 const intptr_t kNumTemps = 0; 37 const intptr_t kNumTemps = 0;
38 LocationSummary* result = new(isolate) LocationSummary( 38 LocationSummary* result = new(zone) LocationSummary(
39 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 39 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
40 result->set_out(0, Location::RegisterLocation(EAX)); 40 result->set_out(0, Location::RegisterLocation(EAX));
41 return result; 41 return result;
42 } 42 }
43 43
44 44
45 LocationSummary* PushArgumentInstr::MakeLocationSummary(Isolate* isolate, 45 LocationSummary* PushArgumentInstr::MakeLocationSummary(Zone* zone,
46 bool opt) const { 46 bool opt) const {
47 const intptr_t kNumInputs = 1; 47 const intptr_t kNumInputs = 1;
48 const intptr_t kNumTemps = 0; 48 const intptr_t kNumTemps = 0;
49 LocationSummary* locs = new(isolate) LocationSummary( 49 LocationSummary* locs = new(zone) LocationSummary(
50 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 50 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
51 locs->set_in(0, Location::AnyOrConstant(value())); 51 locs->set_in(0, Location::AnyOrConstant(value()));
52 return locs; 52 return locs;
53 } 53 }
54 54
55 55
56 void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 56 void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
57 // In SSA mode, we need an explicit push. Nothing to do in non-SSA mode 57 // In SSA mode, we need an explicit push. Nothing to do in non-SSA mode
58 // where PushArgument is handled by BindInstr::EmitNativeCode. 58 // where PushArgument is handled by BindInstr::EmitNativeCode.
59 if (compiler->is_optimizing()) { 59 if (compiler->is_optimizing()) {
60 Location value = locs()->in(0); 60 Location value = locs()->in(0);
61 if (value.IsRegister()) { 61 if (value.IsRegister()) {
62 __ pushl(value.reg()); 62 __ pushl(value.reg());
63 } else if (value.IsConstant()) { 63 } else if (value.IsConstant()) {
64 __ PushObject(value.constant()); 64 __ PushObject(value.constant());
65 } else { 65 } else {
66 ASSERT(value.IsStackSlot()); 66 ASSERT(value.IsStackSlot());
67 __ pushl(value.ToStackSlotAddress()); 67 __ pushl(value.ToStackSlotAddress());
68 } 68 }
69 } 69 }
70 } 70 }
71 71
72 72
73 LocationSummary* ReturnInstr::MakeLocationSummary(Isolate* isolate, 73 LocationSummary* ReturnInstr::MakeLocationSummary(Zone* zone,
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(zone) LocationSummary(
78 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 78 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
79 locs->set_in(0, Location::RegisterLocation(EAX)); 79 locs->set_in(0, Location::RegisterLocation(EAX));
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 instruction: a jump). 86 // that will be overwritten by the patch instruction: a jump).
87 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 87 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
88 Register result = locs()->in(0).reg(); 88 Register result = locs()->in(0).reg();
(...skipping 16 matching lines...) Expand all
105 __ cmpl(EDI, Immediate(fp_sp_dist)); 105 __ cmpl(EDI, Immediate(fp_sp_dist));
106 __ j(EQUAL, &done, Assembler::kNearJump); 106 __ j(EQUAL, &done, Assembler::kNearJump);
107 __ int3(); 107 __ int3();
108 __ Bind(&done); 108 __ Bind(&done);
109 #endif 109 #endif
110 __ LeaveFrame(); 110 __ LeaveFrame();
111 __ ret(); 111 __ ret();
112 } 112 }
113 113
114 114
115 LocationSummary* LoadLocalInstr::MakeLocationSummary(Isolate* isolate, 115 LocationSummary* LoadLocalInstr::MakeLocationSummary(Zone* zone,
116 bool opt) const { 116 bool opt) const {
117 const intptr_t kNumInputs = 0; 117 const intptr_t kNumInputs = 0;
118 const intptr_t stack_index = (local().index() < 0) 118 const intptr_t stack_index = (local().index() < 0)
119 ? kFirstLocalSlotFromFp - local().index() 119 ? kFirstLocalSlotFromFp - local().index()
120 : kParamEndSlotFromFp - local().index(); 120 : kParamEndSlotFromFp - local().index();
121 return LocationSummary::Make(isolate, 121 return LocationSummary::Make(zone,
122 kNumInputs, 122 kNumInputs,
123 Location::StackSlot(stack_index), 123 Location::StackSlot(stack_index),
124 LocationSummary::kNoCall); 124 LocationSummary::kNoCall);
125 } 125 }
126 126
127 127
128 void LoadLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 128 void LoadLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
129 ASSERT(!compiler->is_optimizing()); 129 ASSERT(!compiler->is_optimizing());
130 // Nothing to do. 130 // Nothing to do.
131 } 131 }
132 132
133 133
134 LocationSummary* StoreLocalInstr::MakeLocationSummary(Isolate* isolate, 134 LocationSummary* StoreLocalInstr::MakeLocationSummary(Zone* zone,
135 bool opt) const { 135 bool opt) const {
136 const intptr_t kNumInputs = 1; 136 const intptr_t kNumInputs = 1;
137 return LocationSummary::Make(isolate, 137 return LocationSummary::Make(zone,
138 kNumInputs, 138 kNumInputs,
139 Location::SameAsFirstInput(), 139 Location::SameAsFirstInput(),
140 LocationSummary::kNoCall); 140 LocationSummary::kNoCall);
141 } 141 }
142 142
143 143
144 void StoreLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 144 void StoreLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
145 Register value = locs()->in(0).reg(); 145 Register value = locs()->in(0).reg();
146 Register result = locs()->out(0).reg(); 146 Register result = locs()->out(0).reg();
147 ASSERT(result == value); // Assert that register assignment is correct. 147 ASSERT(result == value); // Assert that register assignment is correct.
148 __ movl(Address(EBP, local().index() * kWordSize), value); 148 __ movl(Address(EBP, local().index() * kWordSize), value);
149 } 149 }
150 150
151 151
152 LocationSummary* ConstantInstr::MakeLocationSummary(Isolate* isolate, 152 LocationSummary* ConstantInstr::MakeLocationSummary(Zone* zone,
153 bool opt) const { 153 bool opt) const {
154 const intptr_t kNumInputs = 0; 154 const intptr_t kNumInputs = 0;
155 return LocationSummary::Make(isolate, 155 return LocationSummary::Make(zone,
156 kNumInputs, 156 kNumInputs,
157 Location::RequiresRegister(), 157 Location::RequiresRegister(),
158 LocationSummary::kNoCall); 158 LocationSummary::kNoCall);
159 } 159 }
160 160
161 161
162 void ConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 162 void ConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
163 // The register allocator drops constant definitions that have no uses. 163 // The register allocator drops constant definitions that have no uses.
164 if (!locs()->out(0).IsInvalid()) { 164 if (!locs()->out(0).IsInvalid()) {
165 Register result = locs()->out(0).reg(); 165 Register result = locs()->out(0).reg();
166 __ LoadObjectSafely(result, value()); 166 __ LoadObjectSafely(result, value());
167 } 167 }
168 } 168 }
169 169
170 170
171 LocationSummary* UnboxedConstantInstr::MakeLocationSummary(Isolate* isolate, 171 LocationSummary* UnboxedConstantInstr::MakeLocationSummary(Zone* zone,
172 bool opt) const { 172 bool opt) const {
173 const intptr_t kNumInputs = 0; 173 const intptr_t kNumInputs = 0;
174 const intptr_t kNumTemps = 174 const intptr_t kNumTemps =
175 (constant_address() == 0) && (representation() != kUnboxedInt32) ? 1 : 0; 175 (constant_address() == 0) && (representation() != kUnboxedInt32) ? 1 : 0;
176 LocationSummary* locs = new(isolate) LocationSummary( 176 LocationSummary* locs = new(zone) LocationSummary(
177 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 177 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
178 if (representation() == kUnboxedDouble) { 178 if (representation() == kUnboxedDouble) {
179 locs->set_out(0, Location::RequiresFpuRegister()); 179 locs->set_out(0, Location::RequiresFpuRegister());
180 } else { 180 } else {
181 ASSERT(representation() == kUnboxedInt32); 181 ASSERT(representation() == kUnboxedInt32);
182 locs->set_out(0, Location::RequiresRegister()); 182 locs->set_out(0, Location::RequiresRegister());
183 } 183 }
184 if (kNumTemps == 1) { 184 if (kNumTemps == 1) {
185 locs->set_temp(0, Location::RequiresRegister()); 185 locs->set_temp(0, Location::RequiresRegister());
186 } 186 }
187 return locs; 187 return locs;
(...skipping 20 matching lines...) Expand all
208 case kUnboxedInt32: 208 case kUnboxedInt32:
209 __ movl(locs()->out(0).reg(), Immediate(Smi::Cast(value()).Value())); 209 __ movl(locs()->out(0).reg(), Immediate(Smi::Cast(value()).Value()));
210 break; 210 break;
211 default: 211 default:
212 UNREACHABLE(); 212 UNREACHABLE();
213 } 213 }
214 } 214 }
215 } 215 }
216 216
217 217
218 LocationSummary* AssertAssignableInstr::MakeLocationSummary(Isolate* isolate, 218 LocationSummary* AssertAssignableInstr::MakeLocationSummary(Zone* zone,
219 bool opt) const { 219 bool opt) const {
220 const intptr_t kNumInputs = 3; 220 const intptr_t kNumInputs = 3;
221 const intptr_t kNumTemps = 0; 221 const intptr_t kNumTemps = 0;
222 LocationSummary* summary = new(isolate) LocationSummary( 222 LocationSummary* summary = new(zone) LocationSummary(
223 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 223 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
224 summary->set_in(0, Location::RegisterLocation(EAX)); // Value. 224 summary->set_in(0, Location::RegisterLocation(EAX)); // Value.
225 summary->set_in(1, Location::RegisterLocation(ECX)); // Instantiator. 225 summary->set_in(1, Location::RegisterLocation(ECX)); // Instantiator.
226 summary->set_in(2, Location::RegisterLocation(EDX)); // Type arguments. 226 summary->set_in(2, Location::RegisterLocation(EDX)); // Type arguments.
227 summary->set_out(0, Location::RegisterLocation(EAX)); 227 summary->set_out(0, Location::RegisterLocation(EAX));
228 return summary; 228 return summary;
229 } 229 }
230 230
231 231
232 LocationSummary* AssertBooleanInstr::MakeLocationSummary(Isolate* isolate, 232 LocationSummary* AssertBooleanInstr::MakeLocationSummary(Zone* zone,
233 bool opt) const { 233 bool opt) const {
234 const intptr_t kNumInputs = 1; 234 const intptr_t kNumInputs = 1;
235 const intptr_t kNumTemps = 0; 235 const intptr_t kNumTemps = 0;
236 LocationSummary* locs = new(isolate) LocationSummary( 236 LocationSummary* locs = new(zone) LocationSummary(
237 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 237 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
238 locs->set_in(0, Location::RegisterLocation(EAX)); 238 locs->set_in(0, Location::RegisterLocation(EAX));
239 locs->set_out(0, Location::RegisterLocation(EAX)); 239 locs->set_out(0, Location::RegisterLocation(EAX));
240 return locs; 240 return locs;
241 } 241 }
242 242
243 243
244 static void EmitAssertBoolean(Register reg, 244 static void EmitAssertBoolean(Register reg,
245 intptr_t token_pos, 245 intptr_t token_pos,
246 intptr_t deopt_id, 246 intptr_t deopt_id,
247 LocationSummary* locs, 247 LocationSummary* locs,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 case Token::kGT: return GREATER; 291 case Token::kGT: return GREATER;
292 case Token::kLTE: return LESS_EQUAL; 292 case Token::kLTE: return LESS_EQUAL;
293 case Token::kGTE: return GREATER_EQUAL; 293 case Token::kGTE: return GREATER_EQUAL;
294 default: 294 default:
295 UNREACHABLE(); 295 UNREACHABLE();
296 return OVERFLOW; 296 return OVERFLOW;
297 } 297 }
298 } 298 }
299 299
300 300
301 LocationSummary* EqualityCompareInstr::MakeLocationSummary(Isolate* isolate, 301 LocationSummary* EqualityCompareInstr::MakeLocationSummary(Zone* zone,
302 bool opt) const { 302 bool opt) const {
303 const intptr_t kNumInputs = 2; 303 const intptr_t kNumInputs = 2;
304 if (operation_cid() == kMintCid) { 304 if (operation_cid() == kMintCid) {
305 const intptr_t kNumTemps = 0; 305 const intptr_t kNumTemps = 0;
306 LocationSummary* locs = new(isolate) LocationSummary( 306 LocationSummary* locs = new(zone) LocationSummary(
307 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 307 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
308 locs->set_in(0, Location::Pair(Location::RequiresRegister(), 308 locs->set_in(0, Location::Pair(Location::RequiresRegister(),
309 Location::RequiresRegister())); 309 Location::RequiresRegister()));
310 locs->set_in(1, Location::Pair(Location::RequiresRegister(), 310 locs->set_in(1, Location::Pair(Location::RequiresRegister(),
311 Location::RequiresRegister())); 311 Location::RequiresRegister()));
312 locs->set_out(0, Location::RequiresRegister()); 312 locs->set_out(0, Location::RequiresRegister());
313 return locs; 313 return locs;
314 } 314 }
315 if (operation_cid() == kDoubleCid) { 315 if (operation_cid() == kDoubleCid) {
316 const intptr_t kNumTemps = 0; 316 const intptr_t kNumTemps = 0;
317 LocationSummary* locs = new(isolate) LocationSummary( 317 LocationSummary* locs = new(zone) LocationSummary(
318 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 318 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
319 locs->set_in(0, Location::RequiresFpuRegister()); 319 locs->set_in(0, Location::RequiresFpuRegister());
320 locs->set_in(1, Location::RequiresFpuRegister()); 320 locs->set_in(1, Location::RequiresFpuRegister());
321 locs->set_out(0, Location::RequiresRegister()); 321 locs->set_out(0, Location::RequiresRegister());
322 return locs; 322 return locs;
323 } 323 }
324 if (operation_cid() == kSmiCid) { 324 if (operation_cid() == kSmiCid) {
325 const intptr_t kNumTemps = 0; 325 const intptr_t kNumTemps = 0;
326 LocationSummary* locs = new(isolate) LocationSummary( 326 LocationSummary* locs = new(zone) LocationSummary(
327 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 327 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
328 locs->set_in(0, Location::RegisterOrConstant(left())); 328 locs->set_in(0, Location::RegisterOrConstant(left()));
329 // Only one input can be a constant operand. The case of two constant 329 // Only one input can be a constant operand. The case of two constant
330 // operands should be handled by constant propagation. 330 // operands should be handled by constant propagation.
331 // Only right can be a stack slot. 331 // Only right can be a stack slot.
332 locs->set_in(1, locs->in(0).IsConstant() 332 locs->set_in(1, locs->in(0).IsConstant()
333 ? Location::RequiresRegister() 333 ? Location::RequiresRegister()
334 : Location::RegisterOrConstant(right())); 334 : Location::RegisterOrConstant(right()));
335 locs->set_out(0, Location::RequiresRegister()); 335 locs->set_out(0, Location::RequiresRegister());
336 return locs; 336 return locs;
337 } 337 }
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 void EqualityCompareInstr::EmitBranchCode(FlowGraphCompiler* compiler, 610 void EqualityCompareInstr::EmitBranchCode(FlowGraphCompiler* compiler,
611 BranchInstr* branch) { 611 BranchInstr* branch) {
612 ASSERT((kind() == Token::kNE) || (kind() == Token::kEQ)); 612 ASSERT((kind() == Token::kNE) || (kind() == Token::kEQ));
613 613
614 BranchLabels labels = compiler->CreateBranchLabels(branch); 614 BranchLabels labels = compiler->CreateBranchLabels(branch);
615 Condition true_condition = EmitComparisonCode(compiler, labels); 615 Condition true_condition = EmitComparisonCode(compiler, labels);
616 EmitBranchOnCondition(compiler, true_condition, labels); 616 EmitBranchOnCondition(compiler, true_condition, labels);
617 } 617 }
618 618
619 619
620 LocationSummary* TestSmiInstr::MakeLocationSummary(Isolate* isolate, 620 LocationSummary* TestSmiInstr::MakeLocationSummary(Zone* zone,
621 bool opt) const { 621 bool opt) const {
622 const intptr_t kNumInputs = 2; 622 const intptr_t kNumInputs = 2;
623 const intptr_t kNumTemps = 0; 623 const intptr_t kNumTemps = 0;
624 LocationSummary* locs = new(isolate) LocationSummary( 624 LocationSummary* locs = new(zone) LocationSummary(
625 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 625 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
626 locs->set_in(0, Location::RequiresRegister()); 626 locs->set_in(0, Location::RequiresRegister());
627 // Only one input can be a constant operand. The case of two constant 627 // Only one input can be a constant operand. The case of two constant
628 // operands should be handled by constant propagation. 628 // operands should be handled by constant propagation.
629 locs->set_in(1, Location::RegisterOrConstant(right())); 629 locs->set_in(1, Location::RegisterOrConstant(right()));
630 return locs; 630 return locs;
631 } 631 }
632 632
633 633
634 Condition TestSmiInstr::EmitComparisonCode(FlowGraphCompiler* compiler, 634 Condition TestSmiInstr::EmitComparisonCode(FlowGraphCompiler* compiler,
635 BranchLabels labels) { 635 BranchLabels labels) {
(...skipping 20 matching lines...) Expand all
656 656
657 void TestSmiInstr::EmitBranchCode(FlowGraphCompiler* compiler, 657 void TestSmiInstr::EmitBranchCode(FlowGraphCompiler* compiler,
658 BranchInstr* branch) { 658 BranchInstr* branch) {
659 BranchLabels labels = compiler->CreateBranchLabels(branch); 659 BranchLabels labels = compiler->CreateBranchLabels(branch);
660 Condition true_condition = EmitComparisonCode(compiler, labels); 660 Condition true_condition = EmitComparisonCode(compiler, labels);
661 EmitBranchOnCondition(compiler, true_condition, labels); 661 EmitBranchOnCondition(compiler, true_condition, labels);
662 } 662 }
663 663
664 664
665 665
666 LocationSummary* TestCidsInstr::MakeLocationSummary(Isolate* isolate, 666 LocationSummary* TestCidsInstr::MakeLocationSummary(Zone* zone,
667 bool opt) const { 667 bool opt) const {
668 const intptr_t kNumInputs = 1; 668 const intptr_t kNumInputs = 1;
669 const intptr_t kNumTemps = 1; 669 const intptr_t kNumTemps = 1;
670 LocationSummary* locs = new(isolate) LocationSummary( 670 LocationSummary* locs = new(zone) LocationSummary(
671 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 671 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
672 locs->set_in(0, Location::RequiresRegister()); 672 locs->set_in(0, Location::RequiresRegister());
673 locs->set_temp(0, Location::RequiresRegister()); 673 locs->set_temp(0, Location::RequiresRegister());
674 locs->set_out(0, Location::RequiresRegister()); 674 locs->set_out(0, Location::RequiresRegister());
675 return locs; 675 return locs;
676 } 676 }
677 677
678 678
679 Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler, 679 Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler,
680 BranchLabels labels) { 680 BranchLabels labels) {
681 ASSERT((kind() == Token::kIS) || (kind() == Token::kISNOT)); 681 ASSERT((kind() == Token::kIS) || (kind() == Token::kISNOT));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 EmitComparisonCode(compiler, labels); 728 EmitComparisonCode(compiler, labels);
729 __ Bind(&is_false); 729 __ Bind(&is_false);
730 __ LoadObject(result_reg, Bool::False()); 730 __ LoadObject(result_reg, Bool::False());
731 __ jmp(&done, Assembler::kNearJump); 731 __ jmp(&done, Assembler::kNearJump);
732 __ Bind(&is_true); 732 __ Bind(&is_true);
733 __ LoadObject(result_reg, Bool::True()); 733 __ LoadObject(result_reg, Bool::True());
734 __ Bind(&done); 734 __ Bind(&done);
735 } 735 }
736 736
737 737
738 LocationSummary* RelationalOpInstr::MakeLocationSummary(Isolate* isolate, 738 LocationSummary* RelationalOpInstr::MakeLocationSummary(Zone* zone,
739 bool opt) const { 739 bool opt) const {
740 const intptr_t kNumInputs = 2; 740 const intptr_t kNumInputs = 2;
741 const intptr_t kNumTemps = 0; 741 const intptr_t kNumTemps = 0;
742 if (operation_cid() == kMintCid) { 742 if (operation_cid() == kMintCid) {
743 const intptr_t kNumTemps = 0; 743 const intptr_t kNumTemps = 0;
744 LocationSummary* locs = new(isolate) LocationSummary( 744 LocationSummary* locs = new(zone) LocationSummary(
745 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 745 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
746 locs->set_in(0, Location::Pair(Location::RequiresRegister(), 746 locs->set_in(0, Location::Pair(Location::RequiresRegister(),
747 Location::RequiresRegister())); 747 Location::RequiresRegister()));
748 locs->set_in(1, Location::Pair(Location::RequiresRegister(), 748 locs->set_in(1, Location::Pair(Location::RequiresRegister(),
749 Location::RequiresRegister())); 749 Location::RequiresRegister()));
750 locs->set_out(0, Location::RequiresRegister()); 750 locs->set_out(0, Location::RequiresRegister());
751 return locs; 751 return locs;
752 } 752 }
753 if (operation_cid() == kDoubleCid) { 753 if (operation_cid() == kDoubleCid) {
754 LocationSummary* summary = new(isolate) LocationSummary( 754 LocationSummary* summary = new(zone) LocationSummary(
755 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 755 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
756 summary->set_in(0, Location::RequiresFpuRegister()); 756 summary->set_in(0, Location::RequiresFpuRegister());
757 summary->set_in(1, Location::RequiresFpuRegister()); 757 summary->set_in(1, Location::RequiresFpuRegister());
758 summary->set_out(0, Location::RequiresRegister()); 758 summary->set_out(0, Location::RequiresRegister());
759 return summary; 759 return summary;
760 } 760 }
761 ASSERT(operation_cid() == kSmiCid); 761 ASSERT(operation_cid() == kSmiCid);
762 LocationSummary* summary = new(isolate) LocationSummary( 762 LocationSummary* summary = new(zone) LocationSummary(
763 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 763 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
764 summary->set_in(0, Location::RegisterOrConstant(left())); 764 summary->set_in(0, Location::RegisterOrConstant(left()));
765 // Only one input can be a constant operand. The case of two constant 765 // Only one input can be a constant operand. The case of two constant
766 // operands should be handled by constant propagation. 766 // operands should be handled by constant propagation.
767 summary->set_in(1, summary->in(0).IsConstant() 767 summary->set_in(1, summary->in(0).IsConstant()
768 ? Location::RequiresRegister() 768 ? Location::RequiresRegister()
769 : Location::RegisterOrConstant(right())); 769 : Location::RegisterOrConstant(right()));
770 summary->set_out(0, Location::RequiresRegister()); 770 summary->set_out(0, Location::RequiresRegister());
771 return summary; 771 return summary;
772 } 772 }
773 773
(...skipping 29 matching lines...) Expand all
803 803
804 804
805 void RelationalOpInstr::EmitBranchCode(FlowGraphCompiler* compiler, 805 void RelationalOpInstr::EmitBranchCode(FlowGraphCompiler* compiler,
806 BranchInstr* branch) { 806 BranchInstr* branch) {
807 BranchLabels labels = compiler->CreateBranchLabels(branch); 807 BranchLabels labels = compiler->CreateBranchLabels(branch);
808 Condition true_condition = EmitComparisonCode(compiler, labels); 808 Condition true_condition = EmitComparisonCode(compiler, labels);
809 EmitBranchOnCondition(compiler, true_condition, labels); 809 EmitBranchOnCondition(compiler, true_condition, labels);
810 } 810 }
811 811
812 812
813 LocationSummary* NativeCallInstr::MakeLocationSummary(Isolate* isolate, 813 LocationSummary* NativeCallInstr::MakeLocationSummary(Zone* zone,
814 bool opt) const { 814 bool opt) const {
815 return MakeCallSummary(isolate); 815 return MakeCallSummary(zone);
816 } 816 }
817 817
818 818
819 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 819 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
820 Register result = locs()->out(0).reg(); 820 Register result = locs()->out(0).reg();
821 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); 821 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function());
822 const bool is_leaf_call = 822 const bool is_leaf_call =
823 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; 823 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0;
824 StubCode* stub_code = compiler->isolate()->stub_code(); 824 StubCode* stub_code = compiler->isolate()->stub_code();
825 825
(...skipping 25 matching lines...) Expand all
851 return false; 851 return false;
852 } 852 }
853 const int64_t index = Smi::Cast(constant->value()).AsInt64Value(); 853 const int64_t index = Smi::Cast(constant->value()).AsInt64Value();
854 const intptr_t scale = Instance::ElementSizeFor(cid); 854 const intptr_t scale = Instance::ElementSizeFor(cid);
855 const intptr_t offset = Instance::DataOffsetFor(cid); 855 const intptr_t offset = Instance::DataOffsetFor(cid);
856 const int64_t displacement = index * scale + offset; 856 const int64_t displacement = index * scale + offset;
857 return Utils::IsInt(32, displacement); 857 return Utils::IsInt(32, displacement);
858 } 858 }
859 859
860 860
861 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(Isolate* isolate, 861 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(Zone* zone,
862 bool opt) const { 862 bool opt) const {
863 const intptr_t kNumInputs = 1; 863 const intptr_t kNumInputs = 1;
864 // TODO(fschneider): Allow immediate operands for the char code. 864 // TODO(fschneider): Allow immediate operands for the char code.
865 return LocationSummary::Make(isolate, 865 return LocationSummary::Make(zone,
866 kNumInputs, 866 kNumInputs,
867 Location::RequiresRegister(), 867 Location::RequiresRegister(),
868 LocationSummary::kNoCall); 868 LocationSummary::kNoCall);
869 } 869 }
870 870
871 871
872 void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 872 void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
873 Register char_code = locs()->in(0).reg(); 873 Register char_code = locs()->in(0).reg();
874 Register result = locs()->out(0).reg(); 874 Register result = locs()->out(0).reg();
875 __ movl(result, 875 __ movl(result,
876 Immediate(reinterpret_cast<uword>(Symbols::PredefinedAddress()))); 876 Immediate(reinterpret_cast<uword>(Symbols::PredefinedAddress())));
877 __ movl(result, Address(result, 877 __ movl(result, Address(result,
878 char_code, 878 char_code,
879 TIMES_HALF_WORD_SIZE, // Char code is a smi. 879 TIMES_HALF_WORD_SIZE, // Char code is a smi.
880 Symbols::kNullCharCodeSymbolOffset * kWordSize)); 880 Symbols::kNullCharCodeSymbolOffset * kWordSize));
881 } 881 }
882 882
883 883
884 LocationSummary* StringToCharCodeInstr::MakeLocationSummary(Isolate* isolate, 884 LocationSummary* StringToCharCodeInstr::MakeLocationSummary(Zone* zone,
885 bool opt) const { 885 bool opt) const {
886 const intptr_t kNumInputs = 1; 886 const intptr_t kNumInputs = 1;
887 return LocationSummary::Make(isolate, 887 return LocationSummary::Make(zone,
888 kNumInputs, 888 kNumInputs,
889 Location::RequiresRegister(), 889 Location::RequiresRegister(),
890 LocationSummary::kNoCall); 890 LocationSummary::kNoCall);
891 } 891 }
892 892
893 893
894 void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 894 void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
895 ASSERT(cid_ == kOneByteStringCid); 895 ASSERT(cid_ == kOneByteStringCid);
896 Register str = locs()->in(0).reg(); 896 Register str = locs()->in(0).reg();
897 Register result = locs()->out(0).reg(); 897 Register result = locs()->out(0).reg();
898 Label is_one, done; 898 Label is_one, done;
899 __ movl(result, FieldAddress(str, String::length_offset())); 899 __ movl(result, FieldAddress(str, String::length_offset()));
900 __ cmpl(result, Immediate(Smi::RawValue(1))); 900 __ cmpl(result, Immediate(Smi::RawValue(1)));
901 __ j(EQUAL, &is_one, Assembler::kNearJump); 901 __ j(EQUAL, &is_one, Assembler::kNearJump);
902 __ movl(result, Immediate(Smi::RawValue(-1))); 902 __ movl(result, Immediate(Smi::RawValue(-1)));
903 __ jmp(&done); 903 __ jmp(&done);
904 __ Bind(&is_one); 904 __ Bind(&is_one);
905 __ movzxb(result, FieldAddress(str, OneByteString::data_offset())); 905 __ movzxb(result, FieldAddress(str, OneByteString::data_offset()));
906 __ SmiTag(result); 906 __ SmiTag(result);
907 __ Bind(&done); 907 __ Bind(&done);
908 } 908 }
909 909
910 910
911 LocationSummary* StringInterpolateInstr::MakeLocationSummary(Isolate* isolate, 911 LocationSummary* StringInterpolateInstr::MakeLocationSummary(Zone* zone,
912 bool opt) const { 912 bool opt) const {
913 const intptr_t kNumInputs = 1; 913 const intptr_t kNumInputs = 1;
914 const intptr_t kNumTemps = 0; 914 const intptr_t kNumTemps = 0;
915 LocationSummary* summary = new(isolate) LocationSummary( 915 LocationSummary* summary = new(zone) LocationSummary(
916 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 916 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
917 summary->set_in(0, Location::RegisterLocation(EAX)); 917 summary->set_in(0, Location::RegisterLocation(EAX));
918 summary->set_out(0, Location::RegisterLocation(EAX)); 918 summary->set_out(0, Location::RegisterLocation(EAX));
919 return summary; 919 return summary;
920 } 920 }
921 921
922 922
923 void StringInterpolateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 923 void StringInterpolateInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
924 Register array = locs()->in(0).reg(); 924 Register array = locs()->in(0).reg();
925 __ pushl(array); 925 __ pushl(array);
926 const int kNumberOfArguments = 1; 926 const int kNumberOfArguments = 1;
927 const Array& kNoArgumentNames = Object::null_array(); 927 const Array& kNoArgumentNames = Object::null_array();
928 compiler->GenerateStaticCall(deopt_id(), 928 compiler->GenerateStaticCall(deopt_id(),
929 token_pos(), 929 token_pos(),
930 CallFunction(), 930 CallFunction(),
931 kNumberOfArguments, 931 kNumberOfArguments,
932 kNoArgumentNames, 932 kNoArgumentNames,
933 locs(), 933 locs(),
934 ICData::Handle()); 934 ICData::Handle());
935 ASSERT(locs()->out(0).reg() == EAX); 935 ASSERT(locs()->out(0).reg() == EAX);
936 } 936 }
937 937
938 938
939 LocationSummary* LoadUntaggedInstr::MakeLocationSummary(Isolate* isolate, 939 LocationSummary* LoadUntaggedInstr::MakeLocationSummary(Zone* zone,
940 bool opt) const { 940 bool opt) const {
941 const intptr_t kNumInputs = 1; 941 const intptr_t kNumInputs = 1;
942 return LocationSummary::Make(isolate, 942 return LocationSummary::Make(zone,
943 kNumInputs, 943 kNumInputs,
944 Location::SameAsFirstInput(), 944 Location::SameAsFirstInput(),
945 LocationSummary::kNoCall); 945 LocationSummary::kNoCall);
946 } 946 }
947 947
948 948
949 void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 949 void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
950 Register obj = locs()->in(0).reg(); 950 Register obj = locs()->in(0).reg();
951 Register result = locs()->out(0).reg(); 951 Register result = locs()->out(0).reg();
952 if (object()->definition()->representation() == kUntagged) { 952 if (object()->definition()->representation() == kUntagged) {
953 __ movl(result, Address(obj, offset())); 953 __ movl(result, Address(obj, offset()));
954 } else { 954 } else {
955 ASSERT(object()->definition()->representation() == kTagged); 955 ASSERT(object()->definition()->representation() == kTagged);
956 __ movl(result, FieldAddress(obj, offset())); 956 __ movl(result, FieldAddress(obj, offset()));
957 } 957 }
958 } 958 }
959 959
960 960
961 LocationSummary* LoadClassIdInstr::MakeLocationSummary(Isolate* isolate, 961 LocationSummary* LoadClassIdInstr::MakeLocationSummary(Zone* zone,
962 bool opt) const { 962 bool opt) const {
963 const intptr_t kNumInputs = 1; 963 const intptr_t kNumInputs = 1;
964 return LocationSummary::Make(isolate, 964 return LocationSummary::Make(zone,
965 kNumInputs, 965 kNumInputs,
966 Location::RequiresRegister(), 966 Location::RequiresRegister(),
967 LocationSummary::kNoCall); 967 LocationSummary::kNoCall);
968 } 968 }
969 969
970 970
971 void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 971 void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
972 const Register object = locs()->in(0).reg(); 972 const Register object = locs()->in(0).reg();
973 const Register result = locs()->out(0).reg(); 973 const Register result = locs()->out(0).reg();
974 Label done; 974 Label done;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 return kUnboxedInt32x4; 1052 return kUnboxedInt32x4;
1053 case kTypedDataFloat64x2ArrayCid: 1053 case kTypedDataFloat64x2ArrayCid:
1054 return kUnboxedFloat64x2; 1054 return kUnboxedFloat64x2;
1055 default: 1055 default:
1056 UNIMPLEMENTED(); 1056 UNIMPLEMENTED();
1057 return kTagged; 1057 return kTagged;
1058 } 1058 }
1059 } 1059 }
1060 1060
1061 1061
1062 LocationSummary* LoadIndexedInstr::MakeLocationSummary(Isolate* isolate, 1062 LocationSummary* LoadIndexedInstr::MakeLocationSummary(Zone* zone,
1063 bool opt) const { 1063 bool opt) const {
1064 const intptr_t kNumInputs = 2; 1064 const intptr_t kNumInputs = 2;
1065 const intptr_t kNumTemps = 0; 1065 const intptr_t kNumTemps = 0;
1066 LocationSummary* locs = new(isolate) LocationSummary( 1066 LocationSummary* locs = new(zone) LocationSummary(
1067 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 1067 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
1068 locs->set_in(0, Location::RequiresRegister()); 1068 locs->set_in(0, Location::RequiresRegister());
1069 if (CanBeImmediateIndex(index(), class_id())) { 1069 if (CanBeImmediateIndex(index(), class_id())) {
1070 // CanBeImmediateIndex must return false for unsafe smis. 1070 // CanBeImmediateIndex must return false for unsafe smis.
1071 locs->set_in(1, Location::Constant(index()->definition()->AsConstant())); 1071 locs->set_in(1, Location::Constant(index()->definition()->AsConstant()));
1072 } else { 1072 } else {
1073 // The index is either untagged (element size == 1) or a smi (for all 1073 // The index is either untagged (element size == 1) or a smi (for all
1074 // element sizes > 1). 1074 // element sizes > 1).
1075 locs->set_in(1, (index_scale() == 1) 1075 locs->set_in(1, (index_scale() == 1)
1076 ? Location::WritableRegister() 1076 ? Location::WritableRegister()
1077 : Location::RequiresRegister()); 1077 : Location::RequiresRegister());
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 return kUnboxedInt32x4; 1222 return kUnboxedInt32x4;
1223 case kTypedDataFloat64x2ArrayCid: 1223 case kTypedDataFloat64x2ArrayCid:
1224 return kUnboxedFloat64x2; 1224 return kUnboxedFloat64x2;
1225 default: 1225 default:
1226 UNIMPLEMENTED(); 1226 UNIMPLEMENTED();
1227 return kTagged; 1227 return kTagged;
1228 } 1228 }
1229 } 1229 }
1230 1230
1231 1231
1232 LocationSummary* StoreIndexedInstr::MakeLocationSummary(Isolate* isolate, 1232 LocationSummary* StoreIndexedInstr::MakeLocationSummary(Zone* zone,
1233 bool opt) const { 1233 bool opt) const {
1234 const intptr_t kNumInputs = 3; 1234 const intptr_t kNumInputs = 3;
1235 const intptr_t kNumTemps = 0; 1235 const intptr_t kNumTemps = 0;
1236 LocationSummary* locs = new(isolate) LocationSummary( 1236 LocationSummary* locs = new(zone) LocationSummary(
1237 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 1237 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
1238 locs->set_in(0, Location::RequiresRegister()); 1238 locs->set_in(0, Location::RequiresRegister());
1239 if (CanBeImmediateIndex(index(), class_id())) { 1239 if (CanBeImmediateIndex(index(), class_id())) {
1240 // CanBeImmediateIndex must return false for unsafe smis. 1240 // CanBeImmediateIndex must return false for unsafe smis.
1241 locs->set_in(1, Location::Constant(index()->definition()->AsConstant())); 1241 locs->set_in(1, Location::Constant(index()->definition()->AsConstant()));
1242 } else { 1242 } else {
1243 // The index is either untagged (element size == 1) or a smi (for all 1243 // The index is either untagged (element size == 1) or a smi (for all
1244 // element sizes > 1). 1244 // element sizes > 1).
1245 locs->set_in(1, (index_scale() == 1) 1245 locs->set_in(1, (index_scale() == 1)
1246 ? Location::WritableRegister() 1246 ? Location::WritableRegister()
1247 : Location::RequiresRegister()); 1247 : Location::RequiresRegister());
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 case kTypedDataFloat32x4ArrayCid: 1382 case kTypedDataFloat32x4ArrayCid:
1383 case kTypedDataFloat64x2ArrayCid: 1383 case kTypedDataFloat64x2ArrayCid:
1384 __ movups(element_address, locs()->in(2).fpu_reg()); 1384 __ movups(element_address, locs()->in(2).fpu_reg());
1385 break; 1385 break;
1386 default: 1386 default:
1387 UNREACHABLE(); 1387 UNREACHABLE();
1388 } 1388 }
1389 } 1389 }
1390 1390
1391 1391
1392 LocationSummary* GuardFieldClassInstr::MakeLocationSummary(Isolate* isolate, 1392 LocationSummary* GuardFieldClassInstr::MakeLocationSummary(Zone* zone,
1393 bool opt) const { 1393 bool opt) const {
1394 const intptr_t kNumInputs = 1; 1394 const intptr_t kNumInputs = 1;
1395 1395
1396 const intptr_t value_cid = value()->Type()->ToCid(); 1396 const intptr_t value_cid = value()->Type()->ToCid();
1397 const intptr_t field_cid = field().guarded_cid(); 1397 const intptr_t field_cid = field().guarded_cid();
1398 1398
1399 const bool emit_full_guard = !opt || (field_cid == kIllegalCid); 1399 const bool emit_full_guard = !opt || (field_cid == kIllegalCid);
1400 const bool needs_value_cid_temp_reg = 1400 const bool needs_value_cid_temp_reg =
1401 (value_cid == kDynamicCid) && (emit_full_guard || (field_cid != kSmiCid)); 1401 (value_cid == kDynamicCid) && (emit_full_guard || (field_cid != kSmiCid));
1402 const bool needs_field_temp_reg = emit_full_guard; 1402 const bool needs_field_temp_reg = emit_full_guard;
1403 1403
1404 intptr_t num_temps = 0; 1404 intptr_t num_temps = 0;
1405 if (needs_value_cid_temp_reg) { 1405 if (needs_value_cid_temp_reg) {
1406 num_temps++; 1406 num_temps++;
1407 } 1407 }
1408 if (needs_field_temp_reg) { 1408 if (needs_field_temp_reg) {
1409 num_temps++; 1409 num_temps++;
1410 } 1410 }
1411 1411
1412 LocationSummary* summary = new(isolate) LocationSummary( 1412 LocationSummary* summary = new(zone) LocationSummary(
1413 isolate, kNumInputs, num_temps, LocationSummary::kNoCall); 1413 zone, kNumInputs, num_temps, LocationSummary::kNoCall);
1414 summary->set_in(0, Location::RequiresRegister()); 1414 summary->set_in(0, Location::RequiresRegister());
1415 1415
1416 for (intptr_t i = 0; i < num_temps; i++) { 1416 for (intptr_t i = 0; i < num_temps; i++) {
1417 summary->set_temp(i, Location::RequiresRegister()); 1417 summary->set_temp(i, Location::RequiresRegister());
1418 } 1418 }
1419 1419
1420 return summary; 1420 return summary;
1421 } 1421 }
1422 1422
1423 1423
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 } else { 1550 } else {
1551 // Both value's and field's class id is known. 1551 // Both value's and field's class id is known.
1552 ASSERT((value_cid != field_cid) && (value_cid != nullability)); 1552 ASSERT((value_cid != field_cid) && (value_cid != nullability));
1553 __ jmp(fail); 1553 __ jmp(fail);
1554 } 1554 }
1555 } 1555 }
1556 __ Bind(&ok); 1556 __ Bind(&ok);
1557 } 1557 }
1558 1558
1559 1559
1560 LocationSummary* GuardFieldLengthInstr::MakeLocationSummary(Isolate* isolate, 1560 LocationSummary* GuardFieldLengthInstr::MakeLocationSummary(Zone* zone,
1561 bool opt) const { 1561 bool opt) const {
1562 const intptr_t kNumInputs = 1; 1562 const intptr_t kNumInputs = 1;
1563 if (!opt || (field().guarded_list_length() == Field::kUnknownFixedLength)) { 1563 if (!opt || (field().guarded_list_length() == Field::kUnknownFixedLength)) {
1564 const intptr_t kNumTemps = 3; 1564 const intptr_t kNumTemps = 3;
1565 LocationSummary* summary = new(isolate) LocationSummary( 1565 LocationSummary* summary = new(zone) LocationSummary(
1566 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 1566 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
1567 summary->set_in(0, Location::RequiresRegister()); 1567 summary->set_in(0, Location::RequiresRegister());
1568 // We need temporaries for field object, length offset and expected length. 1568 // We need temporaries for field object, length offset and expected length.
1569 summary->set_temp(0, Location::RequiresRegister()); 1569 summary->set_temp(0, Location::RequiresRegister());
1570 summary->set_temp(1, Location::RequiresRegister()); 1570 summary->set_temp(1, Location::RequiresRegister());
1571 summary->set_temp(2, Location::RequiresRegister()); 1571 summary->set_temp(2, Location::RequiresRegister());
1572 return summary; 1572 return summary;
1573 } else { 1573 } else {
1574 LocationSummary* summary = new(isolate) LocationSummary( 1574 LocationSummary* summary = new(zone) LocationSummary(
1575 isolate, kNumInputs, 0, LocationSummary::kNoCall); 1575 zone, kNumInputs, 0, LocationSummary::kNoCall);
1576 summary->set_in(0, Location::RequiresRegister()); 1576 summary->set_in(0, Location::RequiresRegister());
1577 return summary; 1577 return summary;
1578 } 1578 }
1579 UNREACHABLE(); 1579 UNREACHABLE();
1580 } 1580 }
1581 1581
1582 1582
1583 void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1583 void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1584 if (field().guarded_list_length() == Field::kNoFixedLength) { 1584 if (field().guarded_list_length() == Field::kNoFixedLength) {
1585 ASSERT(!compiler->is_optimizing()); 1585 ASSERT(!compiler->is_optimizing());
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 } 1703 }
1704 } 1704 }
1705 1705
1706 private: 1706 private:
1707 Instruction* instruction_; 1707 Instruction* instruction_;
1708 const Class& cls_; 1708 const Class& cls_;
1709 const Register result_; 1709 const Register result_;
1710 }; 1710 };
1711 1711
1712 1712
1713 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Isolate* isolate, 1713 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Zone* zone,
1714 bool opt) const { 1714 bool opt) const {
1715 const intptr_t kNumInputs = 2; 1715 const intptr_t kNumInputs = 2;
1716 const intptr_t kNumTemps = 1716 const intptr_t kNumTemps =
1717 (IsUnboxedStore() && opt) ? 2 : 1717 (IsUnboxedStore() && opt) ? 2 :
1718 ((IsPotentialUnboxedStore()) ? 3 : 0); 1718 ((IsPotentialUnboxedStore()) ? 3 : 0);
1719 LocationSummary* summary = new(isolate) LocationSummary( 1719 LocationSummary* summary = new(zone) LocationSummary(
1720 isolate, kNumInputs, kNumTemps, 1720 zone, kNumInputs, kNumTemps,
1721 ((IsUnboxedStore() && opt && is_potential_unboxed_initialization_) || 1721 ((IsUnboxedStore() && opt && is_potential_unboxed_initialization_) ||
1722 IsPotentialUnboxedStore()) 1722 IsPotentialUnboxedStore())
1723 ? LocationSummary::kCallOnSlowPath 1723 ? LocationSummary::kCallOnSlowPath
1724 : LocationSummary::kNoCall); 1724 : LocationSummary::kNoCall);
1725 1725
1726 summary->set_in(0, Location::RequiresRegister()); 1726 summary->set_in(0, Location::RequiresRegister());
1727 if (IsUnboxedStore() && opt) { 1727 if (IsUnboxedStore() && opt) {
1728 summary->set_in(1, Location::RequiresFpuRegister()); 1728 summary->set_in(1, Location::RequiresFpuRegister());
1729 summary->set_temp(0, Location::RequiresRegister()); 1729 summary->set_temp(0, Location::RequiresRegister());
1730 summary->set_temp(1, Location::RequiresRegister()); 1730 summary->set_temp(1, Location::RequiresRegister());
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1938 value_reg, 1938 value_reg,
1939 is_object_reference_initialization_ ? 1939 is_object_reference_initialization_ ?
1940 Assembler::kEmptyOrSmiOrNull : 1940 Assembler::kEmptyOrSmiOrNull :
1941 Assembler::kHeapObjectOrSmi); 1941 Assembler::kHeapObjectOrSmi);
1942 } 1942 }
1943 } 1943 }
1944 __ Bind(&skip_store); 1944 __ Bind(&skip_store);
1945 } 1945 }
1946 1946
1947 1947
1948 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Isolate* isolate, 1948 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone,
1949 bool opt) const { 1949 bool opt) const {
1950 const intptr_t kNumInputs = 1; 1950 const intptr_t kNumInputs = 1;
1951 const intptr_t kNumTemps = 0; 1951 const intptr_t kNumTemps = 0;
1952 LocationSummary* summary = new(isolate) LocationSummary( 1952 LocationSummary* summary = new(zone) LocationSummary(
1953 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 1953 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
1954 summary->set_in(0, Location::RequiresRegister()); 1954 summary->set_in(0, Location::RequiresRegister());
1955 // By specifying same register as input, our simple register allocator can 1955 // By specifying same register as input, our simple register allocator can
1956 // generate better code. 1956 // generate better code.
1957 summary->set_out(0, Location::SameAsFirstInput()); 1957 summary->set_out(0, Location::SameAsFirstInput());
1958 return summary; 1958 return summary;
1959 } 1959 }
1960 1960
1961 1961
1962 // When the parser is building an implicit static getter for optimization, 1962 // When the parser is building an implicit static getter for optimization,
1963 // it can generate a function body where deoptimization ids do not line up 1963 // it can generate a function body where deoptimization ids do not line up
1964 // with the unoptimized code. 1964 // with the unoptimized code.
1965 // 1965 //
1966 // This is safe only so long as LoadStaticFieldInstr cannot deoptimize. 1966 // This is safe only so long as LoadStaticFieldInstr cannot deoptimize.
1967 void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1967 void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1968 Register field = locs()->in(0).reg(); 1968 Register field = locs()->in(0).reg();
1969 Register result = locs()->out(0).reg(); 1969 Register result = locs()->out(0).reg();
1970 __ movl(result, FieldAddress(field, Field::value_offset())); 1970 __ movl(result, FieldAddress(field, Field::value_offset()));
1971 } 1971 }
1972 1972
1973 1973
1974 LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(Isolate* isolate, 1974 LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(Zone* zone,
1975 bool opt) const { 1975 bool opt) const {
1976 LocationSummary* locs = new(isolate) LocationSummary( 1976 LocationSummary* locs = new(zone) LocationSummary(
1977 isolate, 1, 1, LocationSummary::kNoCall); 1977 zone, 1, 1, LocationSummary::kNoCall);
1978 locs->set_in(0, value()->NeedsStoreBuffer() ? Location::WritableRegister() 1978 locs->set_in(0, value()->NeedsStoreBuffer() ? Location::WritableRegister()
1979 : Location::RequiresRegister()); 1979 : Location::RequiresRegister());
1980 locs->set_temp(0, Location::RequiresRegister()); 1980 locs->set_temp(0, Location::RequiresRegister());
1981 return locs; 1981 return locs;
1982 } 1982 }
1983 1983
1984 1984
1985 void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1985 void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1986 Register value = locs()->in(0).reg(); 1986 Register value = locs()->in(0).reg();
1987 Register temp = locs()->temp(0).reg(); 1987 Register temp = locs()->temp(0).reg();
1988 1988
1989 __ LoadObject(temp, field()); 1989 __ LoadObject(temp, field());
1990 if (this->value()->NeedsStoreBuffer()) { 1990 if (this->value()->NeedsStoreBuffer()) {
1991 __ StoreIntoObject(temp, 1991 __ StoreIntoObject(temp,
1992 FieldAddress(temp, Field::value_offset()), value, CanValueBeSmi()); 1992 FieldAddress(temp, Field::value_offset()), value, CanValueBeSmi());
1993 } else { 1993 } else {
1994 __ StoreIntoObjectNoBarrier( 1994 __ StoreIntoObjectNoBarrier(
1995 temp, FieldAddress(temp, Field::value_offset()), value); 1995 temp, FieldAddress(temp, Field::value_offset()), value);
1996 } 1996 }
1997 } 1997 }
1998 1998
1999 1999
2000 LocationSummary* InstanceOfInstr::MakeLocationSummary(Isolate* isolate, 2000 LocationSummary* InstanceOfInstr::MakeLocationSummary(Zone* zone,
2001 bool opt) const { 2001 bool opt) const {
2002 const intptr_t kNumInputs = 3; 2002 const intptr_t kNumInputs = 3;
2003 const intptr_t kNumTemps = 0; 2003 const intptr_t kNumTemps = 0;
2004 LocationSummary* summary = new(isolate) LocationSummary( 2004 LocationSummary* summary = new(zone) LocationSummary(
2005 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 2005 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
2006 summary->set_in(0, Location::RegisterLocation(EAX)); 2006 summary->set_in(0, Location::RegisterLocation(EAX));
2007 summary->set_in(1, Location::RegisterLocation(ECX)); 2007 summary->set_in(1, Location::RegisterLocation(ECX));
2008 summary->set_in(2, Location::RegisterLocation(EDX)); 2008 summary->set_in(2, Location::RegisterLocation(EDX));
2009 summary->set_out(0, Location::RegisterLocation(EAX)); 2009 summary->set_out(0, Location::RegisterLocation(EAX));
2010 return summary; 2010 return summary;
2011 } 2011 }
2012 2012
2013 2013
2014 void InstanceOfInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2014 void InstanceOfInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2015 ASSERT(locs()->in(0).reg() == EAX); // Value. 2015 ASSERT(locs()->in(0).reg() == EAX); // Value.
2016 ASSERT(locs()->in(1).reg() == ECX); // Instantiator. 2016 ASSERT(locs()->in(1).reg() == ECX); // Instantiator.
2017 ASSERT(locs()->in(2).reg() == EDX); // Instantiator type arguments. 2017 ASSERT(locs()->in(2).reg() == EDX); // Instantiator type arguments.
2018 2018
2019 compiler->GenerateInstanceOf(token_pos(), 2019 compiler->GenerateInstanceOf(token_pos(),
2020 deopt_id(), 2020 deopt_id(),
2021 type(), 2021 type(),
2022 negate_result(), 2022 negate_result(),
2023 locs()); 2023 locs());
2024 ASSERT(locs()->out(0).reg() == EAX); 2024 ASSERT(locs()->out(0).reg() == EAX);
2025 } 2025 }
2026 2026
2027 2027
2028 // TODO(srdjan): In case of constant inputs make CreateArray kNoCall and 2028 // TODO(srdjan): In case of constant inputs make CreateArray kNoCall and
2029 // use slow path stub. 2029 // use slow path stub.
2030 LocationSummary* CreateArrayInstr::MakeLocationSummary(Isolate* isolate, 2030 LocationSummary* CreateArrayInstr::MakeLocationSummary(Zone* zone,
2031 bool opt) const { 2031 bool opt) const {
2032 const intptr_t kNumInputs = 2; 2032 const intptr_t kNumInputs = 2;
2033 const intptr_t kNumTemps = 0; 2033 const intptr_t kNumTemps = 0;
2034 LocationSummary* locs = new(isolate) LocationSummary( 2034 LocationSummary* locs = new(zone) LocationSummary(
2035 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 2035 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
2036 locs->set_in(0, Location::RegisterLocation(ECX)); 2036 locs->set_in(0, Location::RegisterLocation(ECX));
2037 locs->set_in(1, Location::RegisterLocation(EDX)); 2037 locs->set_in(1, Location::RegisterLocation(EDX));
2038 locs->set_out(0, Location::RegisterLocation(EAX)); 2038 locs->set_out(0, Location::RegisterLocation(EAX));
2039 return locs; 2039 return locs;
2040 } 2040 }
2041 2041
2042 2042
2043 // Inlines array allocation for known constant values. 2043 // Inlines array allocation for known constant values.
2044 static void InlineArrayAllocation(FlowGraphCompiler* compiler, 2044 static void InlineArrayAllocation(FlowGraphCompiler* compiler,
2045 intptr_t num_elements, 2045 intptr_t num_elements,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
2135 compiler->GenerateCall(token_pos(), 2135 compiler->GenerateCall(token_pos(),
2136 &label, 2136 &label,
2137 RawPcDescriptors::kOther, 2137 RawPcDescriptors::kOther,
2138 locs()); 2138 locs());
2139 compiler->AddStubCallTarget(stub); 2139 compiler->AddStubCallTarget(stub);
2140 __ Bind(&done); 2140 __ Bind(&done);
2141 ASSERT(locs()->out(0).reg() == kResultReg); 2141 ASSERT(locs()->out(0).reg() == kResultReg);
2142 } 2142 }
2143 2143
2144 2144
2145 LocationSummary* LoadFieldInstr::MakeLocationSummary(Isolate* isolate, 2145 LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone,
2146 bool opt) const { 2146 bool opt) const {
2147 const intptr_t kNumInputs = 1; 2147 const intptr_t kNumInputs = 1;
2148 const intptr_t kNumTemps = 2148 const intptr_t kNumTemps =
2149 (IsUnboxedLoad() && opt) ? 1 : 2149 (IsUnboxedLoad() && opt) ? 1 :
2150 ((IsPotentialUnboxedLoad()) ? 2 : 0); 2150 ((IsPotentialUnboxedLoad()) ? 2 : 0);
2151 2151
2152 LocationSummary* locs = new(isolate) LocationSummary( 2152 LocationSummary* locs = new(zone) LocationSummary(
2153 isolate, kNumInputs, kNumTemps, 2153 zone, kNumInputs, kNumTemps,
2154 (opt && !IsPotentialUnboxedLoad()) 2154 (opt && !IsPotentialUnboxedLoad())
2155 ? LocationSummary::kNoCall 2155 ? LocationSummary::kNoCall
2156 : LocationSummary::kCallOnSlowPath); 2156 : LocationSummary::kCallOnSlowPath);
2157 2157
2158 locs->set_in(0, Location::RequiresRegister()); 2158 locs->set_in(0, Location::RequiresRegister());
2159 2159
2160 if (IsUnboxedLoad() && opt) { 2160 if (IsUnboxedLoad() && opt) {
2161 locs->set_temp(0, Location::RequiresRegister()); 2161 locs->set_temp(0, Location::RequiresRegister());
2162 } else if (IsPotentialUnboxedLoad()) { 2162 } else if (IsPotentialUnboxedLoad()) {
2163 locs->set_temp(0, opt ? Location::RequiresFpuRegister() 2163 locs->set_temp(0, opt ? Location::RequiresFpuRegister()
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
2261 __ jmp(&done); 2261 __ jmp(&done);
2262 } 2262 }
2263 2263
2264 __ Bind(&load_pointer); 2264 __ Bind(&load_pointer);
2265 } 2265 }
2266 __ movl(result, FieldAddress(instance_reg, offset_in_bytes())); 2266 __ movl(result, FieldAddress(instance_reg, offset_in_bytes()));
2267 __ Bind(&done); 2267 __ Bind(&done);
2268 } 2268 }
2269 2269
2270 2270
2271 LocationSummary* InstantiateTypeInstr::MakeLocationSummary(Isolate* isolate, 2271 LocationSummary* InstantiateTypeInstr::MakeLocationSummary(Zone* zone,
2272 bool opt) const { 2272 bool opt) const {
2273 const intptr_t kNumInputs = 1; 2273 const intptr_t kNumInputs = 1;
2274 const intptr_t kNumTemps = 0; 2274 const intptr_t kNumTemps = 0;
2275 LocationSummary* locs = new(isolate) LocationSummary( 2275 LocationSummary* locs = new(zone) LocationSummary(
2276 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 2276 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
2277 locs->set_in(0, Location::RegisterLocation(EAX)); 2277 locs->set_in(0, Location::RegisterLocation(EAX));
2278 locs->set_out(0, Location::RegisterLocation(EAX)); 2278 locs->set_out(0, Location::RegisterLocation(EAX));
2279 return locs; 2279 return locs;
2280 } 2280 }
2281 2281
2282 2282
2283 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2283 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2284 Register instantiator_reg = locs()->in(0).reg(); 2284 Register instantiator_reg = locs()->in(0).reg();
2285 Register result_reg = locs()->out(0).reg(); 2285 Register result_reg = locs()->out(0).reg();
2286 2286
2287 // 'instantiator_reg' is the instantiator TypeArguments object (or null). 2287 // 'instantiator_reg' is the instantiator TypeArguments object (or null).
2288 // A runtime call to instantiate the type is required. 2288 // A runtime call to instantiate the type is required.
2289 __ PushObject(Object::null_object()); // Make room for the result. 2289 __ PushObject(Object::null_object()); // Make room for the result.
2290 __ PushObject(type()); 2290 __ PushObject(type());
2291 __ pushl(instantiator_reg); // Push instantiator type arguments. 2291 __ pushl(instantiator_reg); // Push instantiator type arguments.
2292 compiler->GenerateRuntimeCall(token_pos(), 2292 compiler->GenerateRuntimeCall(token_pos(),
2293 deopt_id(), 2293 deopt_id(),
2294 kInstantiateTypeRuntimeEntry, 2294 kInstantiateTypeRuntimeEntry,
2295 2, 2295 2,
2296 locs()); 2296 locs());
2297 __ Drop(2); // Drop instantiator and uninstantiated type. 2297 __ Drop(2); // Drop instantiator and uninstantiated type.
2298 __ popl(result_reg); // Pop instantiated type. 2298 __ popl(result_reg); // Pop instantiated type.
2299 ASSERT(instantiator_reg == result_reg); 2299 ASSERT(instantiator_reg == result_reg);
2300 } 2300 }
2301 2301
2302 2302
2303 LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary( 2303 LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary(
2304 Isolate* isolate, bool opt) const { 2304 Zone* zone, bool opt) const {
2305 const intptr_t kNumInputs = 1; 2305 const intptr_t kNumInputs = 1;
2306 const intptr_t kNumTemps = 0; 2306 const intptr_t kNumTemps = 0;
2307 LocationSummary* locs = new(isolate) LocationSummary( 2307 LocationSummary* locs = new(zone) LocationSummary(
2308 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 2308 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
2309 locs->set_in(0, Location::RegisterLocation(EAX)); 2309 locs->set_in(0, Location::RegisterLocation(EAX));
2310 locs->set_out(0, Location::RegisterLocation(EAX)); 2310 locs->set_out(0, Location::RegisterLocation(EAX));
2311 return locs; 2311 return locs;
2312 } 2312 }
2313 2313
2314 2314
2315 void InstantiateTypeArgumentsInstr::EmitNativeCode( 2315 void InstantiateTypeArgumentsInstr::EmitNativeCode(
2316 FlowGraphCompiler* compiler) { 2316 FlowGraphCompiler* compiler) {
2317 Register instantiator_reg = locs()->in(0).reg(); 2317 Register instantiator_reg = locs()->in(0).reg();
2318 Register result_reg = locs()->out(0).reg(); 2318 Register result_reg = locs()->out(0).reg();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2366 kInstantiateTypeArgumentsRuntimeEntry, 2366 kInstantiateTypeArgumentsRuntimeEntry,
2367 2, 2367 2,
2368 locs()); 2368 locs());
2369 __ Drop(2); // Drop instantiator and uninstantiated type arguments. 2369 __ Drop(2); // Drop instantiator and uninstantiated type arguments.
2370 __ popl(result_reg); // Pop instantiated type arguments. 2370 __ popl(result_reg); // Pop instantiated type arguments.
2371 __ Bind(&type_arguments_instantiated); 2371 __ Bind(&type_arguments_instantiated);
2372 } 2372 }
2373 2373
2374 2374
2375 LocationSummary* AllocateUninitializedContextInstr::MakeLocationSummary( 2375 LocationSummary* AllocateUninitializedContextInstr::MakeLocationSummary(
2376 Isolate* isolate, 2376 Zone* zone,
2377 bool opt) const { 2377 bool opt) const {
2378 ASSERT(opt); 2378 ASSERT(opt);
2379 const intptr_t kNumInputs = 0; 2379 const intptr_t kNumInputs = 0;
2380 const intptr_t kNumTemps = 1; 2380 const intptr_t kNumTemps = 1;
2381 LocationSummary* locs = new(isolate) LocationSummary( 2381 LocationSummary* locs = new(zone) LocationSummary(
2382 isolate, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath); 2382 zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath);
2383 locs->set_temp(0, Location::RegisterLocation(ECX)); 2383 locs->set_temp(0, Location::RegisterLocation(ECX));
2384 locs->set_out(0, Location::RegisterLocation(EAX)); 2384 locs->set_out(0, Location::RegisterLocation(EAX));
2385 return locs; 2385 return locs;
2386 } 2386 }
2387 2387
2388 2388
2389 class AllocateContextSlowPath : public SlowPathCode { 2389 class AllocateContextSlowPath : public SlowPathCode {
2390 public: 2390 public:
2391 explicit AllocateContextSlowPath( 2391 explicit AllocateContextSlowPath(
2392 AllocateUninitializedContextInstr* instruction) 2392 AllocateUninitializedContextInstr* instruction)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2434 temp); // end address 2434 temp); // end address
2435 2435
2436 // Setup up number of context variables field. 2436 // Setup up number of context variables field.
2437 __ movl(FieldAddress(result, Context::num_variables_offset()), 2437 __ movl(FieldAddress(result, Context::num_variables_offset()),
2438 Immediate(num_context_variables())); 2438 Immediate(num_context_variables()));
2439 2439
2440 __ Bind(slow_path->exit_label()); 2440 __ Bind(slow_path->exit_label());
2441 } 2441 }
2442 2442
2443 2443
2444 LocationSummary* AllocateContextInstr::MakeLocationSummary(Isolate* isolate, 2444 LocationSummary* AllocateContextInstr::MakeLocationSummary(Zone* zone,
2445 bool opt) const { 2445 bool opt) const {
2446 const intptr_t kNumInputs = 0; 2446 const intptr_t kNumInputs = 0;
2447 const intptr_t kNumTemps = 1; 2447 const intptr_t kNumTemps = 1;
2448 LocationSummary* locs = new(isolate) LocationSummary( 2448 LocationSummary* locs = new(zone) LocationSummary(
2449 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 2449 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
2450 locs->set_temp(0, Location::RegisterLocation(EDX)); 2450 locs->set_temp(0, Location::RegisterLocation(EDX));
2451 locs->set_out(0, Location::RegisterLocation(EAX)); 2451 locs->set_out(0, Location::RegisterLocation(EAX));
2452 return locs; 2452 return locs;
2453 } 2453 }
2454 2454
2455 2455
2456 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2456 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2457 ASSERT(locs()->temp(0).reg() == EDX); 2457 ASSERT(locs()->temp(0).reg() == EDX);
2458 ASSERT(locs()->out(0).reg() == EAX); 2458 ASSERT(locs()->out(0).reg() == EAX);
2459 2459
2460 __ movl(EDX, Immediate(num_context_variables())); 2460 __ movl(EDX, Immediate(num_context_variables()));
2461 StubCode* stub_code = compiler->isolate()->stub_code(); 2461 StubCode* stub_code = compiler->isolate()->stub_code();
2462 const ExternalLabel label(stub_code->AllocateContextEntryPoint()); 2462 const ExternalLabel label(stub_code->AllocateContextEntryPoint());
2463 compiler->GenerateCall(token_pos(), 2463 compiler->GenerateCall(token_pos(),
2464 &label, 2464 &label,
2465 RawPcDescriptors::kOther, 2465 RawPcDescriptors::kOther,
2466 locs()); 2466 locs());
2467 } 2467 }
2468 2468
2469 2469
2470 LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Isolate* isolate, 2470 LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone,
2471 bool opt) const { 2471 bool opt) const {
2472 const intptr_t kNumInputs = 1; 2472 const intptr_t kNumInputs = 1;
2473 const intptr_t kNumTemps = 1; 2473 const intptr_t kNumTemps = 1;
2474 LocationSummary* locs = new(isolate) LocationSummary( 2474 LocationSummary* locs = new(zone) LocationSummary(
2475 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 2475 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
2476 locs->set_in(0, Location::RegisterLocation(EAX)); 2476 locs->set_in(0, Location::RegisterLocation(EAX));
2477 locs->set_temp(0, Location::RegisterLocation(ECX)); 2477 locs->set_temp(0, Location::RegisterLocation(ECX));
2478 return locs; 2478 return locs;
2479 } 2479 }
2480 2480
2481 2481
2482 void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2482 void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2483 Register field = locs()->in(0).reg(); 2483 Register field = locs()->in(0).reg();
2484 Register temp = locs()->temp(0).reg(); 2484 Register temp = locs()->temp(0).reg();
2485 2485
(...skipping 12 matching lines...) Expand all
2498 compiler->GenerateRuntimeCall(token_pos(), 2498 compiler->GenerateRuntimeCall(token_pos(),
2499 deopt_id(), 2499 deopt_id(),
2500 kInitStaticFieldRuntimeEntry, 2500 kInitStaticFieldRuntimeEntry,
2501 1, 2501 1,
2502 locs()); 2502 locs());
2503 __ Drop(2); // Remove argument and unused result. 2503 __ Drop(2); // Remove argument and unused result.
2504 __ Bind(&no_call); 2504 __ Bind(&no_call);
2505 } 2505 }
2506 2506
2507 2507
2508 LocationSummary* CloneContextInstr::MakeLocationSummary(Isolate* isolate, 2508 LocationSummary* CloneContextInstr::MakeLocationSummary(Zone* zone,
2509 bool opt) const { 2509 bool opt) const {
2510 const intptr_t kNumInputs = 1; 2510 const intptr_t kNumInputs = 1;
2511 const intptr_t kNumTemps = 0; 2511 const intptr_t kNumTemps = 0;
2512 LocationSummary* locs = new(isolate) LocationSummary( 2512 LocationSummary* locs = new(zone) LocationSummary(
2513 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 2513 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
2514 locs->set_in(0, Location::RegisterLocation(EAX)); 2514 locs->set_in(0, Location::RegisterLocation(EAX));
2515 locs->set_out(0, Location::RegisterLocation(EAX)); 2515 locs->set_out(0, Location::RegisterLocation(EAX));
2516 return locs; 2516 return locs;
2517 } 2517 }
2518 2518
2519 2519
2520 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2520 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2521 Register context_value = locs()->in(0).reg(); 2521 Register context_value = locs()->in(0).reg();
2522 Register result = locs()->out(0).reg(); 2522 Register result = locs()->out(0).reg();
2523 2523
2524 __ PushObject(Object::null_object()); // Make room for the result. 2524 __ PushObject(Object::null_object()); // Make room for the result.
2525 __ pushl(context_value); 2525 __ pushl(context_value);
2526 compiler->GenerateRuntimeCall(token_pos(), 2526 compiler->GenerateRuntimeCall(token_pos(),
2527 deopt_id(), 2527 deopt_id(),
2528 kCloneContextRuntimeEntry, 2528 kCloneContextRuntimeEntry,
2529 1, 2529 1,
2530 locs()); 2530 locs());
2531 __ popl(result); // Remove argument. 2531 __ popl(result); // Remove argument.
2532 __ popl(result); // Get result (cloned context). 2532 __ popl(result); // Get result (cloned context).
2533 } 2533 }
2534 2534
2535 2535
2536 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Isolate* isolate, 2536 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Zone* zone,
2537 bool opt) const { 2537 bool opt) const {
2538 UNREACHABLE(); 2538 UNREACHABLE();
2539 return NULL; 2539 return NULL;
2540 } 2540 }
2541 2541
2542 2542
2543 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2543 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2544 __ Bind(compiler->GetJumpLabel(this)); 2544 __ Bind(compiler->GetJumpLabel(this));
2545 compiler->AddExceptionHandler(catch_try_index(), 2545 compiler->AddExceptionHandler(catch_try_index(),
2546 try_index(), 2546 try_index(),
(...skipping 13 matching lines...) Expand all
2560 2560
2561 // Restore stack and initialize the two exception variables: 2561 // Restore stack and initialize the two exception variables:
2562 // exception and stack trace variables. 2562 // exception and stack trace variables.
2563 __ movl(Address(EBP, exception_var().index() * kWordSize), 2563 __ movl(Address(EBP, exception_var().index() * kWordSize),
2564 kExceptionObjectReg); 2564 kExceptionObjectReg);
2565 __ movl(Address(EBP, stacktrace_var().index() * kWordSize), 2565 __ movl(Address(EBP, stacktrace_var().index() * kWordSize),
2566 kStackTraceObjectReg); 2566 kStackTraceObjectReg);
2567 } 2567 }
2568 2568
2569 2569
2570 LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Isolate* isolate, 2570 LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Zone* zone,
2571 bool opt) const { 2571 bool opt) const {
2572 const intptr_t kNumInputs = 0; 2572 const intptr_t kNumInputs = 0;
2573 const intptr_t kNumTemps = 0; 2573 const intptr_t kNumTemps = 0;
2574 LocationSummary* summary = new(isolate) LocationSummary( 2574 LocationSummary* summary = new(zone) LocationSummary(
2575 isolate, kNumInputs, 2575 zone, kNumInputs,
2576 kNumTemps, 2576 kNumTemps,
2577 LocationSummary::kCallOnSlowPath); 2577 LocationSummary::kCallOnSlowPath);
2578 return summary; 2578 return summary;
2579 } 2579 }
2580 2580
2581 2581
2582 class CheckStackOverflowSlowPath : public SlowPathCode { 2582 class CheckStackOverflowSlowPath : public SlowPathCode {
2583 public: 2583 public:
2584 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) 2584 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction)
2585 : instruction_(instruction) { } 2585 : instruction_(instruction) { }
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
2755 __ shll(left, right); 2755 __ shll(left, right);
2756 __ sarl(left, right); 2756 __ sarl(left, right);
2757 __ cmpl(left, temp); 2757 __ cmpl(left, temp);
2758 __ j(NOT_EQUAL, deopt); // Overflow. 2758 __ j(NOT_EQUAL, deopt); // Overflow.
2759 // Shift for result now we know there is no overflow. 2759 // Shift for result now we know there is no overflow.
2760 __ shll(left, right); 2760 __ shll(left, right);
2761 } 2761 }
2762 } 2762 }
2763 2763
2764 2764
2765 LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Isolate* isolate, 2765 LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone,
2766 bool opt) const { 2766 bool opt) const {
2767 const intptr_t kNumInputs = 2; 2767 const intptr_t kNumInputs = 2;
2768 if (op_kind() == Token::kTRUNCDIV) { 2768 if (op_kind() == Token::kTRUNCDIV) {
2769 const intptr_t kNumTemps = 1; 2769 const intptr_t kNumTemps = 1;
2770 LocationSummary* summary = new(isolate) LocationSummary( 2770 LocationSummary* summary = new(zone) LocationSummary(
2771 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 2771 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
2772 if (RightIsPowerOfTwoConstant()) { 2772 if (RightIsPowerOfTwoConstant()) {
2773 summary->set_in(0, Location::RequiresRegister()); 2773 summary->set_in(0, Location::RequiresRegister());
2774 ConstantInstr* right_constant = right()->definition()->AsConstant(); 2774 ConstantInstr* right_constant = right()->definition()->AsConstant();
2775 // The programmer only controls one bit, so the constant is safe. 2775 // The programmer only controls one bit, so the constant is safe.
2776 summary->set_in(1, Location::Constant(right_constant)); 2776 summary->set_in(1, Location::Constant(right_constant));
2777 summary->set_temp(0, Location::RequiresRegister()); 2777 summary->set_temp(0, Location::RequiresRegister());
2778 summary->set_out(0, Location::SameAsFirstInput()); 2778 summary->set_out(0, Location::SameAsFirstInput());
2779 } else { 2779 } else {
2780 // Both inputs must be writable because they will be untagged. 2780 // Both inputs must be writable because they will be untagged.
2781 summary->set_in(0, Location::RegisterLocation(EAX)); 2781 summary->set_in(0, Location::RegisterLocation(EAX));
2782 summary->set_in(1, Location::WritableRegister()); 2782 summary->set_in(1, Location::WritableRegister());
2783 summary->set_out(0, Location::SameAsFirstInput()); 2783 summary->set_out(0, Location::SameAsFirstInput());
2784 // Will be used for sign extension and division. 2784 // Will be used for sign extension and division.
2785 summary->set_temp(0, Location::RegisterLocation(EDX)); 2785 summary->set_temp(0, Location::RegisterLocation(EDX));
2786 } 2786 }
2787 return summary; 2787 return summary;
2788 } else if (op_kind() == Token::kMOD) { 2788 } else if (op_kind() == Token::kMOD) {
2789 const intptr_t kNumTemps = 1; 2789 const intptr_t kNumTemps = 1;
2790 LocationSummary* summary = new(isolate) LocationSummary( 2790 LocationSummary* summary = new(zone) LocationSummary(
2791 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 2791 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
2792 // Both inputs must be writable because they will be untagged. 2792 // Both inputs must be writable because they will be untagged.
2793 summary->set_in(0, Location::RegisterLocation(EDX)); 2793 summary->set_in(0, Location::RegisterLocation(EDX));
2794 summary->set_in(1, Location::WritableRegister()); 2794 summary->set_in(1, Location::WritableRegister());
2795 summary->set_out(0, Location::SameAsFirstInput()); 2795 summary->set_out(0, Location::SameAsFirstInput());
2796 // Will be used for sign extension and division. 2796 // Will be used for sign extension and division.
2797 summary->set_temp(0, Location::RegisterLocation(EAX)); 2797 summary->set_temp(0, Location::RegisterLocation(EAX));
2798 return summary; 2798 return summary;
2799 } else if (op_kind() == Token::kSHR) { 2799 } else if (op_kind() == Token::kSHR) {
2800 const intptr_t kNumTemps = 0; 2800 const intptr_t kNumTemps = 0;
2801 LocationSummary* summary = new(isolate) LocationSummary( 2801 LocationSummary* summary = new(zone) LocationSummary(
2802 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 2802 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
2803 summary->set_in(0, Location::RequiresRegister()); 2803 summary->set_in(0, Location::RequiresRegister());
2804 summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), ECX)); 2804 summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), ECX));
2805 summary->set_out(0, Location::SameAsFirstInput()); 2805 summary->set_out(0, Location::SameAsFirstInput());
2806 return summary; 2806 return summary;
2807 } else if (op_kind() == Token::kSHL) { 2807 } else if (op_kind() == Token::kSHL) {
2808 const intptr_t kNumTemps = can_overflow() ? 1 : 0; 2808 const intptr_t kNumTemps = can_overflow() ? 1 : 0;
2809 LocationSummary* summary = new(isolate) LocationSummary( 2809 LocationSummary* summary = new(zone) LocationSummary(
2810 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 2810 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
2811 summary->set_in(0, Location::RequiresRegister()); 2811 summary->set_in(0, Location::RequiresRegister());
2812 summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), ECX)); 2812 summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), ECX));
2813 if (can_overflow()) { 2813 if (can_overflow()) {
2814 summary->set_temp(0, Location::RequiresRegister()); 2814 summary->set_temp(0, Location::RequiresRegister());
2815 } 2815 }
2816 summary->set_out(0, Location::SameAsFirstInput()); 2816 summary->set_out(0, Location::SameAsFirstInput());
2817 return summary; 2817 return summary;
2818 } else { 2818 } else {
2819 const intptr_t kNumTemps = 0; 2819 const intptr_t kNumTemps = 0;
2820 LocationSummary* summary = new(isolate) LocationSummary( 2820 LocationSummary* summary = new(zone) LocationSummary(
2821 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 2821 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
2822 summary->set_in(0, Location::RequiresRegister()); 2822 summary->set_in(0, Location::RequiresRegister());
2823 ConstantInstr* constant = right()->definition()->AsConstant(); 2823 ConstantInstr* constant = right()->definition()->AsConstant();
2824 if (constant != NULL) { 2824 if (constant != NULL) {
2825 summary->set_in(1, Location::RegisterOrSmiConstant(right())); 2825 summary->set_in(1, Location::RegisterOrSmiConstant(right()));
2826 } else { 2826 } else {
2827 summary->set_in(1, Location::PrefersRegister()); 2827 summary->set_in(1, Location::PrefersRegister());
2828 } 2828 }
2829 summary->set_out(0, Location::SameAsFirstInput()); 2829 summary->set_out(0, Location::SameAsFirstInput());
2830 return summary; 2830 return summary;
2831 } 2831 }
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
3064 UNREACHABLE(); 3064 UNREACHABLE();
3065 break; 3065 break;
3066 } 3066 }
3067 default: 3067 default:
3068 UNREACHABLE(); 3068 UNREACHABLE();
3069 break; 3069 break;
3070 } 3070 }
3071 } 3071 }
3072 3072
3073 3073
3074 LocationSummary* BinaryInt32OpInstr::MakeLocationSummary(Isolate* isolate, 3074 LocationSummary* BinaryInt32OpInstr::MakeLocationSummary(Zone* zone,
3075 bool opt) const { 3075 bool opt) const {
3076 const intptr_t kNumInputs = 2; 3076 const intptr_t kNumInputs = 2;
3077 if (op_kind() == Token::kTRUNCDIV) { 3077 if (op_kind() == Token::kTRUNCDIV) {
3078 UNREACHABLE(); 3078 UNREACHABLE();
3079 return NULL; 3079 return NULL;
3080 } else if (op_kind() == Token::kMOD) { 3080 } else if (op_kind() == Token::kMOD) {
3081 UNREACHABLE(); 3081 UNREACHABLE();
3082 return NULL; 3082 return NULL;
3083 } else if (op_kind() == Token::kSHR) { 3083 } else if (op_kind() == Token::kSHR) {
3084 const intptr_t kNumTemps = 0; 3084 const intptr_t kNumTemps = 0;
3085 LocationSummary* summary = new(isolate) LocationSummary( 3085 LocationSummary* summary = new(zone) LocationSummary(
3086 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3086 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3087 summary->set_in(0, Location::RequiresRegister()); 3087 summary->set_in(0, Location::RequiresRegister());
3088 summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), ECX)); 3088 summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), ECX));
3089 summary->set_out(0, Location::SameAsFirstInput()); 3089 summary->set_out(0, Location::SameAsFirstInput());
3090 return summary; 3090 return summary;
3091 } else if (op_kind() == Token::kSHL) { 3091 } else if (op_kind() == Token::kSHL) {
3092 const intptr_t kNumTemps = can_overflow() ? 1 : 0; 3092 const intptr_t kNumTemps = can_overflow() ? 1 : 0;
3093 LocationSummary* summary = new(isolate) LocationSummary( 3093 LocationSummary* summary = new(zone) LocationSummary(
3094 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3094 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3095 summary->set_in(0, Location::RequiresRegister()); 3095 summary->set_in(0, Location::RequiresRegister());
3096 summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), ECX)); 3096 summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), ECX));
3097 if (can_overflow()) { 3097 if (can_overflow()) {
3098 summary->set_temp(0, Location::RequiresRegister()); 3098 summary->set_temp(0, Location::RequiresRegister());
3099 } 3099 }
3100 summary->set_out(0, Location::SameAsFirstInput()); 3100 summary->set_out(0, Location::SameAsFirstInput());
3101 return summary; 3101 return summary;
3102 } else { 3102 } else {
3103 const intptr_t kNumTemps = 0; 3103 const intptr_t kNumTemps = 0;
3104 LocationSummary* summary = new(isolate) LocationSummary( 3104 LocationSummary* summary = new(zone) LocationSummary(
3105 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3105 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3106 summary->set_in(0, Location::RequiresRegister()); 3106 summary->set_in(0, Location::RequiresRegister());
3107 ConstantInstr* constant = right()->definition()->AsConstant(); 3107 ConstantInstr* constant = right()->definition()->AsConstant();
3108 if (constant != NULL) { 3108 if (constant != NULL) {
3109 summary->set_in(1, Location::RegisterOrSmiConstant(right())); 3109 summary->set_in(1, Location::RegisterOrSmiConstant(right()));
3110 } else { 3110 } else {
3111 summary->set_in(1, Location::PrefersRegister()); 3111 summary->set_in(1, Location::PrefersRegister());
3112 } 3112 }
3113 summary->set_out(0, Location::SameAsFirstInput()); 3113 summary->set_out(0, Location::SameAsFirstInput());
3114 return summary; 3114 return summary;
3115 } 3115 }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
3226 deopt); 3226 deopt);
3227 break; 3227 break;
3228 3228
3229 default: 3229 default:
3230 UNREACHABLE(); 3230 UNREACHABLE();
3231 break; 3231 break;
3232 } 3232 }
3233 } 3233 }
3234 3234
3235 3235
3236 LocationSummary* BinaryUint32OpInstr::MakeLocationSummary(Isolate* isolate, 3236 LocationSummary* BinaryUint32OpInstr::MakeLocationSummary(Zone* zone,
3237 bool opt) const { 3237 bool opt) const {
3238 const intptr_t kNumInputs = 2; 3238 const intptr_t kNumInputs = 2;
3239 const intptr_t kNumTemps = (op_kind() == Token::kMUL) ? 1 : 0; 3239 const intptr_t kNumTemps = (op_kind() == Token::kMUL) ? 1 : 0;
3240 LocationSummary* summary = new(isolate) LocationSummary( 3240 LocationSummary* summary = new(zone) LocationSummary(
3241 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3241 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3242 if (op_kind() == Token::kMUL) { 3242 if (op_kind() == Token::kMUL) {
3243 summary->set_in(0, Location::RegisterLocation(EAX)); 3243 summary->set_in(0, Location::RegisterLocation(EAX));
3244 summary->set_temp(0, Location::RegisterLocation(EDX)); 3244 summary->set_temp(0, Location::RegisterLocation(EDX));
3245 } else { 3245 } else {
3246 summary->set_in(0, Location::RequiresRegister()); 3246 summary->set_in(0, Location::RequiresRegister());
3247 } 3247 }
3248 summary->set_in(1, Location::RequiresRegister()); 3248 summary->set_in(1, Location::RequiresRegister());
3249 summary->set_out(0, Location::SameAsFirstInput()); 3249 summary->set_out(0, Location::SameAsFirstInput());
3250 return summary; 3250 return summary;
3251 } 3251 }
(...skipping 17 matching lines...) Expand all
3269 __ mull(right); // Result in EDX:EAX. 3269 __ mull(right); // Result in EDX:EAX.
3270 ASSERT(out == EAX); 3270 ASSERT(out == EAX);
3271 ASSERT(locs()->temp(0).reg() == EDX); 3271 ASSERT(locs()->temp(0).reg() == EDX);
3272 break; 3272 break;
3273 default: 3273 default:
3274 UNREACHABLE(); 3274 UNREACHABLE();
3275 } 3275 }
3276 } 3276 }
3277 3277
3278 3278
3279 LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary(Isolate* isolate, 3279 LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary(Zone* zone,
3280 bool opt) const { 3280 bool opt) const {
3281 intptr_t left_cid = left()->Type()->ToCid(); 3281 intptr_t left_cid = left()->Type()->ToCid();
3282 intptr_t right_cid = right()->Type()->ToCid(); 3282 intptr_t right_cid = right()->Type()->ToCid();
3283 ASSERT((left_cid != kDoubleCid) && (right_cid != kDoubleCid)); 3283 ASSERT((left_cid != kDoubleCid) && (right_cid != kDoubleCid));
3284 const intptr_t kNumInputs = 2; 3284 const intptr_t kNumInputs = 2;
3285 const bool need_temp = (left()->definition() != right()->definition()) 3285 const bool need_temp = (left()->definition() != right()->definition())
3286 && (left_cid != kSmiCid) 3286 && (left_cid != kSmiCid)
3287 && (right_cid != kSmiCid); 3287 && (right_cid != kSmiCid);
3288 const intptr_t kNumTemps = need_temp ? 1 : 0; 3288 const intptr_t kNumTemps = need_temp ? 1 : 0;
3289 LocationSummary* summary = new(isolate) LocationSummary( 3289 LocationSummary* summary = new(zone) LocationSummary(
3290 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3290 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3291 summary->set_in(0, Location::RequiresRegister()); 3291 summary->set_in(0, Location::RequiresRegister());
3292 summary->set_in(1, Location::RequiresRegister()); 3292 summary->set_in(1, Location::RequiresRegister());
3293 if (need_temp) summary->set_temp(0, Location::RequiresRegister()); 3293 if (need_temp) summary->set_temp(0, Location::RequiresRegister());
3294 return summary; 3294 return summary;
3295 } 3295 }
3296 3296
3297 3297
3298 void CheckEitherNonSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3298 void CheckEitherNonSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3299 Label* deopt = compiler->AddDeoptStub(deopt_id(), 3299 Label* deopt = compiler->AddDeoptStub(deopt_id(),
3300 ICData::kDeoptBinaryDoubleOp, 3300 ICData::kDeoptBinaryDoubleOp,
(...skipping 11 matching lines...) Expand all
3312 } else { 3312 } else {
3313 Register temp = locs()->temp(0).reg(); 3313 Register temp = locs()->temp(0).reg();
3314 __ movl(temp, left); 3314 __ movl(temp, left);
3315 __ orl(temp, right); 3315 __ orl(temp, right);
3316 __ testl(temp, Immediate(kSmiTagMask)); 3316 __ testl(temp, Immediate(kSmiTagMask));
3317 } 3317 }
3318 __ j(ZERO, deopt); 3318 __ j(ZERO, deopt);
3319 } 3319 }
3320 3320
3321 3321
3322 LocationSummary* BoxInstr::MakeLocationSummary(Isolate* isolate, 3322 LocationSummary* BoxInstr::MakeLocationSummary(Zone* zone,
3323 bool opt) const { 3323 bool opt) const {
3324 const intptr_t kNumInputs = 1; 3324 const intptr_t kNumInputs = 1;
3325 const intptr_t kNumTemps = 0; 3325 const intptr_t kNumTemps = 0;
3326 LocationSummary* summary = new(isolate) LocationSummary( 3326 LocationSummary* summary = new(zone) LocationSummary(
3327 isolate, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath); 3327 zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath);
3328 summary->set_in(0, Location::RequiresFpuRegister()); 3328 summary->set_in(0, Location::RequiresFpuRegister());
3329 summary->set_out(0, Location::RequiresRegister()); 3329 summary->set_out(0, Location::RequiresRegister());
3330 return summary; 3330 return summary;
3331 } 3331 }
3332 3332
3333 3333
3334 void BoxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3334 void BoxInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3335 Register out_reg = locs()->out(0).reg(); 3335 Register out_reg = locs()->out(0).reg();
3336 XmmRegister value = locs()->in(0).fpu_reg(); 3336 XmmRegister value = locs()->in(0).fpu_reg();
3337 3337
(...skipping 13 matching lines...) Expand all
3351 case kUnboxedInt32x4: 3351 case kUnboxedInt32x4:
3352 __ movups(FieldAddress(out_reg, ValueOffset()), value); 3352 __ movups(FieldAddress(out_reg, ValueOffset()), value);
3353 break; 3353 break;
3354 default: 3354 default:
3355 UNREACHABLE(); 3355 UNREACHABLE();
3356 break; 3356 break;
3357 } 3357 }
3358 } 3358 }
3359 3359
3360 3360
3361 LocationSummary* UnboxInstr::MakeLocationSummary(Isolate* isolate, 3361 LocationSummary* UnboxInstr::MakeLocationSummary(Zone* zone,
3362 bool opt) const { 3362 bool opt) const {
3363 const bool needs_temp = CanDeoptimize() || 3363 const bool needs_temp = CanDeoptimize() ||
3364 (CanConvertSmi() && (value()->Type()->ToCid() == kSmiCid)); 3364 (CanConvertSmi() && (value()->Type()->ToCid() == kSmiCid));
3365 3365
3366 const intptr_t kNumInputs = 1; 3366 const intptr_t kNumInputs = 1;
3367 const intptr_t kNumTemps = needs_temp ? 1 : 0; 3367 const intptr_t kNumTemps = needs_temp ? 1 : 0;
3368 LocationSummary* summary = new(isolate) LocationSummary( 3368 LocationSummary* summary = new(zone) LocationSummary(
3369 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3369 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3370 summary->set_in(0, Location::RequiresRegister()); 3370 summary->set_in(0, Location::RequiresRegister());
3371 if (needs_temp) { 3371 if (needs_temp) {
3372 summary->set_temp(0, Location::RequiresRegister()); 3372 summary->set_temp(0, Location::RequiresRegister());
3373 } 3373 }
3374 if (representation() == kUnboxedMint) { 3374 if (representation() == kUnboxedMint) {
3375 summary->set_out(0, Location::Pair(Location::RegisterLocation(EAX), 3375 summary->set_out(0, Location::Pair(Location::RegisterLocation(EAX),
3376 Location::RegisterLocation(EDX))); 3376 Location::RegisterLocation(EDX)));
3377 } else { 3377 } else {
3378 summary->set_out(0, Location::RequiresFpuRegister()); 3378 summary->set_out(0, Location::RequiresFpuRegister());
3379 } 3379 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
3478 Label done; 3478 Label done;
3479 __ jmp(&done); 3479 __ jmp(&done);
3480 __ Bind(&is_smi); 3480 __ Bind(&is_smi);
3481 EmitSmiConversion(compiler); 3481 EmitSmiConversion(compiler);
3482 __ Bind(&done); 3482 __ Bind(&done);
3483 } 3483 }
3484 } 3484 }
3485 } 3485 }
3486 3486
3487 3487
3488 LocationSummary* BoxInteger32Instr::MakeLocationSummary(Isolate* isolate, 3488 LocationSummary* BoxInteger32Instr::MakeLocationSummary(Zone* zone,
3489 bool opt) const { 3489 bool opt) const {
3490 const intptr_t kNumInputs = 1; 3490 const intptr_t kNumInputs = 1;
3491 const intptr_t kNumTemps = 0; 3491 const intptr_t kNumTemps = 0;
3492 LocationSummary* summary = new(isolate) LocationSummary( 3492 LocationSummary* summary = new(zone) LocationSummary(
3493 isolate, kNumInputs, kNumTemps, 3493 zone, kNumInputs, kNumTemps,
3494 ValueFitsSmi() ? LocationSummary::kNoCall 3494 ValueFitsSmi() ? LocationSummary::kNoCall
3495 : LocationSummary::kCallOnSlowPath); 3495 : LocationSummary::kCallOnSlowPath);
3496 const bool needs_writable_input = ValueFitsSmi() || 3496 const bool needs_writable_input = ValueFitsSmi() ||
3497 (from_representation() == kUnboxedUint32); 3497 (from_representation() == kUnboxedUint32);
3498 summary->set_in(0, needs_writable_input ? Location::RequiresRegister() 3498 summary->set_in(0, needs_writable_input ? Location::RequiresRegister()
3499 : Location::WritableRegister()); 3499 : Location::WritableRegister());
3500 summary->set_out(0, ValueFitsSmi() ? Location::SameAsFirstInput() 3500 summary->set_out(0, ValueFitsSmi() ? Location::SameAsFirstInput()
3501 : Location::RequiresRegister()); 3501 : Location::RequiresRegister());
3502 return summary; 3502 return summary;
3503 } 3503 }
(...skipping 27 matching lines...) Expand all
3531 __ movl(FieldAddress(out, Mint::value_offset() + kWordSize), value); 3531 __ movl(FieldAddress(out, Mint::value_offset() + kWordSize), value);
3532 } else { 3532 } else {
3533 __ movl(FieldAddress(out, Mint::value_offset() + kWordSize), 3533 __ movl(FieldAddress(out, Mint::value_offset() + kWordSize),
3534 Immediate(0)); 3534 Immediate(0));
3535 } 3535 }
3536 __ Bind(&done); 3536 __ Bind(&done);
3537 } 3537 }
3538 } 3538 }
3539 3539
3540 3540
3541 LocationSummary* BoxInt64Instr::MakeLocationSummary(Isolate* isolate, 3541 LocationSummary* BoxInt64Instr::MakeLocationSummary(Zone* zone,
3542 bool opt) const { 3542 bool opt) const {
3543 const intptr_t kNumInputs = 1; 3543 const intptr_t kNumInputs = 1;
3544 const intptr_t kNumTemps = ValueFitsSmi() ? 0 : 1; 3544 const intptr_t kNumTemps = ValueFitsSmi() ? 0 : 1;
3545 LocationSummary* summary = new(isolate) LocationSummary( 3545 LocationSummary* summary = new(zone) LocationSummary(
3546 isolate, kNumInputs, 3546 zone, kNumInputs,
3547 kNumTemps, 3547 kNumTemps,
3548 ValueFitsSmi() 3548 ValueFitsSmi()
3549 ? LocationSummary::kNoCall 3549 ? LocationSummary::kNoCall
3550 : LocationSummary::kCallOnSlowPath); 3550 : LocationSummary::kCallOnSlowPath);
3551 summary->set_in(0, Location::Pair(Location::RequiresRegister(), 3551 summary->set_in(0, Location::Pair(Location::RequiresRegister(),
3552 Location::RequiresRegister())); 3552 Location::RequiresRegister()));
3553 if (!ValueFitsSmi()) { 3553 if (!ValueFitsSmi()) {
3554 summary->set_temp(0, Location::RequiresRegister()); 3554 summary->set_temp(0, Location::RequiresRegister());
3555 } 3555 }
3556 summary->set_out(0, Location::RequiresRegister()); 3556 summary->set_out(0, Location::RequiresRegister());
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
3599 __ subl(value_lo, Immediate(0x40000000)); 3599 __ subl(value_lo, Immediate(0x40000000));
3600 3600
3601 BoxAllocationSlowPath::Allocate( 3601 BoxAllocationSlowPath::Allocate(
3602 compiler, this, compiler->mint_class(), out_reg, kNoRegister); 3602 compiler, this, compiler->mint_class(), out_reg, kNoRegister);
3603 __ movl(FieldAddress(out_reg, Mint::value_offset()), value_lo); 3603 __ movl(FieldAddress(out_reg, Mint::value_offset()), value_lo);
3604 __ movl(FieldAddress(out_reg, Mint::value_offset() + kWordSize), value_hi); 3604 __ movl(FieldAddress(out_reg, Mint::value_offset() + kWordSize), value_hi);
3605 __ Bind(&done); 3605 __ Bind(&done);
3606 } 3606 }
3607 3607
3608 3608
3609 LocationSummary* UnboxInteger32Instr::MakeLocationSummary(Isolate* isolate, 3609 LocationSummary* UnboxInteger32Instr::MakeLocationSummary(Zone* zone,
3610 bool opt) const { 3610 bool opt) const {
3611 const intptr_t value_cid = value()->Type()->ToCid(); 3611 const intptr_t value_cid = value()->Type()->ToCid();
3612 const intptr_t kNumInputs = 1; 3612 const intptr_t kNumInputs = 1;
3613 intptr_t kNumTemps = 0; 3613 intptr_t kNumTemps = 0;
3614 3614
3615 if (CanDeoptimize()) { 3615 if (CanDeoptimize()) {
3616 if ((value_cid != kSmiCid) && 3616 if ((value_cid != kSmiCid) &&
3617 (value_cid != kMintCid) && 3617 (value_cid != kMintCid) &&
3618 !is_truncating()) { 3618 !is_truncating()) {
3619 kNumTemps = 2; 3619 kNumTemps = 2;
3620 } else { 3620 } else {
3621 kNumTemps = 1; 3621 kNumTemps = 1;
3622 } 3622 }
3623 } 3623 }
3624 3624
3625 LocationSummary* summary = new(isolate) LocationSummary( 3625 LocationSummary* summary = new(zone) LocationSummary(
3626 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3626 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3627 summary->set_in(0, Location::RequiresRegister()); 3627 summary->set_in(0, Location::RequiresRegister());
3628 for (int i = 0; i < kNumTemps; i++) { 3628 for (int i = 0; i < kNumTemps; i++) {
3629 summary->set_temp(i, Location::RequiresRegister()); 3629 summary->set_temp(i, Location::RequiresRegister());
3630 } 3630 }
3631 summary->set_out(0, ((value_cid == kSmiCid) || (value_cid != kMintCid)) ? 3631 summary->set_out(0, ((value_cid == kSmiCid) || (value_cid != kMintCid)) ?
3632 Location::SameAsFirstInput() : Location::RequiresRegister()); 3632 Location::SameAsFirstInput() : Location::RequiresRegister());
3633 return summary; 3633 return summary;
3634 } 3634 }
3635 3635
3636 3636
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
3695 result, 3695 result,
3696 Address(value, TIMES_2, lo_offset), 3696 Address(value, TIMES_2, lo_offset),
3697 Address(value, TIMES_2, hi_offset), 3697 Address(value, TIMES_2, hi_offset),
3698 temp, 3698 temp,
3699 out_of_range); 3699 out_of_range);
3700 __ Bind(&done); 3700 __ Bind(&done);
3701 } 3701 }
3702 } 3702 }
3703 3703
3704 3704
3705 LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Isolate* isolate, 3705 LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Zone* zone,
3706 bool opt) const { 3706 bool opt) const {
3707 const bool might_box = (representation() == kTagged) && !can_pack_into_smi(); 3707 const bool might_box = (representation() == kTagged) && !can_pack_into_smi();
3708 const intptr_t kNumInputs = 2; 3708 const intptr_t kNumInputs = 2;
3709 const intptr_t kNumTemps = might_box ? 1 : 0; 3709 const intptr_t kNumTemps = might_box ? 1 : 0;
3710 LocationSummary* summary = new(isolate) LocationSummary( 3710 LocationSummary* summary = new(zone) LocationSummary(
3711 isolate, kNumInputs, kNumTemps, 3711 zone, kNumInputs, kNumTemps,
3712 might_box ? LocationSummary::kCallOnSlowPath : LocationSummary::kNoCall); 3712 might_box ? LocationSummary::kCallOnSlowPath : LocationSummary::kNoCall);
3713 summary->set_in(0, Location::RequiresRegister()); 3713 summary->set_in(0, Location::RequiresRegister());
3714 // The smi index is either untagged (element size == 1), or it is left smi 3714 // The smi index is either untagged (element size == 1), or it is left smi
3715 // tagged (for all element sizes > 1). 3715 // tagged (for all element sizes > 1).
3716 summary->set_in(1, (index_scale() == 1) ? Location::WritableRegister() 3716 summary->set_in(1, (index_scale() == 1) ? Location::WritableRegister()
3717 : Location::RequiresRegister()); 3717 : Location::RequiresRegister());
3718 if (might_box) { 3718 if (might_box) {
3719 summary->set_temp(0, Location::RequiresRegister()); 3719 summary->set_temp(0, Location::RequiresRegister());
3720 } 3720 }
3721 3721
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
3810 compiler, this, compiler->mint_class(), result, kNoRegister); 3810 compiler, this, compiler->mint_class(), result, kNoRegister);
3811 __ movl(FieldAddress(result, Mint::value_offset()), temp); 3811 __ movl(FieldAddress(result, Mint::value_offset()), temp);
3812 __ movl(FieldAddress(result, Mint::value_offset() + kWordSize), 3812 __ movl(FieldAddress(result, Mint::value_offset() + kWordSize),
3813 Immediate(0)); 3813 Immediate(0));
3814 __ Bind(&done); 3814 __ Bind(&done);
3815 } 3815 }
3816 } 3816 }
3817 } 3817 }
3818 3818
3819 3819
3820 LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary(Isolate* isolate, 3820 LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary(Zone* zone,
3821 bool opt) const { 3821 bool opt) const {
3822 const intptr_t kNumInputs = 2; 3822 const intptr_t kNumInputs = 2;
3823 const intptr_t kNumTemps = 0; 3823 const intptr_t kNumTemps = 0;
3824 LocationSummary* summary = new(isolate) LocationSummary( 3824 LocationSummary* summary = new(zone) LocationSummary(
3825 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3825 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3826 summary->set_in(0, Location::RequiresFpuRegister()); 3826 summary->set_in(0, Location::RequiresFpuRegister());
3827 summary->set_in(1, Location::RequiresFpuRegister()); 3827 summary->set_in(1, Location::RequiresFpuRegister());
3828 summary->set_out(0, Location::SameAsFirstInput()); 3828 summary->set_out(0, Location::SameAsFirstInput());
3829 return summary; 3829 return summary;
3830 } 3830 }
3831 3831
3832 3832
3833 void BinaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3833 void BinaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3834 XmmRegister left = locs()->in(0).fpu_reg(); 3834 XmmRegister left = locs()->in(0).fpu_reg();
3835 XmmRegister right = locs()->in(1).fpu_reg(); 3835 XmmRegister right = locs()->in(1).fpu_reg();
3836 3836
3837 ASSERT(locs()->out(0).fpu_reg() == left); 3837 ASSERT(locs()->out(0).fpu_reg() == left);
3838 3838
3839 switch (op_kind()) { 3839 switch (op_kind()) {
3840 case Token::kADD: __ addsd(left, right); break; 3840 case Token::kADD: __ addsd(left, right); break;
3841 case Token::kSUB: __ subsd(left, right); break; 3841 case Token::kSUB: __ subsd(left, right); break;
3842 case Token::kMUL: __ mulsd(left, right); break; 3842 case Token::kMUL: __ mulsd(left, right); break;
3843 case Token::kDIV: __ divsd(left, right); break; 3843 case Token::kDIV: __ divsd(left, right); break;
3844 default: UNREACHABLE(); 3844 default: UNREACHABLE();
3845 } 3845 }
3846 } 3846 }
3847 3847
3848 3848
3849 LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Isolate* isolate, 3849 LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone,
3850 bool opt) const { 3850 bool opt) const {
3851 const intptr_t kNumInputs = 2; 3851 const intptr_t kNumInputs = 2;
3852 const intptr_t kNumTemps = 0; 3852 const intptr_t kNumTemps = 0;
3853 LocationSummary* summary = new(isolate) LocationSummary( 3853 LocationSummary* summary = new(zone) LocationSummary(
3854 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3854 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3855 summary->set_in(0, Location::RequiresFpuRegister()); 3855 summary->set_in(0, Location::RequiresFpuRegister());
3856 summary->set_in(1, Location::RequiresFpuRegister()); 3856 summary->set_in(1, Location::RequiresFpuRegister());
3857 summary->set_out(0, Location::SameAsFirstInput()); 3857 summary->set_out(0, Location::SameAsFirstInput());
3858 return summary; 3858 return summary;
3859 } 3859 }
3860 3860
3861 3861
3862 void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3862 void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3863 XmmRegister left = locs()->in(0).fpu_reg(); 3863 XmmRegister left = locs()->in(0).fpu_reg();
3864 XmmRegister right = locs()->in(1).fpu_reg(); 3864 XmmRegister right = locs()->in(1).fpu_reg();
3865 3865
3866 ASSERT(locs()->out(0).fpu_reg() == left); 3866 ASSERT(locs()->out(0).fpu_reg() == left);
3867 3867
3868 switch (op_kind()) { 3868 switch (op_kind()) {
3869 case Token::kADD: __ addps(left, right); break; 3869 case Token::kADD: __ addps(left, right); break;
3870 case Token::kSUB: __ subps(left, right); break; 3870 case Token::kSUB: __ subps(left, right); break;
3871 case Token::kMUL: __ mulps(left, right); break; 3871 case Token::kMUL: __ mulps(left, right); break;
3872 case Token::kDIV: __ divps(left, right); break; 3872 case Token::kDIV: __ divps(left, right); break;
3873 default: UNREACHABLE(); 3873 default: UNREACHABLE();
3874 } 3874 }
3875 } 3875 }
3876 3876
3877 3877
3878 LocationSummary* BinaryFloat64x2OpInstr::MakeLocationSummary(Isolate* isolate, 3878 LocationSummary* BinaryFloat64x2OpInstr::MakeLocationSummary(Zone* zone,
3879 bool opt) const { 3879 bool opt) const {
3880 const intptr_t kNumInputs = 2; 3880 const intptr_t kNumInputs = 2;
3881 const intptr_t kNumTemps = 0; 3881 const intptr_t kNumTemps = 0;
3882 LocationSummary* summary = new(isolate) LocationSummary( 3882 LocationSummary* summary = new(zone) LocationSummary(
3883 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3883 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3884 summary->set_in(0, Location::RequiresFpuRegister()); 3884 summary->set_in(0, Location::RequiresFpuRegister());
3885 summary->set_in(1, Location::RequiresFpuRegister()); 3885 summary->set_in(1, Location::RequiresFpuRegister());
3886 summary->set_out(0, Location::SameAsFirstInput()); 3886 summary->set_out(0, Location::SameAsFirstInput());
3887 return summary; 3887 return summary;
3888 } 3888 }
3889 3889
3890 3890
3891 void BinaryFloat64x2OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3891 void BinaryFloat64x2OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3892 XmmRegister left = locs()->in(0).fpu_reg(); 3892 XmmRegister left = locs()->in(0).fpu_reg();
3893 XmmRegister right = locs()->in(1).fpu_reg(); 3893 XmmRegister right = locs()->in(1).fpu_reg();
3894 3894
3895 ASSERT(locs()->out(0).fpu_reg() == left); 3895 ASSERT(locs()->out(0).fpu_reg() == left);
3896 3896
3897 switch (op_kind()) { 3897 switch (op_kind()) {
3898 case Token::kADD: __ addpd(left, right); break; 3898 case Token::kADD: __ addpd(left, right); break;
3899 case Token::kSUB: __ subpd(left, right); break; 3899 case Token::kSUB: __ subpd(left, right); break;
3900 case Token::kMUL: __ mulpd(left, right); break; 3900 case Token::kMUL: __ mulpd(left, right); break;
3901 case Token::kDIV: __ divpd(left, right); break; 3901 case Token::kDIV: __ divpd(left, right); break;
3902 default: UNREACHABLE(); 3902 default: UNREACHABLE();
3903 } 3903 }
3904 } 3904 }
3905 3905
3906 3906
3907 LocationSummary* Simd32x4ShuffleInstr::MakeLocationSummary(Isolate* isolate, 3907 LocationSummary* Simd32x4ShuffleInstr::MakeLocationSummary(Zone* zone,
3908 bool opt) const { 3908 bool opt) const {
3909 const intptr_t kNumInputs = 1; 3909 const intptr_t kNumInputs = 1;
3910 const intptr_t kNumTemps = 0; 3910 const intptr_t kNumTemps = 0;
3911 LocationSummary* summary = new(isolate) LocationSummary( 3911 LocationSummary* summary = new(zone) LocationSummary(
3912 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3912 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3913 summary->set_in(0, Location::RequiresFpuRegister()); 3913 summary->set_in(0, Location::RequiresFpuRegister());
3914 summary->set_out(0, Location::SameAsFirstInput()); 3914 summary->set_out(0, Location::SameAsFirstInput());
3915 return summary; 3915 return summary;
3916 } 3916 }
3917 3917
3918 3918
3919 void Simd32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3919 void Simd32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3920 XmmRegister value = locs()->in(0).fpu_reg(); 3920 XmmRegister value = locs()->in(0).fpu_reg();
3921 3921
3922 ASSERT(locs()->out(0).fpu_reg() == value); 3922 ASSERT(locs()->out(0).fpu_reg() == value);
(...skipping 17 matching lines...) Expand all
3940 break; 3940 break;
3941 case MethodRecognizer::kFloat32x4Shuffle: 3941 case MethodRecognizer::kFloat32x4Shuffle:
3942 case MethodRecognizer::kInt32x4Shuffle: 3942 case MethodRecognizer::kInt32x4Shuffle:
3943 __ shufps(value, value, Immediate(mask_)); 3943 __ shufps(value, value, Immediate(mask_));
3944 break; 3944 break;
3945 default: UNREACHABLE(); 3945 default: UNREACHABLE();
3946 } 3946 }
3947 } 3947 }
3948 3948
3949 3949
3950 LocationSummary* Simd32x4ShuffleMixInstr::MakeLocationSummary(Isolate* isolate, 3950 LocationSummary* Simd32x4ShuffleMixInstr::MakeLocationSummary(Zone* zone,
3951 bool opt) const { 3951 bool opt) const {
3952 const intptr_t kNumInputs = 2; 3952 const intptr_t kNumInputs = 2;
3953 const intptr_t kNumTemps = 0; 3953 const intptr_t kNumTemps = 0;
3954 LocationSummary* summary = new(isolate) LocationSummary( 3954 LocationSummary* summary = new(zone) LocationSummary(
3955 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3955 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3956 summary->set_in(0, Location::RequiresFpuRegister()); 3956 summary->set_in(0, Location::RequiresFpuRegister());
3957 summary->set_in(1, Location::RequiresFpuRegister()); 3957 summary->set_in(1, Location::RequiresFpuRegister());
3958 summary->set_out(0, Location::SameAsFirstInput()); 3958 summary->set_out(0, Location::SameAsFirstInput());
3959 return summary; 3959 return summary;
3960 } 3960 }
3961 3961
3962 3962
3963 void Simd32x4ShuffleMixInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3963 void Simd32x4ShuffleMixInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3964 XmmRegister left = locs()->in(0).fpu_reg(); 3964 XmmRegister left = locs()->in(0).fpu_reg();
3965 XmmRegister right = locs()->in(1).fpu_reg(); 3965 XmmRegister right = locs()->in(1).fpu_reg();
3966 3966
3967 ASSERT(locs()->out(0).fpu_reg() == left); 3967 ASSERT(locs()->out(0).fpu_reg() == left);
3968 switch (op_kind()) { 3968 switch (op_kind()) {
3969 case MethodRecognizer::kFloat32x4ShuffleMix: 3969 case MethodRecognizer::kFloat32x4ShuffleMix:
3970 case MethodRecognizer::kInt32x4ShuffleMix: 3970 case MethodRecognizer::kInt32x4ShuffleMix:
3971 __ shufps(left, right, Immediate(mask_)); 3971 __ shufps(left, right, Immediate(mask_));
3972 break; 3972 break;
3973 default: UNREACHABLE(); 3973 default: UNREACHABLE();
3974 } 3974 }
3975 } 3975 }
3976 3976
3977 3977
3978 LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary(Isolate* isolate, 3978 LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary(Zone* zone,
3979 bool opt) const { 3979 bool opt) const {
3980 const intptr_t kNumInputs = 1; 3980 const intptr_t kNumInputs = 1;
3981 const intptr_t kNumTemps = 0; 3981 const intptr_t kNumTemps = 0;
3982 LocationSummary* summary = new(isolate) LocationSummary( 3982 LocationSummary* summary = new(zone) LocationSummary(
3983 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3983 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3984 summary->set_in(0, Location::RequiresFpuRegister()); 3984 summary->set_in(0, Location::RequiresFpuRegister());
3985 summary->set_out(0, Location::RequiresRegister()); 3985 summary->set_out(0, Location::RequiresRegister());
3986 return summary; 3986 return summary;
3987 } 3987 }
3988 3988
3989 3989
3990 void Simd32x4GetSignMaskInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3990 void Simd32x4GetSignMaskInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3991 XmmRegister value = locs()->in(0).fpu_reg(); 3991 XmmRegister value = locs()->in(0).fpu_reg();
3992 Register out = locs()->out(0).reg(); 3992 Register out = locs()->out(0).reg();
3993 3993
3994 __ movmskps(out, value); 3994 __ movmskps(out, value);
3995 __ SmiTag(out); 3995 __ SmiTag(out);
3996 } 3996 }
3997 3997
3998 3998
3999 LocationSummary* Float32x4ConstructorInstr::MakeLocationSummary( 3999 LocationSummary* Float32x4ConstructorInstr::MakeLocationSummary(
4000 Isolate* isolate, bool opt) const { 4000 Zone* zone, bool opt) const {
4001 const intptr_t kNumInputs = 4; 4001 const intptr_t kNumInputs = 4;
4002 const intptr_t kNumTemps = 0; 4002 const intptr_t kNumTemps = 0;
4003 LocationSummary* summary = new(isolate) LocationSummary( 4003 LocationSummary* summary = new(zone) LocationSummary(
4004 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4004 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4005 summary->set_in(0, Location::RequiresFpuRegister()); 4005 summary->set_in(0, Location::RequiresFpuRegister());
4006 summary->set_in(1, Location::RequiresFpuRegister()); 4006 summary->set_in(1, Location::RequiresFpuRegister());
4007 summary->set_in(2, Location::RequiresFpuRegister()); 4007 summary->set_in(2, Location::RequiresFpuRegister());
4008 summary->set_in(3, Location::RequiresFpuRegister()); 4008 summary->set_in(3, Location::RequiresFpuRegister());
4009 summary->set_out(0, Location::SameAsFirstInput()); 4009 summary->set_out(0, Location::SameAsFirstInput());
4010 return summary; 4010 return summary;
4011 } 4011 }
4012 4012
4013 4013
4014 void Float32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4014 void Float32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
(...skipping 12 matching lines...) Expand all
4027 __ cvtsd2ss(v0, v0); 4027 __ cvtsd2ss(v0, v0);
4028 __ movss(Address(ESP, 8), v0); 4028 __ movss(Address(ESP, 8), v0);
4029 __ movsd(v0, v3); 4029 __ movsd(v0, v3);
4030 __ cvtsd2ss(v0, v0); 4030 __ cvtsd2ss(v0, v0);
4031 __ movss(Address(ESP, 12), v0); 4031 __ movss(Address(ESP, 12), v0);
4032 __ movups(v0, Address(ESP, 0)); 4032 __ movups(v0, Address(ESP, 0));
4033 __ addl(ESP, Immediate(16)); 4033 __ addl(ESP, Immediate(16));
4034 } 4034 }
4035 4035
4036 4036
4037 LocationSummary* Float32x4ZeroInstr::MakeLocationSummary(Isolate* isolate, 4037 LocationSummary* Float32x4ZeroInstr::MakeLocationSummary(Zone* zone,
4038 bool opt) const { 4038 bool opt) const {
4039 const intptr_t kNumInputs = 0; 4039 const intptr_t kNumInputs = 0;
4040 const intptr_t kNumTemps = 0; 4040 const intptr_t kNumTemps = 0;
4041 LocationSummary* summary = new(isolate) LocationSummary( 4041 LocationSummary* summary = new(zone) LocationSummary(
4042 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4042 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4043 summary->set_out(0, Location::RequiresFpuRegister()); 4043 summary->set_out(0, Location::RequiresFpuRegister());
4044 return summary; 4044 return summary;
4045 } 4045 }
4046 4046
4047 4047
4048 void Float32x4ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4048 void Float32x4ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4049 XmmRegister value = locs()->out(0).fpu_reg(); 4049 XmmRegister value = locs()->out(0).fpu_reg();
4050 __ xorps(value, value); 4050 __ xorps(value, value);
4051 } 4051 }
4052 4052
4053 4053
4054 LocationSummary* Float32x4SplatInstr::MakeLocationSummary(Isolate* isolate, 4054 LocationSummary* Float32x4SplatInstr::MakeLocationSummary(Zone* zone,
4055 bool opt) const { 4055 bool opt) const {
4056 const intptr_t kNumInputs = 1; 4056 const intptr_t kNumInputs = 1;
4057 const intptr_t kNumTemps = 0; 4057 const intptr_t kNumTemps = 0;
4058 LocationSummary* summary = new(isolate) LocationSummary( 4058 LocationSummary* summary = new(zone) LocationSummary(
4059 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4059 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4060 summary->set_in(0, Location::RequiresFpuRegister()); 4060 summary->set_in(0, Location::RequiresFpuRegister());
4061 summary->set_out(0, Location::SameAsFirstInput()); 4061 summary->set_out(0, Location::SameAsFirstInput());
4062 return summary; 4062 return summary;
4063 } 4063 }
4064 4064
4065 4065
4066 void Float32x4SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4066 void Float32x4SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4067 XmmRegister value = locs()->out(0).fpu_reg(); 4067 XmmRegister value = locs()->out(0).fpu_reg();
4068 ASSERT(locs()->in(0).fpu_reg() == locs()->out(0).fpu_reg()); 4068 ASSERT(locs()->in(0).fpu_reg() == locs()->out(0).fpu_reg());
4069 // Convert to Float32. 4069 // Convert to Float32.
4070 __ cvtsd2ss(value, value); 4070 __ cvtsd2ss(value, value);
4071 // Splat across all lanes. 4071 // Splat across all lanes.
4072 __ shufps(value, value, Immediate(0x00)); 4072 __ shufps(value, value, Immediate(0x00));
4073 } 4073 }
4074 4074
4075 4075
4076 LocationSummary* Float32x4ComparisonInstr::MakeLocationSummary(Isolate* isolate, 4076 LocationSummary* Float32x4ComparisonInstr::MakeLocationSummary(Zone* zone,
4077 bool opt) const { 4077 bool opt) const {
4078 const intptr_t kNumInputs = 2; 4078 const intptr_t kNumInputs = 2;
4079 const intptr_t kNumTemps = 0; 4079 const intptr_t kNumTemps = 0;
4080 LocationSummary* summary = new(isolate) LocationSummary( 4080 LocationSummary* summary = new(zone) LocationSummary(
4081 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4081 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4082 summary->set_in(0, Location::RequiresFpuRegister()); 4082 summary->set_in(0, Location::RequiresFpuRegister());
4083 summary->set_in(1, Location::RequiresFpuRegister()); 4083 summary->set_in(1, Location::RequiresFpuRegister());
4084 summary->set_out(0, Location::SameAsFirstInput()); 4084 summary->set_out(0, Location::SameAsFirstInput());
4085 return summary; 4085 return summary;
4086 } 4086 }
4087 4087
4088 4088
4089 void Float32x4ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4089 void Float32x4ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4090 XmmRegister left = locs()->in(0).fpu_reg(); 4090 XmmRegister left = locs()->in(0).fpu_reg();
4091 XmmRegister right = locs()->in(1).fpu_reg(); 4091 XmmRegister right = locs()->in(1).fpu_reg();
(...skipping 18 matching lines...) Expand all
4110 break; 4110 break;
4111 case MethodRecognizer::kFloat32x4LessThanOrEqual: 4111 case MethodRecognizer::kFloat32x4LessThanOrEqual:
4112 __ cmppsle(left, right); 4112 __ cmppsle(left, right);
4113 break; 4113 break;
4114 4114
4115 default: UNREACHABLE(); 4115 default: UNREACHABLE();
4116 } 4116 }
4117 } 4117 }
4118 4118
4119 4119
4120 LocationSummary* Float32x4MinMaxInstr::MakeLocationSummary(Isolate* isolate, 4120 LocationSummary* Float32x4MinMaxInstr::MakeLocationSummary(Zone* zone,
4121 bool opt) const { 4121 bool opt) const {
4122 const intptr_t kNumInputs = 2; 4122 const intptr_t kNumInputs = 2;
4123 const intptr_t kNumTemps = 0; 4123 const intptr_t kNumTemps = 0;
4124 LocationSummary* summary = new(isolate) LocationSummary( 4124 LocationSummary* summary = new(zone) LocationSummary(
4125 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4125 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4126 summary->set_in(0, Location::RequiresFpuRegister()); 4126 summary->set_in(0, Location::RequiresFpuRegister());
4127 summary->set_in(1, Location::RequiresFpuRegister()); 4127 summary->set_in(1, Location::RequiresFpuRegister());
4128 summary->set_out(0, Location::SameAsFirstInput()); 4128 summary->set_out(0, Location::SameAsFirstInput());
4129 return summary; 4129 return summary;
4130 } 4130 }
4131 4131
4132 4132
4133 void Float32x4MinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4133 void Float32x4MinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4134 XmmRegister left = locs()->in(0).fpu_reg(); 4134 XmmRegister left = locs()->in(0).fpu_reg();
4135 XmmRegister right = locs()->in(1).fpu_reg(); 4135 XmmRegister right = locs()->in(1).fpu_reg();
4136 4136
4137 ASSERT(locs()->out(0).fpu_reg() == left); 4137 ASSERT(locs()->out(0).fpu_reg() == left);
4138 4138
4139 switch (op_kind()) { 4139 switch (op_kind()) {
4140 case MethodRecognizer::kFloat32x4Min: 4140 case MethodRecognizer::kFloat32x4Min:
4141 __ minps(left, right); 4141 __ minps(left, right);
4142 break; 4142 break;
4143 case MethodRecognizer::kFloat32x4Max: 4143 case MethodRecognizer::kFloat32x4Max:
4144 __ maxps(left, right); 4144 __ maxps(left, right);
4145 break; 4145 break;
4146 default: UNREACHABLE(); 4146 default: UNREACHABLE();
4147 } 4147 }
4148 } 4148 }
4149 4149
4150 4150
4151 LocationSummary* Float32x4ScaleInstr::MakeLocationSummary(Isolate* isolate, 4151 LocationSummary* Float32x4ScaleInstr::MakeLocationSummary(Zone* zone,
4152 bool opt) const { 4152 bool opt) const {
4153 const intptr_t kNumInputs = 2; 4153 const intptr_t kNumInputs = 2;
4154 const intptr_t kNumTemps = 0; 4154 const intptr_t kNumTemps = 0;
4155 LocationSummary* summary = new(isolate) LocationSummary( 4155 LocationSummary* summary = new(zone) LocationSummary(
4156 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4156 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4157 summary->set_in(0, Location::RequiresFpuRegister()); 4157 summary->set_in(0, Location::RequiresFpuRegister());
4158 summary->set_in(1, Location::RequiresFpuRegister()); 4158 summary->set_in(1, Location::RequiresFpuRegister());
4159 summary->set_out(0, Location::SameAsFirstInput()); 4159 summary->set_out(0, Location::SameAsFirstInput());
4160 return summary; 4160 return summary;
4161 } 4161 }
4162 4162
4163 4163
4164 void Float32x4ScaleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4164 void Float32x4ScaleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4165 XmmRegister left = locs()->in(0).fpu_reg(); 4165 XmmRegister left = locs()->in(0).fpu_reg();
4166 XmmRegister right = locs()->in(1).fpu_reg(); 4166 XmmRegister right = locs()->in(1).fpu_reg();
4167 4167
4168 ASSERT(locs()->out(0).fpu_reg() == left); 4168 ASSERT(locs()->out(0).fpu_reg() == left);
4169 4169
4170 switch (op_kind()) { 4170 switch (op_kind()) {
4171 case MethodRecognizer::kFloat32x4Scale: 4171 case MethodRecognizer::kFloat32x4Scale:
4172 __ cvtsd2ss(left, left); 4172 __ cvtsd2ss(left, left);
4173 __ shufps(left, left, Immediate(0x00)); 4173 __ shufps(left, left, Immediate(0x00));
4174 __ mulps(left, right); 4174 __ mulps(left, right);
4175 break; 4175 break;
4176 default: UNREACHABLE(); 4176 default: UNREACHABLE();
4177 } 4177 }
4178 } 4178 }
4179 4179
4180 4180
4181 LocationSummary* Float32x4SqrtInstr::MakeLocationSummary(Isolate* isolate, 4181 LocationSummary* Float32x4SqrtInstr::MakeLocationSummary(Zone* zone,
4182 bool opt) const { 4182 bool opt) const {
4183 const intptr_t kNumInputs = 1; 4183 const intptr_t kNumInputs = 1;
4184 const intptr_t kNumTemps = 0; 4184 const intptr_t kNumTemps = 0;
4185 LocationSummary* summary = new(isolate) LocationSummary( 4185 LocationSummary* summary = new(zone) LocationSummary(
4186 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4186 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4187 summary->set_in(0, Location::RequiresFpuRegister()); 4187 summary->set_in(0, Location::RequiresFpuRegister());
4188 summary->set_out(0, Location::SameAsFirstInput()); 4188 summary->set_out(0, Location::SameAsFirstInput());
4189 return summary; 4189 return summary;
4190 } 4190 }
4191 4191
4192 4192
4193 void Float32x4SqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4193 void Float32x4SqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4194 XmmRegister left = locs()->in(0).fpu_reg(); 4194 XmmRegister left = locs()->in(0).fpu_reg();
4195 4195
4196 ASSERT(locs()->out(0).fpu_reg() == left); 4196 ASSERT(locs()->out(0).fpu_reg() == left);
4197 4197
4198 switch (op_kind()) { 4198 switch (op_kind()) {
4199 case MethodRecognizer::kFloat32x4Sqrt: 4199 case MethodRecognizer::kFloat32x4Sqrt:
4200 __ sqrtps(left); 4200 __ sqrtps(left);
4201 break; 4201 break;
4202 case MethodRecognizer::kFloat32x4Reciprocal: 4202 case MethodRecognizer::kFloat32x4Reciprocal:
4203 __ reciprocalps(left); 4203 __ reciprocalps(left);
4204 break; 4204 break;
4205 case MethodRecognizer::kFloat32x4ReciprocalSqrt: 4205 case MethodRecognizer::kFloat32x4ReciprocalSqrt:
4206 __ rsqrtps(left); 4206 __ rsqrtps(left);
4207 break; 4207 break;
4208 default: UNREACHABLE(); 4208 default: UNREACHABLE();
4209 } 4209 }
4210 } 4210 }
4211 4211
4212 4212
4213 LocationSummary* Float32x4ZeroArgInstr::MakeLocationSummary(Isolate* isolate, 4213 LocationSummary* Float32x4ZeroArgInstr::MakeLocationSummary(Zone* zone,
4214 bool opt) const { 4214 bool opt) const {
4215 const intptr_t kNumInputs = 1; 4215 const intptr_t kNumInputs = 1;
4216 const intptr_t kNumTemps = 0; 4216 const intptr_t kNumTemps = 0;
4217 LocationSummary* summary = new(isolate) LocationSummary( 4217 LocationSummary* summary = new(zone) LocationSummary(
4218 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4218 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4219 summary->set_in(0, Location::RequiresFpuRegister()); 4219 summary->set_in(0, Location::RequiresFpuRegister());
4220 summary->set_out(0, Location::SameAsFirstInput()); 4220 summary->set_out(0, Location::SameAsFirstInput());
4221 return summary; 4221 return summary;
4222 } 4222 }
4223 4223
4224 4224
4225 void Float32x4ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4225 void Float32x4ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4226 XmmRegister left = locs()->in(0).fpu_reg(); 4226 XmmRegister left = locs()->in(0).fpu_reg();
4227 4227
4228 ASSERT(locs()->out(0).fpu_reg() == left); 4228 ASSERT(locs()->out(0).fpu_reg() == left);
4229 switch (op_kind()) { 4229 switch (op_kind()) {
4230 case MethodRecognizer::kFloat32x4Negate: 4230 case MethodRecognizer::kFloat32x4Negate:
4231 __ negateps(left); 4231 __ negateps(left);
4232 break; 4232 break;
4233 case MethodRecognizer::kFloat32x4Absolute: 4233 case MethodRecognizer::kFloat32x4Absolute:
4234 __ absps(left); 4234 __ absps(left);
4235 break; 4235 break;
4236 default: UNREACHABLE(); 4236 default: UNREACHABLE();
4237 } 4237 }
4238 } 4238 }
4239 4239
4240 4240
4241 LocationSummary* Float32x4ClampInstr::MakeLocationSummary(Isolate* isolate, 4241 LocationSummary* Float32x4ClampInstr::MakeLocationSummary(Zone* zone,
4242 bool opt) const { 4242 bool opt) const {
4243 const intptr_t kNumInputs = 3; 4243 const intptr_t kNumInputs = 3;
4244 const intptr_t kNumTemps = 0; 4244 const intptr_t kNumTemps = 0;
4245 LocationSummary* summary = new(isolate) LocationSummary( 4245 LocationSummary* summary = new(zone) LocationSummary(
4246 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4246 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4247 summary->set_in(0, Location::RequiresFpuRegister()); 4247 summary->set_in(0, Location::RequiresFpuRegister());
4248 summary->set_in(1, Location::RequiresFpuRegister()); 4248 summary->set_in(1, Location::RequiresFpuRegister());
4249 summary->set_in(2, Location::RequiresFpuRegister()); 4249 summary->set_in(2, Location::RequiresFpuRegister());
4250 summary->set_out(0, Location::SameAsFirstInput()); 4250 summary->set_out(0, Location::SameAsFirstInput());
4251 return summary; 4251 return summary;
4252 } 4252 }
4253 4253
4254 4254
4255 void Float32x4ClampInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4255 void Float32x4ClampInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4256 XmmRegister left = locs()->in(0).fpu_reg(); 4256 XmmRegister left = locs()->in(0).fpu_reg();
4257 XmmRegister lower = locs()->in(1).fpu_reg(); 4257 XmmRegister lower = locs()->in(1).fpu_reg();
4258 XmmRegister upper = locs()->in(2).fpu_reg(); 4258 XmmRegister upper = locs()->in(2).fpu_reg();
4259 ASSERT(locs()->out(0).fpu_reg() == left); 4259 ASSERT(locs()->out(0).fpu_reg() == left);
4260 __ minps(left, upper); 4260 __ minps(left, upper);
4261 __ maxps(left, lower); 4261 __ maxps(left, lower);
4262 } 4262 }
4263 4263
4264 4264
4265 LocationSummary* Float32x4WithInstr::MakeLocationSummary(Isolate* isolate, 4265 LocationSummary* Float32x4WithInstr::MakeLocationSummary(Zone* zone,
4266 bool opt) const { 4266 bool opt) const {
4267 const intptr_t kNumInputs = 2; 4267 const intptr_t kNumInputs = 2;
4268 const intptr_t kNumTemps = 0; 4268 const intptr_t kNumTemps = 0;
4269 LocationSummary* summary = new(isolate) LocationSummary( 4269 LocationSummary* summary = new(zone) LocationSummary(
4270 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4270 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4271 summary->set_in(0, Location::RequiresFpuRegister()); 4271 summary->set_in(0, Location::RequiresFpuRegister());
4272 summary->set_in(1, Location::RequiresFpuRegister()); 4272 summary->set_in(1, Location::RequiresFpuRegister());
4273 summary->set_out(0, Location::SameAsFirstInput()); 4273 summary->set_out(0, Location::SameAsFirstInput());
4274 return summary; 4274 return summary;
4275 } 4275 }
4276 4276
4277 4277
4278 void Float32x4WithInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4278 void Float32x4WithInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4279 XmmRegister replacement = locs()->in(0).fpu_reg(); 4279 XmmRegister replacement = locs()->in(0).fpu_reg();
4280 XmmRegister value = locs()->in(1).fpu_reg(); 4280 XmmRegister value = locs()->in(1).fpu_reg();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
4324 __ movss(Address(ESP, 12), replacement); 4324 __ movss(Address(ESP, 12), replacement);
4325 // Move updated value into output register. 4325 // Move updated value into output register.
4326 __ movups(replacement, Address(ESP, 0)); 4326 __ movups(replacement, Address(ESP, 0));
4327 __ addl(ESP, Immediate(16)); 4327 __ addl(ESP, Immediate(16));
4328 break; 4328 break;
4329 default: UNREACHABLE(); 4329 default: UNREACHABLE();
4330 } 4330 }
4331 } 4331 }
4332 4332
4333 4333
4334 LocationSummary* Float32x4ToInt32x4Instr::MakeLocationSummary(Isolate* isolate, 4334 LocationSummary* Float32x4ToInt32x4Instr::MakeLocationSummary(Zone* zone,
4335 bool opt) const { 4335 bool opt) const {
4336 const intptr_t kNumInputs = 1; 4336 const intptr_t kNumInputs = 1;
4337 const intptr_t kNumTemps = 0; 4337 const intptr_t kNumTemps = 0;
4338 LocationSummary* summary = new(isolate) LocationSummary( 4338 LocationSummary* summary = new(zone) LocationSummary(
4339 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4339 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4340 summary->set_in(0, Location::RequiresFpuRegister()); 4340 summary->set_in(0, Location::RequiresFpuRegister());
4341 summary->set_out(0, Location::SameAsFirstInput()); 4341 summary->set_out(0, Location::SameAsFirstInput());
4342 return summary; 4342 return summary;
4343 } 4343 }
4344 4344
4345 4345
4346 void Float32x4ToInt32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 4346 void Float32x4ToInt32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
4347 // NOP. 4347 // NOP.
4348 } 4348 }
4349 4349
4350 4350
4351 LocationSummary* Simd64x2ShuffleInstr::MakeLocationSummary(Isolate* isolate, 4351 LocationSummary* Simd64x2ShuffleInstr::MakeLocationSummary(Zone* zone,
4352 bool opt) const { 4352 bool opt) const {
4353 const intptr_t kNumInputs = 1; 4353 const intptr_t kNumInputs = 1;
4354 const intptr_t kNumTemps = 0; 4354 const intptr_t kNumTemps = 0;
4355 LocationSummary* summary = new(isolate) LocationSummary( 4355 LocationSummary* summary = new(zone) LocationSummary(
4356 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4356 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4357 summary->set_in(0, Location::RequiresFpuRegister()); 4357 summary->set_in(0, Location::RequiresFpuRegister());
4358 summary->set_out(0, Location::SameAsFirstInput()); 4358 summary->set_out(0, Location::SameAsFirstInput());
4359 return summary; 4359 return summary;
4360 } 4360 }
4361 4361
4362 4362
4363 void Simd64x2ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4363 void Simd64x2ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4364 XmmRegister value = locs()->in(0).fpu_reg(); 4364 XmmRegister value = locs()->in(0).fpu_reg();
4365 4365
4366 ASSERT(locs()->out(0).fpu_reg() == value); 4366 ASSERT(locs()->out(0).fpu_reg() == value);
4367 4367
4368 switch (op_kind()) { 4368 switch (op_kind()) {
4369 case MethodRecognizer::kFloat64x2GetX: 4369 case MethodRecognizer::kFloat64x2GetX:
4370 // nop. 4370 // nop.
4371 break; 4371 break;
4372 case MethodRecognizer::kFloat64x2GetY: 4372 case MethodRecognizer::kFloat64x2GetY:
4373 __ shufpd(value, value, Immediate(0x33)); 4373 __ shufpd(value, value, Immediate(0x33));
4374 break; 4374 break;
4375 default: UNREACHABLE(); 4375 default: UNREACHABLE();
4376 } 4376 }
4377 } 4377 }
4378 4378
4379 4379
4380 4380
4381 LocationSummary* Float64x2ZeroInstr::MakeLocationSummary(Isolate* isolate, 4381 LocationSummary* Float64x2ZeroInstr::MakeLocationSummary(Zone* zone,
4382 bool opt) const { 4382 bool opt) const {
4383 const intptr_t kNumInputs = 0; 4383 const intptr_t kNumInputs = 0;
4384 const intptr_t kNumTemps = 0; 4384 const intptr_t kNumTemps = 0;
4385 LocationSummary* summary = new(isolate) LocationSummary( 4385 LocationSummary* summary = new(zone) LocationSummary(
4386 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4386 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4387 summary->set_out(0, Location::RequiresFpuRegister()); 4387 summary->set_out(0, Location::RequiresFpuRegister());
4388 return summary; 4388 return summary;
4389 } 4389 }
4390 4390
4391 4391
4392 void Float64x2ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4392 void Float64x2ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4393 XmmRegister value = locs()->out(0).fpu_reg(); 4393 XmmRegister value = locs()->out(0).fpu_reg();
4394 __ xorpd(value, value); 4394 __ xorpd(value, value);
4395 } 4395 }
4396 4396
4397 4397
4398 LocationSummary* Float64x2SplatInstr::MakeLocationSummary(Isolate* isolate, 4398 LocationSummary* Float64x2SplatInstr::MakeLocationSummary(Zone* zone,
4399 bool opt) const { 4399 bool opt) const {
4400 const intptr_t kNumInputs = 1; 4400 const intptr_t kNumInputs = 1;
4401 const intptr_t kNumTemps = 0; 4401 const intptr_t kNumTemps = 0;
4402 LocationSummary* summary = new(isolate) LocationSummary( 4402 LocationSummary* summary = new(zone) LocationSummary(
4403 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4403 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4404 summary->set_in(0, Location::RequiresFpuRegister()); 4404 summary->set_in(0, Location::RequiresFpuRegister());
4405 summary->set_out(0, Location::SameAsFirstInput()); 4405 summary->set_out(0, Location::SameAsFirstInput());
4406 return summary; 4406 return summary;
4407 } 4407 }
4408 4408
4409 4409
4410 void Float64x2SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4410 void Float64x2SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4411 XmmRegister value = locs()->out(0).fpu_reg(); 4411 XmmRegister value = locs()->out(0).fpu_reg();
4412 __ shufpd(value, value, Immediate(0x0)); 4412 __ shufpd(value, value, Immediate(0x0));
4413 } 4413 }
4414 4414
4415 4415
4416 LocationSummary* Float64x2ConstructorInstr::MakeLocationSummary( 4416 LocationSummary* Float64x2ConstructorInstr::MakeLocationSummary(
4417 Isolate* isolate, bool opt) const { 4417 Zone* zone, bool opt) const {
4418 const intptr_t kNumInputs = 2; 4418 const intptr_t kNumInputs = 2;
4419 const intptr_t kNumTemps = 0; 4419 const intptr_t kNumTemps = 0;
4420 LocationSummary* summary = new(isolate) LocationSummary( 4420 LocationSummary* summary = new(zone) LocationSummary(
4421 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4421 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4422 summary->set_in(0, Location::RequiresFpuRegister()); 4422 summary->set_in(0, Location::RequiresFpuRegister());
4423 summary->set_in(1, Location::RequiresFpuRegister()); 4423 summary->set_in(1, Location::RequiresFpuRegister());
4424 summary->set_out(0, Location::SameAsFirstInput()); 4424 summary->set_out(0, Location::SameAsFirstInput());
4425 return summary; 4425 return summary;
4426 } 4426 }
4427 4427
4428 4428
4429 void Float64x2ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4429 void Float64x2ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4430 XmmRegister v0 = locs()->in(0).fpu_reg(); 4430 XmmRegister v0 = locs()->in(0).fpu_reg();
4431 XmmRegister v1 = locs()->in(1).fpu_reg(); 4431 XmmRegister v1 = locs()->in(1).fpu_reg();
4432 ASSERT(v0 == locs()->out(0).fpu_reg()); 4432 ASSERT(v0 == locs()->out(0).fpu_reg());
4433 // shufpd mask 0x0 results in: 4433 // shufpd mask 0x0 results in:
4434 // Lower 64-bits of v0 = Lower 64-bits of v0. 4434 // Lower 64-bits of v0 = Lower 64-bits of v0.
4435 // Upper 64-bits of v0 = Lower 64-bits of v1. 4435 // Upper 64-bits of v0 = Lower 64-bits of v1.
4436 __ shufpd(v0, v1, Immediate(0x0)); 4436 __ shufpd(v0, v1, Immediate(0x0));
4437 } 4437 }
4438 4438
4439 4439
4440 LocationSummary* Float64x2ToFloat32x4Instr::MakeLocationSummary( 4440 LocationSummary* Float64x2ToFloat32x4Instr::MakeLocationSummary(
4441 Isolate* isolate, bool opt) const { 4441 Zone* zone, bool opt) const {
4442 const intptr_t kNumInputs = 1; 4442 const intptr_t kNumInputs = 1;
4443 const intptr_t kNumTemps = 0; 4443 const intptr_t kNumTemps = 0;
4444 LocationSummary* summary = new(isolate) LocationSummary( 4444 LocationSummary* summary = new(zone) LocationSummary(
4445 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4445 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4446 summary->set_in(0, Location::RequiresFpuRegister()); 4446 summary->set_in(0, Location::RequiresFpuRegister());
4447 summary->set_out(0, Location::SameAsFirstInput()); 4447 summary->set_out(0, Location::SameAsFirstInput());
4448 return summary; 4448 return summary;
4449 } 4449 }
4450 4450
4451 4451
4452 void Float64x2ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 4452 void Float64x2ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
4453 XmmRegister value = locs()->out(0).fpu_reg(); 4453 XmmRegister value = locs()->out(0).fpu_reg();
4454 __ cvtpd2ps(value, value); 4454 __ cvtpd2ps(value, value);
4455 } 4455 }
4456 4456
4457 4457
4458 LocationSummary* Float32x4ToFloat64x2Instr::MakeLocationSummary( 4458 LocationSummary* Float32x4ToFloat64x2Instr::MakeLocationSummary(
4459 Isolate* isolate, bool opt) const { 4459 Zone* zone, bool opt) const {
4460 const intptr_t kNumInputs = 1; 4460 const intptr_t kNumInputs = 1;
4461 const intptr_t kNumTemps = 0; 4461 const intptr_t kNumTemps = 0;
4462 LocationSummary* summary = new(isolate) LocationSummary( 4462 LocationSummary* summary = new(zone) LocationSummary(
4463 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4463 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4464 summary->set_in(0, Location::RequiresFpuRegister()); 4464 summary->set_in(0, Location::RequiresFpuRegister());
4465 summary->set_out(0, Location::SameAsFirstInput()); 4465 summary->set_out(0, Location::SameAsFirstInput());
4466 return summary; 4466 return summary;
4467 } 4467 }
4468 4468
4469 4469
4470 void Float32x4ToFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 4470 void Float32x4ToFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
4471 XmmRegister value = locs()->out(0).fpu_reg(); 4471 XmmRegister value = locs()->out(0).fpu_reg();
4472 __ cvtps2pd(value, value); 4472 __ cvtps2pd(value, value);
4473 } 4473 }
4474 4474
4475 4475
4476 LocationSummary* Float64x2ZeroArgInstr::MakeLocationSummary(Isolate* isolate, 4476 LocationSummary* Float64x2ZeroArgInstr::MakeLocationSummary(Zone* zone,
4477 bool opt) const { 4477 bool opt) const {
4478 const intptr_t kNumInputs = 1; 4478 const intptr_t kNumInputs = 1;
4479 const intptr_t kNumTemps = 0; 4479 const intptr_t kNumTemps = 0;
4480 LocationSummary* summary = new(isolate) LocationSummary( 4480 LocationSummary* summary = new(zone) LocationSummary(
4481 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4481 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4482 summary->set_in(0, Location::RequiresFpuRegister()); 4482 summary->set_in(0, Location::RequiresFpuRegister());
4483 if (representation() == kTagged) { 4483 if (representation() == kTagged) {
4484 ASSERT(op_kind() == MethodRecognizer::kFloat64x2GetSignMask); 4484 ASSERT(op_kind() == MethodRecognizer::kFloat64x2GetSignMask);
4485 summary->set_out(0, Location::RequiresRegister()); 4485 summary->set_out(0, Location::RequiresRegister());
4486 } else { 4486 } else {
4487 ASSERT(representation() == kUnboxedFloat64x2); 4487 ASSERT(representation() == kUnboxedFloat64x2);
4488 summary->set_out(0, Location::SameAsFirstInput()); 4488 summary->set_out(0, Location::SameAsFirstInput());
4489 } 4489 }
4490 return summary; 4490 return summary;
4491 } 4491 }
(...skipping 17 matching lines...) Expand all
4509 break; 4509 break;
4510 case MethodRecognizer::kFloat64x2GetSignMask: 4510 case MethodRecognizer::kFloat64x2GetSignMask:
4511 __ movmskpd(locs()->out(0).reg(), left); 4511 __ movmskpd(locs()->out(0).reg(), left);
4512 __ SmiTag(locs()->out(0).reg()); 4512 __ SmiTag(locs()->out(0).reg());
4513 break; 4513 break;
4514 default: UNREACHABLE(); 4514 default: UNREACHABLE();
4515 } 4515 }
4516 } 4516 }
4517 4517
4518 4518
4519 LocationSummary* Float64x2OneArgInstr::MakeLocationSummary(Isolate* isolate, 4519 LocationSummary* Float64x2OneArgInstr::MakeLocationSummary(Zone* zone,
4520 bool opt) const { 4520 bool opt) const {
4521 const intptr_t kNumInputs = 2; 4521 const intptr_t kNumInputs = 2;
4522 const intptr_t kNumTemps = 0; 4522 const intptr_t kNumTemps = 0;
4523 LocationSummary* summary = new(isolate) LocationSummary( 4523 LocationSummary* summary = new(zone) LocationSummary(
4524 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4524 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4525 summary->set_in(0, Location::RequiresFpuRegister()); 4525 summary->set_in(0, Location::RequiresFpuRegister());
4526 summary->set_in(1, Location::RequiresFpuRegister()); 4526 summary->set_in(1, Location::RequiresFpuRegister());
4527 summary->set_out(0, Location::SameAsFirstInput()); 4527 summary->set_out(0, Location::SameAsFirstInput());
4528 return summary; 4528 return summary;
4529 } 4529 }
4530 4530
4531 4531
4532 void Float64x2OneArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4532 void Float64x2OneArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4533 XmmRegister left = locs()->in(0).fpu_reg(); 4533 XmmRegister left = locs()->in(0).fpu_reg();
4534 XmmRegister right = locs()->in(1).fpu_reg(); 4534 XmmRegister right = locs()->in(1).fpu_reg();
(...skipping 29 matching lines...) Expand all
4564 break; 4564 break;
4565 case MethodRecognizer::kFloat64x2Max: 4565 case MethodRecognizer::kFloat64x2Max:
4566 __ maxpd(left, right); 4566 __ maxpd(left, right);
4567 break; 4567 break;
4568 default: UNREACHABLE(); 4568 default: UNREACHABLE();
4569 } 4569 }
4570 } 4570 }
4571 4571
4572 4572
4573 LocationSummary* Int32x4ConstructorInstr::MakeLocationSummary( 4573 LocationSummary* Int32x4ConstructorInstr::MakeLocationSummary(
4574 Isolate* isolate, bool opt) const { 4574 Zone* zone, bool opt) const {
4575 const intptr_t kNumInputs = 4; 4575 const intptr_t kNumInputs = 4;
4576 const intptr_t kNumTemps = 0; 4576 const intptr_t kNumTemps = 0;
4577 LocationSummary* summary = new(isolate) LocationSummary( 4577 LocationSummary* summary = new(zone) LocationSummary(
4578 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4578 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4579 summary->set_in(0, Location::RequiresRegister()); 4579 summary->set_in(0, Location::RequiresRegister());
4580 summary->set_in(1, Location::RequiresRegister()); 4580 summary->set_in(1, Location::RequiresRegister());
4581 summary->set_in(2, Location::RequiresRegister()); 4581 summary->set_in(2, Location::RequiresRegister());
4582 summary->set_in(3, Location::RequiresRegister()); 4582 summary->set_in(3, Location::RequiresRegister());
4583 summary->set_out(0, Location::RequiresFpuRegister()); 4583 summary->set_out(0, Location::RequiresFpuRegister());
4584 return summary; 4584 return summary;
4585 } 4585 }
4586 4586
4587 4587
4588 void Int32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4588 void Int32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4589 Register v0 = locs()->in(0).reg(); 4589 Register v0 = locs()->in(0).reg();
4590 Register v1 = locs()->in(1).reg(); 4590 Register v1 = locs()->in(1).reg();
4591 Register v2 = locs()->in(2).reg(); 4591 Register v2 = locs()->in(2).reg();
4592 Register v3 = locs()->in(3).reg(); 4592 Register v3 = locs()->in(3).reg();
4593 XmmRegister result = locs()->out(0).fpu_reg(); 4593 XmmRegister result = locs()->out(0).fpu_reg();
4594 __ subl(ESP, Immediate(4 * kInt32Size)); 4594 __ subl(ESP, Immediate(4 * kInt32Size));
4595 __ movl(Address(ESP, 0 * kInt32Size), v0); 4595 __ movl(Address(ESP, 0 * kInt32Size), v0);
4596 __ movl(Address(ESP, 1 * kInt32Size), v1); 4596 __ movl(Address(ESP, 1 * kInt32Size), v1);
4597 __ movl(Address(ESP, 2 * kInt32Size), v2); 4597 __ movl(Address(ESP, 2 * kInt32Size), v2);
4598 __ movl(Address(ESP, 3 * kInt32Size), v3); 4598 __ movl(Address(ESP, 3 * kInt32Size), v3);
4599 __ movups(result, Address(ESP, 0)); 4599 __ movups(result, Address(ESP, 0));
4600 __ addl(ESP, Immediate(4 * kInt32Size)); 4600 __ addl(ESP, Immediate(4 * kInt32Size));
4601 } 4601 }
4602 4602
4603 4603
4604 LocationSummary* Int32x4BoolConstructorInstr::MakeLocationSummary( 4604 LocationSummary* Int32x4BoolConstructorInstr::MakeLocationSummary(
4605 Isolate* isolate, bool opt) const { 4605 Zone* zone, bool opt) const {
4606 const intptr_t kNumInputs = 4; 4606 const intptr_t kNumInputs = 4;
4607 const intptr_t kNumTemps = 0; 4607 const intptr_t kNumTemps = 0;
4608 LocationSummary* summary = new(isolate) LocationSummary( 4608 LocationSummary* summary = new(zone) LocationSummary(
4609 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4609 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4610 summary->set_in(0, Location::RequiresRegister()); 4610 summary->set_in(0, Location::RequiresRegister());
4611 summary->set_in(1, Location::RequiresRegister()); 4611 summary->set_in(1, Location::RequiresRegister());
4612 summary->set_in(2, Location::RequiresRegister()); 4612 summary->set_in(2, Location::RequiresRegister());
4613 summary->set_in(3, Location::RequiresRegister()); 4613 summary->set_in(3, Location::RequiresRegister());
4614 summary->set_out(0, Location::RequiresFpuRegister()); 4614 summary->set_out(0, Location::RequiresFpuRegister());
4615 return summary; 4615 return summary;
4616 } 4616 }
4617 4617
4618 4618
4619 void Int32x4BoolConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4619 void Int32x4BoolConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
4657 __ jmp(&w_done); 4657 __ jmp(&w_done);
4658 __ Bind(&w_false); 4658 __ Bind(&w_false);
4659 __ movl(Address(ESP, 12), Immediate(0x0)); 4659 __ movl(Address(ESP, 12), Immediate(0x0));
4660 __ Bind(&w_done); 4660 __ Bind(&w_done);
4661 4661
4662 __ movups(result, Address(ESP, 0)); 4662 __ movups(result, Address(ESP, 0));
4663 __ addl(ESP, Immediate(16)); 4663 __ addl(ESP, Immediate(16));
4664 } 4664 }
4665 4665
4666 4666
4667 LocationSummary* Int32x4GetFlagInstr::MakeLocationSummary(Isolate* isolate, 4667 LocationSummary* Int32x4GetFlagInstr::MakeLocationSummary(Zone* zone,
4668 bool opt) const { 4668 bool opt) const {
4669 const intptr_t kNumInputs = 1; 4669 const intptr_t kNumInputs = 1;
4670 const intptr_t kNumTemps = 0; 4670 const intptr_t kNumTemps = 0;
4671 LocationSummary* summary = new(isolate) LocationSummary( 4671 LocationSummary* summary = new(zone) LocationSummary(
4672 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4672 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4673 summary->set_in(0, Location::RequiresFpuRegister()); 4673 summary->set_in(0, Location::RequiresFpuRegister());
4674 summary->set_out(0, Location::RequiresRegister()); 4674 summary->set_out(0, Location::RequiresRegister());
4675 return summary; 4675 return summary;
4676 } 4676 }
4677 4677
4678 4678
4679 void Int32x4GetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4679 void Int32x4GetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4680 XmmRegister value = locs()->in(0).fpu_reg(); 4680 XmmRegister value = locs()->in(0).fpu_reg();
4681 Register result = locs()->out(0).reg(); 4681 Register result = locs()->out(0).reg();
4682 Label done; 4682 Label done;
(...skipping 20 matching lines...) Expand all
4703 __ testl(result, result); 4703 __ testl(result, result);
4704 __ j(NOT_ZERO, &non_zero, Assembler::kNearJump); 4704 __ j(NOT_ZERO, &non_zero, Assembler::kNearJump);
4705 __ LoadObject(result, Bool::False()); 4705 __ LoadObject(result, Bool::False());
4706 __ jmp(&done); 4706 __ jmp(&done);
4707 __ Bind(&non_zero); 4707 __ Bind(&non_zero);
4708 __ LoadObject(result, Bool::True()); 4708 __ LoadObject(result, Bool::True());
4709 __ Bind(&done); 4709 __ Bind(&done);
4710 } 4710 }
4711 4711
4712 4712
4713 LocationSummary* Int32x4SelectInstr::MakeLocationSummary(Isolate* isolate, 4713 LocationSummary* Int32x4SelectInstr::MakeLocationSummary(Zone* zone,
4714 bool opt) const { 4714 bool opt) const {
4715 const intptr_t kNumInputs = 3; 4715 const intptr_t kNumInputs = 3;
4716 const intptr_t kNumTemps = 1; 4716 const intptr_t kNumTemps = 1;
4717 LocationSummary* summary = new(isolate) LocationSummary( 4717 LocationSummary* summary = new(zone) LocationSummary(
4718 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4718 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4719 summary->set_in(0, Location::RequiresFpuRegister()); 4719 summary->set_in(0, Location::RequiresFpuRegister());
4720 summary->set_in(1, Location::RequiresFpuRegister()); 4720 summary->set_in(1, Location::RequiresFpuRegister());
4721 summary->set_in(2, Location::RequiresFpuRegister()); 4721 summary->set_in(2, Location::RequiresFpuRegister());
4722 summary->set_temp(0, Location::RequiresFpuRegister()); 4722 summary->set_temp(0, Location::RequiresFpuRegister());
4723 summary->set_out(0, Location::SameAsFirstInput()); 4723 summary->set_out(0, Location::SameAsFirstInput());
4724 return summary; 4724 return summary;
4725 } 4725 }
4726 4726
4727 4727
4728 void Int32x4SelectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4728 void Int32x4SelectInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4729 XmmRegister mask = locs()->in(0).fpu_reg(); 4729 XmmRegister mask = locs()->in(0).fpu_reg();
4730 XmmRegister trueValue = locs()->in(1).fpu_reg(); 4730 XmmRegister trueValue = locs()->in(1).fpu_reg();
4731 XmmRegister falseValue = locs()->in(2).fpu_reg(); 4731 XmmRegister falseValue = locs()->in(2).fpu_reg();
4732 XmmRegister out = locs()->out(0).fpu_reg(); 4732 XmmRegister out = locs()->out(0).fpu_reg();
4733 XmmRegister temp = locs()->temp(0).fpu_reg(); 4733 XmmRegister temp = locs()->temp(0).fpu_reg();
4734 ASSERT(out == mask); 4734 ASSERT(out == mask);
4735 // Copy mask. 4735 // Copy mask.
4736 __ movaps(temp, mask); 4736 __ movaps(temp, mask);
4737 // Invert it. 4737 // Invert it.
4738 __ notps(temp); 4738 __ notps(temp);
4739 // mask = mask & trueValue. 4739 // mask = mask & trueValue.
4740 __ andps(mask, trueValue); 4740 __ andps(mask, trueValue);
4741 // temp = temp & falseValue. 4741 // temp = temp & falseValue.
4742 __ andps(temp, falseValue); 4742 __ andps(temp, falseValue);
4743 // out = mask | temp. 4743 // out = mask | temp.
4744 __ orps(mask, temp); 4744 __ orps(mask, temp);
4745 } 4745 }
4746 4746
4747 4747
4748 LocationSummary* Int32x4SetFlagInstr::MakeLocationSummary(Isolate* isolate, 4748 LocationSummary* Int32x4SetFlagInstr::MakeLocationSummary(Zone* zone,
4749 bool opt) const { 4749 bool opt) const {
4750 const intptr_t kNumInputs = 2; 4750 const intptr_t kNumInputs = 2;
4751 const intptr_t kNumTemps = 0; 4751 const intptr_t kNumTemps = 0;
4752 LocationSummary* summary = new(isolate) LocationSummary( 4752 LocationSummary* summary = new(zone) LocationSummary(
4753 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4753 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4754 summary->set_in(0, Location::RequiresFpuRegister()); 4754 summary->set_in(0, Location::RequiresFpuRegister());
4755 summary->set_in(1, Location::RequiresRegister()); 4755 summary->set_in(1, Location::RequiresRegister());
4756 summary->set_out(0, Location::SameAsFirstInput()); 4756 summary->set_out(0, Location::SameAsFirstInput());
4757 return summary; 4757 return summary;
4758 } 4758 }
4759 4759
4760 4760
4761 void Int32x4SetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4761 void Int32x4SetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4762 XmmRegister mask = locs()->in(0).fpu_reg(); 4762 XmmRegister mask = locs()->in(0).fpu_reg();
4763 Register flag = locs()->in(1).reg(); 4763 Register flag = locs()->in(1).reg();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
4795 break; 4795 break;
4796 default: UNREACHABLE(); 4796 default: UNREACHABLE();
4797 } 4797 }
4798 __ Bind(&exitPath); 4798 __ Bind(&exitPath);
4799 // Copy mask back to register. 4799 // Copy mask back to register.
4800 __ movups(mask, Address(ESP, 0)); 4800 __ movups(mask, Address(ESP, 0));
4801 __ addl(ESP, Immediate(16)); 4801 __ addl(ESP, Immediate(16));
4802 } 4802 }
4803 4803
4804 4804
4805 LocationSummary* Int32x4ToFloat32x4Instr::MakeLocationSummary(Isolate* isolate, 4805 LocationSummary* Int32x4ToFloat32x4Instr::MakeLocationSummary(Zone* zone,
4806 bool opt) const { 4806 bool opt) const {
4807 const intptr_t kNumInputs = 1; 4807 const intptr_t kNumInputs = 1;
4808 const intptr_t kNumTemps = 0; 4808 const intptr_t kNumTemps = 0;
4809 LocationSummary* summary = new(isolate) LocationSummary( 4809 LocationSummary* summary = new(zone) LocationSummary(
4810 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4810 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4811 summary->set_in(0, Location::RequiresFpuRegister()); 4811 summary->set_in(0, Location::RequiresFpuRegister());
4812 summary->set_out(0, Location::SameAsFirstInput()); 4812 summary->set_out(0, Location::SameAsFirstInput());
4813 return summary; 4813 return summary;
4814 } 4814 }
4815 4815
4816 4816
4817 void Int32x4ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 4817 void Int32x4ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
4818 // NOP. 4818 // NOP.
4819 } 4819 }
4820 4820
4821 4821
4822 LocationSummary* BinaryInt32x4OpInstr::MakeLocationSummary(Isolate* isolate, 4822 LocationSummary* BinaryInt32x4OpInstr::MakeLocationSummary(Zone* zone,
4823 bool opt) const { 4823 bool opt) const {
4824 const intptr_t kNumInputs = 2; 4824 const intptr_t kNumInputs = 2;
4825 const intptr_t kNumTemps = 0; 4825 const intptr_t kNumTemps = 0;
4826 LocationSummary* summary = new(isolate) LocationSummary( 4826 LocationSummary* summary = new(zone) LocationSummary(
4827 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4827 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4828 summary->set_in(0, Location::RequiresFpuRegister()); 4828 summary->set_in(0, Location::RequiresFpuRegister());
4829 summary->set_in(1, Location::RequiresFpuRegister()); 4829 summary->set_in(1, Location::RequiresFpuRegister());
4830 summary->set_out(0, Location::SameAsFirstInput()); 4830 summary->set_out(0, Location::SameAsFirstInput());
4831 return summary; 4831 return summary;
4832 } 4832 }
4833 4833
4834 4834
4835 void BinaryInt32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4835 void BinaryInt32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4836 XmmRegister left = locs()->in(0).fpu_reg(); 4836 XmmRegister left = locs()->in(0).fpu_reg();
4837 XmmRegister right = locs()->in(1).fpu_reg(); 4837 XmmRegister right = locs()->in(1).fpu_reg();
(...skipping 15 matching lines...) Expand all
4853 __ addpl(left, right); 4853 __ addpl(left, right);
4854 break; 4854 break;
4855 case Token::kSUB: 4855 case Token::kSUB:
4856 __ subpl(left, right); 4856 __ subpl(left, right);
4857 break; 4857 break;
4858 default: UNREACHABLE(); 4858 default: UNREACHABLE();
4859 } 4859 }
4860 } 4860 }
4861 4861
4862 4862
4863 LocationSummary* MathUnaryInstr::MakeLocationSummary(Isolate* isolate, 4863 LocationSummary* MathUnaryInstr::MakeLocationSummary(Zone* zone,
4864 bool opt) const { 4864 bool opt) const {
4865 if ((kind() == MathUnaryInstr::kSin) || (kind() == MathUnaryInstr::kCos)) { 4865 if ((kind() == MathUnaryInstr::kSin) || (kind() == MathUnaryInstr::kCos)) {
4866 const intptr_t kNumInputs = 1; 4866 const intptr_t kNumInputs = 1;
4867 const intptr_t kNumTemps = 1; 4867 const intptr_t kNumTemps = 1;
4868 LocationSummary* summary = new(isolate) LocationSummary( 4868 LocationSummary* summary = new(zone) LocationSummary(
4869 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 4869 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
4870 summary->set_in(0, Location::FpuRegisterLocation(XMM1)); 4870 summary->set_in(0, Location::FpuRegisterLocation(XMM1));
4871 // EDI is chosen because it is callee saved so we do not need to back it 4871 // EDI is chosen because it is callee saved so we do not need to back it
4872 // up before calling into the runtime. 4872 // up before calling into the runtime.
4873 summary->set_temp(0, Location::RegisterLocation(EDI)); 4873 summary->set_temp(0, Location::RegisterLocation(EDI));
4874 summary->set_out(0, Location::FpuRegisterLocation(XMM1)); 4874 summary->set_out(0, Location::FpuRegisterLocation(XMM1));
4875 return summary; 4875 return summary;
4876 } 4876 }
4877 ASSERT((kind() == MathUnaryInstr::kSqrt) || 4877 ASSERT((kind() == MathUnaryInstr::kSqrt) ||
4878 (kind() == MathUnaryInstr::kDoubleSquare)); 4878 (kind() == MathUnaryInstr::kDoubleSquare));
4879 const intptr_t kNumInputs = 1; 4879 const intptr_t kNumInputs = 1;
4880 const intptr_t kNumTemps = 0; 4880 const intptr_t kNumTemps = 0;
4881 LocationSummary* summary = new(isolate) LocationSummary( 4881 LocationSummary* summary = new(zone) LocationSummary(
4882 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4882 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4883 summary->set_in(0, Location::RequiresFpuRegister()); 4883 summary->set_in(0, Location::RequiresFpuRegister());
4884 if (kind() == MathUnaryInstr::kDoubleSquare) { 4884 if (kind() == MathUnaryInstr::kDoubleSquare) {
4885 summary->set_out(0, Location::SameAsFirstInput()); 4885 summary->set_out(0, Location::SameAsFirstInput());
4886 } else { 4886 } else {
4887 summary->set_out(0, Location::RequiresFpuRegister()); 4887 summary->set_out(0, Location::RequiresFpuRegister());
4888 } 4888 }
4889 return summary; 4889 return summary;
4890 } 4890 }
4891 4891
4892 4892
(...skipping 14 matching lines...) Expand all
4907 __ CallRuntime(TargetFunction(), InputCount()); 4907 __ CallRuntime(TargetFunction(), InputCount());
4908 __ fstpl(Address(ESP, 0)); 4908 __ fstpl(Address(ESP, 0));
4909 __ movsd(locs()->out(0).fpu_reg(), Address(ESP, 0)); 4909 __ movsd(locs()->out(0).fpu_reg(), Address(ESP, 0));
4910 // Restore ESP. 4910 // Restore ESP.
4911 __ movl(ESP, locs()->temp(0).reg()); 4911 __ movl(ESP, locs()->temp(0).reg());
4912 } 4912 }
4913 } 4913 }
4914 4914
4915 4915
4916 LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary( 4916 LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary(
4917 Isolate* isolate, bool opt) const { 4917 Zone* zone, bool opt) const {
4918 const intptr_t kNumTemps = 0; 4918 const intptr_t kNumTemps = 0;
4919 LocationSummary* summary = new(isolate) LocationSummary( 4919 LocationSummary* summary = new(zone) LocationSummary(
4920 isolate, InputCount(), kNumTemps, LocationSummary::kCall); 4920 zone, InputCount(), kNumTemps, LocationSummary::kCall);
4921 summary->set_in(0, Location::RegisterLocation(EAX)); 4921 summary->set_in(0, Location::RegisterLocation(EAX));
4922 summary->set_in(1, Location::RegisterLocation(ECX)); 4922 summary->set_in(1, Location::RegisterLocation(ECX));
4923 summary->set_in(2, Location::RegisterLocation(EDX)); 4923 summary->set_in(2, Location::RegisterLocation(EDX));
4924 summary->set_in(3, Location::RegisterLocation(EBX)); 4924 summary->set_in(3, Location::RegisterLocation(EBX));
4925 summary->set_out(0, Location::RegisterLocation(EAX)); 4925 summary->set_out(0, Location::RegisterLocation(EAX));
4926 return summary; 4926 return summary;
4927 } 4927 }
4928 4928
4929 4929
4930 void CaseInsensitiveCompareUC16Instr::EmitNativeCode( 4930 void CaseInsensitiveCompareUC16Instr::EmitNativeCode(
(...skipping 11 matching lines...) Expand all
4942 __ movl(Address(ESP, + 3 * kWordSize), locs()->in(3).reg()); 4942 __ movl(Address(ESP, + 3 * kWordSize), locs()->in(3).reg());
4943 4943
4944 // Call the function. 4944 // Call the function.
4945 __ CallRuntime(TargetFunction(), TargetFunction().argument_count()); 4945 __ CallRuntime(TargetFunction(), TargetFunction().argument_count());
4946 4946
4947 // Restore ESP. 4947 // Restore ESP.
4948 __ movl(ESP, kSavedSPReg); 4948 __ movl(ESP, kSavedSPReg);
4949 } 4949 }
4950 4950
4951 4951
4952 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate, 4952 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Zone* zone,
4953 bool opt) const { 4953 bool opt) const {
4954 if (result_cid() == kDoubleCid) { 4954 if (result_cid() == kDoubleCid) {
4955 const intptr_t kNumInputs = 2; 4955 const intptr_t kNumInputs = 2;
4956 const intptr_t kNumTemps = 1; 4956 const intptr_t kNumTemps = 1;
4957 LocationSummary* summary = new(isolate) LocationSummary( 4957 LocationSummary* summary = new(zone) LocationSummary(
4958 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4958 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4959 summary->set_in(0, Location::RequiresFpuRegister()); 4959 summary->set_in(0, Location::RequiresFpuRegister());
4960 summary->set_in(1, Location::RequiresFpuRegister()); 4960 summary->set_in(1, Location::RequiresFpuRegister());
4961 // Reuse the left register so that code can be made shorter. 4961 // Reuse the left register so that code can be made shorter.
4962 summary->set_out(0, Location::SameAsFirstInput()); 4962 summary->set_out(0, Location::SameAsFirstInput());
4963 summary->set_temp(0, Location::RequiresRegister()); 4963 summary->set_temp(0, Location::RequiresRegister());
4964 return summary; 4964 return summary;
4965 } 4965 }
4966 4966
4967 ASSERT(result_cid() == kSmiCid); 4967 ASSERT(result_cid() == kSmiCid);
4968 const intptr_t kNumInputs = 2; 4968 const intptr_t kNumInputs = 2;
4969 const intptr_t kNumTemps = 0; 4969 const intptr_t kNumTemps = 0;
4970 LocationSummary* summary = new(isolate) LocationSummary( 4970 LocationSummary* summary = new(zone) LocationSummary(
4971 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4971 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4972 summary->set_in(0, Location::RequiresRegister()); 4972 summary->set_in(0, Location::RequiresRegister());
4973 summary->set_in(1, Location::RequiresRegister()); 4973 summary->set_in(1, Location::RequiresRegister());
4974 // Reuse the left register so that code can be made shorter. 4974 // Reuse the left register so that code can be made shorter.
4975 summary->set_out(0, Location::SameAsFirstInput()); 4975 summary->set_out(0, Location::SameAsFirstInput());
4976 return summary; 4976 return summary;
4977 } 4977 }
4978 4978
4979 4979
4980 void MathMinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4980 void MathMinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4981 ASSERT((op_kind() == MethodRecognizer::kMathMin) || 4981 ASSERT((op_kind() == MethodRecognizer::kMathMin) ||
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
5031 __ cmpl(left, right); 5031 __ cmpl(left, right);
5032 ASSERT(result == left); 5032 ASSERT(result == left);
5033 if (is_min) { 5033 if (is_min) {
5034 __ cmovgel(result, right); 5034 __ cmovgel(result, right);
5035 } else { 5035 } else {
5036 __ cmovlessl(result, right); 5036 __ cmovlessl(result, right);
5037 } 5037 }
5038 } 5038 }
5039 5039
5040 5040
5041 LocationSummary* UnarySmiOpInstr::MakeLocationSummary(Isolate* isolate, 5041 LocationSummary* UnarySmiOpInstr::MakeLocationSummary(Zone* zone,
5042 bool opt) const { 5042 bool opt) const {
5043 const intptr_t kNumInputs = 1; 5043 const intptr_t kNumInputs = 1;
5044 return LocationSummary::Make(isolate, 5044 return LocationSummary::Make(zone,
5045 kNumInputs, 5045 kNumInputs,
5046 Location::SameAsFirstInput(), 5046 Location::SameAsFirstInput(),
5047 LocationSummary::kNoCall); 5047 LocationSummary::kNoCall);
5048 } 5048 }
5049 5049
5050 5050
5051 void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5051 void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5052 Register value = locs()->in(0).reg(); 5052 Register value = locs()->in(0).reg();
5053 ASSERT(value == locs()->out(0).reg()); 5053 ASSERT(value == locs()->out(0).reg());
5054 switch (op_kind()) { 5054 switch (op_kind()) {
5055 case Token::kNEGATE: { 5055 case Token::kNEGATE: {
5056 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptUnaryOp); 5056 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptUnaryOp);
5057 __ negl(value); 5057 __ negl(value);
5058 __ j(OVERFLOW, deopt); 5058 __ j(OVERFLOW, deopt);
5059 break; 5059 break;
5060 } 5060 }
5061 case Token::kBIT_NOT: 5061 case Token::kBIT_NOT:
5062 __ notl(value); 5062 __ notl(value);
5063 __ andl(value, Immediate(~kSmiTagMask)); // Remove inverted smi-tag. 5063 __ andl(value, Immediate(~kSmiTagMask)); // Remove inverted smi-tag.
5064 break; 5064 break;
5065 default: 5065 default:
5066 UNREACHABLE(); 5066 UNREACHABLE();
5067 } 5067 }
5068 } 5068 }
5069 5069
5070 5070
5071 LocationSummary* UnaryDoubleOpInstr::MakeLocationSummary(Isolate* isolate, 5071 LocationSummary* UnaryDoubleOpInstr::MakeLocationSummary(Zone* zone,
5072 bool opt) const { 5072 bool opt) const {
5073 const intptr_t kNumInputs = 1; 5073 const intptr_t kNumInputs = 1;
5074 const intptr_t kNumTemps = 0; 5074 const intptr_t kNumTemps = 0;
5075 LocationSummary* summary = new(isolate) LocationSummary( 5075 LocationSummary* summary = new(zone) LocationSummary(
5076 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5076 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5077 summary->set_in(0, Location::RequiresFpuRegister()); 5077 summary->set_in(0, Location::RequiresFpuRegister());
5078 summary->set_out(0, Location::SameAsFirstInput()); 5078 summary->set_out(0, Location::SameAsFirstInput());
5079 return summary; 5079 return summary;
5080 } 5080 }
5081 5081
5082 5082
5083 void UnaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5083 void UnaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5084 XmmRegister value = locs()->in(0).fpu_reg(); 5084 XmmRegister value = locs()->in(0).fpu_reg();
5085 ASSERT(locs()->out(0).fpu_reg() == value); 5085 ASSERT(locs()->out(0).fpu_reg() == value);
5086 __ DoubleNegate(value); 5086 __ DoubleNegate(value);
5087 } 5087 }
5088 5088
5089 5089
5090 LocationSummary* Int32ToDoubleInstr::MakeLocationSummary(Isolate* isolate, 5090 LocationSummary* Int32ToDoubleInstr::MakeLocationSummary(Zone* zone,
5091 bool opt) const { 5091 bool opt) const {
5092 const intptr_t kNumInputs = 1; 5092 const intptr_t kNumInputs = 1;
5093 const intptr_t kNumTemps = 0; 5093 const intptr_t kNumTemps = 0;
5094 LocationSummary* result = new(isolate) LocationSummary( 5094 LocationSummary* result = new(zone) LocationSummary(
5095 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5095 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5096 result->set_in(0, Location::RequiresRegister()); 5096 result->set_in(0, Location::RequiresRegister());
5097 result->set_out(0, Location::RequiresFpuRegister()); 5097 result->set_out(0, Location::RequiresFpuRegister());
5098 return result; 5098 return result;
5099 } 5099 }
5100 5100
5101 5101
5102 void Int32ToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5102 void Int32ToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5103 Register value = locs()->in(0).reg(); 5103 Register value = locs()->in(0).reg();
5104 FpuRegister result = locs()->out(0).fpu_reg(); 5104 FpuRegister result = locs()->out(0).fpu_reg();
5105 __ cvtsi2sd(result, value); 5105 __ cvtsi2sd(result, value);
5106 } 5106 }
5107 5107
5108 5108
5109 LocationSummary* SmiToDoubleInstr::MakeLocationSummary(Isolate* isolate, 5109 LocationSummary* SmiToDoubleInstr::MakeLocationSummary(Zone* zone,
5110 bool opt) const { 5110 bool opt) const {
5111 const intptr_t kNumInputs = 1; 5111 const intptr_t kNumInputs = 1;
5112 const intptr_t kNumTemps = 0; 5112 const intptr_t kNumTemps = 0;
5113 LocationSummary* result = new(isolate) LocationSummary( 5113 LocationSummary* result = new(zone) LocationSummary(
5114 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5114 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5115 result->set_in(0, Location::WritableRegister()); 5115 result->set_in(0, Location::WritableRegister());
5116 result->set_out(0, Location::RequiresFpuRegister()); 5116 result->set_out(0, Location::RequiresFpuRegister());
5117 return result; 5117 return result;
5118 } 5118 }
5119 5119
5120 5120
5121 void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5121 void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5122 Register value = locs()->in(0).reg(); 5122 Register value = locs()->in(0).reg();
5123 FpuRegister result = locs()->out(0).fpu_reg(); 5123 FpuRegister result = locs()->out(0).fpu_reg();
5124 __ SmiUntag(value); 5124 __ SmiUntag(value);
5125 __ cvtsi2sd(result, value); 5125 __ cvtsi2sd(result, value);
5126 } 5126 }
5127 5127
5128 5128
5129 LocationSummary* MintToDoubleInstr::MakeLocationSummary(Isolate* isolate, 5129 LocationSummary* MintToDoubleInstr::MakeLocationSummary(Zone* zone,
5130 bool opt) const { 5130 bool opt) const {
5131 const intptr_t kNumInputs = 1; 5131 const intptr_t kNumInputs = 1;
5132 const intptr_t kNumTemps = 0; 5132 const intptr_t kNumTemps = 0;
5133 LocationSummary* result = new(isolate) LocationSummary( 5133 LocationSummary* result = new(zone) LocationSummary(
5134 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5134 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5135 result->set_in(0, Location::Pair(Location::RequiresRegister(), 5135 result->set_in(0, Location::Pair(Location::RequiresRegister(),
5136 Location::RequiresRegister())); 5136 Location::RequiresRegister()));
5137 result->set_out(0, Location::RequiresFpuRegister()); 5137 result->set_out(0, Location::RequiresFpuRegister());
5138 return result; 5138 return result;
5139 } 5139 }
5140 5140
5141 5141
5142 void MintToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5142 void MintToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5143 PairLocation* pair = locs()->in(0).AsPairLocation(); 5143 PairLocation* pair = locs()->in(0).AsPairLocation();
5144 Register in_lo = pair->At(0).reg(); 5144 Register in_lo = pair->At(0).reg();
5145 Register in_hi = pair->At(1).reg(); 5145 Register in_hi = pair->At(1).reg();
5146 5146
5147 FpuRegister result = locs()->out(0).fpu_reg(); 5147 FpuRegister result = locs()->out(0).fpu_reg();
5148 5148
5149 // Push hi. 5149 // Push hi.
5150 __ pushl(in_hi); 5150 __ pushl(in_hi);
5151 // Push lo. 5151 // Push lo.
5152 __ pushl(in_lo); 5152 __ pushl(in_lo);
5153 // Perform conversion from Mint to double. 5153 // Perform conversion from Mint to double.
5154 __ fildl(Address(ESP, 0)); 5154 __ fildl(Address(ESP, 0));
5155 // Pop FPU stack onto regular stack. 5155 // Pop FPU stack onto regular stack.
5156 __ fstpl(Address(ESP, 0)); 5156 __ fstpl(Address(ESP, 0));
5157 // Copy into result. 5157 // Copy into result.
5158 __ movsd(result, Address(ESP, 0)); 5158 __ movsd(result, Address(ESP, 0));
5159 // Pop args. 5159 // Pop args.
5160 __ addl(ESP, Immediate(2 * kWordSize)); 5160 __ addl(ESP, Immediate(2 * kWordSize));
5161 } 5161 }
5162 5162
5163 5163
5164 LocationSummary* DoubleToIntegerInstr::MakeLocationSummary(Isolate* isolate, 5164 LocationSummary* DoubleToIntegerInstr::MakeLocationSummary(Zone* zone,
5165 bool opt) const { 5165 bool opt) const {
5166 const intptr_t kNumInputs = 1; 5166 const intptr_t kNumInputs = 1;
5167 const intptr_t kNumTemps = 0; 5167 const intptr_t kNumTemps = 0;
5168 LocationSummary* result = new(isolate) LocationSummary( 5168 LocationSummary* result = new(zone) LocationSummary(
5169 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 5169 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
5170 result->set_in(0, Location::RegisterLocation(ECX)); 5170 result->set_in(0, Location::RegisterLocation(ECX));
5171 result->set_out(0, Location::RegisterLocation(EAX)); 5171 result->set_out(0, Location::RegisterLocation(EAX));
5172 return result; 5172 return result;
5173 } 5173 }
5174 5174
5175 5175
5176 void DoubleToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5176 void DoubleToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5177 Register result = locs()->out(0).reg(); 5177 Register result = locs()->out(0).reg();
5178 Register value_obj = locs()->in(0).reg(); 5178 Register value_obj = locs()->in(0).reg();
5179 XmmRegister value_double = XMM0; 5179 XmmRegister value_double = XMM0;
(...skipping 20 matching lines...) Expand all
5200 instance_call()->token_pos(), 5200 instance_call()->token_pos(),
5201 target, 5201 target,
5202 kNumberOfArguments, 5202 kNumberOfArguments,
5203 Object::null_array(), // No argument names. 5203 Object::null_array(), // No argument names.
5204 locs(), 5204 locs(),
5205 ICData::Handle()); 5205 ICData::Handle());
5206 __ Bind(&done); 5206 __ Bind(&done);
5207 } 5207 }
5208 5208
5209 5209
5210 LocationSummary* DoubleToSmiInstr::MakeLocationSummary(Isolate* isolate, 5210 LocationSummary* DoubleToSmiInstr::MakeLocationSummary(Zone* zone,
5211 bool opt) const { 5211 bool opt) const {
5212 const intptr_t kNumInputs = 1; 5212 const intptr_t kNumInputs = 1;
5213 const intptr_t kNumTemps = 0; 5213 const intptr_t kNumTemps = 0;
5214 LocationSummary* result = new(isolate) LocationSummary( 5214 LocationSummary* result = new(zone) LocationSummary(
5215 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5215 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5216 result->set_in(0, Location::RequiresFpuRegister()); 5216 result->set_in(0, Location::RequiresFpuRegister());
5217 result->set_out(0, Location::RequiresRegister()); 5217 result->set_out(0, Location::RequiresRegister());
5218 return result; 5218 return result;
5219 } 5219 }
5220 5220
5221 5221
5222 void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5222 void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5223 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptDoubleToSmi); 5223 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptDoubleToSmi);
5224 Register result = locs()->out(0).reg(); 5224 Register result = locs()->out(0).reg();
5225 XmmRegister value = locs()->in(0).fpu_reg(); 5225 XmmRegister value = locs()->in(0).fpu_reg();
5226 __ cvttsd2si(result, value); 5226 __ cvttsd2si(result, value);
5227 // Check for overflow and that it fits into Smi. 5227 // Check for overflow and that it fits into Smi.
5228 __ cmpl(result, Immediate(0xC0000000)); 5228 __ cmpl(result, Immediate(0xC0000000));
5229 __ j(NEGATIVE, deopt); 5229 __ j(NEGATIVE, deopt);
5230 __ SmiTag(result); 5230 __ SmiTag(result);
5231 } 5231 }
5232 5232
5233 5233
5234 LocationSummary* DoubleToDoubleInstr::MakeLocationSummary(Isolate* isolate, 5234 LocationSummary* DoubleToDoubleInstr::MakeLocationSummary(Zone* zone,
5235 bool opt) const { 5235 bool opt) const {
5236 const intptr_t kNumInputs = 1; 5236 const intptr_t kNumInputs = 1;
5237 const intptr_t kNumTemps = 0; 5237 const intptr_t kNumTemps = 0;
5238 LocationSummary* result = new(isolate) LocationSummary( 5238 LocationSummary* result = new(zone) LocationSummary(
5239 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5239 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5240 result->set_in(0, Location::RequiresFpuRegister()); 5240 result->set_in(0, Location::RequiresFpuRegister());
5241 result->set_out(0, Location::RequiresFpuRegister()); 5241 result->set_out(0, Location::RequiresFpuRegister());
5242 return result; 5242 return result;
5243 } 5243 }
5244 5244
5245 5245
5246 void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5246 void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5247 XmmRegister value = locs()->in(0).fpu_reg(); 5247 XmmRegister value = locs()->in(0).fpu_reg();
5248 XmmRegister result = locs()->out(0).fpu_reg(); 5248 XmmRegister result = locs()->out(0).fpu_reg();
5249 switch (recognized_kind()) { 5249 switch (recognized_kind()) {
5250 case MethodRecognizer::kDoubleTruncate: 5250 case MethodRecognizer::kDoubleTruncate:
5251 __ roundsd(result, value, Assembler::kRoundToZero); 5251 __ roundsd(result, value, Assembler::kRoundToZero);
5252 break; 5252 break;
5253 case MethodRecognizer::kDoubleFloor: 5253 case MethodRecognizer::kDoubleFloor:
5254 __ roundsd(result, value, Assembler::kRoundDown); 5254 __ roundsd(result, value, Assembler::kRoundDown);
5255 break; 5255 break;
5256 case MethodRecognizer::kDoubleCeil: 5256 case MethodRecognizer::kDoubleCeil:
5257 __ roundsd(result, value, Assembler::kRoundUp); 5257 __ roundsd(result, value, Assembler::kRoundUp);
5258 break; 5258 break;
5259 default: 5259 default:
5260 UNREACHABLE(); 5260 UNREACHABLE();
5261 } 5261 }
5262 } 5262 }
5263 5263
5264 5264
5265 LocationSummary* DoubleToFloatInstr::MakeLocationSummary(Isolate* isolate, 5265 LocationSummary* DoubleToFloatInstr::MakeLocationSummary(Zone* zone,
5266 bool opt) const { 5266 bool opt) const {
5267 const intptr_t kNumInputs = 1; 5267 const intptr_t kNumInputs = 1;
5268 const intptr_t kNumTemps = 0; 5268 const intptr_t kNumTemps = 0;
5269 LocationSummary* result = new(isolate) LocationSummary( 5269 LocationSummary* result = new(zone) LocationSummary(
5270 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5270 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5271 result->set_in(0, Location::RequiresFpuRegister()); 5271 result->set_in(0, Location::RequiresFpuRegister());
5272 result->set_out(0, Location::SameAsFirstInput()); 5272 result->set_out(0, Location::SameAsFirstInput());
5273 return result; 5273 return result;
5274 } 5274 }
5275 5275
5276 5276
5277 void DoubleToFloatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5277 void DoubleToFloatInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5278 __ cvtsd2ss(locs()->out(0).fpu_reg(), locs()->in(0).fpu_reg()); 5278 __ cvtsd2ss(locs()->out(0).fpu_reg(), locs()->in(0).fpu_reg());
5279 } 5279 }
5280 5280
5281 5281
5282 LocationSummary* FloatToDoubleInstr::MakeLocationSummary(Isolate* isolate, 5282 LocationSummary* FloatToDoubleInstr::MakeLocationSummary(Zone* zone,
5283 bool opt) const { 5283 bool opt) const {
5284 const intptr_t kNumInputs = 1; 5284 const intptr_t kNumInputs = 1;
5285 const intptr_t kNumTemps = 0; 5285 const intptr_t kNumTemps = 0;
5286 LocationSummary* result = new(isolate) LocationSummary( 5286 LocationSummary* result = new(zone) LocationSummary(
5287 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5287 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5288 result->set_in(0, Location::RequiresFpuRegister()); 5288 result->set_in(0, Location::RequiresFpuRegister());
5289 result->set_out(0, Location::SameAsFirstInput()); 5289 result->set_out(0, Location::SameAsFirstInput());
5290 return result; 5290 return result;
5291 } 5291 }
5292 5292
5293 5293
5294 void FloatToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5294 void FloatToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5295 __ cvtss2sd(locs()->out(0).fpu_reg(), locs()->in(0).fpu_reg()); 5295 __ cvtss2sd(locs()->out(0).fpu_reg(), locs()->in(0).fpu_reg());
5296 } 5296 }
5297 5297
5298 5298
5299 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(Isolate* isolate, 5299 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(Zone* zone,
5300 bool opt) const { 5300 bool opt) const {
5301 ASSERT((InputCount() == 1) || (InputCount() == 2)); 5301 ASSERT((InputCount() == 1) || (InputCount() == 2));
5302 const intptr_t kNumTemps = 5302 const intptr_t kNumTemps =
5303 (recognized_kind() == MethodRecognizer::kMathDoublePow) ? 3 : 1; 5303 (recognized_kind() == MethodRecognizer::kMathDoublePow) ? 3 : 1;
5304 LocationSummary* result = new(isolate) LocationSummary( 5304 LocationSummary* result = new(zone) LocationSummary(
5305 isolate, InputCount(), kNumTemps, LocationSummary::kCall); 5305 zone, InputCount(), kNumTemps, LocationSummary::kCall);
5306 // EDI is chosen because it is callee saved so we do not need to back it 5306 // EDI is chosen because it is callee saved so we do not need to back it
5307 // up before calling into the runtime. 5307 // up before calling into the runtime.
5308 result->set_temp(0, Location::RegisterLocation(EDI)); 5308 result->set_temp(0, Location::RegisterLocation(EDI));
5309 result->set_in(0, Location::FpuRegisterLocation(XMM1)); 5309 result->set_in(0, Location::FpuRegisterLocation(XMM1));
5310 if (InputCount() == 2) { 5310 if (InputCount() == 2) {
5311 result->set_in(1, Location::FpuRegisterLocation(XMM2)); 5311 result->set_in(1, Location::FpuRegisterLocation(XMM2));
5312 } 5312 }
5313 if (recognized_kind() == MethodRecognizer::kMathDoublePow) { 5313 if (recognized_kind() == MethodRecognizer::kMathDoublePow) {
5314 // Temp index 1. 5314 // Temp index 1.
5315 result->set_temp(1, Location::RegisterLocation(EAX)); 5315 result->set_temp(1, Location::RegisterLocation(EAX));
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
5467 } 5467 }
5468 5468
5469 __ CallRuntime(TargetFunction(), InputCount()); 5469 __ CallRuntime(TargetFunction(), InputCount());
5470 __ fstpl(Address(ESP, 0)); 5470 __ fstpl(Address(ESP, 0));
5471 __ movsd(locs()->out(0).fpu_reg(), Address(ESP, 0)); 5471 __ movsd(locs()->out(0).fpu_reg(), Address(ESP, 0));
5472 // Restore ESP. 5472 // Restore ESP.
5473 __ movl(ESP, locs()->temp(kSavedSpTempIndex).reg()); 5473 __ movl(ESP, locs()->temp(kSavedSpTempIndex).reg());
5474 } 5474 }
5475 5475
5476 5476
5477 LocationSummary* ExtractNthOutputInstr::MakeLocationSummary(Isolate* isolate, 5477 LocationSummary* ExtractNthOutputInstr::MakeLocationSummary(Zone* zone,
5478 bool opt) const { 5478 bool opt) const {
5479 // Only use this instruction in optimized code. 5479 // Only use this instruction in optimized code.
5480 ASSERT(opt); 5480 ASSERT(opt);
5481 const intptr_t kNumInputs = 1; 5481 const intptr_t kNumInputs = 1;
5482 LocationSummary* summary = new(isolate) LocationSummary( 5482 LocationSummary* summary = new(zone) LocationSummary(
5483 isolate, kNumInputs, 0, LocationSummary::kNoCall); 5483 zone, kNumInputs, 0, LocationSummary::kNoCall);
5484 if (representation() == kUnboxedDouble) { 5484 if (representation() == kUnboxedDouble) {
5485 if (index() == 0) { 5485 if (index() == 0) {
5486 summary->set_in(0, Location::Pair(Location::RequiresFpuRegister(), 5486 summary->set_in(0, Location::Pair(Location::RequiresFpuRegister(),
5487 Location::Any())); 5487 Location::Any()));
5488 } else { 5488 } else {
5489 ASSERT(index() == 1); 5489 ASSERT(index() == 1);
5490 summary->set_in(0, Location::Pair(Location::Any(), 5490 summary->set_in(0, Location::Pair(Location::Any(),
5491 Location::RequiresFpuRegister())); 5491 Location::RequiresFpuRegister()));
5492 } 5492 }
5493 summary->set_out(0, Location::RequiresFpuRegister()); 5493 summary->set_out(0, Location::RequiresFpuRegister());
(...skipping 23 matching lines...) Expand all
5517 __ movaps(out, in); 5517 __ movaps(out, in);
5518 } else { 5518 } else {
5519 ASSERT(representation() == kTagged); 5519 ASSERT(representation() == kTagged);
5520 Register out = locs()->out(0).reg(); 5520 Register out = locs()->out(0).reg();
5521 Register in = in_loc.reg(); 5521 Register in = in_loc.reg();
5522 __ movl(out, in); 5522 __ movl(out, in);
5523 } 5523 }
5524 } 5524 }
5525 5525
5526 5526
5527 LocationSummary* MergedMathInstr::MakeLocationSummary(Isolate* isolate, 5527 LocationSummary* MergedMathInstr::MakeLocationSummary(Zone* zone,
5528 bool opt) const { 5528 bool opt) const {
5529 if (kind() == MergedMathInstr::kTruncDivMod) { 5529 if (kind() == MergedMathInstr::kTruncDivMod) {
5530 const intptr_t kNumInputs = 2; 5530 const intptr_t kNumInputs = 2;
5531 const intptr_t kNumTemps = 0; 5531 const intptr_t kNumTemps = 0;
5532 LocationSummary* summary = new(isolate) LocationSummary( 5532 LocationSummary* summary = new(zone) LocationSummary(
5533 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5533 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5534 // Both inputs must be writable because they will be untagged. 5534 // Both inputs must be writable because they will be untagged.
5535 summary->set_in(0, Location::RegisterLocation(EAX)); 5535 summary->set_in(0, Location::RegisterLocation(EAX));
5536 summary->set_in(1, Location::WritableRegister()); 5536 summary->set_in(1, Location::WritableRegister());
5537 // Output is a pair of registers. 5537 // Output is a pair of registers.
5538 summary->set_out(0, Location::Pair(Location::RegisterLocation(EAX), 5538 summary->set_out(0, Location::Pair(Location::RegisterLocation(EAX),
5539 Location::RegisterLocation(EDX))); 5539 Location::RegisterLocation(EDX)));
5540 return summary; 5540 return summary;
5541 } 5541 }
5542 if (kind() == MergedMathInstr::kSinCos) { 5542 if (kind() == MergedMathInstr::kSinCos) {
5543 const intptr_t kNumInputs = 1; 5543 const intptr_t kNumInputs = 1;
5544 const intptr_t kNumTemps = 0; 5544 const intptr_t kNumTemps = 0;
5545 LocationSummary* summary = new(isolate) LocationSummary( 5545 LocationSummary* summary = new(zone) LocationSummary(
5546 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5546 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5547 summary->set_in(0, Location::RequiresFpuRegister()); 5547 summary->set_in(0, Location::RequiresFpuRegister());
5548 summary->set_out(0, Location::Pair(Location::RequiresFpuRegister(), 5548 summary->set_out(0, Location::Pair(Location::RequiresFpuRegister(),
5549 Location::RequiresFpuRegister())); 5549 Location::RequiresFpuRegister()));
5550 return summary; 5550 return summary;
5551 } 5551 }
5552 UNIMPLEMENTED(); 5552 UNIMPLEMENTED();
5553 return NULL; 5553 return NULL;
5554 } 5554 }
5555 5555
5556 5556
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
5650 __ movsd(out2, Address(ESP, 0)); 5650 __ movsd(out2, Address(ESP, 0));
5651 __ addl(ESP, Immediate(2 * kWordSize)); 5651 __ addl(ESP, Immediate(2 * kWordSize));
5652 return; 5652 return;
5653 } 5653 }
5654 5654
5655 UNIMPLEMENTED(); 5655 UNIMPLEMENTED();
5656 } 5656 }
5657 5657
5658 5658
5659 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary( 5659 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary(
5660 Isolate* isolate, bool opt) const { 5660 Zone* zone, bool opt) const {
5661 return MakeCallSummary(isolate); 5661 return MakeCallSummary(zone);
5662 } 5662 }
5663 5663
5664 5664
5665 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5665 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5666 ASSERT(ic_data().NumArgsTested() == 1); 5666 ASSERT(ic_data().NumArgsTested() == 1);
5667 if (!with_checks()) { 5667 if (!with_checks()) {
5668 ASSERT(ic_data().HasOneTarget()); 5668 ASSERT(ic_data().HasOneTarget());
5669 const Function& target = Function::ZoneHandle(ic_data().GetTargetAt(0)); 5669 const Function& target = Function::ZoneHandle(ic_data().GetTargetAt(0));
5670 compiler->GenerateStaticCall(deopt_id(), 5670 compiler->GenerateStaticCall(deopt_id(),
5671 instance_call()->token_pos(), 5671 instance_call()->token_pos(),
(...skipping 18 matching lines...) Expand all
5690 EDI, // Class id register. 5690 EDI, // Class id register.
5691 instance_call()->ArgumentCount(), 5691 instance_call()->ArgumentCount(),
5692 instance_call()->argument_names(), 5692 instance_call()->argument_names(),
5693 deopt, 5693 deopt,
5694 deopt_id(), 5694 deopt_id(),
5695 instance_call()->token_pos(), 5695 instance_call()->token_pos(),
5696 locs()); 5696 locs());
5697 } 5697 }
5698 5698
5699 5699
5700 LocationSummary* BranchInstr::MakeLocationSummary(Isolate* isolate, 5700 LocationSummary* BranchInstr::MakeLocationSummary(Zone* zone,
5701 bool opt) const { 5701 bool opt) const {
5702 comparison()->InitializeLocationSummary(isolate, opt); 5702 comparison()->InitializeLocationSummary(zone, opt);
5703 // Branches don't produce a result. 5703 // Branches don't produce a result.
5704 comparison()->locs()->set_out(0, Location::NoLocation()); 5704 comparison()->locs()->set_out(0, Location::NoLocation());
5705 return comparison()->locs(); 5705 return comparison()->locs();
5706 } 5706 }
5707 5707
5708 5708
5709 void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5709 void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5710 comparison()->EmitBranchCode(compiler, this); 5710 comparison()->EmitBranchCode(compiler, this);
5711 } 5711 }
5712 5712
5713 5713
5714 LocationSummary* CheckClassInstr::MakeLocationSummary(Isolate* isolate, 5714 LocationSummary* CheckClassInstr::MakeLocationSummary(Zone* zone,
5715 bool opt) const { 5715 bool opt) const {
5716 const intptr_t kNumInputs = 1; 5716 const intptr_t kNumInputs = 1;
5717 const bool need_mask_temp = IsDenseSwitch() && !IsDenseMask(ComputeCidMask()); 5717 const bool need_mask_temp = IsDenseSwitch() && !IsDenseMask(ComputeCidMask());
5718 const intptr_t kNumTemps = !IsNullCheck() ? (need_mask_temp ? 2 : 1) : 0; 5718 const intptr_t kNumTemps = !IsNullCheck() ? (need_mask_temp ? 2 : 1) : 0;
5719 LocationSummary* summary = new(isolate) LocationSummary( 5719 LocationSummary* summary = new(zone) LocationSummary(
5720 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5720 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5721 summary->set_in(0, Location::RequiresRegister()); 5721 summary->set_in(0, Location::RequiresRegister());
5722 if (!IsNullCheck()) { 5722 if (!IsNullCheck()) {
5723 summary->set_temp(0, Location::RequiresRegister()); 5723 summary->set_temp(0, Location::RequiresRegister());
5724 if (need_mask_temp) { 5724 if (need_mask_temp) {
5725 summary->set_temp(1, Location::RequiresRegister()); 5725 summary->set_temp(1, Location::RequiresRegister());
5726 } 5726 }
5727 } 5727 }
5728 return summary; 5728 return summary;
5729 } 5729 }
5730 5730
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
5786 } else { 5786 } else {
5787 __ j(EQUAL, &is_ok); 5787 __ j(EQUAL, &is_ok);
5788 } 5788 }
5789 } 5789 }
5790 } 5790 }
5791 } 5791 }
5792 __ Bind(&is_ok); 5792 __ Bind(&is_ok);
5793 } 5793 }
5794 5794
5795 5795
5796 LocationSummary* CheckSmiInstr::MakeLocationSummary(Isolate* isolate, 5796 LocationSummary* CheckSmiInstr::MakeLocationSummary(Zone* zone,
5797 bool opt) const { 5797 bool opt) const {
5798 const intptr_t kNumInputs = 1; 5798 const intptr_t kNumInputs = 1;
5799 const intptr_t kNumTemps = 0; 5799 const intptr_t kNumTemps = 0;
5800 LocationSummary* summary = new(isolate) LocationSummary( 5800 LocationSummary* summary = new(zone) LocationSummary(
5801 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5801 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5802 summary->set_in(0, Location::RequiresRegister()); 5802 summary->set_in(0, Location::RequiresRegister());
5803 return summary; 5803 return summary;
5804 } 5804 }
5805 5805
5806 5806
5807 void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5807 void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5808 Register value = locs()->in(0).reg(); 5808 Register value = locs()->in(0).reg();
5809 Label* deopt = compiler->AddDeoptStub(deopt_id(), 5809 Label* deopt = compiler->AddDeoptStub(deopt_id(),
5810 ICData::kDeoptCheckSmi, 5810 ICData::kDeoptCheckSmi,
5811 licm_hoisted_ ? ICData::kHoisted : 0); 5811 licm_hoisted_ ? ICData::kHoisted : 0);
5812 __ testl(value, Immediate(kSmiTagMask)); 5812 __ testl(value, Immediate(kSmiTagMask));
5813 __ j(NOT_ZERO, deopt); 5813 __ j(NOT_ZERO, deopt);
5814 } 5814 }
5815 5815
5816 5816
5817 LocationSummary* CheckClassIdInstr::MakeLocationSummary(Isolate* isolate, 5817 LocationSummary* CheckClassIdInstr::MakeLocationSummary(Zone* zone,
5818 bool opt) const { 5818 bool opt) const {
5819 const intptr_t kNumInputs = 1; 5819 const intptr_t kNumInputs = 1;
5820 const intptr_t kNumTemps = 0; 5820 const intptr_t kNumTemps = 0;
5821 LocationSummary* summary = new(isolate) LocationSummary( 5821 LocationSummary* summary = new(zone) LocationSummary(
5822 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5822 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5823 summary->set_in(0, Location::RequiresRegister()); 5823 summary->set_in(0, Location::RequiresRegister());
5824 return summary; 5824 return summary;
5825 } 5825 }
5826 5826
5827 5827
5828 void CheckClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5828 void CheckClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5829 Register value = locs()->in(0).reg(); 5829 Register value = locs()->in(0).reg();
5830 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckClass); 5830 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckClass);
5831 __ cmpl(value, Immediate(Smi::RawValue(cid_))); 5831 __ cmpl(value, Immediate(Smi::RawValue(cid_)));
5832 __ j(NOT_ZERO, deopt); 5832 __ j(NOT_ZERO, deopt);
5833 } 5833 }
5834 5834
5835 5835
5836 // Length: register or constant. 5836 // Length: register or constant.
5837 // Index: register, constant or stack slot. 5837 // Index: register, constant or stack slot.
5838 LocationSummary* CheckArrayBoundInstr::MakeLocationSummary(Isolate* isolate, 5838 LocationSummary* CheckArrayBoundInstr::MakeLocationSummary(Zone* zone,
5839 bool opt) const { 5839 bool opt) const {
5840 const intptr_t kNumInputs = 2; 5840 const intptr_t kNumInputs = 2;
5841 const intptr_t kNumTemps = 0; 5841 const intptr_t kNumTemps = 0;
5842 LocationSummary* locs = new(isolate) LocationSummary( 5842 LocationSummary* locs = new(zone) LocationSummary(
5843 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5843 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5844 if (length()->definition()->IsConstant()) { 5844 if (length()->definition()->IsConstant()) {
5845 locs->set_in(kLengthPos, Location::RegisterOrSmiConstant(length())); 5845 locs->set_in(kLengthPos, Location::RegisterOrSmiConstant(length()));
5846 } else { 5846 } else {
5847 locs->set_in(kLengthPos, Location::PrefersRegister()); 5847 locs->set_in(kLengthPos, Location::PrefersRegister());
5848 } 5848 }
5849 locs->set_in(kIndexPos, Location::RegisterOrSmiConstant(index())); 5849 locs->set_in(kIndexPos, Location::RegisterOrSmiConstant(index()));
5850 return locs; 5850 return locs;
5851 } 5851 }
5852 5852
5853 5853
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
5899 __ j(ABOVE_EQUAL, deopt); 5899 __ j(ABOVE_EQUAL, deopt);
5900 } else { 5900 } else {
5901 Register index = index_loc.reg(); 5901 Register index = index_loc.reg();
5902 Register length = length_loc.reg(); 5902 Register length = length_loc.reg();
5903 __ cmpl(length, index); 5903 __ cmpl(length, index);
5904 __ j(BELOW_EQUAL, deopt); 5904 __ j(BELOW_EQUAL, deopt);
5905 } 5905 }
5906 } 5906 }
5907 5907
5908 5908
5909 LocationSummary* BinaryMintOpInstr::MakeLocationSummary(Isolate* isolate, 5909 LocationSummary* BinaryMintOpInstr::MakeLocationSummary(Zone* zone,
5910 bool opt) const { 5910 bool opt) const {
5911 const intptr_t kNumInputs = 2; 5911 const intptr_t kNumInputs = 2;
5912 switch (op_kind()) { 5912 switch (op_kind()) {
5913 case Token::kBIT_AND: 5913 case Token::kBIT_AND:
5914 case Token::kBIT_OR: 5914 case Token::kBIT_OR:
5915 case Token::kBIT_XOR: 5915 case Token::kBIT_XOR:
5916 case Token::kADD: 5916 case Token::kADD:
5917 case Token::kSUB: 5917 case Token::kSUB:
5918 case Token::kMUL: { 5918 case Token::kMUL: {
5919 const intptr_t kNumTemps = (op_kind() == Token::kMUL) ? 1 : 0; 5919 const intptr_t kNumTemps = (op_kind() == Token::kMUL) ? 1 : 0;
5920 LocationSummary* summary = new(isolate) LocationSummary( 5920 LocationSummary* summary = new(zone) LocationSummary(
5921 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5921 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5922 summary->set_in(0, (op_kind() == Token::kMUL) 5922 summary->set_in(0, (op_kind() == Token::kMUL)
5923 ? Location::Pair(Location::RegisterLocation(EAX), 5923 ? Location::Pair(Location::RegisterLocation(EAX),
5924 Location::RegisterLocation(EDX)) 5924 Location::RegisterLocation(EDX))
5925 : Location::Pair(Location::RequiresRegister(), 5925 : Location::Pair(Location::RequiresRegister(),
5926 Location::RequiresRegister())); 5926 Location::RequiresRegister()));
5927 summary->set_in(1, Location::Pair(Location::RequiresRegister(), 5927 summary->set_in(1, Location::Pair(Location::RequiresRegister(),
5928 Location::RequiresRegister())); 5928 Location::RequiresRegister()));
5929 summary->set_out(0, Location::SameAsFirstInput()); 5929 summary->set_out(0, Location::SameAsFirstInput());
5930 if (kNumTemps > 0) { 5930 if (kNumTemps > 0) {
5931 summary->set_temp(0, Location::RequiresRegister()); 5931 summary->set_temp(0, Location::RequiresRegister());
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
6005 } 6005 }
6006 default: 6006 default:
6007 UNREACHABLE(); 6007 UNREACHABLE();
6008 } 6008 }
6009 if (FLAG_throw_on_javascript_int_overflow) { 6009 if (FLAG_throw_on_javascript_int_overflow) {
6010 EmitJavascriptIntOverflowCheck(compiler, deopt, left_lo, left_hi); 6010 EmitJavascriptIntOverflowCheck(compiler, deopt, left_lo, left_hi);
6011 } 6011 }
6012 } 6012 }
6013 6013
6014 6014
6015 LocationSummary* ShiftMintOpInstr::MakeLocationSummary(Isolate* isolate, 6015 LocationSummary* ShiftMintOpInstr::MakeLocationSummary(Zone* zone,
6016 bool opt) const { 6016 bool opt) const {
6017 const intptr_t kNumInputs = 2; 6017 const intptr_t kNumInputs = 2;
6018 const intptr_t kNumTemps = 6018 const intptr_t kNumTemps =
6019 (op_kind() == Token::kSHL) && CanDeoptimize() ? 2 : 0; 6019 (op_kind() == Token::kSHL) && CanDeoptimize() ? 2 : 0;
6020 LocationSummary* summary = new(isolate) LocationSummary( 6020 LocationSummary* summary = new(zone) LocationSummary(
6021 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 6021 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
6022 summary->set_in(0, Location::Pair(Location::RequiresRegister(), 6022 summary->set_in(0, Location::Pair(Location::RequiresRegister(),
6023 Location::RequiresRegister())); 6023 Location::RequiresRegister()));
6024 summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), ECX)); 6024 summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), ECX));
6025 if ((op_kind() == Token::kSHL) && CanDeoptimize()) { 6025 if ((op_kind() == Token::kSHL) && CanDeoptimize()) {
6026 summary->set_temp(0, Location::RequiresRegister()); 6026 summary->set_temp(0, Location::RequiresRegister());
6027 summary->set_temp(1, Location::RequiresRegister()); 6027 summary->set_temp(1, Location::RequiresRegister());
6028 } 6028 }
6029 summary->set_out(0, Location::SameAsFirstInput()); 6029 summary->set_out(0, Location::SameAsFirstInput());
6030 return summary; 6030 return summary;
6031 } 6031 }
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
6206 UNREACHABLE(); 6206 UNREACHABLE();
6207 } 6207 }
6208 __ Bind(&done); 6208 __ Bind(&done);
6209 } 6209 }
6210 if (FLAG_throw_on_javascript_int_overflow) { 6210 if (FLAG_throw_on_javascript_int_overflow) {
6211 EmitJavascriptIntOverflowCheck(compiler, deopt, left_lo, left_hi); 6211 EmitJavascriptIntOverflowCheck(compiler, deopt, left_lo, left_hi);
6212 } 6212 }
6213 } 6213 }
6214 6214
6215 6215
6216 LocationSummary* UnaryMintOpInstr::MakeLocationSummary(Isolate* isolate, 6216 LocationSummary* UnaryMintOpInstr::MakeLocationSummary(Zone* zone,
6217 bool opt) const { 6217 bool opt) const {
6218 const intptr_t kNumInputs = 1; 6218 const intptr_t kNumInputs = 1;
6219 const intptr_t kNumTemps = 0; 6219 const intptr_t kNumTemps = 0;
6220 LocationSummary* summary = new(isolate) LocationSummary( 6220 LocationSummary* summary = new(zone) LocationSummary(
6221 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 6221 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
6222 summary->set_in(0, Location::Pair(Location::RequiresRegister(), 6222 summary->set_in(0, Location::Pair(Location::RequiresRegister(),
6223 Location::RequiresRegister())); 6223 Location::RequiresRegister()));
6224 summary->set_out(0, Location::SameAsFirstInput()); 6224 summary->set_out(0, Location::SameAsFirstInput());
6225 if (FLAG_throw_on_javascript_int_overflow) { 6225 if (FLAG_throw_on_javascript_int_overflow) {
6226 summary->set_temp(0, Location::RequiresRegister()); 6226 summary->set_temp(0, Location::RequiresRegister());
6227 } 6227 }
6228 return summary; 6228 return summary;
6229 } 6229 }
6230 6230
6231 6231
(...skipping 30 matching lines...) Expand all
6262 CompileType ShiftUint32OpInstr::ComputeType() const { 6262 CompileType ShiftUint32OpInstr::ComputeType() const {
6263 return CompileType::Int(); 6263 return CompileType::Int();
6264 } 6264 }
6265 6265
6266 6266
6267 CompileType UnaryUint32OpInstr::ComputeType() const { 6267 CompileType UnaryUint32OpInstr::ComputeType() const {
6268 return CompileType::Int(); 6268 return CompileType::Int();
6269 } 6269 }
6270 6270
6271 6271
6272 LocationSummary* ShiftUint32OpInstr::MakeLocationSummary(Isolate* isolate, 6272 LocationSummary* ShiftUint32OpInstr::MakeLocationSummary(Zone* zone,
6273 bool opt) const { 6273 bool opt) const {
6274 const intptr_t kNumInputs = 2; 6274 const intptr_t kNumInputs = 2;
6275 const intptr_t kNumTemps = 0; 6275 const intptr_t kNumTemps = 0;
6276 LocationSummary* summary = new(isolate) LocationSummary( 6276 LocationSummary* summary = new(zone) LocationSummary(
6277 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 6277 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
6278 summary->set_in(0, Location::RequiresRegister()); 6278 summary->set_in(0, Location::RequiresRegister());
6279 summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), ECX)); 6279 summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), ECX));
6280 summary->set_out(0, Location::SameAsFirstInput()); 6280 summary->set_out(0, Location::SameAsFirstInput());
6281 return summary; 6281 return summary;
6282 } 6282 }
6283 6283
6284 6284
6285 void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6285 void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6286 const intptr_t kShifterLimit = 31; 6286 const intptr_t kShifterLimit = 31;
6287 6287
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
6347 6347
6348 __ Bind(&zero); 6348 __ Bind(&zero);
6349 // Shift was greater than 31 bits, just return zero. 6349 // Shift was greater than 31 bits, just return zero.
6350 __ xorl(left, left); 6350 __ xorl(left, left);
6351 6351
6352 // Exit path. 6352 // Exit path.
6353 __ Bind(&done); 6353 __ Bind(&done);
6354 } 6354 }
6355 6355
6356 6356
6357 LocationSummary* UnaryUint32OpInstr::MakeLocationSummary(Isolate* isolate, 6357 LocationSummary* UnaryUint32OpInstr::MakeLocationSummary(Zone* zone,
6358 bool opt) const { 6358 bool opt) const {
6359 const intptr_t kNumInputs = 1; 6359 const intptr_t kNumInputs = 1;
6360 const intptr_t kNumTemps = 0; 6360 const intptr_t kNumTemps = 0;
6361 LocationSummary* summary = new(isolate) LocationSummary( 6361 LocationSummary* summary = new(zone) LocationSummary(
6362 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 6362 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
6363 summary->set_in(0, Location::RequiresRegister()); 6363 summary->set_in(0, Location::RequiresRegister());
6364 summary->set_out(0, Location::SameAsFirstInput()); 6364 summary->set_out(0, Location::SameAsFirstInput());
6365 return summary; 6365 return summary;
6366 } 6366 }
6367 6367
6368 6368
6369 void UnaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6369 void UnaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6370 Register out = locs()->out(0).reg(); 6370 Register out = locs()->out(0).reg();
6371 ASSERT(locs()->in(0).reg() == out); 6371 ASSERT(locs()->in(0).reg() == out);
6372 6372
6373 ASSERT(op_kind() == Token::kBIT_NOT); 6373 ASSERT(op_kind() == Token::kBIT_NOT);
6374 6374
6375 __ notl(out); 6375 __ notl(out);
6376 } 6376 }
6377 6377
6378 6378
6379 LocationSummary* UnboxedIntConverterInstr::MakeLocationSummary(Isolate* isolate, 6379 LocationSummary* UnboxedIntConverterInstr::MakeLocationSummary(Zone* zone,
6380 bool opt) const { 6380 bool opt) const {
6381 const intptr_t kNumInputs = 1; 6381 const intptr_t kNumInputs = 1;
6382 const intptr_t kNumTemps = 0; 6382 const intptr_t kNumTemps = 0;
6383 LocationSummary* summary = new(isolate) LocationSummary( 6383 LocationSummary* summary = new(zone) LocationSummary(
6384 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 6384 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
6385 if ((from() == kUnboxedInt32 || from() == kUnboxedUint32) && 6385 if ((from() == kUnboxedInt32 || from() == kUnboxedUint32) &&
6386 (to() == kUnboxedInt32 || to() == kUnboxedUint32)) { 6386 (to() == kUnboxedInt32 || to() == kUnboxedUint32)) {
6387 summary->set_in(0, Location::RequiresRegister()); 6387 summary->set_in(0, Location::RequiresRegister());
6388 summary->set_out(0, Location::SameAsFirstInput()); 6388 summary->set_out(0, Location::SameAsFirstInput());
6389 } else if (from() == kUnboxedMint) { 6389 } else if (from() == kUnboxedMint) {
6390 summary->set_in(0, Location::Pair( 6390 summary->set_in(0, Location::Pair(
6391 CanDeoptimize() ? Location::WritableRegister() 6391 CanDeoptimize() ? Location::WritableRegister()
6392 : Location::RequiresRegister(), 6392 : Location::RequiresRegister(),
6393 Location::RequiresRegister())); 6393 Location::RequiresRegister()));
6394 summary->set_out(0, Location::RequiresRegister()); 6394 summary->set_out(0, Location::RequiresRegister());
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
6454 Register out_hi = out_pair->At(1).reg(); 6454 Register out_hi = out_pair->At(1).reg();
6455 ASSERT(locs()->in(0).reg() == EAX); 6455 ASSERT(locs()->in(0).reg() == EAX);
6456 ASSERT(out_lo == EAX && out_hi == EDX); 6456 ASSERT(out_lo == EAX && out_hi == EDX);
6457 __ cdq(); 6457 __ cdq();
6458 } else { 6458 } else {
6459 UNREACHABLE(); 6459 UNREACHABLE();
6460 } 6460 }
6461 } 6461 }
6462 6462
6463 6463
6464 LocationSummary* ThrowInstr::MakeLocationSummary(Isolate* isolate, 6464 LocationSummary* ThrowInstr::MakeLocationSummary(Zone* zone,
6465 bool opt) const { 6465 bool opt) const {
6466 return new(isolate) LocationSummary(isolate, 0, 0, LocationSummary::kCall); 6466 return new(zone) LocationSummary(zone, 0, 0, LocationSummary::kCall);
6467 } 6467 }
6468 6468
6469 6469
6470 6470
6471 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6471 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6472 compiler->GenerateRuntimeCall(token_pos(), 6472 compiler->GenerateRuntimeCall(token_pos(),
6473 deopt_id(), 6473 deopt_id(),
6474 kThrowRuntimeEntry, 6474 kThrowRuntimeEntry,
6475 1, 6475 1,
6476 locs()); 6476 locs());
6477 __ int3(); 6477 __ int3();
6478 } 6478 }
6479 6479
6480 6480
6481 LocationSummary* ReThrowInstr::MakeLocationSummary(Isolate* isolate, 6481 LocationSummary* ReThrowInstr::MakeLocationSummary(Zone* zone,
6482 bool opt) const { 6482 bool opt) const {
6483 return new(isolate) LocationSummary(isolate, 0, 0, LocationSummary::kCall); 6483 return new(zone) LocationSummary(zone, 0, 0, LocationSummary::kCall);
6484 } 6484 }
6485 6485
6486 6486
6487 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6487 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6488 compiler->SetNeedsStacktrace(catch_try_index()); 6488 compiler->SetNeedsStacktrace(catch_try_index());
6489 compiler->GenerateRuntimeCall(token_pos(), 6489 compiler->GenerateRuntimeCall(token_pos(),
6490 deopt_id(), 6490 deopt_id(),
6491 kReThrowRuntimeEntry, 6491 kReThrowRuntimeEntry,
6492 2, 6492 2,
6493 locs()); 6493 locs());
6494 __ int3(); 6494 __ int3();
6495 } 6495 }
6496 6496
6497 6497
6498 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6498 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6499 if (!compiler->CanFallThroughTo(normal_entry())) { 6499 if (!compiler->CanFallThroughTo(normal_entry())) {
6500 __ jmp(compiler->GetJumpLabel(normal_entry())); 6500 __ jmp(compiler->GetJumpLabel(normal_entry()));
6501 } 6501 }
6502 } 6502 }
6503 6503
6504 6504
6505 LocationSummary* GotoInstr::MakeLocationSummary(Isolate* isolate, 6505 LocationSummary* GotoInstr::MakeLocationSummary(Zone* zone,
6506 bool opt) const { 6506 bool opt) const {
6507 return new(isolate) LocationSummary(isolate, 0, 0, LocationSummary::kNoCall); 6507 return new(zone) LocationSummary(zone, 0, 0, LocationSummary::kNoCall);
6508 } 6508 }
6509 6509
6510 6510
6511 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6511 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6512 if (!compiler->is_optimizing()) { 6512 if (!compiler->is_optimizing()) {
6513 if (FLAG_emit_edge_counters) { 6513 if (FLAG_emit_edge_counters) {
6514 compiler->EmitEdgeCounter(); 6514 compiler->EmitEdgeCounter();
6515 } 6515 }
6516 // Add a deoptimization descriptor for deoptimizing instructions that 6516 // Add a deoptimization descriptor for deoptimizing instructions that
6517 // may be inserted before this instruction. This descriptor points 6517 // may be inserted before this instruction. This descriptor points
6518 // after the edge counter for uniformity with ARM and MIPS, where we can 6518 // after the edge counter for uniformity with ARM and MIPS, where we can
6519 // reuse pattern matching that matches backwards from the end of the 6519 // reuse pattern matching that matches backwards from the end of the
6520 // pattern. 6520 // pattern.
6521 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, 6521 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
6522 GetDeoptId(), 6522 GetDeoptId(),
6523 Scanner::kNoSourcePos); 6523 Scanner::kNoSourcePos);
6524 } 6524 }
6525 if (HasParallelMove()) { 6525 if (HasParallelMove()) {
6526 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 6526 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
6527 } 6527 }
6528 6528
6529 // We can fall through if the successor is the next block in the list. 6529 // We can fall through if the successor is the next block in the list.
6530 // Otherwise, we need a jump. 6530 // Otherwise, we need a jump.
6531 if (!compiler->CanFallThroughTo(successor())) { 6531 if (!compiler->CanFallThroughTo(successor())) {
6532 __ jmp(compiler->GetJumpLabel(successor())); 6532 __ jmp(compiler->GetJumpLabel(successor()));
6533 } 6533 }
6534 } 6534 }
6535 6535
6536 6536
6537 LocationSummary* IndirectGotoInstr::MakeLocationSummary(Isolate* isolate, 6537 LocationSummary* IndirectGotoInstr::MakeLocationSummary(Zone* zone,
6538 bool opt) const { 6538 bool opt) const {
6539 const intptr_t kNumInputs = 1; 6539 const intptr_t kNumInputs = 1;
6540 const intptr_t kNumTemps = 1; 6540 const intptr_t kNumTemps = 1;
6541 6541
6542 LocationSummary* summary = new(isolate) LocationSummary( 6542 LocationSummary* summary = new(zone) LocationSummary(
6543 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 6543 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
6544 6544
6545 summary->set_in(0, Location::RequiresRegister()); 6545 summary->set_in(0, Location::RequiresRegister());
6546 summary->set_temp(0, Location::RequiresRegister()); 6546 summary->set_temp(0, Location::RequiresRegister());
6547 6547
6548 return summary; 6548 return summary;
6549 } 6549 }
6550 6550
6551 6551
6552 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6552 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6553 Register target_address_reg = locs()->temp_slot(0)->reg(); 6553 Register target_address_reg = locs()->temp_slot(0)->reg();
6554 6554
6555 // Load from [current frame pointer] + kPcMarkerSlotFromFp. 6555 // Load from [current frame pointer] + kPcMarkerSlotFromFp.
6556 __ movl(target_address_reg, Address(EBP, kPcMarkerSlotFromFp * kWordSize)); 6556 __ movl(target_address_reg, Address(EBP, kPcMarkerSlotFromFp * kWordSize));
6557 6557
6558 // Add the offset. 6558 // Add the offset.
6559 Register offset_reg = locs()->in(0).reg(); 6559 Register offset_reg = locs()->in(0).reg();
6560 if (offset()->definition()->representation() == kTagged) { 6560 if (offset()->definition()->representation() == kTagged) {
6561 __ SmiUntag(offset_reg); 6561 __ SmiUntag(offset_reg);
6562 } 6562 }
6563 __ addl(target_address_reg, offset_reg); 6563 __ addl(target_address_reg, offset_reg);
6564 6564
6565 // Jump to the absolute address. 6565 // Jump to the absolute address.
6566 __ jmp(target_address_reg); 6566 __ jmp(target_address_reg);
6567 } 6567 }
6568 6568
6569 6569
6570 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate, 6570 LocationSummary* StrictCompareInstr::MakeLocationSummary(Zone* zone,
6571 bool opt) const { 6571 bool opt) const {
6572 const intptr_t kNumInputs = 2; 6572 const intptr_t kNumInputs = 2;
6573 const intptr_t kNumTemps = 0; 6573 const intptr_t kNumTemps = 0;
6574 if (needs_number_check()) { 6574 if (needs_number_check()) {
6575 LocationSummary* locs = new(isolate) LocationSummary( 6575 LocationSummary* locs = new(zone) LocationSummary(
6576 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 6576 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
6577 locs->set_in(0, Location::RegisterLocation(EAX)); 6577 locs->set_in(0, Location::RegisterLocation(EAX));
6578 locs->set_in(1, Location::RegisterLocation(ECX)); 6578 locs->set_in(1, Location::RegisterLocation(ECX));
6579 locs->set_out(0, Location::RegisterLocation(EAX)); 6579 locs->set_out(0, Location::RegisterLocation(EAX));
6580 return locs; 6580 return locs;
6581 } 6581 }
6582 LocationSummary* locs = new(isolate) LocationSummary( 6582 LocationSummary* locs = new(zone) LocationSummary(
6583 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 6583 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
6584 locs->set_in(0, Location::RegisterOrConstant(left())); 6584 locs->set_in(0, Location::RegisterOrConstant(left()));
6585 // Only one of the inputs can be a constant. Choose register if the first one 6585 // Only one of the inputs can be a constant. Choose register if the first one
6586 // is a constant. 6586 // is a constant.
6587 locs->set_in(1, locs->in(0).IsConstant() 6587 locs->set_in(1, locs->in(0).IsConstant()
6588 ? Location::RequiresRegister() 6588 ? Location::RequiresRegister()
6589 : Location::RegisterOrConstant(right())); 6589 : Location::RegisterOrConstant(right()));
6590 locs->set_out(0, Location::RequiresRegister()); 6590 locs->set_out(0, Location::RequiresRegister());
6591 return locs; 6591 return locs;
6592 } 6592 }
6593 6593
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
6651 } 6651 }
6652 6652
6653 6653
6654 // Detect pattern when one value is zero and another is a power of 2. 6654 // Detect pattern when one value is zero and another is a power of 2.
6655 static bool IsPowerOfTwoKind(intptr_t v1, intptr_t v2) { 6655 static bool IsPowerOfTwoKind(intptr_t v1, intptr_t v2) {
6656 return (Utils::IsPowerOfTwo(v1) && (v2 == 0)) || 6656 return (Utils::IsPowerOfTwo(v1) && (v2 == 0)) ||
6657 (Utils::IsPowerOfTwo(v2) && (v1 == 0)); 6657 (Utils::IsPowerOfTwo(v2) && (v1 == 0));
6658 } 6658 }
6659 6659
6660 6660
6661 LocationSummary* IfThenElseInstr::MakeLocationSummary(Isolate* isolate, 6661 LocationSummary* IfThenElseInstr::MakeLocationSummary(Zone* zone,
6662 bool opt) const { 6662 bool opt) const {
6663 comparison()->InitializeLocationSummary(isolate, opt); 6663 comparison()->InitializeLocationSummary(zone, opt);
6664 // TODO(vegorov): support byte register constraints in the register allocator. 6664 // TODO(vegorov): support byte register constraints in the register allocator.
6665 comparison()->locs()->set_out(0, Location::RegisterLocation(EDX)); 6665 comparison()->locs()->set_out(0, Location::RegisterLocation(EDX));
6666 return comparison()->locs(); 6666 return comparison()->locs();
6667 } 6667 }
6668 6668
6669 6669
6670 void IfThenElseInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6670 void IfThenElseInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6671 ASSERT(locs()->out(0).reg() == EDX); 6671 ASSERT(locs()->out(0).reg() == EDX);
6672 6672
6673 // Clear upper part of the out register. We are going to use setcc on it 6673 // Clear upper part of the out register. We are going to use setcc on it
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
6709 __ decl(EDX); 6709 __ decl(EDX);
6710 __ andl(EDX, Immediate( 6710 __ andl(EDX, Immediate(
6711 Smi::RawValue(true_value) - Smi::RawValue(false_value))); 6711 Smi::RawValue(true_value) - Smi::RawValue(false_value)));
6712 if (false_value != 0) { 6712 if (false_value != 0) {
6713 __ addl(EDX, Immediate(Smi::RawValue(false_value))); 6713 __ addl(EDX, Immediate(Smi::RawValue(false_value)));
6714 } 6714 }
6715 } 6715 }
6716 } 6716 }
6717 6717
6718 6718
6719 LocationSummary* ClosureCallInstr::MakeLocationSummary(Isolate* isolate, 6719 LocationSummary* ClosureCallInstr::MakeLocationSummary(Zone* zone,
6720 bool opt) const { 6720 bool opt) const {
6721 const intptr_t kNumInputs = 1; 6721 const intptr_t kNumInputs = 1;
6722 const intptr_t kNumTemps = 0; 6722 const intptr_t kNumTemps = 0;
6723 LocationSummary* summary = new(isolate) LocationSummary( 6723 LocationSummary* summary = new(zone) LocationSummary(
6724 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 6724 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
6725 summary->set_in(0, Location::RegisterLocation(EAX)); // Function. 6725 summary->set_in(0, Location::RegisterLocation(EAX)); // Function.
6726 summary->set_out(0, Location::RegisterLocation(EAX)); 6726 summary->set_out(0, Location::RegisterLocation(EAX));
6727 return summary; 6727 return summary;
6728 } 6728 }
6729 6729
6730 6730
6731 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6731 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6732 // Load arguments descriptors. 6732 // Load arguments descriptors.
6733 intptr_t argument_count = ArgumentCount(); 6733 intptr_t argument_count = ArgumentCount();
6734 const Array& arguments_descriptor = 6734 const Array& arguments_descriptor =
(...skipping 24 matching lines...) Expand all
6759 // Add deoptimization continuation point after the call and before the 6759 // Add deoptimization continuation point after the call and before the
6760 // arguments are removed. 6760 // arguments are removed.
6761 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, 6761 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
6762 deopt_id_after, 6762 deopt_id_after,
6763 token_pos()); 6763 token_pos());
6764 } 6764 }
6765 __ Drop(argument_count); 6765 __ Drop(argument_count);
6766 } 6766 }
6767 6767
6768 6768
6769 LocationSummary* BooleanNegateInstr::MakeLocationSummary(Isolate* isolate, 6769 LocationSummary* BooleanNegateInstr::MakeLocationSummary(Zone* zone,
6770 bool opt) const { 6770 bool opt) const {
6771 return LocationSummary::Make(isolate, 6771 return LocationSummary::Make(zone,
6772 1, 6772 1,
6773 Location::RequiresRegister(), 6773 Location::RequiresRegister(),
6774 LocationSummary::kNoCall); 6774 LocationSummary::kNoCall);
6775 } 6775 }
6776 6776
6777 6777
6778 void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6778 void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6779 Register value = locs()->in(0).reg(); 6779 Register value = locs()->in(0).reg();
6780 Register result = locs()->out(0).reg(); 6780 Register result = locs()->out(0).reg();
6781 6781
6782 Label done; 6782 Label done;
6783 __ LoadObject(result, Bool::True()); 6783 __ LoadObject(result, Bool::True());
6784 __ CompareRegisters(result, value); 6784 __ CompareRegisters(result, value);
6785 __ j(NOT_EQUAL, &done, Assembler::kNearJump); 6785 __ j(NOT_EQUAL, &done, Assembler::kNearJump);
6786 __ LoadObject(result, Bool::False()); 6786 __ LoadObject(result, Bool::False());
6787 __ Bind(&done); 6787 __ Bind(&done);
6788 } 6788 }
6789 6789
6790 6790
6791 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Isolate* isolate, 6791 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Zone* zone,
6792 bool opt) const { 6792 bool opt) const {
6793 return MakeCallSummary(isolate); 6793 return MakeCallSummary(zone);
6794 } 6794 }
6795 6795
6796 6796
6797 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6797 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6798 Isolate* isolate = compiler->isolate(); 6798 Isolate* isolate = compiler->isolate();
6799 StubCode* stub_code = isolate->stub_code(); 6799 StubCode* stub_code = isolate->stub_code();
6800 const Code& stub = Code::Handle(isolate, 6800 const Code& stub = Code::Handle(isolate,
6801 stub_code->GetAllocationStubForClass(cls())); 6801 stub_code->GetAllocationStubForClass(cls()));
6802 const ExternalLabel label(stub.EntryPoint()); 6802 const ExternalLabel label(stub.EntryPoint());
6803 compiler->GenerateCall(token_pos(), 6803 compiler->GenerateCall(token_pos(),
(...skipping 13 matching lines...) Expand all
6817 #if defined(DEBUG) 6817 #if defined(DEBUG)
6818 __ movl(EDX, Immediate(kInvalidObjectPointer)); 6818 __ movl(EDX, Immediate(kInvalidObjectPointer));
6819 #endif 6819 #endif
6820 } 6820 }
6821 6821
6822 } // namespace dart 6822 } // namespace dart
6823 6823
6824 #undef __ 6824 #undef __
6825 6825
6826 #endif // defined TARGET_ARCH_IA32 6826 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm64.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698