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

Unified Diff: runtime/vm/intrinsifier_arm.cc

Issue 1217323002: Intrinsic version of Object.runtimeType (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: more Created 5 years, 6 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
Index: runtime/vm/intrinsifier_arm.cc
diff --git a/runtime/vm/intrinsifier_arm.cc b/runtime/vm/intrinsifier_arm.cc
index 4ba8fedd2f7aabd1601694702323ddfec74ab1a1..9dbd1f94cee99479faed58f4e3562d8dce73f3b7 100644
--- a/runtime/vm/intrinsifier_arm.cc
+++ b/runtime/vm/intrinsifier_arm.cc
@@ -1570,6 +1570,35 @@ void Intrinsifier::ObjectEquals(Assembler* assembler) {
}
+// Return type quickly for simple types (not parameterized and not signature).
+void Intrinsifier::ObjectRuntimeType(Assembler* assembler) {
+ Label fall_through;
+ static const intptr_t kSmiCidSource = kSmiCid << RawObject::kClassIdTagPos;
+ __ ldr(R0, Address(SP, 0 * kWordSize));
+
+ __ LoadImmediate(TMP, reinterpret_cast<int32_t>(&kSmiCidSource) + 1);
+ __ tst(R0, Operand(kSmiTagMask));
+ __ mov(TMP, Operand(R0), NE);
+ __ LoadClassId(R1, TMP);
+ __ LoadClassById(R2, R1);
+ // R2: class of instance (R0).
+ __ ldr(R3, FieldAddress(R2, Class::signature_function_offset()));
+ __ CompareImmediate(R3, reinterpret_cast<int32_t>(Object::null()));
+ __ b(&fall_through, NE);
+
+ __ ldrh(R3, FieldAddress(R2, Class::num_type_arguments_offset()));
+ __ CompareImmediate(R3, 0);
+ __ b(&fall_through, NE);
+
+ __ ldr(R0, FieldAddress(R2, Class::canonical_types_offset()));
+ __ CompareImmediate(R0, reinterpret_cast<int32_t>(Object::null()));
+ __ b(&fall_through, EQ);
+ __ Ret();
+
+ __ Bind(&fall_through);
+}
+
+
void Intrinsifier::String_getHashCode(Assembler* assembler) {
__ ldr(R0, Address(SP, 0 * kWordSize));
__ ldr(R0, FieldAddress(R0, String::hash_offset()));

Powered by Google App Engine
This is Rietveld 408576698