Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: runtime/vm/instructions_arm64.cc

Issue 1439893002: - Annotate instructions that load objects from the ObjectPool or Thread. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/instructions_arm.cc ('k') | runtime/vm/instructions_ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/constants_arm64.h" 9 #include "vm/constants_arm64.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 offset |= instr->Imm16Field(); 252 offset |= instr->Imm16Field();
253 } 253 }
254 } 254 }
255 // PP is untagged on ARM64. 255 // PP is untagged on ARM64.
256 ASSERT(Utils::IsAligned(offset, 8)); 256 ASSERT(Utils::IsAligned(offset, 8));
257 *index = ObjectPool::IndexFromOffset(offset - kHeapObjectTag); 257 *index = ObjectPool::IndexFromOffset(offset - kHeapObjectTag);
258 return start; 258 return start;
259 } 259 }
260 260
261 261
262 bool DecodeLoadObjectFromPoolOrThread(uword pc,
263 const Code& code,
264 Object* obj) {
265 ASSERT(code.ContainsInstructionAt(pc));
266
267 Instr* instr = Instr::At(pc);
268 if (instr->IsLoadStoreRegOp() && (instr->Bit(22) == 1) &&
269 (instr->Bits(30, 2) == 3) && instr->Bit(24) == 1) {
270 intptr_t offset = (instr->Imm12Field() << 3);
271 if (instr->RnField() == PP) {
272 // PP is untagged on ARM64.
273 ASSERT(Utils::IsAligned(offset, 8));
274 intptr_t index = ObjectPool::IndexFromOffset(offset - kHeapObjectTag);
275 const ObjectPool& pool = ObjectPool::Handle(code.object_pool());
276 if (pool.InfoAt(index) == ObjectPool::kTaggedObject) {
277 *obj = pool.ObjectAt(index);
278 return true;
279 }
280 } else if (instr->RnField() == THR) {
281 return Thread::ObjectAtOffset(offset, obj);
282 }
283 }
284 // TODO(rmacnak): Loads with offsets beyond 12 bits.
285
286 return false;
287 }
288
289
262 // Encodes a load sequence ending at 'end'. Encodes a fixed length two 290 // Encodes a load sequence ending at 'end'. Encodes a fixed length two
263 // instruction load from the pool pointer in PP using the destination 291 // instruction load from the pool pointer in PP using the destination
264 // register reg as a temporary for the base address. 292 // register reg as a temporary for the base address.
265 // Assumes that the location has already been validated for patching. 293 // Assumes that the location has already been validated for patching.
266 void InstructionPattern::EncodeLoadWordFromPoolFixed(uword end, 294 void InstructionPattern::EncodeLoadWordFromPoolFixed(uword end,
267 int32_t offset) { 295 int32_t offset) {
268 uword start = end - Instr::kInstrSize; 296 uword start = end - Instr::kInstrSize;
269 Instr* instr = Instr::At(start); 297 Instr* instr = Instr::At(start);
270 const int32_t upper12 = offset & 0x00fff000; 298 const int32_t upper12 = offset & 0x00fff000;
271 const int32_t lower12 = offset & 0x00000fff; 299 const int32_t lower12 = offset & 0x00000fff;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 bool ReturnPattern::IsValid() const { 404 bool ReturnPattern::IsValid() const {
377 Instr* bx_lr = Instr::At(pc_); 405 Instr* bx_lr = Instr::At(pc_);
378 const Register crn = ConcreteRegister(LR); 406 const Register crn = ConcreteRegister(LR);
379 const int32_t instruction = RET | (static_cast<int32_t>(crn) << kRnShift); 407 const int32_t instruction = RET | (static_cast<int32_t>(crn) << kRnShift);
380 return bx_lr->InstructionBits() == instruction; 408 return bx_lr->InstructionBits() == instruction;
381 } 409 }
382 410
383 } // namespace dart 411 } // namespace dart
384 412
385 #endif // defined TARGET_ARCH_ARM64 413 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/instructions_arm.cc ('k') | runtime/vm/instructions_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698