| 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_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
| 8 | 8 |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1373 void LoadIndexedStringStub::Generate(MacroAssembler* masm) { | 1373 void LoadIndexedStringStub::Generate(MacroAssembler* masm) { |
| 1374 // Return address is in ra. | 1374 // Return address is in ra. |
| 1375 Label miss; | 1375 Label miss; |
| 1376 | 1376 |
| 1377 Register receiver = LoadDescriptor::ReceiverRegister(); | 1377 Register receiver = LoadDescriptor::ReceiverRegister(); |
| 1378 Register index = LoadDescriptor::NameRegister(); | 1378 Register index = LoadDescriptor::NameRegister(); |
| 1379 Register scratch = a5; | 1379 Register scratch = a5; |
| 1380 Register result = v0; | 1380 Register result = v0; |
| 1381 DCHECK(!scratch.is(receiver) && !scratch.is(index)); | 1381 DCHECK(!scratch.is(receiver) && !scratch.is(index)); |
| 1382 DCHECK(!FLAG_vector_ics || | 1382 DCHECK(!FLAG_vector_ics || |
| 1383 (!scratch.is(VectorLoadICDescriptor::VectorRegister()) && | 1383 !scratch.is(VectorLoadICDescriptor::VectorRegister())); |
| 1384 result.is(VectorLoadICDescriptor::SlotRegister()))); | |
| 1385 | 1384 |
| 1386 // StringCharAtGenerator doesn't use the result register until it's passed | |
| 1387 // the different miss possibilities. If it did, we would have a conflict | |
| 1388 // when FLAG_vector_ics is true. | |
| 1389 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, | 1385 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, |
| 1390 &miss, // When not a string. | 1386 &miss, // When not a string. |
| 1391 &miss, // When not a number. | 1387 &miss, // When not a number. |
| 1392 &miss, // When index out of range. | 1388 &miss, // When index out of range. |
| 1393 STRING_INDEX_IS_ARRAY_INDEX, | 1389 STRING_INDEX_IS_ARRAY_INDEX, |
| 1394 RECEIVER_IS_STRING); | 1390 RECEIVER_IS_STRING); |
| 1395 char_at_generator.GenerateFast(masm); | 1391 char_at_generator.GenerateFast(masm); |
| 1396 __ Ret(); | 1392 __ Ret(); |
| 1397 | 1393 |
| 1398 StubRuntimeCallHelper call_helper; | 1394 StubRuntimeCallHelper call_helper; |
| 1399 char_at_generator.GenerateSlow(masm, call_helper); | 1395 char_at_generator.GenerateSlow(masm, PART_OF_IC_HANDLER, call_helper); |
| 1400 | 1396 |
| 1401 __ bind(&miss); | 1397 __ bind(&miss); |
| 1402 PropertyAccessCompiler::TailCallBuiltin( | 1398 PropertyAccessCompiler::TailCallBuiltin( |
| 1403 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); | 1399 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); |
| 1404 } | 1400 } |
| 1405 | 1401 |
| 1406 | 1402 |
| 1407 // Uses registers a0 to a4. | 1403 // Uses registers a0 to a4. |
| 1408 // Expected input (depending on whether args are in registers or on the stack): | 1404 // Expected input (depending on whether args are in registers or on the stack): |
| 1409 // * object: a0 or at sp + 1 * kPointerSize. | 1405 // * object: a0 or at sp + 1 * kPointerSize. |
| (...skipping 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3082 | 3078 |
| 3083 ExternalReference miss = ExternalReference(IC_Utility(id), masm->isolate()); | 3079 ExternalReference miss = ExternalReference(IC_Utility(id), masm->isolate()); |
| 3084 __ CallExternalReference(miss, 3); | 3080 __ CallExternalReference(miss, 3); |
| 3085 | 3081 |
| 3086 // Move result to a1 and exit the internal frame. | 3082 // Move result to a1 and exit the internal frame. |
| 3087 __ mov(a1, v0); | 3083 __ mov(a1, v0); |
| 3088 } | 3084 } |
| 3089 | 3085 |
| 3090 | 3086 |
| 3091 void StringCharCodeAtGenerator::GenerateSlow( | 3087 void StringCharCodeAtGenerator::GenerateSlow( |
| 3092 MacroAssembler* masm, | 3088 MacroAssembler* masm, EmbedMode embed_mode, |
| 3093 const RuntimeCallHelper& call_helper) { | 3089 const RuntimeCallHelper& call_helper) { |
| 3094 __ Abort(kUnexpectedFallthroughToCharCodeAtSlowCase); | 3090 __ Abort(kUnexpectedFallthroughToCharCodeAtSlowCase); |
| 3095 | 3091 |
| 3096 // Index is not a smi. | 3092 // Index is not a smi. |
| 3097 __ bind(&index_not_smi_); | 3093 __ bind(&index_not_smi_); |
| 3098 // If index is a heap number, try converting it to an integer. | 3094 // If index is a heap number, try converting it to an integer. |
| 3099 __ CheckMap(index_, | 3095 __ CheckMap(index_, |
| 3100 result_, | 3096 result_, |
| 3101 Heap::kHeapNumberMapRootIndex, | 3097 Heap::kHeapNumberMapRootIndex, |
| 3102 index_not_number_, | 3098 index_not_number_, |
| 3103 DONT_DO_SMI_CHECK); | 3099 DONT_DO_SMI_CHECK); |
| 3104 call_helper.BeforeCall(masm); | 3100 call_helper.BeforeCall(masm); |
| 3105 // Consumed by runtime conversion function: | 3101 // Consumed by runtime conversion function: |
| 3106 __ Push(object_, index_); | 3102 if (FLAG_vector_ics && embed_mode == PART_OF_IC_HANDLER) { |
| 3103 __ Push(VectorLoadICDescriptor::VectorRegister(), |
| 3104 VectorLoadICDescriptor::SlotRegister(), object_, index_); |
| 3105 } else { |
| 3106 __ Push(object_, index_); |
| 3107 } |
| 3107 if (index_flags_ == STRING_INDEX_IS_NUMBER) { | 3108 if (index_flags_ == STRING_INDEX_IS_NUMBER) { |
| 3108 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); | 3109 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); |
| 3109 } else { | 3110 } else { |
| 3110 DCHECK(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); | 3111 DCHECK(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); |
| 3111 // NumberToSmi discards numbers that are not exact integers. | 3112 // NumberToSmi discards numbers that are not exact integers. |
| 3112 __ CallRuntime(Runtime::kNumberToSmi, 1); | 3113 __ CallRuntime(Runtime::kNumberToSmi, 1); |
| 3113 } | 3114 } |
| 3114 | 3115 |
| 3115 // Save the conversion result before the pop instructions below | 3116 // Save the conversion result before the pop instructions below |
| 3116 // have a chance to overwrite it. | 3117 // have a chance to overwrite it. |
| 3117 | 3118 |
| 3118 __ Move(index_, v0); | 3119 __ Move(index_, v0); |
| 3119 __ pop(object_); | 3120 if (FLAG_vector_ics && embed_mode == PART_OF_IC_HANDLER) { |
| 3121 __ Pop(VectorLoadICDescriptor::SlotRegister(), |
| 3122 VectorLoadICDescriptor::VectorRegister(), object_); |
| 3123 } else { |
| 3124 __ pop(object_); |
| 3125 } |
| 3120 // Reload the instance type. | 3126 // Reload the instance type. |
| 3121 __ ld(result_, FieldMemOperand(object_, HeapObject::kMapOffset)); | 3127 __ ld(result_, FieldMemOperand(object_, HeapObject::kMapOffset)); |
| 3122 __ lbu(result_, FieldMemOperand(result_, Map::kInstanceTypeOffset)); | 3128 __ lbu(result_, FieldMemOperand(result_, Map::kInstanceTypeOffset)); |
| 3123 call_helper.AfterCall(masm); | 3129 call_helper.AfterCall(masm); |
| 3124 // If index is still not a smi, it must be out of range. | 3130 // If index is still not a smi, it must be out of range. |
| 3125 __ JumpIfNotSmi(index_, index_out_of_range_); | 3131 __ JumpIfNotSmi(index_, index_out_of_range_); |
| 3126 // Otherwise, return to the fast path. | 3132 // Otherwise, return to the fast path. |
| 3127 __ Branch(&got_smi_index_); | 3133 __ Branch(&got_smi_index_); |
| 3128 | 3134 |
| 3129 // Call runtime. We get here when the receiver is a string and the | 3135 // Call runtime. We get here when the receiver is a string and the |
| (...skipping 2409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5539 kStackUnwindSpace, kInvalidStackOffset, | 5545 kStackUnwindSpace, kInvalidStackOffset, |
| 5540 MemOperand(fp, 6 * kPointerSize), NULL); | 5546 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5541 } | 5547 } |
| 5542 | 5548 |
| 5543 | 5549 |
| 5544 #undef __ | 5550 #undef __ |
| 5545 | 5551 |
| 5546 } } // namespace v8::internal | 5552 } } // namespace v8::internal |
| 5547 | 5553 |
| 5548 #endif // V8_TARGET_ARCH_MIPS64 | 5554 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |