Commit 0ffaedf8 authored by Mathias Bynens's avatar Mathias Bynens Committed by Commit Bot

[builtins] Remove SymbolConstructor_ConstructStub builtin

This brings us closer to our goal of deprecating the `construct_stub`
field in `SharedFunctionInfo`.

Bug: v8:7503
Change-Id: Id7bee0d61830f7bcf2cad4f6e50ff9f24b58a51b
Reviewed-on: https://chromium-review.googlesource.com/939790Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51633}
parent 344a5c39
......@@ -2119,7 +2119,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
factory->the_hole_value(), Builtins::kSymbolConstructor);
symbol_fun->shared()->set_builtin_function_id(kSymbolConstructor);
symbol_fun->shared()->SetConstructStub(
*BUILTIN_CODE(isolate, SymbolConstructor_ConstructStub));
*BUILTIN_CODE(isolate, JSBuiltinsConstructStub));
symbol_fun->shared()->set_length(0);
symbol_fun->shared()->DontAdaptArguments();
native_context()->set_symbol_function(*symbol_fun);
......
......@@ -1061,8 +1061,8 @@ namespace internal {
TFJ(StringIteratorPrototypeNext, 0) \
\
/* Symbol */ \
/* ES #sec-symbol-constructor */ \
CPP(SymbolConstructor) \
CPP(SymbolConstructor_ConstructStub) \
/* ES6 #sec-symbol.for */ \
CPP(SymbolFor) \
/* ES6 #sec-symbol.keyfor */ \
......
......@@ -11,27 +11,25 @@ namespace v8 {
namespace internal {
// -----------------------------------------------------------------------------
// ES6 section 19.4 Symbol Objects
// ES #sec-symbol-objects
// ES6 section 19.4.1.1 Symbol ( [ description ] ) for the [[Call]] case.
// ES #sec-symbol-constructor
BUILTIN(SymbolConstructor) {
HandleScope scope(isolate);
Handle<Symbol> result = isolate->factory()->NewSymbol();
Handle<Object> description = args.atOrUndefined(isolate, 1);
if (!description->IsUndefined(isolate)) {
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, description,
Object::ToString(isolate, description));
result->set_name(*description);
if (args.new_target()->IsUndefined(isolate)) { // [[Call]]
Handle<Symbol> result = isolate->factory()->NewSymbol();
Handle<Object> description = args.atOrUndefined(isolate, 1);
if (!description->IsUndefined(isolate)) {
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, description, Object::ToString(isolate, description));
result->set_name(*description);
}
return *result;
} else { // [[Construct]]
THROW_NEW_ERROR_RETURN_FAILURE(
isolate, NewTypeError(MessageTemplate::kNotConstructor,
isolate->factory()->Symbol_string()));
}
return *result;
}
// ES6 section 19.4.1.1 Symbol ( [ description ] ) for the [[Construct]] case.
BUILTIN(SymbolConstructor_ConstructStub) {
HandleScope scope(isolate);
THROW_NEW_ERROR_RETURN_FAILURE(
isolate, NewTypeError(MessageTemplate::kNotConstructor,
isolate->factory()->Symbol_string()));
}
// ES6 section 19.4.2.1 Symbol.for.
......
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