Revision f230a1cf deps/v8/src/ast.h

View differences:

deps/v8/src/ast.h
97 97

  
98 98
#define EXPRESSION_NODE_LIST(V)                 \
99 99
  V(FunctionLiteral)                            \
100
  V(SharedFunctionInfoLiteral)                  \
100
  V(NativeFunctionLiteral)                      \
101 101
  V(Conditional)                                \
102 102
  V(VariableProxy)                              \
103 103
  V(Literal)                                    \
......
117 117
  V(CompareOperation)                           \
118 118
  V(ThisFunction)
119 119

  
120
#define AUXILIARY_NODE_LIST(V)                  \
121
  V(CaseClause)
122

  
120 123
#define AST_NODE_LIST(V)                        \
121 124
  DECLARATION_NODE_LIST(V)                      \
122 125
  MODULE_NODE_LIST(V)                           \
123 126
  STATEMENT_NODE_LIST(V)                        \
124
  EXPRESSION_NODE_LIST(V)
127
  EXPRESSION_NODE_LIST(V)                       \
128
  AUXILIARY_NODE_LIST(V)
125 129

  
126 130
// Forward declarations
127 131
class AstConstructionVisitor;
......
206 210
    return zone->New(static_cast<int>(size));
207 211
  }
208 212

  
209
  AstNode() {}
210

  
213
  explicit AstNode(int position): position_(position) {}
211 214
  virtual ~AstNode() {}
212 215

  
213 216
  virtual void Accept(AstVisitor* v) = 0;
214 217
  virtual NodeType node_type() const = 0;
218
  int position() const { return position_; }
215 219

  
216 220
  // Type testing & conversion functions overridden by concrete subclasses.
217 221
#define DECLARE_NODE_FUNCTIONS(type)                  \
......
248 252
  void* operator new(size_t size);
249 253

  
250 254
  friend class CaseClause;  // Generates AST IDs.
255

  
256
  int position_;
251 257
};
252 258

  
253 259

  
254 260
class Statement : public AstNode {
255 261
 public:
256
  Statement() : statement_pos_(RelocInfo::kNoPosition) {}
262
  explicit Statement(int position) : AstNode(position) {}
257 263

  
258 264
  bool IsEmpty() { return AsEmptyStatement() != NULL; }
259 265
  virtual bool IsJump() const { return false; }
260

  
261
  void set_statement_pos(int statement_pos) { statement_pos_ = statement_pos; }
262
  int statement_pos() const { return statement_pos_; }
263

  
264
 private:
265
  int statement_pos_;
266 266
};
267 267

  
268 268

  
......
329 329
    kTest
330 330
  };
331 331

  
332
  virtual int position() const {
333
    UNREACHABLE();
334
    return 0;
335
  }
336

  
337 332
  virtual bool IsValidLeftHandSide() { return false; }
338 333

  
339 334
  // Helpers for ToBoolean conversion.
......
387 382
  TypeFeedbackId test_id() const { return test_id_; }
388 383

  
389 384
 protected:
390
  explicit Expression(Isolate* isolate)
391
      : bounds_(Bounds::Unbounded(isolate)),
385
  Expression(Isolate* isolate, int pos)
386
      : AstNode(pos),
387
        bounds_(Bounds::Unbounded(isolate)),
392 388
        id_(GetNextId(isolate)),
393 389
        test_id_(GetNextId(isolate)) {}
394 390
  void set_to_boolean_types(byte types) { to_boolean_types_ = types; }
......
431 427

  
432 428
 protected:
433 429
  BreakableStatement(
434
      Isolate* isolate, ZoneStringList* labels, BreakableType breakable_type)
435
      : labels_(labels),
430
      Isolate* isolate, ZoneStringList* labels,
431
      BreakableType breakable_type, int position)
432
      : Statement(position),
433
        labels_(labels),
436 434
        breakable_type_(breakable_type),
437 435
        entry_id_(GetNextId(isolate)),
438 436
        exit_id_(GetNextId(isolate)) {
......
473 471
        ZoneStringList* labels,
474 472
        int capacity,
475 473
        bool is_initializer_block,
474
        int pos,
476 475
        Zone* zone)
477
      : BreakableStatement(isolate, labels, TARGET_FOR_NAMED_ONLY),
476
      : BreakableStatement(isolate, labels, TARGET_FOR_NAMED_ONLY, pos),
478 477
        statements_(capacity, zone),
479 478
        is_initializer_block_(is_initializer_block),
480 479
        scope_(NULL) {
......
498 497
 protected:
499 498
  Declaration(VariableProxy* proxy,
500 499
              VariableMode mode,
501
              Scope* scope)
502
      : proxy_(proxy),
500
              Scope* scope,
501
              int pos)
502
      : AstNode(pos),
503
        proxy_(proxy),
503 504
        mode_(mode),
504 505
        scope_(scope) {
505 506
    ASSERT(IsDeclaredVariableMode(mode));
......
525 526
 protected:
526 527
  VariableDeclaration(VariableProxy* proxy,
527 528
                      VariableMode mode,
528
                      Scope* scope)
529
      : Declaration(proxy, mode, scope) {
529
                      Scope* scope,
530
                      int pos)
531
      : Declaration(proxy, mode, scope, pos) {
530 532
  }
531 533
};
532 534

  
......
545 547
  FunctionDeclaration(VariableProxy* proxy,
546 548
                      VariableMode mode,
547 549
                      FunctionLiteral* fun,
548
                      Scope* scope)
549
      : Declaration(proxy, mode, scope),
550
                      Scope* scope,
551
                      int pos)
552
      : Declaration(proxy, mode, scope, pos),
550 553
        fun_(fun) {
551 554
    // At the moment there are no "const functions" in JavaScript...
552 555
    ASSERT(mode == VAR || mode == LET);
......
570 573
 protected:
571 574
  ModuleDeclaration(VariableProxy* proxy,
572 575
                    Module* module,
573
                    Scope* scope)
574
      : Declaration(proxy, MODULE, scope),
576
                    Scope* scope,
577
                    int pos)
578
      : Declaration(proxy, MODULE, scope, pos),
575 579
        module_(module) {
576 580
  }
577 581

  
......
592 596
 protected:
593 597
  ImportDeclaration(VariableProxy* proxy,
594 598
                    Module* module,
595
                    Scope* scope)
596
      : Declaration(proxy, LET, scope),
599
                    Scope* scope,
600
                    int pos)
601
      : Declaration(proxy, LET, scope, pos),
597 602
        module_(module) {
598 603
  }
599 604

  
......
611 616
  }
612 617

  
613 618
 protected:
614
  ExportDeclaration(VariableProxy* proxy, Scope* scope)
615
      : Declaration(proxy, LET, scope) {}
619
  ExportDeclaration(VariableProxy* proxy, Scope* scope, int pos)
620
      : Declaration(proxy, LET, scope, pos) {}
616 621
};
617 622

  
618 623

  
......
622 627
  Block* body() const { return body_; }
623 628

  
624 629
 protected:
625
  explicit Module(Zone* zone)
626
      : interface_(Interface::NewModule(zone)),
630
  Module(Zone* zone, int pos)
631
      : AstNode(pos),
632
        interface_(Interface::NewModule(zone)),
627 633
        body_(NULL) {}
628
  explicit Module(Interface* interface, Block* body = NULL)
629
      : interface_(interface),
634
  Module(Interface* interface, int pos, Block* body = NULL)
635
      : AstNode(pos),
636
        interface_(interface),
630 637
        body_(body) {}
631 638

  
632 639
 private:
......
640 647
  DECLARE_NODE_TYPE(ModuleLiteral)
641 648

  
642 649
 protected:
643
  ModuleLiteral(Block* body, Interface* interface) : Module(interface, body) {}
650
  ModuleLiteral(Block* body, Interface* interface, int pos)
651
      : Module(interface, pos, body) {}
644 652
};
645 653

  
646 654

  
......
651 659
  VariableProxy* proxy() const { return proxy_; }
652 660

  
653 661
 protected:
654
  inline explicit ModuleVariable(VariableProxy* proxy);
662
  inline ModuleVariable(VariableProxy* proxy, int pos);
655 663

  
656 664
 private:
657 665
  VariableProxy* proxy_;
......
666 674
  Handle<String> name() const { return name_; }
667 675

  
668 676
 protected:
669
  ModulePath(Module* module, Handle<String> name, Zone* zone)
670
      : Module(zone),
677
  ModulePath(Module* module, Handle<String> name, Zone* zone, int pos)
678
      : Module(zone, pos),
671 679
        module_(module),
672 680
        name_(name) {
673 681
  }
......
685 693
  Handle<String> url() const { return url_; }
686 694

  
687 695
 protected:
688
  ModuleUrl(Handle<String> url, Zone* zone)
689
      : Module(zone), url_(url) {
696
  ModuleUrl(Handle<String> url, Zone* zone, int pos)
697
      : Module(zone, pos), url_(url) {
690 698
  }
691 699

  
692 700
 private:
......
702 710
  Block* body() const { return body_; }
703 711

  
704 712
 protected:
705
  ModuleStatement(VariableProxy* proxy, Block* body)
706
      : proxy_(proxy),
713
  ModuleStatement(VariableProxy* proxy, Block* body, int pos)
714
      : Statement(pos),
715
        proxy_(proxy),
707 716
        body_(body) {
708 717
  }
709 718

  
......
730 739
  Label* continue_target()  { return &continue_target_; }
731 740

  
732 741
 protected:
733
  IterationStatement(Isolate* isolate, ZoneStringList* labels)
734
      : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS),
742
  IterationStatement(Isolate* isolate, ZoneStringList* labels, int pos)
743
      : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS, pos),
735 744
        body_(NULL),
736 745
        osr_entry_id_(GetNextId(isolate)) {
737 746
  }
......
759 768

  
760 769
  Expression* cond() const { return cond_; }
761 770

  
762
  // Position where condition expression starts. We need it to make
763
  // the loop's condition a breakable location.
764
  int condition_position() { return condition_position_; }
765
  void set_condition_position(int pos) { condition_position_ = pos; }
766

  
767 771
  virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; }
768 772
  virtual BailoutId StackCheckId() const V8_OVERRIDE { return back_edge_id_; }
769 773
  BailoutId BackEdgeId() const { return back_edge_id_; }
770 774

  
771 775
 protected:
772
  DoWhileStatement(Isolate* isolate, ZoneStringList* labels)
773
      : IterationStatement(isolate, labels),
776
  DoWhileStatement(Isolate* isolate, ZoneStringList* labels, int pos)
777
      : IterationStatement(isolate, labels, pos),
774 778
        cond_(NULL),
775
        condition_position_(-1),
776 779
        continue_id_(GetNextId(isolate)),
777 780
        back_edge_id_(GetNextId(isolate)) {
778 781
  }
......
780 783
 private:
781 784
  Expression* cond_;
782 785

  
783
  int condition_position_;
784

  
785 786
  const BailoutId continue_id_;
786 787
  const BailoutId back_edge_id_;
787 788
};
......
809 810
  BailoutId BodyId() const { return body_id_; }
810 811

  
811 812
 protected:
812
  WhileStatement(Isolate* isolate, ZoneStringList* labels)
813
      : IterationStatement(isolate, labels),
813
  WhileStatement(Isolate* isolate, ZoneStringList* labels, int pos)
814
      : IterationStatement(isolate, labels, pos),
814 815
        cond_(NULL),
815 816
        may_have_function_literal_(true),
816 817
        body_id_(GetNextId(isolate)) {
......
860 861
  void set_loop_variable(Variable* var) { loop_variable_ = var; }
861 862

  
862 863
 protected:
863
  ForStatement(Isolate* isolate, ZoneStringList* labels)
864
      : IterationStatement(isolate, labels),
864
  ForStatement(Isolate* isolate, ZoneStringList* labels, int pos)
865
      : IterationStatement(isolate, labels, pos),
865 866
        init_(NULL),
866 867
        cond_(NULL),
867 868
        next_(NULL),
......
902 903
  Expression* subject() const { return subject_; }
903 904

  
904 905
 protected:
905
  ForEachStatement(Isolate* isolate, ZoneStringList* labels)
906
      : IterationStatement(isolate, labels),
906
  ForEachStatement(Isolate* isolate, ZoneStringList* labels, int pos)
907
      : IterationStatement(isolate, labels, pos),
907 908
        each_(NULL),
908 909
        subject_(NULL) {
909 910
  }
......
933 934
  virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; }
934 935

  
935 936
 protected:
936
  ForInStatement(Isolate* isolate, ZoneStringList* labels)
937
      : ForEachStatement(isolate, labels),
937
  ForInStatement(Isolate* isolate, ZoneStringList* labels, int pos)
938
      : ForEachStatement(isolate, labels, pos),
938 939
        for_in_type_(SLOW_FOR_IN),
939 940
        body_id_(GetNextId(isolate)),
940 941
        prepare_id_(GetNextId(isolate)) {
......
994 995
  BailoutId BackEdgeId() const { return back_edge_id_; }
995 996

  
996 997
 protected:
997
  ForOfStatement(Isolate* isolate, ZoneStringList* labels)
998
      : ForEachStatement(isolate, labels),
998
  ForOfStatement(Isolate* isolate, ZoneStringList* labels, int pos)
999
      : ForEachStatement(isolate, labels, pos),
999 1000
        assign_iterator_(NULL),
1000 1001
        next_result_(NULL),
1001 1002
        result_done_(NULL),
......
1020 1021
  virtual bool IsJump() const V8_OVERRIDE { return expression_->IsThrow(); }
1021 1022

  
1022 1023
 protected:
1023
  explicit ExpressionStatement(Expression* expression)
1024
      : expression_(expression) { }
1024
  ExpressionStatement(Expression* expression, int pos)
1025
      : Statement(pos), expression_(expression) { }
1025 1026

  
1026 1027
 private:
1027 1028
  Expression* expression_;
......
1033 1034
  virtual bool IsJump() const V8_FINAL V8_OVERRIDE { return true; }
1034 1035

  
1035 1036
 protected:
1036
  JumpStatement() {}
1037
  explicit JumpStatement(int pos) : Statement(pos) {}
1037 1038
};
1038 1039

  
1039 1040

  
......
1044 1045
  IterationStatement* target() const { return target_; }
1045 1046

  
1046 1047
 protected:
1047
  explicit ContinueStatement(IterationStatement* target)
1048
      : target_(target) { }
1048
  explicit ContinueStatement(IterationStatement* target, int pos)
1049
      : JumpStatement(pos), target_(target) { }
1049 1050

  
1050 1051
 private:
1051 1052
  IterationStatement* target_;
......
1059 1060
  BreakableStatement* target() const { return target_; }
1060 1061

  
1061 1062
 protected:
1062
  explicit BreakStatement(BreakableStatement* target)
1063
      : target_(target) { }
1063
  explicit BreakStatement(BreakableStatement* target, int pos)
1064
      : JumpStatement(pos), target_(target) { }
1064 1065

  
1065 1066
 private:
1066 1067
  BreakableStatement* target_;
......
1074 1075
  Expression* expression() const { return expression_; }
1075 1076

  
1076 1077
 protected:
1077
  explicit ReturnStatement(Expression* expression)
1078
      : expression_(expression) { }
1078
  explicit ReturnStatement(Expression* expression, int pos)
1079
      : JumpStatement(pos), expression_(expression) { }
1079 1080

  
1080 1081
 private:
1081 1082
  Expression* expression_;
......
1091 1092
  Statement* statement() const { return statement_; }
1092 1093

  
1093 1094
 protected:
