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

Unified Diff: runtime/vm/stub_code_ia32.cc

Issue 24203004: Dart VM: Simplify code generation for equality operators. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: rebased Created 7 years, 3 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/stub_code_arm.cc ('k') | runtime/vm/stub_code_mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code_ia32.cc
===================================================================
--- runtime/vm/stub_code_ia32.cc (revision 28079)
+++ runtime/vm/stub_code_ia32.cc (working copy)
@@ -2032,105 +2032,6 @@
}
-// Implements equality operator when one of the arguments is null
-// (identity check) and updates ICData if necessary.
-// TOS + 0: return address
-// TOS + 1: right argument
-// TOS + 2: left argument
-// ECX: ICData.
-// EAX: result.
-// TODO(srdjan): Move to VM stubs once Boolean objects become VM objects.
-void StubCode::GenerateEqualityWithNullArgStub(Assembler* assembler) {
- static const intptr_t kNumArgsTested = 2;
-#if defined(DEBUG)
- { Label ok;
- __ movl(EAX, FieldAddress(ECX, ICData::num_args_tested_offset()));
- __ cmpl(EAX, Immediate(kNumArgsTested));
- __ j(EQUAL, &ok, Assembler::kNearJump);
- __ Stop("Incorrect ICData for equality");
- __ Bind(&ok);
- }
-#endif // DEBUG
- // Check IC data, update if needed.
- // ECX: IC data object (preserved).
- __ movl(EBX, FieldAddress(ECX, ICData::ic_data_offset()));
- // EBX: ic_data_array with check entries: classes and target functions.
- __ leal(EBX, FieldAddress(EBX, Array::data_offset()));
- // EBX: points directly to the first ic data array element.
-
- Label get_class_id_as_smi, no_match, loop, compute_result, found;
- __ Bind(&loop);
- // Check left.
- __ movl(EAX, Address(ESP, 2 * kWordSize));
- __ call(&get_class_id_as_smi);
- __ movl(EDI, Address(EBX, 0 * kWordSize));
- __ cmpl(EAX, EDI); // Class id match?
- __ j(NOT_EQUAL, &no_match, Assembler::kNearJump);
- // Check right.
- __ movl(EAX, Address(ESP, 1 * kWordSize));
- __ call(&get_class_id_as_smi);
- __ movl(EDI, Address(EBX, 1 * kWordSize));
- __ cmpl(EAX, EDI); // Class id match?
- __ j(EQUAL, &found, Assembler::kNearJump);
- __ Bind(&no_match);
- // Next check group.
- __ addl(EBX, Immediate(
- kWordSize * ICData::TestEntryLengthFor(kNumArgsTested)));
- __ cmpl(EDI, Immediate(Smi::RawValue(kIllegalCid))); // Done?
- __ j(NOT_EQUAL, &loop, Assembler::kNearJump);
- Label update_ic_data;
- __ jmp(&update_ic_data);
-
- __ Bind(&found);
- const intptr_t count_offset =
- ICData::CountIndexFor(kNumArgsTested) * kWordSize;
- __ addl(Address(EBX, count_offset), Immediate(Smi::RawValue(1)));
- __ j(NO_OVERFLOW, &compute_result);
- __ movl(Address(EBX, count_offset),
- Immediate(Smi::RawValue(Smi::kMaxValue)));
-
- __ Bind(&compute_result);
- Label true_label;
- __ movl(EAX, Address(ESP, 1 * kWordSize));
- __ cmpl(EAX, Address(ESP, 2 * kWordSize));
- __ j(EQUAL, &true_label, Assembler::kNearJump);
- __ LoadObject(EAX, Bool::False());
- __ ret();
- __ Bind(&true_label);
- __ LoadObject(EAX, Bool::True());
- __ ret();
-
- __ Bind(&get_class_id_as_smi);
- Label not_smi;
- // Test if Smi -> load Smi class for comparison.
- __ testl(EAX, Immediate(kSmiTagMask));
- __ j(NOT_ZERO, &not_smi, Assembler::kNearJump);
- __ movl(EAX, Immediate(Smi::RawValue(kSmiCid)));
- __ ret();
-
- __ Bind(&not_smi);
- __ LoadClassId(EAX, EAX);
- __ SmiTag(EAX);
- __ ret();
-
- __ Bind(&update_ic_data);
-
- // ECX: ICData
- __ movl(EAX, Address(ESP, 1 * kWordSize));
- __ movl(EDI, Address(ESP, 2 * kWordSize));
- __ EnterStubFrame();
- __ pushl(EDI); // arg 0
- __ pushl(EAX); // arg 1
- __ PushObject(Symbols::EqualOperator()); // Target's name.
- __ pushl(ECX); // ICData
- __ CallRuntime(kUpdateICDataTwoArgsRuntimeEntry, 4);
- __ Drop(4);
- __ LeaveFrame();
-
- __ jmp(&compute_result, Assembler::kNearJump);
-}
-
-
// Calls to the runtime to optimize the given function.
// EDI: function to be reoptimized.
// EDX: argument descriptor (preserved).
« no previous file with comments | « runtime/vm/stub_code_arm.cc ('k') | runtime/vm/stub_code_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698