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