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