| 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 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 __ bne(CMPRES1, ZR, &slow_case); | 649 __ bne(CMPRES1, ZR, &slow_case); |
| 650 } | 650 } |
| 651 __ bltz(T3, &slow_case); | 651 __ bltz(T3, &slow_case); |
| 652 | 652 |
| 653 // Check for maximum allowed length. | 653 // Check for maximum allowed length. |
| 654 const intptr_t max_len = | 654 const intptr_t max_len = |
| 655 reinterpret_cast<int32_t>(Smi::New(Array::kMaxElements)); | 655 reinterpret_cast<int32_t>(Smi::New(Array::kMaxElements)); |
| 656 __ BranchUnsignedGreater(T3, Immediate(max_len), &slow_case); | 656 __ BranchUnsignedGreater(T3, Immediate(max_len), &slow_case); |
| 657 | 657 |
| 658 const intptr_t cid = kArrayCid; | 658 const intptr_t cid = kArrayCid; |
| 659 __ MaybeTraceAllocation(kArrayCid, T4, &slow_case); | 659 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kArrayCid, T4, &slow_case)); |
| 660 | 660 |
| 661 const intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; | 661 const intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; |
| 662 __ LoadImmediate(T2, fixed_size); | 662 __ LoadImmediate(T2, fixed_size); |
| 663 __ sll(T3, T3, 1); // T3 is a Smi. | 663 __ sll(T3, T3, 1); // T3 is a Smi. |
| 664 __ addu(T2, T2, T3); | 664 __ addu(T2, T2, T3); |
| 665 ASSERT(kSmiTagShift == 1); | 665 ASSERT(kSmiTagShift == 1); |
| 666 __ LoadImmediate(T3, ~(kObjectAlignment - 1)); | 666 __ LoadImmediate(T3, ~(kObjectAlignment - 1)); |
| 667 __ and_(T2, T2, T3); | 667 __ and_(T2, T2, T3); |
| 668 | 668 |
| 669 // T2: Allocation size. | 669 // T2: Allocation size. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 683 // T2: allocation size. | 683 // T2: allocation size. |
| 684 // T3: heap. | 684 // T3: heap. |
| 685 __ lw(T4, Address(T3, Heap::EndOffset(space))); | 685 __ lw(T4, Address(T3, Heap::EndOffset(space))); |
| 686 __ BranchUnsignedGreaterEqual(T1, T4, &slow_case); | 686 __ BranchUnsignedGreaterEqual(T1, T4, &slow_case); |
| 687 | 687 |
| 688 // Successfully allocated the object(s), now update top to point to | 688 // Successfully allocated the object(s), now update top to point to |
| 689 // next object start and initialize the object. | 689 // next object start and initialize the object. |
| 690 // T3: heap. | 690 // T3: heap. |
| 691 __ sw(T1, Address(T3, Heap::TopOffset(space))); | 691 __ sw(T1, Address(T3, Heap::TopOffset(space))); |
| 692 __ addiu(T0, T0, Immediate(kHeapObjectTag)); | 692 __ addiu(T0, T0, Immediate(kHeapObjectTag)); |
| 693 __ UpdateAllocationStatsWithSize(cid, T2, T4, space); | 693 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, T2, T4, space)); |
| 694 | 694 |
| 695 // Initialize the tags. | 695 // Initialize the tags. |
| 696 // T0: new object start as a tagged pointer. | 696 // T0: new object start as a tagged pointer. |
| 697 // T1: new object end address. | 697 // T1: new object end address. |
| 698 // T2: allocation size. | 698 // T2: allocation size. |
| 699 { | 699 { |
| 700 Label overflow, done; | 700 Label overflow, done; |
| 701 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; | 701 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; |
| 702 | 702 |
| 703 __ BranchUnsignedGreater( | 703 __ BranchUnsignedGreater( |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 // First compute the rounded instance size. | 928 // First compute the rounded instance size. |
| 929 // T1: number of context variables. | 929 // T1: number of context variables. |
| 930 intptr_t fixed_size = sizeof(RawContext) + kObjectAlignment - 1; | 930 intptr_t fixed_size = sizeof(RawContext) + kObjectAlignment - 1; |
| 931 __ LoadImmediate(T2, fixed_size); | 931 __ LoadImmediate(T2, fixed_size); |
| 932 __ sll(T0, T1, 2); | 932 __ sll(T0, T1, 2); |
| 933 __ addu(T2, T2, T0); | 933 __ addu(T2, T2, T0); |
| 934 ASSERT(kSmiTagShift == 1); | 934 ASSERT(kSmiTagShift == 1); |
| 935 __ LoadImmediate(T0, ~((kObjectAlignment) - 1)); | 935 __ LoadImmediate(T0, ~((kObjectAlignment) - 1)); |
| 936 __ and_(T2, T2, T0); | 936 __ and_(T2, T2, T0); |
| 937 | 937 |
| 938 __ MaybeTraceAllocation(kContextCid, T4, &slow_case); | 938 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kContextCid, T4, &slow_case)); |
| 939 // Now allocate the object. | 939 // Now allocate the object. |
| 940 // T1: number of context variables. | 940 // T1: number of context variables. |
| 941 // T2: object size. | 941 // T2: object size. |
| 942 const intptr_t cid = kContextCid; | 942 const intptr_t cid = kContextCid; |
| 943 Heap::Space space = Heap::SpaceForAllocation(cid); | 943 Heap::Space space = Heap::SpaceForAllocation(cid); |
| 944 __ LoadIsolate(T5); | 944 __ LoadIsolate(T5); |
| 945 __ lw(T5, Address(T5, Isolate::heap_offset())); | 945 __ lw(T5, Address(T5, Isolate::heap_offset())); |
| 946 __ lw(V0, Address(T5, Heap::TopOffset(space))); | 946 __ lw(V0, Address(T5, Heap::TopOffset(space))); |
| 947 __ addu(T3, T2, V0); | 947 __ addu(T3, T2, V0); |
| 948 | 948 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 961 | 961 |
| 962 // Successfully allocated the object, now update top to point to | 962 // Successfully allocated the object, now update top to point to |
| 963 // next object start and initialize the object. | 963 // next object start and initialize the object. |
| 964 // V0: new object. | 964 // V0: new object. |
| 965 // T1: number of context variables. | 965 // T1: number of context variables. |
| 966 // T2: object size. | 966 // T2: object size. |
| 967 // T3: next object start. | 967 // T3: next object start. |
| 968 // T5: heap. | 968 // T5: heap. |
| 969 __ sw(T3, Address(T5, Heap::TopOffset(space))); | 969 __ sw(T3, Address(T5, Heap::TopOffset(space))); |
| 970 __ addiu(V0, V0, Immediate(kHeapObjectTag)); | 970 __ addiu(V0, V0, Immediate(kHeapObjectTag)); |
| 971 __ UpdateAllocationStatsWithSize(cid, T2, T5, space); | 971 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, T2, T5, space)); |
| 972 | 972 |
| 973 // Calculate the size tag. | 973 // Calculate the size tag. |
| 974 // V0: new object. | 974 // V0: new object. |
| 975 // T1: number of context variables. | 975 // T1: number of context variables. |
| 976 // T2: object size. | 976 // T2: object size. |
| 977 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; | 977 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; |
| 978 __ LoadImmediate(TMP, RawObject::SizeTag::kMaxSizeTag); | 978 __ LoadImmediate(TMP, RawObject::SizeTag::kMaxSizeTag); |
| 979 __ sltu(CMPRES1, TMP, T2); // CMPRES1 = T2 > TMP ? 1 : 0. | 979 __ sltu(CMPRES1, TMP, T2); // CMPRES1 = T2 > TMP ? 1 : 0. |
| 980 __ movn(T2, ZR, CMPRES1); // T2 = CMPRES1 != 0 ? 0 : T2. | 980 __ movn(T2, ZR, CMPRES1); // T2 = CMPRES1 != 0 ? 0 : T2. |
| 981 __ sll(TMP, T2, shift); // TMP = T2 << shift. | 981 __ sll(TMP, T2, shift); // TMP = T2 << shift. |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 // T5: heap. | 1146 // T5: heap. |
| 1147 __ lw(CMPRES1, Address(T5, Heap::EndOffset(space))); | 1147 __ lw(CMPRES1, Address(T5, Heap::EndOffset(space))); |
| 1148 if (FLAG_use_slow_path) { | 1148 if (FLAG_use_slow_path) { |
| 1149 __ b(&slow_case); | 1149 __ b(&slow_case); |
| 1150 } else { | 1150 } else { |
| 1151 __ BranchUnsignedGreaterEqual(T3, CMPRES1, &slow_case); | 1151 __ BranchUnsignedGreaterEqual(T3, CMPRES1, &slow_case); |
| 1152 } | 1152 } |
| 1153 // Successfully allocated the object(s), now update top to point to | 1153 // Successfully allocated the object(s), now update top to point to |
| 1154 // next object start and initialize the object. | 1154 // next object start and initialize the object. |
| 1155 __ sw(T3, Address(T5, Heap::TopOffset(space))); | 1155 __ sw(T3, Address(T5, Heap::TopOffset(space))); |
| 1156 __ UpdateAllocationStats(cls.id(), T5, space); | 1156 NOT_IN_PRODUCT(__ UpdateAllocationStats(cls.id(), T5, space)); |
| 1157 | 1157 |
| 1158 // T2: new object start. | 1158 // T2: new object start. |
| 1159 // T3: next object start. | 1159 // T3: next object start. |
| 1160 // T1: new object type arguments (if is_cls_parameterized). | 1160 // T1: new object type arguments (if is_cls_parameterized). |
| 1161 // Set the tags. | 1161 // Set the tags. |
| 1162 uword tags = 0; | 1162 uword tags = 0; |
| 1163 tags = RawObject::SizeTag::update(instance_size, tags); | 1163 tags = RawObject::SizeTag::update(instance_size, tags); |
| 1164 ASSERT(cls.id() != kIllegalCid); | 1164 ASSERT(cls.id() != kIllegalCid); |
| 1165 tags = RawObject::ClassIdTag::update(cls.id(), tags); | 1165 tags = RawObject::ClassIdTag::update(cls.id(), tags); |
| 1166 __ LoadImmediate(T0, tags); | 1166 __ LoadImmediate(T0, tags); |
| (...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2344 } | 2344 } |
| 2345 | 2345 |
| 2346 | 2346 |
| 2347 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { | 2347 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { |
| 2348 __ break_(0); | 2348 __ break_(0); |
| 2349 } | 2349 } |
| 2350 | 2350 |
| 2351 } // namespace dart | 2351 } // namespace dart |
| 2352 | 2352 |
| 2353 #endif // defined TARGET_ARCH_MIPS | 2353 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |