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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // If true, *object_offset contains offset of object field. | 71 // If true, *object_offset contains offset of object field. |
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: | |
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 } | |
90 return | |
91 CheckForName(name, isolate->factory()->length_string(), | |
92 JSTypedArray::kLengthOffset, object_offset) || | |
93 CheckForName(name, isolate->factory()->byte_length_string(), | |
94 JSTypedArray::kByteLengthOffset, object_offset) || | |
95 CheckForName(name, isolate->factory()->byte_offset_string(), | |
96 JSTypedArray::kByteOffsetOffset, object_offset); | |
97 case JS_ARRAY_BUFFER_TYPE: | 81 case JS_ARRAY_BUFFER_TYPE: |
98 return | 82 return |
99 CheckForName(name, isolate->factory()->byte_length_string(), | 83 CheckForName(name, isolate->factory()->byte_length_string(), |
100 JSArrayBuffer::kByteLengthOffset, object_offset); | 84 JSArrayBuffer::kByteLengthOffset, object_offset); |
101 case JS_DATA_VIEW_TYPE: | |
102 return | |
103 CheckForName(name, isolate->factory()->byte_length_string(), | |
104 JSDataView::kByteLengthOffset, object_offset) || | |
105 CheckForName(name, isolate->factory()->byte_offset_string(), | |
106 JSDataView::kByteOffsetOffset, object_offset); | |
107 default: | 85 default: |
108 if (map->instance_type() < FIRST_NONSTRING_TYPE) { | 86 if (map->instance_type() < FIRST_NONSTRING_TYPE) { |
109 return CheckForName(name, isolate->factory()->length_string(), | 87 return CheckForName(name, isolate->factory()->length_string(), |
110 String::kLengthOffset, object_offset); | 88 String::kLengthOffset, object_offset); |
111 } | 89 } |
112 | 90 |
113 return false; | 91 return false; |
114 } | 92 } |
115 } | 93 } |
116 | 94 |
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1476 info->set_data(Smi::FromInt(index)); | 1454 info->set_data(Smi::FromInt(index)); |
1477 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); | 1455 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); |
1478 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); | 1456 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); |
1479 info->set_getter(*getter); | 1457 info->set_getter(*getter); |
1480 if (!(attributes & ReadOnly)) info->set_setter(*setter); | 1458 if (!(attributes & ReadOnly)) info->set_setter(*setter); |
1481 return info; | 1459 return info; |
1482 } | 1460 } |
1483 | 1461 |
1484 | 1462 |
1485 } } // namespace v8::internal | 1463 } } // namespace v8::internal |
OLD | NEW |