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 #include "src/code-stubs.h" | 5 #include "src/code-stubs.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/compiler/code-stub-assembler.h" | 10 #include "src/compiler/code-stub-assembler.h" |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 | 452 |
453 | 453 |
454 void CompareNilICStub::UpdateStatus(Handle<Object> object) { | 454 void CompareNilICStub::UpdateStatus(Handle<Object> object) { |
455 State state = this->state(); | 455 State state = this->state(); |
456 DCHECK(!state.Contains(GENERIC)); | 456 DCHECK(!state.Contains(GENERIC)); |
457 State old_state = state; | 457 State old_state = state; |
458 if (object->IsNull()) { | 458 if (object->IsNull()) { |
459 state.Add(NULL_TYPE); | 459 state.Add(NULL_TYPE); |
460 } else if (object->IsUndefined()) { | 460 } else if (object->IsUndefined()) { |
461 state.Add(UNDEFINED); | 461 state.Add(UNDEFINED); |
462 } else if (object->IsUndetectableObject() || | 462 } else if (object->IsUndetectableObject() || object->IsSmi()) { |
463 object->IsOddball() || | |
464 !object->IsHeapObject()) { | |
465 state.RemoveAll(); | 463 state.RemoveAll(); |
466 state.Add(GENERIC); | 464 state.Add(GENERIC); |
467 } else if (IsMonomorphic()) { | 465 } else if (IsMonomorphic()) { |
468 state.RemoveAll(); | 466 state.RemoveAll(); |
469 state.Add(GENERIC); | 467 state.Add(GENERIC); |
470 } else { | 468 } else { |
471 state.Add(MONOMORPHIC_MAP); | 469 state.Add(MONOMORPHIC_MAP); |
472 } | 470 } |
473 TraceTransition(old_state, state); | 471 TraceTransition(old_state, state); |
474 set_sub_minor_key(TypesBits::update(sub_minor_key(), state.ToIntegral())); | 472 set_sub_minor_key(TypesBits::update(sub_minor_key(), state.ToIntegral())); |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 } else if (object->IsNull()) { | 931 } else if (object->IsNull()) { |
934 Add(NULL_TYPE); | 932 Add(NULL_TYPE); |
935 return false; | 933 return false; |
936 } else if (object->IsSmi()) { | 934 } else if (object->IsSmi()) { |
937 Add(SMI); | 935 Add(SMI); |
938 return Smi::cast(*object)->value() != 0; | 936 return Smi::cast(*object)->value() != 0; |
939 } else if (object->IsJSReceiver()) { | 937 } else if (object->IsJSReceiver()) { |
940 Add(SPEC_OBJECT); | 938 Add(SPEC_OBJECT); |
941 return !object->IsUndetectableObject(); | 939 return !object->IsUndetectableObject(); |
942 } else if (object->IsString()) { | 940 } else if (object->IsString()) { |
| 941 DCHECK(!object->IsUndetectableObject()); |
943 Add(STRING); | 942 Add(STRING); |
944 return !object->IsUndetectableObject() && | 943 return String::cast(*object)->length() != 0; |
945 String::cast(*object)->length() != 0; | |
946 } else if (object->IsSymbol()) { | 944 } else if (object->IsSymbol()) { |
947 Add(SYMBOL); | 945 Add(SYMBOL); |
948 return true; | 946 return true; |
949 } else if (object->IsHeapNumber()) { | 947 } else if (object->IsHeapNumber()) { |
950 DCHECK(!object->IsUndetectableObject()); | 948 DCHECK(!object->IsUndetectableObject()); |
951 Add(HEAP_NUMBER); | 949 Add(HEAP_NUMBER); |
952 double value = HeapNumber::cast(*object)->value(); | 950 double value = HeapNumber::cast(*object)->value(); |
953 return value != 0 && !std::isnan(value); | 951 return value != 0 && !std::isnan(value); |
954 } else if (object->IsSimd128Value()) { | 952 } else if (object->IsSimd128Value()) { |
955 Add(SIMD_VALUE); | 953 Add(SIMD_VALUE); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 if (type->Is(Type::UntaggedPointer())) { | 1026 if (type->Is(Type::UntaggedPointer())) { |
1029 return Representation::External(); | 1027 return Representation::External(); |
1030 } | 1028 } |
1031 | 1029 |
1032 DCHECK(!type->Is(Type::Untagged())); | 1030 DCHECK(!type->Is(Type::Untagged())); |
1033 return Representation::Tagged(); | 1031 return Representation::Tagged(); |
1034 } | 1032 } |
1035 | 1033 |
1036 } // namespace internal | 1034 } // namespace internal |
1037 } // namespace v8 | 1035 } // namespace v8 |
OLD | NEW |