Commit ed50458e authored by Shu-yu Guo's avatar Shu-yu Guo Committed by Commit Bot

Revert "Reland "[d8] Add d8 global variable""

This reverts commit 120eb388.

Reason for revert: Maybe perturbed GC and caused optimization test to fail: https://ci.chromium.org/p/v8/builders/ci/V8%20Linux64%20GC%20Stress%20-%20custom%20snapshot/33042?

Original change's description:
> Reland "[d8] Add d8 global variable"
> 
> This is a reland of 6798619a
> 
> Original change's description:
> > [d8] Add d8 global variable
> >
> > - Add a a "d8" global variable where d8 can provide helpers.
> >   This in in preparation of adding d8.log for testing our log parsers
> >   written in JavaScript.
> >
> > - Separate d8 helper creation into individual functions.
> >
> > Bug: v8:1064
> > Change-Id: I84e434452463afb93ae403f890d8841b20b00703
> > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2400990
> > Reviewed-by: Toon Verwaest <verwaest@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#69801}
> 
> TBR=verwaest@chromium.org
> 
> Bug: v8:1064
> Change-Id: I656d550b5ec87dc52dbe6cbbdddf7151ce25031f
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2403247
> Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> Reviewed-by: Mythri Alle <mythria@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#69819}

TBR=cbruni@chromium.org,mythria@chromium.org,verwaest@chromium.org

