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_ARRAY_BUFFER_TYPE: | 81 case JS_ARRAY_BUFFER_TYPE: |
82 case JS_SHARED_ARRAY_BUFFER_TYPE: | |
82 return CheckForName(name, isolate->factory()->byte_length_string(), | 83 return CheckForName(name, isolate->factory()->byte_length_string(), |
83 JSArrayBuffer::kByteLengthOffset, object_offset); | 84 JSArrayBuffer::kByteLengthOffset, object_offset); |
84 default: | 85 default: |
85 if (map->instance_type() < FIRST_NONSTRING_TYPE) { | 86 if (map->instance_type() < FIRST_NONSTRING_TYPE) { |
86 return CheckForName(name, isolate->factory()->length_string(), | 87 return CheckForName(name, isolate->factory()->length_string(), |
87 String::kLengthOffset, object_offset); | 88 String::kLengthOffset, object_offset); |
88 } | 89 } |
89 | 90 |
90 return false; | 91 return false; |
91 } | 92 } |
92 } | 93 } |
93 | 94 |
94 | 95 |
95 bool Accessors::IsJSArrayBufferViewFieldAccessor(Handle<Map> map, | 96 bool Accessors::IsJSArrayBufferViewFieldAccessor(Handle<Map> map, |
96 Handle<Name> name, | 97 Handle<Name> name, |
97 int* object_offset) { | 98 int* object_offset) { |
98 Isolate* isolate = name->GetIsolate(); | 99 Isolate* isolate = name->GetIsolate(); |
99 | 100 |
100 switch (map->instance_type()) { | 101 switch (map->instance_type()) { |
101 case JS_TYPED_ARRAY_TYPE: | 102 case JS_TYPED_ARRAY_TYPE: |
103 case JS_SHARED_TYPED_ARRAY_TYPE: | |
jochen (gone - plz use gerrit)
2015/04/28 18:31:46
can shared array buffers be neutered?
binji
2015/04/29 18:27:22
no, does that affect the code here?
| |
102 // %TypedArray%.prototype is non-configurable, and so are the following | 104 // %TypedArray%.prototype is non-configurable, and so are the following |
103 // named properties on %TypedArray%.prototype, so we can directly inline | 105 // named properties on %TypedArray%.prototype, so we can directly inline |
104 // the field-load for typed array maps that still use their | 106 // the field-load for typed array maps that still use their |
105 // %TypedArray%.prototype. | 107 // %TypedArray%.prototype. |
106 if (JSFunction::cast(map->GetConstructor())->prototype() != | 108 if (JSFunction::cast(map->GetConstructor())->prototype() != |
107 map->prototype()) { | 109 map->prototype()) { |
108 return false; | 110 return false; |
109 } | 111 } |
110 return CheckForName(name, isolate->factory()->length_string(), | 112 return CheckForName(name, isolate->factory()->length_string(), |
111 JSTypedArray::kLengthOffset, object_offset) || | 113 JSTypedArray::kLengthOffset, object_offset) || |
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1486 info->set_data(Smi::FromInt(index)); | 1488 info->set_data(Smi::FromInt(index)); |
1487 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); | 1489 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); |
1488 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); | 1490 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); |
1489 info->set_getter(*getter); | 1491 info->set_getter(*getter); |
1490 if (!(attributes & ReadOnly)) info->set_setter(*setter); | 1492 if (!(attributes & ReadOnly)) info->set_setter(*setter); |
1491 return info; | 1493 return info; |
1492 } | 1494 } |
1493 | 1495 |
1494 | 1496 |
1495 } } // namespace v8::internal | 1497 } } // namespace v8::internal |
OLD | NEW |