| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/accessors.h" | 5 #include "src/accessors.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/contexts.h" | 8 #include "src/contexts.h" |
| 9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
| 10 #include "src/execution.h" | 10 #include "src/execution.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 86 } |
| 87 | 87 |
| 88 | 88 |
| 89 bool Accessors::IsJSArrayBufferViewFieldAccessor(Handle<Map> map, | 89 bool Accessors::IsJSArrayBufferViewFieldAccessor(Handle<Map> map, |
| 90 Handle<Name> name, | 90 Handle<Name> name, |
| 91 int* object_offset) { | 91 int* object_offset) { |
| 92 DCHECK(name->IsUniqueName()); | 92 DCHECK(name->IsUniqueName()); |
| 93 Isolate* isolate = name->GetIsolate(); | 93 Isolate* isolate = name->GetIsolate(); |
| 94 | 94 |
| 95 switch (map->instance_type()) { | 95 switch (map->instance_type()) { |
| 96 case JS_TYPED_ARRAY_TYPE: { | |
| 97 if (!CheckForName(name, isolate->factory()->length_string(), | |
| 98 JSTypedArray::kLengthOffset, object_offset) && | |
| 99 !CheckForName(name, isolate->factory()->byte_length_string(), | |
| 100 JSTypedArray::kByteLengthOffset, object_offset) && | |
| 101 !CheckForName(name, isolate->factory()->byte_offset_string(), | |
| 102 JSTypedArray::kByteOffsetOffset, object_offset)) { | |
| 103 return false; | |
| 104 } | |
| 105 | |
| 106 if (map->is_dictionary_map()) return false; | |
| 107 | |
| 108 // Check if the property is overridden on the instance. | |
| 109 DescriptorArray* descriptors = map->instance_descriptors(); | |
| 110 int descriptor = descriptors->SearchWithCache(isolate, *name, *map); | |
| 111 if (descriptor != DescriptorArray::kNotFound) return false; | |
| 112 | |
| 113 Handle<Object> proto = Handle<Object>(map->prototype(), isolate); | |
| 114 if (!proto->IsJSReceiver()) return false; | |
| 115 | |
| 116 // Check if the property is defined in the prototype chain. | |
| 117 LookupIterator it(proto, name); | |
| 118 if (!it.IsFound()) return false; | |
| 119 | |
| 120 Handle<Object> typed_array_proto = isolate->typed_array_prototype(); | |
| 121 | |
| 122 // Property is not configurable. It is enough to verify that | |
| 123 // the holder is the same. | |
| 124 return *it.GetHolder<Object>() == *typed_array_proto; | |
| 125 } | |
| 126 case JS_DATA_VIEW_TYPE: | 96 case JS_DATA_VIEW_TYPE: |
| 127 return CheckForName(name, isolate->factory()->byte_length_string(), | 97 return CheckForName(name, isolate->factory()->byte_length_string(), |
| 128 JSDataView::kByteLengthOffset, object_offset) || | 98 JSDataView::kByteLengthOffset, object_offset) || |
| 129 CheckForName(name, isolate->factory()->byte_offset_string(), | 99 CheckForName(name, isolate->factory()->byte_offset_string(), |
| 130 JSDataView::kByteOffsetOffset, object_offset); | 100 JSDataView::kByteOffsetOffset, object_offset); |
| 131 default: | 101 default: |
| 132 return false; | 102 return false; |
| 133 } | 103 } |
| 134 } | 104 } |
| 135 | 105 |
| (...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 Isolate* isolate = name->GetIsolate(); | 1179 Isolate* isolate = name->GetIsolate(); |
| 1210 Handle<AccessorInfo> info = MakeAccessor(isolate, name, &ModuleGetExport, | 1180 Handle<AccessorInfo> info = MakeAccessor(isolate, name, &ModuleGetExport, |
| 1211 &ModuleSetExport, attributes); | 1181 &ModuleSetExport, attributes); |
| 1212 info->set_data(Smi::FromInt(index)); | 1182 info->set_data(Smi::FromInt(index)); |
| 1213 return info; | 1183 return info; |
| 1214 } | 1184 } |
| 1215 | 1185 |
| 1216 | 1186 |
| 1217 } // namespace internal | 1187 } // namespace internal |
| 1218 } // namespace v8 | 1188 } // namespace v8 |
| OLD | NEW |