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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
6 | 6 |
7 // Note on Mips implementation: | 7 // Note on Mips implementation: |
8 // | 8 // |
9 // The result_register() for mips is the 'v0' register, which is defined | 9 // The result_register() for mips is the 'v0' register, which is defined |
10 // by the ABI to contain function return values. However, the first | 10 // by the ABI to contain function return values. However, the first |
(...skipping 3030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3041 __ jmp(&done); | 3041 __ jmp(&done); |
3042 | 3042 |
3043 NopRuntimeCallHelper call_helper; | 3043 NopRuntimeCallHelper call_helper; |
3044 generator.GenerateSlow(masm_, NOT_PART_OF_IC_HANDLER, call_helper); | 3044 generator.GenerateSlow(masm_, NOT_PART_OF_IC_HANDLER, call_helper); |
3045 | 3045 |
3046 __ bind(&done); | 3046 __ bind(&done); |
3047 context()->Plug(result); | 3047 context()->Plug(result); |
3048 } | 3048 } |
3049 | 3049 |
3050 | 3050 |
3051 void FullCodeGenerator::EmitStringCharAt(CallRuntime* expr) { | |
3052 ZoneList<Expression*>* args = expr->arguments(); | |
3053 DCHECK(args->length() == 2); | |
3054 | |
3055 VisitForStackValue(args->at(0)); | |
3056 VisitForAccumulatorValue(args->at(1)); | |
3057 __ mov(a0, result_register()); | |
3058 | |
3059 Register object = a1; | |
3060 Register index = a0; | |
3061 Register scratch = a3; | |
3062 Register result = v0; | |
3063 | |
3064 PopOperand(object); | |
3065 | |
3066 Label need_conversion; | |
3067 Label index_out_of_range; | |
3068 Label done; | |
3069 StringCharAtGenerator generator(object, | |
3070 index, | |
3071 scratch, | |
3072 result, | |
3073 &need_conversion, | |
3074 &need_conversion, | |
3075 &index_out_of_range, | |
3076 STRING_INDEX_IS_NUMBER); | |
3077 generator.GenerateFast(masm_); | |
3078 __ jmp(&done); | |
3079 | |
3080 __ bind(&index_out_of_range); | |
3081 // When the index is out of range, the spec requires us to return | |
3082 // the empty string. | |
3083 __ LoadRoot(result, Heap::kempty_stringRootIndex); | |
3084 __ jmp(&done); | |
3085 | |
3086 __ bind(&need_conversion); | |
3087 // Move smi zero into the result register, which will trigger | |
3088 // conversion. | |
3089 __ li(result, Operand(Smi::FromInt(0))); | |
3090 __ jmp(&done); | |
3091 | |
3092 NopRuntimeCallHelper call_helper; | |
3093 generator.GenerateSlow(masm_, NOT_PART_OF_IC_HANDLER, call_helper); | |
3094 | |
3095 __ bind(&done); | |
3096 context()->Plug(result); | |
3097 } | |
3098 | |
3099 | |
3100 void FullCodeGenerator::EmitCall(CallRuntime* expr) { | 3051 void FullCodeGenerator::EmitCall(CallRuntime* expr) { |
3101 ZoneList<Expression*>* args = expr->arguments(); | 3052 ZoneList<Expression*>* args = expr->arguments(); |
3102 DCHECK_LE(2, args->length()); | 3053 DCHECK_LE(2, args->length()); |
3103 // Push target, receiver and arguments onto the stack. | 3054 // Push target, receiver and arguments onto the stack. |
3104 for (Expression* const arg : *args) { | 3055 for (Expression* const arg : *args) { |
3105 VisitForStackValue(arg); | 3056 VisitForStackValue(arg); |
3106 } | 3057 } |
3107 PrepareForBailoutForId(expr->CallId(), BailoutState::NO_REGISTERS); | 3058 PrepareForBailoutForId(expr->CallId(), BailoutState::NO_REGISTERS); |
3108 // Move target to a1. | 3059 // Move target to a1. |
3109 int const argc = args->length() - 2; | 3060 int const argc = args->length() - 2; |
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3963 reinterpret_cast<uint64_t>( | 3914 reinterpret_cast<uint64_t>( |
3964 isolate->builtins()->OnStackReplacement()->entry())); | 3915 isolate->builtins()->OnStackReplacement()->entry())); |
3965 return ON_STACK_REPLACEMENT; | 3916 return ON_STACK_REPLACEMENT; |
3966 } | 3917 } |
3967 | 3918 |
3968 | 3919 |
3969 } // namespace internal | 3920 } // namespace internal |
3970 } // namespace v8 | 3921 } // namespace v8 |
3971 | 3922 |
3972 #endif // V8_TARGET_ARCH_MIPS64 | 3923 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |