X87: [ic] Record call counts for monomorphic calls made with an IC.
authorchunyang.dai <chunyang.dai@intel.com>
Wed, 1 Jul 2015 11:39:06 +0000 (04:39 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 1 Jul 2015 11:39:20 +0000 (11:39 +0000)
port c1a4f7477f03ebb0c6889bbf8ea6a4c928e0d413 (r29281).

original commit message:

   The idea is that TurboFan can use this information for more intelligent
   inlining.

BUG=

Review URL: https://codereview.chromium.org/1213723005

Cr-Commit-Position: refs/heads/master@{#29409}

src/x87/code-stubs-x87.cc

index bd332020b9a4e4071b5441b44dab1646e3e93f9c..affa69fd4e2e0040d242a3a77572916704f1eac9 100644 (file)
@@ -1934,6 +1934,11 @@ void CallIC_ArrayStub::Generate(MacroAssembler* masm) {
          factory->allocation_site_map());
   __ j(not_equal, &miss);
 
+  // Increment the call count for monomorphic function calls.
+  __ add(FieldOperand(ebx, edx, times_half_pointer_size,
+                      FixedArray::kHeaderSize + kPointerSize),
+         Immediate(Smi::FromInt(CallICNexus::kCallCountIncrement)));
+
   __ mov(ebx, ecx);
   __ mov(edx, edi);
   ArrayConstructorStub stub(masm->isolate(), arg_count());
@@ -1993,6 +1998,11 @@ void CallICStub::Generate(MacroAssembler* masm) {
   // convincing us that we have a monomorphic JSFunction.
   __ JumpIfSmi(edi, &extra_checks_or_miss);
 
+  // Increment the call count for monomorphic function calls.
+  __ add(FieldOperand(ebx, edx, times_half_pointer_size,
+                      FixedArray::kHeaderSize + kPointerSize),
+         Immediate(Smi::FromInt(CallICNexus::kCallCountIncrement)));
+
   __ bind(&have_js_function);
   if (CallAsMethod()) {
     EmitContinueIfStrictOrNative(masm, &cont);
@@ -2064,6 +2074,11 @@ void CallICStub::Generate(MacroAssembler* masm) {
   // Update stats.
   __ add(FieldOperand(ebx, with_types_offset), Immediate(Smi::FromInt(1)));
 
+  // Initialize the call counter.
+  __ mov(FieldOperand(ebx, edx, times_half_pointer_size,
+                      FixedArray::kHeaderSize + kPointerSize),
+         Immediate(Smi::FromInt(CallICNexus::kCallCountIncrement)));
+
   // Store the function. Use a stub since we need a frame for allocation.
   // ebx - vector
   // edx - slot