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

Unified Diff: runtime/vm/intrinsifier_x64.cc

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/intrinsifier_ia32.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intrinsifier_x64.cc
diff --git a/runtime/vm/intrinsifier_x64.cc b/runtime/vm/intrinsifier_x64.cc
index bc0ea67276ab22be3d4aec020a90daa9762cdac0..bf8261e133ba4118c2fa9d0d6a036f29aa3b6937 100644
--- a/runtime/vm/intrinsifier_x64.cc
+++ b/runtime/vm/intrinsifier_x64.cc
@@ -1479,98 +1479,6 @@ bool Intrinsifier::Object_equal(Assembler* assembler) {
}
-static intptr_t GetOffsetForField(const char* class_name_p,
- const char* field_name_p) {
- const String& class_name = String::Handle(Symbols::New(class_name_p));
- const String& field_name = String::Handle(Symbols::New(field_name_p));
- const Library& core_lib = Library::Handle(Library::CoreLibrary());
- const Class& cls =
- Class::Handle(core_lib.LookupClassAllowPrivate(class_name));
- ASSERT(!cls.IsNull());
- const Field& field = Field::ZoneHandle(cls.LookupInstanceField(field_name));
- ASSERT(!field.IsNull());
- return field.Offset();
-}
-
-
-static const char* kFixedSizeArrayIteratorClassName = "_FixedSizeArrayIterator";
-
-// Class 'FixedSizeArrayIterator':
-// T next() {
-// return _array[_pos++];
-// }
-// Intrinsify: return _array[_pos++];
-// TODO(srdjan): Throw a 'StateError' exception if the iterator
-// has no more elements.
-bool Intrinsifier::FixedSizeArrayIterator_next(Assembler* assembler) {
- Label fall_through;
- const intptr_t array_offset =
- GetOffsetForField(kFixedSizeArrayIteratorClassName, "_array");
- const intptr_t pos_offset =
- GetOffsetForField(kFixedSizeArrayIteratorClassName, "_pos");
- ASSERT((array_offset >= 0) && (pos_offset >= 0));
- // Receiver is not NULL.
- __ movq(RAX, Address(RSP, + 1 * kWordSize)); // Receiver.
- __ movq(RCX, FieldAddress(RAX, pos_offset)); // Field _pos.
- // '_pos' cannot be greater than array length and therefore is always Smi.
-#if defined(DEBUG)
- Label pos_ok;
- __ testq(RCX, Immediate(kSmiTagMask));
- __ j(ZERO, &pos_ok, Assembler::kNearJump);
- __ Stop("pos must be Smi");
- __ Bind(&pos_ok);
-#endif
- // Check that we are not trying to call 'next' when 'hasNext' is false.
- __ movq(RAX, FieldAddress(RAX, array_offset)); // Field _array.
- __ cmpq(RCX, FieldAddress(RAX, Array::length_offset())); // Range check.
- __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump);
-
- // RCX is Smi, i.e, times 2.
- ASSERT(kSmiTagShift == 1);
- __ movq(RDI, FieldAddress(RAX, RCX, TIMES_4, sizeof(RawArray))); // Result.
- const Immediate value = Immediate(reinterpret_cast<int64_t>(Smi::New(1)));
- __ addq(RCX, value); // _pos++.
- __ j(OVERFLOW, &fall_through, Assembler::kNearJump);
- __ movq(RAX, Address(RSP, + 1 * kWordSize)); // Receiver.
- __ StoreIntoObjectNoBarrier(RAX,
- FieldAddress(RAX, pos_offset),
- RCX); // Store _pos.
- __ movq(RAX, RDI);
- __ ret();
- __ Bind(&fall_through);
- return false;
-}
-
-
-// Class 'FixedSizeArrayIterator':
-// bool get hasNext {
-// return _length > _pos;
-// }
-bool Intrinsifier::FixedSizeArrayIterator_getHasNext(Assembler* assembler) {
- Label fall_through, is_true;
- const intptr_t length_offset =
- GetOffsetForField(kFixedSizeArrayIteratorClassName, "_length");
- const intptr_t pos_offset =
- GetOffsetForField(kFixedSizeArrayIteratorClassName, "_pos");
- __ movq(RAX, Address(RSP, + 1 * kWordSize)); // Receiver.
- __ movq(RCX, FieldAddress(RAX, length_offset)); // Field _length.
- __ movq(RAX, FieldAddress(RAX, pos_offset)); // Field _pos.
- __ movq(RDI, RAX);
- __ orq(RDI, RCX);
- __ testq(RDI, Immediate(kSmiTagMask));
- __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi _length/_pos.
- __ cmpq(RCX, RAX); // _length > _pos.
- __ j(GREATER, &is_true, Assembler::kNearJump);
- __ LoadObject(RAX, Bool::False());
- __ ret();
- __ Bind(&is_true);
- __ LoadObject(RAX, Bool::True());
- __ ret();
- __ Bind(&fall_through);
- return false;
-}
-
-
bool Intrinsifier::String_getHashCode(Assembler* assembler) {
Label fall_through;
__ movq(RAX, Address(RSP, + 1 * kWordSize)); // String object.
« no previous file with comments | « runtime/vm/intrinsifier_ia32.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698