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

Side by Side Diff: runtime/vm/intermediate_language_arm64.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
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"
11 #include "vm/flow_graph_compiler.h" 11 #include "vm/flow_graph_compiler.h"
12 #include "vm/locations.h" 12 #include "vm/locations.h"
13 #include "vm/object_store.h" 13 #include "vm/object_store.h"
14 #include "vm/parser.h" 14 #include "vm/parser.h"
15 #include "vm/simulator.h" 15 #include "vm/simulator.h"
16 #include "vm/stack_frame.h" 16 #include "vm/stack_frame.h"
17 #include "vm/stub_code.h" 17 #include "vm/stub_code.h"
18 #include "vm/symbols.h" 18 #include "vm/symbols.h"
19 19
20 #define __ compiler->assembler()-> 20 #define __ compiler->assembler()->
21 21
22 namespace dart { 22 namespace dart {
23 23
24 DECLARE_FLAG(int, optimization_counter_threshold); 24 DECLARE_FLAG(int, optimization_counter_threshold);
25 DECLARE_FLAG(bool, use_osr); 25 DECLARE_FLAG(bool, use_osr);
26 26
27 // Generic summary for call instructions that have all arguments pushed 27 // Generic summary for call instructions that have all arguments pushed
28 // on the stack and return the result in a fixed register R0. 28 // on the stack and return the result in a fixed register R0.
29 LocationSummary* Instruction::MakeCallSummary() { 29 LocationSummary* Instruction::MakeCallSummary() {
30 LocationSummary* result = new LocationSummary(0, 0, LocationSummary::kCall); 30 Isolate* isolate = Isolate::Current();
31 LocationSummary* result = new(isolate) LocationSummary(
32 isolate, 0, 0, LocationSummary::kCall);
31 result->set_out(0, Location::RegisterLocation(R0)); 33 result->set_out(0, Location::RegisterLocation(R0));
32 return result; 34 return result;
33 } 35 }
34 36
35 37
36 LocationSummary* PushArgumentInstr::MakeLocationSummary(bool opt) const { 38 LocationSummary* PushArgumentInstr::MakeLocationSummary(Isolate* isolate,
39 bool opt) const {
37 const intptr_t kNumInputs = 1; 40 const intptr_t kNumInputs = 1;
38 const intptr_t kNumTemps= 0; 41 const intptr_t kNumTemps= 0;
39 LocationSummary* locs = 42 LocationSummary* locs = new(isolate) LocationSummary(
40 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 43 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
41 locs->set_in(0, Location::AnyOrConstant(value())); 44 locs->set_in(0, Location::AnyOrConstant(value()));
42 return locs; 45 return locs;
43 } 46 }
44 47
45 48
46 void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 49 void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
47 // 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
48 // where PushArgument is handled by BindInstr::EmitNativeCode. 51 // where PushArgument is handled by BindInstr::EmitNativeCode.
49 if (compiler->is_optimizing()) { 52 if (compiler->is_optimizing()) {
50 Location value = locs()->in(0); 53 Location value = locs()->in(0);
51 if (value.IsRegister()) { 54 if (value.IsRegister()) {
52 __ Push(value.reg()); 55 __ Push(value.reg());
53 } else if (value.IsConstant()) { 56 } else if (value.IsConstant()) {
54 __ PushObject(value.constant(), PP); 57 __ PushObject(value.constant(), PP);
55 } else { 58 } else {
56 ASSERT(value.IsStackSlot()); 59 ASSERT(value.IsStackSlot());
57 const intptr_t value_offset = value.ToStackSlotOffset(); 60 const intptr_t value_offset = value.ToStackSlotOffset();
58 __ LoadFromOffset(TMP, FP, value_offset, PP); 61 __ LoadFromOffset(TMP, FP, value_offset, PP);
59 __ Push(TMP); 62 __ Push(TMP);
60 } 63 }
61 } 64 }
62 } 65 }
63 66
64 67
65 LocationSummary* ReturnInstr::MakeLocationSummary(bool opt) const { 68 LocationSummary* ReturnInstr::MakeLocationSummary(Isolate* isolate,
69 bool opt) const {
66 const intptr_t kNumInputs = 1; 70 const intptr_t kNumInputs = 1;
67 const intptr_t kNumTemps = 0; 71 const intptr_t kNumTemps = 0;
68 LocationSummary* locs = 72 LocationSummary* locs = new(isolate) LocationSummary(
69 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 73 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
70 locs->set_in(0, Location::RegisterLocation(R0)); 74 locs->set_in(0, Location::RegisterLocation(R0));
71 return locs; 75 return locs;
72 } 76 }
73 77
74 78
75 // Attempt optimized compilation at return instruction instead of at the entry. 79 // Attempt optimized compilation at return instruction instead of at the entry.
76 // The entry needs to be patchable, no inlined objects are allowed in the area 80 // The entry needs to be patchable, no inlined objects are allowed in the area
77 // that will be overwritten by the patch instructions: a branch macro sequence. 81 // that will be overwritten by the patch instructions: a branch macro sequence.
78 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 82 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
79 const Register result = locs()->in(0).reg(); 83 const Register result = locs()->in(0).reg();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 120 }
117 121
118 122
119 // Detect pattern when one value is zero and another is a power of 2. 123 // Detect pattern when one value is zero and another is a power of 2.
120 static bool IsPowerOfTwoKind(intptr_t v1, intptr_t v2) { 124 static bool IsPowerOfTwoKind(intptr_t v1, intptr_t v2) {
121 return (Utils::IsPowerOfTwo(v1) && (v2 == 0)) || 125 return (Utils::IsPowerOfTwo(v1) && (v2 == 0)) ||
122 (Utils::IsPowerOfTwo(v2) && (v1 == 0)); 126 (Utils::IsPowerOfTwo(v2) && (v1 == 0));
123 } 127 }
124 128
125 129
126 LocationSummary* IfThenElseInstr::MakeLocationSummary(bool opt) const { 130 LocationSummary* IfThenElseInstr::MakeLocationSummary(Isolate* isolate,
127 comparison()->InitializeLocationSummary(opt); 131 bool opt) const {
132 comparison()->InitializeLocationSummary(isolate, opt);
128 return comparison()->locs(); 133 return comparison()->locs();
129 } 134 }
130 135
131 136
132 void IfThenElseInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 137 void IfThenElseInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
133 const Register result = locs()->out(0).reg(); 138 const Register result = locs()->out(0).reg();
134 139
135 Location left = locs()->in(0); 140 Location left = locs()->in(0);
136 Location right = locs()->in(1); 141 Location right = locs()->in(1);
137 ASSERT(!left.IsConstant() || !right.IsConstant()); 142 ASSERT(!left.IsConstant() || !right.IsConstant());
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 const int64_t val = 177 const int64_t val =
173 Smi::RawValue(true_value) - Smi::RawValue(false_value); 178 Smi::RawValue(true_value) - Smi::RawValue(false_value);
174 __ AndImmediate(result, result, val, PP); 179 __ AndImmediate(result, result, val, PP);
175 if (false_value != 0) { 180 if (false_value != 0) {
176 __ AddImmediate(result, result, Smi::RawValue(false_value), PP); 181 __ AddImmediate(result, result, Smi::RawValue(false_value), PP);
177 } 182 }
178 } 183 }
179 } 184 }
180 185
181 186
182 LocationSummary* ClosureCallInstr::MakeLocationSummary(bool opt) const { 187 LocationSummary* ClosureCallInstr::MakeLocationSummary(Isolate* isolate,
188 bool opt) const {
183 const intptr_t kNumInputs = 1; 189 const intptr_t kNumInputs = 1;
184 const intptr_t kNumTemps = 0; 190 const intptr_t kNumTemps = 0;
185 LocationSummary* summary = 191 LocationSummary* summary = new(isolate) LocationSummary(
186 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 192 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
187 summary->set_in(0, Location::RegisterLocation(R0)); // Function. 193 summary->set_in(0, Location::RegisterLocation(R0)); // Function.
188 summary->set_out(0, Location::RegisterLocation(R0)); 194 summary->set_out(0, Location::RegisterLocation(R0));
189 return summary; 195 return summary;
190 } 196 }
191 197
192 198
193 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 199 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
194 // Load arguments descriptor in R4. 200 // Load arguments descriptor in R4.
195 int argument_count = ArgumentCount(); 201 int argument_count = ArgumentCount();
196 const Array& arguments_descriptor = 202 const Array& arguments_descriptor =
(...skipping 25 matching lines...) Expand all
222 // Add deoptimization continuation point after the call and before the 228 // Add deoptimization continuation point after the call and before the
223 // arguments are removed. 229 // arguments are removed.
224 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, 230 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
225 deopt_id_after, 231 deopt_id_after,
226 token_pos()); 232 token_pos());
227 } 233 }
228 __ Drop(argument_count); 234 __ Drop(argument_count);
229 } 235 }
230 236
231 237
232 LocationSummary* LoadLocalInstr::MakeLocationSummary(bool opt) const { 238 LocationSummary* LoadLocalInstr::MakeLocationSummary(Isolate* isolate,
239 bool opt) const {
233 return LocationSummary::Make(0, 240 return LocationSummary::Make(0,
234 Location::RequiresRegister(), 241 Location::RequiresRegister(),
235 LocationSummary::kNoCall); 242 LocationSummary::kNoCall);
236 } 243 }
237 244
238 245
239 void LoadLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 246 void LoadLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
240 const Register result = locs()->out(0).reg(); 247 const Register result = locs()->out(0).reg();
241 __ LoadFromOffset(result, FP, local().index() * kWordSize, PP); 248 __ LoadFromOffset(result, FP, local().index() * kWordSize, PP);
242 } 249 }
243 250
244 251
245 LocationSummary* StoreLocalInstr::MakeLocationSummary(bool opt) const { 252 LocationSummary* StoreLocalInstr::MakeLocationSummary(Isolate* isolate,
253 bool opt) const {
246 return LocationSummary::Make(1, 254 return LocationSummary::Make(1,
247 Location::SameAsFirstInput(), 255 Location::SameAsFirstInput(),
248 LocationSummary::kNoCall); 256 LocationSummary::kNoCall);
249 } 257 }
250 258
251 259
252 void StoreLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 260 void StoreLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
253 const Register value = locs()->in(0).reg(); 261 const Register value = locs()->in(0).reg();
254 const Register result = locs()->out(0).reg(); 262 const Register result = locs()->out(0).reg();
255 ASSERT(result == value); // Assert that register assignment is correct. 263 ASSERT(result == value); // Assert that register assignment is correct.
256 __ StoreToOffset(value, FP, local().index() * kWordSize, PP); 264 __ StoreToOffset(value, FP, local().index() * kWordSize, PP);
257 } 265 }
258 266
259 267
260 LocationSummary* ConstantInstr::MakeLocationSummary(bool opt) const { 268 LocationSummary* ConstantInstr::MakeLocationSummary(Isolate* isolate,
269 bool opt) const {
261 return LocationSummary::Make(0, 270 return LocationSummary::Make(0,
262 Location::RequiresRegister(), 271 Location::RequiresRegister(),
263 LocationSummary::kNoCall); 272 LocationSummary::kNoCall);
264 } 273 }
265 274
266 275
267 void ConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 276 void ConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
268 // The register allocator drops constant definitions that have no uses. 277 // The register allocator drops constant definitions that have no uses.
269 if (!locs()->out(0).IsInvalid()) { 278 if (!locs()->out(0).IsInvalid()) {
270 const Register result = locs()->out(0).reg(); 279 const Register result = locs()->out(0).reg();
271 __ LoadObject(result, value(), PP); 280 __ LoadObject(result, value(), PP);
272 } 281 }
273 } 282 }
274 283
275 284
276 LocationSummary* UnboxedConstantInstr::MakeLocationSummary(bool opt) const { 285 LocationSummary* UnboxedConstantInstr::MakeLocationSummary(Isolate* isolate,
286 bool opt) const {
277 const intptr_t kNumInputs = 0; 287 const intptr_t kNumInputs = 0;
278 return LocationSummary::Make(kNumInputs, 288 return LocationSummary::Make(kNumInputs,
279 Location::RequiresFpuRegister(), 289 Location::RequiresFpuRegister(),
280 LocationSummary::kNoCall); 290 LocationSummary::kNoCall);
281 } 291 }
282 292
283 293
284 void UnboxedConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 294 void UnboxedConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
285 if (!locs()->out(0).IsInvalid()) { 295 if (!locs()->out(0).IsInvalid()) {
286 const VRegister dst = locs()->out(0).fpu_reg(); 296 const VRegister dst = locs()->out(0).fpu_reg();
287 __ LoadDImmediate(dst, Double::Cast(value()).value(), PP); 297 __ LoadDImmediate(dst, Double::Cast(value()).value(), PP);
288 } 298 }
289 } 299 }
290 300
291 301
292 LocationSummary* AssertAssignableInstr::MakeLocationSummary(bool opt) const { 302 LocationSummary* AssertAssignableInstr::MakeLocationSummary(Isolate* isolate,
303 bool opt) const {
293 const intptr_t kNumInputs = 3; 304 const intptr_t kNumInputs = 3;
294 const intptr_t kNumTemps = 0; 305 const intptr_t kNumTemps = 0;
295 LocationSummary* summary = 306 LocationSummary* summary = new(isolate) LocationSummary(
296 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 307 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
297 summary->set_in(0, Location::RegisterLocation(R0)); // Value. 308 summary->set_in(0, Location::RegisterLocation(R0)); // Value.
298 summary->set_in(1, Location::RegisterLocation(R2)); // Instantiator. 309 summary->set_in(1, Location::RegisterLocation(R2)); // Instantiator.
299 summary->set_in(2, Location::RegisterLocation(R1)); // Type arguments. 310 summary->set_in(2, Location::RegisterLocation(R1)); // Type arguments.
300 summary->set_out(0, Location::RegisterLocation(R0)); 311 summary->set_out(0, Location::RegisterLocation(R0));
301 return summary; 312 return summary;
302 } 313 }
303 314
304 315
305 LocationSummary* AssertBooleanInstr::MakeLocationSummary(bool opt) const { 316 LocationSummary* AssertBooleanInstr::MakeLocationSummary(Isolate* isolate,
317 bool opt) const {
306 const intptr_t kNumInputs = 1; 318 const intptr_t kNumInputs = 1;
307 const intptr_t kNumTemps = 0; 319 const intptr_t kNumTemps = 0;
308 LocationSummary* locs = 320 LocationSummary* locs = new(isolate) LocationSummary(
309 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 321 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
310 locs->set_in(0, Location::RegisterLocation(R0)); 322 locs->set_in(0, Location::RegisterLocation(R0));
311 locs->set_out(0, Location::RegisterLocation(R0)); 323 locs->set_out(0, Location::RegisterLocation(R0));
312 return locs; 324 return locs;
313 } 325 }
314 326
315 327
316 static void EmitAssertBoolean(Register reg, 328 static void EmitAssertBoolean(Register reg,
317 intptr_t token_pos, 329 intptr_t token_pos,
318 intptr_t deopt_id, 330 intptr_t deopt_id,
319 LocationSummary* locs, 331 LocationSummary* locs,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 true_condition = FlipCondition(true_condition); 427 true_condition = FlipCondition(true_condition);
416 } else if (right.IsConstant()) { 428 } else if (right.IsConstant()) {
417 __ CompareObject(left.reg(), right.constant(), PP); 429 __ CompareObject(left.reg(), right.constant(), PP);
418 } else { 430 } else {
419 __ CompareRegisters(left.reg(), right.reg()); 431 __ CompareRegisters(left.reg(), right.reg());
420 } 432 }
421 return true_condition; 433 return true_condition;
422 } 434 }
423 435
424 436
425 LocationSummary* EqualityCompareInstr::MakeLocationSummary(bool opt) const { 437 LocationSummary* EqualityCompareInstr::MakeLocationSummary(Isolate* isolate,
438 bool opt) const {
426 const intptr_t kNumInputs = 2; 439 const intptr_t kNumInputs = 2;
427 if (operation_cid() == kDoubleCid) { 440 if (operation_cid() == kDoubleCid) {
428 const intptr_t kNumTemps = 0; 441 const intptr_t kNumTemps = 0;
429 LocationSummary* locs = 442 LocationSummary* locs = new(isolate) LocationSummary(
430 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 443 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
431 locs->set_in(0, Location::RequiresFpuRegister()); 444 locs->set_in(0, Location::RequiresFpuRegister());
432 locs->set_in(1, Location::RequiresFpuRegister()); 445 locs->set_in(1, Location::RequiresFpuRegister());
433 locs->set_out(0, Location::RequiresRegister()); 446 locs->set_out(0, Location::RequiresRegister());
434 return locs; 447 return locs;
435 } 448 }
436 if (operation_cid() == kSmiCid) { 449 if (operation_cid() == kSmiCid) {
437 const intptr_t kNumTemps = 0; 450 const intptr_t kNumTemps = 0;
438 LocationSummary* locs = 451 LocationSummary* locs = new(isolate) LocationSummary(
439 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 452 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
440 locs->set_in(0, Location::RegisterOrConstant(left())); 453 locs->set_in(0, Location::RegisterOrConstant(left()));
441 // Only one input can be a constant operand. The case of two constant 454 // Only one input can be a constant operand. The case of two constant
442 // operands should be handled by constant propagation. 455 // operands should be handled by constant propagation.
443 // Only right can be a stack slot. 456 // Only right can be a stack slot.
444 locs->set_in(1, locs->in(0).IsConstant() 457 locs->set_in(1, locs->in(0).IsConstant()
445 ? Location::RequiresRegister() 458 ? Location::RequiresRegister()
446 : Location::RegisterOrConstant(right())); 459 : Location::RegisterOrConstant(right()));
447 locs->set_out(0, Location::RequiresRegister()); 460 locs->set_out(0, Location::RequiresRegister());
448 return locs; 461 return locs;
449 } 462 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 Condition true_condition = EmitComparisonCode(compiler, labels); 534 Condition true_condition = EmitComparisonCode(compiler, labels);
522 if ((operation_cid() == kDoubleCid) && (true_condition != NE)) { 535 if ((operation_cid() == kDoubleCid) && (true_condition != NE)) {
523 // Special case for NaN comparison. Result is always false unless 536 // Special case for NaN comparison. Result is always false unless
524 // relational operator is !=. 537 // relational operator is !=.
525 __ b(labels.false_label, VS); 538 __ b(labels.false_label, VS);
526 } 539 }
527 EmitBranchOnCondition(compiler, true_condition, labels); 540 EmitBranchOnCondition(compiler, true_condition, labels);
528 } 541 }
529 542
530 543
531 LocationSummary* TestSmiInstr::MakeLocationSummary(bool opt) const { 544 LocationSummary* TestSmiInstr::MakeLocationSummary(Isolate* isolate,
545 bool opt) const {
532 const intptr_t kNumInputs = 2; 546 const intptr_t kNumInputs = 2;
533 const intptr_t kNumTemps = 0; 547 const intptr_t kNumTemps = 0;
534 LocationSummary* locs = 548 LocationSummary* locs = new(isolate) LocationSummary(
535 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 549 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
536 locs->set_in(0, Location::RequiresRegister()); 550 locs->set_in(0, Location::RequiresRegister());
537 // Only one input can be a constant operand. The case of two constant 551 // Only one input can be a constant operand. The case of two constant
538 // operands should be handled by constant propagation. 552 // operands should be handled by constant propagation.
539 locs->set_in(1, Location::RegisterOrConstant(right())); 553 locs->set_in(1, Location::RegisterOrConstant(right()));
540 return locs; 554 return locs;
541 } 555 }
542 556
543 557
544 Condition TestSmiInstr::EmitComparisonCode(FlowGraphCompiler* compiler, 558 Condition TestSmiInstr::EmitComparisonCode(FlowGraphCompiler* compiler,
545 BranchLabels labels) { 559 BranchLabels labels) {
(...skipping 19 matching lines...) Expand all
565 579
566 580
567 void TestSmiInstr::EmitBranchCode(FlowGraphCompiler* compiler, 581 void TestSmiInstr::EmitBranchCode(FlowGraphCompiler* compiler,
568 BranchInstr* branch) { 582 BranchInstr* branch) {
569 BranchLabels labels = compiler->CreateBranchLabels(branch); 583 BranchLabels labels = compiler->CreateBranchLabels(branch);
570 Condition true_condition = EmitComparisonCode(compiler, labels); 584 Condition true_condition = EmitComparisonCode(compiler, labels);
571 EmitBranchOnCondition(compiler, true_condition, labels); 585 EmitBranchOnCondition(compiler, true_condition, labels);
572 } 586 }
573 587
574 588
575 LocationSummary* TestCidsInstr::MakeLocationSummary(bool opt) const { 589 LocationSummary* TestCidsInstr::MakeLocationSummary(Isolate* isolate,
590 bool opt) const {
576 const intptr_t kNumInputs = 1; 591 const intptr_t kNumInputs = 1;
577 const intptr_t kNumTemps = 1; 592 const intptr_t kNumTemps = 1;
578 LocationSummary* locs = 593 LocationSummary* locs = new(isolate) LocationSummary(
579 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 594 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
580 locs->set_in(0, Location::RequiresRegister()); 595 locs->set_in(0, Location::RequiresRegister());
581 locs->set_temp(0, Location::RequiresRegister()); 596 locs->set_temp(0, Location::RequiresRegister());
582 locs->set_out(0, Location::RequiresRegister()); 597 locs->set_out(0, Location::RequiresRegister());
583 return locs; 598 return locs;
584 } 599 }
585 600
586 601
587 Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler, 602 Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler,
588 BranchLabels labels) { 603 BranchLabels labels) {
589 ASSERT((kind() == Token::kIS) || (kind() == Token::kISNOT)); 604 ASSERT((kind() == Token::kIS) || (kind() == Token::kISNOT));
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 // True or False into result. 654 // True or False into result.
640 __ Bind(&is_false); 655 __ Bind(&is_false);
641 __ LoadObject(result_reg, Bool::False(), PP); 656 __ LoadObject(result_reg, Bool::False(), PP);
642 __ b(&done); 657 __ b(&done);
643 __ Bind(&is_true); 658 __ Bind(&is_true);
644 __ LoadObject(result_reg, Bool::True(), PP); 659 __ LoadObject(result_reg, Bool::True(), PP);
645 __ Bind(&done); 660 __ Bind(&done);
646 } 661 }
647 662
648 663
649 LocationSummary* RelationalOpInstr::MakeLocationSummary(bool opt) const { 664 LocationSummary* RelationalOpInstr::MakeLocationSummary(Isolate* isolate,
665 bool opt) const {
650 const intptr_t kNumInputs = 2; 666 const intptr_t kNumInputs = 2;
651 const intptr_t kNumTemps = 0; 667 const intptr_t kNumTemps = 0;
652 if (operation_cid() == kDoubleCid) { 668 if (operation_cid() == kDoubleCid) {
653 LocationSummary* summary = 669 LocationSummary* summary = new(isolate) LocationSummary(
654 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 670 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
655 summary->set_in(0, Location::RequiresFpuRegister()); 671 summary->set_in(0, Location::RequiresFpuRegister());
656 summary->set_in(1, Location::RequiresFpuRegister()); 672 summary->set_in(1, Location::RequiresFpuRegister());
657 summary->set_out(0, Location::RequiresRegister()); 673 summary->set_out(0, Location::RequiresRegister());
658 return summary; 674 return summary;
659 } 675 }
660 ASSERT(operation_cid() == kSmiCid); 676 ASSERT(operation_cid() == kSmiCid);
661 LocationSummary* summary = 677 LocationSummary* summary = new(isolate) LocationSummary(
662 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 678 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
663 summary->set_in(0, Location::RegisterOrConstant(left())); 679 summary->set_in(0, Location::RegisterOrConstant(left()));
664 // Only one input can be a constant operand. The case of two constant 680 // Only one input can be a constant operand. The case of two constant
665 // operands should be handled by constant propagation. 681 // operands should be handled by constant propagation.
666 summary->set_in(1, summary->in(0).IsConstant() 682 summary->set_in(1, summary->in(0).IsConstant()
667 ? Location::RequiresRegister() 683 ? Location::RequiresRegister()
668 : Location::RegisterOrConstant(right())); 684 : Location::RegisterOrConstant(right()));
669 summary->set_out(0, Location::RequiresRegister()); 685 summary->set_out(0, Location::RequiresRegister());
670 return summary; 686 return summary;
671 } 687 }
672 688
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 Condition true_condition = EmitComparisonCode(compiler, labels); 727 Condition true_condition = EmitComparisonCode(compiler, labels);
712 if ((operation_cid() == kDoubleCid) && (true_condition != NE)) { 728 if ((operation_cid() == kDoubleCid) && (true_condition != NE)) {
713 // Special case for NaN comparison. Result is always false unless 729 // Special case for NaN comparison. Result is always false unless
714 // relational operator is !=. 730 // relational operator is !=.
715 __ b(labels.false_label, VS); 731 __ b(labels.false_label, VS);
716 } 732 }
717 EmitBranchOnCondition(compiler, true_condition, labels); 733 EmitBranchOnCondition(compiler, true_condition, labels);
718 } 734 }
719 735
720 736
721 LocationSummary* NativeCallInstr::MakeLocationSummary(bool opt) const { 737 LocationSummary* NativeCallInstr::MakeLocationSummary(Isolate* isolate,
738 bool opt) const {
722 const intptr_t kNumInputs = 0; 739 const intptr_t kNumInputs = 0;
723 const intptr_t kNumTemps = 3; 740 const intptr_t kNumTemps = 3;
724 LocationSummary* locs = 741 LocationSummary* locs = new(isolate) LocationSummary(
725 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 742 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
726 locs->set_temp(0, Location::RegisterLocation(R1)); 743 locs->set_temp(0, Location::RegisterLocation(R1));
727 locs->set_temp(1, Location::RegisterLocation(R2)); 744 locs->set_temp(1, Location::RegisterLocation(R2));
728 locs->set_temp(2, Location::RegisterLocation(R5)); 745 locs->set_temp(2, Location::RegisterLocation(R5));
729 locs->set_out(0, Location::RegisterLocation(R0)); 746 locs->set_out(0, Location::RegisterLocation(R0));
730 return locs; 747 return locs;
731 } 748 }
732 749
733 750
734 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 751 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
735 ASSERT(locs()->temp(0).reg() == R1); 752 ASSERT(locs()->temp(0).reg() == R1);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 __ LoadImmediate(R5, entry, PP); 789 __ LoadImmediate(R5, entry, PP);
773 __ LoadImmediate(R1, NativeArguments::ComputeArgcTag(function()), PP); 790 __ LoadImmediate(R1, NativeArguments::ComputeArgcTag(function()), PP);
774 compiler->GenerateCall(token_pos(), 791 compiler->GenerateCall(token_pos(),
775 stub_entry, 792 stub_entry,
776 PcDescriptors::kOther, 793 PcDescriptors::kOther,
777 locs()); 794 locs());
778 __ Pop(result); 795 __ Pop(result);
779 } 796 }
780 797
781 798
782 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(bool opt) const { 799 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(Isolate* isolate,
800 bool opt) const {
783 const intptr_t kNumInputs = 1; 801 const intptr_t kNumInputs = 1;
784 // TODO(fschneider): Allow immediate operands for the char code. 802 // TODO(fschneider): Allow immediate operands for the char code.
785 return LocationSummary::Make(kNumInputs, 803 return LocationSummary::Make(kNumInputs,
786 Location::RequiresRegister(), 804 Location::RequiresRegister(),
787 LocationSummary::kNoCall); 805 LocationSummary::kNoCall);
788 } 806 }
789 807
790 808
791 void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 809 void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
792 const Register char_code = locs()->in(0).reg(); 810 const Register char_code = locs()->in(0).reg();
793 const Register result = locs()->out(0).reg(); 811 const Register result = locs()->out(0).reg();
794 __ LoadImmediate( 812 __ LoadImmediate(
795 result, reinterpret_cast<uword>(Symbols::PredefinedAddress()), PP); 813 result, reinterpret_cast<uword>(Symbols::PredefinedAddress()), PP);
796 __ AddImmediate( 814 __ AddImmediate(
797 result, result, Symbols::kNullCharCodeSymbolOffset * kWordSize, PP); 815 result, result, Symbols::kNullCharCodeSymbolOffset * kWordSize, PP);
798 __ Asr(TMP, char_code, kSmiTagShift); // Untag to use scaled adress mode. 816 __ Asr(TMP, char_code, kSmiTagShift); // Untag to use scaled adress mode.
799 __ ldr(result, Address(result, TMP, UXTX, Address::Scaled)); 817 __ ldr(result, Address(result, TMP, UXTX, Address::Scaled));
800 } 818 }
801 819
802 820
803 LocationSummary* StringToCharCodeInstr::MakeLocationSummary(bool opt) const { 821 LocationSummary* StringToCharCodeInstr::MakeLocationSummary(Isolate* isolate,
822 bool opt) const {
804 const intptr_t kNumInputs = 1; 823 const intptr_t kNumInputs = 1;
805 return LocationSummary::Make(kNumInputs, 824 return LocationSummary::Make(kNumInputs,
806 Location::RequiresRegister(), 825 Location::RequiresRegister(),
807 LocationSummary::kNoCall); 826 LocationSummary::kNoCall);
808 } 827 }
809 828
810 829
811 void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 830 void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
812 ASSERT(cid_ == kOneByteStringCid); 831 ASSERT(cid_ == kOneByteStringCid);
813 const Register str = locs()->in(0).reg(); 832 const Register str = locs()->in(0).reg();
814 const Register result = locs()->out(0).reg(); 833 const Register result = locs()->out(0).reg();
815 __ LoadFieldFromOffset(result, str, String::length_offset(), PP); 834 __ LoadFieldFromOffset(result, str, String::length_offset(), PP);
816 __ ldr(TMP, FieldAddress(str, OneByteString::data_offset()), kUnsignedByte); 835 __ ldr(TMP, FieldAddress(str, OneByteString::data_offset()), kUnsignedByte);
817 __ CompareImmediate(result, Smi::RawValue(1), PP); 836 __ CompareImmediate(result, Smi::RawValue(1), PP);
818 __ LoadImmediate(result, -1, PP); 837 __ LoadImmediate(result, -1, PP);
819 __ csel(result, TMP, result, EQ); 838 __ csel(result, TMP, result, EQ);
820 __ SmiTag(result); 839 __ SmiTag(result);
821 } 840 }
822 841
823 842
824 LocationSummary* StringInterpolateInstr::MakeLocationSummary(bool opt) const { 843 LocationSummary* StringInterpolateInstr::MakeLocationSummary(Isolate* isolate,
844 bool opt) const {
825 const intptr_t kNumInputs = 1; 845 const intptr_t kNumInputs = 1;
826 const intptr_t kNumTemps = 0; 846 const intptr_t kNumTemps = 0;
827 LocationSummary* summary = 847 LocationSummary* summary = new(isolate) LocationSummary(
828 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 848 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
829 summary->set_in(0, Location::RegisterLocation(R0)); 849 summary->set_in(0, Location::RegisterLocation(R0));
830 summary->set_out(0, Location::RegisterLocation(R0)); 850 summary->set_out(0, Location::RegisterLocation(R0));
831 return summary; 851 return summary;
832 } 852 }
833 853
834 854
835 void StringInterpolateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 855 void StringInterpolateInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
836 const Register array = locs()->in(0).reg(); 856 const Register array = locs()->in(0).reg();
837 __ Push(array); 857 __ Push(array);
838 const int kNumberOfArguments = 1; 858 const int kNumberOfArguments = 1;
839 const Array& kNoArgumentNames = Object::null_array(); 859 const Array& kNoArgumentNames = Object::null_array();
840 compiler->GenerateStaticCall(deopt_id(), 860 compiler->GenerateStaticCall(deopt_id(),
841 token_pos(), 861 token_pos(),
842 CallFunction(), 862 CallFunction(),
843 kNumberOfArguments, 863 kNumberOfArguments,
844 kNoArgumentNames, 864 kNoArgumentNames,
845 locs()); 865 locs());
846 ASSERT(locs()->out(0).reg() == R0); 866 ASSERT(locs()->out(0).reg() == R0);
847 } 867 }
848 868
849 869
850 LocationSummary* LoadUntaggedInstr::MakeLocationSummary(bool opt) const { 870 LocationSummary* LoadUntaggedInstr::MakeLocationSummary(Isolate* isolate,
871 bool opt) const {
851 const intptr_t kNumInputs = 1; 872 const intptr_t kNumInputs = 1;
852 return LocationSummary::Make(kNumInputs, 873 return LocationSummary::Make(kNumInputs,
853 Location::RequiresRegister(), 874 Location::RequiresRegister(),
854 LocationSummary::kNoCall); 875 LocationSummary::kNoCall);
855 } 876 }
856 877
857 878
858 void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 879 void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
859 const Register object = locs()->in(0).reg(); 880 const Register object = locs()->in(0).reg();
860 const Register result = locs()->out(0).reg(); 881 const Register result = locs()->out(0).reg();
861 __ LoadFieldFromOffset(result, object, offset(), PP); 882 __ LoadFieldFromOffset(result, object, offset(), PP);
862 } 883 }
863 884
864 885
865 LocationSummary* LoadClassIdInstr::MakeLocationSummary(bool opt) const { 886 LocationSummary* LoadClassIdInstr::MakeLocationSummary(Isolate* isolate,
887 bool opt) const {
866 const intptr_t kNumInputs = 1; 888 const intptr_t kNumInputs = 1;
867 return LocationSummary::Make(kNumInputs, 889 return LocationSummary::Make(kNumInputs,
868 Location::RequiresRegister(), 890 Location::RequiresRegister(),
869 LocationSummary::kNoCall); 891 LocationSummary::kNoCall);
870 } 892 }
871 893
872 894
873 void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 895 void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
874 const Register object = locs()->in(0).reg(); 896 const Register object = locs()->in(0).reg();
875 const Register result = locs()->out(0).reg(); 897 const Register result = locs()->out(0).reg();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 return kUnboxedFloat32x4; 968 return kUnboxedFloat32x4;
947 case kTypedDataFloat64x2ArrayCid: 969 case kTypedDataFloat64x2ArrayCid:
948 return kUnboxedFloat64x2; 970 return kUnboxedFloat64x2;
949 default: 971 default:
950 UNIMPLEMENTED(); 972 UNIMPLEMENTED();
951 return kTagged; 973 return kTagged;
952 } 974 }
953 } 975 }
954 976
955 977
956 LocationSummary* LoadIndexedInstr::MakeLocationSummary(bool opt) const { 978 LocationSummary* LoadIndexedInstr::MakeLocationSummary(Isolate* isolate,
979 bool opt) const {
957 const intptr_t kNumInputs = 2; 980 const intptr_t kNumInputs = 2;
958 const intptr_t kNumTemps = 0; 981 const intptr_t kNumTemps = 0;
959 LocationSummary* locs = 982 LocationSummary* locs = new(isolate) LocationSummary(
960 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 983 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
961 locs->set_in(0, Location::RequiresRegister()); 984 locs->set_in(0, Location::RequiresRegister());
962 // The smi index is either untagged (element size == 1), or it is left smi 985 // The smi index is either untagged (element size == 1), or it is left smi
963 // tagged (for all element sizes > 1). 986 // tagged (for all element sizes > 1).
964 // TODO(regis): Revisit and see if the index can be immediate. 987 // TODO(regis): Revisit and see if the index can be immediate.
965 locs->set_in(1, Location::WritableRegister()); 988 locs->set_in(1, Location::WritableRegister());
966 if ((representation() == kUnboxedDouble) || 989 if ((representation() == kUnboxedDouble) ||
967 (representation() == kUnboxedFloat32x4) || 990 (representation() == kUnboxedFloat32x4) ||
968 (representation() == kUnboxedInt32x4) || 991 (representation() == kUnboxedInt32x4) ||
969 (representation() == kUnboxedFloat64x2)) { 992 (representation() == kUnboxedFloat64x2)) {
970 locs->set_out(0, Location::RequiresFpuRegister()); 993 locs->set_out(0, Location::RequiresFpuRegister());
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 return kUnboxedInt32x4; 1137 return kUnboxedInt32x4;
1115 case kTypedDataFloat64x2ArrayCid: 1138 case kTypedDataFloat64x2ArrayCid:
1116 return kUnboxedFloat64x2; 1139 return kUnboxedFloat64x2;
1117 default: 1140 default:
1118 UNREACHABLE(); 1141 UNREACHABLE();
1119 return kTagged; 1142 return kTagged;
1120 } 1143 }
1121 } 1144 }
1122 1145
1123 1146
1124 LocationSummary* StoreIndexedInstr::MakeLocationSummary(bool opt) const { 1147 LocationSummary* StoreIndexedInstr::MakeLocationSummary(Isolate* isolate,
1148 bool opt) const {
1125 const intptr_t kNumInputs = 3; 1149 const intptr_t kNumInputs = 3;
1126 const intptr_t kNumTemps = 0; 1150 const intptr_t kNumTemps = 0;
1127 LocationSummary* locs = 1151 LocationSummary* locs = new(isolate) LocationSummary(
1128 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 1152 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
1129 locs->set_in(0, Location::RequiresRegister()); 1153 locs->set_in(0, Location::RequiresRegister());
1130 // The smi index is either untagged (element size == 1), or it is left smi 1154 // The smi index is either untagged (element size == 1), or it is left smi
1131 // tagged (for all element sizes > 1). 1155 // tagged (for all element sizes > 1).
1132 // TODO(regis): Revisit and see if the index can be immediate. 1156 // TODO(regis): Revisit and see if the index can be immediate.
1133 locs->set_in(1, Location::WritableRegister()); 1157 locs->set_in(1, Location::WritableRegister());
1134 switch (class_id()) { 1158 switch (class_id()) {
1135 case kArrayCid: 1159 case kArrayCid:
1136 locs->set_in(2, ShouldEmitStoreBarrier() 1160 locs->set_in(2, ShouldEmitStoreBarrier()
1137 ? Location::WritableRegister() 1161 ? Location::WritableRegister()
1138 : Location::RegisterOrConstant(value())); 1162 : Location::RegisterOrConstant(value()));
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 if (value_is_smi == NULL) { 1350 if (value_is_smi == NULL) {
1327 __ b(&done, EQ); 1351 __ b(&done, EQ);
1328 } else { 1352 } else {
1329 __ b(value_is_smi, EQ); 1353 __ b(value_is_smi, EQ);
1330 } 1354 }
1331 __ LoadClassId(value_cid_reg, value_reg, PP); 1355 __ LoadClassId(value_cid_reg, value_reg, PP);
1332 __ Bind(&done); 1356 __ Bind(&done);
1333 } 1357 }
1334 1358
1335 1359
1336 LocationSummary* GuardFieldInstr::MakeLocationSummary(bool opt) const { 1360 LocationSummary* GuardFieldInstr::MakeLocationSummary(Isolate* isolate,
1361 bool opt) const {
1337 const intptr_t kNumInputs = 1; 1362 const intptr_t kNumInputs = 1;
1338 LocationSummary* summary = 1363 LocationSummary* summary = new(isolate) LocationSummary(
1339 new LocationSummary(kNumInputs, 0, LocationSummary::kNoCall); 1364 isolate, kNumInputs, 0, LocationSummary::kNoCall);
1340 summary->set_in(0, Location::RequiresRegister()); 1365 summary->set_in(0, Location::RequiresRegister());
1341 const bool field_has_length = field().needs_length_check(); 1366 const bool field_has_length = field().needs_length_check();
1342 summary->AddTemp(Location::RequiresRegister()); 1367 summary->AddTemp(Location::RequiresRegister());
1343 summary->AddTemp(Location::RequiresRegister()); 1368 summary->AddTemp(Location::RequiresRegister());
1344 const bool need_field_temp_reg = 1369 const bool need_field_temp_reg =
1345 field_has_length || (field().guarded_cid() == kIllegalCid); 1370 field_has_length || (field().guarded_cid() == kIllegalCid);
1346 if (need_field_temp_reg) { 1371 if (need_field_temp_reg) {
1347 summary->AddTemp(Location::RequiresRegister()); 1372 summary->AddTemp(Location::RequiresRegister());
1348 } 1373 }
1349 return summary; 1374 return summary;
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1679 1704
1680 __ b(exit_label()); 1705 __ b(exit_label());
1681 } 1706 }
1682 1707
1683 private: 1708 private:
1684 StoreInstanceFieldInstr* instruction_; 1709 StoreInstanceFieldInstr* instruction_;
1685 const Class& cls_; 1710 const Class& cls_;
1686 }; 1711 };
1687 1712
1688 1713
1689 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(bool opt) const { 1714 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Isolate* isolate,
1715 bool opt) const {
1690 const intptr_t kNumInputs = 2; 1716 const intptr_t kNumInputs = 2;
1691 const intptr_t kNumTemps = 0; 1717 const intptr_t kNumTemps = 0;
1692 LocationSummary* summary = 1718 LocationSummary* summary = new(isolate) LocationSummary(
1693 new LocationSummary(kNumInputs, kNumTemps, 1719 isolate, kNumInputs, kNumTemps,
1694 !field().IsNull() && 1720 !field().IsNull() &&
1695 ((field().guarded_cid() == kIllegalCid) || is_initialization_) 1721 ((field().guarded_cid() == kIllegalCid) || is_initialization_)
1696 ? LocationSummary::kCallOnSlowPath 1722 ? LocationSummary::kCallOnSlowPath
1697 : LocationSummary::kNoCall); 1723 : LocationSummary::kNoCall);
1698 1724
1699 summary->set_in(0, Location::RequiresRegister()); 1725 summary->set_in(0, Location::RequiresRegister());
1700 if (IsUnboxedStore() && opt) { 1726 if (IsUnboxedStore() && opt) {
1701 summary->set_in(1, Location::RequiresFpuRegister()); 1727 summary->set_in(1, Location::RequiresFpuRegister());
1702 summary->AddTemp(Location::RequiresRegister()); 1728 summary->AddTemp(Location::RequiresRegister());
1703 summary->AddTemp(Location::RequiresRegister()); 1729 summary->AddTemp(Location::RequiresRegister());
1704 } else if (IsPotentialUnboxedStore()) { 1730 } else if (IsPotentialUnboxedStore()) {
1705 summary->set_in(1, ShouldEmitStoreBarrier() 1731 summary->set_in(1, ShouldEmitStoreBarrier()
1706 ? Location::WritableRegister() 1732 ? Location::WritableRegister()
1707 : Location::RequiresRegister()); 1733 : Location::RequiresRegister());
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 instance_reg, 1937 instance_reg,
1912 offset_in_bytes_, 1938 offset_in_bytes_,
1913 value_reg, 1939 value_reg,
1914 PP); 1940 PP);
1915 } 1941 }
1916 } 1942 }
1917 __ Bind(&skip_store); 1943 __ Bind(&skip_store);
1918 } 1944 }
1919 1945
1920 1946
1921 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(bool opt) const { 1947 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Isolate* isolate,
1948 bool opt) const {
1922 const intptr_t kNumInputs = 1; 1949 const intptr_t kNumInputs = 1;
1923 const intptr_t kNumTemps = 0; 1950 const intptr_t kNumTemps = 0;
1924 LocationSummary* summary = 1951 LocationSummary* summary = new(isolate) LocationSummary(
1925 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 1952 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
1926 summary->set_in(0, Location::RequiresRegister()); 1953 summary->set_in(0, Location::RequiresRegister());
1927 summary->set_out(0, Location::RequiresRegister()); 1954 summary->set_out(0, Location::RequiresRegister());
1928 return summary; 1955 return summary;
1929 } 1956 }
1930 1957
1931 1958
1932 // When the parser is building an implicit static getter for optimization, 1959 // When the parser is building an implicit static getter for optimization,
1933 // it can generate a function body where deoptimization ids do not line up 1960 // it can generate a function body where deoptimization ids do not line up
1934 // with the unoptimized code. 1961 // with the unoptimized code.
1935 // 1962 //
1936 // This is safe only so long as LoadStaticFieldInstr cannot deoptimize. 1963 // This is safe only so long as LoadStaticFieldInstr cannot deoptimize.
1937 void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1964 void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1938 const Register field = locs()->in(0).reg(); 1965 const Register field = locs()->in(0).reg();
1939 const Register result = locs()->out(0).reg(); 1966 const Register result = locs()->out(0).reg();
1940 __ LoadFieldFromOffset(result, field, Field::value_offset(), PP); 1967 __ LoadFieldFromOffset(result, field, Field::value_offset(), PP);
1941 } 1968 }
1942 1969
1943 1970
1944 LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(bool opt) const { 1971 LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(Isolate* isolate,
1945 LocationSummary* locs = new LocationSummary(1, 1, LocationSummary::kNoCall); 1972 bool opt) const {
1973 LocationSummary* locs = new(isolate) LocationSummary(
1974 isolate, 1, 1, LocationSummary::kNoCall);
1946 locs->set_in(0, value()->NeedsStoreBuffer() ? Location::WritableRegister() 1975 locs->set_in(0, value()->NeedsStoreBuffer() ? Location::WritableRegister()
1947 : Location::RequiresRegister()); 1976 : Location::RequiresRegister());
1948 locs->set_temp(0, Location::RequiresRegister()); 1977 locs->set_temp(0, Location::RequiresRegister());
1949 return locs; 1978 return locs;
1950 } 1979 }
1951 1980
1952 1981
1953 void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1982 void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1954 const Register value = locs()->in(0).reg(); 1983 const Register value = locs()->in(0).reg();
1955 const Register temp = locs()->temp(0).reg(); 1984 const Register temp = locs()->temp(0).reg();
1956 1985
1957 __ LoadObject(temp, field(), PP); 1986 __ LoadObject(temp, field(), PP);
1958 if (this->value()->NeedsStoreBuffer()) { 1987 if (this->value()->NeedsStoreBuffer()) {
1959 __ StoreIntoObjectOffset( 1988 __ StoreIntoObjectOffset(
1960 temp, Field::value_offset(), value, PP, CanValueBeSmi()); 1989 temp, Field::value_offset(), value, PP, CanValueBeSmi());
1961 } else { 1990 } else {
1962 __ StoreIntoObjectOffsetNoBarrier(temp, Field::value_offset(), value, PP); 1991 __ StoreIntoObjectOffsetNoBarrier(temp, Field::value_offset(), value, PP);
1963 } 1992 }
1964 } 1993 }
1965 1994
1966 1995
1967 LocationSummary* InstanceOfInstr::MakeLocationSummary(bool opt) const { 1996 LocationSummary* InstanceOfInstr::MakeLocationSummary(Isolate* isolate,
1997 bool opt) const {
1968 const intptr_t kNumInputs = 3; 1998 const intptr_t kNumInputs = 3;
1969 const intptr_t kNumTemps = 0; 1999 const intptr_t kNumTemps = 0;
1970 LocationSummary* summary = 2000 LocationSummary* summary = new(isolate) LocationSummary(
1971 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 2001 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
1972 summary->set_in(0, Location::RegisterLocation(R0)); 2002 summary->set_in(0, Location::RegisterLocation(R0));
1973 summary->set_in(1, Location::RegisterLocation(R2)); 2003 summary->set_in(1, Location::RegisterLocation(R2));
1974 summary->set_in(2, Location::RegisterLocation(R1)); 2004 summary->set_in(2, Location::RegisterLocation(R1));
1975 summary->set_out(0, Location::RegisterLocation(R0)); 2005 summary->set_out(0, Location::RegisterLocation(R0));
1976 return summary; 2006 return summary;
1977 } 2007 }
1978 2008
1979 2009
1980 void InstanceOfInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2010 void InstanceOfInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1981 ASSERT(locs()->in(0).reg() == R0); // Value. 2011 ASSERT(locs()->in(0).reg() == R0); // Value.
1982 ASSERT(locs()->in(1).reg() == R2); // Instantiator. 2012 ASSERT(locs()->in(1).reg() == R2); // Instantiator.
1983 ASSERT(locs()->in(2).reg() == R1); // Instantiator type arguments. 2013 ASSERT(locs()->in(2).reg() == R1); // Instantiator type arguments.
1984 2014
1985 compiler->GenerateInstanceOf(token_pos(), 2015 compiler->GenerateInstanceOf(token_pos(),
1986 deopt_id(), 2016 deopt_id(),
1987 type(), 2017 type(),
1988 negate_result(), 2018 negate_result(),
1989 locs()); 2019 locs());
1990 ASSERT(locs()->out(0).reg() == R0); 2020 ASSERT(locs()->out(0).reg() == R0);
1991 } 2021 }
1992 2022
1993 2023
1994 LocationSummary* CreateArrayInstr::MakeLocationSummary(bool opt) const { 2024 LocationSummary* CreateArrayInstr::MakeLocationSummary(Isolate* isolate,
2025 bool opt) const {
1995 const intptr_t kNumInputs = 2; 2026 const intptr_t kNumInputs = 2;
1996 const intptr_t kNumTemps = 0; 2027 const intptr_t kNumTemps = 0;
1997 LocationSummary* locs = 2028 LocationSummary* locs = new(isolate) LocationSummary(
1998 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 2029 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
1999 locs->set_in(kElementTypePos, Location::RegisterLocation(R1)); 2030 locs->set_in(kElementTypePos, Location::RegisterLocation(R1));
2000 locs->set_in(kLengthPos, Location::RegisterLocation(R2)); 2031 locs->set_in(kLengthPos, Location::RegisterLocation(R2));
2001 locs->set_out(0, Location::RegisterLocation(R0)); 2032 locs->set_out(0, Location::RegisterLocation(R0));
2002 return locs; 2033 return locs;
2003 } 2034 }
2004 2035
2005 2036
2006 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2037 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2007 // Allocate the array. R2 = length, R1 = element type. 2038 // Allocate the array. R2 = length, R1 = element type.
2008 ASSERT(locs()->in(kElementTypePos).reg() == R1); 2039 ASSERT(locs()->in(kElementTypePos).reg() == R1);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
2104 compiler->RestoreLiveRegisters(locs); 2135 compiler->RestoreLiveRegisters(locs);
2105 2136
2106 __ b(exit_label()); 2137 __ b(exit_label());
2107 } 2138 }
2108 2139
2109 private: 2140 private:
2110 Instruction* instruction_; 2141 Instruction* instruction_;
2111 }; 2142 };
2112 2143
2113 2144
2114 LocationSummary* LoadFieldInstr::MakeLocationSummary(bool opt) const { 2145 LocationSummary* LoadFieldInstr::MakeLocationSummary(Isolate* isolate,
2146 bool opt) const {
2115 const intptr_t kNumInputs = 1; 2147 const intptr_t kNumInputs = 1;
2116 const intptr_t kNumTemps = 0; 2148 const intptr_t kNumTemps = 0;
2117 LocationSummary* locs = 2149 LocationSummary* locs = new(isolate) LocationSummary(
2118 new LocationSummary( 2150 isolate, kNumInputs, kNumTemps,
2119 kNumInputs, kNumTemps, 2151 (opt && !IsPotentialUnboxedLoad())
2120 (opt && !IsPotentialUnboxedLoad())
2121 ? LocationSummary::kNoCall 2152 ? LocationSummary::kNoCall
2122 : LocationSummary::kCallOnSlowPath); 2153 : LocationSummary::kCallOnSlowPath);
2123 2154
2124 locs->set_in(0, Location::RequiresRegister()); 2155 locs->set_in(0, Location::RequiresRegister());
2125 2156
2126 if (IsUnboxedLoad() && opt) { 2157 if (IsUnboxedLoad() && opt) {
2127 locs->AddTemp(Location::RequiresRegister()); 2158 locs->AddTemp(Location::RequiresRegister());
2128 } else if (IsPotentialUnboxedLoad()) { 2159 } else if (IsPotentialUnboxedLoad()) {
2129 locs->AddTemp(Location::RequiresRegister()); 2160 locs->AddTemp(Location::RequiresRegister());
2130 } 2161 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
2244 __ b(&done); 2275 __ b(&done);
2245 } 2276 }
2246 2277
2247 __ Bind(&load_pointer); 2278 __ Bind(&load_pointer);
2248 } 2279 }
2249 __ LoadFieldFromOffset(result_reg, instance_reg, offset_in_bytes(), PP); 2280 __ LoadFieldFromOffset(result_reg, instance_reg, offset_in_bytes(), PP);
2250 __ Bind(&done); 2281 __ Bind(&done);
2251 } 2282 }
2252 2283
2253 2284
2254 LocationSummary* InstantiateTypeInstr::MakeLocationSummary(bool opt) const { 2285 LocationSummary* InstantiateTypeInstr::MakeLocationSummary(Isolate* isolate,
2286 bool opt) const {
2255 const intptr_t kNumInputs = 1; 2287 const intptr_t kNumInputs = 1;
2256 const intptr_t kNumTemps = 0; 2288 const intptr_t kNumTemps = 0;
2257 LocationSummary* locs = 2289 LocationSummary* locs = new(isolate) LocationSummary(
2258 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 2290 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
2259 locs->set_in(0, Location::RegisterLocation(R0)); 2291 locs->set_in(0, Location::RegisterLocation(R0));
2260 locs->set_out(0, Location::RegisterLocation(R0)); 2292 locs->set_out(0, Location::RegisterLocation(R0));
2261 return locs; 2293 return locs;
2262 } 2294 }
2263 2295
2264 2296
2265 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2297 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2266 const Register instantiator_reg = locs()->in(0).reg(); 2298 const Register instantiator_reg = locs()->in(0).reg();
2267 const Register result_reg = locs()->out(0).reg(); 2299 const Register result_reg = locs()->out(0).reg();
2268 2300
2269 // 'instantiator_reg' is the instantiator TypeArguments object (or null). 2301 // 'instantiator_reg' is the instantiator TypeArguments object (or null).
2270 // A runtime call to instantiate the type is required. 2302 // A runtime call to instantiate the type is required.
2271 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. 2303 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result.
2272 __ PushObject(type(), PP); 2304 __ PushObject(type(), PP);
2273 __ Push(instantiator_reg); // Push instantiator type arguments. 2305 __ Push(instantiator_reg); // Push instantiator type arguments.
2274 compiler->GenerateRuntimeCall(token_pos(), 2306 compiler->GenerateRuntimeCall(token_pos(),
2275 deopt_id(), 2307 deopt_id(),
2276 kInstantiateTypeRuntimeEntry, 2308 kInstantiateTypeRuntimeEntry,
2277 2, 2309 2,
2278 locs()); 2310 locs());
2279 __ Drop(2); // Drop instantiator and uninstantiated type. 2311 __ Drop(2); // Drop instantiator and uninstantiated type.
2280 __ Pop(result_reg); // Pop instantiated type. 2312 __ Pop(result_reg); // Pop instantiated type.
2281 ASSERT(instantiator_reg == result_reg); 2313 ASSERT(instantiator_reg == result_reg);
2282 } 2314 }
2283 2315
2284 2316
2285 LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary( 2317 LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary(
2286 bool opt) const { 2318 Isolate* isolate, bool opt) const {
2287 const intptr_t kNumInputs = 1; 2319 const intptr_t kNumInputs = 1;
2288 const intptr_t kNumTemps = 0; 2320 const intptr_t kNumTemps = 0;
2289 LocationSummary* locs = 2321 LocationSummary* locs = new(isolate) LocationSummary(
2290 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 2322 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
2291 locs->set_in(0, Location::RegisterLocation(R0)); 2323 locs->set_in(0, Location::RegisterLocation(R0));
2292 locs->set_out(0, Location::RegisterLocation(R0)); 2324 locs->set_out(0, Location::RegisterLocation(R0));
2293 return locs; 2325 return locs;
2294 } 2326 }
2295 2327
2296 2328
2297 void InstantiateTypeArgumentsInstr::EmitNativeCode( 2329 void InstantiateTypeArgumentsInstr::EmitNativeCode(
2298 FlowGraphCompiler* compiler) { 2330 FlowGraphCompiler* compiler) {
2299 const Register instantiator_reg = locs()->in(0).reg(); 2331 const Register instantiator_reg = locs()->in(0).reg();
2300 const Register result_reg = locs()->out(0).reg(); 2332 const Register result_reg = locs()->out(0).reg();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2343 deopt_id(), 2375 deopt_id(),
2344 kInstantiateTypeArgumentsRuntimeEntry, 2376 kInstantiateTypeArgumentsRuntimeEntry,
2345 2, 2377 2,
2346 locs()); 2378 locs());
2347 __ Drop(2); // Drop instantiator and uninstantiated type arguments. 2379 __ Drop(2); // Drop instantiator and uninstantiated type arguments.
2348 __ Pop(result_reg); // Pop instantiated type arguments. 2380 __ Pop(result_reg); // Pop instantiated type arguments.
2349 __ Bind(&type_arguments_instantiated); 2381 __ Bind(&type_arguments_instantiated);
2350 } 2382 }
2351 2383
2352 2384
2353 LocationSummary* AllocateContextInstr::MakeLocationSummary(bool opt) const { 2385 LocationSummary* AllocateContextInstr::MakeLocationSummary(Isolate* isolate,
2386 bool opt) const {
2354 const intptr_t kNumInputs = 0; 2387 const intptr_t kNumInputs = 0;
2355 const intptr_t kNumTemps = 1; 2388 const intptr_t kNumTemps = 1;
2356 LocationSummary* locs = 2389 LocationSummary* locs = new(isolate) LocationSummary(
2357 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 2390 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
2358 locs->set_temp(0, Location::RegisterLocation(R1)); 2391 locs->set_temp(0, Location::RegisterLocation(R1));
2359 locs->set_out(0, Location::RegisterLocation(R0)); 2392 locs->set_out(0, Location::RegisterLocation(R0));
2360 return locs; 2393 return locs;
2361 } 2394 }
2362 2395
2363 2396
2364 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2397 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2365 ASSERT(locs()->temp(0).reg() == R1); 2398 ASSERT(locs()->temp(0).reg() == R1);
2366 ASSERT(locs()->out(0).reg() == R0); 2399 ASSERT(locs()->out(0).reg() == R0);
2367 2400
2368 __ LoadImmediate(R1, num_context_variables(), PP); 2401 __ LoadImmediate(R1, num_context_variables(), PP);
2369 const ExternalLabel label("alloc_context", 2402 const ExternalLabel label("alloc_context",
2370 StubCode::AllocateContextEntryPoint()); 2403 StubCode::AllocateContextEntryPoint());
2371 compiler->GenerateCall(token_pos(), 2404 compiler->GenerateCall(token_pos(),
2372 &label, 2405 &label,
2373 PcDescriptors::kOther, 2406 PcDescriptors::kOther,
2374 locs()); 2407 locs());
2375 } 2408 }
2376 2409
2377 2410
2378 LocationSummary* CloneContextInstr::MakeLocationSummary(bool opt) const { 2411 LocationSummary* CloneContextInstr::MakeLocationSummary(Isolate* isolate,
2412 bool opt) const {
2379 const intptr_t kNumInputs = 1; 2413 const intptr_t kNumInputs = 1;
2380 const intptr_t kNumTemps = 0; 2414 const intptr_t kNumTemps = 0;
2381 LocationSummary* locs = 2415 LocationSummary* locs = new(isolate) LocationSummary(
2382 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 2416 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
2383 locs->set_in(0, Location::RegisterLocation(R0)); 2417 locs->set_in(0, Location::RegisterLocation(R0));
2384 locs->set_out(0, Location::RegisterLocation(R0)); 2418 locs->set_out(0, Location::RegisterLocation(R0));
2385 return locs; 2419 return locs;
2386 } 2420 }
2387 2421
2388 2422
2389 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2423 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2390 const Register context_value = locs()->in(0).reg(); 2424 const Register context_value = locs()->in(0).reg();
2391 const Register result = locs()->out(0).reg(); 2425 const Register result = locs()->out(0).reg();
2392 2426
2393 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. 2427 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result.
2394 __ Push(context_value); 2428 __ Push(context_value);
2395 compiler->GenerateRuntimeCall(token_pos(), 2429 compiler->GenerateRuntimeCall(token_pos(),
2396 deopt_id(), 2430 deopt_id(),
2397 kCloneContextRuntimeEntry, 2431 kCloneContextRuntimeEntry,
2398 1, 2432 1,
2399 locs()); 2433 locs());
2400 __ Drop(1); // Remove argument. 2434 __ Drop(1); // Remove argument.
2401 __ Pop(result); // Get result (cloned context). 2435 __ Pop(result); // Get result (cloned context).
2402 } 2436 }
2403 2437
2404 2438
2405 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(bool opt) const { 2439 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Isolate* isolate,
2440 bool opt) const {
2406 UNREACHABLE(); 2441 UNREACHABLE();
2407 return NULL; 2442 return NULL;
2408 } 2443 }
2409 2444
2410 2445
2411 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2446 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2412 __ Bind(compiler->GetJumpLabel(this)); 2447 __ Bind(compiler->GetJumpLabel(this));
2413 compiler->AddExceptionHandler(catch_try_index(), 2448 compiler->AddExceptionHandler(catch_try_index(),
2414 try_index(), 2449 try_index(),
2415 compiler->assembler()->CodeSize(), 2450 compiler->assembler()->CodeSize(),
(...skipping 16 matching lines...) Expand all
2432 2467
2433 // Restore stack and initialize the two exception variables: 2468 // Restore stack and initialize the two exception variables:
2434 // exception and stack trace variables. 2469 // exception and stack trace variables.
2435 __ StoreToOffset(kExceptionObjectReg, 2470 __ StoreToOffset(kExceptionObjectReg,
2436 FP, exception_var().index() * kWordSize, PP); 2471 FP, exception_var().index() * kWordSize, PP);
2437 __ StoreToOffset(kStackTraceObjectReg, 2472 __ StoreToOffset(kStackTraceObjectReg,
2438 FP, stacktrace_var().index() * kWordSize, PP); 2473 FP, stacktrace_var().index() * kWordSize, PP);
2439 } 2474 }
2440 2475
2441 2476
2442 LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(bool opt) const { 2477 LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Isolate* isolate,
2478 bool opt) const {
2443 const intptr_t kNumInputs = 0; 2479 const intptr_t kNumInputs = 0;
2444 const intptr_t kNumTemps = 1; 2480 const intptr_t kNumTemps = 1;
2445 LocationSummary* summary = 2481 LocationSummary* summary = new(isolate) LocationSummary(
2446 new LocationSummary(kNumInputs, 2482 isolate, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath);
2447 kNumTemps,
2448 LocationSummary::kCallOnSlowPath);
2449 summary->set_temp(0, Location::RequiresRegister()); 2483 summary->set_temp(0, Location::RequiresRegister());
2450 return summary; 2484 return summary;
2451 } 2485 }
2452 2486
2453 2487
2454 class CheckStackOverflowSlowPath : public SlowPathCode { 2488 class CheckStackOverflowSlowPath : public SlowPathCode {
2455 public: 2489 public:
2456 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) 2490 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction)
2457 : instruction_(instruction) { } 2491 : instruction_(instruction) { }
2458 2492
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
2659 __ b(deopt, NE); // Overflow. 2693 __ b(deopt, NE); // Overflow.
2660 // Shift for result now we know there is no overflow. 2694 // Shift for result now we know there is no overflow.
2661 __ lslv(result, left, TMP); 2695 __ lslv(result, left, TMP);
2662 } 2696 }
2663 if (FLAG_throw_on_javascript_int_overflow) { 2697 if (FLAG_throw_on_javascript_int_overflow) {
2664 EmitJavascriptOverflowCheck(compiler, shift_left->range(), deopt, result); 2698 EmitJavascriptOverflowCheck(compiler, shift_left->range(), deopt, result);
2665 } 2699 }
2666 } 2700 }
2667 2701
2668 2702
2669 LocationSummary* BinarySmiOpInstr::MakeLocationSummary(bool opt) const { 2703 LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Isolate* isolate,
2704 bool opt) const {
2670 const intptr_t kNumInputs = 2; 2705 const intptr_t kNumInputs = 2;
2671 const intptr_t kNumTemps = 0; 2706 const intptr_t kNumTemps = 0;
2672 LocationSummary* summary = 2707 LocationSummary* summary = new(isolate) LocationSummary(
2673 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 2708 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
2674 if (op_kind() == Token::kTRUNCDIV) { 2709 if (op_kind() == Token::kTRUNCDIV) {
2675 summary->set_in(0, Location::RequiresRegister()); 2710 summary->set_in(0, Location::RequiresRegister());
2676 if (RightIsPowerOfTwoConstant()) { 2711 if (RightIsPowerOfTwoConstant()) {
2677 ConstantInstr* right_constant = right()->definition()->AsConstant(); 2712 ConstantInstr* right_constant = right()->definition()->AsConstant();
2678 summary->set_in(1, Location::Constant(right_constant->value())); 2713 summary->set_in(1, Location::Constant(right_constant->value()));
2679 } else { 2714 } else {
2680 summary->set_in(1, Location::RequiresRegister()); 2715 summary->set_in(1, Location::RequiresRegister());
2681 } 2716 }
2682 summary->set_out(0, Location::RequiresRegister()); 2717 summary->set_out(0, Location::RequiresRegister());
2683 return summary; 2718 return summary;
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
2981 default: 3016 default:
2982 UNREACHABLE(); 3017 UNREACHABLE();
2983 break; 3018 break;
2984 } 3019 }
2985 if (FLAG_throw_on_javascript_int_overflow) { 3020 if (FLAG_throw_on_javascript_int_overflow) {
2986 EmitJavascriptOverflowCheck(compiler, range(), deopt, result); 3021 EmitJavascriptOverflowCheck(compiler, range(), deopt, result);
2987 } 3022 }
2988 } 3023 }
2989 3024
2990 3025
2991 LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary(bool opt) const { 3026 LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary(Isolate* isolate,
3027 bool opt) const {
2992 intptr_t left_cid = left()->Type()->ToCid(); 3028 intptr_t left_cid = left()->Type()->ToCid();
2993 intptr_t right_cid = right()->Type()->ToCid(); 3029 intptr_t right_cid = right()->Type()->ToCid();
2994 ASSERT((left_cid != kDoubleCid) && (right_cid != kDoubleCid)); 3030 ASSERT((left_cid != kDoubleCid) && (right_cid != kDoubleCid));
2995 const intptr_t kNumInputs = 2; 3031 const intptr_t kNumInputs = 2;
2996 const intptr_t kNumTemps = 0; 3032 const intptr_t kNumTemps = 0;
2997 LocationSummary* summary = 3033 LocationSummary* summary = new(isolate) LocationSummary(
2998 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3034 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
2999 summary->set_in(0, Location::RequiresRegister()); 3035 summary->set_in(0, Location::RequiresRegister());
3000 summary->set_in(1, Location::RequiresRegister()); 3036 summary->set_in(1, Location::RequiresRegister());
3001 return summary; 3037 return summary;
3002 } 3038 }
3003 3039
3004 3040
3005 void CheckEitherNonSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3041 void CheckEitherNonSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3006 Label* deopt = compiler->AddDeoptStub(deopt_id(), 3042 Label* deopt = compiler->AddDeoptStub(deopt_id(),
3007 ICData::kDeoptBinaryDoubleOp); 3043 ICData::kDeoptBinaryDoubleOp);
3008 intptr_t left_cid = left()->Type()->ToCid(); 3044 intptr_t left_cid = left()->Type()->ToCid();
3009 intptr_t right_cid = right()->Type()->ToCid(); 3045 intptr_t right_cid = right()->Type()->ToCid();
3010 const Register left = locs()->in(0).reg(); 3046 const Register left = locs()->in(0).reg();
3011 const Register right = locs()->in(1).reg(); 3047 const Register right = locs()->in(1).reg();
3012 if (left_cid == kSmiCid) { 3048 if (left_cid == kSmiCid) {
3013 __ tsti(right, kSmiTagMask); 3049 __ tsti(right, kSmiTagMask);
3014 } else if (right_cid == kSmiCid) { 3050 } else if (right_cid == kSmiCid) {
3015 __ tsti(left, kSmiTagMask); 3051 __ tsti(left, kSmiTagMask);
3016 } else { 3052 } else {
3017 __ orr(TMP, left, Operand(right)); 3053 __ orr(TMP, left, Operand(right));
3018 __ tsti(TMP, kSmiTagMask); 3054 __ tsti(TMP, kSmiTagMask);
3019 } 3055 }
3020 __ b(deopt, EQ); 3056 __ b(deopt, EQ);
3021 } 3057 }
3022 3058
3023 3059
3024 LocationSummary* BoxDoubleInstr::MakeLocationSummary(bool opt) const { 3060 LocationSummary* BoxDoubleInstr::MakeLocationSummary(Isolate* isolate,
3061 bool opt) const {
3025 const intptr_t kNumInputs = 1; 3062 const intptr_t kNumInputs = 1;
3026 const intptr_t kNumTemps = 0; 3063 const intptr_t kNumTemps = 0;
3027 LocationSummary* summary = 3064 LocationSummary* summary = new(isolate) LocationSummary(
3028 new LocationSummary(kNumInputs, 3065 isolate, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath);
3029 kNumTemps,
3030 LocationSummary::kCallOnSlowPath);
3031 summary->set_in(0, Location::RequiresFpuRegister()); 3066 summary->set_in(0, Location::RequiresFpuRegister());
3032 summary->set_out(0, Location::RequiresRegister()); 3067 summary->set_out(0, Location::RequiresRegister());
3033 return summary; 3068 return summary;
3034 } 3069 }
3035 3070
3036 3071
3037 void BoxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3072 void BoxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3038 BoxDoubleSlowPath* slow_path = new BoxDoubleSlowPath(this); 3073 BoxDoubleSlowPath* slow_path = new BoxDoubleSlowPath(this);
3039 compiler->AddSlowPathCode(slow_path); 3074 compiler->AddSlowPathCode(slow_path);
3040 3075
3041 const Register out_reg = locs()->out(0).reg(); 3076 const Register out_reg = locs()->out(0).reg();
3042 const VRegister value = locs()->in(0).fpu_reg(); 3077 const VRegister value = locs()->in(0).fpu_reg();
3043 3078
3044 __ TryAllocate(compiler->double_class(), 3079 __ TryAllocate(compiler->double_class(),
3045 slow_path->entry_label(), 3080 slow_path->entry_label(),
3046 out_reg, 3081 out_reg,
3047 PP); 3082 PP);
3048 __ Bind(slow_path->exit_label()); 3083 __ Bind(slow_path->exit_label());
3049 __ StoreDFieldToOffset(value, out_reg, Double::value_offset(), PP); 3084 __ StoreDFieldToOffset(value, out_reg, Double::value_offset(), PP);
3050 } 3085 }
3051 3086
3052 3087
3053 LocationSummary* UnboxDoubleInstr::MakeLocationSummary(bool opt) const { 3088 LocationSummary* UnboxDoubleInstr::MakeLocationSummary(Isolate* isolate,
3089 bool opt) const {
3054 const intptr_t kNumInputs = 1; 3090 const intptr_t kNumInputs = 1;
3055 const intptr_t kNumTemps = 0; 3091 const intptr_t kNumTemps = 0;
3056 LocationSummary* summary = 3092 LocationSummary* summary = new(isolate) LocationSummary(
3057 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3093 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3058 summary->set_in(0, Location::RequiresRegister()); 3094 summary->set_in(0, Location::RequiresRegister());
3059 summary->set_out(0, Location::RequiresFpuRegister()); 3095 summary->set_out(0, Location::RequiresFpuRegister());
3060 return summary; 3096 return summary;
3061 } 3097 }
3062 3098
3063 3099
3064 void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3100 void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3065 CompileType* value_type = value()->Type(); 3101 CompileType* value_type = value()->Type();
3066 const intptr_t value_cid = value_type->ToCid(); 3102 const intptr_t value_cid = value_type->ToCid();
3067 const Register value = locs()->in(0).reg(); 3103 const Register value = locs()->in(0).reg();
(...skipping 23 matching lines...) Expand all
3091 __ b(&done); 3127 __ b(&done);
3092 __ Bind(&is_smi); 3128 __ Bind(&is_smi);
3093 __ Asr(TMP, value, kSmiTagSize); // Copy and untag. 3129 __ Asr(TMP, value, kSmiTagSize); // Copy and untag.
3094 __ scvtfd(result, TMP); 3130 __ scvtfd(result, TMP);
3095 __ Bind(&done); 3131 __ Bind(&done);
3096 } 3132 }
3097 } 3133 }
3098 } 3134 }
3099 3135
3100 3136
3101 LocationSummary* BoxFloat32x4Instr::MakeLocationSummary(bool opt) const { 3137 LocationSummary* BoxFloat32x4Instr::MakeLocationSummary(Isolate* isolate,
3138 bool opt) const {
3102 const intptr_t kNumInputs = 1; 3139 const intptr_t kNumInputs = 1;
3103 const intptr_t kNumTemps = 0; 3140 const intptr_t kNumTemps = 0;
3104 LocationSummary* summary = 3141 LocationSummary* summary = new(isolate) LocationSummary(
3105 new LocationSummary(kNumInputs, 3142 isolate, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath);
3106 kNumTemps,
3107 LocationSummary::kCallOnSlowPath);
3108 summary->set_in(0, Location::RequiresFpuRegister()); 3143 summary->set_in(0, Location::RequiresFpuRegister());
3109 summary->set_out(0, Location::RequiresRegister()); 3144 summary->set_out(0, Location::RequiresRegister());
3110 return summary; 3145 return summary;
3111 } 3146 }
3112 3147
3113 3148
3114 void BoxFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 3149 void BoxFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
3115 BoxFloat32x4SlowPath* slow_path = new BoxFloat32x4SlowPath(this); 3150 BoxFloat32x4SlowPath* slow_path = new BoxFloat32x4SlowPath(this);
3116 compiler->AddSlowPathCode(slow_path); 3151 compiler->AddSlowPathCode(slow_path);
3117 3152
3118 const Register out_reg = locs()->out(0).reg(); 3153 const Register out_reg = locs()->out(0).reg();
3119 const VRegister value = locs()->in(0).fpu_reg(); 3154 const VRegister value = locs()->in(0).fpu_reg();
3120 3155
3121 __ TryAllocate(compiler->float32x4_class(), 3156 __ TryAllocate(compiler->float32x4_class(),
3122 slow_path->entry_label(), 3157 slow_path->entry_label(),
3123 out_reg, 3158 out_reg,
3124 PP); 3159 PP);
3125 __ Bind(slow_path->exit_label()); 3160 __ Bind(slow_path->exit_label());
3126 3161
3127 __ StoreQFieldToOffset(value, out_reg, Float32x4::value_offset(), PP); 3162 __ StoreQFieldToOffset(value, out_reg, Float32x4::value_offset(), PP);
3128 } 3163 }
3129 3164
3130 3165
3131 LocationSummary* UnboxFloat32x4Instr::MakeLocationSummary(bool opt) const { 3166 LocationSummary* UnboxFloat32x4Instr::MakeLocationSummary(Isolate* isolate,
3167 bool opt) const {
3132 const intptr_t kNumInputs = 1; 3168 const intptr_t kNumInputs = 1;
3133 const intptr_t kNumTemps = 0; 3169 const intptr_t kNumTemps = 0;
3134 LocationSummary* summary = 3170 LocationSummary* summary = new(isolate) LocationSummary(
3135 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3171 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3136 summary->set_in(0, Location::RequiresRegister()); 3172 summary->set_in(0, Location::RequiresRegister());
3137 summary->set_out(0, Location::RequiresFpuRegister()); 3173 summary->set_out(0, Location::RequiresFpuRegister());
3138 return summary; 3174 return summary;
3139 } 3175 }
3140 3176
3141 3177
3142 void UnboxFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 3178 void UnboxFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
3143 const intptr_t value_cid = value()->Type()->ToCid(); 3179 const intptr_t value_cid = value()->Type()->ToCid();
3144 const Register value = locs()->in(0).reg(); 3180 const Register value = locs()->in(0).reg();
3145 const VRegister result = locs()->out(0).fpu_reg(); 3181 const VRegister result = locs()->out(0).fpu_reg();
3146 3182
3147 if (value_cid != kFloat32x4Cid) { 3183 if (value_cid != kFloat32x4Cid) {
3148 Label* deopt = compiler->AddDeoptStub(deopt_id_, ICData::kDeoptCheckClass); 3184 Label* deopt = compiler->AddDeoptStub(deopt_id_, ICData::kDeoptCheckClass);
3149 __ tsti(value, kSmiTagMask); 3185 __ tsti(value, kSmiTagMask);
3150 __ b(deopt, EQ); 3186 __ b(deopt, EQ);
3151 __ CompareClassId(value, kFloat32x4Cid, PP); 3187 __ CompareClassId(value, kFloat32x4Cid, PP);
3152 __ b(deopt, NE); 3188 __ b(deopt, NE);
3153 } 3189 }
3154 3190
3155 __ LoadQFieldFromOffset(result, value, Float32x4::value_offset(), PP); 3191 __ LoadQFieldFromOffset(result, value, Float32x4::value_offset(), PP);
3156 } 3192 }
3157 3193
3158 3194
3159 LocationSummary* BoxFloat64x2Instr::MakeLocationSummary(bool opt) const { 3195 LocationSummary* BoxFloat64x2Instr::MakeLocationSummary(Isolate* isolate,
3196 bool opt) const {
3160 const intptr_t kNumInputs = 1; 3197 const intptr_t kNumInputs = 1;
3161 const intptr_t kNumTemps = 0; 3198 const intptr_t kNumTemps = 0;
3162 LocationSummary* summary = 3199 LocationSummary* summary = new(isolate) LocationSummary(
3163 new LocationSummary(kNumInputs, 3200 isolate, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath);
3164 kNumTemps,
3165 LocationSummary::kCallOnSlowPath);
3166 summary->set_in(0, Location::RequiresFpuRegister()); 3201 summary->set_in(0, Location::RequiresFpuRegister());
3167 summary->set_out(0, Location::RequiresRegister()); 3202 summary->set_out(0, Location::RequiresRegister());
3168 return summary; 3203 return summary;
3169 } 3204 }
3170 3205
3171 3206
3172 void BoxFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 3207 void BoxFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
3173 BoxFloat64x2SlowPath* slow_path = new BoxFloat64x2SlowPath(this); 3208 BoxFloat64x2SlowPath* slow_path = new BoxFloat64x2SlowPath(this);
3174 compiler->AddSlowPathCode(slow_path); 3209 compiler->AddSlowPathCode(slow_path);
3175 3210
3176 const Register out_reg = locs()->out(0).reg(); 3211 const Register out_reg = locs()->out(0).reg();
3177 const VRegister value = locs()->in(0).fpu_reg(); 3212 const VRegister value = locs()->in(0).fpu_reg();
3178 3213
3179 __ TryAllocate(compiler->float64x2_class(), 3214 __ TryAllocate(compiler->float64x2_class(),
3180 slow_path->entry_label(), 3215 slow_path->entry_label(),
3181 out_reg, 3216 out_reg,
3182 PP); 3217 PP);
3183 __ Bind(slow_path->exit_label()); 3218 __ Bind(slow_path->exit_label());
3184 3219
3185 __ StoreQFieldToOffset(value, out_reg, Float64x2::value_offset(), PP); 3220 __ StoreQFieldToOffset(value, out_reg, Float64x2::value_offset(), PP);
3186 } 3221 }
3187 3222
3188 3223
3189 LocationSummary* UnboxFloat64x2Instr::MakeLocationSummary(bool opt) const { 3224 LocationSummary* UnboxFloat64x2Instr::MakeLocationSummary(Isolate* isolate,
3225 bool opt) const {
3190 const intptr_t kNumInputs = 1; 3226 const intptr_t kNumInputs = 1;
3191 const intptr_t kNumTemps = 0; 3227 const intptr_t kNumTemps = 0;
3192 LocationSummary* summary = 3228 LocationSummary* summary = new(isolate) LocationSummary(
3193 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3229 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3194 summary->set_in(0, Location::RequiresRegister()); 3230 summary->set_in(0, Location::RequiresRegister());
3195 summary->set_out(0, Location::RequiresFpuRegister()); 3231 summary->set_out(0, Location::RequiresFpuRegister());
3196 return summary; 3232 return summary;
3197 } 3233 }
3198 3234
3199 3235
3200 void UnboxFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 3236 void UnboxFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
3201 const intptr_t value_cid = value()->Type()->ToCid(); 3237 const intptr_t value_cid = value()->Type()->ToCid();
3202 const Register value = locs()->in(0).reg(); 3238 const Register value = locs()->in(0).reg();
3203 const VRegister result = locs()->out(0).fpu_reg(); 3239 const VRegister result = locs()->out(0).fpu_reg();
3204 3240
3205 if (value_cid != kFloat64x2Cid) { 3241 if (value_cid != kFloat64x2Cid) {
3206 Label* deopt = compiler->AddDeoptStub(deopt_id_, ICData::kDeoptCheckClass); 3242 Label* deopt = compiler->AddDeoptStub(deopt_id_, ICData::kDeoptCheckClass);
3207 __ tsti(value, kSmiTagMask); 3243 __ tsti(value, kSmiTagMask);
3208 __ b(deopt, EQ); 3244 __ b(deopt, EQ);
3209 __ CompareClassId(value, kFloat64x2Cid, PP); 3245 __ CompareClassId(value, kFloat64x2Cid, PP);
3210 __ b(deopt, NE); 3246 __ b(deopt, NE);
3211 } 3247 }
3212 3248
3213 __ LoadQFieldFromOffset(result, value, Float64x2::value_offset(), PP); 3249 __ LoadQFieldFromOffset(result, value, Float64x2::value_offset(), PP);
3214 } 3250 }
3215 3251
3216 3252
3217 LocationSummary* BoxInt32x4Instr::MakeLocationSummary(bool opt) const { 3253 LocationSummary* BoxInt32x4Instr::MakeLocationSummary(Isolate* isolate,
3254 bool opt) const {
3218 const intptr_t kNumInputs = 1; 3255 const intptr_t kNumInputs = 1;
3219 const intptr_t kNumTemps = 0; 3256 const intptr_t kNumTemps = 0;
3220 LocationSummary* summary = 3257 LocationSummary* summary = new(isolate) LocationSummary(
3221 new LocationSummary(kNumInputs, 3258 isolate, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath);
3222 kNumTemps,
3223 LocationSummary::kCallOnSlowPath);
3224 summary->set_in(0, Location::RequiresFpuRegister()); 3259 summary->set_in(0, Location::RequiresFpuRegister());
3225 summary->set_out(0, Location::RequiresRegister()); 3260 summary->set_out(0, Location::RequiresRegister());
3226 return summary; 3261 return summary;
3227 } 3262 }
3228 3263
3229 3264
3230 class BoxInt32x4SlowPath : public SlowPathCode { 3265 class BoxInt32x4SlowPath : public SlowPathCode {
3231 public: 3266 public:
3232 explicit BoxInt32x4SlowPath(BoxInt32x4Instr* instruction) 3267 explicit BoxInt32x4SlowPath(BoxInt32x4Instr* instruction)
3233 : instruction_(instruction) { } 3268 : instruction_(instruction) { }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3269 __ TryAllocate(compiler->int32x4_class(), 3304 __ TryAllocate(compiler->int32x4_class(),
3270 slow_path->entry_label(), 3305 slow_path->entry_label(),
3271 out_reg, 3306 out_reg,
3272 PP); 3307 PP);
3273 __ Bind(slow_path->exit_label()); 3308 __ Bind(slow_path->exit_label());
3274 3309
3275 __ StoreQFieldToOffset(value, out_reg, Int32x4::value_offset(), PP); 3310 __ StoreQFieldToOffset(value, out_reg, Int32x4::value_offset(), PP);
3276 } 3311 }
3277 3312
3278 3313
3279 LocationSummary* UnboxInt32x4Instr::MakeLocationSummary(bool opt) const { 3314 LocationSummary* UnboxInt32x4Instr::MakeLocationSummary(Isolate* isolate,
3315 bool opt) const {
3280 const intptr_t kNumInputs = 1; 3316 const intptr_t kNumInputs = 1;
3281 const intptr_t kNumTemps = 0; 3317 const intptr_t kNumTemps = 0;
3282 LocationSummary* summary = 3318 LocationSummary* summary = new(isolate) LocationSummary(
3283 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3319 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3284 summary->set_in(0, Location::RequiresRegister()); 3320 summary->set_in(0, Location::RequiresRegister());
3285 summary->set_out(0, Location::RequiresFpuRegister()); 3321 summary->set_out(0, Location::RequiresFpuRegister());
3286 return summary; 3322 return summary;
3287 } 3323 }
3288 3324
3289 3325
3290 void UnboxInt32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 3326 void UnboxInt32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
3291 const intptr_t value_cid = value()->Type()->ToCid(); 3327 const intptr_t value_cid = value()->Type()->ToCid();
3292 const Register value = locs()->in(0).reg(); 3328 const Register value = locs()->in(0).reg();
3293 const VRegister result = locs()->out(0).fpu_reg(); 3329 const VRegister result = locs()->out(0).fpu_reg();
3294 3330
3295 if (value_cid != kInt32x4Cid) { 3331 if (value_cid != kInt32x4Cid) {
3296 Label* deopt = compiler->AddDeoptStub(deopt_id_, ICData::kDeoptCheckClass); 3332 Label* deopt = compiler->AddDeoptStub(deopt_id_, ICData::kDeoptCheckClass);
3297 __ tsti(value, kSmiTagMask); 3333 __ tsti(value, kSmiTagMask);
3298 __ b(deopt, EQ); 3334 __ b(deopt, EQ);
3299 __ CompareClassId(value, kInt32x4Cid, PP); 3335 __ CompareClassId(value, kInt32x4Cid, PP);
3300 __ b(deopt, NE); 3336 __ b(deopt, NE);
3301 } 3337 }
3302 3338
3303 __ LoadQFieldFromOffset(result, value, Int32x4::value_offset(), PP); 3339 __ LoadQFieldFromOffset(result, value, Int32x4::value_offset(), PP);
3304 } 3340 }
3305 3341
3306 3342
3307 LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary(bool opt) const { 3343 LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary(Isolate* isolate,
3344 bool opt) const {
3308 const intptr_t kNumInputs = 2; 3345 const intptr_t kNumInputs = 2;
3309 const intptr_t kNumTemps = 0; 3346 const intptr_t kNumTemps = 0;
3310 LocationSummary* summary = 3347 LocationSummary* summary = new(isolate) LocationSummary(
3311 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3348 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3312 summary->set_in(0, Location::RequiresFpuRegister()); 3349 summary->set_in(0, Location::RequiresFpuRegister());
3313 summary->set_in(1, Location::RequiresFpuRegister()); 3350 summary->set_in(1, Location::RequiresFpuRegister());
3314 summary->set_out(0, Location::RequiresFpuRegister()); 3351 summary->set_out(0, Location::RequiresFpuRegister());
3315 return summary; 3352 return summary;
3316 } 3353 }
3317 3354
3318 3355
3319 void BinaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3356 void BinaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3320 const VRegister left = locs()->in(0).fpu_reg(); 3357 const VRegister left = locs()->in(0).fpu_reg();
3321 const VRegister right = locs()->in(1).fpu_reg(); 3358 const VRegister right = locs()->in(1).fpu_reg();
3322 const VRegister result = locs()->out(0).fpu_reg(); 3359 const VRegister result = locs()->out(0).fpu_reg();
3323 switch (op_kind()) { 3360 switch (op_kind()) {
3324 case Token::kADD: __ faddd(result, left, right); break; 3361 case Token::kADD: __ faddd(result, left, right); break;
3325 case Token::kSUB: __ fsubd(result, left, right); break; 3362 case Token::kSUB: __ fsubd(result, left, right); break;
3326 case Token::kMUL: __ fmuld(result, left, right); break; 3363 case Token::kMUL: __ fmuld(result, left, right); break;
3327 case Token::kDIV: __ fdivd(result, left, right); break; 3364 case Token::kDIV: __ fdivd(result, left, right); break;
3328 default: UNREACHABLE(); 3365 default: UNREACHABLE();
3329 } 3366 }
3330 } 3367 }
3331 3368
3332 3369
3333 LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(bool opt) const { 3370 LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Isolate* isolate,
3371 bool opt) const {
3334 const intptr_t kNumInputs = 2; 3372 const intptr_t kNumInputs = 2;
3335 const intptr_t kNumTemps = 0; 3373 const intptr_t kNumTemps = 0;
3336 LocationSummary* summary = 3374 LocationSummary* summary = new(isolate) LocationSummary(
3337 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3375 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3338 summary->set_in(0, Location::RequiresFpuRegister()); 3376 summary->set_in(0, Location::RequiresFpuRegister());
3339 summary->set_in(1, Location::RequiresFpuRegister()); 3377 summary->set_in(1, Location::RequiresFpuRegister());
3340 summary->set_out(0, Location::RequiresFpuRegister()); 3378 summary->set_out(0, Location::RequiresFpuRegister());
3341 return summary; 3379 return summary;
3342 } 3380 }
3343 3381
3344 3382
3345 void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3383 void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3346 const VRegister left = locs()->in(0).fpu_reg(); 3384 const VRegister left = locs()->in(0).fpu_reg();
3347 const VRegister right = locs()->in(1).fpu_reg(); 3385 const VRegister right = locs()->in(1).fpu_reg();
3348 const VRegister result = locs()->out(0).fpu_reg(); 3386 const VRegister result = locs()->out(0).fpu_reg();
3349 3387
3350 switch (op_kind()) { 3388 switch (op_kind()) {
3351 case Token::kADD: __ vadds(result, left, right); break; 3389 case Token::kADD: __ vadds(result, left, right); break;
3352 case Token::kSUB: __ vsubs(result, left, right); break; 3390 case Token::kSUB: __ vsubs(result, left, right); break;
3353 case Token::kMUL: __ vmuls(result, left, right); break; 3391 case Token::kMUL: __ vmuls(result, left, right); break;
3354 case Token::kDIV: __ vdivs(result, left, right); break; 3392 case Token::kDIV: __ vdivs(result, left, right); break;
3355 default: UNREACHABLE(); 3393 default: UNREACHABLE();
3356 } 3394 }
3357 } 3395 }
3358 3396
3359 3397
3360 LocationSummary* BinaryFloat64x2OpInstr::MakeLocationSummary(bool opt) const { 3398 LocationSummary* BinaryFloat64x2OpInstr::MakeLocationSummary(Isolate* isolate,
3399 bool opt) const {
3361 const intptr_t kNumInputs = 2; 3400 const intptr_t kNumInputs = 2;
3362 const intptr_t kNumTemps = 0; 3401 const intptr_t kNumTemps = 0;
3363 LocationSummary* summary = 3402 LocationSummary* summary = new(isolate) LocationSummary(
3364 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3403 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3365 summary->set_in(0, Location::RequiresFpuRegister()); 3404 summary->set_in(0, Location::RequiresFpuRegister());
3366 summary->set_in(1, Location::RequiresFpuRegister()); 3405 summary->set_in(1, Location::RequiresFpuRegister());
3367 summary->set_out(0, Location::RequiresFpuRegister()); 3406 summary->set_out(0, Location::RequiresFpuRegister());
3368 return summary; 3407 return summary;
3369 } 3408 }
3370 3409
3371 3410
3372 void BinaryFloat64x2OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3411 void BinaryFloat64x2OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3373 const VRegister left = locs()->in(0).fpu_reg(); 3412 const VRegister left = locs()->in(0).fpu_reg();
3374 const VRegister right = locs()->in(1).fpu_reg(); 3413 const VRegister right = locs()->in(1).fpu_reg();
3375 const VRegister result = locs()->out(0).fpu_reg(); 3414 const VRegister result = locs()->out(0).fpu_reg();
3376 3415
3377 switch (op_kind()) { 3416 switch (op_kind()) {
3378 case Token::kADD: __ vaddd(result, left, right); break; 3417 case Token::kADD: __ vaddd(result, left, right); break;
3379 case Token::kSUB: __ vsubd(result, left, right); break; 3418 case Token::kSUB: __ vsubd(result, left, right); break;
3380 case Token::kMUL: __ vmuld(result, left, right); break; 3419 case Token::kMUL: __ vmuld(result, left, right); break;
3381 case Token::kDIV: __ vdivd(result, left, right); break; 3420 case Token::kDIV: __ vdivd(result, left, right); break;
3382 default: UNREACHABLE(); 3421 default: UNREACHABLE();
3383 } 3422 }
3384 } 3423 }
3385 3424
3386 3425
3387 LocationSummary* Simd32x4ShuffleInstr::MakeLocationSummary(bool opt) const { 3426 LocationSummary* Simd32x4ShuffleInstr::MakeLocationSummary(Isolate* isolate,
3427 bool opt) const {
3388 UNIMPLEMENTED(); 3428 UNIMPLEMENTED();
3389 return NULL; 3429 return NULL;
3390 } 3430 }
3391 3431
3392 3432
3393 void Simd32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3433 void Simd32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3394 UNIMPLEMENTED(); 3434 UNIMPLEMENTED();
3395 } 3435 }
3396 3436
3397 3437
3398 LocationSummary* Simd32x4ShuffleMixInstr::MakeLocationSummary(bool opt) const { 3438 LocationSummary* Simd32x4ShuffleMixInstr::MakeLocationSummary(Isolate* isolate,
3439 bool opt) const {
3399 UNIMPLEMENTED(); 3440 UNIMPLEMENTED();
3400 return NULL; 3441 return NULL;
3401 } 3442 }
3402 3443
3403 3444
3404 void Simd32x4ShuffleMixInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3445 void Simd32x4ShuffleMixInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3405 UNIMPLEMENTED(); 3446 UNIMPLEMENTED();
3406 } 3447 }
3407 3448
3408 3449
3409 LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary(bool opt) const { 3450 LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary(Isolate* isolate,
3451 bool opt) const {
3410 UNIMPLEMENTED(); 3452 UNIMPLEMENTED();
3411 return NULL; 3453 return NULL;
3412 } 3454 }
3413 3455
3414 3456
3415 void Simd32x4GetSignMaskInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3457 void Simd32x4GetSignMaskInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3416 UNIMPLEMENTED(); 3458 UNIMPLEMENTED();
3417 } 3459 }
3418 3460
3419 3461
3420 LocationSummary* Float32x4ConstructorInstr::MakeLocationSummary( 3462 LocationSummary* Float32x4ConstructorInstr::MakeLocationSummary(
3421 bool opt) const { 3463 Isolate* isolate, bool opt) const {
3422 const intptr_t kNumInputs = 4; 3464 const intptr_t kNumInputs = 4;
3423 const intptr_t kNumTemps = 0; 3465 const intptr_t kNumTemps = 0;
3424 LocationSummary* summary = 3466 LocationSummary* summary = new(isolate) LocationSummary(
3425 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3467 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3426 summary->set_in(0, Location::RequiresFpuRegister()); 3468 summary->set_in(0, Location::RequiresFpuRegister());
3427 summary->set_in(1, Location::RequiresFpuRegister()); 3469 summary->set_in(1, Location::RequiresFpuRegister());
3428 summary->set_in(2, Location::RequiresFpuRegister()); 3470 summary->set_in(2, Location::RequiresFpuRegister());
3429 summary->set_in(3, Location::RequiresFpuRegister()); 3471 summary->set_in(3, Location::RequiresFpuRegister());
3430 summary->set_out(0, Location::RequiresFpuRegister()); 3472 summary->set_out(0, Location::RequiresFpuRegister());
3431 return summary; 3473 return summary;
3432 } 3474 }
3433 3475
3434 3476
3435 void Float32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3477 void Float32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3436 const VRegister v0 = locs()->in(0).fpu_reg(); 3478 const VRegister v0 = locs()->in(0).fpu_reg();
3437 const VRegister v1 = locs()->in(1).fpu_reg(); 3479 const VRegister v1 = locs()->in(1).fpu_reg();
3438 const VRegister v2 = locs()->in(2).fpu_reg(); 3480 const VRegister v2 = locs()->in(2).fpu_reg();
3439 const VRegister v3 = locs()->in(3).fpu_reg(); 3481 const VRegister v3 = locs()->in(3).fpu_reg();
3440 const VRegister r = locs()->out(0).fpu_reg(); 3482 const VRegister r = locs()->out(0).fpu_reg();
3441 3483
3442 __ fcvtsd(v0, v0); 3484 __ fcvtsd(v0, v0);
3443 __ vinss(r, 0, v0, 0); 3485 __ vinss(r, 0, v0, 0);
3444 __ fcvtsd(v1, v1); 3486 __ fcvtsd(v1, v1);
3445 __ vinss(r, 1, v1, 1); 3487 __ vinss(r, 1, v1, 1);
3446 __ fcvtsd(v2, v2); 3488 __ fcvtsd(v2, v2);
3447 __ vinss(r, 2, v2, 2); 3489 __ vinss(r, 2, v2, 2);
3448 __ fcvtsd(v3, v3); 3490 __ fcvtsd(v3, v3);
3449 __ vinss(r, 3, v3, 3); 3491 __ vinss(r, 3, v3, 3);
3450 } 3492 }
3451 3493
3452 3494
3453 LocationSummary* Float32x4ZeroInstr::MakeLocationSummary(bool opt) const { 3495 LocationSummary* Float32x4ZeroInstr::MakeLocationSummary(Isolate* isolate,
3496 bool opt) const {
3454 const intptr_t kNumInputs = 0; 3497 const intptr_t kNumInputs = 0;
3455 const intptr_t kNumTemps = 0; 3498 const intptr_t kNumTemps = 0;
3456 LocationSummary* summary = 3499 LocationSummary* summary = new(isolate) LocationSummary(
3457 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3500 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3458 summary->set_out(0, Location::RequiresFpuRegister()); 3501 summary->set_out(0, Location::RequiresFpuRegister());
3459 return summary; 3502 return summary;
3460 } 3503 }
3461 3504
3462 3505
3463 void Float32x4ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3506 void Float32x4ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3464 const VRegister v = locs()->out(0).fpu_reg(); 3507 const VRegister v = locs()->out(0).fpu_reg();
3465 __ LoadDImmediate(v, 0.0, PP); 3508 __ LoadDImmediate(v, 0.0, PP);
3466 } 3509 }
3467 3510
3468 3511
3469 LocationSummary* Float32x4SplatInstr::MakeLocationSummary(bool opt) const { 3512 LocationSummary* Float32x4SplatInstr::MakeLocationSummary(Isolate* isolate,
3513 bool opt) const {
3470 const intptr_t kNumInputs = 1; 3514 const intptr_t kNumInputs = 1;
3471 const intptr_t kNumTemps = 0; 3515 const intptr_t kNumTemps = 0;
3472 LocationSummary* summary = 3516 LocationSummary* summary = new(isolate) LocationSummary(
3473 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3517 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3474 summary->set_in(0, Location::RequiresFpuRegister()); 3518 summary->set_in(0, Location::RequiresFpuRegister());
3475 summary->set_out(0, Location::RequiresFpuRegister()); 3519 summary->set_out(0, Location::RequiresFpuRegister());
3476 return summary; 3520 return summary;
3477 } 3521 }
3478 3522
3479 3523
3480 void Float32x4SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3524 void Float32x4SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3481 const VRegister value = locs()->in(0).fpu_reg(); 3525 const VRegister value = locs()->in(0).fpu_reg();
3482 const VRegister result = locs()->out(0).fpu_reg(); 3526 const VRegister result = locs()->out(0).fpu_reg();
3483 3527
3484 // Convert to Float32. 3528 // Convert to Float32.
3485 __ fcvtsd(VTMP, value); 3529 __ fcvtsd(VTMP, value);
3486 3530
3487 // Splat across all lanes. 3531 // Splat across all lanes.
3488 __ vdups(result, VTMP, 0); 3532 __ vdups(result, VTMP, 0);
3489 } 3533 }
3490 3534
3491 3535
3492 LocationSummary* Float32x4ComparisonInstr::MakeLocationSummary(bool opt) const { 3536 LocationSummary* Float32x4ComparisonInstr::MakeLocationSummary(Isolate* isolate,
3537 bool opt) const {
3493 UNIMPLEMENTED(); 3538 UNIMPLEMENTED();
3494 return NULL; 3539 return NULL;
3495 } 3540 }
3496 3541
3497 3542
3498 void Float32x4ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3543 void Float32x4ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3499 UNIMPLEMENTED(); 3544 UNIMPLEMENTED();
3500 } 3545 }
3501 3546
3502 3547
3503 LocationSummary* Float32x4MinMaxInstr::MakeLocationSummary(bool opt) const { 3548 LocationSummary* Float32x4MinMaxInstr::MakeLocationSummary(Isolate* isolate,
3549 bool opt) const {
3504 UNIMPLEMENTED(); 3550 UNIMPLEMENTED();
3505 return NULL; 3551 return NULL;
3506 } 3552 }
3507 3553
3508 3554
3509 void Float32x4MinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3555 void Float32x4MinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3510 UNIMPLEMENTED(); 3556 UNIMPLEMENTED();
3511 } 3557 }
3512 3558
3513 3559
3514 LocationSummary* Float32x4SqrtInstr::MakeLocationSummary(bool opt) const { 3560 LocationSummary* Float32x4SqrtInstr::MakeLocationSummary(Isolate* isolate,
3561 bool opt) const {
3515 UNIMPLEMENTED(); 3562 UNIMPLEMENTED();
3516 return NULL; 3563 return NULL;
3517 } 3564 }
3518 3565
3519 3566
3520 void Float32x4SqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3567 void Float32x4SqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3521 UNIMPLEMENTED(); 3568 UNIMPLEMENTED();
3522 } 3569 }
3523 3570
3524 3571
3525 LocationSummary* Float32x4ScaleInstr::MakeLocationSummary(bool opt) const { 3572 LocationSummary* Float32x4ScaleInstr::MakeLocationSummary(Isolate* isolate,
3573 bool opt) const {
3526 const intptr_t kNumInputs = 2; 3574 const intptr_t kNumInputs = 2;
3527 const intptr_t kNumTemps = 0; 3575 const intptr_t kNumTemps = 0;
3528 LocationSummary* summary = 3576 LocationSummary* summary = new(isolate) LocationSummary(
3529 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3577 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3530 summary->set_in(0, Location::RequiresFpuRegister()); 3578 summary->set_in(0, Location::RequiresFpuRegister());
3531 summary->set_in(1, Location::RequiresFpuRegister()); 3579 summary->set_in(1, Location::RequiresFpuRegister());
3532 summary->set_out(0, Location::RequiresFpuRegister()); 3580 summary->set_out(0, Location::RequiresFpuRegister());
3533 return summary; 3581 return summary;
3534 } 3582 }
3535 3583
3536 3584
3537 void Float32x4ScaleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3585 void Float32x4ScaleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3538 const VRegister left = locs()->in(0).fpu_reg(); 3586 const VRegister left = locs()->in(0).fpu_reg();
3539 const VRegister right = locs()->in(1).fpu_reg(); 3587 const VRegister right = locs()->in(1).fpu_reg();
3540 const VRegister result = locs()->out(0).fpu_reg(); 3588 const VRegister result = locs()->out(0).fpu_reg();
3541 3589
3542 switch (op_kind()) { 3590 switch (op_kind()) {
3543 case MethodRecognizer::kFloat32x4Scale: 3591 case MethodRecognizer::kFloat32x4Scale:
3544 __ fcvtsd(VTMP, left); 3592 __ fcvtsd(VTMP, left);
3545 __ vdups(result, VTMP, 0); 3593 __ vdups(result, VTMP, 0);
3546 __ vmuls(result, result, right); 3594 __ vmuls(result, result, right);
3547 break; 3595 break;
3548 default: UNREACHABLE(); 3596 default: UNREACHABLE();
3549 } 3597 }
3550 } 3598 }
3551 3599
3552 3600
3553 LocationSummary* Float32x4ZeroArgInstr::MakeLocationSummary(bool opt) const { 3601 LocationSummary* Float32x4ZeroArgInstr::MakeLocationSummary(Isolate* isolate,
3602 bool opt) const {
3554 UNIMPLEMENTED(); 3603 UNIMPLEMENTED();
3555 return NULL; 3604 return NULL;
3556 } 3605 }
3557 3606
3558 3607
3559 void Float32x4ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3608 void Float32x4ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3560 UNIMPLEMENTED(); 3609 UNIMPLEMENTED();
3561 } 3610 }
3562 3611
3563 3612
3564 LocationSummary* Float32x4ClampInstr::MakeLocationSummary(bool opt) const { 3613 LocationSummary* Float32x4ClampInstr::MakeLocationSummary(Isolate* isolate,
3614 bool opt) const {
3565 UNIMPLEMENTED(); 3615 UNIMPLEMENTED();
3566 return NULL; 3616 return NULL;
3567 } 3617 }
3568 3618
3569 3619
3570 void Float32x4ClampInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3620 void Float32x4ClampInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3571 UNIMPLEMENTED(); 3621 UNIMPLEMENTED();
3572 } 3622 }
3573 3623
3574 3624
3575 LocationSummary* Float32x4WithInstr::MakeLocationSummary(bool opt) const { 3625 LocationSummary* Float32x4WithInstr::MakeLocationSummary(Isolate* isolate,
3626 bool opt) const {
3576 UNIMPLEMENTED(); 3627 UNIMPLEMENTED();
3577 return NULL; 3628 return NULL;
3578 } 3629 }
3579 3630
3580 3631
3581 void Float32x4WithInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3632 void Float32x4WithInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3582 UNIMPLEMENTED(); 3633 UNIMPLEMENTED();
3583 } 3634 }
3584 3635
3585 3636
3586 LocationSummary* Float32x4ToInt32x4Instr::MakeLocationSummary(bool opt) const { 3637 LocationSummary* Float32x4ToInt32x4Instr::MakeLocationSummary(Isolate* isolate,
3638 bool opt) const {
3587 UNIMPLEMENTED(); 3639 UNIMPLEMENTED();
3588 return NULL; 3640 return NULL;
3589 } 3641 }
3590 3642
3591 3643
3592 void Float32x4ToInt32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 3644 void Float32x4ToInt32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
3593 UNIMPLEMENTED(); 3645 UNIMPLEMENTED();
3594 } 3646 }
3595 3647
3596 3648
3597 LocationSummary* Simd64x2ShuffleInstr::MakeLocationSummary(bool opt) const { 3649 LocationSummary* Simd64x2ShuffleInstr::MakeLocationSummary(Isolate* isolate,
3650 bool opt) const {
3598 const intptr_t kNumInputs = 1; 3651 const intptr_t kNumInputs = 1;
3599 const intptr_t kNumTemps = 0; 3652 const intptr_t kNumTemps = 0;
3600 LocationSummary* summary = 3653 LocationSummary* summary = new(isolate) LocationSummary(
3601 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3654 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3602 summary->set_in(0, Location::RequiresFpuRegister()); 3655 summary->set_in(0, Location::RequiresFpuRegister());
3603 summary->set_out(0, Location::RequiresFpuRegister()); 3656 summary->set_out(0, Location::RequiresFpuRegister());
3604 return summary; 3657 return summary;
3605 } 3658 }
3606 3659
3607 3660
3608 void Simd64x2ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3661 void Simd64x2ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3609 const VRegister value = locs()->in(0).fpu_reg(); 3662 const VRegister value = locs()->in(0).fpu_reg();
3610 const VRegister result = locs()->out(0).fpu_reg(); 3663 const VRegister result = locs()->out(0).fpu_reg();
3611 3664
3612 switch (op_kind()) { 3665 switch (op_kind()) {
3613 case MethodRecognizer::kFloat64x2GetX: 3666 case MethodRecognizer::kFloat64x2GetX:
3614 __ vinsd(result, 0, value, 0); 3667 __ vinsd(result, 0, value, 0);
3615 break; 3668 break;
3616 case MethodRecognizer::kFloat64x2GetY: 3669 case MethodRecognizer::kFloat64x2GetY:
3617 __ vinsd(result, 0, value, 1); 3670 __ vinsd(result, 0, value, 1);
3618 break; 3671 break;
3619 default: UNREACHABLE(); 3672 default: UNREACHABLE();
3620 } 3673 }
3621 } 3674 }
3622 3675
3623 3676
3624 LocationSummary* Float64x2ZeroInstr::MakeLocationSummary(bool opt) const { 3677 LocationSummary* Float64x2ZeroInstr::MakeLocationSummary(Isolate* isolate,
3678 bool opt) const {
3625 const intptr_t kNumInputs = 0; 3679 const intptr_t kNumInputs = 0;
3626 const intptr_t kNumTemps = 0; 3680 const intptr_t kNumTemps = 0;
3627 LocationSummary* summary = 3681 LocationSummary* summary = new(isolate) LocationSummary(
3628 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3682 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3629 summary->set_out(0, Location::RequiresFpuRegister()); 3683 summary->set_out(0, Location::RequiresFpuRegister());
3630 return summary; 3684 return summary;
3631 } 3685 }
3632 3686
3633 3687
3634 void Float64x2ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3688 void Float64x2ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3635 const VRegister v = locs()->out(0).fpu_reg(); 3689 const VRegister v = locs()->out(0).fpu_reg();
3636 __ LoadDImmediate(v, 0.0, PP); 3690 __ LoadDImmediate(v, 0.0, PP);
3637 } 3691 }
3638 3692
3639 3693
3640 LocationSummary* Float64x2SplatInstr::MakeLocationSummary(bool opt) const { 3694 LocationSummary* Float64x2SplatInstr::MakeLocationSummary(Isolate* isolate,
3695 bool opt) const {
3641 const intptr_t kNumInputs = 1; 3696 const intptr_t kNumInputs = 1;
3642 const intptr_t kNumTemps = 0; 3697 const intptr_t kNumTemps = 0;
3643 LocationSummary* summary = 3698 LocationSummary* summary = new(isolate) LocationSummary(
3644 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3699 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3645 summary->set_in(0, Location::RequiresFpuRegister()); 3700 summary->set_in(0, Location::RequiresFpuRegister());
3646 summary->set_out(0, Location::RequiresFpuRegister()); 3701 summary->set_out(0, Location::RequiresFpuRegister());
3647 return summary; 3702 return summary;
3648 } 3703 }
3649 3704
3650 3705
3651 void Float64x2SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3706 void Float64x2SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3652 const VRegister value = locs()->in(0).fpu_reg(); 3707 const VRegister value = locs()->in(0).fpu_reg();
3653 const VRegister result = locs()->out(0).fpu_reg(); 3708 const VRegister result = locs()->out(0).fpu_reg();
3654 __ vdupd(result, value, 0); 3709 __ vdupd(result, value, 0);
3655 } 3710 }
3656 3711
3657 3712
3658 LocationSummary* Float64x2ConstructorInstr::MakeLocationSummary( 3713 LocationSummary* Float64x2ConstructorInstr::MakeLocationSummary(
3659 bool opt) const { 3714 Isolate* isolate, bool opt) const {
3660 const intptr_t kNumInputs = 2; 3715 const intptr_t kNumInputs = 2;
3661 const intptr_t kNumTemps = 0; 3716 const intptr_t kNumTemps = 0;
3662 LocationSummary* summary = 3717 LocationSummary* summary = new(isolate) LocationSummary(
3663 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3718 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3664 summary->set_in(0, Location::RequiresFpuRegister()); 3719 summary->set_in(0, Location::RequiresFpuRegister());
3665 summary->set_in(1, Location::RequiresFpuRegister()); 3720 summary->set_in(1, Location::RequiresFpuRegister());
3666 summary->set_out(0, Location::RequiresFpuRegister()); 3721 summary->set_out(0, Location::RequiresFpuRegister());
3667 return summary; 3722 return summary;
3668 } 3723 }
3669 3724
3670 3725
3671 void Float64x2ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3726 void Float64x2ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3672 const VRegister v0 = locs()->in(0).fpu_reg(); 3727 const VRegister v0 = locs()->in(0).fpu_reg();
3673 const VRegister v1 = locs()->in(1).fpu_reg(); 3728 const VRegister v1 = locs()->in(1).fpu_reg();
3674 const VRegister r = locs()->out(0).fpu_reg(); 3729 const VRegister r = locs()->out(0).fpu_reg();
3675 __ vinsd(r, 0, v0, 0); 3730 __ vinsd(r, 0, v0, 0);
3676 __ vinsd(r, 0, v1, 0); 3731 __ vinsd(r, 0, v1, 0);
3677 } 3732 }
3678 3733
3679 3734
3680 LocationSummary* Float64x2ToFloat32x4Instr::MakeLocationSummary( 3735 LocationSummary* Float64x2ToFloat32x4Instr::MakeLocationSummary(
3681 bool opt) const { 3736 Isolate* isolate, bool opt) const {
3682 UNIMPLEMENTED(); 3737 UNIMPLEMENTED();
3683 return NULL; 3738 return NULL;
3684 } 3739 }
3685 3740
3686 3741
3687 void Float64x2ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 3742 void Float64x2ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
3688 UNIMPLEMENTED(); 3743 UNIMPLEMENTED();
3689 } 3744 }
3690 3745
3691 3746
3692 LocationSummary* Float32x4ToFloat64x2Instr::MakeLocationSummary( 3747 LocationSummary* Float32x4ToFloat64x2Instr::MakeLocationSummary(
3693 bool opt) const { 3748 Isolate* isolate, bool opt) const {
3694 UNIMPLEMENTED(); 3749 UNIMPLEMENTED();
3695 return NULL; 3750 return NULL;
3696 } 3751 }
3697 3752
3698 3753
3699 void Float32x4ToFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 3754 void Float32x4ToFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
3700 UNIMPLEMENTED(); 3755 UNIMPLEMENTED();
3701 } 3756 }
3702 3757
3703 3758
3704 LocationSummary* Float64x2ZeroArgInstr::MakeLocationSummary(bool opt) const { 3759 LocationSummary* Float64x2ZeroArgInstr::MakeLocationSummary(Isolate* isolate,
3760 bool opt) const {
3705 UNIMPLEMENTED(); 3761 UNIMPLEMENTED();
3706 return NULL; 3762 return NULL;
3707 } 3763 }
3708 3764
3709 3765
3710 void Float64x2ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3766 void Float64x2ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3711 UNIMPLEMENTED(); 3767 UNIMPLEMENTED();
3712 } 3768 }
3713 3769
3714 3770
3715 LocationSummary* Float64x2OneArgInstr::MakeLocationSummary(bool opt) const { 3771 LocationSummary* Float64x2OneArgInstr::MakeLocationSummary(Isolate* isolate,
3772 bool opt) const {
3716 UNIMPLEMENTED(); 3773 UNIMPLEMENTED();
3717 return NULL; 3774 return NULL;
3718 } 3775 }
3719 3776
3720 3777
3721 void Float64x2OneArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3778 void Float64x2OneArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3722 UNIMPLEMENTED(); 3779 UNIMPLEMENTED();
3723 } 3780 }
3724 3781
3725 3782
3726 LocationSummary* Int32x4BoolConstructorInstr::MakeLocationSummary( 3783 LocationSummary* Int32x4BoolConstructorInstr::MakeLocationSummary(
3727 bool opt) const { 3784 Isolate* isolate, bool opt) const {
3728 UNIMPLEMENTED(); 3785 UNIMPLEMENTED();
3729 return NULL; 3786 return NULL;
3730 } 3787 }
3731 3788
3732 3789
3733 void Int32x4BoolConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3790 void Int32x4BoolConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3734 UNIMPLEMENTED(); 3791 UNIMPLEMENTED();
3735 } 3792 }
3736 3793
3737 3794
3738 LocationSummary* Int32x4GetFlagInstr::MakeLocationSummary(bool opt) const { 3795 LocationSummary* Int32x4GetFlagInstr::MakeLocationSummary(Isolate* isolate,
3796 bool opt) const {
3739 UNIMPLEMENTED(); 3797 UNIMPLEMENTED();
3740 return NULL; 3798 return NULL;
3741 } 3799 }
3742 3800
3743 3801
3744 void Int32x4GetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3802 void Int32x4GetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3745 UNIMPLEMENTED(); 3803 UNIMPLEMENTED();
3746 } 3804 }
3747 3805
3748 3806
3749 LocationSummary* Int32x4SelectInstr::MakeLocationSummary(bool opt) const { 3807 LocationSummary* Int32x4SelectInstr::MakeLocationSummary(Isolate* isolate,
3808 bool opt) const {
3750 UNIMPLEMENTED(); 3809 UNIMPLEMENTED();
3751 return NULL; 3810 return NULL;
3752 } 3811 }
3753 3812
3754 3813
3755 void Int32x4SelectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3814 void Int32x4SelectInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3756 UNIMPLEMENTED(); 3815 UNIMPLEMENTED();
3757 } 3816 }
3758 3817
3759 3818
3760 LocationSummary* Int32x4SetFlagInstr::MakeLocationSummary(bool opt) const { 3819 LocationSummary* Int32x4SetFlagInstr::MakeLocationSummary(Isolate* isolate,
3820 bool opt) const {
3761 UNIMPLEMENTED(); 3821 UNIMPLEMENTED();
3762 return NULL; 3822 return NULL;
3763 } 3823 }
3764 3824
3765 3825
3766 void Int32x4SetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3826 void Int32x4SetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3767 UNIMPLEMENTED(); 3827 UNIMPLEMENTED();
3768 } 3828 }
3769 3829
3770 3830
3771 LocationSummary* Int32x4ToFloat32x4Instr::MakeLocationSummary(bool opt) const { 3831 LocationSummary* Int32x4ToFloat32x4Instr::MakeLocationSummary(Isolate* isolate,
3832 bool opt) const {
3772 UNIMPLEMENTED(); 3833 UNIMPLEMENTED();
3773 return NULL; 3834 return NULL;
3774 } 3835 }
3775 3836
3776 3837
3777 void Int32x4ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 3838 void Int32x4ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
3778 UNIMPLEMENTED(); 3839 UNIMPLEMENTED();
3779 } 3840 }
3780 3841
3781 3842
3782 LocationSummary* BinaryInt32x4OpInstr::MakeLocationSummary(bool opt) const { 3843 LocationSummary* BinaryInt32x4OpInstr::MakeLocationSummary(Isolate* isolate,
3844 bool opt) const {
3783 UNIMPLEMENTED(); 3845 UNIMPLEMENTED();
3784 return NULL; 3846 return NULL;
3785 } 3847 }
3786 3848
3787 3849
3788 void BinaryInt32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3850 void BinaryInt32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3789 UNIMPLEMENTED(); 3851 UNIMPLEMENTED();
3790 } 3852 }
3791 3853
3792 3854
3793 LocationSummary* MathUnaryInstr::MakeLocationSummary(bool opt) const { 3855 LocationSummary* MathUnaryInstr::MakeLocationSummary(Isolate* isolate,
3856 bool opt) const {
3794 if ((kind() == MathUnaryInstr::kSin) || (kind() == MathUnaryInstr::kCos)) { 3857 if ((kind() == MathUnaryInstr::kSin) || (kind() == MathUnaryInstr::kCos)) {
3795 const intptr_t kNumInputs = 1; 3858 const intptr_t kNumInputs = 1;
3796 const intptr_t kNumTemps = 0; 3859 const intptr_t kNumTemps = 0;
3797 LocationSummary* summary = 3860 LocationSummary* summary = new(isolate) LocationSummary(
3798 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 3861 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
3799 summary->set_in(0, Location::FpuRegisterLocation(V0)); 3862 summary->set_in(0, Location::FpuRegisterLocation(V0));
3800 summary->set_out(0, Location::FpuRegisterLocation(V0)); 3863 summary->set_out(0, Location::FpuRegisterLocation(V0));
3801 return summary; 3864 return summary;
3802 } 3865 }
3803 ASSERT((kind() == MathUnaryInstr::kSqrt) || 3866 ASSERT((kind() == MathUnaryInstr::kSqrt) ||
3804 (kind() == MathUnaryInstr::kDoubleSquare)); 3867 (kind() == MathUnaryInstr::kDoubleSquare));
3805 const intptr_t kNumInputs = 1; 3868 const intptr_t kNumInputs = 1;
3806 const intptr_t kNumTemps = 0; 3869 const intptr_t kNumTemps = 0;
3807 LocationSummary* summary = 3870 LocationSummary* summary = new(isolate) LocationSummary(
3808 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3871 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3809 summary->set_in(0, Location::RequiresFpuRegister()); 3872 summary->set_in(0, Location::RequiresFpuRegister());
3810 summary->set_out(0, Location::RequiresFpuRegister()); 3873 summary->set_out(0, Location::RequiresFpuRegister());
3811 return summary; 3874 return summary;
3812 } 3875 }
3813 3876
3814 3877
3815 void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3878 void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3816 if (kind() == MathUnaryInstr::kSqrt) { 3879 if (kind() == MathUnaryInstr::kSqrt) {
3817 const VRegister val = locs()->in(0).fpu_reg(); 3880 const VRegister val = locs()->in(0).fpu_reg();
3818 const VRegister result = locs()->out(0).fpu_reg(); 3881 const VRegister result = locs()->out(0).fpu_reg();
3819 __ fsqrtd(result, val); 3882 __ fsqrtd(result, val);
3820 } else if (kind() == MathUnaryInstr::kDoubleSquare) { 3883 } else if (kind() == MathUnaryInstr::kDoubleSquare) {
3821 const VRegister val = locs()->in(0).fpu_reg(); 3884 const VRegister val = locs()->in(0).fpu_reg();
3822 const VRegister result = locs()->out(0).fpu_reg(); 3885 const VRegister result = locs()->out(0).fpu_reg();
3823 __ fmuld(result, val, val); 3886 __ fmuld(result, val, val);
3824 } else { 3887 } else {
3825 ASSERT((kind() == MathUnaryInstr::kSin) || 3888 ASSERT((kind() == MathUnaryInstr::kSin) ||
3826 (kind() == MathUnaryInstr::kCos)); 3889 (kind() == MathUnaryInstr::kCos));
3827 __ CallRuntime(TargetFunction(), InputCount()); 3890 __ CallRuntime(TargetFunction(), InputCount());
3828 } 3891 }
3829 } 3892 }
3830 3893
3831 3894
3832 LocationSummary* MathMinMaxInstr::MakeLocationSummary(bool opt) const { 3895 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate,
3896 bool opt) const {
3833 if (result_cid() == kDoubleCid) { 3897 if (result_cid() == kDoubleCid) {
3834 const intptr_t kNumInputs = 2; 3898 const intptr_t kNumInputs = 2;
3835 const intptr_t kNumTemps = 0; 3899 const intptr_t kNumTemps = 0;
3836 LocationSummary* summary = 3900 LocationSummary* summary = new(isolate) LocationSummary(
3837 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3901 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3838 summary->set_in(0, Location::RequiresFpuRegister()); 3902 summary->set_in(0, Location::RequiresFpuRegister());
3839 summary->set_in(1, Location::RequiresFpuRegister()); 3903 summary->set_in(1, Location::RequiresFpuRegister());
3840 // Reuse the left register so that code can be made shorter. 3904 // Reuse the left register so that code can be made shorter.
3841 summary->set_out(0, Location::SameAsFirstInput()); 3905 summary->set_out(0, Location::SameAsFirstInput());
3842 return summary; 3906 return summary;
3843 } 3907 }
3844 ASSERT(result_cid() == kSmiCid); 3908 ASSERT(result_cid() == kSmiCid);
3845 const intptr_t kNumInputs = 2; 3909 const intptr_t kNumInputs = 2;
3846 const intptr_t kNumTemps = 0; 3910 const intptr_t kNumTemps = 0;
3847 LocationSummary* summary = 3911 LocationSummary* summary = new(isolate) LocationSummary(
3848 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3912 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3849 summary->set_in(0, Location::RequiresRegister()); 3913 summary->set_in(0, Location::RequiresRegister());
3850 summary->set_in(1, Location::RequiresRegister()); 3914 summary->set_in(1, Location::RequiresRegister());
3851 // Reuse the left register so that code can be made shorter. 3915 // Reuse the left register so that code can be made shorter.
3852 summary->set_out(0, Location::SameAsFirstInput()); 3916 summary->set_out(0, Location::SameAsFirstInput());
3853 return summary; 3917 return summary;
3854 } 3918 }
3855 3919
3856 3920
3857 void MathMinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3921 void MathMinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3858 ASSERT((op_kind() == MethodRecognizer::kMathMin) || 3922 ASSERT((op_kind() == MethodRecognizer::kMathMin) ||
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
3907 __ CompareRegisters(left, right); 3971 __ CompareRegisters(left, right);
3908 ASSERT(result == left); 3972 ASSERT(result == left);
3909 if (is_min) { 3973 if (is_min) {
3910 __ csel(result, right, left, GT); 3974 __ csel(result, right, left, GT);
3911 } else { 3975 } else {
3912 __ csel(result, right, left, LT); 3976 __ csel(result, right, left, LT);
3913 } 3977 }
3914 } 3978 }
3915 3979
3916 3980
3917 LocationSummary* UnarySmiOpInstr::MakeLocationSummary(bool opt) const { 3981 LocationSummary* UnarySmiOpInstr::MakeLocationSummary(Isolate* isolate,
3982 bool opt) const {
3918 const intptr_t kNumInputs = 1; 3983 const intptr_t kNumInputs = 1;
3919 const intptr_t kNumTemps = 0; 3984 const intptr_t kNumTemps = 0;
3920 LocationSummary* summary = 3985 LocationSummary* summary = new(isolate) LocationSummary(
3921 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3986 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3922 summary->set_in(0, Location::RequiresRegister()); 3987 summary->set_in(0, Location::RequiresRegister());
3923 // We make use of 3-operand instructions by not requiring result register 3988 // We make use of 3-operand instructions by not requiring result register
3924 // to be identical to first input register as on Intel. 3989 // to be identical to first input register as on Intel.
3925 summary->set_out(0, Location::RequiresRegister()); 3990 summary->set_out(0, Location::RequiresRegister());
3926 return summary; 3991 return summary;
3927 } 3992 }
3928 3993
3929 3994
3930 void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3995 void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3931 const Register value = locs()->in(0).reg(); 3996 const Register value = locs()->in(0).reg();
(...skipping 12 matching lines...) Expand all
3944 __ mvn(result, value); 4009 __ mvn(result, value);
3945 // Remove inverted smi-tag. 4010 // Remove inverted smi-tag.
3946 __ andi(result, result, ~kSmiTagMask); 4011 __ andi(result, result, ~kSmiTagMask);
3947 break; 4012 break;
3948 default: 4013 default:
3949 UNREACHABLE(); 4014 UNREACHABLE();
3950 } 4015 }
3951 } 4016 }
3952 4017
3953 4018
3954 LocationSummary* UnaryDoubleOpInstr::MakeLocationSummary(bool opt) const { 4019 LocationSummary* UnaryDoubleOpInstr::MakeLocationSummary(Isolate* isolate,
4020 bool opt) const {
3955 const intptr_t kNumInputs = 1; 4021 const intptr_t kNumInputs = 1;
3956 const intptr_t kNumTemps = 0; 4022 const intptr_t kNumTemps = 0;
3957 LocationSummary* summary = 4023 LocationSummary* summary = new(isolate) LocationSummary(
3958 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4024 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3959 summary->set_in(0, Location::RequiresFpuRegister()); 4025 summary->set_in(0, Location::RequiresFpuRegister());
3960 summary->set_out(0, Location::RequiresFpuRegister()); 4026 summary->set_out(0, Location::RequiresFpuRegister());
3961 return summary; 4027 return summary;
3962 } 4028 }
3963 4029
3964 4030
3965 void UnaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4031 void UnaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3966 const VRegister result = locs()->out(0).fpu_reg(); 4032 const VRegister result = locs()->out(0).fpu_reg();
3967 const VRegister value = locs()->in(0).fpu_reg(); 4033 const VRegister value = locs()->in(0).fpu_reg();
3968 __ fnegd(result, value); 4034 __ fnegd(result, value);
3969 } 4035 }
3970 4036
3971 4037
3972 LocationSummary* SmiToDoubleInstr::MakeLocationSummary(bool opt) const { 4038 LocationSummary* SmiToDoubleInstr::MakeLocationSummary(Isolate* isolate,
4039 bool opt) const {
3973 const intptr_t kNumInputs = 1; 4040 const intptr_t kNumInputs = 1;
3974 const intptr_t kNumTemps = 0; 4041 const intptr_t kNumTemps = 0;
3975 LocationSummary* result = 4042 LocationSummary* result = new(isolate) LocationSummary(
3976 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4043 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3977 result->set_in(0, Location::WritableRegister()); 4044 result->set_in(0, Location::WritableRegister());
3978 result->set_out(0, Location::RequiresFpuRegister()); 4045 result->set_out(0, Location::RequiresFpuRegister());
3979 return result; 4046 return result;
3980 } 4047 }
3981 4048
3982 4049
3983 void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4050 void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3984 const Register value = locs()->in(0).reg(); 4051 const Register value = locs()->in(0).reg();
3985 const VRegister result = locs()->out(0).fpu_reg(); 4052 const VRegister result = locs()->out(0).fpu_reg();
3986 __ SmiUntag(value); 4053 __ SmiUntag(value);
3987 __ scvtfd(result, value); 4054 __ scvtfd(result, value);
3988 } 4055 }
3989 4056
3990 4057
3991 LocationSummary* DoubleToIntegerInstr::MakeLocationSummary(bool opt) const { 4058 LocationSummary* DoubleToIntegerInstr::MakeLocationSummary(Isolate* isolate,
4059 bool opt) const {
3992 const intptr_t kNumInputs = 1; 4060 const intptr_t kNumInputs = 1;
3993 const intptr_t kNumTemps = 0; 4061 const intptr_t kNumTemps = 0;
3994 LocationSummary* result = 4062 LocationSummary* result = new(isolate) LocationSummary(
3995 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 4063 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
3996 result->set_in(0, Location::RegisterLocation(R1)); 4064 result->set_in(0, Location::RegisterLocation(R1));
3997 result->set_out(0, Location::RegisterLocation(R0)); 4065 result->set_out(0, Location::RegisterLocation(R0));
3998 return result; 4066 return result;
3999 } 4067 }
4000 4068
4001 4069
4002 void DoubleToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4070 void DoubleToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4003 const Register result = locs()->out(0).reg(); 4071 const Register result = locs()->out(0).reg();
4004 const Register value_obj = locs()->in(0).reg(); 4072 const Register value_obj = locs()->in(0).reg();
4005 ASSERT(result == R0); 4073 ASSERT(result == R0);
(...skipping 28 matching lines...) Expand all
4034 compiler->GenerateStaticCall(deopt_id(), 4102 compiler->GenerateStaticCall(deopt_id(),
4035 instance_call()->token_pos(), 4103 instance_call()->token_pos(),
4036 target, 4104 target,
4037 kNumberOfArguments, 4105 kNumberOfArguments,
4038 Object::null_array(), // No argument names., 4106 Object::null_array(), // No argument names.,
4039 locs()); 4107 locs());
4040 __ Bind(&done); 4108 __ Bind(&done);
4041 } 4109 }
4042 4110
4043 4111
4044 LocationSummary* DoubleToSmiInstr::MakeLocationSummary(bool opt) const { 4112 LocationSummary* DoubleToSmiInstr::MakeLocationSummary(Isolate* isolate,
4113 bool opt) const {
4045 const intptr_t kNumInputs = 1; 4114 const intptr_t kNumInputs = 1;
4046 const intptr_t kNumTemps = 0; 4115 const intptr_t kNumTemps = 0;
4047 LocationSummary* result = new LocationSummary( 4116 LocationSummary* result = new(isolate) LocationSummary(
4048 kNumInputs, kNumTemps, LocationSummary::kNoCall); 4117 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4049 result->set_in(0, Location::RequiresFpuRegister()); 4118 result->set_in(0, Location::RequiresFpuRegister());
4050 result->set_out(0, Location::RequiresRegister()); 4119 result->set_out(0, Location::RequiresRegister());
4051 return result; 4120 return result;
4052 } 4121 }
4053 4122
4054 4123
4055 void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4124 void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4056 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptDoubleToSmi); 4125 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptDoubleToSmi);
4057 const Register result = locs()->out(0).reg(); 4126 const Register result = locs()->out(0).reg();
4058 const VRegister value = locs()->in(0).fpu_reg(); 4127 const VRegister value = locs()->in(0).fpu_reg();
4059 // First check for NaN. Checking for minint after the conversion doesn't work 4128 // First check for NaN. Checking for minint after the conversion doesn't work
4060 // on ARM64 because fcvtzds gives 0 for NaN. 4129 // on ARM64 because fcvtzds gives 0 for NaN.
4061 // TODO(zra): Check spec that this is true. 4130 // TODO(zra): Check spec that this is true.
4062 __ fcmpd(value, value); 4131 __ fcmpd(value, value);
4063 __ b(deopt, VS); 4132 __ b(deopt, VS);
4064 4133
4065 __ fcvtzds(result, value); 4134 __ fcvtzds(result, value);
4066 // Check for overflow and that it fits into Smi. 4135 // Check for overflow and that it fits into Smi.
4067 __ CompareImmediate(result, 0xC000000000000000, PP); 4136 __ CompareImmediate(result, 0xC000000000000000, PP);
4068 __ b(deopt, MI); 4137 __ b(deopt, MI);
4069 __ SmiTag(result); 4138 __ SmiTag(result);
4070 if (FLAG_throw_on_javascript_int_overflow) { 4139 if (FLAG_throw_on_javascript_int_overflow) {
4071 EmitJavascriptOverflowCheck(compiler, range(), deopt, result); 4140 EmitJavascriptOverflowCheck(compiler, range(), deopt, result);
4072 } 4141 }
4073 } 4142 }
4074 4143
4075 4144
4076 LocationSummary* DoubleToDoubleInstr::MakeLocationSummary(bool opt) const { 4145 LocationSummary* DoubleToDoubleInstr::MakeLocationSummary(Isolate* isolate,
4146 bool opt) const {
4077 UNIMPLEMENTED(); 4147 UNIMPLEMENTED();
4078 return NULL; 4148 return NULL;
4079 } 4149 }
4080 4150
4081 4151
4082 void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4152 void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4083 UNIMPLEMENTED(); 4153 UNIMPLEMENTED();
4084 } 4154 }
4085 4155
4086 4156
4087 LocationSummary* DoubleToFloatInstr::MakeLocationSummary(bool opt) const { 4157 LocationSummary* DoubleToFloatInstr::MakeLocationSummary(Isolate* isolate,
4158 bool opt) const {
4088 const intptr_t kNumInputs = 1; 4159 const intptr_t kNumInputs = 1;
4089 const intptr_t kNumTemps = 0; 4160 const intptr_t kNumTemps = 0;
4090 LocationSummary* result = 4161 LocationSummary* result = new(isolate) LocationSummary(
4091 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4162 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4092 result->set_in(0, Location::RequiresFpuRegister()); 4163 result->set_in(0, Location::RequiresFpuRegister());
4093 result->set_out(0, Location::RequiresFpuRegister()); 4164 result->set_out(0, Location::RequiresFpuRegister());
4094 return result; 4165 return result;
4095 } 4166 }
4096 4167
4097 4168
4098 void DoubleToFloatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4169 void DoubleToFloatInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4099 const VRegister value = locs()->in(0).fpu_reg(); 4170 const VRegister value = locs()->in(0).fpu_reg();
4100 const VRegister result = locs()->out(0).fpu_reg(); 4171 const VRegister result = locs()->out(0).fpu_reg();
4101 __ fcvtsd(result, value); 4172 __ fcvtsd(result, value);
4102 } 4173 }
4103 4174
4104 4175
4105 LocationSummary* FloatToDoubleInstr::MakeLocationSummary(bool opt) const { 4176 LocationSummary* FloatToDoubleInstr::MakeLocationSummary(Isolate* isolate,
4177 bool opt) const {
4106 const intptr_t kNumInputs = 1; 4178 const intptr_t kNumInputs = 1;
4107 const intptr_t kNumTemps = 0; 4179 const intptr_t kNumTemps = 0;
4108 LocationSummary* result = 4180 LocationSummary* result = new(isolate) LocationSummary(
4109 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4181 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4110 result->set_in(0, Location::RequiresFpuRegister()); 4182 result->set_in(0, Location::RequiresFpuRegister());
4111 result->set_out(0, Location::RequiresFpuRegister()); 4183 result->set_out(0, Location::RequiresFpuRegister());
4112 return result; 4184 return result;
4113 } 4185 }
4114 4186
4115 4187
4116 void FloatToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4188 void FloatToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4117 const VRegister value = locs()->in(0).fpu_reg(); 4189 const VRegister value = locs()->in(0).fpu_reg();
4118 const VRegister result = locs()->out(0).fpu_reg(); 4190 const VRegister result = locs()->out(0).fpu_reg();
4119 __ fcvtds(result, value); 4191 __ fcvtds(result, value);
4120 } 4192 }
4121 4193
4122 4194
4123 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(bool opt) const { 4195 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(Isolate* isolate,
4196 bool opt) const {
4124 ASSERT((InputCount() == 1) || (InputCount() == 2)); 4197 ASSERT((InputCount() == 1) || (InputCount() == 2));
4125 const intptr_t kNumTemps = 0; 4198 const intptr_t kNumTemps = 0;
4126 LocationSummary* result = 4199 LocationSummary* result = new(isolate) LocationSummary(
4127 new LocationSummary(InputCount(), kNumTemps, LocationSummary::kCall); 4200 isolate, InputCount(), kNumTemps, LocationSummary::kCall);
4128 result->set_in(0, Location::FpuRegisterLocation(V0)); 4201 result->set_in(0, Location::FpuRegisterLocation(V0));
4129 if (InputCount() == 2) { 4202 if (InputCount() == 2) {
4130 result->set_in(1, Location::FpuRegisterLocation(V1)); 4203 result->set_in(1, Location::FpuRegisterLocation(V1));
4131 } 4204 }
4132 if (recognized_kind() == MethodRecognizer::kMathDoublePow) { 4205 if (recognized_kind() == MethodRecognizer::kMathDoublePow) {
4133 result->AddTemp(Location::FpuRegisterLocation(V30)); 4206 result->AddTemp(Location::FpuRegisterLocation(V30));
4134 } 4207 }
4135 result->set_out(0, Location::FpuRegisterLocation(V0)); 4208 result->set_out(0, Location::FpuRegisterLocation(V0));
4136 return result; 4209 return result;
4137 } 4210 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
4252 4325
4253 void InvokeMathCFunctionInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4326 void InvokeMathCFunctionInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4254 if (recognized_kind() == MethodRecognizer::kMathDoublePow) { 4327 if (recognized_kind() == MethodRecognizer::kMathDoublePow) {
4255 InvokeDoublePow(compiler, this); 4328 InvokeDoublePow(compiler, this);
4256 return; 4329 return;
4257 } 4330 }
4258 __ CallRuntime(TargetFunction(), InputCount()); 4331 __ CallRuntime(TargetFunction(), InputCount());
4259 } 4332 }
4260 4333
4261 4334
4262 LocationSummary* ExtractNthOutputInstr::MakeLocationSummary(bool opt) const { 4335 LocationSummary* ExtractNthOutputInstr::MakeLocationSummary(Isolate* isolate,
4336 bool opt) const {
4263 // Only use this instruction in optimized code. 4337 // Only use this instruction in optimized code.
4264 ASSERT(opt); 4338 ASSERT(opt);
4265 const intptr_t kNumInputs = 1; 4339 const intptr_t kNumInputs = 1;
4266 LocationSummary* summary = 4340 LocationSummary* summary = new(isolate) LocationSummary(
4267 new LocationSummary(kNumInputs, 0, LocationSummary::kNoCall); 4341 isolate, kNumInputs, 0, LocationSummary::kNoCall);
4268 if (representation() == kUnboxedDouble) { 4342 if (representation() == kUnboxedDouble) {
4269 if (index() == 0) { 4343 if (index() == 0) {
4270 summary->set_in(0, Location::Pair(Location::RequiresFpuRegister(), 4344 summary->set_in(0, Location::Pair(Location::RequiresFpuRegister(),
4271 Location::Any())); 4345 Location::Any()));
4272 } else { 4346 } else {
4273 ASSERT(index() == 1); 4347 ASSERT(index() == 1);
4274 summary->set_in(0, Location::Pair(Location::Any(), 4348 summary->set_in(0, Location::Pair(Location::Any(),
4275 Location::RequiresFpuRegister())); 4349 Location::RequiresFpuRegister()));
4276 } 4350 }
4277 summary->set_out(0, Location::RequiresFpuRegister()); 4351 summary->set_out(0, Location::RequiresFpuRegister());
(...skipping 23 matching lines...) Expand all
4301 __ fmovdd(out, in); 4375 __ fmovdd(out, in);
4302 } else { 4376 } else {
4303 ASSERT(representation() == kTagged); 4377 ASSERT(representation() == kTagged);
4304 const Register out = locs()->out(0).reg(); 4378 const Register out = locs()->out(0).reg();
4305 const Register in = in_loc.reg(); 4379 const Register in = in_loc.reg();
4306 __ mov(out, in); 4380 __ mov(out, in);
4307 } 4381 }
4308 } 4382 }
4309 4383
4310 4384
4311 LocationSummary* MergedMathInstr::MakeLocationSummary(bool opt) const { 4385 LocationSummary* MergedMathInstr::MakeLocationSummary(Isolate* isolate,
4386 bool opt) const {
4312 if (kind() == MergedMathInstr::kTruncDivMod) { 4387 if (kind() == MergedMathInstr::kTruncDivMod) {
4313 const intptr_t kNumInputs = 2; 4388 const intptr_t kNumInputs = 2;
4314 const intptr_t kNumTemps = 0; 4389 const intptr_t kNumTemps = 0;
4315 LocationSummary* summary = 4390 LocationSummary* summary = new(isolate) LocationSummary(
4316 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4391 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4317 summary->set_in(0, Location::RequiresRegister()); 4392 summary->set_in(0, Location::RequiresRegister());
4318 summary->set_in(1, Location::RequiresRegister()); 4393 summary->set_in(1, Location::RequiresRegister());
4319 // Output is a pair of registers. 4394 // Output is a pair of registers.
4320 summary->set_out(0, Location::Pair(Location::RequiresRegister(), 4395 summary->set_out(0, Location::Pair(Location::RequiresRegister(),
4321 Location::RequiresRegister())); 4396 Location::RequiresRegister()));
4322 return summary; 4397 return summary;
4323 } 4398 }
4324 UNIMPLEMENTED(); 4399 UNIMPLEMENTED();
4325 return NULL; 4400 return NULL;
4326 } 4401 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
4382 return; 4457 return;
4383 } 4458 }
4384 if (kind() == MergedMathInstr::kSinCos) { 4459 if (kind() == MergedMathInstr::kSinCos) {
4385 UNIMPLEMENTED(); 4460 UNIMPLEMENTED();
4386 } 4461 }
4387 UNIMPLEMENTED(); 4462 UNIMPLEMENTED();
4388 } 4463 }
4389 4464
4390 4465
4391 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary( 4466 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary(
4392 bool opt) const { 4467 Isolate* isolate, bool opt) const {
4393 return MakeCallSummary(); 4468 return MakeCallSummary();
4394 } 4469 }
4395 4470
4396 4471
4397 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4472 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4398 Label* deopt = compiler->AddDeoptStub( 4473 Label* deopt = compiler->AddDeoptStub(
4399 deopt_id(), ICData::kDeoptPolymorphicInstanceCallTestFail); 4474 deopt_id(), ICData::kDeoptPolymorphicInstanceCallTestFail);
4400 if (ic_data().NumberOfChecks() == 0) { 4475 if (ic_data().NumberOfChecks() == 0) {
4401 __ b(deopt); 4476 __ b(deopt);
4402 return; 4477 return;
(...skipping 22 matching lines...) Expand all
4425 R2, // Class id register. 4500 R2, // Class id register.
4426 instance_call()->ArgumentCount(), 4501 instance_call()->ArgumentCount(),
4427 instance_call()->argument_names(), 4502 instance_call()->argument_names(),
4428 deopt, 4503 deopt,
4429 deopt_id(), 4504 deopt_id(),
4430 instance_call()->token_pos(), 4505 instance_call()->token_pos(),
4431 locs()); 4506 locs());
4432 } 4507 }
4433 4508
4434 4509
4435 LocationSummary* BranchInstr::MakeLocationSummary(bool opt) const { 4510 LocationSummary* BranchInstr::MakeLocationSummary(Isolate* isolate,
4436 comparison()->InitializeLocationSummary(opt); 4511 bool opt) const {
4512 comparison()->InitializeLocationSummary(isolate, opt);
4437 // Branches don't produce a result. 4513 // Branches don't produce a result.
4438 comparison()->locs()->set_out(0, Location::NoLocation()); 4514 comparison()->locs()->set_out(0, Location::NoLocation());
4439 return comparison()->locs(); 4515 return comparison()->locs();
4440 } 4516 }
4441 4517
4442 4518
4443 void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4519 void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4444 comparison()->EmitBranchCode(compiler, this); 4520 comparison()->EmitBranchCode(compiler, this);
4445 } 4521 }
4446 4522
4447 4523
4448 LocationSummary* CheckClassInstr::MakeLocationSummary(bool opt) const { 4524 LocationSummary* CheckClassInstr::MakeLocationSummary(Isolate* isolate,
4525 bool opt) const {
4449 const intptr_t kNumInputs = 1; 4526 const intptr_t kNumInputs = 1;
4450 const intptr_t kNumTemps = 0; 4527 const intptr_t kNumTemps = 0;
4451 LocationSummary* summary = 4528 LocationSummary* summary = new(isolate) LocationSummary(
4452 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4529 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4453 summary->set_in(0, Location::RequiresRegister()); 4530 summary->set_in(0, Location::RequiresRegister());
4454 if (!IsNullCheck()) { 4531 if (!IsNullCheck()) {
4455 summary->AddTemp(Location::RequiresRegister()); 4532 summary->AddTemp(Location::RequiresRegister());
4456 } 4533 }
4457 return summary; 4534 return summary;
4458 } 4535 }
4459 4536
4460 4537
4461 void CheckClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4538 void CheckClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4462 const ICData::DeoptReasonId deopt_reason = licm_hoisted_ ? 4539 const ICData::DeoptReasonId deopt_reason = licm_hoisted_ ?
(...skipping 28 matching lines...) Expand all
4491 if (i == (num_checks - 1)) { 4568 if (i == (num_checks - 1)) {
4492 __ b(deopt, NE); 4569 __ b(deopt, NE);
4493 } else { 4570 } else {
4494 __ b(&is_ok, EQ); 4571 __ b(&is_ok, EQ);
4495 } 4572 }
4496 } 4573 }
4497 __ Bind(&is_ok); 4574 __ Bind(&is_ok);
4498 } 4575 }
4499 4576
4500 4577
4501 LocationSummary* CheckSmiInstr::MakeLocationSummary(bool opt) const { 4578 LocationSummary* CheckSmiInstr::MakeLocationSummary(Isolate* isolate,
4579 bool opt) const {
4502 const intptr_t kNumInputs = 1; 4580 const intptr_t kNumInputs = 1;
4503 const intptr_t kNumTemps = 0; 4581 const intptr_t kNumTemps = 0;
4504 LocationSummary* summary = 4582 LocationSummary* summary = new(isolate) LocationSummary(
4505 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4583 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4506 summary->set_in(0, Location::RequiresRegister()); 4584 summary->set_in(0, Location::RequiresRegister());
4507 return summary; 4585 return summary;
4508 } 4586 }
4509 4587
4510 4588
4511 void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4589 void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4512 const Register value = locs()->in(0).reg(); 4590 const Register value = locs()->in(0).reg();
4513 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckSmi); 4591 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckSmi);
4514 __ tsti(value, kSmiTagMask); 4592 __ tsti(value, kSmiTagMask);
4515 __ b(deopt, NE); 4593 __ b(deopt, NE);
4516 } 4594 }
4517 4595
4518 4596
4519 LocationSummary* CheckArrayBoundInstr::MakeLocationSummary(bool opt) const { 4597 LocationSummary* CheckArrayBoundInstr::MakeLocationSummary(Isolate* isolate,
4598 bool opt) const {
4520 const intptr_t kNumInputs = 2; 4599 const intptr_t kNumInputs = 2;
4521 const intptr_t kNumTemps = 0; 4600 const intptr_t kNumTemps = 0;
4522 LocationSummary* locs = 4601 LocationSummary* locs = new(isolate) LocationSummary(
4523 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4602 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4524 locs->set_in(kLengthPos, Location::RegisterOrSmiConstant(length())); 4603 locs->set_in(kLengthPos, Location::RegisterOrSmiConstant(length()));
4525 locs->set_in(kIndexPos, Location::RegisterOrSmiConstant(index())); 4604 locs->set_in(kIndexPos, Location::RegisterOrSmiConstant(index()));
4526 return locs; 4605 return locs;
4527 } 4606 }
4528 4607
4529 4608
4530 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4609 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4531 Label* deopt = compiler->AddDeoptStub(deopt_id(), 4610 Label* deopt = compiler->AddDeoptStub(deopt_id(),
4532 ICData::kDeoptCheckArrayBound); 4611 ICData::kDeoptCheckArrayBound);
4533 4612
(...skipping 29 matching lines...) Expand all
4563 __ b(deopt, CS); 4642 __ b(deopt, CS);
4564 } else { 4643 } else {
4565 const Register length = length_loc.reg(); 4644 const Register length = length_loc.reg();
4566 const Register index = index_loc.reg(); 4645 const Register index = index_loc.reg();
4567 __ CompareRegisters(index, length); 4646 __ CompareRegisters(index, length);
4568 __ b(deopt, CS); 4647 __ b(deopt, CS);
4569 } 4648 }
4570 } 4649 }
4571 4650
4572 4651
4573 LocationSummary* UnboxIntegerInstr::MakeLocationSummary(bool opt) const { 4652 LocationSummary* UnboxIntegerInstr::MakeLocationSummary(Isolate* isolate,
4653 bool opt) const {
4574 UNIMPLEMENTED(); 4654 UNIMPLEMENTED();
4575 return NULL; 4655 return NULL;
4576 } 4656 }
4577 4657
4578 4658
4579 void UnboxIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4659 void UnboxIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4580 UNIMPLEMENTED(); 4660 UNIMPLEMENTED();
4581 } 4661 }
4582 4662
4583 4663
4584 LocationSummary* BoxIntegerInstr::MakeLocationSummary(bool opt) const { 4664 LocationSummary* BoxIntegerInstr::MakeLocationSummary(Isolate* isolate,
4665 bool opt) const {
4585 UNIMPLEMENTED(); 4666 UNIMPLEMENTED();
4586 return NULL; 4667 return NULL;
4587 } 4668 }
4588 4669
4589 4670
4590 void BoxIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4671 void BoxIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4591 UNIMPLEMENTED(); 4672 UNIMPLEMENTED();
4592 } 4673 }
4593 4674
4594 4675
4595 LocationSummary* BinaryMintOpInstr::MakeLocationSummary(bool opt) const { 4676 LocationSummary* BinaryMintOpInstr::MakeLocationSummary(Isolate* isolate,
4677 bool opt) const {
4596 UNIMPLEMENTED(); 4678 UNIMPLEMENTED();
4597 return NULL; 4679 return NULL;
4598 } 4680 }
4599 4681
4600 4682
4601 void BinaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4683 void BinaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4602 UNIMPLEMENTED(); 4684 UNIMPLEMENTED();
4603 } 4685 }
4604 4686
4605 4687
4606 LocationSummary* ShiftMintOpInstr::MakeLocationSummary(bool opt) const { 4688 LocationSummary* ShiftMintOpInstr::MakeLocationSummary(Isolate* isolate,
4689 bool opt) const {
4607 UNIMPLEMENTED(); 4690 UNIMPLEMENTED();
4608 return NULL; 4691 return NULL;
4609 } 4692 }
4610 4693
4611 4694
4612 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4695 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4613 UNIMPLEMENTED(); 4696 UNIMPLEMENTED();
4614 } 4697 }
4615 4698
4616 4699
4617 LocationSummary* UnaryMintOpInstr::MakeLocationSummary(bool opt) const { 4700 LocationSummary* UnaryMintOpInstr::MakeLocationSummary(Isolate* isolate,
4701 bool opt) const {
4618 UNIMPLEMENTED(); 4702 UNIMPLEMENTED();
4619 return NULL; 4703 return NULL;
4620 } 4704 }
4621 4705
4622 4706
4623 void UnaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4707 void UnaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4624 UNIMPLEMENTED(); 4708 UNIMPLEMENTED();
4625 } 4709 }
4626 4710
4627 4711
4628 LocationSummary* ThrowInstr::MakeLocationSummary(bool opt) const { 4712 LocationSummary* ThrowInstr::MakeLocationSummary(Isolate* isolate,
4629 return new LocationSummary(0, 0, LocationSummary::kCall); 4713 bool opt) const {
4714 return new(isolate) LocationSummary(isolate, 0, 0, LocationSummary::kCall);
4630 } 4715 }
4631 4716
4632 4717
4633 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4718 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4634 compiler->GenerateRuntimeCall(token_pos(), 4719 compiler->GenerateRuntimeCall(token_pos(),
4635 deopt_id(), 4720 deopt_id(),
4636 kThrowRuntimeEntry, 4721 kThrowRuntimeEntry,
4637 1, 4722 1,
4638 locs()); 4723 locs());
4639 __ hlt(0); 4724 __ hlt(0);
4640 } 4725 }
4641 4726
4642 4727
4643 LocationSummary* ReThrowInstr::MakeLocationSummary(bool opt) const { 4728 LocationSummary* ReThrowInstr::MakeLocationSummary(Isolate* isolate,
4644 return new LocationSummary(0, 0, LocationSummary::kCall); 4729 bool opt) const {
4730 return new(isolate) LocationSummary(isolate, 0, 0, LocationSummary::kCall);
4645 } 4731 }
4646 4732
4647 4733
4648 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4734 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4649 compiler->SetNeedsStacktrace(catch_try_index()); 4735 compiler->SetNeedsStacktrace(catch_try_index());
4650 compiler->GenerateRuntimeCall(token_pos(), 4736 compiler->GenerateRuntimeCall(token_pos(),
4651 deopt_id(), 4737 deopt_id(),
4652 kReThrowRuntimeEntry, 4738 kReThrowRuntimeEntry,
4653 2, 4739 2,
4654 locs()); 4740 locs());
(...skipping 19 matching lines...) Expand all
4674 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, 4760 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
4675 deopt_id_, 4761 deopt_id_,
4676 Scanner::kNoSourcePos); 4762 Scanner::kNoSourcePos);
4677 } 4763 }
4678 if (HasParallelMove()) { 4764 if (HasParallelMove()) {
4679 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 4765 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
4680 } 4766 }
4681 } 4767 }
4682 4768
4683 4769
4684 LocationSummary* GotoInstr::MakeLocationSummary(bool opt) const { 4770 LocationSummary* GotoInstr::MakeLocationSummary(Isolate* isolate,
4685 return new LocationSummary(0, 0, LocationSummary::kNoCall); 4771 bool opt) const {
4772 return new(isolate) LocationSummary(isolate, 0, 0, LocationSummary::kNoCall);
4686 } 4773 }
4687 4774
4688 4775
4689 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4776 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4690 if (!compiler->is_optimizing()) { 4777 if (!compiler->is_optimizing()) {
4691 compiler->EmitEdgeCounter(); 4778 compiler->EmitEdgeCounter();
4692 // Add a deoptimization descriptor for deoptimizing instructions that 4779 // Add a deoptimization descriptor for deoptimizing instructions that
4693 // may be inserted before this instruction. On ARM64 this descriptor 4780 // may be inserted before this instruction. On ARM64 this descriptor
4694 // points after the edge counter code so that we can reuse the same 4781 // points after the edge counter code so that we can reuse the same
4695 // pattern matching code as at call sites, which matches backwards from 4782 // pattern matching code as at call sites, which matches backwards from
4696 // the end of the pattern. 4783 // the end of the pattern.
4697 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, 4784 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
4698 GetDeoptId(), 4785 GetDeoptId(),
4699 Scanner::kNoSourcePos); 4786 Scanner::kNoSourcePos);
4700 } 4787 }
4701 if (HasParallelMove()) { 4788 if (HasParallelMove()) {
4702 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 4789 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
4703 } 4790 }
4704 4791
4705 // We can fall through if the successor is the next block in the list. 4792 // We can fall through if the successor is the next block in the list.
4706 // Otherwise, we need a jump. 4793 // Otherwise, we need a jump.
4707 if (!compiler->CanFallThroughTo(successor())) { 4794 if (!compiler->CanFallThroughTo(successor())) {
4708 __ b(compiler->GetJumpLabel(successor())); 4795 __ b(compiler->GetJumpLabel(successor()));
4709 } 4796 }
4710 } 4797 }
4711 4798
4712 4799
4713 LocationSummary* CurrentContextInstr::MakeLocationSummary(bool opt) const { 4800 LocationSummary* CurrentContextInstr::MakeLocationSummary(Isolate* isolate,
4801 bool opt) const {
4714 return LocationSummary::Make(0, 4802 return LocationSummary::Make(0,
4715 Location::RequiresRegister(), 4803 Location::RequiresRegister(),
4716 LocationSummary::kNoCall); 4804 LocationSummary::kNoCall);
4717 } 4805 }
4718 4806
4719 4807
4720 void CurrentContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4808 void CurrentContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4721 __ mov(locs()->out(0).reg(), CTX); 4809 __ mov(locs()->out(0).reg(), CTX);
4722 } 4810 }
4723 4811
4724 4812
4725 LocationSummary* StrictCompareInstr::MakeLocationSummary(bool opt) const { 4813 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate,
4814 bool opt) const {
4726 const intptr_t kNumInputs = 2; 4815 const intptr_t kNumInputs = 2;
4727 const intptr_t kNumTemps = 0; 4816 const intptr_t kNumTemps = 0;
4728 if (needs_number_check()) { 4817 if (needs_number_check()) {
4729 LocationSummary* locs = 4818 LocationSummary* locs = new(isolate) LocationSummary(
4730 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 4819 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
4731 locs->set_in(0, Location::RegisterLocation(R0)); 4820 locs->set_in(0, Location::RegisterLocation(R0));
4732 locs->set_in(1, Location::RegisterLocation(R1)); 4821 locs->set_in(1, Location::RegisterLocation(R1));
4733 locs->set_out(0, Location::RegisterLocation(R0)); 4822 locs->set_out(0, Location::RegisterLocation(R0));
4734 return locs; 4823 return locs;
4735 } 4824 }
4736 LocationSummary* locs = 4825 LocationSummary* locs = new(isolate) LocationSummary(
4737 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4826 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4738 locs->set_in(0, Location::RegisterOrConstant(left())); 4827 locs->set_in(0, Location::RegisterOrConstant(left()));
4739 // Only one of the inputs can be a constant. Choose register if the first one 4828 // Only one of the inputs can be a constant. Choose register if the first one
4740 // is a constant. 4829 // is a constant.
4741 locs->set_in(1, locs->in(0).IsConstant() 4830 locs->set_in(1, locs->in(0).IsConstant()
4742 ? Location::RequiresRegister() 4831 ? Location::RequiresRegister()
4743 : Location::RegisterOrConstant(right())); 4832 : Location::RegisterOrConstant(right()));
4744 locs->set_out(0, Location::RequiresRegister()); 4833 locs->set_out(0, Location::RequiresRegister());
4745 return locs; 4834 return locs;
4746 } 4835 }
4747 4836
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
4795 void StrictCompareInstr::EmitBranchCode(FlowGraphCompiler* compiler, 4884 void StrictCompareInstr::EmitBranchCode(FlowGraphCompiler* compiler,
4796 BranchInstr* branch) { 4885 BranchInstr* branch) {
4797 ASSERT(kind() == Token::kEQ_STRICT || kind() == Token::kNE_STRICT); 4886 ASSERT(kind() == Token::kEQ_STRICT || kind() == Token::kNE_STRICT);
4798 4887
4799 BranchLabels labels = compiler->CreateBranchLabels(branch); 4888 BranchLabels labels = compiler->CreateBranchLabels(branch);
4800 Condition true_condition = EmitComparisonCode(compiler, labels); 4889 Condition true_condition = EmitComparisonCode(compiler, labels);
4801 EmitBranchOnCondition(compiler, true_condition, labels); 4890 EmitBranchOnCondition(compiler, true_condition, labels);
4802 } 4891 }
4803 4892
4804 4893
4805 LocationSummary* BooleanNegateInstr::MakeLocationSummary(bool opt) const { 4894 LocationSummary* BooleanNegateInstr::MakeLocationSummary(Isolate* isolate,
4895 bool opt) const {
4806 return LocationSummary::Make(1, 4896 return LocationSummary::Make(1,
4807 Location::RequiresRegister(), 4897 Location::RequiresRegister(),
4808 LocationSummary::kNoCall); 4898 LocationSummary::kNoCall);
4809 } 4899 }
4810 4900
4811 4901
4812 void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4902 void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4813 const Register value = locs()->in(0).reg(); 4903 const Register value = locs()->in(0).reg();
4814 const Register result = locs()->out(0).reg(); 4904 const Register result = locs()->out(0).reg();
4815 4905
4816 __ LoadObject(result, Bool::True(), PP); 4906 __ LoadObject(result, Bool::True(), PP);
4817 __ LoadObject(TMP, Bool::False(), PP); 4907 __ LoadObject(TMP, Bool::False(), PP);
4818 __ CompareRegisters(result, value); 4908 __ CompareRegisters(result, value);
4819 __ csel(result, TMP, result, EQ); 4909 __ csel(result, TMP, result, EQ);
4820 } 4910 }
4821 4911
4822 4912
4823 LocationSummary* AllocateObjectInstr::MakeLocationSummary(bool opt) const { 4913 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Isolate* isolate,
4914 bool opt) const {
4824 return MakeCallSummary(); 4915 return MakeCallSummary();
4825 } 4916 }
4826 4917
4827 4918
4828 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4919 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4829 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls())); 4920 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls()));
4830 const ExternalLabel label(cls().ToCString(), stub.EntryPoint()); 4921 const ExternalLabel label(cls().ToCString(), stub.EntryPoint());
4831 compiler->GenerateCall(token_pos(), 4922 compiler->GenerateCall(token_pos(),
4832 &label, 4923 &label,
4833 PcDescriptors::kOther, 4924 PcDescriptors::kOther,
4834 locs()); 4925 locs());
4835 __ Drop(ArgumentCount()); // Discard arguments. 4926 __ Drop(ArgumentCount()); // Discard arguments.
4836 } 4927 }
4837 4928
4838 } // namespace dart 4929 } // namespace dart
4839 4930
4840 #endif // defined TARGET_ARCH_ARM64 4931 #endif // defined TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698