| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 // Compute the size to be allocated, it is based on the array length | 693 // Compute the size to be allocated, it is based on the array length |
| 694 // and is computed as: | 694 // and is computed as: |
| 695 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)). | 695 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)). |
| 696 // Assert that length is a Smi. | 696 // Assert that length is a Smi. |
| 697 __ andi(CMPRES1, A1, Immediate(kSmiTagMask)); | 697 __ andi(CMPRES1, A1, Immediate(kSmiTagMask)); |
| 698 if (FLAG_use_slow_path) { | 698 if (FLAG_use_slow_path) { |
| 699 __ b(&slow_case); | 699 __ b(&slow_case); |
| 700 } else { | 700 } else { |
| 701 __ bne(CMPRES1, ZR, &slow_case); | 701 __ bne(CMPRES1, ZR, &slow_case); |
| 702 } | 702 } |
| 703 __ bltz(A1, &slow_case); |
| 704 // Check for maximum allowed length. |
| 705 const intptr_t max_len = |
| 706 reinterpret_cast<int32_t>(Smi::New(Array::kMaxElements)); |
| 707 __ BranchUnsignedGreater(A1, max_len, &slow_case); |
| 708 |
| 703 __ lw(T0, FieldAddress(CTX, Context::isolate_offset())); | 709 __ lw(T0, FieldAddress(CTX, Context::isolate_offset())); |
| 704 __ lw(T0, Address(T0, Isolate::heap_offset())); | 710 __ lw(T0, Address(T0, Isolate::heap_offset())); |
| 705 __ lw(T0, Address(T0, Heap::new_space_offset())); | 711 __ lw(T0, Address(T0, Heap::new_space_offset())); |
| 706 | 712 |
| 707 // Calculate and align allocation size. | 713 // Calculate and align allocation size. |
| 708 // Load new object start and calculate next object start. | 714 // Load new object start and calculate next object start. |
| 709 // A0: array element type. | 715 // A0: array element type. |
| 710 // A1: Array length as Smi. | 716 // A1: Array length as Smi. |
| 711 // T0: Points to new space object. | 717 // T0: Points to new space object. |
| 712 __ lw(V0, Address(T0, Scavenger::top_offset())); | 718 __ lw(V0, Address(T0, Scavenger::top_offset())); |
| 713 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; | 719 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; |
| 714 __ LoadImmediate(T3, fixed_size); | 720 __ LoadImmediate(T3, fixed_size); |
| 715 __ sll(TMP, A1, 1); // A1 is Smi. | 721 __ sll(TMP, A1, 1); // A1 is Smi. |
| 716 __ addu(T3, T3, TMP); | 722 __ addu(T3, T3, TMP); |
| 717 ASSERT(kSmiTagShift == 1); | 723 ASSERT(kSmiTagShift == 1); |
| 718 __ LoadImmediate(TMP, ~(kObjectAlignment - 1)); | 724 __ LoadImmediate(TMP, ~(kObjectAlignment - 1)); |
| 719 __ and_(T3, T3, TMP); | 725 __ and_(T3, T3, TMP); |
| 720 __ addu(T2, T3, V0); | 726 |
| 727 __ AdduDetectOverflow(T2, T3, V0, CMPRES1); |
| 728 __ bltz(CMPRES1, &slow_case); // CMPRES1 < 0 on overflow. |
| 721 | 729 |
| 722 // Check if the allocation fits into the remaining space. | 730 // Check if the allocation fits into the remaining space. |
| 723 // V0: potential new object start. | 731 // V0: potential new object start. |
| 724 // A0: array element type. | 732 // A0: array element type. |
| 725 // A1: array length as Smi. | 733 // A1: array length as Smi. |
| 726 // T0: points to new space object. | 734 // T0: points to new space object. |
| 727 // T2: potential next object start. | 735 // T2: potential next object start. |
| 728 // T3: array size. | 736 // T3: array size. |
| 729 __ lw(CMPRES1, Address(T0, Scavenger::end_offset())); | 737 __ lw(CMPRES1, Address(T0, Scavenger::end_offset())); |
| 730 __ BranchUnsignedGreaterEqual(T2, CMPRES1, &slow_case); | 738 __ BranchUnsignedGreaterEqual(T2, CMPRES1, &slow_case); |
| (...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2095 const Register right = T0; | 2103 const Register right = T0; |
| 2096 __ lw(left, Address(SP, 1 * kWordSize)); | 2104 __ lw(left, Address(SP, 1 * kWordSize)); |
| 2097 __ lw(right, Address(SP, 0 * kWordSize)); | 2105 __ lw(right, Address(SP, 0 * kWordSize)); |
| 2098 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); | 2106 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); |
| 2099 __ Ret(); | 2107 __ Ret(); |
| 2100 } | 2108 } |
| 2101 | 2109 |
| 2102 } // namespace dart | 2110 } // namespace dart |
| 2103 | 2111 |
| 2104 #endif // defined TARGET_ARCH_MIPS | 2112 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |