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

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 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1887 } 1885 }
1888 1886
1889 1887
1890 void CodeGenerator::AssembleDeoptimizerCall( 1888 void CodeGenerator::AssembleDeoptimizerCall(
1891 int deoptimization_id, Deoptimizer::BailoutType bailout_type) { 1889 int deoptimization_id, Deoptimizer::BailoutType bailout_type) {
1892 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( 1890 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry(
1893 isolate(), deoptimization_id, bailout_type); 1891 isolate(), deoptimization_id, bailout_type);
1894 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); 1892 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY);
1895 } 1893 }
1896 1894
1895 void CodeGenerator::FinishFrame(Frame* frame) {
1896 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
1897 1897
1898 void CodeGenerator::AssemblePrologue() { 1898 const RegList saves_fpu = descriptor->CalleeSavedFPRegisters();
1899 if (saves_fpu != 0) {
1900 int count = base::bits::CountPopulation32(saves_fpu);
1901 DCHECK(kNumCalleeSavedFPU == count);
1902 frame->AllocateSavedCalleeRegisterSlots(count *
1903 (kDoubleSize / kPointerSize));
1904 }
1905
1906 const RegList saves = descriptor->CalleeSavedRegisters();
1907 if (saves != 0) {
1908 int count = base::bits::CountPopulation32(saves);
1909 DCHECK(kNumCalleeSaved == count + 1);
1910 frame->AllocateSavedCalleeRegisterSlots(count);
1911 }
1912 }
1913
1914 void CodeGenerator::AssembleConstructFrame() {
1899 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); 1915 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
1900 if (frame_access_state()->has_frame()) { 1916 if (frame_access_state()->has_frame()) {
1901 if (descriptor->IsCFunctionCall()) { 1917 if (descriptor->IsCFunctionCall()) {
1902 __ Push(ra, fp); 1918 __ Push(ra, fp);
1903 __ mov(fp, sp); 1919 __ mov(fp, sp);
1904 } else if (descriptor->IsJSFunctionCall()) { 1920 } else if (descriptor->IsJSFunctionCall()) {
1905 __ Prologue(this->info()->GeneratePreagedPrologue()); 1921 __ Prologue(this->info()->GeneratePreagedPrologue());
1906 } else { 1922 } else {
1907 __ StubPrologue(info()->GetOutputStackFrameType()); 1923 __ StubPrologue(info()->GetOutputStackFrameType());
1908 } 1924 }
1909 } 1925 }
1910 1926
1911 int stack_shrink_slots = frame()->GetSpillSlotCount(); 1927 int shrink_slots = frame()->GetSpillSlotCount();
1928
1912 if (info()->is_osr()) { 1929 if (info()->is_osr()) {
1913 // TurboFan OSR-compiled functions cannot be entered directly. 1930 // TurboFan OSR-compiled functions cannot be entered directly.
1914 __ Abort(kShouldNotDirectlyEnterOsrFunction); 1931 __ Abort(kShouldNotDirectlyEnterOsrFunction);
1915 1932
1916 // Unoptimized code jumps directly to this entrypoint while the unoptimized 1933 // Unoptimized code jumps directly to this entrypoint while the unoptimized
1917 // frame is still on the stack. Optimized code uses OSR values directly from 1934 // frame is still on the stack. Optimized code uses OSR values directly from
1918 // the unoptimized frame. Thus, all that needs to be done is to allocate the 1935 // the unoptimized frame. Thus, all that needs to be done is to allocate the
1919 // remaining stack slots. 1936 // remaining stack slots.
1920 if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); 1937 if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
1921 osr_pc_offset_ = __ pc_offset(); 1938 osr_pc_offset_ = __ pc_offset();
1922 stack_shrink_slots -= OsrHelper(info()).UnoptimizedFrameSlots(); 1939 shrink_slots -= OsrHelper(info()).UnoptimizedFrameSlots();
1923 } 1940 }
1924 1941
1925 if (stack_shrink_slots > 0) { 1942 if (shrink_slots > 0) {
1926 __ Dsubu(sp, sp, Operand(stack_shrink_slots * kPointerSize)); 1943 __ Dsubu(sp, sp, Operand(shrink_slots * kPointerSize));
1927 } 1944 }
1928 1945
1929 const RegList saves_fpu = descriptor->CalleeSavedFPRegisters(); 1946 const RegList saves_fpu = descriptor->CalleeSavedFPRegisters();
1930 if (saves_fpu != 0) { 1947 if (saves_fpu != 0) {
1931 // Save callee-saved FPU registers. 1948 // Save callee-saved FPU registers.
1932 __ MultiPushFPU(saves_fpu); 1949 __ MultiPushFPU(saves_fpu);
1933 int count = base::bits::CountPopulation32(saves_fpu); 1950 DCHECK(kNumCalleeSavedFPU == base::bits::CountPopulation32(saves_fpu));
1934 DCHECK(kNumCalleeSavedFPU == count);
1935 frame()->AllocateSavedCalleeRegisterSlots(count *
1936 (kDoubleSize / kPointerSize));
1937 } 1951 }
1938 1952
1939 const RegList saves = descriptor->CalleeSavedRegisters(); 1953 const RegList saves = descriptor->CalleeSavedRegisters();
1940 if (saves != 0) { 1954 if (saves != 0) {
1941 // Save callee-saved registers. 1955 // Save callee-saved registers.
1942 __ MultiPush(saves); 1956 __ MultiPush(saves);
1943 // kNumCalleeSaved includes the fp register, but the fp register 1957 DCHECK(kNumCalleeSaved == base::bits::CountPopulation32(saves) + 1);
1944 // is saved separately in TF.
1945 int count = base::bits::CountPopulation32(saves);
1946 DCHECK(kNumCalleeSaved == count + 1);
1947 frame()->AllocateSavedCalleeRegisterSlots(count);
1948 } 1958 }
1949 } 1959 }
1950 1960
1951 1961
1952 void CodeGenerator::AssembleReturn() { 1962 void CodeGenerator::AssembleReturn() {
1953 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); 1963 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
1954 1964
1955 // Restore GP registers. 1965 // Restore GP registers.
1956 const RegList saves = descriptor->CalleeSavedRegisters(); 1966 const RegList saves = descriptor->CalleeSavedRegisters();
1957 if (saves != 0) { 1967 if (saves != 0) {
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
2195 padding_size -= v8::internal::Assembler::kInstrSize; 2205 padding_size -= v8::internal::Assembler::kInstrSize;
2196 } 2206 }
2197 } 2207 }
2198 } 2208 }
2199 2209
2200 #undef __ 2210 #undef __
2201 2211
2202 } // namespace compiler 2212 } // namespace compiler
2203 } // namespace internal 2213 } // namespace internal
2204 } // namespace v8 2214 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698