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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 Handle<JSTypedArray> array = | 605 Handle<JSTypedArray> array = |
606 Handle<JSTypedArray>::cast(base_type->AsConstant()->Value()); | 606 Handle<JSTypedArray>::cast(base_type->AsConstant()->Value()); |
607 if (IsExternalArrayElementsKind(array->map()->elements_kind())) { | 607 if (IsExternalArrayElementsKind(array->map()->elements_kind())) { |
608 ExternalArrayType type = array->type(); | 608 ExternalArrayType type = array->type(); |
609 double byte_length = array->byte_length()->Number(); | 609 double byte_length = array->byte_length()->Number(); |
610 if (byte_length <= kMaxInt) { | 610 if (byte_length <= kMaxInt) { |
611 Handle<ExternalArray> elements = | 611 Handle<ExternalArray> elements = |
612 Handle<ExternalArray>::cast(handle(array->elements())); | 612 Handle<ExternalArray>::cast(handle(array->elements())); |
613 Node* pointer = jsgraph()->IntPtrConstant( | 613 Node* pointer = jsgraph()->IntPtrConstant( |
614 bit_cast<intptr_t>(elements->external_pointer())); | 614 bit_cast<intptr_t>(elements->external_pointer())); |
615 Node* length = jsgraph()->Constant(byte_length / array->element_size()); | 615 Node* length = jsgraph()->Constant(array->length()->Number()); |
616 Node* effect = NodeProperties::GetEffectInput(node); | 616 Node* effect = NodeProperties::GetEffectInput(node); |
617 Node* load = graph()->NewNode( | 617 Node* load = graph()->NewNode( |
618 simplified()->LoadElement( | 618 simplified()->LoadElement( |
619 AccessBuilder::ForTypedArrayElement(type, true)), | 619 AccessBuilder::ForTypedArrayElement(type, true)), |
620 pointer, key, length, effect); | 620 pointer, key, length, effect); |
621 return ReplaceEagerly(node, load); | 621 return ReplaceEagerly(node, load); |
622 } | 622 } |
623 } | 623 } |
624 } | 624 } |
625 return NoChange(); | 625 return NoChange(); |
(...skipping 14 matching lines...) Expand all Loading... |
640 Handle<JSTypedArray> array = | 640 Handle<JSTypedArray> array = |
641 Handle<JSTypedArray>::cast(base_type->AsConstant()->Value()); | 641 Handle<JSTypedArray>::cast(base_type->AsConstant()->Value()); |
642 if (IsExternalArrayElementsKind(array->map()->elements_kind())) { | 642 if (IsExternalArrayElementsKind(array->map()->elements_kind())) { |
643 ExternalArrayType type = array->type(); | 643 ExternalArrayType type = array->type(); |
644 double byte_length = array->byte_length()->Number(); | 644 double byte_length = array->byte_length()->Number(); |
645 if (byte_length <= kMaxInt) { | 645 if (byte_length <= kMaxInt) { |
646 Handle<ExternalArray> elements = | 646 Handle<ExternalArray> elements = |
647 Handle<ExternalArray>::cast(handle(array->elements())); | 647 Handle<ExternalArray>::cast(handle(array->elements())); |
648 Node* pointer = jsgraph()->IntPtrConstant( | 648 Node* pointer = jsgraph()->IntPtrConstant( |
649 bit_cast<intptr_t>(elements->external_pointer())); | 649 bit_cast<intptr_t>(elements->external_pointer())); |
650 Node* length = jsgraph()->Constant(byte_length / array->element_size()); | 650 Node* length = jsgraph()->Constant(array->length()->Number()); |
651 Node* effect = NodeProperties::GetEffectInput(node); | 651 Node* effect = NodeProperties::GetEffectInput(node); |
652 Node* control = NodeProperties::GetControlInput(node); | 652 Node* control = NodeProperties::GetControlInput(node); |
653 Node* store = graph()->NewNode( | 653 Node* store = graph()->NewNode( |
654 simplified()->StoreElement( | 654 simplified()->StoreElement( |
655 AccessBuilder::ForTypedArrayElement(type, true)), | 655 AccessBuilder::ForTypedArrayElement(type, true)), |
656 pointer, key, length, value, effect, control); | 656 pointer, key, length, value, effect, control); |
657 return ReplaceEagerly(node, store); | 657 return ReplaceEagerly(node, store); |
658 } | 658 } |
659 } | 659 } |
660 } | 660 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 return JSBuiltinReducer(jsgraph()).Reduce(node); | 754 return JSBuiltinReducer(jsgraph()).Reduce(node); |
755 default: | 755 default: |
756 break; | 756 break; |
757 } | 757 } |
758 return NoChange(); | 758 return NoChange(); |
759 } | 759 } |
760 | 760 |
761 } // namespace compiler | 761 } // namespace compiler |
762 } // namespace internal | 762 } // namespace internal |
763 } // namespace v8 | 763 } // namespace v8 |
OLD | NEW |