| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 bool Accessors::IsJSObjectFieldAccessor(Handle<Map> map, Handle<Name> name, | 74 bool Accessors::IsJSObjectFieldAccessor(Handle<Map> map, Handle<Name> name, |
| 75 int* object_offset) { | 75 int* object_offset) { |
| 76 Isolate* isolate = name->GetIsolate(); | 76 Isolate* isolate = name->GetIsolate(); |
| 77 | 77 |
| 78 switch (map->instance_type()) { | 78 switch (map->instance_type()) { |
| 79 case JS_ARRAY_TYPE: | 79 case JS_ARRAY_TYPE: |
| 80 return | 80 return |
| 81 CheckForName(name, isolate->factory()->length_string(), | 81 CheckForName(name, isolate->factory()->length_string(), |
| 82 JSArray::kLengthOffset, object_offset); | 82 JSArray::kLengthOffset, object_offset); |
| 83 case JS_ARRAY_BUFFER_TYPE: | 83 case JS_ARRAY_BUFFER_TYPE: |
| 84 case JS_SHARED_ARRAY_BUFFER_TYPE: |
| 84 return CheckForName(name, isolate->factory()->byte_length_string(), | 85 return CheckForName(name, isolate->factory()->byte_length_string(), |
| 85 JSArrayBuffer::kByteLengthOffset, object_offset); | 86 JSArrayBuffer::kByteLengthOffset, object_offset); |
| 86 default: | 87 default: |
| 87 if (map->instance_type() < FIRST_NONSTRING_TYPE) { | 88 if (map->instance_type() < FIRST_NONSTRING_TYPE) { |
| 88 return CheckForName(name, isolate->factory()->length_string(), | 89 return CheckForName(name, isolate->factory()->length_string(), |
| 89 String::kLengthOffset, object_offset); | 90 String::kLengthOffset, object_offset); |
| 90 } | 91 } |
| 91 | 92 |
| 92 return false; | 93 return false; |
| 93 } | 94 } |
| 94 } | 95 } |
| 95 | 96 |
| 96 | 97 |
| 97 bool Accessors::IsJSArrayBufferViewFieldAccessor(Handle<Map> map, | 98 bool Accessors::IsJSArrayBufferViewFieldAccessor(Handle<Map> map, |
| 98 Handle<Name> name, | 99 Handle<Name> name, |
| 99 int* object_offset) { | 100 int* object_offset) { |
| 100 Isolate* isolate = name->GetIsolate(); | 101 Isolate* isolate = name->GetIsolate(); |
| 101 | 102 |
| 102 switch (map->instance_type()) { | 103 switch (map->instance_type()) { |
| 103 case JS_TYPED_ARRAY_TYPE: | 104 case JS_TYPED_ARRAY_TYPE: |
| 105 case JS_SHARED_TYPED_ARRAY_TYPE: |
| 104 // %TypedArray%.prototype is non-configurable, and so are the following | 106 // %TypedArray%.prototype is non-configurable, and so are the following |
| 105 // named properties on %TypedArray%.prototype, so we can directly inline | 107 // named properties on %TypedArray%.prototype, so we can directly inline |
| 106 // the field-load for typed array maps that still use their | 108 // the field-load for typed array maps that still use their |
| 107 // %TypedArray%.prototype. | 109 // %TypedArray%.prototype. |
| 108 if (JSFunction::cast(map->GetConstructor())->prototype() != | 110 if (JSFunction::cast(map->GetConstructor())->prototype() != |
| 109 map->prototype()) { | 111 map->prototype()) { |
| 110 return false; | 112 return false; |
| 111 } | 113 } |
| 112 return CheckForName(name, isolate->factory()->length_string(), | 114 return CheckForName(name, isolate->factory()->length_string(), |
| 113 JSTypedArray::kLengthOffset, object_offset) || | 115 JSTypedArray::kLengthOffset, object_offset) || |
| (...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1451 info->set_data(Smi::FromInt(index)); | 1453 info->set_data(Smi::FromInt(index)); |
| 1452 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); | 1454 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); |
| 1453 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); | 1455 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); |
| 1454 info->set_getter(*getter); | 1456 info->set_getter(*getter); |
| 1455 if (!(attributes & ReadOnly)) info->set_setter(*setter); | 1457 if (!(attributes & ReadOnly)) info->set_setter(*setter); |
| 1456 return info; | 1458 return info; |
| 1457 } | 1459 } |
| 1458 | 1460 |
| 1459 | 1461 |
| 1460 } } // namespace v8::internal | 1462 } } // namespace v8::internal |
| OLD | NEW |