v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
baseline-compiler-ia32-inl.h
Go to the documentation of this file.
1// Use of this source code is governed by a BSD-style license that can be
2// Copyright 2021 the V8 project authors. All rights reserved.
3// found in the LICENSE file.
4
5#ifndef V8_BASELINE_IA32_BASELINE_COMPILER_IA32_INL_H_
6#define V8_BASELINE_IA32_BASELINE_COMPILER_IA32_INL_H_
7
8#include "src/base/macros.h"
11
12namespace v8 {
13namespace internal {
14namespace baseline {
15
16#define __ basm_.
17
18// A builtin call/jump mode that is used then short builtin calls feature is
19// not enabled.
22
25 int max_frame_size = bytecode_->max_frame_size();
29
31}
32
35 // Inlined register frame fill
36 interpreter::Register new_target_or_generator_register =
37 bytecode_->incoming_new_target_or_generator_register();
38 if (v8_flags.debug_code) {
39 __ masm()->CompareRoot(kInterpreterAccumulatorRegister,
40 RootIndex::kUndefinedValue);
41 __ masm()->Assert(equal, AbortReason::kUnexpectedValue);
42 }
43 int register_count = bytecode_->register_count();
44 // Magic value
45 const int kLoopUnrollSize = 8;
46 const int new_target_index = new_target_or_generator_register.index();
47 const bool has_new_target = new_target_index != kMaxInt;
48 if (has_new_target) {
49 DCHECK_LE(new_target_index, register_count);
50 for (int i = 0; i < new_target_index; i++) {
52 }
53 // Push new_target_or_generator.
55 register_count -= new_target_index + 1;
56 }
57 if (register_count < 2 * kLoopUnrollSize) {
58 // If the frame is small enough, just unroll the frame fill completely.
59 for (int i = 0; i < register_count; ++i) {
61 }
62 } else {
63 // Extract the first few registers to round to the unroll size.
64 int first_registers = register_count % kLoopUnrollSize;
65 for (int i = 0; i < first_registers; ++i) {
67 }
68 BaselineAssembler::ScratchRegisterScope scope(&basm_);
69 Register scratch = scope.AcquireScratch();
70 __ Move(scratch, register_count / kLoopUnrollSize);
71 // We enter the loop unconditionally, so make sure we need to loop at least
72 // once.
73 DCHECK_GT(register_count / kLoopUnrollSize, 0);
74 Label loop;
75 __ Bind(&loop);
76 for (int i = 0; i < kLoopUnrollSize; ++i) {
78 }
79 __ masm()->dec(scratch);
80 __ masm()->j(greater, &loop);
81 }
82}
83
85 __ masm()->movd(xmm0, eax);
86 __ Move(eax, esp);
87 __ masm()->add(eax,
89 bytecode_->frame_size()));
90 __ masm()->cmp(eax, ebp);
91 __ masm()->Assert(equal, AbortReason::kUnexpectedStackPointer);
92 __ masm()->movd(eax, xmm0);
93}
94
95#undef __
96
97} // namespace baseline
98} // namespace internal
99} // namespace v8
100
101#endif // V8_BASELINE_IA32_BASELINE_COMPILER_IA32_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