1094
  WithStatement(Scope* scope, Expression* expression, Statement* statement)
1095
      : scope_(scope),
1095
  WithStatement(
1096
      Scope* scope, Expression* expression, Statement* statement, int pos)
1097
      : Statement(pos),
1098
        scope_(scope),
1096 1099
        expression_(expression),
1097 1100
        statement_(statement) { }
1098 1101

  
......
1103 1106
};
1104 1107

  
1105 1108

  
1106
class CaseClause V8_FINAL : public ZoneObject {
1109
class CaseClause V8_FINAL : public AstNode {
1107 1110
 public:
1108
  CaseClause(Isolate* isolate,
1109
             Expression* label,
1110
             ZoneList<Statement*>* statements,
1111
             int pos);
1111
  DECLARE_NODE_TYPE(CaseClause)
1112 1112

  
1113 1113
  bool is_default() const { return label_ == NULL; }
1114 1114
  Expression* label() const {
......
1118 1118
  Label* body_target() { return &body_target_; }
1119 1119
  ZoneList<Statement*>* statements() const { return statements_; }
1120 1120

  
1121
  int position() const { return position_; }
1122
  void set_position(int pos) { position_ = pos; }
1123

  
1124 1121
  BailoutId EntryId() const { return entry_id_; }
1125 1122

  
1126 1123
  // Type feedback information.
......
1129 1126
  Handle<Type> compare_type() { return compare_type_; }
1130 1127

  
1131 1128
 private:
1129
  CaseClause(Isolate* isolate,
1130
             Expression* label,
1131
             ZoneList<Statement*>* statements,
1132
             int pos);
1133

  
1132 1134
  Expression* label_;
1133 1135
  Label body_target_;
1134 1136
  ZoneList<Statement*>* statements_;
1135
  int position_;
1136 1137
  Handle<Type> compare_type_;
1137 1138

  
1138 1139
  const TypeFeedbackId compare_id_;
......
1158 1159
  void set_switch_type(SwitchType switch_type) { switch_type_ = switch_type; }
1159 1160

  
1160 1161
 protected:
1161
  SwitchStatement(Isolate* isolate, ZoneStringList* labels)
1162
      : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS),
1162
  SwitchStatement(Isolate* isolate, ZoneStringList* labels, int pos)
1163
      : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS, pos),
1163 1164
        tag_(NULL),
1164 1165
        cases_(NULL) { }
1165 1166

  
......
1199 1200
  IfStatement(Isolate* isolate,
1200 1201
              Expression* condition,
1201 1202
              Statement* then_statement,
1202
              Statement* else_statement)
1203
      : condition_(condition),
1203
              Statement* else_statement,
1204
              int pos)
1205
      : Statement(pos),
1206
        condition_(condition),
1204 1207
        then_statement_(then_statement),
1205 1208
        else_statement_(else_statement),
1206 1209
        if_id_(GetNextId(isolate)),
......
1222 1225
// stack in the compiler; this should probably be reworked.
1223 1226
class TargetCollector V8_FINAL : public AstNode {
1224 1227
 public:
1225
  explicit TargetCollector(Zone* zone) : targets_(0, zone) { }
1228
  explicit TargetCollector(Zone* zone)
1229
      : AstNode(RelocInfo::kNoPosition), targets_(0, zone) { }
1226 1230

  
1227 1231
  // Adds a jump target to the collector. The collector stores a pointer not
1228 1232
  // a copy of the target to make binding work, so make sure not to pass in
......
1252 1256
  ZoneList<Label*>* escaping_targets() const { return escaping_targets_; }
1253 1257

  
1254 1258
 protected:
1255
  TryStatement(int index, Block* try_block)
1256
      : index_(index),
1259
  TryStatement(int index, Block* try_block, int pos)
1260
      : Statement(pos),
1261
        index_(index),
1257 1262
        try_block_(try_block),
1258 1263
        escaping_targets_(NULL) { }
1259 1264

  
......
1279 1284
                    Block* try_block,
1280 1285
                    Scope* scope,
1281 1286
                    Variable* variable,
1282
                    Block* catch_block)
1283
      : TryStatement(index, try_block),
1287
                    Block* catch_block,
1288
                    int pos)
1289
      : TryStatement(index, try_block, pos),
1284 1290
        scope_(scope),
1285 1291
        variable_(variable),
1286 1292
        catch_block_(catch_block) {
......
1300 1306
  Block* finally_block() const { return finally_block_; }
1301 1307

  
1302 1308
 protected:
1303
  TryFinallyStatement(int index, Block* try_block, Block* finally_block)
1304
      : TryStatement(index, try_block),
1309
  TryFinallyStatement(
1310
      int index, Block* try_block, Block* finally_block, int pos)
1311
      : TryStatement(index, try_block, pos),
1305 1312
        finally_block_(finally_block) { }
1306 1313

  
1307 1314
 private:
......
1314 1321
  DECLARE_NODE_TYPE(DebuggerStatement)
1315 1322

  
1316 1323
 protected:
1317
  DebuggerStatement() {}
1324
  explicit DebuggerStatement(int pos): Statement(pos) {}
1318 1325
};
1319 1326

  
1320 1327

  
......
1323 1330
  DECLARE_NODE_TYPE(EmptyStatement)
1324 1331

  
1325 1332
 protected:
1326
  EmptyStatement() {}
1333
  explicit EmptyStatement(int pos): Statement(pos) {}
1327 1334
};
1328 1335

  
1329 1336

  
......
1380 1387
  TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); }
1381 1388

  
1382 1389
 protected:
1383
  Literal(Isolate* isolate, Handle<Object> value)
1384
      : Expression(isolate),
1390
  Literal(
1391
      Isolate* isolate, Handle<Object> value, int position)
1392
      : Expression(isolate, position),
1385 1393
        value_(value),
1386 1394
        isolate_(isolate) { }
1387 1395

  
......
1411 1419
  MaterializedLiteral(Isolate* isolate,
1412 1420
                      int literal_index,
1413 1421
                      bool is_simple,
1414
                      int depth)
1415
      : Expression(isolate),
1422
                      int depth,
1423
                      int pos)
1424
      : Expression(isolate, pos),
1416 1425
        literal_index_(literal_index),
1417 1426
        is_simple_(is_simple),
1418 1427
        depth_(depth) {}
......
1510 1519
                bool fast_elements,
1511 1520
                int depth,
1512 1521
                bool may_store_doubles,
1513
                bool has_function)
1514
      : MaterializedLiteral(isolate, literal_index, is_simple, depth),
1522
                bool has_function,
1523
                int pos)
1524
      : MaterializedLiteral(isolate, literal_index, is_simple, depth, pos),
1515 1525
        constant_properties_(constant_properties),
1516 1526
        properties_(properties),
1517 1527
        fast_elements_(fast_elements),
......
1539 1549
  RegExpLiteral(Isolate* isolate,
1540 1550
                Handle<String> pattern,
1541 1551
                Handle<String> flags,
1542
                int literal_index)
1543
      : MaterializedLiteral(isolate, literal_index, false, 1),
1552
                int literal_index,
1553
                int pos)
1554
      : MaterializedLiteral(isolate, literal_index, false, 1, pos),
1544 1555
        pattern_(pattern),
1545 1556
        flags_(flags) {}
1546 1557

  
......
1549 1560
  Handle<String> flags_;
1550 1561
};
1551 1562

  
1563

  
1552 1564
// An array literal has a literals object that is used
1553 1565
// for minimizing the work when constructing it at runtime.
1554 1566
class ArrayLiteral V8_FINAL : public MaterializedLiteral {
......
1569 1581
               ZoneList<Expression*>* values,
1570 1582
               int literal_index,
1571 1583
               bool is_simple,
1572
               int depth)
1573
      : MaterializedLiteral(isolate, literal_index, is_simple, depth),
1584
               int depth,
1585
               int pos)
1586
      : MaterializedLiteral(isolate, literal_index, is_simple, depth, pos),
