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 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1174 | 1174 |
1175 | 1175 |
1176 MaybeHandle<Object> Object::SetElement(Isolate* isolate, Handle<Object> object, | 1176 MaybeHandle<Object> Object::SetElement(Isolate* isolate, Handle<Object> object, |
1177 uint32_t index, Handle<Object> value, | 1177 uint32_t index, Handle<Object> value, |
1178 LanguageMode language_mode) { | 1178 LanguageMode language_mode) { |
1179 LookupIterator it(isolate, object, index); | 1179 LookupIterator it(isolate, object, index); |
1180 return SetProperty(&it, value, language_mode, MAY_BE_STORE_FROM_KEYED); | 1180 return SetProperty(&it, value, language_mode, MAY_BE_STORE_FROM_KEYED); |
1181 } | 1181 } |
1182 | 1182 |
1183 | 1183 |
1184 Handle<Object> Object::GetPrototypeSkipHiddenPrototypes( | 1184 Handle<Object> Object::GetPrototype(Isolate* isolate, Handle<Object> obj) { |
1185 Isolate* isolate, Handle<Object> receiver) { | 1185 // We don't expect access checks to be needed on JSProxy objects. |
1186 PrototypeIterator iter(isolate, receiver); | 1186 DCHECK(!obj->IsAccessCheckNeeded() || obj->IsJSObject()); |
1187 while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)) { | 1187 Handle<Context> context(isolate->context()); |
1188 if (obj->IsAccessCheckNeeded() && | |
1189 !isolate->MayAccess(context, Handle<JSObject>::cast(obj))) { | |
1190 return isolate->factory()->null_value(); | |
1191 } | |
1192 return GetPrototypeWithAccess(isolate, obj); | |
1193 } | |
1194 | |
1195 | |
1196 Handle<Object> Object::GetPrototypeWithAccess(Isolate* isolate, | |
1197 Handle<Object> obj) { | |
Toon Verwaest
2015/10/14 10:56:18
If you want to have such a function, make sure it
| |
1198 PrototypeIterator iter(isolate, obj, PrototypeIterator::START_AT_RECEIVER); | |
1199 do { | |
1200 iter.AdvanceIgnoringProxies(); | |
1188 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { | 1201 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { |
1189 return PrototypeIterator::GetCurrent(iter); | 1202 return PrototypeIterator::GetCurrent(iter); |
1190 } | 1203 } |
1191 iter.Advance(); | 1204 } while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)); |
1192 } | |
1193 return PrototypeIterator::GetCurrent(iter); | 1205 return PrototypeIterator::GetCurrent(iter); |
1194 } | 1206 } |
1195 | 1207 |
1196 | 1208 |
1197 MaybeHandle<Object> Object::GetProperty(Isolate* isolate, Handle<Object> object, | 1209 MaybeHandle<Object> Object::GetProperty(Isolate* isolate, Handle<Object> object, |
1198 const char* name, | 1210 const char* name, |
1199 LanguageMode language_mode) { | 1211 LanguageMode language_mode) { |
1200 Handle<String> str = isolate->factory()->InternalizeUtf8String(name); | 1212 Handle<String> str = isolate->factory()->InternalizeUtf8String(name); |
1201 return GetProperty(object, str, language_mode); | 1213 return GetProperty(object, str, language_mode); |
1202 } | 1214 } |
(...skipping 6924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8127 #undef WRITE_INT64_FIELD | 8139 #undef WRITE_INT64_FIELD |
8128 #undef READ_BYTE_FIELD | 8140 #undef READ_BYTE_FIELD |
8129 #undef WRITE_BYTE_FIELD | 8141 #undef WRITE_BYTE_FIELD |
8130 #undef NOBARRIER_READ_BYTE_FIELD | 8142 #undef NOBARRIER_READ_BYTE_FIELD |
8131 #undef NOBARRIER_WRITE_BYTE_FIELD | 8143 #undef NOBARRIER_WRITE_BYTE_FIELD |
8132 | 8144 |
8133 } // namespace internal | 8145 } // namespace internal |
8134 } // namespace v8 | 8146 } // namespace v8 |
8135 | 8147 |
8136 #endif // V8_OBJECTS_INL_H_ | 8148 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |