V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
code-reference.cc
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 #include "src/code-reference.h"
6 
7 #include "src/handles-inl.h"
8 #include "src/objects-inl.h"
9 #include "src/wasm/wasm-code-manager.h"
10 
11 namespace v8 {
12 namespace internal {
13 
14 Address CodeReference::constant_pool() const {
15  return kind_ == JS ? js_code_->constant_pool() : wasm_code_->constant_pool();
16 }
17 
18 Address CodeReference::instruction_start() const {
19  return kind_ == JS
20  ? js_code_->InstructionStart()
21  : reinterpret_cast<Address>(wasm_code_->instructions().start());
22 }
23 
24 Address CodeReference::instruction_end() const {
25  return kind_ == JS
26  ? js_code_->InstructionEnd()
27  : reinterpret_cast<Address>(wasm_code_->instructions().start() +
28  wasm_code_->instructions().size());
29 }
30 
31 int CodeReference::instruction_size() const {
32  return kind_ == JS ? js_code_->InstructionSize()
33  : wasm_code_->instructions().length();
34 }
35 
36 const byte* CodeReference::relocation_start() const {
37  return kind_ == JS ? js_code_->relocation_start()
38  : wasm_code_->reloc_info().start();
39 }
40 
41 const byte* CodeReference::relocation_end() const {
42  return kind_ == JS ? js_code_->relocation_end()
43  : wasm_code_->reloc_info().start() +
44  wasm_code_->reloc_info().length();
45 }
46 
47 int CodeReference::relocation_size() const {
48  return kind_ == JS ? js_code_->relocation_size()
49  : wasm_code_->reloc_info().length();
50 }
51 
52 } // namespace internal
53 } // namespace v8
Definition: libplatform.h:13