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/messages.h" | 10 #include "src/messages.h" |
(...skipping 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1454 HandleScope scope(isolate); | 1454 HandleScope scope(isolate); |
1455 DCHECK_EQ(1, args.length()); | 1455 DCHECK_EQ(1, args.length()); |
1456 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); | 1456 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); |
1457 Handle<Object> result; | 1457 Handle<Object> result; |
1458 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 1458 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
1459 isolate, result, Object::ToPrimitive(input, ToPrimitiveHint::kString)); | 1459 isolate, result, Object::ToPrimitive(input, ToPrimitiveHint::kString)); |
1460 return *result; | 1460 return *result; |
1461 } | 1461 } |
1462 | 1462 |
1463 | 1463 |
1464 RUNTIME_FUNCTION(Runtime_OrdinaryToPrimitive) { | |
1465 HandleScope scope(isolate); | |
1466 DCHECK_EQ(2, args.length()); | |
1467 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0); | |
1468 CONVERT_ARG_HANDLE_CHECKED(String, hint, 1); | |
1469 Handle<Object> result; | |
1470 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | |
1471 isolate, result, JSReceiver::OrdinaryToPrimitive(receiver, hint)); | |
1472 return *result; | |
1473 } | |
1474 | |
1475 | |
1476 RUNTIME_FUNCTION(Runtime_ToNumber) { | 1464 RUNTIME_FUNCTION(Runtime_ToNumber) { |
1477 HandleScope scope(isolate); | 1465 HandleScope scope(isolate); |
1478 DCHECK_EQ(1, args.length()); | 1466 DCHECK_EQ(1, args.length()); |
1479 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); | 1467 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); |
1480 Handle<Object> result; | 1468 Handle<Object> result; |
1481 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | 1469 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
1482 Object::ToNumber(isolate, input)); | 1470 Object::ToNumber(isolate, input)); |
1483 return *result; | 1471 return *result; |
1484 } | 1472 } |
1485 | 1473 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1564 SealHandleScope scope(isolate); | 1552 SealHandleScope scope(isolate); |
1565 DCHECK_EQ(2, args.length()); | 1553 DCHECK_EQ(2, args.length()); |
1566 CONVERT_ARG_CHECKED(Object, object, 0); | 1554 CONVERT_ARG_CHECKED(Object, object, 0); |
1567 CONVERT_ARG_CHECKED(Object, prototype, 1); | 1555 CONVERT_ARG_CHECKED(Object, prototype, 1); |
1568 return isolate->heap()->ToBoolean( | 1556 return isolate->heap()->ToBoolean( |
1569 object->HasInPrototypeChain(isolate, prototype)); | 1557 object->HasInPrototypeChain(isolate, prototype)); |
1570 } | 1558 } |
1571 | 1559 |
1572 } // namespace internal | 1560 } // namespace internal |
1573 } // namespace v8 | 1561 } // namespace v8 |
OLD | NEW |