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

Side by Side Diff: src/mips/lithium-codegen-mips.cc

Issue 767743002: Hydrogen code stubs for vector-based ICs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. Created 6 years 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/mips/code-stubs-mips.cc ('k') | src/mips/lithium-mips.h » ('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 2012 the V8 project authors. All rights reserved.7 1 // Copyright 2012 the V8 project authors. All rights reserved.7
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2871 matching lines...) Expand 10 before | Expand all | Expand 10 after
2882 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 2882 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
2883 DeoptimizeIf(eq, instr, "hole", result, Operand(at)); 2883 DeoptimizeIf(eq, instr, "hole", result, Operand(at));
2884 } 2884 }
2885 } 2885 }
2886 2886
2887 2887
2888 template <class T> 2888 template <class T>
2889 void LCodeGen::EmitVectorLoadICRegisters(T* instr) { 2889 void LCodeGen::EmitVectorLoadICRegisters(T* instr) {
2890 DCHECK(FLAG_vector_ics); 2890 DCHECK(FLAG_vector_ics);
2891 Register vector_register = ToRegister(instr->temp_vector()); 2891 Register vector_register = ToRegister(instr->temp_vector());
2892 Register slot_register = VectorLoadICDescriptor::SlotRegister();
2892 DCHECK(vector_register.is(VectorLoadICDescriptor::VectorRegister())); 2893 DCHECK(vector_register.is(VectorLoadICDescriptor::VectorRegister()));
2894 DCHECK(slot_register.is(a0));
2895
2896 AllowDeferredHandleDereference vector_structure_check;
2893 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); 2897 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector();
2894 __ li(vector_register, vector); 2898 __ li(vector_register, vector);
2895 // No need to allocate this register. 2899 // No need to allocate this register.
2896 DCHECK(VectorLoadICDescriptor::SlotRegister().is(a0)); 2900 FeedbackVectorICSlot slot = instr->hydrogen()->slot();
2897 int index = vector->GetIndex(instr->hydrogen()->slot()); 2901 int index = vector->GetIndex(slot);
2898 __ li(VectorLoadICDescriptor::SlotRegister(), Operand(Smi::FromInt(index))); 2902 __ li(slot_register, Operand(Smi::FromInt(index)));
2899 } 2903 }
2900 2904
2901 2905
2902 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { 2906 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
2903 DCHECK(ToRegister(instr->context()).is(cp)); 2907 DCHECK(ToRegister(instr->context()).is(cp));
2904 DCHECK(ToRegister(instr->global_object()) 2908 DCHECK(ToRegister(instr->global_object())
2905 .is(LoadDescriptor::ReceiverRegister())); 2909 .is(LoadDescriptor::ReceiverRegister()));
2906 DCHECK(ToRegister(instr->result()).is(v0)); 2910 DCHECK(ToRegister(instr->result()).is(v0));
2907 2911
2908 __ li(LoadDescriptor::NameRegister(), Operand(instr->name())); 2912 __ li(LoadDescriptor::NameRegister(), Operand(instr->name()));
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
3940 3944
3941 void LCodeGen::DoTailCallThroughMegamorphicCache( 3945 void LCodeGen::DoTailCallThroughMegamorphicCache(
3942 LTailCallThroughMegamorphicCache* instr) { 3946 LTailCallThroughMegamorphicCache* instr) {
3943 Register receiver = ToRegister(instr->receiver()); 3947 Register receiver = ToRegister(instr->receiver());
3944 Register name = ToRegister(instr->name()); 3948 Register name = ToRegister(instr->name());
3945 DCHECK(receiver.is(LoadDescriptor::ReceiverRegister())); 3949 DCHECK(receiver.is(LoadDescriptor::ReceiverRegister()));
3946 DCHECK(name.is(LoadDescriptor::NameRegister())); 3950 DCHECK(name.is(LoadDescriptor::NameRegister()));
3947 DCHECK(receiver.is(a1)); 3951 DCHECK(receiver.is(a1));
3948 DCHECK(name.is(a2)); 3952 DCHECK(name.is(a2));
3949 3953
3950 Register scratch = a3; 3954 Register scratch = t0;
3951 Register extra = t0; 3955 Register extra = t1;
3952 Register extra2 = t1; 3956 Register extra2 = t2;
3953 Register extra3 = t2; 3957 Register extra3 = t5;
3958 #ifdef DEBUG
3959 Register slot = FLAG_vector_ics ? ToRegister(instr->slot()) : no_reg;
3960 Register vector = FLAG_vector_ics ? ToRegister(instr->vector()) : no_reg;
3961 DCHECK(!FLAG_vector_ics ||
3962 !AreAliased(slot, vector, scratch, extra, extra2, extra3));
3963 #endif
3954 3964
3955 // Important for the tail-call. 3965 // Important for the tail-call.
3956 bool must_teardown_frame = NeedsEagerFrame(); 3966 bool must_teardown_frame = NeedsEagerFrame();
3957 3967
3958 // The probe will tail call to a handler if found. 3968 if (!instr->hydrogen()->is_just_miss()) {
3959 isolate()->stub_cache()->GenerateProbe(masm(), instr->hydrogen()->flags(), 3969 DCHECK(!instr->hydrogen()->is_keyed_load());
3960 must_teardown_frame, receiver, name, 3970
3961 scratch, extra, extra2, extra3); 3971 // The probe will tail call to a handler if found.
3972 isolate()->stub_cache()->GenerateProbe(
3973 masm(), Code::LOAD_IC, instr->hydrogen()->flags(), must_teardown_frame,
3974 receiver, name, scratch, extra, extra2, extra3);
3975 }
3962 3976
3963 // Tail call to miss if we ended up here. 3977 // Tail call to miss if we ended up here.
3964 if (must_teardown_frame) __ LeaveFrame(StackFrame::INTERNAL); 3978 if (must_teardown_frame) __ LeaveFrame(StackFrame::INTERNAL);
3965 LoadIC::GenerateMiss(masm()); 3979 if (instr->hydrogen()->is_keyed_load()) {
3980 KeyedLoadIC::GenerateMiss(masm());
3981 } else {
3982 LoadIC::GenerateMiss(masm());
3983 }
3966 } 3984 }
3967 3985
3968 3986
3969 void LCodeGen::DoCallWithDescriptor(LCallWithDescriptor* instr) { 3987 void LCodeGen::DoCallWithDescriptor(LCallWithDescriptor* instr) {
3970 DCHECK(ToRegister(instr->result()).is(v0)); 3988 DCHECK(ToRegister(instr->result()).is(v0));
3971 3989
3972 LPointerMap* pointers = instr->pointer_map(); 3990 if (instr->hydrogen()->IsTailCall()) {
3973 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); 3991 if (NeedsEagerFrame()) __ LeaveFrame(StackFrame::INTERNAL);
3974 3992
3975 if (instr->target()->IsConstantOperand()) { 3993 if (instr->target()->IsConstantOperand()) {
3976 LConstantOperand* target = LConstantOperand::cast(instr->target()); 3994 LConstantOperand* target = LConstantOperand::cast(instr->target());
3977 Handle<Code> code = Handle<Code>::cast(ToHandle(target)); 3995 Handle<Code> code = Handle<Code>::cast(ToHandle(target));
3978 generator.BeforeCall(__ CallSize(code, RelocInfo::CODE_TARGET)); 3996 __ Jump(code, RelocInfo::CODE_TARGET);
3979 __ Call(code, RelocInfo::CODE_TARGET); 3997 } else {
3998 DCHECK(instr->target()->IsRegister());
3999 Register target = ToRegister(instr->target());
4000 __ Addu(target, target, Operand(Code::kHeaderSize - kHeapObjectTag));
4001 __ Jump(target);
4002 }
3980 } else { 4003 } else {
3981 DCHECK(instr->target()->IsRegister()); 4004 LPointerMap* pointers = instr->pointer_map();
3982 Register target = ToRegister(instr->target()); 4005 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt);
3983 generator.BeforeCall(__ CallSize(target)); 4006
3984 __ Addu(target, target, Operand(Code::kHeaderSize - kHeapObjectTag)); 4007 if (instr->target()->IsConstantOperand()) {
3985 __ Call(target); 4008 LConstantOperand* target = LConstantOperand::cast(instr->target());
4009 Handle<Code> code = Handle<Code>::cast(ToHandle(target));
4010 generator.BeforeCall(__ CallSize(code, RelocInfo::CODE_TARGET));
4011 __ Call(code, RelocInfo::CODE_TARGET);
4012 } else {
4013 DCHECK(instr->target()->IsRegister());
4014 Register target = ToRegister(instr->target());
4015 generator.BeforeCall(__ CallSize(target));
4016 __ Addu(target, target, Operand(Code::kHeaderSize - kHeapObjectTag));
4017 __ Call(target);
4018 }
4019 generator.AfterCall();
3986 } 4020 }
3987 generator.AfterCall();
3988 } 4021 }
3989 4022
3990 4023
3991 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { 4024 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) {
3992 DCHECK(ToRegister(instr->function()).is(a1)); 4025 DCHECK(ToRegister(instr->function()).is(a1));
3993 DCHECK(ToRegister(instr->result()).is(v0)); 4026 DCHECK(ToRegister(instr->result()).is(v0));
3994 4027
3995 if (instr->hydrogen()->pass_argument_count()) { 4028 if (instr->hydrogen()->pass_argument_count()) {
3996 __ li(a0, Operand(instr->arity())); 4029 __ li(a0, Operand(instr->arity()));
3997 } 4030 }
(...skipping 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after
5928 __ li(at, scope_info); 5961 __ li(at, scope_info);
5929 __ Push(at, ToRegister(instr->function())); 5962 __ Push(at, ToRegister(instr->function()));
5930 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5963 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5931 RecordSafepoint(Safepoint::kNoLazyDeopt); 5964 RecordSafepoint(Safepoint::kNoLazyDeopt);
5932 } 5965 }
5933 5966
5934 5967
5935 #undef __ 5968 #undef __
5936 5969
5937 } } // namespace v8::internal 5970 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/mips/lithium-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698