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

Side by Side Diff: src/compiler/arm64/code-generator-arm64.cc

Issue 2467513002: [builtins]: Uniformly push argument count in TF-generated builtins (Closed)
Patch Set: Fix windows build Created 4 years, 1 month 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/compiler/arm/code-generator-arm.cc ('k') | src/compiler/code-assembler.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 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/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/arm64/frames-arm64.h" 7 #include "src/arm64/frames-arm64.h"
8 #include "src/arm64/macro-assembler-arm64.h" 8 #include "src/arm64/macro-assembler-arm64.h"
9 #include "src/compilation-info.h" 9 #include "src/compilation-info.h"
10 #include "src/compiler/code-generator-impl.h" 10 #include "src/compiler/code-generator-impl.h"
(...skipping 1777 matching lines...) Expand 10 before | Expand all | Expand 10 after
1788 frame->AllocateSavedCalleeRegisterSlots(saved_count); 1788 frame->AllocateSavedCalleeRegisterSlots(saved_count);
1789 } 1789 }
1790 } 1790 }
1791 1791
1792 void CodeGenerator::AssembleConstructFrame() { 1792 void CodeGenerator::AssembleConstructFrame() {
1793 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); 1793 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
1794 if (descriptor->UseNativeStack()) { 1794 if (descriptor->UseNativeStack()) {
1795 __ AssertCspAligned(); 1795 __ AssertCspAligned();
1796 } 1796 }
1797 1797
1798 int fixed_frame_size = descriptor->CalculateFixedFrameSize();
1799 int shrink_slots =
1800 frame()->GetTotalFrameSlotCount() - descriptor->CalculateFixedFrameSize();
1801
1798 if (frame_access_state()->has_frame()) { 1802 if (frame_access_state()->has_frame()) {
1803 // Link the frame
1799 if (descriptor->IsJSFunctionCall()) { 1804 if (descriptor->IsJSFunctionCall()) {
1800 DCHECK(!descriptor->UseNativeStack()); 1805 DCHECK(!descriptor->UseNativeStack());
1801 __ Prologue(this->info()->GeneratePreagedPrologue()); 1806 __ Prologue(this->info()->GeneratePreagedPrologue());
1802 } else { 1807 } else {
1803 if (descriptor->IsCFunctionCall()) { 1808 __ Push(lr, fp);
1804 __ Push(lr, fp); 1809 __ Mov(fp, masm_.StackPointer());
1805 __ Mov(fp, masm_.StackPointer());
1806 __ Claim(frame()->GetSpillSlotCount());
1807 } else {
1808 __ StubPrologue(info()->GetOutputStackFrameType(),
1809 frame()->GetTotalFrameSlotCount());
1810 }
1811 } 1810 }
1812
1813 if (!info()->GeneratePreagedPrologue()) { 1811 if (!info()->GeneratePreagedPrologue()) {
1814 unwinding_info_writer_.MarkFrameConstructed(__ pc_offset()); 1812 unwinding_info_writer_.MarkFrameConstructed(__ pc_offset());
1815 } 1813 }
1816 }
1817 1814
1818 int shrink_slots = frame()->GetSpillSlotCount(); 1815 // Create OSR entry if applicable
1816 if (info()->is_osr()) {
1817 // TurboFan OSR-compiled functions cannot be entered directly.
1818 __ Abort(kShouldNotDirectlyEnterOsrFunction);
1819 1819
1820 if (info()->is_osr()) { 1820 // Unoptimized code jumps directly to this entrypoint while the
1821 // TurboFan OSR-compiled functions cannot be entered directly. 1821 // unoptimized
1822 __ Abort(kShouldNotDirectlyEnterOsrFunction); 1822 // frame is still on the stack. Optimized code uses OSR values directly
1823 // from
1824 // the unoptimized frame. Thus, all that needs to be done is to allocate
1825 // the
1826 // remaining stack slots.
1827 if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
1828 osr_pc_offset_ = __ pc_offset();
1829 shrink_slots -= OsrHelper(info()).UnoptimizedFrameSlots();
1830 }
1823 1831
1824 // Unoptimized code jumps directly to this entrypoint while the unoptimized 1832 // Build remainder of frame, including accounting for and filling-in
1825 // frame is still on the stack. Optimized code uses OSR values directly from 1833 // frame-specific header information, e.g. claiming the extra slot that
1826 // the unoptimized frame. Thus, all that needs to be done is to allocate the 1834 // other platforms explicitly push for STUB frames and frames recording
1827 // remaining stack slots. 1835 // their argument count.
1828 if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); 1836 __ Claim(shrink_slots + (fixed_frame_size & 1));
1829 osr_pc_offset_ = __ pc_offset(); 1837 if (descriptor->PushArgumentCount()) {
1830 shrink_slots -= OsrHelper(info()).UnoptimizedFrameSlots(); 1838 __ Str(kJavaScriptCallArgCountRegister,
1831 } 1839 MemOperand(fp, OptimizedBuiltinFrameConstants::kArgCOffset));
1832 1840 }
1833 if (descriptor->IsJSFunctionCall()) { 1841 bool is_stub_frame =
1834 __ Claim(shrink_slots); 1842 !descriptor->IsJSFunctionCall() && !descriptor->IsCFunctionCall();
1843 if (is_stub_frame) {
1844 UseScratchRegisterScope temps(masm());
1845 Register temp = temps.AcquireX();
1846 __ Mov(temp, Smi::FromInt(info()->GetOutputStackFrameType()));
1847 __ Str(temp, MemOperand(fp, TypedFrameConstants::kFrameTypeOffset));
1848 }
1835 } 1849 }
1836 1850
1837 // Save FP registers. 1851 // Save FP registers.
1838 CPURegList saves_fp = CPURegList(CPURegister::kFPRegister, kDRegSizeInBits, 1852 CPURegList saves_fp = CPURegList(CPURegister::kFPRegister, kDRegSizeInBits,
1839 descriptor->CalleeSavedFPRegisters()); 1853 descriptor->CalleeSavedFPRegisters());
1840 int saved_count = saves_fp.Count(); 1854 int saved_count = saves_fp.Count();
1841 if (saved_count != 0) { 1855 if (saved_count != 0) {
1842 DCHECK(saves_fp.list() == CPURegList::GetCalleeSavedFP().list()); 1856 DCHECK(saves_fp.list() == CPURegList::GetCalleeSavedFP().list());
1843 __ PushCPURegList(saves_fp); 1857 __ PushCPURegList(saves_fp);
1844 } 1858 }
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
2095 padding_size -= kInstructionSize; 2109 padding_size -= kInstructionSize;
2096 } 2110 }
2097 } 2111 }
2098 } 2112 }
2099 2113
2100 #undef __ 2114 #undef __
2101 2115
2102 } // namespace compiler 2116 } // namespace compiler
2103 } // namespace internal 2117 } // namespace internal
2104 } // namespace v8 2118 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/arm/code-generator-arm.cc ('k') | src/compiler/code-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698