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

Unified Diff: runtime/vm/stub_code_x64.cc

Issue 10458031: In generated code for x64 don't load object's class directly from class_ field. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: CoreClass in flow_graph_compiler_x64.cc should return RawClass* 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
« runtime/vm/stub_code_ia32.cc ('K') | « runtime/vm/stub_code_ia32.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
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc
index 4d1f23a9e9b188c27640164670dec77202f2510f..adb501b40999ad403ed1f482a84d69cef0c3041c 100644
--- a/runtime/vm/stub_code_x64.cc
+++ b/runtime/vm/stub_code_x64.cc
@@ -294,7 +294,7 @@ static void MegamorphicLookup(Assembler* assembler) {
__ j(EQUAL, &null_receiver, Assembler::kNearJump);
__ testq(RAX, Immediate(kSmiTagMask));
__ j(ZERO, &smi_receiver, Assembler::kNearJump);
- __ movq(RAX, FieldAddress(RAX, Object::class_offset()));
+ __ LoadClassOfObject(RAX, RAX);
__ jmp(&class_in_rax, Assembler::kNearJump);
__ Bind(&smi_receiver);
// For Smis we need to get the class from the isolate.
@@ -749,12 +749,12 @@ void StubCode::GenerateCallClosureFunctionStub(Assembler* assembler) {
Label not_closure;
__ cmpq(R13, raw_null);
// Not a closure, but null object.
- __ j(EQUAL, &not_closure, Assembler::kNearJump);
+ __ j(EQUAL, &not_closure);
__ testq(R13, Immediate(kSmiTagMask));
- __ j(ZERO, &not_closure, Assembler::kNearJump); // Not a closure, but a smi.
+ __ j(ZERO, &not_closure); // Not a closure, but a smi.
// Verify that the class of the object is a closure class by checking that
// class.signature_function() is not null.
- __ movq(RAX, FieldAddress(R13, Object::class_offset()));
+ __ LoadClassOfObject(RAX, R13);
__ movq(RAX, FieldAddress(RAX, Class::signature_function_offset()));
__ cmpq(RAX, raw_null);
// Actual class is not a closure class.
@@ -1554,8 +1554,6 @@ void StubCode::GenerateNArgsCheckInlineCacheStub(Assembler* assembler,
__ movq(RAX, Address(RSP, RAX, TIMES_4, 0)); // RAX (argument count) is Smi.
Label get_class, ic_miss;
- __ call(&get_class);
- // RAX: receiver's class
// RBX: IC data array.
#if defined(DEBUG)
@@ -1571,7 +1569,6 @@ void StubCode::GenerateNArgsCheckInlineCacheStub(Assembler* assembler,
#endif // DEBUG
// Loop that checks if there is an IC data match.
- // RAX: receiver's class.
// RBX: IC data object (preserved).
__ movq(R12, FieldAddress(RBX, ICData::ic_data_offset()));
// R12: ic_data_array with check entries: classes and target functions.
@@ -1581,6 +1578,8 @@ void StubCode::GenerateNArgsCheckInlineCacheStub(Assembler* assembler,
Immediate(reinterpret_cast<intptr_t>(Object::null()));
Label loop, found;
if (num_args == 1) {
+ __ call(&get_class);
+ // RAX: receiver's class.
__ Bind(&loop);
__ movq(R13, Address(R12, 0)); // Get class to check.
__ cmpq(RAX, R13); // Match?
@@ -1591,19 +1590,20 @@ void StubCode::GenerateNArgsCheckInlineCacheStub(Assembler* assembler,
} else if (num_args == 2) {
Label no_match;
__ Bind(&loop);
- __ movq(R13, Address(R12, 0)); // Get class from IC data to check.
// Get receiver.
__ movq(RAX, FieldAddress(R10, Array::data_offset()));
__ movq(RAX, Address(RSP, RAX, TIMES_4, 0)); // RAX is Smi.
__ call(&get_class);
+ // TODO(vegorov): switch IC data to store class index instead of class.
+ __ movq(R13, Address(R12, 0)); // Get class from IC data to check.
__ cmpq(RAX, R13); // Match?
__ j(NOT_EQUAL, &no_match, Assembler::kNearJump);
// Check second.
- __ movq(R13, Address(R12, kWordSize)); // Get class from IC data to check.
// Get next argument.
__ movq(RAX, FieldAddress(R10, Array::data_offset()));
__ movq(RAX, Address(RSP, RAX, TIMES_4, -kWordSize)); // RAX is Smi.
__ call(&get_class);
+ __ movq(R13, Address(R12, kWordSize)); // Get class from IC data to check.
__ cmpq(RAX, R13); // Match?
__ j(EQUAL, &found);
__ Bind(&no_match);
@@ -1669,7 +1669,7 @@ void StubCode::GenerateNArgsCheckInlineCacheStub(Assembler* assembler,
__ ret();
__ Bind(&not_smi);
- __ movq(RAX, FieldAddress(RAX, Object::class_offset()));
+ __ LoadClassOfObject(RAX, RAX);
__ ret();
}
@@ -1767,7 +1767,7 @@ static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) {
const intptr_t kInstanceOffsetInBytes = 2 * kWordSize;
const intptr_t kCacheOffsetInBytes = 3 * kWordSize;
__ movq(RAX, Address(RSP, kInstanceOffsetInBytes));
- __ movq(R10, FieldAddress(RAX, Object::class_offset()));
+ __ LoadClassOfObject(R10, RAX);
// RAX: instance, R10: instance class.
if (n > 1) {
// Compute instance type arguments into R13.
« runtime/vm/stub_code_ia32.cc ('K') | « runtime/vm/stub_code_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698