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

Side by Side Diff: src/ppc/full-codegen-ppc.cc

Issue 1046223002: PPC: Ensure object literal element boilerplates aren't modified. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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
« 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 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/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_PPC 7 #if V8_TARGET_ARCH_PPC
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 1644
1645 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { 1645 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
1646 Comment cmnt(masm_, "[ ObjectLiteral"); 1646 Comment cmnt(masm_, "[ ObjectLiteral");
1647 1647
1648 expr->BuildConstantProperties(isolate()); 1648 expr->BuildConstantProperties(isolate());
1649 Handle<FixedArray> constant_properties = expr->constant_properties(); 1649 Handle<FixedArray> constant_properties = expr->constant_properties();
1650 __ LoadP(r6, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1650 __ LoadP(r6, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1651 __ LoadP(r6, FieldMemOperand(r6, JSFunction::kLiteralsOffset)); 1651 __ LoadP(r6, FieldMemOperand(r6, JSFunction::kLiteralsOffset));
1652 __ LoadSmiLiteral(r5, Smi::FromInt(expr->literal_index())); 1652 __ LoadSmiLiteral(r5, Smi::FromInt(expr->literal_index()));
1653 __ mov(r4, Operand(constant_properties)); 1653 __ mov(r4, Operand(constant_properties));
1654 int flags = expr->fast_elements() ? ObjectLiteral::kFastElements 1654 int flags = expr->ComputeFlags();
1655 : ObjectLiteral::kNoFlags;
1656 flags |= expr->has_function() ? ObjectLiteral::kHasFunction
1657 : ObjectLiteral::kNoFlags;
1658 __ LoadSmiLiteral(r3, Smi::FromInt(flags)); 1655 __ LoadSmiLiteral(r3, Smi::FromInt(flags));
1659 int properties_count = constant_properties->length() / 2; 1656 if (MustCreateObjectLiteralWithRuntime(expr)) {
1660 if (expr->may_store_doubles() || expr->depth() > 1 ||
1661 masm()->serializer_enabled() || flags != ObjectLiteral::kFastElements ||
1662 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) {
1663 __ Push(r6, r5, r4, r3); 1657 __ Push(r6, r5, r4, r3);
1664 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); 1658 __ CallRuntime(Runtime::kCreateObjectLiteral, 4);
1665 } else { 1659 } else {
1666 FastCloneShallowObjectStub stub(isolate(), properties_count); 1660 FastCloneShallowObjectStub stub(isolate(), expr->properties_count());
1667 __ CallStub(&stub); 1661 __ CallStub(&stub);
1668 } 1662 }
1669 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); 1663 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
1670 1664
1671 // If result_saved is true the result is on top of the stack. If 1665 // If result_saved is true the result is on top of the stack. If
1672 // result_saved is false the result is in r3. 1666 // result_saved is false the result is in r3.
1673 bool result_saved = false; 1667 bool result_saved = false;
1674 1668
1675 // Mark all computed expressions that are bound to a key that 1669 // Mark all computed expressions that are bound to a key that
1676 // is shadowed by a later occurrence of the same key. For the 1670 // is shadowed by a later occurrence of the same key. For the
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1846 } else { 1840 } else {
1847 context()->Plug(r3); 1841 context()->Plug(r3);
1848 } 1842 }
1849 } 1843 }
1850 1844
1851 1845
1852 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { 1846 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
1853 Comment cmnt(masm_, "[ ArrayLiteral"); 1847 Comment cmnt(masm_, "[ ArrayLiteral");
1854 1848
1855 expr->BuildConstantElements(isolate()); 1849 expr->BuildConstantElements(isolate());
1856 int flags = expr->depth() == 1 ? ArrayLiteral::kShallowElements
1857 : ArrayLiteral::kNoFlags;
1858
1859 ZoneList<Expression*>* subexprs = expr->values();
1860 int length = subexprs->length();
1861 Handle<FixedArray> constant_elements = expr->constant_elements(); 1850 Handle<FixedArray> constant_elements = expr->constant_elements();
1862 DCHECK_EQ(2, constant_elements->length()); 1851 bool has_fast_elements =
1863 ElementsKind constant_elements_kind = 1852 IsFastObjectElementsKind(expr->constant_elements_kind());
1864 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value());
1865 bool has_fast_elements = IsFastObjectElementsKind(constant_elements_kind);
1866 Handle<FixedArrayBase> constant_elements_values( 1853 Handle<FixedArrayBase> constant_elements_values(
1867 FixedArrayBase::cast(constant_elements->get(1))); 1854 FixedArrayBase::cast(constant_elements->get(1)));
1868 1855
1869 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; 1856 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE;
1870 if (has_fast_elements && !FLAG_allocation_site_pretenuring) { 1857 if (has_fast_elements && !FLAG_allocation_site_pretenuring) {
1871 // If the only customer of allocation sites is transitioning, then 1858 // If the only customer of allocation sites is transitioning, then
1872 // we can turn it off if we don't have anywhere else to transition to. 1859 // we can turn it off if we don't have anywhere else to transition to.
1873 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; 1860 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
1874 } 1861 }
1875 1862
1876 __ LoadP(r6, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1863 __ LoadP(r6, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1877 __ LoadP(r6, FieldMemOperand(r6, JSFunction::kLiteralsOffset)); 1864 __ LoadP(r6, FieldMemOperand(r6, JSFunction::kLiteralsOffset));
1878 __ LoadSmiLiteral(r5, Smi::FromInt(expr->literal_index())); 1865 __ LoadSmiLiteral(r5, Smi::FromInt(expr->literal_index()));
1879 __ mov(r4, Operand(constant_elements)); 1866 __ mov(r4, Operand(constant_elements));
1880 if (expr->depth() > 1 || length > JSObject::kInitialMaxFastElementArray) { 1867 if (MustCreateArrayLiteralWithRuntime(expr)) {
1881 __ LoadSmiLiteral(r3, Smi::FromInt(flags)); 1868 __ LoadSmiLiteral(r3, Smi::FromInt(expr->ComputeFlags()));
1882 __ Push(r6, r5, r4, r3); 1869 __ Push(r6, r5, r4, r3);
1883 __ CallRuntime(Runtime::kCreateArrayLiteral, 4); 1870 __ CallRuntime(Runtime::kCreateArrayLiteral, 4);
1884 } else { 1871 } else {
1885 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); 1872 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode);
1886 __ CallStub(&stub); 1873 __ CallStub(&stub);
1887 } 1874 }
1888 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); 1875 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
1889 1876
1890 bool result_saved = false; // Is the result saved to the stack? 1877 bool result_saved = false; // Is the result saved to the stack?
1878 ZoneList<Expression*>* subexprs = expr->values();
1879 int length = subexprs->length();
1891 1880
1892 // Emit code to evaluate all the non-constant subexpressions and to store 1881 // Emit code to evaluate all the non-constant subexpressions and to store
1893 // them into the newly cloned array. 1882 // them into the newly cloned array.
1894 for (int i = 0; i < length; i++) { 1883 for (int i = 0; i < length; i++) {
1895 Expression* subexpr = subexprs->at(i); 1884 Expression* subexpr = subexprs->at(i);
1896 // If the subexpression is a literal or a simple materialized literal it 1885 // If the subexpression is a literal or a simple materialized literal it
1897 // is already set in the cloned array. 1886 // is already set in the cloned array.
1898 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; 1887 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue;
1899 1888
1900 if (!result_saved) { 1889 if (!result_saved) {
1901 __ push(r3); 1890 __ push(r3);
1902 __ Push(Smi::FromInt(expr->literal_index())); 1891 __ Push(Smi::FromInt(expr->literal_index()));
1903 result_saved = true; 1892 result_saved = true;
1904 } 1893 }
1905 VisitForAccumulatorValue(subexpr); 1894 VisitForAccumulatorValue(subexpr);
1906 1895
1907 if (IsFastObjectElementsKind(constant_elements_kind)) { 1896 if (has_fast_elements) {
1908 int offset = FixedArray::kHeaderSize + (i * kPointerSize); 1897 int offset = FixedArray::kHeaderSize + (i * kPointerSize);
1909 __ LoadP(r8, MemOperand(sp, kPointerSize)); // Copy of array literal. 1898 __ LoadP(r8, MemOperand(sp, kPointerSize)); // Copy of array literal.
1910 __ LoadP(r4, FieldMemOperand(r8, JSObject::kElementsOffset)); 1899 __ LoadP(r4, FieldMemOperand(r8, JSObject::kElementsOffset));
1911 __ StoreP(result_register(), FieldMemOperand(r4, offset), r0); 1900 __ StoreP(result_register(), FieldMemOperand(r4, offset), r0);
1912 // Update the write barrier for the array store. 1901 // Update the write barrier for the array store.
1913 __ RecordWriteField(r4, offset, result_register(), r5, kLRHasBeenSaved, 1902 __ RecordWriteField(r4, offset, result_register(), r5, kLRHasBeenSaved,
1914 kDontSaveFPRegs, EMIT_REMEMBERED_SET, 1903 kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1915 INLINE_SMI_CHECK); 1904 INLINE_SMI_CHECK);
1916 } else { 1905 } else {
1917 __ LoadSmiLiteral(r6, Smi::FromInt(i)); 1906 __ LoadSmiLiteral(r6, Smi::FromInt(i));
(...skipping 3511 matching lines...) Expand 10 before | Expand all | Expand 10 after
5429 return ON_STACK_REPLACEMENT; 5418 return ON_STACK_REPLACEMENT;
5430 } 5419 }
5431 5420
5432 DCHECK(interrupt_address == 5421 DCHECK(interrupt_address ==
5433 isolate->builtins()->OsrAfterStackCheck()->entry()); 5422 isolate->builtins()->OsrAfterStackCheck()->entry());
5434 return OSR_AFTER_STACK_CHECK; 5423 return OSR_AFTER_STACK_CHECK;
5435 } 5424 }
5436 } 5425 }
5437 } // namespace v8::internal 5426 } // namespace v8::internal
5438 #endif // V8_TARGET_ARCH_PPC 5427 #endif // V8_TARGET_ARCH_PPC
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