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/js-typed-lowering.h" | 5 #include "src/compiler/js-typed-lowering.h" |
6 | 6 |
7 #include "src/ast/modules.h" | 7 #include "src/ast/modules.h" |
8 #include "src/builtins/builtins-utils.h" | 8 #include "src/builtins/builtins-utils.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/compilation-dependencies.h" | 10 #include "src/compilation-dependencies.h" |
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 } | 1198 } |
1199 | 1199 |
1200 Reduction JSTypedLowering::ReduceJSLoadProperty(Node* node) { | 1200 Reduction JSTypedLowering::ReduceJSLoadProperty(Node* node) { |
1201 Node* key = NodeProperties::GetValueInput(node, 1); | 1201 Node* key = NodeProperties::GetValueInput(node, 1); |
1202 Node* base = NodeProperties::GetValueInput(node, 0); | 1202 Node* base = NodeProperties::GetValueInput(node, 0); |
1203 Type* key_type = NodeProperties::GetType(key); | 1203 Type* key_type = NodeProperties::GetType(key); |
1204 HeapObjectMatcher mbase(base); | 1204 HeapObjectMatcher mbase(base); |
1205 if (mbase.HasValue() && mbase.Value()->IsJSTypedArray()) { | 1205 if (mbase.HasValue() && mbase.Value()->IsJSTypedArray()) { |
1206 Handle<JSTypedArray> const array = | 1206 Handle<JSTypedArray> const array = |
1207 Handle<JSTypedArray>::cast(mbase.Value()); | 1207 Handle<JSTypedArray>::cast(mbase.Value()); |
1208 if (!array->GetBuffer()->was_neutered()) { | 1208 if (!array->GetBuffer()->was_neutered() && |
| 1209 !array->GetBuffer()->is_wasm_buffer()) { |
1209 array->GetBuffer()->set_is_neuterable(false); | 1210 array->GetBuffer()->set_is_neuterable(false); |
1210 BufferAccess const access(array->type()); | 1211 BufferAccess const access(array->type()); |
1211 size_t const k = | 1212 size_t const k = |
1212 ElementSizeLog2Of(access.machine_type().representation()); | 1213 ElementSizeLog2Of(access.machine_type().representation()); |
1213 double const byte_length = array->byte_length()->Number(); | 1214 double const byte_length = array->byte_length()->Number(); |
1214 CHECK_LT(k, arraysize(shifted_int32_ranges_)); | 1215 CHECK_LT(k, arraysize(shifted_int32_ranges_)); |
1215 if (key_type->Is(shifted_int32_ranges_[k]) && byte_length <= kMaxInt) { | 1216 if (key_type->Is(shifted_int32_ranges_[k]) && byte_length <= kMaxInt) { |
1216 // JSLoadProperty(typed-array, int32) | 1217 // JSLoadProperty(typed-array, int32) |
1217 Handle<FixedTypedArrayBase> elements = | 1218 Handle<FixedTypedArrayBase> elements = |
1218 Handle<FixedTypedArrayBase>::cast(handle(array->elements())); | 1219 Handle<FixedTypedArrayBase>::cast(handle(array->elements())); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 Node* value = NodeProperties::GetValueInput(node, 2); | 1251 Node* value = NodeProperties::GetValueInput(node, 2); |
1251 Type* key_type = NodeProperties::GetType(key); | 1252 Type* key_type = NodeProperties::GetType(key); |
1252 Type* value_type = NodeProperties::GetType(value); | 1253 Type* value_type = NodeProperties::GetType(value); |
1253 | 1254 |
1254 if (!value_type->Is(Type::PlainPrimitive())) return NoChange(); | 1255 if (!value_type->Is(Type::PlainPrimitive())) return NoChange(); |
1255 | 1256 |
1256 HeapObjectMatcher mbase(base); | 1257 HeapObjectMatcher mbase(base); |
1257 if (mbase.HasValue() && mbase.Value()->IsJSTypedArray()) { | 1258 if (mbase.HasValue() && mbase.Value()->IsJSTypedArray()) { |
1258 Handle<JSTypedArray> const array = | 1259 Handle<JSTypedArray> const array = |
1259 Handle<JSTypedArray>::cast(mbase.Value()); | 1260 Handle<JSTypedArray>::cast(mbase.Value()); |
1260 if (!array->GetBuffer()->was_neutered()) { | 1261 if (!array->GetBuffer()->was_neutered() && |
| 1262 !array->GetBuffer()->is_wasm_buffer()) { |
1261 array->GetBuffer()->set_is_neuterable(false); | 1263 array->GetBuffer()->set_is_neuterable(false); |
1262 BufferAccess const access(array->type()); | 1264 BufferAccess const access(array->type()); |
1263 size_t const k = | 1265 size_t const k = |
1264 ElementSizeLog2Of(access.machine_type().representation()); | 1266 ElementSizeLog2Of(access.machine_type().representation()); |
1265 double const byte_length = array->byte_length()->Number(); | 1267 double const byte_length = array->byte_length()->Number(); |
1266 CHECK_LT(k, arraysize(shifted_int32_ranges_)); | 1268 CHECK_LT(k, arraysize(shifted_int32_ranges_)); |
1267 if (access.external_array_type() != kExternalUint8ClampedArray && | 1269 if (access.external_array_type() != kExternalUint8ClampedArray && |
1268 key_type->Is(shifted_int32_ranges_[k]) && byte_length <= kMaxInt) { | 1270 key_type->Is(shifted_int32_ranges_[k]) && byte_length <= kMaxInt) { |
1269 // JSLoadProperty(typed-array, int32) | 1271 // JSLoadProperty(typed-array, int32) |
1270 Handle<FixedTypedArrayBase> elements = | 1272 Handle<FixedTypedArrayBase> elements = |
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2241 } | 2243 } |
2242 | 2244 |
2243 | 2245 |
2244 CompilationDependencies* JSTypedLowering::dependencies() const { | 2246 CompilationDependencies* JSTypedLowering::dependencies() const { |
2245 return dependencies_; | 2247 return dependencies_; |
2246 } | 2248 } |
2247 | 2249 |
2248 } // namespace compiler | 2250 } // namespace compiler |
2249 } // namespace internal | 2251 } // namespace internal |
2250 } // namespace v8 | 2252 } // namespace v8 |
OLD | NEW |