OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/ast.h" | 5 #include "src/ast.h" |
6 | 6 |
7 #include <cmath> // For isfinite. | 7 #include <cmath> // For isfinite. |
8 #include "src/builtins.h" | 8 #include "src/builtins.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/contexts.h" | 10 #include "src/contexts.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } | 98 } |
99 | 99 |
100 | 100 |
101 Assignment::Assignment(Zone* zone, Token::Value op, Expression* target, | 101 Assignment::Assignment(Zone* zone, Token::Value op, Expression* target, |
102 Expression* value, int pos, IdGen* id_gen) | 102 Expression* value, int pos, IdGen* id_gen) |
103 : Expression(zone, pos, id_gen), | 103 : Expression(zone, pos, id_gen), |
104 op_(op), | 104 op_(op), |
105 target_(target), | 105 target_(target), |
106 value_(value), | 106 value_(value), |
107 binary_operation_(NULL), | 107 binary_operation_(NULL), |
108 assignment_id_(id_gen->GetNextId()), | |
109 is_uninitialized_(false), | 108 is_uninitialized_(false), |
110 store_mode_(STANDARD_STORE) {} | 109 store_mode_(STANDARD_STORE) { |
| 110 #ifdef DEBUG |
| 111 int assignment_id = |
| 112 #endif |
| 113 id_gen->ReserveIdRange(kClassIdRange); // reserve assignment id |
| 114 DCHECK(assignment_id == AssignmentId().ToInt()); |
| 115 } |
111 | 116 |
112 | 117 |
113 Token::Value Assignment::binary_op() const { | 118 Token::Value Assignment::binary_op() const { |
114 switch (op_) { | 119 switch (op_) { |
115 case Token::ASSIGN_BIT_OR: return Token::BIT_OR; | 120 case Token::ASSIGN_BIT_OR: return Token::BIT_OR; |
116 case Token::ASSIGN_BIT_XOR: return Token::BIT_XOR; | 121 case Token::ASSIGN_BIT_XOR: return Token::BIT_XOR; |
117 case Token::ASSIGN_BIT_AND: return Token::BIT_AND; | 122 case Token::ASSIGN_BIT_AND: return Token::BIT_AND; |
118 case Token::ASSIGN_SHL: return Token::SHL; | 123 case Token::ASSIGN_SHL: return Token::SHL; |
119 case Token::ASSIGN_SAR: return Token::SAR; | 124 case Token::ASSIGN_SAR: return Token::SAR; |
120 case Token::ASSIGN_SHR: return Token::SHR; | 125 case Token::ASSIGN_SHR: return Token::SHR; |
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 max_match_ = IncreaseBy(max_match_, node_max_match); | 990 max_match_ = IncreaseBy(max_match_, node_max_match); |
986 } | 991 } |
987 } | 992 } |
988 | 993 |
989 | 994 |
990 CaseClause::CaseClause(Zone* zone, Expression* label, | 995 CaseClause::CaseClause(Zone* zone, Expression* label, |
991 ZoneList<Statement*>* statements, int pos, IdGen* id_gen) | 996 ZoneList<Statement*>* statements, int pos, IdGen* id_gen) |
992 : Expression(zone, pos, id_gen), | 997 : Expression(zone, pos, id_gen), |
993 label_(label), | 998 label_(label), |
994 statements_(statements), | 999 statements_(statements), |
995 compare_type_(Type::None(zone)), | 1000 compare_type_(Type::None(zone)) { |
996 compare_id_(id_gen->GetNextId()), | 1001 #ifdef DEBUG |
997 entry_id_(id_gen->GetNextId()) {} | 1002 int compare_id = |
998 | 1003 #endif |
| 1004 id_gen->ReserveIdRange(kClassIdRange); |
| 1005 DCHECK(compare_id == CompareId().ToInt()); |
| 1006 } |
999 | 1007 |
1000 #define REGULAR_NODE(NodeType) \ | 1008 #define REGULAR_NODE(NodeType) \ |
1001 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ | 1009 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ |
1002 increase_node_count(); \ | 1010 increase_node_count(); \ |
1003 } | 1011 } |
1004 #define REGULAR_NODE_WITH_FEEDBACK_SLOTS(NodeType) \ | 1012 #define REGULAR_NODE_WITH_FEEDBACK_SLOTS(NodeType) \ |
1005 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ | 1013 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ |
1006 increase_node_count(); \ | 1014 increase_node_count(); \ |
1007 add_slot_node(node); \ | 1015 add_slot_node(node); \ |
1008 } | 1016 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1126 SNPrintF(buffer, "%d", Smi::cast(*value())->value()); | 1134 SNPrintF(buffer, "%d", Smi::cast(*value())->value()); |
1127 str = arr; | 1135 str = arr; |
1128 } else { | 1136 } else { |
1129 str = DoubleToCString(value()->Number(), buffer); | 1137 str = DoubleToCString(value()->Number(), buffer); |
1130 } | 1138 } |
1131 return isolate_->factory()->NewStringFromAsciiChecked(str); | 1139 return isolate_->factory()->NewStringFromAsciiChecked(str); |
1132 } | 1140 } |
1133 | 1141 |
1134 | 1142 |
1135 } } // namespace v8::internal | 1143 } } // namespace v8::internal |
OLD | NEW |