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 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 MaybeHandle<Object> Object::SetElement(Isolate* isolate, Handle<Object> object, | 1187 MaybeHandle<Object> Object::SetElement(Isolate* isolate, Handle<Object> object, |
1188 uint32_t index, Handle<Object> value, | 1188 uint32_t index, Handle<Object> value, |
1189 LanguageMode language_mode) { | 1189 LanguageMode language_mode) { |
1190 LookupIterator it(isolate, object, index); | 1190 LookupIterator it(isolate, object, index); |
1191 MAYBE_RETURN_NULL( | 1191 MAYBE_RETURN_NULL( |
1192 SetProperty(&it, value, language_mode, MAY_BE_STORE_FROM_KEYED)); | 1192 SetProperty(&it, value, language_mode, MAY_BE_STORE_FROM_KEYED)); |
1193 return value; | 1193 return value; |
1194 } | 1194 } |
1195 | 1195 |
1196 | 1196 |
1197 Handle<Object> Object::GetPrototype(Isolate* isolate, Handle<Object> obj) { | 1197 MaybeHandle<Object> Object::GetPrototype(Isolate* isolate, |
| 1198 Handle<Object> receiver) { |
1198 // We don't expect access checks to be needed on JSProxy objects. | 1199 // We don't expect access checks to be needed on JSProxy objects. |
1199 DCHECK(!obj->IsAccessCheckNeeded() || obj->IsJSObject()); | 1200 DCHECK(!receiver->IsAccessCheckNeeded() || receiver->IsJSObject()); |
1200 Handle<Context> context(isolate->context()); | 1201 Handle<Context> context(isolate->context()); |
1201 if (obj->IsAccessCheckNeeded() && | 1202 if (receiver->IsAccessCheckNeeded() && |
1202 !isolate->MayAccess(context, Handle<JSObject>::cast(obj))) { | 1203 !isolate->MayAccess(context, Handle<JSObject>::cast(receiver))) { |
1203 return isolate->factory()->null_value(); | 1204 return isolate->factory()->null_value(); |
1204 } | 1205 } |
1205 | 1206 if (receiver->IsJSProxy()) { |
1206 PrototypeIterator iter(isolate, obj, PrototypeIterator::START_AT_RECEIVER); | 1207 return JSProxy::GetPrototype(Handle<JSProxy>::cast(receiver)); |
| 1208 } |
| 1209 PrototypeIterator iter(isolate, receiver, |
| 1210 PrototypeIterator::START_AT_RECEIVER); |
1207 do { | 1211 do { |
1208 iter.AdvanceIgnoringProxies(); | 1212 iter.AdvanceIgnoringProxies(); |
1209 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { | 1213 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { |
1210 return PrototypeIterator::GetCurrent(iter); | 1214 return PrototypeIterator::GetCurrent(iter); |
1211 } | 1215 } |
1212 } while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)); | 1216 } while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)); |
1213 return PrototypeIterator::GetCurrent(iter); | 1217 return PrototypeIterator::GetCurrent(iter); |
1214 } | 1218 } |
1215 | 1219 |
1216 | 1220 |
(...skipping 5181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6398 | 6402 |
6399 int JSFunction::NumberOfLiterals() { | 6403 int JSFunction::NumberOfLiterals() { |
6400 DCHECK(!shared()->bound()); | 6404 DCHECK(!shared()->bound()); |
6401 return literals()->length(); | 6405 return literals()->length(); |
6402 } | 6406 } |
6403 | 6407 |
6404 | 6408 |
6405 ACCESSORS(JSProxy, target, Object, kTargetOffset) | 6409 ACCESSORS(JSProxy, target, Object, kTargetOffset) |
6406 ACCESSORS(JSProxy, handler, Object, kHandlerOffset) | 6410 ACCESSORS(JSProxy, handler, Object, kHandlerOffset) |
6407 ACCESSORS(JSProxy, hash, Object, kHashOffset) | 6411 ACCESSORS(JSProxy, hash, Object, kHashOffset) |
| 6412 bool JSProxy::has_handler() { return !handler()->IsNull(); } |
| 6413 |
6408 ACCESSORS(JSFunctionProxy, call_trap, JSReceiver, kCallTrapOffset) | 6414 ACCESSORS(JSFunctionProxy, call_trap, JSReceiver, kCallTrapOffset) |
6409 ACCESSORS(JSFunctionProxy, construct_trap, Object, kConstructTrapOffset) | 6415 ACCESSORS(JSFunctionProxy, construct_trap, Object, kConstructTrapOffset) |
6410 | 6416 |
6411 | 6417 |
6412 ACCESSORS(JSCollection, table, Object, kTableOffset) | 6418 ACCESSORS(JSCollection, table, Object, kTableOffset) |
6413 | 6419 |
6414 | 6420 |
6415 #define ORDERED_HASH_TABLE_ITERATOR_ACCESSORS(name, type, offset) \ | 6421 #define ORDERED_HASH_TABLE_ITERATOR_ACCESSORS(name, type, offset) \ |
6416 template<class Derived, class TableType> \ | 6422 template<class Derived, class TableType> \ |
6417 type* OrderedHashTableIterator<Derived, TableType>::name() const { \ | 6423 type* OrderedHashTableIterator<Derived, TableType>::name() const { \ |
(...skipping 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8144 #undef WRITE_INT64_FIELD | 8150 #undef WRITE_INT64_FIELD |
8145 #undef READ_BYTE_FIELD | 8151 #undef READ_BYTE_FIELD |
8146 #undef WRITE_BYTE_FIELD | 8152 #undef WRITE_BYTE_FIELD |
8147 #undef NOBARRIER_READ_BYTE_FIELD | 8153 #undef NOBARRIER_READ_BYTE_FIELD |
8148 #undef NOBARRIER_WRITE_BYTE_FIELD | 8154 #undef NOBARRIER_WRITE_BYTE_FIELD |
8149 | 8155 |
8150 } // namespace internal | 8156 } // namespace internal |
8151 } // namespace v8 | 8157 } // namespace v8 |
8152 | 8158 |
8153 #endif // V8_OBJECTS_INL_H_ | 8159 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |