Reviewers: Yang,
Description:
Context-allocate all parameters in generators
Generator function scopes have forced context allocation. Ensure that
all variables in such scopes get context allocation -- even unused
variables.
This fixes an assertion when reifying generator scopes in the debugger.
R=
LOG=Y
BUG=v8:3280
Please review this at https://codereview.chromium.org/246733003/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+26, -1 lines):
M src/scopes.cc
A test/mjsunit/regress/regress-3280.js
Index: src/scopes.cc
diff --git a/src/scopes.cc b/src/scopes.cc
index
4c4729e69ceee1d55624ddc4d278e3dec1b92495..833198ca0d4b9af508a272a7d81c83b80ba70c77
100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -1266,7 +1266,7 @@ void Scope::AllocateParameterLocals() {
for (int i = params_.length() - 1; i >= 0; --i) {
Variable* var = params_[i];
ASSERT(var->scope() == this);
- if (uses_sloppy_arguments) {
+ if (uses_sloppy_arguments || has_forced_context_allocation()) {
// Force context allocation of the parameter.
var->ForceContextAllocation();
}
Index: test/mjsunit/regress/regress-3280.js
diff --git a/test/mjsunit/regress/regress-3280.js
b/test/mjsunit/regress/regress-3280.js
new file mode 100644
index
0000000000000000000000000000000000000000..2fc72cc867722bc0bc76a9ec7a4b068da4a07872
--- /dev/null
+++ b/test/mjsunit/regress/regress-3280.js
@@ -0,0 +1,25 @@
+// Copyright 2014 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-generators --expose-debug-as debug
+
+var Debug = debug.Debug;
+
+var listener_called;
+
+function listener(event, exec_state, event_data, data) {
+ if (event == Debug.DebugEvent.Break) {
+ listener_called = true;
+ exec_state.frame().allScopes();
+ }
+}
+
+Debug.setListener(listener);
+
+function *generator_local_2(a) {
+ debugger;
+}
+generator_local_2(1).next();
+
+assertTrue(listener_called, "listener not called");
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.