Commit 4263f8a5 authored by Gus Caplan's avatar Gus Caplan Committed by Commit Bot

parser: better error message for await+tla

Bug: v8:9344, v8:6513
Change-Id: I1854e483515e7da99192367b6764a0ec7c8b41d9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2411687Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Commit-Queue: Gus Caplan <snek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70099}
parent ac544ffa
...@@ -33,6 +33,9 @@ namespace internal { ...@@ -33,6 +33,9 @@ namespace internal {
"Derived ArrayBuffer constructor created a buffer which was too small") \ "Derived ArrayBuffer constructor created a buffer which was too small") \
T(ArrayBufferSpeciesThis, \ T(ArrayBufferSpeciesThis, \
"ArrayBuffer subclass returned this from species constructor") \ "ArrayBuffer subclass returned this from species constructor") \
T(AwaitNotInAsyncContext, \
"await is only valid in async functions and the top level bodies of " \
"modules") \
T(AwaitNotInAsyncFunction, "await is only valid in async function") \ T(AwaitNotInAsyncFunction, "await is only valid in async function") \
T(AtomicsWaitNotAllowed, "Atomics.wait cannot be called in this context") \ T(AtomicsWaitNotAllowed, "Atomics.wait cannot be called in this context") \
T(BadSortComparisonFunction, \ T(BadSortComparisonFunction, \
......
...@@ -909,7 +909,9 @@ class ParserBase { ...@@ -909,7 +909,9 @@ class ParserBase {
if (scanner()->current_token() == Token::AWAIT && !is_async_function()) { if (scanner()->current_token() == Token::AWAIT && !is_async_function()) {
ReportMessageAt(scanner()->location(), ReportMessageAt(scanner()->location(),
MessageTemplate::kAwaitNotInAsyncFunction); flags().allow_harmony_top_level_await()
? MessageTemplate::kAwaitNotInAsyncContext
: MessageTemplate::kAwaitNotInAsyncFunction);
return; return;
} }
......
...@@ -84,7 +84,7 @@ bytecodes: [ ...@@ -84,7 +84,7 @@ bytecodes: [
B(Mov), R(this), R(0), B(Mov), R(this), R(0),
B(Mov), R(context), R(2), B(Mov), R(context), R(2),
/* 48 E> */ B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3), /* 48 E> */ B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3),
/* 53 S> */ B(Wide), B(LdaSmi), I16(267), /* 53 S> */ B(Wide), B(LdaSmi), I16(268),
B(Star), R(3), B(Star), R(3),
B(LdaConstant), U8(0), B(LdaConstant), U8(0),
B(Star), R(4), B(Star), R(4),
...@@ -115,7 +115,7 @@ bytecodes: [ ...@@ -115,7 +115,7 @@ bytecodes: [
B(Mov), R(this), R(0), B(Mov), R(this), R(0),
B(Mov), R(context), R(2), B(Mov), R(context), R(2),
/* 41 E> */ B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3), /* 41 E> */ B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3),
/* 46 S> */ B(Wide), B(LdaSmi), I16(266), /* 46 S> */ B(Wide), B(LdaSmi), I16(267),
B(Star), R(3), B(Star), R(3),
B(LdaConstant), U8(0), B(LdaConstant), U8(0),
B(Star), R(4), B(Star), R(4),
...@@ -146,7 +146,7 @@ bytecodes: [ ...@@ -146,7 +146,7 @@ bytecodes: [
B(Mov), R(this), R(0), B(Mov), R(this), R(0),
B(Mov), R(context), R(2), B(Mov), R(context), R(2),
/* 48 E> */ B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3), /* 48 E> */ B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3),
/* 53 S> */ B(Wide), B(LdaSmi), I16(267), /* 53 S> */ B(Wide), B(LdaSmi), I16(268),
B(Star), R(3), B(Star), R(3),
B(LdaConstant), U8(0), B(LdaConstant), U8(0),
B(Star), R(4), B(Star), R(4),
...@@ -177,7 +177,7 @@ bytecodes: [ ...@@ -177,7 +177,7 @@ bytecodes: [
B(Mov), R(this), R(0), B(Mov), R(this), R(0),
B(Mov), R(context), R(2), B(Mov), R(context), R(2),
/* 41 E> */ B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3), /* 41 E> */ B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3),
/* 46 S> */ B(Wide), B(LdaSmi), I16(266), /* 46 S> */ B(Wide), B(LdaSmi), I16(267),
B(Star), R(4), B(Star), R(4),
B(LdaConstant), U8(0), B(LdaConstant), U8(0),
B(Star), R(5), B(Star), R(5),
......
...@@ -57,7 +57,7 @@ bytecodes: [ ...@@ -57,7 +57,7 @@ bytecodes: [
B(Mov), R(this), R(0), B(Mov), R(this), R(0),
B(Mov), R(context), R(2), B(Mov), R(context), R(2),
/* 44 E> */ B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3), /* 44 E> */ B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3),
/* 49 S> */ B(Wide), B(LdaSmi), I16(265), /* 49 S> */ B(Wide), B(LdaSmi), I16(266),
B(Star), R(3), B(Star), R(3),
B(LdaConstant), U8(0), B(LdaConstant), U8(0),
B(Star), R(4), B(Star), R(4),
...@@ -89,7 +89,7 @@ bytecodes: [ ...@@ -89,7 +89,7 @@ bytecodes: [
B(Mov), R(this), R(0), B(Mov), R(this), R(0),
B(Mov), R(context), R(2), B(Mov), R(context), R(2),
/* 44 E> */ B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3), /* 44 E> */ B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(0), U8(3),
/* 49 S> */ B(Wide), B(LdaSmi), I16(265), /* 49 S> */ B(Wide), B(LdaSmi), I16(266),
B(Star), R(3), B(Star), R(3),
B(LdaConstant), U8(0), B(LdaConstant), U8(0),
B(Star), R(4), B(Star), R(4),
......
...@@ -25,7 +25,7 @@ bytecodes: [ ...@@ -25,7 +25,7 @@ bytecodes: [
B(TestReferenceEqual), R(this), B(TestReferenceEqual), R(this),
B(Mov), R(this), R(1), B(Mov), R(this), R(1),
B(JumpIfTrue), U8(18), B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(263), B(Wide), B(LdaSmi), I16(264),
B(Star), R(2), B(Star), R(2),
B(LdaConstant), U8(0), B(LdaConstant), U8(0),
B(Star), R(3), B(Star), R(3),
...@@ -56,7 +56,7 @@ frame size: 2 ...@@ -56,7 +56,7 @@ frame size: 2
parameter count: 1 parameter count: 1
bytecode array length: 16 bytecode array length: 16
bytecodes: [ bytecodes: [
/* 56 S> */ B(Wide), B(LdaSmi), I16(265), /* 56 S> */ B(Wide), B(LdaSmi), I16(266),
B(Star), R(0), B(Star), R(0),
B(LdaConstant), U8(0), B(LdaConstant), U8(0),
B(Star), R(1), B(Star), R(1),
...@@ -83,7 +83,7 @@ frame size: 2 ...@@ -83,7 +83,7 @@ frame size: 2
parameter count: 1 parameter count: 1
bytecode array length: 16 bytecode array length: 16
bytecodes: [ bytecodes: [
/* 56 S> */ B(Wide), B(LdaSmi), I16(265), /* 56 S> */ B(Wide), B(LdaSmi), I16(266),
B(Star), R(0), B(Star), R(0),
B(LdaConstant), U8(0), B(LdaConstant), U8(0),
B(Star), R(1), B(Star), R(1),
...@@ -122,7 +122,7 @@ bytecodes: [ ...@@ -122,7 +122,7 @@ bytecodes: [
/* 94 E> */ B(TestReferenceEqual), R(this), /* 94 E> */ B(TestReferenceEqual), R(this),
B(Mov), R(this), R(0), B(Mov), R(this), R(0),
B(JumpIfTrue), U8(18), B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(263), B(Wide), B(LdaSmi), I16(264),
B(Star), R(2), B(Star), R(2),
B(LdaConstant), U8(0), B(LdaConstant), U8(0),
B(Star), R(3), B(Star), R(3),
...@@ -144,7 +144,7 @@ bytecodes: [ ...@@ -144,7 +144,7 @@ bytecodes: [
/* 109 E> */ B(TestReferenceEqual), R(this), /* 109 E> */ B(TestReferenceEqual), R(this),
B(Mov), R(this), R(1), B(Mov), R(this), R(1),
B(JumpIfTrue), U8(18), B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(264), B(Wide), B(LdaSmi), I16(265),
B(Star), R(3), B(Star), R(3),
B(LdaConstant), U8(0), B(LdaConstant), U8(0),
B(Star), R(4), B(Star), R(4),
...@@ -159,7 +159,7 @@ bytecodes: [ ...@@ -159,7 +159,7 @@ bytecodes: [
/* 133 E> */ B(TestReferenceEqual), R(this), /* 133 E> */ B(TestReferenceEqual), R(this),
B(Mov), R(this), R(0), B(Mov), R(this), R(0),
B(JumpIfTrue), U8(18), B(JumpIfTrue), U8(18),
B(Wide), B(LdaSmi), I16(263), B(Wide), B(LdaSmi), I16(264),
B(Star), R(2), B(Star), R(2),
B(LdaConstant), U8(0), B(LdaConstant), U8(0),
B(Star), R(3), B(Star), R(3),
...@@ -189,7 +189,7 @@ frame size: 2 ...@@ -189,7 +189,7 @@ frame size: 2
parameter count: 1 parameter count: 1
bytecode array length: 16 bytecode array length: 16
bytecodes: [ bytecodes: [
/* 60 S> */ B(Wide), B(LdaSmi), I16(267), /* 60 S> */ B(Wide), B(LdaSmi), I16(268),
B(Star), R(0), B(Star), R(0),
B(LdaConstant), U8(0), B(LdaConstant), U8(0),
B(Star), R(1), B(Star), R(1),
...@@ -215,7 +215,7 @@ frame size: 2 ...@@ -215,7 +215,7 @@ frame size: 2
parameter count: 1 parameter count: 1
bytecode array length: 16 bytecode array length: 16
bytecodes: [ bytecodes: [
/* 53 S> */ B(Wide), B(LdaSmi), I16(266), /* 53 S> */ B(Wide), B(LdaSmi), I16(267),
B(Star), R(0), B(Star), R(0),
B(LdaConstant), U8(0), B(LdaConstant), U8(0),
B(Star), R(1), B(Star), R(1),
...@@ -241,7 +241,7 @@ frame size: 2 ...@@ -241,7 +241,7 @@ frame size: 2
parameter count: 1 parameter count: 1
bytecode array length: 16 bytecode array length: 16
bytecodes: [ bytecodes: [
/* 60 S> */ B(Wide), B(LdaSmi), I16(267), /* 60 S> */ B(Wide), B(LdaSmi), I16(268),
B(Star), R(0), B(Star), R(0),
B(LdaConstant), U8(0), B(LdaConstant), U8(0),
B(Star), R(1), B(Star), R(1),
...@@ -267,7 +267,7 @@ frame size: 3 ...@@ -267,7 +267,7 @@ frame size: 3
parameter count: 1 parameter count: 1
bytecode array length: 16 bytecode array length: 16
bytecodes: [ bytecodes: [
/* 46 S> */ B(Wide), B(LdaSmi), I16(266), /* 46 S> */ B(Wide), B(LdaSmi), I16(267),
B(Star), R(1), B(Star), R(1),
B(LdaConstant), U8(0), B(LdaConstant), U8(0),
B(Star), R(2), B(Star), R(2),
......
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