| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/heap.h" | 9 #include "vm/heap.h" |
| 10 #include "vm/memory_region.h" | 10 #include "vm/memory_region.h" |
| (...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1395 if (object.IsSmi()) { | 1395 if (object.IsSmi()) { |
| 1396 cmpq(reg, Immediate(reinterpret_cast<int64_t>(object.raw()))); | 1396 cmpq(reg, Immediate(reinterpret_cast<int64_t>(object.raw()))); |
| 1397 } else { | 1397 } else { |
| 1398 ASSERT(reg != TMP); | 1398 ASSERT(reg != TMP); |
| 1399 LoadObject(TMP, object); | 1399 LoadObject(TMP, object); |
| 1400 cmpq(reg, TMP); | 1400 cmpq(reg, TMP); |
| 1401 } | 1401 } |
| 1402 } | 1402 } |
| 1403 | 1403 |
| 1404 | 1404 |
| 1405 void Assembler::StoreIntoObjectFilter(Register object, |
| 1406 Register value, |
| 1407 Label* no_update) { |
| 1408 // Check that 'value' is a new object. Store buffer updates are not |
| 1409 // required when storing a smi or an old object. |
| 1410 testl(value, Immediate(kNewObjectAlignmentOffset | kHeapObjectTag)); |
| 1411 j(PARITY_ODD, no_update, Assembler::kNearJump); |
| 1412 j(ZERO, no_update, Assembler::kNearJump); |
| 1413 // Check that 'object' is an old object. A store buffer update is |
| 1414 // not required when storing into a new object. |
| 1415 testl(object, Immediate(kNewObjectAlignmentOffset)); |
| 1416 j(NOT_ZERO, no_update, Assembler::kNearJump); |
| 1417 } |
| 1418 |
| 1419 |
| 1405 void Assembler::StoreIntoObject(Register object, | 1420 void Assembler::StoreIntoObject(Register object, |
| 1406 const FieldAddress& dest, | 1421 const FieldAddress& dest, |
| 1407 Register value) { | 1422 Register value) { |
| 1408 // TODO(iposva): Add write barrier. | |
| 1409 movq(dest, value); | 1423 movq(dest, value); |
| 1424 |
| 1425 Label done; |
| 1426 StoreIntoObjectFilter(object, value, &done); |
| 1427 // A store buffer update is required. |
| 1428 pushq(RAX); |
| 1429 leaq(RAX, dest); |
| 1430 call(&StubCode::UpdateStoreBufferLabel()); |
| 1431 popq(RAX); |
| 1432 Bind(&done); |
| 1433 } |
| 1434 |
| 1435 |
| 1436 void Assembler::StoreIntoObjectNoBarrier(Register object, |
| 1437 const FieldAddress& dest, |
| 1438 Register value) { |
| 1439 movq(dest, value); |
| 1440 #if defined(DEBUG) |
| 1441 Label done; |
| 1442 StoreIntoObjectFilter(object, value, &done); |
| 1443 Stop("Store buffer update is required"); |
| 1444 Bind(&done); |
| 1445 #endif // defined(DEBUG) |
| 1446 // No store buffer update. |
| 1410 } | 1447 } |
| 1411 | 1448 |
| 1412 | 1449 |
| 1413 void Assembler::DoubleNegate(XmmRegister d) { | 1450 void Assembler::DoubleNegate(XmmRegister d) { |
| 1414 static const struct ALIGN16 { | 1451 static const struct ALIGN16 { |
| 1415 uint64_t a; | 1452 uint64_t a; |
| 1416 uint64_t b; | 1453 uint64_t b; |
| 1417 } double_negate_constant = | 1454 } double_negate_constant = |
| 1418 {0x8000000000000000LL, 0x8000000000000000LL}; | 1455 {0x8000000000000000LL, 0x8000000000000000LL}; |
| 1419 movq(TMP, Immediate(reinterpret_cast<intptr_t>(&double_negate_constant))); | 1456 movq(TMP, Immediate(reinterpret_cast<intptr_t>(&double_negate_constant))); |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1684 comments.SetCommentAt(i, comments_[i]->comment()); | 1721 comments.SetCommentAt(i, comments_[i]->comment()); |
| 1685 } | 1722 } |
| 1686 | 1723 |
| 1687 return comments; | 1724 return comments; |
| 1688 } | 1725 } |
| 1689 | 1726 |
| 1690 | 1727 |
| 1691 } // namespace dart | 1728 } // namespace dart |
| 1692 | 1729 |
| 1693 #endif // defined TARGET_ARCH_X64 | 1730 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |