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

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

Issue 296003013: - Reduce the number of Isolate::Current() calls. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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
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 10 matching lines...) Expand all
21 namespace dart { 21 namespace dart {
22 22
23 DECLARE_FLAG(int, optimization_counter_threshold); 23 DECLARE_FLAG(int, optimization_counter_threshold);
24 DECLARE_FLAG(bool, propagate_ic_data); 24 DECLARE_FLAG(bool, propagate_ic_data);
25 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); 25 DECLARE_FLAG(bool, throw_on_javascript_int_overflow);
26 DECLARE_FLAG(bool, use_osr); 26 DECLARE_FLAG(bool, use_osr);
27 27
28 // Generic summary for call instructions that have all arguments pushed 28 // Generic summary for call instructions that have all arguments pushed
29 // on the stack and return the result in a fixed register RAX. 29 // on the stack and return the result in a fixed register RAX.
30 LocationSummary* Instruction::MakeCallSummary() { 30 LocationSummary* Instruction::MakeCallSummary() {
31 LocationSummary* result = new LocationSummary(0, 0, LocationSummary::kCall); 31 LocationSummary* result = new LocationSummary(
32 Isolate::Current(), 0, 0, LocationSummary::kCall);
32 result->set_out(0, Location::RegisterLocation(RAX)); 33 result->set_out(0, Location::RegisterLocation(RAX));
33 return result; 34 return result;
34 } 35 }
35 36
36 37
37 LocationSummary* PushArgumentInstr::MakeLocationSummary(bool opt) const { 38 LocationSummary* PushArgumentInstr::MakeLocationSummary(Isolate* isolate,
39 bool opt) const {
38 const intptr_t kNumInputs = 1; 40 const intptr_t kNumInputs = 1;
39 const intptr_t kNumTemps= 0; 41 const intptr_t kNumTemps= 0;
40 LocationSummary* locs = 42 LocationSummary* locs = new(isolate) LocationSummary(
41 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 43 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
42 locs->set_in(0, Location::AnyOrConstant(value())); 44 locs->set_in(0, Location::AnyOrConstant(value()));
43 return locs; 45 return locs;
44 } 46 }
45 47
46 48
47 void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 49 void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
48 // In SSA mode, we need an explicit push. Nothing to do in non-SSA mode 50 // In SSA mode, we need an explicit push. Nothing to do in non-SSA mode
49 // where PushArgument is handled by BindInstr::EmitNativeCode. 51 // where PushArgument is handled by BindInstr::EmitNativeCode.
50 if (compiler->is_optimizing()) { 52 if (compiler->is_optimizing()) {
51 Location value = locs()->in(0); 53 Location value = locs()->in(0);
52 if (value.IsRegister()) { 54 if (value.IsRegister()) {
53 __ pushq(value.reg()); 55 __ pushq(value.reg());
54 } else if (value.IsConstant()) { 56 } else if (value.IsConstant()) {
55 __ PushObject(value.constant(), PP); 57 __ PushObject(value.constant(), PP);
56 } else { 58 } else {
57 ASSERT(value.IsStackSlot()); 59 ASSERT(value.IsStackSlot());
58 __ pushq(value.ToStackSlotAddress()); 60 __ pushq(value.ToStackSlotAddress());
59 } 61 }
60 } 62 }
61 } 63 }
62 64
63 65
64 LocationSummary* ReturnInstr::MakeLocationSummary(bool opt) const { 66 LocationSummary* ReturnInstr::MakeLocationSummary(Isolate* isolate,
67 bool opt) const {
65 const intptr_t kNumInputs = 1; 68 const intptr_t kNumInputs = 1;
66 const intptr_t kNumTemps = 0; 69 const intptr_t kNumTemps = 0;
67 LocationSummary* locs = 70 LocationSummary* locs = new(isolate) LocationSummary(
68 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 71 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
69 locs->set_in(0, Location::RegisterLocation(RAX)); 72 locs->set_in(0, Location::RegisterLocation(RAX));
70 return locs; 73 return locs;
71 } 74 }
72 75
73 76
74 // Attempt optimized compilation at return instruction instead of at the entry. 77 // Attempt optimized compilation at return instruction instead of at the entry.
75 // The entry needs to be patchable, no inlined objects are allowed in the area 78 // The entry needs to be patchable, no inlined objects are allowed in the area
76 // that will be overwritten by the patch instruction: a jump). 79 // that will be overwritten by the patch instruction: a jump).
77 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 80 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
78 Register result = locs()->in(0).reg(); 81 Register result = locs()->in(0).reg();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 117 }
115 118
116 119
117 // Detect pattern when one value is zero and another is a power of 2. 120 // Detect pattern when one value is zero and another is a power of 2.
118 static bool IsPowerOfTwoKind(intptr_t v1, intptr_t v2) { 121 static bool IsPowerOfTwoKind(intptr_t v1, intptr_t v2) {
119 return (Utils::IsPowerOfTwo(v1) && (v2 == 0)) || 122 return (Utils::IsPowerOfTwo(v1) && (v2 == 0)) ||
120 (Utils::IsPowerOfTwo(v2) && (v1 == 0)); 123 (Utils::IsPowerOfTwo(v2) && (v1 == 0));
121 } 124 }
122 125
123 126
124 LocationSummary* IfThenElseInstr::MakeLocationSummary(bool opt) const { 127 LocationSummary* IfThenElseInstr::MakeLocationSummary(Isolate* isolate,
125 comparison()->InitializeLocationSummary(opt); 128 bool opt) const {
129 comparison()->InitializeLocationSummary(isolate, opt);
126 // TODO(vegorov): support byte register constraints in the register allocator. 130 // TODO(vegorov): support byte register constraints in the register allocator.
127 comparison()->locs()->set_out(0, Location::RegisterLocation(RDX)); 131 comparison()->locs()->set_out(0, Location::RegisterLocation(RDX));
128 return comparison()->locs(); 132 return comparison()->locs();
129 } 133 }
130 134
131 135
132 void IfThenElseInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 136 void IfThenElseInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
133 ASSERT(locs()->out(0).reg() == RDX); 137 ASSERT(locs()->out(0).reg() == RDX);
134 138
135 // Clear upper part of the out register. We are going to use setcc on it 139 // 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
171 __ decq(RDX); 175 __ decq(RDX);
172 __ AndImmediate(RDX, 176 __ AndImmediate(RDX,
173 Immediate(Smi::RawValue(true_value) - Smi::RawValue(false_value)), PP); 177 Immediate(Smi::RawValue(true_value) - Smi::RawValue(false_value)), PP);
174 if (false_value != 0) { 178 if (false_value != 0) {
175 __ AddImmediate(RDX, Immediate(Smi::RawValue(false_value)), PP); 179 __ AddImmediate(RDX, Immediate(Smi::RawValue(false_value)), PP);
176 } 180 }
177 } 181 }
178 } 182 }
179 183
180 184
181 LocationSummary* LoadLocalInstr::MakeLocationSummary(bool opt) const { 185 LocationSummary* LoadLocalInstr::MakeLocationSummary(Isolate* isolate,
186 bool opt) const {
182 const intptr_t kNumInputs = 0; 187 const intptr_t kNumInputs = 0;
183 const intptr_t stack_index = (local().index() < 0) 188 const intptr_t stack_index = (local().index() < 0)
184 ? kFirstLocalSlotFromFp - local().index() 189 ? kFirstLocalSlotFromFp - local().index()
185 : kParamEndSlotFromFp - local().index(); 190 : kParamEndSlotFromFp - local().index();
186 return LocationSummary::Make(kNumInputs, 191 return LocationSummary::Make(kNumInputs,
187 Location::StackSlot(stack_index), 192 Location::StackSlot(stack_index),
188 LocationSummary::kNoCall); 193 LocationSummary::kNoCall);
189 } 194 }
190 195
191 196
192 void LoadLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 197 void LoadLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
193 ASSERT(!compiler->is_optimizing()); 198 ASSERT(!compiler->is_optimizing());
194 // Nothing to do. 199 // Nothing to do.
195 } 200 }
196 201
197 202
198 LocationSummary* StoreLocalInstr::MakeLocationSummary(bool opt) const { 203 LocationSummary* StoreLocalInstr::MakeLocationSummary(Isolate* isolate,
204 bool opt) const {
199 const intptr_t kNumInputs = 1; 205 const intptr_t kNumInputs = 1;
200 return LocationSummary::Make(kNumInputs, 206 return LocationSummary::Make(kNumInputs,
201 Location::SameAsFirstInput(), 207 Location::SameAsFirstInput(),
202 LocationSummary::kNoCall); 208 LocationSummary::kNoCall);
203 } 209 }
204 210
205 211
206 void StoreLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 212 void StoreLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
207 Register value = locs()->in(0).reg(); 213 Register value = locs()->in(0).reg();
208 Register result = locs()->out(0).reg(); 214 Register result = locs()->out(0).reg();
209 ASSERT(result == value); // Assert that register assignment is correct. 215 ASSERT(result == value); // Assert that register assignment is correct.
210 __ movq(Address(RBP, local().index() * kWordSize), value); 216 __ movq(Address(RBP, local().index() * kWordSize), value);
211 } 217 }
212 218
213 219
214 LocationSummary* ConstantInstr::MakeLocationSummary(bool opt) const { 220 LocationSummary* ConstantInstr::MakeLocationSummary(Isolate* isolate,
221 bool opt) const {
215 const intptr_t kNumInputs = 0; 222 const intptr_t kNumInputs = 0;
216 return LocationSummary::Make(kNumInputs, 223 return LocationSummary::Make(kNumInputs,
217 Location::RequiresRegister(), 224 Location::RequiresRegister(),
218 LocationSummary::kNoCall); 225 LocationSummary::kNoCall);
219 } 226 }
220 227
221 228
222 void ConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 229 void ConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
223 // The register allocator drops constant definitions that have no uses. 230 // The register allocator drops constant definitions that have no uses.
224 if (!locs()->out(0).IsInvalid()) { 231 if (!locs()->out(0).IsInvalid()) {
225 Register result = locs()->out(0).reg(); 232 Register result = locs()->out(0).reg();
226 __ LoadObject(result, value(), PP); 233 __ LoadObject(result, value(), PP);
227 } 234 }
228 } 235 }
229 236
230 237
231 LocationSummary* UnboxedConstantInstr::MakeLocationSummary(bool opt) const { 238 LocationSummary* UnboxedConstantInstr::MakeLocationSummary(Isolate* isolate,
239 bool opt) const {
232 const intptr_t kNumInputs = 0; 240 const intptr_t kNumInputs = 0;
233 const intptr_t kNumTemps = 0; 241 const intptr_t kNumTemps = 0;
234 LocationSummary* locs = 242 LocationSummary* locs = new(isolate) LocationSummary(
235 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 243 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
236 locs->set_out(0, Location::RequiresFpuRegister()); 244 locs->set_out(0, Location::RequiresFpuRegister());
237 return locs; 245 return locs;
238 } 246 }
239 247
240 248
241 void UnboxedConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 249 void UnboxedConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
242 // The register allocator drops constant definitions that have no uses. 250 // The register allocator drops constant definitions that have no uses.
243 if (!locs()->out(0).IsInvalid()) { 251 if (!locs()->out(0).IsInvalid()) {
244 XmmRegister result = locs()->out(0).fpu_reg(); 252 XmmRegister result = locs()->out(0).fpu_reg();
245 if (Utils::DoublesBitEqual(Double::Cast(value()).value(), 0.0)) { 253 if (Utils::DoublesBitEqual(Double::Cast(value()).value(), 0.0)) {
246 __ xorps(result, result); 254 __ xorps(result, result);
247 } else { 255 } else {
248 __ LoadObject(TMP, value(), PP); 256 __ LoadObject(TMP, value(), PP);
249 __ movsd(result, FieldAddress(TMP, Double::value_offset())); 257 __ movsd(result, FieldAddress(TMP, Double::value_offset()));
250 } 258 }
251 } 259 }
252 } 260 }
253 261
254 262
255 LocationSummary* AssertAssignableInstr::MakeLocationSummary(bool opt) const { 263 LocationSummary* AssertAssignableInstr::MakeLocationSummary(Isolate* isolate,
264 bool opt) const {
256 const intptr_t kNumInputs = 3; 265 const intptr_t kNumInputs = 3;
257 const intptr_t kNumTemps = 0; 266 const intptr_t kNumTemps = 0;
258 LocationSummary* summary = 267 LocationSummary* summary = new(isolate) LocationSummary(
259 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 268 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
260 summary->set_in(0, Location::RegisterLocation(RAX)); // Value. 269 summary->set_in(0, Location::RegisterLocation(RAX)); // Value.
261 summary->set_in(1, Location::RegisterLocation(RCX)); // Instantiator. 270 summary->set_in(1, Location::RegisterLocation(RCX)); // Instantiator.
262 summary->set_in(2, Location::RegisterLocation(RDX)); // Type arguments. 271 summary->set_in(2, Location::RegisterLocation(RDX)); // Type arguments.
263 summary->set_out(0, Location::RegisterLocation(RAX)); 272 summary->set_out(0, Location::RegisterLocation(RAX));
264 return summary; 273 return summary;
265 } 274 }
266 275
267 276
268 LocationSummary* AssertBooleanInstr::MakeLocationSummary(bool opt) const { 277 LocationSummary* AssertBooleanInstr::MakeLocationSummary(Isolate* isolate,
278 bool opt) const {
269 const intptr_t kNumInputs = 1; 279 const intptr_t kNumInputs = 1;
270 const intptr_t kNumTemps = 0; 280 const intptr_t kNumTemps = 0;
271 LocationSummary* locs = 281 LocationSummary* locs = new(isolate) LocationSummary(
272 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 282 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
273 locs->set_in(0, Location::RegisterLocation(RAX)); 283 locs->set_in(0, Location::RegisterLocation(RAX));
274 locs->set_out(0, Location::RegisterLocation(RAX)); 284 locs->set_out(0, Location::RegisterLocation(RAX));
275 return locs; 285 return locs;
276 } 286 }
277 287
278 288
279 static void EmitAssertBoolean(Register reg, 289 static void EmitAssertBoolean(Register reg,
280 intptr_t token_pos, 290 intptr_t token_pos,
281 intptr_t deopt_id, 291 intptr_t deopt_id,
282 LocationSummary* locs, 292 LocationSummary* locs,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 case Token::kGT: return GREATER; 329 case Token::kGT: return GREATER;
320 case Token::kLTE: return LESS_EQUAL; 330 case Token::kLTE: return LESS_EQUAL;
321 case Token::kGTE: return GREATER_EQUAL; 331 case Token::kGTE: return GREATER_EQUAL;
322 default: 332 default:
323 UNREACHABLE(); 333 UNREACHABLE();
324 return OVERFLOW; 334 return OVERFLOW;
325 } 335 }
326 } 336 }
327 337
328 338
329 LocationSummary* EqualityCompareInstr::MakeLocationSummary(bool opt) const { 339 LocationSummary* EqualityCompareInstr::MakeLocationSummary(Isolate* isolate,
340 bool opt) const {
330 const intptr_t kNumInputs = 2; 341 const intptr_t kNumInputs = 2;
331 if (operation_cid() == kDoubleCid) { 342 if (operation_cid() == kDoubleCid) {
332 const intptr_t kNumTemps = 0; 343 const intptr_t kNumTemps = 0;
333 LocationSummary* locs = 344 LocationSummary* locs = new(isolate) LocationSummary(
334 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 345 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
335 locs->set_in(0, Location::RequiresFpuRegister()); 346 locs->set_in(0, Location::RequiresFpuRegister());
336 locs->set_in(1, Location::RequiresFpuRegister()); 347 locs->set_in(1, Location::RequiresFpuRegister());
337 locs->set_out(0, Location::RequiresRegister()); 348 locs->set_out(0, Location::RequiresRegister());
338 return locs; 349 return locs;
339 } 350 }
340 if (operation_cid() == kSmiCid) { 351 if (operation_cid() == kSmiCid) {
341 const intptr_t kNumTemps = 0; 352 const intptr_t kNumTemps = 0;
342 LocationSummary* locs = 353 LocationSummary* locs = new(isolate) LocationSummary(
343 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 354 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
344 locs->set_in(0, Location::RegisterOrConstant(left())); 355 locs->set_in(0, Location::RegisterOrConstant(left()));
345 // Only one input can be a constant operand. The case of two constant 356 // Only one input can be a constant operand. The case of two constant
346 // operands should be handled by constant propagation. 357 // operands should be handled by constant propagation.
347 // Only right can be a stack slot. 358 // Only right can be a stack slot.
348 locs->set_in(1, locs->in(0).IsConstant() 359 locs->set_in(1, locs->in(0).IsConstant()
349 ? Location::RequiresRegister() 360 ? Location::RequiresRegister()
350 : Location::RegisterOrConstant(right())); 361 : Location::RegisterOrConstant(right()));
351 locs->set_out(0, Location::RequiresRegister()); 362 locs->set_out(0, Location::RequiresRegister());
352 return locs; 363 return locs;
353 } 364 }
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 void EqualityCompareInstr::EmitBranchCode(FlowGraphCompiler* compiler, 513 void EqualityCompareInstr::EmitBranchCode(FlowGraphCompiler* compiler,
503 BranchInstr* branch) { 514 BranchInstr* branch) {
504 ASSERT((kind() == Token::kNE) || (kind() == Token::kEQ)); 515 ASSERT((kind() == Token::kNE) || (kind() == Token::kEQ));
505 516
506 BranchLabels labels = compiler->CreateBranchLabels(branch); 517 BranchLabels labels = compiler->CreateBranchLabels(branch);
507 Condition true_condition = EmitComparisonCode(compiler, labels); 518 Condition true_condition = EmitComparisonCode(compiler, labels);
508 EmitBranchOnCondition(compiler, true_condition, labels); 519 EmitBranchOnCondition(compiler, true_condition, labels);
509 } 520 }
510 521
511 522
512 LocationSummary* TestSmiInstr::MakeLocationSummary(bool opt) const { 523 LocationSummary* TestSmiInstr::MakeLocationSummary(Isolate* isolate,
524 bool opt) const {
513 const intptr_t kNumInputs = 2; 525 const intptr_t kNumInputs = 2;
514 const intptr_t kNumTemps = 0; 526 const intptr_t kNumTemps = 0;
515 LocationSummary* locs = 527 LocationSummary* locs = new(isolate) LocationSummary(
516 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 528 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
517 locs->set_in(0, Location::RequiresRegister()); 529 locs->set_in(0, Location::RequiresRegister());
518 // Only one input can be a constant operand. The case of two constant 530 // Only one input can be a constant operand. The case of two constant
519 // operands should be handled by constant propagation. 531 // operands should be handled by constant propagation.
520 locs->set_in(1, Location::RegisterOrConstant(right())); 532 locs->set_in(1, Location::RegisterOrConstant(right()));
521 return locs; 533 return locs;
522 } 534 }
523 535
524 536
525 Condition TestSmiInstr::EmitComparisonCode(FlowGraphCompiler* compiler, 537 Condition TestSmiInstr::EmitComparisonCode(FlowGraphCompiler* compiler,
526 BranchLabels labels) { 538 BranchLabels labels) {
(...skipping 20 matching lines...) Expand all
547 559
548 void TestSmiInstr::EmitBranchCode(FlowGraphCompiler* compiler, 560 void TestSmiInstr::EmitBranchCode(FlowGraphCompiler* compiler,
549 BranchInstr* branch) { 561 BranchInstr* branch) {
550 BranchLabels labels = compiler->CreateBranchLabels(branch); 562 BranchLabels labels = compiler->CreateBranchLabels(branch);
551 Condition true_condition = EmitComparisonCode(compiler, labels); 563 Condition true_condition = EmitComparisonCode(compiler, labels);
552 EmitBranchOnCondition(compiler, true_condition, labels); 564 EmitBranchOnCondition(compiler, true_condition, labels);
553 } 565 }
554 566
555 567
556 568
557 LocationSummary* TestCidsInstr::MakeLocationSummary(bool opt) const { 569 LocationSummary* TestCidsInstr::MakeLocationSummary(Isolate* isolate,
570 bool opt) const {
558 const intptr_t kNumInputs = 1; 571 const intptr_t kNumInputs = 1;
559 const intptr_t kNumTemps = 1; 572 const intptr_t kNumTemps = 1;
560 LocationSummary* locs = 573 LocationSummary* locs = new(isolate) LocationSummary(
561 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 574 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
562 locs->set_in(0, Location::RequiresRegister()); 575 locs->set_in(0, Location::RequiresRegister());
563 locs->set_temp(0, Location::RequiresRegister()); 576 locs->set_temp(0, Location::RequiresRegister());
564 locs->set_out(0, Location::RequiresRegister()); 577 locs->set_out(0, Location::RequiresRegister());
565 return locs; 578 return locs;
566 } 579 }
567 580
568 581
569 Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler, 582 Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler,
570 BranchLabels labels) { 583 BranchLabels labels) {
571 ASSERT((kind() == Token::kIS) || (kind() == Token::kISNOT)); 584 ASSERT((kind() == Token::kIS) || (kind() == Token::kISNOT));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 EmitComparisonCode(compiler, labels); 631 EmitComparisonCode(compiler, labels);
619 __ Bind(&is_false); 632 __ Bind(&is_false);
620 __ LoadObject(result_reg, Bool::False(), PP); 633 __ LoadObject(result_reg, Bool::False(), PP);
621 __ jmp(&done, Assembler::kNearJump); 634 __ jmp(&done, Assembler::kNearJump);
622 __ Bind(&is_true); 635 __ Bind(&is_true);
623 __ LoadObject(result_reg, Bool::True(), PP); 636 __ LoadObject(result_reg, Bool::True(), PP);
624 __ Bind(&done); 637 __ Bind(&done);
625 } 638 }
626 639
627 640
628 LocationSummary* RelationalOpInstr::MakeLocationSummary(bool opt) const { 641 LocationSummary* RelationalOpInstr::MakeLocationSummary(Isolate* isolate,
642 bool opt) const {
629 const intptr_t kNumInputs = 2; 643 const intptr_t kNumInputs = 2;
630 const intptr_t kNumTemps = 0; 644 const intptr_t kNumTemps = 0;
631 if (operation_cid() == kDoubleCid) { 645 if (operation_cid() == kDoubleCid) {
632 LocationSummary* summary = 646 LocationSummary* summary = new(isolate) LocationSummary(
633 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 647 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
634 summary->set_in(0, Location::RequiresFpuRegister()); 648 summary->set_in(0, Location::RequiresFpuRegister());
635 summary->set_in(1, Location::RequiresFpuRegister()); 649 summary->set_in(1, Location::RequiresFpuRegister());
636 summary->set_out(0, Location::RequiresRegister()); 650 summary->set_out(0, Location::RequiresRegister());
637 return summary; 651 return summary;
638 } 652 }
639 ASSERT(operation_cid() == kSmiCid); 653 ASSERT(operation_cid() == kSmiCid);
640 LocationSummary* summary = 654 LocationSummary* summary = new(isolate) LocationSummary(
641 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 655 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
642 summary->set_in(0, Location::RegisterOrConstant(left())); 656 summary->set_in(0, Location::RegisterOrConstant(left()));
643 // Only one input can be a constant operand. The case of two constant 657 // Only one input can be a constant operand. The case of two constant
644 // operands should be handled by constant propagation. 658 // operands should be handled by constant propagation.
645 summary->set_in(1, summary->in(0).IsConstant() 659 summary->set_in(1, summary->in(0).IsConstant()
646 ? Location::RequiresRegister() 660 ? Location::RequiresRegister()
647 : Location::RegisterOrConstant(right())); 661 : Location::RegisterOrConstant(right()));
648 summary->set_out(0, Location::RequiresRegister()); 662 summary->set_out(0, Location::RequiresRegister());
649 return summary; 663 return summary;
650 } 664 }
651 665
(...skipping 27 matching lines...) Expand all
679 693
680 694
681 void RelationalOpInstr::EmitBranchCode(FlowGraphCompiler* compiler, 695 void RelationalOpInstr::EmitBranchCode(FlowGraphCompiler* compiler,
682 BranchInstr* branch) { 696 BranchInstr* branch) {
683 BranchLabels labels = compiler->CreateBranchLabels(branch); 697 BranchLabels labels = compiler->CreateBranchLabels(branch);
684 Condition true_condition = EmitComparisonCode(compiler, labels); 698 Condition true_condition = EmitComparisonCode(compiler, labels);
685 EmitBranchOnCondition(compiler, true_condition, labels); 699 EmitBranchOnCondition(compiler, true_condition, labels);
686 } 700 }
687 701
688 702
689 LocationSummary* NativeCallInstr::MakeLocationSummary(bool opt) const { 703 LocationSummary* NativeCallInstr::MakeLocationSummary(Isolate* isolate,
704 bool opt) const {
690 const intptr_t kNumInputs = 0; 705 const intptr_t kNumInputs = 0;
691 const intptr_t kNumTemps = 3; 706 const intptr_t kNumTemps = 3;
692 LocationSummary* locs = 707 LocationSummary* locs = new(isolate) LocationSummary(
693 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 708 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
694 locs->set_temp(0, Location::RegisterLocation(RAX)); 709 locs->set_temp(0, Location::RegisterLocation(RAX));
695 locs->set_temp(1, Location::RegisterLocation(RBX)); 710 locs->set_temp(1, Location::RegisterLocation(RBX));
696 locs->set_temp(2, Location::RegisterLocation(R10)); 711 locs->set_temp(2, Location::RegisterLocation(R10));
697 locs->set_out(0, Location::RegisterLocation(RAX)); 712 locs->set_out(0, Location::RegisterLocation(RAX));
698 return locs; 713 return locs;
699 } 714 }
700 715
701 716
702 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 717 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
703 ASSERT(locs()->temp(0).reg() == RAX); 718 ASSERT(locs()->temp(0).reg() == RAX);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 const Object& constant = index->definition()->AsConstant()->value(); 750 const Object& constant = index->definition()->AsConstant()->value();
736 if (!constant.IsSmi()) return false; 751 if (!constant.IsSmi()) return false;
737 const Smi& smi_const = Smi::Cast(constant); 752 const Smi& smi_const = Smi::Cast(constant);
738 const intptr_t scale = FlowGraphCompiler::ElementSizeFor(cid); 753 const intptr_t scale = FlowGraphCompiler::ElementSizeFor(cid);
739 const intptr_t data_offset = FlowGraphCompiler::DataOffsetFor(cid); 754 const intptr_t data_offset = FlowGraphCompiler::DataOffsetFor(cid);
740 const int64_t disp = smi_const.AsInt64Value() * scale + data_offset; 755 const int64_t disp = smi_const.AsInt64Value() * scale + data_offset;
741 return Utils::IsInt(32, disp); 756 return Utils::IsInt(32, disp);
742 } 757 }
743 758
744 759
745 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(bool opt) const { 760 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(Isolate* isolate,
761 bool opt) const {
746 const intptr_t kNumInputs = 1; 762 const intptr_t kNumInputs = 1;
747 // TODO(fschneider): Allow immediate operands for the char code. 763 // TODO(fschneider): Allow immediate operands for the char code.
748 return LocationSummary::Make(kNumInputs, 764 return LocationSummary::Make(kNumInputs,
749 Location::RequiresRegister(), 765 Location::RequiresRegister(),
750 LocationSummary::kNoCall); 766 LocationSummary::kNoCall);
751 } 767 }
752 768
753 769
754 void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 770 void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
755 Register char_code = locs()->in(0).reg(); 771 Register char_code = locs()->in(0).reg();
756 Register result = locs()->out(0).reg(); 772 Register result = locs()->out(0).reg();
757 __ LoadImmediate(result, 773 __ LoadImmediate(result,
758 Immediate(reinterpret_cast<uword>(Symbols::PredefinedAddress())), PP); 774 Immediate(reinterpret_cast<uword>(Symbols::PredefinedAddress())), PP);
759 __ movq(result, Address(result, 775 __ movq(result, Address(result,
760 char_code, 776 char_code,
761 TIMES_HALF_WORD_SIZE, // Char code is a smi. 777 TIMES_HALF_WORD_SIZE, // Char code is a smi.
762 Symbols::kNullCharCodeSymbolOffset * kWordSize)); 778 Symbols::kNullCharCodeSymbolOffset * kWordSize));
763 } 779 }
764 780
765 781
766 LocationSummary* StringToCharCodeInstr::MakeLocationSummary(bool opt) const { 782 LocationSummary* StringToCharCodeInstr::MakeLocationSummary(Isolate* isolate,
783 bool opt) const {
767 const intptr_t kNumInputs = 1; 784 const intptr_t kNumInputs = 1;
768 return LocationSummary::Make(kNumInputs, 785 return LocationSummary::Make(kNumInputs,
769 Location::RequiresRegister(), 786 Location::RequiresRegister(),
770 LocationSummary::kNoCall); 787 LocationSummary::kNoCall);
771 } 788 }
772 789
773 790
774 void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 791 void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
775 ASSERT(cid_ == kOneByteStringCid); 792 ASSERT(cid_ == kOneByteStringCid);
776 Register str = locs()->in(0).reg(); 793 Register str = locs()->in(0).reg();
777 Register result = locs()->out(0).reg(); 794 Register result = locs()->out(0).reg();
778 Label is_one, done; 795 Label is_one, done;
779 __ movq(result, FieldAddress(str, String::length_offset())); 796 __ movq(result, FieldAddress(str, String::length_offset()));
780 __ cmpq(result, Immediate(Smi::RawValue(1))); 797 __ cmpq(result, Immediate(Smi::RawValue(1)));
781 __ j(EQUAL, &is_one, Assembler::kNearJump); 798 __ j(EQUAL, &is_one, Assembler::kNearJump);
782 __ movq(result, Immediate(Smi::RawValue(-1))); 799 __ movq(result, Immediate(Smi::RawValue(-1)));
783 __ jmp(&done); 800 __ jmp(&done);
784 __ Bind(&is_one); 801 __ Bind(&is_one);
785 __ movzxb(result, FieldAddress(str, OneByteString::data_offset())); 802 __ movzxb(result, FieldAddress(str, OneByteString::data_offset()));
786 __ SmiTag(result); 803 __ SmiTag(result);
787 __ Bind(&done); 804 __ Bind(&done);
788 } 805 }
789 806
790 807
791 LocationSummary* StringInterpolateInstr::MakeLocationSummary(bool opt) const { 808 LocationSummary* StringInterpolateInstr::MakeLocationSummary(Isolate* isolate,
809 bool opt) const {
792 const intptr_t kNumInputs = 1; 810 const intptr_t kNumInputs = 1;
793 const intptr_t kNumTemps = 0; 811 const intptr_t kNumTemps = 0;
794 LocationSummary* summary = 812 LocationSummary* summary = new(isolate) LocationSummary(
795 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 813 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
796 summary->set_in(0, Location::RegisterLocation(RAX)); 814 summary->set_in(0, Location::RegisterLocation(RAX));
797 summary->set_out(0, Location::RegisterLocation(RAX)); 815 summary->set_out(0, Location::RegisterLocation(RAX));
798 return summary; 816 return summary;
799 } 817 }
800 818
801 819
802 void StringInterpolateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 820 void StringInterpolateInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
803 Register array = locs()->in(0).reg(); 821 Register array = locs()->in(0).reg();
804 __ pushq(array); 822 __ pushq(array);
805 const int kNumberOfArguments = 1; 823 const int kNumberOfArguments = 1;
806 const Array& kNoArgumentNames = Object::null_array(); 824 const Array& kNoArgumentNames = Object::null_array();
807 compiler->GenerateStaticCall(deopt_id(), 825 compiler->GenerateStaticCall(deopt_id(),
808 token_pos(), 826 token_pos(),
809 CallFunction(), 827 CallFunction(),
810 kNumberOfArguments, 828 kNumberOfArguments,
811 kNoArgumentNames, 829 kNoArgumentNames,
812 locs()); 830 locs());
813 ASSERT(locs()->out(0).reg() == RAX); 831 ASSERT(locs()->out(0).reg() == RAX);
814 } 832 }
815 833
816 834
817 LocationSummary* LoadUntaggedInstr::MakeLocationSummary(bool opt) const { 835 LocationSummary* LoadUntaggedInstr::MakeLocationSummary(Isolate* isolate,
836 bool opt) const {
818 const intptr_t kNumInputs = 1; 837 const intptr_t kNumInputs = 1;
819 return LocationSummary::Make(kNumInputs, 838 return LocationSummary::Make(kNumInputs,
820 Location::RequiresRegister(), 839 Location::RequiresRegister(),
821 LocationSummary::kNoCall); 840 LocationSummary::kNoCall);
822 } 841 }
823 842
824 843
825 void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 844 void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
826 Register object = locs()->in(0).reg(); 845 Register object = locs()->in(0).reg();
827 Register result = locs()->out(0).reg(); 846 Register result = locs()->out(0).reg();
828 __ movq(result, FieldAddress(object, offset())); 847 __ movq(result, FieldAddress(object, offset()));
829 } 848 }
830 849
831 850
832 LocationSummary* LoadClassIdInstr::MakeLocationSummary(bool opt) const { 851 LocationSummary* LoadClassIdInstr::MakeLocationSummary(Isolate* isolate,
852 bool opt) const {
833 const intptr_t kNumInputs = 1; 853 const intptr_t kNumInputs = 1;
834 return LocationSummary::Make(kNumInputs, 854 return LocationSummary::Make(kNumInputs,
835 Location::RequiresRegister(), 855 Location::RequiresRegister(),
836 LocationSummary::kNoCall); 856 LocationSummary::kNoCall);
837 } 857 }
838 858
839 859
840 void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 860 void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
841 Register object = locs()->in(0).reg(); 861 Register object = locs()->in(0).reg();
842 Register result = locs()->out(0).reg(); 862 Register result = locs()->out(0).reg();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 return kUnboxedFloat32x4; 933 return kUnboxedFloat32x4;
914 case kTypedDataFloat64x2ArrayCid: 934 case kTypedDataFloat64x2ArrayCid:
915 return kUnboxedFloat64x2; 935 return kUnboxedFloat64x2;
916 default: 936 default:
917 UNIMPLEMENTED(); 937 UNIMPLEMENTED();
918 return kTagged; 938 return kTagged;
919 } 939 }
920 } 940 }
921 941
922 942
923 LocationSummary* LoadIndexedInstr::MakeLocationSummary(bool opt) const { 943 LocationSummary* LoadIndexedInstr::MakeLocationSummary(Isolate* isolate,
944 bool opt) const {
924 const intptr_t kNumInputs = 2; 945 const intptr_t kNumInputs = 2;
925 const intptr_t kNumTemps = 0; 946 const intptr_t kNumTemps = 0;
926 LocationSummary* locs = 947 LocationSummary* locs = new(isolate) LocationSummary(
927 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 948 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
928 locs->set_in(0, Location::RequiresRegister()); 949 locs->set_in(0, Location::RequiresRegister());
929 // The smi index is either untagged (element size == 1), or it is left smi 950 // The smi index is either untagged (element size == 1), or it is left smi
930 // tagged (for all element sizes > 1). 951 // tagged (for all element sizes > 1).
931 if (index_scale() == 1) { 952 if (index_scale() == 1) {
932 locs->set_in(1, CanBeImmediateIndex(index(), class_id()) 953 locs->set_in(1, CanBeImmediateIndex(index(), class_id())
933 ? Location::Constant( 954 ? Location::Constant(
934 index()->definition()->AsConstant()->value()) 955 index()->definition()->AsConstant()->value())
935 : Location::WritableRegister()); 956 : Location::WritableRegister());
936 } else { 957 } else {
937 locs->set_in(1, CanBeImmediateIndex(index(), class_id()) 958 locs->set_in(1, CanBeImmediateIndex(index(), class_id())
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 return kUnboxedInt32x4; 1088 return kUnboxedInt32x4;
1068 case kTypedDataFloat64x2ArrayCid: 1089 case kTypedDataFloat64x2ArrayCid:
1069 return kUnboxedFloat64x2; 1090 return kUnboxedFloat64x2;
1070 default: 1091 default:
1071 UNIMPLEMENTED(); 1092 UNIMPLEMENTED();
1072 return kTagged; 1093 return kTagged;
1073 } 1094 }
1074 } 1095 }
1075 1096
1076 1097
1077 LocationSummary* StoreIndexedInstr::MakeLocationSummary(bool opt) const { 1098 LocationSummary* StoreIndexedInstr::MakeLocationSummary(Isolate* isolate,
1099 bool opt) const {
1078 const intptr_t kNumInputs = 3; 1100 const intptr_t kNumInputs = 3;
1079 const intptr_t kNumTemps = 0; 1101 const intptr_t kNumTemps = 0;
1080 LocationSummary* locs = 1102 LocationSummary* locs = new(isolate) LocationSummary(
1081 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 1103 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
1082 locs->set_in(0, Location::RequiresRegister()); 1104 locs->set_in(0, Location::RequiresRegister());
1083 // The smi index is either untagged (element size == 1), or it is left smi 1105 // The smi index is either untagged (element size == 1), or it is left smi
1084 // tagged (for all element sizes > 1). 1106 // tagged (for all element sizes > 1).
1085 if (index_scale() == 1) { 1107 if (index_scale() == 1) {
1086 locs->set_in(1, CanBeImmediateIndex(index(), class_id()) 1108 locs->set_in(1, CanBeImmediateIndex(index(), class_id())
1087 ? Location::Constant( 1109 ? Location::Constant(
1088 index()->definition()->AsConstant()->value()) 1110 index()->definition()->AsConstant()->value())
1089 : Location::WritableRegister()); 1111 : Location::WritableRegister());
1090 } else { 1112 } else {
1091 locs->set_in(1, CanBeImmediateIndex(index(), class_id()) 1113 locs->set_in(1, CanBeImmediateIndex(index(), class_id())
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 case kTypedDataFloat64x2ArrayCid: 1263 case kTypedDataFloat64x2ArrayCid:
1242 case kTypedDataFloat32x4ArrayCid: 1264 case kTypedDataFloat32x4ArrayCid:
1243 __ movups(element_address, locs()->in(2).fpu_reg()); 1265 __ movups(element_address, locs()->in(2).fpu_reg());
1244 break; 1266 break;
1245 default: 1267 default:
1246 UNREACHABLE(); 1268 UNREACHABLE();
1247 } 1269 }
1248 } 1270 }
1249 1271
1250 1272
1251 LocationSummary* GuardFieldInstr::MakeLocationSummary(bool opt) const { 1273 LocationSummary* GuardFieldInstr::MakeLocationSummary(Isolate* isolate,
1274 bool opt) const {
1252 const intptr_t kNumInputs = 1; 1275 const intptr_t kNumInputs = 1;
1253 LocationSummary* summary = 1276 LocationSummary* summary = new(isolate) LocationSummary(
1254 new LocationSummary(kNumInputs, 0, LocationSummary::kNoCall); 1277 isolate, kNumInputs, 0, LocationSummary::kNoCall);
1255 summary->set_in(0, Location::RequiresRegister()); 1278 summary->set_in(0, Location::RequiresRegister());
1256 const bool field_has_length = field().needs_length_check(); 1279 const bool field_has_length = field().needs_length_check();
1257 const bool need_value_temp_reg = 1280 const bool need_value_temp_reg =
1258 (field_has_length || ((value()->Type()->ToCid() == kDynamicCid) && 1281 (field_has_length || ((value()->Type()->ToCid() == kDynamicCid) &&
1259 (field().guarded_cid() != kSmiCid))); 1282 (field().guarded_cid() != kSmiCid)));
1260 if (need_value_temp_reg) { 1283 if (need_value_temp_reg) {
1261 summary->AddTemp(Location::RequiresRegister()); 1284 summary->AddTemp(Location::RequiresRegister());
1262 } 1285 }
1263 const bool need_field_temp_reg = 1286 const bool need_field_temp_reg =
1264 field_has_length || (field().guarded_cid() == kIllegalCid); 1287 field_has_length || (field().guarded_cid() == kIllegalCid);
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 1638
1616 __ jmp(exit_label()); 1639 __ jmp(exit_label());
1617 } 1640 }
1618 1641
1619 private: 1642 private:
1620 StoreInstanceFieldInstr* instruction_; 1643 StoreInstanceFieldInstr* instruction_;
1621 const Class& cls_; 1644 const Class& cls_;
1622 }; 1645 };
1623 1646
1624 1647
1625 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(bool opt) const { 1648 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Isolate* isolate,
1649 bool opt) const {
1626 const intptr_t kNumInputs = 2; 1650 const intptr_t kNumInputs = 2;
1627 const intptr_t kNumTemps = 0; 1651 const intptr_t kNumTemps = 0;
1628 LocationSummary* summary = 1652 LocationSummary* summary = new(isolate) LocationSummary(
1629 new LocationSummary(kNumInputs, kNumTemps, 1653 isolate, kNumInputs, kNumTemps,
1630 !field().IsNull() && 1654 !field().IsNull() &&
1631 ((field().guarded_cid() == kIllegalCid) || is_initialization_) 1655 ((field().guarded_cid() == kIllegalCid) || is_initialization_)
1632 ? LocationSummary::kCallOnSlowPath 1656 ? LocationSummary::kCallOnSlowPath
1633 : LocationSummary::kNoCall); 1657 : LocationSummary::kNoCall);
1634 1658
1635 summary->set_in(0, Location::RequiresRegister()); 1659 summary->set_in(0, Location::RequiresRegister());
1636 if (IsUnboxedStore() && opt) { 1660 if (IsUnboxedStore() && opt) {
1637 summary->set_in(1, Location::RequiresFpuRegister()); 1661 summary->set_in(1, Location::RequiresFpuRegister());
1638 summary->AddTemp(Location::RequiresRegister()); 1662 summary->AddTemp(Location::RequiresRegister());
1639 summary->AddTemp(Location::RequiresRegister()); 1663 summary->AddTemp(Location::RequiresRegister());
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 } else { 1883 } else {
1860 Register value_reg = locs()->in(1).reg(); 1884 Register value_reg = locs()->in(1).reg();
1861 __ StoreIntoObjectNoBarrier(instance_reg, 1885 __ StoreIntoObjectNoBarrier(instance_reg,
1862 FieldAddress(instance_reg, offset_in_bytes_), value_reg); 1886 FieldAddress(instance_reg, offset_in_bytes_), value_reg);
1863 } 1887 }
1864 } 1888 }
1865 __ Bind(&skip_store); 1889 __ Bind(&skip_store);
1866 } 1890 }
1867 1891
1868 1892
1869 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(bool opt) const { 1893 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Isolate* isolate,
1894 bool opt) const {
1870 const intptr_t kNumInputs = 1; 1895 const intptr_t kNumInputs = 1;
1871 const intptr_t kNumTemps = 0; 1896 const intptr_t kNumTemps = 0;
1872 LocationSummary* summary = 1897 LocationSummary* summary = new(isolate) LocationSummary(
1873 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 1898 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
1874 summary->set_in(0, Location::RequiresRegister()); 1899 summary->set_in(0, Location::RequiresRegister());
1875 summary->set_out(0, Location::RequiresRegister()); 1900 summary->set_out(0, Location::RequiresRegister());
1876 return summary; 1901 return summary;
1877 } 1902 }
1878 1903
1879 1904
1880 // When the parser is building an implicit static getter for optimization, 1905 // When the parser is building an implicit static getter for optimization,
1881 // it can generate a function body where deoptimization ids do not line up 1906 // it can generate a function body where deoptimization ids do not line up
1882 // with the unoptimized code. 1907 // with the unoptimized code.
1883 // 1908 //
1884 // This is safe only so long as LoadStaticFieldInstr cannot deoptimize. 1909 // This is safe only so long as LoadStaticFieldInstr cannot deoptimize.
1885 void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1910 void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1886 Register field = locs()->in(0).reg(); 1911 Register field = locs()->in(0).reg();
1887 Register result = locs()->out(0).reg(); 1912 Register result = locs()->out(0).reg();
1888 __ movq(result, FieldAddress(field, Field::value_offset())); 1913 __ movq(result, FieldAddress(field, Field::value_offset()));
1889 } 1914 }
1890 1915
1891 1916
1892 LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(bool opt) const { 1917 LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(Isolate* isolate,
1893 LocationSummary* locs = new LocationSummary(1, 1, LocationSummary::kNoCall); 1918 bool opt) const {
1919 LocationSummary* locs = new(isolate) LocationSummary(
1920 isolate, 1, 1, LocationSummary::kNoCall);
1894 locs->set_in(0, value()->NeedsStoreBuffer() ? Location::WritableRegister() 1921 locs->set_in(0, value()->NeedsStoreBuffer() ? Location::WritableRegister()
1895 : Location::RequiresRegister()); 1922 : Location::RequiresRegister());
1896 locs->set_temp(0, Location::RequiresRegister()); 1923 locs->set_temp(0, Location::RequiresRegister());
1897 return locs; 1924 return locs;
1898 } 1925 }
1899 1926
1900 1927
1901 void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1928 void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1902 Register value = locs()->in(0).reg(); 1929 Register value = locs()->in(0).reg();
1903 Register temp = locs()->temp(0).reg(); 1930 Register temp = locs()->temp(0).reg();
1904 1931
1905 __ LoadObject(temp, field(), PP); 1932 __ LoadObject(temp, field(), PP);
1906 if (this->value()->NeedsStoreBuffer()) { 1933 if (this->value()->NeedsStoreBuffer()) {
1907 __ StoreIntoObject(temp, 1934 __ StoreIntoObject(temp,
1908 FieldAddress(temp, Field::value_offset()), value, CanValueBeSmi()); 1935 FieldAddress(temp, Field::value_offset()), value, CanValueBeSmi());
1909 } else { 1936 } else {
1910 __ StoreIntoObjectNoBarrier( 1937 __ StoreIntoObjectNoBarrier(
1911 temp, FieldAddress(temp, Field::value_offset()), value); 1938 temp, FieldAddress(temp, Field::value_offset()), value);
1912 } 1939 }
1913 } 1940 }
1914 1941
1915 1942
1916 LocationSummary* InstanceOfInstr::MakeLocationSummary(bool opt) const { 1943 LocationSummary* InstanceOfInstr::MakeLocationSummary(Isolate* isolate,
1944 bool opt) const {
1917 const intptr_t kNumInputs = 3; 1945 const intptr_t kNumInputs = 3;
1918 const intptr_t kNumTemps = 0; 1946 const intptr_t kNumTemps = 0;
1919 LocationSummary* summary = 1947 LocationSummary* summary = new(isolate) LocationSummary(
1920 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 1948 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
1921 summary->set_in(0, Location::RegisterLocation(RAX)); 1949 summary->set_in(0, Location::RegisterLocation(RAX));
1922 summary->set_in(1, Location::RegisterLocation(RCX)); 1950 summary->set_in(1, Location::RegisterLocation(RCX));
1923 summary->set_in(2, Location::RegisterLocation(RDX)); 1951 summary->set_in(2, Location::RegisterLocation(RDX));
1924 summary->set_out(0, Location::RegisterLocation(RAX)); 1952 summary->set_out(0, Location::RegisterLocation(RAX));
1925 return summary; 1953 return summary;
1926 } 1954 }
1927 1955
1928 1956
1929 void InstanceOfInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1957 void InstanceOfInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1930 ASSERT(locs()->in(0).reg() == RAX); // Value. 1958 ASSERT(locs()->in(0).reg() == RAX); // Value.
1931 ASSERT(locs()->in(1).reg() == RCX); // Instantiator. 1959 ASSERT(locs()->in(1).reg() == RCX); // Instantiator.
1932 ASSERT(locs()->in(2).reg() == RDX); // Instantiator type arguments. 1960 ASSERT(locs()->in(2).reg() == RDX); // Instantiator type arguments.
1933 1961
1934 compiler->GenerateInstanceOf(token_pos(), 1962 compiler->GenerateInstanceOf(token_pos(),
1935 deopt_id(), 1963 deopt_id(),
1936 type(), 1964 type(),
1937 negate_result(), 1965 negate_result(),
1938 locs()); 1966 locs());
1939 ASSERT(locs()->out(0).reg() == RAX); 1967 ASSERT(locs()->out(0).reg() == RAX);
1940 } 1968 }
1941 1969
1942 1970
1943 // TODO(srdjan): In case of constant inputs make CreateArray kNoCall and 1971 // TODO(srdjan): In case of constant inputs make CreateArray kNoCall and
1944 // use slow path stub. 1972 // use slow path stub.
1945 LocationSummary* CreateArrayInstr::MakeLocationSummary(bool opt) const { 1973 LocationSummary* CreateArrayInstr::MakeLocationSummary(Isolate* isolate,
1974 bool opt) const {
1946 const intptr_t kNumInputs = 2; 1975 const intptr_t kNumInputs = 2;
1947 const intptr_t kNumTemps = 0; 1976 const intptr_t kNumTemps = 0;
1948 LocationSummary* locs = 1977 LocationSummary* locs = new(isolate) LocationSummary(
1949 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 1978 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
1950 locs->set_in(0, Location::RegisterLocation(RBX)); 1979 locs->set_in(0, Location::RegisterLocation(RBX));
1951 locs->set_in(1, Location::RegisterLocation(R10)); 1980 locs->set_in(1, Location::RegisterLocation(R10));
1952 locs->set_out(0, Location::RegisterLocation(RAX)); 1981 locs->set_out(0, Location::RegisterLocation(RAX));
1953 return locs; 1982 return locs;
1954 } 1983 }
1955 1984
1956 1985
1957 // Inlines array allocation for known constant values. 1986 // Inlines array allocation for known constant values.
1958 static void InlineArrayAllocation(FlowGraphCompiler* compiler, 1987 static void InlineArrayAllocation(FlowGraphCompiler* compiler,
1959 intptr_t num_elements, 1988 intptr_t num_elements,
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
2155 compiler->RestoreLiveRegisters(locs); 2184 compiler->RestoreLiveRegisters(locs);
2156 2185
2157 __ jmp(exit_label()); 2186 __ jmp(exit_label());
2158 } 2187 }
2159 2188
2160 private: 2189 private:
2161 Instruction* instruction_; 2190 Instruction* instruction_;
2162 }; 2191 };
2163 2192
2164 2193
2165 LocationSummary* LoadFieldInstr::MakeLocationSummary(bool opt) const { 2194 LocationSummary* LoadFieldInstr::MakeLocationSummary(Isolate* isolate,
2195 bool opt) const {
2166 const intptr_t kNumInputs = 1; 2196 const intptr_t kNumInputs = 1;
2167 const intptr_t kNumTemps = 0; 2197 const intptr_t kNumTemps = 0;
2168 LocationSummary* locs = 2198 LocationSummary* locs = new(isolate) LocationSummary(
2169 new LocationSummary( 2199 isolate, kNumInputs, kNumTemps,
2170 kNumInputs, kNumTemps,
2171 (opt && !IsPotentialUnboxedLoad()) 2200 (opt && !IsPotentialUnboxedLoad())
2172 ? LocationSummary::kNoCall 2201 ? LocationSummary::kNoCall
2173 : LocationSummary::kCallOnSlowPath); 2202 : LocationSummary::kCallOnSlowPath);
2174 2203
2175 locs->set_in(0, Location::RequiresRegister()); 2204 locs->set_in(0, Location::RequiresRegister());
2176 2205
2177 if (IsUnboxedLoad() && opt) { 2206 if (IsUnboxedLoad() && opt) {
2178 locs->AddTemp(Location::RequiresRegister()); 2207 locs->AddTemp(Location::RequiresRegister());
2179 } else if (IsPotentialUnboxedLoad()) { 2208 } else if (IsPotentialUnboxedLoad()) {
2180 locs->AddTemp(opt ? Location::RequiresFpuRegister() 2209 locs->AddTemp(opt ? Location::RequiresFpuRegister()
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
2299 __ jmp(&done); 2328 __ jmp(&done);
2300 } 2329 }
2301 2330
2302 __ Bind(&load_pointer); 2331 __ Bind(&load_pointer);
2303 } 2332 }
2304 __ movq(result, FieldAddress(instance_reg, offset_in_bytes())); 2333 __ movq(result, FieldAddress(instance_reg, offset_in_bytes()));
2305 __ Bind(&done); 2334 __ Bind(&done);
2306 } 2335 }
2307 2336
2308 2337
2309 LocationSummary* InstantiateTypeInstr::MakeLocationSummary(bool opt) const { 2338 LocationSummary* InstantiateTypeInstr::MakeLocationSummary(Isolate* isolate,
2339 bool opt) const {
2310 const intptr_t kNumInputs = 1; 2340 const intptr_t kNumInputs = 1;
2311 const intptr_t kNumTemps = 0; 2341 const intptr_t kNumTemps = 0;
2312 LocationSummary* locs = 2342 LocationSummary* locs = new(isolate) LocationSummary(
2313 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 2343 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
2314 locs->set_in(0, Location::RegisterLocation(RAX)); 2344 locs->set_in(0, Location::RegisterLocation(RAX));
2315 locs->set_out(0, Location::RegisterLocation(RAX)); 2345 locs->set_out(0, Location::RegisterLocation(RAX));
2316 return locs; 2346 return locs;
2317 } 2347 }
2318 2348
2319 2349
2320 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2350 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2321 Register instantiator_reg = locs()->in(0).reg(); 2351 Register instantiator_reg = locs()->in(0).reg();
2322 Register result_reg = locs()->out(0).reg(); 2352 Register result_reg = locs()->out(0).reg();
2323 2353
2324 // 'instantiator_reg' is the instantiator TypeArguments object (or null). 2354 // 'instantiator_reg' is the instantiator TypeArguments object (or null).
2325 // A runtime call to instantiate the type is required. 2355 // A runtime call to instantiate the type is required.
2326 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. 2356 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result.
2327 __ PushObject(type(), PP); 2357 __ PushObject(type(), PP);
2328 __ pushq(instantiator_reg); // Push instantiator type arguments. 2358 __ pushq(instantiator_reg); // Push instantiator type arguments.
2329 compiler->GenerateRuntimeCall(token_pos(), 2359 compiler->GenerateRuntimeCall(token_pos(),
2330 deopt_id(), 2360 deopt_id(),
2331 kInstantiateTypeRuntimeEntry, 2361 kInstantiateTypeRuntimeEntry,
2332 2, 2362 2,
2333 locs()); 2363 locs());
2334 __ Drop(2); // Drop instantiator and uninstantiated type. 2364 __ Drop(2); // Drop instantiator and uninstantiated type.
2335 __ popq(result_reg); // Pop instantiated type. 2365 __ popq(result_reg); // Pop instantiated type.
2336 ASSERT(instantiator_reg == result_reg); 2366 ASSERT(instantiator_reg == result_reg);
2337 } 2367 }
2338 2368
2339 2369
2340 LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary( 2370 LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary(
2341 bool opt) const { 2371 Isolate* isolate, bool opt) const {
2342 const intptr_t kNumInputs = 1; 2372 const intptr_t kNumInputs = 1;
2343 const intptr_t kNumTemps = 0; 2373 const intptr_t kNumTemps = 0;
2344 LocationSummary* locs = 2374 LocationSummary* locs = new(isolate) LocationSummary(
2345 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 2375 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
2346 locs->set_in(0, Location::RegisterLocation(RAX)); 2376 locs->set_in(0, Location::RegisterLocation(RAX));
2347 locs->set_out(0, Location::RegisterLocation(RAX)); 2377 locs->set_out(0, Location::RegisterLocation(RAX));
2348 return locs; 2378 return locs;
2349 } 2379 }
2350 2380
2351 2381
2352 void InstantiateTypeArgumentsInstr::EmitNativeCode( 2382 void InstantiateTypeArgumentsInstr::EmitNativeCode(
2353 FlowGraphCompiler* compiler) { 2383 FlowGraphCompiler* compiler) {
2354 Register instantiator_reg = locs()->in(0).reg(); 2384 Register instantiator_reg = locs()->in(0).reg();
2355 Register result_reg = locs()->out(0).reg(); 2385 Register result_reg = locs()->out(0).reg();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2402 kInstantiateTypeArgumentsRuntimeEntry, 2432 kInstantiateTypeArgumentsRuntimeEntry,
2403 2, 2433 2,
2404 locs()); 2434 locs());
2405 __ Drop(2); // Drop instantiator and uninstantiated type arguments. 2435 __ Drop(2); // Drop instantiator and uninstantiated type arguments.
2406 __ popq(result_reg); // Pop instantiated type arguments. 2436 __ popq(result_reg); // Pop instantiated type arguments.
2407 __ Bind(&type_arguments_instantiated); 2437 __ Bind(&type_arguments_instantiated);
2408 ASSERT(instantiator_reg == result_reg); 2438 ASSERT(instantiator_reg == result_reg);
2409 } 2439 }
2410 2440
2411 2441
2412 LocationSummary* AllocateContextInstr::MakeLocationSummary(bool opt) const { 2442 LocationSummary* AllocateContextInstr::MakeLocationSummary(Isolate* isolate,
2443 bool opt) const {
2413 const intptr_t kNumInputs = 0; 2444 const intptr_t kNumInputs = 0;
2414 const intptr_t kNumTemps = 1; 2445 const intptr_t kNumTemps = 1;
2415 LocationSummary* locs = 2446 LocationSummary* locs = new(isolate) LocationSummary(
2416 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 2447 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
2417 locs->set_temp(0, Location::RegisterLocation(R10)); 2448 locs->set_temp(0, Location::RegisterLocation(R10));
2418 locs->set_out(0, Location::RegisterLocation(RAX)); 2449 locs->set_out(0, Location::RegisterLocation(RAX));
2419 return locs; 2450 return locs;
2420 } 2451 }
2421 2452
2422 2453
2423 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2454 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2424 ASSERT(locs()->temp(0).reg() == R10); 2455 ASSERT(locs()->temp(0).reg() == R10);
2425 ASSERT(locs()->out(0).reg() == RAX); 2456 ASSERT(locs()->out(0).reg() == RAX);
2426 2457
2427 __ LoadImmediate(R10, Immediate(num_context_variables()), PP); 2458 __ LoadImmediate(R10, Immediate(num_context_variables()), PP);
2428 const ExternalLabel label("alloc_context", 2459 const ExternalLabel label("alloc_context",
2429 StubCode::AllocateContextEntryPoint()); 2460 StubCode::AllocateContextEntryPoint());
2430 compiler->GenerateCall(token_pos(), 2461 compiler->GenerateCall(token_pos(),
2431 &label, 2462 &label,
2432 PcDescriptors::kOther, 2463 PcDescriptors::kOther,
2433 locs()); 2464 locs());
2434 } 2465 }
2435 2466
2436 2467
2437 LocationSummary* CloneContextInstr::MakeLocationSummary(bool opt) const { 2468 LocationSummary* CloneContextInstr::MakeLocationSummary(Isolate* isolate,
2469 bool opt) const {
2438 const intptr_t kNumInputs = 1; 2470 const intptr_t kNumInputs = 1;
2439 const intptr_t kNumTemps = 0; 2471 const intptr_t kNumTemps = 0;
2440 LocationSummary* locs = 2472 LocationSummary* locs = new(isolate) LocationSummary(
2441 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 2473 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
2442 locs->set_in(0, Location::RegisterLocation(RAX)); 2474 locs->set_in(0, Location::RegisterLocation(RAX));
2443 locs->set_out(0, Location::RegisterLocation(RAX)); 2475 locs->set_out(0, Location::RegisterLocation(RAX));
2444 return locs; 2476 return locs;
2445 } 2477 }
2446 2478
2447 2479
2448 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2480 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2449 Register context_value = locs()->in(0).reg(); 2481 Register context_value = locs()->in(0).reg();
2450 Register result = locs()->out(0).reg(); 2482 Register result = locs()->out(0).reg();
2451 2483
2452 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. 2484 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result.
2453 __ pushq(context_value); 2485 __ pushq(context_value);
2454 compiler->GenerateRuntimeCall(token_pos(), 2486 compiler->GenerateRuntimeCall(token_pos(),
2455 deopt_id(), 2487 deopt_id(),
2456 kCloneContextRuntimeEntry, 2488 kCloneContextRuntimeEntry,
2457 1, 2489 1,
2458 locs()); 2490 locs());
2459 __ popq(result); // Remove argument. 2491 __ popq(result); // Remove argument.
2460 __ popq(result); // Get result (cloned context). 2492 __ popq(result); // Get result (cloned context).
2461 } 2493 }
2462 2494
2463 2495
2464 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(bool opt) const { 2496 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Isolate* isolate,
2497 bool opt) const {
2465 UNREACHABLE(); 2498 UNREACHABLE();
2466 return NULL; 2499 return NULL;
2467 } 2500 }
2468 2501
2469 2502
2470 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2503 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2471 __ Bind(compiler->GetJumpLabel(this)); 2504 __ Bind(compiler->GetJumpLabel(this));
2472 compiler->AddExceptionHandler(catch_try_index(), 2505 compiler->AddExceptionHandler(catch_try_index(),
2473 try_index(), 2506 try_index(),
2474 compiler->assembler()->CodeSize(), 2507 compiler->assembler()->CodeSize(),
(...skipping 16 matching lines...) Expand all
2491 2524
2492 // Restore stack and initialize the two exception variables: 2525 // Restore stack and initialize the two exception variables:
2493 // exception and stack trace variables. 2526 // exception and stack trace variables.
2494 __ movq(Address(RBP, exception_var().index() * kWordSize), 2527 __ movq(Address(RBP, exception_var().index() * kWordSize),
2495 kExceptionObjectReg); 2528 kExceptionObjectReg);
2496 __ movq(Address(RBP, stacktrace_var().index() * kWordSize), 2529 __ movq(Address(RBP, stacktrace_var().index() * kWordSize),
2497 kStackTraceObjectReg); 2530 kStackTraceObjectReg);
2498 } 2531 }
2499 2532
2500 2533
2501 LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(bool opt) const { 2534 LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Isolate* isolate,
2535 bool opt) const {
2502 const intptr_t kNumInputs = 0; 2536 const intptr_t kNumInputs = 0;
2503 const intptr_t kNumTemps = 1; 2537 const intptr_t kNumTemps = 1;
2504 LocationSummary* summary = 2538 LocationSummary* summary = new(isolate) LocationSummary(
2505 new LocationSummary(kNumInputs, 2539 isolate, kNumInputs,
2506 kNumTemps, 2540 kNumTemps,
2507 LocationSummary::kCallOnSlowPath); 2541 LocationSummary::kCallOnSlowPath);
2508 summary->set_temp(0, Location::RequiresRegister()); 2542 summary->set_temp(0, Location::RequiresRegister());
2509 return summary; 2543 return summary;
2510 } 2544 }
2511 2545
2512 2546
2513 class CheckStackOverflowSlowPath : public SlowPathCode { 2547 class CheckStackOverflowSlowPath : public SlowPathCode {
2514 public: 2548 public:
2515 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) 2549 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction)
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2735 } 2769 }
2736 } 2770 }
2737 2771
2738 2772
2739 static bool CanBeImmediate(const Object& constant) { 2773 static bool CanBeImmediate(const Object& constant) {
2740 return constant.IsSmi() && 2774 return constant.IsSmi() &&
2741 Immediate(reinterpret_cast<int64_t>(constant.raw())).is_int32(); 2775 Immediate(reinterpret_cast<int64_t>(constant.raw())).is_int32();
2742 } 2776 }
2743 2777
2744 2778
2745 LocationSummary* BinarySmiOpInstr::MakeLocationSummary(bool opt) const { 2779 LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Isolate* isolate,
2780 bool opt) const {
2746 const intptr_t kNumInputs = 2; 2781 const intptr_t kNumInputs = 2;
2747 2782
2748 ConstantInstr* right_constant = right()->definition()->AsConstant(); 2783 ConstantInstr* right_constant = right()->definition()->AsConstant();
2749 if ((right_constant != NULL) && 2784 if ((right_constant != NULL) &&
2750 (op_kind() != Token::kTRUNCDIV) && 2785 (op_kind() != Token::kTRUNCDIV) &&
2751 (op_kind() != Token::kSHL) && 2786 (op_kind() != Token::kSHL) &&
2752 (op_kind() != Token::kMUL) && 2787 (op_kind() != Token::kMUL) &&
2753 (op_kind() != Token::kMOD) && 2788 (op_kind() != Token::kMOD) &&
2754 CanBeImmediate(right_constant->value())) { 2789 CanBeImmediate(right_constant->value())) {
2755 const intptr_t kNumTemps = 0; 2790 const intptr_t kNumTemps = 0;
2756 LocationSummary* summary = 2791 LocationSummary* summary = new(isolate) LocationSummary(
2757 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 2792 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
2758 summary->set_in(0, Location::RequiresRegister()); 2793 summary->set_in(0, Location::RequiresRegister());
2759 summary->set_in(1, Location::Constant(right_constant->value())); 2794 summary->set_in(1, Location::Constant(right_constant->value()));
2760 summary->set_out(0, Location::SameAsFirstInput()); 2795 summary->set_out(0, Location::SameAsFirstInput());
2761 return summary; 2796 return summary;
2762 } 2797 }
2763 2798
2764 if (op_kind() == Token::kTRUNCDIV) { 2799 if (op_kind() == Token::kTRUNCDIV) {
2765 const intptr_t kNumTemps = 1; 2800 const intptr_t kNumTemps = 1;
2766 LocationSummary* summary = 2801 LocationSummary* summary = new(isolate) LocationSummary(
2767 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 2802 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
2768 if (RightIsPowerOfTwoConstant()) { 2803 if (RightIsPowerOfTwoConstant()) {
2769 summary->set_in(0, Location::RequiresRegister()); 2804 summary->set_in(0, Location::RequiresRegister());
2770 ConstantInstr* right_constant = right()->definition()->AsConstant(); 2805 ConstantInstr* right_constant = right()->definition()->AsConstant();
2771 summary->set_in(1, Location::Constant(right_constant->value())); 2806 summary->set_in(1, Location::Constant(right_constant->value()));
2772 summary->set_temp(0, Location::RequiresRegister()); 2807 summary->set_temp(0, Location::RequiresRegister());
2773 summary->set_out(0, Location::SameAsFirstInput()); 2808 summary->set_out(0, Location::SameAsFirstInput());
2774 } else { 2809 } else {
2775 // Both inputs must be writable because they will be untagged. 2810 // Both inputs must be writable because they will be untagged.
2776 summary->set_in(0, Location::RegisterLocation(RAX)); 2811 summary->set_in(0, Location::RegisterLocation(RAX));
2777 summary->set_in(1, Location::WritableRegister()); 2812 summary->set_in(1, Location::WritableRegister());
2778 summary->set_out(0, Location::SameAsFirstInput()); 2813 summary->set_out(0, Location::SameAsFirstInput());
2779 // Will be used for sign extension and division. 2814 // Will be used for sign extension and division.
2780 summary->set_temp(0, Location::RegisterLocation(RDX)); 2815 summary->set_temp(0, Location::RegisterLocation(RDX));
2781 } 2816 }
2782 return summary; 2817 return summary;
2783 } else if (op_kind() == Token::kMOD) { 2818 } else if (op_kind() == Token::kMOD) {
2784 const intptr_t kNumTemps = 1; 2819 const intptr_t kNumTemps = 1;
2785 LocationSummary* summary = 2820 LocationSummary* summary = new(isolate) LocationSummary(
2786 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 2821 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
2787 // Both inputs must be writable because they will be untagged. 2822 // Both inputs must be writable because they will be untagged.
2788 summary->set_in(0, Location::RegisterLocation(RDX)); 2823 summary->set_in(0, Location::RegisterLocation(RDX));
2789 summary->set_in(1, Location::WritableRegister()); 2824 summary->set_in(1, Location::WritableRegister());
2790 summary->set_out(0, Location::SameAsFirstInput()); 2825 summary->set_out(0, Location::SameAsFirstInput());
2791 // Will be used for sign extension and division. 2826 // Will be used for sign extension and division.
2792 summary->set_temp(0, Location::RegisterLocation(RAX)); 2827 summary->set_temp(0, Location::RegisterLocation(RAX));
2793 return summary; 2828 return summary;
2794 } else if (op_kind() == Token::kSHR) { 2829 } else if (op_kind() == Token::kSHR) {
2795 const intptr_t kNumTemps = 0; 2830 const intptr_t kNumTemps = 0;
2796 LocationSummary* summary = 2831 LocationSummary* summary = new(isolate) LocationSummary(
2797 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 2832 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
2798 summary->set_in(0, Location::RequiresRegister()); 2833 summary->set_in(0, Location::RequiresRegister());
2799 summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), RCX)); 2834 summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), RCX));
2800 summary->set_out(0, Location::SameAsFirstInput()); 2835 summary->set_out(0, Location::SameAsFirstInput());
2801 return summary; 2836 return summary;
2802 } else if (op_kind() == Token::kSHL) { 2837 } else if (op_kind() == Token::kSHL) {
2803 const intptr_t kNumTemps = 0; 2838 const intptr_t kNumTemps = 0;
2804 LocationSummary* summary = 2839 LocationSummary* summary = new(isolate) LocationSummary(
2805 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 2840 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
2806 summary->set_in(0, Location::RequiresRegister()); 2841 summary->set_in(0, Location::RequiresRegister());
2807 summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), RCX)); 2842 summary->set_in(1, Location::FixedRegisterOrSmiConstant(right(), RCX));
2808 if (!is_truncating()) { 2843 if (!is_truncating()) {
2809 summary->AddTemp(Location::RequiresRegister()); 2844 summary->AddTemp(Location::RequiresRegister());
2810 } 2845 }
2811 summary->set_out(0, Location::SameAsFirstInput()); 2846 summary->set_out(0, Location::SameAsFirstInput());
2812 return summary; 2847 return summary;
2813 } else { 2848 } else {
2814 const intptr_t kNumTemps = 0; 2849 const intptr_t kNumTemps = 0;
2815 LocationSummary* summary = 2850 LocationSummary* summary = new(isolate) LocationSummary(
2816 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 2851 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
2817 summary->set_in(0, Location::RequiresRegister()); 2852 summary->set_in(0, Location::RequiresRegister());
2818 ConstantInstr* constant = right()->definition()->AsConstant(); 2853 ConstantInstr* constant = right()->definition()->AsConstant();
2819 if (constant != NULL) { 2854 if (constant != NULL) {
2820 summary->set_in(1, Location::RegisterOrSmiConstant(right())); 2855 summary->set_in(1, Location::RegisterOrSmiConstant(right()));
2821 } else { 2856 } else {
2822 summary->set_in(1, Location::PrefersRegister()); 2857 summary->set_in(1, Location::PrefersRegister());
2823 } 2858 }
2824 summary->set_out(0, Location::SameAsFirstInput()); 2859 summary->set_out(0, Location::SameAsFirstInput());
2825 return summary; 2860 return summary;
2826 } 2861 }
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
3190 default: 3225 default:
3191 UNREACHABLE(); 3226 UNREACHABLE();
3192 break; 3227 break;
3193 } 3228 }
3194 if (FLAG_throw_on_javascript_int_overflow) { 3229 if (FLAG_throw_on_javascript_int_overflow) {
3195 EmitJavascriptOverflowCheck(compiler, range(), deopt, result); 3230 EmitJavascriptOverflowCheck(compiler, range(), deopt, result);
3196 } 3231 }
3197 } 3232 }
3198 3233
3199 3234
3200 LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary(bool opt) const { 3235 LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary(Isolate* isolate,
3236 bool opt) const {
3201 intptr_t left_cid = left()->Type()->ToCid(); 3237 intptr_t left_cid = left()->Type()->ToCid();
3202 intptr_t right_cid = right()->Type()->ToCid(); 3238 intptr_t right_cid = right()->Type()->ToCid();
3203 ASSERT((left_cid != kDoubleCid) && (right_cid != kDoubleCid)); 3239 ASSERT((left_cid != kDoubleCid) && (right_cid != kDoubleCid));
3204 const intptr_t kNumInputs = 2; 3240 const intptr_t kNumInputs = 2;
3205 const bool need_temp = (left()->definition() != right()->definition()) 3241 const bool need_temp = (left()->definition() != right()->definition())
3206 && (left_cid != kSmiCid) 3242 && (left_cid != kSmiCid)
3207 && (right_cid != kSmiCid); 3243 && (right_cid != kSmiCid);
3208 const intptr_t kNumTemps = need_temp ? 1 : 0; 3244 const intptr_t kNumTemps = need_temp ? 1 : 0;
3209 LocationSummary* summary = 3245 LocationSummary* summary = new(isolate) LocationSummary(
3210 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3246 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3211 summary->set_in(0, Location::RequiresRegister()); 3247 summary->set_in(0, Location::RequiresRegister());
3212 summary->set_in(1, Location::RequiresRegister()); 3248 summary->set_in(1, Location::RequiresRegister());
3213 if (need_temp) summary->set_temp(0, Location::RequiresRegister()); 3249 if (need_temp) summary->set_temp(0, Location::RequiresRegister());
3214 return summary; 3250 return summary;
3215 } 3251 }
3216 3252
3217 3253
3218 void CheckEitherNonSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3254 void CheckEitherNonSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3219 Label* deopt = compiler->AddDeoptStub(deopt_id(), 3255 Label* deopt = compiler->AddDeoptStub(deopt_id(),
3220 ICData::kDeoptBinaryDoubleOp); 3256 ICData::kDeoptBinaryDoubleOp);
(...skipping 10 matching lines...) Expand all
3231 } else { 3267 } else {
3232 Register temp = locs()->temp(0).reg(); 3268 Register temp = locs()->temp(0).reg();
3233 __ movq(temp, left); 3269 __ movq(temp, left);
3234 __ orq(temp, right); 3270 __ orq(temp, right);
3235 __ testq(temp, Immediate(kSmiTagMask)); 3271 __ testq(temp, Immediate(kSmiTagMask));
3236 } 3272 }
3237 __ j(ZERO, deopt); 3273 __ j(ZERO, deopt);
3238 } 3274 }
3239 3275
3240 3276
3241 LocationSummary* BoxDoubleInstr::MakeLocationSummary(bool opt) const { 3277 LocationSummary* BoxDoubleInstr::MakeLocationSummary(Isolate* isolate,
3278 bool opt) const {
3242 const intptr_t kNumInputs = 1; 3279 const intptr_t kNumInputs = 1;
3243 const intptr_t kNumTemps = 0; 3280 const intptr_t kNumTemps = 0;
3244 LocationSummary* summary = 3281 LocationSummary* summary = new(isolate) LocationSummary(
3245 new LocationSummary(kNumInputs, 3282 isolate, kNumInputs,
3246 kNumTemps, 3283 kNumTemps,
3247 LocationSummary::kCallOnSlowPath); 3284 LocationSummary::kCallOnSlowPath);
3248 summary->set_in(0, Location::RequiresFpuRegister()); 3285 summary->set_in(0, Location::RequiresFpuRegister());
3249 summary->set_out(0, Location::RequiresRegister()); 3286 summary->set_out(0, Location::RequiresRegister());
3250 return summary; 3287 return summary;
3251 } 3288 }
3252 3289
3253 3290
3254 void BoxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3291 void BoxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3255 BoxDoubleSlowPath* slow_path = new BoxDoubleSlowPath(this); 3292 BoxDoubleSlowPath* slow_path = new BoxDoubleSlowPath(this);
3256 compiler->AddSlowPathCode(slow_path); 3293 compiler->AddSlowPathCode(slow_path);
3257 3294
3258 Register out_reg = locs()->out(0).reg(); 3295 Register out_reg = locs()->out(0).reg();
3259 XmmRegister value = locs()->in(0).fpu_reg(); 3296 XmmRegister value = locs()->in(0).fpu_reg();
3260 3297
3261 __ TryAllocate(compiler->double_class(), 3298 __ TryAllocate(compiler->double_class(),
3262 slow_path->entry_label(), 3299 slow_path->entry_label(),
3263 Assembler::kFarJump, 3300 Assembler::kFarJump,
3264 out_reg, 3301 out_reg,
3265 PP); 3302 PP);
3266 __ Bind(slow_path->exit_label()); 3303 __ Bind(slow_path->exit_label());
3267 __ movsd(FieldAddress(out_reg, Double::value_offset()), value); 3304 __ movsd(FieldAddress(out_reg, Double::value_offset()), value);
3268 } 3305 }
3269 3306
3270 3307
3271 LocationSummary* UnboxDoubleInstr::MakeLocationSummary(bool opt) const { 3308 LocationSummary* UnboxDoubleInstr::MakeLocationSummary(Isolate* isolate,
3309 bool opt) const {
3272 const intptr_t kNumInputs = 1; 3310 const intptr_t kNumInputs = 1;
3273 const intptr_t kNumTemps = 0; 3311 const intptr_t kNumTemps = 0;
3274 LocationSummary* summary = 3312 LocationSummary* summary = new(isolate) LocationSummary(
3275 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3313 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3276 const bool needs_writable_input = (value()->Type()->ToCid() != kDoubleCid); 3314 const bool needs_writable_input = (value()->Type()->ToCid() != kDoubleCid);
3277 summary->set_in(0, needs_writable_input 3315 summary->set_in(0, needs_writable_input
3278 ? Location::WritableRegister() 3316 ? Location::WritableRegister()
3279 : Location::RequiresRegister()); 3317 : Location::RequiresRegister());
3280 summary->set_out(0, Location::RequiresFpuRegister()); 3318 summary->set_out(0, Location::RequiresFpuRegister());
3281 return summary; 3319 return summary;
3282 } 3320 }
3283 3321
3284 3322
3285 void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3323 void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
(...skipping 28 matching lines...) Expand all
3314 __ jmp(&done); 3352 __ jmp(&done);
3315 __ Bind(&is_smi); 3353 __ Bind(&is_smi);
3316 __ SmiUntag(value); 3354 __ SmiUntag(value);
3317 __ cvtsi2sd(result, value); 3355 __ cvtsi2sd(result, value);
3318 __ Bind(&done); 3356 __ Bind(&done);
3319 } 3357 }
3320 } 3358 }
3321 } 3359 }
3322 3360
3323 3361
3324 LocationSummary* BoxFloat32x4Instr::MakeLocationSummary(bool opt) const { 3362 LocationSummary* BoxFloat32x4Instr::MakeLocationSummary(Isolate* isolate,
3363 bool opt) const {
3325 const intptr_t kNumInputs = 1; 3364 const intptr_t kNumInputs = 1;
3326 const intptr_t kNumTemps = 0; 3365 const intptr_t kNumTemps = 0;
3327 LocationSummary* summary = 3366 LocationSummary* summary = new(isolate) LocationSummary(
3328 new LocationSummary(kNumInputs, 3367 isolate, kNumInputs,
3329 kNumTemps, 3368 kNumTemps,
3330 LocationSummary::kCallOnSlowPath); 3369 LocationSummary::kCallOnSlowPath);
3331 summary->set_in(0, Location::RequiresFpuRegister()); 3370 summary->set_in(0, Location::RequiresFpuRegister());
3332 summary->set_out(0, Location::RequiresRegister()); 3371 summary->set_out(0, Location::RequiresRegister());
3333 return summary; 3372 return summary;
3334 } 3373 }
3335 3374
3336 3375
3337 void BoxFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 3376 void BoxFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
3338 BoxFloat32x4SlowPath* slow_path = new BoxFloat32x4SlowPath(this); 3377 BoxFloat32x4SlowPath* slow_path = new BoxFloat32x4SlowPath(this);
3339 compiler->AddSlowPathCode(slow_path); 3378 compiler->AddSlowPathCode(slow_path);
3340 3379
3341 Register out_reg = locs()->out(0).reg(); 3380 Register out_reg = locs()->out(0).reg();
3342 XmmRegister value = locs()->in(0).fpu_reg(); 3381 XmmRegister value = locs()->in(0).fpu_reg();
3343 3382
3344 __ TryAllocate(compiler->float32x4_class(), 3383 __ TryAllocate(compiler->float32x4_class(),
3345 slow_path->entry_label(), 3384 slow_path->entry_label(),
3346 Assembler::kFarJump, 3385 Assembler::kFarJump,
3347 out_reg, 3386 out_reg,
3348 PP); 3387 PP);
3349 __ Bind(slow_path->exit_label()); 3388 __ Bind(slow_path->exit_label());
3350 __ movups(FieldAddress(out_reg, Float32x4::value_offset()), value); 3389 __ movups(FieldAddress(out_reg, Float32x4::value_offset()), value);
3351 } 3390 }
3352 3391
3353 3392
3354 LocationSummary* UnboxFloat32x4Instr::MakeLocationSummary(bool opt) const { 3393 LocationSummary* UnboxFloat32x4Instr::MakeLocationSummary(Isolate* isolate,
3394 bool opt) const {
3355 const intptr_t kNumInputs = 1; 3395 const intptr_t kNumInputs = 1;
3356 return LocationSummary::Make(kNumInputs, 3396 return LocationSummary::Make(kNumInputs,
3357 Location::RequiresFpuRegister(), 3397 Location::RequiresFpuRegister(),
3358 LocationSummary::kNoCall); 3398 LocationSummary::kNoCall);
3359 } 3399 }
3360 3400
3361 3401
3362 void UnboxFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 3402 void UnboxFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
3363 const intptr_t value_cid = value()->Type()->ToCid(); 3403 const intptr_t value_cid = value()->Type()->ToCid();
3364 const Register value = locs()->in(0).reg(); 3404 const Register value = locs()->in(0).reg();
3365 const XmmRegister result = locs()->out(0).fpu_reg(); 3405 const XmmRegister result = locs()->out(0).fpu_reg();
3366 3406
3367 if (value_cid != kFloat32x4Cid) { 3407 if (value_cid != kFloat32x4Cid) {
3368 Label* deopt = compiler->AddDeoptStub(deopt_id_, ICData::kDeoptCheckClass); 3408 Label* deopt = compiler->AddDeoptStub(deopt_id_, ICData::kDeoptCheckClass);
3369 __ testq(value, Immediate(kSmiTagMask)); 3409 __ testq(value, Immediate(kSmiTagMask));
3370 __ j(ZERO, deopt); 3410 __ j(ZERO, deopt);
3371 __ CompareClassId(value, kFloat32x4Cid); 3411 __ CompareClassId(value, kFloat32x4Cid);
3372 __ j(NOT_EQUAL, deopt); 3412 __ j(NOT_EQUAL, deopt);
3373 } 3413 }
3374 __ movups(result, FieldAddress(value, Float32x4::value_offset())); 3414 __ movups(result, FieldAddress(value, Float32x4::value_offset()));
3375 } 3415 }
3376 3416
3377 3417
3378 LocationSummary* BoxFloat64x2Instr::MakeLocationSummary(bool opt) const { 3418 LocationSummary* BoxFloat64x2Instr::MakeLocationSummary(Isolate* isolate,
3419 bool opt) const {
3379 const intptr_t kNumInputs = 1; 3420 const intptr_t kNumInputs = 1;
3380 const intptr_t kNumTemps = 0; 3421 const intptr_t kNumTemps = 0;
3381 LocationSummary* summary = 3422 LocationSummary* summary = new(isolate) LocationSummary(
3382 new LocationSummary(kNumInputs, 3423 isolate, kNumInputs,
3383 kNumTemps, 3424 kNumTemps,
3384 LocationSummary::kCallOnSlowPath); 3425 LocationSummary::kCallOnSlowPath);
3385 summary->set_in(0, Location::RequiresFpuRegister()); 3426 summary->set_in(0, Location::RequiresFpuRegister());
3386 summary->set_out(0, Location::RequiresRegister()); 3427 summary->set_out(0, Location::RequiresRegister());
3387 return summary; 3428 return summary;
3388 } 3429 }
3389 3430
3390 3431
3391 void BoxFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 3432 void BoxFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
3392 BoxFloat64x2SlowPath* slow_path = new BoxFloat64x2SlowPath(this); 3433 BoxFloat64x2SlowPath* slow_path = new BoxFloat64x2SlowPath(this);
3393 compiler->AddSlowPathCode(slow_path); 3434 compiler->AddSlowPathCode(slow_path);
3394 3435
3395 Register out_reg = locs()->out(0).reg(); 3436 Register out_reg = locs()->out(0).reg();
3396 XmmRegister value = locs()->in(0).fpu_reg(); 3437 XmmRegister value = locs()->in(0).fpu_reg();
3397 3438
3398 __ TryAllocate(compiler->float64x2_class(), 3439 __ TryAllocate(compiler->float64x2_class(),
3399 slow_path->entry_label(), 3440 slow_path->entry_label(),
3400 Assembler::kFarJump, 3441 Assembler::kFarJump,
3401 out_reg, 3442 out_reg,
3402 kNoRegister); 3443 kNoRegister);
3403 __ Bind(slow_path->exit_label()); 3444 __ Bind(slow_path->exit_label());
3404 __ movups(FieldAddress(out_reg, Float64x2::value_offset()), value); 3445 __ movups(FieldAddress(out_reg, Float64x2::value_offset()), value);
3405 } 3446 }
3406 3447
3407 3448
3408 LocationSummary* UnboxFloat64x2Instr::MakeLocationSummary(bool opt) const { 3449 LocationSummary* UnboxFloat64x2Instr::MakeLocationSummary(Isolate* isolate,
3450 bool opt) const {
3409 const intptr_t value_cid = value()->Type()->ToCid(); 3451 const intptr_t value_cid = value()->Type()->ToCid();
3410 const intptr_t kNumInputs = 1; 3452 const intptr_t kNumInputs = 1;
3411 const intptr_t kNumTemps = value_cid == kFloat64x2Cid ? 0 : 1; 3453 const intptr_t kNumTemps = value_cid == kFloat64x2Cid ? 0 : 1;
3412 LocationSummary* summary = 3454 LocationSummary* summary = new(isolate) LocationSummary(
3413 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3455 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3414 summary->set_in(0, Location::RequiresRegister()); 3456 summary->set_in(0, Location::RequiresRegister());
3415 summary->set_out(0, Location::RequiresFpuRegister()); 3457 summary->set_out(0, Location::RequiresFpuRegister());
3416 return summary; 3458 return summary;
3417 } 3459 }
3418 3460
3419 3461
3420 void UnboxFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 3462 void UnboxFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
3421 const intptr_t value_cid = value()->Type()->ToCid(); 3463 const intptr_t value_cid = value()->Type()->ToCid();
3422 const Register value = locs()->in(0).reg(); 3464 const Register value = locs()->in(0).reg();
3423 const XmmRegister result = locs()->out(0).fpu_reg(); 3465 const XmmRegister result = locs()->out(0).fpu_reg();
3424 3466
3425 if (value_cid != kFloat64x2Cid) { 3467 if (value_cid != kFloat64x2Cid) {
3426 Label* deopt = compiler->AddDeoptStub(deopt_id_, ICData::kDeoptCheckClass); 3468 Label* deopt = compiler->AddDeoptStub(deopt_id_, ICData::kDeoptCheckClass);
3427 __ testq(value, Immediate(kSmiTagMask)); 3469 __ testq(value, Immediate(kSmiTagMask));
3428 __ j(ZERO, deopt); 3470 __ j(ZERO, deopt);
3429 __ CompareClassId(value, kFloat64x2Cid); 3471 __ CompareClassId(value, kFloat64x2Cid);
3430 __ j(NOT_EQUAL, deopt); 3472 __ j(NOT_EQUAL, deopt);
3431 } 3473 }
3432 __ movups(result, FieldAddress(value, Float64x2::value_offset())); 3474 __ movups(result, FieldAddress(value, Float64x2::value_offset()));
3433 } 3475 }
3434 3476
3435 3477
3436 LocationSummary* BoxInt32x4Instr::MakeLocationSummary(bool opt) const { 3478 LocationSummary* BoxInt32x4Instr::MakeLocationSummary(Isolate* isolate,
3479 bool opt) const {
3437 const intptr_t kNumInputs = 1; 3480 const intptr_t kNumInputs = 1;
3438 const intptr_t kNumTemps = 0; 3481 const intptr_t kNumTemps = 0;
3439 LocationSummary* summary = 3482 LocationSummary* summary = new(isolate) LocationSummary(
3440 new LocationSummary(kNumInputs, 3483 isolate, kNumInputs,
3441 kNumTemps, 3484 kNumTemps,
3442 LocationSummary::kCallOnSlowPath); 3485 LocationSummary::kCallOnSlowPath);
3443 summary->set_in(0, Location::RequiresFpuRegister()); 3486 summary->set_in(0, Location::RequiresFpuRegister());
3444 summary->set_out(0, Location::RequiresRegister()); 3487 summary->set_out(0, Location::RequiresRegister());
3445 return summary; 3488 return summary;
3446 } 3489 }
3447 3490
3448 3491
3449 class BoxInt32x4SlowPath : public SlowPathCode { 3492 class BoxInt32x4SlowPath : public SlowPathCode {
3450 public: 3493 public:
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
3488 __ TryAllocate(compiler->int32x4_class(), 3531 __ TryAllocate(compiler->int32x4_class(),
3489 slow_path->entry_label(), 3532 slow_path->entry_label(),
3490 Assembler::kFarJump, 3533 Assembler::kFarJump,
3491 out_reg, 3534 out_reg,
3492 PP); 3535 PP);
3493 __ Bind(slow_path->exit_label()); 3536 __ Bind(slow_path->exit_label());
3494 __ movups(FieldAddress(out_reg, Int32x4::value_offset()), value); 3537 __ movups(FieldAddress(out_reg, Int32x4::value_offset()), value);
3495 } 3538 }
3496 3539
3497 3540
3498 LocationSummary* UnboxInt32x4Instr::MakeLocationSummary(bool opt) const { 3541 LocationSummary* UnboxInt32x4Instr::MakeLocationSummary(Isolate* isolate,
3542 bool opt) const {
3499 const intptr_t kNumInputs = 1; 3543 const intptr_t kNumInputs = 1;
3500 const intptr_t kNumTemps = 0; 3544 const intptr_t kNumTemps = 0;
3501 LocationSummary* summary = 3545 LocationSummary* summary = new(isolate) LocationSummary(
3502 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3546 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3503 summary->set_in(0, Location::RequiresRegister()); 3547 summary->set_in(0, Location::RequiresRegister());
3504 summary->set_out(0, Location::RequiresFpuRegister()); 3548 summary->set_out(0, Location::RequiresFpuRegister());
3505 return summary; 3549 return summary;
3506 } 3550 }
3507 3551
3508 3552
3509 void UnboxInt32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 3553 void UnboxInt32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
3510 const intptr_t value_cid = value()->Type()->ToCid(); 3554 const intptr_t value_cid = value()->Type()->ToCid();
3511 const Register value = locs()->in(0).reg(); 3555 const Register value = locs()->in(0).reg();
3512 const XmmRegister result = locs()->out(0).fpu_reg(); 3556 const XmmRegister result = locs()->out(0).fpu_reg();
3513 3557
3514 if (value_cid != kInt32x4Cid) { 3558 if (value_cid != kInt32x4Cid) {
3515 Label* deopt = compiler->AddDeoptStub(deopt_id_, ICData::kDeoptCheckClass); 3559 Label* deopt = compiler->AddDeoptStub(deopt_id_, ICData::kDeoptCheckClass);
3516 __ testq(value, Immediate(kSmiTagMask)); 3560 __ testq(value, Immediate(kSmiTagMask));
3517 __ j(ZERO, deopt); 3561 __ j(ZERO, deopt);
3518 __ CompareClassId(value, kInt32x4Cid); 3562 __ CompareClassId(value, kInt32x4Cid);
3519 __ j(NOT_EQUAL, deopt); 3563 __ j(NOT_EQUAL, deopt);
3520 } 3564 }
3521 __ movups(result, FieldAddress(value, Int32x4::value_offset())); 3565 __ movups(result, FieldAddress(value, Int32x4::value_offset()));
3522 } 3566 }
3523 3567
3524 3568
3525 LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary(bool opt) const { 3569 LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary(Isolate* isolate,
3570 bool opt) const {
3526 const intptr_t kNumInputs = 2; 3571 const intptr_t kNumInputs = 2;
3527 const intptr_t kNumTemps = 0; 3572 const intptr_t kNumTemps = 0;
3528 LocationSummary* summary = 3573 LocationSummary* summary = new(isolate) LocationSummary(
3529 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3574 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3530 summary->set_in(0, Location::RequiresFpuRegister()); 3575 summary->set_in(0, Location::RequiresFpuRegister());
3531 summary->set_in(1, Location::RequiresFpuRegister()); 3576 summary->set_in(1, Location::RequiresFpuRegister());
3532 summary->set_out(0, Location::SameAsFirstInput()); 3577 summary->set_out(0, Location::SameAsFirstInput());
3533 return summary; 3578 return summary;
3534 } 3579 }
3535 3580
3536 3581
3537 void BinaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3582 void BinaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3538 XmmRegister left = locs()->in(0).fpu_reg(); 3583 XmmRegister left = locs()->in(0).fpu_reg();
3539 XmmRegister right = locs()->in(1).fpu_reg(); 3584 XmmRegister right = locs()->in(1).fpu_reg();
3540 3585
3541 ASSERT(locs()->out(0).fpu_reg() == left); 3586 ASSERT(locs()->out(0).fpu_reg() == left);
3542 3587
3543 switch (op_kind()) { 3588 switch (op_kind()) {
3544 case Token::kADD: __ addsd(left, right); break; 3589 case Token::kADD: __ addsd(left, right); break;
3545 case Token::kSUB: __ subsd(left, right); break; 3590 case Token::kSUB: __ subsd(left, right); break;
3546 case Token::kMUL: __ mulsd(left, right); break; 3591 case Token::kMUL: __ mulsd(left, right); break;
3547 case Token::kDIV: __ divsd(left, right); break; 3592 case Token::kDIV: __ divsd(left, right); break;
3548 default: UNREACHABLE(); 3593 default: UNREACHABLE();
3549 } 3594 }
3550 } 3595 }
3551 3596
3552 3597
3553 LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(bool opt) const { 3598 LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Isolate* isolate,
3599 bool opt) const {
3554 const intptr_t kNumInputs = 2; 3600 const intptr_t kNumInputs = 2;
3555 const intptr_t kNumTemps = 0; 3601 const intptr_t kNumTemps = 0;
3556 LocationSummary* summary = 3602 LocationSummary* summary = new(isolate) LocationSummary(
3557 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3603 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3558 summary->set_in(0, Location::RequiresFpuRegister()); 3604 summary->set_in(0, Location::RequiresFpuRegister());
3559 summary->set_in(1, Location::RequiresFpuRegister()); 3605 summary->set_in(1, Location::RequiresFpuRegister());
3560 summary->set_out(0, Location::SameAsFirstInput()); 3606 summary->set_out(0, Location::SameAsFirstInput());
3561 return summary; 3607 return summary;
3562 } 3608 }
3563 3609
3564 3610
3565 void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3611 void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3566 XmmRegister left = locs()->in(0).fpu_reg(); 3612 XmmRegister left = locs()->in(0).fpu_reg();
3567 XmmRegister right = locs()->in(1).fpu_reg(); 3613 XmmRegister right = locs()->in(1).fpu_reg();
3568 3614
3569 ASSERT(locs()->out(0).fpu_reg() == left); 3615 ASSERT(locs()->out(0).fpu_reg() == left);
3570 3616
3571 switch (op_kind()) { 3617 switch (op_kind()) {
3572 case Token::kADD: __ addps(left, right); break; 3618 case Token::kADD: __ addps(left, right); break;
3573 case Token::kSUB: __ subps(left, right); break; 3619 case Token::kSUB: __ subps(left, right); break;
3574 case Token::kMUL: __ mulps(left, right); break; 3620 case Token::kMUL: __ mulps(left, right); break;
3575 case Token::kDIV: __ divps(left, right); break; 3621 case Token::kDIV: __ divps(left, right); break;
3576 default: UNREACHABLE(); 3622 default: UNREACHABLE();
3577 } 3623 }
3578 } 3624 }
3579 3625
3580 3626
3581 LocationSummary* BinaryFloat64x2OpInstr::MakeLocationSummary(bool opt) const { 3627 LocationSummary* BinaryFloat64x2OpInstr::MakeLocationSummary(Isolate* isolate,
3628 bool opt) const {
3582 const intptr_t kNumInputs = 2; 3629 const intptr_t kNumInputs = 2;
3583 const intptr_t kNumTemps = 0; 3630 const intptr_t kNumTemps = 0;
3584 LocationSummary* summary = 3631 LocationSummary* summary = new(isolate) LocationSummary(
3585 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3632 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3586 summary->set_in(0, Location::RequiresFpuRegister()); 3633 summary->set_in(0, Location::RequiresFpuRegister());
3587 summary->set_in(1, Location::RequiresFpuRegister()); 3634 summary->set_in(1, Location::RequiresFpuRegister());
3588 summary->set_out(0, Location::SameAsFirstInput()); 3635 summary->set_out(0, Location::SameAsFirstInput());
3589 return summary; 3636 return summary;
3590 } 3637 }
3591 3638
3592 3639
3593 void BinaryFloat64x2OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3640 void BinaryFloat64x2OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3594 XmmRegister left = locs()->in(0).fpu_reg(); 3641 XmmRegister left = locs()->in(0).fpu_reg();
3595 XmmRegister right = locs()->in(1).fpu_reg(); 3642 XmmRegister right = locs()->in(1).fpu_reg();
3596 3643
3597 ASSERT(locs()->out(0).fpu_reg() == left); 3644 ASSERT(locs()->out(0).fpu_reg() == left);
3598 3645
3599 switch (op_kind()) { 3646 switch (op_kind()) {
3600 case Token::kADD: __ addpd(left, right); break; 3647 case Token::kADD: __ addpd(left, right); break;
3601 case Token::kSUB: __ subpd(left, right); break; 3648 case Token::kSUB: __ subpd(left, right); break;
3602 case Token::kMUL: __ mulpd(left, right); break; 3649 case Token::kMUL: __ mulpd(left, right); break;
3603 case Token::kDIV: __ divpd(left, right); break; 3650 case Token::kDIV: __ divpd(left, right); break;
3604 default: UNREACHABLE(); 3651 default: UNREACHABLE();
3605 } 3652 }
3606 } 3653 }
3607 3654
3608 3655
3609 LocationSummary* Simd32x4ShuffleInstr::MakeLocationSummary(bool opt) const { 3656 LocationSummary* Simd32x4ShuffleInstr::MakeLocationSummary(Isolate* isolate,
3657 bool opt) const {
3610 const intptr_t kNumInputs = 1; 3658 const intptr_t kNumInputs = 1;
3611 const intptr_t kNumTemps = 0; 3659 const intptr_t kNumTemps = 0;
3612 LocationSummary* summary = 3660 LocationSummary* summary = new(isolate) LocationSummary(
3613 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3661 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3614 summary->set_in(0, Location::RequiresFpuRegister()); 3662 summary->set_in(0, Location::RequiresFpuRegister());
3615 summary->set_out(0, Location::SameAsFirstInput()); 3663 summary->set_out(0, Location::SameAsFirstInput());
3616 return summary; 3664 return summary;
3617 } 3665 }
3618 3666
3619 3667
3620 void Simd32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3668 void Simd32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3621 XmmRegister value = locs()->in(0).fpu_reg(); 3669 XmmRegister value = locs()->in(0).fpu_reg();
3622 3670
3623 ASSERT(locs()->out(0).fpu_reg() == value); 3671 ASSERT(locs()->out(0).fpu_reg() == value);
(...skipping 17 matching lines...) Expand all
3641 break; 3689 break;
3642 case MethodRecognizer::kFloat32x4Shuffle: 3690 case MethodRecognizer::kFloat32x4Shuffle:
3643 case MethodRecognizer::kInt32x4Shuffle: 3691 case MethodRecognizer::kInt32x4Shuffle:
3644 __ shufps(value, value, Immediate(mask_)); 3692 __ shufps(value, value, Immediate(mask_));
3645 break; 3693 break;
3646 default: UNREACHABLE(); 3694 default: UNREACHABLE();
3647 } 3695 }
3648 } 3696 }
3649 3697
3650 3698
3651 LocationSummary* Simd32x4ShuffleMixInstr::MakeLocationSummary(bool opt) const { 3699 LocationSummary* Simd32x4ShuffleMixInstr::MakeLocationSummary(Isolate* isolate,
3700 bool opt) const {
3652 const intptr_t kNumInputs = 2; 3701 const intptr_t kNumInputs = 2;
3653 const intptr_t kNumTemps = 0; 3702 const intptr_t kNumTemps = 0;
3654 LocationSummary* summary = 3703 LocationSummary* summary = new(isolate) LocationSummary(
3655 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3704 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3656 summary->set_in(0, Location::RequiresFpuRegister()); 3705 summary->set_in(0, Location::RequiresFpuRegister());
3657 summary->set_in(1, Location::RequiresFpuRegister()); 3706 summary->set_in(1, Location::RequiresFpuRegister());
3658 summary->set_out(0, Location::SameAsFirstInput()); 3707 summary->set_out(0, Location::SameAsFirstInput());
3659 return summary; 3708 return summary;
3660 } 3709 }
3661 3710
3662 3711
3663 void Simd32x4ShuffleMixInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3712 void Simd32x4ShuffleMixInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3664 XmmRegister left = locs()->in(0).fpu_reg(); 3713 XmmRegister left = locs()->in(0).fpu_reg();
3665 XmmRegister right = locs()->in(1).fpu_reg(); 3714 XmmRegister right = locs()->in(1).fpu_reg();
3666 3715
3667 ASSERT(locs()->out(0).fpu_reg() == left); 3716 ASSERT(locs()->out(0).fpu_reg() == left);
3668 switch (op_kind()) { 3717 switch (op_kind()) {
3669 case MethodRecognizer::kFloat32x4ShuffleMix: 3718 case MethodRecognizer::kFloat32x4ShuffleMix:
3670 case MethodRecognizer::kInt32x4ShuffleMix: 3719 case MethodRecognizer::kInt32x4ShuffleMix:
3671 __ shufps(left, right, Immediate(mask_)); 3720 __ shufps(left, right, Immediate(mask_));
3672 break; 3721 break;
3673 default: UNREACHABLE(); 3722 default: UNREACHABLE();
3674 } 3723 }
3675 } 3724 }
3676 3725
3677 3726
3678 LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary(bool opt) const { 3727 LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary(Isolate* isolate,
3728 bool opt) const {
3679 const intptr_t kNumInputs = 1; 3729 const intptr_t kNumInputs = 1;
3680 const intptr_t kNumTemps = 0; 3730 const intptr_t kNumTemps = 0;
3681 LocationSummary* summary = 3731 LocationSummary* summary = new(isolate) LocationSummary(
3682 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3732 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3683 summary->set_in(0, Location::RequiresFpuRegister()); 3733 summary->set_in(0, Location::RequiresFpuRegister());
3684 summary->set_out(0, Location::RequiresRegister()); 3734 summary->set_out(0, Location::RequiresRegister());
3685 return summary; 3735 return summary;
3686 } 3736 }
3687 3737
3688 3738
3689 void Simd32x4GetSignMaskInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3739 void Simd32x4GetSignMaskInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3690 XmmRegister value = locs()->in(0).fpu_reg(); 3740 XmmRegister value = locs()->in(0).fpu_reg();
3691 Register out = locs()->out(0).reg(); 3741 Register out = locs()->out(0).reg();
3692 3742
3693 __ movmskps(out, value); 3743 __ movmskps(out, value);
3694 __ SmiTag(out); 3744 __ SmiTag(out);
3695 } 3745 }
3696 3746
3697 3747
3698 LocationSummary* Float32x4ConstructorInstr::MakeLocationSummary( 3748 LocationSummary* Float32x4ConstructorInstr::MakeLocationSummary(
3699 bool opt) const { 3749 Isolate* isolate, bool opt) const {
3700 const intptr_t kNumInputs = 4; 3750 const intptr_t kNumInputs = 4;
3701 const intptr_t kNumTemps = 0; 3751 const intptr_t kNumTemps = 0;
3702 LocationSummary* summary = 3752 LocationSummary* summary = new(isolate) LocationSummary(
3703 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3753 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3704 summary->set_in(0, Location::RequiresFpuRegister()); 3754 summary->set_in(0, Location::RequiresFpuRegister());
3705 summary->set_in(1, Location::RequiresFpuRegister()); 3755 summary->set_in(1, Location::RequiresFpuRegister());
3706 summary->set_in(2, Location::RequiresFpuRegister()); 3756 summary->set_in(2, Location::RequiresFpuRegister());
3707 summary->set_in(3, Location::RequiresFpuRegister()); 3757 summary->set_in(3, Location::RequiresFpuRegister());
3708 summary->set_out(0, Location::SameAsFirstInput()); 3758 summary->set_out(0, Location::SameAsFirstInput());
3709 return summary; 3759 return summary;
3710 } 3760 }
3711 3761
3712 3762
3713 void Float32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3763 void Float32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
(...skipping 12 matching lines...) Expand all
3726 __ cvtsd2ss(v0, v0); 3776 __ cvtsd2ss(v0, v0);
3727 __ movss(Address(RSP, 8), v0); 3777 __ movss(Address(RSP, 8), v0);
3728 __ movsd(v0, v3); 3778 __ movsd(v0, v3);
3729 __ cvtsd2ss(v0, v0); 3779 __ cvtsd2ss(v0, v0);
3730 __ movss(Address(RSP, 12), v0); 3780 __ movss(Address(RSP, 12), v0);
3731 __ movups(v0, Address(RSP, 0)); 3781 __ movups(v0, Address(RSP, 0));
3732 __ AddImmediate(RSP, Immediate(16), PP); 3782 __ AddImmediate(RSP, Immediate(16), PP);
3733 } 3783 }
3734 3784
3735 3785
3736 LocationSummary* Float32x4ZeroInstr::MakeLocationSummary(bool opt) const { 3786 LocationSummary* Float32x4ZeroInstr::MakeLocationSummary(Isolate* isolate,
3787 bool opt) const {
3737 const intptr_t kNumInputs = 0; 3788 const intptr_t kNumInputs = 0;
3738 const intptr_t kNumTemps = 0; 3789 const intptr_t kNumTemps = 0;
3739 LocationSummary* summary = 3790 LocationSummary* summary = new(isolate) LocationSummary(
3740 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3791 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3741 summary->set_out(0, Location::RequiresFpuRegister()); 3792 summary->set_out(0, Location::RequiresFpuRegister());
3742 return summary; 3793 return summary;
3743 } 3794 }
3744 3795
3745 3796
3746 void Float32x4ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3797 void Float32x4ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3747 XmmRegister value = locs()->out(0).fpu_reg(); 3798 XmmRegister value = locs()->out(0).fpu_reg();
3748 __ xorps(value, value); 3799 __ xorps(value, value);
3749 } 3800 }
3750 3801
3751 3802
3752 LocationSummary* Float32x4SplatInstr::MakeLocationSummary(bool opt) const { 3803 LocationSummary* Float32x4SplatInstr::MakeLocationSummary(Isolate* isolate,
3804 bool opt) const {
3753 const intptr_t kNumInputs = 1; 3805 const intptr_t kNumInputs = 1;
3754 const intptr_t kNumTemps = 0; 3806 const intptr_t kNumTemps = 0;
3755 LocationSummary* summary = 3807 LocationSummary* summary = new(isolate) LocationSummary(
3756 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3808 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3757 summary->set_in(0, Location::RequiresFpuRegister()); 3809 summary->set_in(0, Location::RequiresFpuRegister());
3758 summary->set_out(0, Location::SameAsFirstInput()); 3810 summary->set_out(0, Location::SameAsFirstInput());
3759 return summary; 3811 return summary;
3760 } 3812 }
3761 3813
3762 3814
3763 void Float32x4SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3815 void Float32x4SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3764 XmmRegister value = locs()->out(0).fpu_reg(); 3816 XmmRegister value = locs()->out(0).fpu_reg();
3765 ASSERT(locs()->in(0).fpu_reg() == locs()->out(0).fpu_reg()); 3817 ASSERT(locs()->in(0).fpu_reg() == locs()->out(0).fpu_reg());
3766 // Convert to Float32. 3818 // Convert to Float32.
3767 __ cvtsd2ss(value, value); 3819 __ cvtsd2ss(value, value);
3768 // Splat across all lanes. 3820 // Splat across all lanes.
3769 __ shufps(value, value, Immediate(0x00)); 3821 __ shufps(value, value, Immediate(0x00));
3770 } 3822 }
3771 3823
3772 3824
3773 LocationSummary* Float32x4ComparisonInstr::MakeLocationSummary(bool opt) const { 3825 LocationSummary* Float32x4ComparisonInstr::MakeLocationSummary(Isolate* isolate,
3826 bool opt) const {
3774 const intptr_t kNumInputs = 2; 3827 const intptr_t kNumInputs = 2;
3775 const intptr_t kNumTemps = 0; 3828 const intptr_t kNumTemps = 0;
3776 LocationSummary* summary = 3829 LocationSummary* summary = new(isolate) LocationSummary(
3777 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3830 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3778 summary->set_in(0, Location::RequiresFpuRegister()); 3831 summary->set_in(0, Location::RequiresFpuRegister());
3779 summary->set_in(1, Location::RequiresFpuRegister()); 3832 summary->set_in(1, Location::RequiresFpuRegister());
3780 summary->set_out(0, Location::SameAsFirstInput()); 3833 summary->set_out(0, Location::SameAsFirstInput());
3781 return summary; 3834 return summary;
3782 } 3835 }
3783 3836
3784 3837
3785 void Float32x4ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3838 void Float32x4ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3786 XmmRegister left = locs()->in(0).fpu_reg(); 3839 XmmRegister left = locs()->in(0).fpu_reg();
3787 XmmRegister right = locs()->in(1).fpu_reg(); 3840 XmmRegister right = locs()->in(1).fpu_reg();
(...skipping 18 matching lines...) Expand all
3806 break; 3859 break;
3807 case MethodRecognizer::kFloat32x4LessThanOrEqual: 3860 case MethodRecognizer::kFloat32x4LessThanOrEqual:
3808 __ cmppsle(left, right); 3861 __ cmppsle(left, right);
3809 break; 3862 break;
3810 3863
3811 default: UNREACHABLE(); 3864 default: UNREACHABLE();
3812 } 3865 }
3813 } 3866 }
3814 3867
3815 3868
3816 LocationSummary* Float32x4MinMaxInstr::MakeLocationSummary(bool opt) const { 3869 LocationSummary* Float32x4MinMaxInstr::MakeLocationSummary(Isolate* isolate,
3870 bool opt) const {
3817 const intptr_t kNumInputs = 2; 3871 const intptr_t kNumInputs = 2;
3818 const intptr_t kNumTemps = 0; 3872 const intptr_t kNumTemps = 0;
3819 LocationSummary* summary = 3873 LocationSummary* summary = new(isolate) LocationSummary(
3820 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3874 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3821 summary->set_in(0, Location::RequiresFpuRegister()); 3875 summary->set_in(0, Location::RequiresFpuRegister());
3822 summary->set_in(1, Location::RequiresFpuRegister()); 3876 summary->set_in(1, Location::RequiresFpuRegister());
3823 summary->set_out(0, Location::SameAsFirstInput()); 3877 summary->set_out(0, Location::SameAsFirstInput());
3824 return summary; 3878 return summary;
3825 } 3879 }
3826 3880
3827 3881
3828 void Float32x4MinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3882 void Float32x4MinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3829 XmmRegister left = locs()->in(0).fpu_reg(); 3883 XmmRegister left = locs()->in(0).fpu_reg();
3830 XmmRegister right = locs()->in(1).fpu_reg(); 3884 XmmRegister right = locs()->in(1).fpu_reg();
3831 3885
3832 ASSERT(locs()->out(0).fpu_reg() == left); 3886 ASSERT(locs()->out(0).fpu_reg() == left);
3833 3887
3834 switch (op_kind()) { 3888 switch (op_kind()) {
3835 case MethodRecognizer::kFloat32x4Min: 3889 case MethodRecognizer::kFloat32x4Min:
3836 __ minps(left, right); 3890 __ minps(left, right);
3837 break; 3891 break;
3838 case MethodRecognizer::kFloat32x4Max: 3892 case MethodRecognizer::kFloat32x4Max:
3839 __ maxps(left, right); 3893 __ maxps(left, right);
3840 break; 3894 break;
3841 default: UNREACHABLE(); 3895 default: UNREACHABLE();
3842 } 3896 }
3843 } 3897 }
3844 3898
3845 3899
3846 LocationSummary* Float32x4ScaleInstr::MakeLocationSummary(bool opt) const { 3900 LocationSummary* Float32x4ScaleInstr::MakeLocationSummary(Isolate* isolate,
3901 bool opt) const {
3847 const intptr_t kNumInputs = 2; 3902 const intptr_t kNumInputs = 2;
3848 const intptr_t kNumTemps = 0; 3903 const intptr_t kNumTemps = 0;
3849 LocationSummary* summary = 3904 LocationSummary* summary = new(isolate) LocationSummary(
3850 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3905 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3851 summary->set_in(0, Location::RequiresFpuRegister()); 3906 summary->set_in(0, Location::RequiresFpuRegister());
3852 summary->set_in(1, Location::RequiresFpuRegister()); 3907 summary->set_in(1, Location::RequiresFpuRegister());
3853 summary->set_out(0, Location::SameAsFirstInput()); 3908 summary->set_out(0, Location::SameAsFirstInput());
3854 return summary; 3909 return summary;
3855 } 3910 }
3856 3911
3857 3912
3858 void Float32x4ScaleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3913 void Float32x4ScaleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3859 XmmRegister left = locs()->in(0).fpu_reg(); 3914 XmmRegister left = locs()->in(0).fpu_reg();
3860 XmmRegister right = locs()->in(1).fpu_reg(); 3915 XmmRegister right = locs()->in(1).fpu_reg();
3861 3916
3862 ASSERT(locs()->out(0).fpu_reg() == left); 3917 ASSERT(locs()->out(0).fpu_reg() == left);
3863 3918
3864 switch (op_kind()) { 3919 switch (op_kind()) {
3865 case MethodRecognizer::kFloat32x4Scale: 3920 case MethodRecognizer::kFloat32x4Scale:
3866 __ cvtsd2ss(left, left); 3921 __ cvtsd2ss(left, left);
3867 __ shufps(left, left, Immediate(0x00)); 3922 __ shufps(left, left, Immediate(0x00));
3868 __ mulps(left, right); 3923 __ mulps(left, right);
3869 break; 3924 break;
3870 default: UNREACHABLE(); 3925 default: UNREACHABLE();
3871 } 3926 }
3872 } 3927 }
3873 3928
3874 3929
3875 LocationSummary* Float32x4SqrtInstr::MakeLocationSummary(bool opt) const { 3930 LocationSummary* Float32x4SqrtInstr::MakeLocationSummary(Isolate* isolate,
3931 bool opt) const {
3876 const intptr_t kNumInputs = 1; 3932 const intptr_t kNumInputs = 1;
3877 const intptr_t kNumTemps = 0; 3933 const intptr_t kNumTemps = 0;
3878 LocationSummary* summary = 3934 LocationSummary* summary = new(isolate) LocationSummary(
3879 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3935 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3880 summary->set_in(0, Location::RequiresFpuRegister()); 3936 summary->set_in(0, Location::RequiresFpuRegister());
3881 summary->set_out(0, Location::SameAsFirstInput()); 3937 summary->set_out(0, Location::SameAsFirstInput());
3882 return summary; 3938 return summary;
3883 } 3939 }
3884 3940
3885 3941
3886 void Float32x4SqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3942 void Float32x4SqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3887 XmmRegister left = locs()->in(0).fpu_reg(); 3943 XmmRegister left = locs()->in(0).fpu_reg();
3888 3944
3889 ASSERT(locs()->out(0).fpu_reg() == left); 3945 ASSERT(locs()->out(0).fpu_reg() == left);
3890 3946
3891 switch (op_kind()) { 3947 switch (op_kind()) {
3892 case MethodRecognizer::kFloat32x4Sqrt: 3948 case MethodRecognizer::kFloat32x4Sqrt:
3893 __ sqrtps(left); 3949 __ sqrtps(left);
3894 break; 3950 break;
3895 case MethodRecognizer::kFloat32x4Reciprocal: 3951 case MethodRecognizer::kFloat32x4Reciprocal:
3896 __ reciprocalps(left); 3952 __ reciprocalps(left);
3897 break; 3953 break;
3898 case MethodRecognizer::kFloat32x4ReciprocalSqrt: 3954 case MethodRecognizer::kFloat32x4ReciprocalSqrt:
3899 __ rsqrtps(left); 3955 __ rsqrtps(left);
3900 break; 3956 break;
3901 default: UNREACHABLE(); 3957 default: UNREACHABLE();
3902 } 3958 }
3903 } 3959 }
3904 3960
3905 3961
3906 LocationSummary* Float32x4ZeroArgInstr::MakeLocationSummary(bool opt) const { 3962 LocationSummary* Float32x4ZeroArgInstr::MakeLocationSummary(Isolate* isolate,
3963 bool opt) const {
3907 const intptr_t kNumInputs = 1; 3964 const intptr_t kNumInputs = 1;
3908 const intptr_t kNumTemps = 0; 3965 const intptr_t kNumTemps = 0;
3909 LocationSummary* summary = 3966 LocationSummary* summary = new(isolate) LocationSummary(
3910 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3967 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3911 summary->set_in(0, Location::RequiresFpuRegister()); 3968 summary->set_in(0, Location::RequiresFpuRegister());
3912 summary->set_out(0, Location::SameAsFirstInput()); 3969 summary->set_out(0, Location::SameAsFirstInput());
3913 return summary; 3970 return summary;
3914 } 3971 }
3915 3972
3916 3973
3917 void Float32x4ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3974 void Float32x4ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3918 XmmRegister left = locs()->in(0).fpu_reg(); 3975 XmmRegister left = locs()->in(0).fpu_reg();
3919 3976
3920 ASSERT(locs()->out(0).fpu_reg() == left); 3977 ASSERT(locs()->out(0).fpu_reg() == left);
3921 switch (op_kind()) { 3978 switch (op_kind()) {
3922 case MethodRecognizer::kFloat32x4Negate: 3979 case MethodRecognizer::kFloat32x4Negate:
3923 __ negateps(left); 3980 __ negateps(left);
3924 break; 3981 break;
3925 case MethodRecognizer::kFloat32x4Absolute: 3982 case MethodRecognizer::kFloat32x4Absolute:
3926 __ absps(left); 3983 __ absps(left);
3927 break; 3984 break;
3928 default: UNREACHABLE(); 3985 default: UNREACHABLE();
3929 } 3986 }
3930 } 3987 }
3931 3988
3932 3989
3933 LocationSummary* Float32x4ClampInstr::MakeLocationSummary(bool opt) const { 3990 LocationSummary* Float32x4ClampInstr::MakeLocationSummary(Isolate* isolate,
3991 bool opt) const {
3934 const intptr_t kNumInputs = 3; 3992 const intptr_t kNumInputs = 3;
3935 const intptr_t kNumTemps = 0; 3993 const intptr_t kNumTemps = 0;
3936 LocationSummary* summary = 3994 LocationSummary* summary = new(isolate) LocationSummary(
3937 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3995 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3938 summary->set_in(0, Location::RequiresFpuRegister()); 3996 summary->set_in(0, Location::RequiresFpuRegister());
3939 summary->set_in(1, Location::RequiresFpuRegister()); 3997 summary->set_in(1, Location::RequiresFpuRegister());
3940 summary->set_in(2, Location::RequiresFpuRegister()); 3998 summary->set_in(2, Location::RequiresFpuRegister());
3941 summary->set_out(0, Location::SameAsFirstInput()); 3999 summary->set_out(0, Location::SameAsFirstInput());
3942 return summary; 4000 return summary;
3943 } 4001 }
3944 4002
3945 4003
3946 void Float32x4ClampInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4004 void Float32x4ClampInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3947 XmmRegister left = locs()->in(0).fpu_reg(); 4005 XmmRegister left = locs()->in(0).fpu_reg();
3948 XmmRegister lower = locs()->in(1).fpu_reg(); 4006 XmmRegister lower = locs()->in(1).fpu_reg();
3949 XmmRegister upper = locs()->in(2).fpu_reg(); 4007 XmmRegister upper = locs()->in(2).fpu_reg();
3950 ASSERT(locs()->out(0).fpu_reg() == left); 4008 ASSERT(locs()->out(0).fpu_reg() == left);
3951 __ minps(left, upper); 4009 __ minps(left, upper);
3952 __ maxps(left, lower); 4010 __ maxps(left, lower);
3953 } 4011 }
3954 4012
3955 4013
3956 LocationSummary* Float32x4WithInstr::MakeLocationSummary(bool opt) const { 4014 LocationSummary* Float32x4WithInstr::MakeLocationSummary(Isolate* isolate,
4015 bool opt) const {
3957 const intptr_t kNumInputs = 2; 4016 const intptr_t kNumInputs = 2;
3958 const intptr_t kNumTemps = 0; 4017 const intptr_t kNumTemps = 0;
3959 LocationSummary* summary = 4018 LocationSummary* summary = new(isolate) LocationSummary(
3960 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4019 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3961 summary->set_in(0, Location::RequiresFpuRegister()); 4020 summary->set_in(0, Location::RequiresFpuRegister());
3962 summary->set_in(1, Location::RequiresFpuRegister()); 4021 summary->set_in(1, Location::RequiresFpuRegister());
3963 summary->set_out(0, Location::SameAsFirstInput()); 4022 summary->set_out(0, Location::SameAsFirstInput());
3964 return summary; 4023 return summary;
3965 } 4024 }
3966 4025
3967 4026
3968 void Float32x4WithInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4027 void Float32x4WithInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3969 XmmRegister replacement = locs()->in(0).fpu_reg(); 4028 XmmRegister replacement = locs()->in(0).fpu_reg();
3970 XmmRegister value = locs()->in(1).fpu_reg(); 4029 XmmRegister value = locs()->in(1).fpu_reg();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
4014 __ movss(Address(RSP, 12), replacement); 4073 __ movss(Address(RSP, 12), replacement);
4015 // Move updated value into output register. 4074 // Move updated value into output register.
4016 __ movups(replacement, Address(RSP, 0)); 4075 __ movups(replacement, Address(RSP, 0));
4017 __ AddImmediate(RSP, Immediate(16), PP); 4076 __ AddImmediate(RSP, Immediate(16), PP);
4018 break; 4077 break;
4019 default: UNREACHABLE(); 4078 default: UNREACHABLE();
4020 } 4079 }
4021 } 4080 }
4022 4081
4023 4082
4024 LocationSummary* Float32x4ToInt32x4Instr::MakeLocationSummary(bool opt) const { 4083 LocationSummary* Float32x4ToInt32x4Instr::MakeLocationSummary(Isolate* isolate,
4084 bool opt) const {
4025 const intptr_t kNumInputs = 1; 4085 const intptr_t kNumInputs = 1;
4026 const intptr_t kNumTemps = 0; 4086 const intptr_t kNumTemps = 0;
4027 LocationSummary* summary = 4087 LocationSummary* summary = new(isolate) LocationSummary(
4028 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4088 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4029 summary->set_in(0, Location::RequiresFpuRegister()); 4089 summary->set_in(0, Location::RequiresFpuRegister());
4030 summary->set_out(0, Location::SameAsFirstInput()); 4090 summary->set_out(0, Location::SameAsFirstInput());
4031 return summary; 4091 return summary;
4032 } 4092 }
4033 4093
4034 4094
4035 void Float32x4ToInt32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 4095 void Float32x4ToInt32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
4036 // NOP. 4096 // NOP.
4037 } 4097 }
4038 4098
4039 4099
4040 LocationSummary* Simd64x2ShuffleInstr::MakeLocationSummary(bool opt) const { 4100 LocationSummary* Simd64x2ShuffleInstr::MakeLocationSummary(Isolate* isolate,
4101 bool opt) const {
4041 const intptr_t kNumInputs = 1; 4102 const intptr_t kNumInputs = 1;
4042 const intptr_t kNumTemps = 0; 4103 const intptr_t kNumTemps = 0;
4043 LocationSummary* summary = 4104 LocationSummary* summary = new(isolate) LocationSummary(
4044 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4105 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4045 summary->set_in(0, Location::RequiresFpuRegister()); 4106 summary->set_in(0, Location::RequiresFpuRegister());
4046 summary->set_out(0, Location::SameAsFirstInput()); 4107 summary->set_out(0, Location::SameAsFirstInput());
4047 return summary; 4108 return summary;
4048 } 4109 }
4049 4110
4050 4111
4051 void Simd64x2ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4112 void Simd64x2ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4052 XmmRegister value = locs()->in(0).fpu_reg(); 4113 XmmRegister value = locs()->in(0).fpu_reg();
4053 4114
4054 ASSERT(locs()->out(0).fpu_reg() == value); 4115 ASSERT(locs()->out(0).fpu_reg() == value);
4055 switch (op_kind()) { 4116 switch (op_kind()) {
4056 case MethodRecognizer::kFloat64x2GetX: 4117 case MethodRecognizer::kFloat64x2GetX:
4057 // nop. 4118 // nop.
4058 break; 4119 break;
4059 case MethodRecognizer::kFloat64x2GetY: 4120 case MethodRecognizer::kFloat64x2GetY:
4060 __ shufpd(value, value, Immediate(0x33)); 4121 __ shufpd(value, value, Immediate(0x33));
4061 break; 4122 break;
4062 default: UNREACHABLE(); 4123 default: UNREACHABLE();
4063 } 4124 }
4064 } 4125 }
4065 4126
4066 4127
4067 LocationSummary* Float64x2ZeroInstr::MakeLocationSummary(bool opt) const { 4128 LocationSummary* Float64x2ZeroInstr::MakeLocationSummary(Isolate* isolate,
4129 bool opt) const {
4068 const intptr_t kNumInputs = 0; 4130 const intptr_t kNumInputs = 0;
4069 const intptr_t kNumTemps = 0; 4131 const intptr_t kNumTemps = 0;
4070 LocationSummary* summary = 4132 LocationSummary* summary = new(isolate) LocationSummary(
4071 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4133 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4072 summary->set_out(0, Location::RequiresFpuRegister()); 4134 summary->set_out(0, Location::RequiresFpuRegister());
4073 return summary; 4135 return summary;
4074 } 4136 }
4075 4137
4076 4138
4077 void Float64x2ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4139 void Float64x2ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4078 XmmRegister value = locs()->out(0).fpu_reg(); 4140 XmmRegister value = locs()->out(0).fpu_reg();
4079 __ xorpd(value, value); 4141 __ xorpd(value, value);
4080 } 4142 }
4081 4143
4082 4144
4083 LocationSummary* Float64x2SplatInstr::MakeLocationSummary(bool opt) const { 4145 LocationSummary* Float64x2SplatInstr::MakeLocationSummary(Isolate* isolate,
4146 bool opt) const {
4084 const intptr_t kNumInputs = 1; 4147 const intptr_t kNumInputs = 1;
4085 const intptr_t kNumTemps = 0; 4148 const intptr_t kNumTemps = 0;
4086 LocationSummary* summary = 4149 LocationSummary* summary = new(isolate) LocationSummary(
4087 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4150 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4088 summary->set_in(0, Location::RequiresFpuRegister()); 4151 summary->set_in(0, Location::RequiresFpuRegister());
4089 summary->set_out(0, Location::SameAsFirstInput()); 4152 summary->set_out(0, Location::SameAsFirstInput());
4090 return summary; 4153 return summary;
4091 } 4154 }
4092 4155
4093 4156
4094 void Float64x2SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4157 void Float64x2SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4095 XmmRegister value = locs()->out(0).fpu_reg(); 4158 XmmRegister value = locs()->out(0).fpu_reg();
4096 __ shufpd(value, value, Immediate(0x0)); 4159 __ shufpd(value, value, Immediate(0x0));
4097 } 4160 }
4098 4161
4099 4162
4100 LocationSummary* Float64x2ConstructorInstr::MakeLocationSummary( 4163 LocationSummary* Float64x2ConstructorInstr::MakeLocationSummary(
4101 bool opt) const { 4164 Isolate* isolate, bool opt) const {
4102 const intptr_t kNumInputs = 2; 4165 const intptr_t kNumInputs = 2;
4103 const intptr_t kNumTemps = 0; 4166 const intptr_t kNumTemps = 0;
4104 LocationSummary* summary = 4167 LocationSummary* summary = new(isolate) LocationSummary(
4105 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4168 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4106 summary->set_in(0, Location::RequiresFpuRegister()); 4169 summary->set_in(0, Location::RequiresFpuRegister());
4107 summary->set_in(1, Location::RequiresFpuRegister()); 4170 summary->set_in(1, Location::RequiresFpuRegister());
4108 summary->set_out(0, Location::SameAsFirstInput()); 4171 summary->set_out(0, Location::SameAsFirstInput());
4109 return summary; 4172 return summary;
4110 } 4173 }
4111 4174
4112 4175
4113 void Float64x2ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4176 void Float64x2ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4114 XmmRegister v0 = locs()->in(0).fpu_reg(); 4177 XmmRegister v0 = locs()->in(0).fpu_reg();
4115 XmmRegister v1 = locs()->in(1).fpu_reg(); 4178 XmmRegister v1 = locs()->in(1).fpu_reg();
4116 ASSERT(v0 == locs()->out(0).fpu_reg()); 4179 ASSERT(v0 == locs()->out(0).fpu_reg());
4117 __ AddImmediate(RSP, Immediate(-16), PP); 4180 __ AddImmediate(RSP, Immediate(-16), PP);
4118 __ movsd(Address(RSP, 0), v0); 4181 __ movsd(Address(RSP, 0), v0);
4119 __ movsd(Address(RSP, 8), v1); 4182 __ movsd(Address(RSP, 8), v1);
4120 __ movups(v0, Address(RSP, 0)); 4183 __ movups(v0, Address(RSP, 0));
4121 __ AddImmediate(RSP, Immediate(16), PP); 4184 __ AddImmediate(RSP, Immediate(16), PP);
4122 } 4185 }
4123 4186
4124 4187
4125 LocationSummary* Float64x2ToFloat32x4Instr::MakeLocationSummary( 4188 LocationSummary* Float64x2ToFloat32x4Instr::MakeLocationSummary(
4126 bool opt) const { 4189 Isolate* isolate, bool opt) const {
4127 const intptr_t kNumInputs = 1; 4190 const intptr_t kNumInputs = 1;
4128 const intptr_t kNumTemps = 0; 4191 const intptr_t kNumTemps = 0;
4129 LocationSummary* summary = 4192 LocationSummary* summary = new(isolate) LocationSummary(
4130 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4193 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4131 summary->set_in(0, Location::RequiresFpuRegister()); 4194 summary->set_in(0, Location::RequiresFpuRegister());
4132 summary->set_out(0, Location::SameAsFirstInput()); 4195 summary->set_out(0, Location::SameAsFirstInput());
4133 return summary; 4196 return summary;
4134 } 4197 }
4135 4198
4136 4199
4137 void Float64x2ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 4200 void Float64x2ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
4138 XmmRegister value = locs()->out(0).fpu_reg(); 4201 XmmRegister value = locs()->out(0).fpu_reg();
4139 __ cvtpd2ps(value, value); 4202 __ cvtpd2ps(value, value);
4140 } 4203 }
4141 4204
4142 4205
4143 LocationSummary* Float32x4ToFloat64x2Instr::MakeLocationSummary( 4206 LocationSummary* Float32x4ToFloat64x2Instr::MakeLocationSummary(
4144 bool opt) const { 4207 Isolate* isolate, bool opt) const {
4145 const intptr_t kNumInputs = 1; 4208 const intptr_t kNumInputs = 1;
4146 const intptr_t kNumTemps = 0; 4209 const intptr_t kNumTemps = 0;
4147 LocationSummary* summary = 4210 LocationSummary* summary = new(isolate) LocationSummary(
4148 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4211 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4149 summary->set_in(0, Location::RequiresFpuRegister()); 4212 summary->set_in(0, Location::RequiresFpuRegister());
4150 summary->set_out(0, Location::SameAsFirstInput()); 4213 summary->set_out(0, Location::SameAsFirstInput());
4151 return summary; 4214 return summary;
4152 } 4215 }
4153 4216
4154 4217
4155 void Float32x4ToFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 4218 void Float32x4ToFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
4156 XmmRegister value = locs()->out(0).fpu_reg(); 4219 XmmRegister value = locs()->out(0).fpu_reg();
4157 __ cvtps2pd(value, value); 4220 __ cvtps2pd(value, value);
4158 } 4221 }
4159 4222
4160 4223
4161 LocationSummary* Float64x2ZeroArgInstr::MakeLocationSummary(bool opt) const { 4224 LocationSummary* Float64x2ZeroArgInstr::MakeLocationSummary(Isolate* isolate,
4225 bool opt) const {
4162 const intptr_t kNumInputs = 1; 4226 const intptr_t kNumInputs = 1;
4163 const intptr_t kNumTemps = 0; 4227 const intptr_t kNumTemps = 0;
4164 LocationSummary* summary = 4228 LocationSummary* summary = new(isolate) LocationSummary(
4165 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4229 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4166 summary->set_in(0, Location::RequiresFpuRegister()); 4230 summary->set_in(0, Location::RequiresFpuRegister());
4167 if (representation() == kTagged) { 4231 if (representation() == kTagged) {
4168 ASSERT(op_kind() == MethodRecognizer::kFloat64x2GetSignMask); 4232 ASSERT(op_kind() == MethodRecognizer::kFloat64x2GetSignMask);
4169 summary->set_out(0, Location::RequiresRegister()); 4233 summary->set_out(0, Location::RequiresRegister());
4170 } else { 4234 } else {
4171 ASSERT(representation() == kUnboxedFloat64x2); 4235 ASSERT(representation() == kUnboxedFloat64x2);
4172 summary->set_out(0, Location::SameAsFirstInput()); 4236 summary->set_out(0, Location::SameAsFirstInput());
4173 } 4237 }
4174 return summary; 4238 return summary;
4175 } 4239 }
(...skipping 17 matching lines...) Expand all
4193 break; 4257 break;
4194 case MethodRecognizer::kFloat64x2GetSignMask: 4258 case MethodRecognizer::kFloat64x2GetSignMask:
4195 __ movmskpd(locs()->out(0).reg(), left); 4259 __ movmskpd(locs()->out(0).reg(), left);
4196 __ SmiTag(locs()->out(0).reg()); 4260 __ SmiTag(locs()->out(0).reg());
4197 break; 4261 break;
4198 default: UNREACHABLE(); 4262 default: UNREACHABLE();
4199 } 4263 }
4200 } 4264 }
4201 4265
4202 4266
4203 LocationSummary* Float64x2OneArgInstr::MakeLocationSummary(bool opt) const { 4267 LocationSummary* Float64x2OneArgInstr::MakeLocationSummary(Isolate* isolate,
4268 bool opt) const {
4204 const intptr_t kNumInputs = 2; 4269 const intptr_t kNumInputs = 2;
4205 const intptr_t kNumTemps = 0; 4270 const intptr_t kNumTemps = 0;
4206 LocationSummary* summary = 4271 LocationSummary* summary = new(isolate) LocationSummary(
4207 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4272 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4208 summary->set_in(0, Location::RequiresFpuRegister()); 4273 summary->set_in(0, Location::RequiresFpuRegister());
4209 summary->set_in(1, Location::RequiresFpuRegister()); 4274 summary->set_in(1, Location::RequiresFpuRegister());
4210 summary->set_out(0, Location::SameAsFirstInput()); 4275 summary->set_out(0, Location::SameAsFirstInput());
4211 return summary; 4276 return summary;
4212 } 4277 }
4213 4278
4214 4279
4215 void Float64x2OneArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4280 void Float64x2OneArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4216 XmmRegister left = locs()->in(0).fpu_reg(); 4281 XmmRegister left = locs()->in(0).fpu_reg();
4217 XmmRegister right = locs()->in(1).fpu_reg(); 4282 XmmRegister right = locs()->in(1).fpu_reg();
(...skipping 29 matching lines...) Expand all
4247 break; 4312 break;
4248 case MethodRecognizer::kFloat64x2Max: 4313 case MethodRecognizer::kFloat64x2Max:
4249 __ maxpd(left, right); 4314 __ maxpd(left, right);
4250 break; 4315 break;
4251 default: UNREACHABLE(); 4316 default: UNREACHABLE();
4252 } 4317 }
4253 } 4318 }
4254 4319
4255 4320
4256 LocationSummary* Int32x4BoolConstructorInstr::MakeLocationSummary( 4321 LocationSummary* Int32x4BoolConstructorInstr::MakeLocationSummary(
4257 bool opt) const { 4322 Isolate* isolate, bool opt) const {
4258 const intptr_t kNumInputs = 4; 4323 const intptr_t kNumInputs = 4;
4259 const intptr_t kNumTemps = 1; 4324 const intptr_t kNumTemps = 1;
4260 LocationSummary* summary = 4325 LocationSummary* summary = new(isolate) LocationSummary(
4261 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4326 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4262 summary->set_in(0, Location::RequiresRegister()); 4327 summary->set_in(0, Location::RequiresRegister());
4263 summary->set_in(1, Location::RequiresRegister()); 4328 summary->set_in(1, Location::RequiresRegister());
4264 summary->set_in(2, Location::RequiresRegister()); 4329 summary->set_in(2, Location::RequiresRegister());
4265 summary->set_in(3, Location::RequiresRegister()); 4330 summary->set_in(3, Location::RequiresRegister());
4266 summary->set_temp(0, Location::RequiresRegister()); 4331 summary->set_temp(0, Location::RequiresRegister());
4267 summary->set_out(0, Location::RequiresFpuRegister()); 4332 summary->set_out(0, Location::RequiresFpuRegister());
4268 return summary; 4333 return summary;
4269 } 4334 }
4270 4335
4271 4336
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
4316 __ Bind(&w_false); 4381 __ Bind(&w_false);
4317 __ LoadImmediate(temp, Immediate(0x0), PP); 4382 __ LoadImmediate(temp, Immediate(0x0), PP);
4318 __ Bind(&w_done); 4383 __ Bind(&w_done);
4319 __ movl(Address(RSP, 12), temp); 4384 __ movl(Address(RSP, 12), temp);
4320 4385
4321 __ movups(result, Address(RSP, 0)); 4386 __ movups(result, Address(RSP, 0));
4322 __ AddImmediate(RSP, Immediate(16), PP); 4387 __ AddImmediate(RSP, Immediate(16), PP);
4323 } 4388 }
4324 4389
4325 4390
4326 LocationSummary* Int32x4GetFlagInstr::MakeLocationSummary(bool opt) const { 4391 LocationSummary* Int32x4GetFlagInstr::MakeLocationSummary(Isolate* isolate,
4392 bool opt) const {
4327 const intptr_t kNumInputs = 1; 4393 const intptr_t kNumInputs = 1;
4328 const intptr_t kNumTemps = 0; 4394 const intptr_t kNumTemps = 0;
4329 LocationSummary* summary = 4395 LocationSummary* summary = new(isolate) LocationSummary(
4330 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4396 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4331 summary->set_in(0, Location::RequiresFpuRegister()); 4397 summary->set_in(0, Location::RequiresFpuRegister());
4332 summary->set_out(0, Location::RequiresRegister()); 4398 summary->set_out(0, Location::RequiresRegister());
4333 return summary; 4399 return summary;
4334 } 4400 }
4335 4401
4336 4402
4337 void Int32x4GetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4403 void Int32x4GetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4338 XmmRegister value = locs()->in(0).fpu_reg(); 4404 XmmRegister value = locs()->in(0).fpu_reg();
4339 Register result = locs()->out(0).reg(); 4405 Register result = locs()->out(0).reg();
4340 Label done; 4406 Label done;
(...skipping 20 matching lines...) Expand all
4361 __ testl(result, result); 4427 __ testl(result, result);
4362 __ j(NOT_ZERO, &non_zero, Assembler::kNearJump); 4428 __ j(NOT_ZERO, &non_zero, Assembler::kNearJump);
4363 __ LoadObject(result, Bool::False(), PP); 4429 __ LoadObject(result, Bool::False(), PP);
4364 __ jmp(&done); 4430 __ jmp(&done);
4365 __ Bind(&non_zero); 4431 __ Bind(&non_zero);
4366 __ LoadObject(result, Bool::True(), PP); 4432 __ LoadObject(result, Bool::True(), PP);
4367 __ Bind(&done); 4433 __ Bind(&done);
4368 } 4434 }
4369 4435
4370 4436
4371 LocationSummary* Int32x4SelectInstr::MakeLocationSummary(bool opt) const { 4437 LocationSummary* Int32x4SelectInstr::MakeLocationSummary(Isolate* isolate,
4438 bool opt) const {
4372 const intptr_t kNumInputs = 3; 4439 const intptr_t kNumInputs = 3;
4373 const intptr_t kNumTemps = 1; 4440 const intptr_t kNumTemps = 1;
4374 LocationSummary* summary = 4441 LocationSummary* summary = new(isolate) LocationSummary(
4375 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4442 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4376 summary->set_in(0, Location::RequiresFpuRegister()); 4443 summary->set_in(0, Location::RequiresFpuRegister());
4377 summary->set_in(1, Location::RequiresFpuRegister()); 4444 summary->set_in(1, Location::RequiresFpuRegister());
4378 summary->set_in(2, Location::RequiresFpuRegister()); 4445 summary->set_in(2, Location::RequiresFpuRegister());
4379 summary->set_temp(0, Location::RequiresFpuRegister()); 4446 summary->set_temp(0, Location::RequiresFpuRegister());
4380 summary->set_out(0, Location::SameAsFirstInput()); 4447 summary->set_out(0, Location::SameAsFirstInput());
4381 return summary; 4448 return summary;
4382 } 4449 }
4383 4450
4384 4451
4385 void Int32x4SelectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4452 void Int32x4SelectInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4386 XmmRegister mask = locs()->in(0).fpu_reg(); 4453 XmmRegister mask = locs()->in(0).fpu_reg();
4387 XmmRegister trueValue = locs()->in(1).fpu_reg(); 4454 XmmRegister trueValue = locs()->in(1).fpu_reg();
4388 XmmRegister falseValue = locs()->in(2).fpu_reg(); 4455 XmmRegister falseValue = locs()->in(2).fpu_reg();
4389 XmmRegister out = locs()->out(0).fpu_reg(); 4456 XmmRegister out = locs()->out(0).fpu_reg();
4390 XmmRegister temp = locs()->temp(0).fpu_reg(); 4457 XmmRegister temp = locs()->temp(0).fpu_reg();
4391 ASSERT(out == mask); 4458 ASSERT(out == mask);
4392 // Copy mask. 4459 // Copy mask.
4393 __ movaps(temp, mask); 4460 __ movaps(temp, mask);
4394 // Invert it. 4461 // Invert it.
4395 __ notps(temp); 4462 __ notps(temp);
4396 // mask = mask & trueValue. 4463 // mask = mask & trueValue.
4397 __ andps(mask, trueValue); 4464 __ andps(mask, trueValue);
4398 // temp = temp & falseValue. 4465 // temp = temp & falseValue.
4399 __ andps(temp, falseValue); 4466 __ andps(temp, falseValue);
4400 // out = mask | temp. 4467 // out = mask | temp.
4401 __ orps(mask, temp); 4468 __ orps(mask, temp);
4402 } 4469 }
4403 4470
4404 4471
4405 LocationSummary* Int32x4SetFlagInstr::MakeLocationSummary(bool opt) const { 4472 LocationSummary* Int32x4SetFlagInstr::MakeLocationSummary(Isolate* isolate,
4473 bool opt) const {
4406 const intptr_t kNumInputs = 2; 4474 const intptr_t kNumInputs = 2;
4407 const intptr_t kNumTemps = 1; 4475 const intptr_t kNumTemps = 1;
4408 LocationSummary* summary = 4476 LocationSummary* summary = new(isolate) LocationSummary(
4409 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4477 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4410 summary->set_in(0, Location::RequiresFpuRegister()); 4478 summary->set_in(0, Location::RequiresFpuRegister());
4411 summary->set_in(1, Location::RequiresRegister()); 4479 summary->set_in(1, Location::RequiresRegister());
4412 summary->set_temp(0, Location::RequiresRegister()); 4480 summary->set_temp(0, Location::RequiresRegister());
4413 summary->set_out(0, Location::SameAsFirstInput()); 4481 summary->set_out(0, Location::SameAsFirstInput());
4414 return summary; 4482 return summary;
4415 } 4483 }
4416 4484
4417 4485
4418 void Int32x4SetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4486 void Int32x4SetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4419 XmmRegister mask = locs()->in(0).fpu_reg(); 4487 XmmRegister mask = locs()->in(0).fpu_reg();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
4461 break; 4529 break;
4462 default: UNREACHABLE(); 4530 default: UNREACHABLE();
4463 } 4531 }
4464 __ Bind(&exitPath); 4532 __ Bind(&exitPath);
4465 // Copy mask back to register. 4533 // Copy mask back to register.
4466 __ movups(mask, Address(RSP, 0)); 4534 __ movups(mask, Address(RSP, 0));
4467 __ AddImmediate(RSP, Immediate(16), PP); 4535 __ AddImmediate(RSP, Immediate(16), PP);
4468 } 4536 }
4469 4537
4470 4538
4471 LocationSummary* Int32x4ToFloat32x4Instr::MakeLocationSummary(bool opt) const { 4539 LocationSummary* Int32x4ToFloat32x4Instr::MakeLocationSummary(Isolate* isolate,
4540 bool opt) const {
4472 const intptr_t kNumInputs = 1; 4541 const intptr_t kNumInputs = 1;
4473 const intptr_t kNumTemps = 0; 4542 const intptr_t kNumTemps = 0;
4474 LocationSummary* summary = 4543 LocationSummary* summary = new(isolate) LocationSummary(
4475 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4544 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4476 summary->set_in(0, Location::RequiresFpuRegister()); 4545 summary->set_in(0, Location::RequiresFpuRegister());
4477 summary->set_out(0, Location::SameAsFirstInput()); 4546 summary->set_out(0, Location::SameAsFirstInput());
4478 return summary; 4547 return summary;
4479 } 4548 }
4480 4549
4481 4550
4482 void Int32x4ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 4551 void Int32x4ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
4483 // NOP. 4552 // NOP.
4484 } 4553 }
4485 4554
4486 4555
4487 LocationSummary* BinaryInt32x4OpInstr::MakeLocationSummary(bool opt) const { 4556 LocationSummary* BinaryInt32x4OpInstr::MakeLocationSummary(Isolate* isolate,
4557 bool opt) const {
4488 const intptr_t kNumInputs = 2; 4558 const intptr_t kNumInputs = 2;
4489 const intptr_t kNumTemps = 0; 4559 const intptr_t kNumTemps = 0;
4490 LocationSummary* summary = 4560 LocationSummary* summary = new(isolate) LocationSummary(
4491 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4561 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4492 summary->set_in(0, Location::RequiresFpuRegister()); 4562 summary->set_in(0, Location::RequiresFpuRegister());
4493 summary->set_in(1, Location::RequiresFpuRegister()); 4563 summary->set_in(1, Location::RequiresFpuRegister());
4494 summary->set_out(0, Location::SameAsFirstInput()); 4564 summary->set_out(0, Location::SameAsFirstInput());
4495 return summary; 4565 return summary;
4496 } 4566 }
4497 4567
4498 4568
4499 void BinaryInt32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4569 void BinaryInt32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4500 XmmRegister left = locs()->in(0).fpu_reg(); 4570 XmmRegister left = locs()->in(0).fpu_reg();
4501 XmmRegister right = locs()->in(1).fpu_reg(); 4571 XmmRegister right = locs()->in(1).fpu_reg();
(...skipping 15 matching lines...) Expand all
4517 __ addpl(left, right); 4587 __ addpl(left, right);
4518 break; 4588 break;
4519 case Token::kSUB: 4589 case Token::kSUB:
4520 __ subpl(left, right); 4590 __ subpl(left, right);
4521 break; 4591 break;
4522 default: UNREACHABLE(); 4592 default: UNREACHABLE();
4523 } 4593 }
4524 } 4594 }
4525 4595
4526 4596
4527 LocationSummary* MathUnaryInstr::MakeLocationSummary(bool opt) const { 4597 LocationSummary* MathUnaryInstr::MakeLocationSummary(Isolate* isolate,
4598 bool opt) const {
4528 if ((kind() == MathUnaryInstr::kSin) || (kind() == MathUnaryInstr::kCos)) { 4599 if ((kind() == MathUnaryInstr::kSin) || (kind() == MathUnaryInstr::kCos)) {
4529 // Calling convention on x64 uses XMM0 and XMM1 to pass the first two 4600 // Calling convention on x64 uses XMM0 and XMM1 to pass the first two
4530 // double arguments and XMM0 to return the result. Unfortunately 4601 // double arguments and XMM0 to return the result. Unfortunately
4531 // currently we can't specify these registers because ParallelMoveResolver 4602 // currently we can't specify these registers because ParallelMoveResolver
4532 // assumes that XMM0 is free at all times. 4603 // assumes that XMM0 is free at all times.
4533 // TODO(vegorov): allow XMM0 to be used. 4604 // TODO(vegorov): allow XMM0 to be used.
4534 const intptr_t kNumTemps = 1; 4605 const intptr_t kNumTemps = 1;
4535 LocationSummary* summary = 4606 LocationSummary* summary = new(isolate) LocationSummary(
4536 new LocationSummary(InputCount(), kNumTemps, LocationSummary::kCall); 4607 isolate, InputCount(), kNumTemps, LocationSummary::kCall);
4537 summary->set_in(0, Location::FpuRegisterLocation(XMM1)); 4608 summary->set_in(0, Location::FpuRegisterLocation(XMM1));
4538 // R13 is chosen because it is callee saved so we do not need to back it 4609 // R13 is chosen because it is callee saved so we do not need to back it
4539 // up before calling into the runtime. 4610 // up before calling into the runtime.
4540 summary->set_temp(0, Location::RegisterLocation(R13)); 4611 summary->set_temp(0, Location::RegisterLocation(R13));
4541 summary->set_out(0, Location::FpuRegisterLocation(XMM1)); 4612 summary->set_out(0, Location::FpuRegisterLocation(XMM1));
4542 return summary; 4613 return summary;
4543 } 4614 }
4544 ASSERT((kind() == MathUnaryInstr::kSqrt) || 4615 ASSERT((kind() == MathUnaryInstr::kSqrt) ||
4545 (kind() == MathUnaryInstr::kDoubleSquare)); 4616 (kind() == MathUnaryInstr::kDoubleSquare));
4546 const intptr_t kNumInputs = 1; 4617 const intptr_t kNumInputs = 1;
4547 const intptr_t kNumTemps = 0; 4618 const intptr_t kNumTemps = 0;
4548 LocationSummary* summary = 4619 LocationSummary* summary = new(isolate) LocationSummary(
4549 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4620 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4550 summary->set_in(0, Location::RequiresFpuRegister()); 4621 summary->set_in(0, Location::RequiresFpuRegister());
4551 if (kind() == MathUnaryInstr::kDoubleSquare) { 4622 if (kind() == MathUnaryInstr::kDoubleSquare) {
4552 summary->set_out(0, Location::SameAsFirstInput()); 4623 summary->set_out(0, Location::SameAsFirstInput());
4553 } else { 4624 } else {
4554 summary->set_out(0, Location::RequiresFpuRegister()); 4625 summary->set_out(0, Location::RequiresFpuRegister());
4555 } 4626 }
4556 return summary; 4627 return summary;
4557 } 4628 }
4558 4629
4559 4630
(...skipping 12 matching lines...) Expand all
4572 __ ReserveAlignedFrameSpace(0); 4643 __ ReserveAlignedFrameSpace(0);
4573 __ movaps(XMM0, locs()->in(0).fpu_reg()); 4644 __ movaps(XMM0, locs()->in(0).fpu_reg());
4574 __ CallRuntime(TargetFunction(), InputCount()); 4645 __ CallRuntime(TargetFunction(), InputCount());
4575 __ movaps(locs()->out(0).fpu_reg(), XMM0); 4646 __ movaps(locs()->out(0).fpu_reg(), XMM0);
4576 // Restore RSP. 4647 // Restore RSP.
4577 __ movq(RSP, locs()->temp(0).reg()); 4648 __ movq(RSP, locs()->temp(0).reg());
4578 } 4649 }
4579 } 4650 }
4580 4651
4581 4652
4582 LocationSummary* UnarySmiOpInstr::MakeLocationSummary(bool opt) const { 4653 LocationSummary* UnarySmiOpInstr::MakeLocationSummary(Isolate* isolate,
4654 bool opt) const {
4583 const intptr_t kNumInputs = 1; 4655 const intptr_t kNumInputs = 1;
4584 return LocationSummary::Make(kNumInputs, 4656 return LocationSummary::Make(kNumInputs,
4585 Location::SameAsFirstInput(), 4657 Location::SameAsFirstInput(),
4586 LocationSummary::kNoCall); 4658 LocationSummary::kNoCall);
4587 } 4659 }
4588 4660
4589 4661
4590 void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4662 void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4591 Register value = locs()->in(0).reg(); 4663 Register value = locs()->in(0).reg();
4592 ASSERT(value == locs()->out(0).reg()); 4664 ASSERT(value == locs()->out(0).reg());
(...skipping 11 matching lines...) Expand all
4604 __ notq(value); 4676 __ notq(value);
4605 // Remove inverted smi-tag. 4677 // Remove inverted smi-tag.
4606 __ AndImmediate(value, Immediate(~kSmiTagMask), PP); 4678 __ AndImmediate(value, Immediate(~kSmiTagMask), PP);
4607 break; 4679 break;
4608 default: 4680 default:
4609 UNREACHABLE(); 4681 UNREACHABLE();
4610 } 4682 }
4611 } 4683 }
4612 4684
4613 4685
4614 LocationSummary* UnaryDoubleOpInstr::MakeLocationSummary(bool opt) const { 4686 LocationSummary* UnaryDoubleOpInstr::MakeLocationSummary(Isolate* isolate,
4687 bool opt) const {
4615 const intptr_t kNumInputs = 1; 4688 const intptr_t kNumInputs = 1;
4616 const intptr_t kNumTemps = 0; 4689 const intptr_t kNumTemps = 0;
4617 LocationSummary* summary = 4690 LocationSummary* summary = new(isolate) LocationSummary(
4618 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4691 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4619 summary->set_in(0, Location::RequiresFpuRegister()); 4692 summary->set_in(0, Location::RequiresFpuRegister());
4620 summary->set_out(0, Location::SameAsFirstInput()); 4693 summary->set_out(0, Location::SameAsFirstInput());
4621 return summary; 4694 return summary;
4622 } 4695 }
4623 4696
4624 4697
4625 void UnaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4698 void UnaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4626 XmmRegister value = locs()->in(0).fpu_reg(); 4699 XmmRegister value = locs()->in(0).fpu_reg();
4627 ASSERT(locs()->out(0).fpu_reg() == value); 4700 ASSERT(locs()->out(0).fpu_reg() == value);
4628 __ DoubleNegate(value); 4701 __ DoubleNegate(value);
4629 } 4702 }
4630 4703
4631 4704
4632 LocationSummary* MathMinMaxInstr::MakeLocationSummary(bool opt) const { 4705 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate,
4706 bool opt) const {
4633 if (result_cid() == kDoubleCid) { 4707 if (result_cid() == kDoubleCid) {
4634 const intptr_t kNumInputs = 2; 4708 const intptr_t kNumInputs = 2;
4635 const intptr_t kNumTemps = 1; 4709 const intptr_t kNumTemps = 1;
4636 LocationSummary* summary = 4710 LocationSummary* summary = new(isolate) LocationSummary(
4637 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4711 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4638 summary->set_in(0, Location::RequiresFpuRegister()); 4712 summary->set_in(0, Location::RequiresFpuRegister());
4639 summary->set_in(1, Location::RequiresFpuRegister()); 4713 summary->set_in(1, Location::RequiresFpuRegister());
4640 // Reuse the left register so that code can be made shorter. 4714 // Reuse the left register so that code can be made shorter.
4641 summary->set_out(0, Location::SameAsFirstInput()); 4715 summary->set_out(0, Location::SameAsFirstInput());
4642 summary->set_temp(0, Location::RequiresRegister()); 4716 summary->set_temp(0, Location::RequiresRegister());
4643 return summary; 4717 return summary;
4644 } 4718 }
4645 ASSERT(result_cid() == kSmiCid); 4719 ASSERT(result_cid() == kSmiCid);
4646 const intptr_t kNumInputs = 2; 4720 const intptr_t kNumInputs = 2;
4647 const intptr_t kNumTemps = 0; 4721 const intptr_t kNumTemps = 0;
4648 LocationSummary* summary = 4722 LocationSummary* summary = new(isolate) LocationSummary(
4649 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4723 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4650 summary->set_in(0, Location::RequiresRegister()); 4724 summary->set_in(0, Location::RequiresRegister());
4651 summary->set_in(1, Location::RequiresRegister()); 4725 summary->set_in(1, Location::RequiresRegister());
4652 // Reuse the left register so that code can be made shorter. 4726 // Reuse the left register so that code can be made shorter.
4653 summary->set_out(0, Location::SameAsFirstInput()); 4727 summary->set_out(0, Location::SameAsFirstInput());
4654 return summary; 4728 return summary;
4655 } 4729 }
4656 4730
4657 4731
4658 void MathMinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4732 void MathMinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4659 ASSERT((op_kind() == MethodRecognizer::kMathMin) || 4733 ASSERT((op_kind() == MethodRecognizer::kMathMin) ||
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
4711 __ cmpq(left, right); 4785 __ cmpq(left, right);
4712 ASSERT(result == left); 4786 ASSERT(result == left);
4713 if (is_min) { 4787 if (is_min) {
4714 __ cmovgeq(result, right); 4788 __ cmovgeq(result, right);
4715 } else { 4789 } else {
4716 __ cmovlessq(result, right); 4790 __ cmovlessq(result, right);
4717 } 4791 }
4718 } 4792 }
4719 4793
4720 4794
4721 LocationSummary* SmiToDoubleInstr::MakeLocationSummary(bool opt) const { 4795 LocationSummary* SmiToDoubleInstr::MakeLocationSummary(Isolate* isolate,
4796 bool opt) const {
4722 const intptr_t kNumInputs = 1; 4797 const intptr_t kNumInputs = 1;
4723 const intptr_t kNumTemps = 0; 4798 const intptr_t kNumTemps = 0;
4724 LocationSummary* result = 4799 LocationSummary* result = new(isolate) LocationSummary(
4725 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4800 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4726 result->set_in(0, Location::WritableRegister()); 4801 result->set_in(0, Location::WritableRegister());
4727 result->set_out(0, Location::RequiresFpuRegister()); 4802 result->set_out(0, Location::RequiresFpuRegister());
4728 return result; 4803 return result;
4729 } 4804 }
4730 4805
4731 4806
4732 void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4807 void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4733 Register value = locs()->in(0).reg(); 4808 Register value = locs()->in(0).reg();
4734 FpuRegister result = locs()->out(0).fpu_reg(); 4809 FpuRegister result = locs()->out(0).fpu_reg();
4735 __ SmiUntag(value); 4810 __ SmiUntag(value);
4736 __ cvtsi2sd(result, value); 4811 __ cvtsi2sd(result, value);
4737 } 4812 }
4738 4813
4739 4814
4740 LocationSummary* DoubleToIntegerInstr::MakeLocationSummary(bool opt) const { 4815 LocationSummary* DoubleToIntegerInstr::MakeLocationSummary(Isolate* isolate,
4816 bool opt) const {
4741 const intptr_t kNumInputs = 1; 4817 const intptr_t kNumInputs = 1;
4742 const intptr_t kNumTemps = 1; 4818 const intptr_t kNumTemps = 1;
4743 LocationSummary* result = 4819 LocationSummary* result = new(isolate) LocationSummary(
4744 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 4820 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
4745 result->set_in(0, Location::RegisterLocation(RCX)); 4821 result->set_in(0, Location::RegisterLocation(RCX));
4746 result->set_out(0, Location::RegisterLocation(RAX)); 4822 result->set_out(0, Location::RegisterLocation(RAX));
4747 result->set_temp(0, Location::RegisterLocation(RBX)); 4823 result->set_temp(0, Location::RegisterLocation(RBX));
4748 return result; 4824 return result;
4749 } 4825 }
4750 4826
4751 4827
4752 void DoubleToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4828 void DoubleToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4753 Register result = locs()->out(0).reg(); 4829 Register result = locs()->out(0).reg();
4754 Register value_obj = locs()->in(0).reg(); 4830 Register value_obj = locs()->in(0).reg();
(...skipping 26 matching lines...) Expand all
4781 compiler->GenerateStaticCall(deopt_id(), 4857 compiler->GenerateStaticCall(deopt_id(),
4782 instance_call()->token_pos(), 4858 instance_call()->token_pos(),
4783 target, 4859 target,
4784 kNumberOfArguments, 4860 kNumberOfArguments,
4785 Object::null_array(), // No argument names. 4861 Object::null_array(), // No argument names.
4786 locs()); 4862 locs());
4787 __ Bind(&done); 4863 __ Bind(&done);
4788 } 4864 }
4789 4865
4790 4866
4791 LocationSummary* DoubleToSmiInstr::MakeLocationSummary(bool opt) const { 4867 LocationSummary* DoubleToSmiInstr::MakeLocationSummary(Isolate* isolate,
4868 bool opt) const {
4792 const intptr_t kNumInputs = 1; 4869 const intptr_t kNumInputs = 1;
4793 const intptr_t kNumTemps = 1; 4870 const intptr_t kNumTemps = 1;
4794 LocationSummary* result = new LocationSummary( 4871 LocationSummary* result = new(isolate) LocationSummary(
4795 kNumInputs, kNumTemps, LocationSummary::kNoCall); 4872 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4796 result->set_in(0, Location::RequiresFpuRegister()); 4873 result->set_in(0, Location::RequiresFpuRegister());
4797 result->set_out(0, Location:: Location::RequiresRegister()); 4874 result->set_out(0, Location:: Location::RequiresRegister());
4798 result->set_temp(0, Location::RequiresRegister()); 4875 result->set_temp(0, Location::RequiresRegister());
4799 return result; 4876 return result;
4800 } 4877 }
4801 4878
4802 4879
4803 void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4880 void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4804 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptDoubleToSmi); 4881 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptDoubleToSmi);
4805 Register result = locs()->out(0).reg(); 4882 Register result = locs()->out(0).reg();
4806 XmmRegister value = locs()->in(0).fpu_reg(); 4883 XmmRegister value = locs()->in(0).fpu_reg();
4807 Register temp = locs()->temp(0).reg(); 4884 Register temp = locs()->temp(0).reg();
4808 4885
4809 __ cvttsd2siq(result, value); 4886 __ cvttsd2siq(result, value);
4810 // Overflow is signalled with minint. 4887 // Overflow is signalled with minint.
4811 Label do_call, done; 4888 Label do_call, done;
4812 // Check for overflow and that it fits into Smi. 4889 // Check for overflow and that it fits into Smi.
4813 __ movq(temp, result); 4890 __ movq(temp, result);
4814 __ shlq(temp, Immediate(1)); 4891 __ shlq(temp, Immediate(1));
4815 __ j(OVERFLOW, deopt); 4892 __ j(OVERFLOW, deopt);
4816 __ SmiTag(result); 4893 __ SmiTag(result);
4817 if (FLAG_throw_on_javascript_int_overflow) { 4894 if (FLAG_throw_on_javascript_int_overflow) {
4818 EmitJavascriptOverflowCheck(compiler, range(), deopt, result); 4895 EmitJavascriptOverflowCheck(compiler, range(), deopt, result);
4819 } 4896 }
4820 } 4897 }
4821 4898
4822 4899
4823 LocationSummary* DoubleToDoubleInstr::MakeLocationSummary(bool opt) const { 4900 LocationSummary* DoubleToDoubleInstr::MakeLocationSummary(Isolate* isolate,
4901 bool opt) const {
4824 const intptr_t kNumInputs = 1; 4902 const intptr_t kNumInputs = 1;
4825 const intptr_t kNumTemps = 0; 4903 const intptr_t kNumTemps = 0;
4826 LocationSummary* result = 4904 LocationSummary* result = new(isolate) LocationSummary(
4827 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4905 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4828 result->set_in(0, Location::RequiresFpuRegister()); 4906 result->set_in(0, Location::RequiresFpuRegister());
4829 result->set_out(0, Location::RequiresFpuRegister()); 4907 result->set_out(0, Location::RequiresFpuRegister());
4830 return result; 4908 return result;
4831 } 4909 }
4832 4910
4833 4911
4834 void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4912 void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4835 XmmRegister value = locs()->in(0).fpu_reg(); 4913 XmmRegister value = locs()->in(0).fpu_reg();
4836 XmmRegister result = locs()->out(0).fpu_reg(); 4914 XmmRegister result = locs()->out(0).fpu_reg();
4837 switch (recognized_kind()) { 4915 switch (recognized_kind()) {
4838 case MethodRecognizer::kDoubleTruncate: 4916 case MethodRecognizer::kDoubleTruncate:
4839 __ roundsd(result, value, Assembler::kRoundToZero); 4917 __ roundsd(result, value, Assembler::kRoundToZero);
4840 break; 4918 break;
4841 case MethodRecognizer::kDoubleFloor: 4919 case MethodRecognizer::kDoubleFloor:
4842 __ roundsd(result, value, Assembler::kRoundDown); 4920 __ roundsd(result, value, Assembler::kRoundDown);
4843 break; 4921 break;
4844 case MethodRecognizer::kDoubleCeil: 4922 case MethodRecognizer::kDoubleCeil:
4845 __ roundsd(result, value, Assembler::kRoundUp); 4923 __ roundsd(result, value, Assembler::kRoundUp);
4846 break; 4924 break;
4847 default: 4925 default:
4848 UNREACHABLE(); 4926 UNREACHABLE();
4849 } 4927 }
4850 } 4928 }
4851 4929
4852 4930
4853 LocationSummary* DoubleToFloatInstr::MakeLocationSummary(bool opt) const { 4931 LocationSummary* DoubleToFloatInstr::MakeLocationSummary(Isolate* isolate,
4932 bool opt) const {
4854 const intptr_t kNumInputs = 1; 4933 const intptr_t kNumInputs = 1;
4855 const intptr_t kNumTemps = 0; 4934 const intptr_t kNumTemps = 0;
4856 LocationSummary* result = 4935 LocationSummary* result = new(isolate) LocationSummary(
4857 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4936 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4858 result->set_in(0, Location::RequiresFpuRegister()); 4937 result->set_in(0, Location::RequiresFpuRegister());
4859 result->set_out(0, Location::SameAsFirstInput()); 4938 result->set_out(0, Location::SameAsFirstInput());
4860 return result; 4939 return result;
4861 } 4940 }
4862 4941
4863 4942
4864 void DoubleToFloatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4943 void DoubleToFloatInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4865 __ cvtsd2ss(locs()->out(0).fpu_reg(), locs()->in(0).fpu_reg()); 4944 __ cvtsd2ss(locs()->out(0).fpu_reg(), locs()->in(0).fpu_reg());
4866 } 4945 }
4867 4946
4868 4947
4869 LocationSummary* FloatToDoubleInstr::MakeLocationSummary(bool opt) const { 4948 LocationSummary* FloatToDoubleInstr::MakeLocationSummary(Isolate* isolate,
4949 bool opt) const {
4870 const intptr_t kNumInputs = 1; 4950 const intptr_t kNumInputs = 1;
4871 const intptr_t kNumTemps = 0; 4951 const intptr_t kNumTemps = 0;
4872 LocationSummary* result = 4952 LocationSummary* result = new(isolate) LocationSummary(
4873 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4953 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4874 result->set_in(0, Location::RequiresFpuRegister()); 4954 result->set_in(0, Location::RequiresFpuRegister());
4875 result->set_out(0, Location::SameAsFirstInput()); 4955 result->set_out(0, Location::SameAsFirstInput());
4876 return result; 4956 return result;
4877 } 4957 }
4878 4958
4879 4959
4880 void FloatToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4960 void FloatToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4881 __ cvtss2sd(locs()->out(0).fpu_reg(), locs()->in(0).fpu_reg()); 4961 __ cvtss2sd(locs()->out(0).fpu_reg(), locs()->in(0).fpu_reg());
4882 } 4962 }
4883 4963
4884 4964
4885 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(bool opt) const { 4965 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(Isolate* isolate,
4966 bool opt) const {
4886 // Calling convention on x64 uses XMM0 and XMM1 to pass the first two 4967 // Calling convention on x64 uses XMM0 and XMM1 to pass the first two
4887 // double arguments and XMM0 to return the result. Unfortunately 4968 // double arguments and XMM0 to return the result. Unfortunately
4888 // currently we can't specify these registers because ParallelMoveResolver 4969 // currently we can't specify these registers because ParallelMoveResolver
4889 // assumes that XMM0 is free at all times. 4970 // assumes that XMM0 is free at all times.
4890 // TODO(vegorov): allow XMM0 to be used. 4971 // TODO(vegorov): allow XMM0 to be used.
4891 ASSERT((InputCount() == 1) || (InputCount() == 2)); 4972 ASSERT((InputCount() == 1) || (InputCount() == 2));
4892 const intptr_t kNumTemps = 1; 4973 const intptr_t kNumTemps = 1;
4893 LocationSummary* result = 4974 LocationSummary* result = new(isolate) LocationSummary(
4894 new LocationSummary(InputCount(), kNumTemps, LocationSummary::kCall); 4975 isolate, InputCount(), kNumTemps, LocationSummary::kCall);
4895 result->set_temp(0, Location::RegisterLocation(R13)); 4976 result->set_temp(0, Location::RegisterLocation(R13));
4896 result->set_in(0, Location::FpuRegisterLocation(XMM2)); 4977 result->set_in(0, Location::FpuRegisterLocation(XMM2));
4897 if (InputCount() == 2) { 4978 if (InputCount() == 2) {
4898 result->set_in(1, Location::FpuRegisterLocation(XMM1)); 4979 result->set_in(1, Location::FpuRegisterLocation(XMM1));
4899 } 4980 }
4900 if (recognized_kind() == MethodRecognizer::kMathDoublePow) { 4981 if (recognized_kind() == MethodRecognizer::kMathDoublePow) {
4901 // Temp index 1. 4982 // Temp index 1.
4902 result->AddTemp(Location::RegisterLocation(RAX)); 4983 result->AddTemp(Location::RegisterLocation(RAX));
4903 // Temp index 2. 4984 // Temp index 2.
4904 result->AddTemp(Location::FpuRegisterLocation(XMM4)); 4985 result->AddTemp(Location::FpuRegisterLocation(XMM4));
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
5056 ASSERT(locs()->in(1).fpu_reg() == XMM1); 5137 ASSERT(locs()->in(1).fpu_reg() == XMM1);
5057 } 5138 }
5058 5139
5059 __ CallRuntime(TargetFunction(), InputCount()); 5140 __ CallRuntime(TargetFunction(), InputCount());
5060 __ movaps(locs()->out(0).fpu_reg(), XMM0); 5141 __ movaps(locs()->out(0).fpu_reg(), XMM0);
5061 // Restore RSP. 5142 // Restore RSP.
5062 __ movq(RSP, locs()->temp(kSavedSpTempIndex).reg()); 5143 __ movq(RSP, locs()->temp(kSavedSpTempIndex).reg());
5063 } 5144 }
5064 5145
5065 5146
5066 LocationSummary* ExtractNthOutputInstr::MakeLocationSummary(bool opt) const { 5147 LocationSummary* ExtractNthOutputInstr::MakeLocationSummary(Isolate* isolate,
5148 bool opt) const {
5067 // Only use this instruction in optimized code. 5149 // Only use this instruction in optimized code.
5068 ASSERT(opt); 5150 ASSERT(opt);
5069 const intptr_t kNumInputs = 1; 5151 const intptr_t kNumInputs = 1;
5070 LocationSummary* summary = 5152 LocationSummary* summary = new(isolate) LocationSummary(
5071 new LocationSummary(kNumInputs, 0, LocationSummary::kNoCall); 5153 isolate, kNumInputs, 0, LocationSummary::kNoCall);
5072 if (representation() == kUnboxedDouble) { 5154 if (representation() == kUnboxedDouble) {
5073 if (index() == 0) { 5155 if (index() == 0) {
5074 summary->set_in(0, Location::Pair(Location::RequiresFpuRegister(), 5156 summary->set_in(0, Location::Pair(Location::RequiresFpuRegister(),
5075 Location::Any())); 5157 Location::Any()));
5076 } else { 5158 } else {
5077 ASSERT(index() == 1); 5159 ASSERT(index() == 1);
5078 summary->set_in(0, Location::Pair(Location::Any(), 5160 summary->set_in(0, Location::Pair(Location::Any(),
5079 Location::RequiresFpuRegister())); 5161 Location::RequiresFpuRegister()));
5080 } 5162 }
5081 summary->set_out(0, Location::RequiresFpuRegister()); 5163 summary->set_out(0, Location::RequiresFpuRegister());
(...skipping 23 matching lines...) Expand all
5105 __ movaps(out, in); 5187 __ movaps(out, in);
5106 } else { 5188 } else {
5107 ASSERT(representation() == kTagged); 5189 ASSERT(representation() == kTagged);
5108 Register out = locs()->out(0).reg(); 5190 Register out = locs()->out(0).reg();
5109 Register in = in_loc.reg(); 5191 Register in = in_loc.reg();
5110 __ movq(out, in); 5192 __ movq(out, in);
5111 } 5193 }
5112 } 5194 }
5113 5195
5114 5196
5115 LocationSummary* MergedMathInstr::MakeLocationSummary(bool opt) const { 5197 LocationSummary* MergedMathInstr::MakeLocationSummary(Isolate* isolate,
5198 bool opt) const {
5116 if (kind() == MergedMathInstr::kTruncDivMod) { 5199 if (kind() == MergedMathInstr::kTruncDivMod) {
5117 const intptr_t kNumInputs = 2; 5200 const intptr_t kNumInputs = 2;
5118 const intptr_t kNumTemps = 0; 5201 const intptr_t kNumTemps = 0;
5119 LocationSummary* summary = 5202 LocationSummary* summary = new(isolate) LocationSummary(
5120 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 5203 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5121 // Both inputs must be writable because they will be untagged. 5204 // Both inputs must be writable because they will be untagged.
5122 summary->set_in(0, Location::RegisterLocation(RAX)); 5205 summary->set_in(0, Location::RegisterLocation(RAX));
5123 summary->set_in(1, Location::WritableRegister()); 5206 summary->set_in(1, Location::WritableRegister());
5124 summary->set_out(0, Location::Pair(Location::RegisterLocation(RAX), 5207 summary->set_out(0, Location::Pair(Location::RegisterLocation(RAX),
5125 Location::RegisterLocation(RDX))); 5208 Location::RegisterLocation(RDX)));
5126 return summary; 5209 return summary;
5127 } 5210 }
5128 if (kind() == MergedMathInstr::kSinCos) { 5211 if (kind() == MergedMathInstr::kSinCos) {
5129 const intptr_t kNumInputs = 1; 5212 const intptr_t kNumInputs = 1;
5130 const intptr_t kNumTemps = 1; 5213 const intptr_t kNumTemps = 1;
5131 LocationSummary* summary = 5214 LocationSummary* summary = new(isolate) LocationSummary(
5132 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 5215 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
5133 // Because we always call into the runtime (LocationSummary::kCall) we 5216 // Because we always call into the runtime (LocationSummary::kCall) we
5134 // must specify each input, temp, and output register explicitly. 5217 // must specify each input, temp, and output register explicitly.
5135 summary->set_in(0, Location::FpuRegisterLocation(XMM1)); 5218 summary->set_in(0, Location::FpuRegisterLocation(XMM1));
5136 // R13 is chosen because it is callee saved so we do not need to back it 5219 // R13 is chosen because it is callee saved so we do not need to back it
5137 // up before calling into the runtime. 5220 // up before calling into the runtime.
5138 summary->set_temp(0, Location::RegisterLocation(R13)); 5221 summary->set_temp(0, Location::RegisterLocation(R13));
5139 summary->set_out(0, Location::Pair(Location::FpuRegisterLocation(XMM2), 5222 summary->set_out(0, Location::Pair(Location::FpuRegisterLocation(XMM2),
5140 Location::FpuRegisterLocation(XMM3))); 5223 Location::FpuRegisterLocation(XMM3)));
5141 return summary; 5224 return summary;
5142 } 5225 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
5280 // Restore RSP. 5363 // Restore RSP.
5281 __ movq(RSP, locs()->temp(0).reg()); 5364 __ movq(RSP, locs()->temp(0).reg());
5282 5365
5283 return; 5366 return;
5284 } 5367 }
5285 UNIMPLEMENTED(); 5368 UNIMPLEMENTED();
5286 } 5369 }
5287 5370
5288 5371
5289 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary( 5372 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary(
5290 bool opt) const { 5373 Isolate* isolate, bool opt) const {
5291 return MakeCallSummary(); 5374 return MakeCallSummary();
5292 } 5375 }
5293 5376
5294 5377
5295 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5378 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5296 Label* deopt = compiler->AddDeoptStub( 5379 Label* deopt = compiler->AddDeoptStub(
5297 deopt_id(), ICData::kDeoptPolymorphicInstanceCallTestFail); 5380 deopt_id(), ICData::kDeoptPolymorphicInstanceCallTestFail);
5298 if (ic_data().NumberOfChecks() == 0) { 5381 if (ic_data().NumberOfChecks() == 0) {
5299 __ jmp(deopt); 5382 __ jmp(deopt);
5300 return; 5383 return;
(...skipping 20 matching lines...) Expand all
5321 RDI, // Class id register. 5404 RDI, // Class id register.
5322 instance_call()->ArgumentCount(), 5405 instance_call()->ArgumentCount(),
5323 instance_call()->argument_names(), 5406 instance_call()->argument_names(),
5324 deopt, 5407 deopt,
5325 deopt_id(), 5408 deopt_id(),
5326 instance_call()->token_pos(), 5409 instance_call()->token_pos(),
5327 locs()); 5410 locs());
5328 } 5411 }
5329 5412
5330 5413
5331 LocationSummary* BranchInstr::MakeLocationSummary(bool opt) const { 5414 LocationSummary* BranchInstr::MakeLocationSummary(Isolate* isolate,
5332 comparison()->InitializeLocationSummary(opt); 5415 bool opt) const {
5416 comparison()->InitializeLocationSummary(isolate, opt);
5333 // Branches don't produce a result. 5417 // Branches don't produce a result.
5334 comparison()->locs()->set_out(0, Location::NoLocation()); 5418 comparison()->locs()->set_out(0, Location::NoLocation());
5335 return comparison()->locs(); 5419 return comparison()->locs();
5336 } 5420 }
5337 5421
5338 5422
5339 void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5423 void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5340 comparison()->EmitBranchCode(compiler, this); 5424 comparison()->EmitBranchCode(compiler, this);
5341 } 5425 }
5342 5426
5343 5427
5344 LocationSummary* CheckClassInstr::MakeLocationSummary(bool opt) const { 5428 LocationSummary* CheckClassInstr::MakeLocationSummary(Isolate* isolate,
5429 bool opt) const {
5345 const intptr_t kNumInputs = 1; 5430 const intptr_t kNumInputs = 1;
5346 const intptr_t kNumTemps = 0; 5431 const intptr_t kNumTemps = 0;
5347 LocationSummary* summary = 5432 LocationSummary* summary = new(isolate) LocationSummary(
5348 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 5433 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5349 summary->set_in(0, Location::RequiresRegister()); 5434 summary->set_in(0, Location::RequiresRegister());
5350 if (!IsNullCheck()) { 5435 if (!IsNullCheck()) {
5351 summary->AddTemp(Location::RequiresRegister()); 5436 summary->AddTemp(Location::RequiresRegister());
5352 } 5437 }
5353 return summary; 5438 return summary;
5354 } 5439 }
5355 5440
5356 5441
5357 void CheckClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5442 void CheckClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5358 const ICData::DeoptReasonId deopt_reason = licm_hoisted_ ? 5443 const ICData::DeoptReasonId deopt_reason = licm_hoisted_ ?
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
5393 __ j(EQUAL, &is_ok, Assembler::kNearJump); 5478 __ j(EQUAL, &is_ok, Assembler::kNearJump);
5394 } else { 5479 } else {
5395 __ j(EQUAL, &is_ok); 5480 __ j(EQUAL, &is_ok);
5396 } 5481 }
5397 } 5482 }
5398 } 5483 }
5399 __ Bind(&is_ok); 5484 __ Bind(&is_ok);
5400 } 5485 }
5401 5486
5402 5487
5403 LocationSummary* CheckSmiInstr::MakeLocationSummary(bool opt) const { 5488 LocationSummary* CheckSmiInstr::MakeLocationSummary(Isolate* isolate,
5489 bool opt) const {
5404 const intptr_t kNumInputs = 1; 5490 const intptr_t kNumInputs = 1;
5405 const intptr_t kNumTemps = 0; 5491 const intptr_t kNumTemps = 0;
5406 LocationSummary* summary = 5492 LocationSummary* summary = new(isolate) LocationSummary(
5407 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 5493 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5408 summary->set_in(0, Location::RequiresRegister()); 5494 summary->set_in(0, Location::RequiresRegister());
5409 return summary; 5495 return summary;
5410 } 5496 }
5411 5497
5412 5498
5413 void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5499 void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5414 Register value = locs()->in(0).reg(); 5500 Register value = locs()->in(0).reg();
5415 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckSmi); 5501 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckSmi);
5416 __ testq(value, Immediate(kSmiTagMask)); 5502 __ testq(value, Immediate(kSmiTagMask));
5417 __ j(NOT_ZERO, deopt); 5503 __ j(NOT_ZERO, deopt);
5418 } 5504 }
5419 5505
5420 5506
5421 LocationSummary* CheckArrayBoundInstr::MakeLocationSummary(bool opt) const { 5507 LocationSummary* CheckArrayBoundInstr::MakeLocationSummary(Isolate* isolate,
5508 bool opt) const {
5422 const intptr_t kNumInputs = 2; 5509 const intptr_t kNumInputs = 2;
5423 const intptr_t kNumTemps = 0; 5510 const intptr_t kNumTemps = 0;
5424 LocationSummary* locs = 5511 LocationSummary* locs = new(isolate) LocationSummary(
5425 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 5512 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5426 locs->set_in(kLengthPos, Location::RegisterOrSmiConstant(length())); 5513 locs->set_in(kLengthPos, Location::RegisterOrSmiConstant(length()));
5427 locs->set_in(kIndexPos, Location::RegisterOrSmiConstant(index())); 5514 locs->set_in(kIndexPos, Location::RegisterOrSmiConstant(index()));
5428 return locs; 5515 return locs;
5429 } 5516 }
5430 5517
5431 5518
5432 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5519 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5433 Label* deopt = compiler->AddDeoptStub(deopt_id(), 5520 Label* deopt = compiler->AddDeoptStub(deopt_id(),
5434 ICData::kDeoptCheckArrayBound); 5521 ICData::kDeoptCheckArrayBound);
5435 5522
(...skipping 24 matching lines...) Expand all
5460 __ j(ABOVE_EQUAL, deopt); 5547 __ j(ABOVE_EQUAL, deopt);
5461 } else { 5548 } else {
5462 Register length = length_loc.reg(); 5549 Register length = length_loc.reg();
5463 Register index = index_loc.reg(); 5550 Register index = index_loc.reg();
5464 __ cmpq(index, length); 5551 __ cmpq(index, length);
5465 __ j(ABOVE_EQUAL, deopt); 5552 __ j(ABOVE_EQUAL, deopt);
5466 } 5553 }
5467 } 5554 }
5468 5555
5469 5556
5470 LocationSummary* UnboxIntegerInstr::MakeLocationSummary(bool opt) const { 5557 LocationSummary* UnboxIntegerInstr::MakeLocationSummary(Isolate* isolate,
5558 bool opt) const {
5471 UNIMPLEMENTED(); 5559 UNIMPLEMENTED();
5472 return NULL; 5560 return NULL;
5473 } 5561 }
5474 5562
5475 5563
5476 void UnboxIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5564 void UnboxIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5477 UNIMPLEMENTED(); 5565 UNIMPLEMENTED();
5478 } 5566 }
5479 5567
5480 5568
5481 LocationSummary* BoxIntegerInstr::MakeLocationSummary(bool opt) const { 5569 LocationSummary* BoxIntegerInstr::MakeLocationSummary(Isolate* isolate,
5570 bool opt) const {
5482 UNIMPLEMENTED(); 5571 UNIMPLEMENTED();
5483 return NULL; 5572 return NULL;
5484 } 5573 }
5485 5574
5486 5575
5487 void BoxIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5576 void BoxIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5488 UNIMPLEMENTED(); 5577 UNIMPLEMENTED();
5489 } 5578 }
5490 5579
5491 5580
5492 LocationSummary* BinaryMintOpInstr::MakeLocationSummary(bool opt) const { 5581 LocationSummary* BinaryMintOpInstr::MakeLocationSummary(Isolate* isolate,
5582 bool opt) const {
5493 UNIMPLEMENTED(); 5583 UNIMPLEMENTED();
5494 return NULL; 5584 return NULL;
5495 } 5585 }
5496 5586
5497 5587
5498 void BinaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5588 void BinaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5499 UNIMPLEMENTED(); 5589 UNIMPLEMENTED();
5500 } 5590 }
5501 5591
5502 5592
5503 LocationSummary* UnaryMintOpInstr::MakeLocationSummary(bool opt) const { 5593 LocationSummary* UnaryMintOpInstr::MakeLocationSummary(Isolate* isolate,
5594 bool opt) const {
5504 UNIMPLEMENTED(); 5595 UNIMPLEMENTED();
5505 return NULL; 5596 return NULL;
5506 } 5597 }
5507 5598
5508 5599
5509 void UnaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5600 void UnaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5510 UNIMPLEMENTED(); 5601 UNIMPLEMENTED();
5511 } 5602 }
5512 5603
5513 5604
5514 LocationSummary* ShiftMintOpInstr::MakeLocationSummary(bool opt) const { 5605 LocationSummary* ShiftMintOpInstr::MakeLocationSummary(Isolate* isolate,
5606 bool opt) const {
5515 UNIMPLEMENTED(); 5607 UNIMPLEMENTED();
5516 return NULL; 5608 return NULL;
5517 } 5609 }
5518 5610
5519 5611
5520 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5612 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5521 UNIMPLEMENTED(); 5613 UNIMPLEMENTED();
5522 } 5614 }
5523 5615
5524 5616
5525 LocationSummary* ThrowInstr::MakeLocationSummary(bool opt) const { 5617 LocationSummary* ThrowInstr::MakeLocationSummary(Isolate* isolate,
5526 return new LocationSummary(0, 0, LocationSummary::kCall); 5618 bool opt) const {
5619 return new(isolate) LocationSummary(isolate, 0, 0, LocationSummary::kCall);
5527 } 5620 }
5528 5621
5529 5622
5530 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5623 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5531 compiler->GenerateRuntimeCall(token_pos(), 5624 compiler->GenerateRuntimeCall(token_pos(),
5532 deopt_id(), 5625 deopt_id(),
5533 kThrowRuntimeEntry, 5626 kThrowRuntimeEntry,
5534 1, 5627 1,
5535 locs()); 5628 locs());
5536 __ int3(); 5629 __ int3();
5537 } 5630 }
5538 5631
5539 5632
5540 LocationSummary* ReThrowInstr::MakeLocationSummary(bool opt) const { 5633 LocationSummary* ReThrowInstr::MakeLocationSummary(Isolate* isolate,
5541 return new LocationSummary(0, 0, LocationSummary::kCall); 5634 bool opt) const {
5635 return new(isolate) LocationSummary(isolate, 0, 0, LocationSummary::kCall);
5542 } 5636 }
5543 5637
5544 5638
5545 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5639 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5546 compiler->SetNeedsStacktrace(catch_try_index()); 5640 compiler->SetNeedsStacktrace(catch_try_index());
5547 compiler->GenerateRuntimeCall(token_pos(), 5641 compiler->GenerateRuntimeCall(token_pos(),
5548 deopt_id(), 5642 deopt_id(),
5549 kReThrowRuntimeEntry, 5643 kReThrowRuntimeEntry,
5550 2, 5644 2,
5551 locs()); 5645 locs());
(...skipping 18 matching lines...) Expand all
5570 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, 5664 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
5571 deopt_id_, 5665 deopt_id_,
5572 Scanner::kNoSourcePos); 5666 Scanner::kNoSourcePos);
5573 } 5667 }
5574 if (HasParallelMove()) { 5668 if (HasParallelMove()) {
5575 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 5669 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
5576 } 5670 }
5577 } 5671 }
5578 5672
5579 5673
5580 LocationSummary* GotoInstr::MakeLocationSummary(bool opt) const { 5674 LocationSummary* GotoInstr::MakeLocationSummary(Isolate* isolate,
5581 return new LocationSummary(0, 0, LocationSummary::kNoCall); 5675 bool opt) const {
5676 return new(isolate) LocationSummary(isolate, 0, 0, LocationSummary::kNoCall);
5582 } 5677 }
5583 5678
5584 5679
5585 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5680 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5586 if (!compiler->is_optimizing()) { 5681 if (!compiler->is_optimizing()) {
5587 compiler->EmitEdgeCounter(); 5682 compiler->EmitEdgeCounter();
5588 // Add a deoptimization descriptor for deoptimizing instructions that 5683 // Add a deoptimization descriptor for deoptimizing instructions that
5589 // may be inserted before this instruction. This descriptor points 5684 // may be inserted before this instruction. This descriptor points
5590 // after the edge counter for uniformity with ARM and MIPS, where we can 5685 // after the edge counter for uniformity with ARM and MIPS, where we can
5591 // reuse pattern matching that matches backwards from the end of the 5686 // reuse pattern matching that matches backwards from the end of the
5592 // pattern. 5687 // pattern.
5593 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, 5688 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
5594 GetDeoptId(), 5689 GetDeoptId(),
5595 Scanner::kNoSourcePos); 5690 Scanner::kNoSourcePos);
5596 } 5691 }
5597 if (HasParallelMove()) { 5692 if (HasParallelMove()) {
5598 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 5693 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
5599 } 5694 }
5600 5695
5601 // We can fall through if the successor is the next block in the list. 5696 // We can fall through if the successor is the next block in the list.
5602 // Otherwise, we need a jump. 5697 // Otherwise, we need a jump.
5603 if (!compiler->CanFallThroughTo(successor())) { 5698 if (!compiler->CanFallThroughTo(successor())) {
5604 __ jmp(compiler->GetJumpLabel(successor())); 5699 __ jmp(compiler->GetJumpLabel(successor()));
5605 } 5700 }
5606 } 5701 }
5607 5702
5608 5703
5609 LocationSummary* CurrentContextInstr::MakeLocationSummary(bool opt) const { 5704 LocationSummary* CurrentContextInstr::MakeLocationSummary(Isolate* isolate,
5705 bool opt) const {
5610 return LocationSummary::Make(0, 5706 return LocationSummary::Make(0,
5611 Location::RequiresRegister(), 5707 Location::RequiresRegister(),
5612 LocationSummary::kNoCall); 5708 LocationSummary::kNoCall);
5613 } 5709 }
5614 5710
5615 5711
5616 void CurrentContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5712 void CurrentContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5617 __ MoveRegister(locs()->out(0).reg(), CTX); 5713 __ MoveRegister(locs()->out(0).reg(), CTX);
5618 } 5714 }
5619 5715
5620 5716
5621 LocationSummary* StrictCompareInstr::MakeLocationSummary(bool opt) const { 5717 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate,
5718 bool opt) const {
5622 const intptr_t kNumInputs = 2; 5719 const intptr_t kNumInputs = 2;
5623 const intptr_t kNumTemps = 0; 5720 const intptr_t kNumTemps = 0;
5624 if (needs_number_check()) { 5721 if (needs_number_check()) {
5625 LocationSummary* locs = 5722 LocationSummary* locs = new(isolate) LocationSummary(
5626 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 5723 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
5627 locs->set_in(0, Location::RegisterLocation(RAX)); 5724 locs->set_in(0, Location::RegisterLocation(RAX));
5628 locs->set_in(1, Location::RegisterLocation(RCX)); 5725 locs->set_in(1, Location::RegisterLocation(RCX));
5629 locs->set_out(0, Location::RegisterLocation(RAX)); 5726 locs->set_out(0, Location::RegisterLocation(RAX));
5630 return locs; 5727 return locs;
5631 } 5728 }
5632 LocationSummary* locs = 5729 LocationSummary* locs = new(isolate) LocationSummary(
5633 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 5730 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5634 locs->set_in(0, Location::RegisterOrConstant(left())); 5731 locs->set_in(0, Location::RegisterOrConstant(left()));
5635 // Only one of the inputs can be a constant. Choose register if the first one 5732 // Only one of the inputs can be a constant. Choose register if the first one
5636 // is a constant. 5733 // is a constant.
5637 locs->set_in(1, locs->in(0).IsConstant() 5734 locs->set_in(1, locs->in(0).IsConstant()
5638 ? Location::RequiresRegister() 5735 ? Location::RequiresRegister()
5639 : Location::RegisterOrConstant(right())); 5736 : Location::RegisterOrConstant(right()));
5640 locs->set_out(0, Location::RequiresRegister()); 5737 locs->set_out(0, Location::RequiresRegister());
5641 return locs; 5738 return locs;
5642 } 5739 }
5643 5740
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
5692 void StrictCompareInstr::EmitBranchCode(FlowGraphCompiler* compiler, 5789 void StrictCompareInstr::EmitBranchCode(FlowGraphCompiler* compiler,
5693 BranchInstr* branch) { 5790 BranchInstr* branch) {
5694 ASSERT(kind() == Token::kEQ_STRICT || kind() == Token::kNE_STRICT); 5791 ASSERT(kind() == Token::kEQ_STRICT || kind() == Token::kNE_STRICT);
5695 5792
5696 BranchLabels labels = compiler->CreateBranchLabels(branch); 5793 BranchLabels labels = compiler->CreateBranchLabels(branch);
5697 Condition true_condition = EmitComparisonCode(compiler, labels); 5794 Condition true_condition = EmitComparisonCode(compiler, labels);
5698 EmitBranchOnCondition(compiler, true_condition, labels); 5795 EmitBranchOnCondition(compiler, true_condition, labels);
5699 } 5796 }
5700 5797
5701 5798
5702 LocationSummary* ClosureCallInstr::MakeLocationSummary(bool opt) const { 5799 LocationSummary* ClosureCallInstr::MakeLocationSummary(Isolate* isolate,
5800 bool opt) const {
5703 const intptr_t kNumInputs = 1; 5801 const intptr_t kNumInputs = 1;
5704 const intptr_t kNumTemps = 0; 5802 const intptr_t kNumTemps = 0;
5705 LocationSummary* summary = 5803 LocationSummary* summary = new(isolate) LocationSummary(
5706 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 5804 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
5707 summary->set_in(0, Location::RegisterLocation(RAX)); // Function. 5805 summary->set_in(0, Location::RegisterLocation(RAX)); // Function.
5708 summary->set_out(0, Location::RegisterLocation(RAX)); 5806 summary->set_out(0, Location::RegisterLocation(RAX));
5709 return summary; 5807 return summary;
5710 } 5808 }
5711 5809
5712 5810
5713 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5811 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5714 // Arguments descriptor is expected in R10. 5812 // Arguments descriptor is expected in R10.
5715 intptr_t argument_count = ArgumentCount(); 5813 intptr_t argument_count = ArgumentCount();
5716 const Array& arguments_descriptor = 5814 const Array& arguments_descriptor =
(...skipping 25 matching lines...) Expand all
5742 // Add deoptimization continuation point after the call and before the 5840 // Add deoptimization continuation point after the call and before the
5743 // arguments are removed. 5841 // arguments are removed.
5744 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, 5842 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
5745 deopt_id_after, 5843 deopt_id_after,
5746 token_pos()); 5844 token_pos());
5747 } 5845 }
5748 __ Drop(argument_count); 5846 __ Drop(argument_count);
5749 } 5847 }
5750 5848
5751 5849
5752 LocationSummary* BooleanNegateInstr::MakeLocationSummary(bool opt) const { 5850 LocationSummary* BooleanNegateInstr::MakeLocationSummary(Isolate* isolate,
5851 bool opt) const {
5753 return LocationSummary::Make(1, 5852 return LocationSummary::Make(1,
5754 Location::RequiresRegister(), 5853 Location::RequiresRegister(),
5755 LocationSummary::kNoCall); 5854 LocationSummary::kNoCall);
5756 } 5855 }
5757 5856
5758 5857
5759 void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5858 void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5760 Register value = locs()->in(0).reg(); 5859 Register value = locs()->in(0).reg();
5761 Register result = locs()->out(0).reg(); 5860 Register result = locs()->out(0).reg();
5762 5861
5763 Label done; 5862 Label done;
5764 __ LoadObject(result, Bool::True(), PP); 5863 __ LoadObject(result, Bool::True(), PP);
5765 __ CompareRegisters(result, value); 5864 __ CompareRegisters(result, value);
5766 __ j(NOT_EQUAL, &done, Assembler::kNearJump); 5865 __ j(NOT_EQUAL, &done, Assembler::kNearJump);
5767 __ LoadObject(result, Bool::False(), PP); 5866 __ LoadObject(result, Bool::False(), PP);
5768 __ Bind(&done); 5867 __ Bind(&done);
5769 } 5868 }
5770 5869
5771 5870
5772 LocationSummary* AllocateObjectInstr::MakeLocationSummary(bool opt) const { 5871 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Isolate* isolate,
5872 bool opt) const {
5773 return MakeCallSummary(); 5873 return MakeCallSummary();
5774 } 5874 }
5775 5875
5776 5876
5777 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5877 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5778 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls())); 5878 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls()));
5779 const ExternalLabel label(cls().ToCString(), stub.EntryPoint()); 5879 const ExternalLabel label(cls().ToCString(), stub.EntryPoint());
5780 compiler->GenerateCall(token_pos(), 5880 compiler->GenerateCall(token_pos(),
5781 &label, 5881 &label,
5782 PcDescriptors::kOther, 5882 PcDescriptors::kOther,
5783 locs()); 5883 locs());
5784 __ Drop(ArgumentCount()); // Discard arguments. 5884 __ Drop(ArgumentCount()); // Discard arguments.
5785 } 5885 }
5786 5886
5787 } // namespace dart 5887 } // namespace dart
5788 5888
5789 #undef __ 5889 #undef __
5790 5890
5791 #endif // defined TARGET_ARCH_X64 5891 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698