Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: src/factory.cc

Issue 338793004: More set_map() calls replaced with MigrateToMap(). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/bootstrapper.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/factory.h" 5 #include "src/factory.h"
6 6
7 #include "src/conversions.h" 7 #include "src/conversions.h"
8 #include "src/isolate-inl.h" 8 #include "src/isolate-inl.h"
9 #include "src/macro-assembler.h" 9 #include "src/macro-assembler.h"
10 10
(...skipping 1800 matching lines...) Expand 10 before | Expand all | Expand 10 after
1811 OneByteStringKey key(STATIC_ASCII_VECTOR("<freezing call trap>"), 1811 OneByteStringKey key(STATIC_ASCII_VECTOR("<freezing call trap>"),
1812 heap->HashSeed()); 1812 heap->HashSeed());
1813 Handle<String> name = InternalizeStringWithKey(&key); 1813 Handle<String> name = InternalizeStringWithKey(&key);
1814 shared = NewSharedFunctionInfo(name, MaybeHandle<Code>()); 1814 shared = NewSharedFunctionInfo(name, MaybeHandle<Code>());
1815 } 1815 }
1816 1816
1817 // In order to keep heap in consistent state there must be no allocations 1817 // In order to keep heap in consistent state there must be no allocations
1818 // before object re-initialization is finished and filler object is installed. 1818 // before object re-initialization is finished and filler object is installed.
1819 DisallowHeapAllocation no_allocation; 1819 DisallowHeapAllocation no_allocation;
1820 1820
1821 // Put in filler if the new object is smaller than the old.
1822 if (size_difference > 0) {
1823 heap->CreateFillerObjectAt(
1824 object->address() + map->instance_size(), size_difference);
Toon Verwaest 2014/06/24 13:15:13 AdjustLiveBytes?
Igor Sheludko 2014/06/24 13:55:54 Done.
1825 }
1826
1821 // Reset the map for the object. 1827 // Reset the map for the object.
1822 object->set_map(*map); 1828 object->synchronized_set_map(*map);
1823 Handle<JSObject> jsobj = Handle<JSObject>::cast(object); 1829 Handle<JSObject> jsobj = Handle<JSObject>::cast(object);
1824 1830
1825 // Reinitialize the object from the constructor map. 1831 // Reinitialize the object from the constructor map.
1826 heap->InitializeJSObjectFromMap(*jsobj, *properties, *map); 1832 heap->InitializeJSObjectFromMap(*jsobj, *properties, *map);
1827 1833
1828 // Functions require some minimal initialization. 1834 // Functions require some minimal initialization.
1829 if (type == JS_FUNCTION_TYPE) { 1835 if (type == JS_FUNCTION_TYPE) {
1830 map->set_function_with_prototype(true); 1836 map->set_function_with_prototype(true);
1831 Handle<JSFunction> js_function = Handle<JSFunction>::cast(object); 1837 Handle<JSFunction> js_function = Handle<JSFunction>::cast(object);
1832 Handle<Context> context(isolate()->context()->native_context()); 1838 Handle<Context> context(isolate()->context()->native_context());
1833 InitializeFunction(js_function, shared.ToHandleChecked(), context); 1839 InitializeFunction(js_function, shared.ToHandleChecked(), context);
1834 } 1840 }
1835
1836 // Put in filler if the new object is smaller than the old.
1837 if (size_difference > 0) {
1838 heap->CreateFillerObjectAt(
1839 object->address() + map->instance_size(), size_difference);
1840 }
1841 } 1841 }
1842 1842
1843 1843
1844 void Factory::ReinitializeJSGlobalProxy(Handle<JSGlobalProxy> object, 1844 void Factory::ReinitializeJSGlobalProxy(Handle<JSGlobalProxy> object,
1845 Handle<JSFunction> constructor) { 1845 Handle<JSFunction> constructor) {
1846 ASSERT(constructor->has_initial_map()); 1846 ASSERT(constructor->has_initial_map());
1847 Handle<Map> map(constructor->initial_map(), isolate()); 1847 Handle<Map> map(constructor->initial_map(), isolate());
1848 1848
1849 // The proxy's hash should be retained across reinitialization. 1849 // The proxy's hash should be retained across reinitialization.
1850 Handle<Object> hash(object->hash(), isolate()); 1850 Handle<Object> hash(object->hash(), isolate());
1851 1851
1852 // Check that the already allocated object has the same size and type as 1852 // Check that the already allocated object has the same size and type as
1853 // objects allocated using the constructor. 1853 // objects allocated using the constructor.
1854 ASSERT(map->instance_size() == object->map()->instance_size()); 1854 ASSERT(map->instance_size() == object->map()->instance_size());
1855 ASSERT(map->instance_type() == object->map()->instance_type()); 1855 ASSERT(map->instance_type() == object->map()->instance_type());
1856 1856
1857 // Allocate the backing storage for the properties. 1857 // Allocate the backing storage for the properties.
1858 int prop_size = map->InitialPropertiesLength(); 1858 int prop_size = map->InitialPropertiesLength();
1859 Handle<FixedArray> properties = NewFixedArray(prop_size, TENURED); 1859 Handle<FixedArray> properties = NewFixedArray(prop_size, TENURED);
1860 1860
1861 // In order to keep heap in consistent state there must be no allocations 1861 // In order to keep heap in consistent state there must be no allocations
1862 // before object re-initialization is finished. 1862 // before object re-initialization is finished.
1863 DisallowHeapAllocation no_allocation; 1863 DisallowHeapAllocation no_allocation;
1864 1864
1865 // Reset the map for the object. 1865 // Reset the map for the object.
1866 object->set_map(constructor->initial_map()); 1866 object->synchronized_set_map(*map);
1867 1867
1868 Heap* heap = isolate()->heap(); 1868 Heap* heap = isolate()->heap();
1869 // Reinitialize the object from the constructor map. 1869 // Reinitialize the object from the constructor map.
1870 heap->InitializeJSObjectFromMap(*object, *properties, *map); 1870 heap->InitializeJSObjectFromMap(*object, *properties, *map);
1871 1871
1872 // Restore the saved hash. 1872 // Restore the saved hash.
1873 object->set_hash(*hash); 1873 object->set_hash(*hash);
1874 } 1874 }
1875 1875
1876 1876
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
2371 return Handle<Object>::null(); 2371 return Handle<Object>::null();
2372 } 2372 }
2373 2373
2374 2374
2375 Handle<Object> Factory::ToBoolean(bool value) { 2375 Handle<Object> Factory::ToBoolean(bool value) {
2376 return value ? true_value() : false_value(); 2376 return value ? true_value() : false_value();
2377 } 2377 }
2378 2378
2379 2379
2380 } } // namespace v8::internal 2380 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698