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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 CompareICState::State CompareICState::NewInputState(State old_state, | 397 CompareICState::State CompareICState::NewInputState(State old_state, |
398 Handle<Object> value) { | 398 Handle<Object> value) { |
399 switch (old_state) { | 399 switch (old_state) { |
400 case UNINITIALIZED: | 400 case UNINITIALIZED: |
401 if (value->IsBoolean()) return BOOLEAN; | 401 if (value->IsBoolean()) return BOOLEAN; |
402 if (value->IsSmi()) return SMI; | 402 if (value->IsSmi()) return SMI; |
403 if (value->IsHeapNumber()) return NUMBER; | 403 if (value->IsHeapNumber()) return NUMBER; |
404 if (value->IsInternalizedString()) return INTERNALIZED_STRING; | 404 if (value->IsInternalizedString()) return INTERNALIZED_STRING; |
405 if (value->IsString()) return STRING; | 405 if (value->IsString()) return STRING; |
406 if (value->IsSymbol()) return UNIQUE_NAME; | 406 if (value->IsSymbol()) return UNIQUE_NAME; |
407 if (value->IsJSReceiver() && !value->IsUndetectableObject()) { | 407 if (value->IsJSReceiver() && !value->IsUndetectable()) { |
408 return RECEIVER; | 408 return RECEIVER; |
409 } | 409 } |
410 break; | 410 break; |
411 case BOOLEAN: | 411 case BOOLEAN: |
412 if (value->IsBoolean()) return BOOLEAN; | 412 if (value->IsBoolean()) return BOOLEAN; |
413 break; | 413 break; |
414 case SMI: | 414 case SMI: |
415 if (value->IsSmi()) return SMI; | 415 if (value->IsSmi()) return SMI; |
416 if (value->IsHeapNumber()) return NUMBER; | 416 if (value->IsHeapNumber()) return NUMBER; |
417 break; | 417 break; |
418 case NUMBER: | 418 case NUMBER: |
419 if (value->IsNumber()) return NUMBER; | 419 if (value->IsNumber()) return NUMBER; |
420 break; | 420 break; |
421 case INTERNALIZED_STRING: | 421 case INTERNALIZED_STRING: |
422 if (value->IsInternalizedString()) return INTERNALIZED_STRING; | 422 if (value->IsInternalizedString()) return INTERNALIZED_STRING; |
423 if (value->IsString()) return STRING; | 423 if (value->IsString()) return STRING; |
424 if (value->IsSymbol()) return UNIQUE_NAME; | 424 if (value->IsSymbol()) return UNIQUE_NAME; |
425 break; | 425 break; |
426 case STRING: | 426 case STRING: |
427 if (value->IsString()) return STRING; | 427 if (value->IsString()) return STRING; |
428 break; | 428 break; |
429 case UNIQUE_NAME: | 429 case UNIQUE_NAME: |
430 if (value->IsUniqueName()) return UNIQUE_NAME; | 430 if (value->IsUniqueName()) return UNIQUE_NAME; |
431 break; | 431 break; |
432 case RECEIVER: | 432 case RECEIVER: |
433 if (value->IsJSReceiver() && !value->IsUndetectableObject()) { | 433 if (value->IsJSReceiver() && !value->IsUndetectable()) { |
434 return RECEIVER; | 434 return RECEIVER; |
435 } | 435 } |
436 break; | 436 break; |
437 case GENERIC: | 437 case GENERIC: |
438 break; | 438 break; |
439 case KNOWN_RECEIVER: | 439 case KNOWN_RECEIVER: |
440 UNREACHABLE(); | 440 UNREACHABLE(); |
441 break; | 441 break; |
442 } | 442 } |
443 return GENERIC; | 443 return GENERIC; |
(...skipping 17 matching lines...) Expand all Loading... |
461 return NUMBER; | 461 return NUMBER; |
462 } | 462 } |
463 } | 463 } |
464 if (x->IsInternalizedString() && y->IsInternalizedString()) { | 464 if (x->IsInternalizedString() && y->IsInternalizedString()) { |
465 // We compare internalized strings as plain ones if we need to determine | 465 // We compare internalized strings as plain ones if we need to determine |
466 // the order in a non-equality compare. | 466 // the order in a non-equality compare. |
467 return Token::IsEqualityOp(op) ? INTERNALIZED_STRING : STRING; | 467 return Token::IsEqualityOp(op) ? INTERNALIZED_STRING : STRING; |
468 } | 468 } |
469 if (x->IsString() && y->IsString()) return STRING; | 469 if (x->IsString() && y->IsString()) return STRING; |
470 if (x->IsJSReceiver() && y->IsJSReceiver()) { | 470 if (x->IsJSReceiver() && y->IsJSReceiver()) { |
471 if (x->IsUndetectableObject() || y->IsUndetectableObject()) { | 471 if (x->IsUndetectable() || y->IsUndetectable()) { |
472 return GENERIC; | 472 return GENERIC; |
473 } | 473 } |
474 if (Handle<JSReceiver>::cast(x)->map() == | 474 if (Handle<JSReceiver>::cast(x)->map() == |
475 Handle<JSReceiver>::cast(y)->map()) { | 475 Handle<JSReceiver>::cast(y)->map()) { |
476 return KNOWN_RECEIVER; | 476 return KNOWN_RECEIVER; |
477 } else { | 477 } else { |
478 return Token::IsEqualityOp(op) ? RECEIVER : GENERIC; | 478 return Token::IsEqualityOp(op) ? RECEIVER : GENERIC; |
479 } | 479 } |
480 } | 480 } |
481 if (!Token::IsEqualityOp(op)) return GENERIC; | 481 if (!Token::IsEqualityOp(op)) return GENERIC; |
(...skipping 24 matching lines...) Expand all Loading... |
506 case RECEIVER: | 506 case RECEIVER: |
507 case GENERIC: | 507 case GENERIC: |
508 return GENERIC; | 508 return GENERIC; |
509 } | 509 } |
510 UNREACHABLE(); | 510 UNREACHABLE(); |
511 return GENERIC; // Make the compiler happy. | 511 return GENERIC; // Make the compiler happy. |
512 } | 512 } |
513 | 513 |
514 } // namespace internal | 514 } // namespace internal |
515 } // namespace v8 | 515 } // namespace v8 |
OLD | NEW |