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

Side by Side Diff: src/ic/ic-state.cc

Issue 1355113002: [ic] Also collect known map for relational comparison. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address Jakob's comment. Created 5 years, 3 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/ia32/code-stubs-ia32.cc ('k') | src/mips/code-stubs-mips.cc » ('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 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
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
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698