Commit 62f09de9 authored by Michael Achenbach's avatar Michael Achenbach Committed by Commit Bot

Revert "Fix "this" value in lazily-parsed module functions."

This reverts commit c3bd741e.

Reason for revert: Breaks layout tests:
https://build.chromium.org/p/client.v8.fyi/builders/V8-Blink%20Linux%2064/builds/20384

Original change's description:
> Fix "this" value in lazily-parsed module functions.
> 
> When preparsing top-level functions in a module, we didn't track
> unresolved variables. Consequently, "this" ended up referencing
> the global "this", which has the wrong value (in a module "this"
> is supposed to be the undefined value).
> 
> This patch fixes that. This also lets us stop forcing context
> allocation of all variables in module scopes, which the patch
> takes care of as well.
> 
> Bug: chromium:791334
> Change-Id: Ifac1f1adc033f3facfb3d29dd4bca32ee27bffcf
> Reviewed-on: https://chromium-review.googlesource.com/808938
> Reviewed-by: Marja Hölttä <marja@chromium.org>
> Reviewed-by: Adam Klein <adamk@chromium.org>
> Reviewed-by: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
> Commit-Queue: Georg Neis <neis@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#50025}

TBR=adamk@chromium.org,marja@chromium.org,neis@chromium.org,kozyatinskiy@chromium.org

