585b39f53a
This is a reland of c3bd741efd
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
TBR=kozyatinskiy@chromium.org
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel
Bug: chromium:791334
Change-Id: I57acc7b84a345565b36cbb55924fa2ff9b449eec
Reviewed-on: https://chromium-review.googlesource.com/822341
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50045}
504 lines
6.9 KiB
Plaintext
504 lines
6.9 KiB
Plaintext
Tests evaluateOnCallFrame in module.
|
|
|
|
Running test: testTotal
|
|
foo1 (module1:7:2)
|
|
foo2 (module2:6:9)
|
|
(anonymous) (module3:4:0)
|
|
local:foo1
|
|
[
|
|
[0] : c1 = 12
|
|
[1] : g1 = 2
|
|
]
|
|
module
|
|
[
|
|
[0] : a1 = 10
|
|
[1] : b1 = 11
|
|
[2] : foo1 = function foo1() { let c1 = 12; let g1 = 2; debugger; return a1 + b1 + c1 + g1; }
|
|
]
|
|
global
|
|
[
|
|
...
|
|
]
|
|
Check variables in frame#0
|
|
let g1 = 2;
|
|
#debugger;
|
|
return a1 + b1 + c1 + g1;
|
|
|
|
Array =
|
|
{
|
|
className : Function
|
|
description : function Array() { [native code] }
|
|
objectId : <objectId>
|
|
type : function
|
|
}
|
|
c1 =
|
|
{
|
|
description : 12
|
|
type : number
|
|
value : 12
|
|
}
|
|
Evaluating: ++c1
|
|
updated c1 =
|
|
{
|
|
description : 13
|
|
type : number
|
|
value : 13
|
|
}
|
|
Evaluating: --c1
|
|
g1 =
|
|
{
|
|
description : 2
|
|
type : number
|
|
value : 2
|
|
}
|
|
Evaluating: ++g1
|
|
updated g1 =
|
|
{
|
|
description : 3
|
|
type : number
|
|
value : 3
|
|
}
|
|
Evaluating: --g1
|
|
a1 =
|
|
{
|
|
description : 10
|
|
type : number
|
|
value : 10
|
|
}
|
|
Evaluating: ++a1
|
|
updated a1 =
|
|
{
|
|
description : 11
|
|
type : number
|
|
value : 11
|
|
}
|
|
Evaluating: --a1
|
|
b1 =
|
|
{
|
|
description : 11
|
|
type : number
|
|
value : 11
|
|
}
|
|
Evaluating: ++b1
|
|
updated b1 =
|
|
{
|
|
description : 12
|
|
type : number
|
|
value : 12
|
|
}
|
|
Evaluating: --b1
|
|
foo1 =
|
|
{
|
|
className : Function
|
|
description : function foo1() { let c1 = 12; let g1 = 2; debugger; return a1 + b1 + c1 + g1; }
|
|
objectId : <objectId>
|
|
type : function
|
|
}
|
|
local:foo2
|
|
[
|
|
[0] : c2 = 22
|
|
]
|
|
module
|
|
[
|
|
[0] : a2 = 20
|
|
[1] : foo1 = function foo1() { let c1 = 12; let g1 = 2; debugger; return a1 + b1 + c1 + g1; }
|
|
[2] : b2 = 21
|
|
[3] : foo2 = function foo2() { let c2 = 22; return foo1() + a2 + b2 + c2; }
|
|
]
|
|
global
|
|
[
|
|
...
|
|
]
|
|
Check variables in frame#1
|
|
let c2 = 22;
|
|
return #foo1() + a2 + b2 + c2;
|
|
}
|
|
|
|
Array =
|
|
{
|
|
className : Function
|
|
description : function Array() { [native code] }
|
|
objectId : <objectId>
|
|
type : function
|
|
}
|
|
c2 =
|
|
{
|
|
description : 22
|
|
type : number
|
|
value : 22
|
|
}
|
|
Evaluating: ++c2
|
|
updated c2 =
|
|
{
|
|
description : 23
|
|
type : number
|
|
value : 23
|
|
}
|
|
Evaluating: --c2
|
|
a2 =
|
|
{
|
|
description : 20
|
|
type : number
|
|
value : 20
|
|
}
|
|
Evaluating: ++a2
|
|
updated a2 =
|
|
{
|
|
description : 21
|
|
type : number
|
|
value : 21
|
|
}
|
|
Evaluating: --a2
|
|
foo1 =
|
|
{
|
|
className : Function
|
|
description : function foo1() { let c1 = 12; let g1 = 2; debugger; return a1 + b1 + c1 + g1; }
|
|
objectId : <objectId>
|
|
type : function
|
|
}
|
|
b2 =
|
|
{
|
|
description : 21
|
|
type : number
|
|
value : 21
|
|
}
|
|
Evaluating: ++b2
|
|
updated b2 =
|
|
{
|
|
description : 22
|
|
type : number
|
|
value : 22
|
|
}
|
|
Evaluating: --b2
|
|
foo2 =
|
|
{
|
|
className : Function
|
|
description : function foo2() { let c2 = 22; return foo1() + a2 + b2 + c2; }
|
|
objectId : <objectId>
|
|
type : function
|
|
}
|
|
module
|
|
[
|
|
[0] : foo2 = function foo2() { let c2 = 22; return foo1() + a2 + b2 + c2; }
|
|
[1] : b3 = 31
|
|
]
|
|
global
|
|
[
|
|
...
|
|
]
|
|
Check variables in frame#2
|
|
export let b3 = 31;
|
|
#foo2();
|
|
|
|
|
|
Array =
|
|
{
|
|
className : Function
|
|
description : function Array() { [native code] }
|
|
objectId : <objectId>
|
|
type : function
|
|
}
|
|
foo2 =
|
|
{
|
|
className : Function
|
|
description : function foo2() { let c2 = 22; return foo1() + a2 + b2 + c2; }
|
|
objectId : <objectId>
|
|
type : function
|
|
}
|
|
b3 =
|
|
{
|
|
description : 31
|
|
type : number
|
|
value : 31
|
|
}
|
|
Evaluating: ++b3
|
|
updated b3 =
|
|
{
|
|
description : 32
|
|
type : number
|
|
value : 32
|
|
}
|
|
Evaluating: --b3
|
|
|
|
Running test: testAnother
|
|
(anonymous) (module4:5:13)
|
|
bar (module4:5:24)
|
|
(anonymous) (module4:7:0)
|
|
local
|
|
[
|
|
]
|
|
closure:bar
|
|
[
|
|
[0] : a = 0
|
|
]
|
|
global
|
|
[
|
|
...
|
|
]
|
|
Check variables in frame#0
|
|
let a = 0;
|
|
(() => {a; #debugger;})();
|
|
};
|
|
|
|
Array =
|
|
{
|
|
className : Function
|
|
description : function Array() { [native code] }
|
|
objectId : <objectId>
|
|
type : function
|
|
}
|
|
a =
|
|
{
|
|
description : 0
|
|
type : number
|
|
value : 0
|
|
}
|
|
Evaluating: ++a
|
|
updated a =
|
|
{
|
|
description : 1
|
|
type : number
|
|
value : 1
|
|
}
|
|
Evaluating: --a
|
|
local:bar
|
|
[
|
|
[0] : a = 0
|
|
]
|
|
global
|
|
[
|
|
...
|
|
]
|
|
Check variables in frame#1
|
|
let a = 0;
|
|
(() => {a; debugger;})#();
|
|
};
|
|
|
|
Array =
|
|
{
|
|
className : Function
|
|
description : function Array() { [native code] }
|
|
objectId : <objectId>
|
|
type : function
|
|
}
|
|
a =
|
|
{
|
|
description : 0
|
|
type : number
|
|
value : 0
|
|
}
|
|
Evaluating: ++a
|
|
updated a =
|
|
{
|
|
description : 1
|
|
type : number
|
|
value : 1
|
|
}
|
|
Evaluating: --a
|
|
global
|
|
[
|
|
...
|
|
]
|
|
Check variables in frame#2
|
|
};
|
|
#bar();
|
|
|
|
Array =
|
|
{
|
|
className : Function
|
|
description : function Array() { [native code] }
|
|
objectId : <objectId>
|
|
type : function
|
|
}
|
|
|
|
Running test: testDifferentModuleVariables
|
|
(anonymous) (module5:5:0)
|
|
module
|
|
[
|
|
[0] : b2 = 21
|
|
[1] : a = 0
|
|
[2] : b = 0
|
|
[3] : c = 0
|
|
]
|
|
global
|
|
[
|
|
...
|
|
]
|
|
Check variables in frame#0
|
|
export var c = 0;
|
|
#debugger;
|
|
|
|
|
|
Array =
|
|
{
|
|
className : Function
|
|
description : function Array() { [native code] }
|
|
objectId : <objectId>
|
|
type : function
|
|
}
|
|
b2 =
|
|
{
|
|
description : 21
|
|
type : number
|
|
value : 21
|
|
}
|
|
Evaluating: ++b2
|
|
updated b2 =
|
|
{
|
|
description : 21
|
|
type : number
|
|
value : 21
|
|
}
|
|
Evaluating: --b2
|
|
a =
|
|
{
|
|
description : 0
|
|
type : number
|
|
value : 0
|
|
}
|
|
Evaluating: ++a
|
|
updated a =
|
|
{
|
|
description : 0
|
|
type : number
|
|
value : 0
|
|
}
|
|
Evaluating: --a
|
|
b =
|
|
{
|
|
description : 0
|
|
type : number
|
|
value : 0
|
|
}
|
|
Evaluating: ++b
|
|
updated b =
|
|
{
|
|
description : 1
|
|
type : number
|
|
value : 1
|
|
}
|
|
Evaluating: --b
|
|
c =
|
|
{
|
|
description : 0
|
|
type : number
|
|
value : 0
|
|
}
|
|
Evaluating: ++c
|
|
updated c =
|
|
{
|
|
description : 1
|
|
type : number
|
|
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
|
|
}
|