OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
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 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1460 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, | 1460 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, |
1461 &miss, // When not a string. | 1461 &miss, // When not a string. |
1462 &miss, // When not a number. | 1462 &miss, // When not a number. |
1463 &miss, // When index out of range. | 1463 &miss, // When index out of range. |
1464 STRING_INDEX_IS_ARRAY_INDEX, | 1464 STRING_INDEX_IS_ARRAY_INDEX, |
1465 RECEIVER_IS_STRING); | 1465 RECEIVER_IS_STRING); |
1466 char_at_generator.GenerateFast(masm); | 1466 char_at_generator.GenerateFast(masm); |
1467 __ Ret(); | 1467 __ Ret(); |
1468 | 1468 |
1469 StubRuntimeCallHelper call_helper; | 1469 StubRuntimeCallHelper call_helper; |
1470 char_at_generator.GenerateSlow(masm, call_helper); | 1470 char_at_generator.GenerateSlow(masm, PART_OF_IC_HANDLER, call_helper); |
1471 | 1471 |
1472 __ Bind(&miss); | 1472 __ Bind(&miss); |
1473 PropertyAccessCompiler::TailCallBuiltin( | 1473 PropertyAccessCompiler::TailCallBuiltin( |
1474 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); | 1474 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); |
1475 } | 1475 } |
1476 | 1476 |
1477 | 1477 |
1478 void InstanceofStub::Generate(MacroAssembler* masm) { | 1478 void InstanceofStub::Generate(MacroAssembler* masm) { |
1479 // Stack on entry: | 1479 // Stack on entry: |
1480 // jssp[0]: function. | 1480 // jssp[0]: function. |
(...skipping 1814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3295 object_, | 3295 object_, |
3296 index_.W(), | 3296 index_.W(), |
3297 result_, | 3297 result_, |
3298 &call_runtime_); | 3298 &call_runtime_); |
3299 __ SmiTag(result_); | 3299 __ SmiTag(result_); |
3300 __ Bind(&exit_); | 3300 __ Bind(&exit_); |
3301 } | 3301 } |
3302 | 3302 |
3303 | 3303 |
3304 void StringCharCodeAtGenerator::GenerateSlow( | 3304 void StringCharCodeAtGenerator::GenerateSlow( |
3305 MacroAssembler* masm, | 3305 MacroAssembler* masm, EmbedMode embed_mode, |
3306 const RuntimeCallHelper& call_helper) { | 3306 const RuntimeCallHelper& call_helper) { |
3307 __ Abort(kUnexpectedFallthroughToCharCodeAtSlowCase); | 3307 __ Abort(kUnexpectedFallthroughToCharCodeAtSlowCase); |
3308 | 3308 |
3309 __ Bind(&index_not_smi_); | 3309 __ Bind(&index_not_smi_); |
3310 // If index is a heap number, try converting it to an integer. | 3310 // If index is a heap number, try converting it to an integer. |
3311 __ JumpIfNotHeapNumber(index_, index_not_number_); | 3311 __ JumpIfNotHeapNumber(index_, index_not_number_); |
3312 call_helper.BeforeCall(masm); | 3312 call_helper.BeforeCall(masm); |
3313 if (FLAG_vector_ics && embed_mode == PART_OF_IC_HANDLER) { | |
3314 __ Push(VectorLoadICDescriptor::VectorRegister(), | |
3315 VectorLoadICDescriptor::SlotRegister()); | |
3316 } | |
3313 // Save object_ on the stack and pass index_ as argument for runtime call. | 3317 // Save object_ on the stack and pass index_ as argument for runtime call. |
3314 __ Push(object_, index_); | 3318 __ Push(object_, index_); |
3315 if (index_flags_ == STRING_INDEX_IS_NUMBER) { | 3319 if (index_flags_ == STRING_INDEX_IS_NUMBER) { |
3316 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); | 3320 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); |
3317 } else { | 3321 } else { |
3318 DCHECK(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); | 3322 DCHECK(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); |
3319 // NumberToSmi discards numbers that are not exact integers. | 3323 // NumberToSmi discards numbers that are not exact integers. |
3320 __ CallRuntime(Runtime::kNumberToSmi, 1); | 3324 __ CallRuntime(Runtime::kNumberToSmi, 1); |
3321 } | 3325 } |
3322 // Save the conversion result before the pop instructions below | 3326 // Save the conversion result before the pop instructions below |
3323 // have a chance to overwrite it. | 3327 // have a chance to overwrite it. |
3324 __ Mov(index_, x0); | 3328 __ Mov(index_, x0); |
3325 __ Pop(object_); | 3329 __ Pop(object_); |
3330 if (FLAG_vector_ics && embed_mode == PART_OF_IC_HANDLER) { | |
3331 __ Pop(VectorLoadICDescriptor::SlotRegister()); | |
Yang
2015/03/23 14:23:59
Can we use the equivalent Pop with two registers?
mvstanton
2015/03/23 15:54:44
Done. There is some hilarity here, because arm and
| |
3332 __ Pop(VectorLoadICDescriptor::VectorRegister()); | |
3333 } | |
3326 // Reload the instance type. | 3334 // Reload the instance type. |
3327 __ Ldr(result_, FieldMemOperand(object_, HeapObject::kMapOffset)); | 3335 __ Ldr(result_, FieldMemOperand(object_, HeapObject::kMapOffset)); |
3328 __ Ldrb(result_, FieldMemOperand(result_, Map::kInstanceTypeOffset)); | 3336 __ Ldrb(result_, FieldMemOperand(result_, Map::kInstanceTypeOffset)); |
3329 call_helper.AfterCall(masm); | 3337 call_helper.AfterCall(masm); |
3330 | 3338 |
3331 // If index is still not a smi, it must be out of range. | 3339 // If index is still not a smi, it must be out of range. |
3332 __ JumpIfNotSmi(index_, index_out_of_range_); | 3340 __ JumpIfNotSmi(index_, index_out_of_range_); |
3333 // Otherwise, return to the fast path. | 3341 // Otherwise, return to the fast path. |
3334 __ B(&got_smi_index_); | 3342 __ B(&got_smi_index_); |
3335 | 3343 |
(...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4653 Register scratch1 = x5; | 4661 Register scratch1 = x5; |
4654 | 4662 |
4655 __ Add(feedback, vector, Operand::UntagSmiAndScale(slot, kPointerSizeLog2)); | 4663 __ Add(feedback, vector, Operand::UntagSmiAndScale(slot, kPointerSizeLog2)); |
4656 __ Ldr(feedback, FieldMemOperand(feedback, FixedArray::kHeaderSize)); | 4664 __ Ldr(feedback, FieldMemOperand(feedback, FixedArray::kHeaderSize)); |
4657 | 4665 |
4658 // Is it a weak cell? | 4666 // Is it a weak cell? |
4659 Label try_array; | 4667 Label try_array; |
4660 Label not_array, smi_key, key_okay, miss; | 4668 Label not_array, smi_key, key_okay, miss; |
4661 __ Ldr(scratch1, FieldMemOperand(feedback, HeapObject::kMapOffset)); | 4669 __ Ldr(scratch1, FieldMemOperand(feedback, HeapObject::kMapOffset)); |
4662 __ JumpIfNotRoot(scratch1, Heap::kWeakCellMapRootIndex, &try_array); | 4670 __ JumpIfNotRoot(scratch1, Heap::kWeakCellMapRootIndex, &try_array); |
4663 __ JumpIfNotSmi(key, &miss); | |
4664 HandleMonomorphicCase(masm, receiver, key, vector, slot, feedback, scratch1, | 4671 HandleMonomorphicCase(masm, receiver, key, vector, slot, feedback, scratch1, |
4665 &miss); | 4672 &miss); |
4666 | 4673 |
4667 __ Bind(&try_array); | 4674 __ Bind(&try_array); |
4668 // Is it a fixed array? | 4675 // Is it a fixed array? |
4669 __ JumpIfNotRoot(scratch1, Heap::kFixedArrayMapRootIndex, ¬_array); | 4676 __ JumpIfNotRoot(scratch1, Heap::kFixedArrayMapRootIndex, ¬_array); |
4677 | |
4670 // We have a polymorphic element handler. | 4678 // We have a polymorphic element handler. |
4671 __ JumpIfNotSmi(key, &miss); | |
4672 | |
4673 Label polymorphic, try_poly_name; | 4679 Label polymorphic, try_poly_name; |
4674 __ Bind(&polymorphic); | 4680 __ Bind(&polymorphic); |
4675 HandleArrayCases(masm, receiver, key, vector, slot, feedback, scratch1, x6, | 4681 HandleArrayCases(masm, receiver, key, vector, slot, feedback, scratch1, x6, |
4676 x7, true, &miss); | 4682 x7, true, &miss); |
4677 | 4683 |
4678 __ Bind(¬_array); | 4684 __ Bind(¬_array); |
4679 // Is it generic? | 4685 // Is it generic? |
4680 __ JumpIfNotRoot(feedback, Heap::kmegamorphic_symbolRootIndex, | 4686 __ JumpIfNotRoot(feedback, Heap::kmegamorphic_symbolRootIndex, |
4681 &try_poly_name); | 4687 &try_poly_name); |
4682 Handle<Code> megamorphic_stub = | 4688 Handle<Code> megamorphic_stub = |
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5737 kStackUnwindSpace, NULL, spill_offset, | 5743 kStackUnwindSpace, NULL, spill_offset, |
5738 MemOperand(fp, 6 * kPointerSize), NULL); | 5744 MemOperand(fp, 6 * kPointerSize), NULL); |
5739 } | 5745 } |
5740 | 5746 |
5741 | 5747 |
5742 #undef __ | 5748 #undef __ |
5743 | 5749 |
5744 } } // namespace v8::internal | 5750 } } // namespace v8::internal |
5745 | 5751 |
5746 #endif // V8_TARGET_ARCH_ARM64 | 5752 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |