OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 JSObject*, | 73 JSObject*, |
74 Object* value, | 74 Object* value, |
75 void*) { | 75 void*) { |
76 // According to ECMA-262, section 8.6.2.2, page 28, setting | 76 // According to ECMA-262, section 8.6.2.2, page 28, setting |
77 // read-only properties must be silently ignored. | 77 // read-only properties must be silently ignored. |
78 return value; | 78 return value; |
79 } | 79 } |
80 | 80 |
81 | 81 |
82 static V8_INLINE bool CheckForName(Handle<String> name, | 82 static V8_INLINE bool CheckForName(Handle<String> name, |
83 String* property_name, | 83 Handle<String> property_name, |
84 int offset, | 84 int offset, |
85 int* object_offset) { | 85 int* object_offset) { |
86 if (name->Equals(property_name)) { | 86 if (String::Equals(name, property_name)) { |
87 *object_offset = offset; | 87 *object_offset = offset; |
88 return true; | 88 return true; |
89 } | 89 } |
90 return false; | 90 return false; |
91 } | 91 } |
92 | 92 |
93 | 93 |
94 // Returns true for properties that are accessors to object fields. | 94 // Returns true for properties that are accessors to object fields. |
95 // If true, *object_offset contains offset of object field. | 95 // If true, *object_offset contains offset of object field. |
96 template <class T> | 96 template <class T> |
97 bool Accessors::IsJSObjectFieldAccessor(typename T::TypeHandle type, | 97 bool Accessors::IsJSObjectFieldAccessor(typename T::TypeHandle type, |
98 Handle<String> name, | 98 Handle<String> name, |
99 int* object_offset) { | 99 int* object_offset) { |
100 Isolate* isolate = name->GetIsolate(); | 100 Isolate* isolate = name->GetIsolate(); |
101 | 101 |
102 if (type->Is(T::String())) { | 102 if (type->Is(T::String())) { |
103 return CheckForName(name, isolate->heap()->length_string(), | 103 return CheckForName(name, isolate->factory()->length_string(), |
104 String::kLengthOffset, object_offset); | 104 String::kLengthOffset, object_offset); |
105 } | 105 } |
106 | 106 |
107 if (!type->IsClass()) return false; | 107 if (!type->IsClass()) return false; |
108 Handle<Map> map = type->AsClass(); | 108 Handle<Map> map = type->AsClass(); |
109 | 109 |
110 switch (map->instance_type()) { | 110 switch (map->instance_type()) { |
111 case JS_ARRAY_TYPE: | 111 case JS_ARRAY_TYPE: |
112 return | 112 return |
113 CheckForName(name, isolate->heap()->length_string(), | 113 CheckForName(name, isolate->factory()->length_string(), |
114 JSArray::kLengthOffset, object_offset); | 114 JSArray::kLengthOffset, object_offset); |
115 case JS_TYPED_ARRAY_TYPE: | 115 case JS_TYPED_ARRAY_TYPE: |
116 return | 116 return |
117 CheckForName(name, isolate->heap()->length_string(), | 117 CheckForName(name, isolate->factory()->length_string(), |
118 JSTypedArray::kLengthOffset, object_offset) || | 118 JSTypedArray::kLengthOffset, object_offset) || |
119 CheckForName(name, isolate->heap()->byte_length_string(), | 119 CheckForName(name, isolate->factory()->byte_length_string(), |
120 JSTypedArray::kByteLengthOffset, object_offset) || | 120 JSTypedArray::kByteLengthOffset, object_offset) || |
121 CheckForName(name, isolate->heap()->byte_offset_string(), | 121 CheckForName(name, isolate->factory()->byte_offset_string(), |
122 JSTypedArray::kByteOffsetOffset, object_offset); | 122 JSTypedArray::kByteOffsetOffset, object_offset); |
123 case JS_ARRAY_BUFFER_TYPE: | 123 case JS_ARRAY_BUFFER_TYPE: |
124 return | 124 return |
125 CheckForName(name, isolate->heap()->byte_length_string(), | 125 CheckForName(name, isolate->factory()->byte_length_string(), |
126 JSArrayBuffer::kByteLengthOffset, object_offset); | 126 JSArrayBuffer::kByteLengthOffset, object_offset); |
127 case JS_DATA_VIEW_TYPE: | 127 case JS_DATA_VIEW_TYPE: |
128 return | 128 return |
129 CheckForName(name, isolate->heap()->byte_length_string(), | 129 CheckForName(name, isolate->factory()->byte_length_string(), |
130 JSDataView::kByteLengthOffset, object_offset) || | 130 JSDataView::kByteLengthOffset, object_offset) || |
131 CheckForName(name, isolate->heap()->byte_offset_string(), | 131 CheckForName(name, isolate->factory()->byte_offset_string(), |
132 JSDataView::kByteOffsetOffset, object_offset); | 132 JSDataView::kByteOffsetOffset, object_offset); |
133 default: | 133 default: |
134 return false; | 134 return false; |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 | 138 |
139 template | 139 template |
140 bool Accessors::IsJSObjectFieldAccessor<Type>(Type* type, | 140 bool Accessors::IsJSObjectFieldAccessor<Type>(Type* type, |
141 Handle<String> name, | 141 Handle<String> name, |
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 info->set_data(Smi::FromInt(index)); | 967 info->set_data(Smi::FromInt(index)); |
968 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); | 968 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); |
969 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); | 969 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); |
970 info->set_getter(*getter); | 970 info->set_getter(*getter); |
971 if (!(attributes & ReadOnly)) info->set_setter(*setter); | 971 if (!(attributes & ReadOnly)) info->set_setter(*setter); |
972 return info; | 972 return info; |
973 } | 973 } |
974 | 974 |
975 | 975 |
976 } } // namespace v8::internal | 976 } } // namespace v8::internal |
OLD | NEW |