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

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

Issue 1049793002: MIPS64: 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_MIPS64 7 #if V8_TARGET_ARCH_MIPS64
8 8
9 // Note on Mips implementation: 9 // Note on Mips implementation:
10 // 10 //
(...skipping 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 1675
1676 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { 1676 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
1677 Comment cmnt(masm_, "[ ObjectLiteral"); 1677 Comment cmnt(masm_, "[ ObjectLiteral");
1678 1678
1679 expr->BuildConstantProperties(isolate()); 1679 expr->BuildConstantProperties(isolate());
1680 Handle<FixedArray> constant_properties = expr->constant_properties(); 1680 Handle<FixedArray> constant_properties = expr->constant_properties();
1681 __ ld(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1681 __ ld(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1682 __ ld(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset)); 1682 __ ld(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset));
1683 __ li(a2, Operand(Smi::FromInt(expr->literal_index()))); 1683 __ li(a2, Operand(Smi::FromInt(expr->literal_index())));
1684 __ li(a1, Operand(constant_properties)); 1684 __ li(a1, Operand(constant_properties));
1685 int flags = expr->fast_elements() 1685 __ li(a0, Operand(Smi::FromInt(expr->ComputeFlags())));
1686 ? ObjectLiteral::kFastElements 1686 if (MustCreateObjectLiteralWithRuntime(expr)) {
1687 : ObjectLiteral::kNoFlags;
1688 flags |= expr->has_function()
1689 ? ObjectLiteral::kHasFunction
1690 : ObjectLiteral::kNoFlags;
1691 __ li(a0, Operand(Smi::FromInt(flags)));
1692 int properties_count = constant_properties->length() / 2;
1693 if (expr->may_store_doubles() || expr->depth() > 1 ||
1694 masm()->serializer_enabled() || flags != ObjectLiteral::kFastElements ||
1695 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) {
1696 __ Push(a3, a2, a1, a0); 1687 __ Push(a3, a2, a1, a0);
1697 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); 1688 __ CallRuntime(Runtime::kCreateObjectLiteral, 4);
1698 } else { 1689 } else {
1699 FastCloneShallowObjectStub stub(isolate(), properties_count); 1690 FastCloneShallowObjectStub stub(isolate(), expr->properties_count());
1700 __ CallStub(&stub); 1691 __ CallStub(&stub);
1701 } 1692 }
1702 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); 1693 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
1703 1694
1704 // If result_saved is true the result is on top of the stack. If 1695 // If result_saved is true the result is on top of the stack. If
1705 // result_saved is false the result is in v0. 1696 // result_saved is false the result is in v0.
1706 bool result_saved = false; 1697 bool result_saved = false;
1707 1698
1708 // Mark all computed expressions that are bound to a key that 1699 // Mark all computed expressions that are bound to a key that
1709 // is shadowed by a later occurrence of the same key. For the 1700 // is shadowed by a later occurrence of the same key. For the
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 } else { 1872 } else {
1882 context()->Plug(v0); 1873 context()->Plug(v0);
1883 } 1874 }
1884 } 1875 }
1885 1876
1886 1877
1887 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { 1878 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
1888 Comment cmnt(masm_, "[ ArrayLiteral"); 1879 Comment cmnt(masm_, "[ ArrayLiteral");
1889 1880
1890 expr->BuildConstantElements(isolate()); 1881 expr->BuildConstantElements(isolate());
1891 int flags = expr->depth() == 1
1892 ? ArrayLiteral::kShallowElements
1893 : ArrayLiteral::kNoFlags;
1894
1895 ZoneList<Expression*>* subexprs = expr->values();
1896 int length = subexprs->length();
1897 1882
1898 Handle<FixedArray> constant_elements = expr->constant_elements(); 1883 Handle<FixedArray> constant_elements = expr->constant_elements();
1899 DCHECK_EQ(2, constant_elements->length());
1900 ElementsKind constant_elements_kind =
1901 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value());
1902 bool has_fast_elements = 1884 bool has_fast_elements =
1903 IsFastObjectElementsKind(constant_elements_kind); 1885 IsFastObjectElementsKind(expr->constant_elements_kind());
1904 Handle<FixedArrayBase> constant_elements_values(
1905 FixedArrayBase::cast(constant_elements->get(1)));
1906 1886
1907 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; 1887 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE;
1908 if (has_fast_elements && !FLAG_allocation_site_pretenuring) { 1888 if (has_fast_elements && !FLAG_allocation_site_pretenuring) {
1909 // If the only customer of allocation sites is transitioning, then 1889 // If the only customer of allocation sites is transitioning, then
1910 // we can turn it off if we don't have anywhere else to transition to. 1890 // we can turn it off if we don't have anywhere else to transition to.
1911 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; 1891 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
1912 } 1892 }
1913 1893
1914 __ mov(a0, result_register()); 1894 __ mov(a0, result_register());
1915 __ ld(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1895 __ ld(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1916 __ ld(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset)); 1896 __ ld(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset));
1917 __ li(a2, Operand(Smi::FromInt(expr->literal_index()))); 1897 __ li(a2, Operand(Smi::FromInt(expr->literal_index())));
1918 __ li(a1, Operand(constant_elements)); 1898 __ li(a1, Operand(constant_elements));
1919 if (expr->depth() > 1 || length > JSObject::kInitialMaxFastElementArray) { 1899 if (MustCreateArrayLiteralWithRuntime(expr)) {
1920 __ li(a0, Operand(Smi::FromInt(flags))); 1900 __ li(a0, Operand(Smi::FromInt(expr->ComputeFlags())));
1921 __ Push(a3, a2, a1, a0); 1901 __ Push(a3, a2, a1, a0);
1922 __ CallRuntime(Runtime::kCreateArrayLiteral, 4); 1902 __ CallRuntime(Runtime::kCreateArrayLiteral, 4);
1923 } else { 1903 } else {
1924 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); 1904 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode);
1925 __ CallStub(&stub); 1905 __ CallStub(&stub);
1926 } 1906 }
1927 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); 1907 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
1928 1908
1929 bool result_saved = false; // Is the result saved to the stack? 1909 bool result_saved = false; // Is the result saved to the stack?
1910 ZoneList<Expression*>* subexprs = expr->values();
1911 int length = subexprs->length();
1930 1912
1931 // Emit code to evaluate all the non-constant subexpressions and to store 1913 // Emit code to evaluate all the non-constant subexpressions and to store
1932 // them into the newly cloned array. 1914 // them into the newly cloned array.
1933 for (int i = 0; i < length; i++) { 1915 for (int i = 0; i < length; i++) {
1934 Expression* subexpr = subexprs->at(i); 1916 Expression* subexpr = subexprs->at(i);
1935 // If the subexpression is a literal or a simple materialized literal it 1917 // If the subexpression is a literal or a simple materialized literal it
1936 // is already set in the cloned array. 1918 // is already set in the cloned array.
1937 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; 1919 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue;
1938 1920
1939 if (!result_saved) { 1921 if (!result_saved) {
1940 __ push(v0); // array literal 1922 __ push(v0); // array literal
1941 __ Push(Smi::FromInt(expr->literal_index())); 1923 __ Push(Smi::FromInt(expr->literal_index()));
1942 result_saved = true; 1924 result_saved = true;
1943 } 1925 }
1944 1926
1945 VisitForAccumulatorValue(subexpr); 1927 VisitForAccumulatorValue(subexpr);
1946 1928
1947 if (IsFastObjectElementsKind(constant_elements_kind)) { 1929 if (has_fast_elements) {
1948 int offset = FixedArray::kHeaderSize + (i * kPointerSize); 1930 int offset = FixedArray::kHeaderSize + (i * kPointerSize);
1949 __ ld(a6, MemOperand(sp, kPointerSize)); // Copy of array literal. 1931 __ ld(a6, MemOperand(sp, kPointerSize)); // Copy of array literal.
1950 __ ld(a1, FieldMemOperand(a6, JSObject::kElementsOffset)); 1932 __ ld(a1, FieldMemOperand(a6, JSObject::kElementsOffset));
1951 __ sd(result_register(), FieldMemOperand(a1, offset)); 1933 __ sd(result_register(), FieldMemOperand(a1, offset));
1952 // Update the write barrier for the array store. 1934 // Update the write barrier for the array store.
1953 __ RecordWriteField(a1, offset, result_register(), a2, 1935 __ RecordWriteField(a1, offset, result_register(), a2,
1954 kRAHasBeenSaved, kDontSaveFPRegs, 1936 kRAHasBeenSaved, kDontSaveFPRegs,
1955 EMIT_REMEMBERED_SET, INLINE_SMI_CHECK); 1937 EMIT_REMEMBERED_SET, INLINE_SMI_CHECK);
1956 } else { 1938 } else {
1957 __ li(a3, Operand(Smi::FromInt(i))); 1939 __ li(a3, Operand(Smi::FromInt(i)));
(...skipping 3483 matching lines...) Expand 10 before | Expand all | Expand 10 after
5441 Assembler::target_address_at(pc_immediate_load_address)) == 5423 Assembler::target_address_at(pc_immediate_load_address)) ==
5442 reinterpret_cast<uint64_t>( 5424 reinterpret_cast<uint64_t>(
5443 isolate->builtins()->OsrAfterStackCheck()->entry())); 5425 isolate->builtins()->OsrAfterStackCheck()->entry()));
5444 return OSR_AFTER_STACK_CHECK; 5426 return OSR_AFTER_STACK_CHECK;
5445 } 5427 }
5446 5428
5447 5429
5448 } } // namespace v8::internal 5430 } } // namespace v8::internal
5449 5431
5450 #endif // V8_TARGET_ARCH_MIPS64 5432 #endif // V8_TARGET_ARCH_MIPS64
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