| 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_ARM | 5 #if V8_TARGET_ARCH_ARM |
| 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 3013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3024 __ jmp(&done); | 3024 __ jmp(&done); |
| 3025 | 3025 |
| 3026 NopRuntimeCallHelper call_helper; | 3026 NopRuntimeCallHelper call_helper; |
| 3027 generator.GenerateSlow(masm_, NOT_PART_OF_IC_HANDLER, call_helper); | 3027 generator.GenerateSlow(masm_, NOT_PART_OF_IC_HANDLER, call_helper); |
| 3028 | 3028 |
| 3029 __ bind(&done); | 3029 __ bind(&done); |
| 3030 context()->Plug(result); | 3030 context()->Plug(result); |
| 3031 } | 3031 } |
| 3032 | 3032 |
| 3033 | 3033 |
| 3034 void FullCodeGenerator::EmitStringCharAt(CallRuntime* expr) { | |
| 3035 ZoneList<Expression*>* args = expr->arguments(); | |
| 3036 DCHECK(args->length() == 2); | |
| 3037 VisitForStackValue(args->at(0)); | |
| 3038 VisitForAccumulatorValue(args->at(1)); | |
| 3039 | |
| 3040 Register object = r1; | |
| 3041 Register index = r0; | |
| 3042 Register scratch = r3; | |
| 3043 Register result = r0; | |
| 3044 | |
| 3045 PopOperand(object); | |
| 3046 | |
| 3047 Label need_conversion; | |
| 3048 Label index_out_of_range; | |
| 3049 Label done; | |
| 3050 StringCharAtGenerator generator(object, | |
| 3051 index, | |
| 3052 scratch, | |
| 3053 result, | |
| 3054 &need_conversion, | |
| 3055 &need_conversion, | |
| 3056 &index_out_of_range, | |
| 3057 STRING_INDEX_IS_NUMBER); | |
| 3058 generator.GenerateFast(masm_); | |
| 3059 __ jmp(&done); | |
| 3060 | |
| 3061 __ bind(&index_out_of_range); | |
| 3062 // When the index is out of range, the spec requires us to return | |
| 3063 // the empty string. | |
| 3064 __ LoadRoot(result, Heap::kempty_stringRootIndex); | |
| 3065 __ jmp(&done); | |
| 3066 | |
| 3067 __ bind(&need_conversion); | |
| 3068 // Move smi zero into the result register, which will trigger | |
| 3069 // conversion. | |
| 3070 __ mov(result, Operand(Smi::FromInt(0))); | |
| 3071 __ jmp(&done); | |
| 3072 | |
| 3073 NopRuntimeCallHelper call_helper; | |
| 3074 generator.GenerateSlow(masm_, NOT_PART_OF_IC_HANDLER, call_helper); | |
| 3075 | |
| 3076 __ bind(&done); | |
| 3077 context()->Plug(result); | |
| 3078 } | |
| 3079 | |
| 3080 | |
| 3081 void FullCodeGenerator::EmitCall(CallRuntime* expr) { | 3034 void FullCodeGenerator::EmitCall(CallRuntime* expr) { |
| 3082 ZoneList<Expression*>* args = expr->arguments(); | 3035 ZoneList<Expression*>* args = expr->arguments(); |
| 3083 DCHECK_LE(2, args->length()); | 3036 DCHECK_LE(2, args->length()); |
| 3084 // Push target, receiver and arguments onto the stack. | 3037 // Push target, receiver and arguments onto the stack. |
| 3085 for (Expression* const arg : *args) { | 3038 for (Expression* const arg : *args) { |
| 3086 VisitForStackValue(arg); | 3039 VisitForStackValue(arg); |
| 3087 } | 3040 } |
| 3088 PrepareForBailoutForId(expr->CallId(), BailoutState::NO_REGISTERS); | 3041 PrepareForBailoutForId(expr->CallId(), BailoutState::NO_REGISTERS); |
| 3089 // Move target to r1. | 3042 // Move target to r1. |
| 3090 int const argc = args->length() - 2; | 3043 int const argc = args->length() - 2; |
| (...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4001 DCHECK(interrupt_address == | 3954 DCHECK(interrupt_address == |
| 4002 isolate->builtins()->OnStackReplacement()->entry()); | 3955 isolate->builtins()->OnStackReplacement()->entry()); |
| 4003 return ON_STACK_REPLACEMENT; | 3956 return ON_STACK_REPLACEMENT; |
| 4004 } | 3957 } |
| 4005 | 3958 |
| 4006 | 3959 |
| 4007 } // namespace internal | 3960 } // namespace internal |
| 4008 } // namespace v8 | 3961 } // namespace v8 |
| 4009 | 3962 |
| 4010 #endif // V8_TARGET_ARCH_ARM | 3963 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |