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 1988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1999 // | FP | RET | args | caller frame | | 1999 // | FP | RET | args | caller frame | |
2000 // ^ esp,ebp | 2000 // ^ esp,ebp |
2001 | 2001 |
2002 // --{ pop ebp }---------------------------------------------------------------- | 2002 // --{ pop ebp }---------------------------------------------------------------- |
2003 // | RET | args | caller frame | | 2003 // | RET | args | caller frame | |
2004 // ^ esp ^ ebp | 2004 // ^ esp ^ ebp |
2005 | 2005 |
2006 | 2006 |
2007 void CodeGenerator::AssemblePrologue() { | 2007 void CodeGenerator::AssemblePrologue() { |
2008 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 2008 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
2009 if (descriptor->IsCFunctionCall()) { | 2009 if (frame()->needs_frame()) { |
2010 // Assemble a prologue similar the to cdecl calling convention. | 2010 if (descriptor->IsCFunctionCall()) { |
2011 __ push(ebp); | 2011 __ push(ebp); |
2012 __ mov(ebp, esp); | 2012 __ mov(ebp, esp); |
2013 } else if (descriptor->IsJSFunctionCall()) { | 2013 } else if (descriptor->IsJSFunctionCall()) { |
2014 // TODO(turbofan): this prologue is redundant with OSR, but needed for | 2014 __ Prologue(this->info()->GeneratePreagedPrologue()); |
2015 // code aging. | 2015 } else { |
2016 __ Prologue(this->info()->GeneratePreagedPrologue()); | 2016 __ StubPrologue(info()->GetOutputStackFrameType()); |
2017 } else if (frame()->needs_frame()) { | 2017 } |
2018 __ StubPrologue(); | |
2019 } else { | 2018 } else { |
2020 frame()->SetElidedFrameSizeInSlots(kPCOnStackSize / kPointerSize); | 2019 frame()->SetElidedFrameSizeInSlots(kPCOnStackSize / kPointerSize); |
2021 } | 2020 } |
2022 frame_access_state()->SetFrameAccessToDefault(); | 2021 frame_access_state()->SetFrameAccessToDefault(); |
2023 | 2022 |
2024 int stack_shrink_slots = frame()->GetSpillSlotCount(); | 2023 int stack_shrink_slots = frame()->GetSpillSlotCount(); |
2025 if (info()->is_osr()) { | 2024 if (info()->is_osr()) { |
2026 // TurboFan OSR-compiled functions cannot be entered directly. | 2025 // TurboFan OSR-compiled functions cannot be entered directly. |
2027 __ Abort(kShouldNotDirectlyEnterOsrFunction); | 2026 __ Abort(kShouldNotDirectlyEnterOsrFunction); |
2028 | 2027 |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2342 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2341 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
2343 __ Nop(padding_size); | 2342 __ Nop(padding_size); |
2344 } | 2343 } |
2345 } | 2344 } |
2346 | 2345 |
2347 #undef __ | 2346 #undef __ |
2348 | 2347 |
2349 } // namespace compiler | 2348 } // namespace compiler |
2350 } // namespace internal | 2349 } // namespace internal |
2351 } // namespace v8 | 2350 } // namespace v8 |
OLD | NEW |