OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
7 | 7 |
8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
9 | 9 |
| 10 #include "vm/flow_graph_compiler.h" |
10 #include "vm/instructions.h" | 11 #include "vm/instructions.h" |
11 #include "vm/object.h" | 12 #include "vm/object.h" |
12 | 13 |
13 namespace dart { | 14 namespace dart { |
14 | 15 |
15 RawArray* CodePatcher::GetClosureArgDescAt(uword return_address, | 16 RawArray* CodePatcher::GetClosureArgDescAt(uword return_address, |
16 const Code& code) { | 17 const Code& code) { |
17 ASSERT(code.ContainsInstructionAt(return_address)); | 18 ASSERT(code.ContainsInstructionAt(return_address)); |
18 CallPattern call(return_address, code); | 19 CallPattern call(return_address, code); |
19 return call.ClosureArgumentsDescriptor(); | 20 return call.ClosureArgumentsDescriptor(); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } | 97 } |
97 | 98 |
98 | 99 |
99 // This class pattern matches on a load from the object pool. Loading on | 100 // This class pattern matches on a load from the object pool. Loading on |
100 // ARM is complicated because it can take four possible different forms. We | 101 // ARM is complicated because it can take four possible different forms. We |
101 // match backwards from the end of the sequence so we can reuse the code for | 102 // match backwards from the end of the sequence so we can reuse the code for |
102 // matching object pool loads at calls. | 103 // matching object pool loads at calls. |
103 class EdgeCounter : public ValueObject { | 104 class EdgeCounter : public ValueObject { |
104 public: | 105 public: |
105 EdgeCounter(uword pc, const Code& code) | 106 EdgeCounter(uword pc, const Code& code) |
106 : end_(pc - kAdjust), object_pool_(Array::Handle(code.ObjectPool())) { | 107 : end_(pc - FlowGraphCompiler::EdgeCounterIncrementSizeInBytes()), |
| 108 object_pool_(Array::Handle(code.ObjectPool())) { |
107 // An IsValid predicate is complicated and duplicates the code in the | 109 // An IsValid predicate is complicated and duplicates the code in the |
108 // decoding function. Instead we rely on decoding the pattern which | 110 // decoding function. Instead we rely on decoding the pattern which |
109 // will assert partial validity. | 111 // will assert partial validity. |
110 } | 112 } |
111 | 113 |
112 RawObject* edge_counter() const { | 114 RawObject* edge_counter() const { |
113 Register ignored; | 115 Register ignored; |
114 intptr_t index; | 116 intptr_t index; |
115 InstructionPattern::DecodeLoadWordFromPool(end_, &ignored, &index); | 117 InstructionPattern::DecodeLoadWordFromPool(end_, &ignored, &index); |
116 ASSERT(ignored == R0); | 118 ASSERT(ignored == R0); |
(...skipping 15 matching lines...) Expand all Loading... |
132 | 134 |
133 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) { | 135 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) { |
134 ASSERT(code.ContainsInstructionAt(pc)); | 136 ASSERT(code.ContainsInstructionAt(pc)); |
135 EdgeCounter counter(pc, code); | 137 EdgeCounter counter(pc, code); |
136 return counter.edge_counter(); | 138 return counter.edge_counter(); |
137 } | 139 } |
138 | 140 |
139 } // namespace dart | 141 } // namespace dart |
140 | 142 |
141 #endif // defined TARGET_ARCH_ARM | 143 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |