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.h" | 9 #include "src/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 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); | 1454 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); |
1455 CONVERT_ARG_HANDLE_CHECKED(JSFunction, setter, 2); | 1455 CONVERT_ARG_HANDLE_CHECKED(JSFunction, setter, 2); |
1456 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); | 1456 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); |
1457 | 1457 |
1458 RETURN_FAILURE_ON_EXCEPTION( | 1458 RETURN_FAILURE_ON_EXCEPTION( |
1459 isolate, | 1459 isolate, |
1460 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), | 1460 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), |
1461 setter, attrs)); | 1461 setter, attrs)); |
1462 return isolate->heap()->undefined_value(); | 1462 return isolate->heap()->undefined_value(); |
1463 } | 1463 } |
| 1464 |
| 1465 |
| 1466 RUNTIME_FUNCTION(Runtime_ToObject) { |
| 1467 HandleScope scope(isolate); |
| 1468 DCHECK_EQ(1, args.length()); |
| 1469 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
| 1470 Handle<JSReceiver> receiver; |
| 1471 if (JSReceiver::ToObject(isolate, object).ToHandle(&receiver)) { |
| 1472 return *receiver; |
| 1473 } |
| 1474 THROW_NEW_ERROR_RETURN_FAILURE( |
| 1475 isolate, NewTypeError(MessageTemplate::kUndefinedOrNullToObject)); |
| 1476 } |
| 1477 |
1464 } // namespace internal | 1478 } // namespace internal |
1465 } // namespace v8 | 1479 } // namespace v8 |
OLD | NEW |