Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: src/parsing/parser-base.h

Issue 1980483003: [es6] Reintroduce the instanceof operator in the backends. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Igors comments. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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...) Expand 10 before | Expand all | Expand 10 after
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...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698