OLD | NEW |
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 2889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2900 __ Jump(ra); | 2900 __ Jump(ra); |
2901 | 2901 |
2902 if (no_frame_start != -1) { | 2902 if (no_frame_start != -1) { |
2903 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); | 2903 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); |
2904 } | 2904 } |
2905 } | 2905 } |
2906 | 2906 |
2907 | 2907 |
2908 template <class T> | 2908 template <class T> |
2909 void LCodeGen::EmitVectorLoadICRegisters(T* instr) { | 2909 void LCodeGen::EmitVectorLoadICRegisters(T* instr) { |
2910 DCHECK(FLAG_vector_ics); | |
2911 Register vector_register = ToRegister(instr->temp_vector()); | 2910 Register vector_register = ToRegister(instr->temp_vector()); |
2912 Register slot_register = VectorLoadICDescriptor::SlotRegister(); | 2911 Register slot_register = VectorLoadICDescriptor::SlotRegister(); |
2913 DCHECK(vector_register.is(VectorLoadICDescriptor::VectorRegister())); | 2912 DCHECK(vector_register.is(VectorLoadICDescriptor::VectorRegister())); |
2914 DCHECK(slot_register.is(a0)); | 2913 DCHECK(slot_register.is(a0)); |
2915 | 2914 |
2916 AllowDeferredHandleDereference vector_structure_check; | 2915 AllowDeferredHandleDereference vector_structure_check; |
2917 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); | 2916 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); |
2918 __ li(vector_register, vector); | 2917 __ li(vector_register, vector); |
2919 // No need to allocate this register. | 2918 // No need to allocate this register. |
2920 FeedbackVectorICSlot slot = instr->hydrogen()->slot(); | 2919 FeedbackVectorICSlot slot = instr->hydrogen()->slot(); |
2921 int index = vector->GetIndex(slot); | 2920 int index = vector->GetIndex(slot); |
2922 __ li(slot_register, Operand(Smi::FromInt(index))); | 2921 __ li(slot_register, Operand(Smi::FromInt(index))); |
2923 } | 2922 } |
2924 | 2923 |
2925 | 2924 |
2926 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { | 2925 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { |
2927 DCHECK(ToRegister(instr->context()).is(cp)); | 2926 DCHECK(ToRegister(instr->context()).is(cp)); |
2928 DCHECK(ToRegister(instr->global_object()) | 2927 DCHECK(ToRegister(instr->global_object()) |
2929 .is(LoadDescriptor::ReceiverRegister())); | 2928 .is(LoadDescriptor::ReceiverRegister())); |
2930 DCHECK(ToRegister(instr->result()).is(v0)); | 2929 DCHECK(ToRegister(instr->result()).is(v0)); |
2931 | 2930 |
2932 __ li(LoadDescriptor::NameRegister(), Operand(instr->name())); | 2931 __ li(LoadDescriptor::NameRegister(), Operand(instr->name())); |
2933 if (FLAG_vector_ics) { | 2932 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); |
2934 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); | |
2935 } | |
2936 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; | 2933 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; |
2937 Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode, | 2934 Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode, |
2938 PREMONOMORPHIC).code(); | 2935 PREMONOMORPHIC).code(); |
2939 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2936 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2940 } | 2937 } |
2941 | 2938 |
2942 | 2939 |
2943 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2940 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2944 Register context = ToRegister(instr->context()); | 2941 Register context = ToRegister(instr->context()); |
2945 Register result = ToRegister(instr->result()); | 2942 Register result = ToRegister(instr->result()); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3026 } | 3023 } |
3027 | 3024 |
3028 | 3025 |
3029 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 3026 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
3030 DCHECK(ToRegister(instr->context()).is(cp)); | 3027 DCHECK(ToRegister(instr->context()).is(cp)); |
3031 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); | 3028 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); |
3032 DCHECK(ToRegister(instr->result()).is(v0)); | 3029 DCHECK(ToRegister(instr->result()).is(v0)); |
3033 | 3030 |
3034 // Name is always in a2. | 3031 // Name is always in a2. |
3035 __ li(LoadDescriptor::NameRegister(), Operand(instr->name())); | 3032 __ li(LoadDescriptor::NameRegister(), Operand(instr->name())); |
3036 if (FLAG_vector_ics) { | 3033 EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr); |
3037 EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr); | |
3038 } | |
3039 Handle<Code> ic = CodeFactory::LoadICInOptimizedCode( | 3034 Handle<Code> ic = CodeFactory::LoadICInOptimizedCode( |
3040 isolate(), NOT_CONTEXTUAL, | 3035 isolate(), NOT_CONTEXTUAL, |
3041 instr->hydrogen()->initialization_state()).code(); | 3036 instr->hydrogen()->initialization_state()).code(); |
3042 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3037 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3043 } | 3038 } |
3044 | 3039 |
3045 | 3040 |
3046 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { | 3041 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { |
3047 Register scratch = scratch0(); | 3042 Register scratch = scratch0(); |
3048 Register function = ToRegister(instr->function()); | 3043 Register function = ToRegister(instr->function()); |
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3945 ParameterCount count(instr->arity()); | 3940 ParameterCount count(instr->arity()); |
3946 __ InvokeFunction(a1, count, CALL_FUNCTION, generator); | 3941 __ InvokeFunction(a1, count, CALL_FUNCTION, generator); |
3947 } else { | 3942 } else { |
3948 CallKnownFunction(known_function, | 3943 CallKnownFunction(known_function, |
3949 instr->hydrogen()->formal_parameter_count(), | 3944 instr->hydrogen()->formal_parameter_count(), |
3950 instr->arity(), instr); | 3945 instr->arity(), instr); |
3951 } | 3946 } |
3952 } | 3947 } |
3953 | 3948 |
3954 | 3949 |
3955 void LCodeGen::DoTailCallThroughMegamorphicCache( | |
3956 LTailCallThroughMegamorphicCache* instr) { | |
3957 Register receiver = ToRegister(instr->receiver()); | |
3958 Register name = ToRegister(instr->name()); | |
3959 DCHECK(receiver.is(LoadDescriptor::ReceiverRegister())); | |
3960 DCHECK(name.is(LoadDescriptor::NameRegister())); | |
3961 DCHECK(receiver.is(a1)); | |
3962 DCHECK(name.is(a2)); | |
3963 | |
3964 Register scratch = t0; | |
3965 Register extra = t1; | |
3966 Register extra2 = t2; | |
3967 Register extra3 = t5; | |
3968 | |
3969 // The probe will tail call to a handler if found. | |
3970 isolate()->stub_cache()->GenerateProbe( | |
3971 masm(), Code::LOAD_IC, instr->hydrogen()->flags(), false, receiver, name, | |
3972 scratch, extra, extra2, extra3); | |
3973 | |
3974 // Tail call to miss if we ended up here. | |
3975 LoadIC::GenerateMiss(masm()); | |
3976 } | |
3977 | |
3978 | |
3979 void LCodeGen::DoCallWithDescriptor(LCallWithDescriptor* instr) { | 3950 void LCodeGen::DoCallWithDescriptor(LCallWithDescriptor* instr) { |
3980 DCHECK(ToRegister(instr->result()).is(v0)); | 3951 DCHECK(ToRegister(instr->result()).is(v0)); |
3981 | 3952 |
3982 if (instr->hydrogen()->IsTailCall()) { | 3953 if (instr->hydrogen()->IsTailCall()) { |
3983 if (NeedsEagerFrame()) __ LeaveFrame(StackFrame::INTERNAL); | 3954 if (NeedsEagerFrame()) __ LeaveFrame(StackFrame::INTERNAL); |
3984 | 3955 |
3985 if (instr->target()->IsConstantOperand()) { | 3956 if (instr->target()->IsConstantOperand()) { |
3986 LConstantOperand* target = LConstantOperand::cast(instr->target()); | 3957 LConstantOperand* target = LConstantOperand::cast(instr->target()); |
3987 Handle<Code> code = Handle<Code>::cast(ToHandle(target)); | 3958 Handle<Code> code = Handle<Code>::cast(ToHandle(target)); |
3988 __ Jump(code, RelocInfo::CODE_TARGET); | 3959 __ Jump(code, RelocInfo::CODE_TARGET); |
(...skipping 2107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6096 __ li(at, scope_info); | 6067 __ li(at, scope_info); |
6097 __ Push(at, ToRegister(instr->function())); | 6068 __ Push(at, ToRegister(instr->function())); |
6098 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6069 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6099 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6070 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6100 } | 6071 } |
6101 | 6072 |
6102 | 6073 |
6103 #undef __ | 6074 #undef __ |
6104 | 6075 |
6105 } } // namespace v8::internal | 6076 } } // namespace v8::internal |
OLD | NEW |