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 2223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2234 Token::Value cmp = op; | 2234 Token::Value cmp = op; |
2235 switch (op) { | 2235 switch (op) { |
2236 case Token::NE: cmp = Token::EQ; break; | 2236 case Token::NE: cmp = Token::EQ; break; |
2237 case Token::NE_STRICT: cmp = Token::EQ_STRICT; break; | 2237 case Token::NE_STRICT: cmp = Token::EQ_STRICT; break; |
2238 default: break; | 2238 default: break; |
2239 } | 2239 } |
2240 if (cmp == Token::EQ && is_strong(language_mode())) { | 2240 if (cmp == Token::EQ && is_strong(language_mode())) { |
2241 ReportMessageAt(op_location, MessageTemplate::kStrongEqual); | 2241 ReportMessageAt(op_location, MessageTemplate::kStrongEqual); |
2242 *ok = false; | 2242 *ok = false; |
2243 return this->EmptyExpression(); | 2243 return this->EmptyExpression(); |
| 2244 } else if (FLAG_harmony_instanceof && cmp == Token::INSTANCEOF) { |
| 2245 x = Traits::RewriteInstanceof(x, y, pos); |
| 2246 } else { |
| 2247 x = factory()->NewCompareOperation(cmp, x, y, pos); |
| 2248 if (cmp != op) { |
| 2249 // The comparison was negated - add a NOT. |
| 2250 x = factory()->NewUnaryOperation(Token::NOT, x, pos); |
| 2251 } |
2244 } | 2252 } |
2245 x = factory()->NewCompareOperation(cmp, x, y, pos); | |
2246 if (cmp != op) { | |
2247 // The comparison was negated - add a NOT. | |
2248 x = factory()->NewUnaryOperation(Token::NOT, x, pos); | |
2249 } | |
2250 | |
2251 } else { | 2253 } else { |
2252 // We have a "normal" binary operation. | 2254 // We have a "normal" binary operation. |
2253 x = factory()->NewBinaryOperation(op, x, y, pos); | 2255 x = factory()->NewBinaryOperation(op, x, y, pos); |
2254 } | 2256 } |
2255 } | 2257 } |
2256 } | 2258 } |
2257 return x; | 2259 return x; |
2258 } | 2260 } |
2259 | 2261 |
2260 | 2262 |
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3370 has_seen_constructor_ = true; | 3372 has_seen_constructor_ = true; |
3371 return; | 3373 return; |
3372 } | 3374 } |
3373 } | 3375 } |
3374 | 3376 |
3375 | 3377 |
3376 } // namespace internal | 3378 } // namespace internal |
3377 } // namespace v8 | 3379 } // namespace v8 |
3378 | 3380 |
3379 #endif // V8_PARSING_PARSER_BASE_H | 3381 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |