Index: src/builtins.cc |
diff --git a/src/builtins.cc b/src/builtins.cc |
index 9e5631d84a4d815d564d7d0dda40ecb5d087f55b..231b57af0f59dd80cdb028ff9b76a582a1ddbc46 100644 |
--- a/src/builtins.cc |
+++ b/src/builtins.cc |
@@ -778,6 +778,30 @@ BUILTIN(ArrayConcat) { |
// ----------------------------------------------------------------------------- |
+// |
+ |
+ |
+// 20.3.4.45 Date.prototype [ @@toPrimitive ] ( hint ) |
+BUILTIN(DateToPrimitive) { |
+ HandleScope scope(isolate); |
+ DCHECK_EQ(2, args.length()); |
+ if (!args.receiver()->IsJSReceiver()) { |
+ THROW_NEW_ERROR_RETURN_FAILURE( |
+ isolate, NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, |
+ isolate->factory()->NewStringFromAsciiChecked( |
+ "Date.prototype [ @@toPrimitive ]"), |
+ args.receiver())); |
+ } |
+ Handle<JSReceiver> receiver = args.at<JSReceiver>(0); |
+ Handle<Object> hint = args.at<Object>(1); |
+ Handle<Object> result; |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
+ JSDate::ToPrimitive(receiver, hint)); |
+ return *result; |
+} |
+ |
+ |
+// ----------------------------------------------------------------------------- |
// Throwers for restricted function properties and strict arguments object |
// properties |