Commit 6a222b8f authored by mvstanton's avatar mvstanton Committed by Commit bot

Code cleanup in GenerateRecordCallTarget.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#27630}
parent 3068b5ff
......@@ -2364,7 +2364,7 @@ static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) {
// r1 : the function to call
FrameAndConstantPoolScope 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(r0);
__ Push(r3, r2, r1, r0);
......@@ -2396,6 +2396,8 @@ 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 r4 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;
Register feedback_map = r5;
Register weak_value = r8;
......@@ -2404,12 +2406,11 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) {
__ b(eq, &done);
__ CompareRoot(r4, Heap::kmegamorphic_symbolRootIndex);
__ b(eq, &done);
__ ldr(feedback_map, FieldMemOperand(r4, 0));
__ ldr(feedback_map, FieldMemOperand(r4, HeapObject::kMapOffset));
__ CompareRoot(feedback_map, Heap::kWeakCellMapRootIndex);
__ b(ne, FLAG_pretenuring_call_new ? &miss : &check_allocation_site);
// If r1 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(weak_value, &initialize);
__ jmp(&megamorphic);
......@@ -2418,7 +2419,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(feedback_map, Heap::kAllocationSiteMapRootIndex);
__ b(ne, &miss);
......
......@@ -2736,7 +2736,7 @@ static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub,
Register index) {
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(argc);
__ Push(argc, function, feedback_vector, index);
......@@ -2779,18 +2779,20 @@ static void GenerateRecordCallTarget(MacroAssembler* masm, Register argc,
// A monomorphic cache hit or an already megamorphic state: invoke the
// function without changing the state.
// We don't know if feedback value 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;
__ Ldr(feedback_value, FieldMemOperand(feedback, WeakCell::kValueOffset));
__ Cmp(function, feedback_value);
__ B(eq, &done);
__ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex);
__ B(eq, &done);
__ Ldr(feedback_map, FieldMemOperand(feedback, 0));
__ Ldr(feedback_map, FieldMemOperand(feedback, HeapObject::kMapOffset));
__ CompareRoot(feedback_map, Heap::kWeakCellMapRootIndex);
__ B(ne, FLAG_pretenuring_call_new ? &miss : &check_allocation_site);
// If function 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(feedback_value, &initialize);
__ B(&megamorphic);
......@@ -2799,7 +2801,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm, Register argc,
// 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 scratch1 register.
// AllocationSite.
__ JumpIfNotRoot(feedback_map, Heap::kAllocationSiteMapRootIndex, &miss);
// Make sure the function is the Array() function
......
......@@ -1920,7 +1920,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);
......@@ -1954,16 +1954,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);
......@@ -1972,7 +1975,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);
......
......@@ -2505,7 +2505,7 @@ static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) {
1 << 6 | // a2
1 << 7; // a3
// Arguments register must be smi-tagged to call out.
// Number-of-arguments register must be smi-tagged to call out.
__ SmiTag(a0);
__ MultiPush(kSavedRegs);
......@@ -2538,6 +2538,8 @@ 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 t0 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;
Register feedback_map = t1;
Register weak_value = t4;
......@@ -2545,13 +2547,12 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) {
__ Branch(&done, eq, a1, Operand(weak_value));
__ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex);
__ Branch(&done, eq, t0, Operand(at));
__ lw(feedback_map, FieldMemOperand(t0, 0));
__ lw(feedback_map, FieldMemOperand(t0, Heap::kMapOffset));
__ LoadRoot(at, Heap::kWeakCellMapRootIndex);
__ Branch(FLAG_pretenuring_call_new ? &miss : &check_allocation_site, ne,
feedback_map, Operand(at));
// If a1 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(weak_value, &initialize);
__ jmp(&megamorphic);
......@@ -2560,7 +2561,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 a3.
// AllocationSite.
__ LoadRoot(at, Heap::kAllocationSiteMapRootIndex);
__ Branch(&miss, ne, feedback_map, Operand(at));
......
......@@ -2541,7 +2541,7 @@ static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) {
1 << 6 | // a2
1 << 7; // a3
// Arguments register must be smi-tagged to call out.
// Number-of-arguments register must be smi-tagged to call out.
__ SmiTag(a0);
__ MultiPush(kSavedRegs);
......@@ -2574,6 +2574,8 @@ 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 a4 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;
Register feedback_map = a5;
Register weak_value = t0;
......@@ -2581,13 +2583,12 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) {
__ Branch(&done, eq, a1, Operand(weak_value));
__ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex);
__ Branch(&done, eq, a4, Operand(at));
__ ld(feedback_map, FieldMemOperand(a4, 0));
__ ld(feedback_map, FieldMemOperand(a4, HeapObject::kMapOffset));
__ LoadRoot(at, Heap::kWeakCellMapRootIndex);
__ Branch(FLAG_pretenuring_call_new ? &miss : &check_allocation_site, ne,
feedback_map, Operand(at));
// If a1 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(weak_value, &initialize);
__ jmp(&megamorphic);
......@@ -2596,7 +2597,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 a3.
// AllocationSite.
__ LoadRoot(at, Heap::kAllocationSiteMapRootIndex);
__ Branch(&miss, ne, feedback_map, Operand(at));
......
......@@ -1785,7 +1785,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.
__ Integer32ToSmi(rax, rax);
__ Push(rax);
__ Push(rdi);
......@@ -1822,17 +1822,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 rcx 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;
__ cmpp(rdi, FieldOperand(rcx, WeakCell::kValueOffset));
__ j(equal, &done, Label::kFar);
__ CompareRoot(rcx, Heap::kmegamorphic_symbolRootIndex);
__ j(equal, &done, Label::kFar);
__ CompareRoot(FieldOperand(rcx, 0), Heap::kWeakCellMapRootIndex);
__ CompareRoot(FieldOperand(rcx, 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. Otherwise, we
// need to go megamorphic.
// If the weak cell is cleared, we have a new chance to become monomorphic.
__ CheckSmi(FieldOperand(rcx, WeakCell::kValueOffset));
__ j(equal, &initialize);
__ jmp(&megamorphic);
......@@ -1842,7 +1844,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 rcx.
// AllocationSite.
__ CompareRoot(FieldOperand(rcx, 0), Heap::kAllocationSiteMapRootIndex);
__ j(not_equal, &miss);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment