[ESNext] Implement optional catch binding

This is just a rebased version of
https://chromium-review.googlesource.com/c/v8/v8/+/571453 with
no functional changes

Bug: v8:6889
Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: Ia082cc09ca527505b288ac88e68e0b74eae94765
Reviewed-on: https://chromium-review.googlesource.com/849423
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50417}
This commit is contained in:
Sathya Gunasekaran 2018-01-04 11:15:04 -08:00 committed by Commit Bot
parent 9c0edf6813
commit 779c080895
18 changed files with 434 additions and 359 deletions

View File

@ -984,8 +984,10 @@ void AstPrinter::VisitTryCatchStatement(TryCatchStatement* node) {
UNREACHABLE();
}
Print(" %s\n", prediction);
PrintLiteralWithModeIndented("CATCHVAR", node->scope()->catch_variable(),
node->scope()->catch_variable()->raw_name());
if (node->scope()) {
PrintLiteralWithModeIndented("CATCHVAR", node->scope()->catch_variable(),
node->scope()->catch_variable()->raw_name());
}
PrintIndentedVisit("CATCH", node->catch_block());
}

View File

@ -4353,6 +4353,7 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_class_fields)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_dynamic_import)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_import_meta)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrict_constructor_return)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_optional_catch_binding)
void InstallPublicSymbol(Factory* factory, Handle<Context> native_context,
const char* name, Handle<Symbol> value) {

View File

@ -207,7 +207,8 @@ DEFINE_IMPLICATION(harmony_class_fields, harmony_static_fields)
V(harmony_do_expressions, "harmony do-expressions") \
V(harmony_class_fields, "harmony fields in class literals") \
V(harmony_static_fields, "harmony static fields in class literals") \
V(harmony_bigint, "harmony arbitrary precision integers")
V(harmony_bigint, "harmony arbitrary precision integers") \
V(harmony_optional_catch_binding, "allow omitting binding in catch blocks")
// Features that are complete (but still behind --harmony/es-staging flag).
#define HARMONY_STAGED(V) \

View File

@ -1738,9 +1738,11 @@ void BytecodeGenerator::VisitTryCatchStatement(TryCatchStatement* stmt) {
}
try_control_builder.EndTry();
// Create a catch scope that binds the exception.
BuildNewLocalCatchContext(stmt->scope());
builder()->StoreAccumulatorInRegister(context);
if (stmt->scope()) {
// Create a catch scope that binds the exception.
BuildNewLocalCatchContext(stmt->scope());
builder()->StoreAccumulatorInRegister(context);
}
// If requested, clear message object as we enter the catch block.
if (stmt->ShouldClearPendingException(outer_catch_prediction)) {
@ -1751,7 +1753,11 @@ void BytecodeGenerator::VisitTryCatchStatement(TryCatchStatement* stmt) {
builder()->LoadAccumulatorWithRegister(context);
// Evaluate the catch-block.
VisitInScope(stmt->catch_block(), stmt->scope());
if (stmt->scope()) {
VisitInScope(stmt->catch_block(), stmt->scope());
} else {
VisitBlock(stmt->catch_block());
}
try_control_builder.EndCatch();
}

View File

@ -85,7 +85,7 @@ void Reparenter::VisitRewritableExpression(RewritableExpression* expr) {
}
void Reparenter::VisitBlock(Block* stmt) {
if (stmt->scope() != nullptr)
if (stmt->scope())
stmt->scope()->ReplaceOuterScope(scope_);
else
VisitStatements(stmt->statements());
@ -93,7 +93,11 @@ void Reparenter::VisitBlock(Block* stmt) {
void Reparenter::VisitTryCatchStatement(TryCatchStatement* stmt) {
Visit(stmt->try_block());
stmt->scope()->ReplaceOuterScope(scope_);
if (stmt->scope()) {
stmt->scope()->ReplaceOuterScope(scope_);
} else {
Visit(stmt->catch_block());
}
}
void Reparenter::VisitWithStatement(WithStatement* stmt) {

View File

@ -282,7 +282,8 @@ class ParserBase {
allow_harmony_static_fields_(false),
allow_harmony_dynamic_import_(false),
allow_harmony_import_meta_(false),
allow_harmony_async_iteration_(false) {}
allow_harmony_async_iteration_(false),
allow_harmony_optional_catch_binding_(false) {}
#define ALLOW_ACCESSORS(name) \
bool allow_##name() const { return allow_##name##_; } \
@ -296,6 +297,7 @@ class ParserBase {
ALLOW_ACCESSORS(harmony_dynamic_import);
ALLOW_ACCESSORS(harmony_import_meta);
ALLOW_ACCESSORS(harmony_async_iteration);
ALLOW_ACCESSORS(harmony_optional_catch_binding);
#undef ALLOW_ACCESSORS
@ -1535,6 +1537,7 @@ class ParserBase {
bool allow_harmony_dynamic_import_;
bool allow_harmony_import_meta_;
bool allow_harmony_async_iteration_;
bool allow_harmony_optional_catch_binding_;
friend class DiscardableZoneScope;
};
@ -5544,50 +5547,60 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseTryStatement(
{
SourceRangeScope catch_range_scope(scanner(), &catch_range);
if (Check(Token::CATCH)) {
Expect(Token::LPAREN, CHECK_OK);
catch_info.scope = NewScope(CATCH_SCOPE);
catch_info.scope->set_start_position(scanner()->location().beg_pos);
{
BlockState catch_block_state(&scope_, catch_info.scope);
catch_block = factory()->NewBlock(16, false);
// Create a block scope to hold any lexical declarations created
// as part of destructuring the catch parameter.
{
BlockState catch_variable_block_state(zone(), &scope_);
scope()->set_start_position(scanner()->location().beg_pos);
typename Types::Target target(this, catch_block);
// This does not simply call ParsePrimaryExpression to avoid
// ExpressionFromIdentifier from being called in the first
// branch, which would introduce an unresolved symbol and mess
// with arrow function names.
if (peek_any_identifier()) {
catch_info.name =
ParseIdentifier(kDontAllowRestrictedIdentifiers, CHECK_OK);
} else {
ExpressionClassifier pattern_classifier(this);
catch_info.pattern = ParsePrimaryExpression(CHECK_OK);
ValidateBindingPattern(CHECK_OK);
}
Expect(Token::RPAREN, CHECK_OK);
impl()->RewriteCatchPattern(&catch_info, CHECK_OK);
if (!impl()->IsNull(catch_info.init_block)) {
catch_block->statements()->Add(catch_info.init_block, zone());
}
catch_info.inner_block = ParseBlock(nullptr, CHECK_OK);
catch_block->statements()->Add(catch_info.inner_block, zone());
impl()->ValidateCatchBlock(catch_info, CHECK_OK);
scope()->set_end_position(scanner()->location().end_pos);
catch_block->set_scope(scope()->FinalizeBlockScope());
}
bool has_binding;
if (allow_harmony_optional_catch_binding()) {
has_binding = Check(Token::LPAREN);
} else {
has_binding = true;
Expect(Token::LPAREN, CHECK_OK);
}
catch_info.scope->set_end_position(scanner()->location().end_pos);
if (has_binding) {
catch_info.scope = NewScope(CATCH_SCOPE);
catch_info.scope->set_start_position(scanner()->location().beg_pos);
{
BlockState catch_block_state(&scope_, catch_info.scope);
catch_block = factory()->NewBlock(16, false);
// Create a block scope to hold any lexical declarations created
// as part of destructuring the catch parameter.
{
BlockState catch_variable_block_state(zone(), &scope_);
scope()->set_start_position(scanner()->location().beg_pos);
// This does not simply call ParsePrimaryExpression to avoid
// ExpressionFromIdentifier from being called in the first
// branch, which would introduce an unresolved symbol and mess
// with arrow function names.
if (peek_any_identifier()) {
catch_info.name =
ParseIdentifier(kDontAllowRestrictedIdentifiers, CHECK_OK);
} else {
ExpressionClassifier pattern_classifier(this);
catch_info.pattern = ParsePrimaryExpression(CHECK_OK);
ValidateBindingPattern(CHECK_OK);
}
Expect(Token::RPAREN, CHECK_OK);
impl()->RewriteCatchPattern(&catch_info, CHECK_OK);
if (!impl()->IsNull(catch_info.init_block)) {
catch_block->statements()->Add(catch_info.init_block, zone());
}
catch_info.inner_block = ParseBlock(nullptr, CHECK_OK);
catch_block->statements()->Add(catch_info.inner_block, zone());
impl()->ValidateCatchBlock(catch_info, CHECK_OK);
scope()->set_end_position(scanner()->location().end_pos);
catch_block->set_scope(scope()->FinalizeBlockScope());
}
}
catch_info.scope->set_end_position(scanner()->location().end_pos);
} else {
catch_block = ParseBlock(nullptr, CHECK_OK);
}
}
}

View File

@ -548,6 +548,7 @@ Parser::Parser(ParseInfo* info)
set_allow_harmony_import_meta(FLAG_harmony_import_meta);
set_allow_harmony_async_iteration(FLAG_harmony_async_iteration);
set_allow_harmony_bigint(FLAG_harmony_bigint);
set_allow_harmony_optional_catch_binding(FLAG_harmony_optional_catch_binding);
for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount;
++feature) {
use_counts_[feature] = 0;
@ -1760,7 +1761,6 @@ Statement* Parser::RewriteTryStatement(Block* try_block, Block* catch_block,
if (catch_block != nullptr && finally_block != nullptr) {
// If we have both, create an inner try/catch.
DCHECK_NOT_NULL(catch_info.scope);
TryCatchStatement* statement;
statement = factory()->NewTryCatchStatement(try_block, catch_info.scope,
catch_block, kNoSourcePosition);
@ -1773,7 +1773,6 @@ Statement* Parser::RewriteTryStatement(Block* try_block, Block* catch_block,
if (catch_block != nullptr) {
DCHECK_NULL(finally_block);
DCHECK_NOT_NULL(catch_info.scope);
TryCatchStatement* stmt = factory()->NewTryCatchStatement(
try_block, catch_info.scope, catch_block, pos);
RecordTryCatchStatementSourceRange(stmt, catch_range);
@ -4285,9 +4284,8 @@ void Parser::BuildIteratorCloseForCompletion(ZoneList<Statement*>* statements,
zone());
Block* catch_block = factory()->NewBlock(0, false);
Scope* catch_scope = NewHiddenCatchScope();
try_call_return = factory()->NewTryCatchStatement(try_block, catch_scope,
catch_block, nopos);
try_call_return =
factory()->NewTryCatchStatement(try_block, nullptr, catch_block, nopos);
}
// let output = %_Call(iteratorReturn, iterator);

View File

@ -306,6 +306,7 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
SET_ALLOW(harmony_import_meta);
SET_ALLOW(harmony_async_iteration);
SET_ALLOW(harmony_bigint);
SET_ALLOW(harmony_optional_catch_binding);
#undef SET_ALLOW
}
return reusable_preparser_;

View File

@ -292,7 +292,7 @@ snippet: "
"
frame size: 22
parameter count: 1
bytecode array length: 571
bytecode array length: 557
bytecodes: [
B(Ldar), R(2),
B(JumpIfUndefined), U8(18),
@ -326,7 +326,7 @@ bytecodes: [
B(LdaZero),
B(Star), R(11),
B(Mov), R(15), R(12),
B(JumpConstant), U8(21),
B(JumpConstant), U8(20),
B(LdaZero),
B(Star), R(6),
B(Mov), R(context), R(17),
@ -415,15 +415,15 @@ bytecodes: [
B(Star), R(17),
B(LdaZero),
B(TestEqualStrict), R(6), U8(14),
B(JumpIfTrue), U8(104),
B(JumpIfTrue), U8(90),
B(LdaNamedProperty), R(4), U8(15), U8(15),
B(Star), R(8),
B(TestUndetectable),
B(JumpIfFalse), U8(4),
B(Jump), U8(93),
B(Jump), U8(79),
B(LdaSmi), I8(1),
B(TestEqualStrict), R(6), U8(17),
B(JumpIfFalse), U8(61),
B(JumpIfFalse), U8(47),
B(Ldar), R(8),
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
@ -438,16 +438,10 @@ bytecodes: [
B(Mov), R(8), R(19),
B(Mov), R(4), R(20),
B(InvokeIntrinsic), U8(Runtime::k_Call), R(19), U8(2),
B(Jump), U8(20),
B(Star), R(19),
B(Ldar), R(closure),
B(CreateCatchContext), R(19), U8(13), U8(17),
B(Star), R(18),
B(Jump), U8(6),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(18),
B(PushContext), R(19),
B(PopContext), R(19),
B(Jump), U8(27),
B(Mov), R(8), R(18),
B(Mov), R(4), R(19),
@ -460,7 +454,7 @@ bytecodes: [
B(Ldar), R(17),
B(SetPendingMessage),
B(Ldar), R(15),
B(SwitchOnSmiNoFeedback), U8(18), U8(2), I8(0),
B(SwitchOnSmiNoFeedback), U8(17), U8(2), I8(0),
B(Jump), U8(13),
B(LdaZero),
B(Star), R(11),
@ -493,7 +487,7 @@ bytecodes: [
B(Jump), U8(39),
B(Star), R(15),
B(Ldar), R(closure),
B(CreateCatchContext), R(15), U8(13), U8(20),
B(CreateCatchContext), R(15), U8(13), U8(19),
B(Star), R(14),
B(LdaTheHole),
B(SetPendingMessage),
@ -522,7 +516,7 @@ bytecodes: [
B(Ldar), R(13),
B(SetPendingMessage),
B(Ldar), R(11),
B(SwitchOnSmiNoFeedback), U8(22), U8(3), I8(0),
B(SwitchOnSmiNoFeedback), U8(21), U8(3), I8(0),
B(Jump), U8(22),
B(LdaTrue),
B(Star), R(16),
@ -540,7 +534,7 @@ bytecodes: [
constant pool: [
Smi [37],
Smi [104],
Smi [427],
Smi [413],
Smi [15],
Smi [7],
TUPLE2_TYPE,
@ -555,18 +549,17 @@ constant pool: [
FIXED_ARRAY_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE,
Smi [6],
Smi [14],
FIXED_ARRAY_TYPE,
Smi [448],
Smi [434],
Smi [6],
Smi [20],
Smi [23],
]
handlers: [
[40, 516, 524],
[43, 477, 479],
[40, 502, 510],
[43, 463, 465],
[90, 277, 285],
[93, 237, 239],
[346, 356, 358],

View File

@ -16,7 +16,7 @@ snippet: "
"
frame size: 23
parameter count: 1
bytecode array length: 589
bytecode array length: 575
bytecodes: [
B(Ldar), R(2),
B(JumpIfUndefined), U8(18),
@ -130,15 +130,15 @@ bytecodes: [
B(Star), R(18),
B(LdaZero),
B(TestEqualStrict), R(6), U8(18),
B(JumpIfTrue), U8(199),
B(JumpIfTrue), U8(185),
B(LdaNamedProperty), R(4), U8(12), U8(19),
B(Star), R(8),
B(TestUndetectable),
B(JumpIfFalse), U8(4),
B(Jump), U8(188),
B(Jump), U8(174),
B(LdaSmi), I8(1),
B(TestEqualStrict), R(6), U8(21),
B(JumpIfFalse), U8(109),
B(JumpIfFalse), U8(95),
B(Ldar), R(8),
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
@ -172,16 +172,10 @@ bytecodes: [
B(Ldar), R(20),
B(ReThrow),
B(Ldar), R(20),
B(Jump), U8(20),
B(Star), R(20),
B(Ldar), R(closure),
B(CreateCatchContext), R(20), U8(10), U8(14),
B(Star), R(19),
B(Jump), U8(6),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(19),
B(PushContext), R(20),
B(PopContext), R(20),
B(Jump), U8(74),
B(Mov), R(8), R(19),
B(Mov), R(4), R(20),
@ -227,7 +221,7 @@ bytecodes: [
B(Jump), U8(42),
B(Star), R(16),
B(Ldar), R(closure),
B(CreateCatchContext), R(16), U8(10), U8(15),
B(CreateCatchContext), R(16), U8(10), U8(14),
B(Star), R(15),
B(LdaTheHole),
B(SetPendingMessage),
@ -258,7 +252,7 @@ bytecodes: [
B(Ldar), R(14),
B(SetPendingMessage),
B(Ldar), R(12),
B(SwitchOnSmiNoFeedback), U8(16), U8(2), I8(0),
B(SwitchOnSmiNoFeedback), U8(15), U8(2), I8(0),
B(Jump), U8(8),
B(Ldar), R(13),
/* 57 S> */ B(Return),
@ -270,7 +264,7 @@ bytecodes: [
constant pool: [
Smi [89],
Smi [339],
Smi [419],
Smi [405],
TUPLE2_TYPE,
SYMBOL_TYPE,
SYMBOL_TYPE,
@ -283,13 +277,12 @@ constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE,
FIXED_ARRAY_TYPE,
Smi [6],
Smi [9],
]
handlers: [
[46, 548, 556],
[49, 506, 508],
[46, 534, 542],
[49, 492, 494],
[55, 257, 265],
[58, 217, 219],
[325, 383, 385],
@ -304,7 +297,7 @@ snippet: "
"
frame size: 23
parameter count: 1
bytecode array length: 618
bytecode array length: 604
bytecodes: [
B(Ldar), R(2),
B(JumpIfUndefined), U8(18),
@ -419,15 +412,15 @@ bytecodes: [
B(Star), R(18),
B(LdaZero),
B(TestEqualStrict), R(6), U8(18),
B(JumpIfTrue), U8(199),
B(JumpIfTrue), U8(185),
B(LdaNamedProperty), R(4), U8(12), U8(19),
B(Star), R(8),
B(TestUndetectable),
B(JumpIfFalse), U8(4),
B(Jump), U8(188),
B(Jump), U8(174),
B(LdaSmi), I8(1),
B(TestEqualStrict), R(6), U8(21),
B(JumpIfFalse), U8(109),
B(JumpIfFalse), U8(95),
B(Ldar), R(8),
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
@ -461,16 +454,10 @@ bytecodes: [
B(Ldar), R(20),
B(ReThrow),
B(Ldar), R(20),
B(Jump), U8(20),
B(Star), R(20),
B(Ldar), R(closure),
B(CreateCatchContext), R(20), U8(10), U8(14),
B(Star), R(19),
B(Jump), U8(6),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(19),
B(PushContext), R(20),
B(PopContext), R(20),
B(Jump), U8(74),
B(Mov), R(8), R(19),
B(Mov), R(4), R(20),
@ -501,7 +488,7 @@ bytecodes: [
B(Ldar), R(18),
B(SetPendingMessage),
B(Ldar), R(16),
B(SwitchOnSmiNoFeedback), U8(15), U8(2), I8(0),
B(SwitchOnSmiNoFeedback), U8(14), U8(2), I8(0),
B(Jump), U8(13),
B(LdaZero),
B(Star), R(12),
@ -520,7 +507,7 @@ bytecodes: [
B(Jump), U8(43),
B(Star), R(16),
B(Ldar), R(closure),
B(CreateCatchContext), R(16), U8(10), U8(17),
B(CreateCatchContext), R(16), U8(10), U8(16),
B(Star), R(15),
B(LdaTheHole),
B(SetPendingMessage),
@ -551,7 +538,7 @@ bytecodes: [
B(Ldar), R(14),
B(SetPendingMessage),
B(Ldar), R(12),
B(SwitchOnSmiNoFeedback), U8(18), U8(3), I8(0),
B(SwitchOnSmiNoFeedback), U8(17), U8(3), I8(0),
B(Jump), U8(21),
B(Mov), R(10), R(15),
B(Mov), R(13), R(16),
@ -568,7 +555,7 @@ bytecodes: [
constant pool: [
Smi [89],
Smi [342],
Smi [422],
Smi [408],
TUPLE2_TYPE,
SYMBOL_TYPE,
SYMBOL_TYPE,
@ -580,7 +567,6 @@ constant pool: [
FIXED_ARRAY_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE,
Smi [6],
Smi [14],
FIXED_ARRAY_TYPE,
@ -589,8 +575,8 @@ constant pool: [
Smi [22],
]
handlers: [
[46, 564, 572],
[49, 521, 523],
[46, 550, 558],
[49, 507, 509],
[55, 259, 267],
[58, 219, 221],
[328, 386, 388],
@ -608,7 +594,7 @@ snippet: "
"
frame size: 23
parameter count: 1
bytecode array length: 607
bytecode array length: 593
bytecodes: [
B(Ldar), R(2),
B(JumpIfUndefined), U8(18),
@ -730,15 +716,15 @@ bytecodes: [
B(Star), R(18),
B(LdaZero),
B(TestEqualStrict), R(6), U8(20),
B(JumpIfTrue), U8(199),
B(JumpIfTrue), U8(185),
B(LdaNamedProperty), R(4), U8(12), U8(21),
B(Star), R(8),
B(TestUndetectable),
B(JumpIfFalse), U8(4),
B(Jump), U8(188),
B(Jump), U8(174),
B(LdaSmi), I8(1),
B(TestEqualStrict), R(6), U8(23),
B(JumpIfFalse), U8(109),
B(JumpIfFalse), U8(95),
B(Ldar), R(8),
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
@ -772,16 +758,10 @@ bytecodes: [
B(Ldar), R(20),
B(ReThrow),
B(Ldar), R(20),
B(Jump), U8(20),
B(Star), R(20),
B(Ldar), R(closure),
B(CreateCatchContext), R(20), U8(10), U8(14),
B(Star), R(19),
B(Jump), U8(6),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(19),
B(PushContext), R(20),
B(PopContext), R(20),
B(Jump), U8(74),
B(Mov), R(8), R(19),
B(Mov), R(4), R(20),
@ -827,7 +807,7 @@ bytecodes: [
B(Jump), U8(42),
B(Star), R(16),
B(Ldar), R(closure),
B(CreateCatchContext), R(16), U8(10), U8(15),
B(CreateCatchContext), R(16), U8(10), U8(14),
B(Star), R(15),
B(LdaTheHole),
B(SetPendingMessage),
@ -858,7 +838,7 @@ bytecodes: [
B(Ldar), R(14),
B(SetPendingMessage),
B(Ldar), R(12),
B(SwitchOnSmiNoFeedback), U8(16), U8(2), I8(0),
B(SwitchOnSmiNoFeedback), U8(15), U8(2), I8(0),
B(Jump), U8(8),
B(Ldar), R(13),
/* 114 S> */ B(Return),
@ -870,7 +850,7 @@ bytecodes: [
constant pool: [
Smi [89],
Smi [357],
Smi [437],
Smi [423],
TUPLE2_TYPE,
SYMBOL_TYPE,
SYMBOL_TYPE,
@ -883,13 +863,12 @@ constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE,
FIXED_ARRAY_TYPE,
Smi [6],
Smi [9],
]
handlers: [
[46, 566, 574],
[49, 524, 526],
[46, 552, 560],
[49, 510, 512],
[55, 275, 283],
[58, 235, 237],
[343, 401, 403],
@ -905,7 +884,7 @@ snippet: "
"
frame size: 19
parameter count: 1
bytecode array length: 417
bytecode array length: 403
bytecodes: [
/* 16 E> */ B(StackCheck),
B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0),
@ -978,15 +957,15 @@ bytecodes: [
B(Star), R(15),
B(LdaZero),
B(TestEqualStrict), R(4), U8(19),
B(JumpIfTrue), U8(104),
B(JumpIfTrue), U8(90),
B(LdaNamedProperty), R(2), U8(9), U8(20),
B(Star), R(6),
B(TestUndetectable),
B(JumpIfFalse), U8(4),
B(Jump), U8(93),
B(Jump), U8(79),
B(LdaSmi), I8(1),
B(TestEqualStrict), R(4), U8(22),
B(JumpIfFalse), U8(61),
B(JumpIfFalse), U8(47),
B(Ldar), R(6),
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
@ -1001,16 +980,10 @@ bytecodes: [
B(Mov), R(6), R(17),
B(Mov), R(2), R(18),
B(InvokeIntrinsic), U8(Runtime::k_Call), R(17), U8(2),
B(Jump), U8(20),
B(Star), R(17),
B(Ldar), R(closure),
B(CreateCatchContext), R(17), U8(7), U8(11),
B(Star), R(16),
B(Jump), U8(6),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(16),
B(PushContext), R(17),
B(PopContext), R(17),
B(Jump), U8(27),
B(Mov), R(6), R(16),
B(Mov), R(2), R(17),
@ -1023,7 +996,7 @@ bytecodes: [
B(Ldar), R(15),
B(SetPendingMessage),
B(Ldar), R(13),
B(SwitchOnSmiNoFeedback), U8(12), U8(2), I8(0),
B(SwitchOnSmiNoFeedback), U8(11), U8(2), I8(0),
B(Jump), U8(13),
B(LdaZero),
B(Star), R(9),
@ -1042,7 +1015,7 @@ bytecodes: [
B(Jump), U8(43),
B(Star), R(13),
B(Ldar), R(closure),
B(CreateCatchContext), R(13), U8(7), U8(14),
B(CreateCatchContext), R(13), U8(7), U8(13),
B(Star), R(12),
B(LdaTheHole),
B(SetPendingMessage),
@ -1073,7 +1046,7 @@ bytecodes: [
B(Ldar), R(11),
B(SetPendingMessage),
B(Ldar), R(9),
B(SwitchOnSmiNoFeedback), U8(15), U8(3), I8(0),
B(SwitchOnSmiNoFeedback), U8(14), U8(3), I8(0),
B(Jump), U8(21),
B(Mov), R(8), R(12),
B(Mov), R(10), R(13),
@ -1099,7 +1072,6 @@ constant pool: [
FIXED_ARRAY_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE,
Smi [6],
Smi [14],
FIXED_ARRAY_TYPE,
@ -1108,8 +1080,8 @@ constant pool: [
Smi [22],
]
handlers: [
[10, 363, 371],
[13, 320, 322],
[10, 349, 357],
[13, 306, 308],
[27, 153, 161],
[30, 113, 115],
[222, 232, 234],

View File

@ -11,7 +11,7 @@ snippet: "
"
frame size: 14
parameter count: 1
bytecode array length: 262
bytecode array length: 248
bytecodes: [
/* 30 E> */ B(StackCheck),
B(LdaZero),
@ -73,15 +73,15 @@ bytecodes: [
B(Star), R(10),
B(LdaZero),
B(TestEqualStrict), R(4), U8(14),
B(JumpIfTrue), U8(104),
B(JumpIfTrue), U8(90),
B(LdaNamedProperty), R(2), U8(7), U8(15),
B(Star), R(6),
B(TestUndetectable),
B(JumpIfFalse), U8(4),
B(Jump), U8(93),
B(Jump), U8(79),
B(LdaSmi), I8(1),
B(TestEqualStrict), R(4), U8(17),
B(JumpIfFalse), U8(61),
B(JumpIfFalse), U8(47),
B(Ldar), R(6),
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
@ -96,16 +96,10 @@ bytecodes: [
B(Mov), R(6), R(12),
B(Mov), R(2), R(13),
B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2),
B(Jump), U8(20),
B(Star), R(12),
B(Ldar), R(closure),
B(CreateCatchContext), R(12), U8(5), U8(9),
B(Star), R(11),
B(Jump), U8(6),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(11),
B(PushContext), R(12),
B(PopContext), R(12),
B(Jump), U8(27),
B(Mov), R(6), R(11),
B(Mov), R(2), R(12),
@ -135,7 +129,6 @@ constant pool: [
FIXED_ARRAY_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE,
]
handlers: [
[7, 124, 132],
@ -150,7 +143,7 @@ snippet: "
"
frame size: 15
parameter count: 1
bytecode array length: 272
bytecode array length: 258
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaConstant), U8(0),
@ -214,15 +207,15 @@ bytecodes: [
B(Star), R(11),
B(LdaZero),
B(TestEqualStrict), R(5), U8(13),
B(JumpIfTrue), U8(104),
B(JumpIfTrue), U8(90),
B(LdaNamedProperty), R(3), U8(7), U8(14),
B(Star), R(7),
B(TestUndetectable),
B(JumpIfFalse), U8(4),
B(Jump), U8(93),
B(Jump), U8(79),
B(LdaSmi), I8(1),
B(TestEqualStrict), R(5), U8(16),
B(JumpIfFalse), U8(61),
B(JumpIfFalse), U8(47),
B(Ldar), R(7),
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
@ -237,16 +230,10 @@ bytecodes: [
B(Mov), R(7), R(13),
B(Mov), R(3), R(14),
B(InvokeIntrinsic), U8(Runtime::k_Call), R(13), U8(2),
B(Jump), U8(20),
B(Star), R(13),
B(Ldar), R(closure),
B(CreateCatchContext), R(13), U8(5), U8(9),
B(Star), R(12),
B(Jump), U8(6),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(12),
B(PushContext), R(13),
B(PopContext), R(13),
B(Jump), U8(27),
B(Mov), R(7), R(12),
B(Mov), R(3), R(13),
@ -259,7 +246,7 @@ bytecodes: [
B(Ldar), R(11),
B(SetPendingMessage),
B(Ldar), R(9),
B(SwitchOnSmiNoFeedback), U8(10), U8(2), I8(0),
B(SwitchOnSmiNoFeedback), U8(9), U8(2), I8(0),
B(Jump), U8(8),
B(Ldar), R(10),
/* 85 S> */ B(Return),
@ -278,7 +265,6 @@ constant pool: [
FIXED_ARRAY_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE,
Smi [6],
Smi [9],
]
@ -297,7 +283,7 @@ snippet: "
"
frame size: 14
parameter count: 1
bytecode array length: 280
bytecode array length: 266
bytecodes: [
/* 30 E> */ B(StackCheck),
B(LdaZero),
@ -367,15 +353,15 @@ bytecodes: [
B(Star), R(10),
B(LdaZero),
B(TestEqualStrict), R(4), U8(16),
B(JumpIfTrue), U8(104),
B(JumpIfTrue), U8(90),
B(LdaNamedProperty), R(2), U8(7), U8(17),
B(Star), R(6),
B(TestUndetectable),
B(JumpIfFalse), U8(4),
B(Jump), U8(93),
B(Jump), U8(79),
B(LdaSmi), I8(1),
B(TestEqualStrict), R(4), U8(19),
B(JumpIfFalse), U8(61),
B(JumpIfFalse), U8(47),
B(Ldar), R(6),
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
@ -390,16 +376,10 @@ bytecodes: [
B(Mov), R(6), R(12),
B(Mov), R(2), R(13),
B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2),
B(Jump), U8(20),
B(Star), R(12),
B(Ldar), R(closure),
B(CreateCatchContext), R(12), U8(5), U8(9),
B(Star), R(11),
B(Jump), U8(6),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(11),
B(PushContext), R(12),
B(PopContext), R(12),
B(Jump), U8(27),
B(Mov), R(6), R(11),
B(Mov), R(2), R(12),
@ -429,7 +409,6 @@ constant pool: [
FIXED_ARRAY_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE,
]
handlers: [
[7, 142, 150],
@ -444,7 +423,7 @@ snippet: "
"
frame size: 13
parameter count: 1
bytecode array length: 282
bytecode array length: 268
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), R(7),
@ -510,15 +489,15 @@ bytecodes: [
B(Star), R(9),
B(LdaZero),
B(TestEqualStrict), R(3), U8(19),
B(JumpIfTrue), U8(104),
B(JumpIfTrue), U8(90),
B(LdaNamedProperty), R(1), U8(9), U8(20),
B(Star), R(5),
B(TestUndetectable),
B(JumpIfFalse), U8(4),
B(Jump), U8(93),
B(Jump), U8(79),
B(LdaSmi), I8(1),
B(TestEqualStrict), R(3), U8(22),
B(JumpIfFalse), U8(61),
B(JumpIfFalse), U8(47),
B(Ldar), R(5),
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
@ -533,16 +512,10 @@ bytecodes: [
B(Mov), R(5), R(11),
B(Mov), R(1), R(12),
B(InvokeIntrinsic), U8(Runtime::k_Call), R(11), U8(2),
B(Jump), U8(20),
B(Star), R(11),
B(Ldar), R(closure),
B(CreateCatchContext), R(11), U8(7), U8(11),
B(Star), R(10),
B(Jump), U8(6),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(10),
B(PushContext), R(11),
B(PopContext), R(11),
B(Jump), U8(27),
B(Mov), R(5), R(10),
B(Mov), R(1), R(11),
@ -555,7 +528,7 @@ bytecodes: [
B(Ldar), R(9),
B(SetPendingMessage),
B(Ldar), R(7),
B(SwitchOnSmiNoFeedback), U8(12), U8(2), I8(0),
B(SwitchOnSmiNoFeedback), U8(11), U8(2), I8(0),
B(Jump), U8(8),
B(Ldar), R(8),
/* 105 S> */ B(Return),
@ -576,7 +549,6 @@ constant pool: [
FIXED_ARRAY_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE,
Smi [6],
Smi [9],
]

View File

@ -15,7 +15,7 @@ snippet: "
"
frame size: 16
parameter count: 2
bytecode array length: 262
bytecode array length: 248
bytecodes: [
/* 10 E> */ B(StackCheck),
B(LdaZero),
@ -77,15 +77,15 @@ bytecodes: [
B(Star), R(12),
B(LdaZero),
B(TestEqualStrict), R(6), U8(13),
B(JumpIfTrue), U8(104),
B(JumpIfTrue), U8(90),
B(LdaNamedProperty), R(4), U8(6), U8(14),
B(Star), R(8),
B(TestUndetectable),
B(JumpIfFalse), U8(4),
B(Jump), U8(93),
B(Jump), U8(79),
B(LdaSmi), I8(1),
B(TestEqualStrict), R(6), U8(16),
B(JumpIfFalse), U8(61),
B(JumpIfFalse), U8(47),
B(Ldar), R(8),
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
@ -100,16 +100,10 @@ bytecodes: [
B(Mov), R(8), R(14),
B(Mov), R(4), R(15),
B(InvokeIntrinsic), U8(Runtime::k_Call), R(14), U8(2),
B(Jump), U8(20),
B(Star), R(14),
B(Ldar), R(closure),
B(CreateCatchContext), R(14), U8(4), U8(8),
B(Star), R(13),
B(Jump), U8(6),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(13),
B(PushContext), R(14),
B(PopContext), R(14),
B(Jump), U8(27),
B(Mov), R(8), R(13),
B(Mov), R(4), R(14),
@ -138,7 +132,6 @@ constant pool: [
FIXED_ARRAY_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE,
]
handlers: [
[7, 124, 132],
@ -155,7 +148,7 @@ snippet: "
"
frame size: 23
parameter count: 2
bytecode array length: 345
bytecode array length: 331
bytecodes: [
B(CreateFunctionContext), U8(4),
B(PushContext), R(8),
@ -255,15 +248,15 @@ bytecodes: [
B(Star), R(12),
B(LdaZero),
B(TestEqualStrict), R(3), U8(17),
B(JumpIfTrue), U8(104),
B(JumpIfTrue), U8(90),
B(LdaNamedProperty), R(1), U8(10), U8(18),
B(Star), R(5),
B(TestUndetectable),
B(JumpIfFalse), U8(4),
B(Jump), U8(93),
B(Jump), U8(79),
B(LdaSmi), I8(1),
B(TestEqualStrict), R(3), U8(20),
B(JumpIfFalse), U8(61),
B(JumpIfFalse), U8(47),
B(Ldar), R(5),
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
@ -278,16 +271,10 @@ bytecodes: [
B(Mov), R(5), R(14),
B(Mov), R(1), R(15),
B(InvokeIntrinsic), U8(Runtime::k_Call), R(14), U8(2),
B(Jump), U8(20),
B(Star), R(14),
B(Ldar), R(closure),
B(CreateCatchContext), R(14), U8(8), U8(12),
B(Star), R(13),
B(Jump), U8(6),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(13),
B(PushContext), R(14),
B(PopContext), R(14),
B(Jump), U8(27),
B(Mov), R(5), R(13),
B(Mov), R(1), R(14),
@ -321,7 +308,6 @@ constant pool: [
FIXED_ARRAY_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE,
]
handlers: [
[35, 205, 213],
@ -338,7 +324,7 @@ snippet: "
"
frame size: 14
parameter count: 2
bytecode array length: 280
bytecode array length: 266
bytecodes: [
/* 10 E> */ B(StackCheck),
B(LdaZero),
@ -409,15 +395,15 @@ bytecodes: [
B(Star), R(10),
B(LdaZero),
B(TestEqualStrict), R(4), U8(16),
B(JumpIfTrue), U8(104),
B(JumpIfTrue), U8(90),
B(LdaNamedProperty), R(2), U8(8), U8(17),
B(Star), R(6),
B(TestUndetectable),
B(JumpIfFalse), U8(4),
B(Jump), U8(93),
B(Jump), U8(79),
B(LdaSmi), I8(1),
B(TestEqualStrict), R(4), U8(19),
B(JumpIfFalse), U8(61),
B(JumpIfFalse), U8(47),
B(Ldar), R(6),
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
@ -432,16 +418,10 @@ bytecodes: [
B(Mov), R(6), R(12),
B(Mov), R(2), R(13),
B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2),
B(Jump), U8(20),
B(Star), R(12),
B(Ldar), R(closure),
B(CreateCatchContext), R(12), U8(6), U8(10),
B(Star), R(11),
B(Jump), U8(6),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(11),
B(PushContext), R(12),
B(PopContext), R(12),
B(Jump), U8(27),
B(Mov), R(6), R(11),
B(Mov), R(2), R(12),
@ -472,7 +452,6 @@ constant pool: [
FIXED_ARRAY_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE,
]
handlers: [
[7, 142, 150],
@ -489,7 +468,7 @@ snippet: "
"
frame size: 19
parameter count: 2
bytecode array length: 300
bytecode array length: 286
bytecodes: [
/* 10 E> */ B(StackCheck),
B(LdaZero),
@ -567,15 +546,15 @@ bytecodes: [
B(Star), R(15),
B(LdaZero),
B(TestEqualStrict), R(9), U8(18),
B(JumpIfTrue), U8(104),
B(JumpIfTrue), U8(90),
B(LdaNamedProperty), R(7), U8(8), U8(19),
B(Star), R(11),
B(TestUndetectable),
B(JumpIfFalse), U8(4),
B(Jump), U8(93),
B(Jump), U8(79),
B(LdaSmi), I8(1),
B(TestEqualStrict), R(9), U8(21),
B(JumpIfFalse), U8(61),
B(JumpIfFalse), U8(47),
B(Ldar), R(11),
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
@ -590,16 +569,10 @@ bytecodes: [
B(Mov), R(11), R(17),
B(Mov), R(7), R(18),
B(InvokeIntrinsic), U8(Runtime::k_Call), R(17), U8(2),
B(Jump), U8(20),
B(Star), R(17),
B(Ldar), R(closure),
B(CreateCatchContext), R(17), U8(6), U8(10),
B(Star), R(16),
B(Jump), U8(6),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(16),
B(PushContext), R(17),
B(PopContext), R(17),
B(Jump), U8(27),
B(Mov), R(11), R(16),
B(Mov), R(7), R(17),
@ -630,7 +603,6 @@ constant pool: [
FIXED_ARRAY_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE,
]
handlers: [
[7, 162, 170],
@ -647,7 +619,7 @@ snippet: "
"
frame size: 19
parameter count: 2
bytecode array length: 341
bytecode array length: 327
bytecodes: [
B(Ldar), R(3),
B(JumpIfUndefined), U8(18),
@ -741,15 +713,15 @@ bytecodes: [
B(Star), R(15),
B(LdaZero),
B(TestEqualStrict), R(7), U8(13),
B(JumpIfTrue), U8(104),
B(JumpIfTrue), U8(90),
B(LdaNamedProperty), R(5), U8(9), U8(14),
B(Star), R(9),
B(TestUndetectable),
B(JumpIfFalse), U8(4),
B(Jump), U8(93),
B(Jump), U8(79),
B(LdaSmi), I8(1),
B(TestEqualStrict), R(7), U8(16),
B(JumpIfFalse), U8(61),
B(JumpIfFalse), U8(47),
B(Ldar), R(9),
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
@ -764,16 +736,10 @@ bytecodes: [
B(Mov), R(9), R(17),
B(Mov), R(5), R(18),
B(InvokeIntrinsic), U8(Runtime::k_Call), R(17), U8(2),
B(Jump), U8(20),
B(Star), R(17),
B(Ldar), R(closure),
B(CreateCatchContext), R(17), U8(7), U8(11),
B(Star), R(16),
B(Jump), U8(6),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(16),
B(PushContext), R(17),
B(PopContext), R(17),
B(Jump), U8(27),
B(Mov), R(9), R(16),
B(Mov), R(5), R(17),
@ -805,7 +771,6 @@ constant pool: [
FIXED_ARRAY_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE,
]
handlers: [
[85, 203, 211],
@ -822,7 +787,7 @@ snippet: "
"
frame size: 18
parameter count: 2
bytecode array length: 408
bytecode array length: 394
bytecodes: [
B(Ldar), R(2),
B(JumpIfUndefined), U8(18),
@ -940,15 +905,15 @@ bytecodes: [
B(Star), R(14),
B(LdaZero),
B(TestEqualStrict), R(6), U8(13),
B(JumpIfTrue), U8(104),
B(JumpIfTrue), U8(90),
B(LdaNamedProperty), R(4), U8(13), U8(14),
B(Star), R(8),
B(TestUndetectable),
B(JumpIfFalse), U8(4),
B(Jump), U8(93),
B(Jump), U8(79),
B(LdaSmi), I8(1),
B(TestEqualStrict), R(6), U8(16),
B(JumpIfFalse), U8(61),
B(JumpIfFalse), U8(47),
B(Ldar), R(8),
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
@ -963,16 +928,10 @@ bytecodes: [
B(Mov), R(8), R(16),
B(Mov), R(4), R(17),
B(InvokeIntrinsic), U8(Runtime::k_Call), R(16), U8(2),
B(Jump), U8(20),
B(Star), R(16),
B(Ldar), R(closure),
B(CreateCatchContext), R(16), U8(11), U8(15),
B(Star), R(15),
B(Jump), U8(6),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(15),
B(PushContext), R(16),
B(PopContext), R(16),
B(Jump), U8(27),
B(Mov), R(8), R(15),
B(Mov), R(4), R(16),
@ -985,7 +944,7 @@ bytecodes: [
B(Ldar), R(14),
B(SetPendingMessage),
B(Ldar), R(12),
B(SwitchOnSmiNoFeedback), U8(16), U8(2), I8(0),
B(SwitchOnSmiNoFeedback), U8(15), U8(2), I8(0),
B(Jump), U8(8),
B(Ldar), R(13),
/* 49 S> */ B(Return),
@ -1010,7 +969,6 @@ constant pool: [
FIXED_ARRAY_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE,
Smi [6],
Smi [9],
]
@ -1029,7 +987,7 @@ snippet: "
"
frame size: 23
parameter count: 2
bytecode array length: 386
bytecode array length: 372
bytecodes: [
B(CreateFunctionContext), U8(1),
B(PushContext), R(12),
@ -1103,15 +1061,15 @@ bytecodes: [
B(Star), R(19),
B(LdaZero),
B(TestEqualStrict), R(7), U8(13),
B(JumpIfTrue), U8(104),
B(JumpIfTrue), U8(90),
B(LdaNamedProperty), R(5), U8(6), U8(14),
B(Star), R(9),
B(TestUndetectable),
B(JumpIfFalse), U8(4),
B(Jump), U8(93),
B(Jump), U8(79),
B(LdaSmi), I8(1),
B(TestEqualStrict), R(7), U8(16),
B(JumpIfFalse), U8(61),
B(JumpIfFalse), U8(47),
B(Ldar), R(9),
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
@ -1126,16 +1084,10 @@ bytecodes: [
B(Mov), R(9), R(21),
B(Mov), R(5), R(22),
B(InvokeIntrinsic), U8(Runtime::k_Call), R(21), U8(2),
B(Jump), U8(20),
B(Star), R(21),
B(Ldar), R(closure),
B(CreateCatchContext), R(21), U8(4), U8(8),
B(Star), R(20),
B(Jump), U8(6),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(20),
B(PushContext), R(21),
B(PopContext), R(21),
B(Jump), U8(27),
B(Mov), R(9), R(20),
B(Mov), R(5), R(21),
@ -1163,7 +1115,7 @@ bytecodes: [
B(Jump), U8(42),
B(Star), R(17),
B(Ldar), R(closure),
B(CreateCatchContext), R(17), U8(4), U8(9),
B(CreateCatchContext), R(17), U8(4), U8(8),
B(Star), R(16),
B(LdaTheHole),
B(SetPendingMessage),
@ -1194,7 +1146,7 @@ bytecodes: [
B(Ldar), R(15),
B(SetPendingMessage),
B(Ldar), R(13),
B(SwitchOnSmiNoFeedback), U8(10), U8(2), I8(0),
B(SwitchOnSmiNoFeedback), U8(9), U8(2), I8(0),
B(Jump), U8(8),
B(Ldar), R(14),
/* 60 S> */ B(Return),
@ -1213,13 +1165,12 @@ constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE,
FIXED_ARRAY_TYPE,
Smi [6],
Smi [9],
]
handlers: [
[18, 345, 353],
[21, 303, 305],
[18, 331, 339],
[21, 289, 291],
[27, 149, 157],
[30, 109, 111],
[217, 227, 229],
@ -1234,7 +1185,7 @@ snippet: "
"
frame size: 24
parameter count: 2
bytecode array length: 480
bytecode array length: 466
bytecodes: [
B(Ldar), R(2),
B(JumpIfUndefined), U8(18),
@ -1345,15 +1296,15 @@ bytecodes: [
B(Star), R(19),
B(LdaZero),
B(TestEqualStrict), R(6), U8(13),
B(JumpIfTrue), U8(104),
B(JumpIfTrue), U8(90),
B(LdaNamedProperty), R(4), U8(8), U8(14),
B(Star), R(8),
B(TestUndetectable),
B(JumpIfFalse), U8(4),
B(Jump), U8(93),
B(Jump), U8(79),
B(LdaSmi), I8(1),
B(TestEqualStrict), R(6), U8(16),
B(JumpIfFalse), U8(61),
B(JumpIfFalse), U8(47),
B(Ldar), R(8),
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
@ -1368,16 +1319,10 @@ bytecodes: [
B(Mov), R(8), R(21),
B(Mov), R(4), R(22),
B(InvokeIntrinsic), U8(Runtime::k_Call), R(21), U8(2),
B(Jump), U8(20),
B(Star), R(21),
B(Ldar), R(closure),
B(CreateCatchContext), R(21), U8(6), U8(10),
B(Star), R(20),
B(Jump), U8(6),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(20),
B(PushContext), R(21),
B(PopContext), R(21),
B(Jump), U8(27),
B(Mov), R(8), R(20),
B(Mov), R(4), R(21),
@ -1405,7 +1350,7 @@ bytecodes: [
B(Jump), U8(42),
B(Star), R(17),
B(Ldar), R(closure),
B(CreateCatchContext), R(17), U8(6), U8(11),
B(CreateCatchContext), R(17), U8(6), U8(10),
B(Star), R(16),
B(LdaTheHole),
B(SetPendingMessage),
@ -1436,7 +1381,7 @@ bytecodes: [
B(Ldar), R(15),
B(SetPendingMessage),
B(Ldar), R(13),
B(SwitchOnSmiNoFeedback), U8(12), U8(2), I8(0),
B(SwitchOnSmiNoFeedback), U8(11), U8(2), I8(0),
B(Jump), U8(8),
B(Ldar), R(14),
/* 54 S> */ B(Return),
@ -1457,13 +1402,12 @@ constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE,
FIXED_ARRAY_TYPE,
Smi [6],
Smi [9],
]
handlers: [
[54, 439, 447],
[57, 397, 399],
[54, 425, 433],
[57, 383, 385],
[63, 243, 251],
[66, 203, 205],
[311, 321, 323],

View File

@ -130,7 +130,7 @@ snippet: "
"
frame size: 17
parameter count: 1
bytecode array length: 402
bytecode array length: 388
bytecodes: [
B(Ldar), R(2),
B(JumpIfUndefined), U8(18),
@ -244,15 +244,15 @@ bytecodes: [
B(Star), R(13),
B(LdaZero),
B(TestEqualStrict), R(6), U8(14),
B(JumpIfTrue), U8(104),
B(JumpIfTrue), U8(90),
B(LdaNamedProperty), R(4), U8(14), U8(15),
B(Star), R(8),
B(TestUndetectable),
B(JumpIfFalse), U8(4),
B(Jump), U8(93),
B(Jump), U8(79),
B(LdaSmi), I8(1),
B(TestEqualStrict), R(6), U8(17),
B(JumpIfFalse), U8(61),
B(JumpIfFalse), U8(47),
B(Ldar), R(8),
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
@ -267,16 +267,10 @@ bytecodes: [
B(Mov), R(8), R(15),
B(Mov), R(4), R(16),
B(InvokeIntrinsic), U8(Runtime::k_Call), R(15), U8(2),
B(Jump), U8(20),
B(Star), R(15),
B(Ldar), R(closure),
B(CreateCatchContext), R(15), U8(12), U8(16),
B(Star), R(14),
B(Jump), U8(6),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(14),
B(PushContext), R(15),
B(PopContext), R(15),
B(Jump), U8(27),
B(Mov), R(8), R(14),
B(Mov), R(4), R(15),
@ -289,7 +283,7 @@ bytecodes: [
B(Ldar), R(13),
B(SetPendingMessage),
B(Ldar), R(11),
B(SwitchOnSmiNoFeedback), U8(17), U8(2), I8(0),
B(SwitchOnSmiNoFeedback), U8(16), U8(2), I8(0),
B(Jump), U8(8),
B(Ldar), R(12),
/* 44 S> */ B(Return),
@ -315,7 +309,6 @@ constant pool: [
FIXED_ARRAY_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE,
Smi [6],
Smi [9],
]

View File

@ -1319,6 +1319,8 @@ enum ParserFlag {
kAllowHarmonyDynamicImport,
kAllowHarmonyAsyncIteration,
kAllowHarmonyImportMeta,
kAllowHarmonyDoExpressions,
kAllowHarmonyOptionalCatchBinding,
};
enum ParserSyncTestResult {
@ -1335,6 +1337,9 @@ void SetGlobalFlags(i::EnumSet<ParserFlag> flags) {
i::FLAG_harmony_dynamic_import = flags.Contains(kAllowHarmonyDynamicImport);
i::FLAG_harmony_import_meta = flags.Contains(kAllowHarmonyImportMeta);
i::FLAG_harmony_async_iteration = flags.Contains(kAllowHarmonyAsyncIteration);
i::FLAG_harmony_do_expressions = flags.Contains(kAllowHarmonyDoExpressions);
i::FLAG_harmony_optional_catch_binding =
flags.Contains(kAllowHarmonyOptionalCatchBinding);
}
void SetParserFlags(i::PreParser* parser, i::EnumSet<ParserFlag> flags) {
@ -1351,6 +1356,10 @@ void SetParserFlags(i::PreParser* parser, i::EnumSet<ParserFlag> flags) {
flags.Contains(kAllowHarmonyImportMeta));
parser->set_allow_harmony_async_iteration(
flags.Contains(kAllowHarmonyAsyncIteration));
parser->set_allow_harmony_do_expressions(
flags.Contains(kAllowHarmonyDoExpressions));
parser->set_allow_harmony_optional_catch_binding(
flags.Contains(kAllowHarmonyOptionalCatchBinding));
}
void TestParserSyncWithFlags(i::Handle<i::String> source,
@ -2448,6 +2457,66 @@ TEST(NoErrorsTryCatchFinally) {
RunParserSyncTest(context_data, statement_data, kSuccess);
}
TEST(OptionalCatchBinding) {
// clang-format off
const char* context_data[][2] = {
{"", ""},
{"'use strict';", ""},
{"try {", "} catch (e) { }"},
{"try {} catch (e) {", "}"},
{"try {", "} catch ({e}) { }"},
{"try {} catch ({e}) {", "}"},
{"function f() {", "}"},
{ NULL, NULL }
};
const char* statement_data[] = {
"try { } catch { }",
"try { } catch { } finally { }",
"try { let e; } catch { let e; }",
"try { let e; } catch { let e; } finally { let e; }",
NULL
};
// clang-format on
// No error with flag
static const ParserFlag flags[] = {kAllowHarmonyOptionalCatchBinding};
RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0, flags,
arraysize(flags));
// Still an error without flag
RunParserSyncTest(context_data, statement_data, kError);
}
TEST(OptionalCatchBindingInDoExpression) {
// This is an edge case no otherwise hit: a catch scope in a parameter
// expression which needs its own scope.
// clang-format off
const char* context_data[][2] = {
{"((x = (eval(''), do {", "}))=>{})()"},
{ NULL, NULL }
};
const char* statement_data[] = {
"try { } catch { }",
"try { } catch { } finally { }",
"try { let e; } catch { let e; }",
"try { let e; } catch { let e; } finally { let e; }",
NULL
};
// clang-format on
// No error with flag
static const ParserFlag do_and_catch_flags[] = {
kAllowHarmonyDoExpressions, kAllowHarmonyOptionalCatchBinding};
RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
do_and_catch_flags, arraysize(do_and_catch_flags));
// Still an error without flag
static const ParserFlag do_flag[] = {kAllowHarmonyDoExpressions};
RunParserSyncTest(context_data, statement_data, kError, NULL, 0, do_flag,
arraysize(do_flag));
}
TEST(ErrorsRegexpLiteral) {
const char* context_data[][2] = {{"var r = ", ""}, {nullptr, nullptr}};
@ -3433,81 +3502,81 @@ TEST(MaybeAssignedInsideLoop) {
{1, "for (j of x) { [foo] = [j] }", top},
{1, "for (j of x) { var foo = j }", top},
{1, "for (j of x) { var [foo] = [j] }", top},
{0, "for (j of x) { let foo = j }", {2}},
{0, "for (j of x) { let [foo] = [j] }", {2}},
{0, "for (j of x) { const foo = j }", {2}},
{0, "for (j of x) { const [foo] = [j] }", {2}},
{0, "for (j of x) { function foo() {return j} }", {2}},
{0, "for (j of x) { let foo = j }", {1}},
{0, "for (j of x) { let [foo] = [j] }", {1}},
{0, "for (j of x) { const foo = j }", {1}},
{0, "for (j of x) { const [foo] = [j] }", {1}},
{0, "for (j of x) { function foo() {return j} }", {1}},
{1, "for ({j} of x) { foo = j }", top},
{1, "for ({j} of x) { [foo] = [j] }", top},
{1, "for ({j} of x) { var foo = j }", top},
{1, "for ({j} of x) { var [foo] = [j] }", top},
{0, "for ({j} of x) { let foo = j }", {2}},
{0, "for ({j} of x) { let [foo] = [j] }", {2}},
{0, "for ({j} of x) { const foo = j }", {2}},
{0, "for ({j} of x) { const [foo] = [j] }", {2}},
{0, "for ({j} of x) { function foo() {return j} }", {2}},
{0, "for ({j} of x) { let foo = j }", {1}},
{0, "for ({j} of x) { let [foo] = [j] }", {1}},
{0, "for ({j} of x) { const foo = j }", {1}},
{0, "for ({j} of x) { const [foo] = [j] }", {1}},
{0, "for ({j} of x) { function foo() {return j} }", {1}},
{1, "for (var j of x) { foo = j }", top},
{1, "for (var j of x) { [foo] = [j] }", top},
{1, "for (var j of x) { var foo = j }", top},
{1, "for (var j of x) { var [foo] = [j] }", top},
{0, "for (var j of x) { let foo = j }", {2}},
{0, "for (var j of x) { let [foo] = [j] }", {2}},
{0, "for (var j of x) { const foo = j }", {2}},
{0, "for (var j of x) { const [foo] = [j] }", {2}},
{0, "for (var j of x) { function foo() {return j} }", {2}},
{0, "for (var j of x) { let foo = j }", {1}},
{0, "for (var j of x) { let [foo] = [j] }", {1}},
{0, "for (var j of x) { const foo = j }", {1}},
{0, "for (var j of x) { const [foo] = [j] }", {1}},
{0, "for (var j of x) { function foo() {return j} }", {1}},
{1, "for (var {j} of x) { foo = j }", top},
{1, "for (var {j} of x) { [foo] = [j] }", top},
{1, "for (var {j} of x) { var foo = j }", top},
{1, "for (var {j} of x) { var [foo] = [j] }", top},
{0, "for (var {j} of x) { let foo = j }", {2}},
{0, "for (var {j} of x) { let [foo] = [j] }", {2}},
{0, "for (var {j} of x) { const foo = j }", {2}},
{0, "for (var {j} of x) { const [foo] = [j] }", {2}},
{0, "for (var {j} of x) { function foo() {return j} }", {2}},
{0, "for (var {j} of x) { let foo = j }", {1}},
{0, "for (var {j} of x) { let [foo] = [j] }", {1}},
{0, "for (var {j} of x) { const foo = j }", {1}},
{0, "for (var {j} of x) { const [foo] = [j] }", {1}},
{0, "for (var {j} of x) { function foo() {return j} }", {1}},
{1, "for (let j of x) { foo = j }", top},
{1, "for (let j of x) { [foo] = [j] }", top},
{1, "for (let j of x) { var foo = j }", top},
{1, "for (let j of x) { var [foo] = [j] }", top},
{0, "for (let j of x) { let foo = j }", {0, 2, 0}},
{0, "for (let j of x) { let [foo] = [j] }", {0, 2, 0}},
{0, "for (let j of x) { const foo = j }", {0, 2, 0}},
{0, "for (let j of x) { const [foo] = [j] }", {0, 2, 0}},
{0, "for (let j of x) { function foo() {return j} }", {0, 2, 0}},
{0, "for (let j of x) { let foo = j }", {0, 1, 0}},
{0, "for (let j of x) { let [foo] = [j] }", {0, 1, 0}},
{0, "for (let j of x) { const foo = j }", {0, 1, 0}},
{0, "for (let j of x) { const [foo] = [j] }", {0, 1, 0}},
{0, "for (let j of x) { function foo() {return j} }", {0, 1, 0}},
{1, "for (let {j} of x) { foo = j }", top},
{1, "for (let {j} of x) { [foo] = [j] }", top},
{1, "for (let {j} of x) { var foo = j }", top},
{1, "for (let {j} of x) { var [foo] = [j] }", top},
{0, "for (let {j} of x) { let foo = j }", {0, 2, 0}},
{0, "for (let {j} of x) { let [foo] = [j] }", {0, 2, 0}},
{0, "for (let {j} of x) { const foo = j }", {0, 2, 0}},
{0, "for (let {j} of x) { const [foo] = [j] }", {0, 2, 0}},
{0, "for (let {j} of x) { function foo() {return j} }", {0, 2, 0}},
{0, "for (let {j} of x) { let foo = j }", {0, 1, 0}},
{0, "for (let {j} of x) { let [foo] = [j] }", {0, 1, 0}},
{0, "for (let {j} of x) { const foo = j }", {0, 1, 0}},
{0, "for (let {j} of x) { const [foo] = [j] }", {0, 1, 0}},
{0, "for (let {j} of x) { function foo() {return j} }", {0, 1, 0}},
{1, "for (const j of x) { foo = j }", top},
{1, "for (const j of x) { [foo] = [j] }", top},
{1, "for (const j of x) { var foo = j }", top},
{1, "for (const j of x) { var [foo] = [j] }", top},
{0, "for (const j of x) { let foo = j }", {0, 2, 0}},
{0, "for (const j of x) { let [foo] = [j] }", {0, 2, 0}},
{0, "for (const j of x) { const foo = j }", {0, 2, 0}},
{0, "for (const j of x) { const [foo] = [j] }", {0, 2, 0}},
{0, "for (const j of x) { function foo() {return j} }", {0, 2, 0}},
{0, "for (const j of x) { let foo = j }", {0, 1, 0}},
{0, "for (const j of x) { let [foo] = [j] }", {0, 1, 0}},
{0, "for (const j of x) { const foo = j }", {0, 1, 0}},
{0, "for (const j of x) { const [foo] = [j] }", {0, 1, 0}},
{0, "for (const j of x) { function foo() {return j} }", {0, 1, 0}},
{1, "for (const {j} of x) { foo = j }", top},
{1, "for (const {j} of x) { [foo] = [j] }", top},
{1, "for (const {j} of x) { var foo = j }", top},
{1, "for (const {j} of x) { var [foo] = [j] }", top},
{0, "for (const {j} of x) { let foo = j }", {0, 2, 0}},
{0, "for (const {j} of x) { let [foo] = [j] }", {0, 2, 0}},
{0, "for (const {j} of x) { const foo = j }", {0, 2, 0}},
{0, "for (const {j} of x) { const [foo] = [j] }", {0, 2, 0}},
{0, "for (const {j} of x) { function foo() {return j} }", {0, 2, 0}},
{0, "for (const {j} of x) { let foo = j }", {0, 1, 0}},
{0, "for (const {j} of x) { let [foo] = [j] }", {0, 1, 0}},
{0, "for (const {j} of x) { const foo = j }", {0, 1, 0}},
{0, "for (const {j} of x) { const [foo] = [j] }", {0, 1, 0}},
{0, "for (const {j} of x) { function foo() {return j} }", {0, 1, 0}},
{1, "for (j in x) { foo = j }", top},
{1, "for (j in x) { [foo] = [j] }", top},

View File

@ -1382,10 +1382,11 @@ TEST(CodeSerializerLargeCodeObject) {
// code. Don't even bother generating optimized code to avoid timeouts.
FLAG_always_opt = false;
Vector<const uint8_t> source =
ConstructSource(STATIC_CHAR_VECTOR("var j=1; if (j == 0) {"),
STATIC_CHAR_VECTOR("for (let i of Object.prototype);"),
STATIC_CHAR_VECTOR("} j=7; j"), 1100);
Vector<const uint8_t> source = ConstructSource(
STATIC_CHAR_VECTOR("var j=1; if (j == 0) {"),
STATIC_CHAR_VECTOR(
"for (let i of Object.prototype) for (let k = 0; k < 0; ++k);"),
STATIC_CHAR_VECTOR("} j=7; j"), 1100);
Handle<String> source_str =
isolate->factory()->NewStringFromOneByte(source).ToHandleChecked();

View File

@ -0,0 +1,65 @@
// Copyright 2017 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.
// Flags: --harmony-optional-catch-binding
let state = 'initial';
x: try {
throw new Error('caught');
state = 'unreachable';
} catch {
assertEquals(state, 'initial');
state = 'caught';
break x;
state = 'unreachable';
}
assertEquals(state, 'caught');
state = 'initial';
x: try {
throw new Error('caught');
state = 'unreachable';
} catch {
assertEquals(state, 'initial');
state = 'caught';
break x;
state = 'unreachable';
} finally {
assertEquals(state, 'caught');
state = 'finally';
}
assertEquals(state, 'finally');
state = 'initial';
x: {
y: try {
throw new Error('caught');
state = 'unreachable';
} catch {
assertEquals(state, 'initial');
state = 'caught';
break x;
state = 'unreachable';
} finally {
assertEquals(state, 'caught');
state = 'finally';
break y;
state = 'unreachable';
}
assertEquals(state, 'finally');
state = 'after block';
}
assertEquals(state, 'after block');
do {
try {
throw new Error();
} catch {
break;
}
assertUnreachable();
} while(false);

View File

@ -0,0 +1,39 @@
// Copyright 2017 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.
// Flags: --harmony-optional-catch-binding
let state = 'initial';
try {
throw new Error('caught');
state = 'unreachable';
} catch { // Note the lack of a binding
assertEquals(state, 'initial');
state = 'caught';
}
assertEquals(state, 'caught');
let sigil1 = {};
try {
throw sigil1;
} catch (e) {
assertEquals(e, sigil1);
}
let sigil2 = {};
let reached = false;
try {
try {
throw sigil1;
} catch {
reached = true;
} finally {
throw sigil2;
}
} catch (e) {
assertEquals(e, sigil2);
}
assertTrue(reached);

View File

@ -49,9 +49,10 @@ FEATURE_FLAGS = {
'regexp-unicode-property-escapes': '--harmony-regexp-property',
'Promise.prototype.finally': '--harmony-promise-finally',
'class-fields-public': '--harmony-class-fields',
'optional-catch-binding': '--harmony-optional-catch-binding',
}
SKIPPED_FEATURES = set(['class-fields-private', 'optional-catch-binding'])
SKIPPED_FEATURES = set(['class-fields-private'])
DATA = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data")
ARCHIVE = DATA + ".tar"