| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 24 matching lines...) Expand all Loading... |
| 35 #include "stub-cache.h" | 35 #include "stub-cache.h" |
| 36 #include "type-info.h" | 36 #include "type-info.h" |
| 37 | 37 |
| 38 #include "ic-inl.h" | 38 #include "ic-inl.h" |
| 39 #include "objects-inl.h" | 39 #include "objects-inl.h" |
| 40 | 40 |
| 41 namespace v8 { | 41 namespace v8 { |
| 42 namespace internal { | 42 namespace internal { |
| 43 | 43 |
| 44 | 44 |
| 45 TypeInfo TypeInfo::FromValue(Handle<Object> value) { | |
| 46 if (value->IsSmi()) { | |
| 47 return TypeInfo::Smi(); | |
| 48 } else if (value->IsHeapNumber()) { | |
| 49 return TypeInfo::IsInt32Double(HeapNumber::cast(*value)->value()) | |
| 50 ? TypeInfo::Integer32() | |
| 51 : TypeInfo::Double(); | |
| 52 } else if (value->IsString()) { | |
| 53 return TypeInfo::String(); | |
| 54 } | |
| 55 return TypeInfo::Unknown(); | |
| 56 } | |
| 57 | |
| 58 | |
| 59 TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code, | 45 TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code, |
| 60 Handle<Context> native_context, | 46 Handle<Context> native_context, |
| 61 Isolate* isolate, | 47 Isolate* isolate, |
| 62 Zone* zone) | 48 Zone* zone) |
| 63 : native_context_(native_context), | 49 : native_context_(native_context), |
| 64 isolate_(isolate), | 50 isolate_(isolate), |
| 65 zone_(zone) { | 51 zone_(zone) { |
| 66 BuildDictionary(code); | 52 BuildDictionary(code); |
| 67 ASSERT(dictionary_->IsDictionary()); | 53 ASSERT(dictionary_->IsDictionary()); |
| 68 } | 54 } |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 USE(maybe_result); | 577 USE(maybe_result); |
| 592 #ifdef DEBUG | 578 #ifdef DEBUG |
| 593 Object* result = NULL; | 579 Object* result = NULL; |
| 594 // Dictionary has been allocated with sufficient size for all elements. | 580 // Dictionary has been allocated with sufficient size for all elements. |
| 595 ASSERT(maybe_result->ToObject(&result)); | 581 ASSERT(maybe_result->ToObject(&result)); |
| 596 ASSERT(*dictionary_ == result); | 582 ASSERT(*dictionary_ == result); |
| 597 #endif | 583 #endif |
| 598 } | 584 } |
| 599 | 585 |
| 600 | 586 |
| 601 Representation Representation::FromType(TypeInfo info) { | |
| 602 if (info.IsUninitialized()) return Representation::None(); | |
| 603 if (info.IsSmi()) return Representation::Smi(); | |
| 604 if (info.IsInteger32()) return Representation::Integer32(); | |
| 605 if (info.IsDouble()) return Representation::Double(); | |
| 606 if (info.IsNumber()) return Representation::Double(); | |
| 607 return Representation::Tagged(); | |
| 608 } | |
| 609 | |
| 610 | |
| 611 } } // namespace v8::internal | 587 } } // namespace v8::internal |
| OLD | NEW |