Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Unified Diff: src/x87/code-stubs-x87.cc

Issue 1051253004: x87: v8:3539 - hold constructor feedback in weak cells (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x87/code-stubs-x87.cc
diff --git a/src/x87/code-stubs-x87.cc b/src/x87/code-stubs-x87.cc
index e6fc7b83e49a3b98b7fdb37d84e2b97ec37da04c..2c32545a35c89b178fcf18ff6120bb5e2e1b9580 100644
--- a/src/x87/code-stubs-x87.cc
+++ b/src/x87/code-stubs-x87.cc
@@ -1600,6 +1600,30 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) {
}
+static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) {
+ // eax : number of arguments to the construct function
+ // ebx : Feedback vector
+ // edx : slot in feedback vector (Smi)
+ // edi : the function to call
+ FrameScope scope(masm, StackFrame::INTERNAL);
+
+ // Arguments register must be smi-tagged to call out.
+ __ SmiTag(eax);
+ __ push(eax);
+ __ push(edi);
+ __ push(edx);
+ __ push(ebx);
+
+ __ CallStub(stub);
+
+ __ pop(ebx);
+ __ pop(edx);
+ __ pop(edi);
+ __ pop(eax);
+ __ SmiUntag(eax);
+}
+
+
static void GenerateRecordCallTarget(MacroAssembler* masm) {
// Cache the called function in a feedback vector slot. Cache states
// are uninitialized, monomorphic (indicated by a JSFunction), and
@@ -1617,18 +1641,26 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) {
// A monomorphic cache hit or an already megamorphic state: invoke the
// function without changing the state.
- __ cmp(ecx, edi);
+ Label check_allocation_site;
+ __ cmp(edi, FieldOperand(ecx, WeakCell::kValueOffset));
__ j(equal, &done, Label::kFar);
- __ cmp(ecx, Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate)));
+ __ CompareRoot(ecx, Heap::kmegamorphic_symbolRootIndex);
__ j(equal, &done, Label::kFar);
+ __ CompareRoot(FieldOperand(ecx, 0), 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.
+ __ JumpIfSmi(FieldOperand(ecx, WeakCell::kValueOffset), &initialize);
+ __ jmp(&megamorphic);
if (!FLAG_pretenuring_call_new) {
+ __ bind(&check_allocation_site);
// 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.
- Handle<Map> allocation_site_map = isolate->factory()->allocation_site_map();
- __ cmp(FieldOperand(ecx, 0), Immediate(allocation_site_map));
+ __ CompareRoot(FieldOperand(ecx, 0), Heap::kAllocationSiteMapRootIndex);
__ j(not_equal, &miss);
// Make sure the function is the Array() function
@@ -1642,7 +1674,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) {
// A monomorphic miss (i.e, here the cache is not uninitialized) goes
// megamorphic.
- __ cmp(ecx, Immediate(TypeFeedbackVector::UninitializedSentinel(isolate)));
+ __ CompareRoot(ecx, Heap::kuninitialized_symbolRootIndex);
__ j(equal, &initialize);
// MegamorphicSentinel is an immortal immovable object (undefined) so no
// write-barrier is needed.
@@ -1664,43 +1696,15 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) {
// The target function is the Array constructor,
// Create an AllocationSite if we don't already have it, store it in the
// slot.
- {
- FrameScope scope(masm, StackFrame::INTERNAL);
-
- // Arguments register must be smi-tagged to call out.
- __ SmiTag(eax);
- __ push(eax);
- __ push(edi);
- __ push(edx);
- __ push(ebx);
-
- CreateAllocationSiteStub create_stub(isolate);
- __ CallStub(&create_stub);
-
- __ pop(ebx);
- __ pop(edx);
- __ pop(edi);
- __ pop(eax);
- __ SmiUntag(eax);
- }
+ CreateAllocationSiteStub create_stub(isolate);
+ CallStubInRecordCallTarget(masm, &create_stub);
__ jmp(&done);
__ bind(&not_array_function);
}
- __ mov(FieldOperand(ebx, edx, times_half_pointer_size,
- FixedArray::kHeaderSize),
- edi);
- // We won't need edx or ebx anymore, just save edi
- __ push(edi);
- __ push(ebx);
- __ push(edx);
- __ RecordWriteArray(ebx, edi, edx, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
- OMIT_SMI_CHECK);
- __ pop(edx);
- __ pop(ebx);
- __ pop(edi);
-
+ CreateWeakCellStub create_stub(isolate);
+ CallStubInRecordCallTarget(masm, &create_stub);
__ bind(&done);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698