@@ -99,22 +99,37 @@ bool Accessors::IsJSArrayBufferViewFieldAccessor(Handle<Map> map,
99
99
Isolate* isolate = name->GetIsolate ();
100
100
101
101
switch (map->instance_type ()) {
102
- case JS_TYPED_ARRAY_TYPE:
103
- // %TypedArray%.prototype is non-configurable, and so are the following
104
- // named properties on %TypedArray%.prototype, so we can directly inline
105
- // the field-load for typed array maps that still use their
106
- // %TypedArray%.prototype.
107
- if ( JSFunction::cast (map-> GetConstructor ())-> prototype () !=
108
- map-> prototype ( )) {
102
+ case JS_TYPED_ARRAY_TYPE: {
103
+ if (! CheckForName (name, isolate-> factory ()-> length_string (),
104
+ JSTypedArray:: kLengthOffset , object_offset) &&
105
+ ! CheckForName (name, isolate-> factory ()-> byte_length_string (),
106
+ JSTypedArray:: kByteLengthOffset , object_offset) &&
107
+ ! CheckForName (name, isolate-> factory ()-> byte_offset_string (),
108
+ JSTypedArray:: kByteOffsetOffset , object_offset )) {
109
109
return false ;
110
110
}
111
- return CheckForName (name, isolate->factory ()->length_string (),
112
- JSTypedArray::kLengthOffset , object_offset) ||
113
- CheckForName (name, isolate->factory ()->byte_length_string (),
114
- JSTypedArray::kByteLengthOffset , object_offset) ||
115
- CheckForName (name, isolate->factory ()->byte_offset_string (),
116
- JSTypedArray::kByteOffsetOffset , object_offset);
117
111
112
+ if (map->is_dictionary_map ()) return false ;
113
+
114
+ // Check if the property is overridden on the instance.
115
+ DescriptorArray* descriptors = map->instance_descriptors ();
116
+ int descriptor = descriptors->SearchWithCache (*name, *map);
117
+ if (descriptor != DescriptorArray::kNotFound ) return false ;
118
+
119
+ Handle <Object> proto = Handle <Object>(map->prototype (), isolate);
120
+ if (!proto->IsJSReceiver ()) return false ;
121
+
122
+ // Check if the property is defined in the prototype chain.
123
+ LookupIterator it (proto, name);
124
+ if (!it.IsFound ()) return false ;
125
+
126
+ Object* original_proto =
127
+ JSFunction::cast (map->GetConstructor ())->prototype ();
128
+
129
+ // Property is not configurable. It is enough to verify that
130
+ // the holder is the same.
131
+ return *it.GetHolder <Object>() == original_proto;
132
+ }
118
133
case JS_DATA_VIEW_TYPE:
119
134
return CheckForName (name, isolate->factory ()->byte_length_string (),
120
135
JSDataView::kByteLengthOffset , object_offset) ||
0 commit comments