Chromium Code Reviews| 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 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1380 EmitOperand(7, Operand(reg)); | 1380 EmitOperand(7, Operand(reg)); |
| 1381 buffer_.EmitObject(object); | 1381 buffer_.EmitObject(object); |
| 1382 } | 1382 } |
| 1383 } | 1383 } |
| 1384 } | 1384 } |
| 1385 | 1385 |
| 1386 | 1386 |
| 1387 void Assembler::StoreIntoObjectFilter(Register object, | 1387 void Assembler::StoreIntoObjectFilter(Register object, |
| 1388 Register value, | 1388 Register value, |
| 1389 Label* no_update) { | 1389 Label* no_update) { |
| 1390 // Check that 'value' is a new object. Store buffer updates are not | 1390 andl(value, Immediate(0x5)); |
|
kasperl
2012/06/21 05:05:47
I think you should add a comment here explaning th
Ivan Posva
2012/06/22 06:56:22
Thanks! Half of the credit goes to Slava...
I wil
| |
| 1391 // required when storing a smi or an old object. | 1391 shrl(value, Immediate(1)); |
| 1392 testl(value, Immediate(kNewObjectAlignmentOffset | kHeapObjectTag)); | 1392 adcl(value, object); |
| 1393 j(PARITY_ODD, no_update, Assembler::kNearJump); | 1393 andl(value, Immediate(0x7)); |
| 1394 j(ZERO, no_update, Assembler::kNearJump); | 1394 cmpl(value, Immediate(0x4)); |
| 1395 // Check that 'object' is an old object. A store buffer update is | 1395 j(NOT_ZERO, no_update); |
|
sra1
2012/06/22 05:17:44
and value,7
lea value,[object*8 + value]
and value
Ivan Posva
2012/06/22 06:56:22
Thanks for the suggestion to use lea to separate t
| |
| 1396 // not required when storing into a new object. | |
| 1397 testl(object, Immediate(kNewObjectAlignmentOffset)); | |
| 1398 j(NOT_ZERO, no_update, Assembler::kNearJump); | |
| 1399 } | 1396 } |
| 1400 | 1397 |
| 1401 | 1398 |
| 1402 void Assembler::StoreIntoObject(Register object, | 1399 void Assembler::StoreIntoObject(Register object, |
| 1403 const FieldAddress& dest, | 1400 const FieldAddress& dest, |
| 1404 Register value) { | 1401 Register value) { |
| 1405 movl(dest, value); | 1402 movl(dest, value); |
| 1406 Label done; | 1403 Label done; |
| 1404 pushl(value); | |
| 1407 StoreIntoObjectFilter(object, value, &done); | 1405 StoreIntoObjectFilter(object, value, &done); |
| 1408 // A store buffer update is required. | 1406 // A store buffer update is required. |
| 1409 pushl(EAX); // Preserve EAX. | 1407 if (value != EAX) pushl(EAX); // Preserve EAX. |
| 1410 leal(EAX, dest); | 1408 leal(EAX, dest); |
| 1411 call(&StubCode::UpdateStoreBufferLabel()); | 1409 call(&StubCode::UpdateStoreBufferLabel()); |
| 1412 popl(EAX); // Restore EAX. | 1410 if (value != EAX) popl(EAX); // Restore EAX. |
| 1413 Bind(&done); | 1411 Bind(&done); |
| 1412 popl(value); | |
| 1414 } | 1413 } |
| 1415 | 1414 |
| 1416 | 1415 |
| 1417 void Assembler::StoreIntoObjectNoBarrier(Register object, | 1416 void Assembler::StoreIntoObjectNoBarrier(Register object, |
| 1418 const FieldAddress& dest, | 1417 const FieldAddress& dest, |
| 1419 Register value) { | 1418 Register value) { |
| 1420 movl(dest, value); | 1419 movl(dest, value); |
| 1421 #if defined(DEBUG) | 1420 #if defined(DEBUG) |
| 1422 Label done; | 1421 Label done; |
| 1422 pushl(value); | |
| 1423 StoreIntoObjectFilter(object, value, &done); | 1423 StoreIntoObjectFilter(object, value, &done); |
| 1424 Stop("Store buffer update is required"); | 1424 Stop("Store buffer update is required"); |
| 1425 Bind(&done); | 1425 Bind(&done); |
| 1426 popl(value); | |
| 1426 #endif // defined(DEBUG) | 1427 #endif // defined(DEBUG) |
| 1427 // No store buffer update. | 1428 // No store buffer update. |
| 1428 } | 1429 } |
| 1429 | 1430 |
| 1430 | 1431 |
| 1431 void Assembler::StoreIntoObjectNoBarrier(Register object, | 1432 void Assembler::StoreIntoObjectNoBarrier(Register object, |
| 1432 const FieldAddress& dest, | 1433 const FieldAddress& dest, |
| 1433 const Object& value) { | 1434 const Object& value) { |
| 1434 if (value.IsSmi()) { | 1435 if (value.IsSmi()) { |
| 1435 movl(dest, Immediate(reinterpret_cast<int32_t>(value.raw()))); | 1436 movl(dest, Immediate(reinterpret_cast<int32_t>(value.raw()))); |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1730 comments.SetCommentAt(i, comments_[i]->comment()); | 1731 comments.SetCommentAt(i, comments_[i]->comment()); |
| 1731 } | 1732 } |
| 1732 | 1733 |
| 1733 return comments; | 1734 return comments; |
| 1734 } | 1735 } |
| 1735 | 1736 |
| 1736 | 1737 |
| 1737 } // namespace dart | 1738 } // namespace dart |
| 1738 | 1739 |
| 1739 #endif // defined TARGET_ARCH_IA32 | 1740 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |