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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
7 | 7 |
8 #include "vm/constants_mips.h" | 8 #include "vm/constants_mips.h" |
9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
10 #include "vm/instructions.h" | 10 #include "vm/instructions.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 ASSERT(instr->OpcodeField() == LUI); | 114 ASSERT(instr->OpcodeField() == LUI); |
115 ASSERT(instr->RtField() == *reg); | 115 ASSERT(instr->RtField() == *reg); |
116 // Offset is signed, so add the upper 16 bits. | 116 // Offset is signed, so add the upper 16 bits. |
117 offset += (instr->UImmField() << 16); | 117 offset += (instr->UImmField() << 16); |
118 } | 118 } |
119 *index = ObjectPool::IndexFromOffset(offset); | 119 *index = ObjectPool::IndexFromOffset(offset); |
120 return start; | 120 return start; |
121 } | 121 } |
122 | 122 |
123 | 123 |
| 124 bool DecodeLoadObjectFromPoolOrThread(uword pc, |
| 125 const Code& code, |
| 126 Object* obj) { |
| 127 ASSERT(code.ContainsInstructionAt(pc)); |
| 128 |
| 129 Instr* instr = Instr::At(pc); |
| 130 if ((instr->OpcodeField() == LW)) { |
| 131 intptr_t offset = instr->SImmField(); |
| 132 if (instr->RsField() == PP) { |
| 133 intptr_t index = ObjectPool::IndexFromOffset(offset); |
| 134 const ObjectPool& pool = ObjectPool::Handle(code.object_pool()); |
| 135 if (pool.InfoAt(index) == ObjectPool::kTaggedObject) { |
| 136 *obj = pool.ObjectAt(index); |
| 137 return true; |
| 138 } |
| 139 } else if (instr->RsField() == THR) { |
| 140 return Thread::ObjectAtOffset(offset, obj); |
| 141 } |
| 142 } |
| 143 // TODO(rmacnak): Sequence for loads beyond 16 bits. |
| 144 |
| 145 return false; |
| 146 } |
| 147 |
| 148 |
124 RawICData* CallPattern::IcData() { | 149 RawICData* CallPattern::IcData() { |
125 if (ic_data_.IsNull()) { | 150 if (ic_data_.IsNull()) { |
126 Register reg; | 151 Register reg; |
127 InstructionPattern::DecodeLoadObject(ic_data_load_end_, | 152 InstructionPattern::DecodeLoadObject(ic_data_load_end_, |
128 object_pool_, | 153 object_pool_, |
129 ®, | 154 ®, |
130 &ic_data_); | 155 &ic_data_); |
131 ASSERT(reg == S5); | 156 ASSERT(reg == S5); |
132 } | 157 } |
133 return ic_data_.raw(); | 158 return ic_data_.raw(); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 bool ReturnPattern::IsValid() const { | 283 bool ReturnPattern::IsValid() const { |
259 Instr* jr = Instr::At(pc_); | 284 Instr* jr = Instr::At(pc_); |
260 return (jr->OpcodeField() == SPECIAL) && | 285 return (jr->OpcodeField() == SPECIAL) && |
261 (jr->FunctionField() == JR) && | 286 (jr->FunctionField() == JR) && |
262 (jr->RsField() == RA); | 287 (jr->RsField() == RA); |
263 } | 288 } |
264 | 289 |
265 } // namespace dart | 290 } // namespace dart |
266 | 291 |
267 #endif // defined TARGET_ARCH_MIPS | 292 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |