| 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" |
| 11 #include "vm/runtime_entry.h" | 11 #include "vm/runtime_entry.h" |
| 12 #include "vm/stub_code.h" | 12 #include "vm/stub_code.h" |
| 13 | 13 |
| 14 namespace dart { | 14 namespace dart { |
| 15 | 15 |
| 16 DECLARE_RUNTIME_ENTRY(StoreBuffer); | |
| 17 | |
| 18 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); | 16 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); |
| 19 DEFINE_FLAG(bool, code_comments, false, | 17 DEFINE_FLAG(bool, code_comments, false, |
| 20 "Include comments into code and disassembly"); | 18 "Include comments into code and disassembly"); |
| 21 | 19 |
| 22 | 20 |
| 23 class DirectCallRelocation : public AssemblerFixup { | 21 class DirectCallRelocation : public AssemblerFixup { |
| 24 public: | 22 public: |
| 25 void Process(const MemoryRegion& region, int position) { | 23 void Process(const MemoryRegion& region, int position) { |
| 26 // Direct calls are relative to the following instruction on x86. | 24 // Direct calls are relative to the following instruction on x86. |
| 27 int32_t pointer = region.Load<int32_t>(position); | 25 int32_t pointer = region.Load<int32_t>(position); |
| (...skipping 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1393 Label done; | 1391 Label done; |
| 1394 // Check that 'value' is a new object. Store buffer updates are not | 1392 // Check that 'value' is a new object. Store buffer updates are not |
| 1395 // required when storing a smi or an old object. | 1393 // required when storing a smi or an old object. |
| 1396 testl(value, Immediate(kNewObjectAlignmentOffset | kHeapObjectTag)); | 1394 testl(value, Immediate(kNewObjectAlignmentOffset | kHeapObjectTag)); |
| 1397 j(PARITY_ODD, &done, Assembler::kNearJump); | 1395 j(PARITY_ODD, &done, Assembler::kNearJump); |
| 1398 // Check that 'object' is an old object. A store buffer update is | 1396 // Check that 'object' is an old object. A store buffer update is |
| 1399 // not required when storing into a new object. | 1397 // not required when storing into a new object. |
| 1400 testl(object, Immediate(kNewObjectAlignmentOffset)); | 1398 testl(object, Immediate(kNewObjectAlignmentOffset)); |
| 1401 j(NOT_ZERO, &done, Assembler::kNearJump); | 1399 j(NOT_ZERO, &done, Assembler::kNearJump); |
| 1402 // A store buffer update is required. | 1400 // A store buffer update is required. |
| 1403 pushal(); | 1401 pushl(EAX); // Preserve EAX. |
| 1404 movl(EBP, ESP); | 1402 leal(EAX, dest); |
| 1405 ReserveAlignedFrameSpace(kWordSize); | 1403 call(&StubCode::UpdateStoreBufferLabel()); |
| 1406 movl(EAX, dest); | 1404 popl(EAX); // Restore EAX. |
| 1407 movl(Address(ESP, 0), EAX); // Push argument | |
| 1408 CallRuntime(kStoreBufferRuntimeEntry); | |
| 1409 movl(ESP, EBP); | |
| 1410 popal(); | |
| 1411 Bind(&done); | 1405 Bind(&done); |
| 1412 } | 1406 } |
| 1413 | 1407 |
| 1414 | 1408 |
| 1415 void Assembler::StoreIntoObjectNoBarrier(Register object, | 1409 void Assembler::StoreIntoObjectNoBarrier(Register object, |
| 1416 const FieldAddress& dest, | 1410 const FieldAddress& dest, |
| 1417 Register value) { | 1411 Register value) { |
| 1418 movl(dest, value); | 1412 movl(dest, value); |
| 1419 #if 0 // TODO(cshapiro) Turn this back on after it is fixed defined(DEBUG). | 1413 #if 0 // TODO(cshapiro) Turn this back on after it is fixed defined(DEBUG). |
| 1420 Label done; | 1414 Label done; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1731 comments.SetCommentAt(i, comments_[i]->comment()); | 1725 comments.SetCommentAt(i, comments_[i]->comment()); |
| 1732 } | 1726 } |
| 1733 | 1727 |
| 1734 return comments; | 1728 return comments; |
| 1735 } | 1729 } |
| 1736 | 1730 |
| 1737 | 1731 |
| 1738 } // namespace dart | 1732 } // namespace dart |
| 1739 | 1733 |
| 1740 #endif // defined TARGET_ARCH_IA32 | 1734 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |