v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
baseline-compiler-ppc-inl.h
Go to the documentation of this file.
1// Copyright 2021 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#ifndef V8_BASELINE_PPC_BASELINE_COMPILER_PPC_INL_H_
6#define V8_BASELINE_PPC_BASELINE_COMPILER_PPC_INL_H_
7
8#include "src/base/logging.h"
10
11namespace v8 {
12namespace internal {
13namespace baseline {
14
15#define __ basm_.
16
17// A builtin call/jump mode that is used then short builtin calls feature is
18// not enabled.
21
24 __ masm()->EnterFrame(StackFrame::BASELINE);
26 int max_frame_size = bytecode_->max_frame_size();
30
32}
33
36 // Inlined register frame fill
37 interpreter::Register new_target_or_generator_register =
38 bytecode_->incoming_new_target_or_generator_register();
39 if (v8_flags.debug_code) {
40 __ masm()->CompareRoot(kInterpreterAccumulatorRegister,
41 RootIndex::kUndefinedValue);
42 __ masm()->Assert(eq, AbortReason::kUnexpectedValue);
43 }
44 int register_count = bytecode_->register_count();
45 // Magic value
46 const int kLoopUnrollSize = 8;
47 const int new_target_index = new_target_or_generator_register.index();
48 const bool has_new_target = new_target_index != kMaxInt;
49 if (has_new_target) {
50 DCHECK_LE(new_target_index, register_count);
51 for (int i = 0; i < new_target_index; i++) {
53 }
54 // Push new_target_or_generator.
56 register_count -= new_target_index + 1;
57 }
58 if (register_count < 2 * kLoopUnrollSize) {
59 // If the frame is small enough, just unroll the frame fill completely.
60 for (int i = 0; i < register_count; ++i) {
62 }
63
64 } else {
65 // Extract the first few registers to round to the unroll size.
66 int first_registers = register_count % kLoopUnrollSize;
67 for (int i = 0; i < first_registers; ++i) {
69 }
70 BaselineAssembler::ScratchRegisterScope temps(&basm_);
71 Register scratch = temps.AcquireScratch();
72
73 __ Move(scratch, register_count / kLoopUnrollSize);
74 // We enter the loop unconditionally, so make sure we need to loop at least
75 // once.
76 DCHECK_GT(register_count / kLoopUnrollSize, 0);
77 Label loop;
78 __ Bind(&loop);
79 for (int i = 0; i < kLoopUnrollSize; ++i) {
81 }
82 __ masm()->SubS64(scratch, scratch, Operand(1), r0, LeaveOE, SetRC);
83 __ masm()->bgt(&loop, cr0);
84 }
85}
86
88 BaselineAssembler::ScratchRegisterScope temps(&basm_);
89 Register scratch = temps.AcquireScratch();
90
91 __ masm()->AddS64(scratch, sp,
93 bytecode_->frame_size()));
94 __ masm()->CmpU64(scratch, fp);
95 __ masm()->Assert(eq, AbortReason::kUnexpectedStackPointer);
96}
97
98} // namespace baseline
99} // namespace internal
100} // namespace v8
101
102#endif // V8_BASELINE_PPC_BASELINE_COMPILER_PPC_INL_H_
#define ASM_CODE_COMMENT(asm)
Definition assembler.h:617
constexpr BuiltinCallJumpMode kFallbackBuiltinCallJumpModeForBaseline
constexpr Register kJavaScriptCallTargetRegister
constexpr Register kJavaScriptCallArgCountRegister
constexpr Register kInterpreterAccumulatorRegister
constexpr Register kContextRegister
V8_EXPORT_PRIVATE FlagValues v8_flags
constexpr int kMaxInt
Definition globals.h:374
constexpr Register kJavaScriptCallNewTargetRegister
constexpr Register kJSFunctionRegister
#define DCHECK_LE(v1, v2)
Definition logging.h:490
#define DCHECK_EQ(v1, v2)
Definition logging.h:485
#define DCHECK_GT(v1, v2)
Definition logging.h:487