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/cpu-profiler.h" | 10 #include "src/cpu-profiler.h" |
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 SimpleListPrinter p(os); | 961 SimpleListPrinter p(os); |
962 if (s.IsEmpty()) p.Add("None"); | 962 if (s.IsEmpty()) p.Add("None"); |
963 if (s.Contains(ToBooleanStub::UNDEFINED)) p.Add("Undefined"); | 963 if (s.Contains(ToBooleanStub::UNDEFINED)) p.Add("Undefined"); |
964 if (s.Contains(ToBooleanStub::BOOLEAN)) p.Add("Bool"); | 964 if (s.Contains(ToBooleanStub::BOOLEAN)) p.Add("Bool"); |
965 if (s.Contains(ToBooleanStub::NULL_TYPE)) p.Add("Null"); | 965 if (s.Contains(ToBooleanStub::NULL_TYPE)) p.Add("Null"); |
966 if (s.Contains(ToBooleanStub::SMI)) p.Add("Smi"); | 966 if (s.Contains(ToBooleanStub::SMI)) p.Add("Smi"); |
967 if (s.Contains(ToBooleanStub::SPEC_OBJECT)) p.Add("SpecObject"); | 967 if (s.Contains(ToBooleanStub::SPEC_OBJECT)) p.Add("SpecObject"); |
968 if (s.Contains(ToBooleanStub::STRING)) p.Add("String"); | 968 if (s.Contains(ToBooleanStub::STRING)) p.Add("String"); |
969 if (s.Contains(ToBooleanStub::SYMBOL)) p.Add("Symbol"); | 969 if (s.Contains(ToBooleanStub::SYMBOL)) p.Add("Symbol"); |
970 if (s.Contains(ToBooleanStub::HEAP_NUMBER)) p.Add("HeapNumber"); | 970 if (s.Contains(ToBooleanStub::HEAP_NUMBER)) p.Add("HeapNumber"); |
971 if (s.Contains(ToBooleanStub::SIMD_VALUE)) p.Add("SimdValue"); | |
972 return os << ")"; | 971 return os << ")"; |
973 } | 972 } |
974 | 973 |
975 | 974 |
976 bool ToBooleanStub::Types::UpdateStatus(Handle<Object> object) { | 975 bool ToBooleanStub::Types::UpdateStatus(Handle<Object> object) { |
977 if (object->IsUndefined()) { | 976 if (object->IsUndefined()) { |
978 Add(UNDEFINED); | 977 Add(UNDEFINED); |
979 return false; | 978 return false; |
980 } else if (object->IsBoolean()) { | 979 } else if (object->IsBoolean()) { |
981 Add(BOOLEAN); | 980 Add(BOOLEAN); |
(...skipping 12 matching lines...) Expand all Loading... |
994 return !object->IsUndetectableObject() && | 993 return !object->IsUndetectableObject() && |
995 String::cast(*object)->length() != 0; | 994 String::cast(*object)->length() != 0; |
996 } else if (object->IsSymbol()) { | 995 } else if (object->IsSymbol()) { |
997 Add(SYMBOL); | 996 Add(SYMBOL); |
998 return true; | 997 return true; |
999 } else if (object->IsHeapNumber()) { | 998 } else if (object->IsHeapNumber()) { |
1000 DCHECK(!object->IsUndetectableObject()); | 999 DCHECK(!object->IsUndetectableObject()); |
1001 Add(HEAP_NUMBER); | 1000 Add(HEAP_NUMBER); |
1002 double value = HeapNumber::cast(*object)->value(); | 1001 double value = HeapNumber::cast(*object)->value(); |
1003 return value != 0 && !std::isnan(value); | 1002 return value != 0 && !std::isnan(value); |
1004 } else if (object->IsFloat32x4()) { | |
1005 Add(SIMD_VALUE); | |
1006 return true; | |
1007 } else { | 1003 } else { |
1008 // We should never see an internal object at runtime here! | 1004 // We should never see an internal object at runtime here! |
1009 UNREACHABLE(); | 1005 UNREACHABLE(); |
1010 return true; | 1006 return true; |
1011 } | 1007 } |
1012 } | 1008 } |
1013 | 1009 |
1014 | 1010 |
1015 bool ToBooleanStub::Types::NeedsMap() const { | 1011 bool ToBooleanStub::Types::NeedsMap() const { |
1016 return Contains(ToBooleanStub::SPEC_OBJECT) || | 1012 return Contains(ToBooleanStub::SPEC_OBJECT) |
1017 Contains(ToBooleanStub::STRING) || Contains(ToBooleanStub::SYMBOL) || | 1013 || Contains(ToBooleanStub::STRING) |
1018 Contains(ToBooleanStub::HEAP_NUMBER) || | 1014 || Contains(ToBooleanStub::SYMBOL) |
1019 Contains(ToBooleanStub::SIMD_VALUE); | 1015 || Contains(ToBooleanStub::HEAP_NUMBER); |
1020 } | 1016 } |
1021 | 1017 |
1022 | 1018 |
1023 bool ToBooleanStub::Types::CanBeUndetectable() const { | 1019 bool ToBooleanStub::Types::CanBeUndetectable() const { |
1024 return Contains(ToBooleanStub::SPEC_OBJECT) | 1020 return Contains(ToBooleanStub::SPEC_OBJECT) |
1025 || Contains(ToBooleanStub::STRING); | 1021 || Contains(ToBooleanStub::STRING); |
1026 } | 1022 } |
1027 | 1023 |
1028 | 1024 |
1029 void StubFailureTrampolineStub::GenerateAheadOfTime(Isolate* isolate) { | 1025 void StubFailureTrampolineStub::GenerateAheadOfTime(Isolate* isolate) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 | 1079 |
1084 if (type->Is(Type::UntaggedPointer())) { | 1080 if (type->Is(Type::UntaggedPointer())) { |
1085 return Representation::External(); | 1081 return Representation::External(); |
1086 } | 1082 } |
1087 | 1083 |
1088 DCHECK(!type->Is(Type::Untagged())); | 1084 DCHECK(!type->Is(Type::Untagged())); |
1089 return Representation::Tagged(); | 1085 return Representation::Tagged(); |
1090 } | 1086 } |
1091 } // namespace internal | 1087 } // namespace internal |
1092 } // namespace v8 | 1088 } // namespace v8 |
OLD | NEW |