Skip to content

Commit a497f87

Browse files
authored
Upgrade V8 for top-level-await (#3015)
1 parent 726f086 commit a497f87

File tree

7 files changed

+23
-6
lines changed

7 files changed

+23
-6
lines changed

cli/tests/integration_tests.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ itest!(error_013_missing_script {
427427
itest!(error_014_catch_dynamic_import_error {
428428
args: "error_014_catch_dynamic_import_error.js --reload --allow-read",
429429
output: "error_014_catch_dynamic_import_error.js.out",
430+
exit_code: 1,
430431
});
431432

432433
itest!(error_015_dynamic_import_permissions {
@@ -549,3 +550,8 @@ itest!(wasm_async {
549550
args: "wasm_async.js",
550551
output: "wasm_async.out",
551552
});
553+
554+
itest!(top_level_await {
555+
args: "--allow-read top_level_await.js",
556+
output: "top_level_await.out",
557+
});

cli/tests/top_level_await.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const buf = await Deno.readFile("hello.txt");
2+
const n = await Deno.stdout.write(buf);
3+
console.log(`\n\nwrite ${n}`);

cli/tests/top_level_await.out

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Hello world!
2+
3+
write 12

core/libdeno/api.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,9 @@ void deno_init() {
120120
// remove this to make it work asynchronously too. But that requires getting
121121
// PumpMessageLoop and RunMicrotasks setup correctly.
122122
// See https://github.com/denoland/deno/issues/2544
123-
const char* argv[2] = {"", "--no-wasm-async-compilation"};
124-
int argc = 2;
123+
const char* argv[3] = {"", "--no-wasm-async-compilation",
124+
"--harmony-top-level-await"};
125+
int argc = 3;
125126
v8::V8::SetFlagsFromCommandLine(&argc, const_cast<char**>(argv), false);
126127
}
127128
}

core/libdeno/modules.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,12 @@ void deno_mod_evaluate(Deno* d_, void* user_data, deno_mod id) {
147147
if (status == Module::kInstantiated) {
148148
bool ok = !module->Evaluate(context).IsEmpty();
149149
status = module->GetStatus(); // Update status after evaluating.
150-
CHECK_IMPLIES(ok, status == Module::kEvaluated);
151-
CHECK_IMPLIES(!ok, status == Module::kErrored);
150+
if (ok) {
151+
// Note status can still be kErrored even if we get ok.
152+
CHECK(status == Module::kEvaluated || status == Module::kErrored);
153+
} else {
154+
CHECK_EQ(status, Module::kErrored);
155+
}
152156
}
153157

154158
switch (status) {

gclient_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
22
solutions = [
33
{
4-
'url': 'https://chromium.googlesource.com/v8/[email protected].8',
4+
'url': 'https://chromium.googlesource.com/v8/[email protected].110',
55
'name': 'v8',
66
'deps_file': 'DEPS',
77
'custom_deps': {

third_party

Submodule third_party updated 963 files

0 commit comments

Comments
 (0)