Update V8 to version 4.1.0.21
This is a cherry-pick of all commits up to and including the
4.1.0.21 cherry-pick in Chromium.
Original commit message:
Version 4.1.0.21 (cherry-pick)
Merged 206e9136bde0f2b5ae8cb77afbb1e7833e5bd412
Unlink pages from the space page list after evacuation.
BUG=430201
LOG=N
R=jkummerow@chromium.org
Review URL: https://codereview.chromium.org/953813002
Cr-Commit-Position: refs/branch-heads/4.1@{#22}
Cr-Branched-From: 2e08d2a7aa9d65d269d8c57aba82eb38a8cb0a18-refs/heads/candidates@{#25353}
---
FPIIM-449
Change-Id: I8c23c7bbb70772b4858fe8a47b64fa97ee0d1f8c
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index 250562a..7105eb2 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -48,7 +48,7 @@
Heap* heap = isolate_->heap();
if (heap->natives_source_cache()->get(index)->IsUndefined()) {
// We can use external strings for the natives.
- Vector<const char> source = Natives::GetRawScriptSource(index);
+ Vector<const char> source = Natives::GetScriptSource(index);
NativesExternalStringResource* resource =
new NativesExternalStringResource(this,
source.start(),
@@ -57,6 +57,8 @@
Handle<String> source_code = isolate_->factory()
->NewExternalStringFromOneByte(resource)
.ToHandleChecked();
+ // Mark this external string with a special map.
+ source_code->set_map(isolate_->heap()->native_source_string_map());
heap->natives_source_cache()->set(index, *source_code);
}
Handle<Object> cached_source(heap->natives_source_cache()->get(index),
@@ -126,7 +128,7 @@
void Bootstrapper::TearDown() {
if (delete_these_non_arrays_on_tear_down_ != NULL) {
int len = delete_these_non_arrays_on_tear_down_->length();
- DCHECK(len < 28); // Don't use this mechanism for unbounded allocations.
+ DCHECK(len < 1000); // Don't use this mechanism for unbounded allocations.
for (int i = 0; i < len; i++) {
delete delete_these_non_arrays_on_tear_down_->at(i);
delete_these_non_arrays_on_tear_down_->at(i) = NULL;
@@ -208,6 +210,16 @@
// Used for creating a context from scratch.
void InstallNativeFunctions();
void InstallExperimentalNativeFunctions();
+
+#define DECLARE_FEATURE_INITIALIZATION(id, descr) \
+ void InstallNativeFunctions_##id(); \
+ void InitializeGlobal_##id();
+
+ HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION)
+ HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION)
+ HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION)
+#undef DECLARE_FEATURE_INITIALIZATION
+
Handle<JSFunction> InstallInternalArray(Handle<JSBuiltinsObject> builtins,
const char* name,
ElementsKind elements_kind);
@@ -349,8 +361,8 @@
static void SetObjectPrototype(Handle<JSObject> object, Handle<Object> proto) {
// object.__proto__ = proto;
Handle<Map> old_map = Handle<Map>(object->map());
- Handle<Map> new_map = Map::Copy(old_map);
- new_map->set_prototype(*proto);
+ Handle<Map> new_map = Map::Copy(old_map, "SetObjectPrototype");
+ new_map->SetPrototype(proto, FAST_PROTOTYPE);
JSObject::MigrateToMap(object, new_map);
}
@@ -481,6 +493,8 @@
Handle<String> object_name = factory->Object_string();
+ Handle<JSObject> object_function_prototype;
+
{ // --- O b j e c t ---
Handle<JSFunction> object_fun = factory->NewFunction(object_name);
int unused = JSObject::kInitialGlobalObjectUnusedPropertiesCount;
@@ -495,19 +509,20 @@
native_context()->set_object_function(*object_fun);
// Allocate a new prototype for the object function.
- Handle<JSObject> prototype = factory->NewJSObject(
- isolate->object_function(),
- TENURED);
- Handle<Map> map = Map::Copy(handle(prototype->map()));
+ object_function_prototype =
+ factory->NewJSObject(isolate->object_function(), TENURED);
+ Handle<Map> map = Map::Copy(handle(object_function_prototype->map()),
+ "EmptyObjectPrototype");
map->set_is_prototype_map(true);
- prototype->set_map(*map);
+ object_function_prototype->set_map(*map);
- native_context()->set_initial_object_prototype(*prototype);
+ native_context()->set_initial_object_prototype(*object_function_prototype);
// For bootstrapping set the array prototype to be the same as the object
// prototype, otherwise the missing initial_array_prototype will cause
// assertions during startup.
- native_context()->set_initial_array_prototype(*prototype);
- Accessors::FunctionSetPrototype(object_fun, prototype);
+ native_context()->set_initial_array_prototype(*object_function_prototype);
+ Accessors::FunctionSetPrototype(object_fun, object_function_prototype)
+ .Assert();
}
// Allocate the empty function as the prototype for function ECMAScript
@@ -522,8 +537,7 @@
Handle<Map> empty_function_map =
CreateFunctionMap(FUNCTION_WITHOUT_PROTOTYPE);
DCHECK(!empty_function_map->is_dictionary_map());
- empty_function_map->set_prototype(
- native_context()->object_function()->prototype());
+ empty_function_map->SetPrototype(object_function_prototype);
empty_function_map->set_is_prototype_map(true);
empty_function->set_map(*empty_function_map);
@@ -537,10 +551,10 @@
empty_function->shared()->DontAdaptArguments();
// Set prototypes for the function maps.
- native_context()->sloppy_function_map()->set_prototype(*empty_function);
- native_context()->sloppy_function_without_prototype_map()->
- set_prototype(*empty_function);
- sloppy_function_map_writable_prototype_->set_prototype(*empty_function);
+ native_context()->sloppy_function_map()->SetPrototype(empty_function);
+ native_context()->sloppy_function_without_prototype_map()->SetPrototype(
+ empty_function);
+ sloppy_function_map_writable_prototype_->SetPrototype(empty_function);
return empty_function;
}
@@ -642,7 +656,7 @@
Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize);
SetStrictFunctionInstanceDescriptor(map, function_mode);
map->set_function_with_prototype(IsFunctionModeWithPrototype(function_mode));
- map->set_prototype(*empty_function);
+ map->SetPrototype(empty_function);
return map;
}
@@ -851,7 +865,6 @@
Handle<JSGlobalProxy> global_proxy) {
// Set the native context for the global object.
global_object->set_native_context(*native_context());
- global_object->set_global_context(*native_context());
global_object->set_global_proxy(*global_proxy);
global_proxy->set_native_context(*native_context());
native_context()->set_global_proxy(*global_proxy);
@@ -896,6 +909,10 @@
Factory* factory = isolate->factory();
Heap* heap = isolate->heap();
+ Handle<ScriptContextTable> script_context_table =
+ factory->NewScriptContextTable();
+ native_context()->set_script_context_table(*script_context_table);
+
Handle<String> object_name = factory->Object_string();
JSObject::AddProperty(
global_object, object_name, isolate->object_function(), DONT_ENUM);
@@ -934,7 +951,7 @@
CallbacksDescriptor d(
Handle<Name>(Name::cast(array_length->name())),
array_length, attribs);
- array_function->initial_map()->AppendDescriptor(&d);
+ initial_map->AppendDescriptor(&d);
}
// array_function is used internally. JS code creating array object should
@@ -1028,11 +1045,10 @@
{
// ECMA-262, section 15.10.7.1.
- FieldDescriptor field(factory->source_string(),
- JSRegExp::kSourceFieldIndex,
- final,
- Representation::Tagged());
- initial_map->AppendDescriptor(&field);
+ Handle<AccessorInfo> regexp_source(
+ Accessors::RegExpSourceInfo(isolate, final));
+ CallbacksDescriptor d(factory->source_string(), regexp_source, final);
+ initial_map->AppendDescriptor(&d);
}
{
// ECMA-262, section 15.10.7.2.
@@ -1069,19 +1085,17 @@
initial_map->AppendDescriptor(&field);
}
- initial_map->set_inobject_properties(5);
- initial_map->set_pre_allocated_property_fields(5);
+ static const int num_fields = JSRegExp::kInObjectFieldCount;
+ initial_map->set_inobject_properties(num_fields);
+ initial_map->set_pre_allocated_property_fields(num_fields);
initial_map->set_unused_property_fields(0);
- initial_map->set_instance_size(
- initial_map->instance_size() + 5 * kPointerSize);
- initial_map->set_visitor_id(StaticVisitorBase::GetVisitorId(*initial_map));
+ initial_map->set_instance_size(initial_map->instance_size() +
+ num_fields * kPointerSize);
// RegExp prototype object is itself a RegExp.
- Handle<Map> proto_map = Map::Copy(initial_map);
- proto_map->set_prototype(native_context()->initial_object_prototype());
+ Handle<Map> proto_map = Map::Copy(initial_map, "RegExpPrototype");
+ DCHECK(proto_map->prototype() == *isolate->initial_object_prototype());
Handle<JSObject> proto = factory->NewJSObjectFromMap(proto_map);
- proto->InObjectPropertyAtPut(JSRegExp::kSourceFieldIndex,
- heap->query_colon_string());
proto->InObjectPropertyAtPut(JSRegExp::kGlobalFieldIndex,
heap->false_value());
proto->InObjectPropertyAtPut(JSRegExp::kIgnoreCaseFieldIndex,
@@ -1092,7 +1106,7 @@
Smi::FromInt(0),
SKIP_WRITE_BARRIER); // It's a Smi.
proto_map->set_is_prototype_map(true);
- initial_map->set_prototype(*proto);
+ initial_map->SetPrototype(proto);
factory->SetRegExpIrregexpData(Handle<JSRegExp>::cast(proto),
JSRegExp::IRREGEXP, factory->empty_string(),
JSRegExp::Flags(0), 0);
@@ -1232,7 +1246,8 @@
}
{ // --- aliased arguments map
- Handle<Map> map = Map::Copy(isolate->sloppy_arguments_map());
+ Handle<Map> map =
+ Map::Copy(isolate->sloppy_arguments_map(), "AliasedArguments");
map->set_elements_kind(SLOPPY_ARGUMENTS_ELEMENTS);
DCHECK_EQ(2, map->pre_allocated_property_fields());
native_context()->set_aliased_arguments_map(*map);
@@ -1276,7 +1291,9 @@
// @@iterator method is added later.
map->set_function_with_prototype(true);
- map->set_prototype(native_context()->object_function()->prototype());
+ DCHECK_EQ(native_context()->object_function()->prototype(),
+ *isolate->initial_object_prototype());
+ map->SetPrototype(isolate->initial_object_prototype());
map->set_pre_allocated_property_fields(1);
map->set_inobject_properties(1);
@@ -1358,16 +1375,12 @@
void Genesis::InitializeExperimentalGlobal() {
- // TODO(erikcorry): Move this into Genesis::InitializeGlobal once we no
- // longer need to live behind a flag.
- Handle<JSObject> builtins(native_context()->builtins());
+#define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id();
- Handle<HeapObject> flag(
- FLAG_harmony_regexps ? heap()->true_value() : heap()->false_value());
- PropertyAttributes attributes =
- static_cast<PropertyAttributes>(DONT_DELETE | READ_ONLY);
- Runtime::DefineObjectProperty(builtins, factory()->harmony_regexps_string(),
- flag, attributes).Assert();
+ HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL)
+ HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL)
+ HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL)
+#undef FEATURE_INITIALIZE_GLOBAL
}
@@ -1384,8 +1397,8 @@
Factory* factory = isolate->factory();
Handle<String> source_code;
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
- isolate, source_code, factory->NewStringFromAscii(
- ExperimentalNatives::GetRawScriptSource(index)),
+ isolate, source_code,
+ factory->NewStringFromAscii(ExperimentalNatives::GetScriptSource(index)),
false);
return CompileNative(isolate, name, source_code);
}
@@ -1503,12 +1516,6 @@
.ToHandleChecked(); \
native_context()->set_##var(Type::cast(*var##_native));
-#define INSTALL_NATIVE_MATH(name) \
- { \
- Handle<Object> fun = \
- ResolveBuiltinIdHolder(native_context(), "Math." #name); \
- native_context()->set_math_##name##_fun(JSFunction::cast(*fun)); \
- }
void Genesis::InstallNativeFunctions() {
HandleScope scope(isolate());
@@ -1521,6 +1528,7 @@
INSTALL_NATIVE(JSFunction, "ToInteger", to_integer_fun);
INSTALL_NATIVE(JSFunction, "ToUint32", to_uint32_fun);
INSTALL_NATIVE(JSFunction, "ToInt32", to_int32_fun);
+ INSTALL_NATIVE(JSFunction, "ToLength", to_length_fun);
INSTALL_NATIVE(JSFunction, "GlobalEval", global_eval_fun);
INSTALL_NATIVE(JSFunction, "Instantiate", instantiate_fun);
@@ -1551,30 +1559,7 @@
native_object_get_notifier);
INSTALL_NATIVE(JSFunction, "NativeObjectNotifierPerformChange",
native_object_notifier_perform_change);
-
- INSTALL_NATIVE(Symbol, "symbolIterator", iterator_symbol);
- INSTALL_NATIVE(Symbol, "symbolUnscopables", unscopables_symbol);
INSTALL_NATIVE(JSFunction, "ArrayValues", array_values_iterator);
-
- INSTALL_NATIVE_MATH(abs)
- INSTALL_NATIVE_MATH(acos)
- INSTALL_NATIVE_MATH(asin)
- INSTALL_NATIVE_MATH(atan)
- INSTALL_NATIVE_MATH(atan2)
- INSTALL_NATIVE_MATH(ceil)
- INSTALL_NATIVE_MATH(cos)
- INSTALL_NATIVE_MATH(exp)
- INSTALL_NATIVE_MATH(floor)
- INSTALL_NATIVE_MATH(imul)
- INSTALL_NATIVE_MATH(log)
- INSTALL_NATIVE_MATH(max)
- INSTALL_NATIVE_MATH(min)
- INSTALL_NATIVE_MATH(pow)
- INSTALL_NATIVE_MATH(random)
- INSTALL_NATIVE_MATH(round)
- INSTALL_NATIVE_MATH(sin)
- INSTALL_NATIVE_MATH(sqrt)
- INSTALL_NATIVE_MATH(tan)
}
@@ -1585,10 +1570,74 @@
INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap);
INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate);
}
+
+#define INSTALL_NATIVE_FUNCTIONS_FOR(id, descr) InstallNativeFunctions_##id();
+ HARMONY_INPROGRESS(INSTALL_NATIVE_FUNCTIONS_FOR)
+ HARMONY_STAGED(INSTALL_NATIVE_FUNCTIONS_FOR)
+ HARMONY_SHIPPING(INSTALL_NATIVE_FUNCTIONS_FOR)
+#undef INSTALL_NATIVE_FUNCTIONS_FOR
+}
+
+
+#define EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(id) \
+ void Genesis::InstallNativeFunctions_##id() {}
+
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_scoping)
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_modules)
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_strings)
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_arrays)
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_array_includes)
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_classes)
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_object_literals)
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_regexps)
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_arrow_functions)
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_numeric_literals)
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_tostring)
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_templates)
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sloppy)
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_unicode)
+
+
+void Genesis::InstallNativeFunctions_harmony_proxies() {
+ if (FLAG_harmony_proxies) {
+ INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap);
+ INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap);
+ INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap);
+ INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate);
+ }
}
#undef INSTALL_NATIVE
+#define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \
+ void Genesis::InitializeGlobal_##id() {}
+
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_scoping)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_modules)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_strings)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_arrays)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_array_includes)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_classes)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_literals)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_arrow_functions)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_numeric_literals)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tostring)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_proxies)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_templates)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_unicode)
+
+void Genesis::InitializeGlobal_harmony_regexps() {
+ Handle<JSObject> builtins(native_context()->builtins());
+
+ Handle<HeapObject> flag(FLAG_harmony_regexps ? heap()->true_value()
+ : heap()->false_value());
+ PropertyAttributes attributes =
+ static_cast<PropertyAttributes>(DONT_DELETE | READ_ONLY);
+ Runtime::DefineObjectProperty(builtins, factory()->harmony_regexps_string(),
+ flag, attributes).Assert();
+}
+
Handle<JSFunction> Genesis::InstallInternalArray(
Handle<JSBuiltinsObject> builtins,
@@ -1612,7 +1661,7 @@
array_function->shared()->DontAdaptArguments();
Handle<Map> original_map(array_function->initial_map());
- Handle<Map> initial_map = Map::Copy(original_map);
+ Handle<Map> initial_map = Map::Copy(original_map, "InternalArray");
initial_map->set_elements_kind(elements_kind);
JSFunction::SetInitialMap(array_function, initial_map, prototype);
@@ -1627,7 +1676,7 @@
{ // Add length.
CallbacksDescriptor d(
Handle<Name>(Name::cast(array_length->name())), array_length, attribs);
- array_function->initial_map()->AppendDescriptor(&d);
+ initial_map->AppendDescriptor(&d);
}
return array_function;
@@ -1657,7 +1706,6 @@
Handle<JSBuiltinsObject>::cast(factory()->NewGlobalObject(builtins_fun));
builtins->set_builtins(*builtins);
builtins->set_native_context(*native_context());
- builtins->set_global_context(*native_context());
builtins->set_global_proxy(native_context()->global_proxy());
@@ -1697,7 +1745,7 @@
isolate()->initial_object_prototype(), Builtins::kIllegal);
Handle<JSObject> prototype =
factory()->NewJSObject(isolate()->object_function(), TENURED);
- Accessors::FunctionSetPrototype(script_fun, prototype);
+ Accessors::FunctionSetPrototype(script_fun, prototype).Assert();
native_context()->set_script_function(*script_fun);
Handle<Map> script_map = Handle<Map>(script_fun->initial_map());
@@ -1839,7 +1887,7 @@
isolate()->initial_object_prototype(), Builtins::kIllegal);
Handle<JSObject> prototype =
factory()->NewJSObject(isolate()->object_function(), TENURED);
- Accessors::FunctionSetPrototype(opaque_reference_fun, prototype);
+ Accessors::FunctionSetPrototype(opaque_reference_fun, prototype).Assert();
native_context()->set_opaque_reference_function(*opaque_reference_fun);
}
@@ -1890,8 +1938,8 @@
// Create maps for generator functions and their prototypes. Store those
// maps in the native context.
Handle<Map> generator_function_map =
- Map::Copy(sloppy_function_map_writable_prototype_);
- generator_function_map->set_prototype(*generator_function_prototype);
+ Map::Copy(sloppy_function_map_writable_prototype_, "GeneratorFunction");
+ generator_function_map->SetPrototype(generator_function_prototype);
native_context()->set_sloppy_generator_function_map(
*generator_function_map);
@@ -1921,15 +1969,16 @@
rw_attribs, poison_pair);
Handle<Map> strict_function_map(native_context()->strict_function_map());
- Handle<Map> strict_generator_function_map = Map::Copy(strict_function_map);
+ Handle<Map> strict_generator_function_map =
+ Map::Copy(strict_function_map, "StrictGeneratorFunction");
// "arguments" and "caller" already poisoned.
- strict_generator_function_map->set_prototype(*generator_function_prototype);
+ strict_generator_function_map->SetPrototype(generator_function_prototype);
native_context()->set_strict_generator_function_map(
*strict_generator_function_map);
Handle<JSFunction> object_function(native_context()->object_function());
Handle<Map> generator_object_prototype_map = Map::Create(isolate(), 0);
- generator_object_prototype_map->set_prototype(*generator_object_prototype);
+ generator_object_prototype_map->SetPrototype(generator_object_prototype);
native_context()->set_generator_object_prototype_map(
*generator_object_prototype_map);
}
@@ -1939,6 +1988,17 @@
return true;
}
+ // Install public symbols.
+ {
+ static const PropertyAttributes attributes =
+ static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
+#define INSTALL_PUBLIC_SYMBOL(name, varname, description) \
+ Handle<String> varname = factory()->NewStringFromStaticChars(#varname); \
+ JSObject::AddProperty(builtins, varname, factory()->name(), attributes);
+ PUBLIC_SYMBOL_LIST(INSTALL_PUBLIC_SYMBOL)
+#undef INSTALL_PUBLIC_SYMBOL
+ }
+
// Install natives.
for (int i = Natives::GetDebuggerCount();
i < Natives::GetBuiltinsCount();
@@ -1979,8 +2039,10 @@
if (FLAG_vector_ics) {
// Apply embeds an IC, so we need a type vector of size 1 in the shared
// function info.
+ FeedbackVectorSpec spec(0, 1);
+ spec.SetKind(0, Code::CALL_IC);
Handle<TypeFeedbackVector> feedback_vector =
- factory()->NewTypeFeedbackVector(1);
+ factory()->NewTypeFeedbackVector(spec);
apply->shared()->set_feedback_vector(*feedback_vector);
}
@@ -2017,7 +2079,7 @@
// Set prototype on map.
initial_map->set_non_instance_prototype(false);
- initial_map->set_prototype(*array_prototype);
+ initial_map->SetPrototype(array_prototype);
// Update map with length accessor from Array and add "index" and "input".
Map::EnsureDescriptorSlack(initial_map, 3);
@@ -2065,22 +2127,22 @@
Handle<AccessorInfo> arguments_iterator =
Accessors::ArgumentsIteratorInfo(isolate(), attribs);
{
- CallbacksDescriptor d(Handle<Name>(native_context()->iterator_symbol()),
- arguments_iterator, attribs);
+ CallbacksDescriptor d(factory()->iterator_symbol(), arguments_iterator,
+ attribs);
Handle<Map> map(native_context()->sloppy_arguments_map());
Map::EnsureDescriptorSlack(map, 1);
map->AppendDescriptor(&d);
}
{
- CallbacksDescriptor d(Handle<Name>(native_context()->iterator_symbol()),
- arguments_iterator, attribs);
+ CallbacksDescriptor d(factory()->iterator_symbol(), arguments_iterator,
+ attribs);
Handle<Map> map(native_context()->aliased_arguments_map());
Map::EnsureDescriptorSlack(map, 1);
map->AppendDescriptor(&d);
}
{
- CallbacksDescriptor d(Handle<Name>(native_context()->iterator_symbol()),
- arguments_iterator, attribs);
+ CallbacksDescriptor d(factory()->iterator_symbol(), arguments_iterator,
+ attribs);
Handle<Map> map(native_context()->strict_arguments_map());
Map::EnsureDescriptorSlack(map, 1);
map->AppendDescriptor(&d);
@@ -2095,22 +2157,46 @@
}
-#define INSTALL_EXPERIMENTAL_NATIVE(i, flag, file) \
- if (FLAG_harmony_##flag && \
- strcmp(ExperimentalNatives::GetScriptName(i).start(), \
- "native " file) == 0) { \
- if (!CompileExperimentalBuiltin(isolate(), i)) return false; \
- }
-
-
bool Genesis::InstallExperimentalNatives() {
+ static const char* harmony_arrays_natives[] = {
+ "native harmony-array.js", "native harmony-typedarray.js", NULL};
+ static const char* harmony_array_includes_natives[] = {
+ "native harmony-array-includes.js", NULL};
+ static const char* harmony_proxies_natives[] = {"native proxy.js", NULL};
+ static const char* harmony_strings_natives[] = {"native harmony-string.js",
+ NULL};
+ static const char* harmony_classes_natives[] = {"native harmony-classes.js",
+ NULL};
+ static const char* harmony_modules_natives[] = {NULL};
+ static const char* harmony_scoping_natives[] = {NULL};
+ static const char* harmony_object_literals_natives[] = {NULL};
+ static const char* harmony_regexps_natives[] = {
+ "native harmony-regexp.js", NULL};
+ static const char* harmony_arrow_functions_natives[] = {NULL};
+ static const char* harmony_numeric_literals_natives[] = {NULL};
+ static const char* harmony_tostring_natives[] = {"native harmony-tostring.js",
+ NULL};
+ static const char* harmony_templates_natives[] = {
+ "native harmony-templates.js", NULL};
+ static const char* harmony_sloppy_natives[] = {NULL};
+ static const char* harmony_unicode_natives[] = {NULL};
+
for (int i = ExperimentalNatives::GetDebuggerCount();
- i < ExperimentalNatives::GetBuiltinsCount();
- i++) {
- INSTALL_EXPERIMENTAL_NATIVE(i, proxies, "proxy.js")
- INSTALL_EXPERIMENTAL_NATIVE(i, strings, "harmony-string.js")
- INSTALL_EXPERIMENTAL_NATIVE(i, arrays, "harmony-array.js")
- INSTALL_EXPERIMENTAL_NATIVE(i, classes, "harmony-classes.js")
+ i < ExperimentalNatives::GetBuiltinsCount(); i++) {
+#define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \
+ if (FLAG_##id) { \
+ for (size_t j = 0; id##_natives[j] != NULL; j++) { \
+ Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \
+ if (strncmp(script_name.start(), id##_natives[j], \
+ script_name.length()) == 0) { \
+ if (!CompileExperimentalBuiltin(isolate(), i)) return false; \
+ } \
+ } \
+ }
+ HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES);
+ HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES);
+ HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES);
+#undef INSTALL_EXPERIMENTAL_NATIVES
}
InstallExperimentalNativeFunctions();
@@ -2495,6 +2581,8 @@
JSObject::AddProperty(to, key, constant, details.attributes());
break;
}
+ case ACCESSOR_FIELD:
+ UNREACHABLE();
case CALLBACKS: {
Handle<Name> key(descs->GetKey(i));
LookupIterator it(to, key, LookupIterator::OWN_SKIP_INTERCEPTOR);
@@ -2505,15 +2593,10 @@
DCHECK(!to->HasFastProperties());
// Add to dictionary.
Handle<Object> callbacks(descs->GetCallbacksObject(i), isolate());
- PropertyDetails d = PropertyDetails(
- details.attributes(), CALLBACKS, i + 1);
+ PropertyDetails d(details.attributes(), CALLBACKS, i + 1);
JSObject::SetNormalizedProperty(to, key, callbacks, d);
break;
}
- // Do not occur since the from object has fast properties.
- case NORMAL:
- UNREACHABLE();
- break;
}
}
} else {
@@ -2538,6 +2621,7 @@
isolate());
}
PropertyDetails details = properties->DetailsAt(i);
+ DCHECK_EQ(DATA, details.kind());
JSObject::AddProperty(to, key, value, details.attributes());
}
}
@@ -2588,20 +2672,24 @@
class NoTrackDoubleFieldsForSerializerScope {
public:
explicit NoTrackDoubleFieldsForSerializerScope(Isolate* isolate)
- : flag_(FLAG_track_double_fields) {
+ : flag_(FLAG_track_double_fields), enabled_(false) {
if (isolate->serializer_enabled()) {
// Disable tracking double fields because heap numbers treated as
// immutable by the serializer.
FLAG_track_double_fields = false;
+ enabled_ = true;
}
}
~NoTrackDoubleFieldsForSerializerScope() {
- FLAG_track_double_fields = flag_;
+ if (enabled_) {
+ FLAG_track_double_fields = flag_;
+ }
}
private:
bool flag_;
+ bool enabled_;
};
@@ -2635,6 +2723,15 @@
AddToWeakNativeContextList(*native_context());
isolate->set_context(*native_context());
isolate->counters()->contexts_created_by_snapshot()->Increment();
+#if TRACE_MAPS
+ if (FLAG_trace_maps) {
+ Handle<JSFunction> object_fun = isolate->object_function();
+ PrintF("[TraceMap: InitialMap map= %p SFI= %d_Object ]\n",
+ reinterpret_cast<void*>(object_fun->initial_map()),
+ object_fun->shared()->unique_id());
+ Map::TraceAllTransitions(object_fun->initial_map());
+ }
+#endif
Handle<GlobalObject> global_object;
Handle<JSGlobalProxy> global_proxy = CreateNewGlobals(
global_proxy_template, maybe_global_proxy, &global_object);