Change-Id: I81f69334ed2ce104c00e6205d50001e4bdf07d15
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:791334
Reviewed-on: https://chromium-review.googlesource.com/822258Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50036}
parent 10f392ac
......@@ -147,6 +147,8 @@ Scope::Scope(Zone* zone, Scope* outer_scope, ScopeType scope_type)
DCHECK_NE(SCRIPT_SCOPE, scope_type);
SetDefaults();
set_language_mode(outer_scope->language_mode());
force_context_allocation_ =
!is_function_scope() && outer_scope->has_forced_context_allocation();
outer_scope_->AddInnerScope(this);
}
......@@ -1368,8 +1370,12 @@ bool Scope::AllowsLazyParsingWithoutUnresolvedVariables(
if (s->is_catch_scope()) continue;
// With scopes do not introduce variables that need allocation.
if (s->is_with_scope()) continue;
DCHECK(s->is_module_scope() || s->is_block_scope() ||
s->is_function_scope());
// Module scopes context-allocate all variables, and have no
// {this} or {arguments} variables whose existence depends on
// references to them.
if (s->is_module_scope()) continue;
// Only block scopes and function scopes should disallow preparsing.
DCHECK(s->is_block_scope() || s->is_function_scope());
return false;
}
return true;
......@@ -1728,6 +1734,9 @@ void Scope::Print(int n) {
if (scope->was_lazily_parsed()) Indent(n1, "// lazily parsed\n");
if (scope->ShouldEagerCompile()) Indent(n1, "// will be compiled\n");
}
if (has_forced_context_allocation()) {
Indent(n1, "// forces context allocation\n");
}
if (num_stack_slots_ > 0) {
Indent(n1, "// ");
PrintF("%d stack slots\n", num_stack_slots_);
......@@ -2102,8 +2111,11 @@ bool Scope::MustAllocateInContext(Variable* var) {
// an eval() call or a runtime with lookup), it must be allocated in the
// context.
//
// Temporary variables are always stack-allocated. Catch-bound variables are
// Exceptions: If the scope as a whole has forced context allocation, all
// variables will have context allocation, even temporaries. Otherwise
// temporary variables are always stack-allocated. Catch-bound variables are
// always context-allocated.
if (has_forced_context_allocation()) return true;
if (var->mode() == TEMPORARY) return false;
if (is_catch_scope()) return true;
if ((is_script_scope() || is_eval_scope()) &&
......
......@@ -334,6 +334,14 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
bool is_hidden() const { return is_hidden_; }
void set_is_hidden() { is_hidden_ = true; }
// In some cases we want to force context allocation for a whole scope.
void ForceContextAllocation() {
DCHECK(!already_resolved_);
force_context_allocation_ = true;
}
bool has_forced_context_allocation() const {
return force_context_allocation_;
}
void ForceContextAllocationForParameters() {
DCHECK(!already_resolved_);
force_context_allocation_for_parameters_ = true;
......
......@@ -690,6 +690,7 @@ FunctionLiteral* Parser::DoParseProgram(ParseInfo* info) {
var->AllocateTo(VariableLocation::PARAMETER, 0);
PrepareGeneratorVariables();
scope->ForceContextAllocation();
Expression* initial_yield =
BuildInitialYield(kNoSourcePosition, kGeneratorFunction);
body->Add(
......
......@@ -11,49 +11,52 @@ top level: yes
snippet: "
import \"bar\";
"
frame size: 6
frame size: 5
parameter count: 2
bytecode array length: 91
bytecode array length: 96
bytecodes: [
B(Ldar), R(0),
B(Ldar), R(1),
B(JumpIfUndefined), U8(18),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1),
B(PushContext), R(3),
B(RestoreGeneratorState), R(0),
B(Star), R(2),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1),
B(PushContext), R(2),
B(RestoreGeneratorState), R(1),
B(Star), R(0),
B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0),
B(Abort), U8(42),
B(LdaSmi), I8(-2),
B(Star), R(2),
B(LdaConstant), U8(1),
B(Star), R(5),
B(Mov), R(arg0), R(3),
B(Mov), R(closure), R(4),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(3),
B(PushContext), R(3),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
B(Star), R(0),
B(LdaConstant), U8(1),
B(Star), R(4),
B(Mov), R(arg0), R(2),
B(Mov), R(closure), R(3),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3),
B(PushContext), R(2),
B(Mov), R(this), R(4),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2),
B(StaCurrentContextSlot), U8(4),
/* 0 E> */ B(StackCheck),
/* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
B(Star), R(1),
B(LdaImmutableCurrentContextSlot), U8(4),
/* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0),
/* 13 S> */ B(Return),
B(RestoreGeneratorRegisters), R(0), R(0), U8(4),
B(RestoreGeneratorRegisters), R(1), R(0), U8(3),
B(LdaSmi), I8(-2),
B(Star), R(2),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1),
B(Star), R(4),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(0),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(4),
B(Ldar), R(3),
/* 0 E> */ B(Throw),
B(Ldar), R(4),
B(Ldar), R(3),
/* 13 S> */ B(Return),
B(Mov), R(4), R(1),
B(Ldar), R(1),
B(Ldar), R(3),
B(StaCurrentContextSlot), U8(5),
B(LdaCurrentContextSlot), U8(5),
/* 13 S> */ B(Return),
]
constant pool: [
Smi [43],
Smi [47],
FIXED_ARRAY_TYPE,
Smi [10],
Smi [7],
......@@ -65,49 +68,52 @@ handlers: [
snippet: "
import {foo} from \"bar\";
"
frame size: 6
frame size: 5
parameter count: 2
bytecode array length: 91
bytecode array length: 96
bytecodes: [
B(Ldar), R(0),
B(Ldar), R(1),
B(JumpIfUndefined), U8(18),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1),
B(PushContext), R(3),
B(RestoreGeneratorState), R(0),
B(Star), R(2),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1),
B(PushContext), R(2),
B(RestoreGeneratorState), R(1),
B(Star), R(0),
B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0),
B(Abort), U8(42),
B(LdaSmi), I8(-2),
B(Star), R(2),
B(LdaConstant), U8(1),
B(Star), R(5),
B(Mov), R(arg0), R(3),
B(Mov), R(closure), R(4),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(3),
B(PushContext), R(3),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
B(Star), R(0),
B(LdaConstant), U8(1),
B(Star), R(4),
B(Mov), R(arg0), R(2),
B(Mov), R(closure), R(3),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3),
B(PushContext), R(2),
B(Mov), R(this), R(4),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2),
B(StaCurrentContextSlot), U8(4),
/* 0 E> */ B(StackCheck),
/* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
B(Star), R(1),
B(LdaImmutableCurrentContextSlot), U8(4),
/* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0),
/* 24 S> */ B(Return),
B(RestoreGeneratorRegisters), R(0), R(0), U8(4),
B(RestoreGeneratorRegisters), R(1), R(0), U8(3),
B(LdaSmi), I8(-2),
B(Star), R(2),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1),
B(Star), R(4),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(0),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(4),
B(Ldar), R(3),
/* 0 E> */ B(Throw),
B(Ldar), R(4),
B(Ldar), R(3),
/* 24 S> */ B(Return),
B(Mov), R(4), R(1),
B(Ldar), R(1),
B(Ldar), R(3),
B(StaCurrentContextSlot), U8(5),
B(LdaCurrentContextSlot), U8(5),
/* 24 S> */ B(Return),
]
constant pool: [
Smi [43],
Smi [47],
FIXED_ARRAY_TYPE,
Smi [10],
Smi [7],
......@@ -121,66 +127,76 @@ snippet: "
goo(42);
{ let x; { goo(42) } };
"
frame size: 7
frame size: 6
parameter count: 2
bytecode array length: 121
bytecode array length: 140
bytecodes: [
B(Ldar), R(1),
B(JumpIfUndefined), U8(18),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1),
B(PushContext), R(4),
B(PushContext), R(2),
B(RestoreGeneratorState), R(1),
B(Star), R(3),
B(Star), R(0),
B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0),
B(Abort), U8(42),
B(LdaSmi), I8(-2),
B(Star), R(3),
B(Star), R(0),
B(LdaConstant), U8(1),
B(Star), R(6),
B(Mov), R(arg0), R(4),
B(Mov), R(closure), R(5),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(4), U8(3),
B(PushContext), R(4),
B(Mov), R(this), R(6),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(5), U8(2),
B(Star), R(1),
B(Star), R(4),
B(Mov), R(arg0), R(2),
B(Mov), R(closure), R(3),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3),
B(PushContext), R(2),
B(Mov), R(this), R(4),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2),
B(StaCurrentContextSlot), U8(4),
/* 0 E> */ B(StackCheck),
/* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(5), U8(0),
B(Star), R(1),
B(LdaImmutableCurrentContextSlot), U8(4),
/* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0),
/* 64 S> */ B(Return),
B(RestoreGeneratorRegisters), R(1), R(0), U8(5),
B(RestoreGeneratorRegisters), R(1), R(0), U8(3),
B(LdaSmi), I8(-2),
B(Star), R(3),
B(Star), R(0),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1),
B(Star), R(5),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(5),
B(Ldar), R(3),
/* 0 E> */ B(Throw),
B(Ldar), R(5),
B(Ldar), R(3),
/* 64 S> */ B(Return),
/* 32 S> */ B(LdaModuleVariable), I8(-1), U8(0),
B(ThrowReferenceErrorIfHole), U8(4),
B(Star), R(5),
B(Star), R(3),
B(LdaSmi), I8(42),
B(Star), R(6),
/* 32 E> */ B(CallUndefinedReceiver1), R(5), R(6), U8(0),
B(Star), R(4),
/* 32 E> */ B(CallUndefinedReceiver1), R(3), R(4), U8(0),
B(Ldar), R(closure),
B(CreateBlockContext), U8(5),
B(PushContext), R(3),
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
/* 47 S> */ B(LdaUndefined),
B(Star), R(0),
/* 52 S> */ B(LdaModuleVariable), I8(-1), U8(0),
/* 47 E> */ B(StaCurrentContextSlot), U8(4),
/* 52 S> */ B(LdaModuleVariable), I8(-1), U8(1),
B(ThrowReferenceErrorIfHole), U8(4),
B(Star), R(5),
B(Star), R(4),
B(LdaSmi), I8(42),
B(Star), R(6),
/* 52 E> */ B(CallUndefinedReceiver1), R(5), R(6), U8(2),
B(Star), R(2),
B(Star), R(5),
/* 52 E> */ B(CallUndefinedReceiver1), R(4), R(5), U8(2),
B(StaContextSlot), R(3), U8(5), U8(0),
B(PopContext), R(3),
B(LdaCurrentContextSlot), U8(5),
/* 64 S> */ B(Return),
]
constant pool: [
Smi [43],
Smi [47],
FIXED_ARRAY_TYPE,
Smi [10],
Smi [7],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["goo"],
FIXED_ARRAY_TYPE,
]
handlers: [
]
......@@ -191,64 +207,74 @@ snippet: "
foo++;
{ let x; { foo++ } };
"
frame size: 7
frame size: 5
parameter count: 2
bytecode array length: 119
bytecode array length: 137
bytecodes: [
B(Ldar), R(1),
B(JumpIfUndefined), U8(18),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1),
B(PushContext), R(4),
B(PushContext), R(2),
B(RestoreGeneratorState), R(1),
B(Star), R(3),
B(Star), R(0),
B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0),
B(Abort), U8(42),
B(LdaSmi), I8(-2),
B(Star), R(3),
B(Star), R(0),
B(LdaConstant), U8(1),
B(Star), R(6),
B(Mov), R(arg0), R(4),
B(Mov), R(closure), R(5),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(4), U8(3),
B(PushContext), R(4),
B(Mov), R(this), R(6),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(5), U8(2),
B(Star), R(1),
B(Star), R(4),
B(Mov), R(arg0), R(2),
B(Mov), R(closure), R(3),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3),
B(PushContext), R(2),
B(Mov), R(this), R(4),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2),
B(StaCurrentContextSlot), U8(4),
/* 0 E> */ B(StackCheck),
/* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(5), U8(0),
B(Star), R(1),
B(LdaImmutableCurrentContextSlot), U8(4),
/* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0),
/* 49 S> */ B(Return),
B(RestoreGeneratorRegisters), R(1), R(0), U8(5),
B(RestoreGeneratorRegisters), R(1), R(0), U8(3),
B(LdaSmi), I8(-2),
B(Star), R(3),
B(Star), R(0),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1),
B(Star), R(5),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(5),
B(Ldar), R(3),
/* 0 E> */ B(Throw),
B(Ldar), R(5),
B(Ldar), R(3),
/* 49 S> */ B(Return),
/* 17 S> */ B(LdaSmi), I8(42),
/* 17 E> */ B(StaModuleVariable), I8(1), U8(0),
/* 21 S> */ B(LdaModuleVariable), I8(1), U8(0),
B(Inc), U8(0),
/* 24 E> */ B(StaModuleVariable), I8(1), U8(0),
B(Ldar), R(closure),
B(CreateBlockContext), U8(4),
B(PushContext), R(3),
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
/* 34 S> */ B(LdaUndefined),
B(Star), R(0),
/* 39 S> */ B(LdaModuleVariable), I8(1), U8(0),
/* 34 E> */ B(StaCurrentContextSlot), U8(4),
/* 39 S> */ B(LdaModuleVariable), I8(1), U8(1),
B(ToNumeric), U8(1),
B(Star), R(5),
B(Star), R(4),
B(Inc), U8(1),
/* 42 E> */ B(StaModuleVariable), I8(1), U8(0),
B(Mov), R(5), R(2),
B(Ldar), R(2),
/* 42 E> */ B(StaModuleVariable), I8(1), U8(1),
B(Ldar), R(4),
B(StaContextSlot), R(3), U8(5), U8(0),
B(PopContext), R(3),
B(LdaCurrentContextSlot), U8(5),
/* 49 S> */ B(Return),
]
constant pool: [
Smi [43],
Smi [47],
FIXED_ARRAY_TYPE,
Smi [10],
Smi [7],
FIXED_ARRAY_TYPE,
]
handlers: [
]
......@@ -259,67 +285,76 @@ snippet: "
foo++;
{ let x; { foo++ } };
"
frame size: 7
frame size: 5
parameter count: 2
bytecode array length: 125
bytecode array length: 141
bytecodes: [
B(Ldar), R(1),
B(JumpIfUndefined), U8(18),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1),
B(PushContext), R(4),
B(PushContext), R(2),
B(RestoreGeneratorState), R(1),
B(Star), R(3),
B(Star), R(0),
B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0),
B(Abort), U8(42),
B(LdaSmi), I8(-2),
B(Star), R(3),
B(Star), R(0),
B(LdaConstant), U8(1),
B(Star), R(6),
B(Mov), R(arg0), R(4),
B(Mov), R(closure), R(5),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(4), U8(3),
B(PushContext), R(4),
B(Mov), R(this), R(6),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(5), U8(2),
B(Star), R(4),
B(Mov), R(arg0), R(2),
B(Mov), R(closure), R(3),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3),
B(PushContext), R(2),
B(Mov), R(this), R(4),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2),
B(StaCurrentContextSlot), U8(4),
B(Star), R(1),
B(LdaTheHole),
B(StaModuleVariable), I8(1), U8(0),
/* 0 E> */ B(StackCheck),
B(Ldar), R(1),
/* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(5), U8(0),
B(LdaImmutableCurrentContextSlot), U8(4),
/* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0),
/* 49 S> */ B(Return),
B(RestoreGeneratorRegisters), R(1), R(0), U8(5),
B(RestoreGeneratorRegisters), R(1), R(0), U8(3),
B(LdaSmi), I8(-2),
B(Star), R(3),
B(Star), R(0),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1),
B(Star), R(5),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(5),
B(Ldar), R(3),
/* 0 E> */ B(Throw),
B(Ldar), R(5),
B(Ldar), R(3),
/* 49 S> */ B(Return),
/* 17 S> */ B(LdaSmi), I8(42),
/* 17 E> */ B(StaModuleVariable), I8(1), U8(0),
/* 21 S> */ B(LdaModuleVariable), I8(1), U8(0),
B(Inc), U8(0),
/* 24 E> */ B(StaModuleVariable), I8(1), U8(0),
B(Ldar), R(closure),
B(CreateBlockContext), U8(4),
B(PushContext), R(3),
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
/* 34 S> */ B(LdaUndefined),
B(Star), R(0),
/* 39 S> */ B(LdaModuleVariable), I8(1), U8(0),
/* 34 E> */ B(StaCurrentContextSlot), U8(4),
/* 39 S> */ B(LdaModuleVariable), I8(1), U8(1),
B(ToNumeric), U8(1),
B(Star), R(5),
B(Star), R(4),
B(Inc), U8(1),
/* 42 E> */ B(StaModuleVariable), I8(1), U8(0),
B(Mov), R(5), R(2),
B(Ldar), R(2),
/* 42 E> */ B(StaModuleVariable), I8(1), U8(1),
B(Ldar), R(4),
B(StaContextSlot), R(3), U8(5), U8(0),
B(PopContext), R(3),
B(LdaCurrentContextSlot), U8(5),
/* 49 S> */ B(Return),
]
constant pool: [
Smi [49],
Smi [51],
FIXED_ARRAY_TYPE,
Smi [10],
Smi [7],
FIXED_ARRAY_TYPE,
]
handlers: [
]
......@@ -330,67 +365,76 @@ snippet: "
foo++;
{ let x; { foo++ } };
"
frame size: 7
frame size: 5
parameter count: 2
bytecode array length: 129
bytecode array length: 145
bytecodes: [
B(Ldar), R(1),
B(JumpIfUndefined), U8(18),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1),
B(PushContext), R(4),
B(PushContext), R(2),
B(RestoreGeneratorState), R(1),
B(Star), R(3),
B(Star), R(0),
B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0),
B(Abort), U8(42),
B(LdaSmi), I8(-2),
B(Star), R(3),
B(Star), R(0),
B(LdaConstant), U8(1),
B(Star), R(6),
B(Mov), R(arg0), R(4),
B(Mov), R(closure), R(5),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(4), U8(3),
B(PushContext), R(4),
B(Mov), R(this), R(6),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(5), U8(2),
B(Star), R(4),
B(Mov), R(arg0), R(2),
B(Mov), R(closure), R(3),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3),
B(PushContext), R(2),
B(Mov), R(this), R(4),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2),
B(StaCurrentContextSlot), U8(4),
B(Star), R(1),
B(LdaTheHole),
B(StaModuleVariable), I8(1), U8(0),
/* 0 E> */ B(StackCheck),
B(Ldar), R(1),
/* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(5), U8(0),
B(LdaImmutableCurrentContextSlot), U8(4),
/* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0),
/* 51 S> */ B(Return),
B(RestoreGeneratorRegisters), R(1), R(0), U8(5),
B(RestoreGeneratorRegisters), R(1), R(0), U8(3),
B(LdaSmi), I8(-2),
B(Star), R(3),
B(Star), R(0),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1),
B(Star), R(5),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(5),
B(Ldar), R(3),
/* 0 E> */ B(Throw),
B(Ldar), R(5),
B(Ldar), R(3),
/* 51 S> */ B(Return),
/* 19 S> */ B(LdaSmi), I8(42),
/* 19 E> */ B(StaModuleVariable), I8(1), U8(0),
/* 23 S> */ B(LdaModuleVariable), I8(1), U8(0),
B(Inc), U8(0),
/* 26 E> */ B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0),
B(Ldar), R(closure),
B(CreateBlockContext), U8(4),
B(PushContext), R(3),
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
/* 36 S> */ B(LdaUndefined),
B(Star), R(0),
/* 41 S> */ B(LdaModuleVariable), I8(1), U8(0),
/* 36 E> */ B(StaCurrentContextSlot), U8(4),
/* 41 S> */ B(LdaModuleVariable), I8(1), U8(1),
B(ToNumeric), U8(1),
B(Star), R(5),
B(Star), R(4),
B(Inc), U8(1),
/* 44 E> */ B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0),
B(Mov), R(5), R(2),
B(Ldar), R(2),
B(Ldar), R(4),
B(StaContextSlot), R(3), U8(5), U8(0),
B(PopContext), R(3),
B(LdaCurrentContextSlot), U8(5),
/* 51 S> */ B(Return),
]
constant pool: [
Smi [49],
Smi [51],
FIXED_ARRAY_TYPE,
Smi [10],
Smi [7],
FIXED_ARRAY_TYPE,
]
handlers: [
]
......@@ -399,54 +443,56 @@ handlers: [
snippet: "
export default (function () {});
"
frame size: 6
frame size: 5
parameter count: 2
bytecode array length: 104
bytecode array length: 107
bytecodes: [
B(Ldar), R(0),
B(Ldar), R(1),
B(JumpIfUndefined), U8(18),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1),
B(PushContext), R(3),
B(RestoreGeneratorState), R(0),
B(Star), R(2),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1),
B(PushContext), R(2),
B(RestoreGeneratorState), R(1),
B(Star), R(0),
B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0),
B(Abort), U8(42),
B(LdaSmi), I8(-2),
B(Star), R(2),
B(LdaConstant), U8(1),
B(Star), R(5),
B(Mov), R(arg0), R(3),
B(Mov), R(closure), R(4),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(3),
B(PushContext), R(3),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
B(Star), R(0),
B(LdaConstant), U8(1),
B(Star), R(4),
B(Mov), R(arg0), R(2),
B(Mov), R(closure), R(3),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3),
B(PushContext), R(2),
B(Mov), R(this), R(4),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2),
B(StaCurrentContextSlot), U8(4),
B(Star), R(1),
B(LdaTheHole),
B(StaModuleVariable), I8(1), U8(0),
/* 0 E> */ B(StackCheck),
B(Ldar), R(0),
/* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
B(LdaImmutableCurrentContextSlot), U8(4),
/* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0),
/* 32 S> */ B(Return),
B(RestoreGeneratorRegisters), R(0), R(0), U8(4),
B(RestoreGeneratorRegisters), R(1), R(0), U8(3),
B(LdaSmi), I8(-2),
B(Star), R(2),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1),
B(Star), R(4),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(0),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(4),
B(Ldar), R(3),
/* 0 E> */ B(Throw),
B(Ldar), R(4),
B(Ldar), R(3),
/* 32 S> */ B(Return),
B(Mov), R(4), R(1),
B(Ldar), R(3),
B(StaCurrentContextSlot), U8(5),
B(CreateClosure), U8(4), U8(0), U8(0),
B(StaModuleVariable), I8(1), U8(0),
B(Ldar), R(1),
B(LdaCurrentContextSlot), U8(5),
/* 32 S> */ B(Return),
]
constant pool: [
Smi [49],
Smi [51],
FIXED_ARRAY_TYPE,
Smi [10],
Smi [7],
......@@ -459,63 +505,65 @@ handlers: [
snippet: "
export default (class {});
"
frame size: 8
frame size: 7
parameter count: 2
bytecode array length: 125
bytecode array length: 128
bytecodes: [
B(Ldar), R(0),
B(Ldar), R(1),
B(JumpIfUndefined), U8(18),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1),
B(PushContext), R(3),
B(RestoreGeneratorState), R(0),
B(Star), R(2),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1),
B(PushContext), R(2),
B(RestoreGeneratorState), R(1),
B(Star), R(0),
B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0),
B(Abort), U8(42),
B(LdaSmi), I8(-2),
B(Star), R(2),
B(LdaConstant), U8(1),
B(Star), R(5),
B(Mov), R(arg0), R(3),
B(Mov), R(closure), R(4),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(3),
B(PushContext), R(3),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
B(Star), R(0),
B(LdaConstant), U8(1),
B(Star), R(4),
B(Mov), R(arg0), R(2),
B(Mov), R(closure), R(3),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3),
B(PushContext), R(2),
B(Mov), R(this), R(4),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2),
B(StaCurrentContextSlot), U8(4),
B(Star), R(1),
B(LdaTheHole),
B(StaModuleVariable), I8(1), U8(0),
/* 0 E> */ B(StackCheck),
B(Ldar), R(0),
/* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
B(LdaImmutableCurrentContextSlot), U8(4),
/* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0),
/* 26 S> */ B(Return),
B(RestoreGeneratorRegisters), R(0), R(0), U8(4),
B(RestoreGeneratorRegisters), R(1), R(0), U8(3),
B(LdaSmi), I8(-2),
B(Star), R(2),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1),
B(Star), R(4),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(0),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(4),
B(Ldar), R(3),
/* 0 E> */ B(Throw),
B(Ldar), R(4),
B(Ldar), R(3),
/* 26 S> */ B(Return),
B(Mov), R(4), R(1),
B(Ldar), R(3),
B(StaCurrentContextSlot), U8(5),
B(LdaTheHole),
B(Star), R(7),
B(Star), R(6),
B(CreateClosure), U8(5), U8(0), U8(0),
B(Star), R(4),
B(Star), R(3),
B(LdaConstant), U8(4),
B(Star), R(5),
B(Mov), R(4), R(6),
B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(3),
B(Star), R(5),
B(Ldar), R(6),
B(Star), R(4),
B(Mov), R(3), R(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(3),
B(Star), R(4),
B(Ldar), R(5),
B(StaModuleVariable), I8(1), U8(0),
B(Ldar), R(1),
B(LdaCurrentContextSlot), U8(5),
/* 26 S> */ B(Return),
]
constant pool: [
Smi [49],
Smi [51],
FIXED_ARRAY_TYPE,
Smi [10],
Smi [7],
......@@ -529,49 +577,52 @@ handlers: [
snippet: "
export {foo as goo} from \"bar\"
"
frame size: 6
frame size: 5
parameter count: 2
bytecode array length: 91
bytecode array length: 96
bytecodes: [
B(Ldar), R(0),
B(Ldar), R(1),
B(JumpIfUndefined), U8(18),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1),
B(PushContext), R(3),
B(RestoreGeneratorState), R(0),
B(Star), R(2),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1),
B(PushContext), R(2),
B(RestoreGeneratorState), R(1),
B(Star), R(0),
B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0),
B(Abort), U8(42),
B(LdaSmi), I8(-2),
B(Star), R(2),
B(LdaConstant), U8(1),
B(Star), R(5),
B(Mov), R(arg0), R(3),
B(Mov), R(closure), R(4),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(3),
B(PushContext), R(3),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
B(Star), R(0),
B(LdaConstant), U8(1),
B(Star), R(4),
B(Mov), R(arg0), R(2),
B(Mov), R(closure), R(3),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3),
B(PushContext), R(2),
B(Mov), R(this), R(4),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2),
B(StaCurrentContextSlot), U8(4),
/* 0 E> */ B(StackCheck),
/* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
B(Star), R(1),
B(LdaImmutableCurrentContextSlot), U8(4),
/* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0),
/* 30 S> */ B(Return),
B(RestoreGeneratorRegisters), R(0), R(0), U8(4),
B(RestoreGeneratorRegisters), R(1), R(0), U8(3),
B(LdaSmi), I8(-2),
B(Star), R(2),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1),
B(Star), R(4),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(0),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(4),
B(Ldar), R(3),
/* 0 E> */ B(Throw),
B(Ldar), R(4),
B(Ldar), R(3),
/* 30 S> */ B(Return),
B(Mov), R(4), R(1),
B(Ldar), R(1),
B(Ldar), R(3),
B(StaCurrentContextSlot), U8(5),
B(LdaCurrentContextSlot), U8(5),
/* 30 S> */ B(Return),
]
constant pool: [
Smi [43],
Smi [47],
FIXED_ARRAY_TYPE,
Smi [10],
Smi [7],
......@@ -583,49 +634,52 @@ handlers: [
snippet: "
export * from \"bar\"
"
frame size: 6
frame size: 5
parameter count: 2
bytecode array length: 91
bytecode array length: 96
bytecodes: [
B(Ldar), R(0),
B(Ldar), R(1),
B(JumpIfUndefined), U8(18),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1),
B(PushContext), R(3),
B(RestoreGeneratorState), R(0),
B(Star), R(2),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1),
B(PushContext), R(2),
B(RestoreGeneratorState), R(1),
B(Star), R(0),
B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0),
B(Abort), U8(42),
B(LdaSmi), I8(-2),
B(Star), R(2),
B(LdaConstant), U8(1),
B(Star), R(5),
B(Mov), R(arg0), R(3),
B(Mov), R(closure), R(4),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(3),
B(PushContext), R(3),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
B(Star), R(0),
B(LdaConstant), U8(1),
B(Star), R(4),
B(Mov), R(arg0), R(2),
B(Mov), R(closure), R(3),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3),
B(PushContext), R(2),
B(Mov), R(this), R(4),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2),
B(StaCurrentContextSlot), U8(4),
/* 0 E> */ B(StackCheck),
/* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
B(Star), R(1),
B(LdaImmutableCurrentContextSlot), U8(4),
/* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0),
/* 19 S> */ B(Return),
B(RestoreGeneratorRegisters), R(0), R(0), U8(4),
B(RestoreGeneratorRegisters), R(1), R(0), U8(3),
B(LdaSmi), I8(-2),
B(Star), R(2),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1),
B(Star), R(4),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(0),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(4),
B(Ldar), R(3),
/* 0 E> */ B(Throw),
B(Ldar), R(4),
B(Ldar), R(3),
/* 19 S> */ B(Return),
B(Mov), R(4), R(1),
B(Ldar), R(1),
B(Ldar), R(3),
B(StaCurrentContextSlot), U8(5),
B(LdaCurrentContextSlot), U8(5),
/* 19 S> */ B(Return),
]
constant pool: [
Smi [43],
Smi [47],
FIXED_ARRAY_TYPE,
Smi [10],
Smi [7],
......@@ -638,58 +692,66 @@ snippet: "
import * as foo from \"bar\"
foo.f(foo, foo.x);
"
frame size: 9
frame size: 7
parameter count: 2
bytecode array length: 118
bytecode array length: 134
bytecodes: [
B(Ldar), R(0),
B(Ldar), R(1),
B(JumpIfUndefined), U8(18),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1),
B(PushContext), R(4),
B(RestoreGeneratorState), R(0),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1),
B(PushContext), R(2),
B(RestoreGeneratorState), R(1),
B(Star), R(0),
B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0),
B(Abort), U8(42),
B(LdaSmi), I8(-2),
B(Star), R(3),
B(LdaConstant), U8(1),
B(Star), R(6),
B(Mov), R(arg0), R(4),
B(Mov), R(closure), R(5),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(4), U8(3),
B(PushContext), R(4),
B(Mov), R(this), R(6),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(5), U8(2),
B(Star), R(0),
B(LdaZero),
B(Star), R(5),
B(CallRuntime), U16(Runtime::kGetModuleNamespace), R(5), U8(1),
B(LdaConstant), U8(1),
B(Star), R(4),
B(Mov), R(arg0), R(2),
B(Mov), R(closure), R(3),
B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3),
B(PushContext), R(2),
B(Mov), R(this), R(4),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2),
B(StaCurrentContextSlot), U8(4),
B(Star), R(1),
B(LdaZero),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kGetModuleNamespace), R(3), U8(1),
B(StaCurrentContextSlot), U8(5),
/* 0 E> */ B(StackCheck),
B(Ldar), R(0),
/* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(5), U8(0),
B(LdaImmutableCurrentContextSlot), U8(4),
/* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0),
/* 45 S> */ B(Return),
B(RestoreGeneratorRegisters), R(0), R(0), U8(5),
B(RestoreGeneratorRegisters), R(1), R(0), U8(3),
B(LdaSmi), I8(-2),
B(Star), R(0),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1),
B(Star), R(3),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1),
B(Star), R(5),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(5),
B(Ldar), R(3),
/* 0 E> */ B(Throw),
B(Ldar), R(5),
B(Ldar), R(3),
/* 45 S> */ B(Return),
/* 31 S> */ B(LdaNamedProperty), R(1), U8(4), U8(0),
/* 27 S> */ B(LdaImmutableCurrentContextSlot), U8(5),
B(Star), R(4),
/* 31 E> */ B(LdaNamedProperty), R(4), U8(4), U8(0),
B(Star), R(3),
B(LdaImmutableCurrentContextSlot), U8(5),
B(Star), R(5),
/* 42 E> */ B(LdaNamedProperty), R(1), U8(5), U8(2),
B(Star), R(8),
/* 31 E> */ B(CallProperty2), R(5), R(1), R(1), R(8), U8(4),
B(Star), R(2),
B(LdaImmutableCurrentContextSlot), U8(5),
B(Star), R(6),
/* 42 E> */ B(LdaNamedProperty), R(6), U8(5), U8(2),
B(Star), R(6),
/* 31 E> */ B(CallProperty2), R(3), R(4), R(5), R(6), U8(4),
B(StaCurrentContextSlot), U8(6),
B(LdaCurrentContextSlot), U8(6),
/* 45 S> */ B(Return),
]
constant pool: [
Smi [55],
Smi [57],
FIXED_ARRAY_TYPE,
Smi [10],
Smi [7],
......
......@@ -6224,9 +6224,9 @@ TEST(ModuleParsingInternals) {
CHECK(declarations->AtForTest(8)->proxy()->raw_name()->IsOneByteEqualTo(
"nonexport"));
CHECK(!declarations->AtForTest(8)->proxy()->var()->binding_needs_init());
CHECK(declarations->AtForTest(8)->proxy()->var()->location() ==
i::VariableLocation::LOCAL);
CHECK(declarations->AtForTest(8)->proxy()->var()->binding_needs_init());
CHECK(declarations->AtForTest(8)->proxy()->var()->location() !=
i::VariableLocation::MODULE);
CHECK(
declarations->AtForTest(9)->proxy()->raw_name()->IsOneByteEqualTo("mm"));
......
......@@ -271,7 +271,7 @@ let salad = 12;
function listener(event, exec_state) {
if (event == Debug.DebugEvent.Break) {
let scope_count = exec_state.frame().scopeCount();
let module_scope = exec_state.frame().scope(1);
let module_scope = exec_state.frame().scope(2);
assertEquals(debug.ScopeType.Module, module_scope.scopeType());
module_scope.setVariableValue('salad', 42);
}
......@@ -311,7 +311,7 @@ export let ham = 1;
function listener(event, exec_state) {
if (event == Debug.DebugEvent.Break) {
let scope_count = exec_state.frame().scopeCount();
let module_scope = exec_state.frame().scope(1);
let module_scope = exec_state.frame().scope(2);
assertEquals(debug.ScopeType.Module, module_scope.scopeType());
module_scope.setVariableValue('ham', 2);
}
......
......@@ -139,10 +139,10 @@ listener_delegate = function(exec_state) {
debug.ScopeType.Script,
debug.ScopeType.Global], exec_state);
CheckScopeContent(
{exported_var: undefined, imported_var: undefined},
{local_var: undefined, exported_var: undefined, imported_var: undefined},
0, exec_state);
CheckScopeDoesNotHave(
["local_var", "doesntexist", "local_let", "exported_let", "imported_let"],
["doesnotexist", "local_let", "exported_let", "imported_let"],
0, exec_state);
};
debugger;
......@@ -161,9 +161,8 @@ listener_delegate = function(exec_state) {
debug.ScopeType.Script,
debug.ScopeType.Global], exec_state);
CheckScopeContent(
{exported_let: 3, exported_var: 4,
{local_let: 1, local_var: 2, exported_let: 3, exported_var: 4,
imported_let: 3, imported_var: 4}, 0, exec_state);
CheckScopeDoesNotHave(["local_var", "local_let"], 0, exec_state);
};
debugger;
EndTest();
......@@ -179,9 +178,8 @@ listener_delegate = function(exec_state) {
debug.ScopeType.Script,
debug.ScopeType.Global], exec_state);
CheckScopeContent(
{exported_let: 13, exported_var: 14,
{local_let: 11, local_var: 12, exported_let: 13, exported_var: 14,
imported_let: 13, imported_var: 14}, 0, exec_state);
CheckScopeDoesNotHave(["local_var", "local_let"], 0, exec_state);
};
debugger;
EndTest();
......@@ -12,8 +12,9 @@ local:foo1
module
[
[0] : a1 = 10
[1] : b1 = 11
[2] : foo1 = function foo1() { let c1 = 12; let g1 = 2; debugger; return a1 + b1 + c1 + g1; }
[1] : g1 = 1
[2] : b1 = 11
[3] : foo1 = function foo1() { let c1 = 12; let g1 = 2; debugger; return a1 + b1 + c1 + g1; }
]
global
[
......@@ -179,8 +180,9 @@ foo2 =
}
module
[
[0] : foo2 = function foo2() { let c2 = 22; return foo1() + a2 + b2 + c2; }
[1] : b3 = 31
[0] : a3 = 30
[1] : foo2 = function foo2() { let c2 = 22; return foo1() + a2 + b2 + c2; }
[2] : b3 = 31
]
global
[
......@@ -198,6 +200,20 @@ Array =
objectId : <objectId>
type : function
}
a3 =
{
description : 30
type : number
value : 30
}
Evaluating: ++a3
updated a3 =
{
description : 31
type : number
value : 31
}
Evaluating: --a3
foo2 =
{
className : Function
......@@ -231,6 +247,12 @@ closure:bar
[
[0] : a = 0
]
module
[
[0] : a = 1
[1] : b = 2
[2] : bar = function bar() { let a = 0; (() => {a; debugger;})(); }
]
global
[
...
......@@ -261,10 +283,37 @@ updated a =
value : 1
}
Evaluating: --a
b =
{
description : 2
type : number
value : 2
}
Evaluating: ++b
updated b =
{
description : 3
type : number
value : 3
}
Evaluating: --b
bar =
{
className : Function
description : function bar() { let a = 0; (() => {a; debugger;})(); }
objectId : <objectId>
type : function
}
local:bar
[
[0] : a = 0
]
module
[
[0] : a = 1
[1] : b = 2
[2] : bar = function bar() { let a = 0; (() => {a; debugger;})(); }
]
global
[
...
......@@ -295,6 +344,33 @@ updated a =
value : 1
}
Evaluating: --a
b =
{
description : 2
type : number
value : 2
}
Evaluating: ++b
updated b =
{
description : 3
type : number
value : 3
}
Evaluating: --b
bar =
{
className : Function
description : function bar() { let a = 0; (() => {a; debugger;})(); }
objectId : <objectId>
type : function
}
module
[
[0] : a = 1
[1] : b = 2
[2] : bar = function bar() { let a = 0; (() => {a; debugger;})(); }
]
global
[
...
......@@ -310,6 +386,41 @@ Array =
objectId : <objectId>
type : function
}
a =
{
description : 1
type : number
value : 1
}
Evaluating: ++a
updated a =
{
description : 2
type : number
value : 2
}
Evaluating: --a
b =
{
description : 2
type : number
value : 2
}
Evaluating: ++b
updated b =
{
description : 3
type : number
value : 3
}
Evaluating: --b
bar =
{
className : Function
description : function bar() { let a = 0; (() => {a; debugger;})(); }
objectId : <objectId>
type : function
}
Running test: testDifferentModuleVariables
(anonymous) (module5:5:0)
......@@ -392,112 +503,3 @@ updated c =
value : 1
}
Evaluating: --c
Running test: testCapturedLocalVariable
(anonymous) (module6:2:25)
(anonymous) (module6:2:37)
local
[
[0] : y = 5
]
module
[
[0] : x = 5
]
global
[
...
]
Check variables in frame#0
let x = 5;
(function() { let y = x; #debugger; })()
Array =
{
className : Function
description : function Array() { [native code] }
objectId : <objectId>
type : function
}
y =
{
description : 5
type : number
value : 5
}
Evaluating: ++y
updated y =
{
description : 6
type : number
value : 6
}
Evaluating: --y
x =
{
description : 5
type : number
value : 5
}
Evaluating: ++x
updated x =
{
description : 6
type : number
value : 6
}
Evaluating: --x
module
[
[0] : x = 5
]
global
[
...
]
Check variables in frame#1
let x = 5;
(function() { let y = x; debugger; })#()
Array =
{
className : Function
description : function Array() { [native code] }
objectId : <objectId>
type : function
}
x =
{
description : 5
type : number
value : 5
}
Evaluating: ++x
updated x =
{
description : 6
type : number
value : 6
}
Evaluating: --x
Running test: testLocalVariableToplevel
(anonymous) (module7:2:0)
global
[
...
]
Check variables in frame#0
let x = 5;
#debugger;
Array =
{
className : Function
description : function Array() { [native code] }
objectId : <objectId>
type : function
}
......@@ -49,16 +49,6 @@ export var c = 0;
debugger;
`;
var module6 = `
let x = 5;
(function() { let y = x; debugger; })()
`;
var module7 = `
let x = 5;
debugger;
`;
InspectorTest.runAsyncTestSuite([
async function testTotal() {
session.setupScriptMap();
......@@ -92,26 +82,6 @@ InspectorTest.runAsyncTestSuite([
await checkFrame(callFrames[i], i);
}
await Protocol.Debugger.resume();
},
async function testCapturedLocalVariable() {
contextGroup.addModule(module6, 'module6');
let {params:{callFrames}} = (await Protocol.Debugger.oncePaused());
session.logCallFrames(callFrames);
for (let i = 0; i < callFrames.length; ++i) {
await checkFrame(callFrames[i], i);
}
await Protocol.Debugger.resume();
},
async function testLocalVariableToplevel() {
contextGroup.addModule(module7, 'module7');
let {params:{callFrames}} = (await Protocol.Debugger.oncePaused());
session.logCallFrames(callFrames);
for (let i = 0; i < callFrames.length; ++i) {
await checkFrame(callFrames[i], i);
}
await Protocol.Debugger.resume();
}
]);
......
// 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.
// MODULE
let foo = () => { return this };
assertEquals(undefined, foo());
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