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

Unified Diff: runtime/vm/stub_code_x64.cc

Issue 10409067: More inlined type checking for x64. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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/flow_graph_compiler_x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code_x64.cc
===================================================================
--- runtime/vm/stub_code_x64.cc (revision 7858)
+++ runtime/vm/stub_code_x64.cc (working copy)
@@ -1764,16 +1764,24 @@
ASSERT((1 <= n) && (n <= 3));
const Immediate raw_null =
Immediate(reinterpret_cast<intptr_t>(Object::null()));
- // const intptr_t kInstantiatorTypeArgumentsInBytes = 1 * kWordSize;
+ const intptr_t kInstantiatorTypeArgumentsInBytes = 1 * kWordSize;
const intptr_t kInstanceOffsetInBytes = 2 * kWordSize;
const intptr_t kCacheOffsetInBytes = 3 * kWordSize;
__ movq(RAX, Address(RSP, kInstanceOffsetInBytes));
__ movq(R10, FieldAddress(RAX, Object::class_offset()));
// RAX: instance, R10: instance class.
if (n > 1) {
- __ Unimplemented("GenerateSubtypeNTestCacheStub n > 1");
+ // Compute instance type arguments into R13.
+ Label has_no_type_arguments;
+ __ movq(R13, raw_null);
+ __ movq(RDI, FieldAddress(R10,
+ Class::type_arguments_instance_field_offset_offset()));
+ __ cmpq(RDI, Immediate(Class::kNoTypeArguments));
+ __ j(EQUAL, &has_no_type_arguments, Assembler::kNearJump);
+ __ movq(R13, FieldAddress(RAX, RDI, TIMES_1, 0));
+ __ Bind(&has_no_type_arguments);
}
- // TODO(srdjan): R13: instance type arguments or null, used only if n > 1.
+ // R13: instance type arguments or null, used only if n > 1.
__ movq(RDX, Address(RSP, kCacheOffsetInBytes));
// RDX: SubtypeTestCache.
__ movq(RDX, FieldAddress(RDX, SubtypeTestCache::cache_offset()));
@@ -1790,7 +1798,20 @@
if (n == 1) {
__ j(EQUAL, &found, Assembler::kNearJump);
} else {
- __ Unimplemented("GenerateSubtypeNTestCacheStub n > 1");
+ __ j(NOT_EQUAL, &next_iteration, Assembler::kNearJump);
+ __ movq(RDI,
+ Address(RDX, kWordSize * SubtypeTestCache::kInstanceTypeArguments));
+ __ cmpq(RDI, R13);
+ if (n == 2) {
+ __ j(EQUAL, &found, Assembler::kNearJump);
+ } else {
+ __ j(NOT_EQUAL, &next_iteration, Assembler::kNearJump);
+ __ movq(RDI,
+ Address(RDX,
+ kWordSize * SubtypeTestCache::kInstantiatorTypeArguments));
+ __ cmpq(RDI, Address(RSP, kInstantiatorTypeArgumentsInBytes));
+ __ j(EQUAL, &found, Assembler::kNearJump);
+ }
}
__ Bind(&next_iteration);
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698