Reviewers: ulan,

Description:
Remove deprecated v8::preparser namespace.

R=u...@chromium.org

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

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

Affected files (+26, -39 lines):
  M src/parser.h
  M src/parser.cc
  M src/preparser.h
  M src/preparser.cc
  M test/cctest/test-parsing.cc


Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 96b1aa84ff7cc61bab26f9d48dae91509ea9cfb6..e0ddd5907ce621a2502ba84cfd2ad2a63c978e47 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -4362,9 +4362,8 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
         // building an AST. This gathers the data needed to build a lazy
         // function.
         SingletonLogger logger;
-        preparser::PreParser::PreParseResult result =
-            LazyParseFunctionLiteral(&logger);
-        if (result == preparser::PreParser::kPreParseStackOverflow) {
+ PreParser::PreParseResult result = LazyParseFunctionLiteral(&logger);
+        if (result == PreParser::kPreParseStackOverflow) {
           // Propagate stack overflow.
           stack_overflow_ = true;
           *ok = false;
@@ -4521,16 +4520,14 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
 }


-preparser::PreParser::PreParseResult Parser::LazyParseFunctionLiteral(
+PreParser::PreParseResult Parser::LazyParseFunctionLiteral(
     SingletonLogger* logger) {
   HistogramTimerScope preparse_scope(isolate()->counters()->pre_parse());
   ASSERT_EQ(Token::LBRACE, scanner().current_token());

   if (reusable_preparser_ == NULL) {
     intptr_t stack_limit = isolate()->stack_guard()->real_climit();
-    reusable_preparser_ = new preparser::PreParser(&scanner_,
-                                                   NULL,
-                                                   stack_limit);
+    reusable_preparser_ = new PreParser(&scanner_, NULL, stack_limit);
reusable_preparser_->set_allow_harmony_scoping(allow_harmony_scoping());
     reusable_preparser_->set_allow_modules(allow_modules());
     reusable_preparser_->set_allow_natives_syntax(allow_natives_syntax());
@@ -4540,7 +4537,7 @@ preparser::PreParser::PreParseResult Parser::LazyParseFunctionLiteral(
     reusable_preparser_->set_allow_harmony_numeric_literals(
         allow_harmony_numeric_literals());
   }
-  preparser::PreParser::PreParseResult result =
+  PreParser::PreParseResult result =
reusable_preparser_->PreParseLazyFunction(top_scope_->language_mode(),
                                                 is_generator(),
                                                 logger);
@@ -5803,15 +5800,15 @@ ScriptDataImpl* PreParserApi::PreParse(Isolate* isolate,
   HistogramTimerScope timer(isolate->counters()->pre_parse());
   Scanner scanner(isolate->unicode_cache());
   intptr_t stack_limit = isolate->stack_guard()->real_climit();
-  preparser::PreParser preparser(&scanner, &recorder, stack_limit);
+  PreParser preparser(&scanner, &recorder, stack_limit);
   preparser.set_allow_lazy(true);
   preparser.set_allow_generators(FLAG_harmony_generators);
   preparser.set_allow_for_of(FLAG_harmony_iteration);
   preparser.set_allow_harmony_scoping(FLAG_harmony_scoping);
preparser.set_allow_harmony_numeric_literals(FLAG_harmony_numeric_literals);
   scanner.Initialize(source);
- preparser::PreParser::PreParseResult result = preparser.PreParseProgram();
-  if (result == preparser::PreParser::kPreParseStackOverflow) {
+  PreParser::PreParseResult result = preparser.PreParseProgram();
+  if (result == PreParser::kPreParseStackOverflow) {
     isolate->StackOverflow();
     return NULL;
   }
Index: src/parser.h
diff --git a/src/parser.h b/src/parser.h
index e5853bd582488cae0bbfba41bbdb901ab5813db2..055103e8010153b887669041e338068b73cced23 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -841,7 +841,7 @@ class Parser BASE_EMBEDDED {
                             Handle<String> type,
                             Vector< Handle<Object> > arguments);

-  preparser::PreParser::PreParseResult LazyParseFunctionLiteral(
+  PreParser::PreParseResult LazyParseFunctionLiteral(
        SingletonLogger* logger);

   AstNodeFactory<AstConstructionVisitor>* factory() {
@@ -853,7 +853,7 @@ class Parser BASE_EMBEDDED {

   Handle<Script> script_;
   Scanner scanner_;
-  preparser::PreParser* reusable_preparser_;
+  PreParser* reusable_preparser_;
   Scope* top_scope_;
   Scope* original_scope_;  // for ES5 function declarations in sloppy eval
   FunctionState* current_function_state_;
Index: src/preparser.cc
diff --git a/src/preparser.cc b/src/preparser.cc
index 11f5595440fcde4771e62c5d05a2aef9300fe2f0..4b65b46496bb83c73167e28bab349f427601d668 100644
--- a/src/preparser.cc
+++ b/src/preparser.cc
@@ -53,8 +53,7 @@ int isfinite(double value);
 #endif

 namespace v8 {
-
-namespace preparser {
+namespace internal {

 PreParser::PreParseResult PreParser::PreParseLazyFunction(
     i::LanguageMode mode, bool is_generator, i::ParserRecorder* log) {
@@ -1663,4 +1662,4 @@ bool PreParser::peek_any_identifier() {
          next == i::Token::YIELD;
 }

-} }  // v8::preparser
+} }  // v8::internal
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index 08766e9160fee303d0805180c2878827db5e54a9..770cc82e1ee2aaec09b257f8f0fc3faa7272580a 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -33,7 +33,6 @@
 #include "scanner.h"

 namespace v8 {
-
 namespace internal {

 // Used to detect duplicates in object literals. Each of the values
@@ -125,11 +124,6 @@ void ObjectLiteralChecker<P>::CheckProperty(Token::Value property,
   }
 }

-}  // v8::internal
-
-namespace preparser {
-
-typedef uint8_t byte;

// Preparsing checks a JavaScript program and emits preparse-data that helps
 // a later parsing to be faster.
@@ -144,6 +138,7 @@ typedef uint8_t byte;
 // That means that contextual checks (like a label being declared where
 // it is used) are generally omitted.

+typedef uint8_t byte;
 namespace i = v8::internal;

 class PreParser {
@@ -693,6 +688,6 @@ class PreParser {
   friend class i::ObjectLiteralChecker<PreParser>;
 };

-} }  // v8::preparser
+} }  // v8::internal

 #endif  // V8_PREPARSER_H
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index f84b8ad6b3c93f58c9e5e19a4f4b11206bffadb3..04e64cf55c1e5be50eb981184ab9940ca169f3e4 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -264,12 +264,11 @@ TEST(StandAlonePreParser) {
     i::Scanner scanner(CcTest::i_isolate()->unicode_cache());
     scanner.Initialize(&stream);

-    v8::preparser::PreParser preparser(&scanner, &log, stack_limit);
+    i::PreParser preparser(&scanner, &log, stack_limit);
     preparser.set_allow_lazy(true);
     preparser.set_allow_natives_syntax(true);
-    v8::preparser::PreParser::PreParseResult result =
-        preparser.PreParseProgram();
-    CHECK_EQ(v8::preparser::PreParser::kPreParseSuccess, result);
+    i::PreParser::PreParseResult result = preparser.PreParseProgram();
+    CHECK_EQ(i::PreParser::kPreParseSuccess, result);
     i::ScriptDataImpl data(log.ExtractData());
     CHECK(!data.has_error());
   }
@@ -300,11 +299,10 @@ TEST(StandAlonePreParserNoNatives) {
     scanner.Initialize(&stream);

     // Preparser defaults to disallowing natives syntax.
-    v8::preparser::PreParser preparser(&scanner, &log, stack_limit);
+    i::PreParser preparser(&scanner, &log, stack_limit);
     preparser.set_allow_lazy(true);
-    v8::preparser::PreParser::PreParseResult result =
-        preparser.PreParseProgram();
-    CHECK_EQ(v8::preparser::PreParser::kPreParseSuccess, result);
+    i::PreParser::PreParseResult result = preparser.PreParseProgram();
+    CHECK_EQ(i::PreParser::kPreParseSuccess, result);
     i::ScriptDataImpl data(log.ExtractData());
     // Data contains syntax error.
     CHECK(data.has_error());
@@ -402,11 +400,10 @@ TEST(PreParseOverflow) {
   i::Scanner scanner(CcTest::i_isolate()->unicode_cache());
   scanner.Initialize(&stream);

-  v8::preparser::PreParser preparser(&scanner, &log, stack_limit);
+  i::PreParser preparser(&scanner, &log, stack_limit);
   preparser.set_allow_lazy(true);
-  v8::preparser::PreParser::PreParseResult result =
-      preparser.PreParseProgram();
-  CHECK_EQ(v8::preparser::PreParser::kPreParseStackOverflow, result);
+  i::PreParser::PreParseResult result = preparser.PreParseProgram();
+  CHECK_EQ(i::PreParser::kPreParseStackOverflow, result);
 }


@@ -1121,12 +1118,11 @@ void TestParserSyncWithFlags(i::Handle<i::String> source, unsigned flags) {
   {
     i::Scanner scanner(isolate->unicode_cache());
i::GenericStringUtf16CharacterStream stream(source, 0, source->length());
-    v8::preparser::PreParser preparser(&scanner, &log, stack_limit);
+    i::PreParser preparser(&scanner, &log, stack_limit);
     SET_PARSER_FLAGS(preparser, flags);
     scanner.Initialize(&stream);
-    v8::preparser::PreParser::PreParseResult result =
-        preparser.PreParseProgram();
-    CHECK_EQ(v8::preparser::PreParser::kPreParseSuccess, result);
+    i::PreParser::PreParseResult result = preparser.PreParseProgram();
+    CHECK_EQ(i::PreParser::kPreParseSuccess, result);
   }
   i::ScriptDataImpl data(log.ExtractData());



--
--
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to