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

Unified Diff: src/arm64/code-stubs-arm64.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 | « src/arm/interface-descriptors-arm.cc ('k') | src/arm64/interface-descriptors-arm64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm64/code-stubs-arm64.cc
diff --git a/src/arm64/code-stubs-arm64.cc b/src/arm64/code-stubs-arm64.cc
index 3d6133b7010ef16c254a20121f3dbdd9e55b887b..54c28337ba6012168aedc27bf59b6847c61a846f 100644
--- a/src/arm64/code-stubs-arm64.cc
+++ b/src/arm64/code-stubs-arm64.cc
@@ -3636,127 +3636,6 @@ void InternalArrayConstructorStub::Generate(MacroAssembler* masm) {
GenerateCase(masm, FAST_ELEMENTS);
}
-
-void FastNewObjectStub::Generate(MacroAssembler* masm) {
- // ----------- S t a t e -------------
- // -- x1 : target
- // -- x3 : new target
- // -- cp : context
- // -- lr : return address
- // -----------------------------------
- __ AssertFunction(x1);
- __ AssertReceiver(x3);
-
- // Verify that the new target is a JSFunction.
- Label new_object;
- __ JumpIfNotObjectType(x3, x2, x2, JS_FUNCTION_TYPE, &new_object);
-
- // Load the initial map and verify that it's in fact a map.
- __ Ldr(x2, FieldMemOperand(x3, JSFunction::kPrototypeOrInitialMapOffset));
- __ JumpIfSmi(x2, &new_object);
- __ JumpIfNotObjectType(x2, x0, x0, MAP_TYPE, &new_object);
-
- // Fall back to runtime if the target differs from the new target's
- // initial map constructor.
- __ Ldr(x0, FieldMemOperand(x2, Map::kConstructorOrBackPointerOffset));
- __ CompareAndBranch(x0, x1, ne, &new_object);
-
- // Allocate the JSObject on the heap.
- Label allocate, done_allocate;
- __ Ldrb(x4, FieldMemOperand(x2, Map::kInstanceSizeOffset));
- __ Allocate(x4, x0, x5, x6, &allocate, SIZE_IN_WORDS);
- __ Bind(&done_allocate);
-
- // Initialize the JSObject fields.
- STATIC_ASSERT(JSObject::kMapOffset == 0 * kPointerSize);
- __ Str(x2, FieldMemOperand(x0, JSObject::kMapOffset));
- __ LoadRoot(x3, Heap::kEmptyFixedArrayRootIndex);
- STATIC_ASSERT(JSObject::kPropertiesOffset == 1 * kPointerSize);
- STATIC_ASSERT(JSObject::kElementsOffset == 2 * kPointerSize);
- __ Str(x3, FieldMemOperand(x0, JSObject::kPropertiesOffset));
- __ Str(x3, FieldMemOperand(x0, JSObject::kElementsOffset));
- STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize);
- __ Add(x1, x0, Operand(JSObject::kHeaderSize - kHeapObjectTag));
-
- // ----------- S t a t e -------------
- // -- x0 : result (tagged)
- // -- x1 : result fields (untagged)
- // -- x5 : result end (untagged)
- // -- x2 : initial map
- // -- cp : context
- // -- lr : return address
- // -----------------------------------
-
- // Perform in-object slack tracking if requested.
- Label slack_tracking;
- STATIC_ASSERT(Map::kNoSlackTracking == 0);
- __ LoadRoot(x6, Heap::kUndefinedValueRootIndex);
- __ Ldr(w3, FieldMemOperand(x2, Map::kBitField3Offset));
- __ TestAndBranchIfAnySet(w3, Map::ConstructionCounter::kMask,
- &slack_tracking);
- {
- // Initialize all in-object fields with undefined.
- __ InitializeFieldsWithFiller(x1, x5, x6);
- __ Ret();
- }
- __ Bind(&slack_tracking);
- {
- // Decrease generous allocation count.
- STATIC_ASSERT(Map::ConstructionCounter::kNext == 32);
- __ Sub(w3, w3, 1 << Map::ConstructionCounter::kShift);
- __ Str(w3, FieldMemOperand(x2, Map::kBitField3Offset));
-
- // Initialize the in-object fields with undefined.
- __ Ldrb(x4, FieldMemOperand(x2, Map::kUnusedPropertyFieldsOffset));
- __ Sub(x4, x5, Operand(x4, LSL, kPointerSizeLog2));
- __ InitializeFieldsWithFiller(x1, x4, x6);
-
- // Initialize the remaining (reserved) fields with one pointer filler map.
- __ LoadRoot(x6, Heap::kOnePointerFillerMapRootIndex);
- __ InitializeFieldsWithFiller(x1, x5, x6);
-
- // Check if we can finalize the instance size.
- Label finalize;
- STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1);
- __ TestAndBranchIfAllClear(w3, Map::ConstructionCounter::kMask, &finalize);
- __ Ret();
-
- // Finalize the instance size.
- __ Bind(&finalize);
- {
- FrameScope scope(masm, StackFrame::INTERNAL);
- __ Push(x0, x2);
- __ CallRuntime(Runtime::kFinalizeInstanceSize);
- __ Pop(x0);
- }
- __ Ret();
- }
-
- // Fall back to %AllocateInNewSpace.
- __ Bind(&allocate);
- {
- FrameScope scope(masm, StackFrame::INTERNAL);
- STATIC_ASSERT(kSmiTag == 0);
- STATIC_ASSERT(kSmiTagSize == 1);
- __ Mov(x4,
- Operand(x4, LSL, kPointerSizeLog2 + kSmiTagSize + kSmiShiftSize));
- __ Push(x2, x4);
- __ CallRuntime(Runtime::kAllocateInNewSpace);
- __ Pop(x2);
- }
- __ Ldrb(x5, FieldMemOperand(x2, Map::kInstanceSizeOffset));
- __ Add(x5, x0, Operand(x5, LSL, kPointerSizeLog2));
- STATIC_ASSERT(kHeapObjectTag == 1);
- __ Sub(x5, x5, kHeapObjectTag); // Subtract the tag from end.
- __ B(&done_allocate);
-
- // Fall back to %NewObject.
- __ Bind(&new_object);
- __ Push(x1, x3);
- __ TailCallRuntime(Runtime::kNewObject);
-}
-
-
void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- x1 : function
« no previous file with comments | « src/arm/interface-descriptors-arm.cc ('k') | src/arm64/interface-descriptors-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698