OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_S390 | 5 #if V8_TARGET_ARCH_S390 |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 3453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3464 | 3464 |
3465 Label fast_elements_case; | 3465 Label fast_elements_case; |
3466 __ CmpP(r5, Operand(FAST_ELEMENTS)); | 3466 __ CmpP(r5, Operand(FAST_ELEMENTS)); |
3467 __ beq(&fast_elements_case); | 3467 __ beq(&fast_elements_case); |
3468 GenerateCase(masm, FAST_HOLEY_ELEMENTS); | 3468 GenerateCase(masm, FAST_HOLEY_ELEMENTS); |
3469 | 3469 |
3470 __ bind(&fast_elements_case); | 3470 __ bind(&fast_elements_case); |
3471 GenerateCase(masm, FAST_ELEMENTS); | 3471 GenerateCase(masm, FAST_ELEMENTS); |
3472 } | 3472 } |
3473 | 3473 |
3474 void FastNewObjectStub::Generate(MacroAssembler* masm) { | |
3475 // ----------- S t a t e ------------- | |
3476 // -- r3 : target | |
3477 // -- r5 : new target | |
3478 // -- cp : context | |
3479 // -- lr : return address | |
3480 // ----------------------------------- | |
3481 __ AssertFunction(r3); | |
3482 __ AssertReceiver(r5); | |
3483 | |
3484 // Verify that the new target is a JSFunction. | |
3485 Label new_object; | |
3486 __ CompareObjectType(r5, r4, r4, JS_FUNCTION_TYPE); | |
3487 __ bne(&new_object); | |
3488 | |
3489 // Load the initial map and verify that it's in fact a map. | |
3490 __ LoadP(r4, FieldMemOperand(r5, JSFunction::kPrototypeOrInitialMapOffset)); | |
3491 __ JumpIfSmi(r4, &new_object); | |
3492 __ CompareObjectType(r4, r2, r2, MAP_TYPE); | |
3493 __ bne(&new_object); | |
3494 | |
3495 // Fall back to runtime if the target differs from the new target's | |
3496 // initial map constructor. | |
3497 __ LoadP(r2, FieldMemOperand(r4, Map::kConstructorOrBackPointerOffset)); | |
3498 __ CmpP(r2, r3); | |
3499 __ bne(&new_object); | |
3500 | |
3501 // Allocate the JSObject on the heap. | |
3502 Label allocate, done_allocate; | |
3503 __ LoadlB(r6, FieldMemOperand(r4, Map::kInstanceSizeOffset)); | |
3504 __ Allocate(r6, r2, r7, r8, &allocate, SIZE_IN_WORDS); | |
3505 __ bind(&done_allocate); | |
3506 | |
3507 // Initialize the JSObject fields. | |
3508 __ StoreP(r4, FieldMemOperand(r2, JSObject::kMapOffset)); | |
3509 __ LoadRoot(r5, Heap::kEmptyFixedArrayRootIndex); | |
3510 __ StoreP(r5, FieldMemOperand(r2, JSObject::kPropertiesOffset)); | |
3511 __ StoreP(r5, FieldMemOperand(r2, JSObject::kElementsOffset)); | |
3512 STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); | |
3513 __ AddP(r3, r2, Operand(JSObject::kHeaderSize - kHeapObjectTag)); | |
3514 | |
3515 // ----------- S t a t e ------------- | |
3516 // -- r2 : result (tagged) | |
3517 // -- r3 : result fields (untagged) | |
3518 // -- r7 : result end (untagged) | |
3519 // -- r4 : initial map | |
3520 // -- cp : context | |
3521 // -- lr : return address | |
3522 // ----------------------------------- | |
3523 | |
3524 // Perform in-object slack tracking if requested. | |
3525 Label slack_tracking; | |
3526 STATIC_ASSERT(Map::kNoSlackTracking == 0); | |
3527 __ LoadRoot(r8, Heap::kUndefinedValueRootIndex); | |
3528 __ LoadlW(r5, FieldMemOperand(r4, Map::kBitField3Offset)); | |
3529 __ DecodeField<Map::ConstructionCounter>(r9, r5); | |
3530 __ LoadAndTestP(r9, r9); | |
3531 __ bne(&slack_tracking); | |
3532 { | |
3533 // Initialize all in-object fields with undefined. | |
3534 __ InitializeFieldsWithFiller(r3, r7, r8); | |
3535 | |
3536 __ Ret(); | |
3537 } | |
3538 __ bind(&slack_tracking); | |
3539 { | |
3540 // Decrease generous allocation count. | |
3541 STATIC_ASSERT(Map::ConstructionCounter::kNext == 32); | |
3542 __ Add32(r5, r5, Operand(-(1 << Map::ConstructionCounter::kShift))); | |
3543 __ StoreW(r5, FieldMemOperand(r4, Map::kBitField3Offset)); | |
3544 | |
3545 // Initialize the in-object fields with undefined. | |
3546 __ LoadlB(r6, FieldMemOperand(r4, Map::kUnusedPropertyFieldsOffset)); | |
3547 __ ShiftLeftP(r6, r6, Operand(kPointerSizeLog2)); | |
3548 __ SubP(r6, r7, r6); | |
3549 __ InitializeFieldsWithFiller(r3, r6, r8); | |
3550 | |
3551 // Initialize the remaining (reserved) fields with one pointer filler map. | |
3552 __ LoadRoot(r8, Heap::kOnePointerFillerMapRootIndex); | |
3553 __ InitializeFieldsWithFiller(r3, r7, r8); | |
3554 | |
3555 // Check if we can finalize the instance size. | |
3556 __ CmpP(r9, Operand(Map::kSlackTrackingCounterEnd)); | |
3557 __ Ret(ne); | |
3558 | |
3559 // Finalize the instance size. | |
3560 { | |
3561 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | |
3562 __ Push(r2, r4); | |
3563 __ CallRuntime(Runtime::kFinalizeInstanceSize); | |
3564 __ Pop(r2); | |
3565 } | |
3566 __ Ret(); | |
3567 } | |
3568 | |
3569 // Fall back to %AllocateInNewSpace. | |
3570 __ bind(&allocate); | |
3571 { | |
3572 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | |
3573 STATIC_ASSERT(kSmiTag == 0); | |
3574 __ ShiftLeftP(r6, r6, | |
3575 Operand(kPointerSizeLog2 + kSmiTagSize + kSmiShiftSize)); | |
3576 __ Push(r4, r6); | |
3577 __ CallRuntime(Runtime::kAllocateInNewSpace); | |
3578 __ Pop(r4); | |
3579 } | |
3580 __ LoadlB(r7, FieldMemOperand(r4, Map::kInstanceSizeOffset)); | |
3581 __ ShiftLeftP(r7, r7, Operand(kPointerSizeLog2)); | |
3582 __ AddP(r7, r2, r7); | |
3583 __ SubP(r7, r7, Operand(kHeapObjectTag)); | |
3584 __ b(&done_allocate); | |
3585 | |
3586 // Fall back to %NewObject. | |
3587 __ bind(&new_object); | |
3588 __ Push(r3, r5); | |
3589 __ TailCallRuntime(Runtime::kNewObject); | |
3590 } | |
3591 | |
3592 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { | 3474 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { |
3593 // ----------- S t a t e ------------- | 3475 // ----------- S t a t e ------------- |
3594 // -- r3 : function | 3476 // -- r3 : function |
3595 // -- cp : context | 3477 // -- cp : context |
3596 // -- fp : frame pointer | 3478 // -- fp : frame pointer |
3597 // -- lr : return address | 3479 // -- lr : return address |
3598 // ----------------------------------- | 3480 // ----------------------------------- |
3599 __ AssertFunction(r3); | 3481 __ AssertFunction(r3); |
3600 | 3482 |
3601 // Make r4 point to the JavaScript frame. | 3483 // Make r4 point to the JavaScript frame. |
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4466 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 4348 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
4467 kStackUnwindSpace, NULL, return_value_operand, NULL); | 4349 kStackUnwindSpace, NULL, return_value_operand, NULL); |
4468 } | 4350 } |
4469 | 4351 |
4470 #undef __ | 4352 #undef __ |
4471 | 4353 |
4472 } // namespace internal | 4354 } // namespace internal |
4473 } // namespace v8 | 4355 } // namespace v8 |
4474 | 4356 |
4475 #endif // V8_TARGET_ARCH_S390 | 4357 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |