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