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

Unified Diff: runtime/vm/stub_code_ia32.cc

Issue 9395016: First part of new ICData infrastructure: use a wrapper object instead of an array. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 10 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/stub_code_ia32.cc
===================================================================
--- runtime/vm/stub_code_ia32.cc (revision 4401)
+++ runtime/vm/stub_code_ia32.cc (working copy)
@@ -7,7 +7,6 @@
#include "vm/code_generator.h"
#include "vm/compiler.h"
-#include "vm/ic_data.h"
#include "vm/object_store.h"
#include "vm/pages.h"
#include "vm/resolver.h"
@@ -364,8 +363,7 @@
__ cmpl(EDI, raw_null);
__ j(EQUAL, &not_found, Assembler::kNearJump);
- ASSERT(ICData::kNameIndex == 0);
- __ cmpl(EDI, FieldAddress(ECX, Array::data_offset()));
+ __ cmpl(EDI, FieldAddress(ECX, ICData::target_name_offset()));
__ j(NOT_EQUAL, &next_iteration, Assembler::kNearJump);
// Name found, check total argument count and named argument count.
@@ -1536,7 +1534,7 @@
// Generate inline cache check for 'num_args'.
-// ECX: Inline cache data array.
+// ECX: Inline cache data object.
// EDX: Arguments array.
// TOS(0): return address
// Control flow:
@@ -1551,7 +1549,7 @@
ASSERT(num_args > 0);
// Get receiver.
__ movl(EAX, FieldAddress(EDX, Array::data_offset()));
- __ movl(EAX, Address(ESP, EAX, TIMES_2, 0)); // EAX is Smi.
+ __ movl(EAX, Address(ESP, EAX, TIMES_2, 0)); // EAX (argument_count) is Smi.
Label get_class, ic_miss;
__ call(&get_class);
@@ -1561,11 +1559,9 @@
#if defined(DEBUG)
{ Label ok;
// Check that the IC data array has NumberOfArgumentsChecked() == num_args.
- __ movl(EBX, FieldAddress(ECX,
- Array::data_offset() + ICData::kNumArgsCheckedIndex * kWordSize));
- const Immediate value =
- Immediate(reinterpret_cast<int32_t>(Smi::New(num_args)));
- __ cmpl(EBX, value);
+ // 'num_args_tested' is stored as an untagged int.
+ __ movl(EBX, FieldAddress(ECX, ICData::num_args_tested_offset()));
+ __ cmpl(EBX, Immediate(num_args));
__ j(EQUAL, &ok, Assembler::kNearJump);
__ Stop("Incorrect stub for IC data");
__ Bind(&ok);
@@ -1574,10 +1570,11 @@
// Loop that checks if there is an IC data match.
// EAX: receiver's class.
- // ECX: IC data array (preserved).
- __ leal(EBX, FieldAddress(ECX,
- Array::data_offset() + ICData::kChecksStartIndex * kWordSize));
- // EBX: pointing to a class to check against (into IC data array).
+ // 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.
const Immediate raw_null =
Immediate(reinterpret_cast<intptr_t>(Object::null()));
Label loop, found;
@@ -1590,24 +1587,29 @@
__ cmpl(EDI, raw_null); // Done?
__ j(NOT_EQUAL, &loop, Assembler::kNearJump);
} else if (num_args == 2) {
+ // EDI: class to check.
Label no_match;
__ Bind(&loop);
- __ movl(EDI, Address(EBX, 0)); // Get class from IC data to check.
- // Get receiver.
+ // Get class from IC data to check.
+ __ movl(EDI, Address(EBX, 0));
+ // Get receiver using argument descriptor in EDX.
__ movl(EAX, FieldAddress(EDX, Array::data_offset()));
- __ movl(EAX, Address(ESP, EAX, TIMES_2, 0)); // EAX is Smi.
+ __ movl(EAX, Address(ESP, EAX, TIMES_2, 0)); // EAX (arg. count) is Smi.
__ call(&get_class);
__ cmpl(EAX, EDI); // Match?
__ j(NOT_EQUAL, &no_match, Assembler::kNearJump);
- // Check second.
- __ movl(EDI, Address(EBX, kWordSize)); // Get class from IC data to check.
+ // Check second class/argument.
+ // Get class from IC data to check.
+ __ movl(EDI, Address(EBX, kWordSize));
// Get next argument.
__ movl(EAX, FieldAddress(EDX, Array::data_offset()));
- __ movl(EAX, Address(ESP, EAX, TIMES_2, -kWordSize)); // EAX is Smi.
+ __ movl(EAX, Address(ESP, EAX, TIMES_2, -kWordSize));
+ // EAX (argument count) is Smi.
__ call(&get_class);
__ cmpl(EAX, EDI); // Match?
__ j(EQUAL, &found, Assembler::kNearJump);
__ Bind(&no_match);
+ // Each test entry has (1 + num_args) array elements.
__ addl(EBX, Immediate(kWordSize * (1 + num_args))); // Next element.
__ cmpl(EDI, raw_null); // Done?
__ j(NOT_EQUAL, &loop, Assembler::kNearJump);

Powered by Google App Engine
This is Rietveld 408576698