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 2543 matching lines...) Loading... |
2554 // operations. (We could combine the two and get rid of this | 2554 // operations. (We could combine the two and get rid of this |
2555 // code and AST node eventually.) | 2555 // code and AST node eventually.) |
2556 if (Token::IsCompareOp(op)) { | 2556 if (Token::IsCompareOp(op)) { |
2557 // We have a comparison. | 2557 // We have a comparison. |
2558 Token::Value cmp = op; | 2558 Token::Value cmp = op; |
2559 switch (op) { | 2559 switch (op) { |
2560 case Token::NE: cmp = Token::EQ; break; | 2560 case Token::NE: cmp = Token::EQ; break; |
2561 case Token::NE_STRICT: cmp = Token::EQ_STRICT; break; | 2561 case Token::NE_STRICT: cmp = Token::EQ_STRICT; break; |
2562 default: break; | 2562 default: break; |
2563 } | 2563 } |
2564 if (FLAG_harmony_instanceof && cmp == Token::INSTANCEOF) { | 2564 x = factory()->NewCompareOperation(cmp, x, y, pos); |
2565 x = Traits::RewriteInstanceof(x, y, pos); | 2565 if (cmp != op) { |
2566 } else { | 2566 // The comparison was negated - add a NOT. |
2567 x = factory()->NewCompareOperation(cmp, x, y, pos); | 2567 x = factory()->NewUnaryOperation(Token::NOT, x, pos); |
2568 if (cmp != op) { | |
2569 // The comparison was negated - add a NOT. | |
2570 x = factory()->NewUnaryOperation(Token::NOT, x, pos); | |
2571 } | |
2572 } | 2568 } |
2573 | |
2574 } else if (op == Token::EXP) { | 2569 } else if (op == Token::EXP) { |
2575 x = Traits::RewriteExponentiation(x, y, pos); | 2570 x = Traits::RewriteExponentiation(x, y, pos); |
2576 } else { | 2571 } else { |
2577 // We have a "normal" binary operation. | 2572 // We have a "normal" binary operation. |
2578 x = factory()->NewBinaryOperation(op, x, y, pos); | 2573 x = factory()->NewBinaryOperation(op, x, y, pos); |
2579 } | 2574 } |
2580 } | 2575 } |
2581 } | 2576 } |
2582 return x; | 2577 return x; |
2583 } | 2578 } |
(...skipping 1008 matching lines...) Loading... |
3592 has_seen_constructor_ = true; | 3587 has_seen_constructor_ = true; |
3593 return; | 3588 return; |
3594 } | 3589 } |
3595 } | 3590 } |
3596 | 3591 |
3597 | 3592 |
3598 } // namespace internal | 3593 } // namespace internal |
3599 } // namespace v8 | 3594 } // namespace v8 |
3600 | 3595 |
3601 #endif // V8_PARSING_PARSER_BASE_H | 3596 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |