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-graph.h" | 7 #include "src/compiler/js-graph.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-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 HeapObjectMatcher<Object> mbase(base); | 774 HeapObjectMatcher<Object> mbase(base); |
775 if (mbase.HasValue() && mbase.Value().handle()->IsJSTypedArray()) { | 775 if (mbase.HasValue() && mbase.Value().handle()->IsJSTypedArray()) { |
776 Handle<JSTypedArray> const array = | 776 Handle<JSTypedArray> const array = |
777 Handle<JSTypedArray>::cast(mbase.Value().handle()); | 777 Handle<JSTypedArray>::cast(mbase.Value().handle()); |
778 array->GetBuffer()->set_is_neuterable(false); | 778 array->GetBuffer()->set_is_neuterable(false); |
779 BufferAccess const access(array->type()); | 779 BufferAccess const access(array->type()); |
780 size_t const k = ElementSizeLog2Of(access.machine_type()); | 780 size_t const k = ElementSizeLog2Of(access.machine_type()); |
781 double const byte_length = array->byte_length()->Number(); | 781 double const byte_length = array->byte_length()->Number(); |
782 CHECK_LT(k, arraysize(shifted_int32_ranges_)); | 782 CHECK_LT(k, arraysize(shifted_int32_ranges_)); |
783 if (IsExternalArrayElementsKind(array->map()->elements_kind()) && | 783 if (IsExternalArrayElementsKind(array->map()->elements_kind()) && |
784 access.external_array_type() != kExternalUint8ClampedArray && | |
785 key_type->Is(shifted_int32_ranges_[k]) && byte_length <= kMaxInt) { | 784 key_type->Is(shifted_int32_ranges_[k]) && byte_length <= kMaxInt) { |
786 // JSLoadProperty(typed-array, int32) | 785 // JSLoadProperty(typed-array, int32) |
787 Handle<ExternalArray> elements = | 786 Handle<ExternalArray> elements = |
788 Handle<ExternalArray>::cast(handle(array->elements())); | 787 Handle<ExternalArray>::cast(handle(array->elements())); |
789 Node* buffer = jsgraph()->PointerConstant(elements->external_pointer()); | 788 Node* buffer = jsgraph()->PointerConstant(elements->external_pointer()); |
790 Node* length = jsgraph()->Constant(byte_length); | 789 Node* length = jsgraph()->Constant(byte_length); |
791 Node* effect = NodeProperties::GetEffectInput(node); | 790 Node* effect = NodeProperties::GetEffectInput(node); |
792 Node* control = NodeProperties::GetControlInput(node); | 791 Node* control = NodeProperties::GetControlInput(node); |
793 // Check if we can avoid the bounds check. | 792 // Check if we can avoid the bounds check. |
794 if (key_type->Min() >= 0 && key_type->Max() < array->length()->Number()) { | 793 if (key_type->Min() >= 0 && key_type->Max() < array->length()->Number()) { |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 } | 1076 } |
1078 | 1077 |
1079 | 1078 |
1080 MachineOperatorBuilder* JSTypedLowering::machine() const { | 1079 MachineOperatorBuilder* JSTypedLowering::machine() const { |
1081 return jsgraph()->machine(); | 1080 return jsgraph()->machine(); |
1082 } | 1081 } |
1083 | 1082 |
1084 } // namespace compiler | 1083 } // namespace compiler |
1085 } // namespace internal | 1084 } // namespace internal |
1086 } // namespace v8 | 1085 } // namespace v8 |
OLD | NEW |