v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
branch-hint-map.h
Go to the documentation of this file.
1// Copyright 2021 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_WASM_BRANCH_HINT_MAP_H_
6#define V8_WASM_BRANCH_HINT_MAP_H_
7
8#include <unordered_map>
9
10#include "src/base/macros.h"
11#include "src/common/globals.h"
12
13namespace v8 {
14namespace internal {
15
16namespace wasm {
17
19 public:
20 void insert(uint32_t offset, BranchHint hint) { map_.emplace(offset, hint); }
21
22 BranchHint GetHintFor(uint32_t offset) const {
23 auto it = map_.find(offset);
24 if (it == map_.end()) {
25 return BranchHint::kNone;
26 }
27 return it->second;
28 }
29
30 size_t NumHintsForTesting() const { return map_.size(); }
31
32 private:
33 std::unordered_map<uint32_t, BranchHint> map_;
34};
35
36using BranchHintInfo = std::unordered_map<uint32_t, BranchHintMap>;
37
38} // namespace wasm
39} // namespace internal
40} // namespace v8
41
42#endif // V8_WASM_BRANCH_HINT_MAP_H_
void insert(uint32_t offset, BranchHint hint)
std::unordered_map< uint32_t, BranchHint > map_
BranchHint GetHintFor(uint32_t offset) const
const MapRef map_
int32_t offset
std::unordered_map< uint32_t, BranchHintMap > BranchHintInfo
Definition c-api.cc:87
#define V8_EXPORT_PRIVATE
Definition macros.h:460