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 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1531 Handle<Object> prototype; | 1531 Handle<Object> prototype; |
1532 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 1532 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
1533 isolate, prototype, | 1533 isolate, prototype, |
1534 Object::GetProperty(callable, isolate->factory()->prototype_string())); | 1534 Object::GetProperty(callable, isolate->factory()->prototype_string())); |
1535 if (!prototype->IsJSReceiver()) { | 1535 if (!prototype->IsJSReceiver()) { |
1536 THROW_NEW_ERROR_RETURN_FAILURE( | 1536 THROW_NEW_ERROR_RETURN_FAILURE( |
1537 isolate, | 1537 isolate, |
1538 NewTypeError(MessageTemplate::kInstanceofNonobjectProto, prototype)); | 1538 NewTypeError(MessageTemplate::kInstanceofNonobjectProto, prototype)); |
1539 } | 1539 } |
1540 // Return whether or not {prototype} is in the prototype chain of {object}. | 1540 // Return whether or not {prototype} is in the prototype chain of {object}. |
1541 return isolate->heap()->ToBoolean( | 1541 Maybe<bool> result = Object::HasInPrototypeChain(isolate, object, prototype); |
1542 object->HasInPrototypeChain(isolate, *prototype)); | 1542 MAYBE_RETURN(result, isolate->heap()->exception()); |
| 1543 return isolate->heap()->ToBoolean(result.FromJust()); |
1543 } | 1544 } |
1544 | 1545 |
1545 | 1546 |
1546 RUNTIME_FUNCTION(Runtime_HasInPrototypeChain) { | 1547 RUNTIME_FUNCTION(Runtime_HasInPrototypeChain) { |
1547 SealHandleScope scope(isolate); | 1548 HandleScope scope(isolate); |
1548 DCHECK_EQ(2, args.length()); | 1549 DCHECK_EQ(2, args.length()); |
1549 CONVERT_ARG_CHECKED(Object, object, 0); | 1550 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
1550 CONVERT_ARG_CHECKED(Object, prototype, 1); | 1551 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); |
1551 return isolate->heap()->ToBoolean( | 1552 Maybe<bool> result = Object::HasInPrototypeChain(isolate, object, prototype); |
1552 object->HasInPrototypeChain(isolate, prototype)); | 1553 MAYBE_RETURN(result, isolate->heap()->exception()); |
| 1554 return isolate->heap()->ToBoolean(result.FromJust()); |
1553 } | 1555 } |
1554 | 1556 |
1555 | 1557 |
1556 // ES6 section 7.4.7 CreateIterResultObject ( value, done ) | 1558 // ES6 section 7.4.7 CreateIterResultObject ( value, done ) |
1557 RUNTIME_FUNCTION(Runtime_CreateIterResultObject) { | 1559 RUNTIME_FUNCTION(Runtime_CreateIterResultObject) { |
1558 HandleScope scope(isolate); | 1560 HandleScope scope(isolate); |
1559 DCHECK_EQ(2, args.length()); | 1561 DCHECK_EQ(2, args.length()); |
1560 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0); | 1562 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0); |
1561 CONVERT_ARG_HANDLE_CHECKED(Object, done, 1); | 1563 CONVERT_ARG_HANDLE_CHECKED(Object, done, 1); |
1562 return *isolate->factory()->NewJSIteratorResult(value, done); | 1564 return *isolate->factory()->NewJSIteratorResult(value, done); |
(...skipping 20 matching lines...) Expand all Loading... |
1583 | 1585 |
1584 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { | 1586 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { |
1585 HandleScope scope(isolate); | 1587 HandleScope scope(isolate); |
1586 DCHECK(args.length() == 2); | 1588 DCHECK(args.length() == 2); |
1587 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); | 1589 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); |
1588 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); | 1590 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); |
1589 return JSReceiver::DefineProperties(isolate, o, properties); | 1591 return JSReceiver::DefineProperties(isolate, o, properties); |
1590 } | 1592 } |
1591 } // namespace internal | 1593 } // namespace internal |
1592 } // namespace v8 | 1594 } // namespace v8 |
OLD | NEW |