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

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

Issue 2951333002: Moves the top_ and end_ words of the Scavenger into mutator thread. (Closed)
Patch Set: Full removal of heap's top/end offsets. Changed allocs in other archs. Created 3 years, 5 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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" // NOLINT 5 #include "vm/globals.h" // NOLINT
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/longjump.h" 10 #include "vm/longjump.h"
(...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 Register instance_reg, 1337 Register instance_reg,
1338 Register temp_reg) { 1338 Register temp_reg) {
1339 ASSERT(failure != NULL); 1339 ASSERT(failure != NULL);
1340 if (FLAG_inline_alloc) { 1340 if (FLAG_inline_alloc) {
1341 // If this allocation is traced, program will jump to failure path 1341 // If this allocation is traced, program will jump to failure path
1342 // (i.e. the allocation stub) which will allocate the object and trace the 1342 // (i.e. the allocation stub) which will allocate the object and trace the
1343 // allocation call site. 1343 // allocation call site.
1344 NOT_IN_PRODUCT(MaybeTraceAllocation(cls.id(), temp_reg, failure)); 1344 NOT_IN_PRODUCT(MaybeTraceAllocation(cls.id(), temp_reg, failure));
1345 const intptr_t instance_size = cls.instance_size(); 1345 const intptr_t instance_size = cls.instance_size();
1346 Heap::Space space = Heap::kNew; 1346 Heap::Space space = Heap::kNew;
1347 ldr(temp_reg, Address(THR, Thread::heap_offset())); 1347 ldr(instance_reg, Address(THR, Thread::top_offset()));
1348 ldr(instance_reg, Address(temp_reg, Heap::TopOffset(space)));
1349 // TODO(koda): Protect against unsigned overflow here. 1348 // TODO(koda): Protect against unsigned overflow here.
1350 AddImmediateSetFlags(instance_reg, instance_reg, instance_size); 1349 AddImmediateSetFlags(instance_reg, instance_reg, instance_size);
1351 1350
1352 // instance_reg: potential next object start. 1351 // instance_reg: potential next object start.
1353 ldr(TMP, Address(temp_reg, Heap::EndOffset(space))); 1352 ldr(TMP, Address(THR, Thread::end_offset()));
1354 CompareRegisters(TMP, instance_reg); 1353 CompareRegisters(TMP, instance_reg);
1355 // fail if heap end unsigned less than or equal to instance_reg. 1354 // fail if heap end unsigned less than or equal to instance_reg.
1356 b(failure, LS); 1355 b(failure, LS);
1357 1356
1358 // Successfully allocated the object, now update top to point to 1357 // Successfully allocated the object, now update top to point to
1359 // next object start and store the class in the class field of object. 1358 // next object start and store the class in the class field of object.
1360 str(instance_reg, Address(temp_reg, Heap::TopOffset(space))); 1359 str(instance_reg, Address(THR, Thread::top_offset()));
1361 1360
1362 ASSERT(instance_size >= kHeapObjectTag); 1361 ASSERT(instance_size >= kHeapObjectTag);
1363 AddImmediate(instance_reg, -instance_size + kHeapObjectTag); 1362 AddImmediate(instance_reg, -instance_size + kHeapObjectTag);
1364 NOT_IN_PRODUCT(UpdateAllocationStats(cls.id(), space)); 1363 NOT_IN_PRODUCT(UpdateAllocationStats(cls.id(), space));
1365 1364
1366 uword tags = 0; 1365 uword tags = 0;
1367 tags = RawObject::SizeTag::update(instance_size, tags); 1366 tags = RawObject::SizeTag::update(instance_size, tags);
1368 ASSERT(cls.id() != kIllegalCid); 1367 ASSERT(cls.id() != kIllegalCid);
1369 tags = RawObject::ClassIdTag::update(cls.id(), tags); 1368 tags = RawObject::ClassIdTag::update(cls.id(), tags);
1370 LoadImmediate(TMP, tags); 1369 LoadImmediate(TMP, tags);
(...skipping 10 matching lines...) Expand all
1381 Register instance, 1380 Register instance,
1382 Register end_address, 1381 Register end_address,
1383 Register temp1, 1382 Register temp1,
1384 Register temp2) { 1383 Register temp2) {
1385 if (FLAG_inline_alloc) { 1384 if (FLAG_inline_alloc) {
1386 // If this allocation is traced, program will jump to failure path 1385 // If this allocation is traced, program will jump to failure path
1387 // (i.e. the allocation stub) which will allocate the object and trace the 1386 // (i.e. the allocation stub) which will allocate the object and trace the
1388 // allocation call site. 1387 // allocation call site.
1389 NOT_IN_PRODUCT(MaybeTraceAllocation(cid, temp1, failure)); 1388 NOT_IN_PRODUCT(MaybeTraceAllocation(cid, temp1, failure));
1390 Heap::Space space = Heap::kNew; 1389 Heap::Space space = Heap::kNew;
1391 ldr(temp1, Address(THR, Thread::heap_offset()));
1392 // Potential new object start. 1390 // Potential new object start.
1393 ldr(instance, Address(temp1, Heap::TopOffset(space))); 1391 ldr(instance, Address(THR, Thread::top_offset()));
1394 AddImmediateSetFlags(end_address, instance, instance_size); 1392 AddImmediateSetFlags(end_address, instance, instance_size);
1395 b(failure, CS); // Fail on unsigned overflow. 1393 b(failure, CS); // Fail on unsigned overflow.
1396 1394
1397 // Check if the allocation fits into the remaining space. 1395 // Check if the allocation fits into the remaining space.
1398 // instance: potential new object start. 1396 // instance: potential new object start.
1399 // end_address: potential next object start. 1397 // end_address: potential next object start.
1400 ldr(temp2, Address(temp1, Heap::EndOffset(space))); 1398 ldr(temp2, Address(THR, Thread::end_offset()));
1401 cmp(end_address, Operand(temp2)); 1399 cmp(end_address, Operand(temp2));
1402 b(failure, CS); 1400 b(failure, CS);
1403 1401
1404 // Successfully allocated the object(s), now update top to point to 1402 // Successfully allocated the object(s), now update top to point to
1405 // next object start and initialize the object. 1403 // next object start and initialize the object.
1406 str(end_address, Address(temp1, Heap::TopOffset(space))); 1404 str(end_address, Address(THR, Thread::top_offset()));
1407 add(instance, instance, Operand(kHeapObjectTag)); 1405 add(instance, instance, Operand(kHeapObjectTag));
1408 LoadImmediate(temp2, instance_size); 1406 LoadImmediate(temp2, instance_size);
1409 NOT_IN_PRODUCT(UpdateAllocationStatsWithSize(cid, temp2, space)); 1407 NOT_IN_PRODUCT(UpdateAllocationStatsWithSize(cid, temp2, space));
1410 1408
1411 // Initialize the tags. 1409 // Initialize the tags.
1412 // instance: new object start as a tagged pointer. 1410 // instance: new object start as a tagged pointer.
1413 uword tags = 0; 1411 uword tags = 0;
1414 tags = RawObject::ClassIdTag::update(cid, tags); 1412 tags = RawObject::ClassIdTag::update(cid, tags);
1415 tags = RawObject::SizeTag::update(instance_size, tags); 1413 tags = RawObject::SizeTag::update(instance_size, tags);
1416 LoadImmediate(temp2, tags); 1414 LoadImmediate(temp2, tags);
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 str(tmp, Address(addr, 7), kUnsignedByte); 1569 str(tmp, Address(addr, 7), kUnsignedByte);
1572 if (sz == kDoubleWord) { 1570 if (sz == kDoubleWord) {
1573 return; 1571 return;
1574 } 1572 }
1575 UNIMPLEMENTED(); 1573 UNIMPLEMENTED();
1576 } 1574 }
1577 1575
1578 } // namespace dart 1576 } // namespace dart
1579 1577
1580 #endif // defined TARGET_ARCH_ARM64 1578 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/assembler_arm.cc ('k') | runtime/vm/assembler_ia32.cc » ('j') | runtime/vm/heap.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698