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

Side by Side Diff: src/hydrogen.cc

Issue 19595004: Rename AllocationSiteInfo to AllocationMemento (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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/hydrogen.h ('k') | src/hydrogen-instructions.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1446 AddStore(array, HObjectAccess::ForMap(), array_map); 1446 AddStore(array, HObjectAccess::ForMap(), array_map);
1447 1447
1448 HConstant* empty_fixed_array = 1448 HConstant* empty_fixed_array =
1449 Add<HConstant>(isolate()->factory()->empty_fixed_array()); 1449 Add<HConstant>(isolate()->factory()->empty_fixed_array());
1450 1450
1451 HObjectAccess access = HObjectAccess::ForPropertiesPointer(); 1451 HObjectAccess access = HObjectAccess::ForPropertiesPointer();
1452 AddStore(array, access, empty_fixed_array); 1452 AddStore(array, access, empty_fixed_array);
1453 AddStore(array, HObjectAccess::ForArrayLength(), length_field); 1453 AddStore(array, HObjectAccess::ForArrayLength(), length_field);
1454 1454
1455 if (mode == TRACK_ALLOCATION_SITE) { 1455 if (mode == TRACK_ALLOCATION_SITE) {
1456 BuildCreateAllocationSiteInfo(array, 1456 BuildCreateAllocationMemento(array,
1457 JSArray::kSize, 1457 JSArray::kSize,
1458 allocation_site_payload); 1458 allocation_site_payload);
1459 } 1459 }
1460 1460
1461 int elements_location = JSArray::kSize; 1461 int elements_location = JSArray::kSize;
1462 if (mode == TRACK_ALLOCATION_SITE) { 1462 if (mode == TRACK_ALLOCATION_SITE) {
1463 elements_location += AllocationSiteInfo::kSize; 1463 elements_location += AllocationMemento::kSize;
1464 } 1464 }
1465 1465
1466 HInnerAllocatedObject* elements = 1466 HInnerAllocatedObject* elements =
1467 Add<HInnerAllocatedObject>(array, elements_location); 1467 Add<HInnerAllocatedObject>(array, elements_location);
1468 AddStore(array, HObjectAccess::ForElementsPointer(), elements); 1468 AddStore(array, HObjectAccess::ForElementsPointer(), elements);
1469 return elements; 1469 return elements;
1470 } 1470 }
1471 1471
1472 1472
1473 HLoadNamedField* HGraphBuilder::AddLoadElements(HValue* object, 1473 HLoadNamedField* HGraphBuilder::AddLoadElements(HValue* object,
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1647 HValue* boilerplate, 1647 HValue* boilerplate,
1648 HValue* allocation_site, 1648 HValue* allocation_site,
1649 AllocationSiteMode mode, 1649 AllocationSiteMode mode,
1650 ElementsKind kind, 1650 ElementsKind kind,
1651 int length) { 1651 int length) {
1652 NoObservableSideEffectsScope no_effects(this); 1652 NoObservableSideEffectsScope no_effects(this);
1653 1653
1654 // All sizes here are multiples of kPointerSize. 1654 // All sizes here are multiples of kPointerSize.
1655 int size = JSArray::kSize; 1655 int size = JSArray::kSize;
1656 if (mode == TRACK_ALLOCATION_SITE) { 1656 if (mode == TRACK_ALLOCATION_SITE) {
1657 size += AllocationSiteInfo::kSize; 1657 size += AllocationMemento::kSize;
1658 } 1658 }
1659 int elems_offset = size; 1659 int elems_offset = size;
1660 if (length > 0) { 1660 if (length > 0) {
1661 size += IsFastDoubleElementsKind(kind) 1661 size += IsFastDoubleElementsKind(kind)
1662 ? FixedDoubleArray::SizeFor(length) 1662 ? FixedDoubleArray::SizeFor(length)
1663 : FixedArray::SizeFor(length); 1663 : FixedArray::SizeFor(length);
1664 } 1664 }
1665 1665
1666 HAllocate::Flags allocate_flags = HAllocate::DefaultFlags(kind); 1666 HAllocate::Flags allocate_flags = HAllocate::DefaultFlags(kind);
1667 // Allocate both the JS array and the elements array in one big 1667 // Allocate both the JS array and the elements array in one big
1668 // allocation. This avoids multiple limit checks. 1668 // allocation. This avoids multiple limit checks.
1669 HValue* size_in_bytes = Add<HConstant>(size); 1669 HValue* size_in_bytes = Add<HConstant>(size);
1670 HInstruction* object = Add<HAllocate>(context, 1670 HInstruction* object = Add<HAllocate>(context,
1671 size_in_bytes, 1671 size_in_bytes,
1672 HType::JSObject(), 1672 HType::JSObject(),
1673 allocate_flags); 1673 allocate_flags);
1674 1674
1675 // Copy the JS array part. 1675 // Copy the JS array part.
1676 for (int i = 0; i < JSArray::kSize; i += kPointerSize) { 1676 for (int i = 0; i < JSArray::kSize; i += kPointerSize) {
1677 if ((i != JSArray::kElementsOffset) || (length == 0)) { 1677 if ((i != JSArray::kElementsOffset) || (length == 0)) {
1678 HObjectAccess access = HObjectAccess::ForJSArrayOffset(i); 1678 HObjectAccess access = HObjectAccess::ForJSArrayOffset(i);
1679 AddStore(object, access, AddLoad(boilerplate, access)); 1679 AddStore(object, access, AddLoad(boilerplate, access));
1680 } 1680 }
1681 } 1681 }
1682 1682
1683 // Create an allocation site info if requested. 1683 // Create an allocation site info if requested.
1684 if (mode == TRACK_ALLOCATION_SITE) { 1684 if (mode == TRACK_ALLOCATION_SITE) {
1685 BuildCreateAllocationSiteInfo(object, JSArray::kSize, allocation_site); 1685 BuildCreateAllocationMemento(object, JSArray::kSize, allocation_site);
1686 } 1686 }
1687 1687
1688 if (length > 0) { 1688 if (length > 0) {
1689 // Get hold of the elements array of the boilerplate and setup the 1689 // Get hold of the elements array of the boilerplate and setup the
1690 // elements pointer in the resulting object. 1690 // elements pointer in the resulting object.
1691 HValue* boilerplate_elements = AddLoadElements(boilerplate); 1691 HValue* boilerplate_elements = AddLoadElements(boilerplate);
1692 HValue* object_elements = Add<HInnerAllocatedObject>(object, elems_offset); 1692 HValue* object_elements = Add<HInnerAllocatedObject>(object, elems_offset);
1693 AddStore(object, HObjectAccess::ForElementsPointer(), object_elements); 1693 AddStore(object, HObjectAccess::ForElementsPointer(), object_elements);
1694 1694
1695 // Copy the elements array header. 1695 // Copy the elements array header.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1780 BuildCheckMap(value, type->Classes().Current()); 1780 BuildCheckMap(value, type->Classes().Current());
1781 } else { 1781 } else {
1782 if_nil.Deopt(); 1782 if_nil.Deopt();
1783 } 1783 }
1784 } 1784 }
1785 1785
1786 if_nil.CaptureContinuation(continuation); 1786 if_nil.CaptureContinuation(continuation);
1787 } 1787 }
1788 1788
1789 1789
1790 HValue* HGraphBuilder::BuildCreateAllocationSiteInfo(HValue* previous_object, 1790 HValue* HGraphBuilder::BuildCreateAllocationMemento(HValue* previous_object,
1791 int previous_object_size, 1791 int previous_object_size,
1792 HValue* alloc_site) { 1792 HValue* alloc_site) {
1793 ASSERT(alloc_site != NULL); 1793 ASSERT(alloc_site != NULL);
1794 HInnerAllocatedObject* alloc_site_info = Add<HInnerAllocatedObject>( 1794 HInnerAllocatedObject* alloc_memento = Add<HInnerAllocatedObject>(
1795 previous_object, previous_object_size); 1795 previous_object, previous_object_size);
1796 Handle<Map> alloc_site_info_map( 1796 Handle<Map> alloc_memento_map(
1797 isolate()->heap()->allocation_site_info_map()); 1797 isolate()->heap()->allocation_memento_map());
1798 AddStoreMapConstant(alloc_site_info, alloc_site_info_map); 1798 AddStoreMapConstant(alloc_memento, alloc_memento_map);
1799 HObjectAccess access = HObjectAccess::ForAllocationSiteInfoSite(); 1799 HObjectAccess access = HObjectAccess::ForAllocationMementoSite();
1800 AddStore(alloc_site_info, access, alloc_site); 1800 AddStore(alloc_memento, access, alloc_site);
1801 return alloc_site_info; 1801 return alloc_memento;
1802 } 1802 }
1803 1803
1804 1804
1805 HInstruction* HGraphBuilder::BuildGetNativeContext(HValue* context) { 1805 HInstruction* HGraphBuilder::BuildGetNativeContext(HValue* context) {
1806 // Get the global context, then the native context 1806 // Get the global context, then the native context
1807 HInstruction* global_object = Add<HGlobalObject>(context); 1807 HInstruction* global_object = Add<HGlobalObject>(context);
1808 HObjectAccess access = HObjectAccess::ForJSObjectOffset( 1808 HObjectAccess access = HObjectAccess::ForJSObjectOffset(
1809 GlobalObject::kNativeContextOffset); 1809 GlobalObject::kNativeContextOffset);
1810 return AddLoad(global_object, access); 1810 return AddLoad(global_object, access);
1811 } 1811 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1882 } 1882 }
1883 1883
1884 1884
1885 HValue* HGraphBuilder::JSArrayBuilder::EstablishAllocationSize( 1885 HValue* HGraphBuilder::JSArrayBuilder::EstablishAllocationSize(
1886 HValue* length_node) { 1886 HValue* length_node) {
1887 HValue* context = builder()->environment()->LookupContext(); 1887 HValue* context = builder()->environment()->LookupContext();
1888 ASSERT(length_node != NULL); 1888 ASSERT(length_node != NULL);
1889 1889
1890 int base_size = JSArray::kSize; 1890 int base_size = JSArray::kSize;
1891 if (mode_ == TRACK_ALLOCATION_SITE) { 1891 if (mode_ == TRACK_ALLOCATION_SITE) {
1892 base_size += AllocationSiteInfo::kSize; 1892 base_size += AllocationMemento::kSize;
1893 } 1893 }
1894 1894
1895 if (IsFastDoubleElementsKind(kind_)) { 1895 if (IsFastDoubleElementsKind(kind_)) {
1896 base_size += FixedDoubleArray::kHeaderSize; 1896 base_size += FixedDoubleArray::kHeaderSize;
1897 } else { 1897 } else {
1898 base_size += FixedArray::kHeaderSize; 1898 base_size += FixedArray::kHeaderSize;
1899 } 1899 }
1900 1900
1901 HInstruction* elements_size_value = 1901 HInstruction* elements_size_value =
1902 builder()->Add<HConstant>(elements_size()); 1902 builder()->Add<HConstant>(elements_size());
1903 HInstruction* mul = HMul::New(zone(), context, length_node, 1903 HInstruction* mul = HMul::New(zone(), context, length_node,
1904 elements_size_value); 1904 elements_size_value);
1905 mul->ClearFlag(HValue::kCanOverflow); 1905 mul->ClearFlag(HValue::kCanOverflow);
1906 builder()->AddInstruction(mul); 1906 builder()->AddInstruction(mul);
1907 1907
1908 HInstruction* base = builder()->Add<HConstant>(base_size); 1908 HInstruction* base = builder()->Add<HConstant>(base_size);
1909 HInstruction* total_size = HAdd::New(zone(), context, base, mul); 1909 HInstruction* total_size = HAdd::New(zone(), context, base, mul);
1910 total_size->ClearFlag(HValue::kCanOverflow); 1910 total_size->ClearFlag(HValue::kCanOverflow);
1911 builder()->AddInstruction(total_size); 1911 builder()->AddInstruction(total_size);
1912 return total_size; 1912 return total_size;
1913 } 1913 }
1914 1914
1915 1915
1916 HValue* HGraphBuilder::JSArrayBuilder::EstablishEmptyArrayAllocationSize() { 1916 HValue* HGraphBuilder::JSArrayBuilder::EstablishEmptyArrayAllocationSize() {
1917 int base_size = JSArray::kSize; 1917 int base_size = JSArray::kSize;
1918 if (mode_ == TRACK_ALLOCATION_SITE) { 1918 if (mode_ == TRACK_ALLOCATION_SITE) {
1919 base_size += AllocationSiteInfo::kSize; 1919 base_size += AllocationMemento::kSize;
1920 } 1920 }
1921 1921
1922 base_size += IsFastDoubleElementsKind(kind_) 1922 base_size += IsFastDoubleElementsKind(kind_)
1923 ? FixedDoubleArray::SizeFor(initial_capacity()) 1923 ? FixedDoubleArray::SizeFor(initial_capacity())
1924 : FixedArray::SizeFor(initial_capacity()); 1924 : FixedArray::SizeFor(initial_capacity());
1925 1925
1926 return builder()->Add<HConstant>(base_size); 1926 return builder()->Add<HConstant>(base_size);
1927 } 1927 }
1928 1928
1929 1929
(...skipping 2491 matching lines...) Expand 10 before | Expand all | Expand 10 after
4421 // Check whether to use fast or slow deep-copying for boilerplate. 4421 // Check whether to use fast or slow deep-copying for boilerplate.
4422 int data_size = 0; 4422 int data_size = 0;
4423 int pointer_size = 0; 4423 int pointer_size = 0;
4424 int max_properties = kMaxFastLiteralProperties; 4424 int max_properties = kMaxFastLiteralProperties;
4425 if (IsFastLiteral(original_boilerplate_object, 4425 if (IsFastLiteral(original_boilerplate_object,
4426 kMaxFastLiteralDepth, 4426 kMaxFastLiteralDepth,
4427 &max_properties, 4427 &max_properties,
4428 &data_size, 4428 &data_size,
4429 &pointer_size)) { 4429 &pointer_size)) {
4430 if (mode == TRACK_ALLOCATION_SITE) { 4430 if (mode == TRACK_ALLOCATION_SITE) {
4431 pointer_size += AllocationSiteInfo::kSize; 4431 pointer_size += AllocationMemento::kSize;
4432 } 4432 }
4433 4433
4434 Handle<JSObject> boilerplate_object = DeepCopy(original_boilerplate_object); 4434 Handle<JSObject> boilerplate_object = DeepCopy(original_boilerplate_object);
4435 literal = BuildFastLiteral(context, 4435 literal = BuildFastLiteral(context,
4436 boilerplate_object, 4436 boilerplate_object,
4437 original_boilerplate_object, 4437 original_boilerplate_object,
4438 site, 4438 site,
4439 data_size, 4439 data_size,
4440 pointer_size, 4440 pointer_size,
4441 mode); 4441 mode);
(...skipping 3953 matching lines...) Expand 10 before | Expand all | Expand 10 after
8395 if (boilerplate_object->map()->NumberOfFields() != 0) { 8395 if (boilerplate_object->map()->NumberOfFields() != 0) {
8396 HValue* object_properties = 8396 HValue* object_properties =
8397 Add<HInnerAllocatedObject>(target, object_offset); 8397 Add<HInnerAllocatedObject>(target, object_offset);
8398 BuildEmitInObjectProperties(boilerplate_object, original_boilerplate_object, 8398 BuildEmitInObjectProperties(boilerplate_object, original_boilerplate_object,
8399 object_properties, target, offset, data_target, data_offset); 8399 object_properties, target, offset, data_target, data_offset);
8400 } 8400 }
8401 8401
8402 // Create allocation site info. 8402 // Create allocation site info.
8403 if (mode == TRACK_ALLOCATION_SITE && 8403 if (mode == TRACK_ALLOCATION_SITE &&
8404 boilerplate_object->map()->CanTrackAllocationSite()) { 8404 boilerplate_object->map()->CanTrackAllocationSite()) {
8405 elements_offset += AllocationSiteInfo::kSize; 8405 elements_offset += AllocationMemento::kSize;
8406 *offset += AllocationSiteInfo::kSize; 8406 *offset += AllocationMemento::kSize;
8407 BuildCreateAllocationSiteInfo(target, JSArray::kSize, allocation_site); 8407 BuildCreateAllocationMemento(target, JSArray::kSize, allocation_site);
8408 } 8408 }
8409 } 8409 }
8410 8410
8411 8411
8412 HValue* HOptimizedGraphBuilder::BuildEmitObjectHeader( 8412 HValue* HOptimizedGraphBuilder::BuildEmitObjectHeader(
8413 Handle<JSObject> boilerplate_object, 8413 Handle<JSObject> boilerplate_object,
8414 HInstruction* target, 8414 HInstruction* target,
8415 HInstruction* data_target, 8415 HInstruction* data_target,
8416 int object_offset, 8416 int object_offset,
8417 int elements_offset, 8417 int elements_offset,
(...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after
9912 if (ShouldProduceTraceOutput()) { 9912 if (ShouldProduceTraceOutput()) {
9913 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 9913 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
9914 } 9914 }
9915 9915
9916 #ifdef DEBUG 9916 #ifdef DEBUG
9917 graph_->Verify(false); // No full verify. 9917 graph_->Verify(false); // No full verify.
9918 #endif 9918 #endif
9919 } 9919 }
9920 9920
9921 } } // namespace v8::internal 9921 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698