| 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/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
| 8 #include "src/compiler/change-lowering.h" | 8 #include "src/compiler/change-lowering.h" |
| 9 #include "src/compiler/control-builders.h" | 9 #include "src/compiler/control-builders.h" |
| 10 #include "src/compiler/graph-reducer.h" | 10 #include "src/compiler/graph-reducer.h" |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 if (Pipeline::SupportedTarget()) { | 528 if (Pipeline::SupportedTarget()) { |
| 529 Object* result = t.Call(); | 529 Object* result = t.Call(); |
| 530 CHECK_EQ(t.isolate()->heap()->true_value(), result); | 530 CHECK_EQ(t.isolate()->heap()->true_value(), result); |
| 531 } | 531 } |
| 532 #endif | 532 #endif |
| 533 } | 533 } |
| 534 | 534 |
| 535 E GetElement(int index) { | 535 E GetElement(int index) { |
| 536 BoundsCheck(index); | 536 BoundsCheck(index); |
| 537 if (tagged) { | 537 if (tagged) { |
| 538 E* raw = reinterpret_cast<E*>(tagged_array->GetDataStartAddress()); | 538 return GetTaggedElement(index); |
| 539 return raw[index]; | |
| 540 } else { | 539 } else { |
| 541 return untagged_array[index]; | 540 return untagged_array[index]; |
| 542 } | 541 } |
| 543 } | 542 } |
| 544 | 543 |
| 545 private: | 544 private: |
| 546 ElementAccess GetElementAccess() { | 545 ElementAccess GetElementAccess() { |
| 547 ElementAccess access = {tagged ? kTaggedBase : kUntaggedBase, | 546 ElementAccess access = {tagged ? kTaggedBase : kUntaggedBase, |
| 548 tagged ? FixedArrayBase::kHeaderSize : 0, | 547 tagged ? FixedArrayBase::kHeaderSize : 0, |
| 549 Type::Any(), rep}; | 548 Type::Any(), rep}; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 562 Node* GetBaseNode(SimplifiedLoweringTester<T>* t) { | 561 Node* GetBaseNode(SimplifiedLoweringTester<T>* t) { |
| 563 return tagged ? t->HeapConstant(tagged_array) | 562 return tagged ? t->HeapConstant(tagged_array) |
| 564 : t->PointerConstant(untagged_array); | 563 : t->PointerConstant(untagged_array); |
| 565 } | 564 } |
| 566 | 565 |
| 567 void BoundsCheck(int index) { | 566 void BoundsCheck(int index) { |
| 568 CHECK_GE(index, 0); | 567 CHECK_GE(index, 0); |
| 569 CHECK_LT(index, static_cast<int>(num_elements)); | 568 CHECK_LT(index, static_cast<int>(num_elements)); |
| 570 CHECK_EQ(static_cast<int>(ByteSize()), tagged_array->length()); | 569 CHECK_EQ(static_cast<int>(ByteSize()), tagged_array->length()); |
| 571 } | 570 } |
| 571 |
| 572 E GetTaggedElement(int index) { |
| 573 E* raw = reinterpret_cast<E*>(tagged_array->GetDataStartAddress()); |
| 574 return raw[index]; |
| 575 } |
| 572 }; | 576 }; |
| 573 | 577 |
| 578 template <> |
| 579 double AccessTester<double>::GetTaggedElement(int index) { |
| 580 return ReadDoubleValue(tagged_array->GetDataStartAddress() + |
| 581 index * sizeof(double)); |
| 582 } |
| 583 |
| 574 | 584 |
| 575 template <typename E> | 585 template <typename E> |
| 576 static void RunAccessTest(MachineType rep, E* original_elements, size_t num) { | 586 static void RunAccessTest(MachineType rep, E* original_elements, size_t num) { |
| 577 int num_elements = static_cast<int>(num); | 587 int num_elements = static_cast<int>(num); |
| 578 | 588 |
| 579 for (int taggedness = 0; taggedness < 2; taggedness++) { | 589 for (int taggedness = 0; taggedness < 2; taggedness++) { |
| 580 AccessTester<E> a(taggedness == 1, rep, original_elements, num); | 590 AccessTester<E> a(taggedness == 1, rep, original_elements, num); |
| 581 for (int field = 0; field < 2; field++) { | 591 for (int field = 0; field < 2; field++) { |
| 582 for (int i = 0; i < num_elements - 1; i++) { | 592 for (int i = 0; i < num_elements - 1; i++) { |
| 583 a.Reinitialize(); | 593 a.Reinitialize(); |
| (...skipping 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2086 Bounds phi_bounds = Bounds::Either(Bounds(d.arg1), Bounds(d.arg2), z); | 2096 Bounds phi_bounds = Bounds::Either(Bounds(d.arg1), Bounds(d.arg2), z); |
| 2087 NodeProperties::SetBounds(phi, phi_bounds); | 2097 NodeProperties::SetBounds(phi, phi_bounds); |
| 2088 | 2098 |
| 2089 Node* use = t.Use(phi, d.use); | 2099 Node* use = t.Use(phi, d.use); |
| 2090 t.Return(use); | 2100 t.Return(use); |
| 2091 t.Lower(); | 2101 t.Lower(); |
| 2092 | 2102 |
| 2093 CHECK_EQ(d.expected, OpParameter<MachineType>(phi)); | 2103 CHECK_EQ(d.expected, OpParameter<MachineType>(phi)); |
| 2094 } | 2104 } |
| 2095 } | 2105 } |
| OLD | NEW |