| 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/call-optimization.h" | 7 #include "src/ic/call-optimization.h" |
| 8 #include "src/ic/handler-compiler.h" | 8 #include "src/ic/handler-compiler.h" |
| 9 #include "src/ic/ic.h" | 9 #include "src/ic/ic.h" |
| 10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 | 588 |
| 589 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { | 589 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { |
| 590 // Return the constant value. | 590 // Return the constant value. |
| 591 __ Move(r0, value); | 591 __ Move(r0, value); |
| 592 __ Ret(); | 592 __ Ret(); |
| 593 } | 593 } |
| 594 | 594 |
| 595 | 595 |
| 596 void NamedLoadHandlerCompiler::GenerateLoadCallback( | 596 void NamedLoadHandlerCompiler::GenerateLoadCallback( |
| 597 Register reg, Handle<AccessorInfo> callback) { | 597 Register reg, Handle<AccessorInfo> callback) { |
| 598 // Build AccessorInfo::args_ list on the stack and push property name below | 598 DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), receiver())); |
| 599 // the exit frame to make GC aware of them and store pointers to them. | 599 DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), reg)); |
| 600 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); | 600 |
| 601 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); | 601 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property |
| 602 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); | 602 // name below the exit frame to make GC aware of them. |
| 603 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); | 603 STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0); |
| 604 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); | 604 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1); |
| 605 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); | 605 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2); |
| 606 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); | 606 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3); |
| 607 DCHECK(!scratch2().is(reg)); | 607 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4); |
| 608 DCHECK(!scratch3().is(reg)); | 608 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5); |
| 609 DCHECK(!scratch4().is(reg)); | 609 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6); |
| 610 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7); |
| 611 |
| 610 __ push(receiver()); | 612 __ push(receiver()); |
| 611 // Push data from AccessorInfo. | 613 // Push data from AccessorInfo. |
| 612 Handle<Object> data(callback->data(), isolate()); | 614 Handle<Object> data(callback->data(), isolate()); |
| 613 if (data->IsUndefined() || data->IsSmi()) { | 615 if (data->IsUndefined() || data->IsSmi()) { |
| 614 __ Move(scratch3(), data); | 616 __ Move(scratch2(), data); |
| 615 } else { | 617 } else { |
| 616 Handle<WeakCell> cell = | 618 Handle<WeakCell> cell = |
| 617 isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data)); | 619 isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data)); |
| 618 // The callback is alive if this instruction is executed, | 620 // The callback is alive if this instruction is executed, |
| 619 // so the weak cell is not cleared and points to data. | 621 // so the weak cell is not cleared and points to data. |
| 620 __ GetWeakValue(scratch3(), cell); | 622 __ GetWeakValue(scratch2(), cell); |
| 621 } | 623 } |
| 622 __ push(scratch3()); | 624 __ push(scratch2()); |
| 623 __ LoadRoot(scratch3(), Heap::kUndefinedValueRootIndex); | 625 __ LoadRoot(scratch2(), Heap::kUndefinedValueRootIndex); |
| 624 __ mov(scratch4(), scratch3()); | 626 __ Push(scratch2(), scratch2()); |
| 625 __ Push(scratch3(), scratch4()); | 627 __ mov(scratch2(), Operand(ExternalReference::isolate_address(isolate()))); |
| 626 __ mov(scratch4(), Operand(ExternalReference::isolate_address(isolate()))); | 628 __ Push(scratch2(), reg); |
| 627 __ Push(scratch4(), reg); | 629 __ Push(Smi::FromInt(0)); // should_throw_on_error -> false |
| 628 __ mov(scratch2(), sp); // scratch2 = PropertyAccessorInfo::args_ | |
| 629 __ push(name()); | 630 __ push(name()); |
| 630 | 631 |
| 631 // Abi for CallApiGetter | 632 // Abi for CallApiGetter |
| 632 Register getter_address_reg = ApiGetterDescriptor::function_address(); | 633 Register getter_address_reg = ApiGetterDescriptor::function_address(); |
| 633 | 634 |
| 634 Address getter_address = v8::ToCData<Address>(callback->getter()); | 635 Address getter_address = v8::ToCData<Address>(callback->getter()); |
| 635 ApiFunction fun(getter_address); | 636 ApiFunction fun(getter_address); |
| 636 ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL; | 637 ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL; |
| 637 ExternalReference ref = ExternalReference(&fun, type, isolate()); | 638 ExternalReference ref = ExternalReference(&fun, type, isolate()); |
| 638 __ mov(getter_address_reg, Operand(ref)); | 639 __ mov(getter_address_reg, Operand(ref)); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 DCHECK(holder()->HasNamedInterceptor()); | 708 DCHECK(holder()->HasNamedInterceptor()); |
| 708 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); | 709 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); |
| 709 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), | 710 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), |
| 710 holder()); | 711 holder()); |
| 711 | 712 |
| 712 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); | 713 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); |
| 713 } | 714 } |
| 714 | 715 |
| 715 | 716 |
| 716 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 717 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
| 717 Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback) { | 718 Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback, |
| 719 LanguageMode language_mode) { |
| 718 Register holder_reg = Frontend(name); | 720 Register holder_reg = Frontend(name); |
| 719 | 721 |
| 720 __ push(receiver()); // receiver | 722 __ push(receiver()); // receiver |
| 721 __ push(holder_reg); | 723 __ push(holder_reg); |
| 722 | 724 |
| 723 // If the callback cannot leak, then push the callback directly, | 725 // If the callback cannot leak, then push the callback directly, |
| 724 // otherwise wrap it in a weak cell. | 726 // otherwise wrap it in a weak cell. |
| 725 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { | 727 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { |
| 726 __ mov(ip, Operand(callback)); | 728 __ mov(ip, Operand(callback)); |
| 727 } else { | 729 } else { |
| 728 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); | 730 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); |
| 729 __ mov(ip, Operand(cell)); | 731 __ mov(ip, Operand(cell)); |
| 730 } | 732 } |
| 731 __ push(ip); | 733 __ push(ip); |
| 732 __ mov(ip, Operand(name)); | 734 __ mov(ip, Operand(name)); |
| 733 __ Push(ip, value()); | 735 __ Push(ip, value()); |
| 736 __ Push(Smi::FromInt(language_mode)); |
| 734 | 737 |
| 735 // Do tail-call to the runtime system. | 738 // Do tail-call to the runtime system. |
| 736 __ TailCallRuntime(Runtime::kStoreCallbackProperty); | 739 __ TailCallRuntime(Runtime::kStoreCallbackProperty); |
| 737 | 740 |
| 738 // Return the generated code. | 741 // Return the generated code. |
| 739 return GetCode(kind(), Code::FAST, name); | 742 return GetCode(kind(), Code::FAST, name); |
| 740 } | 743 } |
| 741 | 744 |
| 742 | 745 |
| 743 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( | 746 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 // Return the generated code. | 793 // Return the generated code. |
| 791 return GetCode(kind(), Code::NORMAL, name); | 794 return GetCode(kind(), Code::NORMAL, name); |
| 792 } | 795 } |
| 793 | 796 |
| 794 | 797 |
| 795 #undef __ | 798 #undef __ |
| 796 } // namespace internal | 799 } // namespace internal |
| 797 } // namespace v8 | 800 } // namespace v8 |
| 798 | 801 |
| 799 #endif // V8_TARGET_ARCH_ARM | 802 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |