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

Side by Side Diff: runtime/vm/intermediate_language_x64.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_mips.cc ('k') | runtime/vm/locations.h » ('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_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
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, throw_on_javascript_int_overflow); 30 DECLARE_FLAG(bool, throw_on_javascript_int_overflow);
31 DECLARE_FLAG(bool, use_osr); 31 DECLARE_FLAG(bool, use_osr);
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 RAX. 34 // on the stack and return the result in a fixed register RAX.
35 LocationSummary* Instruction::MakeCallSummary(Isolate* isolate) { 35 LocationSummary* Instruction::MakeCallSummary(Zone* zone) {
36 LocationSummary* result = new(isolate) LocationSummary( 36 LocationSummary* result = new(zone) LocationSummary(
37 Isolate::Current(), 0, 0, LocationSummary::kCall); 37 zone, 0, 0, LocationSummary::kCall);
38 result->set_out(0, Location::RegisterLocation(RAX)); 38 result->set_out(0, Location::RegisterLocation(RAX));
39 return result; 39 return result;
40 } 40 }
41 41
42 42
43 LocationSummary* PushArgumentInstr::MakeLocationSummary(Isolate* isolate, 43 LocationSummary* PushArgumentInstr::MakeLocationSummary(Zone* zone,
44 bool opt) const { 44 bool opt) const {
45 const intptr_t kNumInputs = 1; 45 const intptr_t kNumInputs = 1;
46 const intptr_t kNumTemps = 0; 46 const intptr_t kNumTemps = 0;
47 LocationSummary* locs = new(isolate) LocationSummary( 47 LocationSummary* locs = new(zone) LocationSummary(
48 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 48 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
49 locs->set_in(0, Location::AnyOrConstant(value())); 49 locs->set_in(0, Location::AnyOrConstant(value()));
50 return locs; 50 return locs;
51 } 51 }
52 52
53 53
54 void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 54 void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
55 // In SSA mode, we need an explicit push. Nothing to do in non-SSA mode 55 // In SSA mode, we need an explicit push. Nothing to do in non-SSA mode
56 // where PushArgument is handled by BindInstr::EmitNativeCode. 56 // where PushArgument is handled by BindInstr::EmitNativeCode.
57 if (compiler->is_optimizing()) { 57 if (compiler->is_optimizing()) {
58 Location value = locs()->in(0); 58 Location value = locs()->in(0);
59 if (value.IsRegister()) { 59 if (value.IsRegister()) {
60 __ pushq(value.reg()); 60 __ pushq(value.reg());
61 } else if (value.IsConstant()) { 61 } else if (value.IsConstant()) {
62 __ PushObject(value.constant(), PP); 62 __ PushObject(value.constant(), PP);
63 } else { 63 } else {
64 ASSERT(value.IsStackSlot()); 64 ASSERT(value.IsStackSlot());
65 __ pushq(value.ToStackSlotAddress()); 65 __ pushq(value.ToStackSlotAddress());
66 } 66 }
67 } 67 }
68 } 68 }
69 69
70 70
71 LocationSummary* ReturnInstr::MakeLocationSummary(Isolate* isolate, 71 LocationSummary* ReturnInstr::MakeLocationSummary(Zone* zone,
72 bool opt) const { 72 bool opt) const {
73 const intptr_t kNumInputs = 1; 73 const intptr_t kNumInputs = 1;
74 const intptr_t kNumTemps = 0; 74 const intptr_t kNumTemps = 0;
75 LocationSummary* locs = new(isolate) LocationSummary( 75 LocationSummary* locs = new(zone) LocationSummary(
76 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 76 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
77 locs->set_in(0, Location::RegisterLocation(RAX)); 77 locs->set_in(0, Location::RegisterLocation(RAX));
78 return locs; 78 return locs;
79 } 79 }
80 80
81 81
82 // Attempt optimized compilation at return instruction instead of at the entry. 82 // Attempt optimized compilation at return instruction instead of at the entry.
83 // The entry needs to be patchable, no inlined objects are allowed in the area 83 // The entry needs to be patchable, no inlined objects are allowed in the area
84 // that will be overwritten by the patch instruction: a jump). 84 // that will be overwritten by the patch instruction: a jump).
85 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 85 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
86 Register result = locs()->in(0).reg(); 86 Register result = locs()->in(0).reg();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 129 }
130 130
131 131
132 // Detect pattern when one value is zero and another is a power of 2. 132 // Detect pattern when one value is zero and another is a power of 2.
133 static bool IsPowerOfTwoKind(intptr_t v1, intptr_t v2) { 133 static bool IsPowerOfTwoKind(intptr_t v1, intptr_t v2) {
134 return (Utils::IsPowerOfTwo(v1) && (v2 == 0)) || 134 return (Utils::IsPowerOfTwo(v1) && (v2 == 0)) ||
135 (Utils::IsPowerOfTwo(v2) && (v1 == 0)); 135 (Utils::IsPowerOfTwo(v2) && (v1 == 0));
136 } 136 }
137 137
138 138
139 LocationSummary* IfThenElseInstr::MakeLocationSummary(Isolate* isolate, 139 LocationSummary* IfThenElseInstr::MakeLocationSummary(Zone* zone,
140 bool opt) const { 140 bool opt) const {
141 comparison()->InitializeLocationSummary(isolate, opt); 141 comparison()->InitializeLocationSummary(zone, opt);
142 // TODO(vegorov): support byte register constraints in the register allocator. 142 // TODO(vegorov): support byte register constraints in the register allocator.
143 comparison()->locs()->set_out(0, Location::RegisterLocation(RDX)); 143 comparison()->locs()->set_out(0, Location::RegisterLocation(RDX));
144 return comparison()->locs(); 144 return comparison()->locs();
145 } 145 }
146 146
147 147
148 void IfThenElseInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 148 void IfThenElseInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
149 ASSERT(locs()->out(0).reg() == RDX); 149 ASSERT(locs()->out(0).reg() == RDX);
150 150
151 // Clear upper part of the out register. We are going to use setcc on it 151 // 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
187 __ decq(RDX); 187 __ decq(RDX);
188 __ AndImmediate(RDX, 188 __ AndImmediate(RDX,
189 Immediate(Smi::RawValue(true_value) - Smi::RawValue(false_value)), PP); 189 Immediate(Smi::RawValue(true_value) - Smi::RawValue(false_value)), PP);
190 if (false_value != 0) { 190 if (false_value != 0) {
191 __ AddImmediate(RDX, Immediate(Smi::RawValue(false_value)), PP); 191 __ AddImmediate(RDX, Immediate(Smi::RawValue(false_value)), PP);
192 } 192 }
193 } 193 }
194 } 194 }
195 195
196 196
197 LocationSummary* LoadLocalInstr::MakeLocationSummary(Isolate* isolate, 197 LocationSummary* LoadLocalInstr::MakeLocationSummary(Zone* zone,
198 bool opt) const { 198 bool opt) const {
199 const intptr_t kNumInputs = 0; 199 const intptr_t kNumInputs = 0;
200 const intptr_t stack_index = (local().index() < 0) 200 const intptr_t stack_index = (local().index() < 0)
201 ? kFirstLocalSlotFromFp - local().index() 201 ? kFirstLocalSlotFromFp - local().index()
202 : kParamEndSlotFromFp - local().index(); 202 : kParamEndSlotFromFp - local().index();
203 return LocationSummary::Make(isolate, 203 return LocationSummary::Make(zone,
204 kNumInputs, 204 kNumInputs,
205 Location::StackSlot(stack_index), 205 Location::StackSlot(stack_index),
206 LocationSummary::kNoCall); 206 LocationSummary::kNoCall);
207 } 207 }
208 208
209 209
210 void LoadLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 210 void LoadLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
211 ASSERT(!compiler->is_optimizing()); 211 ASSERT(!compiler->is_optimizing());
212 // Nothing to do. 212 // Nothing to do.
213 } 213 }
214 214
215 215
216 LocationSummary* StoreLocalInstr::MakeLocationSummary(Isolate* isolate, 216 LocationSummary* StoreLocalInstr::MakeLocationSummary(Zone* zone,
217 bool opt) const { 217 bool opt) const {
218 const intptr_t kNumInputs = 1; 218 const intptr_t kNumInputs = 1;
219 return LocationSummary::Make(isolate, 219 return LocationSummary::Make(zone,
220 kNumInputs, 220 kNumInputs,
221 Location::SameAsFirstInput(), 221 Location::SameAsFirstInput(),
222 LocationSummary::kNoCall); 222 LocationSummary::kNoCall);
223 } 223 }
224 224
225 225
226 void StoreLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 226 void StoreLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
227 Register value = locs()->in(0).reg(); 227 Register value = locs()->in(0).reg();
228 Register result = locs()->out(0).reg(); 228 Register result = locs()->out(0).reg();
229 ASSERT(result == value); // Assert that register assignment is correct. 229 ASSERT(result == value); // Assert that register assignment is correct.
230 __ movq(Address(RBP, local().index() * kWordSize), value); 230 __ movq(Address(RBP, local().index() * kWordSize), value);
231 } 231 }
232 232
233 233
234 LocationSummary* ConstantInstr::MakeLocationSummary(Isolate* isolate, 234 LocationSummary* ConstantInstr::MakeLocationSummary(Zone* zone,
235 bool opt) const { 235 bool opt) const {
236 const intptr_t kNumInputs = 0; 236 const intptr_t kNumInputs = 0;
237 return LocationSummary::Make(isolate, 237 return LocationSummary::Make(zone,
238 kNumInputs, 238 kNumInputs,
239 Location::RequiresRegister(), 239 Location::RequiresRegister(),
240 LocationSummary::kNoCall); 240 LocationSummary::kNoCall);
241 } 241 }
242 242
243 243
244 void ConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 244 void ConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
245 // The register allocator drops constant definitions that have no uses. 245 // The register allocator drops constant definitions that have no uses.
246 if (!locs()->out(0).IsInvalid()) { 246 if (!locs()->out(0).IsInvalid()) {
247 Register result = locs()->out(0).reg(); 247 Register result = locs()->out(0).reg();
248 __ LoadObject(result, value(), PP); 248 __ LoadObject(result, value(), PP);
249 } 249 }
250 } 250 }
251 251
252 252
253 LocationSummary* UnboxedConstantInstr::MakeLocationSummary(Isolate* isolate, 253 LocationSummary* UnboxedConstantInstr::MakeLocationSummary(Zone* zone,
254 bool opt) const { 254 bool opt) const {
255 const intptr_t kNumInputs = 0; 255 const intptr_t kNumInputs = 0;
256 const intptr_t kNumTemps = 0; 256 const intptr_t kNumTemps = 0;
257 LocationSummary* locs = new(isolate) LocationSummary( 257 LocationSummary* locs = new(zone) LocationSummary(
258 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 258 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
259 switch (representation()) { 259 switch (representation()) {
260 case kUnboxedDouble: 260 case kUnboxedDouble:
261 locs->set_out(0, Location::RequiresFpuRegister()); 261 locs->set_out(0, Location::RequiresFpuRegister());
262 break; 262 break;
263 case kUnboxedInt32: 263 case kUnboxedInt32:
264 locs->set_out(0, Location::RequiresRegister()); 264 locs->set_out(0, Location::RequiresRegister());
265 break; 265 break;
266 default: 266 default:
267 UNREACHABLE(); 267 UNREACHABLE();
268 break; 268 break;
(...skipping 20 matching lines...) Expand all
289 __ movl(locs()->out(0).reg(), 289 __ movl(locs()->out(0).reg(),
290 Immediate(static_cast<int32_t>(Smi::Cast(value()).Value()))); 290 Immediate(static_cast<int32_t>(Smi::Cast(value()).Value())));
291 break; 291 break;
292 default: 292 default:
293 UNREACHABLE(); 293 UNREACHABLE();
294 } 294 }
295 } 295 }
296 } 296 }
297 297
298 298
299 LocationSummary* AssertAssignableInstr::MakeLocationSummary(Isolate* isolate, 299 LocationSummary* AssertAssignableInstr::MakeLocationSummary(Zone* zone,
300 bool opt) const { 300 bool opt) const {
301 const intptr_t kNumInputs = 3; 301 const intptr_t kNumInputs = 3;
302 const intptr_t kNumTemps = 0; 302 const intptr_t kNumTemps = 0;
303 LocationSummary* summary = new(isolate) LocationSummary( 303 LocationSummary* summary = new(zone) LocationSummary(
304 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 304 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
305 summary->set_in(0, Location::RegisterLocation(RAX)); // Value. 305 summary->set_in(0, Location::RegisterLocation(RAX)); // Value.
306 summary->set_in(1, Location::RegisterLocation(RCX)); // Instantiator. 306 summary->set_in(1, Location::RegisterLocation(RCX)); // Instantiator.
307 summary->set_in(2, Location::RegisterLocation(RDX)); // Type arguments. 307 summary->set_in(2, Location::RegisterLocation(RDX)); // Type arguments.
308 summary->set_out(0, Location::RegisterLocation(RAX)); 308 summary->set_out(0, Location::RegisterLocation(RAX));
309 return summary; 309 return summary;
310 } 310 }
311 311
312 312
313 LocationSummary* AssertBooleanInstr::MakeLocationSummary(Isolate* isolate, 313 LocationSummary* AssertBooleanInstr::MakeLocationSummary(Zone* zone,
314 bool opt) const { 314 bool opt) const {
315 const intptr_t kNumInputs = 1; 315 const intptr_t kNumInputs = 1;
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::kCall); 318 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
319 locs->set_in(0, Location::RegisterLocation(RAX)); 319 locs->set_in(0, Location::RegisterLocation(RAX));
320 locs->set_out(0, Location::RegisterLocation(RAX)); 320 locs->set_out(0, Location::RegisterLocation(RAX));
321 return locs; 321 return locs;
322 } 322 }
323 323
324 324
325 static void EmitAssertBoolean(Register reg, 325 static void EmitAssertBoolean(Register reg,
326 intptr_t token_pos, 326 intptr_t token_pos,
327 intptr_t deopt_id, 327 intptr_t deopt_id,
328 LocationSummary* locs, 328 LocationSummary* locs,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 case Token::kGT: return GREATER; 372 case Token::kGT: return GREATER;
373 case Token::kLTE: return LESS_EQUAL; 373 case Token::kLTE: return LESS_EQUAL;
374 case Token::kGTE: return GREATER_EQUAL; 374 case Token::kGTE: return GREATER_EQUAL;
375 default: 375 default:
376 UNREACHABLE(); 376 UNREACHABLE();
377 return OVERFLOW; 377 return OVERFLOW;
378 } 378 }
379 } 379 }
380 380
381 381
382 LocationSummary* EqualityCompareInstr::MakeLocationSummary(Isolate* isolate, 382 LocationSummary* EqualityCompareInstr::MakeLocationSummary(Zone* zone,
383 bool opt) const { 383 bool opt) const {
384 const intptr_t kNumInputs = 2; 384 const intptr_t kNumInputs = 2;
385 if (operation_cid() == kMintCid) { 385 if (operation_cid() == kMintCid) {
386 const intptr_t kNumTemps = 0; 386 const intptr_t kNumTemps = 0;
387 LocationSummary* locs = new(isolate) LocationSummary( 387 LocationSummary* locs = new(zone) LocationSummary(
388 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 388 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
389 locs->set_in(0, Location::RequiresRegister()); 389 locs->set_in(0, Location::RequiresRegister());
390 locs->set_in(1, Location::RequiresRegister()); 390 locs->set_in(1, Location::RequiresRegister());
391 locs->set_out(0, Location::RequiresRegister()); 391 locs->set_out(0, Location::RequiresRegister());
392 return locs; 392 return locs;
393 } 393 }
394 if (operation_cid() == kDoubleCid) { 394 if (operation_cid() == kDoubleCid) {
395 const intptr_t kNumTemps = 0; 395 const intptr_t kNumTemps = 0;
396 LocationSummary* locs = new(isolate) LocationSummary( 396 LocationSummary* locs = new(zone) LocationSummary(
397 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 397 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
398 locs->set_in(0, Location::RequiresFpuRegister()); 398 locs->set_in(0, Location::RequiresFpuRegister());
399 locs->set_in(1, Location::RequiresFpuRegister()); 399 locs->set_in(1, Location::RequiresFpuRegister());
400 locs->set_out(0, Location::RequiresRegister()); 400 locs->set_out(0, Location::RequiresRegister());
401 return locs; 401 return locs;
402 } 402 }
403 if (operation_cid() == kSmiCid) { 403 if (operation_cid() == kSmiCid) {
404 const intptr_t kNumTemps = 0; 404 const intptr_t kNumTemps = 0;
405 LocationSummary* locs = new(isolate) LocationSummary( 405 LocationSummary* locs = new(zone) LocationSummary(
406 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 406 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
407 locs->set_in(0, Location::RegisterOrConstant(left())); 407 locs->set_in(0, Location::RegisterOrConstant(left()));
408 // Only one input can be a constant operand. The case of two constant 408 // Only one input can be a constant operand. The case of two constant
409 // operands should be handled by constant propagation. 409 // operands should be handled by constant propagation.
410 // Only right can be a stack slot. 410 // Only right can be a stack slot.
411 locs->set_in(1, locs->in(0).IsConstant() 411 locs->set_in(1, locs->in(0).IsConstant()
412 ? Location::RequiresRegister() 412 ? Location::RequiresRegister()
413 : Location::RegisterOrConstant(right())); 413 : Location::RegisterOrConstant(right()));
414 locs->set_out(0, Location::RequiresRegister()); 414 locs->set_out(0, Location::RequiresRegister());
415 return locs; 415 return locs;
416 } 416 }
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 void EqualityCompareInstr::EmitBranchCode(FlowGraphCompiler* compiler, 565 void EqualityCompareInstr::EmitBranchCode(FlowGraphCompiler* compiler,
566 BranchInstr* branch) { 566 BranchInstr* branch) {
567 ASSERT((kind() == Token::kNE) || (kind() == Token::kEQ)); 567 ASSERT((kind() == Token::kNE) || (kind() == Token::kEQ));
568 568
569 BranchLabels labels = compiler->CreateBranchLabels(branch); 569 BranchLabels labels = compiler->CreateBranchLabels(branch);
570 Condition true_condition = EmitComparisonCode(compiler, labels); 570 Condition true_condition = EmitComparisonCode(compiler, labels);
571 EmitBranchOnCondition(compiler, true_condition, labels); 571 EmitBranchOnCondition(compiler, true_condition, labels);
572 } 572 }
573 573
574 574
575 LocationSummary* TestSmiInstr::MakeLocationSummary(Isolate* isolate, 575 LocationSummary* TestSmiInstr::MakeLocationSummary(Zone* zone,
576 bool opt) const { 576 bool opt) const {
577 const intptr_t kNumInputs = 2; 577 const intptr_t kNumInputs = 2;
578 const intptr_t kNumTemps = 0; 578 const intptr_t kNumTemps = 0;
579 LocationSummary* locs = new(isolate) LocationSummary( 579 LocationSummary* locs = new(zone) LocationSummary(
580 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 580 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
581 locs->set_in(0, Location::RequiresRegister()); 581 locs->set_in(0, Location::RequiresRegister());
582 // Only one input can be a constant operand. The case of two constant 582 // Only one input can be a constant operand. The case of two constant
583 // operands should be handled by constant propagation. 583 // operands should be handled by constant propagation.
584 locs->set_in(1, Location::RegisterOrConstant(right())); 584 locs->set_in(1, Location::RegisterOrConstant(right()));
585 return locs; 585 return locs;
586 } 586 }
587 587
588 588
589 Condition TestSmiInstr::EmitComparisonCode(FlowGraphCompiler* compiler, 589 Condition TestSmiInstr::EmitComparisonCode(FlowGraphCompiler* compiler,
590 BranchLabels labels) { 590 BranchLabels labels) {
(...skipping 20 matching lines...) Expand all
611 611
612 void TestSmiInstr::EmitBranchCode(FlowGraphCompiler* compiler, 612 void TestSmiInstr::EmitBranchCode(FlowGraphCompiler* compiler,
613 BranchInstr* branch) { 613 BranchInstr* branch) {
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 620
621 LocationSummary* TestCidsInstr::MakeLocationSummary(Isolate* isolate, 621 LocationSummary* TestCidsInstr::MakeLocationSummary(Zone* zone,
622 bool opt) const { 622 bool opt) const {
623 const intptr_t kNumInputs = 1; 623 const intptr_t kNumInputs = 1;
624 const intptr_t kNumTemps = 1; 624 const intptr_t kNumTemps = 1;
625 LocationSummary* locs = new(isolate) LocationSummary( 625 LocationSummary* locs = new(zone) LocationSummary(
626 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 626 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
627 locs->set_in(0, Location::RequiresRegister()); 627 locs->set_in(0, Location::RequiresRegister());
628 locs->set_temp(0, Location::RequiresRegister()); 628 locs->set_temp(0, Location::RequiresRegister());
629 locs->set_out(0, Location::RequiresRegister()); 629 locs->set_out(0, Location::RequiresRegister());
630 return locs; 630 return locs;
631 } 631 }
632 632
633 633
634 Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler, 634 Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler,
635 BranchLabels labels) { 635 BranchLabels labels) {
636 ASSERT((kind() == Token::kIS) || (kind() == Token::kISNOT)); 636 ASSERT((kind() == Token::kIS) || (kind() == Token::kISNOT));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 EmitComparisonCode(compiler, labels); 683 EmitComparisonCode(compiler, labels);
684 __ Bind(&is_false); 684 __ Bind(&is_false);
685 __ LoadObject(result_reg, Bool::False(), PP); 685 __ LoadObject(result_reg, Bool::False(), PP);
686 __ jmp(&done, Assembler::kNearJump); 686 __ jmp(&done, Assembler::kNearJump);
687 __ Bind(&is_true); 687 __ Bind(&is_true);
688 __ LoadObject(result_reg, Bool::True(), PP); 688 __ LoadObject(result_reg, Bool::True(), PP);
689 __ Bind(&done); 689 __ Bind(&done);
690 } 690 }
691 691
692 692
693 LocationSummary* RelationalOpInstr::MakeLocationSummary(Isolate* isolate, 693 LocationSummary* RelationalOpInstr::MakeLocationSummary(Zone* zone,
694 bool opt) const { 694 bool opt) const {
695 const intptr_t kNumInputs = 2; 695 const intptr_t kNumInputs = 2;
696 const intptr_t kNumTemps = 0; 696 const intptr_t kNumTemps = 0;
697 if (operation_cid() == kDoubleCid) { 697 if (operation_cid() == kDoubleCid) {
698 LocationSummary* summary = new(isolate) LocationSummary( 698 LocationSummary* summary = new(zone) LocationSummary(
699 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 699 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
700 summary->set_in(0, Location::RequiresFpuRegister()); 700 summary->set_in(0, Location::RequiresFpuRegister());
701 summary->set_in(1, Location::RequiresFpuRegister()); 701 summary->set_in(1, Location::RequiresFpuRegister());
702 summary->set_out(0, Location::RequiresRegister()); 702 summary->set_out(0, Location::RequiresRegister());
703 return summary; 703 return summary;
704 } else if (operation_cid() == kMintCid) { 704 } else if (operation_cid() == kMintCid) {
705 LocationSummary* summary = new(isolate) LocationSummary( 705 LocationSummary* summary = new(zone) LocationSummary(
706 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 706 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
707 summary->set_in(0, Location::RequiresRegister()); 707 summary->set_in(0, Location::RequiresRegister());
708 summary->set_in(1, Location::RequiresRegister()); 708 summary->set_in(1, Location::RequiresRegister());
709 summary->set_out(0, Location::RequiresRegister()); 709 summary->set_out(0, Location::RequiresRegister());
710 return summary; 710 return summary;
711 } 711 }
712 ASSERT(operation_cid() == kSmiCid); 712 ASSERT(operation_cid() == kSmiCid);
713 LocationSummary* summary = new(isolate) LocationSummary( 713 LocationSummary* summary = new(zone) LocationSummary(
714 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 714 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
715 summary->set_in(0, Location::RegisterOrConstant(left())); 715 summary->set_in(0, Location::RegisterOrConstant(left()));
716 // Only one input can be a constant operand. The case of two constant 716 // Only one input can be a constant operand. The case of two constant
717 // operands should be handled by constant propagation. 717 // operands should be handled by constant propagation.
718 summary->set_in(1, summary->in(0).IsConstant() 718 summary->set_in(1, summary->in(0).IsConstant()
719 ? Location::RequiresRegister() 719 ? Location::RequiresRegister()
720 : Location::RegisterOrConstant(right())); 720 : Location::RegisterOrConstant(right()));
721 summary->set_out(0, Location::RequiresRegister()); 721 summary->set_out(0, Location::RequiresRegister());
722 return summary; 722 return summary;
723 } 723 }
724 724
(...skipping 27 matching lines...) Expand all
752 752
753 753
754 void RelationalOpInstr::EmitBranchCode(FlowGraphCompiler* compiler, 754 void RelationalOpInstr::EmitBranchCode(FlowGraphCompiler* compiler,
755 BranchInstr* branch) { 755 BranchInstr* branch) {
756 BranchLabels labels = compiler->CreateBranchLabels(branch); 756 BranchLabels labels = compiler->CreateBranchLabels(branch);
757 Condition true_condition = EmitComparisonCode(compiler, labels); 757 Condition true_condition = EmitComparisonCode(compiler, labels);
758 EmitBranchOnCondition(compiler, true_condition, labels); 758 EmitBranchOnCondition(compiler, true_condition, labels);
759 } 759 }
760 760
761 761
762 LocationSummary* NativeCallInstr::MakeLocationSummary(Isolate* isolate, 762 LocationSummary* NativeCallInstr::MakeLocationSummary(Zone* zone,
763 bool opt) const { 763 bool opt) const {
764 return MakeCallSummary(isolate); 764 return MakeCallSummary(zone);
765 } 765 }
766 766
767 767
768 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 768 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
769 Register result = locs()->out(0).reg(); 769 Register result = locs()->out(0).reg();
770 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); 770 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function());
771 const bool is_leaf_call = 771 const bool is_leaf_call =
772 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; 772 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0;
773 StubCode* stub_code = compiler->isolate()->stub_code(); 773 StubCode* stub_code = compiler->isolate()->stub_code();
774 774
(...skipping 27 matching lines...) Expand all
802 const Object& constant = index->definition()->AsConstant()->value(); 802 const Object& constant = index->definition()->AsConstant()->value();
803 if (!constant.IsSmi()) return false; 803 if (!constant.IsSmi()) return false;
804 const Smi& smi_const = Smi::Cast(constant); 804 const Smi& smi_const = Smi::Cast(constant);
805 const intptr_t scale = Instance::ElementSizeFor(cid); 805 const intptr_t scale = Instance::ElementSizeFor(cid);
806 const intptr_t data_offset = Instance::DataOffsetFor(cid); 806 const intptr_t data_offset = Instance::DataOffsetFor(cid);
807 const int64_t disp = smi_const.AsInt64Value() * scale + data_offset; 807 const int64_t disp = smi_const.AsInt64Value() * scale + data_offset;
808 return Utils::IsInt(32, disp); 808 return Utils::IsInt(32, disp);
809 } 809 }
810 810
811 811
812 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(Isolate* isolate, 812 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(Zone* zone,
813 bool opt) const { 813 bool opt) const {
814 const intptr_t kNumInputs = 1; 814 const intptr_t kNumInputs = 1;
815 // TODO(fschneider): Allow immediate operands for the char code. 815 // TODO(fschneider): Allow immediate operands for the char code.
816 return LocationSummary::Make(isolate, 816 return LocationSummary::Make(zone,
817 kNumInputs, 817 kNumInputs,
818 Location::RequiresRegister(), 818 Location::RequiresRegister(),
819 LocationSummary::kNoCall); 819 LocationSummary::kNoCall);
820 } 820 }
821 821
822 822
823 void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 823 void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
824 Register char_code = locs()->in(0).reg(); 824 Register char_code = locs()->in(0).reg();
825 Register result = locs()->out(0).reg(); 825 Register result = locs()->out(0).reg();
826 __ LoadImmediate(result, 826 __ LoadImmediate(result,
827 Immediate(reinterpret_cast<uword>(Symbols::PredefinedAddress())), PP); 827 Immediate(reinterpret_cast<uword>(Symbols::PredefinedAddress())), PP);
828 __ movq(result, Address(result, 828 __ movq(result, Address(result,
829 char_code, 829 char_code,
830 TIMES_HALF_WORD_SIZE, // Char code is a smi. 830 TIMES_HALF_WORD_SIZE, // Char code is a smi.
831 Symbols::kNullCharCodeSymbolOffset * kWordSize)); 831 Symbols::kNullCharCodeSymbolOffset * kWordSize));
832 } 832 }
833 833
834 834
835 LocationSummary* StringToCharCodeInstr::MakeLocationSummary(Isolate* isolate, 835 LocationSummary* StringToCharCodeInstr::MakeLocationSummary(Zone* zone,
836 bool opt) const { 836 bool opt) const {
837 const intptr_t kNumInputs = 1; 837 const intptr_t kNumInputs = 1;
838 return LocationSummary::Make(isolate, 838 return LocationSummary::Make(zone,
839 kNumInputs, 839 kNumInputs,
840 Location::RequiresRegister(), 840 Location::RequiresRegister(),
841 LocationSummary::kNoCall); 841 LocationSummary::kNoCall);
842 } 842 }
843 843
844 844
845 void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 845 void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
846 ASSERT(cid_ == kOneByteStringCid); 846 ASSERT(cid_ == kOneByteStringCid);
847 Register str = locs()->in(0).reg(); 847 Register str = locs()->in(0).reg();
848 Register result = locs()->out(0).reg(); 848 Register result = locs()->out(0).reg();
849 Label is_one, done; 849 Label is_one, done;
850 __ movq(result, FieldAddress(str, String::length_offset())); 850 __ movq(result, FieldAddress(str, String::length_offset()));
851 __ cmpq(result, Immediate(Smi::RawValue(1))); 851 __ cmpq(result, Immediate(Smi::RawValue(1)));
852 __ j(EQUAL, &is_one, Assembler::kNearJump); 852 __ j(EQUAL, &is_one, Assembler::kNearJump);
853 __ movq(result, Immediate(Smi::RawValue(-1))); 853 __ movq(result, Immediate(Smi::RawValue(-1)));
854 __ jmp(&done); 854 __ jmp(&done);
855 __ Bind(&is_one); 855 __ Bind(&is_one);
856 __ movzxb(result, FieldAddress(str, OneByteString::data_offset())); 856 __ movzxb(result, FieldAddress(str, OneByteString::data_offset()));
857 __ SmiTag(result); 857 __ SmiTag(result);
858 __ Bind(&done); 858 __ Bind(&done);
859 } 859 }
860 860
861 861
862 LocationSummary* StringInterpolateInstr::MakeLocationSummary(Isolate* isolate, 862 LocationSummary* StringInterpolateInstr::MakeLocationSummary(Zone* zone,
863 bool opt) const { 863 bool opt) const {
864 const intptr_t kNumInputs = 1; 864 const intptr_t kNumInputs = 1;
865 const intptr_t kNumTemps = 0; 865 const intptr_t kNumTemps = 0;
866 LocationSummary* summary = new(isolate) LocationSummary( 866 LocationSummary* summary = new(zone) LocationSummary(
867 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 867 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
868 summary->set_in(0, Location::RegisterLocation(RAX)); 868 summary->set_in(0, Location::RegisterLocation(RAX));
869 summary->set_out(0, Location::RegisterLocation(RAX)); 869 summary->set_out(0, Location::RegisterLocation(RAX));
870 return summary; 870 return summary;
871 } 871 }
872 872
873 873
874 void StringInterpolateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 874 void StringInterpolateInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
875 Register array = locs()->in(0).reg(); 875 Register array = locs()->in(0).reg();
876 __ pushq(array); 876 __ pushq(array);
877 const int kNumberOfArguments = 1; 877 const int kNumberOfArguments = 1;
878 const Array& kNoArgumentNames = Object::null_array(); 878 const Array& kNoArgumentNames = Object::null_array();
879 compiler->GenerateStaticCall(deopt_id(), 879 compiler->GenerateStaticCall(deopt_id(),
880 token_pos(), 880 token_pos(),
881 CallFunction(), 881 CallFunction(),
882 kNumberOfArguments, 882 kNumberOfArguments,
883 kNoArgumentNames, 883 kNoArgumentNames,
884 locs(), 884 locs(),
885 ICData::Handle()); 885 ICData::Handle());
886 ASSERT(locs()->out(0).reg() == RAX); 886 ASSERT(locs()->out(0).reg() == RAX);
887 } 887 }
888 888
889 889
890 LocationSummary* LoadUntaggedInstr::MakeLocationSummary(Isolate* isolate, 890 LocationSummary* LoadUntaggedInstr::MakeLocationSummary(Zone* zone,
891 bool opt) const { 891 bool opt) const {
892 const intptr_t kNumInputs = 1; 892 const intptr_t kNumInputs = 1;
893 return LocationSummary::Make(isolate, 893 return LocationSummary::Make(zone,
894 kNumInputs, 894 kNumInputs,
895 Location::RequiresRegister(), 895 Location::RequiresRegister(),
896 LocationSummary::kNoCall); 896 LocationSummary::kNoCall);
897 } 897 }
898 898
899 899
900 void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 900 void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
901 Register obj = locs()->in(0).reg(); 901 Register obj = locs()->in(0).reg();
902 Register result = locs()->out(0).reg(); 902 Register result = locs()->out(0).reg();
903 if (object()->definition()->representation() == kUntagged) { 903 if (object()->definition()->representation() == kUntagged) {
904 __ movq(result, Address(obj, offset())); 904 __ movq(result, Address(obj, offset()));
905 } else { 905 } else {
906 ASSERT(object()->definition()->representation() == kTagged); 906 ASSERT(object()->definition()->representation() == kTagged);
907 __ movq(result, FieldAddress(obj, offset())); 907 __ movq(result, FieldAddress(obj, offset()));
908 } 908 }
909 } 909 }
910 910
911 911
912 LocationSummary* LoadClassIdInstr::MakeLocationSummary(Isolate* isolate, 912 LocationSummary* LoadClassIdInstr::MakeLocationSummary(Zone* zone,
913 bool opt) const { 913 bool opt) const {
914 const intptr_t kNumInputs = 1; 914 const intptr_t kNumInputs = 1;
915 return LocationSummary::Make(isolate, 915 return LocationSummary::Make(zone,
916 kNumInputs, 916 kNumInputs,
917 Location::RequiresRegister(), 917 Location::RequiresRegister(),
918 LocationSummary::kNoCall); 918 LocationSummary::kNoCall);
919 } 919 }
920 920
921 921
922 void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 922 void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
923 const Register object = locs()->in(0).reg(); 923 const Register object = locs()->in(0).reg();
924 const Register result = locs()->out(0).reg(); 924 const Register result = locs()->out(0).reg();
925 Label load, done; 925 Label load, done;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 return kUnboxedFloat32x4; 1006 return kUnboxedFloat32x4;
1007 case kTypedDataFloat64x2ArrayCid: 1007 case kTypedDataFloat64x2ArrayCid:
1008 return kUnboxedFloat64x2; 1008 return kUnboxedFloat64x2;
1009 default: 1009 default:
1010 UNIMPLEMENTED(); 1010 UNIMPLEMENTED();
1011 return kTagged; 1011 return kTagged;
1012 } 1012 }
1013 } 1013 }
1014 1014
1015 1015
1016 LocationSummary* LoadIndexedInstr::MakeLocationSummary(Isolate* isolate, 1016 LocationSummary* LoadIndexedInstr::MakeLocationSummary(Zone* zone,
1017 bool opt) const { 1017 bool opt) const {
1018 const intptr_t kNumInputs = 2; 1018 const intptr_t kNumInputs = 2;
1019 const intptr_t kNumTemps = 0; 1019 const intptr_t kNumTemps = 0;
1020 LocationSummary* locs = new(isolate) LocationSummary( 1020 LocationSummary* locs = new(zone) LocationSummary(
1021 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 1021 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
1022 locs->set_in(0, Location::RequiresRegister()); 1022 locs->set_in(0, Location::RequiresRegister());
1023 // The smi index is either untagged (element size == 1), or it is left smi 1023 // The smi index is either untagged (element size == 1), or it is left smi
1024 // tagged (for all element sizes > 1). 1024 // tagged (for all element sizes > 1).
1025 if (index_scale() == 1) { 1025 if (index_scale() == 1) {
1026 locs->set_in(1, CanBeImmediateIndex(index(), class_id()) 1026 locs->set_in(1, CanBeImmediateIndex(index(), class_id())
1027 ? Location::Constant(index()->definition()->AsConstant()) 1027 ? Location::Constant(index()->definition()->AsConstant())
1028 : Location::WritableRegister()); 1028 : Location::WritableRegister());
1029 } else { 1029 } else {
1030 locs->set_in(1, CanBeImmediateIndex(index(), class_id()) 1030 locs->set_in(1, CanBeImmediateIndex(index(), class_id())
1031 ? Location::Constant(index()->definition()->AsConstant()) 1031 ? Location::Constant(index()->definition()->AsConstant())
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 __ SmiTag(result); 1138 __ SmiTag(result);
1139 break; 1139 break;
1140 default: 1140 default:
1141 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); 1141 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid));
1142 __ movq(result, element_address); 1142 __ movq(result, element_address);
1143 break; 1143 break;
1144 } 1144 }
1145 } 1145 }
1146 1146
1147 1147
1148 LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Isolate* isolate, 1148 LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Zone* zone,
1149 bool opt) const { 1149 bool opt) const {
1150 const intptr_t kNumInputs = 2; 1150 const intptr_t kNumInputs = 2;
1151 const intptr_t kNumTemps = 0; 1151 const intptr_t kNumTemps = 0;
1152 LocationSummary* summary = new(isolate) LocationSummary( 1152 LocationSummary* summary = new(zone) LocationSummary(
1153 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 1153 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
1154 summary->set_in(0, Location::RequiresRegister()); 1154 summary->set_in(0, Location::RequiresRegister());
1155 // The smi index is either untagged (element size == 1), or it is left smi 1155 // The smi index is either untagged (element size == 1), or it is left smi
1156 // tagged (for all element sizes > 1). 1156 // tagged (for all element sizes > 1).
1157 summary->set_in(1, index_scale() == 1 ? Location::WritableRegister() 1157 summary->set_in(1, index_scale() == 1 ? Location::WritableRegister()
1158 : Location::RequiresRegister()); 1158 : Location::RequiresRegister());
1159 summary->set_out(0, Location::RequiresRegister()); 1159 summary->set_out(0, Location::RequiresRegister());
1160 return summary; 1160 return summary;
1161 } 1161 }
1162 1162
1163 1163
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 return kUnboxedInt32x4; 1231 return kUnboxedInt32x4;
1232 case kTypedDataFloat64x2ArrayCid: 1232 case kTypedDataFloat64x2ArrayCid:
1233 return kUnboxedFloat64x2; 1233 return kUnboxedFloat64x2;
1234 default: 1234 default:
1235 UNIMPLEMENTED(); 1235 UNIMPLEMENTED();
1236 return kTagged; 1236 return kTagged;
1237 } 1237 }
1238 } 1238 }
1239 1239
1240 1240
1241 LocationSummary* StoreIndexedInstr::MakeLocationSummary(Isolate* isolate, 1241 LocationSummary* StoreIndexedInstr::MakeLocationSummary(Zone* zone,
1242 bool opt) const { 1242 bool opt) const {
1243 const intptr_t kNumInputs = 3; 1243 const intptr_t kNumInputs = 3;
1244 const intptr_t kNumTemps = 0; 1244 const intptr_t kNumTemps = 0;
1245 LocationSummary* locs = new(isolate) LocationSummary( 1245 LocationSummary* locs = new(zone) LocationSummary(
1246 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 1246 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
1247 locs->set_in(0, Location::RequiresRegister()); 1247 locs->set_in(0, Location::RequiresRegister());
1248 // The smi index is either untagged (element size == 1), or it is left smi 1248 // The smi index is either untagged (element size == 1), or it is left smi
1249 // tagged (for all element sizes > 1). 1249 // tagged (for all element sizes > 1).
1250 if (index_scale() == 1) { 1250 if (index_scale() == 1) {
1251 locs->set_in(1, CanBeImmediateIndex(index(), class_id()) 1251 locs->set_in(1, CanBeImmediateIndex(index(), class_id())
1252 ? Location::Constant(index()->definition()->AsConstant()) 1252 ? Location::Constant(index()->definition()->AsConstant())
1253 : Location::WritableRegister()); 1253 : Location::WritableRegister());
1254 } else { 1254 } else {
1255 locs->set_in(1, CanBeImmediateIndex(index(), class_id()) 1255 locs->set_in(1, CanBeImmediateIndex(index(), class_id())
1256 ? Location::Constant(index()->definition()->AsConstant()) 1256 ? Location::Constant(index()->definition()->AsConstant())
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 case kTypedDataFloat64x2ArrayCid: 1400 case kTypedDataFloat64x2ArrayCid:
1401 case kTypedDataFloat32x4ArrayCid: 1401 case kTypedDataFloat32x4ArrayCid:
1402 __ movups(element_address, locs()->in(2).fpu_reg()); 1402 __ movups(element_address, locs()->in(2).fpu_reg());
1403 break; 1403 break;
1404 default: 1404 default:
1405 UNREACHABLE(); 1405 UNREACHABLE();
1406 } 1406 }
1407 } 1407 }
1408 1408
1409 1409
1410 LocationSummary* GuardFieldClassInstr::MakeLocationSummary(Isolate* isolate, 1410 LocationSummary* GuardFieldClassInstr::MakeLocationSummary(Zone* zone,
1411 bool opt) const { 1411 bool opt) const {
1412 const intptr_t kNumInputs = 1; 1412 const intptr_t kNumInputs = 1;
1413 1413
1414 const intptr_t value_cid = value()->Type()->ToCid(); 1414 const intptr_t value_cid = value()->Type()->ToCid();
1415 const intptr_t field_cid = field().guarded_cid(); 1415 const intptr_t field_cid = field().guarded_cid();
1416 1416
1417 const bool emit_full_guard = !opt || (field_cid == kIllegalCid); 1417 const bool emit_full_guard = !opt || (field_cid == kIllegalCid);
1418 const bool needs_value_cid_temp_reg = 1418 const bool needs_value_cid_temp_reg =
1419 (value_cid == kDynamicCid) && (emit_full_guard || (field_cid != kSmiCid)); 1419 (value_cid == kDynamicCid) && (emit_full_guard || (field_cid != kSmiCid));
1420 const bool needs_field_temp_reg = emit_full_guard; 1420 const bool needs_field_temp_reg = emit_full_guard;
1421 1421
1422 intptr_t num_temps = 0; 1422 intptr_t num_temps = 0;
1423 if (needs_value_cid_temp_reg) { 1423 if (needs_value_cid_temp_reg) {
1424 num_temps++; 1424 num_temps++;
1425 } 1425 }
1426 if (needs_field_temp_reg) { 1426 if (needs_field_temp_reg) {
1427 num_temps++; 1427 num_temps++;
1428 } 1428 }
1429 1429
1430 LocationSummary* summary = new(isolate) LocationSummary( 1430 LocationSummary* summary = new(zone) LocationSummary(
1431 isolate, kNumInputs, num_temps, LocationSummary::kNoCall); 1431 zone, kNumInputs, num_temps, LocationSummary::kNoCall);
1432 summary->set_in(0, Location::RequiresRegister()); 1432 summary->set_in(0, Location::RequiresRegister());
1433 1433
1434 for (intptr_t i = 0; i < num_temps; i++) { 1434 for (intptr_t i = 0; i < num_temps; i++) {
1435 summary->set_temp(i, Location::RequiresRegister()); 1435 summary->set_temp(i, Location::RequiresRegister());
1436 } 1436 }
1437 1437
1438 1438
1439 return summary; 1439 return summary;
1440 } 1440 }
1441 1441
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1555 } else { 1555 } else {
1556 // Both value's and field's class id is known. 1556 // Both value's and field's class id is known.
1557 ASSERT((value_cid != field_cid) && (value_cid != nullability)); 1557 ASSERT((value_cid != field_cid) && (value_cid != nullability));
1558 __ jmp(fail); 1558 __ jmp(fail);
1559 } 1559 }
1560 } 1560 }
1561 __ Bind(&ok); 1561 __ Bind(&ok);
1562 } 1562 }
1563 1563
1564 1564
1565 LocationSummary* GuardFieldLengthInstr::MakeLocationSummary(Isolate* isolate, 1565 LocationSummary* GuardFieldLengthInstr::MakeLocationSummary(Zone* zone,
1566 bool opt) const { 1566 bool opt) const {
1567 const intptr_t kNumInputs = 1; 1567 const intptr_t kNumInputs = 1;
1568 if (!opt || (field().guarded_list_length() == Field::kUnknownFixedLength)) { 1568 if (!opt || (field().guarded_list_length() == Field::kUnknownFixedLength)) {
1569 const intptr_t kNumTemps = 3; 1569 const intptr_t kNumTemps = 3;
1570 LocationSummary* summary = new(isolate) LocationSummary( 1570 LocationSummary* summary = new(zone) LocationSummary(
1571 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 1571 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
1572 summary->set_in(0, Location::RequiresRegister()); 1572 summary->set_in(0, Location::RequiresRegister());
1573 // We need temporaries for field object, length offset and expected length. 1573 // We need temporaries for field object, length offset and expected length.
1574 summary->set_temp(0, Location::RequiresRegister()); 1574 summary->set_temp(0, Location::RequiresRegister());
1575 summary->set_temp(1, Location::RequiresRegister()); 1575 summary->set_temp(1, Location::RequiresRegister());
1576 summary->set_temp(2, Location::RequiresRegister()); 1576 summary->set_temp(2, Location::RequiresRegister());
1577 return summary; 1577 return summary;
1578 } else { 1578 } else {
1579 LocationSummary* summary = new(isolate) LocationSummary( 1579 LocationSummary* summary = new(zone) LocationSummary(
1580 isolate, kNumInputs, 0, LocationSummary::kNoCall); 1580 zone, kNumInputs, 0, LocationSummary::kNoCall);
1581 summary->set_in(0, Location::RequiresRegister()); 1581 summary->set_in(0, Location::RequiresRegister());
1582 return summary; 1582 return summary;
1583 } 1583 }
1584 UNREACHABLE(); 1584 UNREACHABLE();
1585 } 1585 }
1586 1586
1587 1587
1588 void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1588 void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1589 if (field().guarded_list_length() == Field::kNoFixedLength) { 1589 if (field().guarded_list_length() == Field::kNoFixedLength) {
1590 ASSERT(!compiler->is_optimizing()); 1590 ASSERT(!compiler->is_optimizing());
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 } 1709 }
1710 } 1710 }
1711 1711
1712 private: 1712 private:
1713 Instruction* instruction_; 1713 Instruction* instruction_;
1714 const Class& cls_; 1714 const Class& cls_;
1715 const Register result_; 1715 const Register result_;
1716 }; 1716 };
1717 1717
1718 1718
1719 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Isolate* isolate, 1719 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Zone* zone,
1720 bool opt) const { 1720 bool opt) const {
1721 const intptr_t kNumInputs = 2; 1721 const intptr_t kNumInputs = 2;
1722 const intptr_t kNumTemps = 1722 const intptr_t kNumTemps =
1723 (IsUnboxedStore() && opt) ? 2 : 1723 (IsUnboxedStore() && opt) ? 2 :
1724 ((IsPotentialUnboxedStore()) ? 3 : 0); 1724 ((IsPotentialUnboxedStore()) ? 3 : 0);
1725 LocationSummary* summary = new(isolate) LocationSummary( 1725 LocationSummary* summary = new(zone) LocationSummary(
1726 isolate, kNumInputs, kNumTemps, 1726 zone, kNumInputs, kNumTemps,
1727 ((IsUnboxedStore() && opt && is_potential_unboxed_initialization_) || 1727 ((IsUnboxedStore() && opt && is_potential_unboxed_initialization_) ||
1728 IsPotentialUnboxedStore()) 1728 IsPotentialUnboxedStore())
1729 ? LocationSummary::kCallOnSlowPath 1729 ? LocationSummary::kCallOnSlowPath
1730 : LocationSummary::kNoCall); 1730 : LocationSummary::kNoCall);
1731 1731
1732 summary->set_in(0, Location::RequiresRegister()); 1732 summary->set_in(0, Location::RequiresRegister());
1733 if (IsUnboxedStore() && opt) { 1733 if (IsUnboxedStore() && opt) {
1734 summary->set_in(1, Location::RequiresFpuRegister()); 1734 summary->set_in(1, Location::RequiresFpuRegister());
1735 summary->set_temp(0, Location::RequiresRegister()); 1735 summary->set_temp(0, Location::RequiresRegister());
1736 summary->set_temp(1, Location::RequiresRegister()); 1736 summary->set_temp(1, Location::RequiresRegister());
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1940 value_reg, 1940 value_reg,
1941 is_object_reference_initialization_ ? 1941 is_object_reference_initialization_ ?
1942 Assembler::kEmptyOrSmiOrNull : 1942 Assembler::kEmptyOrSmiOrNull :
1943 Assembler::kHeapObjectOrSmi); 1943 Assembler::kHeapObjectOrSmi);
1944 } 1944 }
1945 } 1945 }
1946 __ Bind(&skip_store); 1946 __ Bind(&skip_store);
1947 } 1947 }
1948 1948
1949 1949
1950 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Isolate* isolate, 1950 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone,
1951 bool opt) const { 1951 bool opt) const {
1952 const intptr_t kNumInputs = 1; 1952 const intptr_t kNumInputs = 1;
1953 const intptr_t kNumTemps = 0; 1953 const intptr_t kNumTemps = 0;
1954 LocationSummary* summary = new(isolate) LocationSummary( 1954 LocationSummary* summary = new(zone) LocationSummary(
1955 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 1955 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
1956 summary->set_in(0, Location::RequiresRegister()); 1956 summary->set_in(0, Location::RequiresRegister());
1957 summary->set_out(0, Location::RequiresRegister()); 1957 summary->set_out(0, Location::RequiresRegister());
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 __ movq(result, FieldAddress(field, Field::value_offset())); 1970 __ movq(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(), PP); 1989 __ LoadObject(temp, field(), PP);
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(RAX)); 2006 summary->set_in(0, Location::RegisterLocation(RAX));
2007 summary->set_in(1, Location::RegisterLocation(RCX)); 2007 summary->set_in(1, Location::RegisterLocation(RCX));
2008 summary->set_in(2, Location::RegisterLocation(RDX)); 2008 summary->set_in(2, Location::RegisterLocation(RDX));
2009 summary->set_out(0, Location::RegisterLocation(RAX)); 2009 summary->set_out(0, Location::RegisterLocation(RAX));
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() == RAX); // Value. 2015 ASSERT(locs()->in(0).reg() == RAX); // Value.
2016 ASSERT(locs()->in(1).reg() == RCX); // Instantiator. 2016 ASSERT(locs()->in(1).reg() == RCX); // Instantiator.
2017 ASSERT(locs()->in(2).reg() == RDX); // Instantiator type arguments. 2017 ASSERT(locs()->in(2).reg() == RDX); // 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() == RAX); 2024 ASSERT(locs()->out(0).reg() == RAX);
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(RBX)); 2036 locs->set_in(0, Location::RegisterLocation(RBX));
2037 locs->set_in(1, Location::RegisterLocation(R10)); 2037 locs->set_in(1, Location::RegisterLocation(R10));
2038 locs->set_out(0, Location::RegisterLocation(RAX)); 2038 locs->set_out(0, Location::RegisterLocation(RAX));
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
2132 compiler->GenerateCall(token_pos(), 2132 compiler->GenerateCall(token_pos(),
2133 &label, 2133 &label,
2134 RawPcDescriptors::kOther, 2134 RawPcDescriptors::kOther,
2135 locs()); 2135 locs());
2136 compiler->AddStubCallTarget(stub); 2136 compiler->AddStubCallTarget(stub);
2137 __ Bind(&done); 2137 __ Bind(&done);
2138 ASSERT(locs()->out(0).reg() == kResultReg); 2138 ASSERT(locs()->out(0).reg() == kResultReg);
2139 } 2139 }
2140 2140
2141 2141
2142 LocationSummary* LoadFieldInstr::MakeLocationSummary(Isolate* isolate, 2142 LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone,
2143 bool opt) const { 2143 bool opt) const {
2144 const intptr_t kNumInputs = 1; 2144 const intptr_t kNumInputs = 1;
2145 const intptr_t kNumTemps = 2145 const intptr_t kNumTemps =
2146 (IsUnboxedLoad() && opt) ? 1 : 2146 (IsUnboxedLoad() && opt) ? 1 :
2147 ((IsPotentialUnboxedLoad()) ? 2 : 0); 2147 ((IsPotentialUnboxedLoad()) ? 2 : 0);
2148 LocationSummary* locs = new(isolate) LocationSummary( 2148 LocationSummary* locs = new(zone) LocationSummary(
2149 isolate, kNumInputs, kNumTemps, 2149 zone, kNumInputs, kNumTemps,
2150 (opt && !IsPotentialUnboxedLoad()) 2150 (opt && !IsPotentialUnboxedLoad())
2151 ? LocationSummary::kNoCall 2151 ? LocationSummary::kNoCall
2152 : LocationSummary::kCallOnSlowPath); 2152 : LocationSummary::kCallOnSlowPath);
2153 2153
2154 locs->set_in(0, Location::RequiresRegister()); 2154 locs->set_in(0, Location::RequiresRegister());
2155 2155
2156 if (IsUnboxedLoad() && opt) { 2156 if (IsUnboxedLoad() && opt) {
2157 locs->set_temp(0, Location::RequiresRegister()); 2157 locs->set_temp(0, Location::RequiresRegister());
2158 } else if (IsPotentialUnboxedLoad()) { 2158 } else if (IsPotentialUnboxedLoad()) {
2159 locs->set_temp(0, opt ? Location::RequiresFpuRegister() 2159 locs->set_temp(0, opt ? Location::RequiresFpuRegister()
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
2257 __ jmp(&done); 2257 __ jmp(&done);
2258 } 2258 }
2259 2259
2260 __ Bind(&load_pointer); 2260 __ Bind(&load_pointer);
2261 } 2261 }
2262 __ movq(result, FieldAddress(instance_reg, offset_in_bytes())); 2262 __ movq(result, FieldAddress(instance_reg, offset_in_bytes()));
2263 __ Bind(&done); 2263 __ Bind(&done);
2264 } 2264 }
2265 2265
2266 2266
2267 LocationSummary* InstantiateTypeInstr::MakeLocationSummary(Isolate* isolate, 2267 LocationSummary* InstantiateTypeInstr::MakeLocationSummary(Zone* zone,
2268 bool opt) const { 2268 bool opt) const {
2269 const intptr_t kNumInputs = 1; 2269 const intptr_t kNumInputs = 1;
2270 const intptr_t kNumTemps = 0; 2270 const intptr_t kNumTemps = 0;
2271 LocationSummary* locs = new(isolate) LocationSummary( 2271 LocationSummary* locs = new(zone) LocationSummary(
2272 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 2272 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
2273 locs->set_in(0, Location::RegisterLocation(RAX)); 2273 locs->set_in(0, Location::RegisterLocation(RAX));
2274 locs->set_out(0, Location::RegisterLocation(RAX)); 2274 locs->set_out(0, Location::RegisterLocation(RAX));
2275 return locs; 2275 return locs;
2276 } 2276 }
2277 2277
2278 2278
2279 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2279 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2280 Register instantiator_reg = locs()->in(0).reg(); 2280 Register instantiator_reg = locs()->in(0).reg();
2281 Register result_reg = locs()->out(0).reg(); 2281 Register result_reg = locs()->out(0).reg();
2282 2282
2283 // 'instantiator_reg' is the instantiator TypeArguments object (or null). 2283 // 'instantiator_reg' is the instantiator TypeArguments object (or null).
2284 // A runtime call to instantiate the type is required. 2284 // A runtime call to instantiate the type is required.
2285 __ PushObject(Object::null_object(), PP); // Make room for the result. 2285 __ PushObject(Object::null_object(), PP); // Make room for the result.
2286 __ PushObject(type(), PP); 2286 __ PushObject(type(), PP);
2287 __ pushq(instantiator_reg); // Push instantiator type arguments. 2287 __ pushq(instantiator_reg); // Push instantiator type arguments.
2288 compiler->GenerateRuntimeCall(token_pos(), 2288 compiler->GenerateRuntimeCall(token_pos(),
2289 deopt_id(), 2289 deopt_id(),
2290 kInstantiateTypeRuntimeEntry, 2290 kInstantiateTypeRuntimeEntry,
2291 2, 2291 2,
2292 locs()); 2292 locs());
2293 __ Drop(2); // Drop instantiator and uninstantiated type. 2293 __ Drop(2); // Drop instantiator and uninstantiated type.
2294 __ popq(result_reg); // Pop instantiated type. 2294 __ popq(result_reg); // Pop instantiated type.
2295 ASSERT(instantiator_reg == result_reg); 2295 ASSERT(instantiator_reg == result_reg);
2296 } 2296 }
2297 2297
2298 2298
2299 LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary( 2299 LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary(
2300 Isolate* isolate, bool opt) const { 2300 Zone* zone, bool opt) const {
2301 const intptr_t kNumInputs = 1; 2301 const intptr_t kNumInputs = 1;
2302 const intptr_t kNumTemps = 0; 2302 const intptr_t kNumTemps = 0;
2303 LocationSummary* locs = new(isolate) LocationSummary( 2303 LocationSummary* locs = new(zone) LocationSummary(
2304 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 2304 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
2305 locs->set_in(0, Location::RegisterLocation(RAX)); 2305 locs->set_in(0, Location::RegisterLocation(RAX));
2306 locs->set_out(0, Location::RegisterLocation(RAX)); 2306 locs->set_out(0, Location::RegisterLocation(RAX));
2307 return locs; 2307 return locs;
2308 } 2308 }
2309 2309
2310 2310
2311 void InstantiateTypeArgumentsInstr::EmitNativeCode( 2311 void InstantiateTypeArgumentsInstr::EmitNativeCode(
2312 FlowGraphCompiler* compiler) { 2312 FlowGraphCompiler* compiler) {
2313 Register instantiator_reg = locs()->in(0).reg(); 2313 Register instantiator_reg = locs()->in(0).reg();
2314 Register result_reg = locs()->out(0).reg(); 2314 Register result_reg = locs()->out(0).reg();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2362 2, 2362 2,
2363 locs()); 2363 locs());
2364 __ Drop(2); // Drop instantiator and uninstantiated type arguments. 2364 __ Drop(2); // Drop instantiator and uninstantiated type arguments.
2365 __ popq(result_reg); // Pop instantiated type arguments. 2365 __ popq(result_reg); // Pop instantiated type arguments.
2366 __ Bind(&type_arguments_instantiated); 2366 __ Bind(&type_arguments_instantiated);
2367 ASSERT(instantiator_reg == result_reg); 2367 ASSERT(instantiator_reg == result_reg);
2368 } 2368 }
2369 2369
2370 2370
2371 LocationSummary* AllocateUninitializedContextInstr::MakeLocationSummary( 2371 LocationSummary* AllocateUninitializedContextInstr::MakeLocationSummary(
2372 Isolate* isolate, 2372 Zone* zone,
2373 bool opt) const { 2373 bool opt) const {
2374 ASSERT(opt); 2374 ASSERT(opt);
2375 const intptr_t kNumInputs = 0; 2375 const intptr_t kNumInputs = 0;
2376 const intptr_t kNumTemps = 1; 2376 const intptr_t kNumTemps = 1;
2377 LocationSummary* locs = new(isolate) LocationSummary( 2377 LocationSummary* locs = new(zone) LocationSummary(
2378 isolate, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath); 2378 zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath);
2379 locs->set_temp(0, Location::RegisterLocation(R10)); 2379 locs->set_temp(0, Location::RegisterLocation(R10));
2380 locs->set_out(0, Location::RegisterLocation(RAX)); 2380 locs->set_out(0, Location::RegisterLocation(RAX));
2381 return locs; 2381 return locs;
2382 } 2382 }
2383 2383
2384 2384
2385 class AllocateContextSlowPath : public SlowPathCode { 2385 class AllocateContextSlowPath : public SlowPathCode {
2386 public: 2386 public:
2387 explicit AllocateContextSlowPath( 2387 explicit AllocateContextSlowPath(
2388 AllocateUninitializedContextInstr* instruction) 2388 AllocateUninitializedContextInstr* instruction)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2430 temp); // end address 2430 temp); // end address
2431 2431
2432 // Setup up number of context variables field. 2432 // Setup up number of context variables field.
2433 __ movq(FieldAddress(result, Context::num_variables_offset()), 2433 __ movq(FieldAddress(result, Context::num_variables_offset()),
2434 Immediate(num_context_variables())); 2434 Immediate(num_context_variables()));
2435 2435
2436 __ Bind(slow_path->exit_label()); 2436 __ Bind(slow_path->exit_label());
2437 } 2437 }
2438 2438
2439 2439
2440 LocationSummary* AllocateContextInstr::MakeLocationSummary(Isolate* isolate, 2440 LocationSummary* AllocateContextInstr::MakeLocationSummary(Zone* zone,
2441 bool opt) const { 2441 bool opt) const {
2442 const intptr_t kNumInputs = 0; 2442 const intptr_t kNumInputs = 0;
2443 const intptr_t kNumTemps = 1; 2443 const intptr_t kNumTemps = 1;
2444 LocationSummary* locs = new(isolate) LocationSummary( 2444 LocationSummary* locs = new(zone) LocationSummary(
2445 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 2445 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
2446 locs->set_temp(0, Location::RegisterLocation(R10)); 2446 locs->set_temp(0, Location::RegisterLocation(R10));
2447 locs->set_out(0, Location::RegisterLocation(RAX)); 2447 locs->set_out(0, Location::RegisterLocation(RAX));
2448 return locs; 2448 return locs;
2449 } 2449 }
2450 2450
2451 2451
2452 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2452 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2453 ASSERT(locs()->temp(0).reg() == R10); 2453 ASSERT(locs()->temp(0).reg() == R10);
2454 ASSERT(locs()->out(0).reg() == RAX); 2454 ASSERT(locs()->out(0).reg() == RAX);
2455 StubCode* stub_code = compiler->isolate()->stub_code(); 2455 StubCode* stub_code = compiler->isolate()->stub_code();
2456 2456
2457 __ LoadImmediate(R10, Immediate(num_context_variables()), PP); 2457 __ LoadImmediate(R10, Immediate(num_context_variables()), PP);
2458 const ExternalLabel label(stub_code->AllocateContextEntryPoint()); 2458 const ExternalLabel label(stub_code->AllocateContextEntryPoint());
2459 compiler->GenerateCall(token_pos(), 2459 compiler->GenerateCall(token_pos(),
2460 &label, 2460 &label,
2461 RawPcDescriptors::kOther, 2461 RawPcDescriptors::kOther,
2462 locs()); 2462 locs());
2463 } 2463 }
2464 2464
2465 2465
2466 LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Isolate* isolate, 2466 LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone,
2467 bool opt) const { 2467 bool opt) const {
2468 const intptr_t kNumInputs = 1; 2468 const intptr_t kNumInputs = 1;
2469 const intptr_t kNumTemps = 1; 2469 const intptr_t kNumTemps = 1;
2470 LocationSummary* locs = new(isolate) LocationSummary( 2470 LocationSummary* locs = new(zone) LocationSummary(
2471 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 2471 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
2472 locs->set_in(0, Location::RegisterLocation(RAX)); 2472 locs->set_in(0, Location::RegisterLocation(RAX));
2473 locs->set_temp(0, Location::RegisterLocation(RCX)); 2473 locs->set_temp(0, Location::RegisterLocation(RCX));
2474 return locs; 2474 return locs;
2475 } 2475 }
2476 2476
2477 2477
2478 void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2478 void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2479 Register field = locs()->in(0).reg(); 2479 Register field = locs()->in(0).reg();
2480 Register temp = locs()->temp(0).reg(); 2480 Register temp = locs()->temp(0).reg();
2481 2481
(...skipping 12 matching lines...) Expand all
2494 compiler->GenerateRuntimeCall(token_pos(), 2494 compiler->GenerateRuntimeCall(token_pos(),
2495 deopt_id(), 2495 deopt_id(),
2496 kInitStaticFieldRuntimeEntry, 2496 kInitStaticFieldRuntimeEntry,
2497 1, 2497 1,
2498 locs()); 2498 locs());
2499 __ Drop(2); // Remove argument and unused result. 2499 __ Drop(2); // Remove argument and unused result.
2500 __ Bind(&no_call); 2500 __ Bind(&no_call);
2501 } 2501 }
2502 2502
2503 2503
2504 LocationSummary* CloneContextInstr::MakeLocationSummary(Isolate* isolate, 2504 LocationSummary* CloneContextInstr::MakeLocationSummary(Zone* zone,
2505 bool opt) const { 2505 bool opt) const {
2506 const intptr_t kNumInputs = 1; 2506 const intptr_t kNumInputs = 1;
2507 const intptr_t kNumTemps = 0; 2507 const intptr_t kNumTemps = 0;
2508 LocationSummary* locs = new(isolate) LocationSummary( 2508 LocationSummary* locs = new(zone) LocationSummary(
2509 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 2509 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
2510 locs->set_in(0, Location::RegisterLocation(RAX)); 2510 locs->set_in(0, Location::RegisterLocation(RAX));
2511 locs->set_out(0, Location::RegisterLocation(RAX)); 2511 locs->set_out(0, Location::RegisterLocation(RAX));
2512 return locs; 2512 return locs;
2513 } 2513 }
2514 2514
2515 2515
2516 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2516 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2517 Register context_value = locs()->in(0).reg(); 2517 Register context_value = locs()->in(0).reg();
2518 Register result = locs()->out(0).reg(); 2518 Register result = locs()->out(0).reg();
2519 2519
2520 __ PushObject(Object::null_object(), PP); // Make room for the result. 2520 __ PushObject(Object::null_object(), PP); // Make room for the result.
2521 __ pushq(context_value); 2521 __ pushq(context_value);
2522 compiler->GenerateRuntimeCall(token_pos(), 2522 compiler->GenerateRuntimeCall(token_pos(),
2523 deopt_id(), 2523 deopt_id(),
2524 kCloneContextRuntimeEntry, 2524 kCloneContextRuntimeEntry,
2525 1, 2525 1,
2526 locs()); 2526 locs());
2527 __ popq(result); // Remove argument. 2527 __ popq(result); // Remove argument.
2528 __ popq(result); // Get result (cloned context). 2528 __ popq(result); // Get result (cloned context).
2529 } 2529 }
2530 2530
2531 2531
2532 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Isolate* isolate, 2532 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Zone* zone,
2533 bool opt) const { 2533 bool opt) const {
2534 UNREACHABLE(); 2534 UNREACHABLE();
2535 return NULL; 2535 return NULL;
2536 } 2536 }
2537 2537
2538 2538
2539 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2539 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2540 __ Bind(compiler->GetJumpLabel(this)); 2540 __ Bind(compiler->GetJumpLabel(this));
2541 compiler->AddExceptionHandler(catch_try_index(), 2541 compiler->AddExceptionHandler(catch_try_index(),
2542 try_index(), 2542 try_index(),
(...skipping 17 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 __ movq(Address(RBP, exception_var().index() * kWordSize), 2563 __ movq(Address(RBP, exception_var().index() * kWordSize),
2564 kExceptionObjectReg); 2564 kExceptionObjectReg);
2565 __ movq(Address(RBP, stacktrace_var().index() * kWordSize), 2565 __ movq(Address(RBP, 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 = 1; 2573 const intptr_t kNumTemps = 1;
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 summary->set_temp(0, Location::RequiresRegister()); 2578 summary->set_temp(0, Location::RequiresRegister());
2579 return summary; 2579 return summary;
2580 } 2580 }
2581 2581
2582 2582
2583 class CheckStackOverflowSlowPath : public SlowPathCode { 2583 class CheckStackOverflowSlowPath : public SlowPathCode {
2584 public: 2584 public:
2585 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) 2585 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction)
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
2790 } 2790 }
2791 } 2791 }
2792 2792
2793 2793
2794 static bool CanBeImmediate(const Object& constant) { 2794 static bool CanBeImmediate(const Object& constant) {
2795 return constant.IsSmi() && 2795 return constant.IsSmi() &&
2796 Immediate(reinterpret_cast<int64_t>(constant.raw())).is_int32(); 2796 Immediate(reinterpret_cast<int64_t>(constant.raw())).is_int32();
2797 } 2797 }
2798 2798
2799 2799
2800 LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Isolate* isolate, 2800 LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone,
2801 bool opt) const { 2801 bool opt) const {
2802 const intptr_t kNumInputs = 2; 2802 const intptr_t kNumInputs = 2;
2803 2803
2804 ConstantInstr* right_constant = right()->definition()->AsConstant(); 2804 ConstantInstr* right_constant = right()->definition()->AsConstant();
2805 if ((right_constant != NULL) && 2805 if ((right_constant != NULL) &&
2806 (op_kind() != Token::kTRUNCDIV) && 2806 (op_kind() != Token::kTRUNCDIV) &&
2807 (op_kind() != Token::kSHL) && 2807 (op_kind() != Token::kSHL) &&
2808 (op_kind() != Token::kMUL) && 2808 (op_kind() != Token::kMUL) &&
2809 (op_kind() != Token::kMOD) && 2809 (op_kind() != Token::kMOD) &&
2810 CanBeImmediate(right_constant->value())) { 2810 CanBeImmediate(right_constant->value())) {
2811 const intptr_t kNumTemps = 0; 2811 const intptr_t kNumTemps = 0;
2812 LocationSummary* summary = new(isolate) LocationSummary( 2812 LocationSummary* summary = new(zone) LocationSummary(
2813 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 2813 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
2814 summary->set_in(0, Location::RequiresRegister()); 2814 summary->set_in(0, Location::RequiresRegister());
2815 summary->set_in(1, Location::Constant(right_constant)); 2815 summary->set_in(1, Location::Constant(right_constant));
2816 summary->set_out(0, Location::SameAsFirstInput()); 2816 summary->set_out(0, Location::SameAsFirstInput());
2817 return summary; 2817 return summary;
2818 } 2818 }
2819 2819
2820 if (op_kind() == Token::kTRUNCDIV) { 2820 if (op_kind() == Token::kTRUNCDIV) {
2821 const intptr_t kNumTemps = 1; 2821 const intptr_t kNumTemps = 1;
2822 LocationSummary* summary = new(isolate) LocationSummary( 2822 LocationSummary* summary = new(zone) LocationSummary(
2823 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 2823 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
2824 if (RightIsPowerOfTwoConstant()) { 2824 if (RightIsPowerOfTwoConstant()) {
2825 summary->set_in(0, Location::RequiresRegister()); 2825 summary->set_in(0, Location::RequiresRegister());
2826 ConstantInstr* right_constant = right()->definition()->AsConstant(); 2826 ConstantInstr* right_constant = right()->definition()->AsConstant();
2827 summary->set_in(1, Location::Constant(right_constant)); 2827 summary->set_in(1, Location::Constant(right_constant));
2828 summary->set_temp(0, Location::RequiresRegister()); 2828 summary->set_temp(0, Location::RequiresRegister());
2829 summary->set_out(0, Location::SameAsFirstInput()); 2829 summary->set_out(0, Location::SameAsFirstInput());
2830 } else { 2830 } else {
2831 // Both inputs must be writable because they will be untagged. 2831 // Both inputs must be writable because they will be untagged.
2832 summary->set_in(0, Location::RegisterLocation(RAX)); 2832 summary->set_in(0, Location::RegisterLocation(RAX));
2833 summary->set_in(1, Location::WritableRegister()); 2833 summary->set_in(1, Location::WritableRegister());
2834 summary->set_out(0, Location::SameAsFirstInput()); 2834 summary->set_out(0, Location::SameAsFirstInput());
2835 // Will be used for sign extension and division. 2835 // Will be used for sign extension and division.
2836 summary->set_temp(0, Location::RegisterLocation(RDX)); 2836 summary->set_temp(0, Location::RegisterLocation(RDX));
2837 } 2837 }
2838 return summary; 2838 return summary;
2839 } else if (op_kind() == Token::kMOD) { 2839 } else if (op_kind() == Token::kMOD) {
2840 const intptr_t kNumTemps = 1; 2840 const intptr_t kNumTemps = 1;
2841 LocationSummary* summary = new(isolate) LocationSummary( 2841 LocationSummary* summary = new(zone) LocationSummary(
2842 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 2842 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
2843 // Both inputs must be writable because they will be untagged. 2843 // Both inputs must be writable because they will be untagged.
2844 summary->set_in(0, Location::RegisterLocation(RDX)); 2844 summary->set_in(0, Location::RegisterLocation(RDX));
2845 summary->set_in(1, Location::WritableRegister()); 2845 summary->set_in(1, Location::WritableRegister());
2846 summary->set_out(0, Location::SameAsFirstInput()); 2846 summary->set_out(0, Location::SameAsFirstInput());
2847 // Will be used for sign extension and division. 2847 // Will be used for sign extension and division.
2848 summary->set_temp(0, Location::RegisterLocation(RAX)); 2848 summary->set_temp(0, Location::RegisterLocation(RAX));
2849 return summary; 2849 return summary;
2850 } else if (op_kind() == Token::kSHR) { 2850 } else if (op_kind() == Token::kSHR) {
2851 const intptr_t kNumTemps = 0; 2851 const intptr_t kNumTemps = 0;
2852 LocationSummary* summary = new(isolate) LocationSummary( 2852 LocationSummary* summary = new(zone) LocationSummary(
2853 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 2853 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
2854 summary->set_in(0, Location::RequiresRegister()); 2854 summary->set_in(0, Location::RequiresRegister());
2855 summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), RCX)); 2855 summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), RCX));
2856 summary->set_out(0, Location::SameAsFirstInput()); 2856 summary->set_out(0, Location::SameAsFirstInput());
2857 return summary; 2857 return summary;
2858 } else if (op_kind() == Token::kSHL) { 2858 } else if (op_kind() == Token::kSHL) {
2859 const intptr_t kNumTemps = can_overflow() ? 1 : 0; 2859 const intptr_t kNumTemps = can_overflow() ? 1 : 0;
2860 LocationSummary* summary = new(isolate) LocationSummary( 2860 LocationSummary* summary = new(zone) LocationSummary(
2861 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 2861 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
2862 summary->set_in(0, Location::RequiresRegister()); 2862 summary->set_in(0, Location::RequiresRegister());
2863 summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), RCX)); 2863 summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), RCX));
2864 if (can_overflow()) { 2864 if (can_overflow()) {
2865 summary->set_temp(0, Location::RequiresRegister()); 2865 summary->set_temp(0, Location::RequiresRegister());
2866 } 2866 }
2867 summary->set_out(0, Location::SameAsFirstInput()); 2867 summary->set_out(0, Location::SameAsFirstInput());
2868 return summary; 2868 return summary;
2869 } else { 2869 } else {
2870 const intptr_t kNumTemps = 0; 2870 const intptr_t kNumTemps = 0;
2871 LocationSummary* summary = new(isolate) LocationSummary( 2871 LocationSummary* summary = new(zone) LocationSummary(
2872 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 2872 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
2873 summary->set_in(0, Location::RequiresRegister()); 2873 summary->set_in(0, Location::RequiresRegister());
2874 ConstantInstr* constant = right()->definition()->AsConstant(); 2874 ConstantInstr* constant = right()->definition()->AsConstant();
2875 if (constant != NULL) { 2875 if (constant != NULL) {
2876 summary->set_in(1, Location::RegisterOrSmiConstant(right())); 2876 summary->set_in(1, Location::RegisterOrSmiConstant(right()));
2877 } else { 2877 } else {
2878 summary->set_in(1, Location::PrefersRegister()); 2878 summary->set_in(1, Location::PrefersRegister());
2879 } 2879 }
2880 summary->set_out(0, Location::SameAsFirstInput()); 2880 summary->set_out(0, Location::SameAsFirstInput());
2881 return summary; 2881 return summary;
2882 } 2882 }
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
3211 default: 3211 default:
3212 UNREACHABLE(); 3212 UNREACHABLE();
3213 break; 3213 break;
3214 } 3214 }
3215 if (FLAG_throw_on_javascript_int_overflow) { 3215 if (FLAG_throw_on_javascript_int_overflow) {
3216 EmitJavascriptOverflowCheck(compiler, range(), deopt, result); 3216 EmitJavascriptOverflowCheck(compiler, range(), deopt, result);
3217 } 3217 }
3218 } 3218 }
3219 3219
3220 3220
3221 LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary(Isolate* isolate, 3221 LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary(Zone* zone,
3222 bool opt) const { 3222 bool opt) const {
3223 intptr_t left_cid = left()->Type()->ToCid(); 3223 intptr_t left_cid = left()->Type()->ToCid();
3224 intptr_t right_cid = right()->Type()->ToCid(); 3224 intptr_t right_cid = right()->Type()->ToCid();
3225 ASSERT((left_cid != kDoubleCid) && (right_cid != kDoubleCid)); 3225 ASSERT((left_cid != kDoubleCid) && (right_cid != kDoubleCid));
3226 const intptr_t kNumInputs = 2; 3226 const intptr_t kNumInputs = 2;
3227 const bool need_temp = (left()->definition() != right()->definition()) 3227 const bool need_temp = (left()->definition() != right()->definition())
3228 && (left_cid != kSmiCid) 3228 && (left_cid != kSmiCid)
3229 && (right_cid != kSmiCid); 3229 && (right_cid != kSmiCid);
3230 const intptr_t kNumTemps = need_temp ? 1 : 0; 3230 const intptr_t kNumTemps = need_temp ? 1 : 0;
3231 LocationSummary* summary = new(isolate) LocationSummary( 3231 LocationSummary* summary = new(zone) LocationSummary(
3232 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3232 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3233 summary->set_in(0, Location::RequiresRegister()); 3233 summary->set_in(0, Location::RequiresRegister());
3234 summary->set_in(1, Location::RequiresRegister()); 3234 summary->set_in(1, Location::RequiresRegister());
3235 if (need_temp) summary->set_temp(0, Location::RequiresRegister()); 3235 if (need_temp) summary->set_temp(0, Location::RequiresRegister());
3236 return summary; 3236 return summary;
3237 } 3237 }
3238 3238
3239 3239
3240 void CheckEitherNonSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3240 void CheckEitherNonSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3241 Label* deopt = compiler->AddDeoptStub(deopt_id(), 3241 Label* deopt = compiler->AddDeoptStub(deopt_id(),
3242 ICData::kDeoptBinaryDoubleOp, 3242 ICData::kDeoptBinaryDoubleOp,
(...skipping 11 matching lines...) Expand all
3254 } else { 3254 } else {
3255 Register temp = locs()->temp(0).reg(); 3255 Register temp = locs()->temp(0).reg();
3256 __ movq(temp, left); 3256 __ movq(temp, left);
3257 __ orq(temp, right); 3257 __ orq(temp, right);
3258 __ testq(temp, Immediate(kSmiTagMask)); 3258 __ testq(temp, Immediate(kSmiTagMask));
3259 } 3259 }
3260 __ j(ZERO, deopt); 3260 __ j(ZERO, deopt);
3261 } 3261 }
3262 3262
3263 3263
3264 LocationSummary* BoxInstr::MakeLocationSummary(Isolate* isolate, 3264 LocationSummary* BoxInstr::MakeLocationSummary(Zone* zone,
3265 bool opt) const { 3265 bool opt) const {
3266 const intptr_t kNumInputs = 1; 3266 const intptr_t kNumInputs = 1;
3267 const intptr_t kNumTemps = 0; 3267 const intptr_t kNumTemps = 0;
3268 LocationSummary* summary = new(isolate) LocationSummary( 3268 LocationSummary* summary = new(zone) LocationSummary(
3269 isolate, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath); 3269 zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath);
3270 summary->set_in(0, Location::RequiresFpuRegister()); 3270 summary->set_in(0, Location::RequiresFpuRegister());
3271 summary->set_out(0, Location::RequiresRegister()); 3271 summary->set_out(0, Location::RequiresRegister());
3272 return summary; 3272 return summary;
3273 } 3273 }
3274 3274
3275 3275
3276 void BoxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3276 void BoxInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3277 Register out_reg = locs()->out(0).reg(); 3277 Register out_reg = locs()->out(0).reg();
3278 XmmRegister value = locs()->in(0).fpu_reg(); 3278 XmmRegister value = locs()->in(0).fpu_reg();
3279 3279
3280 BoxAllocationSlowPath::Allocate( 3280 BoxAllocationSlowPath::Allocate(
3281 compiler, this, compiler->BoxClassFor(from_representation()), out_reg); 3281 compiler, this, compiler->BoxClassFor(from_representation()), out_reg);
3282 __ movsd(FieldAddress(out_reg, Double::value_offset()), value); 3282 __ movsd(FieldAddress(out_reg, Double::value_offset()), value);
3283 switch (from_representation()) { 3283 switch (from_representation()) {
3284 case kUnboxedDouble: 3284 case kUnboxedDouble:
3285 __ movsd(FieldAddress(out_reg, ValueOffset()), value); 3285 __ movsd(FieldAddress(out_reg, ValueOffset()), value);
3286 break; 3286 break;
3287 case kUnboxedFloat32x4: 3287 case kUnboxedFloat32x4:
3288 case kUnboxedFloat64x2: 3288 case kUnboxedFloat64x2:
3289 case kUnboxedInt32x4: 3289 case kUnboxedInt32x4:
3290 __ movups(FieldAddress(out_reg, ValueOffset()), value); 3290 __ movups(FieldAddress(out_reg, ValueOffset()), value);
3291 break; 3291 break;
3292 default: 3292 default:
3293 UNREACHABLE(); 3293 UNREACHABLE();
3294 break; 3294 break;
3295 } 3295 }
3296 } 3296 }
3297 3297
3298 3298
3299 LocationSummary* UnboxInstr::MakeLocationSummary(Isolate* isolate, 3299 LocationSummary* UnboxInstr::MakeLocationSummary(Zone* zone,
3300 bool opt) const { 3300 bool opt) const {
3301 const intptr_t kNumInputs = 1; 3301 const intptr_t kNumInputs = 1;
3302 const intptr_t kNumTemps = 0; 3302 const intptr_t kNumTemps = 0;
3303 const bool needs_writable_input = 3303 const bool needs_writable_input =
3304 (representation() != kUnboxedMint) && 3304 (representation() != kUnboxedMint) &&
3305 (value()->Type()->ToNullableCid() != BoxCid()); 3305 (value()->Type()->ToNullableCid() != BoxCid());
3306 LocationSummary* summary = new(isolate) LocationSummary( 3306 LocationSummary* summary = new(zone) LocationSummary(
3307 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3307 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3308 summary->set_in(0, needs_writable_input ? Location::WritableRegister() 3308 summary->set_in(0, needs_writable_input ? Location::WritableRegister()
3309 : Location::RequiresRegister()); 3309 : Location::RequiresRegister());
3310 if (representation() == kUnboxedMint) { 3310 if (representation() == kUnboxedMint) {
3311 summary->set_out(0, Location::SameAsFirstInput()); 3311 summary->set_out(0, Location::SameAsFirstInput());
3312 } else { 3312 } else {
3313 summary->set_out(0, Location::RequiresFpuRegister()); 3313 summary->set_out(0, Location::RequiresFpuRegister());
3314 } 3314 }
3315 return summary; 3315 return summary;
3316 } 3316 }
3317 3317
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
3405 Label done; 3405 Label done;
3406 __ jmp(&done); 3406 __ jmp(&done);
3407 __ Bind(&is_smi); 3407 __ Bind(&is_smi);
3408 EmitSmiConversion(compiler); 3408 EmitSmiConversion(compiler);
3409 __ Bind(&done); 3409 __ Bind(&done);
3410 } 3410 }
3411 } 3411 }
3412 } 3412 }
3413 3413
3414 3414
3415 LocationSummary* UnboxInteger32Instr::MakeLocationSummary(Isolate* isolate, 3415 LocationSummary* UnboxInteger32Instr::MakeLocationSummary(Zone* zone,
3416 bool opt) const { 3416 bool opt) const {
3417 const intptr_t kNumInputs = 1; 3417 const intptr_t kNumInputs = 1;
3418 const intptr_t kNumTemps = (!is_truncating() && CanDeoptimize()) ? 1 : 0; 3418 const intptr_t kNumTemps = (!is_truncating() && CanDeoptimize()) ? 1 : 0;
3419 LocationSummary* summary = new(isolate) LocationSummary( 3419 LocationSummary* summary = new(zone) LocationSummary(
3420 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3420 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3421 summary->set_in(0, Location::RequiresRegister()); 3421 summary->set_in(0, Location::RequiresRegister());
3422 summary->set_out(0, Location::SameAsFirstInput()); 3422 summary->set_out(0, Location::SameAsFirstInput());
3423 if (kNumTemps > 0) { 3423 if (kNumTemps > 0) {
3424 summary->set_temp(0, Location::RequiresRegister()); 3424 summary->set_temp(0, Location::RequiresRegister());
3425 } 3425 }
3426 return summary; 3426 return summary;
3427 } 3427 }
3428 3428
3429 3429
3430 void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 3430 void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
(...skipping 22 matching lines...) Expand all
3453 if (!is_truncating() && (deopt != NULL)) { 3453 if (!is_truncating() && (deopt != NULL)) {
3454 ASSERT(representation() == kUnboxedInt32); 3454 ASSERT(representation() == kUnboxedInt32);
3455 Register temp = locs()->temp(0).reg(); 3455 Register temp = locs()->temp(0).reg();
3456 __ movsxd(temp, value); 3456 __ movsxd(temp, value);
3457 __ cmpq(temp, value); 3457 __ cmpq(temp, value);
3458 __ j(NOT_EQUAL, deopt); 3458 __ j(NOT_EQUAL, deopt);
3459 } 3459 }
3460 } 3460 }
3461 3461
3462 3462
3463 LocationSummary* BoxInteger32Instr::MakeLocationSummary(Isolate* isolate, 3463 LocationSummary* BoxInteger32Instr::MakeLocationSummary(Zone* zone,
3464 bool opt) const { 3464 bool opt) const {
3465 ASSERT((from_representation() == kUnboxedInt32) || 3465 ASSERT((from_representation() == kUnboxedInt32) ||
3466 (from_representation() == kUnboxedUint32)); 3466 (from_representation() == kUnboxedUint32));
3467 const intptr_t kNumInputs = 1; 3467 const intptr_t kNumInputs = 1;
3468 const intptr_t kNumTemps = 0; 3468 const intptr_t kNumTemps = 0;
3469 LocationSummary* summary = new(isolate) LocationSummary( 3469 LocationSummary* summary = new(zone) LocationSummary(
3470 isolate, 3470 zone,
3471 kNumInputs, 3471 kNumInputs,
3472 kNumTemps, 3472 kNumTemps,
3473 LocationSummary::kNoCall); 3473 LocationSummary::kNoCall);
3474 summary->set_in(0, Location::RequiresRegister()); 3474 summary->set_in(0, Location::RequiresRegister());
3475 summary->set_out(0, Location::RequiresRegister()); 3475 summary->set_out(0, Location::RequiresRegister());
3476 return summary; 3476 return summary;
3477 } 3477 }
3478 3478
3479 3479
3480 void BoxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 3480 void BoxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
3481 const Register value = locs()->in(0).reg(); 3481 const Register value = locs()->in(0).reg();
3482 const Register out = locs()->out(0).reg(); 3482 const Register out = locs()->out(0).reg();
3483 ASSERT(value != out); 3483 ASSERT(value != out);
3484 3484
3485 ASSERT(kSmiTagSize == 1); 3485 ASSERT(kSmiTagSize == 1);
3486 if (from_representation() == kUnboxedInt32) { 3486 if (from_representation() == kUnboxedInt32) {
3487 __ movsxd(out, value); 3487 __ movsxd(out, value);
3488 } else { 3488 } else {
3489 ASSERT(from_representation() == kUnboxedUint32); 3489 ASSERT(from_representation() == kUnboxedUint32);
3490 __ movl(out, value); 3490 __ movl(out, value);
3491 } 3491 }
3492 __ SmiTag(out); 3492 __ SmiTag(out);
3493 } 3493 }
3494 3494
3495 3495
3496 LocationSummary* BoxInt64Instr::MakeLocationSummary(Isolate* isolate, 3496 LocationSummary* BoxInt64Instr::MakeLocationSummary(Zone* zone,
3497 bool opt) const { 3497 bool opt) const {
3498 const intptr_t kNumInputs = 1; 3498 const intptr_t kNumInputs = 1;
3499 const intptr_t kNumTemps = 0; 3499 const intptr_t kNumTemps = 0;
3500 LocationSummary* summary = new(isolate) LocationSummary( 3500 LocationSummary* summary = new(zone) LocationSummary(
3501 isolate, 3501 zone,
3502 kNumInputs, 3502 kNumInputs,
3503 kNumTemps, 3503 kNumTemps,
3504 ValueFitsSmi() ? LocationSummary::kNoCall 3504 ValueFitsSmi() ? LocationSummary::kNoCall
3505 : LocationSummary::kCallOnSlowPath); 3505 : LocationSummary::kCallOnSlowPath);
3506 summary->set_in(0, Location::RequiresRegister()); 3506 summary->set_in(0, Location::RequiresRegister());
3507 summary->set_out(0, Location::RequiresRegister()); 3507 summary->set_out(0, Location::RequiresRegister());
3508 return summary; 3508 return summary;
3509 } 3509 }
3510 3510
3511 3511
3512 void BoxInt64Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 3512 void BoxInt64Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
3513 const Register out = locs()->out(0).reg(); 3513 const Register out = locs()->out(0).reg();
3514 const Register value = locs()->in(0).reg(); 3514 const Register value = locs()->in(0).reg();
3515 __ MoveRegister(out, value); 3515 __ MoveRegister(out, value);
3516 __ SmiTag(out); 3516 __ SmiTag(out);
3517 if (!ValueFitsSmi()) { 3517 if (!ValueFitsSmi()) {
3518 Label done; 3518 Label done;
3519 __ j(NO_OVERFLOW, &done); 3519 __ j(NO_OVERFLOW, &done);
3520 BoxAllocationSlowPath::Allocate( 3520 BoxAllocationSlowPath::Allocate(
3521 compiler, this, compiler->mint_class(), out); 3521 compiler, this, compiler->mint_class(), out);
3522 __ movq(FieldAddress(out, Mint::value_offset()), value); 3522 __ movq(FieldAddress(out, Mint::value_offset()), value);
3523 __ Bind(&done); 3523 __ Bind(&done);
3524 } 3524 }
3525 } 3525 }
3526 3526
3527 3527
3528 LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary(Isolate* isolate, 3528 LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary(Zone* zone,
3529 bool opt) const { 3529 bool opt) const {
3530 const intptr_t kNumInputs = 2; 3530 const intptr_t kNumInputs = 2;
3531 const intptr_t kNumTemps = 0; 3531 const intptr_t kNumTemps = 0;
3532 LocationSummary* summary = new(isolate) LocationSummary( 3532 LocationSummary* summary = new(zone) LocationSummary(
3533 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3533 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3534 summary->set_in(0, Location::RequiresFpuRegister()); 3534 summary->set_in(0, Location::RequiresFpuRegister());
3535 summary->set_in(1, Location::RequiresFpuRegister()); 3535 summary->set_in(1, Location::RequiresFpuRegister());
3536 summary->set_out(0, Location::SameAsFirstInput()); 3536 summary->set_out(0, Location::SameAsFirstInput());
3537 return summary; 3537 return summary;
3538 } 3538 }
3539 3539
3540 3540
3541 void BinaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3541 void BinaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3542 XmmRegister left = locs()->in(0).fpu_reg(); 3542 XmmRegister left = locs()->in(0).fpu_reg();
3543 XmmRegister right = locs()->in(1).fpu_reg(); 3543 XmmRegister right = locs()->in(1).fpu_reg();
3544 3544
3545 ASSERT(locs()->out(0).fpu_reg() == left); 3545 ASSERT(locs()->out(0).fpu_reg() == left);
3546 3546
3547 switch (op_kind()) { 3547 switch (op_kind()) {
3548 case Token::kADD: __ addsd(left, right); break; 3548 case Token::kADD: __ addsd(left, right); break;
3549 case Token::kSUB: __ subsd(left, right); break; 3549 case Token::kSUB: __ subsd(left, right); break;
3550 case Token::kMUL: __ mulsd(left, right); break; 3550 case Token::kMUL: __ mulsd(left, right); break;
3551 case Token::kDIV: __ divsd(left, right); break; 3551 case Token::kDIV: __ divsd(left, right); break;
3552 default: UNREACHABLE(); 3552 default: UNREACHABLE();
3553 } 3553 }
3554 } 3554 }
3555 3555
3556 3556
3557 LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Isolate* isolate, 3557 LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone,
3558 bool opt) const { 3558 bool opt) const {
3559 const intptr_t kNumInputs = 2; 3559 const intptr_t kNumInputs = 2;
3560 const intptr_t kNumTemps = 0; 3560 const intptr_t kNumTemps = 0;
3561 LocationSummary* summary = new(isolate) LocationSummary( 3561 LocationSummary* summary = new(zone) LocationSummary(
3562 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3562 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3563 summary->set_in(0, Location::RequiresFpuRegister()); 3563 summary->set_in(0, Location::RequiresFpuRegister());
3564 summary->set_in(1, Location::RequiresFpuRegister()); 3564 summary->set_in(1, Location::RequiresFpuRegister());
3565 summary->set_out(0, Location::SameAsFirstInput()); 3565 summary->set_out(0, Location::SameAsFirstInput());
3566 return summary; 3566 return summary;
3567 } 3567 }
3568 3568
3569 3569
3570 void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3570 void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3571 XmmRegister left = locs()->in(0).fpu_reg(); 3571 XmmRegister left = locs()->in(0).fpu_reg();
3572 XmmRegister right = locs()->in(1).fpu_reg(); 3572 XmmRegister right = locs()->in(1).fpu_reg();
3573 3573
3574 ASSERT(locs()->out(0).fpu_reg() == left); 3574 ASSERT(locs()->out(0).fpu_reg() == left);
3575 3575
3576 switch (op_kind()) { 3576 switch (op_kind()) {
3577 case Token::kADD: __ addps(left, right); break; 3577 case Token::kADD: __ addps(left, right); break;
3578 case Token::kSUB: __ subps(left, right); break; 3578 case Token::kSUB: __ subps(left, right); break;
3579 case Token::kMUL: __ mulps(left, right); break; 3579 case Token::kMUL: __ mulps(left, right); break;
3580 case Token::kDIV: __ divps(left, right); break; 3580 case Token::kDIV: __ divps(left, right); break;
3581 default: UNREACHABLE(); 3581 default: UNREACHABLE();
3582 } 3582 }
3583 } 3583 }
3584 3584
3585 3585
3586 LocationSummary* BinaryFloat64x2OpInstr::MakeLocationSummary(Isolate* isolate, 3586 LocationSummary* BinaryFloat64x2OpInstr::MakeLocationSummary(Zone* zone,
3587 bool opt) const { 3587 bool opt) const {
3588 const intptr_t kNumInputs = 2; 3588 const intptr_t kNumInputs = 2;
3589 const intptr_t kNumTemps = 0; 3589 const intptr_t kNumTemps = 0;
3590 LocationSummary* summary = new(isolate) LocationSummary( 3590 LocationSummary* summary = new(zone) LocationSummary(
3591 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3591 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3592 summary->set_in(0, Location::RequiresFpuRegister()); 3592 summary->set_in(0, Location::RequiresFpuRegister());
3593 summary->set_in(1, Location::RequiresFpuRegister()); 3593 summary->set_in(1, Location::RequiresFpuRegister());
3594 summary->set_out(0, Location::SameAsFirstInput()); 3594 summary->set_out(0, Location::SameAsFirstInput());
3595 return summary; 3595 return summary;
3596 } 3596 }
3597 3597
3598 3598
3599 void BinaryFloat64x2OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3599 void BinaryFloat64x2OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3600 XmmRegister left = locs()->in(0).fpu_reg(); 3600 XmmRegister left = locs()->in(0).fpu_reg();
3601 XmmRegister right = locs()->in(1).fpu_reg(); 3601 XmmRegister right = locs()->in(1).fpu_reg();
3602 3602
3603 ASSERT(locs()->out(0).fpu_reg() == left); 3603 ASSERT(locs()->out(0).fpu_reg() == left);
3604 3604
3605 switch (op_kind()) { 3605 switch (op_kind()) {
3606 case Token::kADD: __ addpd(left, right); break; 3606 case Token::kADD: __ addpd(left, right); break;
3607 case Token::kSUB: __ subpd(left, right); break; 3607 case Token::kSUB: __ subpd(left, right); break;
3608 case Token::kMUL: __ mulpd(left, right); break; 3608 case Token::kMUL: __ mulpd(left, right); break;
3609 case Token::kDIV: __ divpd(left, right); break; 3609 case Token::kDIV: __ divpd(left, right); break;
3610 default: UNREACHABLE(); 3610 default: UNREACHABLE();
3611 } 3611 }
3612 } 3612 }
3613 3613
3614 3614
3615 LocationSummary* Simd32x4ShuffleInstr::MakeLocationSummary(Isolate* isolate, 3615 LocationSummary* Simd32x4ShuffleInstr::MakeLocationSummary(Zone* zone,
3616 bool opt) const { 3616 bool opt) const {
3617 const intptr_t kNumInputs = 1; 3617 const intptr_t kNumInputs = 1;
3618 const intptr_t kNumTemps = 0; 3618 const intptr_t kNumTemps = 0;
3619 LocationSummary* summary = new(isolate) LocationSummary( 3619 LocationSummary* summary = new(zone) LocationSummary(
3620 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3620 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3621 summary->set_in(0, Location::RequiresFpuRegister()); 3621 summary->set_in(0, Location::RequiresFpuRegister());
3622 summary->set_out(0, Location::SameAsFirstInput()); 3622 summary->set_out(0, Location::SameAsFirstInput());
3623 return summary; 3623 return summary;
3624 } 3624 }
3625 3625
3626 3626
3627 void Simd32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3627 void Simd32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3628 XmmRegister value = locs()->in(0).fpu_reg(); 3628 XmmRegister value = locs()->in(0).fpu_reg();
3629 3629
3630 ASSERT(locs()->out(0).fpu_reg() == value); 3630 ASSERT(locs()->out(0).fpu_reg() == value);
(...skipping 17 matching lines...) Expand all
3648 break; 3648 break;
3649 case MethodRecognizer::kFloat32x4Shuffle: 3649 case MethodRecognizer::kFloat32x4Shuffle:
3650 case MethodRecognizer::kInt32x4Shuffle: 3650 case MethodRecognizer::kInt32x4Shuffle:
3651 __ shufps(value, value, Immediate(mask_)); 3651 __ shufps(value, value, Immediate(mask_));
3652 break; 3652 break;
3653 default: UNREACHABLE(); 3653 default: UNREACHABLE();
3654 } 3654 }
3655 } 3655 }
3656 3656
3657 3657
3658 LocationSummary* Simd32x4ShuffleMixInstr::MakeLocationSummary(Isolate* isolate, 3658 LocationSummary* Simd32x4ShuffleMixInstr::MakeLocationSummary(Zone* zone,
3659 bool opt) const { 3659 bool opt) const {
3660 const intptr_t kNumInputs = 2; 3660 const intptr_t kNumInputs = 2;
3661 const intptr_t kNumTemps = 0; 3661 const intptr_t kNumTemps = 0;
3662 LocationSummary* summary = new(isolate) LocationSummary( 3662 LocationSummary* summary = new(zone) LocationSummary(
3663 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3663 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3664 summary->set_in(0, Location::RequiresFpuRegister()); 3664 summary->set_in(0, Location::RequiresFpuRegister());
3665 summary->set_in(1, Location::RequiresFpuRegister()); 3665 summary->set_in(1, Location::RequiresFpuRegister());
3666 summary->set_out(0, Location::SameAsFirstInput()); 3666 summary->set_out(0, Location::SameAsFirstInput());
3667 return summary; 3667 return summary;
3668 } 3668 }
3669 3669
3670 3670
3671 void Simd32x4ShuffleMixInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3671 void Simd32x4ShuffleMixInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3672 XmmRegister left = locs()->in(0).fpu_reg(); 3672 XmmRegister left = locs()->in(0).fpu_reg();
3673 XmmRegister right = locs()->in(1).fpu_reg(); 3673 XmmRegister right = locs()->in(1).fpu_reg();
3674 3674
3675 ASSERT(locs()->out(0).fpu_reg() == left); 3675 ASSERT(locs()->out(0).fpu_reg() == left);
3676 switch (op_kind()) { 3676 switch (op_kind()) {
3677 case MethodRecognizer::kFloat32x4ShuffleMix: 3677 case MethodRecognizer::kFloat32x4ShuffleMix:
3678 case MethodRecognizer::kInt32x4ShuffleMix: 3678 case MethodRecognizer::kInt32x4ShuffleMix:
3679 __ shufps(left, right, Immediate(mask_)); 3679 __ shufps(left, right, Immediate(mask_));
3680 break; 3680 break;
3681 default: UNREACHABLE(); 3681 default: UNREACHABLE();
3682 } 3682 }
3683 } 3683 }
3684 3684
3685 3685
3686 LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary(Isolate* isolate, 3686 LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary(Zone* zone,
3687 bool opt) const { 3687 bool opt) const {
3688 const intptr_t kNumInputs = 1; 3688 const intptr_t kNumInputs = 1;
3689 const intptr_t kNumTemps = 0; 3689 const intptr_t kNumTemps = 0;
3690 LocationSummary* summary = new(isolate) LocationSummary( 3690 LocationSummary* summary = new(zone) LocationSummary(
3691 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3691 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3692 summary->set_in(0, Location::RequiresFpuRegister()); 3692 summary->set_in(0, Location::RequiresFpuRegister());
3693 summary->set_out(0, Location::RequiresRegister()); 3693 summary->set_out(0, Location::RequiresRegister());
3694 return summary; 3694 return summary;
3695 } 3695 }
3696 3696
3697 3697
3698 void Simd32x4GetSignMaskInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3698 void Simd32x4GetSignMaskInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3699 XmmRegister value = locs()->in(0).fpu_reg(); 3699 XmmRegister value = locs()->in(0).fpu_reg();
3700 Register out = locs()->out(0).reg(); 3700 Register out = locs()->out(0).reg();
3701 3701
3702 __ movmskps(out, value); 3702 __ movmskps(out, value);
3703 __ SmiTag(out); 3703 __ SmiTag(out);
3704 } 3704 }
3705 3705
3706 3706
3707 LocationSummary* Float32x4ConstructorInstr::MakeLocationSummary( 3707 LocationSummary* Float32x4ConstructorInstr::MakeLocationSummary(
3708 Isolate* isolate, bool opt) const { 3708 Zone* zone, bool opt) const {
3709 const intptr_t kNumInputs = 4; 3709 const intptr_t kNumInputs = 4;
3710 const intptr_t kNumTemps = 0; 3710 const intptr_t kNumTemps = 0;
3711 LocationSummary* summary = new(isolate) LocationSummary( 3711 LocationSummary* summary = new(zone) LocationSummary(
3712 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3712 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3713 summary->set_in(0, Location::RequiresFpuRegister()); 3713 summary->set_in(0, Location::RequiresFpuRegister());
3714 summary->set_in(1, Location::RequiresFpuRegister()); 3714 summary->set_in(1, Location::RequiresFpuRegister());
3715 summary->set_in(2, Location::RequiresFpuRegister()); 3715 summary->set_in(2, Location::RequiresFpuRegister());
3716 summary->set_in(3, Location::RequiresFpuRegister()); 3716 summary->set_in(3, Location::RequiresFpuRegister());
3717 summary->set_out(0, Location::SameAsFirstInput()); 3717 summary->set_out(0, Location::SameAsFirstInput());
3718 return summary; 3718 return summary;
3719 } 3719 }
3720 3720
3721 3721
3722 void Float32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3722 void Float32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
(...skipping 12 matching lines...) Expand all
3735 __ cvtsd2ss(v0, v0); 3735 __ cvtsd2ss(v0, v0);
3736 __ movss(Address(RSP, 8), v0); 3736 __ movss(Address(RSP, 8), v0);
3737 __ movsd(v0, v3); 3737 __ movsd(v0, v3);
3738 __ cvtsd2ss(v0, v0); 3738 __ cvtsd2ss(v0, v0);
3739 __ movss(Address(RSP, 12), v0); 3739 __ movss(Address(RSP, 12), v0);
3740 __ movups(v0, Address(RSP, 0)); 3740 __ movups(v0, Address(RSP, 0));
3741 __ AddImmediate(RSP, Immediate(16), PP); 3741 __ AddImmediate(RSP, Immediate(16), PP);
3742 } 3742 }
3743 3743
3744 3744
3745 LocationSummary* Float32x4ZeroInstr::MakeLocationSummary(Isolate* isolate, 3745 LocationSummary* Float32x4ZeroInstr::MakeLocationSummary(Zone* zone,
3746 bool opt) const { 3746 bool opt) const {
3747 const intptr_t kNumInputs = 0; 3747 const intptr_t kNumInputs = 0;
3748 const intptr_t kNumTemps = 0; 3748 const intptr_t kNumTemps = 0;
3749 LocationSummary* summary = new(isolate) LocationSummary( 3749 LocationSummary* summary = new(zone) LocationSummary(
3750 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3750 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3751 summary->set_out(0, Location::RequiresFpuRegister()); 3751 summary->set_out(0, Location::RequiresFpuRegister());
3752 return summary; 3752 return summary;
3753 } 3753 }
3754 3754
3755 3755
3756 void Float32x4ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3756 void Float32x4ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3757 XmmRegister value = locs()->out(0).fpu_reg(); 3757 XmmRegister value = locs()->out(0).fpu_reg();
3758 __ xorps(value, value); 3758 __ xorps(value, value);
3759 } 3759 }
3760 3760
3761 3761
3762 LocationSummary* Float32x4SplatInstr::MakeLocationSummary(Isolate* isolate, 3762 LocationSummary* Float32x4SplatInstr::MakeLocationSummary(Zone* zone,
3763 bool opt) const { 3763 bool opt) const {
3764 const intptr_t kNumInputs = 1; 3764 const intptr_t kNumInputs = 1;
3765 const intptr_t kNumTemps = 0; 3765 const intptr_t kNumTemps = 0;
3766 LocationSummary* summary = new(isolate) LocationSummary( 3766 LocationSummary* summary = new(zone) LocationSummary(
3767 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3767 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3768 summary->set_in(0, Location::RequiresFpuRegister()); 3768 summary->set_in(0, Location::RequiresFpuRegister());
3769 summary->set_out(0, Location::SameAsFirstInput()); 3769 summary->set_out(0, Location::SameAsFirstInput());
3770 return summary; 3770 return summary;
3771 } 3771 }
3772 3772
3773 3773
3774 void Float32x4SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3774 void Float32x4SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3775 XmmRegister value = locs()->out(0).fpu_reg(); 3775 XmmRegister value = locs()->out(0).fpu_reg();
3776 ASSERT(locs()->in(0).fpu_reg() == locs()->out(0).fpu_reg()); 3776 ASSERT(locs()->in(0).fpu_reg() == locs()->out(0).fpu_reg());
3777 // Convert to Float32. 3777 // Convert to Float32.
3778 __ cvtsd2ss(value, value); 3778 __ cvtsd2ss(value, value);
3779 // Splat across all lanes. 3779 // Splat across all lanes.
3780 __ shufps(value, value, Immediate(0x00)); 3780 __ shufps(value, value, Immediate(0x00));
3781 } 3781 }
3782 3782
3783 3783
3784 LocationSummary* Float32x4ComparisonInstr::MakeLocationSummary(Isolate* isolate, 3784 LocationSummary* Float32x4ComparisonInstr::MakeLocationSummary(Zone* zone,
3785 bool opt) const { 3785 bool opt) const {
3786 const intptr_t kNumInputs = 2; 3786 const intptr_t kNumInputs = 2;
3787 const intptr_t kNumTemps = 0; 3787 const intptr_t kNumTemps = 0;
3788 LocationSummary* summary = new(isolate) LocationSummary( 3788 LocationSummary* summary = new(zone) LocationSummary(
3789 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3789 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3790 summary->set_in(0, Location::RequiresFpuRegister()); 3790 summary->set_in(0, Location::RequiresFpuRegister());
3791 summary->set_in(1, Location::RequiresFpuRegister()); 3791 summary->set_in(1, Location::RequiresFpuRegister());
3792 summary->set_out(0, Location::SameAsFirstInput()); 3792 summary->set_out(0, Location::SameAsFirstInput());
3793 return summary; 3793 return summary;
3794 } 3794 }
3795 3795
3796 3796
3797 void Float32x4ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3797 void Float32x4ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3798 XmmRegister left = locs()->in(0).fpu_reg(); 3798 XmmRegister left = locs()->in(0).fpu_reg();
3799 XmmRegister right = locs()->in(1).fpu_reg(); 3799 XmmRegister right = locs()->in(1).fpu_reg();
(...skipping 18 matching lines...) Expand all
3818 break; 3818 break;
3819 case MethodRecognizer::kFloat32x4LessThanOrEqual: 3819 case MethodRecognizer::kFloat32x4LessThanOrEqual:
3820 __ cmppsle(left, right); 3820 __ cmppsle(left, right);
3821 break; 3821 break;
3822 3822
3823 default: UNREACHABLE(); 3823 default: UNREACHABLE();
3824 } 3824 }
3825 } 3825 }
3826 3826
3827 3827
3828 LocationSummary* Float32x4MinMaxInstr::MakeLocationSummary(Isolate* isolate, 3828 LocationSummary* Float32x4MinMaxInstr::MakeLocationSummary(Zone* zone,
3829 bool opt) const { 3829 bool opt) const {
3830 const intptr_t kNumInputs = 2; 3830 const intptr_t kNumInputs = 2;
3831 const intptr_t kNumTemps = 0; 3831 const intptr_t kNumTemps = 0;
3832 LocationSummary* summary = new(isolate) LocationSummary( 3832 LocationSummary* summary = new(zone) LocationSummary(
3833 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3833 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3834 summary->set_in(0, Location::RequiresFpuRegister()); 3834 summary->set_in(0, Location::RequiresFpuRegister());
3835 summary->set_in(1, Location::RequiresFpuRegister()); 3835 summary->set_in(1, Location::RequiresFpuRegister());
3836 summary->set_out(0, Location::SameAsFirstInput()); 3836 summary->set_out(0, Location::SameAsFirstInput());
3837 return summary; 3837 return summary;
3838 } 3838 }
3839 3839
3840 3840
3841 void Float32x4MinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3841 void Float32x4MinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3842 XmmRegister left = locs()->in(0).fpu_reg(); 3842 XmmRegister left = locs()->in(0).fpu_reg();
3843 XmmRegister right = locs()->in(1).fpu_reg(); 3843 XmmRegister right = locs()->in(1).fpu_reg();
3844 3844
3845 ASSERT(locs()->out(0).fpu_reg() == left); 3845 ASSERT(locs()->out(0).fpu_reg() == left);
3846 3846
3847 switch (op_kind()) { 3847 switch (op_kind()) {
3848 case MethodRecognizer::kFloat32x4Min: 3848 case MethodRecognizer::kFloat32x4Min:
3849 __ minps(left, right); 3849 __ minps(left, right);
3850 break; 3850 break;
3851 case MethodRecognizer::kFloat32x4Max: 3851 case MethodRecognizer::kFloat32x4Max:
3852 __ maxps(left, right); 3852 __ maxps(left, right);
3853 break; 3853 break;
3854 default: UNREACHABLE(); 3854 default: UNREACHABLE();
3855 } 3855 }
3856 } 3856 }
3857 3857
3858 3858
3859 LocationSummary* Float32x4ScaleInstr::MakeLocationSummary(Isolate* isolate, 3859 LocationSummary* Float32x4ScaleInstr::MakeLocationSummary(Zone* zone,
3860 bool opt) const { 3860 bool opt) const {
3861 const intptr_t kNumInputs = 2; 3861 const intptr_t kNumInputs = 2;
3862 const intptr_t kNumTemps = 0; 3862 const intptr_t kNumTemps = 0;
3863 LocationSummary* summary = new(isolate) LocationSummary( 3863 LocationSummary* summary = new(zone) LocationSummary(
3864 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3864 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3865 summary->set_in(0, Location::RequiresFpuRegister()); 3865 summary->set_in(0, Location::RequiresFpuRegister());
3866 summary->set_in(1, Location::RequiresFpuRegister()); 3866 summary->set_in(1, Location::RequiresFpuRegister());
3867 summary->set_out(0, Location::SameAsFirstInput()); 3867 summary->set_out(0, Location::SameAsFirstInput());
3868 return summary; 3868 return summary;
3869 } 3869 }
3870 3870
3871 3871
3872 void Float32x4ScaleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3872 void Float32x4ScaleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3873 XmmRegister left = locs()->in(0).fpu_reg(); 3873 XmmRegister left = locs()->in(0).fpu_reg();
3874 XmmRegister right = locs()->in(1).fpu_reg(); 3874 XmmRegister right = locs()->in(1).fpu_reg();
3875 3875
3876 ASSERT(locs()->out(0).fpu_reg() == left); 3876 ASSERT(locs()->out(0).fpu_reg() == left);
3877 3877
3878 switch (op_kind()) { 3878 switch (op_kind()) {
3879 case MethodRecognizer::kFloat32x4Scale: 3879 case MethodRecognizer::kFloat32x4Scale:
3880 __ cvtsd2ss(left, left); 3880 __ cvtsd2ss(left, left);
3881 __ shufps(left, left, Immediate(0x00)); 3881 __ shufps(left, left, Immediate(0x00));
3882 __ mulps(left, right); 3882 __ mulps(left, right);
3883 break; 3883 break;
3884 default: UNREACHABLE(); 3884 default: UNREACHABLE();
3885 } 3885 }
3886 } 3886 }
3887 3887
3888 3888
3889 LocationSummary* Float32x4SqrtInstr::MakeLocationSummary(Isolate* isolate, 3889 LocationSummary* Float32x4SqrtInstr::MakeLocationSummary(Zone* zone,
3890 bool opt) const { 3890 bool opt) const {
3891 const intptr_t kNumInputs = 1; 3891 const intptr_t kNumInputs = 1;
3892 const intptr_t kNumTemps = 0; 3892 const intptr_t kNumTemps = 0;
3893 LocationSummary* summary = new(isolate) LocationSummary( 3893 LocationSummary* summary = new(zone) LocationSummary(
3894 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3894 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3895 summary->set_in(0, Location::RequiresFpuRegister()); 3895 summary->set_in(0, Location::RequiresFpuRegister());
3896 summary->set_out(0, Location::SameAsFirstInput()); 3896 summary->set_out(0, Location::SameAsFirstInput());
3897 return summary; 3897 return summary;
3898 } 3898 }
3899 3899
3900 3900
3901 void Float32x4SqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3901 void Float32x4SqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3902 XmmRegister left = locs()->in(0).fpu_reg(); 3902 XmmRegister left = locs()->in(0).fpu_reg();
3903 3903
3904 ASSERT(locs()->out(0).fpu_reg() == left); 3904 ASSERT(locs()->out(0).fpu_reg() == left);
3905 3905
3906 switch (op_kind()) { 3906 switch (op_kind()) {
3907 case MethodRecognizer::kFloat32x4Sqrt: 3907 case MethodRecognizer::kFloat32x4Sqrt:
3908 __ sqrtps(left); 3908 __ sqrtps(left);
3909 break; 3909 break;
3910 case MethodRecognizer::kFloat32x4Reciprocal: 3910 case MethodRecognizer::kFloat32x4Reciprocal:
3911 __ reciprocalps(left); 3911 __ reciprocalps(left);
3912 break; 3912 break;
3913 case MethodRecognizer::kFloat32x4ReciprocalSqrt: 3913 case MethodRecognizer::kFloat32x4ReciprocalSqrt:
3914 __ rsqrtps(left); 3914 __ rsqrtps(left);
3915 break; 3915 break;
3916 default: UNREACHABLE(); 3916 default: UNREACHABLE();
3917 } 3917 }
3918 } 3918 }
3919 3919
3920 3920
3921 LocationSummary* Float32x4ZeroArgInstr::MakeLocationSummary(Isolate* isolate, 3921 LocationSummary* Float32x4ZeroArgInstr::MakeLocationSummary(Zone* zone,
3922 bool opt) const { 3922 bool opt) const {
3923 const intptr_t kNumInputs = 1; 3923 const intptr_t kNumInputs = 1;
3924 const intptr_t kNumTemps = 0; 3924 const intptr_t kNumTemps = 0;
3925 LocationSummary* summary = new(isolate) LocationSummary( 3925 LocationSummary* summary = new(zone) LocationSummary(
3926 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3926 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3927 summary->set_in(0, Location::RequiresFpuRegister()); 3927 summary->set_in(0, Location::RequiresFpuRegister());
3928 summary->set_out(0, Location::SameAsFirstInput()); 3928 summary->set_out(0, Location::SameAsFirstInput());
3929 return summary; 3929 return summary;
3930 } 3930 }
3931 3931
3932 3932
3933 void Float32x4ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3933 void Float32x4ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3934 XmmRegister left = locs()->in(0).fpu_reg(); 3934 XmmRegister left = locs()->in(0).fpu_reg();
3935 3935
3936 ASSERT(locs()->out(0).fpu_reg() == left); 3936 ASSERT(locs()->out(0).fpu_reg() == left);
3937 switch (op_kind()) { 3937 switch (op_kind()) {
3938 case MethodRecognizer::kFloat32x4Negate: 3938 case MethodRecognizer::kFloat32x4Negate:
3939 __ negateps(left); 3939 __ negateps(left);
3940 break; 3940 break;
3941 case MethodRecognizer::kFloat32x4Absolute: 3941 case MethodRecognizer::kFloat32x4Absolute:
3942 __ absps(left); 3942 __ absps(left);
3943 break; 3943 break;
3944 default: UNREACHABLE(); 3944 default: UNREACHABLE();
3945 } 3945 }
3946 } 3946 }
3947 3947
3948 3948
3949 LocationSummary* Float32x4ClampInstr::MakeLocationSummary(Isolate* isolate, 3949 LocationSummary* Float32x4ClampInstr::MakeLocationSummary(Zone* zone,
3950 bool opt) const { 3950 bool opt) const {
3951 const intptr_t kNumInputs = 3; 3951 const intptr_t kNumInputs = 3;
3952 const intptr_t kNumTemps = 0; 3952 const intptr_t kNumTemps = 0;
3953 LocationSummary* summary = new(isolate) LocationSummary( 3953 LocationSummary* summary = new(zone) LocationSummary(
3954 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3954 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3955 summary->set_in(0, Location::RequiresFpuRegister()); 3955 summary->set_in(0, Location::RequiresFpuRegister());
3956 summary->set_in(1, Location::RequiresFpuRegister()); 3956 summary->set_in(1, Location::RequiresFpuRegister());
3957 summary->set_in(2, Location::RequiresFpuRegister()); 3957 summary->set_in(2, 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 Float32x4ClampInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3963 void Float32x4ClampInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3964 XmmRegister left = locs()->in(0).fpu_reg(); 3964 XmmRegister left = locs()->in(0).fpu_reg();
3965 XmmRegister lower = locs()->in(1).fpu_reg(); 3965 XmmRegister lower = locs()->in(1).fpu_reg();
3966 XmmRegister upper = locs()->in(2).fpu_reg(); 3966 XmmRegister upper = locs()->in(2).fpu_reg();
3967 ASSERT(locs()->out(0).fpu_reg() == left); 3967 ASSERT(locs()->out(0).fpu_reg() == left);
3968 __ minps(left, upper); 3968 __ minps(left, upper);
3969 __ maxps(left, lower); 3969 __ maxps(left, lower);
3970 } 3970 }
3971 3971
3972 3972
3973 LocationSummary* Float32x4WithInstr::MakeLocationSummary(Isolate* isolate, 3973 LocationSummary* Float32x4WithInstr::MakeLocationSummary(Zone* zone,
3974 bool opt) const { 3974 bool opt) const {
3975 const intptr_t kNumInputs = 2; 3975 const intptr_t kNumInputs = 2;
3976 const intptr_t kNumTemps = 0; 3976 const intptr_t kNumTemps = 0;
3977 LocationSummary* summary = new(isolate) LocationSummary( 3977 LocationSummary* summary = new(zone) LocationSummary(
3978 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3978 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3979 summary->set_in(0, Location::RequiresFpuRegister()); 3979 summary->set_in(0, Location::RequiresFpuRegister());
3980 summary->set_in(1, Location::RequiresFpuRegister()); 3980 summary->set_in(1, Location::RequiresFpuRegister());
3981 summary->set_out(0, Location::SameAsFirstInput()); 3981 summary->set_out(0, Location::SameAsFirstInput());
3982 return summary; 3982 return summary;
3983 } 3983 }
3984 3984
3985 3985
3986 void Float32x4WithInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3986 void Float32x4WithInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3987 XmmRegister replacement = locs()->in(0).fpu_reg(); 3987 XmmRegister replacement = locs()->in(0).fpu_reg();
3988 XmmRegister value = locs()->in(1).fpu_reg(); 3988 XmmRegister value = locs()->in(1).fpu_reg();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
4032 __ movss(Address(RSP, 12), replacement); 4032 __ movss(Address(RSP, 12), replacement);
4033 // Move updated value into output register. 4033 // Move updated value into output register.
4034 __ movups(replacement, Address(RSP, 0)); 4034 __ movups(replacement, Address(RSP, 0));
4035 __ AddImmediate(RSP, Immediate(16), PP); 4035 __ AddImmediate(RSP, Immediate(16), PP);
4036 break; 4036 break;
4037 default: UNREACHABLE(); 4037 default: UNREACHABLE();
4038 } 4038 }
4039 } 4039 }
4040 4040
4041 4041
4042 LocationSummary* Float32x4ToInt32x4Instr::MakeLocationSummary(Isolate* isolate, 4042 LocationSummary* Float32x4ToInt32x4Instr::MakeLocationSummary(Zone* zone,
4043 bool opt) const { 4043 bool opt) const {
4044 const intptr_t kNumInputs = 1; 4044 const intptr_t kNumInputs = 1;
4045 const intptr_t kNumTemps = 0; 4045 const intptr_t kNumTemps = 0;
4046 LocationSummary* summary = new(isolate) LocationSummary( 4046 LocationSummary* summary = new(zone) LocationSummary(
4047 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4047 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4048 summary->set_in(0, Location::RequiresFpuRegister()); 4048 summary->set_in(0, Location::RequiresFpuRegister());
4049 summary->set_out(0, Location::SameAsFirstInput()); 4049 summary->set_out(0, Location::SameAsFirstInput());
4050 return summary; 4050 return summary;
4051 } 4051 }
4052 4052
4053 4053
4054 void Float32x4ToInt32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 4054 void Float32x4ToInt32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
4055 // NOP. 4055 // NOP.
4056 } 4056 }
4057 4057
4058 4058
4059 LocationSummary* Simd64x2ShuffleInstr::MakeLocationSummary(Isolate* isolate, 4059 LocationSummary* Simd64x2ShuffleInstr::MakeLocationSummary(Zone* zone,
4060 bool opt) const { 4060 bool opt) const {
4061 const intptr_t kNumInputs = 1; 4061 const intptr_t kNumInputs = 1;
4062 const intptr_t kNumTemps = 0; 4062 const intptr_t kNumTemps = 0;
4063 LocationSummary* summary = new(isolate) LocationSummary( 4063 LocationSummary* summary = new(zone) LocationSummary(
4064 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4064 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4065 summary->set_in(0, Location::RequiresFpuRegister()); 4065 summary->set_in(0, Location::RequiresFpuRegister());
4066 summary->set_out(0, Location::SameAsFirstInput()); 4066 summary->set_out(0, Location::SameAsFirstInput());
4067 return summary; 4067 return summary;
4068 } 4068 }
4069 4069
4070 4070
4071 void Simd64x2ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4071 void Simd64x2ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4072 XmmRegister value = locs()->in(0).fpu_reg(); 4072 XmmRegister value = locs()->in(0).fpu_reg();
4073 4073
4074 ASSERT(locs()->out(0).fpu_reg() == value); 4074 ASSERT(locs()->out(0).fpu_reg() == value);
4075 switch (op_kind()) { 4075 switch (op_kind()) {
4076 case MethodRecognizer::kFloat64x2GetX: 4076 case MethodRecognizer::kFloat64x2GetX:
4077 // nop. 4077 // nop.
4078 break; 4078 break;
4079 case MethodRecognizer::kFloat64x2GetY: 4079 case MethodRecognizer::kFloat64x2GetY:
4080 __ shufpd(value, value, Immediate(0x33)); 4080 __ shufpd(value, value, Immediate(0x33));
4081 break; 4081 break;
4082 default: UNREACHABLE(); 4082 default: UNREACHABLE();
4083 } 4083 }
4084 } 4084 }
4085 4085
4086 4086
4087 LocationSummary* Float64x2ZeroInstr::MakeLocationSummary(Isolate* isolate, 4087 LocationSummary* Float64x2ZeroInstr::MakeLocationSummary(Zone* zone,
4088 bool opt) const { 4088 bool opt) const {
4089 const intptr_t kNumInputs = 0; 4089 const intptr_t kNumInputs = 0;
4090 const intptr_t kNumTemps = 0; 4090 const intptr_t kNumTemps = 0;
4091 LocationSummary* summary = new(isolate) LocationSummary( 4091 LocationSummary* summary = new(zone) LocationSummary(
4092 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4092 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4093 summary->set_out(0, Location::RequiresFpuRegister()); 4093 summary->set_out(0, Location::RequiresFpuRegister());
4094 return summary; 4094 return summary;
4095 } 4095 }
4096 4096
4097 4097
4098 void Float64x2ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4098 void Float64x2ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4099 XmmRegister value = locs()->out(0).fpu_reg(); 4099 XmmRegister value = locs()->out(0).fpu_reg();
4100 __ xorpd(value, value); 4100 __ xorpd(value, value);
4101 } 4101 }
4102 4102
4103 4103
4104 LocationSummary* Float64x2SplatInstr::MakeLocationSummary(Isolate* isolate, 4104 LocationSummary* Float64x2SplatInstr::MakeLocationSummary(Zone* zone,
4105 bool opt) const { 4105 bool opt) const {
4106 const intptr_t kNumInputs = 1; 4106 const intptr_t kNumInputs = 1;
4107 const intptr_t kNumTemps = 0; 4107 const intptr_t kNumTemps = 0;
4108 LocationSummary* summary = new(isolate) LocationSummary( 4108 LocationSummary* summary = new(zone) LocationSummary(
4109 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4109 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4110 summary->set_in(0, Location::RequiresFpuRegister()); 4110 summary->set_in(0, Location::RequiresFpuRegister());
4111 summary->set_out(0, Location::SameAsFirstInput()); 4111 summary->set_out(0, Location::SameAsFirstInput());
4112 return summary; 4112 return summary;
4113 } 4113 }
4114 4114
4115 4115
4116 void Float64x2SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4116 void Float64x2SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4117 XmmRegister value = locs()->out(0).fpu_reg(); 4117 XmmRegister value = locs()->out(0).fpu_reg();
4118 __ shufpd(value, value, Immediate(0x0)); 4118 __ shufpd(value, value, Immediate(0x0));
4119 } 4119 }
4120 4120
4121 4121
4122 LocationSummary* Float64x2ConstructorInstr::MakeLocationSummary( 4122 LocationSummary* Float64x2ConstructorInstr::MakeLocationSummary(
4123 Isolate* isolate, bool opt) const { 4123 Zone* zone, bool opt) const {
4124 const intptr_t kNumInputs = 2; 4124 const intptr_t kNumInputs = 2;
4125 const intptr_t kNumTemps = 0; 4125 const intptr_t kNumTemps = 0;
4126 LocationSummary* summary = new(isolate) LocationSummary( 4126 LocationSummary* summary = new(zone) LocationSummary(
4127 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4127 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4128 summary->set_in(0, Location::RequiresFpuRegister()); 4128 summary->set_in(0, Location::RequiresFpuRegister());
4129 summary->set_in(1, Location::RequiresFpuRegister()); 4129 summary->set_in(1, Location::RequiresFpuRegister());
4130 summary->set_out(0, Location::SameAsFirstInput()); 4130 summary->set_out(0, Location::SameAsFirstInput());
4131 return summary; 4131 return summary;
4132 } 4132 }
4133 4133
4134 4134
4135 void Float64x2ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4135 void Float64x2ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4136 XmmRegister v0 = locs()->in(0).fpu_reg(); 4136 XmmRegister v0 = locs()->in(0).fpu_reg();
4137 XmmRegister v1 = locs()->in(1).fpu_reg(); 4137 XmmRegister v1 = locs()->in(1).fpu_reg();
4138 ASSERT(v0 == locs()->out(0).fpu_reg()); 4138 ASSERT(v0 == locs()->out(0).fpu_reg());
4139 // shufpd mask 0x0 results in: 4139 // shufpd mask 0x0 results in:
4140 // Lower 64-bits of v0 = Lower 64-bits of v0. 4140 // Lower 64-bits of v0 = Lower 64-bits of v0.
4141 // Upper 64-bits of v0 = Lower 64-bits of v1. 4141 // Upper 64-bits of v0 = Lower 64-bits of v1.
4142 __ shufpd(v0, v1, Immediate(0x0)); 4142 __ shufpd(v0, v1, Immediate(0x0));
4143 } 4143 }
4144 4144
4145 4145
4146 LocationSummary* Float64x2ToFloat32x4Instr::MakeLocationSummary( 4146 LocationSummary* Float64x2ToFloat32x4Instr::MakeLocationSummary(
4147 Isolate* isolate, bool opt) const { 4147 Zone* zone, bool opt) const {
4148 const intptr_t kNumInputs = 1; 4148 const intptr_t kNumInputs = 1;
4149 const intptr_t kNumTemps = 0; 4149 const intptr_t kNumTemps = 0;
4150 LocationSummary* summary = new(isolate) LocationSummary( 4150 LocationSummary* summary = new(zone) LocationSummary(
4151 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4151 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4152 summary->set_in(0, Location::RequiresFpuRegister()); 4152 summary->set_in(0, Location::RequiresFpuRegister());
4153 summary->set_out(0, Location::SameAsFirstInput()); 4153 summary->set_out(0, Location::SameAsFirstInput());
4154 return summary; 4154 return summary;
4155 } 4155 }
4156 4156
4157 4157
4158 void Float64x2ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 4158 void Float64x2ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
4159 XmmRegister value = locs()->out(0).fpu_reg(); 4159 XmmRegister value = locs()->out(0).fpu_reg();
4160 __ cvtpd2ps(value, value); 4160 __ cvtpd2ps(value, value);
4161 } 4161 }
4162 4162
4163 4163
4164 LocationSummary* Float32x4ToFloat64x2Instr::MakeLocationSummary( 4164 LocationSummary* Float32x4ToFloat64x2Instr::MakeLocationSummary(
4165 Isolate* isolate, bool opt) const { 4165 Zone* zone, bool opt) const {
4166 const intptr_t kNumInputs = 1; 4166 const intptr_t kNumInputs = 1;
4167 const intptr_t kNumTemps = 0; 4167 const intptr_t kNumTemps = 0;
4168 LocationSummary* summary = new(isolate) LocationSummary( 4168 LocationSummary* summary = new(zone) LocationSummary(
4169 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4169 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4170 summary->set_in(0, Location::RequiresFpuRegister()); 4170 summary->set_in(0, Location::RequiresFpuRegister());
4171 summary->set_out(0, Location::SameAsFirstInput()); 4171 summary->set_out(0, Location::SameAsFirstInput());
4172 return summary; 4172 return summary;
4173 } 4173 }
4174 4174
4175 4175
4176 void Float32x4ToFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 4176 void Float32x4ToFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
4177 XmmRegister value = locs()->out(0).fpu_reg(); 4177 XmmRegister value = locs()->out(0).fpu_reg();
4178 __ cvtps2pd(value, value); 4178 __ cvtps2pd(value, value);
4179 } 4179 }
4180 4180
4181 4181
4182 LocationSummary* Float64x2ZeroArgInstr::MakeLocationSummary(Isolate* isolate, 4182 LocationSummary* Float64x2ZeroArgInstr::MakeLocationSummary(Zone* zone,
4183 bool opt) const { 4183 bool opt) const {
4184 const intptr_t kNumInputs = 1; 4184 const intptr_t kNumInputs = 1;
4185 const intptr_t kNumTemps = 0; 4185 const intptr_t kNumTemps = 0;
4186 LocationSummary* summary = new(isolate) LocationSummary( 4186 LocationSummary* summary = new(zone) LocationSummary(
4187 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4187 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4188 summary->set_in(0, Location::RequiresFpuRegister()); 4188 summary->set_in(0, Location::RequiresFpuRegister());
4189 if (representation() == kTagged) { 4189 if (representation() == kTagged) {
4190 ASSERT(op_kind() == MethodRecognizer::kFloat64x2GetSignMask); 4190 ASSERT(op_kind() == MethodRecognizer::kFloat64x2GetSignMask);
4191 summary->set_out(0, Location::RequiresRegister()); 4191 summary->set_out(0, Location::RequiresRegister());
4192 } else { 4192 } else {
4193 ASSERT(representation() == kUnboxedFloat64x2); 4193 ASSERT(representation() == kUnboxedFloat64x2);
4194 summary->set_out(0, Location::SameAsFirstInput()); 4194 summary->set_out(0, Location::SameAsFirstInput());
4195 } 4195 }
4196 return summary; 4196 return summary;
4197 } 4197 }
(...skipping 17 matching lines...) Expand all
4215 break; 4215 break;
4216 case MethodRecognizer::kFloat64x2GetSignMask: 4216 case MethodRecognizer::kFloat64x2GetSignMask:
4217 __ movmskpd(locs()->out(0).reg(), left); 4217 __ movmskpd(locs()->out(0).reg(), left);
4218 __ SmiTag(locs()->out(0).reg()); 4218 __ SmiTag(locs()->out(0).reg());
4219 break; 4219 break;
4220 default: UNREACHABLE(); 4220 default: UNREACHABLE();
4221 } 4221 }
4222 } 4222 }
4223 4223
4224 4224
4225 LocationSummary* Float64x2OneArgInstr::MakeLocationSummary(Isolate* isolate, 4225 LocationSummary* Float64x2OneArgInstr::MakeLocationSummary(Zone* zone,
4226 bool opt) const { 4226 bool opt) const {
4227 const intptr_t kNumInputs = 2; 4227 const intptr_t kNumInputs = 2;
4228 const intptr_t kNumTemps = 0; 4228 const intptr_t kNumTemps = 0;
4229 LocationSummary* summary = new(isolate) LocationSummary( 4229 LocationSummary* summary = new(zone) LocationSummary(
4230 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4230 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4231 summary->set_in(0, Location::RequiresFpuRegister()); 4231 summary->set_in(0, Location::RequiresFpuRegister());
4232 summary->set_in(1, Location::RequiresFpuRegister()); 4232 summary->set_in(1, Location::RequiresFpuRegister());
4233 summary->set_out(0, Location::SameAsFirstInput()); 4233 summary->set_out(0, Location::SameAsFirstInput());
4234 return summary; 4234 return summary;
4235 } 4235 }
4236 4236
4237 4237
4238 void Float64x2OneArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4238 void Float64x2OneArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4239 XmmRegister left = locs()->in(0).fpu_reg(); 4239 XmmRegister left = locs()->in(0).fpu_reg();
4240 XmmRegister right = locs()->in(1).fpu_reg(); 4240 XmmRegister right = locs()->in(1).fpu_reg();
(...skipping 29 matching lines...) Expand all
4270 break; 4270 break;
4271 case MethodRecognizer::kFloat64x2Max: 4271 case MethodRecognizer::kFloat64x2Max:
4272 __ maxpd(left, right); 4272 __ maxpd(left, right);
4273 break; 4273 break;
4274 default: UNREACHABLE(); 4274 default: UNREACHABLE();
4275 } 4275 }
4276 } 4276 }
4277 4277
4278 4278
4279 LocationSummary* Int32x4ConstructorInstr::MakeLocationSummary( 4279 LocationSummary* Int32x4ConstructorInstr::MakeLocationSummary(
4280 Isolate* isolate, bool opt) const { 4280 Zone* zone, bool opt) const {
4281 const intptr_t kNumInputs = 4; 4281 const intptr_t kNumInputs = 4;
4282 const intptr_t kNumTemps = 0; 4282 const intptr_t kNumTemps = 0;
4283 LocationSummary* summary = new(isolate) LocationSummary( 4283 LocationSummary* summary = new(zone) LocationSummary(
4284 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4284 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4285 summary->set_in(0, Location::RequiresRegister()); 4285 summary->set_in(0, Location::RequiresRegister());
4286 summary->set_in(1, Location::RequiresRegister()); 4286 summary->set_in(1, Location::RequiresRegister());
4287 summary->set_in(2, Location::RequiresRegister()); 4287 summary->set_in(2, Location::RequiresRegister());
4288 summary->set_in(3, Location::RequiresRegister()); 4288 summary->set_in(3, Location::RequiresRegister());
4289 summary->set_out(0, Location::RequiresFpuRegister()); 4289 summary->set_out(0, Location::RequiresFpuRegister());
4290 return summary; 4290 return summary;
4291 } 4291 }
4292 4292
4293 4293
4294 void Int32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4294 void Int32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4295 Register v0 = locs()->in(0).reg(); 4295 Register v0 = locs()->in(0).reg();
4296 Register v1 = locs()->in(1).reg(); 4296 Register v1 = locs()->in(1).reg();
4297 Register v2 = locs()->in(2).reg(); 4297 Register v2 = locs()->in(2).reg();
4298 Register v3 = locs()->in(3).reg(); 4298 Register v3 = locs()->in(3).reg();
4299 XmmRegister result = locs()->out(0).fpu_reg(); 4299 XmmRegister result = locs()->out(0).fpu_reg();
4300 __ AddImmediate(RSP, Immediate(-4 * kInt32Size), PP); 4300 __ AddImmediate(RSP, Immediate(-4 * kInt32Size), PP);
4301 __ movl(Address(RSP, 0 * kInt32Size), v0); 4301 __ movl(Address(RSP, 0 * kInt32Size), v0);
4302 __ movl(Address(RSP, 1 * kInt32Size), v1); 4302 __ movl(Address(RSP, 1 * kInt32Size), v1);
4303 __ movl(Address(RSP, 2 * kInt32Size), v2); 4303 __ movl(Address(RSP, 2 * kInt32Size), v2);
4304 __ movl(Address(RSP, 3 * kInt32Size), v3); 4304 __ movl(Address(RSP, 3 * kInt32Size), v3);
4305 __ movups(result, Address(RSP, 0)); 4305 __ movups(result, Address(RSP, 0));
4306 __ AddImmediate(RSP, Immediate(4 * kInt32Size), PP); 4306 __ AddImmediate(RSP, Immediate(4 * kInt32Size), PP);
4307 } 4307 }
4308 4308
4309 4309
4310 LocationSummary* Int32x4BoolConstructorInstr::MakeLocationSummary( 4310 LocationSummary* Int32x4BoolConstructorInstr::MakeLocationSummary(
4311 Isolate* isolate, bool opt) const { 4311 Zone* zone, bool opt) const {
4312 const intptr_t kNumInputs = 4; 4312 const intptr_t kNumInputs = 4;
4313 const intptr_t kNumTemps = 1; 4313 const intptr_t kNumTemps = 1;
4314 LocationSummary* summary = new(isolate) LocationSummary( 4314 LocationSummary* summary = new(zone) LocationSummary(
4315 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4315 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4316 summary->set_in(0, Location::RequiresRegister()); 4316 summary->set_in(0, Location::RequiresRegister());
4317 summary->set_in(1, Location::RequiresRegister()); 4317 summary->set_in(1, Location::RequiresRegister());
4318 summary->set_in(2, Location::RequiresRegister()); 4318 summary->set_in(2, Location::RequiresRegister());
4319 summary->set_in(3, Location::RequiresRegister()); 4319 summary->set_in(3, Location::RequiresRegister());
4320 summary->set_temp(0, Location::RequiresRegister()); 4320 summary->set_temp(0, Location::RequiresRegister());
4321 summary->set_out(0, Location::RequiresFpuRegister()); 4321 summary->set_out(0, Location::RequiresFpuRegister());
4322 return summary; 4322 return summary;
4323 } 4323 }
4324 4324
4325 4325
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
4370 __ Bind(&w_false); 4370 __ Bind(&w_false);
4371 __ LoadImmediate(temp, Immediate(0x0), PP); 4371 __ LoadImmediate(temp, Immediate(0x0), PP);
4372 __ Bind(&w_done); 4372 __ Bind(&w_done);
4373 __ movl(Address(RSP, 12), temp); 4373 __ movl(Address(RSP, 12), temp);
4374 4374
4375 __ movups(result, Address(RSP, 0)); 4375 __ movups(result, Address(RSP, 0));
4376 __ AddImmediate(RSP, Immediate(16), PP); 4376 __ AddImmediate(RSP, Immediate(16), PP);
4377 } 4377 }
4378 4378
4379 4379
4380 LocationSummary* Int32x4GetFlagInstr::MakeLocationSummary(Isolate* isolate, 4380 LocationSummary* Int32x4GetFlagInstr::MakeLocationSummary(Zone* zone,
4381 bool opt) const { 4381 bool opt) const {
4382 const intptr_t kNumInputs = 1; 4382 const intptr_t kNumInputs = 1;
4383 const intptr_t kNumTemps = 0; 4383 const intptr_t kNumTemps = 0;
4384 LocationSummary* summary = new(isolate) LocationSummary( 4384 LocationSummary* summary = new(zone) LocationSummary(
4385 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4385 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4386 summary->set_in(0, Location::RequiresFpuRegister()); 4386 summary->set_in(0, Location::RequiresFpuRegister());
4387 summary->set_out(0, Location::RequiresRegister()); 4387 summary->set_out(0, Location::RequiresRegister());
4388 return summary; 4388 return summary;
4389 } 4389 }
4390 4390
4391 4391
4392 void Int32x4GetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4392 void Int32x4GetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4393 XmmRegister value = locs()->in(0).fpu_reg(); 4393 XmmRegister value = locs()->in(0).fpu_reg();
4394 Register result = locs()->out(0).reg(); 4394 Register result = locs()->out(0).reg();
4395 Label done; 4395 Label done;
(...skipping 20 matching lines...) Expand all
4416 __ testl(result, result); 4416 __ testl(result, result);
4417 __ j(NOT_ZERO, &non_zero, Assembler::kNearJump); 4417 __ j(NOT_ZERO, &non_zero, Assembler::kNearJump);
4418 __ LoadObject(result, Bool::False(), PP); 4418 __ LoadObject(result, Bool::False(), PP);
4419 __ jmp(&done); 4419 __ jmp(&done);
4420 __ Bind(&non_zero); 4420 __ Bind(&non_zero);
4421 __ LoadObject(result, Bool::True(), PP); 4421 __ LoadObject(result, Bool::True(), PP);
4422 __ Bind(&done); 4422 __ Bind(&done);
4423 } 4423 }
4424 4424
4425 4425
4426 LocationSummary* Int32x4SelectInstr::MakeLocationSummary(Isolate* isolate, 4426 LocationSummary* Int32x4SelectInstr::MakeLocationSummary(Zone* zone,
4427 bool opt) const { 4427 bool opt) const {
4428 const intptr_t kNumInputs = 3; 4428 const intptr_t kNumInputs = 3;
4429 const intptr_t kNumTemps = 1; 4429 const intptr_t kNumTemps = 1;
4430 LocationSummary* summary = new(isolate) LocationSummary( 4430 LocationSummary* summary = new(zone) LocationSummary(
4431 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4431 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4432 summary->set_in(0, Location::RequiresFpuRegister()); 4432 summary->set_in(0, Location::RequiresFpuRegister());
4433 summary->set_in(1, Location::RequiresFpuRegister()); 4433 summary->set_in(1, Location::RequiresFpuRegister());
4434 summary->set_in(2, Location::RequiresFpuRegister()); 4434 summary->set_in(2, Location::RequiresFpuRegister());
4435 summary->set_temp(0, Location::RequiresFpuRegister()); 4435 summary->set_temp(0, Location::RequiresFpuRegister());
4436 summary->set_out(0, Location::SameAsFirstInput()); 4436 summary->set_out(0, Location::SameAsFirstInput());
4437 return summary; 4437 return summary;
4438 } 4438 }
4439 4439
4440 4440
4441 void Int32x4SelectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4441 void Int32x4SelectInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4442 XmmRegister mask = locs()->in(0).fpu_reg(); 4442 XmmRegister mask = locs()->in(0).fpu_reg();
4443 XmmRegister trueValue = locs()->in(1).fpu_reg(); 4443 XmmRegister trueValue = locs()->in(1).fpu_reg();
4444 XmmRegister falseValue = locs()->in(2).fpu_reg(); 4444 XmmRegister falseValue = locs()->in(2).fpu_reg();
4445 XmmRegister out = locs()->out(0).fpu_reg(); 4445 XmmRegister out = locs()->out(0).fpu_reg();
4446 XmmRegister temp = locs()->temp(0).fpu_reg(); 4446 XmmRegister temp = locs()->temp(0).fpu_reg();
4447 ASSERT(out == mask); 4447 ASSERT(out == mask);
4448 // Copy mask. 4448 // Copy mask.
4449 __ movaps(temp, mask); 4449 __ movaps(temp, mask);
4450 // Invert it. 4450 // Invert it.
4451 __ notps(temp); 4451 __ notps(temp);
4452 // mask = mask & trueValue. 4452 // mask = mask & trueValue.
4453 __ andps(mask, trueValue); 4453 __ andps(mask, trueValue);
4454 // temp = temp & falseValue. 4454 // temp = temp & falseValue.
4455 __ andps(temp, falseValue); 4455 __ andps(temp, falseValue);
4456 // out = mask | temp. 4456 // out = mask | temp.
4457 __ orps(mask, temp); 4457 __ orps(mask, temp);
4458 } 4458 }
4459 4459
4460 4460
4461 LocationSummary* Int32x4SetFlagInstr::MakeLocationSummary(Isolate* isolate, 4461 LocationSummary* Int32x4SetFlagInstr::MakeLocationSummary(Zone* zone,
4462 bool opt) const { 4462 bool opt) const {
4463 const intptr_t kNumInputs = 2; 4463 const intptr_t kNumInputs = 2;
4464 const intptr_t kNumTemps = 1; 4464 const intptr_t kNumTemps = 1;
4465 LocationSummary* summary = new(isolate) LocationSummary( 4465 LocationSummary* summary = new(zone) LocationSummary(
4466 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4466 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4467 summary->set_in(0, Location::RequiresFpuRegister()); 4467 summary->set_in(0, Location::RequiresFpuRegister());
4468 summary->set_in(1, Location::RequiresRegister()); 4468 summary->set_in(1, Location::RequiresRegister());
4469 summary->set_temp(0, Location::RequiresRegister()); 4469 summary->set_temp(0, Location::RequiresRegister());
4470 summary->set_out(0, Location::SameAsFirstInput()); 4470 summary->set_out(0, Location::SameAsFirstInput());
4471 return summary; 4471 return summary;
4472 } 4472 }
4473 4473
4474 4474
4475 void Int32x4SetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4475 void Int32x4SetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4476 XmmRegister mask = locs()->in(0).fpu_reg(); 4476 XmmRegister mask = locs()->in(0).fpu_reg();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
4518 break; 4518 break;
4519 default: UNREACHABLE(); 4519 default: UNREACHABLE();
4520 } 4520 }
4521 __ Bind(&exitPath); 4521 __ Bind(&exitPath);
4522 // Copy mask back to register. 4522 // Copy mask back to register.
4523 __ movups(mask, Address(RSP, 0)); 4523 __ movups(mask, Address(RSP, 0));
4524 __ AddImmediate(RSP, Immediate(16), PP); 4524 __ AddImmediate(RSP, Immediate(16), PP);
4525 } 4525 }
4526 4526
4527 4527
4528 LocationSummary* Int32x4ToFloat32x4Instr::MakeLocationSummary(Isolate* isolate, 4528 LocationSummary* Int32x4ToFloat32x4Instr::MakeLocationSummary(Zone* zone,
4529 bool opt) const { 4529 bool opt) const {
4530 const intptr_t kNumInputs = 1; 4530 const intptr_t kNumInputs = 1;
4531 const intptr_t kNumTemps = 0; 4531 const intptr_t kNumTemps = 0;
4532 LocationSummary* summary = new(isolate) LocationSummary( 4532 LocationSummary* summary = new(zone) LocationSummary(
4533 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4533 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4534 summary->set_in(0, Location::RequiresFpuRegister()); 4534 summary->set_in(0, Location::RequiresFpuRegister());
4535 summary->set_out(0, Location::SameAsFirstInput()); 4535 summary->set_out(0, Location::SameAsFirstInput());
4536 return summary; 4536 return summary;
4537 } 4537 }
4538 4538
4539 4539
4540 void Int32x4ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 4540 void Int32x4ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
4541 // NOP. 4541 // NOP.
4542 } 4542 }
4543 4543
4544 4544
4545 LocationSummary* BinaryInt32x4OpInstr::MakeLocationSummary(Isolate* isolate, 4545 LocationSummary* BinaryInt32x4OpInstr::MakeLocationSummary(Zone* zone,
4546 bool opt) const { 4546 bool opt) const {
4547 const intptr_t kNumInputs = 2; 4547 const intptr_t kNumInputs = 2;
4548 const intptr_t kNumTemps = 0; 4548 const intptr_t kNumTemps = 0;
4549 LocationSummary* summary = new(isolate) LocationSummary( 4549 LocationSummary* summary = new(zone) LocationSummary(
4550 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4550 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4551 summary->set_in(0, Location::RequiresFpuRegister()); 4551 summary->set_in(0, Location::RequiresFpuRegister());
4552 summary->set_in(1, Location::RequiresFpuRegister()); 4552 summary->set_in(1, Location::RequiresFpuRegister());
4553 summary->set_out(0, Location::SameAsFirstInput()); 4553 summary->set_out(0, Location::SameAsFirstInput());
4554 return summary; 4554 return summary;
4555 } 4555 }
4556 4556
4557 4557
4558 void BinaryInt32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4558 void BinaryInt32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4559 XmmRegister left = locs()->in(0).fpu_reg(); 4559 XmmRegister left = locs()->in(0).fpu_reg();
4560 XmmRegister right = locs()->in(1).fpu_reg(); 4560 XmmRegister right = locs()->in(1).fpu_reg();
(...skipping 15 matching lines...) Expand all
4576 __ addpl(left, right); 4576 __ addpl(left, right);
4577 break; 4577 break;
4578 case Token::kSUB: 4578 case Token::kSUB:
4579 __ subpl(left, right); 4579 __ subpl(left, right);
4580 break; 4580 break;
4581 default: UNREACHABLE(); 4581 default: UNREACHABLE();
4582 } 4582 }
4583 } 4583 }
4584 4584
4585 4585
4586 LocationSummary* MathUnaryInstr::MakeLocationSummary(Isolate* isolate, 4586 LocationSummary* MathUnaryInstr::MakeLocationSummary(Zone* zone,
4587 bool opt) const { 4587 bool opt) const {
4588 if ((kind() == MathUnaryInstr::kSin) || (kind() == MathUnaryInstr::kCos)) { 4588 if ((kind() == MathUnaryInstr::kSin) || (kind() == MathUnaryInstr::kCos)) {
4589 // Calling convention on x64 uses XMM0 and XMM1 to pass the first two 4589 // Calling convention on x64 uses XMM0 and XMM1 to pass the first two
4590 // double arguments and XMM0 to return the result. Unfortunately 4590 // double arguments and XMM0 to return the result. Unfortunately
4591 // currently we can't specify these registers because ParallelMoveResolver 4591 // currently we can't specify these registers because ParallelMoveResolver
4592 // assumes that XMM0 is free at all times. 4592 // assumes that XMM0 is free at all times.
4593 // TODO(vegorov): allow XMM0 to be used. 4593 // TODO(vegorov): allow XMM0 to be used.
4594 const intptr_t kNumTemps = 1; 4594 const intptr_t kNumTemps = 1;
4595 LocationSummary* summary = new(isolate) LocationSummary( 4595 LocationSummary* summary = new(zone) LocationSummary(
4596 isolate, InputCount(), kNumTemps, LocationSummary::kCall); 4596 zone, InputCount(), kNumTemps, LocationSummary::kCall);
4597 summary->set_in(0, Location::FpuRegisterLocation(XMM1)); 4597 summary->set_in(0, Location::FpuRegisterLocation(XMM1));
4598 // R13 is chosen because it is callee saved so we do not need to back it 4598 // R13 is chosen because it is callee saved so we do not need to back it
4599 // up before calling into the runtime. 4599 // up before calling into the runtime.
4600 summary->set_temp(0, Location::RegisterLocation(R13)); 4600 summary->set_temp(0, Location::RegisterLocation(R13));
4601 summary->set_out(0, Location::FpuRegisterLocation(XMM1)); 4601 summary->set_out(0, Location::FpuRegisterLocation(XMM1));
4602 return summary; 4602 return summary;
4603 } 4603 }
4604 ASSERT((kind() == MathUnaryInstr::kSqrt) || 4604 ASSERT((kind() == MathUnaryInstr::kSqrt) ||
4605 (kind() == MathUnaryInstr::kDoubleSquare)); 4605 (kind() == MathUnaryInstr::kDoubleSquare));
4606 const intptr_t kNumInputs = 1; 4606 const intptr_t kNumInputs = 1;
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::RequiresFpuRegister()); 4610 summary->set_in(0, Location::RequiresFpuRegister());
4611 if (kind() == MathUnaryInstr::kDoubleSquare) { 4611 if (kind() == MathUnaryInstr::kDoubleSquare) {
4612 summary->set_out(0, Location::SameAsFirstInput()); 4612 summary->set_out(0, Location::SameAsFirstInput());
4613 } else { 4613 } else {
4614 summary->set_out(0, Location::RequiresFpuRegister()); 4614 summary->set_out(0, Location::RequiresFpuRegister());
4615 } 4615 }
4616 return summary; 4616 return summary;
4617 } 4617 }
4618 4618
4619 4619
(...skipping 13 matching lines...) Expand all
4633 __ movaps(XMM0, locs()->in(0).fpu_reg()); 4633 __ movaps(XMM0, locs()->in(0).fpu_reg());
4634 __ CallRuntime(TargetFunction(), InputCount()); 4634 __ CallRuntime(TargetFunction(), InputCount());
4635 __ movaps(locs()->out(0).fpu_reg(), XMM0); 4635 __ movaps(locs()->out(0).fpu_reg(), XMM0);
4636 // Restore RSP. 4636 // Restore RSP.
4637 __ movq(RSP, locs()->temp(0).reg()); 4637 __ movq(RSP, locs()->temp(0).reg());
4638 } 4638 }
4639 } 4639 }
4640 4640
4641 4641
4642 LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary( 4642 LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary(
4643 Isolate* isolate, bool opt) const { 4643 Zone* zone, bool opt) const {
4644 const intptr_t kNumTemps = 0; 4644 const intptr_t kNumTemps = 0;
4645 LocationSummary* summary = new(isolate) LocationSummary( 4645 LocationSummary* summary = new(zone) LocationSummary(
4646 isolate, InputCount(), kNumTemps, LocationSummary::kCall); 4646 zone, InputCount(), kNumTemps, LocationSummary::kCall);
4647 summary->set_in(0, Location::RegisterLocation(CallingConventions::kArg1Reg)); 4647 summary->set_in(0, Location::RegisterLocation(CallingConventions::kArg1Reg));
4648 summary->set_in(1, Location::RegisterLocation(CallingConventions::kArg2Reg)); 4648 summary->set_in(1, Location::RegisterLocation(CallingConventions::kArg2Reg));
4649 summary->set_in(2, Location::RegisterLocation(CallingConventions::kArg3Reg)); 4649 summary->set_in(2, Location::RegisterLocation(CallingConventions::kArg3Reg));
4650 summary->set_in(3, Location::RegisterLocation(CallingConventions::kArg4Reg)); 4650 summary->set_in(3, Location::RegisterLocation(CallingConventions::kArg4Reg));
4651 summary->set_out(0, Location::RegisterLocation(RAX)); 4651 summary->set_out(0, Location::RegisterLocation(RAX));
4652 return summary; 4652 return summary;
4653 } 4653 }
4654 4654
4655 4655
4656 void CaseInsensitiveCompareUC16Instr::EmitNativeCode( 4656 void CaseInsensitiveCompareUC16Instr::EmitNativeCode(
4657 FlowGraphCompiler* compiler) { 4657 FlowGraphCompiler* compiler) {
4658 4658
4659 // Save RSP. R13 is chosen because it is callee saved so we do not need to 4659 // Save RSP. R13 is chosen because it is callee saved so we do not need to
4660 // back it up before calling into the runtime. 4660 // back it up before calling into the runtime.
4661 static const Register kSavedSPReg = R13; 4661 static const Register kSavedSPReg = R13;
4662 __ movq(kSavedSPReg, RSP); 4662 __ movq(kSavedSPReg, RSP);
4663 __ ReserveAlignedFrameSpace(0); 4663 __ ReserveAlignedFrameSpace(0);
4664 4664
4665 // Call the function. Parameters are already in their correct spots. 4665 // Call the function. Parameters are already in their correct spots.
4666 __ CallRuntime(TargetFunction(), TargetFunction().argument_count()); 4666 __ CallRuntime(TargetFunction(), TargetFunction().argument_count());
4667 4667
4668 // Restore RSP. 4668 // Restore RSP.
4669 __ movq(RSP, kSavedSPReg); 4669 __ movq(RSP, kSavedSPReg);
4670 } 4670 }
4671 4671
4672 4672
4673 LocationSummary* UnarySmiOpInstr::MakeLocationSummary(Isolate* isolate, 4673 LocationSummary* UnarySmiOpInstr::MakeLocationSummary(Zone* zone,
4674 bool opt) const { 4674 bool opt) const {
4675 const intptr_t kNumInputs = 1; 4675 const intptr_t kNumInputs = 1;
4676 return LocationSummary::Make(isolate, 4676 return LocationSummary::Make(zone,
4677 kNumInputs, 4677 kNumInputs,
4678 Location::SameAsFirstInput(), 4678 Location::SameAsFirstInput(),
4679 LocationSummary::kNoCall); 4679 LocationSummary::kNoCall);
4680 } 4680 }
4681 4681
4682 4682
4683 void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4683 void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4684 Register value = locs()->in(0).reg(); 4684 Register value = locs()->in(0).reg();
4685 ASSERT(value == locs()->out(0).reg()); 4685 ASSERT(value == locs()->out(0).reg());
4686 switch (op_kind()) { 4686 switch (op_kind()) {
(...skipping 10 matching lines...) Expand all
4697 __ notq(value); 4697 __ notq(value);
4698 // Remove inverted smi-tag. 4698 // Remove inverted smi-tag.
4699 __ AndImmediate(value, Immediate(~kSmiTagMask), PP); 4699 __ AndImmediate(value, Immediate(~kSmiTagMask), PP);
4700 break; 4700 break;
4701 default: 4701 default:
4702 UNREACHABLE(); 4702 UNREACHABLE();
4703 } 4703 }
4704 } 4704 }
4705 4705
4706 4706
4707 LocationSummary* UnaryDoubleOpInstr::MakeLocationSummary(Isolate* isolate, 4707 LocationSummary* UnaryDoubleOpInstr::MakeLocationSummary(Zone* zone,
4708 bool opt) const { 4708 bool opt) const {
4709 const intptr_t kNumInputs = 1; 4709 const intptr_t kNumInputs = 1;
4710 const intptr_t kNumTemps = 0; 4710 const intptr_t kNumTemps = 0;
4711 LocationSummary* summary = new(isolate) LocationSummary( 4711 LocationSummary* summary = new(zone) LocationSummary(
4712 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4712 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4713 summary->set_in(0, Location::RequiresFpuRegister()); 4713 summary->set_in(0, Location::RequiresFpuRegister());
4714 summary->set_out(0, Location::SameAsFirstInput()); 4714 summary->set_out(0, Location::SameAsFirstInput());
4715 return summary; 4715 return summary;
4716 } 4716 }
4717 4717
4718 4718
4719 void UnaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4719 void UnaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4720 XmmRegister value = locs()->in(0).fpu_reg(); 4720 XmmRegister value = locs()->in(0).fpu_reg();
4721 ASSERT(locs()->out(0).fpu_reg() == value); 4721 ASSERT(locs()->out(0).fpu_reg() == value);
4722 __ DoubleNegate(value); 4722 __ DoubleNegate(value);
4723 } 4723 }
4724 4724
4725 4725
4726 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate, 4726 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Zone* zone,
4727 bool opt) const { 4727 bool opt) const {
4728 if (result_cid() == kDoubleCid) { 4728 if (result_cid() == kDoubleCid) {
4729 const intptr_t kNumInputs = 2; 4729 const intptr_t kNumInputs = 2;
4730 const intptr_t kNumTemps = 1; 4730 const intptr_t kNumTemps = 1;
4731 LocationSummary* summary = new(isolate) LocationSummary( 4731 LocationSummary* summary = new(zone) LocationSummary(
4732 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4732 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4733 summary->set_in(0, Location::RequiresFpuRegister()); 4733 summary->set_in(0, Location::RequiresFpuRegister());
4734 summary->set_in(1, Location::RequiresFpuRegister()); 4734 summary->set_in(1, Location::RequiresFpuRegister());
4735 // Reuse the left register so that code can be made shorter. 4735 // Reuse the left register so that code can be made shorter.
4736 summary->set_out(0, Location::SameAsFirstInput()); 4736 summary->set_out(0, Location::SameAsFirstInput());
4737 summary->set_temp(0, Location::RequiresRegister()); 4737 summary->set_temp(0, Location::RequiresRegister());
4738 return summary; 4738 return summary;
4739 } 4739 }
4740 ASSERT(result_cid() == kSmiCid); 4740 ASSERT(result_cid() == kSmiCid);
4741 const intptr_t kNumInputs = 2; 4741 const intptr_t kNumInputs = 2;
4742 const intptr_t kNumTemps = 0; 4742 const intptr_t kNumTemps = 0;
4743 LocationSummary* summary = new(isolate) LocationSummary( 4743 LocationSummary* summary = new(zone) LocationSummary(
4744 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4744 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4745 summary->set_in(0, Location::RequiresRegister()); 4745 summary->set_in(0, Location::RequiresRegister());
4746 summary->set_in(1, Location::RequiresRegister()); 4746 summary->set_in(1, Location::RequiresRegister());
4747 // Reuse the left register so that code can be made shorter. 4747 // Reuse the left register so that code can be made shorter.
4748 summary->set_out(0, Location::SameAsFirstInput()); 4748 summary->set_out(0, Location::SameAsFirstInput());
4749 return summary; 4749 return summary;
4750 } 4750 }
4751 4751
4752 4752
4753 void MathMinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4753 void MathMinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4754 ASSERT((op_kind() == MethodRecognizer::kMathMin) || 4754 ASSERT((op_kind() == MethodRecognizer::kMathMin) ||
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
4806 __ cmpq(left, right); 4806 __ cmpq(left, right);
4807 ASSERT(result == left); 4807 ASSERT(result == left);
4808 if (is_min) { 4808 if (is_min) {
4809 __ cmovgeq(result, right); 4809 __ cmovgeq(result, right);
4810 } else { 4810 } else {
4811 __ cmovlessq(result, right); 4811 __ cmovlessq(result, right);
4812 } 4812 }
4813 } 4813 }
4814 4814
4815 4815
4816 LocationSummary* Int32ToDoubleInstr::MakeLocationSummary(Isolate* isolate, 4816 LocationSummary* Int32ToDoubleInstr::MakeLocationSummary(Zone* zone,
4817 bool opt) const { 4817 bool opt) const {
4818 const intptr_t kNumInputs = 1; 4818 const intptr_t kNumInputs = 1;
4819 const intptr_t kNumTemps = 0; 4819 const intptr_t kNumTemps = 0;
4820 LocationSummary* result = new(isolate) LocationSummary( 4820 LocationSummary* result = new(zone) LocationSummary(
4821 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4821 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4822 result->set_in(0, Location::RequiresRegister()); 4822 result->set_in(0, Location::RequiresRegister());
4823 result->set_out(0, Location::RequiresFpuRegister()); 4823 result->set_out(0, Location::RequiresFpuRegister());
4824 return result; 4824 return result;
4825 } 4825 }
4826 4826
4827 4827
4828 void Int32ToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4828 void Int32ToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4829 Register value = locs()->in(0).reg(); 4829 Register value = locs()->in(0).reg();
4830 FpuRegister result = locs()->out(0).fpu_reg(); 4830 FpuRegister result = locs()->out(0).fpu_reg();
4831 __ cvtsi2sdl(result, value); 4831 __ cvtsi2sdl(result, value);
4832 } 4832 }
4833 4833
4834 4834
4835 LocationSummary* SmiToDoubleInstr::MakeLocationSummary(Isolate* isolate, 4835 LocationSummary* SmiToDoubleInstr::MakeLocationSummary(Zone* zone,
4836 bool opt) const { 4836 bool opt) const {
4837 const intptr_t kNumInputs = 1; 4837 const intptr_t kNumInputs = 1;
4838 const intptr_t kNumTemps = 0; 4838 const intptr_t kNumTemps = 0;
4839 LocationSummary* result = new(isolate) LocationSummary( 4839 LocationSummary* result = new(zone) LocationSummary(
4840 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4840 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4841 result->set_in(0, Location::WritableRegister()); 4841 result->set_in(0, Location::WritableRegister());
4842 result->set_out(0, Location::RequiresFpuRegister()); 4842 result->set_out(0, Location::RequiresFpuRegister());
4843 return result; 4843 return result;
4844 } 4844 }
4845 4845
4846 4846
4847 void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4847 void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4848 Register value = locs()->in(0).reg(); 4848 Register value = locs()->in(0).reg();
4849 FpuRegister result = locs()->out(0).fpu_reg(); 4849 FpuRegister result = locs()->out(0).fpu_reg();
4850 __ SmiUntag(value); 4850 __ SmiUntag(value);
4851 __ cvtsi2sdq(result, value); 4851 __ cvtsi2sdq(result, value);
4852 } 4852 }
4853 4853
4854 4854
4855 LocationSummary* MintToDoubleInstr::MakeLocationSummary(Isolate* isolate, 4855 LocationSummary* MintToDoubleInstr::MakeLocationSummary(Zone* zone,
4856 bool opt) const { 4856 bool opt) const {
4857 UNIMPLEMENTED(); 4857 UNIMPLEMENTED();
4858 return NULL; 4858 return NULL;
4859 } 4859 }
4860 4860
4861 4861
4862 void MintToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4862 void MintToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4863 UNIMPLEMENTED(); 4863 UNIMPLEMENTED();
4864 } 4864 }
4865 4865
4866 4866
4867 LocationSummary* DoubleToIntegerInstr::MakeLocationSummary(Isolate* isolate, 4867 LocationSummary* DoubleToIntegerInstr::MakeLocationSummary(Zone* zone,
4868 bool opt) const { 4868 bool opt) const {
4869 const intptr_t kNumInputs = 1; 4869 const intptr_t kNumInputs = 1;
4870 const intptr_t kNumTemps = 1; 4870 const intptr_t kNumTemps = 1;
4871 LocationSummary* result = new(isolate) LocationSummary( 4871 LocationSummary* result = new(zone) LocationSummary(
4872 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 4872 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
4873 result->set_in(0, Location::RegisterLocation(RCX)); 4873 result->set_in(0, Location::RegisterLocation(RCX));
4874 result->set_out(0, Location::RegisterLocation(RAX)); 4874 result->set_out(0, Location::RegisterLocation(RAX));
4875 result->set_temp(0, Location::RegisterLocation(RBX)); 4875 result->set_temp(0, Location::RegisterLocation(RBX));
4876 return result; 4876 return result;
4877 } 4877 }
4878 4878
4879 4879
4880 void DoubleToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4880 void DoubleToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4881 Register result = locs()->out(0).reg(); 4881 Register result = locs()->out(0).reg();
4882 Register value_obj = locs()->in(0).reg(); 4882 Register value_obj = locs()->in(0).reg();
(...skipping 27 matching lines...) Expand all
4910 instance_call()->token_pos(), 4910 instance_call()->token_pos(),
4911 target, 4911 target,
4912 kNumberOfArguments, 4912 kNumberOfArguments,
4913 Object::null_array(), // No argument names. 4913 Object::null_array(), // No argument names.
4914 locs(), 4914 locs(),
4915 ICData::Handle()); 4915 ICData::Handle());
4916 __ Bind(&done); 4916 __ Bind(&done);
4917 } 4917 }
4918 4918
4919 4919
4920 LocationSummary* DoubleToSmiInstr::MakeLocationSummary(Isolate* isolate, 4920 LocationSummary* DoubleToSmiInstr::MakeLocationSummary(Zone* zone,
4921 bool opt) const { 4921 bool opt) const {
4922 const intptr_t kNumInputs = 1; 4922 const intptr_t kNumInputs = 1;
4923 const intptr_t kNumTemps = 1; 4923 const intptr_t kNumTemps = 1;
4924 LocationSummary* result = new(isolate) LocationSummary( 4924 LocationSummary* result = new(zone) LocationSummary(
4925 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4925 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4926 result->set_in(0, Location::RequiresFpuRegister()); 4926 result->set_in(0, Location::RequiresFpuRegister());
4927 result->set_out(0, Location::RequiresRegister()); 4927 result->set_out(0, Location::RequiresRegister());
4928 result->set_temp(0, Location::RequiresRegister()); 4928 result->set_temp(0, Location::RequiresRegister());
4929 return result; 4929 return result;
4930 } 4930 }
4931 4931
4932 4932
4933 void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4933 void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4934 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptDoubleToSmi); 4934 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptDoubleToSmi);
4935 Register result = locs()->out(0).reg(); 4935 Register result = locs()->out(0).reg();
4936 XmmRegister value = locs()->in(0).fpu_reg(); 4936 XmmRegister value = locs()->in(0).fpu_reg();
4937 Register temp = locs()->temp(0).reg(); 4937 Register temp = locs()->temp(0).reg();
4938 4938
4939 __ cvttsd2siq(result, value); 4939 __ cvttsd2siq(result, value);
4940 // Overflow is signalled with minint. 4940 // Overflow is signalled with minint.
4941 Label do_call, done; 4941 Label do_call, done;
4942 // Check for overflow and that it fits into Smi. 4942 // Check for overflow and that it fits into Smi.
4943 __ movq(temp, result); 4943 __ movq(temp, result);
4944 __ shlq(temp, Immediate(1)); 4944 __ shlq(temp, Immediate(1));
4945 __ j(OVERFLOW, deopt); 4945 __ j(OVERFLOW, deopt);
4946 __ SmiTag(result); 4946 __ SmiTag(result);
4947 if (FLAG_throw_on_javascript_int_overflow) { 4947 if (FLAG_throw_on_javascript_int_overflow) {
4948 EmitJavascriptOverflowCheck(compiler, range(), deopt, result); 4948 EmitJavascriptOverflowCheck(compiler, range(), deopt, result);
4949 } 4949 }
4950 } 4950 }
4951 4951
4952 4952
4953 LocationSummary* DoubleToDoubleInstr::MakeLocationSummary(Isolate* isolate, 4953 LocationSummary* DoubleToDoubleInstr::MakeLocationSummary(Zone* zone,
4954 bool opt) const { 4954 bool opt) const {
4955 const intptr_t kNumInputs = 1; 4955 const intptr_t kNumInputs = 1;
4956 const intptr_t kNumTemps = 0; 4956 const intptr_t kNumTemps = 0;
4957 LocationSummary* result = new(isolate) LocationSummary( 4957 LocationSummary* result = new(zone) LocationSummary(
4958 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4958 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4959 result->set_in(0, Location::RequiresFpuRegister()); 4959 result->set_in(0, Location::RequiresFpuRegister());
4960 result->set_out(0, Location::RequiresFpuRegister()); 4960 result->set_out(0, Location::RequiresFpuRegister());
4961 return result; 4961 return result;
4962 } 4962 }
4963 4963
4964 4964
4965 void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4965 void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4966 XmmRegister value = locs()->in(0).fpu_reg(); 4966 XmmRegister value = locs()->in(0).fpu_reg();
4967 XmmRegister result = locs()->out(0).fpu_reg(); 4967 XmmRegister result = locs()->out(0).fpu_reg();
4968 switch (recognized_kind()) { 4968 switch (recognized_kind()) {
4969 case MethodRecognizer::kDoubleTruncate: 4969 case MethodRecognizer::kDoubleTruncate:
4970 __ roundsd(result, value, Assembler::kRoundToZero); 4970 __ roundsd(result, value, Assembler::kRoundToZero);
4971 break; 4971 break;
4972 case MethodRecognizer::kDoubleFloor: 4972 case MethodRecognizer::kDoubleFloor:
4973 __ roundsd(result, value, Assembler::kRoundDown); 4973 __ roundsd(result, value, Assembler::kRoundDown);
4974 break; 4974 break;
4975 case MethodRecognizer::kDoubleCeil: 4975 case MethodRecognizer::kDoubleCeil:
4976 __ roundsd(result, value, Assembler::kRoundUp); 4976 __ roundsd(result, value, Assembler::kRoundUp);
4977 break; 4977 break;
4978 default: 4978 default:
4979 UNREACHABLE(); 4979 UNREACHABLE();
4980 } 4980 }
4981 } 4981 }
4982 4982
4983 4983
4984 LocationSummary* DoubleToFloatInstr::MakeLocationSummary(Isolate* isolate, 4984 LocationSummary* DoubleToFloatInstr::MakeLocationSummary(Zone* zone,
4985 bool opt) const { 4985 bool opt) const {
4986 const intptr_t kNumInputs = 1; 4986 const intptr_t kNumInputs = 1;
4987 const intptr_t kNumTemps = 0; 4987 const intptr_t kNumTemps = 0;
4988 LocationSummary* result = new(isolate) LocationSummary( 4988 LocationSummary* result = new(zone) LocationSummary(
4989 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4989 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4990 result->set_in(0, Location::RequiresFpuRegister()); 4990 result->set_in(0, Location::RequiresFpuRegister());
4991 result->set_out(0, Location::SameAsFirstInput()); 4991 result->set_out(0, Location::SameAsFirstInput());
4992 return result; 4992 return result;
4993 } 4993 }
4994 4994
4995 4995
4996 void DoubleToFloatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4996 void DoubleToFloatInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4997 __ cvtsd2ss(locs()->out(0).fpu_reg(), locs()->in(0).fpu_reg()); 4997 __ cvtsd2ss(locs()->out(0).fpu_reg(), locs()->in(0).fpu_reg());
4998 } 4998 }
4999 4999
5000 5000
5001 LocationSummary* FloatToDoubleInstr::MakeLocationSummary(Isolate* isolate, 5001 LocationSummary* FloatToDoubleInstr::MakeLocationSummary(Zone* zone,
5002 bool opt) const { 5002 bool opt) const {
5003 const intptr_t kNumInputs = 1; 5003 const intptr_t kNumInputs = 1;
5004 const intptr_t kNumTemps = 0; 5004 const intptr_t kNumTemps = 0;
5005 LocationSummary* result = new(isolate) LocationSummary( 5005 LocationSummary* result = new(zone) LocationSummary(
5006 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5006 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5007 result->set_in(0, Location::RequiresFpuRegister()); 5007 result->set_in(0, Location::RequiresFpuRegister());
5008 result->set_out(0, Location::SameAsFirstInput()); 5008 result->set_out(0, Location::SameAsFirstInput());
5009 return result; 5009 return result;
5010 } 5010 }
5011 5011
5012 5012
5013 void FloatToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5013 void FloatToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5014 __ cvtss2sd(locs()->out(0).fpu_reg(), locs()->in(0).fpu_reg()); 5014 __ cvtss2sd(locs()->out(0).fpu_reg(), locs()->in(0).fpu_reg());
5015 } 5015 }
5016 5016
5017 5017
5018 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(Isolate* isolate, 5018 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(Zone* zone,
5019 bool opt) const { 5019 bool opt) const {
5020 // Calling convention on x64 uses XMM0 and XMM1 to pass the first two 5020 // Calling convention on x64 uses XMM0 and XMM1 to pass the first two
5021 // double arguments and XMM0 to return the result. Unfortunately 5021 // double arguments and XMM0 to return the result. Unfortunately
5022 // currently we can't specify these registers because ParallelMoveResolver 5022 // currently we can't specify these registers because ParallelMoveResolver
5023 // assumes that XMM0 is free at all times. 5023 // assumes that XMM0 is free at all times.
5024 // TODO(vegorov): allow XMM0 to be used. 5024 // TODO(vegorov): allow XMM0 to be used.
5025 ASSERT((InputCount() == 1) || (InputCount() == 2)); 5025 ASSERT((InputCount() == 1) || (InputCount() == 2));
5026 const intptr_t kNumTemps = 5026 const intptr_t kNumTemps =
5027 (recognized_kind() == MethodRecognizer::kMathDoublePow) ? 3 : 1; 5027 (recognized_kind() == MethodRecognizer::kMathDoublePow) ? 3 : 1;
5028 LocationSummary* result = new(isolate) LocationSummary( 5028 LocationSummary* result = new(zone) LocationSummary(
5029 isolate, InputCount(), kNumTemps, LocationSummary::kCall); 5029 zone, InputCount(), kNumTemps, LocationSummary::kCall);
5030 result->set_temp(0, Location::RegisterLocation(R13)); 5030 result->set_temp(0, Location::RegisterLocation(R13));
5031 result->set_in(0, Location::FpuRegisterLocation(XMM2)); 5031 result->set_in(0, Location::FpuRegisterLocation(XMM2));
5032 if (InputCount() == 2) { 5032 if (InputCount() == 2) {
5033 result->set_in(1, Location::FpuRegisterLocation(XMM1)); 5033 result->set_in(1, Location::FpuRegisterLocation(XMM1));
5034 } 5034 }
5035 if (recognized_kind() == MethodRecognizer::kMathDoublePow) { 5035 if (recognized_kind() == MethodRecognizer::kMathDoublePow) {
5036 // Temp index 1. 5036 // Temp index 1.
5037 result->set_temp(1, Location::RegisterLocation(RAX)); 5037 result->set_temp(1, Location::RegisterLocation(RAX));
5038 // Temp index 2. 5038 // Temp index 2.
5039 result->set_temp(2, Location::FpuRegisterLocation(XMM4)); 5039 result->set_temp(2, Location::FpuRegisterLocation(XMM4));
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
5191 ASSERT(locs()->in(1).fpu_reg() == XMM1); 5191 ASSERT(locs()->in(1).fpu_reg() == XMM1);
5192 } 5192 }
5193 5193
5194 __ CallRuntime(TargetFunction(), InputCount()); 5194 __ CallRuntime(TargetFunction(), InputCount());
5195 __ movaps(locs()->out(0).fpu_reg(), XMM0); 5195 __ movaps(locs()->out(0).fpu_reg(), XMM0);
5196 // Restore RSP. 5196 // Restore RSP.
5197 __ movq(RSP, locs()->temp(kSavedSpTempIndex).reg()); 5197 __ movq(RSP, locs()->temp(kSavedSpTempIndex).reg());
5198 } 5198 }
5199 5199
5200 5200
5201 LocationSummary* ExtractNthOutputInstr::MakeLocationSummary(Isolate* isolate, 5201 LocationSummary* ExtractNthOutputInstr::MakeLocationSummary(Zone* zone,
5202 bool opt) const { 5202 bool opt) const {
5203 // Only use this instruction in optimized code. 5203 // Only use this instruction in optimized code.
5204 ASSERT(opt); 5204 ASSERT(opt);
5205 const intptr_t kNumInputs = 1; 5205 const intptr_t kNumInputs = 1;
5206 LocationSummary* summary = new(isolate) LocationSummary( 5206 LocationSummary* summary = new(zone) LocationSummary(
5207 isolate, kNumInputs, 0, LocationSummary::kNoCall); 5207 zone, kNumInputs, 0, LocationSummary::kNoCall);
5208 if (representation() == kUnboxedDouble) { 5208 if (representation() == kUnboxedDouble) {
5209 if (index() == 0) { 5209 if (index() == 0) {
5210 summary->set_in(0, Location::Pair(Location::RequiresFpuRegister(), 5210 summary->set_in(0, Location::Pair(Location::RequiresFpuRegister(),
5211 Location::Any())); 5211 Location::Any()));
5212 } else { 5212 } else {
5213 ASSERT(index() == 1); 5213 ASSERT(index() == 1);
5214 summary->set_in(0, Location::Pair(Location::Any(), 5214 summary->set_in(0, Location::Pair(Location::Any(),
5215 Location::RequiresFpuRegister())); 5215 Location::RequiresFpuRegister()));
5216 } 5216 }
5217 summary->set_out(0, Location::RequiresFpuRegister()); 5217 summary->set_out(0, Location::RequiresFpuRegister());
(...skipping 23 matching lines...) Expand all
5241 __ movaps(out, in); 5241 __ movaps(out, in);
5242 } else { 5242 } else {
5243 ASSERT(representation() == kTagged); 5243 ASSERT(representation() == kTagged);
5244 Register out = locs()->out(0).reg(); 5244 Register out = locs()->out(0).reg();
5245 Register in = in_loc.reg(); 5245 Register in = in_loc.reg();
5246 __ movq(out, in); 5246 __ movq(out, in);
5247 } 5247 }
5248 } 5248 }
5249 5249
5250 5250
5251 LocationSummary* MergedMathInstr::MakeLocationSummary(Isolate* isolate, 5251 LocationSummary* MergedMathInstr::MakeLocationSummary(Zone* zone,
5252 bool opt) const { 5252 bool opt) const {
5253 if (kind() == MergedMathInstr::kTruncDivMod) { 5253 if (kind() == MergedMathInstr::kTruncDivMod) {
5254 const intptr_t kNumInputs = 2; 5254 const intptr_t kNumInputs = 2;
5255 const intptr_t kNumTemps = 0; 5255 const intptr_t kNumTemps = 0;
5256 LocationSummary* summary = new(isolate) LocationSummary( 5256 LocationSummary* summary = new(zone) LocationSummary(
5257 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5257 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5258 // Both inputs must be writable because they will be untagged. 5258 // Both inputs must be writable because they will be untagged.
5259 summary->set_in(0, Location::RegisterLocation(RAX)); 5259 summary->set_in(0, Location::RegisterLocation(RAX));
5260 summary->set_in(1, Location::WritableRegister()); 5260 summary->set_in(1, Location::WritableRegister());
5261 summary->set_out(0, Location::Pair(Location::RegisterLocation(RAX), 5261 summary->set_out(0, Location::Pair(Location::RegisterLocation(RAX),
5262 Location::RegisterLocation(RDX))); 5262 Location::RegisterLocation(RDX)));
5263 return summary; 5263 return summary;
5264 } 5264 }
5265 if (kind() == MergedMathInstr::kSinCos) { 5265 if (kind() == MergedMathInstr::kSinCos) {
5266 const intptr_t kNumInputs = 1; 5266 const intptr_t kNumInputs = 1;
5267 const intptr_t kNumTemps = 1; 5267 const intptr_t kNumTemps = 1;
5268 LocationSummary* summary = new(isolate) LocationSummary( 5268 LocationSummary* summary = new(zone) LocationSummary(
5269 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 5269 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
5270 // Because we always call into the runtime (LocationSummary::kCall) we 5270 // Because we always call into the runtime (LocationSummary::kCall) we
5271 // must specify each input, temp, and output register explicitly. 5271 // must specify each input, temp, and output register explicitly.
5272 summary->set_in(0, Location::FpuRegisterLocation(XMM1)); 5272 summary->set_in(0, Location::FpuRegisterLocation(XMM1));
5273 // R13 is chosen because it is callee saved so we do not need to back it 5273 // R13 is chosen because it is callee saved so we do not need to back it
5274 // up before calling into the runtime. 5274 // up before calling into the runtime.
5275 summary->set_temp(0, Location::RegisterLocation(R13)); 5275 summary->set_temp(0, Location::RegisterLocation(R13));
5276 summary->set_out(0, Location::Pair(Location::FpuRegisterLocation(XMM2), 5276 summary->set_out(0, Location::Pair(Location::FpuRegisterLocation(XMM2),
5277 Location::FpuRegisterLocation(XMM3))); 5277 Location::FpuRegisterLocation(XMM3)));
5278 return summary; 5278 return summary;
5279 } 5279 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
5417 // Restore RSP. 5417 // Restore RSP.
5418 __ movq(RSP, locs()->temp(0).reg()); 5418 __ movq(RSP, locs()->temp(0).reg());
5419 5419
5420 return; 5420 return;
5421 } 5421 }
5422 UNIMPLEMENTED(); 5422 UNIMPLEMENTED();
5423 } 5423 }
5424 5424
5425 5425
5426 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary( 5426 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary(
5427 Isolate* isolate, bool opt) const { 5427 Zone* zone, bool opt) const {
5428 return MakeCallSummary(isolate); 5428 return MakeCallSummary(zone);
5429 } 5429 }
5430 5430
5431 5431
5432 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5432 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5433 ASSERT(ic_data().NumArgsTested() == 1); 5433 ASSERT(ic_data().NumArgsTested() == 1);
5434 if (!with_checks()) { 5434 if (!with_checks()) {
5435 ASSERT(ic_data().HasOneTarget()); 5435 ASSERT(ic_data().HasOneTarget());
5436 const Function& target = Function::ZoneHandle(ic_data().GetTargetAt(0)); 5436 const Function& target = Function::ZoneHandle(ic_data().GetTargetAt(0));
5437 compiler->GenerateStaticCall(deopt_id(), 5437 compiler->GenerateStaticCall(deopt_id(),
5438 instance_call()->token_pos(), 5438 instance_call()->token_pos(),
(...skipping 18 matching lines...) Expand all
5457 RDI, // Class id register. 5457 RDI, // Class id register.
5458 instance_call()->ArgumentCount(), 5458 instance_call()->ArgumentCount(),
5459 instance_call()->argument_names(), 5459 instance_call()->argument_names(),
5460 deopt, 5460 deopt,
5461 deopt_id(), 5461 deopt_id(),
5462 instance_call()->token_pos(), 5462 instance_call()->token_pos(),
5463 locs()); 5463 locs());
5464 } 5464 }
5465 5465
5466 5466
5467 LocationSummary* BranchInstr::MakeLocationSummary(Isolate* isolate, 5467 LocationSummary* BranchInstr::MakeLocationSummary(Zone* zone,
5468 bool opt) const { 5468 bool opt) const {
5469 comparison()->InitializeLocationSummary(isolate, opt); 5469 comparison()->InitializeLocationSummary(zone, opt);
5470 // Branches don't produce a result. 5470 // Branches don't produce a result.
5471 comparison()->locs()->set_out(0, Location::NoLocation()); 5471 comparison()->locs()->set_out(0, Location::NoLocation());
5472 return comparison()->locs(); 5472 return comparison()->locs();
5473 } 5473 }
5474 5474
5475 5475
5476 void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5476 void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5477 comparison()->EmitBranchCode(compiler, this); 5477 comparison()->EmitBranchCode(compiler, this);
5478 } 5478 }
5479 5479
5480 5480
5481 LocationSummary* CheckClassInstr::MakeLocationSummary(Isolate* isolate, 5481 LocationSummary* CheckClassInstr::MakeLocationSummary(Zone* zone,
5482 bool opt) const { 5482 bool opt) const {
5483 const intptr_t kNumInputs = 1; 5483 const intptr_t kNumInputs = 1;
5484 const bool need_mask_temp = IsDenseSwitch() && !IsDenseMask(ComputeCidMask()); 5484 const bool need_mask_temp = IsDenseSwitch() && !IsDenseMask(ComputeCidMask());
5485 const intptr_t kNumTemps = !IsNullCheck() ? (need_mask_temp ? 2 : 1) : 0; 5485 const intptr_t kNumTemps = !IsNullCheck() ? (need_mask_temp ? 2 : 1) : 0;
5486 LocationSummary* summary = new(isolate) LocationSummary( 5486 LocationSummary* summary = new(zone) LocationSummary(
5487 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5487 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5488 summary->set_in(0, Location::RequiresRegister()); 5488 summary->set_in(0, Location::RequiresRegister());
5489 if (!IsNullCheck()) { 5489 if (!IsNullCheck()) {
5490 summary->set_temp(0, Location::RequiresRegister()); 5490 summary->set_temp(0, Location::RequiresRegister());
5491 if (need_mask_temp) { 5491 if (need_mask_temp) {
5492 summary->set_temp(1, Location::RequiresRegister()); 5492 summary->set_temp(1, Location::RequiresRegister());
5493 } 5493 }
5494 } 5494 }
5495 return summary; 5495 return summary;
5496 } 5496 }
5497 5497
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
5552 } else { 5552 } else {
5553 __ j(EQUAL, &is_ok); 5553 __ j(EQUAL, &is_ok);
5554 } 5554 }
5555 } 5555 }
5556 } 5556 }
5557 } 5557 }
5558 __ Bind(&is_ok); 5558 __ Bind(&is_ok);
5559 } 5559 }
5560 5560
5561 5561
5562 LocationSummary* CheckSmiInstr::MakeLocationSummary(Isolate* isolate, 5562 LocationSummary* CheckSmiInstr::MakeLocationSummary(Zone* zone,
5563 bool opt) const { 5563 bool opt) const {
5564 const intptr_t kNumInputs = 1; 5564 const intptr_t kNumInputs = 1;
5565 const intptr_t kNumTemps = 0; 5565 const intptr_t kNumTemps = 0;
5566 LocationSummary* summary = new(isolate) LocationSummary( 5566 LocationSummary* summary = new(zone) LocationSummary(
5567 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5567 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5568 summary->set_in(0, Location::RequiresRegister()); 5568 summary->set_in(0, Location::RequiresRegister());
5569 return summary; 5569 return summary;
5570 } 5570 }
5571 5571
5572 5572
5573 void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5573 void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5574 Register value = locs()->in(0).reg(); 5574 Register value = locs()->in(0).reg();
5575 Label* deopt = compiler->AddDeoptStub(deopt_id(), 5575 Label* deopt = compiler->AddDeoptStub(deopt_id(),
5576 ICData::kDeoptCheckSmi, 5576 ICData::kDeoptCheckSmi,
5577 licm_hoisted_ ? ICData::kHoisted : 0); 5577 licm_hoisted_ ? ICData::kHoisted : 0);
5578 __ testq(value, Immediate(kSmiTagMask)); 5578 __ testq(value, Immediate(kSmiTagMask));
5579 __ j(NOT_ZERO, deopt); 5579 __ j(NOT_ZERO, deopt);
5580 } 5580 }
5581 5581
5582 5582
5583 LocationSummary* CheckClassIdInstr::MakeLocationSummary(Isolate* isolate, 5583 LocationSummary* CheckClassIdInstr::MakeLocationSummary(Zone* zone,
5584 bool opt) const { 5584 bool opt) const {
5585 const intptr_t kNumInputs = 1; 5585 const intptr_t kNumInputs = 1;
5586 const intptr_t kNumTemps = 0; 5586 const intptr_t kNumTemps = 0;
5587 LocationSummary* summary = new(isolate) LocationSummary( 5587 LocationSummary* summary = new(zone) LocationSummary(
5588 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5588 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5589 summary->set_in(0, Location::RequiresRegister()); 5589 summary->set_in(0, Location::RequiresRegister());
5590 return summary; 5590 return summary;
5591 } 5591 }
5592 5592
5593 5593
5594 void CheckClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5594 void CheckClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5595 Register value = locs()->in(0).reg(); 5595 Register value = locs()->in(0).reg();
5596 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckClass); 5596 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckClass);
5597 __ CompareImmediate(value, Immediate(Smi::RawValue(cid_)), PP); 5597 __ CompareImmediate(value, Immediate(Smi::RawValue(cid_)), PP);
5598 __ j(NOT_ZERO, deopt); 5598 __ j(NOT_ZERO, deopt);
5599 } 5599 }
5600 5600
5601 5601
5602 LocationSummary* CheckArrayBoundInstr::MakeLocationSummary(Isolate* isolate, 5602 LocationSummary* CheckArrayBoundInstr::MakeLocationSummary(Zone* zone,
5603 bool opt) const { 5603 bool opt) const {
5604 const intptr_t kNumInputs = 2; 5604 const intptr_t kNumInputs = 2;
5605 const intptr_t kNumTemps = 0; 5605 const intptr_t kNumTemps = 0;
5606 LocationSummary* locs = new(isolate) LocationSummary( 5606 LocationSummary* locs = new(zone) LocationSummary(
5607 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5607 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5608 locs->set_in(kLengthPos, Location::RegisterOrSmiConstant(length())); 5608 locs->set_in(kLengthPos, Location::RegisterOrSmiConstant(length()));
5609 locs->set_in(kIndexPos, Location::RegisterOrSmiConstant(index())); 5609 locs->set_in(kIndexPos, Location::RegisterOrSmiConstant(index()));
5610 return locs; 5610 return locs;
5611 } 5611 }
5612 5612
5613 5613
5614 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5614 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5615 uint32_t flags = generalized_ ? ICData::kGeneralized : 0; 5615 uint32_t flags = generalized_ ? ICData::kGeneralized : 0;
5616 flags |= licm_hoisted_ ? ICData::kHoisted : 0; 5616 flags |= licm_hoisted_ ? ICData::kHoisted : 0;
5617 Label* deopt = compiler->AddDeoptStub( 5617 Label* deopt = compiler->AddDeoptStub(
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
5683 case Token::kMUL: 5683 case Token::kMUL:
5684 __ imulq(left, right); 5684 __ imulq(left, right);
5685 break; 5685 break;
5686 default: 5686 default:
5687 UNREACHABLE(); 5687 UNREACHABLE();
5688 } 5688 }
5689 if (deopt != NULL) __ j(OVERFLOW, deopt); 5689 if (deopt != NULL) __ j(OVERFLOW, deopt);
5690 } 5690 }
5691 5691
5692 5692
5693 LocationSummary* BinaryMintOpInstr::MakeLocationSummary(Isolate* isolate, 5693 LocationSummary* BinaryMintOpInstr::MakeLocationSummary(Zone* zone,
5694 bool opt) const { 5694 bool opt) const {
5695 const intptr_t kNumInputs = 2; 5695 const intptr_t kNumInputs = 2;
5696 const intptr_t kNumTemps = 0; 5696 const intptr_t kNumTemps = 0;
5697 LocationSummary* summary = new(isolate) LocationSummary( 5697 LocationSummary* summary = new(zone) LocationSummary(
5698 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5698 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5699 summary->set_in(0, Location::RequiresRegister()); 5699 summary->set_in(0, Location::RequiresRegister());
5700 summary->set_in(1, Location::RequiresRegister()); 5700 summary->set_in(1, Location::RequiresRegister());
5701 summary->set_out(0, Location::SameAsFirstInput()); 5701 summary->set_out(0, Location::SameAsFirstInput());
5702 return summary; 5702 return summary;
5703 } 5703 }
5704 5704
5705 5705
5706 void BinaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5706 void BinaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5707 const Register left = locs()->in(0).reg(); 5707 const Register left = locs()->in(0).reg();
5708 const Register right = locs()->in(1).reg(); 5708 const Register right = locs()->in(1).reg();
5709 const Register out = locs()->out(0).reg(); 5709 const Register out = locs()->out(0).reg();
5710 5710
5711 ASSERT(out == left); 5711 ASSERT(out == left);
5712 5712
5713 Label* deopt = NULL; 5713 Label* deopt = NULL;
5714 if (CanDeoptimize()) { 5714 if (CanDeoptimize()) {
5715 deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinaryMintOp); 5715 deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinaryMintOp);
5716 } 5716 }
5717 5717
5718 EmitInt64Arithmetic(compiler, op_kind(), left, right, deopt); 5718 EmitInt64Arithmetic(compiler, op_kind(), left, right, deopt);
5719 5719
5720 if (FLAG_throw_on_javascript_int_overflow) { 5720 if (FLAG_throw_on_javascript_int_overflow) {
5721 EmitJavascriptOverflowCheck(compiler, range(), deopt, out); 5721 EmitJavascriptOverflowCheck(compiler, range(), deopt, out);
5722 } 5722 }
5723 } 5723 }
5724 5724
5725 5725
5726 LocationSummary* UnaryMintOpInstr::MakeLocationSummary(Isolate* isolate, 5726 LocationSummary* UnaryMintOpInstr::MakeLocationSummary(Zone* zone,
5727 bool opt) const { 5727 bool opt) const {
5728 const intptr_t kNumInputs = 1; 5728 const intptr_t kNumInputs = 1;
5729 const intptr_t kNumTemps = 0; 5729 const intptr_t kNumTemps = 0;
5730 LocationSummary* summary = new(isolate) LocationSummary( 5730 LocationSummary* summary = new(zone) LocationSummary(
5731 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5731 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5732 summary->set_in(0, Location::RequiresRegister()); 5732 summary->set_in(0, Location::RequiresRegister());
5733 summary->set_out(0, Location::SameAsFirstInput()); 5733 summary->set_out(0, Location::SameAsFirstInput());
5734 return summary; 5734 return summary;
5735 } 5735 }
5736 5736
5737 5737
5738 void UnaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5738 void UnaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5739 ASSERT(op_kind() == Token::kBIT_NOT); 5739 ASSERT(op_kind() == Token::kBIT_NOT);
5740 const Register left = locs()->in(0).reg(); 5740 const Register left = locs()->in(0).reg();
5741 const Register out = locs()->out(0).reg(); 5741 const Register out = locs()->out(0).reg();
(...skipping 13 matching lines...) Expand all
5755 5755
5756 5756
5757 static const intptr_t kMintShiftCountLimit = 63; 5757 static const intptr_t kMintShiftCountLimit = 63;
5758 5758
5759 bool ShiftMintOpInstr::has_shift_count_check() const { 5759 bool ShiftMintOpInstr::has_shift_count_check() const {
5760 return !RangeUtils::IsWithin( 5760 return !RangeUtils::IsWithin(
5761 right()->definition()->range(), 0, kMintShiftCountLimit); 5761 right()->definition()->range(), 0, kMintShiftCountLimit);
5762 } 5762 }
5763 5763
5764 5764
5765 LocationSummary* ShiftMintOpInstr::MakeLocationSummary(Isolate* isolate, 5765 LocationSummary* ShiftMintOpInstr::MakeLocationSummary(Zone* zone,
5766 bool opt) const { 5766 bool opt) const {
5767 const intptr_t kNumInputs = 2; 5767 const intptr_t kNumInputs = 2;
5768 const intptr_t kNumTemps = can_overflow() ? 1 : 0; 5768 const intptr_t kNumTemps = can_overflow() ? 1 : 0;
5769 LocationSummary* summary = new(isolate) LocationSummary( 5769 LocationSummary* summary = new(zone) LocationSummary(
5770 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5770 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5771 summary->set_in(0, Location::RequiresRegister()); 5771 summary->set_in(0, Location::RequiresRegister());
5772 summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), RCX)); 5772 summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), RCX));
5773 if (kNumTemps > 0) { 5773 if (kNumTemps > 0) {
5774 summary->set_temp(0, Location::RequiresRegister()); 5774 summary->set_temp(0, Location::RequiresRegister());
5775 } 5775 }
5776 summary->set_out(0, Location::SameAsFirstInput()); 5776 summary->set_out(0, Location::SameAsFirstInput());
5777 return summary; 5777 return summary;
5778 } 5778 }
5779 5779
5780 5780
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
5861 CompileType ShiftUint32OpInstr::ComputeType() const { 5861 CompileType ShiftUint32OpInstr::ComputeType() const {
5862 return CompileType::FromCid(kSmiCid); 5862 return CompileType::FromCid(kSmiCid);
5863 } 5863 }
5864 5864
5865 5865
5866 CompileType UnaryUint32OpInstr::ComputeType() const { 5866 CompileType UnaryUint32OpInstr::ComputeType() const {
5867 return CompileType::FromCid(kSmiCid); 5867 return CompileType::FromCid(kSmiCid);
5868 } 5868 }
5869 5869
5870 5870
5871 LocationSummary* BinaryUint32OpInstr::MakeLocationSummary(Isolate* isolate, 5871 LocationSummary* BinaryUint32OpInstr::MakeLocationSummary(Zone* zone,
5872 bool opt) const { 5872 bool opt) const {
5873 const intptr_t kNumInputs = 2; 5873 const intptr_t kNumInputs = 2;
5874 const intptr_t kNumTemps = (op_kind() == Token::kMUL) ? 1 : 0; 5874 const intptr_t kNumTemps = (op_kind() == Token::kMUL) ? 1 : 0;
5875 LocationSummary* summary = new(isolate) LocationSummary( 5875 LocationSummary* summary = new(zone) LocationSummary(
5876 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5876 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5877 summary->set_in(0, Location::RequiresRegister()); 5877 summary->set_in(0, Location::RequiresRegister());
5878 summary->set_in(1, Location::RequiresRegister()); 5878 summary->set_in(1, Location::RequiresRegister());
5879 summary->set_out(0, Location::SameAsFirstInput()); 5879 summary->set_out(0, Location::SameAsFirstInput());
5880 return summary; 5880 return summary;
5881 } 5881 }
5882 5882
5883 5883
5884 template<typename OperandType> 5884 template<typename OperandType>
5885 static void EmitIntegerArithmetic(FlowGraphCompiler* compiler, 5885 static void EmitIntegerArithmetic(FlowGraphCompiler* compiler,
5886 Token::Kind op_kind, 5886 Token::Kind op_kind,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
5926 case Token::kSUB: 5926 case Token::kSUB:
5927 case Token::kMUL: 5927 case Token::kMUL:
5928 EmitIntegerArithmetic(compiler, op_kind(), left, right, NULL); 5928 EmitIntegerArithmetic(compiler, op_kind(), left, right, NULL);
5929 return; 5929 return;
5930 default: 5930 default:
5931 UNREACHABLE(); 5931 UNREACHABLE();
5932 } 5932 }
5933 } 5933 }
5934 5934
5935 5935
5936 LocationSummary* ShiftUint32OpInstr::MakeLocationSummary(Isolate* isolate, 5936 LocationSummary* ShiftUint32OpInstr::MakeLocationSummary(Zone* zone,
5937 bool opt) const { 5937 bool opt) const {
5938 const intptr_t kNumInputs = 2; 5938 const intptr_t kNumInputs = 2;
5939 const intptr_t kNumTemps = 0; 5939 const intptr_t kNumTemps = 0;
5940 LocationSummary* summary = new(isolate) LocationSummary( 5940 LocationSummary* summary = new(zone) LocationSummary(
5941 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5941 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5942 summary->set_in(0, Location::RequiresRegister()); 5942 summary->set_in(0, Location::RequiresRegister());
5943 summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), RCX)); 5943 summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), RCX));
5944 summary->set_out(0, Location::SameAsFirstInput()); 5944 summary->set_out(0, Location::SameAsFirstInput());
5945 return summary; 5945 return summary;
5946 } 5946 }
5947 5947
5948 5948
5949 void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5949 void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5950 const intptr_t kShifterLimit = 31; 5950 const intptr_t kShifterLimit = 31;
5951 5951
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
6010 6010
6011 __ Bind(&zero); 6011 __ Bind(&zero);
6012 // Shift was greater than 31 bits, just return zero. 6012 // Shift was greater than 31 bits, just return zero.
6013 __ xorq(left, left); 6013 __ xorq(left, left);
6014 6014
6015 // Exit path. 6015 // Exit path.
6016 __ Bind(&done); 6016 __ Bind(&done);
6017 } 6017 }
6018 6018
6019 6019
6020 LocationSummary* UnaryUint32OpInstr::MakeLocationSummary(Isolate* isolate, 6020 LocationSummary* UnaryUint32OpInstr::MakeLocationSummary(Zone* zone,
6021 bool opt) const { 6021 bool opt) const {
6022 const intptr_t kNumInputs = 1; 6022 const intptr_t kNumInputs = 1;
6023 const intptr_t kNumTemps = 0; 6023 const intptr_t kNumTemps = 0;
6024 LocationSummary* summary = new(isolate) LocationSummary( 6024 LocationSummary* summary = new(zone) LocationSummary(
6025 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 6025 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
6026 summary->set_in(0, Location::RequiresRegister()); 6026 summary->set_in(0, Location::RequiresRegister());
6027 summary->set_out(0, Location::SameAsFirstInput()); 6027 summary->set_out(0, Location::SameAsFirstInput());
6028 return summary; 6028 return summary;
6029 } 6029 }
6030 6030
6031 6031
6032 void UnaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6032 void UnaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6033 Register out = locs()->out(0).reg(); 6033 Register out = locs()->out(0).reg();
6034 ASSERT(locs()->in(0).reg() == out); 6034 ASSERT(locs()->in(0).reg() == out);
6035 6035
6036 ASSERT(op_kind() == Token::kBIT_NOT); 6036 ASSERT(op_kind() == Token::kBIT_NOT);
6037 6037
6038 __ notl(out); 6038 __ notl(out);
6039 } 6039 }
6040 6040
6041 6041
6042 DEFINE_UNIMPLEMENTED_INSTRUCTION(BinaryInt32OpInstr) 6042 DEFINE_UNIMPLEMENTED_INSTRUCTION(BinaryInt32OpInstr)
6043 6043
6044 6044
6045 LocationSummary* UnboxedIntConverterInstr::MakeLocationSummary(Isolate* isolate, 6045 LocationSummary* UnboxedIntConverterInstr::MakeLocationSummary(Zone* zone,
6046 bool opt) const { 6046 bool opt) const {
6047 const intptr_t kNumInputs = 1; 6047 const intptr_t kNumInputs = 1;
6048 const intptr_t kNumTemps = 0; 6048 const intptr_t kNumTemps = 0;
6049 LocationSummary* summary = new(isolate) LocationSummary( 6049 LocationSummary* summary = new(zone) LocationSummary(
6050 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 6050 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
6051 if (from() == kUnboxedMint) { 6051 if (from() == kUnboxedMint) {
6052 ASSERT((to() == kUnboxedUint32) || (to() == kUnboxedInt32)); 6052 ASSERT((to() == kUnboxedUint32) || (to() == kUnboxedInt32));
6053 summary->set_in(0, Location::RequiresRegister()); 6053 summary->set_in(0, Location::RequiresRegister());
6054 summary->set_out(0, Location::SameAsFirstInput()); 6054 summary->set_out(0, Location::SameAsFirstInput());
6055 } else if (to() == kUnboxedMint) { 6055 } else if (to() == kUnboxedMint) {
6056 ASSERT((from() == kUnboxedInt32) || (from() == kUnboxedUint32)); 6056 ASSERT((from() == kUnboxedInt32) || (from() == kUnboxedUint32));
6057 summary->set_in(0, Location::RequiresRegister()); 6057 summary->set_in(0, Location::RequiresRegister());
6058 summary->set_out(0, Location::SameAsFirstInput()); 6058 summary->set_out(0, Location::SameAsFirstInput());
6059 } else { 6059 } else {
6060 ASSERT((to() == kUnboxedUint32) || (to() == kUnboxedInt32)); 6060 ASSERT((to() == kUnboxedUint32) || (to() == kUnboxedInt32));
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
6114 // Sign extend. 6114 // Sign extend.
6115 ASSERT(from() == kUnboxedInt32); 6115 ASSERT(from() == kUnboxedInt32);
6116 __ movsxd(out, value); 6116 __ movsxd(out, value);
6117 } 6117 }
6118 } else { 6118 } else {
6119 UNREACHABLE(); 6119 UNREACHABLE();
6120 } 6120 }
6121 } 6121 }
6122 6122
6123 6123
6124 LocationSummary* ThrowInstr::MakeLocationSummary(Isolate* isolate, 6124 LocationSummary* ThrowInstr::MakeLocationSummary(Zone* zone,
6125 bool opt) const { 6125 bool opt) const {
6126 return new(isolate) LocationSummary(isolate, 0, 0, LocationSummary::kCall); 6126 return new(zone) LocationSummary(zone, 0, 0, LocationSummary::kCall);
6127 } 6127 }
6128 6128
6129 6129
6130 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6130 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6131 compiler->GenerateRuntimeCall(token_pos(), 6131 compiler->GenerateRuntimeCall(token_pos(),
6132 deopt_id(), 6132 deopt_id(),
6133 kThrowRuntimeEntry, 6133 kThrowRuntimeEntry,
6134 1, 6134 1,
6135 locs()); 6135 locs());
6136 __ int3(); 6136 __ int3();
6137 } 6137 }
6138 6138
6139 6139
6140 LocationSummary* ReThrowInstr::MakeLocationSummary(Isolate* isolate, 6140 LocationSummary* ReThrowInstr::MakeLocationSummary(Zone* zone,
6141 bool opt) const { 6141 bool opt) const {
6142 return new(isolate) LocationSummary(isolate, 0, 0, LocationSummary::kCall); 6142 return new(zone) LocationSummary(zone, 0, 0, LocationSummary::kCall);
6143 } 6143 }
6144 6144
6145 6145
6146 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6146 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6147 compiler->SetNeedsStacktrace(catch_try_index()); 6147 compiler->SetNeedsStacktrace(catch_try_index());
6148 compiler->GenerateRuntimeCall(token_pos(), 6148 compiler->GenerateRuntimeCall(token_pos(),
6149 deopt_id(), 6149 deopt_id(),
6150 kReThrowRuntimeEntry, 6150 kReThrowRuntimeEntry,
6151 2, 6151 2,
6152 locs()); 6152 locs());
6153 __ int3(); 6153 __ int3();
6154 } 6154 }
6155 6155
6156 6156
6157 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6157 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6158 if (!compiler->CanFallThroughTo(normal_entry())) { 6158 if (!compiler->CanFallThroughTo(normal_entry())) {
6159 __ jmp(compiler->GetJumpLabel(normal_entry())); 6159 __ jmp(compiler->GetJumpLabel(normal_entry()));
6160 } 6160 }
6161 } 6161 }
6162 6162
6163 6163
6164 LocationSummary* GotoInstr::MakeLocationSummary(Isolate* isolate, 6164 LocationSummary* GotoInstr::MakeLocationSummary(Zone* zone,
6165 bool opt) const { 6165 bool opt) const {
6166 return new(isolate) LocationSummary(isolate, 0, 0, LocationSummary::kNoCall); 6166 return new(zone) LocationSummary(zone, 0, 0, LocationSummary::kNoCall);
6167 } 6167 }
6168 6168
6169 6169
6170 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6170 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6171 if (!compiler->is_optimizing()) { 6171 if (!compiler->is_optimizing()) {
6172 if (FLAG_emit_edge_counters) { 6172 if (FLAG_emit_edge_counters) {
6173 compiler->EmitEdgeCounter(); 6173 compiler->EmitEdgeCounter();
6174 } 6174 }
6175 // Add a deoptimization descriptor for deoptimizing instructions that 6175 // Add a deoptimization descriptor for deoptimizing instructions that
6176 // may be inserted before this instruction. This descriptor points 6176 // may be inserted before this instruction. This descriptor points
6177 // after the edge counter for uniformity with ARM and MIPS, where we can 6177 // after the edge counter for uniformity with ARM and MIPS, where we can
6178 // reuse pattern matching that matches backwards from the end of the 6178 // reuse pattern matching that matches backwards from the end of the
6179 // pattern. 6179 // pattern.
6180 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, 6180 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
6181 GetDeoptId(), 6181 GetDeoptId(),
6182 Scanner::kNoSourcePos); 6182 Scanner::kNoSourcePos);
6183 } 6183 }
6184 if (HasParallelMove()) { 6184 if (HasParallelMove()) {
6185 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 6185 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
6186 } 6186 }
6187 6187
6188 // We can fall through if the successor is the next block in the list. 6188 // We can fall through if the successor is the next block in the list.
6189 // Otherwise, we need a jump. 6189 // Otherwise, we need a jump.
6190 if (!compiler->CanFallThroughTo(successor())) { 6190 if (!compiler->CanFallThroughTo(successor())) {
6191 __ jmp(compiler->GetJumpLabel(successor())); 6191 __ jmp(compiler->GetJumpLabel(successor()));
6192 } 6192 }
6193 } 6193 }
6194 6194
6195 6195
6196 LocationSummary* IndirectGotoInstr::MakeLocationSummary(Isolate* isolate, 6196 LocationSummary* IndirectGotoInstr::MakeLocationSummary(Zone* zone,
6197 bool opt) const { 6197 bool opt) const {
6198 const intptr_t kNumInputs = 1; 6198 const intptr_t kNumInputs = 1;
6199 const intptr_t kNumTemps = 1; 6199 const intptr_t kNumTemps = 1;
6200 6200
6201 LocationSummary* summary = new(isolate) LocationSummary( 6201 LocationSummary* summary = new(zone) LocationSummary(
6202 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 6202 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
6203 6203
6204 summary->set_in(0, Location::RequiresRegister()); 6204 summary->set_in(0, Location::RequiresRegister());
6205 summary->set_temp(0, Location::RequiresRegister()); 6205 summary->set_temp(0, Location::RequiresRegister());
6206 6206
6207 return summary; 6207 return summary;
6208 } 6208 }
6209 6209
6210 6210
6211 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6211 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6212 Register offset_reg = locs()->in(0).reg(); 6212 Register offset_reg = locs()->in(0).reg();
6213 Register target_address_reg = locs()->temp_slot(0)->reg(); 6213 Register target_address_reg = locs()->temp_slot(0)->reg();
6214 6214
6215 // Load from [current frame pointer] + kPcMarkerSlotFromFp. 6215 // Load from [current frame pointer] + kPcMarkerSlotFromFp.
6216 __ movq(target_address_reg, Address(RBP, kPcMarkerSlotFromFp * kWordSize)); 6216 __ movq(target_address_reg, Address(RBP, kPcMarkerSlotFromFp * kWordSize));
6217 6217
6218 // Calculate the final absolute address. 6218 // Calculate the final absolute address.
6219 if (offset()->definition()->representation() == kTagged) { 6219 if (offset()->definition()->representation() == kTagged) {
6220 __ SmiUntag(offset_reg); 6220 __ SmiUntag(offset_reg);
6221 } 6221 }
6222 __ addq(target_address_reg, offset_reg); 6222 __ addq(target_address_reg, offset_reg);
6223 6223
6224 // Jump to the absolute address. 6224 // Jump to the absolute address.
6225 __ jmp(target_address_reg); 6225 __ jmp(target_address_reg);
6226 } 6226 }
6227 6227
6228 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate, 6228 LocationSummary* StrictCompareInstr::MakeLocationSummary(Zone* zone,
6229 bool opt) const { 6229 bool opt) const {
6230 const intptr_t kNumInputs = 2; 6230 const intptr_t kNumInputs = 2;
6231 const intptr_t kNumTemps = 0; 6231 const intptr_t kNumTemps = 0;
6232 if (needs_number_check()) { 6232 if (needs_number_check()) {
6233 LocationSummary* locs = new(isolate) LocationSummary( 6233 LocationSummary* locs = new(zone) LocationSummary(
6234 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 6234 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
6235 locs->set_in(0, Location::RegisterLocation(RAX)); 6235 locs->set_in(0, Location::RegisterLocation(RAX));
6236 locs->set_in(1, Location::RegisterLocation(RCX)); 6236 locs->set_in(1, Location::RegisterLocation(RCX));
6237 locs->set_out(0, Location::RegisterLocation(RAX)); 6237 locs->set_out(0, Location::RegisterLocation(RAX));
6238 return locs; 6238 return locs;
6239 } 6239 }
6240 LocationSummary* locs = new(isolate) LocationSummary( 6240 LocationSummary* locs = new(zone) LocationSummary(
6241 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 6241 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
6242 locs->set_in(0, Location::RegisterOrConstant(left())); 6242 locs->set_in(0, Location::RegisterOrConstant(left()));
6243 // Only one of the inputs can be a constant. Choose register if the first one 6243 // Only one of the inputs can be a constant. Choose register if the first one
6244 // is a constant. 6244 // is a constant.
6245 locs->set_in(1, locs->in(0).IsConstant() 6245 locs->set_in(1, locs->in(0).IsConstant()
6246 ? Location::RequiresRegister() 6246 ? Location::RequiresRegister()
6247 : Location::RegisterOrConstant(right())); 6247 : Location::RegisterOrConstant(right()));
6248 locs->set_out(0, Location::RequiresRegister()); 6248 locs->set_out(0, Location::RequiresRegister());
6249 return locs; 6249 return locs;
6250 } 6250 }
6251 6251
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
6303 void StrictCompareInstr::EmitBranchCode(FlowGraphCompiler* compiler, 6303 void StrictCompareInstr::EmitBranchCode(FlowGraphCompiler* compiler,
6304 BranchInstr* branch) { 6304 BranchInstr* branch) {
6305 ASSERT(kind() == Token::kEQ_STRICT || kind() == Token::kNE_STRICT); 6305 ASSERT(kind() == Token::kEQ_STRICT || kind() == Token::kNE_STRICT);
6306 6306
6307 BranchLabels labels = compiler->CreateBranchLabels(branch); 6307 BranchLabels labels = compiler->CreateBranchLabels(branch);
6308 Condition true_condition = EmitComparisonCode(compiler, labels); 6308 Condition true_condition = EmitComparisonCode(compiler, labels);
6309 EmitBranchOnCondition(compiler, true_condition, labels); 6309 EmitBranchOnCondition(compiler, true_condition, labels);
6310 } 6310 }
6311 6311
6312 6312
6313 LocationSummary* ClosureCallInstr::MakeLocationSummary(Isolate* isolate, 6313 LocationSummary* ClosureCallInstr::MakeLocationSummary(Zone* zone,
6314 bool opt) const { 6314 bool opt) const {
6315 const intptr_t kNumInputs = 1; 6315 const intptr_t kNumInputs = 1;
6316 const intptr_t kNumTemps = 0; 6316 const intptr_t kNumTemps = 0;
6317 LocationSummary* summary = new(isolate) LocationSummary( 6317 LocationSummary* summary = new(zone) LocationSummary(
6318 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 6318 zone, kNumInputs, kNumTemps, LocationSummary::kCall);
6319 summary->set_in(0, Location::RegisterLocation(RAX)); // Function. 6319 summary->set_in(0, Location::RegisterLocation(RAX)); // Function.
6320 summary->set_out(0, Location::RegisterLocation(RAX)); 6320 summary->set_out(0, Location::RegisterLocation(RAX));
6321 return summary; 6321 return summary;
6322 } 6322 }
6323 6323
6324 6324
6325 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6325 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6326 // Arguments descriptor is expected in R10. 6326 // Arguments descriptor is expected in R10.
6327 intptr_t argument_count = ArgumentCount(); 6327 intptr_t argument_count = ArgumentCount();
6328 const Array& arguments_descriptor = 6328 const Array& arguments_descriptor =
(...skipping 24 matching lines...) Expand all
6353 // Add deoptimization continuation point after the call and before the 6353 // Add deoptimization continuation point after the call and before the
6354 // arguments are removed. 6354 // arguments are removed.
6355 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, 6355 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
6356 deopt_id_after, 6356 deopt_id_after,
6357 token_pos()); 6357 token_pos());
6358 } 6358 }
6359 __ Drop(argument_count); 6359 __ Drop(argument_count);
6360 } 6360 }
6361 6361
6362 6362
6363 LocationSummary* BooleanNegateInstr::MakeLocationSummary(Isolate* isolate, 6363 LocationSummary* BooleanNegateInstr::MakeLocationSummary(Zone* zone,
6364 bool opt) const { 6364 bool opt) const {
6365 return LocationSummary::Make(isolate, 6365 return LocationSummary::Make(zone,
6366 1, 6366 1,
6367 Location::RequiresRegister(), 6367 Location::RequiresRegister(),
6368 LocationSummary::kNoCall); 6368 LocationSummary::kNoCall);
6369 } 6369 }
6370 6370
6371 6371
6372 void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6372 void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6373 Register value = locs()->in(0).reg(); 6373 Register value = locs()->in(0).reg();
6374 Register result = locs()->out(0).reg(); 6374 Register result = locs()->out(0).reg();
6375 6375
6376 Label done; 6376 Label done;
6377 __ LoadObject(result, Bool::True(), PP); 6377 __ LoadObject(result, Bool::True(), PP);
6378 __ CompareRegisters(result, value); 6378 __ CompareRegisters(result, value);
6379 __ j(NOT_EQUAL, &done, Assembler::kNearJump); 6379 __ j(NOT_EQUAL, &done, Assembler::kNearJump);
6380 __ LoadObject(result, Bool::False(), PP); 6380 __ LoadObject(result, Bool::False(), PP);
6381 __ Bind(&done); 6381 __ Bind(&done);
6382 } 6382 }
6383 6383
6384 6384
6385 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Isolate* isolate, 6385 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Zone* zone,
6386 bool opt) const { 6386 bool opt) const {
6387 return MakeCallSummary(isolate); 6387 return MakeCallSummary(zone);
6388 } 6388 }
6389 6389
6390 6390
6391 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6391 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6392 Isolate* isolate = compiler->isolate(); 6392 Isolate* isolate = compiler->isolate();
6393 StubCode* stub_code = isolate->stub_code(); 6393 StubCode* stub_code = isolate->stub_code();
6394 const Code& stub = Code::Handle(isolate, 6394 const Code& stub = Code::Handle(isolate,
6395 stub_code->GetAllocationStubForClass(cls())); 6395 stub_code->GetAllocationStubForClass(cls()));
6396 const ExternalLabel label(stub.EntryPoint()); 6396 const ExternalLabel label(stub.EntryPoint());
6397 compiler->GenerateCall(token_pos(), 6397 compiler->GenerateCall(token_pos(),
(...skipping 14 matching lines...) Expand all
6412 __ movq(R10, Immediate(kInvalidObjectPointer)); 6412 __ movq(R10, Immediate(kInvalidObjectPointer));
6413 __ movq(RBX, Immediate(kInvalidObjectPointer)); 6413 __ movq(RBX, Immediate(kInvalidObjectPointer));
6414 #endif 6414 #endif
6415 } 6415 }
6416 6416
6417 } // namespace dart 6417 } // namespace dart
6418 6418
6419 #undef __ 6419 #undef __
6420 6420
6421 #endif // defined TARGET_ARCH_X64 6421 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | runtime/vm/locations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698