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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1389 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, | 1389 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, |
1390 &miss, // When not a string. | 1390 &miss, // When not a string. |
1391 &miss, // When not a number. | 1391 &miss, // When not a number. |
1392 &miss, // When index out of range. | 1392 &miss, // When index out of range. |
1393 STRING_INDEX_IS_ARRAY_INDEX, | 1393 STRING_INDEX_IS_ARRAY_INDEX, |
1394 RECEIVER_IS_STRING); | 1394 RECEIVER_IS_STRING); |
1395 char_at_generator.GenerateFast(masm); | 1395 char_at_generator.GenerateFast(masm); |
1396 __ Ret(); | 1396 __ Ret(); |
1397 | 1397 |
1398 StubRuntimeCallHelper call_helper; | 1398 StubRuntimeCallHelper call_helper; |
1399 char_at_generator.GenerateSlow(masm, call_helper); | 1399 char_at_generator.GenerateSlow(masm, PART_OF_IC_HANDLER, call_helper); |
1400 | 1400 |
1401 __ bind(&miss); | 1401 __ bind(&miss); |
1402 PropertyAccessCompiler::TailCallBuiltin( | 1402 PropertyAccessCompiler::TailCallBuiltin( |
1403 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); | 1403 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); |
1404 } | 1404 } |
1405 | 1405 |
1406 | 1406 |
1407 // Uses registers a0 to t0. | 1407 // Uses registers a0 to t0. |
1408 // Expected input (depending on whether args are in registers or on the stack): | 1408 // Expected input (depending on whether args are in registers or on the stack): |
1409 // * object: a0 or at sp + 1 * kPointerSize. | 1409 // * object: a0 or at sp + 1 * kPointerSize. |
(...skipping 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3043 index_, | 3043 index_, |
3044 result_, | 3044 result_, |
3045 &call_runtime_); | 3045 &call_runtime_); |
3046 | 3046 |
3047 __ sll(result_, result_, kSmiTagSize); | 3047 __ sll(result_, result_, kSmiTagSize); |
3048 __ bind(&exit_); | 3048 __ bind(&exit_); |
3049 } | 3049 } |
3050 | 3050 |
3051 | 3051 |
3052 void StringCharCodeAtGenerator::GenerateSlow( | 3052 void StringCharCodeAtGenerator::GenerateSlow( |
3053 MacroAssembler* masm, | 3053 MacroAssembler* masm, EmbedMode embed_mode, |
3054 const RuntimeCallHelper& call_helper) { | 3054 const RuntimeCallHelper& call_helper) { |
3055 __ Abort(kUnexpectedFallthroughToCharCodeAtSlowCase); | 3055 __ Abort(kUnexpectedFallthroughToCharCodeAtSlowCase); |
3056 | 3056 |
3057 // Index is not a smi. | 3057 // Index is not a smi. |
3058 __ bind(&index_not_smi_); | 3058 __ bind(&index_not_smi_); |
3059 // If index is a heap number, try converting it to an integer. | 3059 // If index is a heap number, try converting it to an integer. |
3060 __ CheckMap(index_, | 3060 __ CheckMap(index_, |
3061 result_, | 3061 result_, |
3062 Heap::kHeapNumberMapRootIndex, | 3062 Heap::kHeapNumberMapRootIndex, |
3063 index_not_number_, | 3063 index_not_number_, |
3064 DONT_DO_SMI_CHECK); | 3064 DONT_DO_SMI_CHECK); |
3065 call_helper.BeforeCall(masm); | 3065 call_helper.BeforeCall(masm); |
3066 // Consumed by runtime conversion function: | 3066 // Consumed by runtime conversion function: |
3067 if (FLAG_vector_ics && embed_mode == PART_OF_IC_HANDLER) { | |
3068 __ Push(VectorLoadICDescriptor::VectorRegister(), | |
3069 VectorLoadICDescriptor::SlotRegister()); | |
3070 } | |
3067 __ Push(object_, index_); | 3071 __ Push(object_, index_); |
3068 if (index_flags_ == STRING_INDEX_IS_NUMBER) { | 3072 if (index_flags_ == STRING_INDEX_IS_NUMBER) { |
3069 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); | 3073 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); |
3070 } else { | 3074 } else { |
3071 DCHECK(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); | 3075 DCHECK(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); |
3072 // NumberToSmi discards numbers that are not exact integers. | 3076 // NumberToSmi discards numbers that are not exact integers. |
3073 __ CallRuntime(Runtime::kNumberToSmi, 1); | 3077 __ CallRuntime(Runtime::kNumberToSmi, 1); |
3074 } | 3078 } |
3075 | 3079 |
3076 // Save the conversion result before the pop instructions below | 3080 // Save the conversion result before the pop instructions below |
3077 // have a chance to overwrite it. | 3081 // have a chance to overwrite it. |
3078 | 3082 |
3079 __ Move(index_, v0); | 3083 __ Move(index_, v0); |
3080 __ pop(object_); | 3084 __ pop(object_); |
3085 if (FLAG_vector_ics && embed_mode == PART_OF_IC_HANDLER) { | |
3086 __ pop(VectorLoadICDescriptor::SlotRegister()); | |
3087 __ pop(VectorLoadICDescriptor::VectorRegister()); | |
Yang
2015/03/23 14:23:59
Same here, corresponding Pop?
mvstanton
2015/03/23 15:54:44
Done.
| |
3088 } | |
3081 // Reload the instance type. | 3089 // Reload the instance type. |
3082 __ lw(result_, FieldMemOperand(object_, HeapObject::kMapOffset)); | 3090 __ lw(result_, FieldMemOperand(object_, HeapObject::kMapOffset)); |
3083 __ lbu(result_, FieldMemOperand(result_, Map::kInstanceTypeOffset)); | 3091 __ lbu(result_, FieldMemOperand(result_, Map::kInstanceTypeOffset)); |
3084 call_helper.AfterCall(masm); | 3092 call_helper.AfterCall(masm); |
3085 // If index is still not a smi, it must be out of range. | 3093 // If index is still not a smi, it must be out of range. |
3086 __ JumpIfNotSmi(index_, index_out_of_range_); | 3094 __ JumpIfNotSmi(index_, index_out_of_range_); |
3087 // Otherwise, return to the fast path. | 3095 // Otherwise, return to the fast path. |
3088 __ Branch(&got_smi_index_); | 3096 __ Branch(&got_smi_index_); |
3089 | 3097 |
3090 // Call runtime. We get here when the receiver is a string and the | 3098 // Call runtime. We get here when the receiver is a string and the |
(...skipping 2404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5495 kStackUnwindSpace, kInvalidStackOffset, | 5503 kStackUnwindSpace, kInvalidStackOffset, |
5496 MemOperand(fp, 6 * kPointerSize), NULL); | 5504 MemOperand(fp, 6 * kPointerSize), NULL); |
5497 } | 5505 } |
5498 | 5506 |
5499 | 5507 |
5500 #undef __ | 5508 #undef __ |
5501 | 5509 |
5502 } } // namespace v8::internal | 5510 } } // namespace v8::internal |
5503 | 5511 |
5504 #endif // V8_TARGET_ARCH_MIPS | 5512 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |