xref: /third_party/node/deps/v8/src/compiler/osr.cc (revision 1cb0ef41)
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
3// found in the LICENSE file.
4
5#include "src/compiler/osr.h"
6
7#include "src/codegen/optimized-compilation-info.h"
8#include "src/compiler/frame.h"
9#include "src/objects/objects-inl.h"
10#include "src/objects/objects.h"
11#include "src/objects/shared-function-info.h"
12
13namespace v8 {
14namespace internal {
15namespace compiler {
16
17OsrHelper::OsrHelper(OptimizedCompilationInfo* info)
18    : parameter_count_(info->bytecode_array()->parameter_count()),
19      stack_slot_count_(UnoptimizedFrameConstants::RegisterStackSlotCount(
20                            info->bytecode_array()->register_count()) +
21                        UnoptimizedFrameConstants::kExtraSlotCount) {}
22
23void OsrHelper::SetupFrame(Frame* frame) {
24  // The optimized frame will subsume the unoptimized frame. Do so by reserving
25  // the first spill slots.
26  frame->ReserveSpillSlots(UnoptimizedFrameSlots());
27}
28
29}  // namespace compiler
30}  // namespace internal
31}  // namespace v8
32