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

Unified Diff: src/ia32/macro-assembler-ia32.cc

Issue 462025: Better handling of allocation alignment in generated code... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years 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 | « src/ia32/codegen-ia32.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/macro-assembler-ia32.cc
===================================================================
--- src/ia32/macro-assembler-ia32.cc (revision 3400)
+++ src/ia32/macro-assembler-ia32.cc (working copy)
@@ -687,6 +687,11 @@
void MacroAssembler::UpdateAllocationTopHelper(Register result_end,
Register scratch) {
+#ifdef DEBUG
Mads Ager (chromium) 2009/12/04 07:33:12 Please use the flag debug_code, so that we only ge
Søren Thygesen Gjesse 2009/12/04 07:57:22 Done.
+ test(result_end, Immediate(kObjectAlignmentMask));
+ Check(zero, "Unaligned allocation in new space");
+#endif
+
ExternalReference new_space_allocation_top =
ExternalReference::new_space_allocation_top_address();
@@ -826,15 +831,18 @@
Register scratch2,
Register scratch3,
Label* gc_required) {
- // Calculate the number of words needed for the number of characters in the
- // string
+ // Calculate the number of bytes needed for the characters in the string while
+ // observing object alignment.
+ ASSERT((SeqTwoByteString::kHeaderSize & kObjectAlignmentMask) == 0);
mov(scratch1, length);
- add(Operand(scratch1), Immediate(1));
- shr(scratch1, 1);
+ ASSERT(kShortSize == 2);
+ shl(scratch1, 1);
+ add(Operand(scratch1), Immediate(kObjectAlignmentMask));
+ and_(Operand(scratch1), Immediate(~kObjectAlignmentMask));
// Allocate two byte string in new space.
AllocateInNewSpace(SeqTwoByteString::kHeaderSize,
- times_4,
+ times_1,
scratch1,
result,
scratch2,
@@ -857,15 +865,17 @@
Register scratch2,
Register scratch3,
Label* gc_required) {
- // Calculate the number of words needed for the number of characters in the
- // string
+ // Calculate the number of bytes needed for the characters in the string while
+ // observing object alignment.
+ ASSERT((SeqAsciiString::kHeaderSize & kObjectAlignmentMask) == 0);
mov(scratch1, length);
- add(Operand(scratch1), Immediate(3));
- shr(scratch1, 2);
+ ASSERT(kCharSize == 1);
+ add(Operand(scratch1), Immediate(kObjectAlignmentMask));
+ and_(Operand(scratch1), Immediate(~kObjectAlignmentMask));
// Allocate ascii string in new space.
AllocateInNewSpace(SeqAsciiString::kHeaderSize,
- times_4,
+ times_1,
scratch1,
result,
scratch2,
@@ -1383,11 +1393,15 @@
RecordComment(msg);
}
#endif
+ // Disable stub call restrictions to always allow cals to abort.
+ set_allow_stub_calls(true);
+
push(eax);
push(Immediate(p0));
push(Immediate(reinterpret_cast<intptr_t>(Smi::FromInt(p1 - p0))));
CallRuntime(Runtime::kAbort, 2);
// will not return here
+ int3();
}
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698