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

Side by Side Diff: src/ic/mips/handler-compiler-mips.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/ic.cc ('k') | src/ic/mips/ic-mips.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_MIPS 7 #if V8_TARGET_ARCH_MIPS
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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex == 0); 209 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex == 0);
210 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex == 1); 210 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex == 1);
211 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex == 2); 211 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex == 2);
212 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3); 212 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3);
213 __ Push(name, receiver, holder); 213 __ Push(name, receiver, holder);
214 } 214 }
215 215
216 216
217 static void CompileCallLoadPropertyWithInterceptor( 217 static void CompileCallLoadPropertyWithInterceptor(
218 MacroAssembler* masm, Register receiver, Register holder, Register name, 218 MacroAssembler* masm, Register receiver, Register holder, Register name,
219 Handle<JSObject> holder_obj, IC::UtilityId id) { 219 Handle<JSObject> holder_obj, Runtime::FunctionId id) {
220 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); 220 PushInterceptorArguments(masm, receiver, holder, name, holder_obj);
221 __ CallExternalReference(ExternalReference(IC_Utility(id), masm->isolate()), 221 __ CallRuntime(id, NamedLoadHandlerCompiler::kInterceptorArgsLength);
222 NamedLoadHandlerCompiler::kInterceptorArgsLength);
223 } 222 }
224 223
225 224
226 // Generate call to api function. 225 // Generate call to api function.
227 void PropertyHandlerCompiler::GenerateApiAccessorCall( 226 void PropertyHandlerCompiler::GenerateApiAccessorCall(
228 MacroAssembler* masm, const CallOptimization& optimization, 227 MacroAssembler* masm, const CallOptimization& optimization,
229 Handle<Map> receiver_map, Register receiver, Register scratch_in, 228 Handle<Map> receiver_map, Register receiver, Register scratch_in,
230 bool is_store, Register store_parameter, Register accessor_holder, 229 bool is_store, Register store_parameter, Register accessor_holder,
231 int accessor_index) { 230 int accessor_index) {
232 DCHECK(!accessor_holder.is(scratch_in)); 231 DCHECK(!accessor_holder.is(scratch_in));
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } 297 }
299 298
300 299
301 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { 300 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) {
302 // Push receiver, key and value for runtime call. 301 // Push receiver, key and value for runtime call.
303 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), 302 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(),
304 StoreDescriptor::ValueRegister()); 303 StoreDescriptor::ValueRegister());
305 304
306 // The slow case calls into the runtime to complete the store without causing 305 // The slow case calls into the runtime to complete the store without causing
307 // an IC miss that would otherwise cause a transition to the generic stub. 306 // an IC miss that would otherwise cause a transition to the generic stub.
308 ExternalReference ref = 307 __ TailCallRuntime(Runtime::kStoreIC_Slow, 3, 1);
309 ExternalReference(IC_Utility(IC::kStoreIC_Slow), masm->isolate());
310 __ TailCallExternalReference(ref, 3, 1);
311 } 308 }
312 309
313 310
314 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { 311 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) {
315 // Push receiver, key and value for runtime call. 312 // Push receiver, key and value for runtime call.
316 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), 313 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(),
317 StoreDescriptor::ValueRegister()); 314 StoreDescriptor::ValueRegister());
318 315
319 // The slow case calls into the runtime to complete the store without causing 316 // The slow case calls into the runtime to complete the store without causing
320 // an IC miss that would otherwise cause a transition to the generic stub. 317 // an IC miss that would otherwise cause a transition to the generic stub.
321 ExternalReference ref = 318 __ TailCallRuntime(Runtime::kKeyedStoreIC_Slow, 3, 1);
322 ExternalReference(IC_Utility(IC::kKeyedStoreIC_Slow), masm->isolate());
323 __ TailCallExternalReference(ref, 3, 1);
324 } 319 }
325 320
326 321
327 #undef __ 322 #undef __
328 #define __ ACCESS_MASM(masm()) 323 #define __ ACCESS_MASM(masm())
329 324
330 325
331 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, 326 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label,
332 Handle<Name> name) { 327 Handle<Name> name) {
333 if (!label->is_unused()) { 328 if (!label->is_unused()) {
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 __ Push(receiver(), holder_reg, this->name()); 644 __ Push(receiver(), holder_reg, this->name());
650 } else { 645 } else {
651 __ Push(holder_reg, this->name()); 646 __ Push(holder_reg, this->name());
652 } 647 }
653 InterceptorVectorSlotPush(holder_reg); 648 InterceptorVectorSlotPush(holder_reg);
654 // Invoke an interceptor. Note: map checks from receiver to 649 // Invoke an interceptor. Note: map checks from receiver to
655 // interceptor's holder has been compiled before (see a caller 650 // interceptor's holder has been compiled before (see a caller
656 // of this method). 651 // of this method).
657 CompileCallLoadPropertyWithInterceptor( 652 CompileCallLoadPropertyWithInterceptor(
658 masm(), receiver(), holder_reg, this->name(), holder(), 653 masm(), receiver(), holder_reg, this->name(), holder(),
659 IC::kLoadPropertyWithInterceptorOnly); 654 Runtime::kLoadPropertyWithInterceptorOnly);
660 655
661 // Check if interceptor provided a value for property. If it's 656 // Check if interceptor provided a value for property. If it's
662 // the case, return immediately. 657 // the case, return immediately.
663 Label interceptor_failed; 658 Label interceptor_failed;
664 __ LoadRoot(scratch1(), Heap::kNoInterceptorResultSentinelRootIndex); 659 __ LoadRoot(scratch1(), Heap::kNoInterceptorResultSentinelRootIndex);
665 __ Branch(&interceptor_failed, eq, v0, Operand(scratch1())); 660 __ Branch(&interceptor_failed, eq, v0, Operand(scratch1()));
666 frame_scope.GenerateLeaveFrame(); 661 frame_scope.GenerateLeaveFrame();
667 __ Ret(); 662 __ Ret();
668 663
669 __ bind(&interceptor_failed); 664 __ bind(&interceptor_failed);
(...skipping 10 matching lines...) Expand all
680 } 675 }
681 676
682 677
683 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { 678 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) {
684 // Call the runtime system to load the interceptor. 679 // Call the runtime system to load the interceptor.
685 DCHECK(holder()->HasNamedInterceptor()); 680 DCHECK(holder()->HasNamedInterceptor());
686 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); 681 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined());
687 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), 682 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(),
688 holder()); 683 holder());
689 684
690 ExternalReference ref = ExternalReference( 685 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor,
691 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate()); 686 NamedLoadHandlerCompiler::kInterceptorArgsLength, 1);
692 __ TailCallExternalReference(
693 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1);
694 } 687 }
695 688
696 689
697 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( 690 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
698 Handle<JSObject> object, Handle<Name> name, 691 Handle<JSObject> object, Handle<Name> name,
699 Handle<ExecutableAccessorInfo> callback) { 692 Handle<ExecutableAccessorInfo> callback) {
700 Register holder_reg = Frontend(name); 693 Register holder_reg = Frontend(name);
701 694
702 __ Push(receiver(), holder_reg); // Receiver. 695 __ Push(receiver(), holder_reg); // Receiver.
703 // If the callback cannot leak, then push the callback directly, 696 // If the callback cannot leak, then push the callback directly,
704 // otherwise wrap it in a weak cell. 697 // otherwise wrap it in a weak cell.
705 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { 698 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) {
706 __ li(at, Operand(callback)); 699 __ li(at, Operand(callback));
707 } else { 700 } else {
708 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); 701 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback);
709 __ li(at, Operand(cell)); 702 __ li(at, Operand(cell));
710 } 703 }
711 __ push(at); 704 __ push(at);
712 __ li(at, Operand(name)); 705 __ li(at, Operand(name));
713 __ Push(at, value()); 706 __ Push(at, value());
714 707
715 // Do tail-call to the runtime system. 708 // Do tail-call to the runtime system.
716 ExternalReference store_callback_property = 709 __ TailCallRuntime(Runtime::kStoreCallbackProperty, 5, 1);
717 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate());
718 __ TailCallExternalReference(store_callback_property, 5, 1);
719 710
720 // Return the generated code. 711 // Return the generated code.
721 return GetCode(kind(), Code::FAST, name); 712 return GetCode(kind(), Code::FAST, name);
722 } 713 }
723 714
724 715
725 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( 716 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor(
726 Handle<Name> name) { 717 Handle<Name> name) {
727 __ Push(receiver(), this->name(), value()); 718 __ Push(receiver(), this->name(), value());
728 719
729 // Do tail-call to the runtime system. 720 // Do tail-call to the runtime system.
730 ExternalReference store_ic_property = ExternalReference( 721 __ TailCallRuntime(Runtime::kStorePropertyWithInterceptor, 3, 1);
731 IC_Utility(IC::kStorePropertyWithInterceptor), isolate());
732 __ TailCallExternalReference(store_ic_property, 3, 1);
733 722
734 // Return the generated code. 723 // Return the generated code.
735 return GetCode(kind(), Code::FAST, name); 724 return GetCode(kind(), Code::FAST, name);
736 } 725 }
737 726
738 727
739 Register NamedStoreHandlerCompiler::value() { 728 Register NamedStoreHandlerCompiler::value() {
740 return StoreDescriptor::ValueRegister(); 729 return StoreDescriptor::ValueRegister();
741 } 730 }
742 731
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 // Return the generated code. 764 // Return the generated code.
776 return GetCode(kind(), Code::NORMAL, name); 765 return GetCode(kind(), Code::NORMAL, name);
777 } 766 }
778 767
779 768
780 #undef __ 769 #undef __
781 } // namespace internal 770 } // namespace internal
782 } // namespace v8 771 } // namespace v8
783 772
784 #endif // V8_TARGET_ARCH_MIPS 773 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ic/ic.cc ('k') | src/ic/mips/ic-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698