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

Side by Side Diff: src/bootstrapper.cc

Issue 15690018: Handlify map allocation in Genesis::InstallInternalArray. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 true, true); 1604 true, true);
1605 Handle<JSObject> prototype = 1605 Handle<JSObject> prototype =
1606 factory()->NewJSObject(isolate()->object_function(), TENURED); 1606 factory()->NewJSObject(isolate()->object_function(), TENURED);
1607 SetPrototype(array_function, prototype); 1607 SetPrototype(array_function, prototype);
1608 1608
1609 array_function->shared()->set_construct_stub( 1609 array_function->shared()->set_construct_stub(
1610 isolate()->builtins()->builtin(Builtins::kCommonArrayConstructCode)); 1610 isolate()->builtins()->builtin(Builtins::kCommonArrayConstructCode));
1611 1611
1612 array_function->shared()->DontAdaptArguments(); 1612 array_function->shared()->DontAdaptArguments();
1613 1613
1614 MaybeObject* maybe_map = array_function->initial_map()->Copy(); 1614 Handle<Map> original_map(array_function->initial_map());
1615 Map* new_map; 1615 Handle<Map> initial_map = factory()->CopyMap(original_map);
1616 if (!maybe_map->To(&new_map)) return Handle<JSFunction>::null(); 1616 initial_map->set_elements_kind(elements_kind);
1617 new_map->set_elements_kind(elements_kind); 1617 array_function->set_initial_map(*initial_map);
1618 array_function->set_initial_map(new_map);
1619 1618
1620 // Make "length" magic on instances. 1619 // Make "length" magic on instances.
1621 Handle<Map> initial_map(array_function->initial_map());
1622 Handle<DescriptorArray> array_descriptors( 1620 Handle<DescriptorArray> array_descriptors(
1623 factory()->NewDescriptorArray(0, 1)); 1621 factory()->NewDescriptorArray(0, 1));
1624 DescriptorArray::WhitenessWitness witness(*array_descriptors); 1622 DescriptorArray::WhitenessWitness witness(*array_descriptors);
1625 1623
1626 Handle<Foreign> array_length(factory()->NewForeign( 1624 Handle<Foreign> array_length(factory()->NewForeign(
1627 &Accessors::ArrayLength)); 1625 &Accessors::ArrayLength));
1628 PropertyAttributes attribs = static_cast<PropertyAttributes>( 1626 PropertyAttributes attribs = static_cast<PropertyAttributes>(
1629 DONT_ENUM | DONT_DELETE); 1627 DONT_ENUM | DONT_DELETE);
1630 initial_map->set_instance_descriptors(*array_descriptors); 1628 initial_map->set_instance_descriptors(*array_descriptors);
1631 1629
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1865 } 1863 }
1866 1864
1867 // InternalArrays should not use Smi-Only array optimizations. There are too 1865 // InternalArrays should not use Smi-Only array optimizations. There are too
1868 // many places in the C++ runtime code (e.g. RegEx) that assume that 1866 // many places in the C++ runtime code (e.g. RegEx) that assume that
1869 // elements in InternalArrays can be set to non-Smi values without going 1867 // elements in InternalArrays can be set to non-Smi values without going
1870 // through a common bottleneck that would make the SMI_ONLY -> FAST_ELEMENT 1868 // through a common bottleneck that would make the SMI_ONLY -> FAST_ELEMENT
1871 // transition easy to trap. Moreover, they rarely are smi-only. 1869 // transition easy to trap. Moreover, they rarely are smi-only.
1872 { 1870 {
1873 Handle<JSFunction> array_function = 1871 Handle<JSFunction> array_function =
1874 InstallInternalArray(builtins, "InternalArray", FAST_HOLEY_ELEMENTS); 1872 InstallInternalArray(builtins, "InternalArray", FAST_HOLEY_ELEMENTS);
1875 if (array_function.is_null()) return false;
1876 native_context()->set_internal_array_function(*array_function); 1873 native_context()->set_internal_array_function(*array_function);
1877 } 1874 }
1878 1875
1879 { 1876 {
1880 Handle<JSFunction> array_function = 1877 InstallInternalArray(builtins, "InternalPackedArray", FAST_ELEMENTS);
1881 InstallInternalArray(builtins, "InternalPackedArray", FAST_ELEMENTS);
1882 if (array_function.is_null()) return false;
1883 } 1878 }
1884 1879
1885 if (FLAG_disable_native_files) { 1880 if (FLAG_disable_native_files) {
1886 PrintF("Warning: Running without installed natives!\n"); 1881 PrintF("Warning: Running without installed natives!\n");
1887 return true; 1882 return true;
1888 } 1883 }
1889 1884
1890 // Install natives. 1885 // Install natives.
1891 for (int i = Natives::GetDebuggerCount(); 1886 for (int i = Natives::GetDebuggerCount();
1892 i < Natives::GetBuiltinsCount(); 1887 i < Natives::GetBuiltinsCount();
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
2632 return from + sizeof(NestingCounterType); 2627 return from + sizeof(NestingCounterType);
2633 } 2628 }
2634 2629
2635 2630
2636 // Called when the top-level V8 mutex is destroyed. 2631 // Called when the top-level V8 mutex is destroyed.
2637 void Bootstrapper::FreeThreadResources() { 2632 void Bootstrapper::FreeThreadResources() {
2638 ASSERT(!IsActive()); 2633 ASSERT(!IsActive());
2639 } 2634 }
2640 2635
2641 } } // namespace v8::internal 2636 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698