1574 1587
        constant_elements_(constant_elements),
1575 1588
        values_(values),
1576 1589
        first_element_id_(ReserveIdRange(isolate, values->length())) {}
......
1603 1616
  Handle<String> name() const { return name_; }
1604 1617
  Variable* var() const { return var_; }
1605 1618
  bool is_this() const { return is_this_; }
1606
  int position() const { return position_; }
1607 1619
  Interface* interface() const { return interface_; }
1608 1620

  
1609 1621

  
......
1614 1626
  void BindTo(Variable* var);
1615 1627

  
1616 1628
 protected:
1617
  VariableProxy(Isolate* isolate, Variable* var);
1629
  VariableProxy(Isolate* isolate, Variable* var, int position);
1618 1630

  
1619 1631
  VariableProxy(Isolate* isolate,
1620 1632
                Handle<String> name,
......
1629 1641
  // True if this variable proxy is being used in an assignment
1630 1642
  // or with a increment/decrement operator.
1631 1643
  bool is_lvalue_;
1632
  int position_;
1633 1644
  Interface* interface_;
1634 1645
};
1635 1646

  
......
1642 1653

  
1643 1654
  Expression* obj() const { return obj_; }
1644 1655
  Expression* key() const { return key_; }
1645
  virtual int position() const V8_OVERRIDE { return pos_; }
1646 1656

  
1647 1657
  BailoutId LoadId() const { return load_id_; }
1648 1658

  
1649
  bool IsStringLength() const { return is_string_length_; }
1650 1659
  bool IsStringAccess() const { return is_string_access_; }
1651 1660
  bool IsFunctionPrototype() const { return is_function_prototype_; }
1652 1661

  
......
1660 1669
    return STANDARD_STORE;
1661 1670
  }
1662 1671
  bool IsUninitialized() { return is_uninitialized_; }
1672
  bool IsPreMonomorphic() { return is_pre_monomorphic_; }
1673
  bool HasNoTypeInformation() {
1674
    return is_uninitialized_ || is_pre_monomorphic_;
1675
  }
1663 1676
  TypeFeedbackId PropertyFeedbackId() { return reuse(id()); }
1664 1677

  
1665 1678
 protected:
......
1667 1680
           Expression* obj,
1668 1681
           Expression* key,
1669 1682
           int pos)
1670
      : Expression(isolate),
1683
      : Expression(isolate, pos),
1671 1684
        obj_(obj),
1672 1685
        key_(key),
1673
        pos_(pos),
1674 1686
        load_id_(GetNextId(isolate)),
1675 1687
        is_monomorphic_(false),
1688
        is_pre_monomorphic_(false),
1676 1689
        is_uninitialized_(false),
1677
        is_string_length_(false),
1678 1690
        is_string_access_(false),
1679 1691
        is_function_prototype_(false) { }
1680 1692

  
1681 1693
 private:
1682 1694
  Expression* obj_;
1683 1695
  Expression* key_;
1684
  int pos_;
1685 1696
  const BailoutId load_id_;
1686 1697

  
1687 1698
  SmallMapList receiver_types_;
1688 1699
  bool is_monomorphic_ : 1;
1700
  bool is_pre_monomorphic_ : 1;
1689 1701
  bool is_uninitialized_ : 1;
1690
  bool is_string_length_ : 1;
1691 1702
  bool is_string_access_ : 1;
1692 1703
  bool is_function_prototype_ : 1;
1693 1704
};
......
1699 1710

  
1700 1711
  Expression* expression() const { return expression_; }
1701 1712
  ZoneList<Expression*>* arguments() const { return arguments_; }
1702
  virtual int position() const V8_FINAL { return pos_; }
1703 1713

  
1704 1714
  // Type feedback information.
1705 1715
  TypeFeedbackId CallFeedbackId() const { return reuse(id()); }
......
1754 1764
       Expression* expression,
1755 1765
       ZoneList<Expression*>* arguments,
1756 1766
       int pos)
1757
      : Expression(isolate),
1767
      : Expression(isolate, pos),
1758 1768
        expression_(expression),
1759 1769
        arguments_(arguments),
1760
        pos_(pos),
1761 1770
        is_monomorphic_(false),
1762 1771
        check_type_(RECEIVER_MAP_CHECK),
1763 1772
        return_id_(GetNextId(isolate)) { }
......
1765 1774
 private:
1766 1775
  Expression* expression_;
1767 1776
  ZoneList<Expression*>* arguments_;
1768
  int pos_;
1769 1777

  
1770 1778
  bool is_monomorphic_;
1771 1779
  CheckType check_type_;
......
1784 1792

  
1785 1793
  Expression* expression() const { return expression_; }
1786 1794
  ZoneList<Expression*>* arguments() const { return arguments_; }
1787
  virtual int position() const V8_OVERRIDE { return pos_; }
1788 1795

  
1789 1796
  // Type feedback information.
1790 1797
  TypeFeedbackId CallNewFeedbackId() const { return reuse(id()); }
......
1803 1810
          Expression* expression,
1804 1811
          ZoneList<Expression*>* arguments,
1805 1812
          int pos)
1806
      : Expression(isolate),
1813
      : Expression(isolate, pos),
1807 1814
        expression_(expression),
1808 1815
        arguments_(arguments),
1809
        pos_(pos),
1810 1816
        is_monomorphic_(false),
1811 1817
        elements_kind_(GetInitialFastElementsKind()),
1812 1818
        return_id_(GetNextId(isolate)) { }
......
1814 1820
 private:
1815 1821
  Expression* expression_;
1816 1822
  ZoneList<Expression*>* arguments_;
1817
  int pos_;
1818 1823

  
1819 1824
  bool is_monomorphic_;
1820 1825
  Handle<JSFunction> target_;
......
1844 1849
  CallRuntime(Isolate* isolate,
1845 1850
              Handle<String> name,
1846 1851
              const Runtime::Function* function,
1847
              ZoneList<Expression*>* arguments)
1848
      : Expression(isolate),
1852
              ZoneList<Expression*>* arguments,
1853
              int pos)
1854
      : Expression(isolate, pos),
1849 1855
        name_(name),
1850 1856
        function_(function),
1851 1857
        arguments_(arguments) { }
......
1863 1869

  
1864 1870
  Token::Value op() const { return op_; }
1865 1871
  Expression* expression() const { return expression_; }
1866
  virtual int position() const V8_OVERRIDE { return pos_; }
1867 1872

  
1868 1873
  BailoutId MaterializeTrueId() { return materialize_true_id_; }
1869 1874
  BailoutId MaterializeFalseId() { return materialize_false_id_; }
......
1876 1881
                 Token::Value op,
1877 1882
                 Expression* expression,
1878 1883
                 int pos)
1879
      : Expression(isolate),
1884
      : Expression(isolate, pos),
1880 1885
        op_(op),
1881 1886
        expression_(expression),
1882
        pos_(pos),
1883 1887
        materialize_true_id_(GetNextId(isolate)),
1884 1888
        materialize_false_id_(GetNextId(isolate)) {
1885 1889
    ASSERT(Token::IsUnaryOp(op));
......
1888 1892
 private:
1889 1893
  Token::Value op_;
1890 1894
  Expression* expression_;
1891
  int pos_;
1892 1895

  
1893 1896
  // For unary not (Token::NOT), the AST ids where true and false will
1894 1897
  // actually be materialized, respectively.
......
1906 1909
  Token::Value op() const { return op_; }
1907 1910
  Expression* left() const { return left_; }
1908 1911
  Expression* right() const { return right_; }
1909
  virtual int position() const V8_OVERRIDE { return pos_; }
1910 1912

  
1911 1913
  BailoutId RightId() const { return right_id_; }
1912 1914

  
......
1923 1925
                  Expression* left,
1924 1926
                  Expression* right,
1925 1927
                  int pos)
1926
      : Expression(isolate),
