Index: runtime/vm/stub_code_x64.cc |
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc |
index 5187e1eb423e8080b6284a1e9f5a5a89b767b84a..a68eaab83827e34e7a61a0c62daa3014afdd14e0 100644 |
--- a/runtime/vm/stub_code_x64.cc |
+++ b/runtime/vm/stub_code_x64.cc |
@@ -1729,15 +1729,17 @@ void StubCode::GenerateDebugStepCheckStub(Assembler* assembler) { |
// Used to check class and type arguments. Arguments passed on stack: |
// TOS + 0: return address. |
-// TOS + 1: instantiator type arguments (can be NULL). |
-// TOS + 2: instance. |
-// TOS + 3: SubtypeTestCache. |
+// TOS + 1: function type arguments (only if n == 4, can be raw_null). |
+// TOS + 2: instantiator type arguments (only if n == 4, can be raw_null). |
+// TOS + 3: instance. |
+// TOS + 4: SubtypeTestCache. |
// Result in RCX: null -> not found, otherwise result (true or false). |
static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) { |
- ASSERT((1 <= n) && (n <= 3)); |
- const intptr_t kInstantiatorTypeArgumentsInBytes = 1 * kWordSize; |
- const intptr_t kInstanceOffsetInBytes = 2 * kWordSize; |
- const intptr_t kCacheOffsetInBytes = 3 * kWordSize; |
+ ASSERT((n == 1) || (n == 2) || (n == 4)); |
+ const intptr_t kFunctionTypeArgumentsInBytes = 1 * kWordSize; |
+ const intptr_t kInstantiatorTypeArgumentsInBytes = 2 * kWordSize; |
+ const intptr_t kInstanceOffsetInBytes = 3 * kWordSize; |
+ const intptr_t kCacheOffsetInBytes = 4 * kWordSize; |
__ movq(RAX, Address(RSP, kInstanceOffsetInBytes)); |
__ LoadObject(R9, Object::null_object()); |
if (n > 1) { |
@@ -1791,6 +1793,10 @@ static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) { |
Address(RDX, kWordSize * |
SubtypeTestCache::kInstantiatorTypeArguments)); |
__ cmpq(RDI, Address(RSP, kInstantiatorTypeArgumentsInBytes)); |
+ __ j(NOT_EQUAL, &next_iteration, Assembler::kNearJump); |
+ __ movq(RDI, Address(RDX, kWordSize * |
+ SubtypeTestCache::kFunctionTypeArguments)); |
+ __ cmpq(RDI, Address(RSP, kFunctionTypeArgumentsInBytes)); |
__ j(EQUAL, &found, Assembler::kNearJump); |
} |
} |
@@ -1811,9 +1817,10 @@ static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) { |
// Used to check class and type arguments. Arguments passed on stack: |
// TOS + 0: return address. |
-// TOS + 1: instantiator type arguments or NULL. |
-// TOS + 2: instance. |
-// TOS + 3: cache array. |
+// TOS + 1: raw_null. |
+// TOS + 2: raw_null. |
+// TOS + 3: instance. |
+// TOS + 4: SubtypeTestCache. |
// Result in RCX: null -> not found, otherwise result (true or false). |
void StubCode::GenerateSubtype1TestCacheStub(Assembler* assembler) { |
GenerateSubtypeNTestCacheStub(assembler, 1); |
@@ -1822,9 +1829,10 @@ void StubCode::GenerateSubtype1TestCacheStub(Assembler* assembler) { |
// Used to check class and type arguments. Arguments passed on stack: |
// TOS + 0: return address. |
-// TOS + 1: instantiator type arguments or NULL. |
-// TOS + 2: instance. |
-// TOS + 3: cache array. |
+// TOS + 1: raw_null. |
+// TOS + 2: raw_null. |
+// TOS + 3: instance. |
+// TOS + 4: SubtypeTestCache. |
// Result in RCX: null -> not found, otherwise result (true or false). |
void StubCode::GenerateSubtype2TestCacheStub(Assembler* assembler) { |
GenerateSubtypeNTestCacheStub(assembler, 2); |
@@ -1833,12 +1841,13 @@ void StubCode::GenerateSubtype2TestCacheStub(Assembler* assembler) { |
// Used to check class and type arguments. Arguments passed on stack: |
// TOS + 0: return address. |
-// TOS + 1: instantiator type arguments. |
-// TOS + 2: instance. |
-// TOS + 3: cache array. |
+// TOS + 1: function type arguments (can be raw_null). |
+// TOS + 2: instantiator type arguments (can be raw_null). |
+// TOS + 3: instance. |
+// TOS + 4: SubtypeTestCache. |
// Result in RCX: null -> not found, otherwise result (true or false). |
-void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) { |
- GenerateSubtypeNTestCacheStub(assembler, 3); |
+void StubCode::GenerateSubtype4TestCacheStub(Assembler* assembler) { |
+ GenerateSubtypeNTestCacheStub(assembler, 4); |
} |