V8 Project
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 #include "src/v8.h"
6 
7 #if V8_TARGET_ARCH_ARM64
8 
10 #include "src/globals.h"
11 #include "src/utils.h"
12 
13 
14 namespace v8 {
15 namespace internal {
16 
17 
18 void DispatchingDecoderVisitor::AppendVisitor(DecoderVisitor* new_visitor) {
19  visitors_.remove(new_visitor);
20  visitors_.push_back(new_visitor);
21 }
22 
23 
24 void DispatchingDecoderVisitor::PrependVisitor(DecoderVisitor* new_visitor) {
25  visitors_.remove(new_visitor);
26  visitors_.push_front(new_visitor);
27 }
28 
29 
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);
37  return;
38  }
39  }
40  // We reached the end of the list. The last element must be
41  // registered_visitor.
42  DCHECK(*it == registered_visitor);
43  visitors_.insert(it, new_visitor);
44 }
45 
46 
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) {
53  it++;
54  visitors_.insert(it, new_visitor);
55  return;
56  }
57  }
58  // We reached the end of the list. The last element must be
59  // registered_visitor.
60  DCHECK(*it == registered_visitor);
61  visitors_.push_back(new_visitor);
62 }
63 
64 
65 void DispatchingDecoderVisitor::RemoveVisitor(DecoderVisitor* visitor) {
66  visitors_.remove(visitor);
67 }
68 
69 
70 #define DEFINE_VISITOR_CALLERS(A) \
71  void DispatchingDecoderVisitor::Visit##A(Instruction* instr) { \
72  if (!(instr->Mask(A##FMask) == A##Fixed)) { \
73  DCHECK(instr->Mask(A##FMask) == A##Fixed); \
74  } \
75  std::list<DecoderVisitor*>::iterator it; \
76  for (it = visitors_.begin(); it != visitors_.end(); it++) { \
77  (*it)->Visit##A(instr); \
78  } \
79  }
80 VISITOR_LIST(DEFINE_VISITOR_CALLERS)
81 #undef DEFINE_VISITOR_CALLERS
82 
83 
84 } } // namespace v8::internal
85 
86 #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)
Definition: decoder-arm64.h:19
#define DCHECK(condition)
Definition: logging.h:205
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20