Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: runtime/vm/intrinsifier_mips.cc

Issue 578443003: Support old-space allocation in generated code (bump block only for now). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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" // Needed here to get TARGET_ARCH_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/intrinsifier.h" 8 #include "vm/intrinsifier.h"
9 9
10 #include "vm/assembler.h" 10 #include "vm/assembler.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 __ SmiUntag(T2); \ 270 __ SmiUntag(T2); \
271 /* Check for maximum allowed length. */ \ 271 /* Check for maximum allowed length. */ \
272 /* T2: untagged array length. */ \ 272 /* T2: untagged array length. */ \
273 __ BranchSignedGreater(T2, max_len, &fall_through); \ 273 __ BranchSignedGreater(T2, max_len, &fall_through); \
274 __ sll(T2, T2, scale_shift); \ 274 __ sll(T2, T2, scale_shift); \
275 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ 275 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \
276 __ AddImmediate(T2, fixed_size); \ 276 __ AddImmediate(T2, fixed_size); \
277 __ LoadImmediate(TMP, -kObjectAlignment); \ 277 __ LoadImmediate(TMP, -kObjectAlignment); \
278 __ and_(T2, T2, TMP); \ 278 __ and_(T2, T2, TMP); \
279 Heap* heap = Isolate::Current()->heap(); \ 279 Heap* heap = Isolate::Current()->heap(); \
280 \ 280 Heap::Space space = heap->SpaceForAllocation(cid); \
281 __ LoadImmediate(V0, heap->TopAddress()); \ 281 __ LoadImmediate(V0, heap->TopAddress(space)); \
282 __ lw(V0, Address(V0, 0)); \ 282 __ lw(V0, Address(V0, 0)); \
283 \ 283 \
284 /* T2: allocation size. */ \ 284 /* T2: allocation size. */ \
285 __ AdduDetectOverflow(T1, V0, T2, CMPRES1); \ 285 __ AdduDetectOverflow(T1, V0, T2, CMPRES1); \
286 __ bltz(CMPRES1, &fall_through); \ 286 __ bltz(CMPRES1, &fall_through); \
287 \ 287 \
288 /* Check if the allocation fits into the remaining space. */ \ 288 /* Check if the allocation fits into the remaining space. */ \
289 /* V0: potential new object start. */ \ 289 /* V0: potential new object start. */ \
290 /* T1: potential next object start. */ \ 290 /* T1: potential next object start. */ \
291 /* T2: allocation size. */ \ 291 /* T2: allocation size. */ \
292 __ LoadImmediate(T3, heap->EndAddress()); \ 292 __ LoadImmediate(T3, heap->EndAddress(space)); \
293 __ lw(T3, Address(T3, 0)); \ 293 __ lw(T3, Address(T3, 0)); \
294 __ BranchUnsignedGreaterEqual(T1, T3, &fall_through); \ 294 __ BranchUnsignedGreaterEqual(T1, T3, &fall_through); \
295 \ 295 \
296 /* Successfully allocated the object(s), now update top to point to */ \ 296 /* Successfully allocated the object(s), now update top to point to */ \
297 /* next object start and initialize the object. */ \ 297 /* next object start and initialize the object. */ \
298 __ LoadImmediate(T3, heap->TopAddress()); \ 298 __ LoadImmediate(T3, heap->TopAddress(space)); \
299 __ sw(T1, Address(T3, 0)); \ 299 __ sw(T1, Address(T3, 0)); \
300 __ AddImmediate(V0, kHeapObjectTag); \ 300 __ AddImmediate(V0, kHeapObjectTag); \
301 __ UpdateAllocationStatsWithSize(cid, T2, T4); \ 301 __ UpdateAllocationStatsWithSize(cid, T2, T4, space); \
302 /* Initialize the tags. */ \ 302 /* Initialize the tags. */ \
303 /* V0: new object start as a tagged pointer. */ \ 303 /* V0: new object start as a tagged pointer. */ \
304 /* T1: new object end address. */ \ 304 /* T1: new object end address. */ \
305 /* T2: allocation size. */ \ 305 /* T2: allocation size. */ \
306 { \ 306 { \
307 Label size_tag_overflow, done; \ 307 Label size_tag_overflow, done; \
308 __ BranchUnsignedGreater(T2, RawObject::SizeTag::kMaxSizeTag, \ 308 __ BranchUnsignedGreater(T2, RawObject::SizeTag::kMaxSizeTag, \
309 &size_tag_overflow); \ 309 &size_tag_overflow); \
310 __ b(&done); \ 310 __ b(&done); \
311 __ delay_slot()->sll(T2, T2, \ 311 __ delay_slot()->sll(T2, T2, \
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 1425
1426 __ mov(T6, length_reg); // Save the length register. 1426 __ mov(T6, length_reg); // Save the length register.
1427 __ SmiUntag(length_reg); 1427 __ SmiUntag(length_reg);
1428 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; 1428 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1;
1429 __ AddImmediate(length_reg, fixed_size); 1429 __ AddImmediate(length_reg, fixed_size);
1430 __ LoadImmediate(TMP, ~(kObjectAlignment - 1)); 1430 __ LoadImmediate(TMP, ~(kObjectAlignment - 1));
1431 __ and_(length_reg, length_reg, TMP); 1431 __ and_(length_reg, length_reg, TMP);
1432 1432
1433 Isolate* isolate = Isolate::Current(); 1433 Isolate* isolate = Isolate::Current();
1434 Heap* heap = isolate->heap(); 1434 Heap* heap = isolate->heap();
1435 1435 Heap::Space space = heap->SpaceForAllocation(kOneByteStringCid);
1436 __ LoadImmediate(T3, heap->TopAddress()); 1436 __ LoadImmediate(T3, heap->TopAddress(space));
1437 __ lw(V0, Address(T3, 0)); 1437 __ lw(V0, Address(T3, 0));
1438 1438
1439 // length_reg: allocation size. 1439 // length_reg: allocation size.
1440 __ AdduDetectOverflow(T1, V0, length_reg, CMPRES1); 1440 __ AdduDetectOverflow(T1, V0, length_reg, CMPRES1);
1441 __ bltz(CMPRES1, failure); // Fail on overflow. 1441 __ bltz(CMPRES1, failure); // Fail on overflow.
1442 1442
1443 // Check if the allocation fits into the remaining space. 1443 // Check if the allocation fits into the remaining space.
1444 // V0: potential new object start. 1444 // V0: potential new object start.
1445 // T1: potential next object start. 1445 // T1: potential next object start.
1446 // T2: allocation size. 1446 // T2: allocation size.
1447 // T3: heap->TopAddress(). 1447 // T3: heap->TopAddress(space).
1448 __ LoadImmediate(T4, heap->EndAddress()); 1448 __ LoadImmediate(T4, heap->EndAddress(space));
1449 __ lw(T4, Address(T4, 0)); 1449 __ lw(T4, Address(T4, 0));
1450 __ BranchUnsignedGreaterEqual(T1, T4, failure); 1450 __ BranchUnsignedGreaterEqual(T1, T4, failure);
1451 1451
1452 // Successfully allocated the object(s), now update top to point to 1452 // Successfully allocated the object(s), now update top to point to
1453 // next object start and initialize the object. 1453 // next object start and initialize the object.
1454 __ sw(T1, Address(T3, 0)); 1454 __ sw(T1, Address(T3, 0));
1455 __ AddImmediate(V0, kHeapObjectTag); 1455 __ AddImmediate(V0, kHeapObjectTag);
1456 1456
1457 __ UpdateAllocationStatsWithSize(kOneByteStringCid, T2, T3); 1457 __ UpdateAllocationStatsWithSize(kOneByteStringCid, T2, T3, space);
1458 1458
1459 // Initialize the tags. 1459 // Initialize the tags.
1460 // V0: new object start as a tagged pointer. 1460 // V0: new object start as a tagged pointer.
1461 // T1: new object end address. 1461 // T1: new object end address.
1462 // T2: allocation size. 1462 // T2: allocation size.
1463 { 1463 {
1464 Label overflow, done; 1464 Label overflow, done;
1465 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; 1465 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2;
1466 const Class& cls = 1466 const Class& cls =
1467 Class::Handle(isolate->object_store()->one_byte_string_class()); 1467 Class::Handle(isolate->object_store()->one_byte_string_class());
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 Isolate* isolate = Isolate::Current(); 1672 Isolate* isolate = Isolate::Current();
1673 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate)); 1673 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate));
1674 // Set return value. 1674 // Set return value.
1675 __ Ret(); 1675 __ Ret();
1676 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); 1676 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset()));
1677 } 1677 }
1678 1678
1679 } // namespace dart 1679 } // namespace dart
1680 1680
1681 #endif // defined TARGET_ARCH_MIPS 1681 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698