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 #ifndef V8_PARSING_PARSER_BASE_H | 5 #ifndef V8_PARSING_PARSER_BASE_H |
6 #define V8_PARSING_PARSER_BASE_H | 6 #define V8_PARSING_PARSER_BASE_H |
7 | 7 |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
10 #include "src/hashmap.h" | 10 #include "src/hashmap.h" |
(...skipping 2205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2216 Token::Value cmp = op; | 2216 Token::Value cmp = op; |
2217 switch (op) { | 2217 switch (op) { |
2218 case Token::NE: cmp = Token::EQ; break; | 2218 case Token::NE: cmp = Token::EQ; break; |
2219 case Token::NE_STRICT: cmp = Token::EQ_STRICT; break; | 2219 case Token::NE_STRICT: cmp = Token::EQ_STRICT; break; |
2220 default: break; | 2220 default: break; |
2221 } | 2221 } |
2222 if (cmp == Token::EQ && is_strong(language_mode())) { | 2222 if (cmp == Token::EQ && is_strong(language_mode())) { |
2223 ReportMessageAt(op_location, MessageTemplate::kStrongEqual); | 2223 ReportMessageAt(op_location, MessageTemplate::kStrongEqual); |
2224 *ok = false; | 2224 *ok = false; |
2225 return this->EmptyExpression(); | 2225 return this->EmptyExpression(); |
| 2226 } else if (FLAG_harmony_instanceof && cmp == Token::INSTANCEOF) { |
| 2227 x = Traits::RewriteInstanceof(x, y, pos); |
| 2228 } else { |
| 2229 x = factory()->NewCompareOperation(cmp, x, y, pos); |
| 2230 if (cmp != op) { |
| 2231 // The comparison was negated - add a NOT. |
| 2232 x = factory()->NewUnaryOperation(Token::NOT, x, pos); |
| 2233 } |
2226 } | 2234 } |
2227 x = factory()->NewCompareOperation(cmp, x, y, pos); | |
2228 if (cmp != op) { | |
2229 // The comparison was negated - add a NOT. | |
2230 x = factory()->NewUnaryOperation(Token::NOT, x, pos); | |
2231 } | |
2232 | |
2233 } else { | 2235 } else { |
2234 // We have a "normal" binary operation. | 2236 // We have a "normal" binary operation. |
2235 x = factory()->NewBinaryOperation(op, x, y, pos); | 2237 x = factory()->NewBinaryOperation(op, x, y, pos); |
2236 } | 2238 } |
2237 } | 2239 } |
2238 } | 2240 } |
2239 return x; | 2241 return x; |
2240 } | 2242 } |
2241 | 2243 |
2242 | 2244 |
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3345 return; | 3347 return; |
3346 } | 3348 } |
3347 has_seen_constructor_ = true; | 3349 has_seen_constructor_ = true; |
3348 return; | 3350 return; |
3349 } | 3351 } |
3350 } | 3352 } |
3351 } // namespace internal | 3353 } // namespace internal |
3352 } // namespace v8 | 3354 } // namespace v8 |
3353 | 3355 |
3354 #endif // V8_PARSING_PARSER_BASE_H | 3356 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |