v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
bytecode-array-random-iterator.cc
Go to the documentation of this file.
1// Copyright 2015 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
6
8
9namespace v8 {
10namespace internal {
11namespace interpreter {
12
14 Handle<BytecodeArray> bytecode_array, Zone* zone)
15 : BytecodeArrayIterator(bytecode_array, 0), offsets_(zone) {
16 offsets_.reserve(bytecode_array->length() / 2);
17 Initialize();
18}
19
21 // Run forwards through the bytecode array to determine the offset of each
22 // bytecode.
23 while (!done()) {
25 Advance();
26 }
27 GoToStart();
28}
29
31 return current_index_ >= 0 &&
32 static_cast<size_t>(current_index_) < offsets_.size();
33}
34
40
41} // namespace interpreter
42} // namespace internal
43} // namespace v8
void reserve(size_t new_cap)
void push_back(const T &value)
DirectHandle< BytecodeArray > bytecode_array() const
BytecodeArrayRandomIterator(Handle< BytecodeArray > bytecode_array, Zone *zone)