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

Unified Diff: runtime/vm/assembler_ia32.cc

Issue 12438032: Use shorter write-barrier filtering sequence when value is known to be non-smi. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address Ivan's comments Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/assembler_ia32.h ('k') | runtime/vm/assembler_x64.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/assembler_ia32.cc
diff --git a/runtime/vm/assembler_ia32.cc b/runtime/vm/assembler_ia32.cc
index 2acf8ce65f0caefe8152567b374bda5c7b033994..8d0221cbb200d1529e20964fe24d51a7bece958a 100644
--- a/runtime/vm/assembler_ia32.cc
+++ b/runtime/vm/assembler_ia32.cc
@@ -1850,6 +1850,26 @@ void Assembler::CompareObject(Register reg, const Object& object) {
// Destroys the value register.
+void Assembler::StoreIntoObjectFilterNoSmi(Register object,
+ Register value,
+ Label* no_update) {
+ COMPILE_ASSERT((kNewObjectAlignmentOffset == kWordSize) &&
+ (kOldObjectAlignmentOffset == 0), young_alignment);
+
+ // Write-barrier triggers if the value is in the new space (has bit set) and
+ // the object is in the old space (has bit cleared).
+ // To check that we could compute value & ~object and skip the write barrier
+ // if the bit is not set. However we can't destroy the object.
+ // However to preserve the object we compute negated expression
+ // ~value | object instead and skip the write barrier if the bit is set.
+ notl(value);
+ orl(value, object);
+ testl(value, Immediate(kNewObjectAlignmentOffset));
+ j(NOT_ZERO, no_update, Assembler::kNearJump);
+}
+
+
+// Destroys the value register.
void Assembler::StoreIntoObjectFilter(Register object,
Register value,
Label* no_update) {
@@ -1872,12 +1892,17 @@ void Assembler::StoreIntoObjectFilter(Register object,
void Assembler::StoreIntoObject(Register object,
const Address& dest,
- Register value) {
+ Register value,
+ bool can_value_be_smi) {
ASSERT(object != value);
TraceStoreIntoObject(object, dest, value);
movl(dest, value);
Label done;
- StoreIntoObjectFilter(object, value, &done);
+ if (can_value_be_smi) {
+ StoreIntoObjectFilter(object, value, &done);
+ } else {
+ StoreIntoObjectFilterNoSmi(object, value, &done);
+ }
// A store buffer update is required.
if (value != EAX) pushl(EAX); // Preserve EAX.
leal(EAX, dest);
« no previous file with comments | « runtime/vm/assembler_ia32.h ('k') | runtime/vm/assembler_x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698