v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
ast-function-literal-id-reindexer.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_AST_AST_FUNCTION_LITERAL_ID_REINDEXER_H_
6#define V8_AST_AST_FUNCTION_LITERAL_ID_REINDEXER_H_
7
9
10#ifdef DEBUG
11#include <set>
12#endif
13
14namespace v8 {
15namespace internal {
16
17// Changes the ID of all FunctionLiterals in the given Expression by adding the
18// given delta.
20 : public AstTraversalVisitor<AstFunctionLiteralIdReindexer> {
21 public:
22 AstFunctionLiteralIdReindexer(size_t stack_limit, int delta);
25 const AstFunctionLiteralIdReindexer&) = delete;
27
29
30 // AstTraversalVisitor implementation.
33 void VisitCall(Call* lit);
34
35 private:
36 int delta_;
37
38#ifdef DEBUG
39 // Visited set, only used in DCHECKs for verification.
40 std::set<FunctionLiteral*> visited_;
41
42 // Visit all function literals, checking if they have already been visited
43 // (are in the visited set).
44 void CheckVisited(Expression* expr);
45#else
46 void CheckVisited(Expression* expr) {}
47#endif
48};
49
50} // namespace internal
51} // namespace v8
52
53#endif // V8_AST_AST_FUNCTION_LITERAL_ID_REINDEXER_H_
AstFunctionLiteralIdReindexer & operator=(const AstFunctionLiteralIdReindexer &)=delete
AstFunctionLiteralIdReindexer(const AstFunctionLiteralIdReindexer &)=delete
std::string pattern
HeapObjectSet *const visited_