Change-Id: If6df69e30b097c78eb0ff2676f5e5c219edfae5b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:1064
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2404323Reviewed-by: 's avatarShu-yu Guo <syg@chromium.org>
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69823}
parent 7ce5dd6e
......@@ -2071,11 +2071,6 @@ Local<String> Shell::Stringify(Isolate* isolate, Local<Value> value) {
Local<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) {
Local<ObjectTemplate> global_template = ObjectTemplate::New(isolate);
global_template->Set(Symbol::GetToStringTag(isolate),
String::NewFromUtf8Literal(isolate, "global"));
global_template->Set(isolate, "version",
FunctionTemplate::New(isolate, Version));
global_template->Set(isolate, "print", FunctionTemplate::New(isolate, Print));
global_template->Set(isolate, "printErr",
FunctionTemplate::New(isolate, PrintErr));
......@@ -2094,37 +2089,57 @@ Local<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) {
if (!options.omit_quit) {
global_template->Set(isolate, "quit", FunctionTemplate::New(isolate, Quit));
}
global_template->Set(isolate, "testRunner",
Shell::CreateTestRunnerTemplate(isolate));
global_template->Set(isolate, "Realm", Shell::CreateRealmTemplate(isolate));
global_template->Set(isolate, "performance",
Shell::CreatePerformanceTemplate(isolate));
global_template->Set(isolate, "Worker", Shell::CreateWorkerTemplate(isolate));
global_template->Set(isolate, "os", Shell::CreateOSTemplate(isolate));
global_template->Set(isolate, "d8", Shell::CreateD8Template(isolate));
#ifdef V8_FUZZILLI
global_template->Set(
String::NewFromUtf8(isolate, "fuzzilli", NewStringType::kNormal)
.ToLocalChecked(),
FunctionTemplate::New(isolate, Fuzzilli), PropertyAttribute::DontEnum);
#endif // V8_FUZZILLI
Local<ObjectTemplate> test_template = ObjectTemplate::New(isolate);
global_template->Set(isolate, "testRunner", test_template);
test_template->Set(isolate, "notifyDone",
FunctionTemplate::New(isolate, NotifyDone));
test_template->Set(isolate, "waitUntilDone",
FunctionTemplate::New(isolate, WaitUntilDone));
// Reliable access to quit functionality. The "quit" method function
// installed on the global object can be hidden with the --omit-quit flag
// (e.g. on asan bots).
test_template->Set(isolate, "quit", FunctionTemplate::New(isolate, Quit));
if (i::FLAG_expose_async_hooks) {
global_template->Set(isolate, "async_hooks",
Shell::CreateAsyncHookTemplate(isolate));
}
global_template->Set(isolate, "version",
FunctionTemplate::New(isolate, Version));
global_template->Set(Symbol::GetToStringTag(isolate),
String::NewFromUtf8Literal(isolate, "global"));
return global_template;
}
// Bind the Realm object.
Local<ObjectTemplate> realm_template = ObjectTemplate::New(isolate);
realm_template->Set(isolate, "current",
FunctionTemplate::New(isolate, RealmCurrent));
realm_template->Set(isolate, "owner",
FunctionTemplate::New(isolate, RealmOwner));
realm_template->Set(isolate, "global",
FunctionTemplate::New(isolate, RealmGlobal));
realm_template->Set(isolate, "create",
FunctionTemplate::New(isolate, RealmCreate));
realm_template->Set(
isolate, "createAllowCrossRealmAccess",
FunctionTemplate::New(isolate, RealmCreateAllowCrossRealmAccess));
realm_template->Set(isolate, "navigate",
FunctionTemplate::New(isolate, RealmNavigate));
realm_template->Set(isolate, "detachGlobal",
FunctionTemplate::New(isolate, RealmDetachGlobal));
realm_template->Set(isolate, "dispose",
FunctionTemplate::New(isolate, RealmDispose));
realm_template->Set(isolate, "switch",
FunctionTemplate::New(isolate, RealmSwitch));
realm_template->Set(isolate, "eval",
FunctionTemplate::New(isolate, RealmEval));
realm_template->SetAccessor(String::NewFromUtf8Literal(isolate, "shared"),
RealmSharedGet, RealmSharedSet);
global_template->Set(isolate, "Realm", realm_template);
Local<ObjectTemplate> Shell::CreateOSTemplate(Isolate* isolate) {
Local<ObjectTemplate> os_template = ObjectTemplate::New(isolate);
AddOSMethods(isolate, os_template);
return os_template;
}
Local<ObjectTemplate> performance_template = ObjectTemplate::New(isolate);
performance_template->Set(isolate, "now",
FunctionTemplate::New(isolate, PerformanceNow));
performance_template->Set(
isolate, "measureMemory",
FunctionTemplate::New(isolate, PerformanceMeasureMemory));
global_template->Set(isolate, "performance", performance_template);
Local<FunctionTemplate> Shell::CreateWorkerTemplate(Isolate* isolate) {
Local<FunctionTemplate> worker_fun_template =
FunctionTemplate::New(isolate, WorkerNew);
Local<Signature> worker_signature =
......@@ -2149,12 +2164,23 @@ Local<FunctionTemplate> Shell::CreateWorkerTemplate(Isolate* isolate) {
FunctionTemplate::New(isolate, WorkerGetMessage, Local<Value>(),
worker_signature));
worker_fun_template->InstanceTemplate()->SetInternalFieldCount(1);
return worker_fun_template;
}
global_template->Set(isolate, "Worker", worker_fun_template);
Local<ObjectTemplate> os_templ = ObjectTemplate::New(isolate);
AddOSMethods(isolate, os_templ);
global_template->Set(isolate, "os", os_templ);
Local<ObjectTemplate> Shell::CreateAsyncHookTemplate(Isolate* isolate) {
#ifdef V8_FUZZILLI
global_template->Set(
String::NewFromUtf8(isolate, "fuzzilli", NewStringType::kNormal)
.ToLocalChecked(),
FunctionTemplate::New(isolate, Fuzzilli), PropertyAttribute::DontEnum);
#endif // V8_FUZZILLI
if (i::FLAG_expose_async_hooks) {
Local<ObjectTemplate> async_hooks_templ = ObjectTemplate::New(isolate);
async_hooks_templ->Set(isolate, "createHook",
async_hooks_templ->Set(
isolate, "createHook",
FunctionTemplate::New(isolate, AsyncHooksCreateHook));
async_hooks_templ->Set(
isolate, "executionAsyncId",
......@@ -2162,63 +2188,10 @@ Local<ObjectTemplate> Shell::CreateAsyncHookTemplate(Isolate* isolate) {
async_hooks_templ->Set(
isolate, "triggerAsyncId",
FunctionTemplate::New(isolate, AsyncHooksTriggerAsyncId));
return async_hooks_templ;
}
Local<ObjectTemplate> Shell::CreateTestRunnerTemplate(Isolate* isolate) {
Local<ObjectTemplate> test_template = ObjectTemplate::New(isolate);
test_template->Set(isolate, "notifyDone",
FunctionTemplate::New(isolate, NotifyDone));
test_template->Set(isolate, "waitUntilDone",
FunctionTemplate::New(isolate, WaitUntilDone));
// Reliable access to quit functionality. The "quit" method function
// installed on the global object can be hidden with the --omit-quit flag
// (e.g. on asan bots).
test_template->Set(isolate, "quit", FunctionTemplate::New(isolate, Quit));
return test_template;
}
Local<ObjectTemplate> Shell::CreatePerformanceTemplate(Isolate* isolate) {
Local<ObjectTemplate> performance_template = ObjectTemplate::New(isolate);
performance_template->Set(isolate, "now",
FunctionTemplate::New(isolate, PerformanceNow));
performance_template->Set(
isolate, "measureMemory",
FunctionTemplate::New(isolate, PerformanceMeasureMemory));
return performance_template;
}
Local<ObjectTemplate> Shell::CreateRealmTemplate(Isolate* isolate) {
Local<ObjectTemplate> realm_template = ObjectTemplate::New(isolate);
realm_template->Set(isolate, "current",
FunctionTemplate::New(isolate, RealmCurrent));
realm_template->Set(isolate, "owner",
FunctionTemplate::New(isolate, RealmOwner));
realm_template->Set(isolate, "global",
FunctionTemplate::New(isolate, RealmGlobal));
realm_template->Set(isolate, "create",
FunctionTemplate::New(isolate, RealmCreate));
realm_template->Set(
isolate, "createAllowCrossRealmAccess",
FunctionTemplate::New(isolate, RealmCreateAllowCrossRealmAccess));
realm_template->Set(isolate, "navigate",
FunctionTemplate::New(isolate, RealmNavigate));
realm_template->Set(isolate, "detachGlobal",
FunctionTemplate::New(isolate, RealmDetachGlobal));
realm_template->Set(isolate, "dispose",
FunctionTemplate::New(isolate, RealmDispose));
realm_template->Set(isolate, "switch",
FunctionTemplate::New(isolate, RealmSwitch));
realm_template->Set(isolate, "eval",
FunctionTemplate::New(isolate, RealmEval));
realm_template->SetAccessor(String::NewFromUtf8Literal(isolate, "shared"),
RealmSharedGet, RealmSharedSet);
return realm_template;
}
global_template->Set(isolate, "async_hooks", async_hooks_templ);
}
Local<ObjectTemplate> Shell::CreateD8Template(Isolate* isolate) {
Local<ObjectTemplate> d8_template = ObjectTemplate::New(isolate);
return d8_template;
return global_template;
}
static void PrintMessageCallback(Local<Message> message, Local<Value> error) {
......
......@@ -539,16 +539,7 @@ class Shell : public i::AllStatic {
static Local<String> Stringify(Isolate* isolate, Local<Value> value);
static void RunShell(Isolate* isolate);
static bool SetOptions(int argc, char* argv[]);
static Local<ObjectTemplate> CreateGlobalTemplate(Isolate* isolate);
static Local<ObjectTemplate> CreateOSTemplate(Isolate* isolate);
static Local<FunctionTemplate> CreateWorkerTemplate(Isolate* isolate);
static Local<ObjectTemplate> CreateAsyncHookTemplate(Isolate* isolate);
static Local<ObjectTemplate> CreateTestRunnerTemplate(Isolate* isolate);
static Local<ObjectTemplate> CreatePerformanceTemplate(Isolate* isolate);
static Local<ObjectTemplate> CreateRealmTemplate(Isolate* isolate);
static Local<ObjectTemplate> CreateD8Template(Isolate* isolate);
static MaybeLocal<Context> CreateRealm(
const v8::FunctionCallbackInfo<v8::Value>& args, int index,
v8::MaybeLocal<Value> global_object);
......
......@@ -1223,11 +1223,6 @@
# Runs significantly slower with --stress-wasm-code-gc, problematic
# especially in combination with tsan or other slow configurations.
'wasm/many-modules': [SKIP],
# https://crbug.com/v8/10892
'compiler/serializer-dead-after-return': [SKIP],
'compiler/serializer-dead-after-jump': [SKIP],
'regress/regress-crbug-882233-2': [SKIP],
}], # variant == stress_js_bg_compile_wasm_code_gc
##############################################################################
......
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