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

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

Issue 1156323004: Version 4.2.77.21 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.2
Patch Set: Created 5 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
« no previous file with comments | « src/mips/full-codegen-mips.cc ('k') | src/ppc/full-codegen-ppc.cc » ('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 // 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 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 1668
1669 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { 1669 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
1670 Comment cmnt(masm_, "[ ObjectLiteral"); 1670 Comment cmnt(masm_, "[ ObjectLiteral");
1671 1671
1672 expr->BuildConstantProperties(isolate()); 1672 expr->BuildConstantProperties(isolate());
1673 Handle<FixedArray> constant_properties = expr->constant_properties(); 1673 Handle<FixedArray> constant_properties = expr->constant_properties();
1674 __ ld(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1674 __ ld(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1675 __ ld(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset)); 1675 __ ld(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset));
1676 __ li(a2, Operand(Smi::FromInt(expr->literal_index()))); 1676 __ li(a2, Operand(Smi::FromInt(expr->literal_index())));
1677 __ li(a1, Operand(constant_properties)); 1677 __ li(a1, Operand(constant_properties));
1678 int flags = expr->fast_elements() 1678 __ li(a0, Operand(Smi::FromInt(expr->ComputeFlags())));
1679 ? ObjectLiteral::kFastElements 1679 if (MustCreateObjectLiteralWithRuntime(expr)) {
1680 : ObjectLiteral::kNoFlags;
1681 flags |= expr->has_function()
1682 ? ObjectLiteral::kHasFunction
1683 : ObjectLiteral::kNoFlags;
1684 __ li(a0, Operand(Smi::FromInt(flags)));
1685 int properties_count = constant_properties->length() / 2;
1686 if (expr->may_store_doubles() || expr->depth() > 1 ||
1687 masm()->serializer_enabled() || flags != ObjectLiteral::kFastElements ||
1688 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) {
1689 __ Push(a3, a2, a1, a0); 1680 __ Push(a3, a2, a1, a0);
1690 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); 1681 __ CallRuntime(Runtime::kCreateObjectLiteral, 4);
1691 } else { 1682 } else {
1692 FastCloneShallowObjectStub stub(isolate(), properties_count); 1683 FastCloneShallowObjectStub stub(isolate(), expr->properties_count());
1693 __ CallStub(&stub); 1684 __ CallStub(&stub);
1694 } 1685 }
1695 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); 1686 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
1696 1687
1697 // If result_saved is true the result is on top of the stack. If 1688 // If result_saved is true the result is on top of the stack. If
1698 // result_saved is false the result is in v0. 1689 // result_saved is false the result is in v0.
1699 bool result_saved = false; 1690 bool result_saved = false;
1700 1691
1701 // Mark all computed expressions that are bound to a key that 1692 // Mark all computed expressions that are bound to a key that
1702 // is shadowed by a later occurrence of the same key. For the 1693 // is shadowed by a later occurrence of the same key. For the
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1874 } else { 1865 } else {
1875 context()->Plug(v0); 1866 context()->Plug(v0);
1876 } 1867 }
1877 } 1868 }
1878 1869
1879 1870
1880 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { 1871 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
1881 Comment cmnt(masm_, "[ ArrayLiteral"); 1872 Comment cmnt(masm_, "[ ArrayLiteral");
1882 1873
1883 expr->BuildConstantElements(isolate()); 1874 expr->BuildConstantElements(isolate());
1884 int flags = expr->depth() == 1
1885 ? ArrayLiteral::kShallowElements
1886 : ArrayLiteral::kNoFlags;
1887
1888 ZoneList<Expression*>* subexprs = expr->values();
1889 int length = subexprs->length();
1890 1875
1891 Handle<FixedArray> constant_elements = expr->constant_elements(); 1876 Handle<FixedArray> constant_elements = expr->constant_elements();
1892 DCHECK_EQ(2, constant_elements->length());
1893 ElementsKind constant_elements_kind =
1894 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value());
1895 bool has_fast_elements = 1877 bool has_fast_elements =
1896 IsFastObjectElementsKind(constant_elements_kind); 1878 IsFastObjectElementsKind(expr->constant_elements_kind());
1897 Handle<FixedArrayBase> constant_elements_values(
1898 FixedArrayBase::cast(constant_elements->get(1)));
1899 1879
1900 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; 1880 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE;
1901 if (has_fast_elements && !FLAG_allocation_site_pretenuring) { 1881 if (has_fast_elements && !FLAG_allocation_site_pretenuring) {
1902 // If the only customer of allocation sites is transitioning, then 1882 // If the only customer of allocation sites is transitioning, then
1903 // we can turn it off if we don't have anywhere else to transition to. 1883 // we can turn it off if we don't have anywhere else to transition to.
1904 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; 1884 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
1905 } 1885 }
1906 1886
1907 __ mov(a0, result_register()); 1887 __ mov(a0, result_register());
1908 __ ld(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1888 __ ld(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1909 __ ld(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset)); 1889 __ ld(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset));
1910 __ li(a2, Operand(Smi::FromInt(expr->literal_index()))); 1890 __ li(a2, Operand(Smi::FromInt(expr->literal_index())));
1911 __ li(a1, Operand(constant_elements)); 1891 __ li(a1, Operand(constant_elements));
1912 if (expr->depth() > 1 || length > JSObject::kInitialMaxFastElementArray) { 1892 if (MustCreateArrayLiteralWithRuntime(expr)) {
1913 __ li(a0, Operand(Smi::FromInt(flags))); 1893 __ li(a0, Operand(Smi::FromInt(expr->ComputeFlags())));
1914 __ Push(a3, a2, a1, a0); 1894 __ Push(a3, a2, a1, a0);
1915 __ CallRuntime(Runtime::kCreateArrayLiteral, 4); 1895 __ CallRuntime(Runtime::kCreateArrayLiteral, 4);
1916 } else { 1896 } else {
1917 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); 1897 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode);
1918 __ CallStub(&stub); 1898 __ CallStub(&stub);
1919 } 1899 }
1920 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); 1900 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
1921 1901
1922 bool result_saved = false; // Is the result saved to the stack? 1902 bool result_saved = false; // Is the result saved to the stack?
1903 ZoneList<Expression*>* subexprs = expr->values();
1904 int length = subexprs->length();
1923 1905
1924 // Emit code to evaluate all the non-constant subexpressions and to store 1906 // Emit code to evaluate all the non-constant subexpressions and to store
1925 // them into the newly cloned array. 1907 // them into the newly cloned array.
1926 for (int i = 0; i < length; i++) { 1908 for (int i = 0; i < length; i++) {
1927 Expression* subexpr = subexprs->at(i); 1909 Expression* subexpr = subexprs->at(i);
1928 // If the subexpression is a literal or a simple materialized literal it 1910 // If the subexpression is a literal or a simple materialized literal it
1929 // is already set in the cloned array. 1911 // is already set in the cloned array.
1930 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; 1912 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue;
1931 1913
1932 if (!result_saved) { 1914 if (!result_saved) {
1933 __ push(v0); // array literal 1915 __ push(v0); // array literal
1934 __ Push(Smi::FromInt(expr->literal_index())); 1916 __ Push(Smi::FromInt(expr->literal_index()));
1935 result_saved = true; 1917 result_saved = true;
1936 } 1918 }
1937 1919
1938 VisitForAccumulatorValue(subexpr); 1920 VisitForAccumulatorValue(subexpr);
1939 1921
1940 if (IsFastObjectElementsKind(constant_elements_kind)) { 1922 if (has_fast_elements) {
1941 int offset = FixedArray::kHeaderSize + (i * kPointerSize); 1923 int offset = FixedArray::kHeaderSize + (i * kPointerSize);
1942 __ ld(a6, MemOperand(sp, kPointerSize)); // Copy of array literal. 1924 __ ld(a6, MemOperand(sp, kPointerSize)); // Copy of array literal.
1943 __ ld(a1, FieldMemOperand(a6, JSObject::kElementsOffset)); 1925 __ ld(a1, FieldMemOperand(a6, JSObject::kElementsOffset));
1944 __ sd(result_register(), FieldMemOperand(a1, offset)); 1926 __ sd(result_register(), FieldMemOperand(a1, offset));
1945 // Update the write barrier for the array store. 1927 // Update the write barrier for the array store.
1946 __ RecordWriteField(a1, offset, result_register(), a2, 1928 __ RecordWriteField(a1, offset, result_register(), a2,
1947 kRAHasBeenSaved, kDontSaveFPRegs, 1929 kRAHasBeenSaved, kDontSaveFPRegs,
1948 EMIT_REMEMBERED_SET, INLINE_SMI_CHECK); 1930 EMIT_REMEMBERED_SET, INLINE_SMI_CHECK);
1949 } else { 1931 } else {
1950 __ li(a3, Operand(Smi::FromInt(i))); 1932 __ li(a3, Operand(Smi::FromInt(i)));
(...skipping 3499 matching lines...) Expand 10 before | Expand all | Expand 10 after
5450 Assembler::target_address_at(pc_immediate_load_address)) == 5432 Assembler::target_address_at(pc_immediate_load_address)) ==
5451 reinterpret_cast<uint64_t>( 5433 reinterpret_cast<uint64_t>(
5452 isolate->builtins()->OsrAfterStackCheck()->entry())); 5434 isolate->builtins()->OsrAfterStackCheck()->entry()));
5453 return OSR_AFTER_STACK_CHECK; 5435 return OSR_AFTER_STACK_CHECK;
5454 } 5436 }
5455 5437
5456 5438
5457 } } // namespace v8::internal 5439 } } // namespace v8::internal
5458 5440
5459 #endif // V8_TARGET_ARCH_MIPS64 5441 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/full-codegen-mips.cc ('k') | src/ppc/full-codegen-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698