Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: src/ic/ppc/handler-compiler-ppc.cc

Issue 1249433004: PPC: Unify "runtime-style" IC functions with Runtime intrinsics (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/ic/ppc/ic-ppc.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_PPC 7 #if V8_TARGET_ARCH_PPC
8 8
9 #include "src/ic/call-optimization.h" 9 #include "src/ic/call-optimization.h"
10 #include "src/ic/handler-compiler.h" 10 #include "src/ic/handler-compiler.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex == 2); 214 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex == 2);
215 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3); 215 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3);
216 __ push(name); 216 __ push(name);
217 __ push(receiver); 217 __ push(receiver);
218 __ push(holder); 218 __ push(holder);
219 } 219 }
220 220
221 221
222 static void CompileCallLoadPropertyWithInterceptor( 222 static void CompileCallLoadPropertyWithInterceptor(
223 MacroAssembler* masm, Register receiver, Register holder, Register name, 223 MacroAssembler* masm, Register receiver, Register holder, Register name,
224 Handle<JSObject> holder_obj, IC::UtilityId id) { 224 Handle<JSObject> holder_obj, Runtime::FunctionId id) {
225 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); 225 PushInterceptorArguments(masm, receiver, holder, name, holder_obj);
226 __ CallExternalReference(ExternalReference(IC_Utility(id), masm->isolate()), 226 __ CallRuntime(id, NamedLoadHandlerCompiler::kInterceptorArgsLength);
227 NamedLoadHandlerCompiler::kInterceptorArgsLength);
228 } 227 }
229 228
230 229
231 // Generate call to api function. 230 // Generate call to api function.
232 void PropertyHandlerCompiler::GenerateApiAccessorCall( 231 void PropertyHandlerCompiler::GenerateApiAccessorCall(
233 MacroAssembler* masm, const CallOptimization& optimization, 232 MacroAssembler* masm, const CallOptimization& optimization,
234 Handle<Map> receiver_map, Register receiver, Register scratch_in, 233 Handle<Map> receiver_map, Register receiver, Register scratch_in,
235 bool is_store, Register store_parameter, Register accessor_holder, 234 bool is_store, Register store_parameter, Register accessor_holder,
236 int accessor_index) { 235 int accessor_index) {
237 DCHECK(!accessor_holder.is(scratch_in)); 236 DCHECK(!accessor_holder.is(scratch_in));
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 306 }
308 307
309 308
310 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { 309 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) {
311 // Push receiver, key and value for runtime call. 310 // Push receiver, key and value for runtime call.
312 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), 311 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(),
313 StoreDescriptor::ValueRegister()); 312 StoreDescriptor::ValueRegister());
314 313
315 // The slow case calls into the runtime to complete the store without causing 314 // The slow case calls into the runtime to complete the store without causing
316 // an IC miss that would otherwise cause a transition to the generic stub. 315 // an IC miss that would otherwise cause a transition to the generic stub.
317 ExternalReference ref = 316 __ TailCallRuntime(Runtime::kStoreIC_Slow, 3, 1);
318 ExternalReference(IC_Utility(IC::kStoreIC_Slow), masm->isolate());
319 __ TailCallExternalReference(ref, 3, 1);
320 } 317 }
321 318
322 319
323 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { 320 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) {
324 // Push receiver, key and value for runtime call. 321 // Push receiver, key and value for runtime call.
325 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), 322 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(),
326 StoreDescriptor::ValueRegister()); 323 StoreDescriptor::ValueRegister());
327 324
328 // The slow case calls into the runtime to complete the store without causing 325 // The slow case calls into the runtime to complete the store without causing
329 // an IC miss that would otherwise cause a transition to the generic stub. 326 // an IC miss that would otherwise cause a transition to the generic stub.
330 ExternalReference ref = 327 __ TailCallRuntime(Runtime::kKeyedStoreIC_Slow, 3, 1);
331 ExternalReference(IC_Utility(IC::kKeyedStoreIC_Slow), masm->isolate());
332 __ TailCallExternalReference(ref, 3, 1);
333 } 328 }
334 329
335 330
336 #undef __ 331 #undef __
337 #define __ ACCESS_MASM(masm()) 332 #define __ ACCESS_MASM(masm())
338 333
339 334
340 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, 335 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label,
341 Handle<Name> name) { 336 Handle<Name> name) {
342 if (!label->is_unused()) { 337 if (!label->is_unused()) {
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 __ Push(receiver(), holder_reg, this->name()); 649 __ Push(receiver(), holder_reg, this->name());
655 } else { 650 } else {
656 __ Push(holder_reg, this->name()); 651 __ Push(holder_reg, this->name());
657 } 652 }
658 InterceptorVectorSlotPush(holder_reg); 653 InterceptorVectorSlotPush(holder_reg);
659 // Invoke an interceptor. Note: map checks from receiver to 654 // Invoke an interceptor. Note: map checks from receiver to
660 // interceptor's holder has been compiled before (see a caller 655 // interceptor's holder has been compiled before (see a caller
661 // of this method.) 656 // of this method.)
662 CompileCallLoadPropertyWithInterceptor( 657 CompileCallLoadPropertyWithInterceptor(
663 masm(), receiver(), holder_reg, this->name(), holder(), 658 masm(), receiver(), holder_reg, this->name(), holder(),
664 IC::kLoadPropertyWithInterceptorOnly); 659 Runtime::kLoadPropertyWithInterceptorOnly);
665 660
666 // Check if interceptor provided a value for property. If it's 661 // Check if interceptor provided a value for property. If it's
667 // the case, return immediately. 662 // the case, return immediately.
668 Label interceptor_failed; 663 Label interceptor_failed;
669 __ LoadRoot(scratch1(), Heap::kNoInterceptorResultSentinelRootIndex); 664 __ LoadRoot(scratch1(), Heap::kNoInterceptorResultSentinelRootIndex);
670 __ cmp(r3, scratch1()); 665 __ cmp(r3, scratch1());
671 __ beq(&interceptor_failed); 666 __ beq(&interceptor_failed);
672 frame_scope.GenerateLeaveFrame(); 667 frame_scope.GenerateLeaveFrame();
673 __ Ret(); 668 __ Ret();
674 669
(...skipping 11 matching lines...) Expand all
686 } 681 }
687 682
688 683
689 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { 684 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) {
690 // Call the runtime system to load the interceptor. 685 // Call the runtime system to load the interceptor.
691 DCHECK(holder()->HasNamedInterceptor()); 686 DCHECK(holder()->HasNamedInterceptor());
692 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); 687 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined());
693 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), 688 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(),
694 holder()); 689 holder());
695 690
696 ExternalReference ref = ExternalReference( 691 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor,
697 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate()); 692 NamedLoadHandlerCompiler::kInterceptorArgsLength, 1);
698 __ TailCallExternalReference(
699 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1);
700 } 693 }
701 694
702 695
703 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( 696 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
704 Handle<JSObject> object, Handle<Name> name, 697 Handle<JSObject> object, Handle<Name> name,
705 Handle<ExecutableAccessorInfo> callback) { 698 Handle<ExecutableAccessorInfo> callback) {
706 Register holder_reg = Frontend(name); 699 Register holder_reg = Frontend(name);
707 700
708 __ Push(receiver(), holder_reg); // receiver 701 __ Push(receiver(), holder_reg); // receiver
709 702
710 // If the callback cannot leak, then push the callback directly, 703 // If the callback cannot leak, then push the callback directly,
711 // otherwise wrap it in a weak cell. 704 // otherwise wrap it in a weak cell.
712 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { 705 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) {
713 __ mov(ip, Operand(callback)); 706 __ mov(ip, Operand(callback));
714 } else { 707 } else {
715 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); 708 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback);
716 __ mov(ip, Operand(cell)); 709 __ mov(ip, Operand(cell));
717 } 710 }
718 __ push(ip); 711 __ push(ip);
719 __ mov(ip, Operand(name)); 712 __ mov(ip, Operand(name));
720 __ Push(ip, value()); 713 __ Push(ip, value());
721 714
722 // Do tail-call to the runtime system. 715 // Do tail-call to the runtime system.
723 ExternalReference store_callback_property = 716 __ TailCallRuntime(Runtime::kStoreCallbackProperty, 5, 1);
724 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate());
725 __ TailCallExternalReference(store_callback_property, 5, 1);
726 717
727 // Return the generated code. 718 // Return the generated code.
728 return GetCode(kind(), Code::FAST, name); 719 return GetCode(kind(), Code::FAST, name);
729 } 720 }
730 721
731 722
732 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( 723 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor(
733 Handle<Name> name) { 724 Handle<Name> name) {
734 __ Push(receiver(), this->name(), value()); 725 __ Push(receiver(), this->name(), value());
735 726
736 // Do tail-call to the runtime system. 727 // Do tail-call to the runtime system.
737 ExternalReference store_ic_property = ExternalReference( 728 __ TailCallRuntime(Runtime::kStorePropertyWithInterceptor, 3, 1);
738 IC_Utility(IC::kStorePropertyWithInterceptor), isolate());
739 __ TailCallExternalReference(store_ic_property, 3, 1);
740 729
741 // Return the generated code. 730 // Return the generated code.
742 return GetCode(kind(), Code::FAST, name); 731 return GetCode(kind(), Code::FAST, name);
743 } 732 }
744 733
745 734
746 Register NamedStoreHandlerCompiler::value() { 735 Register NamedStoreHandlerCompiler::value() {
747 return StoreDescriptor::ValueRegister(); 736 return StoreDescriptor::ValueRegister();
748 } 737 }
749 738
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 // Return the generated code. 770 // Return the generated code.
782 return GetCode(kind(), Code::NORMAL, name); 771 return GetCode(kind(), Code::NORMAL, name);
783 } 772 }
784 773
785 774
786 #undef __ 775 #undef __
787 } // namespace internal 776 } // namespace internal
788 } // namespace v8 777 } // namespace v8
789 778
790 #endif // V8_TARGET_ARCH_ARM 779 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ic/ppc/ic-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698