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" // Needed here to get TARGET_ARCH_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
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 Loading... |
270 __ SmiUntag(R2); \ | 270 __ SmiUntag(R2); \ |
271 /* Check for maximum allowed length. */ \ | 271 /* Check for maximum allowed length. */ \ |
272 /* R2: untagged array length. */ \ | 272 /* R2: untagged array length. */ \ |
273 __ CompareImmediate(R2, max_len); \ | 273 __ CompareImmediate(R2, max_len); \ |
274 __ b(&fall_through, GT); \ | 274 __ b(&fall_through, GT); \ |
275 __ mov(R2, Operand(R2, LSL, scale_shift)); \ | 275 __ mov(R2, Operand(R2, LSL, scale_shift)); \ |
276 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ | 276 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ |
277 __ AddImmediate(R2, fixed_size); \ | 277 __ AddImmediate(R2, fixed_size); \ |
278 __ bic(R2, R2, Operand(kObjectAlignment - 1)); \ | 278 __ bic(R2, R2, Operand(kObjectAlignment - 1)); \ |
279 Heap* heap = Isolate::Current()->heap(); \ | 279 Heap* heap = Isolate::Current()->heap(); \ |
280 \ | 280 Heap::Space space = heap->SpaceForAllocation(cid); \ |
281 __ LoadImmediate(R0, heap->TopAddress()); \ | 281 __ LoadImmediate(R0, heap->TopAddress(space)); \ |
282 __ ldr(R0, Address(R0, 0)); \ | 282 __ ldr(R0, Address(R0, 0)); \ |
283 \ | 283 \ |
284 /* R2: allocation size. */ \ | 284 /* R2: allocation size. */ \ |
285 __ add(R1, R0, Operand(R2)); \ | 285 __ add(R1, R0, Operand(R2)); \ |
286 __ b(&fall_through, VS); \ | 286 __ b(&fall_through, VS); \ |
287 \ | 287 \ |
288 /* Check if the allocation fits into the remaining space. */ \ | 288 /* Check if the allocation fits into the remaining space. */ \ |
289 /* R0: potential new object start. */ \ | 289 /* R0: potential new object start. */ \ |
290 /* R1: potential next object start. */ \ | 290 /* R1: potential next object start. */ \ |
291 /* R2: allocation size. */ \ | 291 /* R2: allocation size. */ \ |
292 __ LoadImmediate(R3, heap->EndAddress()); \ | 292 __ LoadImmediate(R3, heap->EndAddress(space)); \ |
293 __ ldr(R3, Address(R3, 0)); \ | 293 __ ldr(R3, Address(R3, 0)); \ |
294 __ cmp(R1, Operand(R3)); \ | 294 __ cmp(R1, Operand(R3)); \ |
295 __ b(&fall_through, CS); \ | 295 __ b(&fall_through, CS); \ |
296 \ | 296 \ |
297 /* Successfully allocated the object(s), now update top to point to */ \ | 297 /* Successfully allocated the object(s), now update top to point to */ \ |
298 /* next object start and initialize the object. */ \ | 298 /* next object start and initialize the object. */ \ |
299 __ LoadImmediate(R3, heap->TopAddress()); \ | 299 __ LoadImmediate(R3, heap->TopAddress(space)); \ |
300 __ str(R1, Address(R3, 0)); \ | 300 __ str(R1, Address(R3, 0)); \ |
301 __ AddImmediate(R0, kHeapObjectTag); \ | 301 __ AddImmediate(R0, kHeapObjectTag); \ |
302 __ UpdateAllocationStatsWithSize(cid, R2, R4); \ | 302 __ UpdateAllocationStatsWithSize(cid, R2, R4, space); \ |
303 /* Initialize the tags. */ \ | 303 /* Initialize the tags. */ \ |
304 /* R0: new object start as a tagged pointer. */ \ | 304 /* R0: new object start as a tagged pointer. */ \ |
305 /* R1: new object end address. */ \ | 305 /* R1: new object end address. */ \ |
306 /* R2: allocation size. */ \ | 306 /* R2: allocation size. */ \ |
307 { \ | 307 { \ |
308 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag); \ | 308 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag); \ |
309 __ mov(R2, Operand(R2, LSL, \ | 309 __ mov(R2, Operand(R2, LSL, \ |
310 RawObject::kSizeTagPos - kObjectAlignmentLog2), LS); \ | 310 RawObject::kSizeTagPos - kObjectAlignmentLog2), LS); \ |
311 __ mov(R2, Operand(0), HI); \ | 311 __ mov(R2, Operand(0), HI); \ |
312 \ | 312 \ |
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1377 Label fail; | 1377 Label fail; |
1378 | 1378 |
1379 __ mov(R6, Operand(length_reg)); // Save the length register. | 1379 __ mov(R6, Operand(length_reg)); // Save the length register. |
1380 __ SmiUntag(length_reg); | 1380 __ SmiUntag(length_reg); |
1381 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; | 1381 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; |
1382 __ AddImmediate(length_reg, fixed_size); | 1382 __ AddImmediate(length_reg, fixed_size); |
1383 __ bic(length_reg, length_reg, Operand(kObjectAlignment - 1)); | 1383 __ bic(length_reg, length_reg, Operand(kObjectAlignment - 1)); |
1384 | 1384 |
1385 Isolate* isolate = Isolate::Current(); | 1385 Isolate* isolate = Isolate::Current(); |
1386 Heap* heap = isolate->heap(); | 1386 Heap* heap = isolate->heap(); |
1387 | 1387 const intptr_t cid = kOneByteStringCid; |
1388 __ LoadImmediate(R3, heap->TopAddress()); | 1388 Heap::Space space = heap->SpaceForAllocation(cid); |
| 1389 __ LoadImmediate(R3, heap->TopAddress(space)); |
1389 __ ldr(R0, Address(R3, 0)); | 1390 __ ldr(R0, Address(R3, 0)); |
1390 | 1391 |
1391 // length_reg: allocation size. | 1392 // length_reg: allocation size. |
1392 __ adds(R1, R0, Operand(length_reg)); | 1393 __ adds(R1, R0, Operand(length_reg)); |
1393 __ b(&fail, VS); // Fail on overflow. | 1394 __ b(&fail, VS); // Fail on overflow. |
1394 | 1395 |
1395 // Check if the allocation fits into the remaining space. | 1396 // Check if the allocation fits into the remaining space. |
1396 // R0: potential new object start. | 1397 // R0: potential new object start. |
1397 // R1: potential next object start. | 1398 // R1: potential next object start. |
1398 // R2: allocation size. | 1399 // R2: allocation size. |
1399 // R3: heap->Top->Address(). | 1400 // R3: heap->TopAddress(space). |
1400 __ LoadImmediate(R7, heap->EndAddress()); | 1401 __ LoadImmediate(R7, heap->EndAddress(space)); |
1401 __ ldr(R7, Address(R7, 0)); | 1402 __ ldr(R7, Address(R7, 0)); |
1402 __ cmp(R1, Operand(R7)); | 1403 __ cmp(R1, Operand(R7)); |
1403 __ b(&fail, CS); | 1404 __ b(&fail, CS); |
1404 | 1405 |
1405 // Successfully allocated the object(s), now update top to point to | 1406 // Successfully allocated the object(s), now update top to point to |
1406 // next object start and initialize the object. | 1407 // next object start and initialize the object. |
1407 __ str(R1, Address(R3, 0)); | 1408 __ str(R1, Address(R3, 0)); |
1408 __ AddImmediate(R0, kHeapObjectTag); | 1409 __ AddImmediate(R0, kHeapObjectTag); |
1409 __ UpdateAllocationStatsWithSize(kOneByteStringCid, R2, R3); | 1410 __ UpdateAllocationStatsWithSize(cid, R2, R3, space); |
1410 | 1411 |
1411 // Initialize the tags. | 1412 // Initialize the tags. |
1412 // R0: new object start as a tagged pointer. | 1413 // R0: new object start as a tagged pointer. |
1413 // R1: new object end address. | 1414 // R1: new object end address. |
1414 // R2: allocation size. | 1415 // R2: allocation size. |
1415 { | 1416 { |
1416 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; | 1417 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; |
1417 const Class& cls = | |
1418 Class::Handle(isolate->object_store()->one_byte_string_class()); | |
1419 | 1418 |
1420 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag); | 1419 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag); |
1421 __ mov(R2, Operand(R2, LSL, shift), LS); | 1420 __ mov(R2, Operand(R2, LSL, shift), LS); |
1422 __ mov(R2, Operand(0), HI); | 1421 __ mov(R2, Operand(0), HI); |
1423 | 1422 |
1424 // Get the class index and insert it into the tags. | 1423 // Get the class index and insert it into the tags. |
1425 // R2: size and bit tags. | 1424 // R2: size and bit tags. |
1426 __ LoadImmediate(TMP, RawObject::ClassIdTag::encode(cls.id())); | 1425 __ LoadImmediate(TMP, RawObject::ClassIdTag::encode(cid)); |
1427 __ orr(R2, R2, Operand(TMP)); | 1426 __ orr(R2, R2, Operand(TMP)); |
1428 __ str(R2, FieldAddress(R0, String::tags_offset())); // Store tags. | 1427 __ str(R2, FieldAddress(R0, String::tags_offset())); // Store tags. |
1429 } | 1428 } |
1430 | 1429 |
1431 // Set the length field using the saved length (R6). | 1430 // Set the length field using the saved length (R6). |
1432 __ StoreIntoObjectNoBarrier(R0, | 1431 __ StoreIntoObjectNoBarrier(R0, |
1433 FieldAddress(R0, String::length_offset()), | 1432 FieldAddress(R0, String::length_offset()), |
1434 R6); | 1433 R6); |
1435 // Clear hash. | 1434 // Clear hash. |
1436 __ LoadImmediate(TMP, 0); | 1435 __ LoadImmediate(TMP, 0); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1634 Isolate* isolate = Isolate::Current(); | 1633 Isolate* isolate = Isolate::Current(); |
1635 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); | 1634 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); |
1636 // Set return value to Isolate::current_tag_. | 1635 // Set return value to Isolate::current_tag_. |
1637 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 1636 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
1638 __ Ret(); | 1637 __ Ret(); |
1639 } | 1638 } |
1640 | 1639 |
1641 } // namespace dart | 1640 } // namespace dart |
1642 | 1641 |
1643 #endif // defined TARGET_ARCH_ARM | 1642 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |