v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
decoder-arm64.cc
Go to the documentation of this file.
1// Copyright 2013 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#if V8_TARGET_ARCH_ARM64
6
9#include "src/utils/utils.h"
10
11namespace v8 {
12namespace internal {
13
14void DispatchingDecoderVisitor::AppendVisitor(DecoderVisitor* new_visitor) {
15 visitors_.remove(new_visitor);
16 visitors_.push_back(new_visitor);
17}
18
19void DispatchingDecoderVisitor::PrependVisitor(DecoderVisitor* new_visitor) {
20 visitors_.remove(new_visitor);
21 visitors_.push_front(new_visitor);
22}
23
25 DecoderVisitor* new_visitor, DecoderVisitor* registered_visitor) {
26 visitors_.remove(new_visitor);
27 std::list<DecoderVisitor*>::iterator it;
28 for (it = visitors_.begin(); it != visitors_.end(); it++) {
29 if (*it == registered_visitor) {
30 visitors_.insert(it, new_visitor);
31 return;
32 }
33 }
34 // We reached the end of the list. The last element must be
35 // registered_visitor.
36 DCHECK(*it == registered_visitor);
37 visitors_.insert(it, new_visitor);
38}
39
41 DecoderVisitor* new_visitor, DecoderVisitor* registered_visitor) {
42 visitors_.remove(new_visitor);
43 std::list<DecoderVisitor*>::iterator it;
44 for (it = visitors_.begin(); it != visitors_.end(); it++) {
45 if (*it == registered_visitor) {
46 it++;
47 visitors_.insert(it, new_visitor);
48 return;
49 }
50 }
51 // We reached the end of the list. The last element must be
52 // registered_visitor.
53 DCHECK(*it == registered_visitor);
54 visitors_.push_back(new_visitor);
55}
56
57void DispatchingDecoderVisitor::RemoveVisitor(DecoderVisitor* visitor) {
58 visitors_.remove(visitor);
59}
60
61#define DEFINE_VISITOR_CALLERS(A) \
62 void DispatchingDecoderVisitor::Visit##A(Instruction* instr) { \
63 DCHECK_EQ(instr->Mask(A##FMask), A##Fixed); \
64 std::list<DecoderVisitor*>::iterator it; \
65 for (it = visitors_.begin(); it != visitors_.end(); it++) { \
66 (*it)->Visit##A(instr); \
67 } \
68 }
69VISITOR_LIST(DEFINE_VISITOR_CALLERS)
70#undef DEFINE_VISITOR_CALLERS
71
72} // namespace internal
73} // namespace v8
74
75#endif // V8_TARGET_ARCH_ARM64
void InsertVisitorBefore(DecoderVisitor *new_visitor, DecoderVisitor *registered_visitor)
void AppendVisitor(DecoderVisitor *visitor)
std::list< DecoderVisitor * > visitors_
void InsertVisitorAfter(DecoderVisitor *new_visitor, DecoderVisitor *registered_visitor)
void PrependVisitor(DecoderVisitor *visitor)
void RemoveVisitor(DecoderVisitor *visitor)
#define VISITOR_LIST(V)
#define DCHECK(condition)
Definition logging.h:482