/src/mozilla-central/js/src/jit/shared/Assembler-shared.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
2 | | * vim: set ts=8 sts=4 et sw=4 tw=99: |
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 | | #include "jit/shared/Assembler-shared.h" |
8 | | |
9 | | #include "jit/MacroAssembler-inl.h" |
10 | | |
11 | | using namespace js::jit; |
12 | | |
13 | | void |
14 | | CodeLocationJump::repoint(JitCode* code, MacroAssembler* masm) |
15 | 37 | { |
16 | 37 | MOZ_ASSERT(state_ == Relative); |
17 | 37 | size_t new_off = (size_t)raw_; |
18 | 37 | #ifdef JS_SMALL_BRANCH |
19 | 37 | size_t jumpTableEntryOffset = reinterpret_cast<size_t>(jumpTableEntry_); |
20 | 37 | #endif |
21 | 37 | if (masm != nullptr) { |
22 | 0 | #ifdef JS_CODEGEN_X64 |
23 | 0 | MOZ_ASSERT((uint64_t)raw_ <= UINT32_MAX); |
24 | 0 | #endif |
25 | 0 | new_off = (uintptr_t)raw_; |
26 | 0 | #ifdef JS_SMALL_BRANCH |
27 | 0 | jumpTableEntryOffset = masm->actualIndex(jumpTableEntryOffset); |
28 | 0 | #endif |
29 | 0 | } |
30 | 37 | raw_ = code->raw() + new_off; |
31 | 37 | #ifdef JS_SMALL_BRANCH |
32 | 37 | jumpTableEntry_ = Assembler::PatchableJumpAddress(code, (size_t) jumpTableEntryOffset); |
33 | 37 | #endif |
34 | 37 | setAbsolute(); |
35 | 37 | } |
36 | | |
37 | | void |
38 | | CodeLocationLabel::repoint(JitCode* code) |
39 | 686 | { |
40 | 686 | MOZ_ASSERT(state_ == Relative); |
41 | 686 | uintptr_t new_off = uintptr_t(raw_); |
42 | 686 | MOZ_ASSERT(new_off < code->instructionsSize()); |
43 | 686 | |
44 | 686 | raw_ = code->raw() + new_off; |
45 | 686 | setAbsolute(); |
46 | 686 | } |
47 | | |
48 | | void |
49 | | CodeOffsetJump::fixup(MacroAssembler* masm) |
50 | 37 | { |
51 | 37 | #ifdef JS_SMALL_BRANCH |
52 | 37 | jumpTableIndex_ = masm->actualIndex(jumpTableIndex_); |
53 | 37 | #endif |
54 | 37 | } |