From 5558a50878f04b1aaf711a91880baef5b9c841cf Mon Sep 17 00:00:00 2001 From: verwaest Date: Thu, 25 Aug 2016 12:11:19 -0700 Subject: [PATCH] Merge DeclarationScope::temps_ and Scope::ordered_variables_ into Scope::locals_ BUG=v8:5209 Review-Url: https://codereview.chromium.org/2272083003 Cr-Commit-Position: refs/heads/master@{#38920} --- src/ast/scopes.cc | 118 ++++----- src/ast/scopes.h | 21 +- .../bytecode_expectations/DoExpression.golden | 6 +- .../bytecode_expectations/ForIn.golden | 16 +- .../bytecode_expectations/ForOf.golden | 230 +++++++++--------- .../bytecode_expectations/Switch.golden | 200 +++++++-------- .../default-parameter-do-expression.js | 21 ++ 7 files changed, 307 insertions(+), 305 deletions(-) create mode 100644 test/mjsunit/harmony/default-parameter-do-expression.js diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc index 18b21f97e3..34eeae9dcf 100644 --- a/src/ast/scopes.cc +++ b/src/ast/scopes.cc @@ -41,13 +41,27 @@ Variable* VariableMap::Declare(Zone* zone, Scope* scope, if (added) *added = p->value == nullptr; if (p->value == nullptr) { // The variable has not been declared yet -> insert it. - DCHECK(p->key == name); + DCHECK_EQ(name, p->key); p->value = new (zone) Variable(scope, name, mode, kind, initialization_flag, maybe_assigned_flag); } return reinterpret_cast(p->value); } +void VariableMap::Remove(Variable* var) { + const AstRawString* name = var->raw_name(); + ZoneHashMap::Remove(const_cast(name), name->hash()); +} + +void VariableMap::Add(Zone* zone, Variable* var) { + const AstRawString* name = var->raw_name(); + Entry* p = + ZoneHashMap::LookupOrInsert(const_cast(name), name->hash(), + ZoneAllocationPolicy(zone)); + DCHECK_NULL(p->value); + DCHECK_EQ(name, p->key); + p->value = var; +} Variable* VariableMap::Lookup(const AstRawString* name) { Entry* p = ZoneHashMap::Lookup(const_cast(name), name->hash()); @@ -81,7 +95,7 @@ Scope::Scope(Zone* zone, ScopeType scope_type) : zone_(zone), outer_scope_(nullptr), variables_(zone), - ordered_variables_(4, zone), + locals_(4, zone), decls_(4, zone), scope_type_(scope_type) { DCHECK(scope_type == SCRIPT_SCOPE || scope_type == WITH_SCOPE); @@ -97,7 +111,7 @@ Scope::Scope(Zone* zone, Scope* outer_scope, ScopeType scope_type) : zone_(zone), outer_scope_(outer_scope), variables_(zone), - ordered_variables_(4, zone), + locals_(4, zone), decls_(4, zone), scope_type_(scope_type) { DCHECK_NE(SCRIPT_SCOPE, scope_type); @@ -112,12 +126,12 @@ Scope::Snapshot::Snapshot(Scope* scope) : outer_scope_(scope), top_inner_scope_(scope->inner_scope_), top_unresolved_(scope->unresolved_), - top_temp_(scope->GetClosureScope()->temps()->length()) {} + top_local_(scope->GetClosureScope()->locals_.length()), + top_decl_(scope->GetClosureScope()->decls_.length()) {} DeclarationScope::DeclarationScope(Zone* zone) : Scope(zone), function_kind_(kNormalFunction), - temps_(4, zone), params_(4, zone), sloppy_block_function_map_(zone) { SetDefaults(); @@ -128,7 +142,6 @@ DeclarationScope::DeclarationScope(Zone* zone, Scope* outer_scope, FunctionKind function_kind) : Scope(zone, outer_scope, scope_type), function_kind_(function_kind), - temps_(4, zone), params_(4, zone), sloppy_block_function_map_(zone) { SetDefaults(); @@ -147,7 +160,7 @@ Scope::Scope(Zone* zone, ScopeType scope_type, Handle scope_info) : zone_(zone), outer_scope_(nullptr), variables_(zone), - ordered_variables_(0, zone), + locals_(0, zone), decls_(0, zone), scope_info_(scope_info), scope_type_(scope_type) { @@ -166,7 +179,6 @@ DeclarationScope::DeclarationScope(Zone* zone, ScopeType scope_type, Handle scope_info) : Scope(zone, scope_type, scope_info), function_kind_(scope_info->function_kind()), - temps_(0, zone), params_(0, zone), sloppy_block_function_map_(zone) { SetDefaults(); @@ -176,7 +188,7 @@ Scope::Scope(Zone* zone, const AstRawString* catch_variable_name) : zone_(zone), outer_scope_(nullptr), variables_(zone), - ordered_variables_(0, zone), + locals_(0, zone), decls_(0, zone), scope_type_(CATCH_SCOPE) { SetDefaults(); @@ -530,7 +542,7 @@ void Scope::Snapshot::Reparent(DeclarationScope* new_parent) const { DCHECK_EQ(new_parent, new_parent->GetClosureScope()); DCHECK_NULL(new_parent->inner_scope_); DCHECK_NULL(new_parent->unresolved_); - DCHECK_EQ(0, new_parent->temps()->length()); + DCHECK_EQ(0, new_parent->locals_.length()); Scope* inner_scope = new_parent->sibling_; if (inner_scope != top_inner_scope_) { for (; inner_scope->sibling() != top_inner_scope_; @@ -557,17 +569,25 @@ void Scope::Snapshot::Reparent(DeclarationScope* new_parent) const { outer_scope_->unresolved_ = top_unresolved_; } - if (outer_scope_->GetClosureScope()->temps()->length() != top_temp_) { - ZoneList* temps = outer_scope_->GetClosureScope()->temps(); - for (int i = top_temp_; i < temps->length(); i++) { - Variable* temp = temps->at(i); - DCHECK_EQ(temp->scope(), temp->scope()->GetClosureScope()); - DCHECK_NE(temp->scope(), new_parent); - temp->set_scope(new_parent); - new_parent->AddTemporary(temp); + // TODO(verwaest): This currently only moves do-expression declared variables + // in default arguments that weren't already previously declared with the same + // name in the closure-scope. See + // test/mjsunit/harmony/default-parameter-do-expression.js. + DeclarationScope* outer_closure = outer_scope_->GetClosureScope(); + for (int i = top_local_; i < outer_closure->locals_.length(); i++) { + Variable* local = outer_closure->locals_.at(i); + DCHECK(local->mode() == TEMPORARY || local->mode() == VAR); + DCHECK_EQ(local->scope(), local->scope()->GetClosureScope()); + DCHECK_NE(local->scope(), new_parent); + local->set_scope(new_parent); + new_parent->AddLocal(local); + if (local->mode() == VAR) { + outer_closure->variables_.Remove(local); + new_parent->variables_.Add(new_parent->zone(), local); } - temps->Rewind(top_temp_); } + outer_closure->locals_.Rewind(top_local_); + outer_closure->decls_.Rewind(top_decl_); } void Scope::ReplaceOuterScope(Scope* outer) { @@ -744,7 +764,7 @@ Variable* Scope::NewTemporary(const AstRawString* name) { TEMPORARY, Variable::NORMAL, kCreatedInitialized); - scope->AddTemporary(var); + scope->AddLocal(var); return var; } @@ -806,31 +826,13 @@ Declaration* Scope::CheckLexDeclarationsConflictingWith( void Scope::CollectStackAndContextLocals(ZoneList* stack_locals, ZoneList* context_locals, ZoneList* context_globals) { - DCHECK(stack_locals != NULL); - DCHECK(context_locals != NULL); - DCHECK(context_globals != NULL); + // TODO(verwaest): Just pass out locals_ directly and walk it? + DCHECK_NOT_NULL(stack_locals); + DCHECK_NOT_NULL(context_locals); + DCHECK_NOT_NULL(context_globals); - // Collect temporaries which are always allocated on the stack, unless the - // context as a whole has forced context allocation. - if (is_declaration_scope()) { - ZoneList* temps = AsDeclarationScope()->temps(); - for (int i = 0; i < temps->length(); i++) { - Variable* var = (*temps)[i]; - if (var->is_used()) { - if (var->IsContextSlot()) { - DCHECK(has_forced_context_allocation()); - context_locals->Add(var, zone()); - } else if (var->IsStackLocal()) { - stack_locals->Add(var, zone()); - } else { - DCHECK(var->IsParameter()); - } - } - } - } - - for (int i = 0; i < ordered_variables_.length(); i++) { - Variable* var = ordered_variables_[i]; + for (int i = 0; i < locals_.length(); i++) { + Variable* var = locals_[i]; if (var->IsStackLocal()) { stack_locals->Add(var, zone()); } else if (var->IsContextSlot()) { @@ -1157,18 +1159,6 @@ void Scope::Print(int n) { PrintVar(n1, function); } - if (is_declaration_scope()) { - bool printed_header = false; - ZoneList* temps = AsDeclarationScope()->temps(); - for (int i = 0; i < temps->length(); i++) { - if (!printed_header) { - printed_header = true; - Indent(n1, "// temporary vars:\n"); - } - PrintVar(n1, (*temps)[i]); - } - } - if (variables_.Start() != NULL) { Indent(n1, "// local vars:\n"); PrintMap(n1, &variables_, true); @@ -1550,21 +1540,13 @@ void Scope::AllocateDeclaredGlobal(Variable* var) { } void Scope::AllocateNonParameterLocalsAndDeclaredGlobals() { - // All variables that have no rewrite yet are non-parameter locals. - if (is_declaration_scope()) { - ZoneList* temps = AsDeclarationScope()->temps(); - for (int i = 0; i < temps->length(); i++) { - AllocateNonParameterLocal((*temps)[i]); - } - } - - for (int i = 0; i < ordered_variables_.length(); i++) { - AllocateNonParameterLocal(ordered_variables_[i]); + for (int i = 0; i < locals_.length(); i++) { + AllocateNonParameterLocal(locals_[i]); } if (FLAG_global_var_shortcuts) { - for (int i = 0; i < ordered_variables_.length(); i++) { - AllocateDeclaredGlobal(ordered_variables_[i]); + for (int i = 0; i < locals_.length(); i++) { + AllocateDeclaredGlobal(locals_[i]); } } diff --git a/src/ast/scopes.h b/src/ast/scopes.h index c90a1754d9..b330ed14cc 100644 --- a/src/ast/scopes.h +++ b/src/ast/scopes.h @@ -27,6 +27,8 @@ class VariableMap: public ZoneHashMap { bool* added = nullptr); Variable* Lookup(const AstRawString* name); + void Remove(Variable* var); + void Add(Zone* zone, Variable* var); }; @@ -84,7 +86,8 @@ class Scope: public ZoneObject { Scope* outer_scope_; Scope* top_inner_scope_; VariableProxy* top_unresolved_; - int top_temp_; + int top_local_; + int top_decl_; }; // Compute top scope and allocate variables. For lazy compilation the top @@ -437,7 +440,7 @@ class Scope: public ZoneObject { Variable* var = variables_.Declare(zone, scope, name, mode, kind, initialization_flag, maybe_assigned_flag, &added); - if (added) ordered_variables_.Add(var, zone); + if (added) locals_.Add(var, zone); return var; } Zone* zone_; @@ -456,7 +459,7 @@ class Scope: public ZoneObject { // In case of non-scopeinfo-backed scopes, this contains the variables of the // map above in order of addition. // TODO(verwaest): Thread through Variable. - ZoneList ordered_variables_; + ZoneList locals_; // Unresolved variables referred to from this scope. The proxies themselves // form a linked list of all unresolved proxies. VariableProxy* unresolved_; @@ -729,18 +732,16 @@ class DeclarationScope : public Scope { return this_function_; } - // Adds a temporary variable in this scope's TemporaryScope. This is for - // adjusting the scope of temporaries used when desugaring parameter + // Adds a local variable in this scope's locals list. This is for adjusting + // the scope of temporaries and do-expression vars when desugaring parameter // initializers. - void AddTemporary(Variable* var) { + void AddLocal(Variable* var) { DCHECK(!already_resolved_); // Temporaries are only placed in ClosureScopes. DCHECK_EQ(GetClosureScope(), this); - temps_.Add(var, zone()); + locals_.Add(var, zone()); } - ZoneList* temps() { return &temps_; } - void DeclareSloppyBlockFunction(const AstRawString* name, SloppyBlockFunctionStatement* statement) { sloppy_block_function_map_.Declare(zone(), name, statement); @@ -817,8 +818,6 @@ class DeclarationScope : public Scope { // Info about the parameter list of a function. int arity_; - // Compiler-allocated (user-invisible) temporaries. - ZoneList temps_; // Parameter list in source order. ZoneList params_; // Map of function names to lists of functions defined in sloppy blocks diff --git a/test/cctest/interpreter/bytecode_expectations/DoExpression.golden b/test/cctest/interpreter/bytecode_expectations/DoExpression.golden index e04e131928..9296aba825 100644 --- a/test/cctest/interpreter/bytecode_expectations/DoExpression.golden +++ b/test/cctest/interpreter/bytecode_expectations/DoExpression.golden @@ -59,10 +59,10 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 34 E> */ B(StackCheck), /* 56 S> */ B(LdaSmi), U8(10), - B(Star), R(1), - /* 69 S> */ B(Inc), U8(1), - B(Star), R(1), B(Star), R(0), + /* 69 S> */ B(Inc), U8(1), + B(Star), R(0), + B(Star), R(1), /* 74 S> */ B(Jump), U8(2), B(LdaUndefined), /* 94 S> */ B(Return), diff --git a/test/cctest/interpreter/bytecode_expectations/ForIn.golden b/test/cctest/interpreter/bytecode_expectations/ForIn.golden index b6a8df8636..e1fa2be0b0 100644 --- a/test/cctest/interpreter/bytecode_expectations/ForIn.golden +++ b/test/cctest/interpreter/bytecode_expectations/ForIn.golden @@ -69,7 +69,7 @@ bytecode array length: 44 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), - B(Star), R(1), + B(Star), R(0), /* 68 S> */ B(JumpIfUndefined), U8(37), B(JumpIfNull), U8(35), B(ToObject), R(3), @@ -80,7 +80,7 @@ bytecodes: [ B(JumpIfTrue), U8(22), B(ForInNext), R(3), R(7), R(4), U8(1), B(JumpIfUndefined), U8(9), - B(Star), R(0), + B(Star), R(1), /* 54 E> */ B(StackCheck), B(Star), R(2), /* 73 S> */ B(Nop), @@ -108,7 +108,7 @@ bytecode array length: 55 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), - B(Star), R(1), + B(Star), R(0), /* 59 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(3), B(JumpIfUndefined), U8(45), B(JumpIfNull), U8(43), @@ -120,13 +120,13 @@ bytecodes: [ B(JumpIfTrue), U8(30), B(ForInNext), R(3), R(7), R(4), U8(2), B(JumpIfUndefined), U8(17), - B(Star), R(0), + B(Star), R(1), /* 45 E> */ B(StackCheck), B(Star), R(2), - /* 70 S> */ B(Ldar), R(0), - /* 75 E> */ B(Add), R(1), U8(1), - B(Mov), R(1), R(8), - B(Star), R(1), + /* 70 S> */ B(Ldar), R(1), + /* 75 E> */ B(Add), R(0), U8(1), + B(Mov), R(0), R(8), + B(Star), R(0), /* 72 E> */ B(ForInStep), R(7), B(Star), R(7), B(Jump), U8(-31), diff --git a/test/cctest/interpreter/bytecode_expectations/ForOf.golden b/test/cctest/interpreter/bytecode_expectations/ForOf.golden index 01121e5017..454ea54c93 100644 --- a/test/cctest/interpreter/bytecode_expectations/ForOf.golden +++ b/test/cctest/interpreter/bytecode_expectations/ForOf.golden @@ -17,7 +17,7 @@ bytecode array length: 268 bytecodes: [ /* 30 E> */ B(StackCheck), B(LdaZero), - B(Star), R(3), + B(Star), R(4), B(Mov), R(context), R(11), B(Mov), R(context), R(12), /* 48 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(3), @@ -25,24 +25,24 @@ bytecodes: [ B(LdaConstant), U8(1), /* 48 E> */ B(LdrKeyedProperty), R(14), U8(3), R(13), /* 48 E> */ B(Call), R(13), R(14), U8(1), U8(1), - B(Star), R(1), - /* 45 S> */ B(LdrNamedProperty), R(1), U8(2), U8(7), R(14), - /* 45 E> */ B(Call), R(14), R(1), U8(1), U8(5), B(Star), R(2), - /* 45 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(2), U8(1), + /* 45 S> */ B(LdrNamedProperty), R(2), U8(2), U8(7), R(14), + /* 45 E> */ B(Call), R(14), R(2), U8(1), U8(5), + B(Star), R(3), + /* 45 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(3), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(2), U8(1), - B(LdaNamedProperty), R(2), U8(3), U8(9), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(3), U8(1), + B(LdaNamedProperty), R(3), U8(3), U8(9), B(JumpIfToBooleanTrue), U8(23), - B(LdrNamedProperty), R(2), U8(4), U8(11), R(4), + B(LdrNamedProperty), R(3), U8(4), U8(11), R(5), B(LdaSmi), U8(2), - B(Star), R(3), - B(Mov), R(4), R(0), + B(Star), R(4), + B(Mov), R(5), R(0), /* 34 E> */ B(StackCheck), - B(Mov), R(0), R(7), + B(Mov), R(0), R(1), B(LdaZero), - B(Star), R(3), + B(Star), R(4), B(Jump), U8(-49), B(Jump), U8(34), B(Star), R(13), @@ -51,10 +51,10 @@ bytecodes: [ B(Star), R(12), B(PushContext), R(8), B(LdaSmi), U8(2), - B(TestEqualStrict), R(3), + B(TestEqualStrict), R(4), B(JumpIfFalse), U8(6), B(LdaSmi), U8(1), - B(Star), R(3), + B(Star), R(4), B(LdrContextSlot), R(context), U8(4), R(13), B(CallRuntime), U16(Runtime::kReThrow), R(13), U8(1), B(PopContext), R(8), @@ -67,20 +67,20 @@ bytecodes: [ B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Star), R(11), B(LdaZero), - B(TestEqualStrict), R(3), + B(TestEqualStrict), R(4), B(JumpIfTrue), U8(116), B(LdaUndefined), - B(TestEqualStrict), R(1), + B(TestEqualStrict), R(2), B(JumpIfTrue), U8(111), - B(LdrNamedProperty), R(1), U8(6), U8(13), R(5), + B(LdrNamedProperty), R(2), U8(6), U8(13), R(6), B(LdaNull), - B(TestEqual), R(5), + B(TestEqual), R(6), B(JumpIfFalse), U8(4), B(Jump), U8(99), B(LdaSmi), U8(1), - B(TestEqualStrict), R(3), + B(TestEqualStrict), R(4), B(JumpIfFalse), U8(68), - B(Ldar), R(5), + B(Ldar), R(6), B(TypeOf), B(Star), R(12), B(LdaConstant), U8(7), @@ -94,8 +94,8 @@ bytecodes: [ B(CallRuntime), U16(Runtime::kNewTypeError), R(12), U8(2), B(Throw), B(Mov), R(context), R(12), - B(Mov), R(5), R(13), - B(Mov), R(1), R(14), + B(Mov), R(6), R(13), + B(Mov), R(2), R(14), B(InvokeIntrinsic), U8(Runtime::k_Call), R(13), U8(2), B(Jump), U8(22), B(Star), R(13), @@ -107,14 +107,14 @@ bytecodes: [ B(PushContext), R(8), B(PopContext), R(8), B(Jump), U8(27), - B(Mov), R(5), R(12), - B(Mov), R(1), R(13), + B(Mov), R(6), R(12), + B(Mov), R(2), R(13), B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2), - B(Star), R(6), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(6), U8(1), + B(Star), R(7), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(7), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1), B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(11), U8(1), B(LdaZero), B(TestEqualStrict), R(9), @@ -153,33 +153,33 @@ bytecode array length: 279 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), - B(Star), R(7), + B(Star), R(0), B(LdaZero), - B(Star), R(3), + B(Star), R(5), B(Mov), R(context), R(12), B(Mov), R(context), R(13), /* 68 S> */ B(LdaConstant), U8(1), - /* 68 E> */ B(LdrKeyedProperty), R(7), U8(3), R(14), - /* 68 E> */ B(Call), R(14), R(7), U8(1), U8(1), - B(Star), R(1), - /* 65 S> */ B(LdrNamedProperty), R(1), U8(2), U8(7), R(15), - /* 65 E> */ B(Call), R(15), R(1), U8(1), U8(5), - B(Star), R(2), - /* 65 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(2), U8(1), + /* 68 E> */ B(LdrKeyedProperty), R(0), U8(3), R(14), + /* 68 E> */ B(Call), R(14), R(0), U8(1), U8(1), + B(Star), R(3), + /* 65 S> */ B(LdrNamedProperty), R(3), U8(2), U8(7), R(15), + /* 65 E> */ B(Call), R(15), R(3), U8(1), U8(5), + B(Star), R(4), + /* 65 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(4), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(2), U8(1), - B(LdaNamedProperty), R(2), U8(3), U8(9), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(4), U8(1), + B(LdaNamedProperty), R(4), U8(3), U8(9), B(JumpIfToBooleanTrue), U8(26), - B(LdrNamedProperty), R(2), U8(4), U8(11), R(4), + B(LdrNamedProperty), R(4), U8(4), U8(11), R(6), B(LdaSmi), U8(2), - B(Star), R(3), - B(Mov), R(4), R(0), + B(Star), R(5), + B(Mov), R(6), R(1), /* 54 E> */ B(StackCheck), - B(Mov), R(0), R(8), + B(Mov), R(1), R(2), /* 73 S> */ B(LdaZero), B(Star), R(10), - B(Mov), R(0), R(11), + B(Mov), R(1), R(11), B(Jump), U8(48), B(Jump), U8(34), B(Star), R(14), @@ -188,10 +188,10 @@ bytecodes: [ B(Star), R(13), B(PushContext), R(9), B(LdaSmi), U8(2), - B(TestEqualStrict), R(3), + B(TestEqualStrict), R(5), B(JumpIfFalse), U8(6), B(LdaSmi), U8(1), - B(Star), R(3), + B(Star), R(5), B(LdrContextSlot), R(context), U8(4), R(14), B(CallRuntime), U16(Runtime::kReThrow), R(14), U8(1), B(PopContext), R(9), @@ -204,20 +204,20 @@ bytecodes: [ B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Star), R(12), B(LdaZero), - B(TestEqualStrict), R(3), + B(TestEqualStrict), R(5), B(JumpIfTrue), U8(116), B(LdaUndefined), - B(TestEqualStrict), R(1), + B(TestEqualStrict), R(3), B(JumpIfTrue), U8(111), - B(LdrNamedProperty), R(1), U8(6), U8(13), R(5), + B(LdrNamedProperty), R(3), U8(6), U8(13), R(7), B(LdaNull), - B(TestEqual), R(5), + B(TestEqual), R(7), B(JumpIfFalse), U8(4), B(Jump), U8(99), B(LdaSmi), U8(1), - B(TestEqualStrict), R(3), + B(TestEqualStrict), R(5), B(JumpIfFalse), U8(68), - B(Ldar), R(5), + B(Ldar), R(7), B(TypeOf), B(Star), R(13), B(LdaConstant), U8(7), @@ -231,8 +231,8 @@ bytecodes: [ B(CallRuntime), U16(Runtime::kNewTypeError), R(13), U8(2), B(Throw), B(Mov), R(context), R(13), - B(Mov), R(5), R(14), - B(Mov), R(1), R(15), + B(Mov), R(7), R(14), + B(Mov), R(3), R(15), B(InvokeIntrinsic), U8(Runtime::k_Call), R(14), U8(2), B(Jump), U8(22), B(Star), R(14), @@ -244,14 +244,14 @@ bytecodes: [ B(PushContext), R(9), B(PopContext), R(9), B(Jump), U8(27), - B(Mov), R(5), R(13), - B(Mov), R(1), R(14), + B(Mov), R(7), R(13), + B(Mov), R(3), R(14), B(InvokeIntrinsic), U8(Runtime::k_Call), R(13), U8(2), - B(Star), R(6), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(6), U8(1), + B(Star), R(8), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(8), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(8), U8(1), B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(12), U8(1), B(LdaZero), B(TestEqualStrict), R(10), @@ -297,7 +297,7 @@ bytecode array length: 284 bytecodes: [ /* 30 E> */ B(StackCheck), B(LdaZero), - B(Star), R(3), + B(Star), R(4), B(Mov), R(context), R(11), B(Mov), R(context), R(12), /* 48 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(3), @@ -305,32 +305,32 @@ bytecodes: [ B(LdaConstant), U8(1), /* 48 E> */ B(LdrKeyedProperty), R(14), U8(3), R(13), /* 48 E> */ B(Call), R(13), R(14), U8(1), U8(1), - B(Star), R(1), - /* 45 S> */ B(LdrNamedProperty), R(1), U8(2), U8(7), R(14), - /* 45 E> */ B(Call), R(14), R(1), U8(1), U8(5), B(Star), R(2), - /* 45 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(2), U8(1), + /* 45 S> */ B(LdrNamedProperty), R(2), U8(2), U8(7), R(14), + /* 45 E> */ B(Call), R(14), R(2), U8(1), U8(5), + B(Star), R(3), + /* 45 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(3), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(2), U8(1), - B(LdaNamedProperty), R(2), U8(3), U8(9), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(3), U8(1), + B(LdaNamedProperty), R(3), U8(3), U8(9), B(JumpIfToBooleanTrue), U8(39), - B(LdrNamedProperty), R(2), U8(4), U8(11), R(4), + B(LdrNamedProperty), R(3), U8(4), U8(11), R(5), B(LdaSmi), U8(2), - B(Star), R(3), - B(Mov), R(4), R(0), + B(Star), R(4), + B(Mov), R(5), R(0), /* 34 E> */ B(StackCheck), - B(Mov), R(0), R(7), + B(Mov), R(0), R(1), /* 66 S> */ B(LdaSmi), U8(10), - /* 72 E> */ B(TestEqual), R(7), + /* 72 E> */ B(TestEqual), R(1), B(JumpIfFalse), U8(4), /* 79 S> */ B(Jump), U8(13), /* 91 S> */ B(LdaSmi), U8(20), - /* 97 E> */ B(TestEqual), R(7), + /* 97 E> */ B(TestEqual), R(1), B(JumpIfFalse), U8(4), /* 104 S> */ B(Jump), U8(7), B(LdaZero), - B(Star), R(3), + B(Star), R(4), B(Jump), U8(-65), B(Jump), U8(34), B(Star), R(13), @@ -339,10 +339,10 @@ bytecodes: [ B(Star), R(12), B(PushContext), R(8), B(LdaSmi), U8(2), - B(TestEqualStrict), R(3), + B(TestEqualStrict), R(4), B(JumpIfFalse), U8(6), B(LdaSmi), U8(1), - B(Star), R(3), + B(Star), R(4), B(LdrContextSlot), R(context), U8(4), R(13), B(CallRuntime), U16(Runtime::kReThrow), R(13), U8(1), B(PopContext), R(8), @@ -355,20 +355,20 @@ bytecodes: [ B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Star), R(11), B(LdaZero), - B(TestEqualStrict), R(3), + B(TestEqualStrict), R(4), B(JumpIfTrue), U8(116), B(LdaUndefined), - B(TestEqualStrict), R(1), + B(TestEqualStrict), R(2), B(JumpIfTrue), U8(111), - B(LdrNamedProperty), R(1), U8(6), U8(13), R(5), + B(LdrNamedProperty), R(2), U8(6), U8(13), R(6), B(LdaNull), - B(TestEqual), R(5), + B(TestEqual), R(6), B(JumpIfFalse), U8(4), B(Jump), U8(99), B(LdaSmi), U8(1), - B(TestEqualStrict), R(3), + B(TestEqualStrict), R(4), B(JumpIfFalse), U8(68), - B(Ldar), R(5), + B(Ldar), R(6), B(TypeOf), B(Star), R(12), B(LdaConstant), U8(7), @@ -382,8 +382,8 @@ bytecodes: [ B(CallRuntime), U16(Runtime::kNewTypeError), R(12), U8(2), B(Throw), B(Mov), R(context), R(12), - B(Mov), R(5), R(13), - B(Mov), R(1), R(14), + B(Mov), R(6), R(13), + B(Mov), R(2), R(14), B(InvokeIntrinsic), U8(Runtime::k_Call), R(13), U8(2), B(Jump), U8(22), B(Star), R(13), @@ -395,14 +395,14 @@ bytecodes: [ B(PushContext), R(8), B(PopContext), R(8), B(Jump), U8(27), - B(Mov), R(5), R(12), - B(Mov), R(1), R(13), + B(Mov), R(6), R(12), + B(Mov), R(2), R(13), B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2), - B(Star), R(6), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(6), U8(1), + B(Star), R(7), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(7), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1), B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(11), U8(1), B(LdaZero), B(TestEqualStrict), R(9), @@ -441,9 +441,9 @@ bytecode array length: 292 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(8), - B(Mov), R(8), R(6), + B(Mov), R(8), R(0), B(LdaZero), - B(Star), R(2), + B(Star), R(3), B(Mov), R(context), R(10), B(Mov), R(context), R(11), /* 77 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(3), @@ -451,24 +451,24 @@ bytecodes: [ B(LdaConstant), U8(2), /* 77 E> */ B(LdrKeyedProperty), R(13), U8(3), R(12), /* 77 E> */ B(Call), R(12), R(13), U8(1), U8(1), - B(Star), R(0), - /* 74 S> */ B(LdrNamedProperty), R(0), U8(3), U8(7), R(13), - /* 74 E> */ B(Call), R(13), R(0), U8(1), U8(5), B(Star), R(1), - /* 74 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(1), U8(1), + /* 74 S> */ B(LdrNamedProperty), R(1), U8(3), U8(7), R(13), + /* 74 E> */ B(Call), R(13), R(1), U8(1), U8(5), + B(Star), R(2), + /* 74 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(2), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(1), U8(1), - B(LdaNamedProperty), R(1), U8(4), U8(9), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(2), U8(1), + B(LdaNamedProperty), R(2), U8(4), U8(9), B(JumpIfToBooleanTrue), U8(29), - /* 67 E> */ B(LdrNamedProperty), R(1), U8(5), U8(11), R(3), + /* 67 E> */ B(LdrNamedProperty), R(2), U8(5), U8(11), R(4), B(LdaSmi), U8(2), - B(Star), R(2), - B(Ldar), R(3), - B(StaNamedPropertySloppy), R(6), U8(6), U8(13), + B(Star), R(3), + B(Ldar), R(4), + B(StaNamedPropertySloppy), R(0), U8(6), U8(13), /* 62 E> */ B(StackCheck), /* 88 S> */ B(Nop), - /* 96 E> */ B(LdrNamedProperty), R(6), U8(6), U8(15), R(9), + /* 96 E> */ B(LdrNamedProperty), R(0), U8(6), U8(15), R(9), B(LdaZero), B(Star), R(8), B(Jump), U8(48), @@ -479,10 +479,10 @@ bytecodes: [ B(Star), R(11), B(PushContext), R(7), B(LdaSmi), U8(2), - B(TestEqualStrict), R(2), + B(TestEqualStrict), R(3), B(JumpIfFalse), U8(6), B(LdaSmi), U8(1), - B(Star), R(2), + B(Star), R(3), B(LdrContextSlot), R(context), U8(4), R(12), B(CallRuntime), U16(Runtime::kReThrow), R(12), U8(1), B(PopContext), R(7), @@ -495,20 +495,20 @@ bytecodes: [ B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Star), R(10), B(LdaZero), - B(TestEqualStrict), R(2), + B(TestEqualStrict), R(3), B(JumpIfTrue), U8(116), B(LdaUndefined), - B(TestEqualStrict), R(0), + B(TestEqualStrict), R(1), B(JumpIfTrue), U8(111), - B(LdrNamedProperty), R(0), U8(8), U8(17), R(4), + B(LdrNamedProperty), R(1), U8(8), U8(17), R(5), B(LdaNull), - B(TestEqual), R(4), + B(TestEqual), R(5), B(JumpIfFalse), U8(4), B(Jump), U8(99), B(LdaSmi), U8(1), - B(TestEqualStrict), R(2), + B(TestEqualStrict), R(3), B(JumpIfFalse), U8(68), - B(Ldar), R(4), + B(Ldar), R(5), B(TypeOf), B(Star), R(11), B(LdaConstant), U8(9), @@ -522,8 +522,8 @@ bytecodes: [ B(CallRuntime), U16(Runtime::kNewTypeError), R(11), U8(2), B(Throw), B(Mov), R(context), R(11), - B(Mov), R(4), R(12), - B(Mov), R(0), R(13), + B(Mov), R(5), R(12), + B(Mov), R(1), R(13), B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2), B(Jump), U8(22), B(Star), R(12), @@ -535,14 +535,14 @@ bytecodes: [ B(PushContext), R(7), B(PopContext), R(7), B(Jump), U8(27), - B(Mov), R(4), R(11), - B(Mov), R(0), R(12), + B(Mov), R(5), R(11), + B(Mov), R(1), R(12), B(InvokeIntrinsic), U8(Runtime::k_Call), R(11), U8(2), - B(Star), R(5), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(5), U8(1), + B(Star), R(6), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(6), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(5), U8(1), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(10), U8(1), B(LdaZero), B(TestEqualStrict), R(8), diff --git a/test/cctest/interpreter/bytecode_expectations/Switch.golden b/test/cctest/interpreter/bytecode_expectations/Switch.golden index bc16a7b964..16de860fb2 100644 --- a/test/cctest/interpreter/bytecode_expectations/Switch.golden +++ b/test/cctest/interpreter/bytecode_expectations/Switch.golden @@ -21,10 +21,10 @@ bytecode array length: 32 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), - B(Star), R(1), B(Star), R(0), + B(Star), R(1), /* 45 S> */ B(LdaSmi), U8(1), - B(TestEqualStrict), R(0), + B(TestEqualStrict), R(1), B(Mov), R(0), R(2), B(JumpIfToBooleanTrue), U8(10), B(LdaSmi), U8(2), @@ -57,10 +57,10 @@ bytecode array length: 38 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), - B(Star), R(1), B(Star), R(0), + B(Star), R(1), /* 45 S> */ B(LdaSmi), U8(1), - B(TestEqualStrict), R(0), + B(TestEqualStrict), R(1), B(Mov), R(0), R(2), B(JumpIfToBooleanTrue), U8(10), B(LdaSmi), U8(2), @@ -68,10 +68,10 @@ bytecodes: [ B(JumpIfTrue), U8(10), B(Jump), U8(14), /* 66 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 73 S> */ B(Jump), U8(8), /* 89 S> */ B(LdaSmi), U8(3), - B(Star), R(1), + B(Star), R(0), /* 96 S> */ B(Jump), U8(2), B(LdaUndefined), /* 105 S> */ B(Return), @@ -95,10 +95,10 @@ bytecode array length: 36 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), - B(Star), R(1), B(Star), R(0), + B(Star), R(1), /* 45 S> */ B(LdaSmi), U8(1), - B(TestEqualStrict), R(0), + B(TestEqualStrict), R(1), B(Mov), R(0), R(2), B(JumpIfToBooleanTrue), U8(10), B(LdaSmi), U8(2), @@ -106,9 +106,9 @@ bytecodes: [ B(JumpIfTrue), U8(8), B(Jump), U8(12), /* 66 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 98 S> */ B(LdaSmi), U8(3), - B(Star), R(1), + B(Star), R(0), /* 105 S> */ B(Jump), U8(2), B(LdaUndefined), /* 114 S> */ B(Return), @@ -133,10 +133,10 @@ bytecode array length: 36 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), - B(Star), R(1), B(Star), R(0), + B(Star), R(1), /* 45 S> */ B(LdaSmi), U8(2), - B(TestEqualStrict), R(0), + B(TestEqualStrict), R(1), B(Mov), R(0), R(2), B(JumpIfToBooleanTrue), U8(10), B(LdaSmi), U8(3), @@ -146,7 +146,7 @@ bytecodes: [ /* 66 S> */ B(Jump), U8(10), /* 82 S> */ B(Jump), U8(8), /* 99 S> */ B(LdaSmi), U8(1), - B(Star), R(1), + B(Star), R(0), /* 106 S> */ B(Jump), U8(2), B(LdaUndefined), /* 115 S> */ B(Return), @@ -171,25 +171,25 @@ bytecode array length: 45 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), - B(Star), R(1), - /* 42 E> */ B(TypeOf), B(Star), R(0), + /* 42 E> */ B(TypeOf), + B(Star), R(1), /* 45 S> */ B(LdaSmi), U8(2), - B(TestEqualStrict), R(0), - B(Mov), R(0), R(2), + B(TestEqualStrict), R(1), + B(Mov), R(1), R(2), B(JumpIfToBooleanTrue), U8(10), B(LdaSmi), U8(3), B(TestEqualStrict), R(2), B(JumpIfTrue), U8(10), B(Jump), U8(14), /* 74 S> */ B(LdaSmi), U8(1), - B(Star), R(1), + B(Star), R(0), /* 81 S> */ B(Jump), U8(14), /* 97 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 104 S> */ B(Jump), U8(8), /* 121 S> */ B(LdaSmi), U8(3), - B(Star), R(1), + B(Star), R(0), /* 128 S> */ B(Jump), U8(2), B(LdaUndefined), /* 137 S> */ B(Return), @@ -213,18 +213,18 @@ bytecode array length: 31 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), - B(Star), R(1), B(Star), R(0), + B(Star), R(1), /* 45 S> */ B(TypeOf), - B(TestEqualStrict), R(0), + B(TestEqualStrict), R(1), B(Mov), R(0), R(2), B(JumpIfToBooleanTrue), U8(4), B(Jump), U8(8), /* 74 S> */ B(LdaSmi), U8(1), - B(Star), R(1), + B(Star), R(0), /* 81 S> */ B(Jump), U8(8), /* 98 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 105 S> */ B(Jump), U8(2), B(LdaUndefined), /* 114 S> */ B(Return), @@ -315,10 +315,10 @@ bytecode array length: 290 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), - B(Star), R(1), B(Star), R(0), + B(Star), R(1), /* 45 S> */ B(LdaSmi), U8(1), - B(TestEqualStrict), R(0), + B(TestEqualStrict), R(1), B(Mov), R(0), R(2), B(JumpIfToBooleanTrue), U8(10), B(LdaSmi), U8(2), @@ -326,136 +326,136 @@ bytecodes: [ B(JumpIfTrueConstant), U8(0), B(JumpConstant), U8(1), /* 68 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 77 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 86 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 95 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 104 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 113 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 122 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 131 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 140 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 149 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 158 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 167 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 176 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 185 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 194 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 203 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 212 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 221 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 230 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 239 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 248 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 257 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 266 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 275 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 284 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 293 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 302 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 311 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 320 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 329 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 338 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 347 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 356 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 365 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 374 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 383 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 392 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 401 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 410 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 419 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 428 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 437 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 446 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 455 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 464 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 473 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 482 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 491 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 500 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 509 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 518 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 527 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 536 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 545 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 554 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 563 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 572 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 581 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 590 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 599 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 608 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 617 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 626 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 635 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 644 S> */ B(Jump), U8(8), /* 662 S> */ B(LdaSmi), U8(3), - B(Star), R(1), + B(Star), R(0), /* 671 S> */ B(Jump), U8(2), B(LdaUndefined), /* 680 S> */ B(Return), @@ -485,31 +485,31 @@ bytecode array length: 59 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), - B(Star), R(2), B(Star), R(0), + B(Star), R(1), /* 45 S> */ B(LdaSmi), U8(1), - B(TestEqualStrict), R(0), + B(TestEqualStrict), R(1), B(Mov), R(0), R(3), B(JumpIfToBooleanTrue), U8(10), B(LdaSmi), U8(2), B(TestEqualStrict), R(3), B(JumpIfTrue), U8(33), B(Jump), U8(35), - /* 77 E> */ B(AddSmi), U8(1), R(2), U8(1), - B(Star), R(1), + /* 77 E> */ B(AddSmi), U8(1), R(0), U8(1), + B(Star), R(2), /* 70 S> */ B(LdaSmi), U8(2), - B(TestEqualStrict), R(1), - B(Mov), R(1), R(4), + B(TestEqualStrict), R(2), + B(Mov), R(2), R(4), B(JumpIfToBooleanTrue), U8(4), B(Jump), U8(8), /* 101 S> */ B(LdaSmi), U8(1), - B(Star), R(2), + B(Star), R(0), /* 108 S> */ B(Jump), U8(8), /* 131 S> */ B(LdaSmi), U8(2), - B(Star), R(2), + B(Star), R(0), /* 138 S> */ B(Jump), U8(2), /* 176 S> */ B(LdaSmi), U8(3), - B(Star), R(2), + B(Star), R(0), B(LdaUndefined), /* 185 S> */ B(Return), ] diff --git a/test/mjsunit/harmony/default-parameter-do-expression.js b/test/mjsunit/harmony/default-parameter-do-expression.js new file mode 100644 index 0000000000..cb80d246bc --- /dev/null +++ b/test/mjsunit/harmony/default-parameter-do-expression.js @@ -0,0 +1,21 @@ +// Copyright 2016 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-do-expressions --nolazy + +function hoist_unique_do_var() { + var f = (y = do { var unique = 3 }) => unique; + assertEquals(3, f()); + assertThrows(() => unique, ReferenceError); +} +hoist_unique_do_var(); + +function hoist_duplicate_do_var() { + var duplicate = 100; + var f = (y = do { var duplicate = 3 }) => duplicate; + assertEquals(3, f()); + // TODO(verwaest): The {duplicate} declarations were invalidly merged. + assertEquals(3, duplicate); +} +hoist_duplicate_do_var();