v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
bytecode-array-random-iterator.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_BYTECODE_ARRAY_RANDOM_ITERATOR_H_
6#define V8_INTERPRETER_BYTECODE_ARRAY_RANDOM_ITERATOR_H_
7
8#include <memory>
9
12#include "src/zone/zone.h"
13
14namespace v8 {
15namespace internal {
16namespace interpreter {
17
19 : public BytecodeArrayIterator {
20 public:
22
25 delete;
26
28 ++current_index_;
29 UpdateOffsetFromIndex();
30 return *this;
31 }
33 --current_index_;
34 UpdateOffsetFromIndex();
35 return *this;
36 }
37
39 current_index_ += offset;
40 UpdateOffsetFromIndex();
41 return *this;
42 }
43
45 current_index_ -= offset;
46 UpdateOffsetFromIndex();
47 return *this;
48 }
49
50 int current_index() const { return current_index_; }
51
52 int size() const { return static_cast<int>(offsets_.size()); }
53
54 void GoToIndex(int index) {
55 current_index_ = index;
56 UpdateOffsetFromIndex();
57 }
58 void GoToStart() {
59 current_index_ = 0;
60 UpdateOffsetFromIndex();
61 }
62 void GoToEnd() {
63 current_index_ = size() - 1;
64 UpdateOffsetFromIndex();
65 }
66
67 bool IsValid() const;
68
69 private:
72
73 void Initialize();
74 void UpdateOffsetFromIndex();
75};
76
77} // namespace interpreter
78} // namespace internal
79} // namespace v8
80
81#endif // V8_INTERPRETER_BYTECODE_ARRAY_RANDOM_ITERATOR_H_
BytecodeArrayRandomIterator(const BytecodeArrayRandomIterator &)=delete
BytecodeArrayRandomIterator & operator=(const BytecodeArrayRandomIterator &)=delete
OptionalOpIndex index
int32_t offset
#define V8_EXPORT_PRIVATE
Definition macros.h:460