X87: Code cleanup in GenerateRecordCallTarget.
authorchunyang.dai <chunyang.dai@intel.com>
Thu, 9 Apr 2015 09:31:53 +0000 (02:31 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 9 Apr 2015 09:31:56 +0000 (09:31 +0000)
port 6a222b8ff033eb523149794d37c0d0f29bc8fc40 (r27630)

original commit message:

  Code cleanup in GenerateRecordCallTarget

BUG=

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

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

src/x87/code-stubs-x87.cc

index 2cd2e7b..1a21569 100644 (file)
@@ -1607,7 +1607,7 @@ static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) {
   // edi : the function to call
   FrameScope scope(masm, StackFrame::INTERNAL);
 
-  // Arguments register must be smi-tagged to call out.
+  // Number-of-arguments register must be smi-tagged to call out.
   __ SmiTag(eax);
   __ push(eax);
   __ push(edi);
@@ -1641,16 +1641,19 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) {
 
   // A monomorphic cache hit or an already megamorphic state: invoke the
   // function without changing the state.
+  // We don't know if ecx is a WeakCell or a Symbol, but it's harmless to read
+  // at this position in a symbol (see static asserts in
+  // type-feedback-vector.h).
   Label check_allocation_site;
   __ cmp(edi, FieldOperand(ecx, WeakCell::kValueOffset));
   __ j(equal, &done, Label::kFar);
   __ CompareRoot(ecx, Heap::kmegamorphic_symbolRootIndex);
   __ j(equal, &done, Label::kFar);
-  __ CompareRoot(FieldOperand(ecx, 0), Heap::kWeakCellMapRootIndex);
+  __ CompareRoot(FieldOperand(ecx, HeapObject::kMapOffset),
+                 Heap::kWeakCellMapRootIndex);
   __ j(not_equal, FLAG_pretenuring_call_new ? &miss : &check_allocation_site);
 
-  // If edi is not equal to the weak cell value, and the weak cell value is
-  // cleared, we have a new chance to become monomorphic.
+  // If the weak cell is cleared, we have a new chance to become monomorphic.
   __ JumpIfSmi(FieldOperand(ecx, WeakCell::kValueOffset), &initialize);
   __ jmp(&megamorphic);
 
@@ -1659,7 +1662,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) {
     // If we came here, we need to see if we are the array function.
     // If we didn't have a matching function, and we didn't find the megamorph
     // sentinel, then we have in the slot either some other function or an
-    // AllocationSite. Do a map check on the object in ecx.
+    // AllocationSite.
     __ CompareRoot(FieldOperand(ecx, 0), Heap::kAllocationSiteMapRootIndex);
     __ j(not_equal, &miss);