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