Chromium Code Reviews| 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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 667 | 667 |
| 668 Handle<HeapType> IC::CurrentTypeOf(Handle<Object> object, Isolate* isolate) { | 668 Handle<HeapType> IC::CurrentTypeOf(Handle<Object> object, Isolate* isolate) { |
| 669 return object->IsJSGlobalObject() | 669 return object->IsJSGlobalObject() |
| 670 ? HeapType::Constant(Handle<JSGlobalObject>::cast(object), isolate) | 670 ? HeapType::Constant(Handle<JSGlobalObject>::cast(object), isolate) |
| 671 : HeapType::OfCurrently(object, isolate); | 671 : HeapType::OfCurrently(object, isolate); |
| 672 } | 672 } |
| 673 | 673 |
| 674 | 674 |
| 675 Handle<Map> IC::TypeToMap(HeapType* type, Isolate* isolate) { | 675 Handle<Map> IC::TypeToMap(HeapType* type, Isolate* isolate) { |
| 676 if (type->Is(HeapType::Number())) | 676 if (type->Is(HeapType::Number())) |
| 677 return isolate->factory()->heap_number_map(); | 677 return isolate->factory()->heap_number_map(); |
|
Igor Sheludko
2014/03/27 11:30:16
I'm afraid we could loose the knowledge about muta
| |
| 678 if (type->Is(HeapType::Boolean())) return isolate->factory()->oddball_map(); | 678 if (type->Is(HeapType::Boolean())) return isolate->factory()->oddball_map(); |
| 679 if (type->IsConstant()) { | 679 if (type->IsConstant()) { |
| 680 return handle(Handle<JSGlobalObject>::cast(type->AsConstant())->map()); | 680 return handle(Handle<JSGlobalObject>::cast(type->AsConstant())->map()); |
| 681 } | 681 } |
| 682 ASSERT(type->IsClass()); | 682 ASSERT(type->IsClass()); |
| 683 return type->AsClass(); | 683 return type->AsClass(); |
| 684 } | 684 } |
| 685 | 685 |
| 686 | 686 |
| 687 template <class T> | 687 template <class T> |
| 688 typename T::TypeHandle IC::MapToType(Handle<Map> map, | 688 typename T::TypeHandle IC::MapToType(Handle<Map> map, |
| 689 typename T::Region* region) { | 689 typename T::Region* region) { |
| 690 if (map->instance_type() == HEAP_NUMBER_TYPE) { | 690 if (map->instance_type() == HEAP_NUMBER_TYPE) { |
|
Igor Sheludko
2014/03/27 11:30:16
What about supporting MUTABLE_HEAP_NUMBER_TYPE cas
| |
| 691 return T::Number(region); | 691 return T::Number(region); |
| 692 } else if (map->instance_type() == ODDBALL_TYPE) { | 692 } else if (map->instance_type() == ODDBALL_TYPE) { |
| 693 // The only oddballs that can be recorded in ICs are booleans. | 693 // The only oddballs that can be recorded in ICs are booleans. |
| 694 return T::Boolean(region); | 694 return T::Boolean(region); |
| 695 } else { | 695 } else { |
| 696 return T::Class(map, region); | 696 return T::Class(map, region); |
| 697 } | 697 } |
| 698 } | 698 } |
| 699 | 699 |
| 700 | 700 |
| (...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1856 // Expand the properties array. | 1856 // Expand the properties array. |
| 1857 FixedArray* old_storage = object->properties(); | 1857 FixedArray* old_storage = object->properties(); |
| 1858 int new_unused = transition->unused_property_fields(); | 1858 int new_unused = transition->unused_property_fields(); |
| 1859 int new_size = old_storage->length() + new_unused + 1; | 1859 int new_size = old_storage->length() + new_unused + 1; |
| 1860 Object* result; | 1860 Object* result; |
| 1861 MaybeObject* maybe_result = old_storage->CopySize(new_size); | 1861 MaybeObject* maybe_result = old_storage->CopySize(new_size); |
| 1862 if (!maybe_result->ToObject(&result)) return maybe_result; | 1862 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 1863 | 1863 |
| 1864 FixedArray* new_storage = FixedArray::cast(result); | 1864 FixedArray* new_storage = FixedArray::cast(result); |
| 1865 | 1865 |
| 1866 Object* to_store = value; | |
| 1867 | |
| 1868 DescriptorArray* descriptors = transition->instance_descriptors(); | 1866 DescriptorArray* descriptors = transition->instance_descriptors(); |
| 1869 PropertyDetails details = descriptors->GetDetails(transition->LastAdded()); | 1867 PropertyDetails details = descriptors->GetDetails(transition->LastAdded()); |
| 1870 if (details.representation().IsDouble()) { | 1868 Object* to_store; |
| 1871 MaybeObject* maybe_storage = | 1869 MaybeObject* maybe_storage = value->AllocateNewStorageFor( |
| 1872 isolate->heap()->AllocateHeapNumber(value->Number()); | 1870 isolate->heap(), details.representation()); |
| 1873 if (!maybe_storage->To(&to_store)) return maybe_storage; | 1871 if (!maybe_storage->To(&to_store)) return maybe_storage; |
| 1874 } | |
| 1875 | 1872 |
| 1876 new_storage->set(old_storage->length(), to_store); | 1873 new_storage->set(old_storage->length(), to_store); |
| 1877 | 1874 |
| 1878 // Set the new property value and do the map transition. | 1875 // Set the new property value and do the map transition. |
| 1879 object->set_properties(new_storage); | 1876 object->set_properties(new_storage); |
| 1880 object->set_map(transition); | 1877 object->set_map(transition); |
| 1881 | 1878 |
| 1882 // Return the stored value. | 1879 // Return the stored value. |
| 1883 return value; | 1880 return value; |
| 1884 } | 1881 } |
| (...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2837 #undef ADDR | 2834 #undef ADDR |
| 2838 }; | 2835 }; |
| 2839 | 2836 |
| 2840 | 2837 |
| 2841 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2838 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 2842 return IC_utilities[id]; | 2839 return IC_utilities[id]; |
| 2843 } | 2840 } |
| 2844 | 2841 |
| 2845 | 2842 |
| 2846 } } // namespace v8::internal | 2843 } } // namespace v8::internal |
| OLD | NEW |