Revert "Assign bailout and type feedback IDs in a post-pass"

This reverts r24757, which breaks the ARM64 simulator build.
Simple repro:

   out/arm64.debug/d8 -e 'eval("(function(){ const x; var x; })")'

TBR=bmeurer@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24762 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
svenpanne@chromium.org 2014-10-21 10:55:12 +00:00
parent ce9f799d39
commit d66d302b00
22 changed files with 362 additions and 794 deletions

View File

@ -433,8 +433,6 @@ source_set("v8_base") {
"src/assembler.h",
"src/assert-scope.h",
"src/assert-scope.cc",
"src/ast-numbering.cc",
"src/ast-numbering.h",
"src/ast-value-factory.cc",
"src/ast-value-factory.h",
"src/ast.cc",

View File

@ -1,416 +0,0 @@
// Copyright 2012 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/v8.h"
#include "src/ast.h"
#include "src/ast-numbering.h"
#include "src/compiler.h"
#include "src/scopes.h"
namespace v8 {
namespace internal {
class AstNumberingVisitor FINAL : public AstVisitor {
public:
explicit AstNumberingVisitor(Zone* zone)
: AstVisitor(), next_id_(BailoutId::FirstUsable().ToInt()) {
InitializeAstVisitor(zone);
}
void Renumber(FunctionLiteral* node);
private:
// AST node visitor interface.
#define DEFINE_VISIT(type) virtual void Visit##type(type* node);
AST_NODE_LIST(DEFINE_VISIT)
#undef DEFINE_VISIT
void VisitStatements(ZoneList<Statement*>* statements);
void VisitDeclarations(ZoneList<Declaration*>* declarations);
void VisitArguments(ZoneList<Expression*>* arguments);
void VisitObjectLiteralProperty(ObjectLiteralProperty* property);
int ReserveIdRange(int n) {
int tmp = next_id_;
next_id_ += n;
return tmp;
}
int next_id_;
DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
DISALLOW_COPY_AND_ASSIGN(AstNumberingVisitor);
};
void AstNumberingVisitor::VisitVariableDeclaration(VariableDeclaration* node) {
VisitVariableProxy(node->proxy());
}
void AstNumberingVisitor::VisitExportDeclaration(ExportDeclaration* node) {
VisitVariableProxy(node->proxy());
}
void AstNumberingVisitor::VisitModuleUrl(ModuleUrl* node) {}
void AstNumberingVisitor::VisitEmptyStatement(EmptyStatement* node) {}
void AstNumberingVisitor::VisitContinueStatement(ContinueStatement* node) {}
void AstNumberingVisitor::VisitBreakStatement(BreakStatement* node) {}
void AstNumberingVisitor::VisitDebuggerStatement(DebuggerStatement* node) {
node->set_base_id(ReserveIdRange(DebuggerStatement::num_ids()));
}
void AstNumberingVisitor::VisitNativeFunctionLiteral(
NativeFunctionLiteral* node) {
node->set_base_id(ReserveIdRange(NativeFunctionLiteral::num_ids()));
}
void AstNumberingVisitor::VisitLiteral(Literal* node) {
node->set_base_id(ReserveIdRange(Literal::num_ids()));
}
void AstNumberingVisitor::VisitRegExpLiteral(RegExpLiteral* node) {
node->set_base_id(ReserveIdRange(RegExpLiteral::num_ids()));
}
void AstNumberingVisitor::VisitVariableProxy(VariableProxy* node) {
node->set_base_id(ReserveIdRange(VariableProxy::num_ids()));
}
void AstNumberingVisitor::VisitThisFunction(ThisFunction* node) {
node->set_base_id(ReserveIdRange(ThisFunction::num_ids()));
}
void AstNumberingVisitor::VisitSuperReference(SuperReference* node) {
node->set_base_id(ReserveIdRange(SuperReference::num_ids()));
Visit(node->this_var());
}
void AstNumberingVisitor::VisitModuleDeclaration(ModuleDeclaration* node) {
VisitVariableProxy(node->proxy());
Visit(node->module());
}
void AstNumberingVisitor::VisitImportDeclaration(ImportDeclaration* node) {
VisitVariableProxy(node->proxy());
Visit(node->module());
}
void AstNumberingVisitor::VisitModuleVariable(ModuleVariable* node) {
Visit(node->proxy());
}
void AstNumberingVisitor::VisitModulePath(ModulePath* node) {
Visit(node->module());
}
void AstNumberingVisitor::VisitModuleStatement(ModuleStatement* node) {
Visit(node->body());
}
void AstNumberingVisitor::VisitExpressionStatement(ExpressionStatement* node) {
Visit(node->expression());
}
void AstNumberingVisitor::VisitReturnStatement(ReturnStatement* node) {
Visit(node->expression());
}
void AstNumberingVisitor::VisitYield(Yield* node) {
node->set_base_id(ReserveIdRange(Yield::num_ids()));
Visit(node->generator_object());
Visit(node->expression());
}
void AstNumberingVisitor::VisitThrow(Throw* node) {
node->set_base_id(ReserveIdRange(Throw::num_ids()));
Visit(node->exception());
}
void AstNumberingVisitor::VisitUnaryOperation(UnaryOperation* node) {
node->set_base_id(ReserveIdRange(UnaryOperation::num_ids()));
Visit(node->expression());
}
void AstNumberingVisitor::VisitCountOperation(CountOperation* node) {
node->set_base_id(ReserveIdRange(CountOperation::num_ids()));
Visit(node->expression());
}
void AstNumberingVisitor::VisitBlock(Block* node) {
node->set_base_id(ReserveIdRange(Block::num_ids()));
if (node->scope() != NULL) VisitDeclarations(node->scope()->declarations());
VisitStatements(node->statements());
}
void AstNumberingVisitor::VisitFunctionDeclaration(FunctionDeclaration* node) {
VisitVariableProxy(node->proxy());
VisitFunctionLiteral(node->fun());
}
void AstNumberingVisitor::VisitModuleLiteral(ModuleLiteral* node) {
VisitBlock(node->body());
}
void AstNumberingVisitor::VisitCallRuntime(CallRuntime* node) {
node->set_base_id(ReserveIdRange(CallRuntime::num_ids()));
VisitArguments(node->arguments());
}
void AstNumberingVisitor::VisitWithStatement(WithStatement* node) {
Visit(node->expression());
Visit(node->statement());
}
void AstNumberingVisitor::VisitDoWhileStatement(DoWhileStatement* node) {
node->set_base_id(ReserveIdRange(DoWhileStatement::num_ids()));
Visit(node->body());
Visit(node->cond());
}
void AstNumberingVisitor::VisitWhileStatement(WhileStatement* node) {
node->set_base_id(ReserveIdRange(WhileStatement::num_ids()));
Visit(node->cond());
Visit(node->body());
}
void AstNumberingVisitor::VisitTryCatchStatement(TryCatchStatement* node) {
Visit(node->try_block());
Visit(node->catch_block());
}
void AstNumberingVisitor::VisitTryFinallyStatement(TryFinallyStatement* node) {
Visit(node->try_block());
Visit(node->finally_block());
}
void AstNumberingVisitor::VisitProperty(Property* node) {
node->set_base_id(ReserveIdRange(Property::num_ids()));
Visit(node->key());
Visit(node->obj());
}
void AstNumberingVisitor::VisitAssignment(Assignment* node) {
node->set_base_id(ReserveIdRange(Assignment::num_ids()));
if (node->is_compound()) VisitBinaryOperation(node->binary_operation());
Visit(node->target());
Visit(node->value());
}
void AstNumberingVisitor::VisitBinaryOperation(BinaryOperation* node) {
node->set_base_id(ReserveIdRange(BinaryOperation::num_ids()));
Visit(node->left());
Visit(node->right());
}
void AstNumberingVisitor::VisitCompareOperation(CompareOperation* node) {
node->set_base_id(ReserveIdRange(CompareOperation::num_ids()));
Visit(node->left());
Visit(node->right());
}
void AstNumberingVisitor::VisitForInStatement(ForInStatement* node) {
node->set_base_id(ReserveIdRange(ForInStatement::num_ids()));
Visit(node->each());
Visit(node->enumerable());
Visit(node->body());
}
void AstNumberingVisitor::VisitForOfStatement(ForOfStatement* node) {
node->set_base_id(ReserveIdRange(ForOfStatement::num_ids()));
Visit(node->assign_iterator());
Visit(node->next_result());
Visit(node->result_done());
Visit(node->assign_each());
Visit(node->body());
}
void AstNumberingVisitor::VisitConditional(Conditional* node) {
node->set_base_id(ReserveIdRange(Conditional::num_ids()));
Visit(node->condition());
Visit(node->then_expression());
Visit(node->else_expression());
}
void AstNumberingVisitor::VisitIfStatement(IfStatement* node) {
node->set_base_id(ReserveIdRange(IfStatement::num_ids()));
Visit(node->condition());
Visit(node->then_statement());
if (node->HasElseStatement()) {
Visit(node->else_statement());
}
}
void AstNumberingVisitor::VisitSwitchStatement(SwitchStatement* node) {
node->set_base_id(ReserveIdRange(SwitchStatement::num_ids()));
Visit(node->tag());
ZoneList<CaseClause*>* cases = node->cases();
for (int i = 0; i < cases->length(); i++) {
VisitCaseClause(cases->at(i));
}
}
void AstNumberingVisitor::VisitCaseClause(CaseClause* node) {
node->set_base_id(ReserveIdRange(CaseClause::num_ids()));
if (!node->is_default()) Visit(node->label());
VisitStatements(node->statements());
}
void AstNumberingVisitor::VisitForStatement(ForStatement* node) {
node->set_base_id(ReserveIdRange(ForStatement::num_ids()));
if (node->init() != NULL) Visit(node->init());
if (node->cond() != NULL) Visit(node->cond());
if (node->next() != NULL) Visit(node->next());
Visit(node->body());
}
void AstNumberingVisitor::VisitClassLiteral(ClassLiteral* node) {
node->set_base_id(ReserveIdRange(ClassLiteral::num_ids()));
if (node->extends()) Visit(node->extends());
if (node->constructor()) Visit(node->constructor());
for (int i = 0; i < node->properties()->length(); i++) {
VisitObjectLiteralProperty(node->properties()->at(i));
}
}
void AstNumberingVisitor::VisitObjectLiteral(ObjectLiteral* node) {
node->set_base_id(ReserveIdRange(ObjectLiteral::num_ids()));
for (int i = 0; i < node->properties()->length(); i++) {
VisitObjectLiteralProperty(node->properties()->at(i));
}
}
void AstNumberingVisitor::VisitObjectLiteralProperty(
ObjectLiteralProperty* node) {
Visit(node->key());
Visit(node->value());
}
void AstNumberingVisitor::VisitArrayLiteral(ArrayLiteral* node) {
node->set_base_id(ReserveIdRange(node->num_ids()));
for (int i = 0; i < node->values()->length(); i++) {
Visit(node->values()->at(i));
}
}
void AstNumberingVisitor::VisitCall(Call* node) {
node->set_base_id(ReserveIdRange(Call::num_ids()));
Visit(node->expression());
VisitArguments(node->arguments());
}
void AstNumberingVisitor::VisitCallNew(CallNew* node) {
node->set_base_id(ReserveIdRange(CallNew::num_ids()));
Visit(node->expression());
VisitArguments(node->arguments());
}
void AstNumberingVisitor::VisitStatements(ZoneList<Statement*>* statements) {
if (statements == NULL) return;
for (int i = 0; i < statements->length(); i++) {
Visit(statements->at(i));
}
}
void AstNumberingVisitor::VisitDeclarations(
ZoneList<Declaration*>* declarations) {
for (int i = 0; i < declarations->length(); i++) {
Visit(declarations->at(i));
}
}
void AstNumberingVisitor::VisitArguments(ZoneList<Expression*>* arguments) {
for (int i = 0; i < arguments->length(); i++) {
Visit(arguments->at(i));
}
}
void AstNumberingVisitor::VisitFunctionLiteral(FunctionLiteral* node) {
node->set_base_id(ReserveIdRange(FunctionLiteral::num_ids()));
// We don't recurse into the declarations or body of the function literal:
// you have to separately Renumber() each FunctionLiteral that you compile.
}
void AstNumberingVisitor::Renumber(FunctionLiteral* node) {
if (node->scope()->HasIllegalRedeclaration()) {
node->scope()->VisitIllegalRedeclaration(this);
return;
}
Scope* scope = node->scope();
VisitDeclarations(scope->declarations());
if (scope->is_function_scope() && scope->function() != NULL) {
// Visit the name of the named function expression.
Visit(scope->function());
}
VisitStatements(node->body());
}
bool AstNumbering::Renumber(FunctionLiteral* function, Zone* zone) {
AstNumberingVisitor visitor(zone);
visitor.Renumber(function);
return !visitor.HasStackOverflow();
}
}
} // namespace v8::internal

View File

@ -1,19 +0,0 @@
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_AST_NUMBERING_H_
#define V8_AST_NUMBERING_H_
namespace v8 {
namespace internal {
namespace AstNumbering {
// Assign type feedback IDs and bailout IDs to an AST node tree.
//
bool Renumber(FunctionLiteral* function, Zone* zone);
}
}
} // namespace v8::internal
#endif // V8_AST_NUMBERING_H_

View File

@ -282,8 +282,6 @@ class AstValueFactory {
#undef F
}
Zone* zone() const { return zone_; }
const AstRawString* GetOneByteString(Vector<const uint8_t> literal);
const AstRawString* GetOneByteString(const char* string) {
return GetOneByteString(Vector<const uint8_t>(

View File

@ -59,8 +59,9 @@ bool Expression::IsUndefinedLiteral(Isolate* isolate) const {
}
VariableProxy::VariableProxy(Zone* zone, Variable* var, int position)
: Expression(zone, position),
VariableProxy::VariableProxy(Zone* zone, Variable* var, int position,
IdGen* id_gen)
: Expression(zone, position, 0, id_gen),
is_this_(var->is_this()),
is_assigned_(false),
is_resolved_(false),
@ -72,8 +73,8 @@ VariableProxy::VariableProxy(Zone* zone, Variable* var, int position)
VariableProxy::VariableProxy(Zone* zone, const AstRawString* name, bool is_this,
Interface* interface, int position)
: Expression(zone, position),
Interface* interface, int position, IdGen* id_gen)
: Expression(zone, position, 0, id_gen),
is_this_(is_this),
is_assigned_(false),
is_resolved_(false),
@ -97,8 +98,8 @@ void VariableProxy::BindTo(Variable* var) {
Assignment::Assignment(Zone* zone, Token::Value op, Expression* target,
Expression* value, int pos)
: Expression(zone, pos),
Expression* value, int pos, IdGen* id_gen)
: Expression(zone, pos, num_ids(), id_gen),
is_uninitialized_(false),
key_type_(ELEMENT),
store_mode_(STANDARD_STORE),
@ -989,8 +990,8 @@ RegExpAlternative::RegExpAlternative(ZoneList<RegExpTree*>* nodes)
CaseClause::CaseClause(Zone* zone, Expression* label,
ZoneList<Statement*>* statements, int pos)
: Expression(zone, pos),
ZoneList<Statement*>* statements, int pos, IdGen* id_gen)
: Expression(zone, pos, num_ids(), id_gen),
label_(label),
statements_(statements),
compare_type_(Type::None(zone)) {}

622
src/ast.h

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,6 @@
#include "src/compiler.h"
#include "src/ast-numbering.h"
#include "src/bootstrapper.h"
#include "src/codegen.h"
#include "src/compilation-cache.h"
@ -747,7 +746,6 @@ static bool CompileOptimizedPrologue(CompilationInfo* info) {
if (!Parser::Parse(info)) return false;
if (!Rewriter::Rewrite(info)) return false;
if (!Scope::Analyze(info)) return false;
if (!AstNumbering::Renumber(info->function(), info->zone())) return false;
DCHECK(info->scope() != NULL);
return true;
}

View File

@ -391,6 +391,8 @@ class CompilationInfo {
ast_value_factory_owned_ = owned;
}
AstNode::IdGen* ast_node_id_gen() { return &ast_node_id_gen_; }
protected:
CompilationInfo(Handle<Script> script,
Zone* zone);
@ -510,6 +512,7 @@ class CompilationInfo {
AstValueFactory* ast_value_factory_;
bool ast_value_factory_owned_;
AstNode::IdGen ast_node_id_gen_;
// This flag is used by the main thread to track whether this compilation
// should be abandoned due to dependency change.

View File

@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/ast.h"
#include "src/ast-numbering.h"
#include "src/compiler/access-builder.h"
#include "src/compiler/ast-graph-builder.h"
#include "src/compiler/common-operator.h"
@ -65,7 +63,6 @@ static void Parse(Handle<JSFunction> function, CompilationInfoWithZone* info) {
CHECK(Parser::Parse(info));
CHECK(Rewriter::Rewrite(info));
CHECK(Scope::Analyze(info));
CHECK(AstNumbering::Renumber(info->function(), info->zone()));
CHECK(Compiler::EnsureDeoptimizationSupport(info));
}

View File

@ -4,8 +4,6 @@
#include "src/v8.h"
#include "src/ast.h"
#include "src/ast-numbering.h"
#include "src/code-factory.h"
#include "src/codegen.h"
#include "src/compiler.h"
@ -308,11 +306,6 @@ bool FullCodeGenerator::MakeCode(CompilationInfo* info) {
TimerEventScope<TimerEventCompileFullCode> timer(info->isolate());
if (!AstNumbering::Renumber(info->function(), info->zone())) {
DCHECK(!isolate->has_pending_exception());
return false;
}
Handle<Script> script = info->script();
if (!script->IsUndefined() && !script->source()->IsUndefined()) {
int len = String::cast(script->source())->length();

View File

@ -9,7 +9,6 @@
#include "src/v8.h"
#include "src/allocation-site-scopes.h"
#include "src/ast-numbering.h"
#include "src/full-codegen.h"
#include "src/hydrogen-bce.h"
#include "src/hydrogen-bch.h"
@ -7831,8 +7830,7 @@ bool HOptimizedGraphBuilder::TryInline(Handle<JSFunction> target,
// step, but don't transfer ownership to target_info.
target_info.SetAstValueFactory(top_info()->ast_value_factory(), false);
Handle<SharedFunctionInfo> target_shared(target->shared());
if (!Parser::Parse(&target_info) || !Scope::Analyze(&target_info) ||
!AstNumbering::Renumber(target_info.function(), target_info.zone())) {
if (!Parser::Parse(&target_info) || !Scope::Analyze(&target_info)) {
if (target_info.isolate()->has_pending_exception()) {
// Parse or scope error, never optimize this function.
SetStackOverflow();

View File

@ -736,7 +736,8 @@ FunctionLiteral* ParserTraits::ParseFunctionLiteral(
Parser::Parser(CompilationInfo* info, ParseInfo* parse_info)
: ParserBase<ParserTraits>(&scanner_, parse_info->stack_limit,
info->extension(), NULL, info->zone(), this),
info->extension(), NULL, info->zone(),
info->ast_node_id_gen(), this),
scanner_(parse_info->unicode_cache),
reusable_preparser_(NULL),
original_scope_(NULL),
@ -878,7 +879,7 @@ FunctionLiteral* Parser::DoParseProgram(CompilationInfo* info, Scope** scope,
// Enters 'scope'.
AstNodeFactory<AstConstructionVisitor> function_factory(
ast_value_factory());
zone(), ast_value_factory(), info->ast_node_id_gen());
FunctionState function_state(&function_state_, &scope_, *scope,
&function_factory);
@ -993,7 +994,7 @@ FunctionLiteral* Parser::ParseLazy(Utf16CharacterStream* source) {
}
original_scope_ = scope;
AstNodeFactory<AstConstructionVisitor> function_factory(
ast_value_factory());
zone(), ast_value_factory(), info()->ast_node_id_gen());
FunctionState function_state(&function_state_, &scope_, scope,
&function_factory);
DCHECK(scope->strict_mode() == SLOPPY || info()->strict_mode() == STRICT);
@ -3495,7 +3496,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
// Parse function body.
{
AstNodeFactory<AstConstructionVisitor> function_factory(
ast_value_factory());
zone(), ast_value_factory(), info()->ast_node_id_gen());
FunctionState function_state(&function_state_, &scope_, scope,
&function_factory);
scope_->SetScopeName(function_name);

View File

@ -104,11 +104,11 @@ PreParser::PreParseResult PreParser::PreParseLazyFunction(
log_ = log;
// Lazy functions always have trivial outer scopes (no with/catch scopes).
PreParserScope top_scope(scope_, GLOBAL_SCOPE);
PreParserFactory top_factory(NULL);
PreParserFactory top_factory(NULL, NULL, NULL);
FunctionState top_state(&function_state_, &scope_, &top_scope, &top_factory);
scope_->SetStrictMode(strict_mode);
PreParserScope function_scope(scope_, FUNCTION_SCOPE);
PreParserFactory function_factory(NULL);
PreParserFactory function_factory(NULL, NULL, NULL);
FunctionState function_state(&function_state_, &scope_, &function_scope,
&function_factory);
function_state.set_is_generator(is_generator);
@ -813,7 +813,7 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
// Parse function body.
ScopeType outer_scope_type = scope_->type();
PreParserScope function_scope(scope_, FUNCTION_SCOPE);
PreParserFactory factory(NULL);
PreParserFactory factory(NULL, NULL, NULL);
FunctionState function_state(&function_state_, &scope_, &function_scope,
&factory);
function_state.set_is_generator(IsGeneratorFunction(kind));

View File

@ -70,6 +70,7 @@ class ParserBase : public Traits {
ParserBase(Scanner* scanner, uintptr_t stack_limit, v8::Extension* extension,
ParserRecorder* log, typename Traits::Type::Zone* zone,
AstNode::IdGen* ast_node_id_gen,
typename Traits::Type::Parser this_object)
: Traits(this_object),
parenthesized_function_(false),
@ -86,7 +87,8 @@ class ParserBase : public Traits {
allow_natives_syntax_(false),
allow_arrow_functions_(false),
allow_harmony_object_literals_(false),
zone_(zone) {}
zone_(zone),
ast_node_id_gen_(ast_node_id_gen) {}
// Getters that indicate whether certain syntactical constructs are
// allowed to be parsed by this instance of the parser.
@ -275,6 +277,7 @@ class ParserBase : public Traits {
void set_stack_overflow() { stack_overflow_ = true; }
Mode mode() const { return mode_; }
typename Traits::Type::Zone* zone() const { return zone_; }
AstNode::IdGen* ast_node_id_gen() const { return ast_node_id_gen_; }
INLINE(Token::Value peek()) {
if (stack_overflow_) return Token::ILLEGAL;
@ -577,6 +580,7 @@ class ParserBase : public Traits {
bool allow_harmony_object_literals_;
typename Traits::Type::Zone* zone_; // Only used by Parser.
AstNode::IdGen* ast_node_id_gen_;
};
@ -968,7 +972,7 @@ class PreParserScope {
class PreParserFactory {
public:
explicit PreParserFactory(void* unused_value_factory) {}
PreParserFactory(void*, void*, void*) {}
PreParserExpression NewStringLiteral(PreParserIdentifier identifier,
int pos) {
return PreParserExpression::Default();
@ -1413,7 +1417,7 @@ class PreParser : public ParserBase<PreParserTraits> {
};
PreParser(Scanner* scanner, ParserRecorder* log, uintptr_t stack_limit)
: ParserBase<PreParserTraits>(scanner, stack_limit, NULL, log, NULL,
: ParserBase<PreParserTraits>(scanner, stack_limit, NULL, log, NULL, NULL,
this) {}
// Pre-parse the program from the character stream; returns true on
@ -1422,7 +1426,7 @@ class PreParser : public ParserBase<PreParserTraits> {
// during parsing.
PreParseResult PreParseProgram() {
PreParserScope scope(scope_, GLOBAL_SCOPE);
PreParserFactory factory(NULL);
PreParserFactory factory(NULL, NULL, NULL);
FunctionState top_scope(&function_state_, &scope_, &scope, &factory);
bool ok = true;
int start_position = scanner()->peek_location().beg_pos;
@ -2612,7 +2616,8 @@ typename ParserBase<Traits>::ExpressionT ParserBase<
int handler_count = 0;
{
typename Traits::Type::Factory function_factory(this->ast_value_factory());
typename Traits::Type::Factory function_factory(
zone(), this->ast_value_factory(), ast_node_id_gen_);
FunctionState function_state(&function_state_, &scope_,
Traits::Type::ptr_to_scope(scope),
&function_factory);

View File

@ -15,13 +15,15 @@ namespace internal {
class Processor: public AstVisitor {
public:
Processor(Variable* result, AstValueFactory* ast_value_factory)
Processor(Variable* result, Zone* zone, AstNode::IdGen* ast_node_id_gen)
: result_(result),
result_assigned_(false),
is_set_(false),
in_try_(false),
factory_(ast_value_factory) {
InitializeAstVisitor(ast_value_factory->zone());
// Passing a null AstValueFactory is fine, because Processor doesn't
// need to create strings or literals.
factory_(zone, NULL, ast_node_id_gen) {
InitializeAstVisitor(zone);
}
virtual ~Processor() { }
@ -238,7 +240,7 @@ bool Rewriter::Rewrite(CompilationInfo* info) {
scope->NewTemporary(info->ast_value_factory()->dot_result_string());
// The name string must be internalized at this point.
DCHECK(!result->name().is_null());
Processor processor(result, info->ast_value_factory());
Processor processor(result, info->zone(), info->ast_node_id_gen());
processor.Process(body);
if (processor.HasStackOverflow()) return false;

View File

@ -275,7 +275,8 @@ bool Scope::Analyze(CompilationInfo* info) {
// Allocate the variables.
{
AstNodeFactory<AstNullVisitor> ast_node_factory(info->ast_value_factory());
AstNodeFactory<AstNullVisitor> ast_node_factory(
info->zone(), info->ast_value_factory(), info->ast_node_id_gen());
if (!top->AllocateVariables(info, &ast_node_factory)) return false;
}

View File

@ -8,7 +8,6 @@
#include "src/v8.h"
#include "test/cctest/cctest.h"
#include "src/ast-numbering.h"
#include "src/compiler.h"
#include "src/compiler/linkage.h"
#include "src/compiler/pipeline.h"
@ -167,7 +166,6 @@ class FunctionTester : public InitializedHandleScope {
}
CHECK(Rewriter::Rewrite(&info));
CHECK(Scope::Analyze(&info));
CHECK(AstNumbering::Renumber(info.function(), info.zone()));
CHECK(Compiler::EnsureDeoptimizationSupport(&info));
Pipeline pipeline(&info);
@ -217,7 +215,6 @@ class FunctionTester : public InitializedHandleScope {
Handle<Code>(function->shared()->code()));
CHECK(Rewriter::Rewrite(&info));
CHECK(Scope::Analyze(&info));
CHECK(AstNumbering::Renumber(info.function(), info.zone()));
CHECK(Compiler::EnsureDeoptimizationSupport(&info));
Pipeline pipeline(&info);

View File

@ -16,7 +16,6 @@
#include "src/compiler/register-allocator.h"
#include "src/compiler/schedule.h"
#include "src/ast-numbering.h"
#include "src/full-codegen.h"
#include "src/parser.h"
#include "src/rewriter.h"
@ -49,7 +48,6 @@ class DeoptCodegenTester {
info.SetOptimizing(BailoutId::None(), Handle<Code>(function->code()));
CHECK(Rewriter::Rewrite(&info));
CHECK(Scope::Analyze(&info));
CHECK(AstNumbering::Renumber(info.function(), info.zone()));
CHECK(Compiler::EnsureDeoptimizationSupport(&info));
DCHECK(info.shared_info()->has_deoptimization_support());

View File

@ -5,7 +5,6 @@
#include "src/v8.h"
#include "test/cctest/cctest.h"
#include "src/ast-numbering.h"
#include "src/compiler.h"
#include "src/compiler/pipeline.h"
#include "src/handles.h"
@ -26,7 +25,6 @@ TEST(PipelineAdd) {
CHECK(Parser::Parse(&info));
CHECK(Rewriter::Rewrite(&info));
CHECK(Scope::Analyze(&info));
CHECK(AstNumbering::Renumber(info.function(), info.zone()));
CHECK_NE(NULL, info.scope());
Pipeline pipeline(&info);

View File

@ -40,8 +40,8 @@ TEST(List) {
Isolate* isolate = CcTest::i_isolate();
Zone zone(isolate);
AstValueFactory value_factory(&zone, 0);
AstNodeFactory<AstNullVisitor> factory(&value_factory);
AstNode::IdGen id_gen;
AstNodeFactory<AstNullVisitor> factory(&zone, NULL, &id_gen);
AstNode* node = factory.NewEmptyStatement(RelocInfo::kNoPosition);
list->Add(node);
CHECK_EQ(1, list->length());

View File

@ -31,8 +31,6 @@
#include "src/v8.h"
#include "src/ast.h"
#include "src/ast-numbering.h"
#include "src/ast-value-factory.h"
#include "src/compiler.h"
#include "src/execution.h"
@ -3275,7 +3273,6 @@ TEST(InnerAssignment) {
CHECK(parser.Parse());
CHECK(i::Rewriter::Rewrite(&info));
CHECK(i::Scope::Analyze(&info));
CHECK(i::AstNumbering::Renumber(info.function(), info.zone()));
CHECK(info.function() != NULL);
i::Scope* scope = info.function()->scope();

View File

@ -349,8 +349,6 @@
'../../src/assert-scope.cc',
'../../src/ast-value-factory.cc',
'../../src/ast-value-factory.h',
'../../src/ast-numbering.cc',
'../../src/ast-numbering.h',
'../../src/ast.cc',
'../../src/ast.h',
'../../src/background-parsing-task.cc',