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 // Review notes: | 5 // Review notes: |
6 // | 6 // |
7 // - The use of macros in these inline functions may seem superfluous | 7 // - The use of macros in these inline functions may seem superfluous |
8 // but it is absolutely needed to make sure gcc generates optimal | 8 // but it is absolutely needed to make sure gcc generates optimal |
9 // code. gcc is not happy when attempting to inline too deep. | 9 // code. gcc is not happy when attempting to inline too deep. |
10 // | 10 // |
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 isolate, object, handle(isolate->context()->native_context(), isolate)); | 1154 isolate, object, handle(isolate->context()->native_context(), isolate)); |
1155 } | 1155 } |
1156 | 1156 |
1157 | 1157 |
1158 bool Object::HasSpecificClassOf(String* name) { | 1158 bool Object::HasSpecificClassOf(String* name) { |
1159 return this->IsJSObject() && (JSObject::cast(this)->class_name() == name); | 1159 return this->IsJSObject() && (JSObject::cast(this)->class_name() == name); |
1160 } | 1160 } |
1161 | 1161 |
1162 | 1162 |
1163 MaybeHandle<Object> Object::GetProperty(Handle<Object> object, | 1163 MaybeHandle<Object> Object::GetProperty(Handle<Object> object, |
1164 Handle<Name> name) { | 1164 Handle<Name> name, |
| 1165 LanguageMode language_mode) { |
1165 LookupIterator it(object, name); | 1166 LookupIterator it(object, name); |
1166 return GetProperty(&it); | 1167 return GetProperty(&it, language_mode); |
1167 } | 1168 } |
1168 | 1169 |
1169 | 1170 |
1170 MaybeHandle<Object> Object::GetElement(Isolate* isolate, | 1171 MaybeHandle<Object> Object::GetElement(Isolate* isolate, Handle<Object> object, |
1171 Handle<Object> object, | 1172 uint32_t index, |
1172 uint32_t index) { | 1173 LanguageMode language_mode) { |
1173 LookupIterator it(isolate, object, index); | 1174 LookupIterator it(isolate, object, index); |
1174 return GetProperty(&it); | 1175 return GetProperty(&it, language_mode); |
1175 } | 1176 } |
1176 | 1177 |
1177 | 1178 |
1178 Handle<Object> Object::GetPrototypeSkipHiddenPrototypes( | 1179 Handle<Object> Object::GetPrototypeSkipHiddenPrototypes( |
1179 Isolate* isolate, Handle<Object> receiver) { | 1180 Isolate* isolate, Handle<Object> receiver) { |
1180 PrototypeIterator iter(isolate, receiver); | 1181 PrototypeIterator iter(isolate, receiver); |
1181 while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)) { | 1182 while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)) { |
1182 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { | 1183 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { |
1183 return PrototypeIterator::GetCurrent(iter); | 1184 return PrototypeIterator::GetCurrent(iter); |
1184 } | 1185 } |
1185 iter.Advance(); | 1186 iter.Advance(); |
1186 } | 1187 } |
1187 return PrototypeIterator::GetCurrent(iter); | 1188 return PrototypeIterator::GetCurrent(iter); |
1188 } | 1189 } |
1189 | 1190 |
1190 | 1191 |
1191 MaybeHandle<Object> Object::GetProperty(Isolate* isolate, | 1192 MaybeHandle<Object> Object::GetProperty(Isolate* isolate, Handle<Object> object, |
1192 Handle<Object> object, | 1193 const char* name, |
1193 const char* name) { | 1194 LanguageMode language_mode) { |
1194 Handle<String> str = isolate->factory()->InternalizeUtf8String(name); | 1195 Handle<String> str = isolate->factory()->InternalizeUtf8String(name); |
1195 return GetProperty(object, str); | 1196 return GetProperty(object, str, language_mode); |
1196 } | 1197 } |
1197 | 1198 |
1198 | 1199 |
1199 #define FIELD_ADDR(p, offset) \ | 1200 #define FIELD_ADDR(p, offset) \ |
1200 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) | 1201 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) |
1201 | 1202 |
1202 #define FIELD_ADDR_CONST(p, offset) \ | 1203 #define FIELD_ADDR_CONST(p, offset) \ |
1203 (reinterpret_cast<const byte*>(p) + offset - kHeapObjectTag) | 1204 (reinterpret_cast<const byte*>(p) + offset - kHeapObjectTag) |
1204 | 1205 |
1205 #define READ_FIELD(p, offset) \ | 1206 #define READ_FIELD(p, offset) \ |
(...skipping 5333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6539 if (HasHashCode()) return this; | 6540 if (HasHashCode()) return this; |
6540 String* canonical = String::cast(READ_FIELD(this, kHashFieldSlot)); | 6541 String* canonical = String::cast(READ_FIELD(this, kHashFieldSlot)); |
6541 DCHECK(canonical->IsInternalizedString()); | 6542 DCHECK(canonical->IsInternalizedString()); |
6542 DCHECK(SlowEquals(canonical)); | 6543 DCHECK(SlowEquals(canonical)); |
6543 DCHECK(canonical->HasHashCode()); | 6544 DCHECK(canonical->HasHashCode()); |
6544 return canonical; | 6545 return canonical; |
6545 } | 6546 } |
6546 | 6547 |
6547 | 6548 |
6548 MaybeHandle<Object> Object::GetPropertyOrElement(Handle<Object> object, | 6549 MaybeHandle<Object> Object::GetPropertyOrElement(Handle<Object> object, |
6549 Handle<Name> name) { | 6550 Handle<Name> name, |
| 6551 LanguageMode language_mode) { |
6550 LookupIterator it = | 6552 LookupIterator it = |
6551 LookupIterator::PropertyOrElement(name->GetIsolate(), object, name); | 6553 LookupIterator::PropertyOrElement(name->GetIsolate(), object, name); |
6552 return GetProperty(&it); | 6554 return GetProperty(&it, language_mode); |
6553 } | 6555 } |
6554 | 6556 |
6555 | 6557 |
6556 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object, | 6558 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object, |
6557 Handle<Name> name) { | 6559 Handle<Name> name) { |
6558 // Call the "has" trap on proxies. | 6560 // Call the "has" trap on proxies. |
6559 if (object->IsJSProxy()) { | 6561 if (object->IsJSProxy()) { |
6560 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); | 6562 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
6561 return JSProxy::HasPropertyWithHandler(proxy, name); | 6563 return JSProxy::HasPropertyWithHandler(proxy, name); |
6562 } | 6564 } |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7297 #undef READ_SHORT_FIELD | 7299 #undef READ_SHORT_FIELD |
7298 #undef WRITE_SHORT_FIELD | 7300 #undef WRITE_SHORT_FIELD |
7299 #undef READ_BYTE_FIELD | 7301 #undef READ_BYTE_FIELD |
7300 #undef WRITE_BYTE_FIELD | 7302 #undef WRITE_BYTE_FIELD |
7301 #undef NOBARRIER_READ_BYTE_FIELD | 7303 #undef NOBARRIER_READ_BYTE_FIELD |
7302 #undef NOBARRIER_WRITE_BYTE_FIELD | 7304 #undef NOBARRIER_WRITE_BYTE_FIELD |
7303 | 7305 |
7304 } } // namespace v8::internal | 7306 } } // namespace v8::internal |
7305 | 7307 |
7306 #endif // V8_OBJECTS_INL_H_ | 7308 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |