Remove unused Zone argument from InitializeAstVisitor
This adds a bit of boilerplate to some AstVisitors (they now have to declare their own zone_ member and zone() accessor), but makes it clearer what DEFINE_AST_VISITOR_SUBCLASS_MEMBERS is for: stack limit checking. Review URL: https://codereview.chromium.org/1394303008 Cr-Commit-Position: refs/heads/master@{#31287}
This commit is contained in:
parent
ffd0a2ae74
commit
4937cc9457
@ -32,10 +32,10 @@ namespace internal {
|
||||
} while (false)
|
||||
|
||||
|
||||
AstExpressionVisitor::AstExpressionVisitor(Isolate* isolate, Zone* zone,
|
||||
AstExpressionVisitor::AstExpressionVisitor(Isolate* isolate,
|
||||
FunctionLiteral* root)
|
||||
: root_(root), depth_(0) {
|
||||
InitializeAstVisitor(isolate, zone);
|
||||
InitializeAstVisitor(isolate);
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,7 +21,7 @@ namespace internal {
|
||||
|
||||
class AstExpressionVisitor : public AstVisitor {
|
||||
public:
|
||||
AstExpressionVisitor(Isolate* isolate, Zone* zone, FunctionLiteral* root);
|
||||
AstExpressionVisitor(Isolate* isolate, FunctionLiteral* root);
|
||||
void Run();
|
||||
|
||||
protected:
|
||||
|
@ -15,11 +15,12 @@ class AstNumberingVisitor final : public AstVisitor {
|
||||
AstNumberingVisitor(Isolate* isolate, Zone* zone)
|
||||
: AstVisitor(),
|
||||
isolate_(isolate),
|
||||
zone_(zone),
|
||||
next_id_(BailoutId::FirstUsable().ToInt()),
|
||||
properties_(zone),
|
||||
slot_cache_(zone),
|
||||
dont_optimize_reason_(kNoReason) {
|
||||
InitializeAstVisitor(isolate, zone);
|
||||
InitializeAstVisitor(isolate);
|
||||
}
|
||||
|
||||
bool Renumber(FunctionLiteral* node);
|
||||
@ -73,6 +74,7 @@ class AstNumberingVisitor final : public AstVisitor {
|
||||
BailoutReason dont_optimize_reason() const { return dont_optimize_reason_; }
|
||||
|
||||
Isolate* isolate_;
|
||||
Zone* zone_;
|
||||
int next_id_;
|
||||
AstProperties properties_;
|
||||
// The slot cache allows us to reuse certain feedback vector slots.
|
||||
@ -472,7 +474,7 @@ void AstNumberingVisitor::VisitObjectLiteral(ObjectLiteral* node) {
|
||||
// Mark all computed expressions that are bound to a key that
|
||||
// is shadowed by a later occurrence of the same key. For the
|
||||
// marked expressions, no store code will be is emitted.
|
||||
node->CalculateEmitStore(zone());
|
||||
node->CalculateEmitStore(zone_);
|
||||
ReserveFeedbackSlots(node);
|
||||
}
|
||||
|
||||
|
@ -3190,14 +3190,11 @@ class AstVisitor BASE_EMBEDDED {
|
||||
} \
|
||||
\
|
||||
private: \
|
||||
void InitializeAstVisitor(Isolate* isolate, Zone* zone) { \
|
||||
zone_ = zone; \
|
||||
void InitializeAstVisitor(Isolate* isolate) { \
|
||||
stack_limit_ = isolate->stack_guard()->real_climit(); \
|
||||
stack_overflow_ = false; \
|
||||
} \
|
||||
Zone* zone() { return zone_; } \
|
||||
\
|
||||
Zone* zone_; \
|
||||
uintptr_t stack_limit_; \
|
||||
bool stack_overflow_
|
||||
|
||||
|
@ -128,13 +128,12 @@ void CodeGenerator::MakeCodePrologue(CompilationInfo* info, const char* kind) {
|
||||
#ifdef DEBUG
|
||||
if (info->parse_info() && print_source) {
|
||||
PrintF("--- Source from AST ---\n%s\n",
|
||||
PrettyPrinter(info->isolate(), info->zone())
|
||||
.PrintProgram(info->literal()));
|
||||
PrettyPrinter(info->isolate()).PrintProgram(info->literal()));
|
||||
}
|
||||
|
||||
if (info->parse_info() && print_ast) {
|
||||
PrintF("--- AST ---\n%s\n", AstPrinter(info->isolate(), info->zone())
|
||||
.PrintProgram(info->literal()));
|
||||
PrintF("--- AST ---\n%s\n",
|
||||
AstPrinter(info->isolate()).PrintProgram(info->literal()));
|
||||
}
|
||||
#endif // DEBUG
|
||||
}
|
||||
|
@ -1793,7 +1793,7 @@ bool CompilationPhase::ShouldProduceTraceOutput() const {
|
||||
#if DEBUG
|
||||
void CompilationInfo::PrintAstForTesting() {
|
||||
PrintF("--- Source from AST ---\n%s\n",
|
||||
PrettyPrinter(isolate(), zone()).PrintProgram(literal()));
|
||||
PrettyPrinter(isolate()).PrintProgram(literal()));
|
||||
}
|
||||
#endif
|
||||
} // namespace internal
|
||||
|
@ -211,7 +211,7 @@ class AstGraphBuilder::ControlScope BASE_EMBEDDED {
|
||||
class AstGraphBuilder::ControlScope::DeferredCommands : public ZoneObject {
|
||||
public:
|
||||
explicit DeferredCommands(AstGraphBuilder* owner)
|
||||
: owner_(owner), deferred_(owner->zone()) {}
|
||||
: owner_(owner), deferred_(owner->local_zone()) {}
|
||||
|
||||
// One recorded control-flow command.
|
||||
struct Entry {
|
||||
@ -430,7 +430,8 @@ class AstGraphBuilder::FrameStateBeforeAndAfter {
|
||||
AstGraphBuilder::AstGraphBuilder(Zone* local_zone, CompilationInfo* info,
|
||||
JSGraph* jsgraph, LoopAssignmentAnalysis* loop,
|
||||
JSTypeFeedbackTable* js_type_feedback)
|
||||
: local_zone_(local_zone),
|
||||
: isolate_(info->isolate()),
|
||||
local_zone_(local_zone),
|
||||
info_(info),
|
||||
jsgraph_(jsgraph),
|
||||
environment_(nullptr),
|
||||
@ -452,7 +453,7 @@ AstGraphBuilder::AstGraphBuilder(Zone* local_zone, CompilationInfo* info,
|
||||
info->scope()->num_stack_slots(), info->shared_info(),
|
||||
CALL_MAINTAINS_NATIVE_CONTEXT)),
|
||||
js_type_feedback_(js_type_feedback) {
|
||||
InitializeAstVisitor(info->isolate(), local_zone);
|
||||
InitializeAstVisitor(info->isolate());
|
||||
}
|
||||
|
||||
|
||||
@ -1446,7 +1447,7 @@ void AstGraphBuilder::VisitTryFinallyStatement(TryFinallyStatement* stmt) {
|
||||
// 3. By exiting the try-block with a thrown exception.
|
||||
Node* fallthrough_result = jsgraph()->TheHoleConstant();
|
||||
ControlScope::DeferredCommands* commands =
|
||||
new (zone()) ControlScope::DeferredCommands(this);
|
||||
new (local_zone()) ControlScope::DeferredCommands(this);
|
||||
|
||||
// Evaluate the try-block inside a control scope. This simulates a handler
|
||||
// that is intercepting all control commands.
|
||||
@ -1722,7 +1723,7 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
|
||||
|
||||
// Create nodes to store computed values into the literal.
|
||||
int property_index = 0;
|
||||
AccessorTable accessor_table(zone());
|
||||
AccessorTable accessor_table(local_zone());
|
||||
for (; property_index < expr->properties()->length(); property_index++) {
|
||||
ObjectLiteral::Property* property = expr->properties()->at(property_index);
|
||||
if (property->is_computed_name()) break;
|
||||
@ -3017,9 +3018,6 @@ void AstGraphBuilder::VisitLogicalExpression(BinaryOperation* expr) {
|
||||
}
|
||||
|
||||
|
||||
Isolate* AstGraphBuilder::isolate() const { return info()->isolate(); }
|
||||
|
||||
|
||||
LanguageMode AstGraphBuilder::language_mode() const {
|
||||
return info()->language_mode();
|
||||
}
|
||||
|
@ -70,6 +70,7 @@ class AstGraphBuilder : public AstVisitor {
|
||||
class FrameStateBeforeAndAfter;
|
||||
friend class ControlBuilder;
|
||||
|
||||
Isolate* isolate_;
|
||||
Zone* local_zone_;
|
||||
CompilationInfo* info_;
|
||||
JSGraph* jsgraph_;
|
||||
@ -129,7 +130,7 @@ class AstGraphBuilder : public AstVisitor {
|
||||
ContextScope* execution_context() const { return execution_context_; }
|
||||
CommonOperatorBuilder* common() const { return jsgraph_->common(); }
|
||||
CompilationInfo* info() const { return info_; }
|
||||
Isolate* isolate() const;
|
||||
Isolate* isolate() const { return isolate_; }
|
||||
LanguageMode language_mode() const;
|
||||
JSGraph* jsgraph() { return jsgraph_; }
|
||||
Graph* graph() { return jsgraph_->graph(); }
|
||||
|
@ -13,13 +13,13 @@ namespace compiler {
|
||||
typedef class AstLoopAssignmentAnalyzer ALAA; // for code shortitude.
|
||||
|
||||
ALAA::AstLoopAssignmentAnalyzer(Zone* zone, CompilationInfo* info)
|
||||
: info_(info), loop_stack_(zone) {
|
||||
InitializeAstVisitor(info->isolate(), zone);
|
||||
: info_(info), zone_(zone), loop_stack_(zone) {
|
||||
InitializeAstVisitor(info->isolate());
|
||||
}
|
||||
|
||||
|
||||
LoopAssignmentAnalysis* ALAA::Analyze() {
|
||||
LoopAssignmentAnalysis* a = new (zone()) LoopAssignmentAnalysis(zone());
|
||||
LoopAssignmentAnalysis* a = new (zone_) LoopAssignmentAnalysis(zone_);
|
||||
result_ = a;
|
||||
VisitStatements(info()->literal()->body());
|
||||
result_ = NULL;
|
||||
@ -30,7 +30,7 @@ LoopAssignmentAnalysis* ALAA::Analyze() {
|
||||
void ALAA::Enter(IterationStatement* loop) {
|
||||
int num_variables = 1 + info()->scope()->num_parameters() +
|
||||
info()->scope()->num_stack_slots();
|
||||
BitVector* bits = new (zone()) BitVector(num_variables, zone());
|
||||
BitVector* bits = new (zone_) BitVector(num_variables, zone_);
|
||||
if (info()->is_osr() && info()->osr_ast_id() == loop->OsrEntryId())
|
||||
bits->AddAll();
|
||||
loop_stack_.push_back(bits);
|
||||
|
@ -53,6 +53,7 @@ class AstLoopAssignmentAnalyzer : public AstVisitor {
|
||||
|
||||
private:
|
||||
CompilationInfo* info_;
|
||||
Zone* zone_;
|
||||
ZoneDeque<BitVector*> loop_stack_;
|
||||
LoopAssignmentAnalysis* result_;
|
||||
|
||||
|
@ -163,7 +163,7 @@ bool FullCodeGenerator::MustCreateArrayLiteralWithRuntime(
|
||||
|
||||
|
||||
void FullCodeGenerator::Initialize() {
|
||||
InitializeAstVisitor(info_->isolate(), info_->zone());
|
||||
InitializeAstVisitor(info_->isolate());
|
||||
// The generation of debug code must match between the snapshot code and the
|
||||
// code that is generated later. This is assumed by the debugger when it is
|
||||
// calculating PC offsets after generating a debug version of code. Therefore
|
||||
|
@ -35,6 +35,8 @@ class FullCodeGenerator: public AstVisitor {
|
||||
FullCodeGenerator(MacroAssembler* masm, CompilationInfo* info)
|
||||
: masm_(masm),
|
||||
info_(info),
|
||||
isolate_(info->isolate()),
|
||||
zone_(info->zone()),
|
||||
scope_(info->scope()),
|
||||
nesting_stack_(NULL),
|
||||
loop_depth_(0),
|
||||
@ -688,7 +690,8 @@ class FullCodeGenerator: public AstVisitor {
|
||||
const ExpressionContext* context() { return context_; }
|
||||
void set_new_context(const ExpressionContext* context) { context_ = context; }
|
||||
|
||||
Isolate* isolate() const { return info_->isolate(); }
|
||||
Isolate* isolate() const { return isolate_; }
|
||||
Zone* zone() const { return zone_; }
|
||||
Handle<Script> script() { return info_->script(); }
|
||||
bool is_eval() { return info_->is_eval(); }
|
||||
bool is_native() { return info_->is_native(); }
|
||||
@ -950,6 +953,8 @@ class FullCodeGenerator: public AstVisitor {
|
||||
|
||||
MacroAssembler* masm_;
|
||||
CompilationInfo* info_;
|
||||
Isolate* isolate_;
|
||||
Zone* zone_;
|
||||
Scope* scope_;
|
||||
Label return_label_;
|
||||
NestedStatement* nesting_stack_;
|
||||
|
@ -3581,7 +3581,7 @@ HOptimizedGraphBuilder::HOptimizedGraphBuilder(CompilationInfo* info)
|
||||
// constructor for the initial state relies on function_state_ == NULL
|
||||
// to know it's the initial state.
|
||||
function_state_ = &initial_function_state_;
|
||||
InitializeAstVisitor(info->isolate(), info->zone());
|
||||
InitializeAstVisitor(info->isolate());
|
||||
if (top_info()->is_tracking_positions()) {
|
||||
SetSourcePosition(info->shared_info()->start_position());
|
||||
}
|
||||
|
@ -133,13 +133,14 @@ void BytecodeGenerator::ControlScope::PerformCommand(Command command,
|
||||
|
||||
BytecodeGenerator::BytecodeGenerator(Isolate* isolate, Zone* zone)
|
||||
: isolate_(isolate),
|
||||
zone_(zone),
|
||||
builder_(isolate, zone),
|
||||
info_(nullptr),
|
||||
scope_(nullptr),
|
||||
globals_(0, zone),
|
||||
control_scope_(nullptr),
|
||||
current_context_(Register::function_context()) {
|
||||
InitializeAstVisitor(isolate, zone);
|
||||
InitializeAstVisitor(isolate);
|
||||
}
|
||||
|
||||
|
||||
|
@ -58,6 +58,7 @@ class BytecodeGenerator : public AstVisitor {
|
||||
inline BytecodeArrayBuilder* builder() { return &builder_; }
|
||||
|
||||
inline Isolate* isolate() const { return isolate_; }
|
||||
inline Zone* zone() const { return zone_; }
|
||||
|
||||
inline Scope* scope() const { return scope_; }
|
||||
inline void set_scope(Scope* scope) { scope_ = scope; }
|
||||
@ -77,6 +78,7 @@ class BytecodeGenerator : public AstVisitor {
|
||||
int feedback_index(FeedbackVectorSlot slot) const;
|
||||
|
||||
Isolate* isolate_;
|
||||
Zone* zone_;
|
||||
BytecodeArrayBuilder builder_;
|
||||
CompilationInfo* info_;
|
||||
Scope* scope_;
|
||||
|
@ -13,14 +13,14 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
CallPrinter::CallPrinter(Isolate* isolate, Zone* zone) {
|
||||
CallPrinter::CallPrinter(Isolate* isolate) {
|
||||
output_ = NULL;
|
||||
size_ = 0;
|
||||
pos_ = 0;
|
||||
position_ = 0;
|
||||
found_ = false;
|
||||
done_ = false;
|
||||
InitializeAstVisitor(isolate, zone);
|
||||
InitializeAstVisitor(isolate);
|
||||
}
|
||||
|
||||
|
||||
@ -440,11 +440,11 @@ static int FormatSlotNode(Vector<char>* buf, Expression* node,
|
||||
}
|
||||
|
||||
|
||||
PrettyPrinter::PrettyPrinter(Isolate* isolate, Zone* zone) {
|
||||
PrettyPrinter::PrettyPrinter(Isolate* isolate) {
|
||||
output_ = NULL;
|
||||
size_ = 0;
|
||||
pos_ = 0;
|
||||
InitializeAstVisitor(isolate, zone);
|
||||
InitializeAstVisitor(isolate);
|
||||
}
|
||||
|
||||
|
||||
@ -904,8 +904,8 @@ const char* PrettyPrinter::PrintProgram(FunctionLiteral* program) {
|
||||
}
|
||||
|
||||
|
||||
void PrettyPrinter::PrintOut(Isolate* isolate, Zone* zone, AstNode* node) {
|
||||
PrettyPrinter printer(isolate, zone);
|
||||
void PrettyPrinter::PrintOut(Isolate* isolate, AstNode* node) {
|
||||
PrettyPrinter printer(isolate);
|
||||
PrintF("%s\n", printer.Print(node));
|
||||
}
|
||||
|
||||
@ -1080,8 +1080,7 @@ class IndentedScope BASE_EMBEDDED {
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
AstPrinter::AstPrinter(Isolate* isolate, Zone* zone)
|
||||
: PrettyPrinter(isolate, zone), indent_(0) {}
|
||||
AstPrinter::AstPrinter(Isolate* isolate) : PrettyPrinter(isolate), indent_(0) {}
|
||||
|
||||
|
||||
AstPrinter::~AstPrinter() {
|
||||
|
@ -13,7 +13,7 @@ namespace internal {
|
||||
|
||||
class CallPrinter : public AstVisitor {
|
||||
public:
|
||||
CallPrinter(Isolate* isolate, Zone* zone);
|
||||
explicit CallPrinter(Isolate* isolate);
|
||||
virtual ~CallPrinter();
|
||||
|
||||
// The following routine prints the node with position |position| into a
|
||||
@ -52,7 +52,7 @@ class CallPrinter : public AstVisitor {
|
||||
|
||||
class PrettyPrinter: public AstVisitor {
|
||||
public:
|
||||
PrettyPrinter(Isolate* isolate, Zone* zone);
|
||||
explicit PrettyPrinter(Isolate* isolate);
|
||||
virtual ~PrettyPrinter();
|
||||
|
||||
// The following routines print a node into a string.
|
||||
@ -64,7 +64,7 @@ class PrettyPrinter: public AstVisitor {
|
||||
void Print(const char* format, ...);
|
||||
|
||||
// Print a node to stdout.
|
||||
static void PrintOut(Isolate* isolate, Zone* zone, AstNode* node);
|
||||
static void PrintOut(Isolate* isolate, AstNode* node);
|
||||
|
||||
// Individual nodes
|
||||
#define DECLARE_VISIT(type) void Visit##type(type* node) override;
|
||||
@ -98,7 +98,7 @@ class PrettyPrinter: public AstVisitor {
|
||||
// Prints the AST structure
|
||||
class AstPrinter: public PrettyPrinter {
|
||||
public:
|
||||
AstPrinter(Isolate* isolate, Zone* zone);
|
||||
explicit AstPrinter(Isolate* isolate);
|
||||
virtual ~AstPrinter();
|
||||
|
||||
const char* PrintProgram(FunctionLiteral* program);
|
||||
|
@ -19,9 +19,10 @@ class Processor: public AstVisitor {
|
||||
result_assigned_(false),
|
||||
replacement_(nullptr),
|
||||
is_set_(false),
|
||||
zone_(ast_value_factory->zone()),
|
||||
scope_(scope),
|
||||
factory_(ast_value_factory) {
|
||||
InitializeAstVisitor(isolate, ast_value_factory->zone());
|
||||
InitializeAstVisitor(isolate);
|
||||
}
|
||||
|
||||
virtual ~Processor() { }
|
||||
@ -29,6 +30,7 @@ class Processor: public AstVisitor {
|
||||
void Process(ZoneList<Statement*>* statements);
|
||||
bool result_assigned() const { return result_assigned_; }
|
||||
|
||||
Zone* zone() { return zone_; }
|
||||
Scope* scope() { return scope_; }
|
||||
AstNodeFactory* factory() { return &factory_; }
|
||||
|
||||
@ -51,6 +53,7 @@ class Processor: public AstVisitor {
|
||||
// was hoping for.
|
||||
bool is_set_;
|
||||
|
||||
Zone* zone_;
|
||||
Scope* scope_;
|
||||
AstNodeFactory factory_;
|
||||
|
||||
|
@ -424,7 +424,7 @@ Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) {
|
||||
? new ParseInfo(&zone, location.function())
|
||||
: new ParseInfo(&zone, location.script()));
|
||||
if (Parser::ParseStatic(info.get())) {
|
||||
CallPrinter printer(isolate, &zone);
|
||||
CallPrinter printer(isolate);
|
||||
const char* string = printer.Print(info->literal(), location.start_pos());
|
||||
return isolate->factory()->NewStringFromAsciiChecked(string);
|
||||
} else {
|
||||
|
@ -43,7 +43,8 @@ base::LazyInstance<ZoneTypeCache>::type kCache = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
AsmTyper::AsmTyper(Isolate* isolate, Zone* zone, Script* script,
|
||||
FunctionLiteral* root)
|
||||
: script_(script),
|
||||
: zone_(zone),
|
||||
script_(script),
|
||||
root_(root),
|
||||
valid_(true),
|
||||
stdlib_types_(zone),
|
||||
@ -58,7 +59,7 @@ AsmTyper::AsmTyper(Isolate* isolate, Zone* zone, Script* script,
|
||||
in_function_(false),
|
||||
building_function_tables_(false),
|
||||
cache_(kCache.Get()) {
|
||||
InitializeAstVisitor(isolate, zone);
|
||||
InitializeAstVisitor(isolate);
|
||||
InitializeStdlib();
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@ class AsmTyper : public AstVisitor {
|
||||
DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
|
||||
|
||||
private:
|
||||
Zone* zone_;
|
||||
Script* script_;
|
||||
FunctionLiteral* root_;
|
||||
bool valid_;
|
||||
@ -83,6 +84,8 @@ class AsmTyper : public AstVisitor {
|
||||
void VisitWithExpectation(Expression* expr, Type* expected_type,
|
||||
const char* msg);
|
||||
|
||||
Zone* zone() const { return zone_; }
|
||||
|
||||
#define DECLARE_VISIT(type) virtual void Visit##type(type* node) override;
|
||||
AST_NODE_LIST(DECLARE_VISIT)
|
||||
#undef DECLARE_VISIT
|
||||
|
@ -14,9 +14,8 @@ namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
|
||||
TypingReseter::TypingReseter(Isolate* isolate, Zone* zone,
|
||||
FunctionLiteral* root)
|
||||
: AstExpressionVisitor(isolate, zone, root) {}
|
||||
TypingReseter::TypingReseter(Isolate* isolate, FunctionLiteral* root)
|
||||
: AstExpressionVisitor(isolate, root) {}
|
||||
|
||||
|
||||
void TypingReseter::VisitExpression(Expression* expression) {
|
||||
|
@ -15,7 +15,7 @@ namespace internal {
|
||||
|
||||
class TypingReseter : public AstExpressionVisitor {
|
||||
public:
|
||||
TypingReseter(Isolate* isolate, Zone* zone, FunctionLiteral* root);
|
||||
TypingReseter(Isolate* isolate, FunctionLiteral* root);
|
||||
|
||||
protected:
|
||||
void VisitExpression(Expression* expression) override;
|
||||
|
@ -18,6 +18,7 @@ namespace internal {
|
||||
AstTyper::AstTyper(Isolate* isolate, Zone* zone, Handle<JSFunction> closure,
|
||||
Scope* scope, BailoutId osr_ast_id, FunctionLiteral* root)
|
||||
: isolate_(isolate),
|
||||
zone_(zone),
|
||||
closure_(closure),
|
||||
scope_(scope),
|
||||
osr_ast_id_(osr_ast_id),
|
||||
@ -26,7 +27,7 @@ AstTyper::AstTyper(Isolate* isolate, Zone* zone, Handle<JSFunction> closure,
|
||||
handle(closure->shared()->feedback_vector()),
|
||||
handle(closure->context()->native_context())),
|
||||
store_(zone) {
|
||||
InitializeAstVisitor(isolate, zone);
|
||||
InitializeAstVisitor(isolate);
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,6 +34,7 @@ class AstTyper: public AstVisitor {
|
||||
typedef v8::internal::NestedEffects<int, kNoVar> Store;
|
||||
|
||||
Isolate* isolate_;
|
||||
Zone* zone_;
|
||||
Handle<JSFunction> closure_;
|
||||
Scope* scope_;
|
||||
BailoutId osr_ast_id_;
|
||||
@ -41,6 +42,7 @@ class AstTyper: public AstVisitor {
|
||||
TypeFeedbackOracle oracle_;
|
||||
Store store_;
|
||||
|
||||
Zone* zone() const { return zone_; }
|
||||
TypeFeedbackOracle* oracle() { return &oracle_; }
|
||||
|
||||
void NarrowType(Expression* e, Bounds b) {
|
||||
|
@ -29,9 +29,9 @@ struct {
|
||||
|
||||
|
||||
ExpressionTypeCollector::ExpressionTypeCollector(
|
||||
Isolate* isolate, Zone* zone, FunctionLiteral* root,
|
||||
Isolate* isolate, FunctionLiteral* root,
|
||||
ZoneVector<ExpressionTypeEntry>* dst)
|
||||
: AstExpressionVisitor(isolate, zone, root), result_(dst) {}
|
||||
: AstExpressionVisitor(isolate, root), result_(dst) {}
|
||||
|
||||
|
||||
void ExpressionTypeCollector::Run() {
|
||||
|
@ -23,7 +23,7 @@ struct ExpressionTypeEntry {
|
||||
|
||||
class ExpressionTypeCollector : public AstExpressionVisitor {
|
||||
public:
|
||||
ExpressionTypeCollector(Isolate* isolate, Zone* zone, FunctionLiteral* root,
|
||||
ExpressionTypeCollector(Isolate* isolate, FunctionLiteral* root,
|
||||
ZoneVector<ExpressionTypeEntry>* dst);
|
||||
void Run();
|
||||
|
||||
|
@ -67,7 +67,7 @@ std::string Validate(Zone* zone, const char* source,
|
||||
info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun();
|
||||
AsmTyper typer(isolate, zone, *script, root);
|
||||
if (typer.Validate()) {
|
||||
ExpressionTypeCollector(isolate, zone, root, types).Run();
|
||||
ExpressionTypeCollector(isolate, root, types).Run();
|
||||
return "";
|
||||
} else {
|
||||
return typer.error_message();
|
||||
|
@ -40,7 +40,7 @@ static void CollectTypes(HandleAndZoneScope* handles, const char* source,
|
||||
CHECK(i::Compiler::ParseAndAnalyze(&info));
|
||||
|
||||
ExpressionTypeCollector(
|
||||
isolate, handles->main_zone(),
|
||||
isolate,
|
||||
info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun(), dst)
|
||||
.Run();
|
||||
}
|
||||
|
@ -28,8 +28,8 @@ namespace {
|
||||
|
||||
class TypeSetter : public AstExpressionVisitor {
|
||||
public:
|
||||
TypeSetter(Isolate* isolate, Zone* zone, FunctionLiteral* root)
|
||||
: AstExpressionVisitor(isolate, zone, root) {}
|
||||
TypeSetter(Isolate* isolate, FunctionLiteral* root)
|
||||
: AstExpressionVisitor(isolate, root) {}
|
||||
|
||||
protected:
|
||||
void VisitExpression(Expression* expression) {
|
||||
@ -286,16 +286,16 @@ TEST(ResetTypingInfo) {
|
||||
|
||||
// Core of the test.
|
||||
ZoneVector<ExpressionTypeEntry> types(handles.main_zone());
|
||||
ExpressionTypeCollector(isolate, handles.main_zone(), root, &types).Run();
|
||||
ExpressionTypeCollector(isolate, root, &types).Run();
|
||||
CheckAllSame(types, Bounds::Unbounded());
|
||||
|
||||
TypeSetter(isolate, handles.main_zone(), root).Run();
|
||||
TypeSetter(isolate, root).Run();
|
||||
|
||||
ExpressionTypeCollector(isolate, handles.main_zone(), root, &types).Run();
|
||||
ExpressionTypeCollector(isolate, root, &types).Run();
|
||||
CheckAllSame(types, INT32_TYPE);
|
||||
|
||||
TypingReseter(isolate, handles.main_zone(), root).Run();
|
||||
TypingReseter(isolate, root).Run();
|
||||
|
||||
ExpressionTypeCollector(isolate, handles.main_zone(), root, &types).Run();
|
||||
ExpressionTypeCollector(isolate, root, &types).Run();
|
||||
CheckAllSame(types, Bounds::Unbounded());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user