| 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 2907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2918 __ jmp(&done); | 2918 __ jmp(&done); |
| 2919 | 2919 |
| 2920 NopRuntimeCallHelper call_helper; | 2920 NopRuntimeCallHelper call_helper; |
| 2921 generator.GenerateSlow(masm_, NOT_PART_OF_IC_HANDLER, call_helper); | 2921 generator.GenerateSlow(masm_, NOT_PART_OF_IC_HANDLER, call_helper); |
| 2922 | 2922 |
| 2923 __ bind(&done); | 2923 __ bind(&done); |
| 2924 context()->Plug(result); | 2924 context()->Plug(result); |
| 2925 } | 2925 } |
| 2926 | 2926 |
| 2927 | 2927 |
| 2928 void FullCodeGenerator::EmitStringCharAt(CallRuntime* expr) { | |
| 2929 ZoneList<Expression*>* args = expr->arguments(); | |
| 2930 DCHECK(args->length() == 2); | |
| 2931 | |
| 2932 VisitForStackValue(args->at(0)); | |
| 2933 VisitForAccumulatorValue(args->at(1)); | |
| 2934 | |
| 2935 Register object = ebx; | |
| 2936 Register index = eax; | |
| 2937 Register scratch = edx; | |
| 2938 Register result = eax; | |
| 2939 | |
| 2940 PopOperand(object); | |
| 2941 | |
| 2942 Label need_conversion; | |
| 2943 Label index_out_of_range; | |
| 2944 Label done; | |
| 2945 StringCharAtGenerator generator(object, | |
| 2946 index, | |
| 2947 scratch, | |
| 2948 result, | |
| 2949 &need_conversion, | |
| 2950 &need_conversion, | |
| 2951 &index_out_of_range, | |
| 2952 STRING_INDEX_IS_NUMBER); | |
| 2953 generator.GenerateFast(masm_); | |
| 2954 __ jmp(&done); | |
| 2955 | |
| 2956 __ bind(&index_out_of_range); | |
| 2957 // When the index is out of range, the spec requires us to return | |
| 2958 // the empty string. | |
| 2959 __ Move(result, Immediate(isolate()->factory()->empty_string())); | |
| 2960 __ jmp(&done); | |
| 2961 | |
| 2962 __ bind(&need_conversion); | |
| 2963 // Move smi zero into the result register, which will trigger | |
| 2964 // conversion. | |
| 2965 __ Move(result, Immediate(Smi::FromInt(0))); | |
| 2966 __ jmp(&done); | |
| 2967 | |
| 2968 NopRuntimeCallHelper call_helper; | |
| 2969 generator.GenerateSlow(masm_, NOT_PART_OF_IC_HANDLER, call_helper); | |
| 2970 | |
| 2971 __ bind(&done); | |
| 2972 context()->Plug(result); | |
| 2973 } | |
| 2974 | |
| 2975 | |
| 2976 void FullCodeGenerator::EmitCall(CallRuntime* expr) { | 2928 void FullCodeGenerator::EmitCall(CallRuntime* expr) { |
| 2977 ZoneList<Expression*>* args = expr->arguments(); | 2929 ZoneList<Expression*>* args = expr->arguments(); |
| 2978 DCHECK_LE(2, args->length()); | 2930 DCHECK_LE(2, args->length()); |
| 2979 // Push target, receiver and arguments onto the stack. | 2931 // Push target, receiver and arguments onto the stack. |
| 2980 for (Expression* const arg : *args) { | 2932 for (Expression* const arg : *args) { |
| 2981 VisitForStackValue(arg); | 2933 VisitForStackValue(arg); |
| 2982 } | 2934 } |
| 2983 PrepareForBailoutForId(expr->CallId(), BailoutState::NO_REGISTERS); | 2935 PrepareForBailoutForId(expr->CallId(), BailoutState::NO_REGISTERS); |
| 2984 // Move target to edi. | 2936 // Move target to edi. |
| 2985 int const argc = args->length() - 2; | 2937 int const argc = args->length() - 2; |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3839 isolate->builtins()->OnStackReplacement()->entry(), | 3791 isolate->builtins()->OnStackReplacement()->entry(), |
| 3840 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3792 Assembler::target_address_at(call_target_address, unoptimized_code)); |
| 3841 return ON_STACK_REPLACEMENT; | 3793 return ON_STACK_REPLACEMENT; |
| 3842 } | 3794 } |
| 3843 | 3795 |
| 3844 | 3796 |
| 3845 } // namespace internal | 3797 } // namespace internal |
| 3846 } // namespace v8 | 3798 } // namespace v8 |
| 3847 | 3799 |
| 3848 #endif // V8_TARGET_ARCH_IA32 | 3800 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |