Revert "Revert "Upgrade to 5.0.71.48"" DO NOT MERGE
This reverts commit f2e3994fa5148cc3d9946666f0b0596290192b0e,
and updates the x64 makefile properly so it doesn't break that
build.
FPIIM-449
Change-Id: Ib83e35bfbae6af627451c926a9650ec57c045605
(cherry picked from commit 109988c7ccb6f3fd1a58574fa3dfb88beaef6632)
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index f68a12a..252c51c 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -134,7 +134,8 @@
public:
Genesis(Isolate* isolate, MaybeHandle<JSGlobalProxy> maybe_global_proxy,
v8::Local<v8::ObjectTemplate> global_proxy_template,
- v8::ExtensionConfiguration* extensions, ContextType context_type);
+ v8::ExtensionConfiguration* extensions,
+ GlobalContextType context_type);
~Genesis() { }
Isolate* isolate() const { return isolate_; }
@@ -187,10 +188,10 @@
// New context initialization. Used for creating a context from scratch.
void InitializeGlobal(Handle<JSGlobalObject> global_object,
Handle<JSFunction> empty_function,
- ContextType context_type);
+ GlobalContextType context_type);
void InitializeExperimentalGlobal();
// Depending on the situation, expose and/or get rid of the utils object.
- void ConfigureUtilsObject(ContextType context_type);
+ void ConfigureUtilsObject(GlobalContextType context_type);
#define DECLARE_FEATURE_INITIALIZATION(id, descr) \
void InitializeGlobal_##id();
@@ -206,7 +207,7 @@
Handle<JSFunction> InstallInternalArray(Handle<JSObject> target,
const char* name,
ElementsKind elements_kind);
- bool InstallNatives(ContextType context_type);
+ bool InstallNatives(GlobalContextType context_type);
void InstallTypedArray(const char* name, ElementsKind elements_kind,
Handle<JSFunction>* fun);
@@ -318,11 +319,10 @@
v->Synchronize(VisitorSynchronization::kExtensions);
}
-
Handle<Context> Bootstrapper::CreateEnvironment(
MaybeHandle<JSGlobalProxy> maybe_global_proxy,
v8::Local<v8::ObjectTemplate> global_proxy_template,
- v8::ExtensionConfiguration* extensions, ContextType context_type) {
+ v8::ExtensionConfiguration* extensions, GlobalContextType context_type) {
HandleScope scope(isolate_);
Genesis genesis(isolate_, maybe_global_proxy, global_proxy_template,
extensions, context_type);
@@ -483,7 +483,7 @@
Handle<Map> Genesis::CreateSloppyFunctionMap(FunctionMode function_mode) {
Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize);
SetFunctionInstanceDescriptor(map, function_mode);
- if (IsFunctionModeWithPrototype(function_mode)) map->set_is_constructor();
+ map->set_is_constructor(IsFunctionModeWithPrototype(function_mode));
map->set_is_callable();
return map;
}
@@ -715,7 +715,7 @@
FunctionMode function_mode, Handle<JSFunction> empty_function) {
Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize);
SetStrictFunctionInstanceDescriptor(map, function_mode);
- if (IsFunctionModeWithPrototype(function_mode)) map->set_is_constructor();
+ map->set_is_constructor(IsFunctionModeWithPrototype(function_mode));
map->set_is_callable();
Map::SetPrototype(map, empty_function);
return map;
@@ -726,7 +726,7 @@
Handle<JSFunction> empty_function, bool is_constructor) {
Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize);
SetStrongFunctionInstanceDescriptor(map);
- if (is_constructor) map->set_is_constructor();
+ map->set_is_constructor(is_constructor);
Map::SetPrototype(map, empty_function);
map->set_is_callable();
map->set_is_extensible(is_constructor);
@@ -789,6 +789,7 @@
// Generator functions do not have "caller" or "arguments" accessors.
Handle<Map> sloppy_generator_function_map =
Map::Copy(strict_function_map, "SloppyGeneratorFunction");
+ sloppy_generator_function_map->set_is_constructor(false);
Map::SetPrototype(sloppy_generator_function_map,
generator_function_prototype);
native_context()->set_sloppy_generator_function_map(
@@ -796,6 +797,7 @@
Handle<Map> strict_generator_function_map =
Map::Copy(strict_function_map, "StrictGeneratorFunction");
+ strict_generator_function_map->set_is_constructor(false);
Map::SetPrototype(strict_generator_function_map,
generator_function_prototype);
native_context()->set_strict_generator_function_map(
@@ -804,6 +806,7 @@
Handle<Map> strong_function_map(native_context()->strong_function_map());
Handle<Map> strong_generator_function_map =
Map::Copy(strong_function_map, "StrongGeneratorFunction");
+ strong_generator_function_map->set_is_constructor(false);
Map::SetPrototype(strong_generator_function_map,
generator_function_prototype);
native_context()->set_strong_generator_function_map(
@@ -822,7 +825,7 @@
PropertyAttributes attributes,
Handle<AccessorPair> accessor_pair) {
DescriptorArray* descriptors = map->instance_descriptors();
- int idx = descriptors->SearchWithCache(*name, *map);
+ int idx = descriptors->SearchWithCache(map->GetIsolate(), *name, *map);
AccessorConstantDescriptor descriptor(name, accessor_pair, attributes);
descriptors->Replace(idx, &descriptor);
}
@@ -952,7 +955,6 @@
}
js_global_object_function->initial_map()->set_is_prototype_map(true);
- js_global_object_function->initial_map()->set_is_hidden_prototype();
js_global_object_function->initial_map()->set_dictionary_map(true);
Handle<JSGlobalObject> global_object =
factory()->NewJSGlobalObject(js_global_object_function);
@@ -973,10 +975,10 @@
isolate(), global_constructor, factory()->the_hole_value(),
ApiNatives::GlobalProxyType);
}
-
Handle<String> global_name = factory()->global_string();
global_proxy_function->shared()->set_instance_class_name(*global_name);
global_proxy_function->initial_map()->set_is_access_check_needed(true);
+ global_proxy_function->initial_map()->set_has_hidden_prototype(true);
// Set global_proxy.__proto__ to js_global after ConfigureGlobalObjects
// Return the global proxy.
@@ -1063,7 +1065,7 @@
// work in the snapshot case is done in HookUpGlobalObject.
void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Handle<JSFunction> empty_function,
- ContextType context_type) {
+ GlobalContextType context_type) {
// --- N a t i v e C o n t e x t ---
// Use the empty function as closure (no scope info).
native_context()->set_closure(*empty_function);
@@ -1095,6 +1097,13 @@
Handle<JSFunction> object_freeze = SimpleInstallFunction(
object_function, "freeze", Builtins::kObjectFreeze, 1, false);
native_context()->set_object_freeze(*object_freeze);
+ SimpleInstallFunction(object_function, "getOwnPropertyDescriptor",
+ Builtins::kObjectGetOwnPropertyDescriptor, 2, false);
+ SimpleInstallFunction(object_function, "getOwnPropertyNames",
+ Builtins::kObjectGetOwnPropertyNames, 1, false);
+ SimpleInstallFunction(object_function, "getOwnPropertySymbols",
+ Builtins::kObjectGetOwnPropertySymbols, 1, false);
+ SimpleInstallFunction(object_function, "is", Builtins::kObjectIs, 2, true);
Handle<JSFunction> object_is_extensible =
SimpleInstallFunction(object_function, "isExtensible",
Builtins::kObjectIsExtensible, 1, false);
@@ -1140,6 +1149,22 @@
SimpleInstallFunction(prototype, factory->toString_string(),
Builtins::kFunctionPrototypeToString, 0, false);
+ // Install the @@hasInstance function.
+ Handle<JSFunction> has_instance = InstallFunction(
+ prototype, factory->has_instance_symbol(), JS_OBJECT_TYPE,
+ JSObject::kHeaderSize, MaybeHandle<JSObject>(),
+ Builtins::kFunctionHasInstance,
+ static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY));
+
+ // Set the expected parameters for @@hasInstance to 1; required by builtin.
+ has_instance->shared()->set_internal_formal_parameter_count(1);
+
+ // Set the length for the function to satisfy ECMA-262.
+ has_instance->shared()->set_length(1);
+
+ // Install in the native context
+ native_context()->set_ordinary_has_instance(*has_instance);
+
// Install the "constructor" property on the %FunctionPrototype%.
JSObject::AddProperty(prototype, factory->constructor_string(),
function_fun, DONT_ENUM);
@@ -1216,9 +1241,29 @@
Handle<JSFunction> boolean_fun =
InstallFunction(global, "Boolean", JS_VALUE_TYPE, JSValue::kSize,
isolate->initial_object_prototype(),
- Builtins::kIllegal);
+ Builtins::kBooleanConstructor);
+ boolean_fun->shared()->DontAdaptArguments();
+ boolean_fun->shared()->set_construct_stub(
+ *isolate->builtins()->BooleanConstructor_ConstructStub());
+ boolean_fun->shared()->set_length(1);
InstallWithIntrinsicDefaultProto(isolate, boolean_fun,
Context::BOOLEAN_FUNCTION_INDEX);
+
+ // Create the %BooleanPrototype%
+ Handle<JSValue> prototype =
+ Handle<JSValue>::cast(factory->NewJSObject(boolean_fun, TENURED));
+ prototype->set_value(isolate->heap()->false_value());
+ Accessors::FunctionSetPrototype(boolean_fun, prototype).Assert();
+
+ // Install the "constructor" property on the {prototype}.
+ JSObject::AddProperty(prototype, factory->constructor_string(), boolean_fun,
+ DONT_ENUM);
+
+ // Install the Boolean.prototype methods.
+ SimpleInstallFunction(prototype, "toString",
+ Builtins::kBooleanPrototypeToString, 0, false);
+ SimpleInstallFunction(prototype, "valueOf",
+ Builtins::kBooleanPrototypeValueOf, 0, false);
}
{ // --- S t r i n g ---
@@ -1234,6 +1279,7 @@
Handle<Map> string_map =
Handle<Map>(native_context()->string_function()->initial_map());
+ string_map->set_elements_kind(FAST_STRING_WRAPPER_ELEMENTS);
Map::EnsureDescriptorSlack(string_map, 1);
PropertyAttributes attribs = static_cast<PropertyAttributes>(
@@ -1250,14 +1296,20 @@
{
// --- S y m b o l ---
- Handle<JSFunction> symbol_fun = InstallFunction(
- global, "Symbol", JS_VALUE_TYPE, JSValue::kSize,
- isolate->initial_object_prototype(), Builtins::kSymbolConstructor);
+ Handle<JSObject> prototype =
+ factory->NewJSObject(isolate->object_function(), TENURED);
+ Handle<JSFunction> symbol_fun =
+ InstallFunction(global, "Symbol", JS_VALUE_TYPE, JSValue::kSize,
+ prototype, Builtins::kSymbolConstructor);
symbol_fun->shared()->set_construct_stub(
*isolate->builtins()->SymbolConstructor_ConstructStub());
symbol_fun->shared()->set_length(1);
symbol_fun->shared()->DontAdaptArguments();
native_context()->set_symbol_function(*symbol_fun);
+
+ // Install the "constructor" property on the {prototype}.
+ JSObject::AddProperty(prototype, factory->constructor_string(), symbol_fun,
+ DONT_ENUM);
}
{ // --- D a t e ---
@@ -1290,12 +1342,13 @@
Builtins::kDatePrototypeToDateString, 0, false);
SimpleInstallFunction(prototype, "toTimeString",
Builtins::kDatePrototypeToTimeString, 0, false);
- SimpleInstallFunction(prototype, "toGMTString",
- Builtins::kDatePrototypeToUTCString, 0, false);
SimpleInstallFunction(prototype, "toISOString",
Builtins::kDatePrototypeToISOString, 0, false);
- SimpleInstallFunction(prototype, "toUTCString",
- Builtins::kDatePrototypeToUTCString, 0, false);
+ Handle<JSFunction> to_utc_string =
+ SimpleInstallFunction(prototype, "toUTCString",
+ Builtins::kDatePrototypeToUTCString, 0, false);
+ InstallFunction(prototype, to_utc_string,
+ factory->InternalizeUtf8String("toGMTString"), DONT_ENUM);
SimpleInstallFunction(prototype, "getDate", Builtins::kDatePrototypeGetDate,
0, true);
SimpleInstallFunction(prototype, "setDate", Builtins::kDatePrototypeSetDate,
@@ -1504,9 +1557,11 @@
cons,
Handle<Object>(native_context()->initial_object_prototype(), isolate));
cons->shared()->set_instance_class_name(*name);
- Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED);
- DCHECK(json_object->IsJSObject());
- JSObject::AddProperty(global, name, json_object, DONT_ENUM);
+ Handle<JSObject> math = factory->NewJSObject(cons, TENURED);
+ DCHECK(math->IsJSObject());
+ JSObject::AddProperty(global, name, math, DONT_ENUM);
+ SimpleInstallFunction(math, "max", Builtins::kMathMax, 2, false);
+ SimpleInstallFunction(math, "min", Builtins::kMathMin, 2, false);
}
{ // -- A r r a y B u f f e r
@@ -1527,16 +1582,16 @@
TYPED_ARRAYS(INSTALL_TYPED_ARRAY)
#undef INSTALL_TYPED_ARRAY
- Handle<JSFunction> data_view_fun =
- InstallFunction(
- global, "DataView", JS_DATA_VIEW_TYPE,
- JSDataView::kSizeWithInternalFields,
- isolate->initial_object_prototype(),
- Builtins::kIllegal);
+ Handle<JSFunction> data_view_fun = InstallFunction(
+ global, "DataView", JS_DATA_VIEW_TYPE,
+ JSDataView::kSizeWithInternalFields,
+ isolate->initial_object_prototype(), Builtins::kDataViewConstructor);
InstallWithIntrinsicDefaultProto(isolate, data_view_fun,
Context::DATA_VIEW_FUN_INDEX);
data_view_fun->shared()->set_construct_stub(
- *isolate->builtins()->JSBuiltinsConstructStub());
+ *isolate->builtins()->DataViewConstructor_ConstructStub());
+ data_view_fun->shared()->set_length(3);
+ data_view_fun->shared()->DontAdaptArguments();
}
{ // -- M a p
@@ -1557,7 +1612,7 @@
{ // -- I t e r a t o r R e s u l t
Handle<Map> map =
- factory->NewMap(JS_ITERATOR_RESULT_TYPE, JSIteratorResult::kSize);
+ factory->NewMap(JS_OBJECT_TYPE, JSIteratorResult::kSize);
Map::SetPrototype(map, isolate->initial_object_prototype());
Map::EnsureDescriptorSlack(map, 2);
@@ -1573,6 +1628,7 @@
map->AppendDescriptor(&d);
}
+ map->SetConstructor(native_context()->object_function());
map->SetInObjectProperties(2);
native_context()->set_iterator_result_map(*map);
}
@@ -1618,7 +1674,7 @@
native_context()->set_bound_function_without_constructor_map(*map);
map = Map::Copy(map, "IsConstructor");
- map->set_is_constructor();
+ map->set_is_constructor(true);
native_context()->set_bound_function_with_constructor_map(*map);
}
@@ -1633,18 +1689,20 @@
function->shared()->set_instance_class_name(*arguments_string);
Handle<Map> map = factory->NewMap(
- JS_OBJECT_TYPE, Heap::kSloppyArgumentsObjectSize, FAST_ELEMENTS);
+ JS_OBJECT_TYPE, JSSloppyArgumentsObject::kSize, FAST_ELEMENTS);
// Create the descriptor array for the arguments object.
Map::EnsureDescriptorSlack(map, 2);
{ // length
- DataDescriptor d(factory->length_string(), Heap::kArgumentsLengthIndex,
- DONT_ENUM, Representation::Tagged());
+ DataDescriptor d(factory->length_string(),
+ JSSloppyArgumentsObject::kLengthIndex, DONT_ENUM,
+ Representation::Tagged());
map->AppendDescriptor(&d);
}
{ // callee
- DataDescriptor d(factory->callee_string(), Heap::kArgumentsCalleeIndex,
- DONT_ENUM, Representation::Tagged());
+ DataDescriptor d(factory->callee_string(),
+ JSSloppyArgumentsObject::kCalleeIndex, DONT_ENUM,
+ Representation::Tagged());
map->AppendDescriptor(&d);
}
// @@iterator method is added later.
@@ -1656,8 +1714,6 @@
JSFunction::SetInitialMap(function, map,
isolate->initial_object_prototype());
- DCHECK(map->GetInObjectProperties() > Heap::kArgumentsCalleeIndex);
- DCHECK(map->GetInObjectProperties() > Heap::kArgumentsLengthIndex);
DCHECK(!map->is_dictionary_map());
DCHECK(IsFastObjectElementsKind(map->elements_kind()));
}
@@ -1693,13 +1749,14 @@
// Create the map. Allocate one in-object field for length.
Handle<Map> map = factory->NewMap(
- JS_OBJECT_TYPE, Heap::kStrictArgumentsObjectSize, FAST_ELEMENTS);
+ JS_OBJECT_TYPE, JSStrictArgumentsObject::kSize, FAST_ELEMENTS);
// Create the descriptor array for the arguments object.
Map::EnsureDescriptorSlack(map, 3);
{ // length
- DataDescriptor d(factory->length_string(), Heap::kArgumentsLengthIndex,
- DONT_ENUM, Representation::Tagged());
+ DataDescriptor d(factory->length_string(),
+ JSStrictArgumentsObject::kLengthIndex, DONT_ENUM,
+ Representation::Tagged());
map->AppendDescriptor(&d);
}
{ // callee
@@ -1725,7 +1782,6 @@
native_context()->set_strict_arguments_map(*map);
- DCHECK(map->GetInObjectProperties() > Heap::kArgumentsLengthIndex);
DCHECK(!map->is_dictionary_map());
DCHECK(IsFastObjectElementsKind(map->elements_kind()));
}
@@ -1805,7 +1861,7 @@
Handle<Object> args[] = {global, utils, extras_utils};
return Bootstrapper::CompileNative(isolate, name, source_code,
- arraysize(args), args);
+ arraysize(args), args, NATIVES_CODE);
}
@@ -1818,7 +1874,7 @@
Handle<Object> utils = isolate->natives_utils_object();
Handle<Object> args[] = {global, utils};
return Bootstrapper::CompileNative(isolate, name, source_code,
- arraysize(args), args);
+ arraysize(args), args, NATIVES_CODE);
}
@@ -1832,7 +1888,7 @@
Handle<Object> extras_utils = isolate->extras_utils_object();
Handle<Object> args[] = {global, binding, extras_utils};
return Bootstrapper::CompileNative(isolate, name, source_code,
- arraysize(args), args);
+ arraysize(args), args, EXTENSION_CODE);
}
@@ -1847,13 +1903,13 @@
Handle<Object> extras_utils = isolate->extras_utils_object();
Handle<Object> args[] = {global, binding, extras_utils};
return Bootstrapper::CompileNative(isolate, name, source_code,
- arraysize(args), args);
+ arraysize(args), args, EXTENSION_CODE);
}
-
bool Bootstrapper::CompileNative(Isolate* isolate, Vector<const char> name,
Handle<String> source, int argc,
- Handle<Object> argv[]) {
+ Handle<Object> argv[],
+ NativesFlag natives_flag) {
SuppressDebug compiling_natives(isolate->debug());
// During genesis, the boilerplate for stack overflow won't work until the
// environment has been at least partially initialized. Add a stack check
@@ -1870,7 +1926,7 @@
isolate->factory()->NewStringFromUtf8(name).ToHandleChecked();
Handle<SharedFunctionInfo> function_info = Compiler::CompileScript(
source, script_name, 0, 0, ScriptOriginOptions(), Handle<Object>(),
- context, NULL, NULL, ScriptCompiler::kNoCompileOptions, NATIVES_CODE,
+ context, NULL, NULL, ScriptCompiler::kNoCompileOptions, natives_flag,
false);
if (function_info.is_null()) return false;
@@ -1928,7 +1984,7 @@
function_info = Compiler::CompileScript(
source, script_name, 0, 0, ScriptOriginOptions(), Handle<Object>(),
context, extension, NULL, ScriptCompiler::kNoCompileOptions,
- NOT_NATIVES_CODE, false);
+ EXTENSION_CODE, false);
if (function_info.is_null()) return false;
cache->Add(name, function_info);
}
@@ -1977,8 +2033,7 @@
return Handle<JSObject>::cast(value);
}
-
-void Genesis::ConfigureUtilsObject(ContextType context_type) {
+void Genesis::ConfigureUtilsObject(GlobalContextType context_type) {
switch (context_type) {
// We still need the utils object to find debug functions.
case DEBUG_CONTEXT:
@@ -2027,24 +2082,6 @@
#undef EXPORT_PUBLIC_SYMBOL
{
- Handle<JSFunction> apply = InstallFunction(
- container, "reflect_apply", JS_OBJECT_TYPE, JSObject::kHeaderSize,
- MaybeHandle<JSObject>(), Builtins::kReflectApply);
- apply->shared()->DontAdaptArguments();
- apply->shared()->set_length(3);
- native_context->set_reflect_apply(*apply);
- }
-
- {
- Handle<JSFunction> construct = InstallFunction(
- container, "reflect_construct", JS_OBJECT_TYPE, JSObject::kHeaderSize,
- MaybeHandle<JSObject>(), Builtins::kReflectConstruct);
- construct->shared()->DontAdaptArguments();
- construct->shared()->set_length(2);
- native_context->set_reflect_construct(*construct);
- }
-
- {
Handle<JSFunction> to_string = InstallFunction(
container, "object_to_string", JS_OBJECT_TYPE, JSObject::kHeaderSize,
MaybeHandle<JSObject>(), Builtins::kObjectProtoToString);
@@ -2279,7 +2316,6 @@
}
INITIALIZE_FLAG(FLAG_harmony_tostring)
- INITIALIZE_FLAG(FLAG_harmony_tolength)
INITIALIZE_FLAG(FLAG_harmony_species)
#undef INITIALIZE_FLAG
@@ -2299,13 +2335,15 @@
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_observe)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexps)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_unicode_regexps)
-EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_completion)
-EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tolength)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_iterator_close)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_name)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(promise_extra)
-
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_instanceof)
void InstallPublicSymbol(Factory* factory, Handle<Context> native_context,
const char* name, Handle<Symbol> value) {
@@ -2328,13 +2366,6 @@
}
-void Genesis::InitializeGlobal_harmony_concat_spreadable() {
- if (!FLAG_harmony_concat_spreadable) return;
- InstallPublicSymbol(factory(), native_context(), "isConcatSpreadable",
- factory()->is_concat_spreadable_symbol());
-}
-
-
void Genesis::InitializeGlobal_harmony_regexp_subclass() {
if (!FLAG_harmony_regexp_subclass) return;
InstallPublicSymbol(factory(), native_context(), "match",
@@ -2364,6 +2395,15 @@
Builtins::kReflectDeleteProperty, 2, true);
native_context()->set_reflect_delete_property(*delete_property);
+ Handle<JSFunction> apply = SimpleCreateFunction(
+ isolate(), factory->apply_string(), Builtins::kReflectApply, 3, false);
+ native_context()->set_reflect_apply(*apply);
+
+ Handle<JSFunction> construct =
+ SimpleCreateFunction(isolate(), factory->construct_string(),
+ Builtins::kReflectConstruct, 2, false);
+ native_context()->set_reflect_construct(*construct);
+
if (!FLAG_harmony_reflect) return;
Handle<JSGlobalObject> global(JSGlobalObject::cast(
@@ -2375,6 +2415,8 @@
InstallFunction(reflect, define_property, factory->defineProperty_string());
InstallFunction(reflect, delete_property, factory->deleteProperty_string());
+ InstallFunction(reflect, apply, factory->apply_string());
+ InstallFunction(reflect, construct, factory->construct_string());
SimpleInstallFunction(reflect, factory->get_string(),
Builtins::kReflectGet, 2, false);
@@ -2438,6 +2480,35 @@
}
+void Genesis::InitializeGlobal_harmony_object_values_entries() {
+ if (!FLAG_harmony_object_values_entries) return;
+
+ Handle<JSGlobalObject> global(
+ JSGlobalObject::cast(native_context()->global_object()));
+ Isolate* isolate = global->GetIsolate();
+ Factory* factory = isolate->factory();
+
+ Handle<JSFunction> object_function = isolate->object_function();
+ SimpleInstallFunction(object_function, factory->entries_string(),
+ Builtins::kObjectEntries, 1, false);
+ SimpleInstallFunction(object_function, factory->values_string(),
+ Builtins::kObjectValues, 1, false);
+}
+
+void Genesis::InitializeGlobal_harmony_object_own_property_descriptors() {
+ if (!FLAG_harmony_object_own_property_descriptors) return;
+
+ Handle<JSGlobalObject> global(
+ JSGlobalObject::cast(native_context()->global_object()));
+ Isolate* isolate = global->GetIsolate();
+ Factory* factory = isolate->factory();
+
+ Handle<JSFunction> object_function = isolate->object_function();
+ SimpleInstallFunction(object_function,
+ factory->getOwnPropertyDescriptors_string(),
+ Builtins::kObjectGetOwnPropertyDescriptors, 1, false);
+}
+
void Genesis::InstallJSProxyMaps() {
// Allocate the different maps for all Proxy types.
// Next to the default proxy, we need maps indicating callable and
@@ -2445,7 +2516,7 @@
Handle<Map> proxy_function_map =
Map::Copy(isolate()->sloppy_function_without_prototype_map(), "Proxy");
- proxy_function_map->set_is_constructor();
+ proxy_function_map->set_is_constructor(true);
native_context()->set_proxy_function_map(*proxy_function_map);
Handle<Map> proxy_map =
@@ -2460,7 +2531,7 @@
Handle<Map> proxy_constructor_map =
Map::Copy(proxy_callable_map, "constructor Proxy");
- proxy_constructor_map->set_is_constructor();
+ proxy_constructor_map->set_is_constructor(true);
native_context()->set_proxy_constructor_map(*proxy_constructor_map);
}
@@ -2478,8 +2549,9 @@
Handle<String> name = factory->Proxy_string();
Handle<Code> code(isolate->builtins()->ProxyConstructor());
- Handle<JSFunction> proxy_function = factory->NewFunction(
- isolate->proxy_function_map(), factory->Proxy_string(), code);
+ Handle<JSFunction> proxy_function =
+ factory->NewFunction(isolate->proxy_function_map(),
+ factory->Proxy_string(), MaybeHandle<Code>(code));
JSFunction::SetInitialMap(proxy_function,
Handle<Map>(native_context()->proxy_map(), isolate),
@@ -2574,8 +2646,7 @@
return array_function;
}
-
-bool Genesis::InstallNatives(ContextType context_type) {
+bool Genesis::InstallNatives(GlobalContextType context_type) {
HandleScope scope(isolate());
// Set up the utils object as shared container between native scripts.
@@ -2637,10 +2708,11 @@
if (!CallUtilsFunction(isolate(), "PostNatives")) return false;
- auto function_cache =
+ auto template_instantiations_cache =
ObjectHashTable::New(isolate(), ApiNatives::kInitialFunctionCacheSize,
USE_CUSTOM_MINIMUM_CAPACITY);
- native_context()->set_function_cache(*function_cache);
+ native_context()->set_template_instantiations_cache(
+ *template_instantiations_cache);
// Store the map for the %ObjectPrototype% after the natives has been compiled
// and the Object function has been set up.
@@ -2717,6 +2789,91 @@
InstallBuiltinFunctionIds();
+ // Create a map for accessor property descriptors (a variant of JSObject
+ // that predefines four properties get, set, configurable and enumerable).
+ {
+ // AccessorPropertyDescriptor initial map.
+ Handle<Map> map =
+ factory()->NewMap(JS_OBJECT_TYPE, JSAccessorPropertyDescriptor::kSize);
+ // Create the descriptor array for the property descriptor object.
+ Map::EnsureDescriptorSlack(map, 4);
+
+ { // get
+ DataDescriptor d(factory()->get_string(),
+ JSAccessorPropertyDescriptor::kGetIndex, NONE,
+ Representation::Tagged());
+ map->AppendDescriptor(&d);
+ }
+ { // set
+ DataDescriptor d(factory()->set_string(),
+ JSAccessorPropertyDescriptor::kSetIndex, NONE,
+ Representation::Tagged());
+ map->AppendDescriptor(&d);
+ }
+ { // enumerable
+ DataDescriptor d(factory()->enumerable_string(),
+ JSAccessorPropertyDescriptor::kEnumerableIndex, NONE,
+ Representation::Tagged());
+ map->AppendDescriptor(&d);
+ }
+ { // configurable
+ DataDescriptor d(factory()->configurable_string(),
+ JSAccessorPropertyDescriptor::kConfigurableIndex, NONE,
+ Representation::Tagged());
+ map->AppendDescriptor(&d);
+ }
+
+ Map::SetPrototype(map, isolate()->initial_object_prototype());
+ map->SetConstructor(native_context()->object_function());
+ map->SetInObjectProperties(4);
+ map->set_unused_property_fields(0);
+
+ native_context()->set_accessor_property_descriptor_map(*map);
+ }
+
+ // Create a map for data property descriptors (a variant of JSObject
+ // that predefines four properties value, writable, configurable and
+ // enumerable).
+ {
+ // DataPropertyDescriptor initial map.
+ Handle<Map> map =
+ factory()->NewMap(JS_OBJECT_TYPE, JSDataPropertyDescriptor::kSize);
+ // Create the descriptor array for the property descriptor object.
+ Map::EnsureDescriptorSlack(map, 4);
+
+ { // value
+ DataDescriptor d(factory()->value_string(),
+ JSDataPropertyDescriptor::kValueIndex, NONE,
+ Representation::Tagged());
+ map->AppendDescriptor(&d);
+ }
+ { // writable
+ DataDescriptor d(factory()->writable_string(),
+ JSDataPropertyDescriptor::kWritableIndex, NONE,
+ Representation::Tagged());
+ map->AppendDescriptor(&d);
+ }
+ { // enumerable
+ DataDescriptor d(factory()->enumerable_string(),
+ JSDataPropertyDescriptor::kEnumerableIndex, NONE,
+ Representation::Tagged());
+ map->AppendDescriptor(&d);
+ }
+ { // configurable
+ DataDescriptor d(factory()->configurable_string(),
+ JSDataPropertyDescriptor::kConfigurableIndex, NONE,
+ Representation::Tagged());
+ map->AppendDescriptor(&d);
+ }
+
+ Map::SetPrototype(map, isolate()->initial_object_prototype());
+ map->SetConstructor(native_context()->object_function());
+ map->SetInObjectProperties(4);
+ map->set_unused_property_fields(0);
+
+ native_context()->set_data_property_descriptor_map(*map);
+ }
+
// Create a constructor for RegExp results (a variant of Array that
// predefines the two properties index and match).
{
@@ -2745,7 +2902,7 @@
array_function->initial_map()->instance_descriptors());
Handle<String> length = factory()->length_string();
int old = array_descriptors->SearchWithCache(
- *length, array_function->initial_map());
+ isolate(), *length, array_function->initial_map());
DCHECK(old != DescriptorArray::kNotFound);
AccessorConstantDescriptor desc(
length, handle(array_descriptors->GetValue(old), isolate()),
@@ -2817,11 +2974,13 @@
static const char* harmony_regexps_natives[] = {"native harmony-regexp.js",
nullptr};
static const char* harmony_tostring_natives[] = {nullptr};
+ static const char* harmony_iterator_close_natives[] = {nullptr};
static const char* harmony_sloppy_natives[] = {nullptr};
static const char* harmony_sloppy_function_natives[] = {nullptr};
static const char* harmony_sloppy_let_natives[] = {nullptr};
static const char* harmony_species_natives[] = {"native harmony-species.js",
nullptr};
+ static const char* harmony_tailcalls_natives[] = {nullptr};
static const char* harmony_unicode_regexps_natives[] = {
"native harmony-unicode-regexps.js", nullptr};
static const char* harmony_default_parameters_natives[] = {nullptr};
@@ -2833,17 +2992,20 @@
"native harmony-object-observe.js", nullptr};
static const char* harmony_sharedarraybuffer_natives[] = {
"native harmony-sharedarraybuffer.js", "native harmony-atomics.js", NULL};
- static const char* harmony_concat_spreadable_natives[] = {nullptr};
static const char* harmony_simd_natives[] = {"native harmony-simd.js",
nullptr};
- static const char* harmony_tolength_natives[] = {nullptr};
- static const char* harmony_completion_natives[] = {nullptr};
static const char* harmony_do_expressions_natives[] = {nullptr};
static const char* harmony_regexp_subclass_natives[] = {nullptr};
static const char* harmony_regexp_lookbehind_natives[] = {nullptr};
+ static const char* harmony_instanceof_natives[] = {nullptr};
+ static const char* harmony_regexp_property_natives[] = {nullptr};
static const char* harmony_function_name_natives[] = {nullptr};
+ static const char* harmony_function_sent_natives[] = {nullptr};
static const char* promise_extra_natives[] = {"native promise-extra.js",
nullptr};
+ static const char* harmony_object_values_entries_natives[] = {nullptr};
+ static const char* harmony_object_own_property_descriptors_natives[] = {
+ nullptr};
for (int i = ExperimentalNatives::GetDebuggerCount();
i < ExperimentalNatives::GetBuiltinsCount(); i++) {
@@ -3371,12 +3533,11 @@
bool enabled_;
};
-
Genesis::Genesis(Isolate* isolate,
MaybeHandle<JSGlobalProxy> maybe_global_proxy,
v8::Local<v8::ObjectTemplate> global_proxy_template,
v8::ExtensionConfiguration* extensions,
- ContextType context_type)
+ GlobalContextType context_type)
: isolate_(isolate), active_(isolate->bootstrapper()) {
NoTrackDoubleFieldsForSerializerScope disable_scope(isolate);
result_ = Handle<Context>::null();