1928
      : Expression(isolate, pos),
1927 1929
        op_(op),
1928 1930
        left_(left),
1929 1931
        right_(right),
1930
        pos_(pos),
1931 1932
        right_id_(GetNextId(isolate)) {
1932 1933
    ASSERT(Token::IsBinaryOp(op));
1933 1934
  }
......
1936 1937
  Token::Value op_;
1937 1938
  Expression* left_;
1938 1939
  Expression* right_;
1939
  int pos_;
1940 1940

  
1941 1941
  // TODO(rossberg): the fixed arg should probably be represented as a Constant
1942 1942
  // type for the RHS.
......
1961 1961
  }
1962 1962

  
1963 1963
  Expression* expression() const { return expression_; }
1964
  virtual int position() const V8_OVERRIDE { return pos_; }
1965 1964

  
1966 1965
  void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone);
1967 1966
  virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; }
......
1971 1970
  virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE {
1972 1971
    return store_mode_;
1973 1972
  }
1974
  TypeInfo type() const { return type_; }
1973
  Handle<Type> type() const { return type_; }
1975 1974

  
1976 1975
  BailoutId AssignmentId() const { return assignment_id_; }
1977 1976

  
......
1984 1983
                 bool is_prefix,
1985 1984
                 Expression* expr,
1986 1985
                 int pos)
1987
      : Expression(isolate),
1986
      : Expression(isolate, pos),
1988 1987
        op_(op),
1989 1988
        is_prefix_(is_prefix),
1990 1989
        is_monomorphic_(false),
1991 1990
        store_mode_(STANDARD_STORE),
1992 1991
        expression_(expr),
1993
        pos_(pos),
1994 1992
        assignment_id_(GetNextId(isolate)),
1995 1993
        count_id_(GetNextId(isolate)) {}
1996 1994

  
......
2000 1998
  bool is_monomorphic_ : 1;
2001 1999
  KeyedAccessStoreMode store_mode_ : 5;  // Windows treats as signed,
2002 2000
                                         // must have extra bit.
2003
  TypeInfo type_;
2001
  Handle<Type> type_;
2004 2002

  
2005 2003
  Expression* expression_;
2006
  int pos_;
2007 2004
  const BailoutId assignment_id_;
2008 2005
  const TypeFeedbackId count_id_;
2009 2006
  SmallMapList receiver_types_;
......
2017 2014
  Token::Value op() const { return op_; }
2018 2015
  Expression* left() const { return left_; }
2019 2016
  Expression* right() const { return right_; }
2020
  virtual int position() const V8_OVERRIDE { return pos_; }
2021 2017

  
2022 2018
  // Type feedback information.
2023 2019
  TypeFeedbackId CompareOperationFeedbackId() const { return reuse(id()); }
......
2035 2031
                   Expression* left,
2036 2032
                   Expression* right,
2037 2033
                   int pos)
2038
      : Expression(isolate),
2034
      : Expression(isolate, pos),
2039 2035
        op_(op),
2040 2036
        left_(left),
2041 2037
        right_(right),
2042
        pos_(pos),
2043
        combined_type_(Type::Null(), isolate) {
2038
        combined_type_(Type::None(), isolate) {
2044 2039
    ASSERT(Token::IsCompareOp(op));
2045 2040
  }
2046 2041

  
......
2048 2043
  Token::Value op_;
2049 2044
  Expression* left_;
2050 2045
  Expression* right_;
2051
  int pos_;
2052 2046

  
2053 2047
  Handle<Type> combined_type_;
2054 2048
};
......
2062 2056
  Expression* then_expression() const { return then_expression_; }
2063 2057
  Expression* else_expression() const { return else_expression_; }
2064 2058

  
2065
  int then_expression_position() const { return then_expression_position_; }
2066
  int else_expression_position() const { return else_expression_position_; }
2067

  
2068 2059
  BailoutId ThenId() const { return then_id_; }
2069 2060
  BailoutId ElseId() const { return else_id_; }
2070 2061

  
......
2073 2064
              Expression* condition,
2074 2065
              Expression* then_expression,
2075 2066
              Expression* else_expression,
2076
              int then_expression_position,
2077
              int else_expression_position)
2078
      : Expression(isolate),
2067
              int position)
2068
      : Expression(isolate, position),
2079 2069
        condition_(condition),
2080 2070
        then_expression_(then_expression),
2081 2071
        else_expression_(else_expression),
2082
        then_expression_position_(then_expression_position),
2083
        else_expression_position_(else_expression_position),
2084 2072
        then_id_(GetNextId(isolate)),
2085 2073
        else_id_(GetNextId(isolate)) { }
2086 2074

  
......
2088 2076
  Expression* condition_;
2089 2077
  Expression* then_expression_;
2090 2078
  Expression* else_expression_;
2091
  int then_expression_position_;
2092
  int else_expression_position_;
2093 2079
  const BailoutId then_id_;
2094 2080
  const BailoutId else_id_;
2095 2081
};
......
2106 2092
  Token::Value op() const { return op_; }
2107 2093
  Expression* target() const { return target_; }
2108 2094
  Expression* value() const { return value_; }
2109
  virtual int position() const V8_OVERRIDE { return pos_; }
2110 2095
  BinaryOperation* binary_operation() const { return binary_operation_; }
2111 2096

  
2112 2097
  // This check relies on the definition order of token in token.h.
......
2119 2104
  void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone);
2120 2105
  virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; }
2121 2106
  bool IsUninitialized() { return is_uninitialized_; }
2107
  bool IsPreMonomorphic() { return is_pre_monomorphic_; }
2108
  bool HasNoTypeInformation() {
2109
    return is_uninitialized_ || is_pre_monomorphic_;
2110
  }
2122 2111
  virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE {
2123 2112
    return &receiver_types_;
2124 2113
  }
......
2137 2126
  void Init(Isolate* isolate, AstNodeFactory<Visitor>* factory) {
2138 2127
    ASSERT(Token::IsAssignmentOp(op_));
2139 2128
    if (is_compound()) {
2140
      binary_operation_ =
2141
          factory->NewBinaryOperation(binary_op(), target_, value_, pos_ + 1);
2129
      binary_operation_ = factory->NewBinaryOperation(
2130
          binary_op(), target_, value_, position() + 1);
2142 2131
    }
2143 2132
  }
2144 2133

  
......
2146 2135
  Token::Value op_;
2147 2136
  Expression* target_;
2148 2137
  Expression* value_;
2149
  int pos_;
2150 2138
  BinaryOperation* binary_operation_;
2151 2139
  const BailoutId assignment_id_;
2152 2140

  
2153 2141
  bool is_monomorphic_ : 1;
2154 2142
  bool is_uninitialized_ : 1;
2143
  bool is_pre_monomorphic_ : 1;
2155 2144
  KeyedAccessStoreMode store_mode_ : 5;  // Windows treats as signed,
2156 2145
                                         // must have extra bit.
2157 2146
  SmallMapList receiver_types_;
......
2172 2161
  Expression* generator_object() const { return generator_object_; }
2173 2162
  Expression* expression() const { return expression_; }
2174 2163
  Kind yield_kind() const { return yield_kind_; }
2175
  virtual int position() const V8_OVERRIDE { return pos_; }
2176 2164

  
2177 2165
  // Delegating yield surrounds the "yield" in a "try/catch".  This index
2178 2166
  // locates the catch handler in the handler table, and is equivalent to
......
2192 2180
        Expression* expression,
2193 2181
        Kind yield_kind,
2194 2182
        int pos)
2195
      : Expression(isolate),
2183
      : Expression(isolate, pos),
2196 2184
        generator_object_(generator_object),
2197 2185
        expression_(expression),
2198 2186
        yield_kind_(yield_kind),
2199
        index_(-1),
2200
        pos_(pos) { }
2187
        index_(-1) { }
2201 2188

  
2202 2189
 private:
