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_PPC | 5 #if V8_TARGET_ARCH_PPC |
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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 } | 585 } |
586 | 586 |
587 | 587 |
588 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { | 588 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { |
589 // Return the constant value. | 589 // Return the constant value. |
590 __ Move(r3, value); | 590 __ Move(r3, value); |
591 __ Ret(); | 591 __ Ret(); |
592 } | 592 } |
593 | 593 |
594 | 594 |
595 void NamedLoadHandlerCompiler::GenerateLoadCallback( | |
596 Register reg, Handle<AccessorInfo> callback) { | |
597 DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), receiver())); | |
598 DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), reg)); | |
599 | |
600 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property | |
601 // name below the exit frame to make GC aware of them. | |
602 STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0); | |
603 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1); | |
604 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2); | |
605 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3); | |
606 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4); | |
607 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5); | |
608 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6); | |
609 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7); | |
610 | |
611 __ push(receiver()); | |
612 // Push data from AccessorInfo. | |
613 Handle<Object> data(callback->data(), isolate()); | |
614 if (data->IsUndefined() || data->IsSmi()) { | |
615 __ Move(scratch2(), data); | |
616 } else { | |
617 Handle<WeakCell> cell = | |
618 isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data)); | |
619 // The callback is alive if this instruction is executed, | |
620 // so the weak cell is not cleared and points to data. | |
621 __ GetWeakValue(scratch2(), cell); | |
622 } | |
623 __ push(scratch2()); | |
624 __ LoadRoot(scratch2(), Heap::kUndefinedValueRootIndex); | |
625 __ Push(scratch2(), scratch2()); | |
626 __ mov(scratch2(), Operand(ExternalReference::isolate_address(isolate()))); | |
627 // should_throw_on_error -> false | |
628 __ mov(scratch3(), Operand(Smi::FromInt(0))); | |
629 __ Push(scratch2(), reg, scratch3(), name()); | |
630 | |
631 // Abi for CallApiGetter | |
632 Register getter_address_reg = ApiGetterDescriptor::function_address(); | |
633 | |
634 Address getter_address = v8::ToCData<Address>(callback->getter()); | |
635 ApiFunction fun(getter_address); | |
636 ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL; | |
637 ExternalReference ref = ExternalReference(&fun, type, isolate()); | |
638 __ mov(getter_address_reg, Operand(ref)); | |
639 | |
640 CallApiGetterStub stub(isolate()); | |
641 __ TailCallStub(&stub); | |
642 } | |
643 | |
644 | |
645 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( | 595 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( |
646 LookupIterator* it, Register holder_reg) { | 596 LookupIterator* it, Register holder_reg) { |
647 DCHECK(holder()->HasNamedInterceptor()); | 597 DCHECK(holder()->HasNamedInterceptor()); |
648 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); | 598 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); |
649 | 599 |
650 // Compile the interceptor call, followed by inline code to load the | 600 // Compile the interceptor call, followed by inline code to load the |
651 // property from further up the prototype chain if the call fails. | 601 // property from further up the prototype chain if the call fails. |
652 // Check that the maps haven't changed. | 602 // Check that the maps haven't changed. |
653 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1())); | 603 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1())); |
654 | 604 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 // Return the generated code. | 729 // Return the generated code. |
780 return GetCode(kind(), name); | 730 return GetCode(kind(), name); |
781 } | 731 } |
782 | 732 |
783 | 733 |
784 #undef __ | 734 #undef __ |
785 } // namespace internal | 735 } // namespace internal |
786 } // namespace v8 | 736 } // namespace v8 |
787 | 737 |
788 #endif // V8_TARGET_ARCH_ARM | 738 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |