Debian Codegraph @

js/src/jit/BaselineFrameInfo-inl.h

raw
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: set ts=8 sts=2 et sw=2 tw=80:
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 #ifndef jit_BaselineFrameInfo_inl_h
8 #define jit_BaselineFrameInfo_inl_h
9
10 #include "jit/BaselineFrameInfo.h"
11
12 #include "jit/MacroAssembler-inl.h"
13
14 namespace js {
15 namespace jit {
16
17 void CompilerFrameInfo::pop(StackAdjustment adjust) {
18 spIndex--;
19 StackValue* popped = &stack[spIndex];
20
21 if (adjust == AdjustStack && popped->kind() == StackValue::Stack) {
22 masm.addToStackPtr(Imm32(sizeof(Value)));
23 }
24 // Assert when anything uses this value.
25 popped->reset();
26 }
27
28 void CompilerFrameInfo::popn(uint32_t n, StackAdjustment adjust) {
29 uint32_t poppedStack = 0;
30 for (uint32_t i = 0; i < n; i++) {
31 if (peek(-1)->kind() == StackValue::Stack) {
32 poppedStack++;
33 }
34 pop(DontAdjustStack);
35 }
36 if (adjust == AdjustStack && poppedStack > 0) {
37 masm.addToStackPtr(Imm32(sizeof(Value) * poppedStack));
38 }
39 }
40
41 void InterpreterFrameInfo::pop() { popn(1); }
42
43 void InterpreterFrameInfo::popn(uint32_t n) {
44 masm.addToStackPtr(Imm32(n * sizeof(Value)));
45 }
46
47 } // namespace jit
48 } // namespace js
49
50 #endif /* jit_BaselineFrameInfo_inl_h */