| 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/crankshaft/hydrogen-types.h" | 5 #include "src/crankshaft/hydrogen-types.h" |
| 6 | 6 |
| 7 #include "src/field-type.h" | 7 #include "src/field-type.h" |
| 8 #include "src/handles-inl.h" | 8 #include "src/handles-inl.h" |
| 9 #include "src/ostreams.h" | 9 #include "src/ostreams.h" |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 HType HType::FromFieldType(Handle<FieldType> type, Zone* temp_zone) { | 31 HType HType::FromFieldType(Handle<FieldType> type, Zone* temp_zone) { |
| 32 return FromType(type->Convert(temp_zone)); | 32 return FromType(type->Convert(temp_zone)); |
| 33 } | 33 } |
| 34 | 34 |
| 35 // static | 35 // static |
| 36 HType HType::FromValue(Handle<Object> value) { | 36 HType HType::FromValue(Handle<Object> value) { |
| 37 Object* raw_value = *value; | 37 Object* raw_value = *value; |
| 38 if (raw_value->IsSmi()) return HType::Smi(); | 38 if (raw_value->IsSmi()) return HType::Smi(); |
| 39 DCHECK(raw_value->IsHeapObject()); | 39 DCHECK(raw_value->IsHeapObject()); |
| 40 Isolate* isolate = HeapObject::cast(*value)->GetIsolate(); | 40 Isolate* isolate = HeapObject::cast(*value)->GetIsolate(); |
| 41 if (raw_value->IsNull(isolate)) return HType::Null(); | 41 if (raw_value->IsNull()) return HType::Null(); |
| 42 if (raw_value->IsHeapNumber()) { | 42 if (raw_value->IsHeapNumber()) { |
| 43 double n = Handle<v8::internal::HeapNumber>::cast(value)->value(); | 43 double n = Handle<v8::internal::HeapNumber>::cast(value)->value(); |
| 44 return IsSmiDouble(n) ? HType::Smi() : HType::HeapNumber(); | 44 return IsSmiDouble(n) ? HType::Smi() : HType::HeapNumber(); |
| 45 } | 45 } |
| 46 if (raw_value->IsString()) return HType::String(); | 46 if (raw_value->IsString()) return HType::String(); |
| 47 if (raw_value->IsBoolean()) return HType::Boolean(); | 47 if (raw_value->IsBoolean()) return HType::Boolean(); |
| 48 if (raw_value->IsUndefined(isolate)) return HType::Undefined(); | 48 if (raw_value->IsUndefined(isolate)) return HType::Undefined(); |
| 49 if (raw_value->IsJSArray()) { | 49 if (raw_value->IsJSArray()) { |
| 50 DCHECK(!raw_value->IsUndetectable()); | 50 DCHECK(!raw_value->IsUndetectable()); |
| 51 return HType::JSArray(); | 51 return HType::JSArray(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 66 return os << #Name; | 66 return os << #Name; |
| 67 HTYPE_LIST(DEFINE_CASE) | 67 HTYPE_LIST(DEFINE_CASE) |
| 68 #undef DEFINE_CASE | 68 #undef DEFINE_CASE |
| 69 } | 69 } |
| 70 UNREACHABLE(); | 70 UNREACHABLE(); |
| 71 return os; | 71 return os; |
| 72 } | 72 } |
| 73 | 73 |
| 74 } // namespace internal | 74 } // namespace internal |
| 75 } // namespace v8 | 75 } // namespace v8 |
| OLD | NEW |