Revision: 12290
Author:   [email protected]
Date:     Fri Aug 10 05:28:12 2012
Log: MIPS: Improve load IC so it can call a native accessor even if the holder is in dictionary mode. Add a flag to all maps to indicate whether they are used for dictionary (normalized) objects or fast mode objects. This is a commit of https://chromiumcodereview.appspot.com/10826213/ for palfia. This is a port of r12264, https://chromiumcodereview.appspot.com/10831153
http://code.google.com/p/v8/source/detail?r=12290

Modified:
 /branches/bleeding_edge/src/mips/stub-cache-mips.cc

=======================================
--- /branches/bleeding_edge/src/mips/stub-cache-mips.cc Wed Jul 4 04:40:51 2012 +++ /branches/bleeding_edge/src/mips/stub-cache-mips.cc Fri Aug 10 05:28:12 2012
@@ -1232,6 +1232,43 @@
   __ LoadHeapObject(v0, value);
   __ Ret();
 }
+
+
+void StubCompiler::GenerateDictionaryLoadCallback(Register receiver,
+                                                  Register name_reg,
+                                                  Register scratch1,
+                                                  Register scratch2,
+                                                  Register scratch3,
+ Handle<AccessorInfo> callback,
+                                                  Handle<String> name,
+                                                  Label* miss) {
+  Register dictionary = scratch1;
+  Register index = scratch2;
+ __ lw(dictionary, FieldMemOperand(receiver, JSObject::kPropertiesOffset));
+
+  // Probe the dictionary.
+  Label probe_done;
+  StringDictionaryLookupStub::GeneratePositiveLookup(masm(),
+                                                     miss,
+                                                     &probe_done,
+                                                     dictionary,
+                                                     name_reg,
+ index, // Set if we hit.
+                                                     scratch3);
+  __ bind(&probe_done);
+
+ // If probing finds an entry in the dictionary, check that the value is the
+  // callback.
+  const int kElementsStartOffset =
+      StringDictionary::kHeaderSize +
+      StringDictionary::kElementsStartIndex * kPointerSize;
+  const int kValueOffset = kElementsStartOffset + kPointerSize;
+  __ Addu(scratch1, dictionary, Operand(kValueOffset - kHeapObjectTag));
+  __ sll(scratch3, index, kPointerSizeLog2);
+  __ addu(scratch1, scratch1, scratch3);
+  __ lw(scratch3, MemOperand(scratch1));
+  __ Branch(miss, ne, scratch3, Operand(callback));
+}


 void StubCompiler::GenerateLoadCallback(Handle<JSObject> object,
@@ -1251,6 +1288,11 @@
   Register reg = CheckPrototypes(object, receiver, holder, scratch1,
                                  scratch2, scratch3, name, miss);

+  if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) {
+    GenerateDictionaryLoadCallback(
+ receiver, name_reg, scratch1, scratch2, scratch3, callback, name, miss);
+  }
+
// Build AccessorInfo::args_ list on the stack and push property name below
   // the exit frame to make GC aware of them and store pointers to them.
   __ push(receiver);

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to