Reviewers: danno, mvstanton, Paul Lind, palfia, kisg, dusmil,

Description:
MIPS: Add a premonomorphic state to the call target cache.

Port r19402 (09e916c)

Original commit message:
From a CL by kasperl: https://codereview.chromium.org/162903004/

BUG=

Please review this at https://codereview.chromium.org/169613003/

SVN Base: https://github.com/v8/v8.git@gbl

Affected files (+21, -2 lines):
  M src/mips/code-stubs-mips.cc


Index: src/mips/code-stubs-mips.cc
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
index 4b3107fec70c7fb78a9b72bb440406b8590a4554..363dae71aba7981ecc35a25af64fd18fff3a65cd 100644
--- a/src/mips/code-stubs-mips.cc
+++ b/src/mips/code-stubs-mips.cc
@@ -3165,6 +3165,8 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) {
             masm->isolate()->heap()->undefined_value());
   ASSERT_EQ(*TypeFeedbackInfo::UninitializedSentinel(masm->isolate()),
             masm->isolate()->heap()->the_hole_value());
+  ASSERT_EQ(*TypeFeedbackInfo::PremonomorphicSentinel(masm->isolate()),
+            masm->isolate()->heap()->null_value());

   // Load the cache state into t0.
   __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize);
@@ -3190,10 +3192,27 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) {

   __ bind(&miss);

-  // A monomorphic miss (i.e, here the cache is not uninitialized) goes
-  // megamorphic.
+  // A monomorphic miss (i.e, here the cache is not uninitialized or
+  // pre-monomorphic) goes megamorphic.
+  Label not_uninitialized;
   __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
+  __ Branch(&not_uninitialized, ne, t0, Operand(at));
+
+  // PremonomorphicSentinel is an immortal immovable object (null) so no
+  // write-barrier is needed.
+  __ sll(at, a3, kPointerSizeLog2 - kSmiTagSize);
+  __ Addu(t0, a2, at);
+  __ LoadRoot(at, Heap::kNullValueRootIndex);
+  __ Branch(USE_DELAY_SLOT, &done);
+  __ sw(at, FieldMemOperand(t0, FixedArray::kHeaderSize));
+
+  // If the cache isn't uninitialized, it is either premonomorphic or
+  // monomorphic. If it is premonomorphic, we initialize it thus making
+  // it monomorphic. Otherwise, we go megamorphic.
+  __ bind(&not_uninitialized);
+  __ LoadRoot(at, Heap::kNullValueRootIndex);
   __ Branch(&initialize, eq, t0, Operand(at));
+
   // MegamorphicSentinel is an immortal immovable object (undefined) so no
   // write-barrier is needed.
   __ bind(&megamorphic);


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to