Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Side by Side Diff: src/compiler/js-typed-lowering.cc

Issue 781933002: [turbofan] disable neutering on embedded arraybuffers (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 Node* key = NodeProperties::GetValueInput(node, 1); 686 Node* key = NodeProperties::GetValueInput(node, 1);
687 Node* base = NodeProperties::GetValueInput(node, 0); 687 Node* base = NodeProperties::GetValueInput(node, 0);
688 Type* key_type = NodeProperties::GetBounds(key).upper; 688 Type* key_type = NodeProperties::GetBounds(key).upper;
689 Type* base_type = NodeProperties::GetBounds(base).upper; 689 Type* base_type = NodeProperties::GetBounds(base).upper;
690 // TODO(mstarzinger): This lowering is not correct if: 690 // TODO(mstarzinger): This lowering is not correct if:
691 // a) The typed array or it's buffer is neutered. 691 // a) The typed array or it's buffer is neutered.
692 if (base_type->IsConstant() && 692 if (base_type->IsConstant() &&
693 base_type->AsConstant()->Value()->IsJSTypedArray()) { 693 base_type->AsConstant()->Value()->IsJSTypedArray()) {
694 Handle<JSTypedArray> const array = 694 Handle<JSTypedArray> const array =
695 Handle<JSTypedArray>::cast(base_type->AsConstant()->Value()); 695 Handle<JSTypedArray>::cast(base_type->AsConstant()->Value());
696 array->GetBuffer()->set_is_neuterable(false);
696 BufferAccess const access(array->type()); 697 BufferAccess const access(array->type());
697 size_t const k = ElementSizeLog2Of(access.machine_type()); 698 size_t const k = ElementSizeLog2Of(access.machine_type());
698 double const byte_length = array->byte_length()->Number(); 699 double const byte_length = array->byte_length()->Number();
699 CHECK_LT(k, arraysize(shifted_int32_ranges_)); 700 CHECK_LT(k, arraysize(shifted_int32_ranges_));
700 if (IsExternalArrayElementsKind(array->map()->elements_kind()) && 701 if (IsExternalArrayElementsKind(array->map()->elements_kind()) &&
701 access.external_array_type() != kExternalUint8ClampedArray && 702 access.external_array_type() != kExternalUint8ClampedArray &&
702 key_type->Is(shifted_int32_ranges_[k]) && byte_length <= kMaxInt) { 703 key_type->Is(shifted_int32_ranges_[k]) && byte_length <= kMaxInt) {
703 // JSLoadProperty(typed-array, int32) 704 // JSLoadProperty(typed-array, int32)
704 Handle<ExternalArray> elements = 705 Handle<ExternalArray> elements =
705 Handle<ExternalArray>::cast(handle(array->elements())); 706 Handle<ExternalArray>::cast(handle(array->elements()));
(...skipping 26 matching lines...) Expand all
732 Node* value = NodeProperties::GetValueInput(node, 2); 733 Node* value = NodeProperties::GetValueInput(node, 2);
733 Type* key_type = NodeProperties::GetBounds(key).upper; 734 Type* key_type = NodeProperties::GetBounds(key).upper;
734 Type* base_type = NodeProperties::GetBounds(base).upper; 735 Type* base_type = NodeProperties::GetBounds(base).upper;
735 Type* value_type = NodeProperties::GetBounds(value).upper; 736 Type* value_type = NodeProperties::GetBounds(value).upper;
736 // TODO(mstarzinger): This lowering is not correct if: 737 // TODO(mstarzinger): This lowering is not correct if:
737 // a) The typed array or its buffer is neutered. 738 // a) The typed array or its buffer is neutered.
738 if (base_type->IsConstant() && 739 if (base_type->IsConstant() &&
739 base_type->AsConstant()->Value()->IsJSTypedArray()) { 740 base_type->AsConstant()->Value()->IsJSTypedArray()) {
740 Handle<JSTypedArray> const array = 741 Handle<JSTypedArray> const array =
741 Handle<JSTypedArray>::cast(base_type->AsConstant()->Value()); 742 Handle<JSTypedArray>::cast(base_type->AsConstant()->Value());
743 array->GetBuffer()->set_is_neuterable(false);
742 BufferAccess const access(array->type()); 744 BufferAccess const access(array->type());
743 size_t const k = ElementSizeLog2Of(access.machine_type()); 745 size_t const k = ElementSizeLog2Of(access.machine_type());
744 double const byte_length = array->byte_length()->Number(); 746 double const byte_length = array->byte_length()->Number();
745 CHECK_LT(k, arraysize(shifted_int32_ranges_)); 747 CHECK_LT(k, arraysize(shifted_int32_ranges_));
746 if (IsExternalArrayElementsKind(array->map()->elements_kind()) && 748 if (IsExternalArrayElementsKind(array->map()->elements_kind()) &&
747 access.external_array_type() != kExternalUint8ClampedArray && 749 access.external_array_type() != kExternalUint8ClampedArray &&
748 key_type->Is(shifted_int32_ranges_[k]) && byte_length <= kMaxInt) { 750 key_type->Is(shifted_int32_ranges_[k]) && byte_length <= kMaxInt) {
749 // JSLoadProperty(typed-array, int32) 751 // JSLoadProperty(typed-array, int32)
750 Handle<ExternalArray> elements = 752 Handle<ExternalArray> elements =
751 Handle<ExternalArray>::cast(handle(array->elements())); 753 Handle<ExternalArray>::cast(handle(array->elements()));
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 901
900 Node* JSTypedLowering::Word32Shl(Node* const lhs, int32_t const rhs) { 902 Node* JSTypedLowering::Word32Shl(Node* const lhs, int32_t const rhs) {
901 if (rhs == 0) return lhs; 903 if (rhs == 0) return lhs;
902 return graph()->NewNode(machine()->Word32Shl(), lhs, 904 return graph()->NewNode(machine()->Word32Shl(), lhs,
903 jsgraph()->Int32Constant(rhs)); 905 jsgraph()->Int32Constant(rhs));
904 } 906 }
905 907
906 } // namespace compiler 908 } // namespace compiler
907 } // namespace internal 909 } // namespace internal
908 } // namespace v8 910 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698