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 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1192 | 1192 |
1193 | 1193 |
1194 MaybeHandle<Object> Object::SetElement(Isolate* isolate, Handle<Object> object, | 1194 MaybeHandle<Object> Object::SetElement(Isolate* isolate, Handle<Object> object, |
1195 uint32_t index, Handle<Object> value, | 1195 uint32_t index, Handle<Object> value, |
1196 LanguageMode language_mode) { | 1196 LanguageMode language_mode) { |
1197 LookupIterator it(isolate, object, index); | 1197 LookupIterator it(isolate, object, index); |
1198 return SetProperty(&it, value, language_mode, MAY_BE_STORE_FROM_KEYED); | 1198 return SetProperty(&it, value, language_mode, MAY_BE_STORE_FROM_KEYED); |
1199 } | 1199 } |
1200 | 1200 |
1201 | 1201 |
1202 Handle<Object> Object::GetPrototypeSkipHiddenPrototypes( | 1202 Handle<Object> Object::GetPrototype(Isolate* isolate, Handle<Object> obj) { |
1203 Isolate* isolate, Handle<Object> receiver) { | 1203 // We don't expect access checks to be needed on JSProxy objects. |
1204 PrototypeIterator iter(isolate, receiver); | 1204 DCHECK(!obj->IsAccessCheckNeeded() || obj->IsJSObject()); |
1205 while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)) { | 1205 Handle<Context> context(isolate->context()); |
| 1206 if (obj->IsAccessCheckNeeded() && |
| 1207 !isolate->MayAccess(context, Handle<JSObject>::cast(obj))) { |
| 1208 return isolate->factory()->null_value(); |
| 1209 } |
| 1210 |
| 1211 PrototypeIterator iter(isolate, obj, PrototypeIterator::START_AT_RECEIVER); |
| 1212 do { |
| 1213 iter.AdvanceIgnoringProxies(); |
1206 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { | 1214 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { |
1207 return PrototypeIterator::GetCurrent(iter); | 1215 return PrototypeIterator::GetCurrent(iter); |
1208 } | 1216 } |
1209 iter.Advance(); | 1217 } while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)); |
1210 } | |
1211 return PrototypeIterator::GetCurrent(iter); | 1218 return PrototypeIterator::GetCurrent(iter); |
1212 } | 1219 } |
1213 | 1220 |
1214 | 1221 |
1215 MaybeHandle<Object> Object::GetProperty(Isolate* isolate, Handle<Object> object, | 1222 MaybeHandle<Object> Object::GetProperty(Isolate* isolate, Handle<Object> object, |
1216 const char* name, | 1223 const char* name, |
1217 LanguageMode language_mode) { | 1224 LanguageMode language_mode) { |
1218 Handle<String> str = isolate->factory()->InternalizeUtf8String(name); | 1225 Handle<String> str = isolate->factory()->InternalizeUtf8String(name); |
1219 return GetProperty(object, str, language_mode); | 1226 return GetProperty(object, str, language_mode); |
1220 } | 1227 } |
(...skipping 6911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8132 #undef WRITE_INT64_FIELD | 8139 #undef WRITE_INT64_FIELD |
8133 #undef READ_BYTE_FIELD | 8140 #undef READ_BYTE_FIELD |
8134 #undef WRITE_BYTE_FIELD | 8141 #undef WRITE_BYTE_FIELD |
8135 #undef NOBARRIER_READ_BYTE_FIELD | 8142 #undef NOBARRIER_READ_BYTE_FIELD |
8136 #undef NOBARRIER_WRITE_BYTE_FIELD | 8143 #undef NOBARRIER_WRITE_BYTE_FIELD |
8137 | 8144 |
8138 } // namespace internal | 8145 } // namespace internal |
8139 } // namespace v8 | 8146 } // namespace v8 |
8140 | 8147 |
8141 #endif // V8_OBJECTS_INL_H_ | 8148 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |