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 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1379 | 1379 |
1380 void LoadIndexedStringStub::Generate(MacroAssembler* masm) { | 1380 void LoadIndexedStringStub::Generate(MacroAssembler* masm) { |
1381 // Return address is in ra. | 1381 // Return address is in ra. |
1382 Label miss; | 1382 Label miss; |
1383 | 1383 |
1384 Register receiver = LoadDescriptor::ReceiverRegister(); | 1384 Register receiver = LoadDescriptor::ReceiverRegister(); |
1385 Register index = LoadDescriptor::NameRegister(); | 1385 Register index = LoadDescriptor::NameRegister(); |
1386 Register scratch = t1; | 1386 Register scratch = t1; |
1387 Register result = v0; | 1387 Register result = v0; |
1388 DCHECK(!scratch.is(receiver) && !scratch.is(index)); | 1388 DCHECK(!scratch.is(receiver) && !scratch.is(index)); |
1389 DCHECK(!scratch.is(VectorLoadICDescriptor::VectorRegister())); | 1389 DCHECK(!scratch.is(LoadWithVectorDescriptor::VectorRegister())); |
1390 | 1390 |
1391 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, | 1391 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, |
1392 &miss, // When not a string. | 1392 &miss, // When not a string. |
1393 &miss, // When not a number. | 1393 &miss, // When not a number. |
1394 &miss, // When index out of range. | 1394 &miss, // When index out of range. |
1395 STRING_INDEX_IS_ARRAY_INDEX, | 1395 STRING_INDEX_IS_ARRAY_INDEX, |
1396 RECEIVER_IS_STRING); | 1396 RECEIVER_IS_STRING); |
1397 char_at_generator.GenerateFast(masm); | 1397 char_at_generator.GenerateFast(masm); |
1398 __ Ret(); | 1398 __ Ret(); |
1399 | 1399 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1603 __ DropAndRet(HasArgsInRegisters() ? 0 : 2); | 1603 __ DropAndRet(HasArgsInRegisters() ? 0 : 2); |
1604 } | 1604 } |
1605 } | 1605 } |
1606 | 1606 |
1607 | 1607 |
1608 void FunctionPrototypeStub::Generate(MacroAssembler* masm) { | 1608 void FunctionPrototypeStub::Generate(MacroAssembler* masm) { |
1609 Label miss; | 1609 Label miss; |
1610 Register receiver = LoadDescriptor::ReceiverRegister(); | 1610 Register receiver = LoadDescriptor::ReceiverRegister(); |
1611 // Ensure that the vector and slot registers won't be clobbered before | 1611 // Ensure that the vector and slot registers won't be clobbered before |
1612 // calling the miss handler. | 1612 // calling the miss handler. |
1613 DCHECK(!AreAliased(t0, t1, VectorLoadICDescriptor::VectorRegister(), | 1613 DCHECK(!AreAliased(t0, t1, LoadWithVectorDescriptor::VectorRegister(), |
1614 VectorLoadICDescriptor::SlotRegister())); | 1614 LoadWithVectorDescriptor::SlotRegister())); |
1615 | 1615 |
1616 NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, t0, | 1616 NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, t0, |
1617 t1, &miss); | 1617 t1, &miss); |
1618 __ bind(&miss); | 1618 __ bind(&miss); |
1619 PropertyAccessCompiler::TailCallBuiltin( | 1619 PropertyAccessCompiler::TailCallBuiltin( |
1620 masm, PropertyAccessCompiler::MissBuiltin(Code::LOAD_IC)); | 1620 masm, PropertyAccessCompiler::MissBuiltin(Code::LOAD_IC)); |
1621 } | 1621 } |
1622 | 1622 |
1623 | 1623 |
1624 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { | 1624 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { |
(...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3084 __ bind(&index_not_smi_); | 3084 __ bind(&index_not_smi_); |
3085 // If index is a heap number, try converting it to an integer. | 3085 // If index is a heap number, try converting it to an integer. |
3086 __ CheckMap(index_, | 3086 __ CheckMap(index_, |
3087 result_, | 3087 result_, |
3088 Heap::kHeapNumberMapRootIndex, | 3088 Heap::kHeapNumberMapRootIndex, |
3089 index_not_number_, | 3089 index_not_number_, |
3090 DONT_DO_SMI_CHECK); | 3090 DONT_DO_SMI_CHECK); |
3091 call_helper.BeforeCall(masm); | 3091 call_helper.BeforeCall(masm); |
3092 // Consumed by runtime conversion function: | 3092 // Consumed by runtime conversion function: |
3093 if (embed_mode == PART_OF_IC_HANDLER) { | 3093 if (embed_mode == PART_OF_IC_HANDLER) { |
3094 __ Push(VectorLoadICDescriptor::VectorRegister(), | 3094 __ Push(LoadWithVectorDescriptor::VectorRegister(), |
3095 VectorLoadICDescriptor::SlotRegister(), object_, index_); | 3095 LoadWithVectorDescriptor::SlotRegister(), object_, index_); |
3096 } else { | 3096 } else { |
3097 __ Push(object_, index_); | 3097 __ Push(object_, index_); |
3098 } | 3098 } |
3099 if (index_flags_ == STRING_INDEX_IS_NUMBER) { | 3099 if (index_flags_ == STRING_INDEX_IS_NUMBER) { |
3100 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); | 3100 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); |
3101 } else { | 3101 } else { |
3102 DCHECK(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); | 3102 DCHECK(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); |
3103 // NumberToSmi discards numbers that are not exact integers. | 3103 // NumberToSmi discards numbers that are not exact integers. |
3104 __ CallRuntime(Runtime::kNumberToSmi, 1); | 3104 __ CallRuntime(Runtime::kNumberToSmi, 1); |
3105 } | 3105 } |
3106 | 3106 |
3107 // Save the conversion result before the pop instructions below | 3107 // Save the conversion result before the pop instructions below |
3108 // have a chance to overwrite it. | 3108 // have a chance to overwrite it. |
3109 __ Move(index_, v0); | 3109 __ Move(index_, v0); |
3110 if (embed_mode == PART_OF_IC_HANDLER) { | 3110 if (embed_mode == PART_OF_IC_HANDLER) { |
3111 __ Pop(VectorLoadICDescriptor::VectorRegister(), | 3111 __ Pop(LoadWithVectorDescriptor::VectorRegister(), |
3112 VectorLoadICDescriptor::SlotRegister(), object_); | 3112 LoadWithVectorDescriptor::SlotRegister(), object_); |
3113 } else { | 3113 } else { |
3114 __ pop(object_); | 3114 __ pop(object_); |
3115 } | 3115 } |
3116 // Reload the instance type. | 3116 // Reload the instance type. |
3117 __ lw(result_, FieldMemOperand(object_, HeapObject::kMapOffset)); | 3117 __ lw(result_, FieldMemOperand(object_, HeapObject::kMapOffset)); |
3118 __ lbu(result_, FieldMemOperand(result_, Map::kInstanceTypeOffset)); | 3118 __ lbu(result_, FieldMemOperand(result_, Map::kInstanceTypeOffset)); |
3119 call_helper.AfterCall(masm); | 3119 call_helper.AfterCall(masm); |
3120 // If index is still not a smi, it must be out of range. | 3120 // If index is still not a smi, it must be out of range. |
3121 __ JumpIfNotSmi(index_, index_out_of_range_); | 3121 __ JumpIfNotSmi(index_, index_out_of_range_); |
3122 // Otherwise, return to the fast path. | 3122 // Otherwise, return to the fast path. |
(...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4575 __ Addu(a1, a1, Operand(1)); | 4575 __ Addu(a1, a1, Operand(1)); |
4576 } | 4576 } |
4577 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 4577 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
4578 __ sll(a1, a1, kPointerSizeLog2); | 4578 __ sll(a1, a1, kPointerSizeLog2); |
4579 __ Ret(USE_DELAY_SLOT); | 4579 __ Ret(USE_DELAY_SLOT); |
4580 __ Addu(sp, sp, a1); | 4580 __ Addu(sp, sp, a1); |
4581 } | 4581 } |
4582 | 4582 |
4583 | 4583 |
4584 void LoadICTrampolineStub::Generate(MacroAssembler* masm) { | 4584 void LoadICTrampolineStub::Generate(MacroAssembler* masm) { |
4585 EmitLoadTypeFeedbackVector(masm, VectorLoadICDescriptor::VectorRegister()); | 4585 EmitLoadTypeFeedbackVector(masm, LoadWithVectorDescriptor::VectorRegister()); |
4586 VectorRawLoadStub stub(isolate(), state()); | 4586 LoadICStub stub(isolate(), state()); |
4587 stub.GenerateForTrampoline(masm); | 4587 stub.GenerateForTrampoline(masm); |
4588 } | 4588 } |
4589 | 4589 |
4590 | 4590 |
4591 void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) { | 4591 void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) { |
4592 EmitLoadTypeFeedbackVector(masm, VectorLoadICDescriptor::VectorRegister()); | 4592 EmitLoadTypeFeedbackVector(masm, LoadWithVectorDescriptor::VectorRegister()); |
4593 VectorRawKeyedLoadStub stub(isolate()); | 4593 KeyedLoadICStub stub(isolate()); |
4594 stub.GenerateForTrampoline(masm); | 4594 stub.GenerateForTrampoline(masm); |
4595 } | 4595 } |
4596 | 4596 |
4597 | 4597 |
4598 void CallICTrampolineStub::Generate(MacroAssembler* masm) { | 4598 void CallICTrampolineStub::Generate(MacroAssembler* masm) { |
4599 EmitLoadTypeFeedbackVector(masm, a2); | 4599 EmitLoadTypeFeedbackVector(masm, a2); |
4600 CallICStub stub(isolate(), state()); | 4600 CallICStub stub(isolate(), state()); |
4601 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); | 4601 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); |
4602 } | 4602 } |
4603 | 4603 |
4604 | 4604 |
4605 void CallIC_ArrayTrampolineStub::Generate(MacroAssembler* masm) { | 4605 void CallIC_ArrayTrampolineStub::Generate(MacroAssembler* masm) { |
4606 EmitLoadTypeFeedbackVector(masm, a2); | 4606 EmitLoadTypeFeedbackVector(masm, a2); |
4607 CallIC_ArrayStub stub(isolate(), state()); | 4607 CallIC_ArrayStub stub(isolate(), state()); |
4608 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); | 4608 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); |
4609 } | 4609 } |
4610 | 4610 |
4611 | 4611 |
4612 void VectorRawLoadStub::Generate(MacroAssembler* masm) { | 4612 void LoadICStub::Generate(MacroAssembler* masm) { GenerateImpl(masm, false); } |
4613 GenerateImpl(masm, false); | |
4614 } | |
4615 | 4613 |
4616 | 4614 |
4617 void VectorRawLoadStub::GenerateForTrampoline(MacroAssembler* masm) { | 4615 void LoadICStub::GenerateForTrampoline(MacroAssembler* masm) { |
4618 GenerateImpl(masm, true); | 4616 GenerateImpl(masm, true); |
4619 } | 4617 } |
4620 | 4618 |
4621 | 4619 |
4622 static void HandleArrayCases(MacroAssembler* masm, Register receiver, | 4620 static void HandleArrayCases(MacroAssembler* masm, Register receiver, |
4623 Register key, Register vector, Register slot, | 4621 Register key, Register vector, Register slot, |
4624 Register feedback, Register receiver_map, | 4622 Register feedback, Register receiver_map, |
4625 Register scratch1, Register scratch2, | 4623 Register scratch1, Register scratch2, |
4626 bool is_polymorphic, Label* miss) { | 4624 bool is_polymorphic, Label* miss) { |
4627 // feedback initially contains the feedback array | 4625 // feedback initially contains the feedback array |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4702 | 4700 |
4703 __ sll(at, slot, kPointerSizeLog2 - kSmiTagSize); | 4701 __ sll(at, slot, kPointerSizeLog2 - kSmiTagSize); |
4704 __ Addu(handler, vector, Operand(at)); | 4702 __ Addu(handler, vector, Operand(at)); |
4705 __ lw(handler, | 4703 __ lw(handler, |
4706 FieldMemOperand(handler, FixedArray::kHeaderSize + kPointerSize)); | 4704 FieldMemOperand(handler, FixedArray::kHeaderSize + kPointerSize)); |
4707 __ Addu(t9, handler, Operand(Code::kHeaderSize - kHeapObjectTag)); | 4705 __ Addu(t9, handler, Operand(Code::kHeaderSize - kHeapObjectTag)); |
4708 __ Jump(t9); | 4706 __ Jump(t9); |
4709 } | 4707 } |
4710 | 4708 |
4711 | 4709 |
4712 void VectorRawLoadStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { | 4710 void LoadICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { |
4713 Register receiver = VectorLoadICDescriptor::ReceiverRegister(); // a1 | 4711 Register receiver = LoadWithVectorDescriptor::ReceiverRegister(); // a1 |
4714 Register name = VectorLoadICDescriptor::NameRegister(); // a2 | 4712 Register name = LoadWithVectorDescriptor::NameRegister(); // a2 |
4715 Register vector = VectorLoadICDescriptor::VectorRegister(); // a3 | 4713 Register vector = LoadWithVectorDescriptor::VectorRegister(); // a3 |
4716 Register slot = VectorLoadICDescriptor::SlotRegister(); // a0 | 4714 Register slot = LoadWithVectorDescriptor::SlotRegister(); // a0 |
4717 Register feedback = t0; | 4715 Register feedback = t0; |
4718 Register receiver_map = t1; | 4716 Register receiver_map = t1; |
4719 Register scratch1 = t4; | 4717 Register scratch1 = t4; |
4720 | 4718 |
4721 __ sll(at, slot, kPointerSizeLog2 - kSmiTagSize); | 4719 __ sll(at, slot, kPointerSizeLog2 - kSmiTagSize); |
4722 __ Addu(feedback, vector, Operand(at)); | 4720 __ Addu(feedback, vector, Operand(at)); |
4723 __ lw(feedback, FieldMemOperand(feedback, FixedArray::kHeaderSize)); | 4721 __ lw(feedback, FieldMemOperand(feedback, FixedArray::kHeaderSize)); |
4724 | 4722 |
4725 // Try to quickly handle the monomorphic case without knowing for sure | 4723 // Try to quickly handle the monomorphic case without knowing for sure |
4726 // if we have a weak cell in feedback. We do know it's safe to look | 4724 // if we have a weak cell in feedback. We do know it's safe to look |
(...skipping 22 matching lines...) Expand all Loading... |
4749 | 4747 |
4750 __ bind(&miss); | 4748 __ bind(&miss); |
4751 LoadIC::GenerateMiss(masm); | 4749 LoadIC::GenerateMiss(masm); |
4752 | 4750 |
4753 __ bind(&load_smi_map); | 4751 __ bind(&load_smi_map); |
4754 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); | 4752 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); |
4755 __ jmp(&compare_map); | 4753 __ jmp(&compare_map); |
4756 } | 4754 } |
4757 | 4755 |
4758 | 4756 |
4759 void VectorRawKeyedLoadStub::Generate(MacroAssembler* masm) { | 4757 void KeyedLoadICStub::Generate(MacroAssembler* masm) { |
4760 GenerateImpl(masm, false); | 4758 GenerateImpl(masm, false); |
4761 } | 4759 } |
4762 | 4760 |
4763 | 4761 |
4764 void VectorRawKeyedLoadStub::GenerateForTrampoline(MacroAssembler* masm) { | 4762 void KeyedLoadICStub::GenerateForTrampoline(MacroAssembler* masm) { |
4765 GenerateImpl(masm, true); | 4763 GenerateImpl(masm, true); |
4766 } | 4764 } |
4767 | 4765 |
4768 | 4766 |
4769 void VectorRawKeyedLoadStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { | 4767 void KeyedLoadICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { |
4770 Register receiver = VectorLoadICDescriptor::ReceiverRegister(); // a1 | 4768 Register receiver = LoadWithVectorDescriptor::ReceiverRegister(); // a1 |
4771 Register key = VectorLoadICDescriptor::NameRegister(); // a2 | 4769 Register key = LoadWithVectorDescriptor::NameRegister(); // a2 |
4772 Register vector = VectorLoadICDescriptor::VectorRegister(); // a3 | 4770 Register vector = LoadWithVectorDescriptor::VectorRegister(); // a3 |
4773 Register slot = VectorLoadICDescriptor::SlotRegister(); // a0 | 4771 Register slot = LoadWithVectorDescriptor::SlotRegister(); // a0 |
4774 Register feedback = t0; | 4772 Register feedback = t0; |
4775 Register receiver_map = t1; | 4773 Register receiver_map = t1; |
4776 Register scratch1 = t4; | 4774 Register scratch1 = t4; |
4777 | 4775 |
4778 __ sll(at, slot, kPointerSizeLog2 - kSmiTagSize); | 4776 __ sll(at, slot, kPointerSizeLog2 - kSmiTagSize); |
4779 __ Addu(feedback, vector, Operand(at)); | 4777 __ Addu(feedback, vector, Operand(at)); |
4780 __ lw(feedback, FieldMemOperand(feedback, FixedArray::kHeaderSize)); | 4778 __ lw(feedback, FieldMemOperand(feedback, FixedArray::kHeaderSize)); |
4781 | 4779 |
4782 // Try to quickly handle the monomorphic case without knowing for sure | 4780 // Try to quickly handle the monomorphic case without knowing for sure |
4783 // if we have a weak cell in feedback. We do know it's safe to look | 4781 // if we have a weak cell in feedback. We do know it's safe to look |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5513 kStackUnwindSpace, kInvalidStackOffset, | 5511 kStackUnwindSpace, kInvalidStackOffset, |
5514 MemOperand(fp, 6 * kPointerSize), NULL); | 5512 MemOperand(fp, 6 * kPointerSize), NULL); |
5515 } | 5513 } |
5516 | 5514 |
5517 | 5515 |
5518 #undef __ | 5516 #undef __ |
5519 | 5517 |
5520 } } // namespace v8::internal | 5518 } } // namespace v8::internal |
5521 | 5519 |
5522 #endif // V8_TARGET_ARCH_MIPS | 5520 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |