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

Side by Side Diff: src/arm/full-codegen-arm.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 | « include/v8-version.h ('k') | src/arm64/full-codegen-arm64.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_ARM 7 #if V8_TARGET_ARCH_ARM
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 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 1684
1685 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { 1685 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
1686 Comment cmnt(masm_, "[ ObjectLiteral"); 1686 Comment cmnt(masm_, "[ ObjectLiteral");
1687 1687
1688 expr->BuildConstantProperties(isolate()); 1688 expr->BuildConstantProperties(isolate());
1689 Handle<FixedArray> constant_properties = expr->constant_properties(); 1689 Handle<FixedArray> constant_properties = expr->constant_properties();
1690 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1690 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1691 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); 1691 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset));
1692 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); 1692 __ mov(r2, Operand(Smi::FromInt(expr->literal_index())));
1693 __ mov(r1, Operand(constant_properties)); 1693 __ mov(r1, Operand(constant_properties));
1694 int flags = expr->fast_elements() 1694 int flags = expr->ComputeFlags();
1695 ? ObjectLiteral::kFastElements
1696 : ObjectLiteral::kNoFlags;
1697 flags |= expr->has_function()
1698 ? ObjectLiteral::kHasFunction
1699 : ObjectLiteral::kNoFlags;
1700 __ mov(r0, Operand(Smi::FromInt(flags))); 1695 __ mov(r0, Operand(Smi::FromInt(flags)));
1701 int properties_count = constant_properties->length() / 2; 1696 if (MustCreateObjectLiteralWithRuntime(expr)) {
1702 if (expr->may_store_doubles() || expr->depth() > 1 ||
1703 masm()->serializer_enabled() || flags != ObjectLiteral::kFastElements ||
1704 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) {
1705 __ Push(r3, r2, r1, r0); 1697 __ Push(r3, r2, r1, r0);
1706 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); 1698 __ CallRuntime(Runtime::kCreateObjectLiteral, 4);
1707 } else { 1699 } else {
1708 FastCloneShallowObjectStub stub(isolate(), properties_count); 1700 FastCloneShallowObjectStub stub(isolate(), expr->properties_count());
1709 __ CallStub(&stub); 1701 __ CallStub(&stub);
1710 } 1702 }
1711 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); 1703 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
1712 1704
1713 // If result_saved is true the result is on top of the stack. If 1705 // If result_saved is true the result is on top of the stack. If
1714 // result_saved is false the result is in r0. 1706 // result_saved is false the result is in r0.
1715 bool result_saved = false; 1707 bool result_saved = false;
1716 1708
1717 // Mark all computed expressions that are bound to a key that 1709 // Mark all computed expressions that are bound to a key that
1718 // is shadowed by a later occurrence of the same key. For the 1710 // is shadowed by a later occurrence of the same key. For the
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1890 } else { 1882 } else {
1891 context()->Plug(r0); 1883 context()->Plug(r0);
1892 } 1884 }
1893 } 1885 }
1894 1886
1895 1887
1896 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { 1888 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
1897 Comment cmnt(masm_, "[ ArrayLiteral"); 1889 Comment cmnt(masm_, "[ ArrayLiteral");
1898 1890
1899 expr->BuildConstantElements(isolate()); 1891 expr->BuildConstantElements(isolate());
1900 int flags = expr->depth() == 1
1901 ? ArrayLiteral::kShallowElements
1902 : ArrayLiteral::kNoFlags;
1903 1892
1904 ZoneList<Expression*>* subexprs = expr->values();
1905 int length = subexprs->length();
1906 Handle<FixedArray> constant_elements = expr->constant_elements(); 1893 Handle<FixedArray> constant_elements = expr->constant_elements();
1907 DCHECK_EQ(2, constant_elements->length()); 1894 bool has_fast_elements =
1908 ElementsKind constant_elements_kind = 1895 IsFastObjectElementsKind(expr->constant_elements_kind());
1909 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value());
1910 bool has_fast_elements = IsFastObjectElementsKind(constant_elements_kind);
1911 Handle<FixedArrayBase> constant_elements_values( 1896 Handle<FixedArrayBase> constant_elements_values(
1912 FixedArrayBase::cast(constant_elements->get(1))); 1897 FixedArrayBase::cast(constant_elements->get(1)));
1913 1898
1914 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; 1899 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE;
1915 if (has_fast_elements && !FLAG_allocation_site_pretenuring) { 1900 if (has_fast_elements && !FLAG_allocation_site_pretenuring) {
1916 // If the only customer of allocation sites is transitioning, then 1901 // If the only customer of allocation sites is transitioning, then
1917 // we can turn it off if we don't have anywhere else to transition to. 1902 // we can turn it off if we don't have anywhere else to transition to.
1918 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; 1903 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
1919 } 1904 }
1920 1905
1921 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1906 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1922 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); 1907 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset));
1923 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); 1908 __ mov(r2, Operand(Smi::FromInt(expr->literal_index())));
1924 __ mov(r1, Operand(constant_elements)); 1909 __ mov(r1, Operand(constant_elements));
1925 if (expr->depth() > 1 || length > JSObject::kInitialMaxFastElementArray) { 1910 if (MustCreateArrayLiteralWithRuntime(expr)) {
1926 __ mov(r0, Operand(Smi::FromInt(flags))); 1911 __ mov(r0, Operand(Smi::FromInt(expr->ComputeFlags())));
1927 __ Push(r3, r2, r1, r0); 1912 __ Push(r3, r2, r1, r0);
1928 __ CallRuntime(Runtime::kCreateArrayLiteral, 4); 1913 __ CallRuntime(Runtime::kCreateArrayLiteral, 4);
1929 } else { 1914 } else {
1930 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); 1915 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode);
1931 __ CallStub(&stub); 1916 __ CallStub(&stub);
1932 } 1917 }
1933 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); 1918 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
1934 1919
1935 bool result_saved = false; // Is the result saved to the stack? 1920 bool result_saved = false; // Is the result saved to the stack?
1921 ZoneList<Expression*>* subexprs = expr->values();
1922 int length = subexprs->length();
1936 1923
1937 // Emit code to evaluate all the non-constant subexpressions and to store 1924 // Emit code to evaluate all the non-constant subexpressions and to store
1938 // them into the newly cloned array. 1925 // them into the newly cloned array.
1939 for (int i = 0; i < length; i++) { 1926 for (int i = 0; i < length; i++) {
1940 Expression* subexpr = subexprs->at(i); 1927 Expression* subexpr = subexprs->at(i);
1941 // If the subexpression is a literal or a simple materialized literal it 1928 // If the subexpression is a literal or a simple materialized literal it
1942 // is already set in the cloned array. 1929 // is already set in the cloned array.
1943 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; 1930 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue;
1944 1931
1945 if (!result_saved) { 1932 if (!result_saved) {
1946 __ push(r0); 1933 __ push(r0);
1947 __ Push(Smi::FromInt(expr->literal_index())); 1934 __ Push(Smi::FromInt(expr->literal_index()));
1948 result_saved = true; 1935 result_saved = true;
1949 } 1936 }
1950 VisitForAccumulatorValue(subexpr); 1937 VisitForAccumulatorValue(subexpr);
1951 1938
1952 if (IsFastObjectElementsKind(constant_elements_kind)) { 1939 if (has_fast_elements) {
1953 int offset = FixedArray::kHeaderSize + (i * kPointerSize); 1940 int offset = FixedArray::kHeaderSize + (i * kPointerSize);
1954 __ ldr(r6, MemOperand(sp, kPointerSize)); // Copy of array literal. 1941 __ ldr(r6, MemOperand(sp, kPointerSize)); // Copy of array literal.
1955 __ ldr(r1, FieldMemOperand(r6, JSObject::kElementsOffset)); 1942 __ ldr(r1, FieldMemOperand(r6, JSObject::kElementsOffset));
1956 __ str(result_register(), FieldMemOperand(r1, offset)); 1943 __ str(result_register(), FieldMemOperand(r1, offset));
1957 // Update the write barrier for the array store. 1944 // Update the write barrier for the array store.
1958 __ RecordWriteField(r1, offset, result_register(), r2, 1945 __ RecordWriteField(r1, offset, result_register(), r2,
1959 kLRHasBeenSaved, kDontSaveFPRegs, 1946 kLRHasBeenSaved, kDontSaveFPRegs,
1960 EMIT_REMEMBERED_SET, INLINE_SMI_CHECK); 1947 EMIT_REMEMBERED_SET, INLINE_SMI_CHECK);
1961 } else { 1948 } else {
1962 __ mov(r3, Operand(Smi::FromInt(i))); 1949 __ mov(r3, Operand(Smi::FromInt(i)));
(...skipping 3539 matching lines...) Expand 10 before | Expand all | Expand 10 after
5502 5489
5503 DCHECK(interrupt_address == 5490 DCHECK(interrupt_address ==
5504 isolate->builtins()->OsrAfterStackCheck()->entry()); 5491 isolate->builtins()->OsrAfterStackCheck()->entry());
5505 return OSR_AFTER_STACK_CHECK; 5492 return OSR_AFTER_STACK_CHECK;
5506 } 5493 }
5507 5494
5508 5495
5509 } } // namespace v8::internal 5496 } } // namespace v8::internal
5510 5497
5511 #endif // V8_TARGET_ARCH_ARM 5498 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « include/v8-version.h ('k') | src/arm64/full-codegen-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698