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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/contexts.h" | 9 #include "src/contexts.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 bool Accessors::IsJSObjectFieldAccessor(Handle<Map> map, Handle<Name> name, | 72 bool Accessors::IsJSObjectFieldAccessor(Handle<Map> map, Handle<Name> name, |
73 int* object_offset) { | 73 int* object_offset) { |
74 Isolate* isolate = name->GetIsolate(); | 74 Isolate* isolate = name->GetIsolate(); |
75 | 75 |
76 switch (map->instance_type()) { | 76 switch (map->instance_type()) { |
77 case JS_ARRAY_TYPE: | 77 case JS_ARRAY_TYPE: |
78 return | 78 return |
79 CheckForName(name, isolate->factory()->length_string(), | 79 CheckForName(name, isolate->factory()->length_string(), |
80 JSArray::kLengthOffset, object_offset); | 80 JSArray::kLengthOffset, object_offset); |
81 case JS_TYPED_ARRAY_TYPE: | 81 case JS_TYPED_ARRAY_TYPE: |
| 82 // %TypedArray%.prototype is non-configurable, and so are the following |
| 83 // named properties on %TypedArray%.prototype, so we can directly inline |
| 84 // the field-load for typed array maps that still use their |
| 85 // %TypedArray%.prototype. |
| 86 if (JSFunction::cast(map->GetConstructor())->prototype() != |
| 87 map->prototype()) { |
| 88 return false; |
| 89 } |
82 return | 90 return |
83 CheckForName(name, isolate->factory()->length_string(), | 91 CheckForName(name, isolate->factory()->length_string(), |
84 JSTypedArray::kLengthOffset, object_offset) || | 92 JSTypedArray::kLengthOffset, object_offset) || |
85 CheckForName(name, isolate->factory()->byte_length_string(), | 93 CheckForName(name, isolate->factory()->byte_length_string(), |
86 JSTypedArray::kByteLengthOffset, object_offset) || | 94 JSTypedArray::kByteLengthOffset, object_offset) || |
87 CheckForName(name, isolate->factory()->byte_offset_string(), | 95 CheckForName(name, isolate->factory()->byte_offset_string(), |
88 JSTypedArray::kByteOffsetOffset, object_offset); | 96 JSTypedArray::kByteOffsetOffset, object_offset); |
89 case JS_ARRAY_BUFFER_TYPE: | 97 case JS_ARRAY_BUFFER_TYPE: |
90 return | 98 return |
91 CheckForName(name, isolate->factory()->byte_length_string(), | 99 CheckForName(name, isolate->factory()->byte_length_string(), |
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1560 info->set_data(Smi::FromInt(index)); | 1568 info->set_data(Smi::FromInt(index)); |
1561 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); | 1569 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); |
1562 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); | 1570 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); |
1563 info->set_getter(*getter); | 1571 info->set_getter(*getter); |
1564 if (!(attributes & ReadOnly)) info->set_setter(*setter); | 1572 if (!(attributes & ReadOnly)) info->set_setter(*setter); |
1565 return info; | 1573 return info; |
1566 } | 1574 } |
1567 | 1575 |
1568 | 1576 |
1569 } } // namespace v8::internal | 1577 } } // namespace v8::internal |
OLD | NEW |