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

Side by Side Diff: src/ic/arm64/handler-compiler-arm64.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, 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 | « src/ic/arm/ic-arm.cc ('k') | src/ic/arm64/ic-arm64.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_ARM64 7 #if V8_TARGET_ARCH_ARM64
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex == 1); 125 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex == 1);
126 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex == 2); 126 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex == 2);
127 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3); 127 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3);
128 128
129 __ Push(name, receiver, holder); 129 __ Push(name, receiver, holder);
130 } 130 }
131 131
132 132
133 static void CompileCallLoadPropertyWithInterceptor( 133 static void CompileCallLoadPropertyWithInterceptor(
134 MacroAssembler* masm, Register receiver, Register holder, Register name, 134 MacroAssembler* masm, Register receiver, Register holder, Register name,
135 Handle<JSObject> holder_obj, IC::UtilityId id) { 135 Handle<JSObject> holder_obj, Runtime::FunctionId id) {
136 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); 136 PushInterceptorArguments(masm, receiver, holder, name, holder_obj);
137 137
138 __ CallExternalReference(ExternalReference(IC_Utility(id), masm->isolate()), 138 __ CallRuntime(id, NamedLoadHandlerCompiler::kInterceptorArgsLength);
139 NamedLoadHandlerCompiler::kInterceptorArgsLength);
140 } 139 }
141 140
142 141
143 // Generate call to api function. 142 // Generate call to api function.
144 void PropertyHandlerCompiler::GenerateApiAccessorCall( 143 void PropertyHandlerCompiler::GenerateApiAccessorCall(
145 MacroAssembler* masm, const CallOptimization& optimization, 144 MacroAssembler* masm, const CallOptimization& optimization,
146 Handle<Map> receiver_map, Register receiver, Register scratch, 145 Handle<Map> receiver_map, Register receiver, Register scratch,
147 bool is_store, Register store_parameter, Register accessor_holder, 146 bool is_store, Register store_parameter, Register accessor_holder,
148 int accessor_index) { 147 int accessor_index) {
149 DCHECK(!AreAliased(accessor_holder, scratch)); 148 DCHECK(!AreAliased(accessor_holder, scratch));
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 } 300 }
302 301
303 302
304 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { 303 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) {
305 // Push receiver, name and value for runtime call. 304 // Push receiver, name and value for runtime call.
306 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), 305 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(),
307 StoreDescriptor::ValueRegister()); 306 StoreDescriptor::ValueRegister());
308 307
309 // The slow case calls into the runtime to complete the store without causing 308 // The slow case calls into the runtime to complete the store without causing
310 // an IC miss that would otherwise cause a transition to the generic stub. 309 // an IC miss that would otherwise cause a transition to the generic stub.
311 ExternalReference ref = 310 __ TailCallRuntime(Runtime::kStoreIC_Slow, 3, 1);
312 ExternalReference(IC_Utility(IC::kStoreIC_Slow), masm->isolate());
313 __ TailCallExternalReference(ref, 3, 1);
314 } 311 }
315 312
316 313
317 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { 314 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) {
318 ASM_LOCATION("ElementHandlerCompiler::GenerateStoreSlow"); 315 ASM_LOCATION("ElementHandlerCompiler::GenerateStoreSlow");
319 316
320 // Push receiver, key and value for runtime call. 317 // Push receiver, key and value for runtime call.
321 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), 318 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(),
322 StoreDescriptor::ValueRegister()); 319 StoreDescriptor::ValueRegister());
323 320
324 // The slow case calls into the runtime to complete the store without causing 321 // The slow case calls into the runtime to complete the store without causing
325 // an IC miss that would otherwise cause a transition to the generic stub. 322 // an IC miss that would otherwise cause a transition to the generic stub.
326 ExternalReference ref = 323 __ TailCallRuntime(Runtime::kKeyedStoreIC_Slow, 3, 1);
327 ExternalReference(IC_Utility(IC::kKeyedStoreIC_Slow), masm->isolate());
328 __ TailCallExternalReference(ref, 3, 1);
329 } 324 }
330 325
331 326
332 #undef __ 327 #undef __
333 #define __ ACCESS_MASM(masm()) 328 #define __ ACCESS_MASM(masm())
334 329
335 330
336 Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal( 331 Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal(
337 Handle<PropertyCell> cell, Handle<Name> name, bool is_configurable) { 332 Handle<PropertyCell> cell, Handle<Name> name, bool is_configurable) {
338 Label miss; 333 Label miss;
(...skipping 29 matching lines...) Expand all
368 363
369 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( 364 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor(
370 Handle<Name> name) { 365 Handle<Name> name) {
371 Label miss; 366 Label miss;
372 367
373 ASM_LOCATION("NamedStoreHandlerCompiler::CompileStoreInterceptor"); 368 ASM_LOCATION("NamedStoreHandlerCompiler::CompileStoreInterceptor");
374 369
375 __ Push(receiver(), this->name(), value()); 370 __ Push(receiver(), this->name(), value());
376 371
377 // Do tail-call to the runtime system. 372 // Do tail-call to the runtime system.
378 ExternalReference store_ic_property = ExternalReference( 373 __ TailCallRuntime(Runtime::kStorePropertyWithInterceptor, 3, 1);
379 IC_Utility(IC::kStorePropertyWithInterceptor), isolate());
380 __ TailCallExternalReference(store_ic_property, 3, 1);
381 374
382 // Return the generated code. 375 // Return the generated code.
383 return GetCode(kind(), Code::FAST, name); 376 return GetCode(kind(), Code::FAST, name);
384 } 377 }
385 378
386 379
387 Register NamedStoreHandlerCompiler::value() { 380 Register NamedStoreHandlerCompiler::value() {
388 return StoreDescriptor::ValueRegister(); 381 return StoreDescriptor::ValueRegister();
389 } 382 }
390 383
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 __ Push(receiver(), holder_reg, this->name()); 714 __ Push(receiver(), holder_reg, this->name());
722 } else { 715 } else {
723 __ Push(holder_reg, this->name()); 716 __ Push(holder_reg, this->name());
724 } 717 }
725 InterceptorVectorSlotPush(holder_reg); 718 InterceptorVectorSlotPush(holder_reg);
726 // Invoke an interceptor. Note: map checks from receiver to 719 // Invoke an interceptor. Note: map checks from receiver to
727 // interceptor's holder has been compiled before (see a caller 720 // interceptor's holder has been compiled before (see a caller
728 // of this method.) 721 // of this method.)
729 CompileCallLoadPropertyWithInterceptor( 722 CompileCallLoadPropertyWithInterceptor(
730 masm(), receiver(), holder_reg, this->name(), holder(), 723 masm(), receiver(), holder_reg, this->name(), holder(),
731 IC::kLoadPropertyWithInterceptorOnly); 724 Runtime::kLoadPropertyWithInterceptorOnly);
732 725
733 // Check if interceptor provided a value for property. If it's 726 // Check if interceptor provided a value for property. If it's
734 // the case, return immediately. 727 // the case, return immediately.
735 Label interceptor_failed; 728 Label interceptor_failed;
736 __ JumpIfRoot(x0, Heap::kNoInterceptorResultSentinelRootIndex, 729 __ JumpIfRoot(x0, Heap::kNoInterceptorResultSentinelRootIndex,
737 &interceptor_failed); 730 &interceptor_failed);
738 frame_scope.GenerateLeaveFrame(); 731 frame_scope.GenerateLeaveFrame();
739 __ Ret(); 732 __ Ret();
740 733
741 __ Bind(&interceptor_failed); 734 __ Bind(&interceptor_failed);
(...skipping 10 matching lines...) Expand all
752 } 745 }
753 746
754 747
755 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { 748 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) {
756 // Call the runtime system to load the interceptor. 749 // Call the runtime system to load the interceptor.
757 DCHECK(holder()->HasNamedInterceptor()); 750 DCHECK(holder()->HasNamedInterceptor());
758 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); 751 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined());
759 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), 752 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(),
760 holder()); 753 holder());
761 754
762 ExternalReference ref = ExternalReference( 755 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor,
763 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate()); 756 NamedLoadHandlerCompiler::kInterceptorArgsLength, 1);
764 __ TailCallExternalReference(
765 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1);
766 } 757 }
767 758
768 759
769 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( 760 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
770 Handle<JSObject> object, Handle<Name> name, 761 Handle<JSObject> object, Handle<Name> name,
771 Handle<ExecutableAccessorInfo> callback) { 762 Handle<ExecutableAccessorInfo> callback) {
772 ASM_LOCATION("NamedStoreHandlerCompiler::CompileStoreCallback"); 763 ASM_LOCATION("NamedStoreHandlerCompiler::CompileStoreCallback");
773 Register holder_reg = Frontend(name); 764 Register holder_reg = Frontend(name);
774 765
775 // Stub never generated for non-global objects that require access checks. 766 // Stub never generated for non-global objects that require access checks.
776 DCHECK(holder()->IsJSGlobalProxy() || !holder()->IsAccessCheckNeeded()); 767 DCHECK(holder()->IsJSGlobalProxy() || !holder()->IsAccessCheckNeeded());
777 768
778 // receiver() and holder_reg can alias. 769 // receiver() and holder_reg can alias.
779 DCHECK(!AreAliased(receiver(), scratch1(), scratch2(), value())); 770 DCHECK(!AreAliased(receiver(), scratch1(), scratch2(), value()));
780 DCHECK(!AreAliased(holder_reg, scratch1(), scratch2(), value())); 771 DCHECK(!AreAliased(holder_reg, scratch1(), scratch2(), value()));
781 // If the callback cannot leak, then push the callback directly, 772 // If the callback cannot leak, then push the callback directly,
782 // otherwise wrap it in a weak cell. 773 // otherwise wrap it in a weak cell.
783 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { 774 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) {
784 __ Mov(scratch1(), Operand(callback)); 775 __ Mov(scratch1(), Operand(callback));
785 } else { 776 } else {
786 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); 777 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback);
787 __ Mov(scratch1(), Operand(cell)); 778 __ Mov(scratch1(), Operand(cell));
788 } 779 }
789 __ Mov(scratch2(), Operand(name)); 780 __ Mov(scratch2(), Operand(name));
790 __ Push(receiver(), holder_reg, scratch1(), scratch2(), value()); 781 __ Push(receiver(), holder_reg, scratch1(), scratch2(), value());
791 782
792 // Do tail-call to the runtime system. 783 // Do tail-call to the runtime system.
793 ExternalReference store_callback_property = 784 __ TailCallRuntime(Runtime::kStoreCallbackProperty, 5, 1);
794 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate());
795 __ TailCallExternalReference(store_callback_property, 5, 1);
796 785
797 // Return the generated code. 786 // Return the generated code.
798 return GetCode(kind(), Code::FAST, name); 787 return GetCode(kind(), Code::FAST, name);
799 } 788 }
800 789
801 790
802 #undef __ 791 #undef __
803 } // namespace internal 792 } // namespace internal
804 } // namespace v8 793 } // namespace v8
805 794
806 #endif // V8_TARGET_ARCH_IA32 795 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ic/arm/ic-arm.cc ('k') | src/ic/arm64/ic-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698