| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 7 #if V8_TARGET_ARCH_PPC |
| 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 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1587 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, | 1587 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, |
| 1588 &miss, // When not a string. | 1588 &miss, // When not a string. |
| 1589 &miss, // When not a number. | 1589 &miss, // When not a number. |
| 1590 &miss, // When index out of range. | 1590 &miss, // When index out of range. |
| 1591 STRING_INDEX_IS_ARRAY_INDEX, | 1591 STRING_INDEX_IS_ARRAY_INDEX, |
| 1592 RECEIVER_IS_STRING); | 1592 RECEIVER_IS_STRING); |
| 1593 char_at_generator.GenerateFast(masm); | 1593 char_at_generator.GenerateFast(masm); |
| 1594 __ Ret(); | 1594 __ Ret(); |
| 1595 | 1595 |
| 1596 StubRuntimeCallHelper call_helper; | 1596 StubRuntimeCallHelper call_helper; |
| 1597 char_at_generator.GenerateSlow(masm, call_helper); | 1597 char_at_generator.GenerateSlow(masm, PART_OF_IC_HANDLER, call_helper); |
| 1598 | 1598 |
| 1599 __ bind(&miss); | 1599 __ bind(&miss); |
| 1600 PropertyAccessCompiler::TailCallBuiltin( | 1600 PropertyAccessCompiler::TailCallBuiltin( |
| 1601 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); | 1601 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); |
| 1602 } | 1602 } |
| 1603 | 1603 |
| 1604 | 1604 |
| 1605 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { | 1605 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { |
| 1606 CHECK(!has_new_target()); | 1606 CHECK(!has_new_target()); |
| 1607 // The displacement is the offset of the last parameter (if any) | 1607 // The displacement is the offset of the last parameter (if any) |
| (...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3072 | 3072 |
| 3073 StringCharLoadGenerator::Generate(masm, object_, index_, result_, | 3073 StringCharLoadGenerator::Generate(masm, object_, index_, result_, |
| 3074 &call_runtime_); | 3074 &call_runtime_); |
| 3075 | 3075 |
| 3076 __ SmiTag(result_); | 3076 __ SmiTag(result_); |
| 3077 __ bind(&exit_); | 3077 __ bind(&exit_); |
| 3078 } | 3078 } |
| 3079 | 3079 |
| 3080 | 3080 |
| 3081 void StringCharCodeAtGenerator::GenerateSlow( | 3081 void StringCharCodeAtGenerator::GenerateSlow( |
| 3082 MacroAssembler* masm, const RuntimeCallHelper& call_helper) { | 3082 MacroAssembler* masm, EmbedMode embed_mode, |
| 3083 const RuntimeCallHelper& call_helper) { |
| 3083 __ Abort(kUnexpectedFallthroughToCharCodeAtSlowCase); | 3084 __ Abort(kUnexpectedFallthroughToCharCodeAtSlowCase); |
| 3084 | 3085 |
| 3085 // Index is not a smi. | 3086 // Index is not a smi. |
| 3086 __ bind(&index_not_smi_); | 3087 __ bind(&index_not_smi_); |
| 3087 // If index is a heap number, try converting it to an integer. | 3088 // If index is a heap number, try converting it to an integer. |
| 3088 __ CheckMap(index_, result_, Heap::kHeapNumberMapRootIndex, index_not_number_, | 3089 __ CheckMap(index_, result_, Heap::kHeapNumberMapRootIndex, index_not_number_, |
| 3089 DONT_DO_SMI_CHECK); | 3090 DONT_DO_SMI_CHECK); |
| 3090 call_helper.BeforeCall(masm); | 3091 call_helper.BeforeCall(masm); |
| 3091 __ push(object_); | 3092 if (FLAG_vector_ics && embed_mode == PART_OF_IC_HANDLER) { |
| 3092 __ push(index_); // Consumed by runtime conversion function. | 3093 __ Push(VectorLoadICDescriptor::VectorRegister(), |
| 3094 VectorLoadICDescriptor::SlotRegister(), object_, index_); |
| 3095 } else { |
| 3096 // index_ is consumed by runtime conversion function. |
| 3097 __ Push(object_, index_); |
| 3098 } |
| 3093 if (index_flags_ == STRING_INDEX_IS_NUMBER) { | 3099 if (index_flags_ == STRING_INDEX_IS_NUMBER) { |
| 3094 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); | 3100 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); |
| 3095 } else { | 3101 } else { |
| 3096 DCHECK(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); | 3102 DCHECK(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); |
| 3097 // NumberToSmi discards numbers that are not exact integers. | 3103 // NumberToSmi discards numbers that are not exact integers. |
| 3098 __ CallRuntime(Runtime::kNumberToSmi, 1); | 3104 __ CallRuntime(Runtime::kNumberToSmi, 1); |
| 3099 } | 3105 } |
| 3100 // Save the conversion result before the pop instructions below | 3106 // Save the conversion result before the pop instructions below |
| 3101 // have a chance to overwrite it. | 3107 // have a chance to overwrite it. |
| 3102 __ Move(index_, r3); | 3108 __ Move(index_, r3); |
| 3103 __ pop(object_); | 3109 if (FLAG_vector_ics && embed_mode == PART_OF_IC_HANDLER) { |
| 3110 __ Pop(VectorLoadICDescriptor::VectorRegister(), |
| 3111 VectorLoadICDescriptor::SlotRegister(), object_); |
| 3112 } else { |
| 3113 __ pop(object_); |
| 3114 } |
| 3104 // Reload the instance type. | 3115 // Reload the instance type. |
| 3105 __ LoadP(result_, FieldMemOperand(object_, HeapObject::kMapOffset)); | 3116 __ LoadP(result_, FieldMemOperand(object_, HeapObject::kMapOffset)); |
| 3106 __ lbz(result_, FieldMemOperand(result_, Map::kInstanceTypeOffset)); | 3117 __ lbz(result_, FieldMemOperand(result_, Map::kInstanceTypeOffset)); |
| 3107 call_helper.AfterCall(masm); | 3118 call_helper.AfterCall(masm); |
| 3108 // If index is still not a smi, it must be out of range. | 3119 // If index is still not a smi, it must be out of range. |
| 3109 __ JumpIfNotSmi(index_, index_out_of_range_); | 3120 __ JumpIfNotSmi(index_, index_out_of_range_); |
| 3110 // Otherwise, return to the fast path. | 3121 // Otherwise, return to the fast path. |
| 3111 __ b(&got_smi_index_); | 3122 __ b(&got_smi_index_); |
| 3112 | 3123 |
| 3113 // Call runtime. We get here when the receiver is a string and the | 3124 // Call runtime. We get here when the receiver is a string and the |
| (...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4771 __ SmiToPtrArrayOffset(r0, slot); | 4782 __ SmiToPtrArrayOffset(r0, slot); |
| 4772 __ add(feedback, vector, r0); | 4783 __ add(feedback, vector, r0); |
| 4773 __ LoadP(feedback, FieldMemOperand(feedback, FixedArray::kHeaderSize)); | 4784 __ LoadP(feedback, FieldMemOperand(feedback, FixedArray::kHeaderSize)); |
| 4774 | 4785 |
| 4775 // Is it a weak cell? | 4786 // Is it a weak cell? |
| 4776 Label try_array; | 4787 Label try_array; |
| 4777 Label not_array, smi_key, key_okay, miss; | 4788 Label not_array, smi_key, key_okay, miss; |
| 4778 __ LoadP(scratch1, FieldMemOperand(feedback, HeapObject::kMapOffset)); | 4789 __ LoadP(scratch1, FieldMemOperand(feedback, HeapObject::kMapOffset)); |
| 4779 __ CompareRoot(scratch1, Heap::kWeakCellMapRootIndex); | 4790 __ CompareRoot(scratch1, Heap::kWeakCellMapRootIndex); |
| 4780 __ bne(&try_array); | 4791 __ bne(&try_array); |
| 4781 __ JumpIfNotSmi(key, &miss); | |
| 4782 HandleMonomorphicCase(masm, receiver, key, vector, slot, feedback, scratch1, | 4792 HandleMonomorphicCase(masm, receiver, key, vector, slot, feedback, scratch1, |
| 4783 &miss); | 4793 &miss); |
| 4784 | 4794 |
| 4785 __ bind(&try_array); | 4795 __ bind(&try_array); |
| 4786 // Is it a fixed array? | 4796 // Is it a fixed array? |
| 4787 __ CompareRoot(scratch1, Heap::kFixedArrayMapRootIndex); | 4797 __ CompareRoot(scratch1, Heap::kFixedArrayMapRootIndex); |
| 4788 __ bne(¬_array); | 4798 __ bne(¬_array); |
| 4799 |
| 4789 // We have a polymorphic element handler. | 4800 // We have a polymorphic element handler. |
| 4790 __ JumpIfNotSmi(key, &miss); | |
| 4791 | |
| 4792 Label polymorphic, try_poly_name; | 4801 Label polymorphic, try_poly_name; |
| 4793 __ bind(&polymorphic); | 4802 __ bind(&polymorphic); |
| 4794 HandleArrayCases(masm, receiver, key, vector, slot, feedback, scratch1, r9, | 4803 HandleArrayCases(masm, receiver, key, vector, slot, feedback, scratch1, r9, |
| 4795 r10, true, &miss); | 4804 r10, true, &miss); |
| 4796 | 4805 |
| 4797 __ bind(¬_array); | 4806 __ bind(¬_array); |
| 4798 // Is it generic? | 4807 // Is it generic? |
| 4799 __ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex); | 4808 __ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex); |
| 4800 __ bne(&try_poly_name); | 4809 __ bne(&try_poly_name); |
| 4801 Handle<Code> megamorphic_stub = | 4810 Handle<Code> megamorphic_stub = |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5579 kStackUnwindSpace, NULL, | 5588 kStackUnwindSpace, NULL, |
| 5580 MemOperand(fp, 6 * kPointerSize), NULL); | 5589 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5581 } | 5590 } |
| 5582 | 5591 |
| 5583 | 5592 |
| 5584 #undef __ | 5593 #undef __ |
| 5585 } | 5594 } |
| 5586 } // namespace v8::internal | 5595 } // namespace v8::internal |
| 5587 | 5596 |
| 5588 #endif // V8_TARGET_ARCH_PPC | 5597 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |