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

Unified Diff: runtime/vm/intrinsifier_ia32.cc

Issue 1217323002: Intrinsic version of Object.runtimeType (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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_ia32.cc
diff --git a/runtime/vm/intrinsifier_ia32.cc b/runtime/vm/intrinsifier_ia32.cc
index 93290edd32754b4443ff83411806c01ed7cf5343..09e7744e6563254484579761ab18a7059fd6cbbe 100644
--- a/runtime/vm/intrinsifier_ia32.cc
+++ b/runtime/vm/intrinsifier_ia32.cc
@@ -1666,6 +1666,39 @@ void Intrinsifier::ObjectEquals(Assembler* assembler) {
}
+// Return type quickly for simple types (not parametrized and not signature)
regis 2015/06/30 23:28:32 parametrized -> parameterized
srdjan 2015/07/01 00:35:41 Done.
+void Intrinsifier::ObjectRuntimeType(Assembler* assembler) {
+ Label fall_through, not_smi;
+ __ movl(EAX, Address(ESP, + 1 * kWordSize));
+ __ testl(EAX, Immediate(kSmiTagMask));
+ __ j(NOT_ZERO, &not_smi, Assembler::kNearJump);
+ __ LoadObject(EAX, Type::ZoneHandle(Type::IntType()));
+ __ ret();
+
+ __ Bind(&not_smi);
+ __ LoadClass(EBX, EAX, EDI);
regis 2015/06/30 23:28:32 The C++ code explicitly checks for a null instance
srdjan 2015/07/01 00:35:41 Added a test. The explicit check is probably in C+
+ // EBX: class of instance (EAX).
+ // if ((NumTypeArguments() == 0) && !IsSignatureClass()) {
+ // return reinterpret_cast<RawType*>(raw_ptr()->canonical_types_);
+ // }
regis 2015/06/30 23:28:32 I would remove the code in the comment.
srdjan 2015/07/01 00:35:41 Done.
+ const Immediate& raw_null =
+ Immediate(reinterpret_cast<intptr_t>(Object::null()));
+ __ movl(EDI, FieldAddress(EBX, Class::signature_function_offset()));
+ __ cmpl(EDI, raw_null);
+ __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump);
+
+ __ movzxw(EDI, FieldAddress(EBX, Class::num_type_arguments_offset()));
+ __ cmpl(EDI, Immediate(0));
+ __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump);
+ __ movl(EAX, FieldAddress(EBX, Class::canonical_types_offset()));
+ __ cmpl(EAX, raw_null);
+ __ j(EQUAL, &fall_through, Assembler::kNearJump); // Not yet set.
+ __ ret();
+
+ __ Bind(&fall_through);
+}
+
+
void Intrinsifier::String_getHashCode(Assembler* assembler) {
Label fall_through;
__ movl(EAX, Address(ESP, + 1 * kWordSize)); // String object.
@@ -2073,7 +2106,7 @@ void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) {
// Registers are now set up for the lazy compile stub. It expects the function
// in EAX, the argument descriptor in EDX, and IC-Data in ECX.
static const intptr_t arg_count = RegExpMacroAssembler::kParamCount;
- __ LoadObject(EDX, Array::Handle(ArgumentsDescriptor::New(arg_count)));
+ __ LoadObject(EDX, Array::ZoneHandle(ArgumentsDescriptor::New(arg_count)));
__ xorl(ECX, ECX);
// Tail-call the function.

Powered by Google App Engine
This is Rietveld 408576698