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

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

Issue 1843143002: [turbofan] CodeGenerator: Frame setup refactoring (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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
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/ast/scopes.h" 5 #include "src/ast/scopes.h"
6 #include "src/compiler/code-generator.h" 6 #include "src/compiler/code-generator.h"
7 #include "src/compiler/code-generator-impl.h" 7 #include "src/compiler/code-generator-impl.h"
8 #include "src/compiler/gap-resolver.h" 8 #include "src/compiler/gap-resolver.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/osr.h" 10 #include "src/compiler/osr.h"
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 __ cvt_s_w(i.OutputDoubleRegister(), i.OutputDoubleRegister()); \ 482 __ cvt_s_w(i.OutputDoubleRegister(), i.OutputDoubleRegister()); \
483 __ bind(ool->exit()); \ 483 __ bind(ool->exit()); \
484 __ bind(&done); \ 484 __ bind(&done); \
485 } 485 }
486 486
487 void CodeGenerator::AssembleDeconstructFrame() { 487 void CodeGenerator::AssembleDeconstructFrame() {
488 __ mov(sp, fp); 488 __ mov(sp, fp);
489 __ Pop(ra, fp); 489 __ Pop(ra, fp);
490 } 490 }
491 491
492 void CodeGenerator::AssembleSetupStackPointer() {}
493
494 void CodeGenerator::AssembleDeconstructActivationRecord(int stack_param_delta) { 492 void CodeGenerator::AssembleDeconstructActivationRecord(int stack_param_delta) {
495 int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta); 493 int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta);
496 if (sp_slot_delta > 0) { 494 if (sp_slot_delta > 0) {
497 __ daddiu(sp, sp, sp_slot_delta * kPointerSize); 495 __ daddiu(sp, sp, sp_slot_delta * kPointerSize);
498 } 496 }
499 frame_access_state()->SetFrameAccessToDefault(); 497 frame_access_state()->SetFrameAccessToDefault();
500 } 498 }
501 499
502 500
503 void CodeGenerator::AssemblePrepareTailCall(int stack_param_delta) { 501 void CodeGenerator::AssemblePrepareTailCall(int stack_param_delta) {
(...skipping 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1869 } 1867 }
1870 1868
1871 1869
1872 void CodeGenerator::AssembleDeoptimizerCall( 1870 void CodeGenerator::AssembleDeoptimizerCall(
1873 int deoptimization_id, Deoptimizer::BailoutType bailout_type) { 1871 int deoptimization_id, Deoptimizer::BailoutType bailout_type) {
1874 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( 1872 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry(
1875 isolate(), deoptimization_id, bailout_type); 1873 isolate(), deoptimization_id, bailout_type);
1876 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); 1874 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY);
1877 } 1875 }
1878 1876
1877 void CodeGenerator::FinishFrame(Frame* frame) {
1878 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
1879 int stack_shrink_slots = frame->GetSpillSlotCount();
1880 if (info()->is_osr()) {
1881 stack_shrink_slots -= OsrHelper(info()).UnoptimizedFrameSlots();
1882 }
1879 1883
1880 void CodeGenerator::AssemblePrologue() { 1884 const RegList saves_fpu = descriptor->CalleeSavedFPRegisters();
1885 if (saves_fpu != 0) {
1886 int count = base::bits::CountPopulation32(saves_fpu);
1887 DCHECK(kNumCalleeSavedFPU == count);
1888 frame->AllocateSavedCalleeRegisterSlots(count *
1889 (kDoubleSize / kPointerSize));
1890 }
1891
1892 const RegList saves = descriptor->CalleeSavedRegisters();
1893 if (saves != 0) {
1894 int count = base::bits::CountPopulation32(saves);
1895 DCHECK(kNumCalleeSaved == count + 1);
1896 frame->AllocateSavedCalleeRegisterSlots(count);
1897 }
1898 frame->set_stack_shrink_slots(stack_shrink_slots);
1899 }
1900
1901 void CodeGenerator::AssembleConstructFrame() {
1881 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); 1902 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
1882 if (frame_access_state()->has_frame()) { 1903 if (frame_access_state()->has_frame()) {
1883 if (descriptor->IsCFunctionCall()) { 1904 if (descriptor->IsCFunctionCall()) {
1884 __ Push(ra, fp); 1905 __ Push(ra, fp);
1885 __ mov(fp, sp); 1906 __ mov(fp, sp);
1886 } else if (descriptor->IsJSFunctionCall()) { 1907 } else if (descriptor->IsJSFunctionCall()) {
1887 __ Prologue(this->info()->GeneratePreagedPrologue()); 1908 __ Prologue(this->info()->GeneratePreagedPrologue());
1888 } else { 1909 } else {
1889 __ StubPrologue(info()->GetOutputStackFrameType()); 1910 __ StubPrologue(info()->GetOutputStackFrameType());
1890 } 1911 }
1891 } 1912 }
1892 1913
1893 int stack_shrink_slots = frame()->GetSpillSlotCount();
1894 if (info()->is_osr()) { 1914 if (info()->is_osr()) {
1895 // TurboFan OSR-compiled functions cannot be entered directly. 1915 // TurboFan OSR-compiled functions cannot be entered directly.
1896 __ Abort(kShouldNotDirectlyEnterOsrFunction); 1916 __ Abort(kShouldNotDirectlyEnterOsrFunction);
1897 1917
1898 // Unoptimized code jumps directly to this entrypoint while the unoptimized 1918 // Unoptimized code jumps directly to this entrypoint while the unoptimized
1899 // frame is still on the stack. Optimized code uses OSR values directly from 1919 // frame is still on the stack. Optimized code uses OSR values directly from
1900 // the unoptimized frame. Thus, all that needs to be done is to allocate the 1920 // the unoptimized frame. Thus, all that needs to be done is to allocate the
1901 // remaining stack slots. 1921 // remaining stack slots.
1902 if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); 1922 if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
1903 osr_pc_offset_ = __ pc_offset(); 1923 osr_pc_offset_ = __ pc_offset();
1904 stack_shrink_slots -= OsrHelper(info()).UnoptimizedFrameSlots();
1905 } 1924 }
1906 1925
1907 if (stack_shrink_slots > 0) { 1926 if (frame()->stack_shrink_slots() > 0) {
1908 __ Dsubu(sp, sp, Operand(stack_shrink_slots * kPointerSize)); 1927 __ Dsubu(sp, sp, Operand(frame()->stack_shrink_slots() * kPointerSize));
1909 } 1928 }
1910 1929
1911 const RegList saves_fpu = descriptor->CalleeSavedFPRegisters(); 1930 const RegList saves_fpu = descriptor->CalleeSavedFPRegisters();
1912 if (saves_fpu != 0) { 1931 if (saves_fpu != 0) {
1913 // Save callee-saved FPU registers. 1932 // Save callee-saved FPU registers.
1914 __ MultiPushFPU(saves_fpu); 1933 __ MultiPushFPU(saves_fpu);
1915 int count = base::bits::CountPopulation32(saves_fpu); 1934 DCHECK(kNumCalleeSavedFPU == base::bits::CountPopulation32(saves_fpu));
1916 DCHECK(kNumCalleeSavedFPU == count);
1917 frame()->AllocateSavedCalleeRegisterSlots(count *
1918 (kDoubleSize / kPointerSize));
1919 } 1935 }
1920 1936
1921 const RegList saves = descriptor->CalleeSavedRegisters(); 1937 const RegList saves = descriptor->CalleeSavedRegisters();
1922 if (saves != 0) { 1938 if (saves != 0) {
1923 // Save callee-saved registers. 1939 // Save callee-saved registers.
1924 __ MultiPush(saves); 1940 __ MultiPush(saves);
1925 // kNumCalleeSaved includes the fp register, but the fp register 1941 DCHECK(kNumCalleeSaved == base::bits::CountPopulation32(saves) + 1);
1926 // is saved separately in TF.
1927 int count = base::bits::CountPopulation32(saves);
1928 DCHECK(kNumCalleeSaved == count + 1);
1929 frame()->AllocateSavedCalleeRegisterSlots(count);
1930 } 1942 }
1931 } 1943 }
1932 1944
1933 1945
1934 void CodeGenerator::AssembleReturn() { 1946 void CodeGenerator::AssembleReturn() {
1935 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); 1947 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
1936 1948
1937 // Restore GP registers. 1949 // Restore GP registers.
1938 const RegList saves = descriptor->CalleeSavedRegisters(); 1950 const RegList saves = descriptor->CalleeSavedRegisters();
1939 if (saves != 0) { 1951 if (saves != 0) {
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
2173 padding_size -= v8::internal::Assembler::kInstrSize; 2185 padding_size -= v8::internal::Assembler::kInstrSize;
2174 } 2186 }
2175 } 2187 }
2176 } 2188 }
2177 2189
2178 #undef __ 2190 #undef __
2179 2191
2180 } // namespace compiler 2192 } // namespace compiler
2181 } // namespace internal 2193 } // namespace internal
2182 } // namespace v8 2194 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698