// 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;
}
-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());
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);
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;
}
Handle<String> type,
Vector< Handle<Object> > arguments);
- preparser::PreParser::PreParseResult LazyParseFunctionLiteral(
+ PreParser::PreParseResult LazyParseFunctionLiteral(
SingletonLogger* logger);
AstNodeFactory<AstConstructionVisitor>* factory() {
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_;
#endif
namespace v8 {
-
-namespace preparser {
+namespace internal {
PreParser::PreParseResult PreParser::PreParseLazyFunction(
i::LanguageMode mode, bool is_generator, i::ParserRecorder* log) {
next == i::Token::YIELD;
}
-} } // v8::preparser
+} } // v8::internal
#include "scanner.h"
namespace v8 {
-
namespace internal {
// Used to detect duplicates in object literals. Each of the values
}
}
-} // 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.
// 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 {
friend class i::ObjectLiteralChecker<PreParser>;
};
-} } // v8::preparser
+} } // v8::internal
#endif // V8_PREPARSER_H
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());
}
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());
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);
}
{
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());