#include "src/assembler.h"
#include "src/ast-value-factory.h"
+#include "src/bailout-reason.h"
#include "src/factory.h"
#include "src/feedback-slots.h"
#include "src/interface.h"
// Nodes of the abstract syntax tree. Only concrete classes are
// enumerated here.
-#define DECLARATION_NODE_LIST(V) \
- V(VariableDeclaration) \
- V(FunctionDeclaration) \
- V(ModuleDeclaration) \
- V(ImportDeclaration) \
- V(ExportDeclaration) \
+#define DECLARATION_NODE_LIST(V) \
+ V(VariableDeclaration) \
+ V(FunctionDeclaration) \
+ V(ModuleDeclaration) \
+ V(ImportDeclaration) \
+ V(ExportDeclaration)
#define MODULE_NODE_LIST(V) \
V(ModuleLiteral) \
V(TryFinallyStatement) \
V(DebuggerStatement)
-#define EXPRESSION_NODE_LIST(V) \
- V(FunctionLiteral) \
- V(NativeFunctionLiteral) \
- V(Conditional) \
- V(VariableProxy) \
- V(Literal) \
- V(RegExpLiteral) \
- V(ObjectLiteral) \
- V(ArrayLiteral) \
- V(Assignment) \
- V(Yield) \
- V(Throw) \
- V(Property) \
- V(Call) \
- V(CallNew) \
- V(CallRuntime) \
- V(UnaryOperation) \
- V(CountOperation) \
- V(BinaryOperation) \
- V(CompareOperation) \
- V(ThisFunction) \
+#define EXPRESSION_NODE_LIST(V) \
+ V(FunctionLiteral) \
+ V(ClassLiteral) \
+ V(NativeFunctionLiteral) \
+ V(Conditional) \
+ V(VariableProxy) \
+ V(Literal) \
+ V(RegExpLiteral) \
+ V(ObjectLiteral) \
+ V(ArrayLiteral) \
+ V(Assignment) \
+ V(Yield) \
+ V(Throw) \
+ V(Property) \
+ V(Call) \
+ V(CallNew) \
+ V(CallRuntime) \
+ V(UnaryOperation) \
+ V(CountOperation) \
+ V(BinaryOperation) \
+ V(CompareOperation) \
+ V(ThisFunction) \
+ V(SuperReference) \
V(CaseClause)
#define AST_NODE_LIST(V) \
#define DECLARE_NODE_TYPE(type) \
- virtual void Accept(AstVisitor* v) V8_OVERRIDE; \
- virtual AstNode::NodeType node_type() const V8_FINAL V8_OVERRIDE { \
+ virtual void Accept(AstVisitor* v) OVERRIDE; \
+ virtual AstNode::NodeType node_type() const FINAL OVERRIDE { \
return AstNode::k##type; \
} \
template<class> friend class AstNodeFactory;
};
-class AstProperties V8_FINAL BASE_EMBEDDED {
+class AstProperties FINAL BASE_EMBEDDED {
public:
class Flags : public EnumSet<AstPropertiesFlag, int> {};
class AstNode: public ZoneObject {
public:
+ // For generating IDs for AstNodes.
+ class IdGen {
+ public:
+ explicit IdGen(int id = 0) : id_(id) {}
+
+ int GetNextId() { return ReserveIdRange(1); }
+ int ReserveIdRange(int n) {
+ int tmp = id_;
+ id_ += n;
+ return tmp;
+ }
+
+ private:
+ int id_;
+ };
+
#define DECLARE_TYPE_ENUM(type) k##type,
enum NodeType {
AST_NODE_LIST(DECLARE_TYPE_ENUM)
virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; }
protected:
- static int GetNextId(Zone* zone) {
- return ReserveIdRange(zone, 1);
- }
-
- static int ReserveIdRange(Zone* zone, int n) {
- int tmp = zone->isolate()->ast_node_id();
- zone->isolate()->set_ast_node_id(tmp + n);
- return tmp;
- }
-
// Some nodes re-use bailout IDs for type feedback.
static TypeFeedbackId reuse(BailoutId id) {
return TypeFeedbackId(id.ToInt());
};
-class SmallMapList V8_FINAL {
+class SmallMapList FINAL {
public:
SmallMapList() {}
SmallMapList(int capacity, Zone* zone) : list_(capacity, zone) {}
TypeFeedbackId test_id() const { return test_id_; }
protected:
- Expression(Zone* zone, int pos)
+ Expression(Zone* zone, int pos, IdGen* id_gen)
: AstNode(pos),
- zone_(zone),
bounds_(Bounds::Unbounded(zone)),
parenthesization_level_(0),
- id_(GetNextId(zone)),
- test_id_(GetNextId(zone)) {}
+ id_(id_gen->GetNextId()),
+ test_id_(id_gen->GetNextId()) {}
void set_to_boolean_types(byte types) { to_boolean_types_ = types; }
- Zone* zone_;
-
private:
Bounds bounds_;
byte to_boolean_types_;
ZoneList<const AstRawString*>* labels() const { return labels_; }
// Type testing & conversion.
- virtual BreakableStatement* AsBreakableStatement() V8_FINAL V8_OVERRIDE {
+ virtual BreakableStatement* AsBreakableStatement() FINAL OVERRIDE {
return this;
}
BailoutId ExitId() const { return exit_id_; }
protected:
- BreakableStatement(
- Zone* zone, ZoneList<const AstRawString*>* labels,
- BreakableType breakable_type, int position)
+ BreakableStatement(Zone* zone, ZoneList<const AstRawString*>* labels,
+ BreakableType breakable_type, int position, IdGen* id_gen)
: Statement(zone, position),
labels_(labels),
breakable_type_(breakable_type),
- entry_id_(GetNextId(zone)),
- exit_id_(GetNextId(zone)) {
+ entry_id_(id_gen->GetNextId()),
+ exit_id_(id_gen->GetNextId()) {
DCHECK(labels == NULL || labels->length() > 0);
}
};
-class Block V8_FINAL : public BreakableStatement {
+class Block FINAL : public BreakableStatement {
public:
DECLARE_NODE_TYPE(Block)
BailoutId DeclsId() const { return decls_id_; }
- virtual bool IsJump() const V8_OVERRIDE {
+ virtual bool IsJump() const OVERRIDE {
return !statements_.is_empty() && statements_.last()->IsJump()
&& labels() == NULL; // Good enough as an approximation...
}
void set_scope(Scope* scope) { scope_ = scope; }
protected:
- Block(Zone* zone,
- ZoneList<const AstRawString*>* labels,
- int capacity,
- bool is_initializer_block,
- int pos)
- : BreakableStatement(zone, labels, TARGET_FOR_NAMED_ONLY, pos),
+ Block(Zone* zone, ZoneList<const AstRawString*>* labels, int capacity,
+ bool is_initializer_block, int pos, IdGen* id_gen)
+ : BreakableStatement(zone, labels, TARGET_FOR_NAMED_ONLY, pos, id_gen),
statements_(capacity, zone),
is_initializer_block_(is_initializer_block),
- decls_id_(GetNextId(zone)),
- scope_(NULL) {
- }
+ decls_id_(id_gen->GetNextId()),
+ scope_(NULL) {}
private:
ZoneList<Statement*> statements_;
};
-class VariableDeclaration V8_FINAL : public Declaration {
+class VariableDeclaration FINAL : public Declaration {
public:
DECLARE_NODE_TYPE(VariableDeclaration)
- virtual InitializationFlag initialization() const V8_OVERRIDE {
+ virtual InitializationFlag initialization() const OVERRIDE {
return mode() == VAR ? kCreatedInitialized : kNeedsInitialization;
}
};
-class FunctionDeclaration V8_FINAL : public Declaration {
+class FunctionDeclaration FINAL : public Declaration {
public:
DECLARE_NODE_TYPE(FunctionDeclaration)
FunctionLiteral* fun() const { return fun_; }
- virtual InitializationFlag initialization() const V8_OVERRIDE {
+ virtual InitializationFlag initialization() const OVERRIDE {
return kCreatedInitialized;
}
- virtual bool IsInlineable() const V8_OVERRIDE;
+ virtual bool IsInlineable() const OVERRIDE;
protected:
FunctionDeclaration(Zone* zone,
};
-class ModuleDeclaration V8_FINAL : public Declaration {
+class ModuleDeclaration FINAL : public Declaration {
public:
DECLARE_NODE_TYPE(ModuleDeclaration)
Module* module() const { return module_; }
- virtual InitializationFlag initialization() const V8_OVERRIDE {
+ virtual InitializationFlag initialization() const OVERRIDE {
return kCreatedInitialized;
}
};
-class ImportDeclaration V8_FINAL : public Declaration {
+class ImportDeclaration FINAL : public Declaration {
public:
DECLARE_NODE_TYPE(ImportDeclaration)
Module* module() const { return module_; }
- virtual InitializationFlag initialization() const V8_OVERRIDE {
+ virtual InitializationFlag initialization() const OVERRIDE {
return kCreatedInitialized;
}
};
-class ExportDeclaration V8_FINAL : public Declaration {
+class ExportDeclaration FINAL : public Declaration {
public:
DECLARE_NODE_TYPE(ExportDeclaration)
- virtual InitializationFlag initialization() const V8_OVERRIDE {
+ virtual InitializationFlag initialization() const OVERRIDE {
return kCreatedInitialized;
}
};
-class ModuleLiteral V8_FINAL : public Module {
+class ModuleLiteral FINAL : public Module {
public:
DECLARE_NODE_TYPE(ModuleLiteral)
};
-class ModuleVariable V8_FINAL : public Module {
+class ModuleVariable FINAL : public Module {
public:
DECLARE_NODE_TYPE(ModuleVariable)
};
-class ModulePath V8_FINAL : public Module {
+class ModulePath FINAL : public Module {
public:
DECLARE_NODE_TYPE(ModulePath)
};
-class ModuleUrl V8_FINAL : public Module {
+class ModuleUrl FINAL : public Module {
public:
DECLARE_NODE_TYPE(ModuleUrl)
};
-class ModuleStatement V8_FINAL : public Statement {
+class ModuleStatement FINAL : public Statement {
public:
DECLARE_NODE_TYPE(ModuleStatement)
class IterationStatement : public BreakableStatement {
public:
// Type testing & conversion.
- virtual IterationStatement* AsIterationStatement() V8_FINAL V8_OVERRIDE {
+ virtual IterationStatement* AsIterationStatement() FINAL OVERRIDE {
return this;
}
Label* continue_target() { return &continue_target_; }
protected:
- IterationStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos)
- : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos),
+ IterationStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
+ IdGen* id_gen)
+ : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos, id_gen),
body_(NULL),
- osr_entry_id_(GetNextId(zone)) {
- }
+ osr_entry_id_(id_gen->GetNextId()) {}
void Initialize(Statement* body) {
body_ = body;
};
-class DoWhileStatement V8_FINAL : public IterationStatement {
+class DoWhileStatement FINAL : public IterationStatement {
public:
DECLARE_NODE_TYPE(DoWhileStatement)
Expression* cond() const { return cond_; }
- virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; }
- virtual BailoutId StackCheckId() const V8_OVERRIDE { return back_edge_id_; }
+ virtual BailoutId ContinueId() const OVERRIDE { return continue_id_; }
+ virtual BailoutId StackCheckId() const OVERRIDE { return back_edge_id_; }
BailoutId BackEdgeId() const { return back_edge_id_; }
protected:
- DoWhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos)
- : IterationStatement(zone, labels, pos),
+ DoWhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
+ IdGen* id_gen)
+ : IterationStatement(zone, labels, pos, id_gen),
cond_(NULL),
- continue_id_(GetNextId(zone)),
- back_edge_id_(GetNextId(zone)) {
- }
+ continue_id_(id_gen->GetNextId()),
+ back_edge_id_(id_gen->GetNextId()) {}
private:
Expression* cond_;
};
-class WhileStatement V8_FINAL : public IterationStatement {
+class WhileStatement FINAL : public IterationStatement {
public:
DECLARE_NODE_TYPE(WhileStatement)
may_have_function_literal_ = value;
}
- virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); }
- virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; }
+ virtual BailoutId ContinueId() const OVERRIDE { return EntryId(); }
+ virtual BailoutId StackCheckId() const OVERRIDE { return body_id_; }
BailoutId BodyId() const { return body_id_; }
protected:
- WhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos)
- : IterationStatement(zone, labels, pos),
+ WhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
+ IdGen* id_gen)
+ : IterationStatement(zone, labels, pos, id_gen),
cond_(NULL),
may_have_function_literal_(true),
- body_id_(GetNextId(zone)) {
- }
+ body_id_(id_gen->GetNextId()) {}
private:
Expression* cond_;
};
-class ForStatement V8_FINAL : public IterationStatement {
+class ForStatement FINAL : public IterationStatement {
public:
DECLARE_NODE_TYPE(ForStatement)
may_have_function_literal_ = value;
}
- virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; }
- virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; }
+ virtual BailoutId ContinueId() const OVERRIDE { return continue_id_; }
+ virtual BailoutId StackCheckId() const OVERRIDE { return body_id_; }
BailoutId BodyId() const { return body_id_; }
bool is_fast_smi_loop() { return loop_variable_ != NULL; }
void set_loop_variable(Variable* var) { loop_variable_ = var; }
protected:
- ForStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos)
- : IterationStatement(zone, labels, pos),
+ ForStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
+ IdGen* id_gen)
+ : IterationStatement(zone, labels, pos, id_gen),
init_(NULL),
cond_(NULL),
next_(NULL),
may_have_function_literal_(true),
loop_variable_(NULL),
- continue_id_(GetNextId(zone)),
- body_id_(GetNextId(zone)) {
- }
+ continue_id_(id_gen->GetNextId()),
+ body_id_(id_gen->GetNextId()) {}
private:
Statement* init_;
Expression* subject() const { return subject_; }
protected:
- ForEachStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos)
- : IterationStatement(zone, labels, pos), each_(NULL), subject_(NULL) {}
+ ForEachStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
+ IdGen* id_gen)
+ : IterationStatement(zone, labels, pos, id_gen),
+ each_(NULL),
+ subject_(NULL) {}
private:
Expression* each_;
};
-class ForInStatement V8_FINAL : public ForEachStatement,
+class ForInStatement FINAL : public ForEachStatement,
public FeedbackSlotInterface {
public:
DECLARE_NODE_TYPE(ForInStatement)
BailoutId BodyId() const { return body_id_; }
BailoutId PrepareId() const { return prepare_id_; }
- virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); }
- virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; }
+ virtual BailoutId ContinueId() const OVERRIDE { return EntryId(); }
+ virtual BailoutId StackCheckId() const OVERRIDE { return body_id_; }
protected:
- ForInStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos)
- : ForEachStatement(zone, labels, pos),
+ ForInStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
+ IdGen* id_gen)
+ : ForEachStatement(zone, labels, pos, id_gen),
for_in_type_(SLOW_FOR_IN),
for_in_feedback_slot_(kInvalidFeedbackSlot),
- body_id_(GetNextId(zone)),
- prepare_id_(GetNextId(zone)) {
- }
+ body_id_(id_gen->GetNextId()),
+ prepare_id_(id_gen->GetNextId()) {}
ForInType for_in_type_;
int for_in_feedback_slot_;
};
-class ForOfStatement V8_FINAL : public ForEachStatement {
+class ForOfStatement FINAL : public ForEachStatement {
public:
DECLARE_NODE_TYPE(ForOfStatement)
return assign_each_;
}
- virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); }
- virtual BailoutId StackCheckId() const V8_OVERRIDE { return BackEdgeId(); }
+ virtual BailoutId ContinueId() const OVERRIDE { return EntryId(); }
+ virtual BailoutId StackCheckId() const OVERRIDE { return BackEdgeId(); }
BailoutId BackEdgeId() const { return back_edge_id_; }
protected:
- ForOfStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos)
- : ForEachStatement(zone, labels, pos),
+ ForOfStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
+ IdGen* id_gen)
+ : ForEachStatement(zone, labels, pos, id_gen),
assign_iterator_(NULL),
next_result_(NULL),
result_done_(NULL),
assign_each_(NULL),
- back_edge_id_(GetNextId(zone)) {
- }
+ back_edge_id_(id_gen->GetNextId()) {}
Expression* assign_iterator_;
Expression* next_result_;
};
-class ExpressionStatement V8_FINAL : public Statement {
+class ExpressionStatement FINAL : public Statement {
public:
DECLARE_NODE_TYPE(ExpressionStatement)
void set_expression(Expression* e) { expression_ = e; }
Expression* expression() const { return expression_; }
- virtual bool IsJump() const V8_OVERRIDE { return expression_->IsThrow(); }
+ virtual bool IsJump() const OVERRIDE { return expression_->IsThrow(); }
protected:
ExpressionStatement(Zone* zone, Expression* expression, int pos)
class JumpStatement : public Statement {
public:
- virtual bool IsJump() const V8_FINAL V8_OVERRIDE { return true; }
+ virtual bool IsJump() const FINAL OVERRIDE { return true; }
protected:
explicit JumpStatement(Zone* zone, int pos) : Statement(zone, pos) {}
};
-class ContinueStatement V8_FINAL : public JumpStatement {
+class ContinueStatement FINAL : public JumpStatement {
public:
DECLARE_NODE_TYPE(ContinueStatement)
};
-class BreakStatement V8_FINAL : public JumpStatement {
+class BreakStatement FINAL : public JumpStatement {
public:
DECLARE_NODE_TYPE(BreakStatement)
};
-class ReturnStatement V8_FINAL : public JumpStatement {
+class ReturnStatement FINAL : public JumpStatement {
public:
DECLARE_NODE_TYPE(ReturnStatement)
};
-class WithStatement V8_FINAL : public Statement {
+class WithStatement FINAL : public Statement {
public:
DECLARE_NODE_TYPE(WithStatement)
};
-class CaseClause V8_FINAL : public Expression {
+class CaseClause FINAL : public Expression {
public:
DECLARE_NODE_TYPE(CaseClause)
void set_compare_type(Type* type) { compare_type_ = type; }
private:
- CaseClause(Zone* zone,
- Expression* label,
- ZoneList<Statement*>* statements,
- int pos);
+ CaseClause(Zone* zone, Expression* label, ZoneList<Statement*>* statements,
+ int pos, IdGen* id_gen);
Expression* label_;
Label body_target_;
};
-class SwitchStatement V8_FINAL : public BreakableStatement {
+class SwitchStatement FINAL : public BreakableStatement {
public:
DECLARE_NODE_TYPE(SwitchStatement)
ZoneList<CaseClause*>* cases() const { return cases_; }
protected:
- SwitchStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos)
- : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos),
+ SwitchStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
+ IdGen* id_gen)
+ : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos, id_gen),
tag_(NULL),
- cases_(NULL) { }
+ cases_(NULL) {}
private:
Expression* tag_;
// the parser implicitly creates an empty statement. Use the
// HasThenStatement() and HasElseStatement() functions to check if a
// given if-statement has a then- or an else-part containing code.
-class IfStatement V8_FINAL : public Statement {
+class IfStatement FINAL : public Statement {
public:
DECLARE_NODE_TYPE(IfStatement)
Statement* then_statement() const { return then_statement_; }
Statement* else_statement() const { return else_statement_; }
- virtual bool IsJump() const V8_OVERRIDE {
+ virtual bool IsJump() const OVERRIDE {
return HasThenStatement() && then_statement()->IsJump()
&& HasElseStatement() && else_statement()->IsJump();
}
BailoutId ElseId() const { return else_id_; }
protected:
- IfStatement(Zone* zone,
- Expression* condition,
- Statement* then_statement,
- Statement* else_statement,
- int pos)
+ IfStatement(Zone* zone, Expression* condition, Statement* then_statement,
+ Statement* else_statement, int pos, IdGen* id_gen)
: Statement(zone, pos),
condition_(condition),
then_statement_(then_statement),
else_statement_(else_statement),
- if_id_(GetNextId(zone)),
- then_id_(GetNextId(zone)),
- else_id_(GetNextId(zone)) {
- }
+ if_id_(id_gen->GetNextId()),
+ then_id_(id_gen->GetNextId()),
+ else_id_(id_gen->GetNextId()) {}
private:
Expression* condition_;
// NOTE: TargetCollectors are represented as nodes to fit in the target
// stack in the compiler; this should probably be reworked.
-class TargetCollector V8_FINAL : public AstNode {
+class TargetCollector FINAL : public AstNode {
public:
explicit TargetCollector(Zone* zone)
: AstNode(RelocInfo::kNoPosition), targets_(0, zone) { }
void AddTarget(Label* target, Zone* zone);
// Virtual behaviour. TargetCollectors are never part of the AST.
- virtual void Accept(AstVisitor* v) V8_OVERRIDE { UNREACHABLE(); }
- virtual NodeType node_type() const V8_OVERRIDE { return kInvalid; }
- virtual TargetCollector* AsTargetCollector() V8_OVERRIDE { return this; }
+ virtual void Accept(AstVisitor* v) OVERRIDE { UNREACHABLE(); }
+ virtual NodeType node_type() const OVERRIDE { return kInvalid; }
+ virtual TargetCollector* AsTargetCollector() OVERRIDE { return this; }
ZoneList<Label*>* targets() { return &targets_; }
};
-class TryCatchStatement V8_FINAL : public TryStatement {
+class TryCatchStatement FINAL : public TryStatement {
public:
DECLARE_NODE_TYPE(TryCatchStatement)
};
-class TryFinallyStatement V8_FINAL : public TryStatement {
+class TryFinallyStatement FINAL : public TryStatement {
public:
DECLARE_NODE_TYPE(TryFinallyStatement)
};
-class DebuggerStatement V8_FINAL : public Statement {
+class DebuggerStatement FINAL : public Statement {
public:
DECLARE_NODE_TYPE(DebuggerStatement)
+ BailoutId DebugBreakId() const { return debugger_id_; }
+
protected:
- explicit DebuggerStatement(Zone* zone, int pos): Statement(zone, pos) {}
+ explicit DebuggerStatement(Zone* zone, int pos, IdGen* id_gen)
+ : Statement(zone, pos), debugger_id_(id_gen->GetNextId()) {}
+
+ private:
+ const BailoutId debugger_id_;
};
-class EmptyStatement V8_FINAL : public Statement {
+class EmptyStatement FINAL : public Statement {
public:
DECLARE_NODE_TYPE(EmptyStatement)
};
-class Literal V8_FINAL : public Expression {
+class Literal FINAL : public Expression {
public:
DECLARE_NODE_TYPE(Literal)
- virtual bool IsPropertyName() const V8_OVERRIDE {
+ virtual bool IsPropertyName() const OVERRIDE {
return value_->IsPropertyName();
}
return value_->AsString();
}
- virtual bool ToBooleanIsTrue() const V8_OVERRIDE {
+ virtual bool ToBooleanIsTrue() const OVERRIDE {
return value()->BooleanValue();
}
- virtual bool ToBooleanIsFalse() const V8_OVERRIDE {
+ virtual bool ToBooleanIsFalse() const OVERRIDE {
return !value()->BooleanValue();
}
TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); }
protected:
- Literal(Zone* zone, const AstValue* value, int position)
- : Expression(zone, position),
+ Literal(Zone* zone, const AstValue* value, int position, IdGen* id_gen)
+ : Expression(zone, position, id_gen),
value_(value),
- isolate_(zone->isolate()) { }
+ isolate_(zone->isolate()) {}
private:
Handle<String> ToString();
}
protected:
- MaterializedLiteral(Zone* zone,
- int literal_index,
- int pos)
- : Expression(zone, pos),
+ MaterializedLiteral(Zone* zone, int literal_index, int pos, IdGen* id_gen)
+ : Expression(zone, pos, id_gen),
literal_index_(literal_index),
is_simple_(false),
depth_(0) {}
// Property is used for passing information
// about an object literal's properties from the parser
// to the code generator.
-class ObjectLiteralProperty V8_FINAL : public ZoneObject {
+class ObjectLiteralProperty FINAL : public ZoneObject {
public:
enum Kind {
CONSTANT, // Property with constant value (compile time).
};
ObjectLiteralProperty(Zone* zone, AstValueFactory* ast_value_factory,
- Literal* key, Expression* value);
+ Literal* key, Expression* value, bool is_static);
Literal* key() { return key_; }
Expression* value() { return value_; }
protected:
template<class> friend class AstNodeFactory;
- ObjectLiteralProperty(Zone* zone, bool is_getter, FunctionLiteral* value);
+ ObjectLiteralProperty(Zone* zone, bool is_getter, FunctionLiteral* value,
+ bool is_static);
void set_key(Literal* key) { key_ = key; }
private:
Expression* value_;
Kind kind_;
bool emit_store_;
+ bool is_static_;
Handle<Map> receiver_type_;
};
// An object literal has a boilerplate object that is used
// for minimizing the work when constructing it at runtime.
-class ObjectLiteral V8_FINAL : public MaterializedLiteral {
+class ObjectLiteral FINAL : public MaterializedLiteral {
public:
typedef ObjectLiteralProperty Property;
};
protected:
- ObjectLiteral(Zone* zone,
- ZoneList<Property*>* properties,
- int literal_index,
- int boilerplate_properties,
- bool has_function,
- int pos)
- : MaterializedLiteral(zone, literal_index, pos),
+ ObjectLiteral(Zone* zone, ZoneList<Property*>* properties, int literal_index,
+ int boilerplate_properties, bool has_function, int pos,
+ IdGen* id_gen)
+ : MaterializedLiteral(zone, literal_index, pos, id_gen),
properties_(properties),
boilerplate_properties_(boilerplate_properties),
fast_elements_(false),
// Node for capturing a regexp literal.
-class RegExpLiteral V8_FINAL : public MaterializedLiteral {
+class RegExpLiteral FINAL : public MaterializedLiteral {
public:
DECLARE_NODE_TYPE(RegExpLiteral)
Handle<String> flags() const { return flags_->string(); }
protected:
- RegExpLiteral(Zone* zone,
- const AstRawString* pattern,
- const AstRawString* flags,
- int literal_index,
- int pos)
- : MaterializedLiteral(zone, literal_index, pos),
+ RegExpLiteral(Zone* zone, const AstRawString* pattern,
+ const AstRawString* flags, int literal_index, int pos,
+ IdGen* id_gen)
+ : MaterializedLiteral(zone, literal_index, pos, id_gen),
pattern_(pattern),
flags_(flags) {
set_depth(1);
// An array literal has a literals object that is used
// for minimizing the work when constructing it at runtime.
-class ArrayLiteral V8_FINAL : public MaterializedLiteral {
+class ArrayLiteral FINAL : public MaterializedLiteral {
public:
DECLARE_NODE_TYPE(ArrayLiteral)
};
protected:
- ArrayLiteral(Zone* zone,
- ZoneList<Expression*>* values,
- int literal_index,
- int pos)
- : MaterializedLiteral(zone, literal_index, pos),
+ ArrayLiteral(Zone* zone, ZoneList<Expression*>* values, int literal_index,
+ int pos, IdGen* id_gen)
+ : MaterializedLiteral(zone, literal_index, pos, id_gen),
values_(values),
- first_element_id_(ReserveIdRange(zone, values->length())) {}
+ first_element_id_(id_gen->ReserveIdRange(values->length())) {}
private:
Handle<FixedArray> constant_elements_;
};
-class VariableProxy V8_FINAL : public Expression, public FeedbackSlotInterface {
+class VariableProxy FINAL : public Expression, public FeedbackSlotInterface {
public:
DECLARE_NODE_TYPE(VariableProxy)
- virtual bool IsValidReferenceExpression() const V8_OVERRIDE {
+ virtual bool IsValidReferenceExpression() const OVERRIDE {
return var_ == NULL ? true : var_->IsValidReference();
}
int VariableFeedbackSlot() { return variable_feedback_slot_; }
protected:
- VariableProxy(Zone* zone, Variable* var, int position);
+ VariableProxy(Zone* zone, Variable* var, int position, IdGen* id_gen);
- VariableProxy(Zone* zone,
- const AstRawString* name,
- bool is_this,
- Interface* interface,
- int position);
+ VariableProxy(Zone* zone, const AstRawString* name, bool is_this,
+ Interface* interface, int position, IdGen* id_gen);
const AstRawString* name_;
Variable* var_; // resolved variable, or NULL
};
-class Property V8_FINAL : public Expression, public FeedbackSlotInterface {
+class Property FINAL : public Expression, public FeedbackSlotInterface {
public:
DECLARE_NODE_TYPE(Property)
- virtual bool IsValidReferenceExpression() const V8_OVERRIDE { return true; }
+ virtual bool IsValidReferenceExpression() const OVERRIDE { return true; }
Expression* obj() const { return obj_; }
Expression* key() const { return key_; }
bool IsStringAccess() const { return is_string_access_; }
// Type feedback information.
- virtual bool IsMonomorphic() V8_OVERRIDE {
+ virtual bool IsMonomorphic() OVERRIDE {
return receiver_types_.length() == 1;
}
- virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE {
+ virtual SmallMapList* GetReceiverTypes() OVERRIDE {
return &receiver_types_;
}
- virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE {
+ virtual KeyedAccessStoreMode GetStoreMode() OVERRIDE {
return STANDARD_STORE;
}
bool IsUninitialized() { return !is_for_call_ && is_uninitialized_; }
void mark_for_call() { is_for_call_ = true; }
bool IsForCall() { return is_for_call_; }
+ bool IsSuperAccess() {
+ return obj()->IsSuperReference();
+ }
+
TypeFeedbackId PropertyFeedbackId() { return reuse(id()); }
virtual int ComputeFeedbackSlotCount() { return FLAG_vector_ics ? 1 : 0; }
int PropertyFeedbackSlot() const { return property_feedback_slot_; }
protected:
- Property(Zone* zone, Expression* obj, Expression* key, int pos)
- : Expression(zone, pos),
+ Property(Zone* zone, Expression* obj, Expression* key, int pos, IdGen* id_gen)
+ : Expression(zone, pos, id_gen),
obj_(obj),
key_(key),
- load_id_(GetNextId(zone)),
+ load_id_(id_gen->GetNextId()),
property_feedback_slot_(kInvalidFeedbackSlot),
is_for_call_(false),
is_uninitialized_(false),
};
-class Call V8_FINAL : public Expression, public FeedbackSlotInterface {
+class Call FINAL : public Expression, public FeedbackSlotInterface {
public:
DECLARE_NODE_TYPE(Call)
}
int CallFeedbackSlot() const { return call_feedback_slot_; }
- virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE {
+ virtual SmallMapList* GetReceiverTypes() OVERRIDE {
if (expression()->IsProperty()) {
return expression()->AsProperty()->GetReceiverTypes();
}
return NULL;
}
- virtual bool IsMonomorphic() V8_OVERRIDE {
+ virtual bool IsMonomorphic() OVERRIDE {
if (expression()->IsProperty()) {
return expression()->AsProperty()->IsMonomorphic();
}
void set_allocation_site(Handle<AllocationSite> site) {
allocation_site_ = site;
}
- bool ComputeGlobalTarget(Handle<GlobalObject> global, LookupResult* lookup);
+ bool ComputeGlobalTarget(Handle<GlobalObject> global, LookupIterator* it);
BailoutId ReturnId() const { return return_id_; }
#endif
protected:
- Call(Zone* zone,
- Expression* expression,
- ZoneList<Expression*>* arguments,
- int pos)
- : Expression(zone, pos),
+ Call(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments,
+ int pos, IdGen* id_gen)
+ : Expression(zone, pos, id_gen),
expression_(expression),
arguments_(arguments),
call_feedback_slot_(kInvalidFeedbackSlot),
- return_id_(GetNextId(zone)) {
+ return_id_(id_gen->GetNextId()) {
if (expression->IsProperty()) {
expression->AsProperty()->mark_for_call();
}
};
-class CallNew V8_FINAL : public Expression, public FeedbackSlotInterface {
+class CallNew FINAL : public Expression, public FeedbackSlotInterface {
public:
DECLARE_NODE_TYPE(CallNew)
}
void RecordTypeFeedback(TypeFeedbackOracle* oracle);
- virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; }
+ virtual bool IsMonomorphic() OVERRIDE { return is_monomorphic_; }
Handle<JSFunction> target() const { return target_; }
ElementsKind elements_kind() const { return elements_kind_; }
Handle<AllocationSite> allocation_site() const {
BailoutId ReturnId() const { return return_id_; }
protected:
- CallNew(Zone* zone,
- Expression* expression,
- ZoneList<Expression*>* arguments,
- int pos)
- : Expression(zone, pos),
+ CallNew(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments,
+ int pos, IdGen* id_gen)
+ : Expression(zone, pos, id_gen),
expression_(expression),
arguments_(arguments),
is_monomorphic_(false),
elements_kind_(GetInitialFastElementsKind()),
callnew_feedback_slot_(kInvalidFeedbackSlot),
- return_id_(GetNextId(zone)) { }
+ return_id_(id_gen->GetNextId()) {}
private:
Expression* expression_;
// language construct. Instead it is used to call a C or JS function
// with a set of arguments. This is used from the builtins that are
// implemented in JavaScript (see "v8natives.js").
-class CallRuntime V8_FINAL : public Expression, public FeedbackSlotInterface {
+class CallRuntime FINAL : public Expression, public FeedbackSlotInterface {
public:
DECLARE_NODE_TYPE(CallRuntime)
TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); }
protected:
- CallRuntime(Zone* zone,
- const AstRawString* name,
+ CallRuntime(Zone* zone, const AstRawString* name,
const Runtime::Function* function,
- ZoneList<Expression*>* arguments,
- int pos)
- : Expression(zone, pos),
+ ZoneList<Expression*>* arguments, int pos, IdGen* id_gen)
+ : Expression(zone, pos, id_gen),
raw_name_(name),
function_(function),
- arguments_(arguments) { }
+ arguments_(arguments) {}
private:
const AstRawString* raw_name_;
};
-class UnaryOperation V8_FINAL : public Expression {
+class UnaryOperation FINAL : public Expression {
public:
DECLARE_NODE_TYPE(UnaryOperation)
BailoutId MaterializeFalseId() { return materialize_false_id_; }
virtual void RecordToBooleanTypeFeedback(
- TypeFeedbackOracle* oracle) V8_OVERRIDE;
+ TypeFeedbackOracle* oracle) OVERRIDE;
protected:
- UnaryOperation(Zone* zone,
- Token::Value op,
- Expression* expression,
- int pos)
- : Expression(zone, pos),
+ UnaryOperation(Zone* zone, Token::Value op, Expression* expression, int pos,
+ IdGen* id_gen)
+ : Expression(zone, pos, id_gen),
op_(op),
expression_(expression),
- materialize_true_id_(GetNextId(zone)),
- materialize_false_id_(GetNextId(zone)) {
+ materialize_true_id_(id_gen->GetNextId()),
+ materialize_false_id_(id_gen->GetNextId()) {
DCHECK(Token::IsUnaryOp(op));
}
};
-class BinaryOperation V8_FINAL : public Expression {
+class BinaryOperation FINAL : public Expression {
public:
DECLARE_NODE_TYPE(BinaryOperation)
- virtual bool ResultOverwriteAllowed() const V8_OVERRIDE;
+ virtual bool ResultOverwriteAllowed() const OVERRIDE;
Token::Value op() const { return op_; }
Expression* left() const { return left_; }
void set_fixed_right_arg(Maybe<int> arg) { fixed_right_arg_ = arg; }
virtual void RecordToBooleanTypeFeedback(
- TypeFeedbackOracle* oracle) V8_OVERRIDE;
+ TypeFeedbackOracle* oracle) OVERRIDE;
protected:
- BinaryOperation(Zone* zone,
- Token::Value op,
- Expression* left,
- Expression* right,
- int pos)
- : Expression(zone, pos),
+ BinaryOperation(Zone* zone, Token::Value op, Expression* left,
+ Expression* right, int pos, IdGen* id_gen)
+ : Expression(zone, pos, id_gen),
op_(op),
left_(left),
right_(right),
- right_id_(GetNextId(zone)) {
+ right_id_(id_gen->GetNextId()) {
DCHECK(Token::IsBinaryOp(op));
}
};
-class CountOperation V8_FINAL : public Expression {
+class CountOperation FINAL : public Expression {
public:
DECLARE_NODE_TYPE(CountOperation)
Expression* expression() const { return expression_; }
- virtual bool IsMonomorphic() V8_OVERRIDE {
+ virtual bool IsMonomorphic() OVERRIDE {
return receiver_types_.length() == 1;
}
- virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE {
+ virtual SmallMapList* GetReceiverTypes() OVERRIDE {
return &receiver_types_;
}
- virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE {
+ virtual KeyedAccessStoreMode GetStoreMode() OVERRIDE {
return store_mode_;
}
Type* type() const { return type_; }
TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); }
protected:
- CountOperation(Zone* zone,
- Token::Value op,
- bool is_prefix,
- Expression* expr,
- int pos)
- : Expression(zone, pos),
+ CountOperation(Zone* zone, Token::Value op, bool is_prefix, Expression* expr,
+ int pos, IdGen* id_gen)
+ : Expression(zone, pos, id_gen),
op_(op),
is_prefix_(is_prefix),
store_mode_(STANDARD_STORE),
expression_(expr),
- assignment_id_(GetNextId(zone)),
- count_id_(GetNextId(zone)) {}
+ assignment_id_(id_gen->GetNextId()),
+ count_id_(id_gen->GetNextId()) {}
private:
Token::Value op_;
};
-class CompareOperation V8_FINAL : public Expression {
+class CompareOperation FINAL : public Expression {
public:
DECLARE_NODE_TYPE(CompareOperation)
bool IsLiteralCompareNull(Expression** expr);
protected:
- CompareOperation(Zone* zone,
- Token::Value op,
- Expression* left,
- Expression* right,
- int pos)
- : Expression(zone, pos),
+ CompareOperation(Zone* zone, Token::Value op, Expression* left,
+ Expression* right, int pos, IdGen* id_gen)
+ : Expression(zone, pos, id_gen),
op_(op),
left_(left),
right_(right),
};
-class Conditional V8_FINAL : public Expression {
+class Conditional FINAL : public Expression {
public:
DECLARE_NODE_TYPE(Conditional)
BailoutId ElseId() const { return else_id_; }
protected:
- Conditional(Zone* zone,
- Expression* condition,
- Expression* then_expression,
- Expression* else_expression,
- int position)
- : Expression(zone, position),
+ Conditional(Zone* zone, Expression* condition, Expression* then_expression,
+ Expression* else_expression, int position, IdGen* id_gen)
+ : Expression(zone, position, id_gen),
condition_(condition),
then_expression_(then_expression),
else_expression_(else_expression),
- then_id_(GetNextId(zone)),
- else_id_(GetNextId(zone)) { }
+ then_id_(id_gen->GetNextId()),
+ else_id_(id_gen->GetNextId()) {}
private:
Expression* condition_;
};
-class Assignment V8_FINAL : public Expression {
+class Assignment FINAL : public Expression {
public:
DECLARE_NODE_TYPE(Assignment)
// Type feedback information.
TypeFeedbackId AssignmentFeedbackId() { return reuse(id()); }
- virtual bool IsMonomorphic() V8_OVERRIDE {
+ virtual bool IsMonomorphic() OVERRIDE {
return receiver_types_.length() == 1;
}
bool IsUninitialized() { return is_uninitialized_; }
bool HasNoTypeInformation() {
return is_uninitialized_;
}
- virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE {
+ virtual SmallMapList* GetReceiverTypes() OVERRIDE {
return &receiver_types_;
}
- virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE {
+ virtual KeyedAccessStoreMode GetStoreMode() OVERRIDE {
return store_mode_;
}
void set_is_uninitialized(bool b) { is_uninitialized_ = b; }
void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; }
protected:
- Assignment(Zone* zone,
- Token::Value op,
- Expression* target,
- Expression* value,
- int pos);
+ Assignment(Zone* zone, Token::Value op, Expression* target, Expression* value,
+ int pos, IdGen* id_gen);
template<class Visitor>
void Init(Zone* zone, AstNodeFactory<Visitor>* factory) {
};
-class Yield V8_FINAL : public Expression, public FeedbackSlotInterface {
+class Yield FINAL : public Expression, public FeedbackSlotInterface {
public:
DECLARE_NODE_TYPE(Yield)
enum Kind {
- INITIAL, // The initial yield that returns the unboxed generator object.
- SUSPEND, // A normal yield: { value: EXPRESSION, done: false }
- DELEGATING, // A yield*.
- FINAL // A return: { value: EXPRESSION, done: true }
+ kInitial, // The initial yield that returns the unboxed generator object.
+ kSuspend, // A normal yield: { value: EXPRESSION, done: false }
+ kDelegating, // A yield*.
+ kFinal // A return: { value: EXPRESSION, done: true }
};
Expression* generator_object() const { return generator_object_; }
// locates the catch handler in the handler table, and is equivalent to
// TryCatchStatement::index().
int index() const {
- DCHECK(yield_kind() == DELEGATING);
+ DCHECK_EQ(kDelegating, yield_kind());
return index_;
}
void set_index(int index) {
- DCHECK(yield_kind() == DELEGATING);
+ DCHECK_EQ(kDelegating, yield_kind());
index_ = index;
}
// Type feedback information.
virtual int ComputeFeedbackSlotCount() {
- return (FLAG_vector_ics && yield_kind() == DELEGATING) ? 3 : 0;
+ return (FLAG_vector_ics && yield_kind() == kDelegating) ? 3 : 0;
}
virtual void SetFirstFeedbackSlot(int slot) {
yield_first_feedback_slot_ = slot;
}
protected:
- Yield(Zone* zone,
- Expression* generator_object,
- Expression* expression,
- Kind yield_kind,
- int pos)
- : Expression(zone, pos),
+ Yield(Zone* zone, Expression* generator_object, Expression* expression,
+ Kind yield_kind, int pos, IdGen* id_gen)
+ : Expression(zone, pos, id_gen),
generator_object_(generator_object),
expression_(expression),
yield_kind_(yield_kind),
index_(-1),
- yield_first_feedback_slot_(kInvalidFeedbackSlot) { }
+ yield_first_feedback_slot_(kInvalidFeedbackSlot) {}
private:
Expression* generator_object_;
};
-class Throw V8_FINAL : public Expression {
+class Throw FINAL : public Expression {
public:
DECLARE_NODE_TYPE(Throw)
Expression* exception() const { return exception_; }
protected:
- Throw(Zone* zone, Expression* exception, int pos)
- : Expression(zone, pos), exception_(exception) {}
+ Throw(Zone* zone, Expression* exception, int pos, IdGen* id_gen)
+ : Expression(zone, pos, id_gen), exception_(exception) {}
private:
Expression* exception_;
};
-class FunctionLiteral V8_FINAL : public Expression {
+class FunctionLiteral FINAL : public Expression {
public:
enum FunctionType {
ANONYMOUS_EXPRESSION,
kNotParenthesized
};
- enum KindFlag {
- kNormalFunction,
- kArrowFunction,
- kGeneratorFunction
- };
-
enum ArityRestriction {
NORMAL_ARITY,
GETTER_ARITY,
bitfield_ = IsParenthesized::update(bitfield_, kIsParenthesized);
}
- bool is_generator() { return IsGenerator::decode(bitfield_); }
- bool is_arrow() { return IsArrow::decode(bitfield_); }
+ FunctionKind kind() { return FunctionKindBits::decode(bitfield_); }
+ bool is_arrow() {
+ return IsArrowFunction(FunctionKindBits::decode(bitfield_));
+ }
+ bool is_generator() {
+ return IsGeneratorFunction(FunctionKindBits::decode(bitfield_));
+ }
+ bool is_concise_method() {
+ return IsConciseMethod(FunctionKindBits::decode(bitfield_));
+ }
int ast_node_count() { return ast_properties_.node_count(); }
AstProperties::Flags* flags() { return ast_properties_.flags(); }
int parameter_count, FunctionType function_type,
ParameterFlag has_duplicate_parameters,
IsFunctionFlag is_function,
- IsParenthesizedFlag is_parenthesized, KindFlag kind,
- int position)
- : Expression(zone, position),
+ IsParenthesizedFlag is_parenthesized, FunctionKind kind,
+ int position, IdGen* id_gen)
+ : Expression(zone, position, id_gen),
raw_name_(name),
scope_(scope),
body_(body),
HasDuplicateParameters::encode(has_duplicate_parameters) |
IsFunction::encode(is_function) |
IsParenthesized::encode(is_parenthesized) |
- IsGenerator::encode(kind == kGeneratorFunction) |
- IsArrow::encode(kind == kArrowFunction);
+ FunctionKindBits::encode(kind);
+ DCHECK(IsValidFunctionKind(kind));
}
private:
int function_token_position_;
unsigned bitfield_;
- class IsExpression: public BitField<bool, 0, 1> {};
- class IsAnonymous: public BitField<bool, 1, 1> {};
- class Pretenure: public BitField<bool, 2, 1> {};
- class HasDuplicateParameters: public BitField<ParameterFlag, 3, 1> {};
- class IsFunction: public BitField<IsFunctionFlag, 4, 1> {};
- class IsParenthesized: public BitField<IsParenthesizedFlag, 5, 1> {};
- class IsGenerator : public BitField<bool, 6, 1> {};
- class IsArrow : public BitField<bool, 7, 1> {};
+ class IsExpression : public BitField<bool, 0, 1> {};
+ class IsAnonymous : public BitField<bool, 1, 1> {};
+ class Pretenure : public BitField<bool, 2, 1> {};
+ class HasDuplicateParameters : public BitField<ParameterFlag, 3, 1> {};
+ class IsFunction : public BitField<IsFunctionFlag, 4, 1> {};
+ class IsParenthesized : public BitField<IsParenthesizedFlag, 5, 1> {};
+ class FunctionKindBits : public BitField<FunctionKind, 6, 3> {};
};
-class NativeFunctionLiteral V8_FINAL : public Expression {
+class ClassLiteral FINAL : public Expression {
+ public:
+ typedef ObjectLiteralProperty Property;
+
+ DECLARE_NODE_TYPE(ClassLiteral)
+
+ Handle<String> name() const { return raw_name_->string(); }
+ const AstRawString* raw_name() const { return raw_name_; }
+ Expression* extends() const { return extends_; }
+ Expression* constructor() const { return constructor_; }
+ ZoneList<Property*>* properties() const { return properties_; }
+
+ protected:
+ ClassLiteral(Zone* zone, const AstRawString* name, Expression* extends,
+ Expression* constructor, ZoneList<Property*>* properties,
+ int position, IdGen* id_gen)
+ : Expression(zone, position, id_gen),
+ raw_name_(name),
+ extends_(extends),
+ constructor_(constructor),
+ properties_(properties) {}
+
+ private:
+ const AstRawString* raw_name_;
+ Expression* extends_;
+ Expression* constructor_;
+ ZoneList<Property*>* properties_;
+};
+
+
+class NativeFunctionLiteral FINAL : public Expression {
public:
DECLARE_NODE_TYPE(NativeFunctionLiteral)
protected:
NativeFunctionLiteral(Zone* zone, const AstRawString* name,
- v8::Extension* extension, int pos)
- : Expression(zone, pos), name_(name), extension_(extension) {}
+ v8::Extension* extension, int pos, IdGen* id_gen)
+ : Expression(zone, pos, id_gen), name_(name), extension_(extension) {}
private:
const AstRawString* name_;
};
-class ThisFunction V8_FINAL : public Expression {
+class ThisFunction FINAL : public Expression {
public:
DECLARE_NODE_TYPE(ThisFunction)
protected:
- explicit ThisFunction(Zone* zone, int pos): Expression(zone, pos) {}
+ ThisFunction(Zone* zone, int pos, IdGen* id_gen)
+ : Expression(zone, pos, id_gen) {}
};
+
+class SuperReference FINAL : public Expression {
+ public:
+ DECLARE_NODE_TYPE(SuperReference)
+
+ VariableProxy* this_var() const { return this_var_; }
+
+ TypeFeedbackId HomeObjectFeedbackId() { return reuse(id()); }
+
+ protected:
+ SuperReference(Zone* zone, VariableProxy* this_var, int pos, IdGen* id_gen)
+ : Expression(zone, pos, id_gen), this_var_(this_var) {
+ DCHECK(this_var->is_this());
+ }
+
+ VariableProxy* this_var_;
+};
+
+
#undef DECLARE_NODE_TYPE
};
-class RegExpDisjunction V8_FINAL : public RegExpTree {
+class RegExpDisjunction FINAL : public RegExpTree {
public:
explicit RegExpDisjunction(ZoneList<RegExpTree*>* alternatives);
- virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE;
+ virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE;
virtual RegExpNode* ToNode(RegExpCompiler* compiler,
- RegExpNode* on_success) V8_OVERRIDE;
- virtual RegExpDisjunction* AsDisjunction() V8_OVERRIDE;
- virtual Interval CaptureRegisters() V8_OVERRIDE;
- virtual bool IsDisjunction() V8_OVERRIDE;
- virtual bool IsAnchoredAtStart() V8_OVERRIDE;
- virtual bool IsAnchoredAtEnd() V8_OVERRIDE;
- virtual int min_match() V8_OVERRIDE { return min_match_; }
- virtual int max_match() V8_OVERRIDE { return max_match_; }
+ RegExpNode* on_success) OVERRIDE;
+ virtual RegExpDisjunction* AsDisjunction() OVERRIDE;
+ virtual Interval CaptureRegisters() OVERRIDE;
+ virtual bool IsDisjunction() OVERRIDE;
+ virtual bool IsAnchoredAtStart() OVERRIDE;
+ virtual bool IsAnchoredAtEnd() OVERRIDE;
+ virtual int min_match() OVERRIDE { return min_match_; }
+ virtual int max_match() OVERRIDE { return max_match_; }
ZoneList<RegExpTree*>* alternatives() { return alternatives_; }
private:
ZoneList<RegExpTree*>* alternatives_;
};
-class RegExpAlternative V8_FINAL : public RegExpTree {
+class RegExpAlternative FINAL : public RegExpTree {
public:
explicit RegExpAlternative(ZoneList<RegExpTree*>* nodes);
- virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE;
+ virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE;
virtual RegExpNode* ToNode(RegExpCompiler* compiler,
- RegExpNode* on_success) V8_OVERRIDE;
- virtual RegExpAlternative* AsAlternative() V8_OVERRIDE;
- virtual Interval CaptureRegisters() V8_OVERRIDE;
- virtual bool IsAlternative() V8_OVERRIDE;
- virtual bool IsAnchoredAtStart() V8_OVERRIDE;
- virtual bool IsAnchoredAtEnd() V8_OVERRIDE;
- virtual int min_match() V8_OVERRIDE { return min_match_; }
- virtual int max_match() V8_OVERRIDE { return max_match_; }
+ RegExpNode* on_success) OVERRIDE;
+ virtual RegExpAlternative* AsAlternative() OVERRIDE;
+ virtual Interval CaptureRegisters() OVERRIDE;
+ virtual bool IsAlternative() OVERRIDE;
+ virtual bool IsAnchoredAtStart() OVERRIDE;
+ virtual bool IsAnchoredAtEnd() OVERRIDE;
+ virtual int min_match() OVERRIDE { return min_match_; }
+ virtual int max_match() OVERRIDE { return max_match_; }
ZoneList<RegExpTree*>* nodes() { return nodes_; }
private:
ZoneList<RegExpTree*>* nodes_;
};
-class RegExpAssertion V8_FINAL : public RegExpTree {
+class RegExpAssertion FINAL : public RegExpTree {
public:
enum AssertionType {
START_OF_LINE,
NON_BOUNDARY
};
explicit RegExpAssertion(AssertionType type) : assertion_type_(type) { }
- virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE;
+ virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE;
virtual RegExpNode* ToNode(RegExpCompiler* compiler,
- RegExpNode* on_success) V8_OVERRIDE;
- virtual RegExpAssertion* AsAssertion() V8_OVERRIDE;
- virtual bool IsAssertion() V8_OVERRIDE;
- virtual bool IsAnchoredAtStart() V8_OVERRIDE;
- virtual bool IsAnchoredAtEnd() V8_OVERRIDE;
- virtual int min_match() V8_OVERRIDE { return 0; }
- virtual int max_match() V8_OVERRIDE { return 0; }
+ RegExpNode* on_success) OVERRIDE;
+ virtual RegExpAssertion* AsAssertion() OVERRIDE;
+ virtual bool IsAssertion() OVERRIDE;
+ virtual bool IsAnchoredAtStart() OVERRIDE;
+ virtual bool IsAnchoredAtEnd() OVERRIDE;
+ virtual int min_match() OVERRIDE { return 0; }
+ virtual int max_match() OVERRIDE { return 0; }
AssertionType assertion_type() { return assertion_type_; }
private:
AssertionType assertion_type_;
};
-class CharacterSet V8_FINAL BASE_EMBEDDED {
+class CharacterSet FINAL BASE_EMBEDDED {
public:
explicit CharacterSet(uc16 standard_set_type)
: ranges_(NULL),
};
-class RegExpCharacterClass V8_FINAL : public RegExpTree {
+class RegExpCharacterClass FINAL : public RegExpTree {
public:
RegExpCharacterClass(ZoneList<CharacterRange>* ranges, bool is_negated)
: set_(ranges),
explicit RegExpCharacterClass(uc16 type)
: set_(type),
is_negated_(false) { }
- virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE;
+ virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE;
virtual RegExpNode* ToNode(RegExpCompiler* compiler,
- RegExpNode* on_success) V8_OVERRIDE;
- virtual RegExpCharacterClass* AsCharacterClass() V8_OVERRIDE;
- virtual bool IsCharacterClass() V8_OVERRIDE;
- virtual bool IsTextElement() V8_OVERRIDE { return true; }
- virtual int min_match() V8_OVERRIDE { return 1; }
- virtual int max_match() V8_OVERRIDE { return 1; }
- virtual void AppendToText(RegExpText* text, Zone* zone) V8_OVERRIDE;
+ RegExpNode* on_success) OVERRIDE;
+ virtual RegExpCharacterClass* AsCharacterClass() OVERRIDE;
+ virtual bool IsCharacterClass() OVERRIDE;
+ virtual bool IsTextElement() OVERRIDE { return true; }
+ virtual int min_match() OVERRIDE { return 1; }
+ virtual int max_match() OVERRIDE { return 1; }
+ virtual void AppendToText(RegExpText* text, Zone* zone) OVERRIDE;
CharacterSet character_set() { return set_; }
// TODO(lrn): Remove need for complex version if is_standard that
// recognizes a mangled standard set and just do { return set_.is_special(); }
};
-class RegExpAtom V8_FINAL : public RegExpTree {
+class RegExpAtom FINAL : public RegExpTree {
public:
explicit RegExpAtom(Vector<const uc16> data) : data_(data) { }
- virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE;
+ virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE;
virtual RegExpNode* ToNode(RegExpCompiler* compiler,
- RegExpNode* on_success) V8_OVERRIDE;
- virtual RegExpAtom* AsAtom() V8_OVERRIDE;
- virtual bool IsAtom() V8_OVERRIDE;
- virtual bool IsTextElement() V8_OVERRIDE { return true; }
- virtual int min_match() V8_OVERRIDE { return data_.length(); }
- virtual int max_match() V8_OVERRIDE { return data_.length(); }
- virtual void AppendToText(RegExpText* text, Zone* zone) V8_OVERRIDE;
+ RegExpNode* on_success) OVERRIDE;
+ virtual RegExpAtom* AsAtom() OVERRIDE;
+ virtual bool IsAtom() OVERRIDE;
+ virtual bool IsTextElement() OVERRIDE { return true; }
+ virtual int min_match() OVERRIDE { return data_.length(); }
+ virtual int max_match() OVERRIDE { return data_.length(); }
+ virtual void AppendToText(RegExpText* text, Zone* zone) OVERRIDE;
Vector<const uc16> data() { return data_; }
int length() { return data_.length(); }
private:
};
-class RegExpText V8_FINAL : public RegExpTree {
+class RegExpText FINAL : public RegExpTree {
public:
explicit RegExpText(Zone* zone) : elements_(2, zone), length_(0) {}
- virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE;
+ virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE;
virtual RegExpNode* ToNode(RegExpCompiler* compiler,
- RegExpNode* on_success) V8_OVERRIDE;
- virtual RegExpText* AsText() V8_OVERRIDE;
- virtual bool IsText() V8_OVERRIDE;
- virtual bool IsTextElement() V8_OVERRIDE { return true; }
- virtual int min_match() V8_OVERRIDE { return length_; }
- virtual int max_match() V8_OVERRIDE { return length_; }
- virtual void AppendToText(RegExpText* text, Zone* zone) V8_OVERRIDE;
+ RegExpNode* on_success) OVERRIDE;
+ virtual RegExpText* AsText() OVERRIDE;
+ virtual bool IsText() OVERRIDE;
+ virtual bool IsTextElement() OVERRIDE { return true; }
+ virtual int min_match() OVERRIDE { return length_; }
+ virtual int max_match() OVERRIDE { return length_; }
+ virtual void AppendToText(RegExpText* text, Zone* zone) OVERRIDE;
void AddElement(TextElement elm, Zone* zone) {
elements_.Add(elm, zone);
length_ += elm.length();
};
-class RegExpQuantifier V8_FINAL : public RegExpTree {
+class RegExpQuantifier FINAL : public RegExpTree {
public:
enum QuantifierType { GREEDY, NON_GREEDY, POSSESSIVE };
RegExpQuantifier(int min, int max, QuantifierType type, RegExpTree* body)
max_match_ = max * body->max_match();
}
}
- virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE;
+ virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE;
virtual RegExpNode* ToNode(RegExpCompiler* compiler,
- RegExpNode* on_success) V8_OVERRIDE;
+ RegExpNode* on_success) OVERRIDE;
static RegExpNode* ToNode(int min,
int max,
bool is_greedy,
RegExpCompiler* compiler,
RegExpNode* on_success,
bool not_at_start = false);
- virtual RegExpQuantifier* AsQuantifier() V8_OVERRIDE;
- virtual Interval CaptureRegisters() V8_OVERRIDE;
- virtual bool IsQuantifier() V8_OVERRIDE;
- virtual int min_match() V8_OVERRIDE { return min_match_; }
- virtual int max_match() V8_OVERRIDE { return max_match_; }
+ virtual RegExpQuantifier* AsQuantifier() OVERRIDE;
+ virtual Interval CaptureRegisters() OVERRIDE;
+ virtual bool IsQuantifier() OVERRIDE;
+ virtual int min_match() OVERRIDE { return min_match_; }
+ virtual int max_match() OVERRIDE { return max_match_; }
int min() { return min_; }
int max() { return max_; }
bool is_possessive() { return quantifier_type_ == POSSESSIVE; }
};
-class RegExpCapture V8_FINAL : public RegExpTree {
+class RegExpCapture FINAL : public RegExpTree {
public:
explicit RegExpCapture(RegExpTree* body, int index)
: body_(body), index_(index) { }
- virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE;
+ virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE;
virtual RegExpNode* ToNode(RegExpCompiler* compiler,
- RegExpNode* on_success) V8_OVERRIDE;
+ RegExpNode* on_success) OVERRIDE;
static RegExpNode* ToNode(RegExpTree* body,
int index,
RegExpCompiler* compiler,
RegExpNode* on_success);
- virtual RegExpCapture* AsCapture() V8_OVERRIDE;
- virtual bool IsAnchoredAtStart() V8_OVERRIDE;
- virtual bool IsAnchoredAtEnd() V8_OVERRIDE;
- virtual Interval CaptureRegisters() V8_OVERRIDE;
- virtual bool IsCapture() V8_OVERRIDE;
- virtual int min_match() V8_OVERRIDE { return body_->min_match(); }
- virtual int max_match() V8_OVERRIDE { return body_->max_match(); }
+ virtual RegExpCapture* AsCapture() OVERRIDE;
+ virtual bool IsAnchoredAtStart() OVERRIDE;
+ virtual bool IsAnchoredAtEnd() OVERRIDE;
+ virtual Interval CaptureRegisters() OVERRIDE;
+ virtual bool IsCapture() OVERRIDE;
+ virtual int min_match() OVERRIDE { return body_->min_match(); }
+ virtual int max_match() OVERRIDE { return body_->max_match(); }
RegExpTree* body() { return body_; }
int index() { return index_; }
static int StartRegister(int index) { return index * 2; }
};
-class RegExpLookahead V8_FINAL : public RegExpTree {
+class RegExpLookahead FINAL : public RegExpTree {
public:
RegExpLookahead(RegExpTree* body,
bool is_positive,
capture_count_(capture_count),
capture_from_(capture_from) { }
- virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE;
+ virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE;
virtual RegExpNode* ToNode(RegExpCompiler* compiler,
- RegExpNode* on_success) V8_OVERRIDE;
- virtual RegExpLookahead* AsLookahead() V8_OVERRIDE;
- virtual Interval CaptureRegisters() V8_OVERRIDE;
- virtual bool IsLookahead() V8_OVERRIDE;
- virtual bool IsAnchoredAtStart() V8_OVERRIDE;
- virtual int min_match() V8_OVERRIDE { return 0; }
- virtual int max_match() V8_OVERRIDE { return 0; }
+ RegExpNode* on_success) OVERRIDE;
+ virtual RegExpLookahead* AsLookahead() OVERRIDE;
+ virtual Interval CaptureRegisters() OVERRIDE;
+ virtual bool IsLookahead() OVERRIDE;
+ virtual bool IsAnchoredAtStart() OVERRIDE;
+ virtual int min_match() OVERRIDE { return 0; }
+ virtual int max_match() OVERRIDE { return 0; }
RegExpTree* body() { return body_; }
bool is_positive() { return is_positive_; }
int capture_count() { return capture_count_; }
};
-class RegExpBackReference V8_FINAL : public RegExpTree {
+class RegExpBackReference FINAL : public RegExpTree {
public:
explicit RegExpBackReference(RegExpCapture* capture)
: capture_(capture) { }
- virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE;
+ virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE;
virtual RegExpNode* ToNode(RegExpCompiler* compiler,
- RegExpNode* on_success) V8_OVERRIDE;
- virtual RegExpBackReference* AsBackReference() V8_OVERRIDE;
- virtual bool IsBackReference() V8_OVERRIDE;
- virtual int min_match() V8_OVERRIDE { return 0; }
- virtual int max_match() V8_OVERRIDE { return capture_->max_match(); }
+ RegExpNode* on_success) OVERRIDE;
+ virtual RegExpBackReference* AsBackReference() OVERRIDE;
+ virtual bool IsBackReference() OVERRIDE;
+ virtual int min_match() OVERRIDE { return 0; }
+ virtual int max_match() OVERRIDE { return capture_->max_match(); }
int index() { return capture_->index(); }
RegExpCapture* capture() { return capture_; }
private:
};
-class RegExpEmpty V8_FINAL : public RegExpTree {
+class RegExpEmpty FINAL : public RegExpTree {
public:
RegExpEmpty() { }
- virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE;
+ virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE;
virtual RegExpNode* ToNode(RegExpCompiler* compiler,
- RegExpNode* on_success) V8_OVERRIDE;
- virtual RegExpEmpty* AsEmpty() V8_OVERRIDE;
- virtual bool IsEmpty() V8_OVERRIDE;
- virtual int min_match() V8_OVERRIDE { return 0; }
- virtual int max_match() V8_OVERRIDE { return 0; }
+ RegExpNode* on_success) OVERRIDE;
+ virtual RegExpEmpty* AsEmpty() OVERRIDE;
+ virtual bool IsEmpty() OVERRIDE;
+ virtual int min_match() OVERRIDE { return 0; }
+ virtual int max_match() OVERRIDE { return 0; }
static RegExpEmpty* GetInstance() {
static RegExpEmpty* instance = ::new RegExpEmpty();
return instance;
#define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS() \
public: \
- virtual void Visit(AstNode* node) V8_FINAL V8_OVERRIDE { \
+ virtual void Visit(AstNode* node) FINAL OVERRIDE { \
if (!CheckStackOverflow()) node->Accept(this); \
} \
\
class AstConstructionVisitor BASE_EMBEDDED {
public:
- AstConstructionVisitor() : dont_optimize_reason_(kNoReason) { }
+ AstConstructionVisitor()
+ : dont_crankshaft_reason_(kNoReason), dont_turbofan_reason_(kNoReason) {}
AstProperties* ast_properties() { return &properties_; }
- BailoutReason dont_optimize_reason() { return dont_optimize_reason_; }
+ BailoutReason dont_optimize_reason() {
+ if (dont_turbofan_reason_ != kNoReason) {
+ return dont_turbofan_reason_;
+ } else {
+ return dont_crankshaft_reason_;
+ }
+ }
private:
template<class> friend class AstNodeFactory;
void increase_node_count() { properties_.add_node_count(1); }
void add_flag(AstPropertiesFlag flag) { properties_.flags()->Add(flag); }
- void set_dont_optimize_reason(BailoutReason reason) {
- dont_optimize_reason_ = reason;
+ void set_dont_crankshaft_reason(BailoutReason reason) {
+ dont_crankshaft_reason_ = reason;
+ }
+ void set_dont_turbofan_reason(BailoutReason reason) {
+ dont_turbofan_reason_ = reason;
}
void add_slot_node(FeedbackSlotInterface* slot_node) {
}
AstProperties properties_;
- BailoutReason dont_optimize_reason_;
+ BailoutReason dont_crankshaft_reason_;
+ BailoutReason dont_turbofan_reason_;
};
// AstNode factory
template<class Visitor>
-class AstNodeFactory V8_FINAL BASE_EMBEDDED {
+class AstNodeFactory FINAL BASE_EMBEDDED {
public:
- explicit AstNodeFactory(Zone* zone, AstValueFactory* ast_value_factory)
- : zone_(zone), ast_value_factory_(ast_value_factory) {}
+ AstNodeFactory(Zone* zone, AstValueFactory* ast_value_factory,
+ AstNode::IdGen* id_gen)
+ : zone_(zone), ast_value_factory_(ast_value_factory), id_gen_(id_gen) {}
Visitor* visitor() { return &visitor_; }
int capacity,
bool is_initializer_block,
int pos) {
- Block* block = new(zone_) Block(
- zone_, labels, capacity, is_initializer_block, pos);
+ Block* block = new (zone_)
+ Block(zone_, labels, capacity, is_initializer_block, pos, id_gen_);
VISIT_AND_RETURN(Block, block)
}
-#define STATEMENT_WITH_LABELS(NodeType) \
+#define STATEMENT_WITH_LABELS(NodeType) \
NodeType* New##NodeType(ZoneList<const AstRawString*>* labels, int pos) { \
- NodeType* stmt = new(zone_) NodeType(zone_, labels, pos); \
- VISIT_AND_RETURN(NodeType, stmt); \
+ NodeType* stmt = new (zone_) NodeType(zone_, labels, pos, id_gen_); \
+ VISIT_AND_RETURN(NodeType, stmt); \
}
STATEMENT_WITH_LABELS(DoWhileStatement)
STATEMENT_WITH_LABELS(WhileStatement)
int pos) {
switch (visit_mode) {
case ForEachStatement::ENUMERATE: {
- ForInStatement* stmt = new(zone_) ForInStatement(zone_, labels, pos);
+ ForInStatement* stmt =
+ new (zone_) ForInStatement(zone_, labels, pos, id_gen_);
VISIT_AND_RETURN(ForInStatement, stmt);
}
case ForEachStatement::ITERATE: {
- ForOfStatement* stmt = new(zone_) ForOfStatement(zone_, labels, pos);
+ ForOfStatement* stmt =
+ new (zone_) ForOfStatement(zone_, labels, pos, id_gen_);
VISIT_AND_RETURN(ForOfStatement, stmt);
}
}
Statement* then_statement,
Statement* else_statement,
int pos) {
- IfStatement* stmt = new(zone_) IfStatement(
- zone_, condition, then_statement, else_statement, pos);
+ IfStatement* stmt = new (zone_) IfStatement(
+ zone_, condition, then_statement, else_statement, pos, id_gen_);
VISIT_AND_RETURN(IfStatement, stmt)
}
}
DebuggerStatement* NewDebuggerStatement(int pos) {
- DebuggerStatement* stmt = new(zone_) DebuggerStatement(zone_, pos);
+ DebuggerStatement* stmt =
+ new (zone_) DebuggerStatement(zone_, pos, id_gen_);
VISIT_AND_RETURN(DebuggerStatement, stmt)
}
CaseClause* NewCaseClause(
Expression* label, ZoneList<Statement*>* statements, int pos) {
CaseClause* clause =
- new(zone_) CaseClause(zone_, label, statements, pos);
+ new (zone_) CaseClause(zone_, label, statements, pos, id_gen_);
VISIT_AND_RETURN(CaseClause, clause)
}
Literal* NewStringLiteral(const AstRawString* string, int pos) {
- Literal* lit =
- new (zone_) Literal(zone_, ast_value_factory_->NewString(string), pos);
+ Literal* lit = new (zone_)
+ Literal(zone_, ast_value_factory_->NewString(string), pos, id_gen_);
VISIT_AND_RETURN(Literal, lit)
}
// A JavaScript symbol (ECMA-262 edition 6).
Literal* NewSymbolLiteral(const char* name, int pos) {
- Literal* lit =
- new (zone_) Literal(zone_, ast_value_factory_->NewSymbol(name), pos);
+ Literal* lit = new (zone_)
+ Literal(zone_, ast_value_factory_->NewSymbol(name), pos, id_gen_);
VISIT_AND_RETURN(Literal, lit)
}
Literal* NewNumberLiteral(double number, int pos) {
Literal* lit = new (zone_)
- Literal(zone_, ast_value_factory_->NewNumber(number), pos);
+ Literal(zone_, ast_value_factory_->NewNumber(number), pos, id_gen_);
VISIT_AND_RETURN(Literal, lit)
}
Literal* NewSmiLiteral(int number, int pos) {
- Literal* lit =
- new (zone_) Literal(zone_, ast_value_factory_->NewSmi(number), pos);
+ Literal* lit = new (zone_)
+ Literal(zone_, ast_value_factory_->NewSmi(number), pos, id_gen_);
VISIT_AND_RETURN(Literal, lit)
}
Literal* NewBooleanLiteral(bool b, int pos) {
- Literal* lit =
- new (zone_) Literal(zone_, ast_value_factory_->NewBoolean(b), pos);
+ Literal* lit = new (zone_)
+ Literal(zone_, ast_value_factory_->NewBoolean(b), pos, id_gen_);
VISIT_AND_RETURN(Literal, lit)
}
Literal* NewStringListLiteral(ZoneList<const AstRawString*>* strings,
int pos) {
- Literal* lit = new (zone_)
- Literal(zone_, ast_value_factory_->NewStringList(strings), pos);
+ Literal* lit = new (zone_) Literal(
+ zone_, ast_value_factory_->NewStringList(strings), pos, id_gen_);
VISIT_AND_RETURN(Literal, lit)
}
Literal* NewNullLiteral(int pos) {
Literal* lit =
- new (zone_) Literal(zone_, ast_value_factory_->NewNull(), pos);
+ new (zone_) Literal(zone_, ast_value_factory_->NewNull(), pos, id_gen_);
VISIT_AND_RETURN(Literal, lit)
}
Literal* NewUndefinedLiteral(int pos) {
- Literal* lit =
- new (zone_) Literal(zone_, ast_value_factory_->NewUndefined(), pos);
+ Literal* lit = new (zone_)
+ Literal(zone_, ast_value_factory_->NewUndefined(), pos, id_gen_);
VISIT_AND_RETURN(Literal, lit)
}
Literal* NewTheHoleLiteral(int pos) {
- Literal* lit =
- new (zone_) Literal(zone_, ast_value_factory_->NewTheHole(), pos);
+ Literal* lit = new (zone_)
+ Literal(zone_, ast_value_factory_->NewTheHole(), pos, id_gen_);
VISIT_AND_RETURN(Literal, lit)
}
int boilerplate_properties,
bool has_function,
int pos) {
- ObjectLiteral* lit = new(zone_) ObjectLiteral(
- zone_, properties, literal_index, boilerplate_properties,
- has_function, pos);
+ ObjectLiteral* lit = new (zone_)
+ ObjectLiteral(zone_, properties, literal_index, boilerplate_properties,
+ has_function, pos, id_gen_);
VISIT_AND_RETURN(ObjectLiteral, lit)
}
ObjectLiteral::Property* NewObjectLiteralProperty(Literal* key,
- Expression* value) {
- return new (zone_)
- ObjectLiteral::Property(zone_, ast_value_factory_, key, value);
+ Expression* value,
+ bool is_static) {
+ return new (zone_) ObjectLiteral::Property(zone_, ast_value_factory_, key,
+ value, is_static);
}
ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter,
FunctionLiteral* value,
- int pos) {
+ int pos, bool is_static) {
ObjectLiteral::Property* prop =
- new(zone_) ObjectLiteral::Property(zone_, is_getter, value);
+ new (zone_) ObjectLiteral::Property(zone_, is_getter, value, is_static);
prop->set_key(NewStringLiteral(value->raw_name(), pos));
return prop; // Not an AST node, will not be visited.
}
const AstRawString* flags,
int literal_index,
int pos) {
- RegExpLiteral* lit =
- new(zone_) RegExpLiteral(zone_, pattern, flags, literal_index, pos);
+ RegExpLiteral* lit = new (zone_)
+ RegExpLiteral(zone_, pattern, flags, literal_index, pos, id_gen_);
VISIT_AND_RETURN(RegExpLiteral, lit);
}
ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values,
int literal_index,
int pos) {
- ArrayLiteral* lit = new(zone_) ArrayLiteral(
- zone_, values, literal_index, pos);
+ ArrayLiteral* lit =
+ new (zone_) ArrayLiteral(zone_, values, literal_index, pos, id_gen_);
VISIT_AND_RETURN(ArrayLiteral, lit)
}
VariableProxy* NewVariableProxy(Variable* var,
int pos = RelocInfo::kNoPosition) {
- VariableProxy* proxy = new(zone_) VariableProxy(zone_, var, pos);
+ VariableProxy* proxy = new (zone_) VariableProxy(zone_, var, pos, id_gen_);
VISIT_AND_RETURN(VariableProxy, proxy)
}
bool is_this,
Interface* interface = Interface::NewValue(),
int position = RelocInfo::kNoPosition) {
- VariableProxy* proxy =
- new(zone_) VariableProxy(zone_, name, is_this, interface, position);
+ VariableProxy* proxy = new (zone_)
+ VariableProxy(zone_, name, is_this, interface, position, id_gen_);
VISIT_AND_RETURN(VariableProxy, proxy)
}
Property* NewProperty(Expression* obj, Expression* key, int pos) {
- Property* prop = new(zone_) Property(zone_, obj, key, pos);
+ Property* prop = new (zone_) Property(zone_, obj, key, pos, id_gen_);
VISIT_AND_RETURN(Property, prop)
}
Call* NewCall(Expression* expression,
ZoneList<Expression*>* arguments,
int pos) {
- Call* call = new(zone_) Call(zone_, expression, arguments, pos);
+ Call* call = new (zone_) Call(zone_, expression, arguments, pos, id_gen_);
VISIT_AND_RETURN(Call, call)
}
CallNew* NewCallNew(Expression* expression,
ZoneList<Expression*>* arguments,
int pos) {
- CallNew* call = new(zone_) CallNew(zone_, expression, arguments, pos);
+ CallNew* call =
+ new (zone_) CallNew(zone_, expression, arguments, pos, id_gen_);
VISIT_AND_RETURN(CallNew, call)
}
ZoneList<Expression*>* arguments,
int pos) {
CallRuntime* call =
- new(zone_) CallRuntime(zone_, name, function, arguments, pos);
+ new (zone_) CallRuntime(zone_, name, function, arguments, pos, id_gen_);
VISIT_AND_RETURN(CallRuntime, call)
}
Expression* expression,
int pos) {
UnaryOperation* node =
- new(zone_) UnaryOperation(zone_, op, expression, pos);
+ new (zone_) UnaryOperation(zone_, op, expression, pos, id_gen_);
VISIT_AND_RETURN(UnaryOperation, node)
}
Expression* right,
int pos) {
BinaryOperation* node =
- new(zone_) BinaryOperation(zone_, op, left, right, pos);
+ new (zone_) BinaryOperation(zone_, op, left, right, pos, id_gen_);
VISIT_AND_RETURN(BinaryOperation, node)
}
Expression* expr,
int pos) {
CountOperation* node =
- new(zone_) CountOperation(zone_, op, is_prefix, expr, pos);
+ new (zone_) CountOperation(zone_, op, is_prefix, expr, pos, id_gen_);
VISIT_AND_RETURN(CountOperation, node)
}
Expression* right,
int pos) {
CompareOperation* node =
- new(zone_) CompareOperation(zone_, op, left, right, pos);
+ new (zone_) CompareOperation(zone_, op, left, right, pos, id_gen_);
VISIT_AND_RETURN(CompareOperation, node)
}
Expression* then_expression,
Expression* else_expression,
int position) {
- Conditional* cond = new(zone_) Conditional(
- zone_, condition, then_expression, else_expression, position);
+ Conditional* cond = new (zone_) Conditional(
+ zone_, condition, then_expression, else_expression, position, id_gen_);
VISIT_AND_RETURN(Conditional, cond)
}
Expression* value,
int pos) {
Assignment* assign =
- new(zone_) Assignment(zone_, op, target, value, pos);
+ new (zone_) Assignment(zone_, op, target, value, pos, id_gen_);
assign->Init(zone_, this);
VISIT_AND_RETURN(Assignment, assign)
}
Yield::Kind yield_kind,
int pos) {
if (!expression) expression = NewUndefinedLiteral(pos);
- Yield* yield = new(zone_) Yield(
- zone_, generator_object, expression, yield_kind, pos);
+ Yield* yield = new (zone_)
+ Yield(zone_, generator_object, expression, yield_kind, pos, id_gen_);
VISIT_AND_RETURN(Yield, yield)
}
Throw* NewThrow(Expression* exception, int pos) {
- Throw* t = new(zone_) Throw(zone_, exception, pos);
+ Throw* t = new (zone_) Throw(zone_, exception, pos, id_gen_);
VISIT_AND_RETURN(Throw, t)
}
FunctionLiteral::ParameterFlag has_duplicate_parameters,
FunctionLiteral::FunctionType function_type,
FunctionLiteral::IsFunctionFlag is_function,
- FunctionLiteral::IsParenthesizedFlag is_parenthesized,
- FunctionLiteral::KindFlag kind, int position) {
+ FunctionLiteral::IsParenthesizedFlag is_parenthesized, FunctionKind kind,
+ int position) {
FunctionLiteral* lit = new (zone_) FunctionLiteral(
zone_, name, ast_value_factory, scope, body, materialized_literal_count,
expected_property_count, handler_count, parameter_count, function_type,
- has_duplicate_parameters, is_function, is_parenthesized, kind,
- position);
+ has_duplicate_parameters, is_function, is_parenthesized, kind, position,
+ id_gen_);
// Top-level literal doesn't count for the AST's properties.
if (is_function == FunctionLiteral::kIsFunction) {
visitor_.VisitFunctionLiteral(lit);
return lit;
}
- NativeFunctionLiteral* NewNativeFunctionLiteral(
- const AstRawString* name, v8::Extension* extension,
- int pos) {
+ ClassLiteral* NewClassLiteral(const AstRawString* name, Expression* extends,
+ Expression* constructor,
+ ZoneList<ObjectLiteral::Property*>* properties,
+ int position) {
+ ClassLiteral* lit = new (zone_) ClassLiteral(
+ zone_, name, extends, constructor, properties, position, id_gen_);
+ VISIT_AND_RETURN(ClassLiteral, lit)
+ }
+
+ NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name,
+ v8::Extension* extension,
+ int pos) {
NativeFunctionLiteral* lit =
- new(zone_) NativeFunctionLiteral(zone_, name, extension, pos);
+ new (zone_) NativeFunctionLiteral(zone_, name, extension, pos, id_gen_);
VISIT_AND_RETURN(NativeFunctionLiteral, lit)
}
ThisFunction* NewThisFunction(int pos) {
- ThisFunction* fun = new(zone_) ThisFunction(zone_, pos);
+ ThisFunction* fun = new (zone_) ThisFunction(zone_, pos, id_gen_);
VISIT_AND_RETURN(ThisFunction, fun)
}
+ SuperReference* NewSuperReference(VariableProxy* this_var, int pos) {
+ SuperReference* super =
+ new (zone_) SuperReference(zone_, this_var, pos, id_gen_);
+ VISIT_AND_RETURN(SuperReference, super);
+ }
+
#undef VISIT_AND_RETURN
private:
Zone* zone_;
Visitor visitor_;
AstValueFactory* ast_value_factory_;
+ AstNode::IdGen* id_gen_;
};