| 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_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1394 // Check that 'value' is a new object. Store buffer updates are not | 1394 // Check that 'value' is a new object. Store buffer updates are not |
| 1395 // required when storing a smi or an old object. | 1395 // required when storing a smi or an old object. |
| 1396 testl(value, Immediate(kNewObjectAlignmentOffset | kHeapObjectTag)); | 1396 testl(value, Immediate(kNewObjectAlignmentOffset | kHeapObjectTag)); |
| 1397 j(PARITY_ODD, &done, Assembler::kNearJump); | 1397 j(PARITY_ODD, &done, Assembler::kNearJump); |
| 1398 // Check that 'object' is an old object. A store buffer update is | 1398 // Check that 'object' is an old object. A store buffer update is |
| 1399 // not required when storing into a new object. | 1399 // not required when storing into a new object. |
| 1400 testl(object, Immediate(kNewObjectAlignmentOffset)); | 1400 testl(object, Immediate(kNewObjectAlignmentOffset)); |
| 1401 j(NOT_ZERO, &done, Assembler::kNearJump); | 1401 j(NOT_ZERO, &done, Assembler::kNearJump); |
| 1402 // A store buffer update is required. | 1402 // A store buffer update is required. |
| 1403 pushal(); | 1403 pushal(); |
| 1404 pushl(dest); // Push argument | 1404 movl(EBP, ESP); |
| 1405 ReserveAlignedFrameSpace(kWordSize); |
| 1406 movl(EAX, dest); |
| 1407 movl(Address(ESP, 0), EAX); // Push argument |
| 1405 CallRuntime(kStoreBufferRuntimeEntry); | 1408 CallRuntime(kStoreBufferRuntimeEntry); |
| 1406 popl(value); // Pop argument | 1409 movl(ESP, EBP); |
| 1407 popal(); | 1410 popal(); |
| 1408 Bind(&done); | 1411 Bind(&done); |
| 1409 } | 1412 } |
| 1410 | 1413 |
| 1411 | 1414 |
| 1412 void Assembler::StoreIntoObjectNoBarrier(Register object, | 1415 void Assembler::StoreIntoObjectNoBarrier(Register object, |
| 1413 const FieldAddress& dest, | 1416 const FieldAddress& dest, |
| 1414 Register value) { | 1417 Register value) { |
| 1415 movl(dest, value); | 1418 movl(dest, value); |
| 1416 #if 0 // TODO(cshapiro) Turn this back on after it is fixed defined(DEBUG). | 1419 #if 0 // TODO(cshapiro) Turn this back on after it is fixed defined(DEBUG). |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1496 } | 1499 } |
| 1497 } | 1500 } |
| 1498 | 1501 |
| 1499 | 1502 |
| 1500 void Assembler::LeaveFrame() { | 1503 void Assembler::LeaveFrame() { |
| 1501 movl(ESP, EBP); | 1504 movl(ESP, EBP); |
| 1502 popl(EBP); | 1505 popl(EBP); |
| 1503 } | 1506 } |
| 1504 | 1507 |
| 1505 | 1508 |
| 1509 void Assembler::ReserveAlignedFrameSpace(intptr_t frame_space) { |
| 1510 // Reserve space for arguments and align frame before entering |
| 1511 // the C++ world. |
| 1512 AddImmediate(ESP, Immediate(-frame_space)); |
| 1513 if (OS::ActivationFrameAlignment() > 0) { |
| 1514 andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1))); |
| 1515 } |
| 1516 } |
| 1517 |
| 1518 |
| 1506 void Assembler::CallRuntime(const RuntimeEntry& entry) { | 1519 void Assembler::CallRuntime(const RuntimeEntry& entry) { |
| 1507 entry.Call(this); | 1520 entry.Call(this); |
| 1508 } | 1521 } |
| 1509 | 1522 |
| 1510 | 1523 |
| 1511 void Assembler::Align(int alignment, int offset) { | 1524 void Assembler::Align(int alignment, int offset) { |
| 1512 ASSERT(Utils::IsPowerOfTwo(alignment)); | 1525 ASSERT(Utils::IsPowerOfTwo(alignment)); |
| 1513 int pos = offset + buffer_.GetPosition(); | 1526 int pos = offset + buffer_.GetPosition(); |
| 1514 int mod = pos & (alignment - 1); | 1527 int mod = pos & (alignment - 1); |
| 1515 if (mod == 0) { | 1528 if (mod == 0) { |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1718 comments.SetCommentAt(i, comments_[i]->comment()); | 1731 comments.SetCommentAt(i, comments_[i]->comment()); |
| 1719 } | 1732 } |
| 1720 | 1733 |
| 1721 return comments; | 1734 return comments; |
| 1722 } | 1735 } |
| 1723 | 1736 |
| 1724 | 1737 |
| 1725 } // namespace dart | 1738 } // namespace dart |
| 1726 | 1739 |
| 1727 #endif // defined TARGET_ARCH_IA32 | 1740 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |