| 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 "src/compiler/access-builder.h" | 5 #include "src/compiler/access-builder.h" |
| 6 #include "src/compiler/graph-inl.h" | 6 #include "src/compiler/graph-inl.h" |
| 7 #include "src/compiler/js-builtin-reducer.h" | 7 #include "src/compiler/js-builtin-reducer.h" |
| 8 #include "src/compiler/js-typed-lowering.h" | 8 #include "src/compiler/js-typed-lowering.h" |
| 9 #include "src/compiler/node-aux-data-inl.h" | 9 #include "src/compiler/node-aux-data-inl.h" |
| 10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties-inl.h" |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 } | 527 } |
| 528 | 528 |
| 529 | 529 |
| 530 Reduction JSTypedLowering::ReduceJSLoadProperty(Node* node) { | 530 Reduction JSTypedLowering::ReduceJSLoadProperty(Node* node) { |
| 531 Node* key = NodeProperties::GetValueInput(node, 1); | 531 Node* key = NodeProperties::GetValueInput(node, 1); |
| 532 Node* base = NodeProperties::GetValueInput(node, 0); | 532 Node* base = NodeProperties::GetValueInput(node, 0); |
| 533 Type* key_type = NodeProperties::GetBounds(key).upper; | 533 Type* key_type = NodeProperties::GetBounds(key).upper; |
| 534 Type* base_type = NodeProperties::GetBounds(base).upper; | 534 Type* base_type = NodeProperties::GetBounds(base).upper; |
| 535 // TODO(mstarzinger): This lowering is not correct if: | 535 // TODO(mstarzinger): This lowering is not correct if: |
| 536 // a) The typed array or it's buffer is neutered. | 536 // a) The typed array or it's buffer is neutered. |
| 537 // b) The index is out of bounds. | |
| 538 if (base_type->IsConstant() && key_type->Is(Type::Integral32()) && | 537 if (base_type->IsConstant() && key_type->Is(Type::Integral32()) && |
| 539 base_type->AsConstant()->Value()->IsJSTypedArray()) { | 538 base_type->AsConstant()->Value()->IsJSTypedArray()) { |
| 540 // JSLoadProperty(typed-array, int32) | 539 // JSLoadProperty(typed-array, int32) |
| 541 Handle<JSTypedArray> array = | 540 Handle<JSTypedArray> array = |
| 542 Handle<JSTypedArray>::cast(base_type->AsConstant()->Value()); | 541 Handle<JSTypedArray>::cast(base_type->AsConstant()->Value()); |
| 543 if (IsExternalArrayElementsKind(array->map()->elements_kind())) { | 542 if (IsExternalArrayElementsKind(array->map()->elements_kind())) { |
| 544 ExternalArrayType type = array->type(); | 543 ExternalArrayType type = array->type(); |
| 545 uint32_t length; | 544 uint32_t length; |
| 546 CHECK(array->length()->ToUint32(&length)); | 545 CHECK(array->length()->ToUint32(&length)); |
| 547 Node* elements = graph()->NewNode( | 546 Node* elements = graph()->NewNode( |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 return JSBuiltinReducer(jsgraph()).Reduce(node); | 690 return JSBuiltinReducer(jsgraph()).Reduce(node); |
| 692 default: | 691 default: |
| 693 break; | 692 break; |
| 694 } | 693 } |
| 695 return NoChange(); | 694 return NoChange(); |
| 696 } | 695 } |
| 697 | 696 |
| 698 } // namespace compiler | 697 } // namespace compiler |
| 699 } // namespace internal | 698 } // namespace internal |
| 700 } // namespace v8 | 699 } // namespace v8 |
| OLD | NEW |