Index: src/runtime/runtime-object.cc |
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc |
index 2dd5db86e127cb228572ca1d9f3c8865340abcfc..e493118ae097b0670488b78b4a743a1b17d70cec 100644 |
--- a/src/runtime/runtime-object.cc |
+++ b/src/runtime/runtime-object.cc |
@@ -1425,6 +1425,62 @@ RUNTIME_FUNCTION(Runtime_ToObject) { |
} |
+RUNTIME_FUNCTION(Runtime_ToPrimitive) { |
+ HandleScope scope(isolate); |
+ DCHECK_EQ(1, args.length()); |
+ CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); |
+ Handle<Object> result; |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
+ Object::ToPrimitive(input)); |
+ return *result; |
+} |
+ |
+ |
+RUNTIME_FUNCTION(Runtime_ToPrimitive_Number) { |
+ HandleScope scope(isolate); |
+ DCHECK_EQ(1, args.length()); |
+ CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); |
+ Handle<Object> result; |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
+ isolate, result, Object::ToPrimitive(input, ToPrimitiveHint::kNumber)); |
+ return *result; |
+} |
+ |
+ |
+RUNTIME_FUNCTION(Runtime_ToPrimitive_String) { |
+ HandleScope scope(isolate); |
+ DCHECK_EQ(1, args.length()); |
+ CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); |
+ Handle<Object> result; |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
+ isolate, result, Object::ToPrimitive(input, ToPrimitiveHint::kString)); |
+ return *result; |
+} |
+ |
+ |
+RUNTIME_FUNCTION(Runtime_OrdinaryToPrimitive) { |
+ HandleScope scope(isolate); |
+ DCHECK_EQ(2, args.length()); |
+ CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0); |
+ CONVERT_ARG_HANDLE_CHECKED(String, hint, 1); |
+ Handle<Object> result; |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
+ isolate, result, JSReceiver::OrdinaryToPrimitive(receiver, hint)); |
+ return *result; |
+} |
+ |
+ |
+RUNTIME_FUNCTION(Runtime_ToNumber) { |
+ HandleScope scope(isolate); |
+ DCHECK_EQ(1, args.length()); |
+ CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); |
+ Handle<Object> result; |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
+ Object::ToNumber(isolate, input)); |
+ return *result; |
+} |
+ |
+ |
RUNTIME_FUNCTION(Runtime_StrictEquals) { |
SealHandleScope scope(isolate); |
DCHECK_EQ(2, args.length()); |