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.
7 #if V8_TARGET_ARCH_ARM64
9 #include "src/globals.h"
10 #include "src/utils.h"
11 #include "src/arm64/decoder-arm64.h"
18 void DispatchingDecoderVisitor::AppendVisitor(DecoderVisitor* new_visitor) {
19 visitors_.remove(new_visitor);
20 visitors_.push_front(new_visitor);
24 void DispatchingDecoderVisitor::PrependVisitor(DecoderVisitor* new_visitor) {
25 visitors_.remove(new_visitor);
26 visitors_.push_back(new_visitor);
30 void DispatchingDecoderVisitor::InsertVisitorBefore(
31 DecoderVisitor* new_visitor, DecoderVisitor* registered_visitor) {
32 visitors_.remove(new_visitor);
33 std::list<DecoderVisitor*>::iterator it;
34 for (it = visitors_.begin(); it != visitors_.end(); it++) {
35 if (*it == registered_visitor) {
36 visitors_.insert(it, new_visitor);
40 // We reached the end of the list. The last element must be
41 // registered_visitor.
42 ASSERT(*it == registered_visitor);
43 visitors_.insert(it, new_visitor);
47 void DispatchingDecoderVisitor::InsertVisitorAfter(
48 DecoderVisitor* new_visitor, DecoderVisitor* registered_visitor) {
49 visitors_.remove(new_visitor);
50 std::list<DecoderVisitor*>::iterator it;
51 for (it = visitors_.begin(); it != visitors_.end(); it++) {
52 if (*it == registered_visitor) {
54 visitors_.insert(it, new_visitor);
58 // We reached the end of the list. The last element must be
59 // registered_visitor.
60 ASSERT(*it == registered_visitor);
61 visitors_.push_back(new_visitor);
65 void DispatchingDecoderVisitor::RemoveVisitor(DecoderVisitor* visitor) {
66 visitors_.remove(visitor);
70 #define DEFINE_VISITOR_CALLERS(A) \
71 void DispatchingDecoderVisitor::Visit##A(Instruction* instr) { \
72 if (!(instr->Mask(A##FMask) == A##Fixed)) { \
73 ASSERT(instr->Mask(A##FMask) == A##Fixed); \
75 std::list<DecoderVisitor*>::iterator it; \
76 for (it = visitors_.begin(); it != visitors_.end(); it++) { \
77 (*it)->Visit##A(instr); \
80 VISITOR_LIST(DEFINE_VISITOR_CALLERS)
81 #undef DEFINE_VISITOR_CALLERS
84 } } // namespace v8::internal
86 #endif // V8_TARGET_ARCH_ARM64