| 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_X87 | 5 #if V8_TARGET_ARCH_X87 |
| 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 2899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2910 __ jmp(&done); | 2910 __ jmp(&done); |
| 2911 | 2911 |
| 2912 NopRuntimeCallHelper call_helper; | 2912 NopRuntimeCallHelper call_helper; |
| 2913 generator.GenerateSlow(masm_, NOT_PART_OF_IC_HANDLER, call_helper); | 2913 generator.GenerateSlow(masm_, NOT_PART_OF_IC_HANDLER, call_helper); |
| 2914 | 2914 |
| 2915 __ bind(&done); | 2915 __ bind(&done); |
| 2916 context()->Plug(result); | 2916 context()->Plug(result); |
| 2917 } | 2917 } |
| 2918 | 2918 |
| 2919 | 2919 |
| 2920 void FullCodeGenerator::EmitStringCharAt(CallRuntime* expr) { | |
| 2921 ZoneList<Expression*>* args = expr->arguments(); | |
| 2922 DCHECK(args->length() == 2); | |
| 2923 | |
| 2924 VisitForStackValue(args->at(0)); | |
| 2925 VisitForAccumulatorValue(args->at(1)); | |
| 2926 | |
| 2927 Register object = ebx; | |
| 2928 Register index = eax; | |
| 2929 Register scratch = edx; | |
| 2930 Register result = eax; | |
| 2931 | |
| 2932 PopOperand(object); | |
| 2933 | |
| 2934 Label need_conversion; | |
| 2935 Label index_out_of_range; | |
| 2936 Label done; | |
| 2937 StringCharAtGenerator generator(object, | |
| 2938 index, | |
| 2939 scratch, | |
| 2940 result, | |
| 2941 &need_conversion, | |
| 2942 &need_conversion, | |
| 2943 &index_out_of_range, | |
| 2944 STRING_INDEX_IS_NUMBER); | |
| 2945 generator.GenerateFast(masm_); | |
| 2946 __ jmp(&done); | |
| 2947 | |
| 2948 __ bind(&index_out_of_range); | |
| 2949 // When the index is out of range, the spec requires us to return | |
| 2950 // the empty string. | |
| 2951 __ Move(result, Immediate(isolate()->factory()->empty_string())); | |
| 2952 __ jmp(&done); | |
| 2953 | |
| 2954 __ bind(&need_conversion); | |
| 2955 // Move smi zero into the result register, which will trigger | |
| 2956 // conversion. | |
| 2957 __ Move(result, Immediate(Smi::FromInt(0))); | |
| 2958 __ jmp(&done); | |
| 2959 | |
| 2960 NopRuntimeCallHelper call_helper; | |
| 2961 generator.GenerateSlow(masm_, NOT_PART_OF_IC_HANDLER, call_helper); | |
| 2962 | |
| 2963 __ bind(&done); | |
| 2964 context()->Plug(result); | |
| 2965 } | |
| 2966 | |
| 2967 | |
| 2968 void FullCodeGenerator::EmitCall(CallRuntime* expr) { | 2920 void FullCodeGenerator::EmitCall(CallRuntime* expr) { |
| 2969 ZoneList<Expression*>* args = expr->arguments(); | 2921 ZoneList<Expression*>* args = expr->arguments(); |
| 2970 DCHECK_LE(2, args->length()); | 2922 DCHECK_LE(2, args->length()); |
| 2971 // Push target, receiver and arguments onto the stack. | 2923 // Push target, receiver and arguments onto the stack. |
| 2972 for (Expression* const arg : *args) { | 2924 for (Expression* const arg : *args) { |
| 2973 VisitForStackValue(arg); | 2925 VisitForStackValue(arg); |
| 2974 } | 2926 } |
| 2975 PrepareForBailoutForId(expr->CallId(), BailoutState::NO_REGISTERS); | 2927 PrepareForBailoutForId(expr->CallId(), BailoutState::NO_REGISTERS); |
| 2976 // Move target to edi. | 2928 // Move target to edi. |
| 2977 int const argc = args->length() - 2; | 2929 int const argc = args->length() - 2; |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3831 isolate->builtins()->OnStackReplacement()->entry(), | 3783 isolate->builtins()->OnStackReplacement()->entry(), |
| 3832 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3784 Assembler::target_address_at(call_target_address, unoptimized_code)); |
| 3833 return ON_STACK_REPLACEMENT; | 3785 return ON_STACK_REPLACEMENT; |
| 3834 } | 3786 } |
| 3835 | 3787 |
| 3836 | 3788 |
| 3837 } // namespace internal | 3789 } // namespace internal |
| 3838 } // namespace v8 | 3790 } // namespace v8 |
| 3839 | 3791 |
| 3840 #endif // V8_TARGET_ARCH_X87 | 3792 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |