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 |
600 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( | 651 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( |
601 LookupIterator* it, Register holder_reg) { | 652 LookupIterator* it, Register holder_reg) { |
602 DCHECK(holder()->HasNamedInterceptor()); | 653 DCHECK(holder()->HasNamedInterceptor()); |
603 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); | 654 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); |
604 | 655 |
605 // Compile the interceptor call, followed by inline code to load the | 656 // Compile the interceptor call, followed by inline code to load the |
606 // property from further up the prototype chain if the call fails. | 657 // property from further up the prototype chain if the call fails. |
607 // Check that the maps haven't changed. | 658 // Check that the maps haven't changed. |
608 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1())); | 659 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1())); |
609 | 660 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 // Return the generated code. | 786 // Return the generated code. |
736 return GetCode(kind(), name); | 787 return GetCode(kind(), name); |
737 } | 788 } |
738 | 789 |
739 | 790 |
740 #undef __ | 791 #undef __ |
741 } // namespace internal | 792 } // namespace internal |
742 } // namespace v8 | 793 } // namespace v8 |
743 | 794 |
744 #endif // V8_TARGET_ARCH_ARM | 795 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |