Expose string/regexp related public symbols on harmony flag.
R=littledan@chromium.org BUG=v8:4305, v8:4343, v8:4344, v8:4345 LOG=N Review URL: https://codereview.chromium.org/1408223004 Cr-Commit-Position: refs/heads/master@{#31702}
This commit is contained in:
parent
4490ce8520
commit
f8a43459d4
2
BUILD.gn
2
BUILD.gn
@ -309,8 +309,6 @@ action("js2c_experimental") {
|
||||
"src/js/generator.js",
|
||||
"src/js/harmony-atomics.js",
|
||||
"src/js/harmony-array-includes.js",
|
||||
"src/js/harmony-concat-spreadable.js",
|
||||
"src/js/harmony-tostring.js",
|
||||
"src/js/harmony-regexp.js",
|
||||
"src/js/harmony-reflect.js",
|
||||
"src/js/harmony-object-observe.js",
|
||||
|
@ -2157,10 +2157,8 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_rest_parameters)
|
||||
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_default_parameters)
|
||||
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_destructuring)
|
||||
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_observe)
|
||||
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_concat_spreadable)
|
||||
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexps)
|
||||
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_unicode_regexps)
|
||||
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tostring)
|
||||
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_completion)
|
||||
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tolength)
|
||||
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions)
|
||||
@ -2180,6 +2178,47 @@ static void SimpleInstallFunction(Handle<JSObject>& base, const char* name,
|
||||
}
|
||||
|
||||
|
||||
void InstallPublicSymbol(Factory* factory, Handle<Context> native_context,
|
||||
const char* name, Handle<Symbol> value) {
|
||||
Handle<JSGlobalObject> global(
|
||||
JSGlobalObject::cast(native_context->global_object()));
|
||||
Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol");
|
||||
Handle<JSObject> symbol = Handle<JSObject>::cast(
|
||||
JSObject::GetProperty(global, symbol_string).ToHandleChecked());
|
||||
Handle<String> name_string = factory->InternalizeUtf8String(name);
|
||||
PropertyAttributes attributes =
|
||||
static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
|
||||
JSObject::AddProperty(symbol, name_string, value, attributes);
|
||||
}
|
||||
|
||||
|
||||
void Genesis::InitializeGlobal_harmony_tostring() {
|
||||
if (!FLAG_harmony_tostring) return;
|
||||
InstallPublicSymbol(factory(), native_context(), "toStringTag",
|
||||
factory()->to_string_tag_symbol());
|
||||
}
|
||||
|
||||
|
||||
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",
|
||||
factory()->match_symbol());
|
||||
InstallPublicSymbol(factory(), native_context(), "replace",
|
||||
factory()->replace_symbol());
|
||||
InstallPublicSymbol(factory(), native_context(), "search",
|
||||
factory()->search_symbol());
|
||||
InstallPublicSymbol(factory(), native_context(), "split",
|
||||
factory()->split_symbol());
|
||||
}
|
||||
|
||||
|
||||
void Genesis::InitializeGlobal_harmony_reflect() {
|
||||
if (!FLAG_harmony_reflect) return;
|
||||
|
||||
@ -2622,8 +2661,7 @@ bool Genesis::InstallExperimentalNatives() {
|
||||
static const char* harmony_modules_natives[] = {nullptr};
|
||||
static const char* harmony_regexps_natives[] = {"native harmony-regexp.js",
|
||||
nullptr};
|
||||
static const char* harmony_tostring_natives[] = {"native harmony-tostring.js",
|
||||
nullptr};
|
||||
static const char* harmony_tostring_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};
|
||||
@ -2637,13 +2675,13 @@ bool Genesis::InstallExperimentalNatives() {
|
||||
"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[] = {
|
||||
"native harmony-concat-spreadable.js", nullptr};
|
||||
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};
|
||||
|
||||
for (int i = ExperimentalNatives::GetDebuggerCount();
|
||||
i < ExperimentalNatives::GetBuiltinsCount(); i++) {
|
||||
|
@ -200,7 +200,8 @@ DEFINE_NEG_IMPLICATION(es_staging, legacy_const)
|
||||
V(harmony_default_parameters, "harmony default parameters") \
|
||||
V(harmony_sharedarraybuffer, "harmony sharedarraybuffer") \
|
||||
V(harmony_simd, "harmony simd") \
|
||||
V(harmony_do_expressions, "harmony do-expressions")
|
||||
V(harmony_do_expressions, "harmony do-expressions") \
|
||||
V(harmony_regexp_subclass, "harmony regexp subclassing")
|
||||
|
||||
// Features that are complete (but still behind --harmony/es-staging flag).
|
||||
#define HARMONY_STAGED(V) \
|
||||
|
@ -1,19 +0,0 @@
|
||||
// Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
(function(global, utils) {
|
||||
|
||||
'use strict';
|
||||
|
||||
%CheckIsBootstrapping();
|
||||
|
||||
var isConcatSpreadableSymbol =
|
||||
utils.ImportNow("is_concat_spreadable_symbol");
|
||||
|
||||
utils.InstallConstants(global.Symbol, [
|
||||
// TODO(littledan): Move to symbol.js when shipping
|
||||
"isConcatSpreadable", isConcatSpreadableSymbol
|
||||
]);
|
||||
|
||||
})
|
@ -1,19 +0,0 @@
|
||||
// Copyright 2013 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
(function(global, utils) {
|
||||
|
||||
"use strict";
|
||||
|
||||
%CheckIsBootstrapping();
|
||||
|
||||
var GlobalSymbol = global.Symbol;
|
||||
var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
|
||||
|
||||
utils.InstallConstants(GlobalSymbol, [
|
||||
// TODO(dslomov, caitp): Move to symbol.js when shipping
|
||||
"toStringTag", toStringTagSymbol
|
||||
]);
|
||||
|
||||
})
|
@ -19,11 +19,7 @@ var isConcatSpreadableSymbol =
|
||||
var isRegExpSymbol = utils.ImportNow("is_regexp_symbol");
|
||||
var iteratorSymbol = utils.ImportNow("iterator_symbol");
|
||||
var MakeTypeError;
|
||||
var matchSymbol = utils.ImportNow("match_symbol");
|
||||
var ObjectGetOwnPropertyKeys;
|
||||
var replaceSymbol = utils.ImportNow("replace_symbol");
|
||||
var searchSymbol = utils.ImportNow("search_symbol");
|
||||
var splitSymbol = utils.ImportNow("split_symbol");
|
||||
var toPrimitiveSymbol = utils.ImportNow("to_primitive_symbol");
|
||||
var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
|
||||
var unscopablesSymbol = utils.ImportNow("unscopables_symbol");
|
||||
|
@ -1864,8 +1864,6 @@
|
||||
'../../src/js/generator.js',
|
||||
'../../src/js/harmony-atomics.js',
|
||||
'../../src/js/harmony-array-includes.js',
|
||||
'../../src/js/harmony-concat-spreadable.js',
|
||||
'../../src/js/harmony-tostring.js',
|
||||
'../../src/js/harmony-regexp.js',
|
||||
'../../src/js/harmony-reflect.js',
|
||||
'../../src/js/harmony-object-observe.js',
|
||||
|
Loading…
Reference in New Issue
Block a user