• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #include "src/execution/frame-constants.h"
6 
7 #if V8_TARGET_ARCH_ARM64
8 
9 #include "src/execution/arm64/frame-constants-arm64.h"
10 
11 #include "src/codegen/arm64/assembler-arm64-inl.h"
12 #include "src/codegen/assembler.h"
13 #include "src/execution/frames.h"
14 
15 namespace v8 {
16 namespace internal {
17 
fp_register()18 Register JavaScriptFrame::fp_register() { return v8::internal::fp; }
context_register()19 Register JavaScriptFrame::context_register() { return cp; }
constant_pool_pointer_register()20 Register JavaScriptFrame::constant_pool_pointer_register() { UNREACHABLE(); }
21 
RegisterStackSlotCount(int register_count)22 int UnoptimizedFrameConstants::RegisterStackSlotCount(int register_count) {
23   STATIC_ASSERT(InterpreterFrameConstants::kFixedFrameSize % 16 == 8);
24   // Interpreter frame header size is not 16-bytes aligned, so we'll need at
25   // least one register slot to make the frame a multiple of 16 bytes. The code
26   // below is equivalent to "RoundUp(register_count - 1, 2) + 1".
27   return RoundDown(register_count, 2) + 1;
28 }
29 
PaddingSlotCount(int register_count)30 int BuiltinContinuationFrameConstants::PaddingSlotCount(int register_count) {
31   // Round the total slot count up to a multiple of two, to make the frame a
32   // multiple of 16 bytes.
33   int slot_count = kFixedSlotCount + register_count;
34   int rounded_slot_count = RoundUp(slot_count, 2);
35   return rounded_slot_count - slot_count;
36 }
37 
38 }  // namespace internal
39 }  // namespace v8
40 
41 #endif  // V8_TARGET_ARCH_ARM64
42