OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <limits> | 5 #include <limits> |
6 | 6 |
7 #include "src/compiler/control-builders.h" | 7 #include "src/compiler/control-builders.h" |
8 #include "src/compiler/generic-node-inl.h" | 8 #include "src/compiler/generic-node-inl.h" |
9 #include "src/compiler/graph-visualizer.h" | 9 #include "src/compiler/graph-visualizer.h" |
10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties-inl.h" |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 BoundsCheck(from_index); | 400 BoundsCheck(from_index); |
401 BoundsCheck(to_index); | 401 BoundsCheck(to_index); |
402 ElementAccess access = GetElementAccess(); | 402 ElementAccess access = GetElementAccess(); |
403 | 403 |
404 SimplifiedLoweringTester<Object*> t; | 404 SimplifiedLoweringTester<Object*> t; |
405 Node* ptr = GetBaseNode(&t); | 405 Node* ptr = GetBaseNode(&t); |
406 Node* load = t.LoadElement(access, ptr, t.Int32Constant(from_index)); | 406 Node* load = t.LoadElement(access, ptr, t.Int32Constant(from_index)); |
407 t.StoreElement(access, ptr, t.Int32Constant(to_index), load); | 407 t.StoreElement(access, ptr, t.Int32Constant(to_index), load); |
408 t.Return(t.jsgraph.TrueConstant()); | 408 t.Return(t.jsgraph.TrueConstant()); |
409 t.LowerAllNodes(); | 409 t.LowerAllNodes(); |
410 t.GenerateCode(); | |
411 | 410 |
412 if (Pipeline::SupportedTarget()) { | 411 if (Pipeline::SupportedTarget()) { |
| 412 t.GenerateCode(); |
413 Object* result = t.Call(); | 413 Object* result = t.Call(); |
414 CHECK_EQ(t.isolate()->heap()->true_value(), result); | 414 CHECK_EQ(t.isolate()->heap()->true_value(), result); |
415 } | 415 } |
416 } | 416 } |
417 | 417 |
418 // Create and run code that copies the field in either {untagged_array} | 418 // Create and run code that copies the field in either {untagged_array} |
419 // or {tagged_array} at index {from_index} to index {to_index}. | 419 // or {tagged_array} at index {from_index} to index {to_index}. |
420 void RunCopyField(int from_index, int to_index) { | 420 void RunCopyField(int from_index, int to_index) { |
421 BoundsCheck(from_index); | 421 BoundsCheck(from_index); |
422 BoundsCheck(to_index); | 422 BoundsCheck(to_index); |
423 FieldAccess from_access = GetFieldAccess(from_index); | 423 FieldAccess from_access = GetFieldAccess(from_index); |
424 FieldAccess to_access = GetFieldAccess(to_index); | 424 FieldAccess to_access = GetFieldAccess(to_index); |
425 | 425 |
426 SimplifiedLoweringTester<Object*> t; | 426 SimplifiedLoweringTester<Object*> t; |
427 Node* ptr = GetBaseNode(&t); | 427 Node* ptr = GetBaseNode(&t); |
428 Node* load = t.LoadField(from_access, ptr); | 428 Node* load = t.LoadField(from_access, ptr); |
429 t.StoreField(to_access, ptr, load); | 429 t.StoreField(to_access, ptr, load); |
430 t.Return(t.jsgraph.TrueConstant()); | 430 t.Return(t.jsgraph.TrueConstant()); |
431 t.LowerAllNodes(); | 431 t.LowerAllNodes(); |
432 t.GenerateCode(); | |
433 | 432 |
434 if (Pipeline::SupportedTarget()) { | 433 if (Pipeline::SupportedTarget()) { |
| 434 t.GenerateCode(); |
435 Object* result = t.Call(); | 435 Object* result = t.Call(); |
436 CHECK_EQ(t.isolate()->heap()->true_value(), result); | 436 CHECK_EQ(t.isolate()->heap()->true_value(), result); |
437 } | 437 } |
438 } | 438 } |
439 | 439 |
440 // Create and run code that copies the elements from {this} to {that}. | 440 // Create and run code that copies the elements from {this} to {that}. |
441 void RunCopyElements(AccessTester<E>* that) { | 441 void RunCopyElements(AccessTester<E>* that) { |
442 SimplifiedLoweringTester<Object*> t; | 442 SimplifiedLoweringTester<Object*> t; |
443 | 443 |
444 Node* one = t.Int32Constant(1); | 444 Node* one = t.Int32Constant(1); |
(...skipping 16 matching lines...) Expand all Loading... |
461 // index++ | 461 // index++ |
462 index = t.Int32Add(index, one); | 462 index = t.Int32Add(index, one); |
463 t.environment()->Push(index); | 463 t.environment()->Push(index); |
464 // continue | 464 // continue |
465 loop.EndBody(); | 465 loop.EndBody(); |
466 loop.EndLoop(); | 466 loop.EndLoop(); |
467 } | 467 } |
468 index = t.environment()->Pop(); | 468 index = t.environment()->Pop(); |
469 t.Return(t.jsgraph.TrueConstant()); | 469 t.Return(t.jsgraph.TrueConstant()); |
470 t.LowerAllNodes(); | 470 t.LowerAllNodes(); |
471 t.GenerateCode(); | |
472 | 471 |
473 if (Pipeline::SupportedTarget()) { | 472 if (Pipeline::SupportedTarget()) { |
| 473 t.GenerateCode(); |
474 Object* result = t.Call(); | 474 Object* result = t.Call(); |
475 CHECK_EQ(t.isolate()->heap()->true_value(), result); | 475 CHECK_EQ(t.isolate()->heap()->true_value(), result); |
476 } | 476 } |
477 } | 477 } |
478 | 478 |
479 E GetElement(int index) { | 479 E GetElement(int index) { |
480 BoundsCheck(index); | 480 BoundsCheck(index); |
481 if (tagged) { | 481 if (tagged) { |
482 E* raw = reinterpret_cast<E*>(tagged_array->GetDataStartAddress()); | 482 E* raw = reinterpret_cast<E*>(tagged_array->GetDataStartAddress()); |
483 return raw[index]; | 483 return raw[index]; |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1363 | 1363 |
1364 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, | 1364 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, |
1365 t.p1, t.start, t.start); | 1365 t.p1, t.start, t.start); |
1366 t.Effect(store); | 1366 t.Effect(store); |
1367 t.Lower(); | 1367 t.Lower(); |
1368 | 1368 |
1369 CHECK_EQ(IrOpcode::kStore, store->opcode()); | 1369 CHECK_EQ(IrOpcode::kStore, store->opcode()); |
1370 CHECK_EQ(t.p0, store->InputAt(0)); | 1370 CHECK_EQ(t.p0, store->InputAt(0)); |
1371 CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(2)); | 1371 CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(2)); |
1372 } | 1372 } |
OLD | NEW |