Index: src/mips/builtins-mips.cc |
diff --git a/src/mips/builtins-mips.cc b/src/mips/builtins-mips.cc |
index fdd062b6b69cb53e3ee1e527088ddf435030c647..abf78b3d35c1be4c0e6b8ef2f0c946a6329b14f2 100644 |
--- a/src/mips/builtins-mips.cc |
+++ b/src/mips/builtins-mips.cc |
@@ -319,7 +319,6 @@ void Builtins::Generate_InOptimizationQueue(MacroAssembler* masm) { |
static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
bool is_api_function, |
- bool count_constructions, |
bool create_memento) { |
// ----------- S t a t e ------------- |
// -- a0 : number of arguments |
@@ -329,15 +328,9 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
// -- sp[...]: constructor arguments |
// ----------------------------------- |
- // Should never count constructions for api objects. |
- ASSERT(!is_api_function || !count_constructions); |
- |
// Should never create mementos for api functions. |
ASSERT(!is_api_function || !create_memento); |
- // Should never create mementos before slack tracking is finished. |
- ASSERT(!count_constructions || !create_memento); |
- |
Isolate* isolate = masm->isolate(); |
// ----------- S t a t e ------------- |
@@ -389,19 +382,19 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
__ lbu(a3, FieldMemOperand(a2, Map::kInstanceTypeOffset)); |
__ Branch(&rt_call, eq, a3, Operand(JS_FUNCTION_TYPE)); |
- if (count_constructions) { |
+ if (!is_api_function) { |
Label allocate; |
+ MemOperand bit_field3 = FieldMemOperand(a2, Map::kBitField3Offset); |
+ // Check if slack tracking is enabled. |
+ __ lw(t0, bit_field3); |
+ __ DecodeField<Map::ConstructionCount>(a3, t0); |
Igor Sheludko
2014/05/23 15:04:18
What do you think about storing decoded counter va
Paul Lind
2014/05/23 15:33:39
t8 is not good for this, it's reserved for the mac
kilvadyb
2014/05/23 17:51:50
Done.
|
+ __ Branch(&allocate, eq, a3, Operand(JSFunction::kNoSlackTracking)); |
// Decrease generous allocation count. |
- __ lw(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
- MemOperand constructor_count = |
- FieldMemOperand(a3, SharedFunctionInfo::kConstructionCountOffset); |
- __ lbu(t0, constructor_count); |
- __ Subu(t0, t0, Operand(1)); |
- __ sb(t0, constructor_count); |
- __ Branch(&allocate, ne, t0, Operand(zero_reg)); |
+ __ Subu(t0, t0, Operand(1 << Map::ConstructionCount::kShift)); |
+ __ sw(t0, bit_field3); |
+ __ Branch(&allocate, ne, a3, Operand(JSFunction::kFinishSlackTracking)); |
__ Push(a1, a2, a1); // a1 = Constructor. |
- // The call will replace the stub, so the countdown is only done once. |
__ CallRuntime(Runtime::kHiddenFinalizeInstanceSize, 1); |
__ Pop(a1, a2); |
@@ -443,8 +436,16 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
// t5: First in-object property of JSObject (not tagged) |
ASSERT_EQ(3 * kPointerSize, JSObject::kHeaderSize); |
- if (count_constructions) { |
- __ LoadRoot(t7, Heap::kUndefinedValueRootIndex); |
+ if (!is_api_function) { |
+ Label no_inobject_slack_tracking; |
Paul Lind
2014/05/23 15:01:45
The deleted LoadRoot for UndefinedValue needs to b
Igor Sheludko
2014/05/23 15:04:18
There is one load at the top of the function. I th
Paul Lind
2014/05/23 15:33:39
I'd missed that one. I agree, better to move it he
kilvadyb
2014/05/23 17:51:50
Done.
|
+ |
+ // Check if slack tracking is enabled. |
+ __ lw(t0, FieldMemOperand(a2, Map::kBitField3Offset)); |
+ __ DecodeField<Map::ConstructionCount>(t0); |
Igor Sheludko
2014/05/23 15:04:18
... reloading here, like it was done for ia32?
Paul Lind
2014/05/23 15:33:39
Sure, we can do that with t2. Balázs, please add c
kilvadyb
2014/05/23 17:51:50
Done.
|
+ __ Branch(&no_inobject_slack_tracking, |
+ eq, t0, Operand(JSFunction::kNoSlackTracking)); |
+ |
+ // Allocate object with a slack. |
__ lbu(a0, FieldMemOperand(a2, Map::kPreAllocatedPropertyFieldsOffset)); |
__ sll(at, a0, kPointerSizeLog2); |
__ addu(a0, t5, at); |
@@ -458,12 +459,15 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
__ InitializeFieldsWithFiller(t5, a0, t7); |
// To allow for truncation. |
__ LoadRoot(t7, Heap::kOnePointerFillerMapRootIndex); |
- __ InitializeFieldsWithFiller(t5, t6, t7); |
- } else if (create_memento) { |
- __ Subu(t7, a3, Operand(AllocationMemento::kSize / kPointerSize)); |
- __ sll(at, t7, kPointerSizeLog2); |
- __ Addu(a0, t4, Operand(at)); // End of object. |
- __ LoadRoot(t7, Heap::kUndefinedValueRootIndex); |
+ // Fill the remaining fields with one pointer filler map. |
+ |
+ __ bind(&no_inobject_slack_tracking); |
+ } |
+ |
+ if (create_memento) { |
+ __ Subu(a0, a3, Operand(AllocationMemento::kSize / kPointerSize)); |
+ __ sll(a0, a0, kPointerSizeLog2); |
+ __ Addu(a0, t4, Operand(a0)); // End of object. |
__ InitializeFieldsWithFiller(t5, a0, t7); |
// Fill in memento fields. |
@@ -478,7 +482,6 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
__ sw(t7, MemOperand(t5)); |
__ Addu(t5, t5, kPointerSize); |
} else { |
- __ LoadRoot(t7, Heap::kUndefinedValueRootIndex); |
__ sll(at, a3, kPointerSizeLog2); |
__ Addu(a0, t4, Operand(at)); // End of object. |
__ InitializeFieldsWithFiller(t5, a0, t7); |
@@ -548,7 +551,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
__ addu(t6, a2, t3); // End of object. |
ASSERT_EQ(2 * kPointerSize, FixedArray::kHeaderSize); |
{ Label loop, entry; |
- if (count_constructions) { |
+ if (!is_api_function || create_memento) { |
__ LoadRoot(t7, Heap::kUndefinedValueRootIndex); |
} else if (FLAG_debug_code) { |
__ LoadRoot(t8, Heap::kUndefinedValueRootIndex); |
@@ -676,7 +679,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
} |
// Store offset of return address for deoptimizer. |
- if (!is_api_function && !count_constructions) { |
+ if (!is_api_function) { |
masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); |
} |
@@ -725,18 +728,13 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
} |
-void Builtins::Generate_JSConstructStubCountdown(MacroAssembler* masm) { |
- Generate_JSConstructStubHelper(masm, false, true, false); |
-} |
- |
- |
void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { |
- Generate_JSConstructStubHelper(masm, false, false, FLAG_pretenuring_call_new); |
+ Generate_JSConstructStubHelper(masm, false, FLAG_pretenuring_call_new); |
} |
void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { |
- Generate_JSConstructStubHelper(masm, true, false, false); |
+ Generate_JSConstructStubHelper(masm, true, false); |
} |