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

Side by Side Diff: src/bootstrapper.cc

Issue 12183018: Create pre-frozen change records for Object.observe (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 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 | src/contexts.h » ('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 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 1812 matching lines...) Expand 10 before | Expand all | Expand 10 after
1823 initial_map->AppendDescriptor(&input_field, witness); 1823 initial_map->AppendDescriptor(&input_field, witness);
1824 } 1824 }
1825 1825
1826 initial_map->set_inobject_properties(2); 1826 initial_map->set_inobject_properties(2);
1827 initial_map->set_pre_allocated_property_fields(2); 1827 initial_map->set_pre_allocated_property_fields(2);
1828 initial_map->set_unused_property_fields(0); 1828 initial_map->set_unused_property_fields(0);
1829 1829
1830 native_context()->set_regexp_result_map(*initial_map); 1830 native_context()->set_regexp_result_map(*initial_map);
1831 } 1831 }
1832 1832
1833 // Should be flag-guarded with FLAG_harmony_observation, but can't due to
1834 // context snapshotting.
1835 {
1836 Handle<Map> change_record_map =
1837 factory()->NewMap(JS_OBJECT_TYPE, JSChangeRecord::kSize);
1838 change_record_map->set_constructor(native_context()->object_function());
1839 change_record_map->set_non_instance_prototype(false);
1840 change_record_map->set_prototype(
1841 native_context()->initial_object_prototype());
1842
1843 Handle<DescriptorArray> descriptors = factory()->NewDescriptorArray(0, 4);
1844 DescriptorArray::WhitenessWitness witness(*descriptors);
1845 change_record_map->set_instance_descriptors(*descriptors);
1846
1847 PropertyAttributes attrs =
1848 static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
1849 {
1850 FieldDescriptor field(
1851 heap()->type_symbol(), JSChangeRecord::kTypeIndex, attrs);
1852 change_record_map->AppendDescriptor(&field, witness);
1853 }
1854 {
1855 FieldDescriptor field(
1856 heap()->object_symbol(), JSChangeRecord::kObjectIndex, attrs);
1857 change_record_map->AppendDescriptor(&field, witness);
1858 }
1859 {
1860 FieldDescriptor field(
1861 heap()->name_symbol(), JSChangeRecord::kNameIndex, attrs);
1862 change_record_map->AppendDescriptor(&field, witness);
1863 }
1864
1865 change_record_map->set_inobject_properties(4);
1866 change_record_map->set_pre_allocated_property_fields(3);
1867 change_record_map->set_unused_property_fields(1);
1868
1869 change_record_map->set_is_extensible(false);
1870
1871 native_context()->set_change_record_map(*change_record_map);
1872
1873 // Create a different map for change records with an oldValue property.
1874 {
1875 FieldDescriptor field(
1876 heap()->oldvalue_symbol(), JSChangeRecord::kOldValueIndex, attrs);
1877 MaybeObject* maybe_map = change_record_map->CopyAddDescriptor(
1878 &field, OMIT_TRANSITION);
1879 if (!maybe_map->ToHandle(&change_record_map, isolate())) return false;
1880 }
1881 change_record_map->set_inobject_properties(4);
1882 change_record_map->set_pre_allocated_property_fields(4);
1883 change_record_map->set_unused_property_fields(0);
1884 native_context()->set_change_record_oldvalue_map(*change_record_map);
1885 }
1886
1833 #ifdef VERIFY_HEAP 1887 #ifdef VERIFY_HEAP
1834 builtins->Verify(); 1888 builtins->Verify();
1835 #endif 1889 #endif
1836 1890
1837 return true; 1891 return true;
1838 } 1892 }
1839 1893
1840 1894
1841 bool Genesis::InstallExperimentalNatives() { 1895 bool Genesis::InstallExperimentalNatives() {
1842 for (int i = ExperimentalNatives::GetDebuggerCount(); 1896 for (int i = ExperimentalNatives::GetDebuggerCount();
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
2429 return from + sizeof(NestingCounterType); 2483 return from + sizeof(NestingCounterType);
2430 } 2484 }
2431 2485
2432 2486
2433 // Called when the top-level V8 mutex is destroyed. 2487 // Called when the top-level V8 mutex is destroyed.
2434 void Bootstrapper::FreeThreadResources() { 2488 void Bootstrapper::FreeThreadResources() {
2435 ASSERT(!IsActive()); 2489 ASSERT(!IsActive());
2436 } 2490 }
2437 2491
2438 } } // namespace v8::internal 2492 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/contexts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698