Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(658)

Unified Diff: test/mjsunit/bugs/harmony/debug-blockscopes.js

Issue 7631020: Version 3.5.6. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | test/mjsunit/harmony/block-let-declaration.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/bugs/harmony/debug-blockscopes.js
diff --git a/test/mjsunit/harmony/debug-blockscopes.js b/test/mjsunit/bugs/harmony/debug-blockscopes.js
similarity index 64%
copy from test/mjsunit/harmony/debug-blockscopes.js
copy to test/mjsunit/bugs/harmony/debug-blockscopes.js
index 30f681f129da92cdc6a97fea1cd0bb26c1e91a23..a407c531a7d87113183a5a7b4be7b6c2ca779656 100644
--- a/test/mjsunit/harmony/debug-blockscopes.js
+++ b/test/mjsunit/bugs/harmony/debug-blockscopes.js
@@ -157,7 +157,6 @@ function CheckScopeContent(content, number, exec_state) {
scope_size--;
}
- // TODO(keuchel): print('count' + count + ' scopesize' + scope_size);
if (count != scope_size) {
print('Names found in scope:');
var names = scope.scopeObject().propertyNames();
@@ -193,197 +192,33 @@ function CheckScopeContent(content, number, exec_state) {
}
-// Simple empty block scope in local scope.
-BeginTest("Local block 1");
-
-function local_block_1() {
- {
- debugger;
- }
-}
-
-listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Block,
- debug.ScopeType.Local,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({}, 0, exec_state);
- CheckScopeContent({}, 1, exec_state);
-};
-local_block_1();
-EndTest();
-
-
-// Local scope with a parameter.
-BeginTest("Local 2");
-
-function local_2(a) {
- {
- debugger;
- }
-}
-
-listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Block,
- debug.ScopeType.Local,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({a:1}, 1, exec_state);
-};
-local_2(1);
-EndTest();
-
-
-// Local scope with a parameter and a local variable.
-BeginTest("Local 3");
-
-function local_3(a) {
- var x = 3;
- debugger;
-}
-
-listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Local,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({a:1,x:3}, 0, exec_state);
-};
-local_3(1);
-EndTest();
-
-
-// Local scope with parameters and local variables.
-BeginTest("Local 4");
-
-function local_4(a, b) {
- var x = 3;
- var y = 4;
- debugger;
-}
-
-listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Local,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({a:1,b:2,x:3,y:4}, 0, exec_state);
-};
-local_4(1, 2);
-EndTest();
-
-
-// Single empty with block.
-BeginTest("With block 1");
-
-function with_block_1() {
- with({}) {
- debugger;
- }
-}
-
-listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Block,
- debug.ScopeType.With,
- debug.ScopeType.Local,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({}, 0, exec_state);
- CheckScopeContent({}, 1, exec_state);
-};
-with_block_1();
-EndTest();
-
-
-// Nested empty with blocks.
-BeginTest("With block 2");
-
-function with_block_2() {
- with({}) {
- with({}) {
+// Simple closure formed by returning an inner function referering to an outer
+// block local variable and an outer function's parameter. Due to VM
+// optimizations parts of the actual closure is missing from the debugger
+// information.
+BeginTest("Closure 1");
+
+function closure_1(a) {
+ var x = 2;
+ let y = 3;
+ if (true) {
+ let z = 4;
+ function f() {
debugger;
- }
+ return a + x + y + z;
+ };
+ return f;
}
}
listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Block,
- debug.ScopeType.With,
+ CheckScopeChain([debug.ScopeType.Local,
debug.ScopeType.Block,
- debug.ScopeType.With,
- debug.ScopeType.Local,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({}, 0, exec_state);
- CheckScopeContent({}, 1, exec_state);
- CheckScopeContent({}, 2, exec_state);
- CheckScopeContent({}, 3, exec_state);
-};
-with_block_2();
-EndTest();
-
-
-// With block using an in-place object literal.
-BeginTest("With block 3");
-
-function with_block_3() {
- with({a:1,b:2}) {
- debugger;
- }
-}
-
-listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Block,
- debug.ScopeType.With,
- debug.ScopeType.Local,
+ debug.ScopeType.Closure,
debug.ScopeType.Global], exec_state);
CheckScopeContent({}, 0, exec_state);
- CheckScopeContent({a:1,b:2}, 1, exec_state);
+ CheckScopeContent({z:4}, 1, exec_state);
+ CheckScopeContent({a:1,x:2,y:3}, 2, exec_state);
};
-with_block_3();
+closure_1(1)();
EndTest();
-
-
-// Nested with blocks using in-place object literals.
-BeginTest("With block 4");
-
-function with_block_4() {
- with({a:1,b:2}) {
- with({a:2,b:1}) {
- debugger;
- }
- }
-}
-
-listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Block,
- debug.ScopeType.With,
- debug.ScopeType.Block,
- debug.ScopeType.With,
- debug.ScopeType.Local,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({a:2,b:1}, 1, exec_state);
- CheckScopeContent({a:1,b:2}, 3, exec_state);
-};
-with_block_4();
-EndTest();
-
-
-// TODO(keuchel):
-// Simple closure formed by returning an inner function referering to an outer
-// block local variable and an outer function's parameter.
-// BeginTest("Closure 1");
-//
-// function closure_1(a) {
-// {
-// let x = 3;
-// function f() {
-// debugger;
-// return a + x;
-// };
-// }
-// return f;
-// }
-//
-// listener_delegate = function(exec_state) {
-// CheckScopeChain([debug.ScopeType.Local,
-// debug.ScopeType.Closure,
-// debug.ScopeType.Global], exec_state);
-// // CheckScopeContent({}, 0, exec_state);
-// // CheckScopeContent({}, 1, exec_state);
-// // CheckScopeContent({a:1}, 2, exec_state);
-// };
-// closure_1(1)();
-// EndTest();
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | test/mjsunit/harmony/block-let-declaration.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698