v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
baseline-compiler-mips64-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_MIPS64_BASELINE_COMPILER_MIPS64_INL_H_
6#define V8_BASELINE_MIPS64_BASELINE_COMPILER_MIPS64_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 __ LoadRoot(kInterpreterAccumulatorRegister, RootIndex::kUndefinedValue);
40 int register_count = bytecode_->register_count();
41 // Magic value
42 const int kLoopUnrollSize = 8;
43 const int new_target_index = new_target_or_generator_register.index();
44 const bool has_new_target = new_target_index != kMaxInt;
45 if (has_new_target) {
46 DCHECK_LE(new_target_index, register_count);
47 __ masm()->Daddu(sp, sp, Operand(-(kPointerSize * new_target_index)));
48 for (int i = 0; i < new_target_index; i++) {
49 __ masm()->Sd(kInterpreterAccumulatorRegister, MemOperand(sp, i * 8));
50 }
51 // Push new_target_or_generator.
53 register_count -= new_target_index + 1;
54 }
55 if (register_count < 2 * kLoopUnrollSize) {
56 // If the frame is small enough, just unroll the frame fill completely.
57 __ masm()->Daddu(sp, sp, Operand(-(kPointerSize * register_count)));
58 for (int i = 0; i < register_count; ++i) {
59 __ masm()->Sd(kInterpreterAccumulatorRegister, MemOperand(sp, i * 8));
60 }
61 } else {
62 __ masm()->Daddu(sp, sp, Operand(-(kPointerSize * register_count)));
63 for (int i = 0; i < register_count; ++i) {
64 __ masm()->Sd(kInterpreterAccumulatorRegister, MemOperand(sp, i * 8));
65 }
66 }
67}
68
71 __ masm()->Daddu(kScratchReg, sp,
73 bytecode_->frame_size()));
74 __ masm()->Assert(eq, AbortReason::kUnexpectedStackPointer, kScratchReg,
75 Operand(fp));
76}
77
78} // namespace baseline
79} // namespace internal
80} // namespace v8
81
82#endif // V8_BASELINE_MIPS64_BASELINE_COMPILER_MIPS64_INL_H_
#define ASM_CODE_COMMENT(asm)
Definition assembler.h:617
constexpr BuiltinCallJumpMode kFallbackBuiltinCallJumpModeForBaseline
constexpr Register kJavaScriptCallTargetRegister
constexpr int kPointerSize
Definition globals.h:599
constexpr Register kJavaScriptCallArgCountRegister
constexpr Register kInterpreterAccumulatorRegister
constexpr Register kScratchReg
constexpr Register kContextRegister
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