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 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1041 DCHECK(args.length() == 1); | 1041 DCHECK(args.length() == 1); |
1042 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | 1042 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
1043 if (object->IsJSObject() && !object->IsGlobalObject()) { | 1043 if (object->IsJSObject() && !object->IsGlobalObject()) { |
1044 JSObject::MigrateSlowToFast(Handle<JSObject>::cast(object), 0, | 1044 JSObject::MigrateSlowToFast(Handle<JSObject>::cast(object), 0, |
1045 "RuntimeToFastProperties"); | 1045 "RuntimeToFastProperties"); |
1046 } | 1046 } |
1047 return *object; | 1047 return *object; |
1048 } | 1048 } |
1049 | 1049 |
1050 | 1050 |
1051 RUNTIME_FUNCTION(Runtime_ToBool) { | |
1052 SealHandleScope shs(isolate); | |
1053 DCHECK(args.length() == 1); | |
1054 CONVERT_ARG_CHECKED(Object, object, 0); | |
1055 | |
1056 return isolate->heap()->ToBoolean(object->BooleanValue()); | |
1057 } | |
1058 | |
1059 | |
1060 RUNTIME_FUNCTION(Runtime_NewStringWrapper) { | 1051 RUNTIME_FUNCTION(Runtime_NewStringWrapper) { |
1061 HandleScope scope(isolate); | 1052 HandleScope scope(isolate); |
1062 DCHECK(args.length() == 1); | 1053 DCHECK(args.length() == 1); |
1063 CONVERT_ARG_HANDLE_CHECKED(String, value, 0); | 1054 CONVERT_ARG_HANDLE_CHECKED(String, value, 0); |
1064 return *Object::ToObject(isolate, value).ToHandleChecked(); | 1055 return *Object::ToObject(isolate, value).ToHandleChecked(); |
1065 } | 1056 } |
1066 | 1057 |
1067 | 1058 |
1068 RUNTIME_FUNCTION(Runtime_AllocateHeapNumber) { | 1059 RUNTIME_FUNCTION(Runtime_AllocateHeapNumber) { |
1069 HandleScope scope(isolate); | 1060 HandleScope scope(isolate); |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1470 Handle<JSReceiver> receiver; | 1461 Handle<JSReceiver> receiver; |
1471 if (JSReceiver::ToObject(isolate, object).ToHandle(&receiver)) { | 1462 if (JSReceiver::ToObject(isolate, object).ToHandle(&receiver)) { |
1472 return *receiver; | 1463 return *receiver; |
1473 } | 1464 } |
1474 THROW_NEW_ERROR_RETURN_FAILURE( | 1465 THROW_NEW_ERROR_RETURN_FAILURE( |
1475 isolate, NewTypeError(MessageTemplate::kUndefinedOrNullToObject)); | 1466 isolate, NewTypeError(MessageTemplate::kUndefinedOrNullToObject)); |
1476 } | 1467 } |
1477 | 1468 |
1478 } // namespace internal | 1469 } // namespace internal |
1479 } // namespace v8 | 1470 } // namespace v8 |
OLD | NEW |