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 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1372 Label fail; | 1372 Label fail; |
1373 | 1373 |
1374 __ mov(R6, Operand(length_reg)); // Save the length register. | 1374 __ mov(R6, Operand(length_reg)); // Save the length register. |
1375 __ SmiUntag(length_reg); | 1375 __ SmiUntag(length_reg); |
1376 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; | 1376 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; |
1377 __ AddImmediate(length_reg, fixed_size); | 1377 __ AddImmediate(length_reg, fixed_size); |
1378 __ bic(length_reg, length_reg, Operand(kObjectAlignment - 1)); | 1378 __ bic(length_reg, length_reg, Operand(kObjectAlignment - 1)); |
1379 | 1379 |
1380 Isolate* isolate = Isolate::Current(); | 1380 Isolate* isolate = Isolate::Current(); |
1381 Heap* heap = isolate->heap(); | 1381 Heap* heap = isolate->heap(); |
1382 | 1382 Heap::Space space = heap->SpaceForAllocation(kOneByteStringCid); |
1383 __ LoadImmediate(R3, heap->TopAddress()); | 1383 __ LoadImmediate(R3, heap->TopAddress(space)); |
1384 __ ldr(R0, Address(R3, 0)); | 1384 __ ldr(R0, Address(R3, 0)); |
1385 | 1385 |
1386 // length_reg: allocation size. | 1386 // length_reg: allocation size. |
1387 __ adds(R1, R0, Operand(length_reg)); | 1387 __ adds(R1, R0, Operand(length_reg)); |
1388 __ b(&fail, VS); // Fail on overflow. | 1388 __ b(&fail, VS); // Fail on overflow. |
1389 | 1389 |
1390 // Check if the allocation fits into the remaining space. | 1390 // Check if the allocation fits into the remaining space. |
1391 // R0: potential new object start. | 1391 // R0: potential new object start. |
1392 // R1: potential next object start. | 1392 // R1: potential next object start. |
1393 // R2: allocation size. | 1393 // R2: allocation size. |
1394 // R3: heap->Top->Address(). | 1394 // R3: heap->TopAddress(space). |
1395 __ LoadImmediate(R7, heap->EndAddress()); | 1395 __ LoadImmediate(R7, heap->EndAddress(space)); |
1396 __ ldr(R7, Address(R7, 0)); | 1396 __ ldr(R7, Address(R7, 0)); |
1397 __ cmp(R1, Operand(R7)); | 1397 __ cmp(R1, Operand(R7)); |
1398 __ b(&fail, CS); | 1398 __ b(&fail, CS); |
1399 | 1399 |
1400 // Successfully allocated the object(s), now update top to point to | 1400 // Successfully allocated the object(s), now update top to point to |
1401 // next object start and initialize the object. | 1401 // next object start and initialize the object. |
1402 __ str(R1, Address(R3, 0)); | 1402 __ str(R1, Address(R3, 0)); |
1403 __ AddImmediate(R0, kHeapObjectTag); | 1403 __ AddImmediate(R0, kHeapObjectTag); |
1404 __ UpdateAllocationStatsWithSize(kOneByteStringCid, R2, R3); | 1404 __ UpdateAllocationStatsWithSize(kOneByteStringCid, R2, R3, space); |
1405 | 1405 |
1406 // Initialize the tags. | 1406 // Initialize the tags. |
1407 // R0: new object start as a tagged pointer. | 1407 // R0: new object start as a tagged pointer. |
1408 // R1: new object end address. | 1408 // R1: new object end address. |
1409 // R2: allocation size. | 1409 // R2: allocation size. |
1410 { | 1410 { |
1411 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; | 1411 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; |
1412 const Class& cls = | 1412 const Class& cls = |
1413 Class::Handle(isolate->object_store()->one_byte_string_class()); | 1413 Class::Handle(isolate->object_store()->one_byte_string_class()); |
1414 | 1414 |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1630 Isolate* isolate = Isolate::Current(); | 1630 Isolate* isolate = Isolate::Current(); |
1631 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); | 1631 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); |
1632 // Set return value to Isolate::current_tag_. | 1632 // Set return value to Isolate::current_tag_. |
1633 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 1633 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
1634 __ Ret(); | 1634 __ Ret(); |
1635 } | 1635 } |
1636 | 1636 |
1637 } // namespace dart | 1637 } // namespace dart |
1638 | 1638 |
1639 #endif // defined TARGET_ARCH_ARM | 1639 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |