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

Unified Diff: src/compiler/js-typed-lowering.cc

Issue 794113002: [turbofan] Fix typing of typed array loads/stores. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/compiler/typer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-typed-lowering.cc
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc
index a04a79b80b9070df14d4dec8625eb3ada6e73540..ce3ecc59d49f541a6ecbfac23335a02acdc01443 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -731,13 +731,12 @@ Reduction JSTypedLowering::ReduceJSLoadProperty(Node* node) {
Node* key = NodeProperties::GetValueInput(node, 1);
Node* base = NodeProperties::GetValueInput(node, 0);
Type* key_type = NodeProperties::GetBounds(key).upper;
- Type* base_type = NodeProperties::GetBounds(base).upper;
// TODO(mstarzinger): This lowering is not correct if:
// a) The typed array or it's buffer is neutered.
- if (base_type->IsConstant() &&
- base_type->AsConstant()->Value()->IsJSTypedArray()) {
+ HeapObjectMatcher<Object> mbase(base);
+ if (mbase.HasValue() && mbase.Value().handle()->IsJSTypedArray()) {
Handle<JSTypedArray> const array =
- Handle<JSTypedArray>::cast(base_type->AsConstant()->Value());
+ Handle<JSTypedArray>::cast(mbase.Value().handle());
array->GetBuffer()->set_is_neuterable(false);
BufferAccess const access(array->type());
size_t const k = ElementSizeLog2Of(access.machine_type());
@@ -777,14 +776,13 @@ Reduction JSTypedLowering::ReduceJSStoreProperty(Node* node) {
Node* base = NodeProperties::GetValueInput(node, 0);
Node* value = NodeProperties::GetValueInput(node, 2);
Type* key_type = NodeProperties::GetBounds(key).upper;
- Type* base_type = NodeProperties::GetBounds(base).upper;
Type* value_type = NodeProperties::GetBounds(value).upper;
// TODO(mstarzinger): This lowering is not correct if:
// a) The typed array or its buffer is neutered.
- if (base_type->IsConstant() &&
- base_type->AsConstant()->Value()->IsJSTypedArray()) {
+ HeapObjectMatcher<Object> mbase(base);
+ if (mbase.HasValue() && mbase.Value().handle()->IsJSTypedArray()) {
Handle<JSTypedArray> const array =
- Handle<JSTypedArray>::cast(base_type->AsConstant()->Value());
+ Handle<JSTypedArray>::cast(mbase.Value().handle());
array->GetBuffer()->set_is_neuterable(false);
BufferAccess const access(array->type());
size_t const k = ElementSizeLog2Of(access.machine_type());
« no previous file with comments | « no previous file | src/compiler/typer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698