OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "src/ic/ic-state.h" | 5 #include "src/ic/ic-state.h" |
6 | 6 |
7 #include "src/ic/ic.h" | 7 #include "src/ic/ic.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 (y->IsNumber() && x->IsUndefined())) { | 463 (y->IsNumber() && x->IsUndefined())) { |
464 return NUMBER; | 464 return NUMBER; |
465 } | 465 } |
466 } | 466 } |
467 if (x->IsInternalizedString() && y->IsInternalizedString()) { | 467 if (x->IsInternalizedString() && y->IsInternalizedString()) { |
468 // We compare internalized strings as plain ones if we need to determine | 468 // We compare internalized strings as plain ones if we need to determine |
469 // the order in a non-equality compare. | 469 // the order in a non-equality compare. |
470 return Token::IsEqualityOp(op) ? INTERNALIZED_STRING : STRING; | 470 return Token::IsEqualityOp(op) ? INTERNALIZED_STRING : STRING; |
471 } | 471 } |
472 if (x->IsString() && y->IsString()) return STRING; | 472 if (x->IsString() && y->IsString()) return STRING; |
473 if (!Token::IsEqualityOp(op)) return GENERIC; | |
474 if (x->IsUniqueName() && y->IsUniqueName()) return UNIQUE_NAME; | |
475 if (x->IsJSObject() && y->IsJSObject()) { | 473 if (x->IsJSObject() && y->IsJSObject()) { |
476 if (Handle<JSObject>::cast(x)->map() == | 474 if (Handle<JSObject>::cast(x)->map() == |
477 Handle<JSObject>::cast(y)->map()) { | 475 Handle<JSObject>::cast(y)->map()) { |
478 return KNOWN_OBJECT; | 476 return KNOWN_OBJECT; |
479 } else { | 477 } else { |
480 return OBJECT; | 478 return Token::IsEqualityOp(op) ? OBJECT : GENERIC; |
481 } | 479 } |
482 } | 480 } |
| 481 if (!Token::IsEqualityOp(op)) return GENERIC; |
| 482 if (x->IsUniqueName() && y->IsUniqueName()) return UNIQUE_NAME; |
483 return GENERIC; | 483 return GENERIC; |
484 case SMI: | 484 case SMI: |
485 return x->IsNumber() && y->IsNumber() ? NUMBER : GENERIC; | 485 return x->IsNumber() && y->IsNumber() ? NUMBER : GENERIC; |
486 case INTERNALIZED_STRING: | 486 case INTERNALIZED_STRING: |
487 DCHECK(Token::IsEqualityOp(op)); | 487 DCHECK(Token::IsEqualityOp(op)); |
488 if (x->IsString() && y->IsString()) return STRING; | 488 if (x->IsString() && y->IsString()) return STRING; |
489 if (x->IsUniqueName() && y->IsUniqueName()) return UNIQUE_NAME; | 489 if (x->IsUniqueName() && y->IsUniqueName()) return UNIQUE_NAME; |
490 return GENERIC; | 490 return GENERIC; |
491 case NUMBER: | 491 case NUMBER: |
492 // If the failure was due to one side changing from smi to heap number, | 492 // If the failure was due to one side changing from smi to heap number, |
493 // then keep the state (if other changed at the same time, we will get | 493 // then keep the state (if other changed at the same time, we will get |
494 // a second miss and then go to generic). | 494 // a second miss and then go to generic). |
495 if (old_left == SMI && x->IsHeapNumber()) return NUMBER; | 495 if (old_left == SMI && x->IsHeapNumber()) return NUMBER; |
496 if (old_right == SMI && y->IsHeapNumber()) return NUMBER; | 496 if (old_right == SMI && y->IsHeapNumber()) return NUMBER; |
497 return GENERIC; | 497 return GENERIC; |
498 case KNOWN_OBJECT: | 498 case KNOWN_OBJECT: |
499 DCHECK(Token::IsEqualityOp(op)); | |
500 if (x->IsJSObject() && y->IsJSObject()) { | 499 if (x->IsJSObject() && y->IsJSObject()) { |
501 return OBJECT; | 500 return Token::IsEqualityOp(op) ? OBJECT : GENERIC; |
502 } | 501 } |
503 return GENERIC; | 502 return GENERIC; |
504 case STRING: | 503 case STRING: |
505 case UNIQUE_NAME: | 504 case UNIQUE_NAME: |
506 case OBJECT: | 505 case OBJECT: |
507 case GENERIC: | 506 case GENERIC: |
508 return GENERIC; | 507 return GENERIC; |
509 } | 508 } |
510 UNREACHABLE(); | 509 UNREACHABLE(); |
511 return GENERIC; // Make the compiler happy. | 510 return GENERIC; // Make the compiler happy. |
512 } | 511 } |
513 } // namespace internal | 512 } // namespace internal |
514 } // namespace v8 | 513 } // namespace v8 |
OLD | NEW |