Revision: 20086
Author: [email protected]
Date: Wed Mar 19 15:46:24 2014 UTC
Log: MIPS: Array constructor expects AllocationSite or undefined as
feedback.
Port r20064 (d2ccdc6)
Original commit message:
Redefine Array constructor to expect an AllocationSite in the feedback
register or undefined. This will make code simpler as we support
pretenuring feedback for all constructed objects.
BUG=
[email protected]
Review URL: https://codereview.chromium.org/204613002
Patch from Balazs Kilvady <[email protected]>.
http://code.google.com/p/v8/source/detail?r=20086
Modified:
/branches/bleeding_edge/src/mips/builtins-mips.cc
/branches/bleeding_edge/src/mips/code-stubs-mips.cc
/branches/bleeding_edge/src/mips/lithium-codegen-mips.cc
=======================================
--- /branches/bleeding_edge/src/mips/builtins-mips.cc Tue Mar 11 20:28:28
2014 UTC
+++ /branches/bleeding_edge/src/mips/builtins-mips.cc Wed Mar 19 15:46:24
2014 UTC
@@ -163,9 +163,7 @@
// Run the native code for the Array function called as a normal
function.
// Tail call a stub.
- Handle<Object> megamorphic_sentinel =
- TypeFeedbackInfo::MegamorphicSentinel(masm->isolate());
- __ li(a2, Operand(megamorphic_sentinel));
+ __ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
ArrayConstructorStub stub(masm->isolate());
__ TailCallStub(&stub);
}
@@ -756,9 +754,7 @@
__ mov(a0, a3);
if (is_construct) {
// No type feedback cell is available
- Handle<Object> megamorphic_sentinel =
- TypeFeedbackInfo::MegamorphicSentinel(masm->isolate());
- __ li(a2, Operand(megamorphic_sentinel));
+ __ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
CallConstructStub stub(NO_CALL_FUNCTION_FLAGS);
__ CallStub(&stub);
} else {
=======================================
--- /branches/bleeding_edge/src/mips/code-stubs-mips.cc Mon Mar 17 18:16:19
2014 UTC
+++ /branches/bleeding_edge/src/mips/code-stubs-mips.cc Wed Mar 19 15:46:24
2014 UTC
@@ -3184,6 +3184,10 @@
if (RecordCallTarget()) {
GenerateRecordCallTarget(masm);
+ // Type information was updated. Because we may call Array, which
+ // expects either undefined or an AllocationSite in a2 we need
+ // to set a2 to undefined.
+ __ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
}
}
@@ -3284,7 +3288,19 @@
__ Branch(&slow, ne, t0, Operand(JS_FUNCTION_TYPE));
if (RecordCallTarget()) {
+ Label feedback_register_initialized;
GenerateRecordCallTarget(masm);
+
+ // Put the AllocationSite from the feedback vector into a2, or
undefined.
+ __ sll(at, a3, kPointerSizeLog2 - kSmiTagSize);
+ __ Addu(t1, a2, at);
+ __ lw(a2, FieldMemOperand(t1, FixedArray::kHeaderSize));
+ __ lw(t1, FieldMemOperand(a2, AllocationSite::kMapOffset));
+ __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex);
+ __ Branch(&feedback_register_initialized, eq, t1, Operand(at));
+ __ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
+ __ bind(&feedback_register_initialized);
+ __ AssertUndefinedOrAllocationSite(a2, t1);
}
// Jump to the function-specific construct stub.
@@ -5397,15 +5413,11 @@
// ----------- S t a t e -------------
// -- a0 : argc (only if argument_count_ == ANY)
// -- a1 : constructor
- // -- a2 : feedback vector (fixed array or megamorphic symbol)
- // -- a3 : slot index (if a2 is fixed array)
+ // -- a2 : AllocationSite or undefined
// -- sp[0] : return address
// -- sp[4] : last argument
// -----------------------------------
- ASSERT_EQ(*TypeFeedbackInfo::MegamorphicSentinel(masm->isolate()),
- masm->isolate()->heap()->megamorphic_symbol());
-
if (FLAG_debug_code) {
// The array construct code is only set for the global and natives
// builtin Array functions which always have maps.
@@ -5420,35 +5432,14 @@
__ Assert(eq, kUnexpectedInitialMapForArrayFunction,
t1, Operand(MAP_TYPE));
- // We should either have the megamorphic symbol in a2 or a valid
- // fixed array.
- Label okay_here;
- Handle<Map> fixed_array_map =
masm->isolate()->factory()->fixed_array_map();
- __ LoadRoot(at, Heap::kMegamorphicSymbolRootIndex);
- __ Branch(&okay_here, eq, a2, Operand(at));
- __ lw(t0, FieldMemOperand(a2, 0));
- __ Assert(eq, kExpectedFixedArrayInRegisterA2,
- t0, Operand(fixed_array_map));
-
- // a3 should be a smi if we don't have undefined in a2
- __ AssertSmi(a3);
-
- __ bind(&okay_here);
+ // We should either have undefined in a2 or a valid AllocationSite
+ __ AssertUndefinedOrAllocationSite(a2, t0);
}
Label no_info;
// Get the elements kind and case on that.
- __ LoadRoot(at, Heap::kMegamorphicSymbolRootIndex);
+ __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
__ Branch(&no_info, eq, a2, Operand(at));
- __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize);
- __ Addu(a2, a2, Operand(t0));
- __ lw(a2, FieldMemOperand(a2, FixedArray::kHeaderSize));
-
- // If the feedback vector is undefined, or contains anything other than
an
- // AllocationSite, call an array constructor that doesn't use
AllocationSites.
- __ lw(t0, FieldMemOperand(a2, 0));
- __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex);
- __ Branch(&no_info, ne, t0, Operand(at));
__ lw(a3, FieldMemOperand(a2, AllocationSite::kTransitionInfoOffset));
__ SmiUntag(a3);
=======================================
--- /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Wed Mar 19
15:27:38 2014 UTC
+++ /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Wed Mar 19
15:46:24 2014 UTC
@@ -3914,9 +3914,7 @@
__ li(a0, Operand(instr->arity()));
// No cell in a2 for construct type feedback in optimized code
- Handle<Object> megamorphic_symbol =
- TypeFeedbackInfo::MegamorphicSentinel(isolate());
- __ li(a2, Operand(megamorphic_symbol));
+ __ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
CallConstructStub stub(NO_CALL_FUNCTION_FLAGS);
CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
}
@@ -3928,7 +3926,7 @@
ASSERT(ToRegister(instr->result()).is(v0));
__ li(a0, Operand(instr->arity()));
- __ li(a2, Operand(TypeFeedbackInfo::MegamorphicSentinel(isolate())));
+ __ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
ElementsKind kind = instr->hydrogen()->elements_kind();
AllocationSiteOverrideMode override_mode =
(AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE)
--
--
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/d/optout.