2203 2190
  Expression* generator_object_;
2204 2191
  Expression* expression_;
2205 2192
  Kind yield_kind_;
2206 2193
  int index_;
2207
  int pos_;
2208 2194
};
2209 2195

  
2210 2196

  
......
2213 2199
  DECLARE_NODE_TYPE(Throw)
2214 2200

  
2215 2201
  Expression* exception() const { return exception_; }
2216
  virtual int position() const V8_OVERRIDE { return pos_; }
2217 2202

  
2218 2203
 protected:
2219 2204
  Throw(Isolate* isolate, Expression* exception, int pos)
2220
      : Expression(isolate), exception_(exception), pos_(pos) {}
2205
      : Expression(isolate, pos), exception_(exception) {}
2221 2206

  
2222 2207
 private:
2223 2208
  Expression* exception_;
2224
  int pos_;
2225 2209
};
2226 2210

  
2227 2211

  
......
2336 2320
                  ParameterFlag has_duplicate_parameters,
2337 2321
                  IsFunctionFlag is_function,
2338 2322
                  IsParenthesizedFlag is_parenthesized,
2339
                  IsGeneratorFlag is_generator)
2340
      : Expression(isolate),
2323
                  IsGeneratorFlag is_generator,
2324
                  int position)
2325
      : Expression(isolate, position),
2341 2326
        name_(name),
2342 2327
        scope_(scope),
2343 2328
        body_(body),
......
2383 2368
};
2384 2369

  
2385 2370

  
2386
class SharedFunctionInfoLiteral V8_FINAL : public Expression {
2371
class NativeFunctionLiteral V8_FINAL : public Expression {
2387 2372
 public:
2388
  DECLARE_NODE_TYPE(SharedFunctionInfoLiteral)
2373
  DECLARE_NODE_TYPE(NativeFunctionLiteral)
2389 2374

  
2390
  Handle<SharedFunctionInfo> shared_function_info() const {
2391
    return shared_function_info_;
2392
  }
2375
  Handle<String> name() const { return name_; }
2376
  v8::Extension* extension() const { return extension_; }
2393 2377

  
2394 2378
 protected:
2395
  SharedFunctionInfoLiteral(
2396
      Isolate* isolate,
2397
      Handle<SharedFunctionInfo> shared_function_info)
2398
      : Expression(isolate),
2399
        shared_function_info_(shared_function_info) { }
2379
  NativeFunctionLiteral(
2380
      Isolate* isolate, Handle<String> name, v8::Extension* extension, int pos)
2381
      : Expression(isolate, pos), name_(name), extension_(extension) {}
2400 2382

  
2401 2383
 private:
2402
  Handle<SharedFunctionInfo> shared_function_info_;
2384
  Handle<String> name_;
2385
  v8::Extension* extension_;
2403 2386
};
2404 2387

  
2405 2388

  
......
2408 2391
  DECLARE_NODE_TYPE(ThisFunction)
2409 2392

  
2410 2393
 protected:
2411
  explicit ThisFunction(Isolate* isolate): Expression(isolate) {}
2394
  explicit ThisFunction(Isolate* isolate, int pos): Expression(isolate, pos) {}
2412 2395
};
2413 2396

  
2414 2397
#undef DECLARE_NODE_TYPE
......
2775 2758
// ----------------------------------------------------------------------------
2776 2759
// Out-of-line inline constructors (to side-step cyclic dependencies).
2777 2760

  
2778
inline ModuleVariable::ModuleVariable(VariableProxy* proxy)
2779
    : Module(proxy->interface()),
2761
inline ModuleVariable::ModuleVariable(VariableProxy* proxy, int pos)
2762
    : Module(proxy->interface(), pos),
2780 2763
      proxy_(proxy) {
2781 2764
}
2782 2765

  
......
2893 2876

  
2894 2877
  VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy,
2895 2878
                                              VariableMode mode,
2896
                                              Scope* scope) {
2879
                                              Scope* scope,
2880
                                              int pos) {
2897 2881
    VariableDeclaration* decl =
2898
        new(zone_) VariableDeclaration(proxy, mode, scope);
2882
        new(zone_) VariableDeclaration(proxy, mode, scope, pos);
2899 2883
    VISIT_AND_RETURN(VariableDeclaration, decl)
2900 2884
  }
2901 2885

  
2902 2886
  FunctionDeclaration* NewFunctionDeclaration(VariableProxy* proxy,
2903 2887
                                              VariableMode mode,
2904 2888
                                              FunctionLiteral* fun,
2905
                                              Scope* scope) {
2889
                                              Scope* scope,
2890
                                              int pos) {
2906 2891
    FunctionDeclaration* decl =
2907
        new(zone_) FunctionDeclaration(proxy, mode, fun, scope);
2892
        new(zone_) FunctionDeclaration(proxy, mode, fun, scope, pos);
2908 2893
    VISIT_AND_RETURN(FunctionDeclaration, decl)
2909 2894
  }
2910 2895

  
2911 2896
  ModuleDeclaration* NewModuleDeclaration(VariableProxy* proxy,
2912 2897
                                          Module* module,
2913
                                          Scope* scope) {
2898
                                          Scope* scope,
2899
                                          int pos) {
2914 2900
    ModuleDeclaration* decl =
2915
        new(zone_) ModuleDeclaration(proxy, module, scope);
2901
        new(zone_) ModuleDeclaration(proxy, module, scope, pos);
2916 2902
    VISIT_AND_RETURN(ModuleDeclaration, decl)
2917 2903
  }
2918 2904

  
2919 2905
  ImportDeclaration* NewImportDeclaration(VariableProxy* proxy,
2920 2906
                                          Module* module,
2921
                                          Scope* scope) {
2907
                                          Scope* scope,
2908
                                          int pos) {
2922 2909
    ImportDeclaration* decl =
2923
        new(zone_) ImportDeclaration(proxy, module, scope);
2910
        new(zone_) ImportDeclaration(proxy, module, scope, pos);
2924 2911
    VISIT_AND_RETURN(ImportDeclaration, decl)
2925 2912
  }
2926 2913

  
2927 2914
  ExportDeclaration* NewExportDeclaration(VariableProxy* proxy,
2928
                                          Scope* scope) {
2915
                                          Scope* scope,
2916
                                          int pos) {
2929 2917
    ExportDeclaration* decl =
2930
        new(zone_) ExportDeclaration(proxy, scope);
2918
        new(zone_) ExportDeclaration(proxy, scope, pos);
2931 2919
    VISIT_AND_RETURN(ExportDeclaration, decl)
2932 2920
  }
