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

Unified Diff: src/compiler/access-info.cc

Issue 1453653003: [turbofan] Add support for special JSArrayBufferView accessors. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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 | « src/compiler/access-info.h ('k') | src/compiler/js-native-context-specialization.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/access-info.cc
diff --git a/src/compiler/access-info.cc b/src/compiler/access-info.cc
index 4748023c16c7d1ff9cb460fb90a919d9721f78c6..0693d35c0ae64f159d522fcb0891ca34eb39775f 100644
--- a/src/compiler/access-info.cc
+++ b/src/compiler/access-info.cc
@@ -75,9 +75,10 @@ PropertyAccessInfo PropertyAccessInfo::DataConstant(
// static
PropertyAccessInfo PropertyAccessInfo::DataField(
Type* receiver_type, FieldIndex field_index, Type* field_type,
- MaybeHandle<JSObject> holder, MaybeHandle<Map> transition_map) {
- return PropertyAccessInfo(holder, transition_map, field_index, field_type,
- receiver_type);
+ FieldCheck field_check, MaybeHandle<JSObject> holder,
+ MaybeHandle<Map> transition_map) {
+ return PropertyAccessInfo(holder, transition_map, field_index, field_check,
+ field_type, receiver_type);
}
@@ -116,13 +117,15 @@ PropertyAccessInfo::PropertyAccessInfo(MaybeHandle<JSObject> holder,
PropertyAccessInfo::PropertyAccessInfo(MaybeHandle<JSObject> holder,
MaybeHandle<Map> transition_map,
- FieldIndex field_index, Type* field_type,
+ FieldIndex field_index,
+ FieldCheck field_check, Type* field_type,
Type* receiver_type)
: kind_(kDataField),
receiver_type_(receiver_type),
transition_map_(transition_map),
holder_(holder),
field_index_(field_index),
+ field_check_(field_check),
field_type_(field_type) {}
@@ -286,7 +289,8 @@ bool AccessInfoFactory::ComputePropertyAccessInfo(
DCHECK(field_type->Is(Type::TaggedPointer()));
}
*access_info = PropertyAccessInfo::DataField(
- Type::Class(receiver_map, zone()), field_index, field_type, holder);
+ Type::Class(receiver_map, zone()), field_index, field_type,
+ FieldCheck::kNone, holder);
return true;
} else {
// TODO(bmeurer): Add support for accessors.
@@ -390,6 +394,26 @@ bool AccessInfoFactory::LookupSpecialFieldAccessor(
field_index, field_type);
return true;
}
+ // Check for special JSArrayBufferView field accessors.
+ if (Accessors::IsJSArrayBufferViewFieldAccessor(map, name, &offset)) {
+ FieldIndex field_index = FieldIndex::ForInObjectOffset(offset);
+ Type* field_type = Type::Tagged();
+ if (Name::Equals(factory()->byte_length_string(), name) ||
+ Name::Equals(factory()->byte_offset_string(), name)) {
+ // The JSArrayBufferView::byte_length and JSArrayBufferView::byte_offset
+ // properties are always numbers in the range [0, kMaxSafeInteger].
+ field_type = type_cache_.kPositiveSafeInteger;
+ } else if (map->IsJSTypedArrayMap()) {
+ DCHECK(Name::Equals(factory()->length_string(), name));
+ // The JSTypedArray::length property is always a number in the range
+ // [0, kMaxSafeInteger].
+ field_type = type_cache_.kPositiveSafeInteger;
+ }
+ *access_info = PropertyAccessInfo::DataField(
+ Type::Class(map, zone()), field_index, field_type,
+ FieldCheck::kJSArrayBufferViewBufferNotNeutered);
+ return true;
+ }
return false;
}
@@ -440,9 +464,9 @@ bool AccessInfoFactory::LookupTransition(Handle<Map> map, Handle<Name> name,
DCHECK(field_type->Is(Type::TaggedPointer()));
}
dependencies()->AssumeMapNotDeprecated(transition_map);
- *access_info =
- PropertyAccessInfo::DataField(Type::Class(map, zone()), field_index,
- field_type, holder, transition_map);
+ *access_info = PropertyAccessInfo::DataField(
+ Type::Class(map, zone()), field_index, field_type, FieldCheck::kNone,
+ holder, transition_map);
return true;
}
return false;
« no previous file with comments | « src/compiler/access-info.h ('k') | src/compiler/js-native-context-specialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698