Commit 3cb55265 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[runtime] Remove Runtime::kFunctionSetInstanceClassName.

... and set the instance class name in a bootstrapper instead.

Change-Id: Ie8a9a0e7cdc22ca19616b4a0d09665e059cd4d3e
Reviewed-on: https://chromium-review.googlesource.com/557864Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46356}
parent 0571adf1
......@@ -3693,30 +3693,53 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
}
{ // -- S e t I t e r a t o r
Handle<JSObject> set_iterator_prototype =
isolate->factory()->NewJSObject(isolate->object_function(), TENURED);
JSObject::ForceSetPrototype(set_iterator_prototype, iterator_prototype);
Handle<JSFunction> set_iterator_function = InstallFunction(
container, "SetIterator", JS_SET_ITERATOR_TYPE, JSSetIterator::kSize,
set_iterator_prototype, Builtins::kIllegal);
Handle<String> name = factory->InternalizeUtf8String("Set Iterator");
// Setup %SetIteratorPrototype%.
Handle<JSObject> prototype =
factory->NewJSObject(isolate->object_function(), TENURED);
JSObject::ForceSetPrototype(prototype, iterator_prototype);
// Install the @@toStringTag property on the {prototype}.
JSObject::AddProperty(
prototype, factory->to_string_tag_symbol(), name,
static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
// Setup SetIterator constructor.
Handle<JSFunction> set_iterator_function =
InstallFunction(container, "SetIterator", JS_SET_ITERATOR_TYPE,
JSSetIterator::kSize, prototype, Builtins::kIllegal);
set_iterator_function->shared()->set_instance_class_name(*name);
native_context->set_set_iterator_map(set_iterator_function->initial_map());
}
{ // -- M a p I t e r a t o r
Handle<JSObject> map_iterator_prototype =
isolate->factory()->NewJSObject(isolate->object_function(), TENURED);
JSObject::ForceSetPrototype(map_iterator_prototype, iterator_prototype);
Handle<JSFunction> map_iterator_function = InstallFunction(
container, "MapIterator", JS_MAP_ITERATOR_TYPE, JSMapIterator::kSize,
map_iterator_prototype, Builtins::kIllegal);
Handle<String> name = factory->InternalizeUtf8String("Map Iterator");
// Setup %MapIteratorPrototype%.
Handle<JSObject> prototype =
factory->NewJSObject(isolate->object_function(), TENURED);
JSObject::ForceSetPrototype(prototype, iterator_prototype);
// Install the @@toStringTag property on the {prototype}.
JSObject::AddProperty(
prototype, factory->to_string_tag_symbol(), name,
static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
// Setup MapIterator constructor.
Handle<JSFunction> map_iterator_function =
InstallFunction(container, "MapIterator", JS_MAP_ITERATOR_TYPE,
JSMapIterator::kSize, prototype, Builtins::kIllegal);
map_iterator_function->shared()->set_instance_class_name(*name);
native_context->set_map_iterator_map(map_iterator_function->initial_map());
}
{ // -- S c r i p t
// Builtin functions for Script.
Handle<String> name = factory->InternalizeUtf8String("Script");
Handle<JSFunction> script_fun = InstallFunction(
container, "Script", JS_VALUE_TYPE, JSValue::kSize,
factory->the_hole_value(), Builtins::kUnsupportedThrower);
container, name, JS_VALUE_TYPE, JSValue::kSize,
factory->the_hole_value(), Builtins::kUnsupportedThrower, DONT_ENUM);
script_fun->shared()->set_instance_class_name(*name);
native_context->set_script_function(*script_fun);
Handle<Map> script_map = Handle<Map>(script_fun->initial_map());
......
......@@ -15,7 +15,6 @@ var GlobalMap = global.Map;
var GlobalSet = global.Set;
var iteratorSymbol = utils.ImportNow("iterator_symbol");
var MapIterator = utils.ImportNow("MapIterator");
var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
var SetIterator = utils.ImportNow("SetIterator");
// -------------------------------------------------------------------
......@@ -76,14 +75,10 @@ DEFINE_METHODS(
// -------------------------------------------------------------------
%SetCode(SetIterator, SetIteratorConstructor);
%FunctionSetInstanceClassName(SetIterator, 'Set Iterator');
var SetIteratorNext = SetIterator.prototype.next;
%AddNamedProperty(SetIterator.prototype, toStringTagSymbol,
"Set Iterator", READ_ONLY | DONT_ENUM);
var SetValues = GlobalSet.prototype.values;
%AddNamedProperty(GlobalSet.prototype, "keys", SetValues, DONT_ENUM);
%AddNamedProperty(GlobalSet.prototype, iteratorSymbol, SetValues, DONT_ENUM);
......@@ -156,15 +151,10 @@ DEFINE_METHODS(
// -------------------------------------------------------------------
%SetCode(MapIterator, MapIteratorConstructor);
%FunctionSetInstanceClassName(MapIterator, 'Map Iterator');
var MapIteratorNext = MapIterator.prototype.next;
%AddNamedProperty(MapIterator.prototype, toStringTagSymbol,
"Map Iterator", READ_ONLY | DONT_ENUM);
var MapEntries = GlobalMap.prototype.entries;
%AddNamedProperty(GlobalMap.prototype, iteratorSymbol, MapEntries, DONT_ENUM);
// -------------------------------------------------------------------
......
......@@ -18,7 +18,6 @@ var hashCodeSymbol = utils.ImportNow("hash_code_symbol");
var MathRandom = global.Math.random;
var MapIterator;
var SetIterator;
var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
utils.Import(function(from) {
MapIterator = from.MapIterator;
......
......@@ -18,12 +18,6 @@ var Script = utils.ImportNow("Script");
// -------------------------------------------------------------------
// Script
/**
* Set up the Script function and constructor.
*/
%FunctionSetInstanceClassName(Script, 'Script');
/**
* Get information on a specific source position.
* Returns an object with the following following properties:
......
......@@ -88,17 +88,6 @@ RUNTIME_FUNCTION(Runtime_FunctionGetContextData) {
return fun->native_context()->debug_context_id();
}
RUNTIME_FUNCTION(Runtime_FunctionSetInstanceClassName) {
SealHandleScope shs(isolate);
DCHECK_EQ(2, args.length());
CONVERT_ARG_CHECKED(JSFunction, fun, 0);
CONVERT_ARG_CHECKED(String, name, 1);
fun->shared()->set_instance_class_name(name);
return isolate->heap()->undefined_value();
}
RUNTIME_FUNCTION(Runtime_FunctionSetLength) {
SealHandleScope shs(isolate);
DCHECK_EQ(2, args.length());
......
......@@ -236,7 +236,6 @@ namespace internal {
F(FunctionGetSourceCode, 1, 1) \
F(FunctionGetScriptSourcePosition, 1, 1) \
F(FunctionGetContextData, 1, 1) \
F(FunctionSetInstanceClassName, 2, 1) \
F(FunctionSetLength, 2, 1) \
F(FunctionSetPrototype, 2, 1) \
F(FunctionIsAPIFunction, 1, 1) \
......
......@@ -86,7 +86,12 @@ function CheckGetter(object, name) {
assertTrue(Set.prototype[Symbol.iterator] === Set.prototype.values);
CheckMethod(Set.prototype, "values", 0);
CheckMethod((new Set())[Symbol.iterator]().__proto__, "next", 0);
var SetIteratorPrototype = (new Set())[Symbol.iterator]().__proto__;
CheckMethod(SetIteratorPrototype, "next", 0);
assertEquals("Set Iterator", SetIteratorPrototype[Symbol.toStringTag]);
assertEquals(
undefined,
Object.getOwnPropertyDescriptor(SetIteratorPrototype, "constructor"));
CheckMethod(Map.prototype, "set", 2);
CheckMethod(Map.prototype, "delete", 1);
......@@ -95,7 +100,12 @@ function CheckGetter(object, name) {
CheckMethod(Map.prototype, "values", 0);
assertTrue(Map.prototype[Symbol.iterator] === Map.prototype.entries);
CheckMethod((new Map())[Symbol.iterator]().__proto__, "next", 0);
var MapIteratorPrototype = (new Map())[Symbol.iterator]().__proto__;
CheckMethod(MapIteratorPrototype, "next", 0);
assertEquals("Map Iterator", MapIteratorPrototype[Symbol.toStringTag]);
assertEquals(
undefined,
Object.getOwnPropertyDescriptor(MapIteratorPrototype, "constructor"));
assertEquals(0, WeakSet.length);
CheckMethod(WeakSet.prototype, "add", 1);
......
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