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

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

Issue 16950004: Reduce the amount of full code generated to fill out array literals. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Feedback. Rebased. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/x64/code-stubs-x64.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 // 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 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after
1833 for (int i = 0; i < length; i++) { 1833 for (int i = 0; i < length; i++) {
1834 Expression* subexpr = subexprs->at(i); 1834 Expression* subexpr = subexprs->at(i);
1835 // If the subexpression is a literal or a simple materialized literal it 1835 // If the subexpression is a literal or a simple materialized literal it
1836 // is already set in the cloned array. 1836 // is already set in the cloned array.
1837 if (subexpr->AsLiteral() != NULL || 1837 if (subexpr->AsLiteral() != NULL ||
1838 CompileTimeValue::IsCompileTimeValue(subexpr)) { 1838 CompileTimeValue::IsCompileTimeValue(subexpr)) {
1839 continue; 1839 continue;
1840 } 1840 }
1841 1841
1842 if (!result_saved) { 1842 if (!result_saved) {
1843 __ push(v0); 1843 __ push(v0); // array literal
1844 __ Push(Smi::FromInt(expr->literal_index()));
1844 result_saved = true; 1845 result_saved = true;
1845 } 1846 }
1846 1847
1847 VisitForAccumulatorValue(subexpr); 1848 VisitForAccumulatorValue(subexpr);
1848 1849
1849 if (IsFastObjectElementsKind(constant_elements_kind)) { 1850 if (IsFastObjectElementsKind(constant_elements_kind)) {
1850 int offset = FixedArray::kHeaderSize + (i * kPointerSize); 1851 int offset = FixedArray::kHeaderSize + (i * kPointerSize);
1851 __ lw(t2, MemOperand(sp)); // Copy of array literal. 1852 __ lw(t2, MemOperand(sp, kPointerSize)); // Copy of array literal.
1852 __ lw(a1, FieldMemOperand(t2, JSObject::kElementsOffset)); 1853 __ lw(a1, FieldMemOperand(t2, JSObject::kElementsOffset));
1853 __ sw(result_register(), FieldMemOperand(a1, offset)); 1854 __ sw(result_register(), FieldMemOperand(a1, offset));
1854 // Update the write barrier for the array store. 1855 // Update the write barrier for the array store.
1855 __ RecordWriteField(a1, offset, result_register(), a2, 1856 __ RecordWriteField(a1, offset, result_register(), a2,
1856 kRAHasBeenSaved, kDontSaveFPRegs, 1857 kRAHasBeenSaved, kDontSaveFPRegs,
1857 EMIT_REMEMBERED_SET, INLINE_SMI_CHECK); 1858 EMIT_REMEMBERED_SET, INLINE_SMI_CHECK);
1858 } else { 1859 } else {
1859 __ lw(a1, MemOperand(sp)); // Copy of array literal.
1860 __ lw(a2, FieldMemOperand(a1, JSObject::kMapOffset));
1861 __ li(a3, Operand(Smi::FromInt(i))); 1860 __ li(a3, Operand(Smi::FromInt(i)));
1862 __ li(t0, Operand(Smi::FromInt(expr->literal_index())));
1863 __ mov(a0, result_register()); 1861 __ mov(a0, result_register());
1864 StoreArrayLiteralElementStub stub; 1862 StoreArrayLiteralElementStub stub;
1865 __ CallStub(&stub); 1863 __ CallStub(&stub);
1866 } 1864 }
1867 1865
1868 PrepareForBailoutForId(expr->GetIdForElement(i), NO_REGISTERS); 1866 PrepareForBailoutForId(expr->GetIdForElement(i), NO_REGISTERS);
1869 } 1867 }
1870 if (result_saved) { 1868 if (result_saved) {
1869 __ Pop(); // literal index
1871 context()->PlugTOS(); 1870 context()->PlugTOS();
1872 } else { 1871 } else {
1873 context()->Plug(v0); 1872 context()->Plug(v0);
1874 } 1873 }
1875 } 1874 }
1876 1875
1877 1876
1878 void FullCodeGenerator::VisitAssignment(Assignment* expr) { 1877 void FullCodeGenerator::VisitAssignment(Assignment* expr) {
1879 Comment cmnt(masm_, "[ Assignment"); 1878 Comment cmnt(masm_, "[ Assignment");
1880 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' 1879 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError'
(...skipping 3047 matching lines...) Expand 10 before | Expand all | Expand 10 after
4928 *context_length = 0; 4927 *context_length = 0;
4929 return previous_; 4928 return previous_;
4930 } 4929 }
4931 4930
4932 4931
4933 #undef __ 4932 #undef __
4934 4933
4935 } } // namespace v8::internal 4934 } } // namespace v8::internal
4936 4935
4937 #endif // V8_TARGET_ARCH_MIPS 4936 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698