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 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1469 // | FP | RET | args | caller frame | | 1469 // | FP | RET | args | caller frame | |
1470 // ^ esp,ebp | 1470 // ^ esp,ebp |
1471 | 1471 |
1472 // --{ pop ebp }---------------------------------------------------------------- | 1472 // --{ pop ebp }---------------------------------------------------------------- |
1473 // | RET | args | caller frame | | 1473 // | RET | args | caller frame | |
1474 // ^ esp ^ ebp | 1474 // ^ esp ^ ebp |
1475 | 1475 |
1476 | 1476 |
1477 void CodeGenerator::AssemblePrologue() { | 1477 void CodeGenerator::AssemblePrologue() { |
1478 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1478 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
1479 if (descriptor->IsCFunctionCall()) { | 1479 if (frame()->needs_frame()) { |
1480 // Assemble a prologue similar the to cdecl calling convention. | 1480 if (descriptor->flags() & CallDescriptor::kHasStandardFrameHeader) { |
1481 __ push(ebp); | 1481 __ Prologue(this->info()->GeneratePreagedPrologue()); |
1482 __ mov(ebp, esp); | 1482 } else { |
1483 } else if (descriptor->IsJSFunctionCall()) { | 1483 __ StubPrologue(info()->GetOutputStackFrameType()); |
1484 // TODO(turbofan): this prologue is redundant with OSR, but still needed for | 1484 } |
1485 // code aging. | |
1486 __ Prologue(this->info()->GeneratePreagedPrologue()); | |
1487 } else if (frame()->needs_frame()) { | |
1488 __ StubPrologue(); | |
1489 } else { | 1485 } else { |
1490 frame()->SetElidedFrameSizeInSlots(kPCOnStackSize / kPointerSize); | 1486 frame()->SetElidedFrameSizeInSlots(kPCOnStackSize / kPointerSize); |
1491 } | 1487 } |
1492 frame_access_state()->SetFrameAccessToDefault(); | 1488 frame_access_state()->SetFrameAccessToDefault(); |
1493 | 1489 |
1494 int stack_shrink_slots = frame()->GetSpillSlotCount(); | 1490 int stack_shrink_slots = frame()->GetSpillSlotCount(); |
1495 if (info()->is_osr()) { | 1491 if (info()->is_osr()) { |
1496 // TurboFan OSR-compiled functions cannot be entered directly. | 1492 // TurboFan OSR-compiled functions cannot be entered directly. |
1497 __ Abort(kShouldNotDirectlyEnterOsrFunction); | 1493 __ Abort(kShouldNotDirectlyEnterOsrFunction); |
1498 | 1494 |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1756 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 1752 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
1757 __ Nop(padding_size); | 1753 __ Nop(padding_size); |
1758 } | 1754 } |
1759 } | 1755 } |
1760 | 1756 |
1761 #undef __ | 1757 #undef __ |
1762 | 1758 |
1763 } // namespace compiler | 1759 } // namespace compiler |
1764 } // namespace internal | 1760 } // namespace internal |
1765 } // namespace v8 | 1761 } // namespace v8 |
OLD | NEW |