36 using namespace v8::internal;
56 CHECK_EQ(-2, static_cast<int8_t>(-8) >> 2);
57 CHECK_EQ(-2, static_cast<int>(static_cast<intptr_t>(-8) >> 2));
80 const char* s =
"the quick lazy .... oh forget it!";
82 for (
int i = 1; i < length * 2; i++) {
83 static const char kMarker =
static_cast<char>(42);
88 CHECK(n == length || n == -1);
101 static const int kAreaSize = 512;
109 for (
int i = 0; i < kAreaSize; i++) {
113 OS::MemMove(area1 + dest_offset, area1 + src_offset, length);
114 memmove(area2 + dest_offset, area2 + src_offset, length);
115 if (memcmp(area1, area2, kAreaSize) != 0) {
116 printf(
"OS::MemMove(): src_offset: %d, dest_offset: %d, length: %d\n",
117 src_offset, dest_offset, length);
118 for (
int i = 0; i < kAreaSize; i++) {
119 if (area1[i] == area2[i])
continue;
120 printf(
"diff at offset %d (%p): is %d, should be %d\n",
121 i, reinterpret_cast<void*>(area1 + i), area1[i], area2[i]);
133 static const int kMinOffset = 32;
134 static const int kMaxOffset = 64;
135 static const int kMaxLength = 128;
138 for (
int src_offset = kMinOffset; src_offset <= kMaxOffset; src_offset++) {
139 for (
int dst_offset = kMinOffset; dst_offset <= kMaxOffset; dst_offset++) {
140 for (
int length = 0; length <= kMaxLength; length++) {
141 TestMemMove(area1, area2, src_offset, dst_offset, length);
152 const int kLoops = 5;
153 const int kSequentialSize = 1000;
154 const int kBlockSize = 7;
155 for (
int loop = 0; loop < kLoops; loop++) {
157 for (
int i = 0; i < kSequentialSize; i++) {
160 for (
int i = 0; i < kBlockSize - 1; i++) {
165 CHECK_EQ(kLoops * (kBlockSize + kSequentialSize), result.
length());
166 for (
int i = 0; i < kLoops; i++) {
167 int offset = i * (kSequentialSize + kBlockSize);
168 for (
int j = 0; j < kBlockSize - 1; j++) {
169 CHECK_EQ(j * 7, result[offset + j]);
171 CHECK_EQ(0xbadcafe, result[offset + kBlockSize - 1]);
172 for (
int j = 0; j < kSequentialSize; j++) {
173 CHECK_EQ(j, result[offset + kBlockSize + j]);
182 const int kLoops = 5000;
183 const int kMaxSequenceSize = 13;
184 int total_length = 0;
185 for (
int loop = 0; loop < kLoops; loop++) {
186 int seq_length = loop % kMaxSequenceSize;
188 for (
int j = 0; j < seq_length; j++) {
192 for (
int j = 0; j < seq_length; j++) {
195 total_length += seq_length;
200 for (
int loop = 0; loop < kLoops; loop++) {
201 int seq_length = loop % kMaxSequenceSize;
202 for (
int j = 0; j < seq_length; j++) {
211 TEST(SequenceCollectorRegression) {
218 CHECK_EQ(0, strncmp(
"0123456789012345678901234567890123",
#define CHECK_EQ(expected, value)
Vector< T > AddBlock(int size, T initial_value)
STATIC_ASSERT(sizeof(CPURegister)==sizeof(Register))
int FastD2IChecked(double x)
static void MemMove(void *dest, const void *src, size_t size)
static Vector< T > New(int length)
int StrLength(const char *string)
static int SNPrintF(Vector< char > str, const char *format,...)
Vector< T > EndSequence()
static double nan_value()
void TestMemMove(byte *area1, byte *area2, int src_offset, int dest_offset, int length)