Revision: 9349
Author: [email protected]
Date: Tue Sep 20 09:33:03 2011
Log: Add kHeaderSize constant to SeqString.
This prevents potential misuse of SeqString::kHeaderSize as in the
case of live byte counting in incremental marking stub. All stubs
picked up the undefined size constant SeqString::kHeaderSize, thus
the computed size of all strings was off by two pointers slots.
[email protected]
BUG=v8:1672
TEST=mjsunit/object-seal.js,...
Review URL: http://codereview.chromium.org/7971009
http://code.google.com/p/v8/source/detail?r=9349
Modified:
/branches/bleeding_edge/src/arm/code-stubs-arm.cc
/branches/bleeding_edge/src/mips/code-stubs-mips.cc
/branches/bleeding_edge/src/objects.h
/branches/bleeding_edge/src/runtime.cc
/branches/bleeding_edge/src/spaces.cc
/branches/bleeding_edge/test/mjsunit/mjsunit.status
=======================================
--- /branches/bleeding_edge/src/arm/code-stubs-arm.cc Tue Sep 20 06:32:27
2011
+++ /branches/bleeding_edge/src/arm/code-stubs-arm.cc Tue Sep 20 09:33:03
2011
@@ -4575,8 +4575,7 @@
// For arguments 4 and 3 get string length, calculate start of string
data and
// calculate the shift of the index (0 for ASCII and 1 for two byte).
- STATIC_ASSERT(SeqAsciiString::kHeaderSize ==
SeqTwoByteString::kHeaderSize);
- __ add(r8, subject, Operand(SeqAsciiString::kHeaderSize -
kHeapObjectTag));
+ __ add(r8, subject, Operand(SeqString::kHeaderSize - kHeapObjectTag));
__ eor(r3, r3, Operand(1));
// Load the length from the original subject string from the previous
stack
// frame. Therefore we have to use fp, which points exactly to two
pointer
=======================================
--- /branches/bleeding_edge/src/mips/code-stubs-mips.cc Sun Sep 18 08:11:33
2011
+++ /branches/bleeding_edge/src/mips/code-stubs-mips.cc Tue Sep 20 09:33:03
2011
@@ -4721,8 +4721,7 @@
// For arguments 4 and 3 get string length, calculate start of string
data
// and calculate the shift of the index (0 for ASCII and 1 for two byte).
- STATIC_ASSERT(SeqAsciiString::kHeaderSize ==
SeqTwoByteString::kHeaderSize);
- __ Addu(t2, subject, Operand(SeqAsciiString::kHeaderSize -
kHeapObjectTag));
+ __ Addu(t2, subject, Operand(SeqString::kHeaderSize - kHeapObjectTag));
__ Xor(a3, a3, Operand(1)); // 1 for 2-byte str, 0 for 1-byte.
// Load the length from the original subject string from the previous
stack
// frame. Therefore we have to use fp, which points exactly to two
pointer
=======================================
--- /branches/bleeding_edge/src/objects.h Tue Sep 20 03:06:23 2011
+++ /branches/bleeding_edge/src/objects.h Tue Sep 20 09:33:03 2011
@@ -6130,6 +6130,9 @@
// Casting.
static inline SeqString* cast(Object* obj);
+ // Layout description.
+ static const int kHeaderSize = String::kSize;
+
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(SeqString);
};
@@ -6162,10 +6165,6 @@
static int SizeFor(int length) {
return OBJECT_POINTER_ALIGN(kHeaderSize + length * kCharSize);
}
-
- // Layout description.
- static const int kHeaderSize = String::kSize;
- static const int kAlignedSize = POINTER_SIZE_ALIGN(kHeaderSize);
// Maximal memory usage for a single sequential ASCII string.
static const int kMaxSize = 512 * MB - 1;
@@ -6216,10 +6215,6 @@
static int SizeFor(int length) {
return OBJECT_POINTER_ALIGN(kHeaderSize + length * kShortSize);
}
-
- // Layout description.
- static const int kHeaderSize = String::kSize;
- static const int kAlignedSize = POINTER_SIZE_ALIGN(kHeaderSize);
// Maximal memory usage for a single sequential two-byte string.
static const int kMaxSize = 512 * MB - 1;
=======================================
--- /branches/bleeding_edge/src/runtime.cc Mon Sep 19 11:36:47 2011
+++ /branches/bleeding_edge/src/runtime.cc Tue Sep 20 09:33:03 2011
@@ -5492,7 +5492,7 @@
StringType* new_string = StringType::cast(new_object);
Char* write_cursor = reinterpret_cast<Char*>(
- new_string->address() + SeqAsciiString::kHeaderSize);
+ new_string->address() + SeqString::kHeaderSize);
if (comma) *(write_cursor++) = ',';
*(write_cursor++) = '"';
@@ -5580,16 +5580,15 @@
StringType* new_string = StringType::cast(new_object);
ASSERT(isolate->heap()->new_space()->Contains(new_string));
- STATIC_ASSERT(SeqTwoByteString::kHeaderSize ==
SeqAsciiString::kHeaderSize);
Char* write_cursor = reinterpret_cast<Char*>(
- new_string->address() + SeqAsciiString::kHeaderSize);
+ new_string->address() + SeqString::kHeaderSize);
if (comma) *(write_cursor++) = ',';
write_cursor = WriteQuoteJsonString<Char, Char>(isolate,
write_cursor,
characters);
int final_length = static_cast<int>(
write_cursor - reinterpret_cast<Char*>(
- new_string->address() + SeqAsciiString::kHeaderSize));
+ new_string->address() + SeqString::kHeaderSize));
isolate->heap()->new_space()->
template ShrinkStringAtAllocationBoundary<StringType>(
new_string, final_length);
@@ -5667,9 +5666,8 @@
StringType* new_string = StringType::cast(new_object);
ASSERT(isolate->heap()->new_space()->Contains(new_string));
- STATIC_ASSERT(SeqTwoByteString::kHeaderSize ==
SeqAsciiString::kHeaderSize);
Char* write_cursor = reinterpret_cast<Char*>(
- new_string->address() + SeqAsciiString::kHeaderSize);
+ new_string->address() + SeqString::kHeaderSize);
*(write_cursor++) = '[';
for (int i = 0; i < length; i++) {
if (i != 0) *(write_cursor++) = ',';
@@ -5690,7 +5688,7 @@
int final_length = static_cast<int>(
write_cursor - reinterpret_cast<Char*>(
- new_string->address() + SeqAsciiString::kHeaderSize));
+ new_string->address() + SeqString::kHeaderSize));
isolate->heap()->new_space()->
template ShrinkStringAtAllocationBoundary<StringType>(
new_string, final_length);
=======================================
--- /branches/bleeding_edge/src/spaces.cc Tue Sep 20 08:35:36 2011
+++ /branches/bleeding_edge/src/spaces.cc Tue Sep 20 09:33:03 2011
@@ -438,6 +438,7 @@
chunk->SetFlag(WAS_SWEPT_PRECISELY);
ASSERT(OFFSET_OF(MemoryChunk, flags_) == kFlagsOffset);
+ ASSERT(OFFSET_OF(MemoryChunk, live_byte_count_) == kLiveBytesOffset);
if (executable == EXECUTABLE) chunk->SetFlag(IS_EXECUTABLE);
@@ -823,7 +824,6 @@
ASSERT(object->address() + size <= top);
end_of_previous_object = object->address() + size;
}
-
CHECK_LE(black_size, page->LiveBytes());
}
ASSERT(allocation_pointer_found_in_space);
=======================================
--- /branches/bleeding_edge/test/mjsunit/mjsunit.status Tue Sep 20 04:20:00
2011
+++ /branches/bleeding_edge/test/mjsunit/mjsunit.status Tue Sep 20 09:33:03
2011
@@ -63,11 +63,6 @@
debug-liveedit-check-stack: SKIP
debug-liveedit-patch-positions-replace: SKIP
-# Known failures after merge from the bleeding edge (issue 1672)
-debug-scopes: PASS, SKIP if ($mode == debug)
-mirror-object: PASS, SKIP if ($mode == debug)
-harmony/debug-blockscopes: PASS, SKIP if ($mode == debug)
-
##############################################################################
[ $arch == arm ]
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev