| Index: src/ast.h
|
| diff --git a/src/ast.h b/src/ast.h
|
| index 7432b0b9e6cfaabc385b918f8f8637af0912c6bc..b4f7348eee314eaac011db31d3b238b877d7ef82 100644
|
| --- a/src/ast.h
|
| +++ b/src/ast.h
|
| @@ -117,11 +117,15 @@ namespace internal {
|
| V(CompareOperation) \
|
| V(ThisFunction)
|
|
|
| +#define AUXILIARY_NODE_LIST(V) \
|
| + V(CaseClause)
|
| +
|
| #define AST_NODE_LIST(V) \
|
| DECLARATION_NODE_LIST(V) \
|
| MODULE_NODE_LIST(V) \
|
| STATEMENT_NODE_LIST(V) \
|
| - EXPRESSION_NODE_LIST(V)
|
| + EXPRESSION_NODE_LIST(V) \
|
| + AUXILIARY_NODE_LIST(V)
|
|
|
| // Forward declarations
|
| class AstConstructionVisitor;
|
| @@ -206,12 +210,12 @@ class AstNode: public ZoneObject {
|
| return zone->New(static_cast<int>(size));
|
| }
|
|
|
| - AstNode() {}
|
| -
|
| + explicit AstNode(int position): position_(position) {}
|
| virtual ~AstNode() {}
|
|
|
| virtual void Accept(AstVisitor* v) = 0;
|
| virtual NodeType node_type() const = 0;
|
| + int position() const { return position_; }
|
|
|
| // Type testing & conversion functions overridden by concrete subclasses.
|
| #define DECLARE_NODE_FUNCTIONS(type) \
|
| @@ -248,21 +252,17 @@ class AstNode: public ZoneObject {
|
| void* operator new(size_t size);
|
|
|
| friend class CaseClause; // Generates AST IDs.
|
| +
|
| + int position_;
|
| };
|
|
|
|
|
| class Statement : public AstNode {
|
| public:
|
| - Statement() : statement_pos_(RelocInfo::kNoPosition) {}
|
| + explicit Statement(int position) : AstNode(position) {}
|
|
|
| bool IsEmpty() { return AsEmptyStatement() != NULL; }
|
| virtual bool IsJump() const { return false; }
|
| -
|
| - void set_statement_pos(int statement_pos) { statement_pos_ = statement_pos; }
|
| - int statement_pos() const { return statement_pos_; }
|
| -
|
| - private:
|
| - int statement_pos_;
|
| };
|
|
|
|
|
| @@ -329,11 +329,6 @@ class Expression : public AstNode {
|
| kTest
|
| };
|
|
|
| - virtual int position() const {
|
| - UNREACHABLE();
|
| - return 0;
|
| - }
|
| -
|
| virtual bool IsValidLeftHandSide() { return false; }
|
|
|
| // Helpers for ToBoolean conversion.
|
| @@ -387,8 +382,9 @@ class Expression : public AstNode {
|
| TypeFeedbackId test_id() const { return test_id_; }
|
|
|
| protected:
|
| - explicit Expression(Isolate* isolate)
|
| - : bounds_(Bounds::Unbounded(isolate)),
|
| + Expression(Isolate* isolate, int pos)
|
| + : AstNode(pos),
|
| + bounds_(Bounds::Unbounded(isolate)),
|
| id_(GetNextId(isolate)),
|
| test_id_(GetNextId(isolate)) {}
|
| void set_to_boolean_types(byte types) { to_boolean_types_ = types; }
|
| @@ -431,8 +427,10 @@ class BreakableStatement : public Statement {
|
|
|
| protected:
|
| BreakableStatement(
|
| - Isolate* isolate, ZoneStringList* labels, BreakableType breakable_type)
|
| - : labels_(labels),
|
| + Isolate* isolate, ZoneStringList* labels,
|
| + BreakableType breakable_type, int position)
|
| + : Statement(position),
|
| + labels_(labels),
|
| breakable_type_(breakable_type),
|
| entry_id_(GetNextId(isolate)),
|
| exit_id_(GetNextId(isolate)) {
|
| @@ -473,8 +471,9 @@ class Block V8_FINAL : public BreakableStatement {
|
| ZoneStringList* labels,
|
| int capacity,
|
| bool is_initializer_block,
|
| + int pos,
|
| Zone* zone)
|
| - : BreakableStatement(isolate, labels, TARGET_FOR_NAMED_ONLY),
|
| + : BreakableStatement(isolate, labels, TARGET_FOR_NAMED_ONLY, pos),
|
| statements_(capacity, zone),
|
| is_initializer_block_(is_initializer_block),
|
| scope_(NULL) {
|
| @@ -498,8 +497,10 @@ class Declaration : public AstNode {
|
| protected:
|
| Declaration(VariableProxy* proxy,
|
| VariableMode mode,
|
| - Scope* scope)
|
| - : proxy_(proxy),
|
| + Scope* scope,
|
| + int pos)
|
| + : AstNode(pos),
|
| + proxy_(proxy),
|
| mode_(mode),
|
| scope_(scope) {
|
| ASSERT(IsDeclaredVariableMode(mode));
|
| @@ -525,8 +526,9 @@ class VariableDeclaration V8_FINAL : public Declaration {
|
| protected:
|
| VariableDeclaration(VariableProxy* proxy,
|
| VariableMode mode,
|
| - Scope* scope)
|
| - : Declaration(proxy, mode, scope) {
|
| + Scope* scope,
|
| + int pos)
|
| + : Declaration(proxy, mode, scope, pos) {
|
| }
|
| };
|
|
|
| @@ -545,8 +547,9 @@ class FunctionDeclaration V8_FINAL : public Declaration {
|
| FunctionDeclaration(VariableProxy* proxy,
|
| VariableMode mode,
|
| FunctionLiteral* fun,
|
| - Scope* scope)
|
| - : Declaration(proxy, mode, scope),
|
| + Scope* scope,
|
| + int pos)
|
| + : Declaration(proxy, mode, scope, pos),
|
| fun_(fun) {
|
| // At the moment there are no "const functions" in JavaScript...
|
| ASSERT(mode == VAR || mode == LET);
|
| @@ -570,8 +573,9 @@ class ModuleDeclaration V8_FINAL : public Declaration {
|
| protected:
|
| ModuleDeclaration(VariableProxy* proxy,
|
| Module* module,
|
| - Scope* scope)
|
| - : Declaration(proxy, MODULE, scope),
|
| + Scope* scope,
|
| + int pos)
|
| + : Declaration(proxy, MODULE, scope, pos),
|
| module_(module) {
|
| }
|
|
|
| @@ -592,8 +596,9 @@ class ImportDeclaration V8_FINAL : public Declaration {
|
| protected:
|
| ImportDeclaration(VariableProxy* proxy,
|
| Module* module,
|
| - Scope* scope)
|
| - : Declaration(proxy, LET, scope),
|
| + Scope* scope,
|
| + int pos)
|
| + : Declaration(proxy, LET, scope, pos),
|
| module_(module) {
|
| }
|
|
|
| @@ -611,8 +616,8 @@ class ExportDeclaration V8_FINAL : public Declaration {
|
| }
|
|
|
| protected:
|
| - ExportDeclaration(VariableProxy* proxy, Scope* scope)
|
| - : Declaration(proxy, LET, scope) {}
|
| + ExportDeclaration(VariableProxy* proxy, Scope* scope, int pos)
|
| + : Declaration(proxy, LET, scope, pos) {}
|
| };
|
|
|
|
|
| @@ -622,11 +627,13 @@ class Module : public AstNode {
|
| Block* body() const { return body_; }
|
|
|
| protected:
|
| - explicit Module(Zone* zone)
|
| - : interface_(Interface::NewModule(zone)),
|
| + Module(Zone* zone, int pos)
|
| + : AstNode(pos),
|
| + interface_(Interface::NewModule(zone)),
|
| body_(NULL) {}
|
| - explicit Module(Interface* interface, Block* body = NULL)
|
| - : interface_(interface),
|
| + Module(Interface* interface, int pos, Block* body = NULL)
|
| + : AstNode(pos),
|
| + interface_(interface),
|
| body_(body) {}
|
|
|
| private:
|
| @@ -640,7 +647,8 @@ class ModuleLiteral V8_FINAL : public Module {
|
| DECLARE_NODE_TYPE(ModuleLiteral)
|
|
|
| protected:
|
| - ModuleLiteral(Block* body, Interface* interface) : Module(interface, body) {}
|
| + ModuleLiteral(Block* body, Interface* interface, int pos)
|
| + : Module(interface, pos, body) {}
|
| };
|
|
|
|
|
| @@ -651,7 +659,7 @@ class ModuleVariable V8_FINAL : public Module {
|
| VariableProxy* proxy() const { return proxy_; }
|
|
|
| protected:
|
| - inline explicit ModuleVariable(VariableProxy* proxy);
|
| + inline ModuleVariable(VariableProxy* proxy, int pos);
|
|
|
| private:
|
| VariableProxy* proxy_;
|
| @@ -666,8 +674,8 @@ class ModulePath V8_FINAL : public Module {
|
| Handle<String> name() const { return name_; }
|
|
|
| protected:
|
| - ModulePath(Module* module, Handle<String> name, Zone* zone)
|
| - : Module(zone),
|
| + ModulePath(Module* module, Handle<String> name, Zone* zone, int pos)
|
| + : Module(zone, pos),
|
| module_(module),
|
| name_(name) {
|
| }
|
| @@ -685,8 +693,8 @@ class ModuleUrl V8_FINAL : public Module {
|
| Handle<String> url() const { return url_; }
|
|
|
| protected:
|
| - ModuleUrl(Handle<String> url, Zone* zone)
|
| - : Module(zone), url_(url) {
|
| + ModuleUrl(Handle<String> url, Zone* zone, int pos)
|
| + : Module(zone, pos), url_(url) {
|
| }
|
|
|
| private:
|
| @@ -702,8 +710,9 @@ class ModuleStatement V8_FINAL : public Statement {
|
| Block* body() const { return body_; }
|
|
|
| protected:
|
| - ModuleStatement(VariableProxy* proxy, Block* body)
|
| - : proxy_(proxy),
|
| + ModuleStatement(VariableProxy* proxy, Block* body, int pos)
|
| + : Statement(pos),
|
| + proxy_(proxy),
|
| body_(body) {
|
| }
|
|
|
| @@ -730,8 +739,8 @@ class IterationStatement : public BreakableStatement {
|
| Label* continue_target() { return &continue_target_; }
|
|
|
| protected:
|
| - IterationStatement(Isolate* isolate, ZoneStringList* labels)
|
| - : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS),
|
| + IterationStatement(Isolate* isolate, ZoneStringList* labels, int pos)
|
| + : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS, pos),
|
| body_(NULL),
|
| osr_entry_id_(GetNextId(isolate)) {
|
| }
|
| @@ -759,20 +768,14 @@ class DoWhileStatement V8_FINAL : public IterationStatement {
|
|
|
| Expression* cond() const { return cond_; }
|
|
|
| - // Position where condition expression starts. We need it to make
|
| - // the loop's condition a breakable location.
|
| - int condition_position() { return condition_position_; }
|
| - void set_condition_position(int pos) { condition_position_ = pos; }
|
| -
|
| virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; }
|
| virtual BailoutId StackCheckId() const V8_OVERRIDE { return back_edge_id_; }
|
| BailoutId BackEdgeId() const { return back_edge_id_; }
|
|
|
| protected:
|
| - DoWhileStatement(Isolate* isolate, ZoneStringList* labels)
|
| - : IterationStatement(isolate, labels),
|
| + DoWhileStatement(Isolate* isolate, ZoneStringList* labels, int pos)
|
| + : IterationStatement(isolate, labels, pos),
|
| cond_(NULL),
|
| - condition_position_(-1),
|
| continue_id_(GetNextId(isolate)),
|
| back_edge_id_(GetNextId(isolate)) {
|
| }
|
| @@ -780,8 +783,6 @@ class DoWhileStatement V8_FINAL : public IterationStatement {
|
| private:
|
| Expression* cond_;
|
|
|
| - int condition_position_;
|
| -
|
| const BailoutId continue_id_;
|
| const BailoutId back_edge_id_;
|
| };
|
| @@ -809,8 +810,8 @@ class WhileStatement V8_FINAL : public IterationStatement {
|
| BailoutId BodyId() const { return body_id_; }
|
|
|
| protected:
|
| - WhileStatement(Isolate* isolate, ZoneStringList* labels)
|
| - : IterationStatement(isolate, labels),
|
| + WhileStatement(Isolate* isolate, ZoneStringList* labels, int pos)
|
| + : IterationStatement(isolate, labels, pos),
|
| cond_(NULL),
|
| may_have_function_literal_(true),
|
| body_id_(GetNextId(isolate)) {
|
| @@ -860,8 +861,8 @@ class ForStatement V8_FINAL : public IterationStatement {
|
| void set_loop_variable(Variable* var) { loop_variable_ = var; }
|
|
|
| protected:
|
| - ForStatement(Isolate* isolate, ZoneStringList* labels)
|
| - : IterationStatement(isolate, labels),
|
| + ForStatement(Isolate* isolate, ZoneStringList* labels, int pos)
|
| + : IterationStatement(isolate, labels, pos),
|
| init_(NULL),
|
| cond_(NULL),
|
| next_(NULL),
|
| @@ -902,8 +903,8 @@ class ForEachStatement : public IterationStatement {
|
| Expression* subject() const { return subject_; }
|
|
|
| protected:
|
| - ForEachStatement(Isolate* isolate, ZoneStringList* labels)
|
| - : IterationStatement(isolate, labels),
|
| + ForEachStatement(Isolate* isolate, ZoneStringList* labels, int pos)
|
| + : IterationStatement(isolate, labels, pos),
|
| each_(NULL),
|
| subject_(NULL) {
|
| }
|
| @@ -933,8 +934,8 @@ class ForInStatement V8_FINAL : public ForEachStatement {
|
| virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; }
|
|
|
| protected:
|
| - ForInStatement(Isolate* isolate, ZoneStringList* labels)
|
| - : ForEachStatement(isolate, labels),
|
| + ForInStatement(Isolate* isolate, ZoneStringList* labels, int pos)
|
| + : ForEachStatement(isolate, labels, pos),
|
| for_in_type_(SLOW_FOR_IN),
|
| body_id_(GetNextId(isolate)),
|
| prepare_id_(GetNextId(isolate)) {
|
| @@ -994,8 +995,8 @@ class ForOfStatement V8_FINAL : public ForEachStatement {
|
| BailoutId BackEdgeId() const { return back_edge_id_; }
|
|
|
| protected:
|
| - ForOfStatement(Isolate* isolate, ZoneStringList* labels)
|
| - : ForEachStatement(isolate, labels),
|
| + ForOfStatement(Isolate* isolate, ZoneStringList* labels, int pos)
|
| + : ForEachStatement(isolate, labels, pos),
|
| assign_iterator_(NULL),
|
| next_result_(NULL),
|
| result_done_(NULL),
|
| @@ -1020,8 +1021,8 @@ class ExpressionStatement V8_FINAL : public Statement {
|
| virtual bool IsJump() const V8_OVERRIDE { return expression_->IsThrow(); }
|
|
|
| protected:
|
| - explicit ExpressionStatement(Expression* expression)
|
| - : expression_(expression) { }
|
| + ExpressionStatement(Expression* expression, int pos)
|
| + : Statement(pos), expression_(expression) { }
|
|
|
| private:
|
| Expression* expression_;
|
| @@ -1033,7 +1034,7 @@ class JumpStatement : public Statement {
|
| virtual bool IsJump() const V8_FINAL V8_OVERRIDE { return true; }
|
|
|
| protected:
|
| - JumpStatement() {}
|
| + explicit JumpStatement(int pos) : Statement(pos) {}
|
| };
|
|
|
|
|
| @@ -1044,8 +1045,8 @@ class ContinueStatement V8_FINAL : public JumpStatement {
|
| IterationStatement* target() const { return target_; }
|
|
|
| protected:
|
| - explicit ContinueStatement(IterationStatement* target)
|
| - : target_(target) { }
|
| + explicit ContinueStatement(IterationStatement* target, int pos)
|
| + : JumpStatement(pos), target_(target) { }
|
|
|
| private:
|
| IterationStatement* target_;
|
| @@ -1059,8 +1060,8 @@ class BreakStatement V8_FINAL : public JumpStatement {
|
| BreakableStatement* target() const { return target_; }
|
|
|
| protected:
|
| - explicit BreakStatement(BreakableStatement* target)
|
| - : target_(target) { }
|
| + explicit BreakStatement(BreakableStatement* target, int pos)
|
| + : JumpStatement(pos), target_(target) { }
|
|
|
| private:
|
| BreakableStatement* target_;
|
| @@ -1074,8 +1075,8 @@ class ReturnStatement V8_FINAL : public JumpStatement {
|
| Expression* expression() const { return expression_; }
|
|
|
| protected:
|
| - explicit ReturnStatement(Expression* expression)
|
| - : expression_(expression) { }
|
| + explicit ReturnStatement(Expression* expression, int pos)
|
| + : JumpStatement(pos), expression_(expression) { }
|
|
|
| private:
|
| Expression* expression_;
|
| @@ -1091,8 +1092,10 @@ class WithStatement V8_FINAL : public Statement {
|
| Statement* statement() const { return statement_; }
|
|
|
| protected:
|
| - WithStatement(Scope* scope, Expression* expression, Statement* statement)
|
| - : scope_(scope),
|
| + WithStatement(
|
| + Scope* scope, Expression* expression, Statement* statement, int pos)
|
| + : Statement(pos),
|
| + scope_(scope),
|
| expression_(expression),
|
| statement_(statement) { }
|
|
|
| @@ -1103,12 +1106,9 @@ class WithStatement V8_FINAL : public Statement {
|
| };
|
|
|
|
|
| -class CaseClause V8_FINAL : public ZoneObject {
|
| +class CaseClause V8_FINAL : public AstNode {
|
| public:
|
| - CaseClause(Isolate* isolate,
|
| - Expression* label,
|
| - ZoneList<Statement*>* statements,
|
| - int pos);
|
| + DECLARE_NODE_TYPE(CaseClause)
|
|
|
| bool is_default() const { return label_ == NULL; }
|
| Expression* label() const {
|
| @@ -1118,9 +1118,6 @@ class CaseClause V8_FINAL : public ZoneObject {
|
| Label* body_target() { return &body_target_; }
|
| ZoneList<Statement*>* statements() const { return statements_; }
|
|
|
| - int position() const { return position_; }
|
| - void set_position(int pos) { position_ = pos; }
|
| -
|
| BailoutId EntryId() const { return entry_id_; }
|
|
|
| // Type feedback information.
|
| @@ -1129,10 +1126,14 @@ class CaseClause V8_FINAL : public ZoneObject {
|
| Handle<Type> compare_type() { return compare_type_; }
|
|
|
| private:
|
| + CaseClause(Isolate* isolate,
|
| + Expression* label,
|
| + ZoneList<Statement*>* statements,
|
| + int pos);
|
| +
|
| Expression* label_;
|
| Label body_target_;
|
| ZoneList<Statement*>* statements_;
|
| - int position_;
|
| Handle<Type> compare_type_;
|
|
|
| const TypeFeedbackId compare_id_;
|
| @@ -1158,8 +1159,8 @@ class SwitchStatement V8_FINAL : public BreakableStatement {
|
| void set_switch_type(SwitchType switch_type) { switch_type_ = switch_type; }
|
|
|
| protected:
|
| - SwitchStatement(Isolate* isolate, ZoneStringList* labels)
|
| - : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS),
|
| + SwitchStatement(Isolate* isolate, ZoneStringList* labels, int pos)
|
| + : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS, pos),
|
| tag_(NULL),
|
| cases_(NULL) { }
|
|
|
| @@ -1199,8 +1200,10 @@ class IfStatement V8_FINAL : public Statement {
|
| IfStatement(Isolate* isolate,
|
| Expression* condition,
|
| Statement* then_statement,
|
| - Statement* else_statement)
|
| - : condition_(condition),
|
| + Statement* else_statement,
|
| + int pos)
|
| + : Statement(pos),
|
| + condition_(condition),
|
| then_statement_(then_statement),
|
| else_statement_(else_statement),
|
| if_id_(GetNextId(isolate)),
|
| @@ -1222,7 +1225,8 @@ class IfStatement V8_FINAL : public Statement {
|
| // stack in the compiler; this should probably be reworked.
|
| class TargetCollector V8_FINAL : public AstNode {
|
| public:
|
| - explicit TargetCollector(Zone* zone) : targets_(0, zone) { }
|
| + explicit TargetCollector(Zone* zone)
|
| + : AstNode(RelocInfo::kNoPosition), targets_(0, zone) { }
|
|
|
| // Adds a jump target to the collector. The collector stores a pointer not
|
| // a copy of the target to make binding work, so make sure not to pass in
|
| @@ -1252,8 +1256,9 @@ class TryStatement : public Statement {
|
| ZoneList<Label*>* escaping_targets() const { return escaping_targets_; }
|
|
|
| protected:
|
| - TryStatement(int index, Block* try_block)
|
| - : index_(index),
|
| + TryStatement(int index, Block* try_block, int pos)
|
| + : Statement(pos),
|
| + index_(index),
|
| try_block_(try_block),
|
| escaping_targets_(NULL) { }
|
|
|
| @@ -1279,8 +1284,9 @@ class TryCatchStatement V8_FINAL : public TryStatement {
|
| Block* try_block,
|
| Scope* scope,
|
| Variable* variable,
|
| - Block* catch_block)
|
| - : TryStatement(index, try_block),
|
| + Block* catch_block,
|
| + int pos)
|
| + : TryStatement(index, try_block, pos),
|
| scope_(scope),
|
| variable_(variable),
|
| catch_block_(catch_block) {
|
| @@ -1300,8 +1306,9 @@ class TryFinallyStatement V8_FINAL : public TryStatement {
|
| Block* finally_block() const { return finally_block_; }
|
|
|
| protected:
|
| - TryFinallyStatement(int index, Block* try_block, Block* finally_block)
|
| - : TryStatement(index, try_block),
|
| + TryFinallyStatement(
|
| + int index, Block* try_block, Block* finally_block, int pos)
|
| + : TryStatement(index, try_block, pos),
|
| finally_block_(finally_block) { }
|
|
|
| private:
|
| @@ -1314,7 +1321,7 @@ class DebuggerStatement V8_FINAL : public Statement {
|
| DECLARE_NODE_TYPE(DebuggerStatement)
|
|
|
| protected:
|
| - DebuggerStatement() {}
|
| + explicit DebuggerStatement(int pos): Statement(pos) {}
|
| };
|
|
|
|
|
| @@ -1323,7 +1330,7 @@ class EmptyStatement V8_FINAL : public Statement {
|
| DECLARE_NODE_TYPE(EmptyStatement)
|
|
|
| protected:
|
| - EmptyStatement() {}
|
| + explicit EmptyStatement(int pos): Statement(pos) {}
|
| };
|
|
|
|
|
| @@ -1380,8 +1387,9 @@ class Literal V8_FINAL : public Expression {
|
| TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); }
|
|
|
| protected:
|
| - Literal(Isolate* isolate, Handle<Object> value)
|
| - : Expression(isolate),
|
| + Literal(
|
| + Isolate* isolate, Handle<Object> value, int position)
|
| + : Expression(isolate, position),
|
| value_(value),
|
| isolate_(isolate) { }
|
|
|
| @@ -1411,8 +1419,9 @@ class MaterializedLiteral : public Expression {
|
| MaterializedLiteral(Isolate* isolate,
|
| int literal_index,
|
| bool is_simple,
|
| - int depth)
|
| - : Expression(isolate),
|
| + int depth,
|
| + int pos)
|
| + : Expression(isolate, pos),
|
| literal_index_(literal_index),
|
| is_simple_(is_simple),
|
| depth_(depth) {}
|
| @@ -1510,8 +1519,9 @@ class ObjectLiteral V8_FINAL : public MaterializedLiteral {
|
| bool fast_elements,
|
| int depth,
|
| bool may_store_doubles,
|
| - bool has_function)
|
| - : MaterializedLiteral(isolate, literal_index, is_simple, depth),
|
| + bool has_function,
|
| + int pos)
|
| + : MaterializedLiteral(isolate, literal_index, is_simple, depth, pos),
|
| constant_properties_(constant_properties),
|
| properties_(properties),
|
| fast_elements_(fast_elements),
|
| @@ -1539,8 +1549,9 @@ class RegExpLiteral V8_FINAL : public MaterializedLiteral {
|
| RegExpLiteral(Isolate* isolate,
|
| Handle<String> pattern,
|
| Handle<String> flags,
|
| - int literal_index)
|
| - : MaterializedLiteral(isolate, literal_index, false, 1),
|
| + int literal_index,
|
| + int pos)
|
| + : MaterializedLiteral(isolate, literal_index, false, 1, pos),
|
| pattern_(pattern),
|
| flags_(flags) {}
|
|
|
| @@ -1549,6 +1560,7 @@ class RegExpLiteral V8_FINAL : public MaterializedLiteral {
|
| Handle<String> flags_;
|
| };
|
|
|
| +
|
| // 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 {
|
| @@ -1569,8 +1581,9 @@ class ArrayLiteral V8_FINAL : public MaterializedLiteral {
|
| ZoneList<Expression*>* values,
|
| int literal_index,
|
| bool is_simple,
|
| - int depth)
|
| - : MaterializedLiteral(isolate, literal_index, is_simple, depth),
|
| + int depth,
|
| + int pos)
|
| + : MaterializedLiteral(isolate, literal_index, is_simple, depth, pos),
|
| constant_elements_(constant_elements),
|
| values_(values),
|
| first_element_id_(ReserveIdRange(isolate, values->length())) {}
|
| @@ -1603,7 +1616,6 @@ class VariableProxy V8_FINAL : public Expression {
|
| Handle<String> name() const { return name_; }
|
| Variable* var() const { return var_; }
|
| bool is_this() const { return is_this_; }
|
| - int position() const { return position_; }
|
| Interface* interface() const { return interface_; }
|
|
|
|
|
| @@ -1614,7 +1626,7 @@ class VariableProxy V8_FINAL : public Expression {
|
| void BindTo(Variable* var);
|
|
|
| protected:
|
| - VariableProxy(Isolate* isolate, Variable* var);
|
| + VariableProxy(Isolate* isolate, Variable* var, int position);
|
|
|
| VariableProxy(Isolate* isolate,
|
| Handle<String> name,
|
| @@ -1629,7 +1641,6 @@ class VariableProxy V8_FINAL : public Expression {
|
| // True if this variable proxy is being used in an assignment
|
| // or with a increment/decrement operator.
|
| bool is_lvalue_;
|
| - int position_;
|
| Interface* interface_;
|
| };
|
|
|
| @@ -1642,7 +1653,6 @@ class Property V8_FINAL : public Expression {
|
|
|
| Expression* obj() const { return obj_; }
|
| Expression* key() const { return key_; }
|
| - virtual int position() const V8_OVERRIDE { return pos_; }
|
|
|
| BailoutId LoadId() const { return load_id_; }
|
|
|
| @@ -1659,6 +1669,10 @@ class Property V8_FINAL : public Expression {
|
| return STANDARD_STORE;
|
| }
|
| bool IsUninitialized() { return is_uninitialized_; }
|
| + bool IsPreMonomorphic() { return is_pre_monomorphic_; }
|
| + bool HasNoTypeInformation() {
|
| + return is_uninitialized_ || is_pre_monomorphic_;
|
| + }
|
| TypeFeedbackId PropertyFeedbackId() { return reuse(id()); }
|
|
|
| protected:
|
| @@ -1666,12 +1680,12 @@ class Property V8_FINAL : public Expression {
|
| Expression* obj,
|
| Expression* key,
|
| int pos)
|
| - : Expression(isolate),
|
| + : Expression(isolate, pos),
|
| obj_(obj),
|
| key_(key),
|
| - pos_(pos),
|
| load_id_(GetNextId(isolate)),
|
| is_monomorphic_(false),
|
| + is_pre_monomorphic_(false),
|
| is_uninitialized_(false),
|
| is_string_access_(false),
|
| is_function_prototype_(false) { }
|
| @@ -1679,11 +1693,11 @@ class Property V8_FINAL : public Expression {
|
| private:
|
| Expression* obj_;
|
| Expression* key_;
|
| - int pos_;
|
| const BailoutId load_id_;
|
|
|
| SmallMapList receiver_types_;
|
| bool is_monomorphic_ : 1;
|
| + bool is_pre_monomorphic_ : 1;
|
| bool is_uninitialized_ : 1;
|
| bool is_string_access_ : 1;
|
| bool is_function_prototype_ : 1;
|
| @@ -1696,7 +1710,6 @@ class Call V8_FINAL : public Expression {
|
|
|
| Expression* expression() const { return expression_; }
|
| ZoneList<Expression*>* arguments() const { return arguments_; }
|
| - virtual int position() const V8_FINAL { return pos_; }
|
|
|
| // Type feedback information.
|
| TypeFeedbackId CallFeedbackId() const { return reuse(id()); }
|
| @@ -1751,10 +1764,9 @@ class Call V8_FINAL : public Expression {
|
| Expression* expression,
|
| ZoneList<Expression*>* arguments,
|
| int pos)
|
| - : Expression(isolate),
|
| + : Expression(isolate, pos),
|
| expression_(expression),
|
| arguments_(arguments),
|
| - pos_(pos),
|
| is_monomorphic_(false),
|
| check_type_(RECEIVER_MAP_CHECK),
|
| return_id_(GetNextId(isolate)) { }
|
| @@ -1762,7 +1774,6 @@ class Call V8_FINAL : public Expression {
|
| private:
|
| Expression* expression_;
|
| ZoneList<Expression*>* arguments_;
|
| - int pos_;
|
|
|
| bool is_monomorphic_;
|
| CheckType check_type_;
|
| @@ -1781,7 +1792,6 @@ class CallNew V8_FINAL : public Expression {
|
|
|
| Expression* expression() const { return expression_; }
|
| ZoneList<Expression*>* arguments() const { return arguments_; }
|
| - virtual int position() const V8_OVERRIDE { return pos_; }
|
|
|
| // Type feedback information.
|
| TypeFeedbackId CallNewFeedbackId() const { return reuse(id()); }
|
| @@ -1800,10 +1810,9 @@ class CallNew V8_FINAL : public Expression {
|
| Expression* expression,
|
| ZoneList<Expression*>* arguments,
|
| int pos)
|
| - : Expression(isolate),
|
| + : Expression(isolate, pos),
|
| expression_(expression),
|
| arguments_(arguments),
|
| - pos_(pos),
|
| is_monomorphic_(false),
|
| elements_kind_(GetInitialFastElementsKind()),
|
| return_id_(GetNextId(isolate)) { }
|
| @@ -1811,7 +1820,6 @@ class CallNew V8_FINAL : public Expression {
|
| private:
|
| Expression* expression_;
|
| ZoneList<Expression*>* arguments_;
|
| - int pos_;
|
|
|
| bool is_monomorphic_;
|
| Handle<JSFunction> target_;
|
| @@ -1841,8 +1849,9 @@ class CallRuntime V8_FINAL : public Expression {
|
| CallRuntime(Isolate* isolate,
|
| Handle<String> name,
|
| const Runtime::Function* function,
|
| - ZoneList<Expression*>* arguments)
|
| - : Expression(isolate),
|
| + ZoneList<Expression*>* arguments,
|
| + int pos)
|
| + : Expression(isolate, pos),
|
| name_(name),
|
| function_(function),
|
| arguments_(arguments) { }
|
| @@ -1860,7 +1869,6 @@ class UnaryOperation V8_FINAL : public Expression {
|
|
|
| Token::Value op() const { return op_; }
|
| Expression* expression() const { return expression_; }
|
| - virtual int position() const V8_OVERRIDE { return pos_; }
|
|
|
| BailoutId MaterializeTrueId() { return materialize_true_id_; }
|
| BailoutId MaterializeFalseId() { return materialize_false_id_; }
|
| @@ -1873,10 +1881,9 @@ class UnaryOperation V8_FINAL : public Expression {
|
| Token::Value op,
|
| Expression* expression,
|
| int pos)
|
| - : Expression(isolate),
|
| + : Expression(isolate, pos),
|
| op_(op),
|
| expression_(expression),
|
| - pos_(pos),
|
| materialize_true_id_(GetNextId(isolate)),
|
| materialize_false_id_(GetNextId(isolate)) {
|
| ASSERT(Token::IsUnaryOp(op));
|
| @@ -1885,7 +1892,6 @@ class UnaryOperation V8_FINAL : public Expression {
|
| private:
|
| Token::Value op_;
|
| Expression* expression_;
|
| - int pos_;
|
|
|
| // For unary not (Token::NOT), the AST ids where true and false will
|
| // actually be materialized, respectively.
|
| @@ -1903,7 +1909,6 @@ class BinaryOperation V8_FINAL : public Expression {
|
| Token::Value op() const { return op_; }
|
| Expression* left() const { return left_; }
|
| Expression* right() const { return right_; }
|
| - virtual int position() const V8_OVERRIDE { return pos_; }
|
|
|
| BailoutId RightId() const { return right_id_; }
|
|
|
| @@ -1920,11 +1925,10 @@ class BinaryOperation V8_FINAL : public Expression {
|
| Expression* left,
|
| Expression* right,
|
| int pos)
|
| - : Expression(isolate),
|
| + : Expression(isolate, pos),
|
| op_(op),
|
| left_(left),
|
| right_(right),
|
| - pos_(pos),
|
| right_id_(GetNextId(isolate)) {
|
| ASSERT(Token::IsBinaryOp(op));
|
| }
|
| @@ -1933,7 +1937,6 @@ class BinaryOperation V8_FINAL : public Expression {
|
| Token::Value op_;
|
| Expression* left_;
|
| Expression* right_;
|
| - int pos_;
|
|
|
| // TODO(rossberg): the fixed arg should probably be represented as a Constant
|
| // type for the RHS.
|
| @@ -1958,7 +1961,6 @@ class CountOperation V8_FINAL : public Expression {
|
| }
|
|
|
| Expression* expression() const { return expression_; }
|
| - virtual int position() const V8_OVERRIDE { return pos_; }
|
|
|
| void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone);
|
| virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; }
|
| @@ -1981,13 +1983,12 @@ class CountOperation V8_FINAL : public Expression {
|
| bool is_prefix,
|
| Expression* expr,
|
| int pos)
|
| - : Expression(isolate),
|
| + : Expression(isolate, pos),
|
| op_(op),
|
| is_prefix_(is_prefix),
|
| is_monomorphic_(false),
|
| store_mode_(STANDARD_STORE),
|
| expression_(expr),
|
| - pos_(pos),
|
| assignment_id_(GetNextId(isolate)),
|
| count_id_(GetNextId(isolate)) {}
|
|
|
| @@ -2000,7 +2001,6 @@ class CountOperation V8_FINAL : public Expression {
|
| Handle<Type> type_;
|
|
|
| Expression* expression_;
|
| - int pos_;
|
| const BailoutId assignment_id_;
|
| const TypeFeedbackId count_id_;
|
| SmallMapList receiver_types_;
|
| @@ -2014,7 +2014,6 @@ class CompareOperation V8_FINAL : public Expression {
|
| Token::Value op() const { return op_; }
|
| Expression* left() const { return left_; }
|
| Expression* right() const { return right_; }
|
| - virtual int position() const V8_OVERRIDE { return pos_; }
|
|
|
| // Type feedback information.
|
| TypeFeedbackId CompareOperationFeedbackId() const { return reuse(id()); }
|
| @@ -2032,12 +2031,11 @@ class CompareOperation V8_FINAL : public Expression {
|
| Expression* left,
|
| Expression* right,
|
| int pos)
|
| - : Expression(isolate),
|
| + : Expression(isolate, pos),
|
| op_(op),
|
| left_(left),
|
| right_(right),
|
| - pos_(pos),
|
| - combined_type_(Type::Null(), isolate) {
|
| + combined_type_(Type::None(), isolate) {
|
| ASSERT(Token::IsCompareOp(op));
|
| }
|
|
|
| @@ -2045,7 +2043,6 @@ class CompareOperation V8_FINAL : public Expression {
|
| Token::Value op_;
|
| Expression* left_;
|
| Expression* right_;
|
| - int pos_;
|
|
|
| Handle<Type> combined_type_;
|
| };
|
| @@ -2059,9 +2056,6 @@ class Conditional V8_FINAL : public Expression {
|
| Expression* then_expression() const { return then_expression_; }
|
| Expression* else_expression() const { return else_expression_; }
|
|
|
| - int then_expression_position() const { return then_expression_position_; }
|
| - int else_expression_position() const { return else_expression_position_; }
|
| -
|
| BailoutId ThenId() const { return then_id_; }
|
| BailoutId ElseId() const { return else_id_; }
|
|
|
| @@ -2070,14 +2064,11 @@ class Conditional V8_FINAL : public Expression {
|
| Expression* condition,
|
| Expression* then_expression,
|
| Expression* else_expression,
|
| - int then_expression_position,
|
| - int else_expression_position)
|
| - : Expression(isolate),
|
| + int position)
|
| + : Expression(isolate, position),
|
| condition_(condition),
|
| then_expression_(then_expression),
|
| else_expression_(else_expression),
|
| - then_expression_position_(then_expression_position),
|
| - else_expression_position_(else_expression_position),
|
| then_id_(GetNextId(isolate)),
|
| else_id_(GetNextId(isolate)) { }
|
|
|
| @@ -2085,8 +2076,6 @@ class Conditional V8_FINAL : public Expression {
|
| Expression* condition_;
|
| Expression* then_expression_;
|
| Expression* else_expression_;
|
| - int then_expression_position_;
|
| - int else_expression_position_;
|
| const BailoutId then_id_;
|
| const BailoutId else_id_;
|
| };
|
| @@ -2103,7 +2092,6 @@ class Assignment V8_FINAL : public Expression {
|
| Token::Value op() const { return op_; }
|
| Expression* target() const { return target_; }
|
| Expression* value() const { return value_; }
|
| - virtual int position() const V8_OVERRIDE { return pos_; }
|
| BinaryOperation* binary_operation() const { return binary_operation_; }
|
|
|
| // This check relies on the definition order of token in token.h.
|
| @@ -2116,6 +2104,10 @@ class Assignment V8_FINAL : public Expression {
|
| void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone);
|
| virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; }
|
| bool IsUninitialized() { return is_uninitialized_; }
|
| + bool IsPreMonomorphic() { return is_pre_monomorphic_; }
|
| + bool HasNoTypeInformation() {
|
| + return is_uninitialized_ || is_pre_monomorphic_;
|
| + }
|
| virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE {
|
| return &receiver_types_;
|
| }
|
| @@ -2134,8 +2126,8 @@ class Assignment V8_FINAL : public Expression {
|
| void Init(Isolate* isolate, AstNodeFactory<Visitor>* factory) {
|
| ASSERT(Token::IsAssignmentOp(op_));
|
| if (is_compound()) {
|
| - binary_operation_ =
|
| - factory->NewBinaryOperation(binary_op(), target_, value_, pos_ + 1);
|
| + binary_operation_ = factory->NewBinaryOperation(
|
| + binary_op(), target_, value_, position() + 1);
|
| }
|
| }
|
|
|
| @@ -2143,12 +2135,12 @@ class Assignment V8_FINAL : public Expression {
|
| Token::Value op_;
|
| Expression* target_;
|
| Expression* value_;
|
| - int pos_;
|
| BinaryOperation* binary_operation_;
|
| const BailoutId assignment_id_;
|
|
|
| bool is_monomorphic_ : 1;
|
| bool is_uninitialized_ : 1;
|
| + bool is_pre_monomorphic_ : 1;
|
| KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed,
|
| // must have extra bit.
|
| SmallMapList receiver_types_;
|
| @@ -2169,7 +2161,6 @@ class Yield V8_FINAL : public Expression {
|
| Expression* generator_object() const { return generator_object_; }
|
| Expression* expression() const { return expression_; }
|
| Kind yield_kind() const { return yield_kind_; }
|
| - virtual int position() const V8_OVERRIDE { return pos_; }
|
|
|
| // Delegating yield surrounds the "yield" in a "try/catch". This index
|
| // locates the catch handler in the handler table, and is equivalent to
|
| @@ -2189,19 +2180,17 @@ class Yield V8_FINAL : public Expression {
|
| Expression* expression,
|
| Kind yield_kind,
|
| int pos)
|
| - : Expression(isolate),
|
| + : Expression(isolate, pos),
|
| generator_object_(generator_object),
|
| expression_(expression),
|
| yield_kind_(yield_kind),
|
| - index_(-1),
|
| - pos_(pos) { }
|
| + index_(-1) { }
|
|
|
| private:
|
| Expression* generator_object_;
|
| Expression* expression_;
|
| Kind yield_kind_;
|
| int index_;
|
| - int pos_;
|
| };
|
|
|
|
|
| @@ -2210,15 +2199,13 @@ class Throw V8_FINAL : public Expression {
|
| DECLARE_NODE_TYPE(Throw)
|
|
|
| Expression* exception() const { return exception_; }
|
| - virtual int position() const V8_OVERRIDE { return pos_; }
|
|
|
| protected:
|
| Throw(Isolate* isolate, Expression* exception, int pos)
|
| - : Expression(isolate), exception_(exception), pos_(pos) {}
|
| + : Expression(isolate, pos), exception_(exception) {}
|
|
|
| private:
|
| Expression* exception_;
|
| - int pos_;
|
| };
|
|
|
|
|
| @@ -2333,8 +2320,9 @@ class FunctionLiteral V8_FINAL : public Expression {
|
| ParameterFlag has_duplicate_parameters,
|
| IsFunctionFlag is_function,
|
| IsParenthesizedFlag is_parenthesized,
|
| - IsGeneratorFlag is_generator)
|
| - : Expression(isolate),
|
| + IsGeneratorFlag is_generator,
|
| + int position)
|
| + : Expression(isolate, position),
|
| name_(name),
|
| scope_(scope),
|
| body_(body),
|
| @@ -2389,8 +2377,8 @@ class NativeFunctionLiteral V8_FINAL : public Expression {
|
|
|
| protected:
|
| NativeFunctionLiteral(
|
| - Isolate* isolate, Handle<String> name, v8::Extension* extension)
|
| - : Expression(isolate), name_(name), extension_(extension) { }
|
| + Isolate* isolate, Handle<String> name, v8::Extension* extension, int pos)
|
| + : Expression(isolate, pos), name_(name), extension_(extension) {}
|
|
|
| private:
|
| Handle<String> name_;
|
| @@ -2403,7 +2391,7 @@ class ThisFunction V8_FINAL : public Expression {
|
| DECLARE_NODE_TYPE(ThisFunction)
|
|
|
| protected:
|
| - explicit ThisFunction(Isolate* isolate): Expression(isolate) {}
|
| + explicit ThisFunction(Isolate* isolate, int pos): Expression(isolate, pos) {}
|
| };
|
|
|
| #undef DECLARE_NODE_TYPE
|
| @@ -2770,8 +2758,8 @@ class RegExpEmpty V8_FINAL : public RegExpTree {
|
| // ----------------------------------------------------------------------------
|
| // Out-of-line inline constructors (to side-step cyclic dependencies).
|
|
|
| -inline ModuleVariable::ModuleVariable(VariableProxy* proxy)
|
| - : Module(proxy->interface()),
|
| +inline ModuleVariable::ModuleVariable(VariableProxy* proxy, int pos)
|
| + : Module(proxy->interface(), pos),
|
| proxy_(proxy) {
|
| }
|
|
|
| @@ -2888,75 +2876,81 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
|
|
|
| VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy,
|
| VariableMode mode,
|
| - Scope* scope) {
|
| + Scope* scope,
|
| + int pos) {
|
| VariableDeclaration* decl =
|
| - new(zone_) VariableDeclaration(proxy, mode, scope);
|
| + new(zone_) VariableDeclaration(proxy, mode, scope, pos);
|
| VISIT_AND_RETURN(VariableDeclaration, decl)
|
| }
|
|
|
| FunctionDeclaration* NewFunctionDeclaration(VariableProxy* proxy,
|
| VariableMode mode,
|
| FunctionLiteral* fun,
|
| - Scope* scope) {
|
| + Scope* scope,
|
| + int pos) {
|
| FunctionDeclaration* decl =
|
| - new(zone_) FunctionDeclaration(proxy, mode, fun, scope);
|
| + new(zone_) FunctionDeclaration(proxy, mode, fun, scope, pos);
|
| VISIT_AND_RETURN(FunctionDeclaration, decl)
|
| }
|
|
|
| ModuleDeclaration* NewModuleDeclaration(VariableProxy* proxy,
|
| Module* module,
|
| - Scope* scope) {
|
| + Scope* scope,
|
| + int pos) {
|
| ModuleDeclaration* decl =
|
| - new(zone_) ModuleDeclaration(proxy, module, scope);
|
| + new(zone_) ModuleDeclaration(proxy, module, scope, pos);
|
| VISIT_AND_RETURN(ModuleDeclaration, decl)
|
| }
|
|
|
| ImportDeclaration* NewImportDeclaration(VariableProxy* proxy,
|
| Module* module,
|
| - Scope* scope) {
|
| + Scope* scope,
|
| + int pos) {
|
| ImportDeclaration* decl =
|
| - new(zone_) ImportDeclaration(proxy, module, scope);
|
| + new(zone_) ImportDeclaration(proxy, module, scope, pos);
|
| VISIT_AND_RETURN(ImportDeclaration, decl)
|
| }
|
|
|
| ExportDeclaration* NewExportDeclaration(VariableProxy* proxy,
|
| - Scope* scope) {
|
| + Scope* scope,
|
| + int pos) {
|
| ExportDeclaration* decl =
|
| - new(zone_) ExportDeclaration(proxy, scope);
|
| + new(zone_) ExportDeclaration(proxy, scope, pos);
|
| VISIT_AND_RETURN(ExportDeclaration, decl)
|
| }
|
|
|
| - ModuleLiteral* NewModuleLiteral(Block* body, Interface* interface) {
|
| - ModuleLiteral* module = new(zone_) ModuleLiteral(body, interface);
|
| + ModuleLiteral* NewModuleLiteral(Block* body, Interface* interface, int pos) {
|
| + ModuleLiteral* module = new(zone_) ModuleLiteral(body, interface, pos);
|
| VISIT_AND_RETURN(ModuleLiteral, module)
|
| }
|
|
|
| - ModuleVariable* NewModuleVariable(VariableProxy* proxy) {
|
| - ModuleVariable* module = new(zone_) ModuleVariable(proxy);
|
| + ModuleVariable* NewModuleVariable(VariableProxy* proxy, int pos) {
|
| + ModuleVariable* module = new(zone_) ModuleVariable(proxy, pos);
|
| VISIT_AND_RETURN(ModuleVariable, module)
|
| }
|
|
|
| - ModulePath* NewModulePath(Module* origin, Handle<String> name) {
|
| - ModulePath* module = new(zone_) ModulePath(origin, name, zone_);
|
| + ModulePath* NewModulePath(Module* origin, Handle<String> name, int pos) {
|
| + ModulePath* module = new(zone_) ModulePath(origin, name, zone_, pos);
|
| VISIT_AND_RETURN(ModulePath, module)
|
| }
|
|
|
| - ModuleUrl* NewModuleUrl(Handle<String> url) {
|
| - ModuleUrl* module = new(zone_) ModuleUrl(url, zone_);
|
| + ModuleUrl* NewModuleUrl(Handle<String> url, int pos) {
|
| + ModuleUrl* module = new(zone_) ModuleUrl(url, zone_, pos);
|
| VISIT_AND_RETURN(ModuleUrl, module)
|
| }
|
|
|
| Block* NewBlock(ZoneStringList* labels,
|
| int capacity,
|
| - bool is_initializer_block) {
|
| + bool is_initializer_block,
|
| + int pos) {
|
| Block* block = new(zone_) Block(
|
| - isolate_, labels, capacity, is_initializer_block, zone_);
|
| + isolate_, labels, capacity, is_initializer_block, pos, zone_);
|
| VISIT_AND_RETURN(Block, block)
|
| }
|
|
|
| #define STATEMENT_WITH_LABELS(NodeType) \
|
| - NodeType* New##NodeType(ZoneStringList* labels) { \
|
| - NodeType* stmt = new(zone_) NodeType(isolate_, labels); \
|
| + NodeType* New##NodeType(ZoneStringList* labels, int pos) { \
|
| + NodeType* stmt = new(zone_) NodeType(isolate_, labels, pos); \
|
| VISIT_AND_RETURN(NodeType, stmt); \
|
| }
|
| STATEMENT_WITH_LABELS(DoWhileStatement)
|
| @@ -2966,14 +2960,15 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
|
| #undef STATEMENT_WITH_LABELS
|
|
|
| ForEachStatement* NewForEachStatement(ForEachStatement::VisitMode visit_mode,
|
| - ZoneStringList* labels) {
|
| + ZoneStringList* labels,
|
| + int pos) {
|
| switch (visit_mode) {
|
| case ForEachStatement::ENUMERATE: {
|
| - ForInStatement* stmt = new(zone_) ForInStatement(isolate_, labels);
|
| + ForInStatement* stmt = new(zone_) ForInStatement(isolate_, labels, pos);
|
| VISIT_AND_RETURN(ForInStatement, stmt);
|
| }
|
| case ForEachStatement::ITERATE: {
|
| - ForOfStatement* stmt = new(zone_) ForOfStatement(isolate_, labels);
|
| + ForOfStatement* stmt = new(zone_) ForOfStatement(isolate_, labels, pos);
|
| VISIT_AND_RETURN(ForOfStatement, stmt);
|
| }
|
| }
|
| @@ -2981,44 +2976,47 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
|
| return NULL;
|
| }
|
|
|
| - ModuleStatement* NewModuleStatement(VariableProxy* proxy, Block* body) {
|
| - ModuleStatement* stmt = new(zone_) ModuleStatement(proxy, body);
|
| + ModuleStatement* NewModuleStatement(
|
| + VariableProxy* proxy, Block* body, int pos) {
|
| + ModuleStatement* stmt = new(zone_) ModuleStatement(proxy, body, pos);
|
| VISIT_AND_RETURN(ModuleStatement, stmt)
|
| }
|
|
|
| - ExpressionStatement* NewExpressionStatement(Expression* expression) {
|
| - ExpressionStatement* stmt = new(zone_) ExpressionStatement(expression);
|
| + ExpressionStatement* NewExpressionStatement(Expression* expression, int pos) {
|
| + ExpressionStatement* stmt = new(zone_) ExpressionStatement(expression, pos);
|
| VISIT_AND_RETURN(ExpressionStatement, stmt)
|
| }
|
|
|
| - ContinueStatement* NewContinueStatement(IterationStatement* target) {
|
| - ContinueStatement* stmt = new(zone_) ContinueStatement(target);
|
| + ContinueStatement* NewContinueStatement(IterationStatement* target, int pos) {
|
| + ContinueStatement* stmt = new(zone_) ContinueStatement(target, pos);
|
| VISIT_AND_RETURN(ContinueStatement, stmt)
|
| }
|
|
|
| - BreakStatement* NewBreakStatement(BreakableStatement* target) {
|
| - BreakStatement* stmt = new(zone_) BreakStatement(target);
|
| + BreakStatement* NewBreakStatement(BreakableStatement* target, int pos) {
|
| + BreakStatement* stmt = new(zone_) BreakStatement(target, pos);
|
| VISIT_AND_RETURN(BreakStatement, stmt)
|
| }
|
|
|
| - ReturnStatement* NewReturnStatement(Expression* expression) {
|
| - ReturnStatement* stmt = new(zone_) ReturnStatement(expression);
|
| + ReturnStatement* NewReturnStatement(Expression* expression, int pos) {
|
| + ReturnStatement* stmt = new(zone_) ReturnStatement(expression, pos);
|
| VISIT_AND_RETURN(ReturnStatement, stmt)
|
| }
|
|
|
| WithStatement* NewWithStatement(Scope* scope,
|
| Expression* expression,
|
| - Statement* statement) {
|
| + Statement* statement,
|
| + int pos) {
|
| WithStatement* stmt = new(zone_) WithStatement(
|
| - scope, expression, statement);
|
| + scope, expression, statement, pos);
|
| VISIT_AND_RETURN(WithStatement, stmt)
|
| }
|
|
|
| IfStatement* NewIfStatement(Expression* condition,
|
| Statement* then_statement,
|
| - Statement* else_statement) {
|
| + Statement* else_statement,
|
| + int pos) {
|
| IfStatement* stmt = new(zone_) IfStatement(
|
| - isolate_, condition, then_statement, else_statement);
|
| + isolate_, condition, then_statement, else_statement, pos);
|
| VISIT_AND_RETURN(IfStatement, stmt)
|
| }
|
|
|
| @@ -3026,36 +3024,45 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
|
| Block* try_block,
|
| Scope* scope,
|
| Variable* variable,
|
| - Block* catch_block) {
|
| + Block* catch_block,
|
| + int pos) {
|
| TryCatchStatement* stmt = new(zone_) TryCatchStatement(
|
| - index, try_block, scope, variable, catch_block);
|
| + index, try_block, scope, variable, catch_block, pos);
|
| VISIT_AND_RETURN(TryCatchStatement, stmt)
|
| }
|
|
|
| TryFinallyStatement* NewTryFinallyStatement(int index,
|
| Block* try_block,
|
| - Block* finally_block) {
|
| + Block* finally_block,
|
| + int pos) {
|
| TryFinallyStatement* stmt =
|
| - new(zone_) TryFinallyStatement(index, try_block, finally_block);
|
| + new(zone_) TryFinallyStatement(index, try_block, finally_block, pos);
|
| VISIT_AND_RETURN(TryFinallyStatement, stmt)
|
| }
|
|
|
| - DebuggerStatement* NewDebuggerStatement() {
|
| - DebuggerStatement* stmt = new(zone_) DebuggerStatement();
|
| + DebuggerStatement* NewDebuggerStatement(int pos) {
|
| + DebuggerStatement* stmt = new(zone_) DebuggerStatement(pos);
|
| VISIT_AND_RETURN(DebuggerStatement, stmt)
|
| }
|
|
|
| - EmptyStatement* NewEmptyStatement() {
|
| - return new(zone_) EmptyStatement();
|
| + EmptyStatement* NewEmptyStatement(int pos) {
|
| + return new(zone_) EmptyStatement(pos);
|
| + }
|
| +
|
| + CaseClause* NewCaseClause(
|
| + Expression* label, ZoneList<Statement*>* statements, int pos) {
|
| + CaseClause* clause =
|
| + new(zone_) CaseClause(isolate_, label, statements, pos);
|
| + VISIT_AND_RETURN(CaseClause, clause)
|
| }
|
|
|
| - Literal* NewLiteral(Handle<Object> handle) {
|
| - Literal* lit = new(zone_) Literal(isolate_, handle);
|
| + Literal* NewLiteral(Handle<Object> handle, int pos) {
|
| + Literal* lit = new(zone_) Literal(isolate_, handle, pos);
|
| VISIT_AND_RETURN(Literal, lit)
|
| }
|
|
|
| - Literal* NewNumberLiteral(double number) {
|
| - return NewLiteral(isolate_->factory()->NewNumber(number, TENURED));
|
| + Literal* NewNumberLiteral(double number, int pos) {
|
| + return NewLiteral(isolate_->factory()->NewNumber(number, TENURED), pos);
|
| }
|
|
|
| ObjectLiteral* NewObjectLiteral(
|
| @@ -3066,26 +3073,29 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
|
| bool fast_elements,
|
| int depth,
|
| bool may_store_doubles,
|
| - bool has_function) {
|
| + bool has_function,
|
| + int pos) {
|
| ObjectLiteral* lit = new(zone_) ObjectLiteral(
|
| isolate_, constant_properties, properties, literal_index,
|
| - is_simple, fast_elements, depth, may_store_doubles, has_function);
|
| + is_simple, fast_elements, depth, may_store_doubles, has_function, pos);
|
| VISIT_AND_RETURN(ObjectLiteral, lit)
|
| }
|
|
|
| ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter,
|
| - FunctionLiteral* value) {
|
| + FunctionLiteral* value,
|
| + int pos) {
|
| ObjectLiteral::Property* prop =
|
| new(zone_) ObjectLiteral::Property(is_getter, value);
|
| - prop->set_key(NewLiteral(value->name()));
|
| + prop->set_key(NewLiteral(value->name(), pos));
|
| return prop; // Not an AST node, will not be visited.
|
| }
|
|
|
| RegExpLiteral* NewRegExpLiteral(Handle<String> pattern,
|
| Handle<String> flags,
|
| - int literal_index) {
|
| + int literal_index,
|
| + int pos) {
|
| RegExpLiteral* lit =
|
| - new(zone_) RegExpLiteral(isolate_, pattern, flags, literal_index);
|
| + new(zone_) RegExpLiteral(isolate_, pattern, flags, literal_index, pos);
|
| VISIT_AND_RETURN(RegExpLiteral, lit);
|
| }
|
|
|
| @@ -3093,14 +3103,17 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
|
| ZoneList<Expression*>* values,
|
| int literal_index,
|
| bool is_simple,
|
| - int depth) {
|
| + int depth,
|
| + int pos) {
|
| ArrayLiteral* lit = new(zone_) ArrayLiteral(
|
| - isolate_, constant_elements, values, literal_index, is_simple, depth);
|
| + isolate_, constant_elements, values, literal_index, is_simple,
|
| + depth, pos);
|
| VISIT_AND_RETURN(ArrayLiteral, lit)
|
| }
|
|
|
| - VariableProxy* NewVariableProxy(Variable* var) {
|
| - VariableProxy* proxy = new(zone_) VariableProxy(isolate_, var);
|
| + VariableProxy* NewVariableProxy(Variable* var,
|
| + int pos = RelocInfo::kNoPosition) {
|
| + VariableProxy* proxy = new(zone_) VariableProxy(isolate_, var, pos);
|
| VISIT_AND_RETURN(VariableProxy, proxy)
|
| }
|
|
|
| @@ -3134,9 +3147,10 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
|
|
|
| CallRuntime* NewCallRuntime(Handle<String> name,
|
| const Runtime::Function* function,
|
| - ZoneList<Expression*>* arguments) {
|
| + ZoneList<Expression*>* arguments,
|
| + int pos) {
|
| CallRuntime* call =
|
| - new(zone_) CallRuntime(isolate_, name, function, arguments);
|
| + new(zone_) CallRuntime(isolate_, name, function, arguments, pos);
|
| VISIT_AND_RETURN(CallRuntime, call)
|
| }
|
|
|
| @@ -3178,11 +3192,9 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
|
| Conditional* NewConditional(Expression* condition,
|
| Expression* then_expression,
|
| Expression* else_expression,
|
| - int then_expression_position,
|
| - int else_expression_position) {
|
| + int position) {
|
| Conditional* cond = new(zone_) Conditional(
|
| - isolate_, condition, then_expression, else_expression,
|
| - then_expression_position, else_expression_position);
|
| + isolate_, condition, then_expression, else_expression, position);
|
| VISIT_AND_RETURN(Conditional, cond)
|
| }
|
|
|
| @@ -3222,12 +3234,13 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
|
| FunctionLiteral::FunctionType function_type,
|
| FunctionLiteral::IsFunctionFlag is_function,
|
| FunctionLiteral::IsParenthesizedFlag is_parenthesized,
|
| - FunctionLiteral::IsGeneratorFlag is_generator) {
|
| + FunctionLiteral::IsGeneratorFlag is_generator,
|
| + int position) {
|
| FunctionLiteral* lit = new(zone_) FunctionLiteral(
|
| isolate_, name, scope, body,
|
| materialized_literal_count, expected_property_count, handler_count,
|
| parameter_count, function_type, has_duplicate_parameters, is_function,
|
| - is_parenthesized, is_generator);
|
| + is_parenthesized, is_generator, position);
|
| // Top-level literal doesn't count for the AST's properties.
|
| if (is_function == FunctionLiteral::kIsFunction) {
|
| visitor_.VisitFunctionLiteral(lit);
|
| @@ -3235,15 +3248,15 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
|
| return lit;
|
| }
|
|
|
| - NativeFunctionLiteral* NewNativeFunctionLiteral(Handle<String> name,
|
| - v8::Extension* extension) {
|
| + NativeFunctionLiteral* NewNativeFunctionLiteral(
|
| + Handle<String> name, v8::Extension* extension, int pos) {
|
| NativeFunctionLiteral* lit =
|
| - new(zone_) NativeFunctionLiteral(isolate_, name, extension);
|
| + new(zone_) NativeFunctionLiteral(isolate_, name, extension, pos);
|
| VISIT_AND_RETURN(NativeFunctionLiteral, lit)
|
| }
|
|
|
| - ThisFunction* NewThisFunction() {
|
| - ThisFunction* fun = new(zone_) ThisFunction(isolate_);
|
| + ThisFunction* NewThisFunction(int pos) {
|
| + ThisFunction* fun = new(zone_) ThisFunction(isolate_, pos);
|
| VISIT_AND_RETURN(ThisFunction, fun)
|
| }
|
|
|
|
|