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

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

Issue 2606733002: [stubs] Port FastNewObjectStub to TF (Closed)
Patch Set: Review feedback Created 4 years 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 | src/arm/interface-descriptors-arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/code-stubs-arm.cc
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc
index 336e67a5ef141df0945fda8c6def0b81e2168dd6..3d4530161b81d8ada60c0b5ce9d343a156290ee5 100644
--- a/src/arm/code-stubs-arm.cc
+++ b/src/arm/code-stubs-arm.cc
@@ -3365,123 +3365,6 @@ void InternalArrayConstructorStub::Generate(MacroAssembler* masm) {
}
-void FastNewObjectStub::Generate(MacroAssembler* masm) {
- // ----------- S t a t e -------------
- // -- r1 : target
- // -- r3 : new target
- // -- cp : context
- // -- lr : return address
- // -----------------------------------
- __ AssertFunction(r1);
- __ AssertReceiver(r3);
-
- // Verify that the new target is a JSFunction.
- Label new_object;
- __ CompareObjectType(r3, r2, r2, JS_FUNCTION_TYPE);
- __ b(ne, &new_object);
-
- // Load the initial map and verify that it's in fact a map.
- __ ldr(r2, FieldMemOperand(r3, JSFunction::kPrototypeOrInitialMapOffset));
- __ JumpIfSmi(r2, &new_object);
- __ CompareObjectType(r2, r0, r0, MAP_TYPE);
- __ b(ne, &new_object);
-
- // Fall back to runtime if the target differs from the new target's
- // initial map constructor.
- __ ldr(r0, FieldMemOperand(r2, Map::kConstructorOrBackPointerOffset));
- __ cmp(r0, r1);
- __ b(ne, &new_object);
-
- // Allocate the JSObject on the heap.
- Label allocate, done_allocate;
- __ ldrb(r4, FieldMemOperand(r2, Map::kInstanceSizeOffset));
- __ Allocate(r4, r0, r5, r6, &allocate, SIZE_IN_WORDS);
- __ bind(&done_allocate);
-
- // Initialize the JSObject fields.
- __ str(r2, FieldMemOperand(r0, JSObject::kMapOffset));
- __ LoadRoot(r3, Heap::kEmptyFixedArrayRootIndex);
- __ str(r3, FieldMemOperand(r0, JSObject::kPropertiesOffset));
- __ str(r3, FieldMemOperand(r0, JSObject::kElementsOffset));
- STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize);
- __ add(r1, r0, Operand(JSObject::kHeaderSize - kHeapObjectTag));
-
- // ----------- S t a t e -------------
- // -- r0 : result (tagged)
- // -- r1 : result fields (untagged)
- // -- r5 : result end (untagged)
- // -- r2 : initial map
- // -- cp : context
- // -- lr : return address
- // -----------------------------------
-
- // Perform in-object slack tracking if requested.
- Label slack_tracking;
- STATIC_ASSERT(Map::kNoSlackTracking == 0);
- __ LoadRoot(r6, Heap::kUndefinedValueRootIndex);
- __ ldr(r3, FieldMemOperand(r2, Map::kBitField3Offset));
- __ tst(r3, Operand(Map::ConstructionCounter::kMask));
- __ b(ne, &slack_tracking);
- {
- // Initialize all in-object fields with undefined.
- __ InitializeFieldsWithFiller(r1, r5, r6);
- __ Ret();
- }
- __ bind(&slack_tracking);
- {
- // Decrease generous allocation count.
- STATIC_ASSERT(Map::ConstructionCounter::kNext == 32);
- __ sub(r3, r3, Operand(1 << Map::ConstructionCounter::kShift));
- __ str(r3, FieldMemOperand(r2, Map::kBitField3Offset));
-
- // Initialize the in-object fields with undefined.
- __ ldrb(r4, FieldMemOperand(r2, Map::kUnusedPropertyFieldsOffset));
- __ sub(r4, r5, Operand(r4, LSL, kPointerSizeLog2));
- __ InitializeFieldsWithFiller(r1, r4, r6);
-
- // Initialize the remaining (reserved) fields with one pointer filler map.
- __ LoadRoot(r6, Heap::kOnePointerFillerMapRootIndex);
- __ InitializeFieldsWithFiller(r1, r5, r6);
-
- // Check if we can finalize the instance size.
- STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1);
- __ tst(r3, Operand(Map::ConstructionCounter::kMask));
- __ Ret(ne);
-
- // Finalize the instance size.
- {
- FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
- __ Push(r0, r2);
- __ CallRuntime(Runtime::kFinalizeInstanceSize);
- __ Pop(r0);
- }
- __ Ret();
- }
-
- // Fall back to %AllocateInNewSpace.
- __ bind(&allocate);
- {
- FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
- STATIC_ASSERT(kSmiTag == 0);
- STATIC_ASSERT(kSmiTagSize == 1);
- __ mov(r4, Operand(r4, LSL, kPointerSizeLog2 + 1));
- __ Push(r2, r4);
- __ CallRuntime(Runtime::kAllocateInNewSpace);
- __ Pop(r2);
- }
- __ ldrb(r5, FieldMemOperand(r2, Map::kInstanceSizeOffset));
- __ add(r5, r0, Operand(r5, LSL, kPointerSizeLog2));
- STATIC_ASSERT(kHeapObjectTag == 1);
- __ sub(r5, r5, Operand(kHeapObjectTag));
- __ b(&done_allocate);
-
- // Fall back to %NewObject.
- __ bind(&new_object);
- __ Push(r1, r3);
- __ TailCallRuntime(Runtime::kNewObject);
-}
-
-
void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r1 : function
« no previous file with comments | « no previous file | src/arm/interface-descriptors-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698