Commit 400fe069 authored by peterwmwong's avatar peterwmwong Committed by Commit Bot

[js] Remove Experimental Extras JS Natives

- Removes build step and bootstrapping associated with building/loading `EXPERIMENTAL_EXTRAS` JS natives.
- Removes `--experimental-extras` flag

Bug: v8:7624
Change-Id: I4c45fe70da42847545037d63e9f1da77f5957f8b
Reviewed-on: https://chromium-review.googlesource.com/c/1397906Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Peter Wong <peter.wm.wong@gmail.com>
Cr-Commit-Position: refs/heads/master@{#58590}
parent 426312c8
......@@ -149,12 +149,6 @@ declare_args() {
# This default is used by cctests. Projects using V8 will want to override.
v8_extra_library_files = [ "//test/cctest/test-extra.js" ]
# Like v8_extra_library_files but for experimental features.
#
# This default is used by cctests. Projects using V8 will want to override.
v8_experimental_extra_library_files =
[ "//test/cctest/test-experimental-extra.js" ]
v8_enable_gdbjit =
((v8_current_cpu == "x86" || v8_current_cpu == "x64") &&
(is_linux || is_mac)) || (v8_current_cpu == "ppc64" && is_linux)
......@@ -736,33 +730,6 @@ action("js2c_extras") {
}
}
action("js2c_experimental_extras") {
visibility = [ ":*" ] # Only targets in this file can depend on this.
script = "tools/js2c.py"
sources = v8_experimental_extra_library_files
outputs = [
"$target_gen_dir/experimental-extras-libraries.cc",
]
args = [
rebase_path("$target_gen_dir/experimental-extras-libraries.cc",
root_build_dir),
"EXPERIMENTAL_EXTRAS",
] + rebase_path(sources, root_build_dir)
if (v8_use_external_startup_data) {
outputs += [ "$target_gen_dir/libraries_experimental_extras.bin" ]
args += [
"--startup_blob",
rebase_path("$target_gen_dir/libraries_experimental_extras.bin",
root_build_dir),
]
}
}
action("d8_js2c") {
visibility = [ ":*" ] # Only targets in this file can depend on this.
......@@ -810,14 +777,12 @@ if (v8_use_external_startup_data) {
visibility = [ ":*" ] # Only targets in this file can depend on this.
deps = [
":js2c_experimental_extras",
":js2c_extras",
]
# NOSORT
sources = [
"$target_gen_dir/libraries_extras.bin",
"$target_gen_dir/libraries_experimental_extras.bin",
]
outputs = [
......@@ -1222,26 +1187,16 @@ v8_source_set("v8_nosnapshot") {
visibility = [ ":*" ] # Only targets in this file can depend on this.
deps = [
":js2c_experimental_extras",
":js2c_extras",
":v8_base",
]
sources = [
"$target_gen_dir/experimental-extras-libraries.cc",
"$target_gen_dir/extras-libraries.cc",
"src/snapshot/embedded-empty.cc",
"src/snapshot/snapshot-empty.cc",
]
if (use_jumbo_build == true) {
jumbo_excluded_sources = [
# TODO(mostynb@vewd.com): don't exclude these http://crbug.com/752428
# Generated source, contains same variable names as libraries.cc
"$target_gen_dir/experimental-extras-libraries.cc",
]
}
configs = [ ":internal_config" ]
}
......@@ -1255,7 +1210,6 @@ if (v8_use_snapshot && !v8_use_external_startup_data) {
]
deps = [
":js2c_experimental_extras",
":js2c_extras",
":v8_base",
]
......@@ -1269,7 +1223,6 @@ if (v8_use_snapshot && !v8_use_external_startup_data) {
public = []
sources = [
"$target_gen_dir/experimental-extras-libraries.cc",
"$target_gen_dir/extras-libraries.cc",
"$target_gen_dir/snapshot.cc",
"src/setup-isolate-deserialize.cc",
......@@ -1284,14 +1237,6 @@ if (v8_use_snapshot && !v8_use_external_startup_data) {
sources += [ "src/snapshot/embedded-empty.cc" ]
}
if (use_jumbo_build == true) {
jumbo_excluded_sources = [
# TODO(mostynb@vewd.com): don't exclude these http://crbug.com/752428
# Generated source, contains same variable names as libraries.cc
"$target_gen_dir/experimental-extras-libraries.cc",
]
}
configs = [ ":internal_config" ]
}
}
......@@ -1301,7 +1246,6 @@ if (v8_use_snapshot && v8_use_external_startup_data) {
visibility = [ ":*" ] # Only targets in this file can depend on this.
deps = [
":js2c_experimental_extras",
":js2c_extras",
":v8_base",
]
......@@ -4148,7 +4092,6 @@ group("v8_generated_cc_files") {
deps = [
":d8_js2c",
":generate_bytecode_builtins_list",
":js2c_experimental_extras",
":js2c_extras",
":run_torque",
"src/inspector:v8_generated_cc_files",
......
......@@ -255,9 +255,7 @@ class Genesis {
Handle<JSFunction> InstallTypedArray(const char* name,
ElementsKind elements_kind);
bool InstallExtraNatives();
bool InstallExperimentalExtraNatives();
void InstallBuiltinFunctionIds();
void InstallExperimentalBuiltinFunctionIds();
void InitializeNormalizedMapCaches();
enum ExtensionTraversalState {
......@@ -3829,20 +3827,6 @@ bool Bootstrapper::CompileExtraBuiltin(Isolate* isolate, int index) {
}
bool Bootstrapper::CompileExperimentalExtraBuiltin(Isolate* isolate,
int index) {
HandleScope scope(isolate);
Vector<const char> name = ExperimentalExtraNatives::GetScriptName(index);
Handle<String> source_code =
isolate->bootstrapper()->GetNativeSource(EXPERIMENTAL_EXTRAS, index);
Handle<Object> global = isolate->global_object();
Handle<Object> binding = isolate->extras_binding_object();
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, EXTENSION_CODE);
}
bool Bootstrapper::CompileNative(Isolate* isolate, Vector<const char> name,
Handle<String> source, int argc,
Handle<Object> argv[],
......@@ -5192,16 +5176,6 @@ bool Genesis::InstallExtraNatives() {
}
bool Genesis::InstallExperimentalExtraNatives() {
for (int i = 0; i < ExperimentalExtraNatives::GetBuiltinsCount(); i++) {
if (!Bootstrapper::CompileExperimentalExtraBuiltin(isolate(), i))
return false;
}
return true;
}
static void InstallBuiltinFunctionId(Isolate* isolate, Handle<JSObject> holder,
const char* function_name,
BuiltinFunctionId id) {
......@@ -5707,10 +5681,6 @@ Genesis::Genesis(
if (!isolate->serializer_enabled()) {
InitializeExperimentalGlobal();
if (FLAG_experimental_extras) {
if (!InstallExperimentalExtraNatives()) return;
}
// Store String.prototype's map again in case it has been changed by
// experimental natives.
Handle<JSFunction> string_function(native_context()->string_function(),
......
......@@ -177,9 +177,6 @@ struct MaybeBoolFlag {
//
#define FLAG FLAG_FULL
DEFINE_BOOL(experimental_extras, false,
"enable code compiled in via v8_experimental_extra_library_files")
// Flags for language modes and experimental language features.
DEFINE_BOOL(use_strict, false, "enforce strict mode")
......
......@@ -16,18 +16,9 @@ NativesExternalStringResource::NativesExternalStringResource(NativeType type,
: type_(type), index_(index) {
Vector<const char> source;
DCHECK_LE(0, index);
switch (type_) {
case EXTRAS:
DCHECK(index < ExtraNatives::GetBuiltinsCount());
source = ExtraNatives::GetScriptSource(index);
break;
case EXPERIMENTAL_EXTRAS:
DCHECK(index < ExperimentalExtraNatives::GetBuiltinsCount());
source = ExperimentalExtraNatives::GetScriptSource(index);
break;
default:
UNREACHABLE();
}
CHECK_EQ(EXTRAS, type_);
DCHECK(index < ExtraNatives::GetBuiltinsCount());
source = ExtraNatives::GetScriptSource(index);
data_ = source.start();
length_ = source.length();
}
......
......@@ -136,8 +136,6 @@ void ReadNatives() {
if (natives_blob_ && NativesHolder<EXTRAS>::empty()) {
SnapshotByteSource bytes(natives_blob_->data, natives_blob_->raw_size);
NativesHolder<EXTRAS>::set(NativesStore::MakeFromScriptsSource(&bytes));
NativesHolder<EXPERIMENTAL_EXTRAS>::set(
NativesStore::MakeFromScriptsSource(&bytes));
DCHECK(!bytes.HasMore());
}
}
......@@ -163,7 +161,6 @@ void SetNativesFromFile(StartupData* natives_blob) {
*/
void DisposeNatives() {
NativesHolder<EXTRAS>::Dispose();
NativesHolder<EXPERIMENTAL_EXTRAS>::Dispose();
}
......@@ -207,7 +204,6 @@ Vector<const char> NativesCollection<type>::GetScriptsSource() {
template Vector<const char> NativesCollection<T>::GetScriptName(int i); \
template Vector<const char> NativesCollection<T>::GetScriptsSource();
INSTANTIATE_TEMPLATES(EXTRAS)
INSTANTIATE_TEMPLATES(EXPERIMENTAL_EXTRAS)
#undef INSTANTIATE_TEMPLATES
} // namespace internal
......
......@@ -16,7 +16,6 @@ namespace internal {
enum NativeType {
EXTRAS,
EXPERIMENTAL_EXTRAS,
D8,
TEST
};
......@@ -42,7 +41,6 @@ class V8_EXPORT_PRIVATE NativesCollection {
};
typedef NativesCollection<EXTRAS> ExtraNatives;
typedef NativesCollection<EXPERIMENTAL_EXTRAS> ExperimentalExtraNatives;
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
......
......@@ -26527,42 +26527,6 @@ TEST(ExtrasBindingObject) {
}
TEST(ExperimentalExtras) {
i::FLAG_experimental_extras = true;
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope handle_scope(isolate);
LocalContext env;
// standalone.gypi ensures we include the test-experimental-extra.js file,
// which should export the tested functions.
v8::Local<v8::Object> binding = env->GetExtrasBindingObject();
auto func =
binding->Get(env.local(), v8_str("testExperimentalExtraShouldReturnTen"))
.ToLocalChecked()
.As<v8::Function>();
auto undefined = v8::Undefined(isolate);
auto result = func->Call(env.local(), undefined, 0, {})
.ToLocalChecked()
.As<v8::Number>();
CHECK_EQ(10, result->Int32Value(env.local()).FromJust());
v8::Local<v8::FunctionTemplate> runtimeFunction =
v8::FunctionTemplate::New(isolate, ExtrasBindingTestRuntimeFunction);
binding->Set(env.local(), v8_str("runtime"),
runtimeFunction->GetFunction(env.local()).ToLocalChecked())
.FromJust();
func = binding->Get(env.local(),
v8_str("testExperimentalExtraShouldCallToRuntime"))
.ToLocalChecked()
.As<v8::Function>();
result = func->Call(env.local(), undefined, 0, {})
.ToLocalChecked()
.As<v8::Number>();
CHECK_EQ(7, result->Int32Value(env.local()).FromJust());
}
TEST(ExtrasCreatePromise) {
i::FLAG_allow_natives_syntax = true;
LocalContext context;
......
// 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, binding) {
'use strict';
binding.testExperimentalExtraShouldReturnTen = function () {
return 10;
};
binding.testExperimentalExtraShouldCallToRuntime = function() {
return binding.runtime(3);
};
})
......@@ -393,7 +393,7 @@ def PrepareSources(source_files, native_type, emit_js):
message_template_file = message_template_files[0]
filters = None
if native_type in ("EXTRAS", "EXPERIMENTAL_EXTRAS"):
if native_type in ("EXTRAS"):
filters = BuildExtraFilterChain()
else:
filters = BuildFilterChain(macro_file, message_template_file)
......
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