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

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

Issue 513213002: Generate some intrinsics using our IR. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 months 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 | Annotate | Revision Log
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" 5 #include "vm/globals.h"
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/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/longjump.h" 10 #include "vm/longjump.h"
(...skipping 13 matching lines...) Expand all
24 DEFINE_FLAG(bool, print_stop_message, false, "Print stop message."); 24 DEFINE_FLAG(bool, print_stop_message, false, "Print stop message.");
25 DECLARE_FLAG(bool, inline_alloc); 25 DECLARE_FLAG(bool, inline_alloc);
26 26
27 27
28 Assembler::Assembler(bool use_far_branches) 28 Assembler::Assembler(bool use_far_branches)
29 : buffer_(), 29 : buffer_(),
30 object_pool_(GrowableObjectArray::Handle()), 30 object_pool_(GrowableObjectArray::Handle()),
31 patchable_pool_entries_(), 31 patchable_pool_entries_(),
32 prologue_offset_(-1), 32 prologue_offset_(-1),
33 use_far_branches_(use_far_branches), 33 use_far_branches_(use_far_branches),
34 comments_() { 34 comments_(),
35 allow_constant_pool_(true) {
35 if (Isolate::Current() != Dart::vm_isolate()) { 36 if (Isolate::Current() != Dart::vm_isolate()) {
36 object_pool_ = GrowableObjectArray::New(Heap::kOld); 37 object_pool_ = GrowableObjectArray::New(Heap::kOld);
37 38
38 // These objects and labels need to be accessible through every pool-pointer 39 // These objects and labels need to be accessible through every pool-pointer
39 // at the same index. 40 // at the same index.
40 object_pool_.Add(Object::null_object(), Heap::kOld); 41 object_pool_.Add(Object::null_object(), Heap::kOld);
41 patchable_pool_entries_.Add(kNotPatchable); 42 patchable_pool_entries_.Add(kNotPatchable);
42 // Not adding Object::null() to the index table. It is at index 0 in the 43 // Not adding Object::null() to the index table. It is at index 0 in the
43 // object pool, but the HashMap uses 0 to indicate not found. 44 // object pool, but the HashMap uses 0 to indicate not found.
44 45
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 482
482 intptr_t Assembler::FindImmediate(int64_t imm) { 483 intptr_t Assembler::FindImmediate(int64_t imm) {
483 ASSERT(Isolate::Current() != Dart::vm_isolate()); 484 ASSERT(Isolate::Current() != Dart::vm_isolate());
484 ASSERT(!object_pool_.IsNull()); 485 ASSERT(!object_pool_.IsNull());
485 const Smi& smi = Smi::Handle(reinterpret_cast<RawSmi*>(imm)); 486 const Smi& smi = Smi::Handle(reinterpret_cast<RawSmi*>(imm));
486 return FindObject(smi, kNotPatchable); 487 return FindObject(smi, kNotPatchable);
487 } 488 }
488 489
489 490
490 bool Assembler::CanLoadObjectFromPool(const Object& object) { 491 bool Assembler::CanLoadObjectFromPool(const Object& object) {
492 if (!allow_constant_pool()) return false;
zra 2014/09/05 20:26:49 Please use curly braces. Also, Null, True, and Fa
Florian Schneider 2014/09/08 11:12:39 Ok, I made those objects to be loaded from the con
493
491 // TODO(zra, kmillikin): Also load other large immediates from the object 494 // TODO(zra, kmillikin): Also load other large immediates from the object
492 // pool 495 // pool
493 if (object.IsSmi()) { 496 if (object.IsSmi()) {
494 // If the raw smi does not fit into a 32-bit signed int, then we'll keep 497 // If the raw smi does not fit into a 32-bit signed int, then we'll keep
495 // the raw value in the object pool. 498 // the raw value in the object pool.
496 return !Utils::IsInt(32, reinterpret_cast<int64_t>(object.raw())); 499 return !Utils::IsInt(32, reinterpret_cast<int64_t>(object.raw()));
497 } 500 }
498 ASSERT(object.IsNotTemporaryScopedHandle()); 501 ASSERT(object.IsNotTemporaryScopedHandle());
499 ASSERT(object.IsOld()); 502 ASSERT(object.IsOld());
500 return (Isolate::Current() != Dart::vm_isolate()) && 503 return (Isolate::Current() != Dart::vm_isolate()) &&
501 // Not in the VMHeap, OR is one of the VMHeap objects we put in every 504 // Not in the VMHeap, OR is one of the VMHeap objects we put in every
502 // object pool. 505 // object pool.
503 // TODO(zra): Evaluate putting all VM heap objects into the pool. 506 // TODO(zra): Evaluate putting all VM heap objects into the pool.
504 (!object.InVMHeap() || (object.raw() == Object::null()) || 507 (!object.InVMHeap() || (object.raw() == Object::null()) ||
505 (object.raw() == Bool::True().raw()) || 508 (object.raw() == Bool::True().raw()) ||
506 (object.raw() == Bool::False().raw())); 509 (object.raw() == Bool::False().raw()));
507 } 510 }
508 511
509 512
510 bool Assembler::CanLoadImmediateFromPool(int64_t imm, Register pp) { 513 bool Assembler::CanLoadImmediateFromPool(int64_t imm, Register pp) {
514 if (!allow_constant_pool()) return false;
zra 2014/09/05 20:26:49 Please use curly braces.
Florian Schneider 2014/09/08 11:12:39 Done.
511 return !Utils::IsInt(32, imm) && 515 return !Utils::IsInt(32, imm) &&
512 (pp != kNoPP) && 516 (pp != kNoPP) &&
513 // We *could* put constants in the pool in a VM isolate, but it is 517 // We *could* put constants in the pool in a VM isolate, but it is
514 // simpler to maintain the invariant that the object pool is not used 518 // simpler to maintain the invariant that the object pool is not used
515 // in the VM isolate. 519 // in the VM isolate.
516 (Isolate::Current() != Dart::vm_isolate()); 520 (Isolate::Current() != Dart::vm_isolate());
517 } 521 }
518 522
519 523
520 void Assembler::LoadExternalLabel(Register dst, 524 void Assembler::LoadExternalLabel(Register dst,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 if (CanLoadObjectFromPool(object)) { 564 if (CanLoadObjectFromPool(object)) {
561 LoadObject(TMP, object, pp); 565 LoadObject(TMP, object, pp);
562 CompareRegisters(reg, TMP); 566 CompareRegisters(reg, TMP);
563 } else { 567 } else {
564 CompareImmediate(reg, reinterpret_cast<int64_t>(object.raw()), pp); 568 CompareImmediate(reg, reinterpret_cast<int64_t>(object.raw()), pp);
565 } 569 }
566 } 570 }
567 571
568 572
569 void Assembler::LoadDecodableImmediate(Register reg, int64_t imm, Register pp) { 573 void Assembler::LoadDecodableImmediate(Register reg, int64_t imm, Register pp) {
570 if ((pp != kNoPP) && (Isolate::Current() != Dart::vm_isolate())) { 574 if ((pp != kNoPP) &&
575 (Isolate::Current() != Dart::vm_isolate()) &&
576 allow_constant_pool()) {
571 int64_t val_smi_tag = imm & kSmiTagMask; 577 int64_t val_smi_tag = imm & kSmiTagMask;
572 imm &= ~kSmiTagMask; // Mask off the tag bits. 578 imm &= ~kSmiTagMask; // Mask off the tag bits.
573 const int32_t offset = Array::element_offset(FindImmediate(imm)); 579 const int32_t offset = Array::element_offset(FindImmediate(imm));
574 LoadWordFromPoolOffset(reg, pp, offset); 580 LoadWordFromPoolOffset(reg, pp, offset);
575 if (val_smi_tag != 0) { 581 if (val_smi_tag != 0) {
576 // Add back the tag bits. 582 // Add back the tag bits.
577 orri(reg, reg, val_smi_tag); 583 orri(reg, reg, val_smi_tag);
578 } 584 }
579 } else { 585 } else {
580 // TODO(zra): Since this sequence only needs to be decodable, it can be 586 // TODO(zra): Since this sequence only needs to be decodable, it can be
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 add(base, array, Operand(index, LSL, shift)); 1498 add(base, array, Operand(index, LSL, shift));
1493 } 1499 }
1494 const OperandSize size = Address::OperandSizeFor(cid); 1500 const OperandSize size = Address::OperandSizeFor(cid);
1495 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); 1501 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size));
1496 return Address(base, offset, Address::Offset, size); 1502 return Address(base, offset, Address::Offset, size);
1497 } 1503 }
1498 1504
1499 } // namespace dart 1505 } // namespace dart
1500 1506
1501 #endif // defined TARGET_ARCH_ARM64 1507 #endif // defined TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698