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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
6 | 6 |
7 #include "src/ic/handler-compiler.h" | 7 #include "src/ic/handler-compiler.h" |
8 | 8 |
9 #include "src/api-arguments.h" | 9 #include "src/api-arguments.h" |
10 #include "src/field-type.h" | 10 #include "src/field-type.h" |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 } | 577 } |
578 | 578 |
579 | 579 |
580 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { | 580 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { |
581 // Return the constant value. | 581 // Return the constant value. |
582 __ li(v0, value); | 582 __ li(v0, value); |
583 __ Ret(); | 583 __ Ret(); |
584 } | 584 } |
585 | 585 |
586 | 586 |
587 void NamedLoadHandlerCompiler::GenerateLoadCallback( | |
588 Register reg, Handle<AccessorInfo> callback) { | |
589 DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), receiver())); | |
590 DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), reg)); | |
591 | |
592 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property | |
593 // name below the exit frame to make GC aware of them. | |
594 STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0); | |
595 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1); | |
596 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2); | |
597 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3); | |
598 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4); | |
599 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5); | |
600 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6); | |
601 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7); | |
602 | |
603 // Here and below +1 is for name() pushed after the args_ array. | |
604 typedef PropertyCallbackArguments PCA; | |
605 __ Dsubu(sp, sp, (PCA::kArgsLength + 1) * kPointerSize); | |
606 __ sd(receiver(), MemOperand(sp, (PCA::kThisIndex + 1) * kPointerSize)); | |
607 Handle<Object> data(callback->data(), isolate()); | |
608 if (data->IsUndefined() || data->IsSmi()) { | |
609 __ li(scratch2(), data); | |
610 } else { | |
611 Handle<WeakCell> cell = | |
612 isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data)); | |
613 // The callback is alive if this instruction is executed, | |
614 // so the weak cell is not cleared and points to data. | |
615 __ GetWeakValue(scratch2(), cell); | |
616 } | |
617 __ sd(scratch2(), MemOperand(sp, (PCA::kDataIndex + 1) * kPointerSize)); | |
618 __ LoadRoot(scratch2(), Heap::kUndefinedValueRootIndex); | |
619 __ sd(scratch2(), | |
620 MemOperand(sp, (PCA::kReturnValueOffset + 1) * kPointerSize)); | |
621 __ sd(scratch2(), MemOperand(sp, (PCA::kReturnValueDefaultValueIndex + 1) * | |
622 kPointerSize)); | |
623 __ li(scratch2(), Operand(ExternalReference::isolate_address(isolate()))); | |
624 __ sd(scratch2(), MemOperand(sp, (PCA::kIsolateIndex + 1) * kPointerSize)); | |
625 __ sd(reg, MemOperand(sp, (PCA::kHolderIndex + 1) * kPointerSize)); | |
626 // should_throw_on_error -> false | |
627 DCHECK(Smi::FromInt(0) == nullptr); | |
628 __ sd(zero_reg, | |
629 MemOperand(sp, (PCA::kShouldThrowOnErrorIndex + 1) * kPointerSize)); | |
630 | |
631 __ sd(name(), MemOperand(sp, 0 * kPointerSize)); | |
632 | |
633 // Abi for CallApiGetter. | |
634 Register getter_address_reg = ApiGetterDescriptor::function_address(); | |
635 | |
636 Address getter_address = v8::ToCData<Address>(callback->getter()); | |
637 ApiFunction fun(getter_address); | |
638 ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL; | |
639 ExternalReference ref = ExternalReference(&fun, type, isolate()); | |
640 __ li(getter_address_reg, Operand(ref)); | |
641 | |
642 CallApiGetterStub stub(isolate()); | |
643 __ TailCallStub(&stub); | |
644 } | |
645 | |
646 | |
647 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( | 587 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( |
648 LookupIterator* it, Register holder_reg) { | 588 LookupIterator* it, Register holder_reg) { |
649 DCHECK(holder()->HasNamedInterceptor()); | 589 DCHECK(holder()->HasNamedInterceptor()); |
650 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); | 590 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); |
651 | 591 |
652 // Compile the interceptor call, followed by inline code to load the | 592 // Compile the interceptor call, followed by inline code to load the |
653 // property from further up the prototype chain if the call fails. | 593 // property from further up the prototype chain if the call fails. |
654 // Check that the maps haven't changed. | 594 // Check that the maps haven't changed. |
655 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1())); | 595 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1())); |
656 | 596 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 // Return the generated code. | 720 // Return the generated code. |
781 return GetCode(kind(), name); | 721 return GetCode(kind(), name); |
782 } | 722 } |
783 | 723 |
784 | 724 |
785 #undef __ | 725 #undef __ |
786 } // namespace internal | 726 } // namespace internal |
787 } // namespace v8 | 727 } // namespace v8 |
788 | 728 |
789 #endif // V8_TARGET_ARCH_MIPS64 | 729 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |