OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
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 2918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2929 __ B(&done); | 2929 __ B(&done); |
2930 | 2930 |
2931 NopRuntimeCallHelper call_helper; | 2931 NopRuntimeCallHelper call_helper; |
2932 generator.GenerateSlow(masm_, NOT_PART_OF_IC_HANDLER, call_helper); | 2932 generator.GenerateSlow(masm_, NOT_PART_OF_IC_HANDLER, call_helper); |
2933 | 2933 |
2934 __ Bind(&done); | 2934 __ Bind(&done); |
2935 context()->Plug(result); | 2935 context()->Plug(result); |
2936 } | 2936 } |
2937 | 2937 |
2938 | 2938 |
2939 void FullCodeGenerator::EmitStringCharAt(CallRuntime* expr) { | |
2940 ZoneList<Expression*>* args = expr->arguments(); | |
2941 DCHECK(args->length() == 2); | |
2942 | |
2943 VisitForStackValue(args->at(0)); | |
2944 VisitForAccumulatorValue(args->at(1)); | |
2945 | |
2946 Register object = x1; | |
2947 Register index = x0; | |
2948 Register result = x0; | |
2949 | |
2950 PopOperand(object); | |
2951 | |
2952 Label need_conversion; | |
2953 Label index_out_of_range; | |
2954 Label done; | |
2955 StringCharAtGenerator generator(object, | |
2956 index, | |
2957 x3, | |
2958 result, | |
2959 &need_conversion, | |
2960 &need_conversion, | |
2961 &index_out_of_range, | |
2962 STRING_INDEX_IS_NUMBER); | |
2963 generator.GenerateFast(masm_); | |
2964 __ B(&done); | |
2965 | |
2966 __ Bind(&index_out_of_range); | |
2967 // When the index is out of range, the spec requires us to return | |
2968 // the empty string. | |
2969 __ LoadRoot(result, Heap::kempty_stringRootIndex); | |
2970 __ B(&done); | |
2971 | |
2972 __ Bind(&need_conversion); | |
2973 // Move smi zero into the result register, which will trigger conversion. | |
2974 __ Mov(result, Smi::FromInt(0)); | |
2975 __ B(&done); | |
2976 | |
2977 NopRuntimeCallHelper call_helper; | |
2978 generator.GenerateSlow(masm_, NOT_PART_OF_IC_HANDLER, call_helper); | |
2979 | |
2980 __ Bind(&done); | |
2981 context()->Plug(result); | |
2982 } | |
2983 | |
2984 | |
2985 void FullCodeGenerator::EmitCall(CallRuntime* expr) { | 2939 void FullCodeGenerator::EmitCall(CallRuntime* expr) { |
2986 ASM_LOCATION("FullCodeGenerator::EmitCall"); | 2940 ASM_LOCATION("FullCodeGenerator::EmitCall"); |
2987 ZoneList<Expression*>* args = expr->arguments(); | 2941 ZoneList<Expression*>* args = expr->arguments(); |
2988 DCHECK_LE(2, args->length()); | 2942 DCHECK_LE(2, args->length()); |
2989 // Push target, receiver and arguments onto the stack. | 2943 // Push target, receiver and arguments onto the stack. |
2990 for (Expression* const arg : *args) { | 2944 for (Expression* const arg : *args) { |
2991 VisitForStackValue(arg); | 2945 VisitForStackValue(arg); |
2992 } | 2946 } |
2993 PrepareForBailoutForId(expr->CallId(), BailoutState::NO_REGISTERS); | 2947 PrepareForBailoutForId(expr->CallId(), BailoutState::NO_REGISTERS); |
2994 // Move target to x1. | 2948 // Move target to x1. |
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4002 } | 3956 } |
4003 | 3957 |
4004 return INTERRUPT; | 3958 return INTERRUPT; |
4005 } | 3959 } |
4006 | 3960 |
4007 | 3961 |
4008 } // namespace internal | 3962 } // namespace internal |
4009 } // namespace v8 | 3963 } // namespace v8 |
4010 | 3964 |
4011 #endif // V8_TARGET_ARCH_ARM64 | 3965 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |