Reviewers: dcarney, Jakob, rossberg,

Message:
dcarney, rossberg, jkummerow, ptal

rossberg, you bumped the variable limit the last time (jkummerow, you reviewed; see description for a link) do you know what the "correct" limit is (if there is
one) and what will go wrong if we have too many variable?

Description:
Increase the "local variables in a function" limit.

Based on experiments, it seems like nothing goes wrong if the limit is upped,
and local variables still resolve correctly.

Notes:
- It's unclear what the "correct" limit is and which part of the code needs it.
- https://codereview.chromium.org/11099063/ bumped the limit the last time.
- Test will follow in a separate CL.

[email protected],[email protected],[email protected]
BUG=

Please review this at https://codereview.chromium.org/206283002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+7, -5 lines):
  M src/messages.js
  M src/parser.h
  M test/mjsunit/limit-locals.js


Index: src/messages.js
diff --git a/src/messages.js b/src/messages.js
index e6365a441e32c732ab2a0aad9a455a2523fdebbe..40470325e8d5d40a3fcf404a74651edf8ea0f86e 100644
--- a/src/messages.js
+++ b/src/messages.js
@@ -157,7 +157,7 @@ var kMessages = {
strict_eval_arguments: ["Unexpected eval or arguments in strict mode"], too_many_arguments: ["Too many arguments in function call (only 65535 allowed)"], too_many_parameters: ["Too many parameters in function definition (only 65535 allowed)"], - too_many_variables: ["Too many variables declared (only 131071 allowed)"], + too_many_variables: ["Too many variables declared (only 262143 allowed)"], strict_param_dupe: ["Strict mode function may not have duplicate parameter names"], strict_octal_literal: ["Octal literals are not allowed in strict mode."], strict_duplicate_property: ["Duplicate data property in object literal not allowed in strict mode"],
Index: src/parser.h
diff --git a/src/parser.h b/src/parser.h
index 3d2f03229f0558f1e0860b93e88ae52f35878be0..98d422dcb541dfe01edd826ed98e721d7c34ceee 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -618,7 +618,8 @@ class Parser : public ParserBase<ParserTraits> {
  private:
   friend class ParserTraits;

-  static const int kMaxNumFunctionLocals = 131071;  // 2^17-1
+  // Nobody really knows why we need this limit. :(
+  static const int kMaxNumFunctionLocals = 262143;  // 2^18-1

   enum Mode {
     PARSE_LAZILY,
Index: test/mjsunit/limit-locals.js
diff --git a/test/mjsunit/limit-locals.js b/test/mjsunit/limit-locals.js
index 1d36c80e5d643d5ee9c48543d185a64de3ec72ee..25fe112b0f0b496f06fe9b218d2e18208636d938 100644
--- a/test/mjsunit/limit-locals.js
+++ b/test/mjsunit/limit-locals.js
@@ -25,9 +25,9 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-// Test that there is a limit of 131071 locals.
+// Test that there is a limit of 262143 locals.

-// Flags: --stack-size=1200
+// Flags: --stack-size=2400

 function function_with_n_locals(n) {
   test_prefix = "prefix ";
@@ -43,5 +43,6 @@ function function_with_n_locals(n) {
 assertEquals("prefix 0 suffix", function_with_n_locals(0));
 assertEquals("prefix 16000 suffix", function_with_n_locals(16000));
 assertEquals("prefix 131071 suffix", function_with_n_locals(131071));
+assertEquals("prefix 262143 suffix", function_with_n_locals(262143));

-assertThrows("function_with_n_locals(131072)");
+assertThrows("function_with_n_locals(262144)");


--
--
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.

Reply via email to