Remove deprecated v8::preparser namespace.

R=ulan@chromium.org

Review URL: https://codereview.chromium.org/27174002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17192 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 15db1d7c
...@@ -4375,9 +4375,8 @@ FunctionLiteral* Parser::ParseFunctionLiteral( ...@@ -4375,9 +4375,8 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
// building an AST. This gathers the data needed to build a lazy // building an AST. This gathers the data needed to build a lazy
// function. // function.
SingletonLogger logger; SingletonLogger logger;
preparser::PreParser::PreParseResult result = PreParser::PreParseResult result = LazyParseFunctionLiteral(&logger);
LazyParseFunctionLiteral(&logger); if (result == PreParser::kPreParseStackOverflow) {
if (result == preparser::PreParser::kPreParseStackOverflow) {
// Propagate stack overflow. // Propagate stack overflow.
stack_overflow_ = true; stack_overflow_ = true;
*ok = false; *ok = false;
...@@ -4535,16 +4534,14 @@ FunctionLiteral* Parser::ParseFunctionLiteral( ...@@ -4535,16 +4534,14 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
} }
preparser::PreParser::PreParseResult Parser::LazyParseFunctionLiteral( PreParser::PreParseResult Parser::LazyParseFunctionLiteral(
SingletonLogger* logger) { SingletonLogger* logger) {
HistogramTimerScope preparse_scope(isolate()->counters()->pre_parse()); HistogramTimerScope preparse_scope(isolate()->counters()->pre_parse());
ASSERT_EQ(Token::LBRACE, scanner().current_token()); ASSERT_EQ(Token::LBRACE, scanner().current_token());
if (reusable_preparser_ == NULL) { if (reusable_preparser_ == NULL) {
intptr_t stack_limit = isolate()->stack_guard()->real_climit(); intptr_t stack_limit = isolate()->stack_guard()->real_climit();
reusable_preparser_ = new preparser::PreParser(&scanner_, reusable_preparser_ = new PreParser(&scanner_, NULL, stack_limit);
NULL,
stack_limit);
reusable_preparser_->set_allow_harmony_scoping(allow_harmony_scoping()); reusable_preparser_->set_allow_harmony_scoping(allow_harmony_scoping());
reusable_preparser_->set_allow_modules(allow_modules()); reusable_preparser_->set_allow_modules(allow_modules());
reusable_preparser_->set_allow_natives_syntax(allow_natives_syntax()); reusable_preparser_->set_allow_natives_syntax(allow_natives_syntax());
...@@ -4554,7 +4551,7 @@ preparser::PreParser::PreParseResult Parser::LazyParseFunctionLiteral( ...@@ -4554,7 +4551,7 @@ preparser::PreParser::PreParseResult Parser::LazyParseFunctionLiteral(
reusable_preparser_->set_allow_harmony_numeric_literals( reusable_preparser_->set_allow_harmony_numeric_literals(
allow_harmony_numeric_literals()); allow_harmony_numeric_literals());
} }
preparser::PreParser::PreParseResult result = PreParser::PreParseResult result =
reusable_preparser_->PreParseLazyFunction(top_scope_->language_mode(), reusable_preparser_->PreParseLazyFunction(top_scope_->language_mode(),
is_generator(), is_generator(),
logger); logger);
...@@ -5821,15 +5818,15 @@ ScriptDataImpl* PreParserApi::PreParse(Isolate* isolate, ...@@ -5821,15 +5818,15 @@ ScriptDataImpl* PreParserApi::PreParse(Isolate* isolate,
HistogramTimerScope timer(isolate->counters()->pre_parse()); HistogramTimerScope timer(isolate->counters()->pre_parse());
Scanner scanner(isolate->unicode_cache()); Scanner scanner(isolate->unicode_cache());
intptr_t stack_limit = isolate->stack_guard()->real_climit(); 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_lazy(true);
preparser.set_allow_generators(FLAG_harmony_generators); preparser.set_allow_generators(FLAG_harmony_generators);
preparser.set_allow_for_of(FLAG_harmony_iteration); preparser.set_allow_for_of(FLAG_harmony_iteration);
preparser.set_allow_harmony_scoping(FLAG_harmony_scoping); preparser.set_allow_harmony_scoping(FLAG_harmony_scoping);
preparser.set_allow_harmony_numeric_literals(FLAG_harmony_numeric_literals); preparser.set_allow_harmony_numeric_literals(FLAG_harmony_numeric_literals);
scanner.Initialize(source); scanner.Initialize(source);
preparser::PreParser::PreParseResult result = preparser.PreParseProgram(); PreParser::PreParseResult result = preparser.PreParseProgram();
if (result == preparser::PreParser::kPreParseStackOverflow) { if (result == PreParser::kPreParseStackOverflow) {
isolate->StackOverflow(); isolate->StackOverflow();
return NULL; return NULL;
} }
......
...@@ -843,7 +843,7 @@ class Parser BASE_EMBEDDED { ...@@ -843,7 +843,7 @@ class Parser BASE_EMBEDDED {
Handle<String> type, Handle<String> type,
Vector< Handle<Object> > arguments); Vector< Handle<Object> > arguments);
preparser::PreParser::PreParseResult LazyParseFunctionLiteral( PreParser::PreParseResult LazyParseFunctionLiteral(
SingletonLogger* logger); SingletonLogger* logger);
AstNodeFactory<AstConstructionVisitor>* factory() { AstNodeFactory<AstConstructionVisitor>* factory() {
...@@ -855,7 +855,7 @@ class Parser BASE_EMBEDDED { ...@@ -855,7 +855,7 @@ class Parser BASE_EMBEDDED {
Handle<Script> script_; Handle<Script> script_;
Scanner scanner_; Scanner scanner_;
preparser::PreParser* reusable_preparser_; PreParser* reusable_preparser_;
Scope* top_scope_; Scope* top_scope_;
Scope* original_scope_; // for ES5 function declarations in sloppy eval Scope* original_scope_; // for ES5 function declarations in sloppy eval
FunctionState* current_function_state_; FunctionState* current_function_state_;
......
...@@ -53,8 +53,7 @@ int isfinite(double value); ...@@ -53,8 +53,7 @@ int isfinite(double value);
#endif #endif
namespace v8 { namespace v8 {
namespace internal {
namespace preparser {
PreParser::PreParseResult PreParser::PreParseLazyFunction( PreParser::PreParseResult PreParser::PreParseLazyFunction(
i::LanguageMode mode, bool is_generator, i::ParserRecorder* log) { i::LanguageMode mode, bool is_generator, i::ParserRecorder* log) {
...@@ -1663,4 +1662,4 @@ bool PreParser::peek_any_identifier() { ...@@ -1663,4 +1662,4 @@ bool PreParser::peek_any_identifier() {
next == i::Token::YIELD; next == i::Token::YIELD;
} }
} } // v8::preparser } } // v8::internal
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include "scanner.h" #include "scanner.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
// Used to detect duplicates in object literals. Each of the values // Used to detect duplicates in object literals. Each of the values
...@@ -125,11 +124,6 @@ void ObjectLiteralChecker<P>::CheckProperty(Token::Value property, ...@@ -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 // Preparsing checks a JavaScript program and emits preparse-data that helps
// a later parsing to be faster. // a later parsing to be faster.
...@@ -144,6 +138,7 @@ typedef uint8_t byte; ...@@ -144,6 +138,7 @@ typedef uint8_t byte;
// That means that contextual checks (like a label being declared where // That means that contextual checks (like a label being declared where
// it is used) are generally omitted. // it is used) are generally omitted.
typedef uint8_t byte;
namespace i = v8::internal; namespace i = v8::internal;
class PreParser { class PreParser {
...@@ -693,6 +688,6 @@ class PreParser { ...@@ -693,6 +688,6 @@ class PreParser {
friend class i::ObjectLiteralChecker<PreParser>; friend class i::ObjectLiteralChecker<PreParser>;
}; };
} } // v8::preparser } } // v8::internal
#endif // V8_PREPARSER_H #endif // V8_PREPARSER_H
...@@ -264,12 +264,11 @@ TEST(StandAlonePreParser) { ...@@ -264,12 +264,11 @@ TEST(StandAlonePreParser) {
i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); i::Scanner scanner(CcTest::i_isolate()->unicode_cache());
scanner.Initialize(&stream); 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_lazy(true);
preparser.set_allow_natives_syntax(true); preparser.set_allow_natives_syntax(true);
v8::preparser::PreParser::PreParseResult result = i::PreParser::PreParseResult result = preparser.PreParseProgram();
preparser.PreParseProgram(); CHECK_EQ(i::PreParser::kPreParseSuccess, result);
CHECK_EQ(v8::preparser::PreParser::kPreParseSuccess, result);
i::ScriptDataImpl data(log.ExtractData()); i::ScriptDataImpl data(log.ExtractData());
CHECK(!data.has_error()); CHECK(!data.has_error());
} }
...@@ -300,11 +299,10 @@ TEST(StandAlonePreParserNoNatives) { ...@@ -300,11 +299,10 @@ TEST(StandAlonePreParserNoNatives) {
scanner.Initialize(&stream); scanner.Initialize(&stream);
// Preparser defaults to disallowing natives syntax. // 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); preparser.set_allow_lazy(true);
v8::preparser::PreParser::PreParseResult result = i::PreParser::PreParseResult result = preparser.PreParseProgram();
preparser.PreParseProgram(); CHECK_EQ(i::PreParser::kPreParseSuccess, result);
CHECK_EQ(v8::preparser::PreParser::kPreParseSuccess, result);
i::ScriptDataImpl data(log.ExtractData()); i::ScriptDataImpl data(log.ExtractData());
// Data contains syntax error. // Data contains syntax error.
CHECK(data.has_error()); CHECK(data.has_error());
...@@ -402,11 +400,10 @@ TEST(PreParseOverflow) { ...@@ -402,11 +400,10 @@ TEST(PreParseOverflow) {
i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); i::Scanner scanner(CcTest::i_isolate()->unicode_cache());
scanner.Initialize(&stream); 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_lazy(true);
v8::preparser::PreParser::PreParseResult result = i::PreParser::PreParseResult result = preparser.PreParseProgram();
preparser.PreParseProgram(); CHECK_EQ(i::PreParser::kPreParseStackOverflow, result);
CHECK_EQ(v8::preparser::PreParser::kPreParseStackOverflow, result);
} }
...@@ -1121,12 +1118,11 @@ void TestParserSyncWithFlags(i::Handle<i::String> source, unsigned flags) { ...@@ -1121,12 +1118,11 @@ void TestParserSyncWithFlags(i::Handle<i::String> source, unsigned flags) {
{ {
i::Scanner scanner(isolate->unicode_cache()); i::Scanner scanner(isolate->unicode_cache());
i::GenericStringUtf16CharacterStream stream(source, 0, source->length()); 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); SET_PARSER_FLAGS(preparser, flags);
scanner.Initialize(&stream); scanner.Initialize(&stream);
v8::preparser::PreParser::PreParseResult result = i::PreParser::PreParseResult result = preparser.PreParseProgram();
preparser.PreParseProgram(); CHECK_EQ(i::PreParser::kPreParseSuccess, result);
CHECK_EQ(v8::preparser::PreParser::kPreParseSuccess, result);
} }
i::ScriptDataImpl data(log.ExtractData()); i::ScriptDataImpl data(log.ExtractData());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment