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 5180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6397 | 6401 |
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, handler, Object, kHandlerOffset) | 6409 ACCESSORS(JSProxy, handler, Object, kHandlerOffset) |
6406 ACCESSORS(JSProxy, hash, Object, kHashOffset) | 6410 ACCESSORS(JSProxy, hash, Object, kHashOffset) |
6411 Object* JSProxy::target() const { return map()->prototype(); } | |
Jakob Kummerow
2015/11/12 12:04:24
As discussed, we probably prefer an explicit |targ
Camillo Bruni
2015/11/12 20:20:55
added todo.
| |
6412 void JSProxy::set_target(Object* value, WriteBarrierMode mode) { | |
6413 map()->set_prototype(value, mode); | |
6414 } | |
6415 | |
6407 ACCESSORS(JSFunctionProxy, call_trap, JSReceiver, kCallTrapOffset) | 6416 ACCESSORS(JSFunctionProxy, call_trap, JSReceiver, kCallTrapOffset) |
6408 ACCESSORS(JSFunctionProxy, construct_trap, Object, kConstructTrapOffset) | 6417 ACCESSORS(JSFunctionProxy, construct_trap, Object, kConstructTrapOffset) |
6409 | 6418 |
6410 | 6419 |
6411 void JSProxy::InitializeBody(int object_size, Object* value) { | 6420 void JSProxy::InitializeBody(int object_size, Object* value) { |
6412 DCHECK(!value->IsHeapObject() || !GetHeap()->InNewSpace(value)); | 6421 DCHECK(!value->IsHeapObject() || !GetHeap()->InNewSpace(value)); |
6413 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) { | 6422 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) { |
6414 WRITE_FIELD(this, offset, value); | 6423 WRITE_FIELD(this, offset, value); |
6415 } | 6424 } |
6416 } | 6425 } |
(...skipping 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8089 #undef WRITE_INT64_FIELD | 8098 #undef WRITE_INT64_FIELD |
8090 #undef READ_BYTE_FIELD | 8099 #undef READ_BYTE_FIELD |
8091 #undef WRITE_BYTE_FIELD | 8100 #undef WRITE_BYTE_FIELD |
8092 #undef NOBARRIER_READ_BYTE_FIELD | 8101 #undef NOBARRIER_READ_BYTE_FIELD |
8093 #undef NOBARRIER_WRITE_BYTE_FIELD | 8102 #undef NOBARRIER_WRITE_BYTE_FIELD |
8094 | 8103 |
8095 } // namespace internal | 8104 } // namespace internal |
8096 } // namespace v8 | 8105 } // namespace v8 |
8097 | 8106 |
8098 #endif // V8_OBJECTS_INL_H_ | 8107 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |