v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
handler-table-builder.h
Go to the documentation of this file.
1// Copyright 2016 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_INTERPRETER_HANDLER_TABLE_BUILDER_H_
6#define V8_INTERPRETER_HANDLER_TABLE_BUILDER_H_
7
12
13namespace v8 {
14namespace internal {
15
16class HandlerTable;
17
18namespace interpreter {
19
20// A helper class for constructing exception handler tables for the interpreter.
22 public:
23 explicit HandlerTableBuilder(Zone* zone);
26
27 // Builds the actual handler table by copying the current values into a heap
28 // object. Any further mutations to the builder won't be reflected.
29 template <typename IsolateT>
30 DirectHandle<TrustedByteArray> ToHandlerTable(IsolateT* isolate);
31
32 // Creates a new handler table entry and returns a {hander_id} identifying the
33 // entry, so that it can be referenced by below setter functions.
34 int NewHandlerEntry();
35
36 // Setter functions that modify certain values within the handler table entry
37 // being referenced by the given {handler_id}. All values will be encoded by
38 // the resulting {HandlerTable} class when copied into the heap.
39 void SetTryRegionStart(int handler_id, size_t offset);
40 void SetTryRegionEnd(int handler_id, size_t offset);
41 void SetHandlerTarget(int handler_id, size_t offset);
42 void SetPrediction(int handler_id, HandlerTable::CatchPrediction prediction);
43 void SetContextRegister(int handler_id, Register reg);
44
45 private:
46 struct Entry {
47 size_t offset_start; // Bytecode offset starting try-region.
48 size_t offset_end; // Bytecode offset ending try-region.
49 size_t offset_target; // Bytecode offset of handler target.
50 Register context; // Register holding context for handler.
51 // Optimistic prediction for handler.
53 };
54
56};
57
58} // namespace interpreter
59} // namespace internal
60} // namespace v8
61
62#endif // V8_INTERPRETER_HANDLER_TABLE_BUILDER_H_
HandlerTableBuilder & operator=(const HandlerTableBuilder &)=delete
HandlerTableBuilder(const HandlerTableBuilder &)=delete
int32_t offset
LiftoffRegister reg
#define V8_EXPORT_PRIVATE
Definition macros.h:460