v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
code-reference.h
Go to the documentation of this file.
1// Copyright 2018 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_CODEGEN_CODE_REFERENCE_H_
6#define V8_CODEGEN_CODE_REFERENCE_H_
7
10#include "src/objects/code.h"
11
12namespace v8 {
13namespace internal {
14
15class InstructionStream;
16class Code;
17class CodeDesc;
18
19namespace wasm {
20class WasmCode;
21} // namespace wasm
22
24 public:
25 CodeReference() : kind_(Kind::NONE), null_(nullptr) {}
26 explicit CodeReference(const wasm::WasmCode* wasm_code)
27 : kind_(Kind::WASM_CODE), wasm_code_(wasm_code) {}
30 explicit CodeReference(Handle<Code> code) : kind_(Kind::CODE), code_(code) {}
31
35 int instruction_size() const;
36 const uint8_t* relocation_start() const;
37 const uint8_t* relocation_end() const;
38 int relocation_size() const;
40 int code_comments_size() const;
41
42 bool is_null() const { return kind_ == Kind::NONE; }
43 bool is_code() const { return kind_ == Kind::CODE; }
44 bool is_wasm_code() const { return kind_ == Kind::WASM_CODE; }
45
48 return code_;
49 }
50
53 return wasm_code_;
54 }
55
56 private:
58 union {
59 std::nullptr_t null_;
63 };
64
66};
68
69} // namespace internal
70} // namespace v8
71
72#endif // V8_CODEGEN_CODE_REFERENCE_H_
Address instruction_end() const
CodeReference(Handle< Code > code)
const uint8_t * relocation_start() const
CodeReference(const CodeDesc *code_desc)
const uint8_t * relocation_end() const
Address constant_pool() const
CodeReference(const wasm::WasmCode *wasm_code)
enum v8::internal::CodeReference::Kind kind_
DirectHandle< Code > as_code() const
const wasm::WasmCode * as_wasm_code() const
Address code_comments() const
const wasm::WasmCode * wasm_code_
Address instruction_start() const
const CodeDesc * code_desc
Definition c-api.cc:87
#define DCHECK_EQ(v1, v2)
Definition logging.h:485
#define DISALLOW_NEW_AND_DELETE()
Definition macros.h:155
#define ASSERT_TRIVIALLY_COPYABLE(T)
Definition macros.h:267