Reviewers: danno,

Description:
Remove redundant allow-natives flag from CompilationInfo.

Just use script being native and FLAG_allow_natives_syntax directly.


Please review this at http://codereview.chromium.org/8314018/

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

Affected files:
  M src/compiler.h
  M src/compiler.cc
  M src/parser.cc
  M test/mjsunit/regress/regress-1521.js


Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index 4979a7f8663843f67ee4a91cfa1322bee28b696f..544d1904f95ec3f6a1b6a5ba2159cf98db34793b 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -516,9 +516,6 @@ Handle<SharedFunctionInfo> Compiler::Compile(Handle<String> source,
     info.MarkAsGlobal();
     info.SetExtension(extension);
     info.SetPreParseData(pre_data);
-    if (natives == NATIVES_CODE) {
-      info.MarkAsAllowingNativesSyntax();
-    }
     result = MakeFunctionInfo(&info);
     if (extension == NULL && !result.is_null()) {
       compilation_cache->PutScript(source, result);
Index: src/compiler.h
diff --git a/src/compiler.h b/src/compiler.h
index 09aa23dec984f72b5644bd1f8e52855ffcda99d6..69ab27d9c8196cd562a8103444e41433cc533ef7 100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -83,12 +83,6 @@ class CompilationInfo BASE_EMBEDDED {
     ASSERT(is_lazy());
     flags_ |= IsInLoop::encode(true);
   }
-  void MarkAsAllowingNativesSyntax() {
-    flags_ |= IsNativesSyntaxAllowed::encode(true);
-  }
-  bool allows_natives_syntax() const {
-    return IsNativesSyntaxAllowed::decode(flags_);
-  }
   void MarkAsNative() {
     flags_ |= IsNative::encode(true);
   }
@@ -199,8 +193,6 @@ class CompilationInfo BASE_EMBEDDED {
   class IsInLoop: public BitField<bool, 3, 1> {};
   // Strict mode - used in eager compilation.
   class IsStrictMode: public BitField<bool, 4, 1> {};
-  // Native syntax (%-stuff) allowed?
-  class IsNativesSyntaxAllowed: public BitField<bool, 5, 1> {};
   // Is this a function from our natives.
   class IsNative: public BitField<bool, 6, 1> {};

Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index fb94a1a60b5ad3715590a59685ed60705fb41344..3bf2cf911cf51a402d80ea1991a374bed1037cd9 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -5196,13 +5196,16 @@ bool ParserApi::Parse(CompilationInfo* info) {
   Handle<Script> script = info->script();
   bool harmony_scoping = !info->is_native() && FLAG_harmony_scoping;
   if (info->is_lazy()) {
-    Parser parser(script, true, NULL, NULL);
+    bool allow_natives_syntax =
+        FLAG_allow_natives_syntax ||
+        info->is_native();
+    Parser parser(script, allow_natives_syntax, NULL, NULL);
     parser.SetHarmonyScoping(harmony_scoping);
     result = parser.ParseLazy(info);
   } else {
     // Whether we allow %identifier(..) syntax.
     bool allow_natives_syntax =
-        info->allows_natives_syntax() || FLAG_allow_natives_syntax;
+        info->is_native() || FLAG_allow_natives_syntax;
     ScriptDataImpl* pre_data = info->pre_parse_data();
     Parser parser(script,
                   allow_natives_syntax,
Index: test/mjsunit/regress/regress-1521.js
diff --git a/test/mjsunit/regress/regress-1521.js b/test/mjsunit/regress/regress-1521.js index 415db6780324621d59ff4efdb30da66706aa596d..3149f05a5e93e6711561d4eec4d7c84aa80edcbc 100644
--- a/test/mjsunit/regress/regress-1521.js
+++ b/test/mjsunit/regress/regress-1521.js
@@ -24,6 +24,8 @@
 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Flags: --allow-natives-syntax

 // Optimized variable access inside through a catch context should work.
 function test(x) {
@@ -44,4 +46,3 @@ function test(x) {
 }

 test(3);
-


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to