Revision: 20189
Author:   [email protected]
Date:     Mon Mar 24 12:16:09 2014 UTC
Log:      PreParser cleanup: no need to track with-ness of scopes.

Historically, we used to track the "with-ness" of a scope differently; not
creating a with scope, but setting a property on the scope (see
https://codereview.chromium.org/5166006 ). For laziness decisions, checking the with-ness should be unnecessary: the current scope is function scope, and if the
outer scope is global scope, there's surely no with scope in between.

[email protected]
BUG=

Review URL: https://codereview.chromium.org/209863004
http://code.google.com/p/v8/source/detail?r=20189

Modified:
 /branches/bleeding_edge/src/preparser.cc
 /branches/bleeding_edge/src/preparser.h

=======================================
--- /branches/bleeding_edge/src/preparser.cc    Fri Mar 21 10:34:51 2014 UTC
+++ /branches/bleeding_edge/src/preparser.cc    Mon Mar 24 12:16:09 2014 UTC
@@ -850,7 +850,6 @@

   // Parse function body.
   ScopeType outer_scope_type = scope_->type();
-  bool inside_with = scope_->inside_with();
   PreParserScope function_scope(scope_, FUNCTION_SCOPE);
   FunctionState function_state(&function_state_, &scope_, &function_scope);
   function_state.set_is_generator(is_generator);
@@ -892,8 +891,7 @@

// See Parser::ParseFunctionLiteral for more information about lazy parsing
   // and lazy compilation.
-  bool is_lazily_parsed = (outer_scope_type == GLOBAL_SCOPE &&
-                           !inside_with && allow_lazy() &&
+ bool is_lazily_parsed = (outer_scope_type == GLOBAL_SCOPE && allow_lazy() &&
                            !parenthesized_function_);
   parenthesized_function_ = false;

=======================================
--- /branches/bleeding_edge/src/preparser.h     Fri Mar 21 10:34:51 2014 UTC
+++ /branches/bleeding_edge/src/preparser.h     Mon Mar 24 12:16:09 2014 UTC
@@ -678,18 +678,7 @@
  public:
explicit PreParserScope(PreParserScope* outer_scope, ScopeType scope_type)
       : scope_type_(scope_type) {
-    if (outer_scope) {
- scope_inside_with_ = outer_scope->scope_inside_with_ || is_with_scope();
-      strict_mode_ = outer_scope->strict_mode();
-    } else {
-      scope_inside_with_ = is_with_scope();
-      strict_mode_ = SLOPPY;
-    }
-  }
-
-  bool is_with_scope() const { return scope_type_ == WITH_SCOPE; }
-  bool inside_with() const {
-    return scope_inside_with_;
+    strict_mode_ = outer_scope ? outer_scope->strict_mode() : SLOPPY;
   }

   ScopeType type() { return scope_type_; }
@@ -698,7 +687,6 @@

  private:
   ScopeType scope_type_;
-  bool scope_inside_with_;
   StrictMode strict_mode_;
 };

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