Revision: 6054
Author: [email protected]
Date: Thu Dec 16 09:45:26 2010
Log: Use near labels in write barrier code.
Review URL: http://codereview.chromium.org/5939003
http://code.google.com/p/v8/source/detail?r=6054
Modified:
/branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc
/branches/bleeding_edge/src/ia32/macro-assembler-ia32.h
=======================================
--- /branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc Fri Dec 10
03:02:09 2010
+++ /branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc Thu Dec 16
09:45:26 2010
@@ -72,30 +72,6 @@
// Set dirty mark for region.
bts(Operand(object, Page::kDirtyFlagOffset), addr);
}
-
-
-void MacroAssembler::InNewSpace(Register object,
- Register scratch,
- Condition cc,
- Label* branch) {
- ASSERT(cc == equal || cc == not_equal);
- if (Serializer::enabled()) {
- // Can't do arithmetic on external references if it might get
serialized.
- mov(scratch, Operand(object));
- // The mask isn't really an address. We load it as an external
reference in
- // case the size of the new space is different between the snapshot
maker
- // and the running system.
- and_(Operand(scratch), Immediate(ExternalReference::new_space_mask()));
- cmp(Operand(scratch), Immediate(ExternalReference::new_space_start()));
- j(cc, branch);
- } else {
- int32_t new_space_start = reinterpret_cast<int32_t>(
- ExternalReference::new_space_start().address());
- lea(scratch, Operand(object, -new_space_start));
- and_(scratch, Heap::NewSpaceMask());
- j(cc, branch);
- }
-}
void MacroAssembler::RecordWrite(Register object,
@@ -109,7 +85,7 @@
// First, check if a write barrier is even needed. The tests below
// catch stores of Smis and stores into young gen.
- Label done;
+ NearLabel done;
// Skip barrier if writing a smi.
ASSERT_EQ(0, kSmiTag);
=======================================
--- /branches/bleeding_edge/src/ia32/macro-assembler-ia32.h Tue Dec 7
03:31:57 2010
+++ /branches/bleeding_edge/src/ia32/macro-assembler-ia32.h Thu Dec 16
09:45:26 2010
@@ -70,10 +70,11 @@
// Check if object is in new space.
// scratch can be object itself, but it will be clobbered.
+ template <typename LabelType>
void InNewSpace(Register object,
Register scratch,
Condition cc, // equal for new space, not_equal
otherwise.
- Label* branch);
+ LabelType* branch);
// For page containing |object| mark region covering [object+offset]
// dirty. |object| is the object being stored into, |value| is the
@@ -656,6 +657,31 @@
Register scratch,
bool gc_allowed);
};
+
+
+template <typename LabelType>
+void MacroAssembler::InNewSpace(Register object,
+ Register scratch,
+ Condition cc,
+ LabelType* branch) {
+ ASSERT(cc == equal || cc == not_equal);
+ if (Serializer::enabled()) {
+ // Can't do arithmetic on external references if it might get
serialized.
+ mov(scratch, Operand(object));
+ // The mask isn't really an address. We load it as an external
reference in
+ // case the size of the new space is different between the snapshot
maker
+ // and the running system.
+ and_(Operand(scratch), Immediate(ExternalReference::new_space_mask()));
+ cmp(Operand(scratch), Immediate(ExternalReference::new_space_start()));
+ j(cc, branch);
+ } else {
+ int32_t new_space_start = reinterpret_cast<int32_t>(
+ ExternalReference::new_space_start().address());
+ lea(scratch, Operand(object, -new_space_start));
+ and_(scratch, Heap::NewSpaceMask());
+ j(cc, branch);
+ }
+}
// The code patcher is used to patch (typically) small parts of code e.g.
for
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev