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 2208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2219 Token::Value cmp = op; | 2219 Token::Value cmp = op; |
2220 switch (op) { | 2220 switch (op) { |
2221 case Token::NE: cmp = Token::EQ; break; | 2221 case Token::NE: cmp = Token::EQ; break; |
2222 case Token::NE_STRICT: cmp = Token::EQ_STRICT; break; | 2222 case Token::NE_STRICT: cmp = Token::EQ_STRICT; break; |
2223 default: break; | 2223 default: break; |
2224 } | 2224 } |
2225 if (cmp == Token::EQ && is_strong(language_mode())) { | 2225 if (cmp == Token::EQ && is_strong(language_mode())) { |
2226 ReportMessageAt(op_location, MessageTemplate::kStrongEqual); | 2226 ReportMessageAt(op_location, MessageTemplate::kStrongEqual); |
2227 *ok = false; | 2227 *ok = false; |
2228 return this->EmptyExpression(); | 2228 return this->EmptyExpression(); |
| 2229 } else if (FLAG_harmony_instanceof && cmp == Token::INSTANCEOF) { |
| 2230 x = Traits::RewriteInstanceof(x, y, pos); |
| 2231 } else { |
| 2232 x = factory()->NewCompareOperation(cmp, x, y, pos); |
| 2233 if (cmp != op) { |
| 2234 // The comparison was negated - add a NOT. |
| 2235 x = factory()->NewUnaryOperation(Token::NOT, x, pos); |
| 2236 } |
2229 } | 2237 } |
2230 x = factory()->NewCompareOperation(cmp, x, y, pos); | |
2231 if (cmp != op) { | |
2232 // The comparison was negated - add a NOT. | |
2233 x = factory()->NewUnaryOperation(Token::NOT, x, pos); | |
2234 } | |
2235 | |
2236 } else { | 2238 } else { |
2237 // We have a "normal" binary operation. | 2239 // We have a "normal" binary operation. |
2238 x = factory()->NewBinaryOperation(op, x, y, pos); | 2240 x = factory()->NewBinaryOperation(op, x, y, pos); |
2239 } | 2241 } |
2240 } | 2242 } |
2241 } | 2243 } |
2242 return x; | 2244 return x; |
2243 } | 2245 } |
2244 | 2246 |
2245 | 2247 |
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3360 return; | 3362 return; |
3361 } | 3363 } |
3362 has_seen_constructor_ = true; | 3364 has_seen_constructor_ = true; |
3363 return; | 3365 return; |
3364 } | 3366 } |
3365 } | 3367 } |
3366 } // namespace internal | 3368 } // namespace internal |
3367 } // namespace v8 | 3369 } // namespace v8 |
3368 | 3370 |
3369 #endif // V8_PARSING_PARSER_BASE_H | 3371 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |