| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 namespace v8 { | 40 namespace v8 { |
| 41 namespace internal { | 41 namespace internal { |
| 42 | 42 |
| 43 | 43 |
| 44 TypeInfo TypeInfo::TypeFromValue(Handle<Object> value) { | 44 TypeInfo TypeInfo::TypeFromValue(Handle<Object> value) { |
| 45 TypeInfo info; | 45 TypeInfo info; |
| 46 if (value->IsSmi()) { | 46 if (value->IsSmi()) { |
| 47 info = TypeInfo::Smi(); | 47 info = TypeInfo::Smi(); |
| 48 } else if (value->IsHeapNumber()) { | 48 } else if (value->IsHeapNumber()) { |
| 49 info = TypeInfo::IsInt32Double(HeapNumber::cast(*value)->value()) | 49 double double_value = HeapNumber::cast(*value)->value(); |
| 50 ? TypeInfo::Integer32() | 50 if (TypeInfo::IsSmiDouble(double_value)) { |
| 51 : TypeInfo::Double(); | 51 info = TypeInfo::Smi(); |
| 52 } else if (TypeInfo::IsInt32Double(double_value)) { |
| 53 info = TypeInfo::Integer32(); |
| 54 } else { |
| 55 info = TypeInfo::Double(); |
| 56 } |
| 52 } else if (value->IsString()) { | 57 } else if (value->IsString()) { |
| 53 info = TypeInfo::String(); | 58 info = TypeInfo::String(); |
| 54 } else { | 59 } else { |
| 55 info = TypeInfo::Unknown(); | 60 info = TypeInfo::Unknown(); |
| 56 } | 61 } |
| 57 return info; | 62 return info; |
| 58 } | 63 } |
| 59 | 64 |
| 60 | 65 |
| 61 STATIC_ASSERT(DEFAULT_STRING_STUB == Code::kNoExtraICState); | 66 STATIC_ASSERT(DEFAULT_STRING_STUB == Code::kNoExtraICState); |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 source_positions->Add(position); | 402 source_positions->Add(position); |
| 398 } | 403 } |
| 399 } else { | 404 } else { |
| 400 ASSERT(RelocInfo::IsPosition(mode)); | 405 ASSERT(RelocInfo::IsPosition(mode)); |
| 401 position = static_cast<int>(info->data()); | 406 position = static_cast<int>(info->data()); |
| 402 } | 407 } |
| 403 } | 408 } |
| 404 } | 409 } |
| 405 | 410 |
| 406 } } // namespace v8::internal | 411 } } // namespace v8::internal |
| OLD | NEW |