OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1958 | 1958 |
1959 // result = receiver[f](arg); | 1959 // result = receiver[f](arg); |
1960 __ bind(&l_call); | 1960 __ bind(&l_call); |
1961 __ mov(load_receiver, Operand(esp, kPointerSize)); | 1961 __ mov(load_receiver, Operand(esp, kPointerSize)); |
1962 __ mov(LoadDescriptor::SlotRegister(), | 1962 __ mov(LoadDescriptor::SlotRegister(), |
1963 Immediate(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); | 1963 Immediate(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); |
1964 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); | 1964 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); |
1965 CallIC(ic, TypeFeedbackId::None()); | 1965 CallIC(ic, TypeFeedbackId::None()); |
1966 __ mov(edi, eax); | 1966 __ mov(edi, eax); |
1967 __ mov(Operand(esp, 2 * kPointerSize), edi); | 1967 __ mov(Operand(esp, 2 * kPointerSize), edi); |
1968 SetCallPosition(expr, 1); | 1968 SetCallPosition(expr); |
1969 __ Set(eax, 1); | 1969 __ Set(eax, 1); |
1970 __ Call( | 1970 __ Call( |
1971 isolate()->builtins()->Call(ConvertReceiverMode::kNotNullOrUndefined), | 1971 isolate()->builtins()->Call(ConvertReceiverMode::kNotNullOrUndefined), |
1972 RelocInfo::CODE_TARGET); | 1972 RelocInfo::CODE_TARGET); |
1973 | 1973 |
1974 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 1974 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
1975 __ Drop(1); // The function is still on the stack; drop it. | 1975 __ Drop(1); // The function is still on the stack; drop it. |
1976 | 1976 |
1977 // if (!result.done) goto l_try; | 1977 // if (!result.done) goto l_try; |
1978 __ bind(&l_loop); | 1978 __ bind(&l_loop); |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2756 | 2756 |
2757 void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { | 2757 void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { |
2758 // Load the arguments. | 2758 // Load the arguments. |
2759 ZoneList<Expression*>* args = expr->arguments(); | 2759 ZoneList<Expression*>* args = expr->arguments(); |
2760 int arg_count = args->length(); | 2760 int arg_count = args->length(); |
2761 for (int i = 0; i < arg_count; i++) { | 2761 for (int i = 0; i < arg_count; i++) { |
2762 VisitForStackValue(args->at(i)); | 2762 VisitForStackValue(args->at(i)); |
2763 } | 2763 } |
2764 | 2764 |
2765 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); | 2765 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); |
2766 SetCallPosition(expr, arg_count); | 2766 SetCallPosition(expr); |
2767 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, mode).code(); | 2767 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, mode).code(); |
2768 __ Move(edx, Immediate(SmiFromSlot(expr->CallFeedbackICSlot()))); | 2768 __ Move(edx, Immediate(SmiFromSlot(expr->CallFeedbackICSlot()))); |
2769 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); | 2769 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); |
2770 // Don't assign a type feedback id to the IC, since type feedback is provided | 2770 // Don't assign a type feedback id to the IC, since type feedback is provided |
2771 // by the vector above. | 2771 // by the vector above. |
2772 CallIC(ic); | 2772 CallIC(ic); |
2773 | 2773 |
2774 RecordJSReturnSite(expr); | 2774 RecordJSReturnSite(expr); |
2775 | 2775 |
2776 // Restore context register. | 2776 // Restore context register. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2860 // Push a copy of the function (found below the arguments) and | 2860 // Push a copy of the function (found below the arguments) and |
2861 // resolve eval. | 2861 // resolve eval. |
2862 __ push(Operand(esp, (arg_count + 1) * kPointerSize)); | 2862 __ push(Operand(esp, (arg_count + 1) * kPointerSize)); |
2863 EmitResolvePossiblyDirectEval(arg_count); | 2863 EmitResolvePossiblyDirectEval(arg_count); |
2864 | 2864 |
2865 // Touch up the stack with the resolved function. | 2865 // Touch up the stack with the resolved function. |
2866 __ mov(Operand(esp, (arg_count + 1) * kPointerSize), eax); | 2866 __ mov(Operand(esp, (arg_count + 1) * kPointerSize), eax); |
2867 | 2867 |
2868 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | 2868 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
2869 | 2869 |
2870 SetCallPosition(expr, arg_count); | 2870 SetCallPosition(expr); |
2871 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); | 2871 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); |
2872 __ Set(eax, arg_count); | 2872 __ Set(eax, arg_count); |
2873 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 2873 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
2874 RecordJSReturnSite(expr); | 2874 RecordJSReturnSite(expr); |
2875 // Restore context register. | 2875 // Restore context register. |
2876 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2876 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
2877 context()->DropAndPlug(1, eax); | 2877 context()->DropAndPlug(1, eax); |
2878 } | 2878 } |
2879 | 2879 |
2880 | 2880 |
(...skipping 11 matching lines...) Expand all Loading... |
2892 | 2892 |
2893 // Push the arguments ("left-to-right") on the stack. | 2893 // Push the arguments ("left-to-right") on the stack. |
2894 ZoneList<Expression*>* args = expr->arguments(); | 2894 ZoneList<Expression*>* args = expr->arguments(); |
2895 int arg_count = args->length(); | 2895 int arg_count = args->length(); |
2896 for (int i = 0; i < arg_count; i++) { | 2896 for (int i = 0; i < arg_count; i++) { |
2897 VisitForStackValue(args->at(i)); | 2897 VisitForStackValue(args->at(i)); |
2898 } | 2898 } |
2899 | 2899 |
2900 // Call the construct call builtin that handles allocation and | 2900 // Call the construct call builtin that handles allocation and |
2901 // constructor invocation. | 2901 // constructor invocation. |
2902 SetConstructCallPosition(expr, arg_count); | 2902 SetConstructCallPosition(expr); |
2903 | 2903 |
2904 // Load function and argument count into edi and eax. | 2904 // Load function and argument count into edi and eax. |
2905 __ Move(eax, Immediate(arg_count)); | 2905 __ Move(eax, Immediate(arg_count)); |
2906 __ mov(edi, Operand(esp, arg_count * kPointerSize)); | 2906 __ mov(edi, Operand(esp, arg_count * kPointerSize)); |
2907 | 2907 |
2908 // Record call targets in unoptimized code. | 2908 // Record call targets in unoptimized code. |
2909 __ EmitLoadTypeFeedbackVector(ebx); | 2909 __ EmitLoadTypeFeedbackVector(ebx); |
2910 __ mov(edx, Immediate(SmiFromSlot(expr->CallNewFeedbackSlot()))); | 2910 __ mov(edx, Immediate(SmiFromSlot(expr->CallNewFeedbackSlot()))); |
2911 | 2911 |
2912 Handle<Code> code = CodeFactory::ConstructIC(isolate()).code(); | 2912 Handle<Code> code = CodeFactory::ConstructIC(isolate()).code(); |
(...skipping 15 matching lines...) Expand all Loading... |
2928 | 2928 |
2929 // Push the arguments ("left-to-right") on the stack. | 2929 // Push the arguments ("left-to-right") on the stack. |
2930 ZoneList<Expression*>* args = expr->arguments(); | 2930 ZoneList<Expression*>* args = expr->arguments(); |
2931 int arg_count = args->length(); | 2931 int arg_count = args->length(); |
2932 for (int i = 0; i < arg_count; i++) { | 2932 for (int i = 0; i < arg_count; i++) { |
2933 VisitForStackValue(args->at(i)); | 2933 VisitForStackValue(args->at(i)); |
2934 } | 2934 } |
2935 | 2935 |
2936 // Call the construct call builtin that handles allocation and | 2936 // Call the construct call builtin that handles allocation and |
2937 // constructor invocation. | 2937 // constructor invocation. |
2938 SetConstructCallPosition(expr, arg_count); | 2938 SetConstructCallPosition(expr); |
2939 | 2939 |
2940 // Load new target into edx. | 2940 // Load new target into edx. |
2941 VisitForAccumulatorValue(super_call_ref->new_target_var()); | 2941 VisitForAccumulatorValue(super_call_ref->new_target_var()); |
2942 __ mov(edx, result_register()); | 2942 __ mov(edx, result_register()); |
2943 | 2943 |
2944 // Load function and argument count into edi and eax. | 2944 // Load function and argument count into edi and eax. |
2945 __ Move(eax, Immediate(arg_count)); | 2945 __ Move(eax, Immediate(arg_count)); |
2946 __ mov(edi, Operand(esp, arg_count * kPointerSize)); | 2946 __ mov(edi, Operand(esp, arg_count * kPointerSize)); |
2947 | 2947 |
2948 __ Call(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 2948 __ Call(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3666 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { | 3666 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { |
3667 ZoneList<Expression*>* args = expr->arguments(); | 3667 ZoneList<Expression*>* args = expr->arguments(); |
3668 DCHECK(args->length() == 2); | 3668 DCHECK(args->length() == 2); |
3669 | 3669 |
3670 // Evaluate new.target and super constructor. | 3670 // Evaluate new.target and super constructor. |
3671 VisitForStackValue(args->at(0)); | 3671 VisitForStackValue(args->at(0)); |
3672 VisitForStackValue(args->at(1)); | 3672 VisitForStackValue(args->at(1)); |
3673 | 3673 |
3674 // Call the construct call builtin that handles allocation and | 3674 // Call the construct call builtin that handles allocation and |
3675 // constructor invocation. | 3675 // constructor invocation. |
3676 SetConstructCallPosition(expr, 0); | 3676 SetConstructCallPosition(expr); |
3677 | 3677 |
3678 // Check if the calling frame is an arguments adaptor frame. | 3678 // Check if the calling frame is an arguments adaptor frame. |
3679 Label adaptor_frame, args_set_up, runtime; | 3679 Label adaptor_frame, args_set_up, runtime; |
3680 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); | 3680 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
3681 __ mov(ebx, Operand(edx, StandardFrameConstants::kContextOffset)); | 3681 __ mov(ebx, Operand(edx, StandardFrameConstants::kContextOffset)); |
3682 __ cmp(ebx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 3682 __ cmp(ebx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
3683 __ j(equal, &adaptor_frame); | 3683 __ j(equal, &adaptor_frame); |
3684 // default constructor has no arguments, so no adaptor frame means no args. | 3684 // default constructor has no arguments, so no adaptor frame means no args. |
3685 __ mov(eax, Immediate(0)); | 3685 __ mov(eax, Immediate(0)); |
3686 __ jmp(&args_set_up); | 3686 __ jmp(&args_set_up); |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4066 __ push(Immediate(isolate()->factory()->undefined_value())); | 4066 __ push(Immediate(isolate()->factory()->undefined_value())); |
4067 | 4067 |
4068 __ LoadGlobalFunction(expr->context_index(), eax); | 4068 __ LoadGlobalFunction(expr->context_index(), eax); |
4069 } | 4069 } |
4070 | 4070 |
4071 | 4071 |
4072 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 4072 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
4073 ZoneList<Expression*>* args = expr->arguments(); | 4073 ZoneList<Expression*>* args = expr->arguments(); |
4074 int arg_count = args->length(); | 4074 int arg_count = args->length(); |
4075 | 4075 |
4076 SetCallPosition(expr, arg_count); | 4076 SetCallPosition(expr); |
4077 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); | 4077 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); |
4078 __ Set(eax, arg_count); | 4078 __ Set(eax, arg_count); |
4079 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), | 4079 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), |
4080 RelocInfo::CODE_TARGET); | 4080 RelocInfo::CODE_TARGET); |
4081 } | 4081 } |
4082 | 4082 |
4083 | 4083 |
4084 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | 4084 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
4085 ZoneList<Expression*>* args = expr->arguments(); | 4085 ZoneList<Expression*>* args = expr->arguments(); |
4086 int arg_count = args->length(); | 4086 int arg_count = args->length(); |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4872 Assembler::target_address_at(call_target_address, | 4872 Assembler::target_address_at(call_target_address, |
4873 unoptimized_code)); | 4873 unoptimized_code)); |
4874 return OSR_AFTER_STACK_CHECK; | 4874 return OSR_AFTER_STACK_CHECK; |
4875 } | 4875 } |
4876 | 4876 |
4877 | 4877 |
4878 } // namespace internal | 4878 } // namespace internal |
4879 } // namespace v8 | 4879 } // namespace v8 |
4880 | 4880 |
4881 #endif // V8_TARGET_ARCH_IA32 | 4881 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |