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

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

Issue 1692713005: ES6: Desugaring of instanceof to support @@hasInstance (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@blah
Patch Set: Fixed todos. Created 4 years, 10 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
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 2228 matching lines...) Expand 10 before | Expand all | Expand 10 after
2239 switch (op) { 2239 switch (op) {
2240 case Token::NE: cmp = Token::EQ; break; 2240 case Token::NE: cmp = Token::EQ; break;
2241 case Token::NE_STRICT: cmp = Token::EQ_STRICT; break; 2241 case Token::NE_STRICT: cmp = Token::EQ_STRICT; break;
2242 default: break; 2242 default: break;
2243 } 2243 }
2244 if (cmp == Token::EQ && is_strong(language_mode())) { 2244 if (cmp == Token::EQ && is_strong(language_mode())) {
2245 ReportMessageAt(op_location, MessageTemplate::kStrongEqual); 2245 ReportMessageAt(op_location, MessageTemplate::kStrongEqual);
2246 *ok = false; 2246 *ok = false;
2247 return this->EmptyExpression(); 2247 return this->EmptyExpression();
2248 } 2248 }
2249 x = factory()->NewCompareOperation(cmp, x, y, pos); 2249 if (FLAG_harmony_instanceof && op == Token::INSTANCEOF) {
rossberg 2016/02/12 14:11:31 Nit: make this and 'else if'. Also, s/op/cmp/
mvstanton 2016/02/18 02:12:17 Done.
2250 if (cmp != op) { 2250 x = Traits::RewriteInstanceof(x, y, pos);
2251 // The comparison was negated - add a NOT. 2251 } else {
2252 x = factory()->NewUnaryOperation(Token::NOT, x, pos); 2252 x = factory()->NewCompareOperation(cmp, x, y, pos);
2253 if (cmp != op) {
2254 // The comparison was negated - add a NOT.
2255 x = factory()->NewUnaryOperation(Token::NOT, x, pos);
2256 }
2253 } 2257 }
2254
2255 } else { 2258 } else {
2256 // We have a "normal" binary operation. 2259 // We have a "normal" binary operation.
2257 x = factory()->NewBinaryOperation(op, x, y, pos); 2260 x = factory()->NewBinaryOperation(op, x, y, pos);
2258 } 2261 }
2259 } 2262 }
2260 } 2263 }
2261 return x; 2264 return x;
2262 } 2265 }
2263 2266
2264 2267
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
3374 return; 3377 return;
3375 } 3378 }
3376 has_seen_constructor_ = true; 3379 has_seen_constructor_ = true;
3377 return; 3380 return;
3378 } 3381 }
3379 } 3382 }
3380 } // namespace internal 3383 } // namespace internal
3381 } // namespace v8 3384 } // namespace v8
3382 3385
3383 #endif // V8_PARSING_PARSER_BASE_H 3386 #endif // V8_PARSING_PARSER_BASE_H
OLDNEW
« src/parsing/parser.cc ('K') | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698