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