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

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

Issue 1248303002: Unify runtime-style IC functions with Runtime intrinsics (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Cleanup 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
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_MIPS64 7 #if V8_TARGET_ARCH_MIPS64
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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex == 0); 210 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex == 0);
211 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex == 1); 211 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex == 1);
212 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex == 2); 212 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex == 2);
213 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3); 213 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3);
214 __ Push(name, receiver, holder); 214 __ Push(name, receiver, holder);
215 } 215 }
216 216
217 217
218 static void CompileCallLoadPropertyWithInterceptor( 218 static void CompileCallLoadPropertyWithInterceptor(
219 MacroAssembler* masm, Register receiver, Register holder, Register name, 219 MacroAssembler* masm, Register receiver, Register holder, Register name,
220 Handle<JSObject> holder_obj, IC::UtilityId id) { 220 Handle<JSObject> holder_obj, Runtime::FunctionId id) {
221 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); 221 PushInterceptorArguments(masm, receiver, holder, name, holder_obj);
222 __ CallExternalReference(ExternalReference(IC_Utility(id), masm->isolate()), 222 __ CallExternalReference(
223 NamedLoadHandlerCompiler::kInterceptorArgsLength); 223 ExternalReference(Runtime::FunctionForId(id), masm->isolate()),
224 NamedLoadHandlerCompiler::kInterceptorArgsLength);
224 } 225 }
225 226
226 227
227 // Generate call to api function. 228 // Generate call to api function.
228 void PropertyHandlerCompiler::GenerateApiAccessorCall( 229 void PropertyHandlerCompiler::GenerateApiAccessorCall(
229 MacroAssembler* masm, const CallOptimization& optimization, 230 MacroAssembler* masm, const CallOptimization& optimization,
230 Handle<Map> receiver_map, Register receiver, Register scratch_in, 231 Handle<Map> receiver_map, Register receiver, Register scratch_in,
231 bool is_store, Register store_parameter, Register accessor_holder, 232 bool is_store, Register store_parameter, Register accessor_holder,
232 int accessor_index) { 233 int accessor_index) {
233 DCHECK(!accessor_holder.is(scratch_in)); 234 DCHECK(!accessor_holder.is(scratch_in));
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 } 300 }
300 301
301 302
302 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { 303 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) {
303 // Push receiver, key and value for runtime call. 304 // Push receiver, key and value for runtime call.
304 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), 305 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(),
305 StoreDescriptor::ValueRegister()); 306 StoreDescriptor::ValueRegister());
306 307
307 // 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
308 // 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.
309 ExternalReference ref = 310 ExternalReference ref = ExternalReference(
310 ExternalReference(IC_Utility(IC::kStoreIC_Slow), masm->isolate()); 311 Runtime::FunctionForId(Runtime::kStoreIC_Slow), masm->isolate());
311 __ TailCallExternalReference(ref, 3, 1); 312 __ TailCallExternalReference(ref, 3, 1);
312 } 313 }
313 314
314 315
315 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { 316 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) {
316 // Push receiver, key and value for runtime call. 317 // Push receiver, key and value for runtime call.
317 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), 318 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(),
318 StoreDescriptor::ValueRegister()); 319 StoreDescriptor::ValueRegister());
319 320
320 // 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
321 // 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.
322 ExternalReference ref = 323 ExternalReference ref = ExternalReference(
323 ExternalReference(IC_Utility(IC::kKeyedStoreIC_Slow), masm->isolate()); 324 Runtime::FunctionForId(Runtime::kKeyedStoreIC_Slow), masm->isolate());
324 __ TailCallExternalReference(ref, 3, 1); 325 __ TailCallExternalReference(ref, 3, 1);
325 } 326 }
326 327
327 328
328 #undef __ 329 #undef __
329 #define __ ACCESS_MASM(masm()) 330 #define __ ACCESS_MASM(masm())
330 331
331 332
332 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, 333 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label,
333 Handle<Name> name) { 334 Handle<Name> name) {
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 __ Push(receiver(), holder_reg, this->name()); 651 __ Push(receiver(), holder_reg, this->name());
651 } else { 652 } else {
652 __ Push(holder_reg, this->name()); 653 __ Push(holder_reg, this->name());
653 } 654 }
654 InterceptorVectorSlotPush(holder_reg); 655 InterceptorVectorSlotPush(holder_reg);
655 // Invoke an interceptor. Note: map checks from receiver to 656 // Invoke an interceptor. Note: map checks from receiver to
656 // interceptor's holder has been compiled before (see a caller 657 // interceptor's holder has been compiled before (see a caller
657 // of this method). 658 // of this method).
658 CompileCallLoadPropertyWithInterceptor( 659 CompileCallLoadPropertyWithInterceptor(
659 masm(), receiver(), holder_reg, this->name(), holder(), 660 masm(), receiver(), holder_reg, this->name(), holder(),
660 IC::kLoadPropertyWithInterceptorOnly); 661 Runtime::kLoadPropertyWithInterceptorOnly);
661 662
662 // Check if interceptor provided a value for property. If it's 663 // Check if interceptor provided a value for property. If it's
663 // the case, return immediately. 664 // the case, return immediately.
664 Label interceptor_failed; 665 Label interceptor_failed;
665 __ LoadRoot(scratch1(), Heap::kNoInterceptorResultSentinelRootIndex); 666 __ LoadRoot(scratch1(), Heap::kNoInterceptorResultSentinelRootIndex);
666 __ Branch(&interceptor_failed, eq, v0, Operand(scratch1())); 667 __ Branch(&interceptor_failed, eq, v0, Operand(scratch1()));
667 frame_scope.GenerateLeaveFrame(); 668 frame_scope.GenerateLeaveFrame();
668 __ Ret(); 669 __ Ret();
669 670
670 __ bind(&interceptor_failed); 671 __ bind(&interceptor_failed);
(...skipping 11 matching lines...) Expand all
682 683
683 684
684 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { 685 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) {
685 // Call the runtime system to load the interceptor. 686 // Call the runtime system to load the interceptor.
686 DCHECK(holder()->HasNamedInterceptor()); 687 DCHECK(holder()->HasNamedInterceptor());
687 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); 688 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined());
688 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), 689 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(),
689 holder()); 690 holder());
690 691
691 ExternalReference ref = ExternalReference( 692 ExternalReference ref = ExternalReference(
692 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate()); 693 Runtime::FunctionForId(Runtime::kLoadPropertyWithInterceptor), isolate());
693 __ TailCallExternalReference( 694 __ TailCallExternalReference(
694 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1); 695 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1);
695 } 696 }
696 697
697 698
698 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( 699 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
699 Handle<JSObject> object, Handle<Name> name, 700 Handle<JSObject> object, Handle<Name> name,
700 Handle<ExecutableAccessorInfo> callback) { 701 Handle<ExecutableAccessorInfo> callback) {
701 Register holder_reg = Frontend(name); 702 Register holder_reg = Frontend(name);
702 703
703 __ Push(receiver(), holder_reg); // Receiver. 704 __ Push(receiver(), holder_reg); // Receiver.
704 // If the callback cannot leak, then push the callback directly, 705 // If the callback cannot leak, then push the callback directly,
705 // otherwise wrap it in a weak cell. 706 // otherwise wrap it in a weak cell.
706 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { 707 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) {
707 __ li(at, Operand(callback)); 708 __ li(at, Operand(callback));
708 } else { 709 } else {
709 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); 710 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback);
710 __ li(at, Operand(cell)); 711 __ li(at, Operand(cell));
711 } 712 }
712 __ push(at); 713 __ push(at);
713 __ li(at, Operand(name)); 714 __ li(at, Operand(name));
714 __ Push(at, value()); 715 __ Push(at, value());
715 716
716 // Do tail-call to the runtime system. 717 // Do tail-call to the runtime system.
717 ExternalReference store_callback_property = 718 ExternalReference store_callback_property = ExternalReference(
718 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); 719 Runtime::FunctionForId(Runtime::kStoreCallbackProperty), isolate());
719 __ TailCallExternalReference(store_callback_property, 5, 1); 720 __ TailCallExternalReference(store_callback_property, 5, 1);
720 721
721 // Return the generated code. 722 // Return the generated code.
722 return GetCode(kind(), Code::FAST, name); 723 return GetCode(kind(), Code::FAST, name);
723 } 724 }
724 725
725 726
726 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( 727 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor(
727 Handle<Name> name) { 728 Handle<Name> name) {
728 __ Push(receiver(), this->name(), value()); 729 __ Push(receiver(), this->name(), value());
729 730
730 // Do tail-call to the runtime system. 731 // Do tail-call to the runtime system.
731 ExternalReference store_ic_property = ExternalReference( 732 ExternalReference store_ic_property = ExternalReference(
732 IC_Utility(IC::kStorePropertyWithInterceptor), isolate()); 733 Runtime::FunctionForId(Runtime::kStorePropertyWithInterceptor),
734 isolate());
733 __ TailCallExternalReference(store_ic_property, 3, 1); 735 __ TailCallExternalReference(store_ic_property, 3, 1);
734 736
735 // Return the generated code. 737 // Return the generated code.
736 return GetCode(kind(), Code::FAST, name); 738 return GetCode(kind(), Code::FAST, name);
737 } 739 }
738 740
739 741
740 Register NamedStoreHandlerCompiler::value() { 742 Register NamedStoreHandlerCompiler::value() {
741 return StoreDescriptor::ValueRegister(); 743 return StoreDescriptor::ValueRegister();
742 } 744 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 // Return the generated code. 778 // Return the generated code.
777 return GetCode(kind(), Code::NORMAL, name); 779 return GetCode(kind(), Code::NORMAL, name);
778 } 780 }
779 781
780 782
781 #undef __ 783 #undef __
782 } // namespace internal 784 } // namespace internal
783 } // namespace v8 785 } // namespace v8
784 786
785 #endif // V8_TARGET_ARCH_MIPS64 787 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/ic/mips/ic-mips.cc ('k') | src/ic/mips64/ic-mips64.cc » ('j') | src/runtime/runtime.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698