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

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

Issue 1248303002: Unify runtime-style IC functions with Runtime intrinsics (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Make mips work Created 5 years, 4 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 | « src/ic/mips64/ic-mips64.cc ('k') | src/ic/x64/ic-x64.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_X64 7 #if V8_TARGET_ARCH_X64
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex == 2); 108 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex == 2);
109 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3); 109 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3);
110 __ Push(name); 110 __ Push(name);
111 __ Push(receiver); 111 __ Push(receiver);
112 __ Push(holder); 112 __ Push(holder);
113 } 113 }
114 114
115 115
116 static void CompileCallLoadPropertyWithInterceptor( 116 static void CompileCallLoadPropertyWithInterceptor(
117 MacroAssembler* masm, Register receiver, Register holder, Register name, 117 MacroAssembler* masm, Register receiver, Register holder, Register name,
118 Handle<JSObject> holder_obj, IC::UtilityId id) { 118 Handle<JSObject> holder_obj, Runtime::FunctionId id) {
119 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); 119 PushInterceptorArguments(masm, receiver, holder, name, holder_obj);
120 __ CallExternalReference(ExternalReference(IC_Utility(id), masm->isolate()), 120 __ CallRuntime(id, NamedLoadHandlerCompiler::kInterceptorArgsLength);
121 NamedLoadHandlerCompiler::kInterceptorArgsLength);
122 } 121 }
123 122
124 123
125 // Generate call to api function. 124 // Generate call to api function.
126 void PropertyHandlerCompiler::GenerateApiAccessorCall( 125 void PropertyHandlerCompiler::GenerateApiAccessorCall(
127 MacroAssembler* masm, const CallOptimization& optimization, 126 MacroAssembler* masm, const CallOptimization& optimization,
128 Handle<Map> receiver_map, Register receiver, Register scratch, 127 Handle<Map> receiver_map, Register receiver, Register scratch,
129 bool is_store, Register store_parameter, Register accessor_holder, 128 bool is_store, Register store_parameter, Register accessor_holder,
130 int accessor_index) { 129 int accessor_index) {
131 DCHECK(!accessor_holder.is(scratch)); 130 DCHECK(!accessor_holder.is(scratch));
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 __ Push(value); 313 __ Push(value);
315 __ PushReturnAddressFrom(rbx); 314 __ PushReturnAddressFrom(rbx);
316 } 315 }
317 316
318 317
319 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { 318 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) {
320 // Return address is on the stack. 319 // Return address is on the stack.
321 StoreIC_PushArgs(masm); 320 StoreIC_PushArgs(masm);
322 321
323 // Do tail-call to runtime routine. 322 // Do tail-call to runtime routine.
324 ExternalReference ref(IC_Utility(IC::kStoreIC_Slow), masm->isolate()); 323 __ TailCallRuntime(Runtime::kStoreIC_Slow, 3, 1);
325 __ TailCallExternalReference(ref, 3, 1);
326 } 324 }
327 325
328 326
329 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { 327 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) {
330 // Return address is on the stack. 328 // Return address is on the stack.
331 StoreIC_PushArgs(masm); 329 StoreIC_PushArgs(masm);
332 330
333 // Do tail-call to runtime routine. 331 // Do tail-call to runtime routine.
334 ExternalReference ref(IC_Utility(IC::kKeyedStoreIC_Slow), masm->isolate()); 332 __ TailCallRuntime(Runtime::kKeyedStoreIC_Slow, 3, 1);
335 __ TailCallExternalReference(ref, 3, 1);
336 } 333 }
337 334
338 335
339 #undef __ 336 #undef __
340 #define __ ACCESS_MASM((masm())) 337 #define __ ACCESS_MASM((masm()))
341 338
342 339
343 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, 340 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label,
344 Handle<Name> name) { 341 Handle<Name> name) {
345 if (!label->is_unused()) { 342 if (!label->is_unused()) {
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 } 661 }
665 __ Push(holder_reg); 662 __ Push(holder_reg);
666 __ Push(this->name()); 663 __ Push(this->name());
667 InterceptorVectorSlotPush(holder_reg); 664 InterceptorVectorSlotPush(holder_reg);
668 665
669 // Invoke an interceptor. Note: map checks from receiver to 666 // Invoke an interceptor. Note: map checks from receiver to
670 // interceptor's holder has been compiled before (see a caller 667 // interceptor's holder has been compiled before (see a caller
671 // of this method.) 668 // of this method.)
672 CompileCallLoadPropertyWithInterceptor( 669 CompileCallLoadPropertyWithInterceptor(
673 masm(), receiver(), holder_reg, this->name(), holder(), 670 masm(), receiver(), holder_reg, this->name(), holder(),
674 IC::kLoadPropertyWithInterceptorOnly); 671 Runtime::kLoadPropertyWithInterceptorOnly);
675 672
676 // Check if interceptor provided a value for property. If it's 673 // Check if interceptor provided a value for property. If it's
677 // the case, return immediately. 674 // the case, return immediately.
678 Label interceptor_failed; 675 Label interceptor_failed;
679 __ CompareRoot(rax, Heap::kNoInterceptorResultSentinelRootIndex); 676 __ CompareRoot(rax, Heap::kNoInterceptorResultSentinelRootIndex);
680 __ j(equal, &interceptor_failed); 677 __ j(equal, &interceptor_failed);
681 frame_scope.GenerateLeaveFrame(); 678 frame_scope.GenerateLeaveFrame();
682 __ ret(0); 679 __ ret(0);
683 680
684 __ bind(&interceptor_failed); 681 __ bind(&interceptor_failed);
(...skipping 13 matching lines...) Expand all
698 695
699 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { 696 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) {
700 // Call the runtime system to load the interceptor. 697 // Call the runtime system to load the interceptor.
701 DCHECK(holder()->HasNamedInterceptor()); 698 DCHECK(holder()->HasNamedInterceptor());
702 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); 699 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined());
703 __ PopReturnAddressTo(scratch2()); 700 __ PopReturnAddressTo(scratch2());
704 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), 701 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(),
705 holder()); 702 holder());
706 __ PushReturnAddressFrom(scratch2()); 703 __ PushReturnAddressFrom(scratch2());
707 704
708 ExternalReference ref = ExternalReference( 705 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor,
709 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate()); 706 NamedLoadHandlerCompiler::kInterceptorArgsLength, 1);
710 __ TailCallExternalReference(
711 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1);
712 } 707 }
713 708
714 709
715 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( 710 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
716 Handle<JSObject> object, Handle<Name> name, 711 Handle<JSObject> object, Handle<Name> name,
717 Handle<ExecutableAccessorInfo> callback) { 712 Handle<ExecutableAccessorInfo> callback) {
718 Register holder_reg = Frontend(name); 713 Register holder_reg = Frontend(name);
719 714
720 __ PopReturnAddressTo(scratch1()); 715 __ PopReturnAddressTo(scratch1());
721 __ Push(receiver()); 716 __ Push(receiver());
722 __ Push(holder_reg); 717 __ Push(holder_reg);
723 // If the callback cannot leak, then push the callback directly, 718 // If the callback cannot leak, then push the callback directly,
724 // otherwise wrap it in a weak cell. 719 // otherwise wrap it in a weak cell.
725 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { 720 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) {
726 __ Push(callback); 721 __ Push(callback);
727 } else { 722 } else {
728 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); 723 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback);
729 __ Push(cell); 724 __ Push(cell);
730 } 725 }
731 __ Push(name); 726 __ Push(name);
732 __ Push(value()); 727 __ Push(value());
733 __ PushReturnAddressFrom(scratch1()); 728 __ PushReturnAddressFrom(scratch1());
734 729
735 // Do tail-call to the runtime system. 730 // Do tail-call to the runtime system.
736 ExternalReference store_callback_property = 731 __ TailCallRuntime(Runtime::kStoreCallbackProperty, 5, 1);
737 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate());
738 __ TailCallExternalReference(store_callback_property, 5, 1);
739 732
740 // Return the generated code. 733 // Return the generated code.
741 return GetCode(kind(), Code::FAST, name); 734 return GetCode(kind(), Code::FAST, name);
742 } 735 }
743 736
744 737
745 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( 738 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor(
746 Handle<Name> name) { 739 Handle<Name> name) {
747 __ PopReturnAddressTo(scratch1()); 740 __ PopReturnAddressTo(scratch1());
748 __ Push(receiver()); 741 __ Push(receiver());
749 __ Push(this->name()); 742 __ Push(this->name());
750 __ Push(value()); 743 __ Push(value());
751 __ PushReturnAddressFrom(scratch1()); 744 __ PushReturnAddressFrom(scratch1());
752 745
753 // Do tail-call to the runtime system. 746 // Do tail-call to the runtime system.
754 ExternalReference store_ic_property = ExternalReference( 747 __ TailCallRuntime(Runtime::kStorePropertyWithInterceptor, 3, 1);
755 IC_Utility(IC::kStorePropertyWithInterceptor), isolate());
756 __ TailCallExternalReference(store_ic_property, 3, 1);
757 748
758 // Return the generated code. 749 // Return the generated code.
759 return GetCode(kind(), Code::FAST, name); 750 return GetCode(kind(), Code::FAST, name);
760 } 751 }
761 752
762 753
763 Register NamedStoreHandlerCompiler::value() { 754 Register NamedStoreHandlerCompiler::value() {
764 return StoreDescriptor::ValueRegister(); 755 return StoreDescriptor::ValueRegister();
765 } 756 }
766 757
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 // Return the generated code. 791 // Return the generated code.
801 return GetCode(kind(), Code::NORMAL, name); 792 return GetCode(kind(), Code::NORMAL, name);
802 } 793 }
803 794
804 795
805 #undef __ 796 #undef __
806 } // namespace internal 797 } // namespace internal
807 } // namespace v8 798 } // namespace v8
808 799
809 #endif // V8_TARGET_ARCH_X64 800 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ic/mips64/ic-mips64.cc ('k') | src/ic/x64/ic-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698