Commit 251f63d8 authored by Benedikt Meurer's avatar Benedikt Meurer Committed by Commit Bot

[builtins] Remove DateConstructor_ConstructStub builtin.

Next step on deprecating the construct_stub field in the
SharedFunctionInfo.

Bug: v8:7503
Change-Id: Ibcbf9dc0dbcbcf0e26c103167e8a30074cbdd888
Reviewed-on: https://chromium-review.googlesource.com/940942Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51630}
parent f8c688f4
......@@ -2187,7 +2187,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
InstallWithIntrinsicDefaultProto(isolate, date_fun,
Context::DATE_FUNCTION_INDEX);
date_fun->shared()->SetConstructStub(
*BUILTIN_CODE(isolate, DateConstructor_ConstructStub));
*BUILTIN_CODE(isolate, JSBuiltinsConstructStub));
date_fun->shared()->set_length(7);
date_fun->shared()->DontAdaptArguments();
......
......@@ -193,19 +193,16 @@ Object* SetLocalDateValue(Handle<JSDate> date, double time_val) {
} // namespace
// ES6 section 20.3.2 The Date Constructor for the [[Call]] case.
// ES #sec-date-constructor
BUILTIN(DateConstructor) {
HandleScope scope(isolate);
if (args.new_target()->IsUndefined(isolate)) {
double const time_val = JSDate::CurrentTimeValue(isolate);
char buffer[128];
ToDateString(time_val, ArrayVector(buffer), isolate->date_cache());
RETURN_RESULT_OR_FAILURE(
isolate, isolate->factory()->NewStringFromUtf8(CStrVector(buffer)));
}
// ES6 section 20.3.2 The Date Constructor for the [[Construct]] case.
BUILTIN(DateConstructor_ConstructStub) {
HandleScope scope(isolate);
} else {
int const argc = args.length() - 1;
Handle<JSFunction> target = args.target();
Handle<JSReceiver> new_target = Handle<JSReceiver>::cast(args.new_target());
......@@ -259,8 +256,8 @@ BUILTIN(DateConstructor_ConstructStub) {
seconds = seconds_object->Number();
if (argc >= 7) {
Handle<Object> ms_object;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, ms_object,
Object::ToNumber(args.at(7)));
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, ms_object, Object::ToNumber(args.at(7)));
ms = ms_object->Number();
}
}
......@@ -281,7 +278,9 @@ BUILTIN(DateConstructor_ConstructStub) {
time_val = std::numeric_limits<double>::quiet_NaN();
}
}
RETURN_RESULT_OR_FAILURE(isolate, JSDate::New(target, new_target, time_val));
RETURN_RESULT_OR_FAILURE(isolate,
JSDate::New(target, new_target, time_val));
}
}
// ES6 section 20.3.3.1 Date.now ( )
......
......@@ -461,8 +461,8 @@ namespace internal {
CPP(DataViewPrototypeSetBigUint64) \
\
/* Date */ \
/* ES #sec-date-constructor */ \
CPP(DateConstructor) \
CPP(DateConstructor_ConstructStub) \
/* ES6 #sec-date.prototype.getdate */ \
TFJ(DatePrototypeGetDate, 0) \
/* ES6 #sec-date.prototype.getday */ \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment