| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
| 6 | 6 |
| 7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
| 8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
| 9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
| 10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 Handle<Name> name; | 168 Handle<Name> name; |
| 169 ASSIGN_RETURN_ON_EXCEPTION(isolate, name, Object::ToName(isolate, key), | 169 ASSIGN_RETURN_ON_EXCEPTION(isolate, name, Object::ToName(isolate, key), |
| 170 Object); | 170 Object); |
| 171 | 171 |
| 172 LookupIterator it = LookupIterator::PropertyOrElement(isolate, object, name); | 172 LookupIterator it = LookupIterator::PropertyOrElement(isolate, object, name); |
| 173 return Object::SetProperty(&it, value, language_mode, | 173 return Object::SetProperty(&it, value, language_mode, |
| 174 Object::MAY_BE_STORE_FROM_KEYED); | 174 Object::MAY_BE_STORE_FROM_KEYED); |
| 175 } | 175 } |
| 176 | 176 |
| 177 | 177 |
| 178 MaybeHandle<Object> Runtime::GetPrototype(Isolate* isolate, | 178 RUNTIME_FUNCTION(Runtime_GetPrototype) { |
| 179 Handle<Object> obj) { | 179 HandleScope scope(isolate); |
| 180 DCHECK(args.length() == 1); |
| 181 CONVERT_ARG_HANDLE_CHECKED(Object, obj, 0); |
| 180 // We don't expect access checks to be needed on JSProxy objects. | 182 // We don't expect access checks to be needed on JSProxy objects. |
| 181 DCHECK(!obj->IsAccessCheckNeeded() || obj->IsJSObject()); | 183 DCHECK(!obj->IsAccessCheckNeeded() || obj->IsJSObject()); |
| 182 PrototypeIterator iter(isolate, obj, PrototypeIterator::START_AT_RECEIVER); | 184 PrototypeIterator iter(isolate, obj, PrototypeIterator::START_AT_RECEIVER); |
| 183 do { | 185 do { |
| 184 if (PrototypeIterator::GetCurrent(iter)->IsAccessCheckNeeded() && | 186 if (PrototypeIterator::GetCurrent(iter)->IsAccessCheckNeeded() && |
| 185 !isolate->MayAccess( | 187 !isolate->MayAccess( |
| 186 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)))) { | 188 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)))) { |
| 187 return isolate->factory()->null_value(); | 189 return isolate->heap()->null_value(); |
| 188 } | 190 } |
| 189 iter.AdvanceIgnoringProxies(); | 191 iter.AdvanceIgnoringProxies(); |
| 190 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { | 192 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { |
| 191 return PrototypeIterator::GetCurrent(iter); | 193 return *PrototypeIterator::GetCurrent(iter); |
| 192 } | 194 } |
| 193 } while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)); | 195 } while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)); |
| 194 return PrototypeIterator::GetCurrent(iter); | 196 return *PrototypeIterator::GetCurrent(iter); |
| 195 } | 197 } |
| 196 | 198 |
| 197 | 199 |
| 198 RUNTIME_FUNCTION(Runtime_GetPrototype) { | |
| 199 HandleScope scope(isolate); | |
| 200 DCHECK(args.length() == 1); | |
| 201 CONVERT_ARG_HANDLE_CHECKED(Object, obj, 0); | |
| 202 Handle<Object> result; | |
| 203 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | |
| 204 Runtime::GetPrototype(isolate, obj)); | |
| 205 return *result; | |
| 206 } | |
| 207 | |
| 208 | |
| 209 RUNTIME_FUNCTION(Runtime_InternalSetPrototype) { | 200 RUNTIME_FUNCTION(Runtime_InternalSetPrototype) { |
| 210 HandleScope scope(isolate); | 201 HandleScope scope(isolate); |
| 211 DCHECK(args.length() == 2); | 202 DCHECK(args.length() == 2); |
| 212 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); | 203 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); |
| 213 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); | 204 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); |
| 214 DCHECK(!obj->IsAccessCheckNeeded()); | 205 DCHECK(!obj->IsAccessCheckNeeded()); |
| 215 DCHECK(!obj->map()->is_observed()); | 206 DCHECK(!obj->map()->is_observed()); |
| 216 Handle<Object> result; | 207 Handle<Object> result; |
| 217 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 208 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 218 isolate, result, JSObject::SetPrototype(obj, prototype, false)); | 209 isolate, result, JSObject::SetPrototype(obj, prototype, false)); |
| (...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1563 RUNTIME_FUNCTION(Runtime_CreateIterResultObject) { | 1554 RUNTIME_FUNCTION(Runtime_CreateIterResultObject) { |
| 1564 HandleScope scope(isolate); | 1555 HandleScope scope(isolate); |
| 1565 DCHECK_EQ(2, args.length()); | 1556 DCHECK_EQ(2, args.length()); |
| 1566 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0); | 1557 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0); |
| 1567 CONVERT_ARG_HANDLE_CHECKED(Object, done, 1); | 1558 CONVERT_ARG_HANDLE_CHECKED(Object, done, 1); |
| 1568 return *isolate->factory()->NewJSIteratorResult(value, done); | 1559 return *isolate->factory()->NewJSIteratorResult(value, done); |
| 1569 } | 1560 } |
| 1570 | 1561 |
| 1571 } // namespace internal | 1562 } // namespace internal |
| 1572 } // namespace v8 | 1563 } // namespace v8 |
| OLD | NEW |