OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
9 #include "src/compiler/gap-resolver.h" | 9 #include "src/compiler/gap-resolver.h" |
10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
(...skipping 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1900 // --{ mov esp, ebp }----------------------------------------------------------- | 1900 // --{ mov esp, ebp }----------------------------------------------------------- |
1901 // | FP | RET | args | caller frame | | 1901 // | FP | RET | args | caller frame | |
1902 // ^ esp,ebp | 1902 // ^ esp,ebp |
1903 | 1903 |
1904 // --{ pop ebp }---------------------------------------------------------------- | 1904 // --{ pop ebp }---------------------------------------------------------------- |
1905 // | RET | args | caller frame | | 1905 // | RET | args | caller frame | |
1906 // ^ esp ^ ebp | 1906 // ^ esp ^ ebp |
1907 | 1907 |
1908 | 1908 |
1909 void CodeGenerator::AssemblePrologue() { | 1909 void CodeGenerator::AssemblePrologue() { |
1910 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1910 const CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
1911 if (descriptor->IsCFunctionCall()) { | 1911 if (descriptor->IsCFunctionCall()) { |
1912 // Assemble a prologue similar the to cdecl calling convention. | 1912 // Assemble a prologue similar the to cdecl calling convention. |
1913 __ push(ebp); | 1913 __ push(ebp); |
1914 __ mov(ebp, esp); | 1914 __ mov(ebp, esp); |
1915 } else if (descriptor->IsJSFunctionCall()) { | 1915 } else if (descriptor->IsJSFunctionCall()) { |
1916 // TODO(turbofan): this prologue is redundant with OSR, but needed for | 1916 // TODO(turbofan): this prologue is redundant with OSR, but needed for |
1917 // code aging. | 1917 // code aging. |
1918 __ Prologue(this->info()->GeneratePreagedPrologue()); | 1918 __ Prologue(this->info()->GeneratePreagedPrologue()); |
1919 } else if (frame()->needs_frame()) { | 1919 } else if (frame()->needs_frame()) { |
1920 __ StubPrologue(); | 1920 __ StubPrologue(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1953 frame()->AllocateSavedCalleeRegisterSlots(pushed); | 1953 frame()->AllocateSavedCalleeRegisterSlots(pushed); |
1954 } | 1954 } |
1955 | 1955 |
1956 // Initailize FPU state. | 1956 // Initailize FPU state. |
1957 __ fninit(); | 1957 __ fninit(); |
1958 __ fld1(); | 1958 __ fld1(); |
1959 } | 1959 } |
1960 | 1960 |
1961 | 1961 |
1962 void CodeGenerator::AssembleReturn() { | 1962 void CodeGenerator::AssembleReturn() { |
1963 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1963 const CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
1964 | 1964 |
1965 // Clear the FPU stack only if there is no return value in the stack. | 1965 // Clear the FPU stack only if there is no return value in the stack. |
1966 if (FLAG_debug_code && FLAG_enable_slow_asserts) { | 1966 if (FLAG_debug_code && FLAG_enable_slow_asserts) { |
1967 __ VerifyX87StackDepth(1); | 1967 __ VerifyX87StackDepth(1); |
1968 } | 1968 } |
1969 bool clear_stack = true; | 1969 bool clear_stack = true; |
1970 for (int i = 0; i < descriptor->ReturnCount(); i++) { | 1970 for (int i = 0; i < descriptor->ReturnCount(); i++) { |
1971 MachineRepresentation rep = descriptor->GetReturnType(i).representation(); | 1971 MachineRepresentation rep = descriptor->GetReturnType(i).representation(); |
1972 LinkageLocation loc = descriptor->GetReturnLocation(i); | 1972 LinkageLocation loc = descriptor->GetReturnLocation(i); |
1973 if (IsFloatingPoint(rep) && loc == LinkageLocation::ForRegister(0)) { | 1973 if (IsFloatingPoint(rep) && loc == LinkageLocation::ForRegister(0)) { |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2234 void CodeGenerator::EnsureSpaceForLazyDeopt() { | 2234 void CodeGenerator::EnsureSpaceForLazyDeopt() { |
2235 is_handler_entry_point = true; | 2235 is_handler_entry_point = true; |
2236 DoEnsureSpaceForLazyDeopt(info(), masm(), last_lazy_deopt_pc_); | 2236 DoEnsureSpaceForLazyDeopt(info(), masm(), last_lazy_deopt_pc_); |
2237 } | 2237 } |
2238 | 2238 |
2239 #undef __ | 2239 #undef __ |
2240 | 2240 |
2241 } // namespace compiler | 2241 } // namespace compiler |
2242 } // namespace internal | 2242 } // namespace internal |
2243 } // namespace v8 | 2243 } // namespace v8 |
OLD | NEW |