2933 2921

  
2934
  ModuleLiteral* NewModuleLiteral(Block* body, Interface* interface) {
2935
    ModuleLiteral* module = new(zone_) ModuleLiteral(body, interface);
2922
  ModuleLiteral* NewModuleLiteral(Block* body, Interface* interface, int pos) {
2923
    ModuleLiteral* module = new(zone_) ModuleLiteral(body, interface, pos);
2936 2924
    VISIT_AND_RETURN(ModuleLiteral, module)
2937 2925
  }
2938 2926

  
2939
  ModuleVariable* NewModuleVariable(VariableProxy* proxy) {
2940
    ModuleVariable* module = new(zone_) ModuleVariable(proxy);
2927
  ModuleVariable* NewModuleVariable(VariableProxy* proxy, int pos) {
2928
    ModuleVariable* module = new(zone_) ModuleVariable(proxy, pos);
2941 2929
    VISIT_AND_RETURN(ModuleVariable, module)
2942 2930
  }
2943 2931

  
2944
  ModulePath* NewModulePath(Module* origin, Handle<String> name) {
2945
    ModulePath* module = new(zone_) ModulePath(origin, name, zone_);
2932
  ModulePath* NewModulePath(Module* origin, Handle<String> name, int pos) {
2933
    ModulePath* module = new(zone_) ModulePath(origin, name, zone_, pos);
2946 2934
    VISIT_AND_RETURN(ModulePath, module)
2947 2935
  }
2948 2936

  
2949
  ModuleUrl* NewModuleUrl(Handle<String> url) {
2950
    ModuleUrl* module = new(zone_) ModuleUrl(url, zone_);
2937
  ModuleUrl* NewModuleUrl(Handle<String> url, int pos) {
2938
    ModuleUrl* module = new(zone_) ModuleUrl(url, zone_, pos);
2951 2939
    VISIT_AND_RETURN(ModuleUrl, module)
2952 2940
  }
2953 2941

  
2954 2942
  Block* NewBlock(ZoneStringList* labels,
2955 2943
                  int capacity,
2956
                  bool is_initializer_block) {
2944
                  bool is_initializer_block,
2945
                  int pos) {
2957 2946
    Block* block = new(zone_) Block(
2958
        isolate_, labels, capacity, is_initializer_block, zone_);
2947
        isolate_, labels, capacity, is_initializer_block, pos, zone_);
2959 2948
    VISIT_AND_RETURN(Block, block)
2960 2949
  }
2961 2950

  
2962 2951
#define STATEMENT_WITH_LABELS(NodeType) \
2963
  NodeType* New##NodeType(ZoneStringList* labels) { \
2964
    NodeType* stmt = new(zone_) NodeType(isolate_, labels); \
2952
  NodeType* New##NodeType(ZoneStringList* labels, int pos) { \
2953
    NodeType* stmt = new(zone_) NodeType(isolate_, labels, pos); \
2965 2954
    VISIT_AND_RETURN(NodeType, stmt); \
2966 2955
  }
2967 2956
  STATEMENT_WITH_LABELS(DoWhileStatement)
......
2971 2960
#undef STATEMENT_WITH_LABELS
2972 2961

  
2973 2962
  ForEachStatement* NewForEachStatement(ForEachStatement::VisitMode visit_mode,
2974
                                        ZoneStringList* labels) {
2963
                                        ZoneStringList* labels,
2964
                                        int pos) {
2975 2965
    switch (visit_mode) {
2976 2966
      case ForEachStatement::ENUMERATE: {
2977
        ForInStatement* stmt = new(zone_) ForInStatement(isolate_, labels);
2967
        ForInStatement* stmt = new(zone_) ForInStatement(isolate_, labels, pos);
2978 2968
        VISIT_AND_RETURN(ForInStatement, stmt);
2979 2969
      }
2980 2970
      case ForEachStatement::ITERATE: {
2981
        ForOfStatement* stmt = new(zone_) ForOfStatement(isolate_, labels);
2971
        ForOfStatement* stmt = new(zone_) ForOfStatement(isolate_, labels, pos);
2982 2972
        VISIT_AND_RETURN(ForOfStatement, stmt);
2983 2973
      }
2984 2974
    }
......
2986 2976
    return NULL;
2987 2977
  }
2988 2978

  
2989
  ModuleStatement* NewModuleStatement(VariableProxy* proxy, Block* body) {
2990
    ModuleStatement* stmt = new(zone_) ModuleStatement(proxy, body);
2979
  ModuleStatement* NewModuleStatement(
2980
      VariableProxy* proxy, Block* body, int pos) {
2981
    ModuleStatement* stmt = new(zone_) ModuleStatement(proxy, body, pos);
2991 2982
    VISIT_AND_RETURN(ModuleStatement, stmt)
2992 2983
  }
2993 2984

  
2994
  ExpressionStatement* NewExpressionStatement(Expression* expression) {
2995
    ExpressionStatement* stmt = new(zone_) ExpressionStatement(expression);
2985
  ExpressionStatement* NewExpressionStatement(Expression* expression, int pos) {
2986
    ExpressionStatement* stmt = new(zone_) ExpressionStatement(expression, pos);
2996 2987
    VISIT_AND_RETURN(ExpressionStatement, stmt)
2997 2988
  }
2998 2989

  
2999
  ContinueStatement* NewContinueStatement(IterationStatement* target) {
3000
    ContinueStatement* stmt = new(zone_) ContinueStatement(target);
2990
  ContinueStatement* NewContinueStatement(IterationStatement* target, int pos) {
2991
    ContinueStatement* stmt = new(zone_) ContinueStatement(target, pos);
3001 2992
    VISIT_AND_RETURN(ContinueStatement, stmt)
3002 2993
  }
3003 2994

  
3004
  BreakStatement* NewBreakStatement(BreakableStatement* target) {
3005
    BreakStatement* stmt = new(zone_) BreakStatement(target);
2995
  BreakStatement* NewBreakStatement(BreakableStatement* target, int pos) {
2996
    BreakStatement* stmt = new(zone_) BreakStatement(target, pos);
3006 2997
    VISIT_AND_RETURN(BreakStatement, stmt)
3007 2998
  }
3008 2999

  
3009
  ReturnStatement* NewReturnStatement(Expression* expression) {
3010
    ReturnStatement* stmt = new(zone_) ReturnStatement(expression);
3000
  ReturnStatement* NewReturnStatement(Expression* expression, int pos) {
3001
    ReturnStatement* stmt = new(zone_) ReturnStatement(expression, pos);
3011 3002
    VISIT_AND_RETURN(ReturnStatement, stmt)
3012 3003
  }
3013 3004

  
3014 3005
  WithStatement* NewWithStatement(Scope* scope,
3015 3006
                                  Expression* expression,
3016
                                  Statement* statement) {
3007
                                  Statement* statement,
3008
                                  int pos) {
3017 3009
    WithStatement* stmt = new(zone_) WithStatement(
3018
        scope, expression, statement);
3010
        scope, expression, statement, pos);
3019 3011
    VISIT_AND_RETURN(WithStatement, stmt)
3020 3012
  }
3021 3013

  
3022 3014
  IfStatement* NewIfStatement(Expression* condition,
3023 3015
                              Statement* then_statement,
3024
                              Statement* else_statement) {
3016
                              Statement* else_statement,
3017
                              int pos) {
3025 3018
    IfStatement* stmt = new(zone_) IfStatement(
3026
        isolate_, condition, then_statement, else_statement);
3019
        isolate_, condition, then_statement, else_statement, pos);
3027 3020
    VISIT_AND_RETURN(IfStatement, stmt)
3028 3021
  }
3029 3022

  
......
3031 3024
                                          Block* try_block,
3032 3025
                                          Scope* scope,
3033 3026
                                          Variable* variable,
3034
                                          Block* catch_block) {
3027
                                          Block* catch_block,
3028
                                          int pos) {
3035 3029
    TryCatchStatement* stmt = new(zone_) TryCatchStatement(
3036
        index, try_block, scope, variable, catch_block);
3030
        index, try_block, scope, variable, catch_block, pos);
3037 3031
    VISIT_AND_RETURN(TryCatchStatement, stmt)
3038 3032
  }
3039 3033

  
3040 3034
  TryFinallyStatement* NewTryFinallyStatement(int index,
3041 3035
                                              Block* try_block,
3042
                                              Block* finally_block) {
3036
                                              Block* finally_block,
3037
                                              int pos) {
3043 3038
    TryFinallyStatement* stmt =
3044
        new(zone_) TryFinallyStatement(index, try_block, finally_block);
3039
        new(zone_) TryFinallyStatement(index, try_block, finally_block, pos);
3045 3040
    VISIT_AND_RETURN(TryFinallyStatement, stmt)
3046 3041
  }
3047 3042

  
3048
  DebuggerStatement* NewDebuggerStatement() {
3049
    DebuggerStatement* stmt = new(zone_) DebuggerStatement();
3043
  DebuggerStatement* NewDebuggerStatement(int pos) {
3044
    DebuggerStatement* stmt = new(zone_) DebuggerStatement(pos);
3050 3045
    VISIT_AND_RETURN(DebuggerStatement, stmt)
3051 3046
  }
3052 3047

  
3053
  EmptyStatement* NewEmptyStatement() {
3054
    return new(zone_) EmptyStatement();
3048
  EmptyStatement* NewEmptyStatement(int pos) {
3049
    return new(zone_) EmptyStatement(pos);
3050
  }
3051

  
3052
  CaseClause* NewCaseClause(
3053
      Expression* label, ZoneList<Statement*>* statements, int pos) {
3054
    CaseClause* clause =
3055
        new(zone_) CaseClause(isolate_, label, statements, pos);
3056
    VISIT_AND_RETURN(CaseClause, clause)
3055 3057
  }
3056 3058

  
3057
  Literal* NewLiteral(Handle<Object> handle) {
3058
    Literal* lit = new(zone_) Literal(isolate_, handle);
3059
  Literal* NewLiteral(Handle<Object> handle, int pos) {
3060
    Literal* lit = new(zone_) Literal(isolate_, handle, pos);
3059 3061
    VISIT_AND_RETURN(Literal, lit)
3060 3062
  }
3061 3063

  
3062
  Literal* NewNumberLiteral(double number) {
3063
    return NewLiteral(isolate_->factory()->NewNumber(number, TENURED));
3064
  Literal* NewNumberLiteral(double number, int pos) {
3065
    return NewLiteral(isolate_->factory()->NewNumber(number, TENURED), pos);
3064 3066
  }
3065 3067

  
3066 3068
  ObjectLiteral* NewObjectLiteral(
......
3071 3073
      bool fast_elements,
3072 3074
      int depth,
3073 3075
      bool may_store_doubles,
3074
      bool has_function) {
3076
      bool has_function,
3077
      int pos) {
3075 3078
    ObjectLiteral* lit = new(zone_) ObjectLiteral(
3076 3079
        isolate_, constant_properties, properties, literal_index,
3077
        is_simple, fast_elements, depth, may_store_doubles, has_function);
3080
        is_simple, fast_elements, depth, may_store_doubles, has_function, pos);
3078 3081
    VISIT_AND_RETURN(ObjectLiteral, lit)
3079 3082
  }
3080 3083

  
3081 3084
  ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter,
3082
                                                    FunctionLiteral* value) {
3085
                                                    FunctionLiteral* value,
3086
                                                    int pos) {
3083 3087
    ObjectLiteral::Property* prop =
3084 3088
        new(zone_) ObjectLiteral::Property(is_getter, value);
3085
    prop->set_key(NewLiteral(value->name()));
3089
    prop->set_key(NewLiteral(value->name(), pos));
3086 3090
    return prop;  // Not an AST node, will not be visited.
3087 3091
  }
3088 3092

  
3089 3093
  RegExpLiteral* NewRegExpLiteral(Handle<String> pattern,
3090 3094
                                  Handle<String> flags,
3091
                                  int literal_index) {
3095
                                  int literal_index,
3096
                                  int pos) {
3092 3097
    RegExpLiteral* lit =
3093
        new(zone_) RegExpLiteral(isolate_, pattern, flags, literal_index);
3098
        new(zone_) RegExpLiteral(isolate_, pattern, flags, literal_index, pos);
3094 3099
    VISIT_AND_RETURN(RegExpLiteral, lit);
3095 3100
  }
3096 3101

  
......
3098 3103
                                ZoneList<Expression*>* values,
3099 3104
                                int literal_index,
3100 3105
                                bool is_simple,
3101
                                int depth) {
3106
                                int depth,
3107
                                int pos) {
3102 3108
    ArrayLiteral* lit = new(zone_) ArrayLiteral(
3103
        isolate_, constant_elements, values, literal_index, is_simple, depth);
3109
        isolate_, constant_elements, values, literal_index, is_simple,
3110
        depth, pos);
3104 3111
    VISIT_AND_RETURN(ArrayLiteral, lit)
3105 3112
  }
3106 3113

  
3107
  VariableProxy* NewVariableProxy(Variable* var) {
3108
    VariableProxy* proxy = new(zone_) VariableProxy(isolate_, var);
3114
  VariableProxy* NewVariableProxy(Variable* var,
3115
                                  int pos = RelocInfo::kNoPosition) {
3116
    VariableProxy* proxy = new(zone_) VariableProxy(isolate_, var, pos);
3109 3117
    VISIT_AND_RETURN(VariableProxy, proxy)
3110 3118
  }
3111 3119

  
......
3139 3147

  
3140 3148
  CallRuntime* NewCallRuntime(Handle<String> name,
3141 3149
                              const Runtime::Function* function,
3142
                              ZoneList<Expression*>* arguments) {
3150
                              ZoneList<Expression*>* arguments,
3151
                              int pos) {
3143 3152
    CallRuntime* call =
3144
        new(zone_) CallRuntime(isolate_, name, function, arguments);
3153
        new(zone_) CallRuntime(isolate_, name, function, arguments, pos);
3145 3154
    VISIT_AND_RETURN(CallRuntime, call)
3146 3155
  }
3147 3156

  
......
3183 3192
  Conditional* NewConditional(Expression* condition,
3184 3193
                              Expression* then_expression,
3185 3194
                              Expression* else_expression,
3186
                              int then_expression_position,
3187
                              int else_expression_position) {
3195
                              int position) {
3188 3196
    Conditional* cond = new(zone_) Conditional(
3189
        isolate_, condition, then_expression, else_expression,
3190
        then_expression_position, else_expression_position);
3197
        isolate_, condition, then_expression, else_expression, position);
3191 3198
    VISIT_AND_RETURN(Conditional, cond)
3192 3199
  }
3193 3200

  
......
3227 3234
      FunctionLiteral::FunctionType function_type,
3228 3235
      FunctionLiteral::IsFunctionFlag is_function,
3229 3236
      FunctionLiteral::IsParenthesizedFlag is_parenthesized,
3230
      FunctionLiteral::IsGeneratorFlag is_generator) {
3237
      FunctionLiteral::IsGeneratorFlag is_generator,
3238
      int position) {
3231 3239
    FunctionLiteral* lit = new(zone_) FunctionLiteral(
3232 3240
        isolate_, name, scope, body,
3233 3241
        materialized_literal_count, expected_property_count, handler_count,
3234 3242
        parameter_count, function_type, has_duplicate_parameters, is_function,
3235
        is_parenthesized, is_generator);
3243
        is_parenthesized, is_generator, position);
3236 3244
    // Top-level literal doesn't count for the AST's properties.
3237 3245
    if (is_function == FunctionLiteral::kIsFunction) {
3238 3246
      visitor_.VisitFunctionLiteral(lit);
......
3240 3248
    return lit;
3241 3249
  }
3242 3250

  
3243
  SharedFunctionInfoLiteral* NewSharedFunctionInfoLiteral(
3244
      Handle<SharedFunctionInfo> shared_function_info) {
3245
    SharedFunctionInfoLiteral* lit =
3246
        new(zone_) SharedFunctionInfoLiteral(isolate_, shared_function_info);
3247
    VISIT_AND_RETURN(SharedFunctionInfoLiteral, lit)
3251
  NativeFunctionLiteral* NewNativeFunctionLiteral(
3252
      Handle<String> name, v8::Extension* extension, int pos) {
3253
    NativeFunctionLiteral* lit =
3254
        new(zone_) NativeFunctionLiteral(isolate_, name, extension, pos);
3255
    VISIT_AND_RETURN(NativeFunctionLiteral, lit)
3248 3256
  }
3249 3257

  
3250
  ThisFunction* NewThisFunction() {
3251
    ThisFunction* fun = new(zone_) ThisFunction(isolate_);
3258
  ThisFunction* NewThisFunction(int pos) {
3259
    ThisFunction* fun = new(zone_) ThisFunction(isolate_, pos);
3252 3260
    VISIT_AND_RETURN(ThisFunction, fun)
3253 3261
  }
3254 3262

  

Also available in: Unified diff