| 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/v8.h" | 5 #include "src/v8.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/messages.h" | 10 #include "src/messages.h" |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 return *result; | 257 return *result; |
| 258 } | 258 } |
| 259 Handle<Object> result; | 259 Handle<Object> result; |
| 260 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 260 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 261 isolate, result, JSObject::SetPrototype(obj, prototype, true)); | 261 isolate, result, JSObject::SetPrototype(obj, prototype, true)); |
| 262 return *result; | 262 return *result; |
| 263 } | 263 } |
| 264 | 264 |
| 265 | 265 |
| 266 RUNTIME_FUNCTION(Runtime_IsInPrototypeChain) { | 266 RUNTIME_FUNCTION(Runtime_IsInPrototypeChain) { |
| 267 HandleScope shs(isolate); | 267 SealHandleScope shs(isolate); |
| 268 DCHECK(args.length() == 2); | 268 DCHECK(args.length() == 2); |
| 269 // See ECMA-262, section 15.3.5.3, page 88 (steps 5 - 8). | 269 // See ECMA-262, section 15.3.5.3, page 88 (steps 5 - 8). |
| 270 CONVERT_ARG_HANDLE_CHECKED(Object, O, 0); | 270 CONVERT_ARG_CHECKED(Object, O, 0); |
| 271 CONVERT_ARG_HANDLE_CHECKED(Object, V, 1); | 271 CONVERT_ARG_CHECKED(Object, V, 1); |
| 272 PrototypeIterator iter(isolate, V, PrototypeIterator::START_AT_RECEIVER); | 272 return isolate->heap()->ToBoolean(V->HasInPrototypeChain(isolate, O)); |
| 273 while (true) { | |
| 274 iter.AdvanceIgnoringProxies(); | |
| 275 if (iter.IsAtEnd()) return isolate->heap()->false_value(); | |
| 276 if (iter.IsAtEnd(O)) return isolate->heap()->true_value(); | |
| 277 } | |
| 278 } | 273 } |
| 279 | 274 |
| 280 | 275 |
| 281 // Enumerator used as indices into the array returned from GetOwnProperty | 276 // Enumerator used as indices into the array returned from GetOwnProperty |
| 282 enum PropertyDescriptorIndices { | 277 enum PropertyDescriptorIndices { |
| 283 IS_ACCESSOR_INDEX, | 278 IS_ACCESSOR_INDEX, |
| 284 VALUE_INDEX, | 279 VALUE_INDEX, |
| 285 GETTER_INDEX, | 280 GETTER_INDEX, |
| 286 SETTER_INDEX, | 281 SETTER_INDEX, |
| 287 WRITABLE_INDEX, | 282 WRITABLE_INDEX, |
| (...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1437 Handle<JSReceiver> receiver; | 1432 Handle<JSReceiver> receiver; |
| 1438 if (JSReceiver::ToObject(isolate, object).ToHandle(&receiver)) { | 1433 if (JSReceiver::ToObject(isolate, object).ToHandle(&receiver)) { |
| 1439 return *receiver; | 1434 return *receiver; |
| 1440 } | 1435 } |
| 1441 THROW_NEW_ERROR_RETURN_FAILURE( | 1436 THROW_NEW_ERROR_RETURN_FAILURE( |
| 1442 isolate, NewTypeError(MessageTemplate::kUndefinedOrNullToObject)); | 1437 isolate, NewTypeError(MessageTemplate::kUndefinedOrNullToObject)); |
| 1443 } | 1438 } |
| 1444 | 1439 |
| 1445 } // namespace internal | 1440 } // namespace internal |
| 1446 } // namespace v8 | 1441 } // namespace v8 |
| OLD | NEW |