Version 3.2.10
Fixed bug in external float arrays on ARM (issue 1323).
Minor performance improvements and bug fixes.
git-svn-id: http://v8.googlecode.com/svn/trunk@7596 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/test/cctest/cctest.status b/test/cctest/cctest.status
index 986fb8d..3bb9998 100644
--- a/test/cctest/cctest.status
+++ b/test/cctest/cctest.status
@@ -57,6 +57,12 @@
test-debug/DebuggerAgentProtocolOverflowHeader: SKIP
test-sockets/Socket: SKIP
+# BUG(1075): Unresolved crashes.
+cctest/test-serialize/Deserialize: PASS || FAIL
+cctest/test-serialize/DeserializeFromSecondSerializationAndRunScript2: PASS || FAIL
+cctest/test-serialize/DeserializeAndRunScript2: PASS || FAIL
+cctest/test-serialize/DeserializeFromSecondSerialization: PASS || FAIL
+
##############################################################################
[ $arch == arm && $crankshaft ]
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 715dbdb..d7621d1 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -8671,18 +8671,21 @@
}
+static int call_depth;
+
+
static void WithTryCatch(Handle<Message> message, Handle<Value> data) {
TryCatch try_catch;
}
static void ThrowFromJS(Handle<Message> message, Handle<Value> data) {
- CompileRun("throw 'ThrowInJS';");
+ if (--call_depth) CompileRun("throw 'ThrowInJS';");
}
static void ThrowViaApi(Handle<Message> message, Handle<Value> data) {
- ThrowException(v8_str("ThrowViaApi"));
+ if (--call_depth) ThrowException(v8_str("ThrowViaApi"));
}
@@ -8708,6 +8711,7 @@
if (callback != NULL) {
V8::AddMessageListener(callback);
}
+ call_depth = 5;
ExpectFalse(
"var thrown = false;\n"
"try { func(); } catch(e) { thrown = true; }\n"
diff --git a/test/cctest/test-conversions.cc b/test/cctest/test-conversions.cc
index 1b5cc2d..7c29746 100644
--- a/test/cctest/test-conversions.cc
+++ b/test/cctest/test-conversions.cc
@@ -1,4 +1,4 @@
-// Copyright 2006-2008 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
#include <stdlib.h>
@@ -11,139 +11,151 @@
TEST(Hex) {
- CHECK_EQ(0.0, StringToDouble("0x0", ALLOW_HEX | ALLOW_OCTALS));
- CHECK_EQ(0.0, StringToDouble("0X0", ALLOW_HEX | ALLOW_OCTALS));
- CHECK_EQ(1.0, StringToDouble("0x1", ALLOW_HEX | ALLOW_OCTALS));
- CHECK_EQ(16.0, StringToDouble("0x10", ALLOW_HEX | ALLOW_OCTALS));
- CHECK_EQ(255.0, StringToDouble("0xff", ALLOW_HEX | ALLOW_OCTALS));
- CHECK_EQ(175.0, StringToDouble("0xAF", ALLOW_HEX | ALLOW_OCTALS));
+ UnicodeCache uc;
+ CHECK_EQ(0.0, StringToDouble(&uc, "0x0", ALLOW_HEX | ALLOW_OCTALS));
+ CHECK_EQ(0.0, StringToDouble(&uc, "0X0", ALLOW_HEX | ALLOW_OCTALS));
+ CHECK_EQ(1.0, StringToDouble(&uc, "0x1", ALLOW_HEX | ALLOW_OCTALS));
+ CHECK_EQ(16.0, StringToDouble(&uc, "0x10", ALLOW_HEX | ALLOW_OCTALS));
+ CHECK_EQ(255.0, StringToDouble(&uc, "0xff", ALLOW_HEX | ALLOW_OCTALS));
+ CHECK_EQ(175.0, StringToDouble(&uc, "0xAF", ALLOW_HEX | ALLOW_OCTALS));
- CHECK_EQ(0.0, StringToDouble("0x0", ALLOW_HEX));
- CHECK_EQ(0.0, StringToDouble("0X0", ALLOW_HEX));
- CHECK_EQ(1.0, StringToDouble("0x1", ALLOW_HEX));
- CHECK_EQ(16.0, StringToDouble("0x10", ALLOW_HEX));
- CHECK_EQ(255.0, StringToDouble("0xff", ALLOW_HEX));
- CHECK_EQ(175.0, StringToDouble("0xAF", ALLOW_HEX));
+ CHECK_EQ(0.0, StringToDouble(&uc, "0x0", ALLOW_HEX));
+ CHECK_EQ(0.0, StringToDouble(&uc, "0X0", ALLOW_HEX));
+ CHECK_EQ(1.0, StringToDouble(&uc, "0x1", ALLOW_HEX));
+ CHECK_EQ(16.0, StringToDouble(&uc, "0x10", ALLOW_HEX));
+ CHECK_EQ(255.0, StringToDouble(&uc, "0xff", ALLOW_HEX));
+ CHECK_EQ(175.0, StringToDouble(&uc, "0xAF", ALLOW_HEX));
}
TEST(Octal) {
- CHECK_EQ(0.0, StringToDouble("0", ALLOW_HEX | ALLOW_OCTALS));
- CHECK_EQ(0.0, StringToDouble("00", ALLOW_HEX | ALLOW_OCTALS));
- CHECK_EQ(1.0, StringToDouble("01", ALLOW_HEX | ALLOW_OCTALS));
- CHECK_EQ(7.0, StringToDouble("07", ALLOW_HEX | ALLOW_OCTALS));
- CHECK_EQ(8.0, StringToDouble("010", ALLOW_HEX | ALLOW_OCTALS));
- CHECK_EQ(63.0, StringToDouble("077", ALLOW_HEX | ALLOW_OCTALS));
+ UnicodeCache uc;
+ CHECK_EQ(0.0, StringToDouble(&uc, "0", ALLOW_HEX | ALLOW_OCTALS));
+ CHECK_EQ(0.0, StringToDouble(&uc, "00", ALLOW_HEX | ALLOW_OCTALS));
+ CHECK_EQ(1.0, StringToDouble(&uc, "01", ALLOW_HEX | ALLOW_OCTALS));
+ CHECK_EQ(7.0, StringToDouble(&uc, "07", ALLOW_HEX | ALLOW_OCTALS));
+ CHECK_EQ(8.0, StringToDouble(&uc, "010", ALLOW_HEX | ALLOW_OCTALS));
+ CHECK_EQ(63.0, StringToDouble(&uc, "077", ALLOW_HEX | ALLOW_OCTALS));
- CHECK_EQ(0.0, StringToDouble("0", ALLOW_HEX));
- CHECK_EQ(0.0, StringToDouble("00", ALLOW_HEX));
- CHECK_EQ(1.0, StringToDouble("01", ALLOW_HEX));
- CHECK_EQ(7.0, StringToDouble("07", ALLOW_HEX));
- CHECK_EQ(10.0, StringToDouble("010", ALLOW_HEX));
- CHECK_EQ(77.0, StringToDouble("077", ALLOW_HEX));
+ CHECK_EQ(0.0, StringToDouble(&uc, "0", ALLOW_HEX));
+ CHECK_EQ(0.0, StringToDouble(&uc, "00", ALLOW_HEX));
+ CHECK_EQ(1.0, StringToDouble(&uc, "01", ALLOW_HEX));
+ CHECK_EQ(7.0, StringToDouble(&uc, "07", ALLOW_HEX));
+ CHECK_EQ(10.0, StringToDouble(&uc, "010", ALLOW_HEX));
+ CHECK_EQ(77.0, StringToDouble(&uc, "077", ALLOW_HEX));
const double x = 010000000000; // Power of 2, no rounding errors.
- CHECK_EQ(x * x * x * x * x, StringToDouble("01" "0000000000" "0000000000"
+ CHECK_EQ(x * x * x * x * x, StringToDouble(&uc, "01" "0000000000" "0000000000"
"0000000000" "0000000000" "0000000000", ALLOW_OCTALS));
}
TEST(MalformedOctal) {
- CHECK_EQ(8.0, StringToDouble("08", ALLOW_HEX | ALLOW_OCTALS));
- CHECK_EQ(81.0, StringToDouble("081", ALLOW_HEX | ALLOW_OCTALS));
- CHECK_EQ(78.0, StringToDouble("078", ALLOW_HEX | ALLOW_OCTALS));
+ UnicodeCache uc;
+ CHECK_EQ(8.0, StringToDouble(&uc, "08", ALLOW_HEX | ALLOW_OCTALS));
+ CHECK_EQ(81.0, StringToDouble(&uc, "081", ALLOW_HEX | ALLOW_OCTALS));
+ CHECK_EQ(78.0, StringToDouble(&uc, "078", ALLOW_HEX | ALLOW_OCTALS));
- CHECK(isnan(StringToDouble("07.7", ALLOW_HEX | ALLOW_OCTALS)));
- CHECK(isnan(StringToDouble("07.8", ALLOW_HEX | ALLOW_OCTALS)));
- CHECK(isnan(StringToDouble("07e8", ALLOW_HEX | ALLOW_OCTALS)));
- CHECK(isnan(StringToDouble("07e7", ALLOW_HEX | ALLOW_OCTALS)));
+ CHECK(isnan(StringToDouble(&uc, "07.7", ALLOW_HEX | ALLOW_OCTALS)));
+ CHECK(isnan(StringToDouble(&uc, "07.8", ALLOW_HEX | ALLOW_OCTALS)));
+ CHECK(isnan(StringToDouble(&uc, "07e8", ALLOW_HEX | ALLOW_OCTALS)));
+ CHECK(isnan(StringToDouble(&uc, "07e7", ALLOW_HEX | ALLOW_OCTALS)));
- CHECK_EQ(8.7, StringToDouble("08.7", ALLOW_HEX | ALLOW_OCTALS));
- CHECK_EQ(8e7, StringToDouble("08e7", ALLOW_HEX | ALLOW_OCTALS));
+ CHECK_EQ(8.7, StringToDouble(&uc, "08.7", ALLOW_HEX | ALLOW_OCTALS));
+ CHECK_EQ(8e7, StringToDouble(&uc, "08e7", ALLOW_HEX | ALLOW_OCTALS));
- CHECK_EQ(0.001, StringToDouble("0.001", ALLOW_HEX | ALLOW_OCTALS));
- CHECK_EQ(0.713, StringToDouble("0.713", ALLOW_HEX | ALLOW_OCTALS));
+ CHECK_EQ(0.001, StringToDouble(&uc, "0.001", ALLOW_HEX | ALLOW_OCTALS));
+ CHECK_EQ(0.713, StringToDouble(&uc, "0.713", ALLOW_HEX | ALLOW_OCTALS));
- CHECK_EQ(8.0, StringToDouble("08", ALLOW_HEX));
- CHECK_EQ(81.0, StringToDouble("081", ALLOW_HEX));
- CHECK_EQ(78.0, StringToDouble("078", ALLOW_HEX));
+ CHECK_EQ(8.0, StringToDouble(&uc, "08", ALLOW_HEX));
+ CHECK_EQ(81.0, StringToDouble(&uc, "081", ALLOW_HEX));
+ CHECK_EQ(78.0, StringToDouble(&uc, "078", ALLOW_HEX));
- CHECK_EQ(7.7, StringToDouble("07.7", ALLOW_HEX));
- CHECK_EQ(7.8, StringToDouble("07.8", ALLOW_HEX));
- CHECK_EQ(7e8, StringToDouble("07e8", ALLOW_HEX));
- CHECK_EQ(7e7, StringToDouble("07e7", ALLOW_HEX));
+ CHECK_EQ(7.7, StringToDouble(&uc, "07.7", ALLOW_HEX));
+ CHECK_EQ(7.8, StringToDouble(&uc, "07.8", ALLOW_HEX));
+ CHECK_EQ(7e8, StringToDouble(&uc, "07e8", ALLOW_HEX));
+ CHECK_EQ(7e7, StringToDouble(&uc, "07e7", ALLOW_HEX));
- CHECK_EQ(8.7, StringToDouble("08.7", ALLOW_HEX));
- CHECK_EQ(8e7, StringToDouble("08e7", ALLOW_HEX));
+ CHECK_EQ(8.7, StringToDouble(&uc, "08.7", ALLOW_HEX));
+ CHECK_EQ(8e7, StringToDouble(&uc, "08e7", ALLOW_HEX));
- CHECK_EQ(0.001, StringToDouble("0.001", ALLOW_HEX));
- CHECK_EQ(0.713, StringToDouble("0.713", ALLOW_HEX));
+ CHECK_EQ(0.001, StringToDouble(&uc, "0.001", ALLOW_HEX));
+ CHECK_EQ(0.713, StringToDouble(&uc, "0.713", ALLOW_HEX));
}
TEST(TrailingJunk) {
- CHECK_EQ(8.0, StringToDouble("8q", ALLOW_TRAILING_JUNK));
- CHECK_EQ(63.0, StringToDouble("077qqq", ALLOW_OCTALS | ALLOW_TRAILING_JUNK));
- CHECK_EQ(10.0, StringToDouble("10e", ALLOW_OCTALS | ALLOW_TRAILING_JUNK));
- CHECK_EQ(10.0, StringToDouble("10e-", ALLOW_OCTALS | ALLOW_TRAILING_JUNK));
+ UnicodeCache uc;
+ CHECK_EQ(8.0, StringToDouble(&uc, "8q", ALLOW_TRAILING_JUNK));
+ CHECK_EQ(63.0,
+ StringToDouble(&uc, "077qqq", ALLOW_OCTALS | ALLOW_TRAILING_JUNK));
+ CHECK_EQ(10.0,
+ StringToDouble(&uc, "10e", ALLOW_OCTALS | ALLOW_TRAILING_JUNK));
+ CHECK_EQ(10.0,
+ StringToDouble(&uc, "10e-", ALLOW_OCTALS | ALLOW_TRAILING_JUNK));
}
TEST(NonStrDecimalLiteral) {
- CHECK(isnan(StringToDouble(" ", NO_FLAGS, OS::nan_value())));
- CHECK(isnan(StringToDouble("", NO_FLAGS, OS::nan_value())));
- CHECK(isnan(StringToDouble(" ", NO_FLAGS, OS::nan_value())));
- CHECK_EQ(0.0, StringToDouble("", NO_FLAGS));
- CHECK_EQ(0.0, StringToDouble(" ", NO_FLAGS));
+ UnicodeCache uc;
+ CHECK(isnan(StringToDouble(&uc, " ", NO_FLAGS, OS::nan_value())));
+ CHECK(isnan(StringToDouble(&uc, "", NO_FLAGS, OS::nan_value())));
+ CHECK(isnan(StringToDouble(&uc, " ", NO_FLAGS, OS::nan_value())));
+ CHECK_EQ(0.0, StringToDouble(&uc, "", NO_FLAGS));
+ CHECK_EQ(0.0, StringToDouble(&uc, " ", NO_FLAGS));
}
TEST(IntegerStrLiteral) {
- CHECK_EQ(0.0, StringToDouble("0.0", NO_FLAGS));
- CHECK_EQ(0.0, StringToDouble("0", NO_FLAGS));
- CHECK_EQ(0.0, StringToDouble("00", NO_FLAGS));
- CHECK_EQ(0.0, StringToDouble("000", NO_FLAGS));
- CHECK_EQ(1.0, StringToDouble("1", NO_FLAGS));
- CHECK_EQ(-1.0, StringToDouble("-1", NO_FLAGS));
- CHECK_EQ(-1.0, StringToDouble(" -1 ", NO_FLAGS));
- CHECK_EQ(1.0, StringToDouble(" +1 ", NO_FLAGS));
- CHECK(isnan(StringToDouble(" - 1 ", NO_FLAGS)));
- CHECK(isnan(StringToDouble(" + 1 ", NO_FLAGS)));
+ UnicodeCache uc;
+ CHECK_EQ(0.0, StringToDouble(&uc, "0.0", NO_FLAGS));
+ CHECK_EQ(0.0, StringToDouble(&uc, "0", NO_FLAGS));
+ CHECK_EQ(0.0, StringToDouble(&uc, "00", NO_FLAGS));
+ CHECK_EQ(0.0, StringToDouble(&uc, "000", NO_FLAGS));
+ CHECK_EQ(1.0, StringToDouble(&uc, "1", NO_FLAGS));
+ CHECK_EQ(-1.0, StringToDouble(&uc, "-1", NO_FLAGS));
+ CHECK_EQ(-1.0, StringToDouble(&uc, " -1 ", NO_FLAGS));
+ CHECK_EQ(1.0, StringToDouble(&uc, " +1 ", NO_FLAGS));
+ CHECK(isnan(StringToDouble(&uc, " - 1 ", NO_FLAGS)));
+ CHECK(isnan(StringToDouble(&uc, " + 1 ", NO_FLAGS)));
- CHECK_EQ(0.0, StringToDouble("0e0", ALLOW_HEX | ALLOW_OCTALS));
- CHECK_EQ(0.0, StringToDouble("0e1", ALLOW_HEX | ALLOW_OCTALS));
- CHECK_EQ(0.0, StringToDouble("0e-1", ALLOW_HEX | ALLOW_OCTALS));
- CHECK_EQ(0.0, StringToDouble("0e-100000", ALLOW_HEX | ALLOW_OCTALS));
- CHECK_EQ(0.0, StringToDouble("0e+100000", ALLOW_HEX | ALLOW_OCTALS));
- CHECK_EQ(0.0, StringToDouble("0.", ALLOW_HEX | ALLOW_OCTALS));
+ CHECK_EQ(0.0, StringToDouble(&uc, "0e0", ALLOW_HEX | ALLOW_OCTALS));
+ CHECK_EQ(0.0, StringToDouble(&uc, "0e1", ALLOW_HEX | ALLOW_OCTALS));
+ CHECK_EQ(0.0, StringToDouble(&uc, "0e-1", ALLOW_HEX | ALLOW_OCTALS));
+ CHECK_EQ(0.0, StringToDouble(&uc, "0e-100000", ALLOW_HEX | ALLOW_OCTALS));
+ CHECK_EQ(0.0, StringToDouble(&uc, "0e+100000", ALLOW_HEX | ALLOW_OCTALS));
+ CHECK_EQ(0.0, StringToDouble(&uc, "0.", ALLOW_HEX | ALLOW_OCTALS));
}
TEST(LongNumberStr) {
- CHECK_EQ(1e10, StringToDouble("1" "0000000000", NO_FLAGS));
- CHECK_EQ(1e20, StringToDouble("1" "0000000000" "0000000000", NO_FLAGS));
+ UnicodeCache uc;
+ CHECK_EQ(1e10, StringToDouble(&uc, "1" "0000000000", NO_FLAGS));
+ CHECK_EQ(1e20, StringToDouble(&uc, "1" "0000000000" "0000000000", NO_FLAGS));
- CHECK_EQ(1e60, StringToDouble("1" "0000000000" "0000000000" "0000000000"
+ CHECK_EQ(1e60, StringToDouble(&uc, "1" "0000000000" "0000000000" "0000000000"
"0000000000" "0000000000" "0000000000", NO_FLAGS));
- CHECK_EQ(1e-2, StringToDouble("." "0" "1", NO_FLAGS));
- CHECK_EQ(1e-11, StringToDouble("." "0000000000" "1", NO_FLAGS));
- CHECK_EQ(1e-21, StringToDouble("." "0000000000" "0000000000" "1", NO_FLAGS));
+ CHECK_EQ(1e-2, StringToDouble(&uc, "." "0" "1", NO_FLAGS));
+ CHECK_EQ(1e-11, StringToDouble(&uc, "." "0000000000" "1", NO_FLAGS));
+ CHECK_EQ(1e-21, StringToDouble(&uc, "." "0000000000" "0000000000" "1",
+ NO_FLAGS));
- CHECK_EQ(1e-61, StringToDouble("." "0000000000" "0000000000" "0000000000"
+ CHECK_EQ(1e-61, StringToDouble(&uc, "." "0000000000" "0000000000" "0000000000"
"0000000000" "0000000000" "0000000000" "1", NO_FLAGS));
// x = 24414062505131248.0 and y = 24414062505131252.0 are representable in
// double. Check chat z = (x + y) / 2 is rounded to x...
CHECK_EQ(24414062505131248.0,
- StringToDouble("24414062505131250.0", NO_FLAGS));
+ StringToDouble(&uc, "24414062505131250.0", NO_FLAGS));
// ... and z = (x + y) / 2 + delta is rounded to y.
CHECK_EQ(24414062505131252.0,
- StringToDouble("24414062505131250.000000001", NO_FLAGS));
+ StringToDouble(&uc, "24414062505131250.000000001", NO_FLAGS));
}
TEST(MaximumSignificantDigits) {
+ UnicodeCache uc;
char num[] =
"4.4501477170144020250819966727949918635852426585926051135169509"
"122872622312493126406953054127118942431783801370080830523154578"
@@ -159,15 +171,16 @@
"847003580761626016356864581135848683152156368691976240370422601"
"6998291015625000000000000000000000000000000000e-308";
- CHECK_EQ(4.4501477170144017780491e-308, StringToDouble(num, NO_FLAGS));
+ CHECK_EQ(4.4501477170144017780491e-308, StringToDouble(&uc, num, NO_FLAGS));
// Changes the result of strtod (at least in glibc implementation).
num[sizeof(num) - 8] = '1';
- CHECK_EQ(4.4501477170144022721148e-308, StringToDouble(num, NO_FLAGS));
+ CHECK_EQ(4.4501477170144022721148e-308, StringToDouble(&uc, num, NO_FLAGS));
}
TEST(MinimumExponent) {
+ UnicodeCache uc;
// Same test but with different point-position.
char num[] =
"445014771701440202508199667279499186358524265859260511351695091"
@@ -184,29 +197,31 @@
"470035807616260163568645811358486831521563686919762403704226016"
"998291015625000000000000000000000000000000000e-1108";
- CHECK_EQ(4.4501477170144017780491e-308, StringToDouble(num, NO_FLAGS));
+ CHECK_EQ(4.4501477170144017780491e-308, StringToDouble(&uc, num, NO_FLAGS));
// Changes the result of strtod (at least in glibc implementation).
num[sizeof(num) - 8] = '1';
- CHECK_EQ(4.4501477170144022721148e-308, StringToDouble(num, NO_FLAGS));
+ CHECK_EQ(4.4501477170144022721148e-308, StringToDouble(&uc, num, NO_FLAGS));
}
TEST(MaximumExponent) {
+ UnicodeCache uc;
char num[] = "0.16e309";
- CHECK_EQ(1.59999999999999997765e+308, StringToDouble(num, NO_FLAGS));
+ CHECK_EQ(1.59999999999999997765e+308, StringToDouble(&uc, num, NO_FLAGS));
}
TEST(ExponentNumberStr) {
- CHECK_EQ(1e1, StringToDouble("1e1", NO_FLAGS));
- CHECK_EQ(1e1, StringToDouble("1e+1", NO_FLAGS));
- CHECK_EQ(1e-1, StringToDouble("1e-1", NO_FLAGS));
- CHECK_EQ(1e100, StringToDouble("1e+100", NO_FLAGS));
- CHECK_EQ(1e-100, StringToDouble("1e-100", NO_FLAGS));
- CHECK_EQ(1e-106, StringToDouble(".000001e-100", NO_FLAGS));
+ UnicodeCache uc;
+ CHECK_EQ(1e1, StringToDouble(&uc, "1e1", NO_FLAGS));
+ CHECK_EQ(1e1, StringToDouble(&uc, "1e+1", NO_FLAGS));
+ CHECK_EQ(1e-1, StringToDouble(&uc, "1e-1", NO_FLAGS));
+ CHECK_EQ(1e100, StringToDouble(&uc, "1e+100", NO_FLAGS));
+ CHECK_EQ(1e-100, StringToDouble(&uc, "1e-100", NO_FLAGS));
+ CHECK_EQ(1e-106, StringToDouble(&uc, ".000001e-100", NO_FLAGS));
}
class OneBit1: public BitField<uint32_t, 0, 1> {};
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index 98a5870..39856b6 100755
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -1,4 +1,4 @@
-// Copyright 2006-2009 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -258,14 +258,14 @@
NULL
};
- uintptr_t stack_limit = ISOLATE->stack_guard()->real_climit();
+ uintptr_t stack_limit = i::Isolate::Current()->stack_guard()->real_climit();
for (int i = 0; programs[i]; i++) {
const char* program = programs[i];
i::Utf8ToUC16CharacterStream stream(
reinterpret_cast<const i::byte*>(program),
static_cast<unsigned>(strlen(program)));
i::CompleteParserRecorder log;
- i::V8JavaScriptScanner scanner(ISOLATE->scanner_constants());
+ i::V8JavaScriptScanner scanner(i::Isolate::Current()->unicode_cache());
scanner.Initialize(&stream);
v8::preparser::PreParser::PreParseResult result =
@@ -282,7 +282,7 @@
TEST(RegressChromium62639) {
int marker;
- ISOLATE->stack_guard()->SetStackLimit(
+ i::Isolate::Current()->stack_guard()->SetStackLimit(
reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
const char* program = "var x = 'something';\n"
@@ -307,7 +307,7 @@
// the block could be lazily compiled, and an extra, unexpected,
// entry was added to the data.
int marker;
- ISOLATE->stack_guard()->SetStackLimit(
+ i::Isolate::Current()->stack_guard()->SetStackLimit(
reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
const char* program =
@@ -343,7 +343,7 @@
TEST(PreParseOverflow) {
int marker;
- ISOLATE->stack_guard()->SetStackLimit(
+ i::Isolate::Current()->stack_guard()->SetStackLimit(
reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
size_t kProgramSize = 1024 * 1024;
@@ -352,13 +352,13 @@
memset(*program, '(', kProgramSize);
program[kProgramSize] = '\0';
- uintptr_t stack_limit = ISOLATE->stack_guard()->real_climit();
+ uintptr_t stack_limit = i::Isolate::Current()->stack_guard()->real_climit();
i::Utf8ToUC16CharacterStream stream(
reinterpret_cast<const i::byte*>(*program),
static_cast<unsigned>(kProgramSize));
i::CompleteParserRecorder log;
- i::V8JavaScriptScanner scanner(ISOLATE->scanner_constants());
+ i::V8JavaScriptScanner scanner(i::Isolate::Current()->unicode_cache());
scanner.Initialize(&stream);
@@ -576,7 +576,7 @@
i::Token::Value* expected_tokens,
int skip_pos = 0, // Zero means not skipping.
int skip_to = 0) {
- i::V8JavaScriptScanner scanner(ISOLATE->scanner_constants());
+ i::V8JavaScriptScanner scanner(i::Isolate::Current()->unicode_cache());
scanner.Initialize(stream);
int i = 0;
@@ -655,7 +655,7 @@
i::Utf8ToUC16CharacterStream stream(
reinterpret_cast<const i::byte*>(re_source),
static_cast<unsigned>(strlen(re_source)));
- i::V8JavaScriptScanner scanner(ISOLATE->scanner_constants());
+ i::V8JavaScriptScanner scanner(i::Isolate::Current()->unicode_cache());
scanner.Initialize(&stream);
i::Token::Value start = scanner.peek();
diff --git a/test/cctest/test-threads.cc b/test/cctest/test-threads.cc
index 37f0205..c6d5cb0 100644
--- a/test/cctest/test-threads.cc
+++ b/test/cctest/test-threads.cc
@@ -28,6 +28,7 @@
#include "v8.h"
#include "platform.h"
+#include "isolate.h"
#include "cctest.h"
@@ -136,3 +137,55 @@
CHECK_EQ(DONE, turn);
}
+
+class ThreadIdValidationThread : public v8::internal::Thread {
+ public:
+ ThreadIdValidationThread(i::Thread* thread_to_start,
+ i::List<i::ThreadId>* refs,
+ unsigned int thread_no,
+ i::Semaphore* semaphore)
+ : Thread(NULL, "ThreadRefValidationThread"),
+ refs_(refs), thread_no_(thread_no), thread_to_start_(thread_to_start),
+ semaphore_(semaphore) {
+ }
+
+ void Run() {
+ i::ThreadId thread_id = i::ThreadId::Current();
+ for (int i = 0; i < thread_no_; i++) {
+ CHECK(!(*refs_)[i].Equals(thread_id));
+ }
+ CHECK(thread_id.IsValid());
+ (*refs_)[thread_no_] = thread_id;
+ if (thread_to_start_ != NULL) {
+ thread_to_start_->Start();
+ }
+ semaphore_->Signal();
+ }
+ private:
+ i::List<i::ThreadId>* refs_;
+ int thread_no_;
+ i::Thread* thread_to_start_;
+ i::Semaphore* semaphore_;
+};
+
+TEST(ThreadIdValidation) {
+ const int kNThreads = 100;
+ i::List<ThreadIdValidationThread*> threads(kNThreads);
+ i::List<i::ThreadId> refs(kNThreads);
+ i::Semaphore* semaphore = i::OS::CreateSemaphore(0);
+ ThreadIdValidationThread* prev = NULL;
+ for (int i = kNThreads - 1; i >= 0; i--) {
+ ThreadIdValidationThread* newThread =
+ new ThreadIdValidationThread(prev, &refs, i, semaphore);
+ threads.Add(newThread);
+ prev = newThread;
+ refs.Add(i::ThreadId::Invalid());
+ }
+ prev->Start();
+ for (int i = 0; i < kNThreads; i++) {
+ semaphore->Wait();
+ }
+ for (int i = 0; i < kNThreads; i++) {
+ delete threads[i];
+ }
+}
diff --git a/test/mjsunit/compiler/array-length.js b/test/mjsunit/compiler/array-length.js
index 126c7a0..462a1e7 100644
--- a/test/mjsunit/compiler/array-length.js
+++ b/test/mjsunit/compiler/array-length.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
function ArrayLength(a) { return a.length; }
function Test(a0, a2, a5) {
@@ -36,7 +38,12 @@
var a0 = [];
var a2 = [1,2];
var a5 = [1,2,3,4,5];
-for (var i = 0; i < 100000; i++) Test(a0, a2, a5);
+for (var i = 0; i < 5; i++) Test(a0, a2, a5);
+%OptimizeFunctionOnNextCall(ArrayLength);
+%OptimizeFunctionOnNextCall(Test);
+Test(a0, a2, a5);
assertEquals("undefined", typeof(ArrayLength(0)));
-for (var i = 0; i < 100000; i++) Test(a0, a2, a5);
+for (var i = 0; i < 5; i++) Test(a0, a2, a5);
+%OptimizeFunctionOnNextCall(Test);
+Test(a0, a2, a5);
assertEquals(4, ArrayLength("hest"));
diff --git a/test/mjsunit/compiler/assignment-deopt.js b/test/mjsunit/compiler/assignment-deopt.js
index 74f185b..2b00625 100644
--- a/test/mjsunit/compiler/assignment-deopt.js
+++ b/test/mjsunit/compiler/assignment-deopt.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
// Test deopt with count operation on parameter.
var max_smi = 1073741823;
var o = {x:0};
@@ -44,12 +46,15 @@
assign2(o);
assertEquals("421", o.x);
-var s = max_smi - 10000;
+var s = max_smi - 10;
o.x = s;
-for(var i = 0; i < 20000; i++) {
+for(var i = 0; i < 20; i++) {
assign2(o);
+ if (i == 4) {
+ %OptimizeFunctionOnNextCall(assign2);
+ }
}
-assertEquals(max_smi + 10000, o.x);
+assertEquals(max_smi + 10, o.x);
// Test deopt with count operation on keyed property.
@@ -59,36 +64,48 @@
assign3(o, 0);
assertEquals("421", o[0]);
-var s = max_smi - 10000;
+var s = max_smi - 10;
o[0] = s;
-for(var i = 0; i < 20000; i++) {
+for(var i = 0; i < 20; i++) {
assign3(o, 0);
+ if (i == 4) {
+ %OptimizeFunctionOnNextCall(assign3);
+ }
}
-assertEquals(max_smi + 10000, o[0]);
+assertEquals(max_smi + 10, o[0]);
-assign3(o,"0");
+assign3(o, "0");
-assertEquals(max_smi + 10001, o[0]);
+assertEquals(max_smi + 11, o[0]);
// Test bailout when accessing a non-existing array element.
o[0] = 0;
-for(var i = 0; i < 10000; i++) {
+for(var i = 0; i < 5; i++) {
assign3(o, 0);
}
-assign3(o,1);
+%OptimizeFunctionOnNextCall(assign3);
+assign3(o, 0);
+assign3(o, 1);
// Test bailout with count operation in a value context.
function assign5(x,y) { return (x += 1) + y; }
-for (var i = 0; i < 10000; ++i) assertEquals(4, assign5(2, 1));
+for (var i = 0; i < 5; ++i) assertEquals(4, assign5(2, 1));
+%OptimizeFunctionOnNextCall(assign5);
+assertEquals(4, assign5(2, 1));
+
assertEquals(4.1, assign5(2, 1.1));
assertEquals(4.1, assign5(2.1, 1));
function assign7(o,y) { return (o.x += 1) + y; }
o = {x:0};
-for (var i = 0; i < 10000; ++i) {
+for (var i = 0; i < 5; ++i) {
o.x = 42;
assertEquals(44, assign7(o, 1));
}
+%OptimizeFunctionOnNextCall(assign7);
+o.x = 42;
+assertEquals(44, assign7(o, 1));
+
o.x = 42;
assertEquals(44.1, assign7(o, 1.1));
o.x = 42.1;
@@ -96,10 +113,14 @@
function assign9(o,y) { return (o[0] += 1) + y; }
q = [0];
-for (var i = 0; i < 10000; ++i) {
+for (var i = 0; i < 5; ++i) {
q[0] = 42;
assertEquals(44, assign9(q, 1));
}
+%OptimizeFunctionOnNextCall(assign9);
+q[0] = 42;
+assertEquals(44, assign9(q, 1));
+
q[0] = 42;
assertEquals(44.1, assign9(q, 1.1));
q[0] = 42.1;
@@ -109,11 +130,16 @@
function assign10(p) { return p.x += 1 }
var g1 = {x:0};
var g2 = {y:0, x:42};
-for (var i = 0; i < 10000; ++i) {
+for (var i = 0; i < 5; ++i) {
g1.x = 42;
assertEquals(43, assign10(g1));
assertEquals(43, g1.x);
}
+%OptimizeFunctionOnNextCall(assign10);
+g1.x = 42;
+assertEquals(43, assign10(g1));
+assertEquals(43, g1.x);
+
assertEquals(43, assign10(g2));
assertEquals(43, g2.x);
@@ -123,10 +149,14 @@
var g3 = { valueOf: function() { o.y = "bar"; return 42; }};
function assign11(p) { return p.x += 1; }
-for (var i = 0; i < 10000; i++) {
+for (var i = 0; i < 5; i++) {
o.x = "a";
assign11(o);
}
+%OptimizeFunctionOnNextCall(assign11);
+o.x = "a";
+assign11(o);
+
assertEquals("a11", assign11(o));
o.x = g3;
assertEquals(43, assign11(o));
@@ -136,10 +166,14 @@
var g4 = { valueOf: function() { o.y = "bar"; return 42; }};
function assign12(p) { return p[0] += 1; }
-for (var i = 0; i < 1000000; i++) {
+for (var i = 0; i < 5; i++) {
o[0] = "a";
assign12(o);
}
+%OptimizeFunctionOnNextCall(assign12);
+o[0] = "a";
+assign12(o);
+
assertEquals("a11", assign12(o));
o[0] = g4;
assertEquals(43, assign12(o));
diff --git a/test/mjsunit/compiler/count-deopt.js b/test/mjsunit/compiler/count-deopt.js
index dcd82f8..415dadc 100644
--- a/test/mjsunit/compiler/count-deopt.js
+++ b/test/mjsunit/compiler/count-deopt.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
// Test deopt with count operation on parameter.
var max_smi = 1073741823;
var o = {x:0};
@@ -44,12 +46,15 @@
inc2(o);
assertEquals(43, o.x);
-var s = max_smi - 10000;
+var s = max_smi - 10;
o.x = s;
-for(var i = 0; i < 20000; i++) {
+for(var i = 0; i < 20; i++) {
inc2(o);
+ if (i == 4) {
+ %OptimizeFunctionOnNextCall(inc2);
+ }
}
-assertEquals(max_smi + 10000, o.x);
+assertEquals(max_smi + 10, o.x);
// Test deopt with count operation on keyed property.
@@ -59,40 +64,52 @@
inc3(o, 0);
assertEquals(43, o[0]);
-var s = max_smi - 10000;
+var s = max_smi - 10;
o[0] = s;
-for(var i = 0; i < 20000; i++) {
+for(var i = 0; i < 20; i++) {
inc3(o, 0);
+ if (i == 4) {
+ %OptimizeFunctionOnNextCall(inc3);
+ }
}
-assertEquals(max_smi + 10000, o[0]);
+assertEquals(max_smi + 10, o[0]);
inc3(o,"0");
-assertEquals(max_smi + 10001, o[0]);
+assertEquals(max_smi + 11, o[0]);
// Test bailout when accessing a non-existing array element.
o[0] = 0;
-for(var i = 0; i < 10000; i++) {
+for(var i = 0; i < 5; i++) {
inc3(o, 0);
}
-inc3(o,1);
+%OptimizeFunctionOnNextCall(inc3);
+inc3(o, 0);
+inc3(o, 1);
// Test bailout with count operation in a value context.
function inc4(x,y) { return (x++) + y; }
-for (var i = 0; i < 100000; ++i) assertEquals(3, inc4(2, 1));
+for (var i = 0; i < 5; ++i) assertEquals(3, inc4(2, 1));
+%OptimizeFunctionOnNextCall(inc4);
+inc4(2, 1);
assertEquals(3.1, inc4(2, 1.1));
function inc5(x,y) { return (++x) + y; }
-for (var i = 0; i < 100000; ++i) assertEquals(4, inc5(2, 1));
+for (var i = 0; i < 5; ++i) assertEquals(4, inc5(2, 1));
+%OptimizeFunctionOnNextCall(inc5);
+assertEquals(4, inc5(2, 1));
assertEquals(4.1, inc5(2, 1.1));
assertEquals(4.1, inc5(2.1, 1));
function inc6(o,y) { return (o.x++) + y; }
o = {x:0};
-for (var i = 0; i < 10000; ++i) {
+for (var i = 0; i < 5; ++i) {
o.x = 42;
assertEquals(43, inc6(o, 1));
}
+%OptimizeFunctionOnNextCall(inc6);
+o.x = 42;
+assertEquals(43, inc6(o, 1));
o.x = 42;
assertEquals(43.1, inc6(o, 1.1));
o.x = 42.1;
@@ -100,10 +117,13 @@
function inc7(o,y) { return (++o.x) + y; }
o = {x:0};
-for (var i = 0; i < 10000; ++i) {
+for (var i = 0; i < 5; ++i) {
o.x = 42;
assertEquals(44, inc7(o, 1));
}
+%OptimizeFunctionOnNextCall(inc7);
+o.x = 42;
+assertEquals(44, inc7(o, 1));
o.x = 42;
assertEquals(44.1, inc7(o, 1.1));
o.x = 42.1;
@@ -111,10 +131,13 @@
function inc8(o,y) { return (o[0]++) + y; }
var q = [0];
-for (var i = 0; i < 100000; ++i) {
+for (var i = 0; i < 5; ++i) {
q[0] = 42;
assertEquals(43, inc8(q, 1));
}
+%OptimizeFunctionOnNextCall(inc8);
+q[0] = 42;
+assertEquals(43, inc8(q, 1));
q[0] = 42;
assertEquals(43.1, inc8(q, 1.1));
q[0] = 42.1;
@@ -122,10 +145,13 @@
function inc9(o,y) { return (++o[0]) + y; }
q = [0];
-for (var i = 0; i < 100000; ++i) {
+for (var i = 0; i < 5; ++i) {
q[0] = 42;
assertEquals(44, inc9(q, 1));
}
+%OptimizeFunctionOnNextCall(inc9);
+q[0] = 42;
+assertEquals(44, inc9(q, 1));
q[0] = 42;
assertEquals(44.1, inc9(q, 1.1));
q[0] = 42.1;
@@ -135,11 +161,15 @@
function inc10(p) { return p.x++ }
var g1 = {x:0};
var g2 = {y:0, x:42}
-for (var i = 0; i < 10000; ++i) {
+for (var i = 0; i < 5; ++i) {
g1.x = 42;
assertEquals(42, inc10(g1));
assertEquals(43, g1.x);
}
+%OptimizeFunctionOnNextCall(inc10);
+g1.x = 42;
+assertEquals(42, inc10(g1));
+assertEquals(43, g1.x);
assertEquals(42, inc10(g2));
assertEquals(43, g2.x);
diff --git a/test/mjsunit/compiler/deopt-args.js b/test/mjsunit/compiler/deopt-args.js
index 780e2a2..17c397c 100644
--- a/test/mjsunit/compiler/deopt-args.js
+++ b/test/mjsunit/compiler/deopt-args.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
function g(x) {
return x.f(0,1,2);
}
@@ -35,9 +37,11 @@
var object = { };
object.f = f;
-for (var i = 0; i < 10000000; i++) {
+for (var i = 0; i < 5; i++) {
assertEquals(42, g(object));
}
+%OptimizeFunctionOnNextCall(g);
+g(object);
object.f = function(a,b,c) { return 87; };
assertEquals(87, g(object));
diff --git a/test/mjsunit/compiler/inline-compare.js b/test/mjsunit/compiler/inline-compare.js
index 6efe154..d97dce2 100644
--- a/test/mjsunit/compiler/inline-compare.js
+++ b/test/mjsunit/compiler/inline-compare.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
// Test that we can inline a function that returns the result of
// a compare operation.
function TestInlineCompare(o) {
@@ -42,5 +44,7 @@
var o = {};
o.f = function() { return 0 === 1; };
-for (var i = 0; i < 10000000; i++) TestInlineCompare(o);
+for (var i = 0; i < 5; i++) TestInlineCompare(o);
+%OptimizeFunctionOnNextCall(TestInlineCompare);
+TestInlineCompare(o);
TestInlineCompare({f: o.f});
diff --git a/test/mjsunit/compiler/inline-global-access.js b/test/mjsunit/compiler/inline-global-access.js
index 3795173..b52652a 100644
--- a/test/mjsunit/compiler/inline-global-access.js
+++ b/test/mjsunit/compiler/inline-global-access.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
// Test that we can inline a function that returns the result of a
// global variable load.
var GLOBAL;
@@ -45,5 +47,7 @@
var o = {};
o.f = function() { return GLOBAL; };
-for (var i = 0; i < 10000000; i++) TestInlineGlobalLoad(o);
+for (var i = 0; i < 5; i++) TestInlineGlobalLoad(o);
+%OptimizeFunctionOnNextCall(TestInlineGlobalLoad);
+TestInlineGlobalLoad(o);
TestInlineGlobalLoad({f: o.f});
diff --git a/test/mjsunit/compiler/inline-param.js b/test/mjsunit/compiler/inline-param.js
index 8e0933a..8fa8008 100644
--- a/test/mjsunit/compiler/inline-param.js
+++ b/test/mjsunit/compiler/inline-param.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
// Test that we can inline a call with a parameter.
function TestInlineOneParam(o, p) {
// Effect context.
@@ -42,7 +44,9 @@
var obj = {x:42};
var o1 = {};
o1.f = function(o) { return o.x; };
-for (var i = 0; i < 10000; i++) TestInlineOneParam(o1, obj);
+for (var i = 0; i < 5; i++) TestInlineOneParam(o1, obj);
+%OptimizeFunctionOnNextCall(TestInlineOneParam);
+TestInlineOneParam(o1, obj);
TestInlineOneParam({f: o1.f}, {x:42});
@@ -76,5 +80,7 @@
var o2 = {};
o2.h = function(i, j) { return i < j; };
-for (var i = 0; i < 10000; i++) TestInlineTwoParams(o2, 42);
+for (var i = 0; i < 5; i++) TestInlineTwoParams(o2, 42);
+%OptimizeFunctionOnNextCall(TestInlineTwoParams);
+TestInlineTwoParams(o2, 42);
TestInlineTwoParams({h: o2.h}, 42);
diff --git a/test/mjsunit/compiler/inline-two.js b/test/mjsunit/compiler/inline-two.js
index 30f579d..68372a9 100644
--- a/test/mjsunit/compiler/inline-two.js
+++ b/test/mjsunit/compiler/inline-two.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
// Test that we can inline a function that calls another function.
function TestInlineX(o) {
// Effect context.
@@ -42,7 +44,9 @@
var o2 = {};
o2.size = function() { return 42; }
o2.g = function() { return this.size(); };
-for (var i = 0; i < 10000; i++) TestInlineX(o2);
+for (var i = 0; i < 5; i++) TestInlineX(o2);
+%OptimizeFunctionOnNextCall(TestInlineX);
+TestInlineX(o2);
TestInlineX({g: o2.g, size:o2.size});
@@ -65,7 +69,9 @@
var o3 = {};
o3.v = obj;
o3.h = function() { return this.v.foo(); };
-for (var i = 0; i < 10000; i++) TestInlineX2(o3);
+for (var i = 0; i < 5; i++) TestInlineX2(o3);
+%OptimizeFunctionOnNextCall(TestInlineX2);
+TestInlineX2(o3);
TestInlineX2({h: o3.h, v:obj});
@@ -89,5 +95,7 @@
o3.v = obj;
o3.f = function() { return this.v; }
o3.h = function() { return this.f().g(); };
-for (var i = 0; i < 10000; i++) TestInlineFG(o3);
+for (var i = 0; i < 5; i++) TestInlineFG(o3);
+%OptimizeFunctionOnNextCall(TestInlineFG);
+TestInlineFG(o3);
TestInlineFG({h: o3.h, f: o3.f, v:obj});
diff --git a/test/mjsunit/compiler/optimized-function-calls.js b/test/mjsunit/compiler/optimized-function-calls.js
index 1b5f3b0..c3e69d7 100644
--- a/test/mjsunit/compiler/optimized-function-calls.js
+++ b/test/mjsunit/compiler/optimized-function-calls.js
@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --expose-gc
+// Flags: --allow-natives-syntax --expose-gc
function f() {
gc();
@@ -48,7 +48,9 @@
function call_f(o) {
return o.f();
}
-for (var i = 0; i < 10000000; i++) call_f(object);
+for (var i = 0; i < 5; i++) call_f(object);
+%OptimizeFunctionOnNextCall(call_f);
+call_f(object);
// Check that nested global function calls work.
diff --git a/test/mjsunit/compiler/pic.js b/test/mjsunit/compiler/pic.js
index 06f2b3e..f5b136c 100644
--- a/test/mjsunit/compiler/pic.js
+++ b/test/mjsunit/compiler/pic.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
function GetX(o) { return o.x; }
function CallF(o) { return o.f(); }
function SetX(o) { o.x = 42; }
@@ -53,11 +55,15 @@
// Run the test until we're fairly sure we've optimized the
// polymorphic property access.
-for (var i = 0; i < 100000; i++) {
+for (var i = 0; i < 5; i++) {
Test(o1);
Test(o2);
Test(o3);
}
+%OptimizeFunctionOnNextCall(Test);
+Test(o1);
+Test(o2);
+Test(o3);
// Make sure that the following doesn't crash.
GetX(0);
diff --git a/test/mjsunit/compiler/property-calls.js b/test/mjsunit/compiler/property-calls.js
index 3366971..ad5ca81 100644
--- a/test/mjsunit/compiler/property-calls.js
+++ b/test/mjsunit/compiler/property-calls.js
@@ -25,12 +25,16 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
function f(o) { return o.g(); }
function g() { return 42; }
var object = { };
object.g = g;
-for (var i = 0; i < 10000000; i++) f(object);
+for (var i = 0; i < 5; i++) f(object);
+%OptimizeFunctionOnNextCall(f);
+f(object);
assertEquals(42, f(object));
object = { g: function() { return 87; } };
diff --git a/test/mjsunit/compiler/property-refs.js b/test/mjsunit/compiler/property-refs.js
index 3f6f793..6f1f19f 100644
--- a/test/mjsunit/compiler/property-refs.js
+++ b/test/mjsunit/compiler/property-refs.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
function Load(o) {
return o.outer.x | o.outer.inner.y;
}
@@ -45,7 +47,9 @@
return Load(object);
}
-for (var i = 0; i < 10000; i++) LoadXY(i, i);
+for (var i = 0; i < 5; i++) LoadXY(i, i);
+%OptimizeFunctionOnNextCall(LoadXY);
+LoadXY(6, 6);
assertEquals(42 | 87, LoadXY(42, 87));
assertEquals(42 | 87, LoadXY(42, 87));
assertEquals(42 | 99, LoadXY(42, "99"));
diff --git a/test/mjsunit/compiler/property-stores.js b/test/mjsunit/compiler/property-stores.js
index 0dec82a..4ffac07 100644
--- a/test/mjsunit/compiler/property-stores.js
+++ b/test/mjsunit/compiler/property-stores.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
var a = 42;
var obj = {x: 0,
@@ -33,11 +35,17 @@
h: function() { this.x = a; }};
var i;
-for (i = 0; i < 10000; i++) { obj.f(); }
+for (i = 0; i < 5; i++) { obj.f(); }
+%OptimizeFunctionOnNextCall(obj.f);
+obj.f();
assertEquals(7, obj.x);
-for (i = 0; i < 10000; i++) { obj.g(); }
+for (i = 0; i < 5; i++) { obj.g(); }
+%OptimizeFunctionOnNextCall(obj.g);
+obj.g();
assertEquals(43, obj.x);
-for (i = 0; i < 10000; i++) { obj.h(); }
+for (i = 0; i < 5; i++) { obj.h(); }
+%OptimizeFunctionOnNextCall(obj.h);
+obj.h();
assertEquals(42, obj.x);
diff --git a/test/mjsunit/compiler/recursive-deopt.js b/test/mjsunit/compiler/recursive-deopt.js
index 366f59a..c921ade 100644
--- a/test/mjsunit/compiler/recursive-deopt.js
+++ b/test/mjsunit/compiler/recursive-deopt.js
@@ -25,6 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
function f(n) {
// Force deopt in both leaf case and when returning. To make
@@ -34,15 +35,11 @@
return f(n - 1) << one;
}
-function RunTests() {
- assertEquals(1 << 1, f(0));
- assertEquals(1 << 2, f(1));
- assertEquals(1 << 5, f(4));
-}
-
var one = 1;
-for (var i = 0; i < 1000000; i++) RunTests();
+for (var i = 0; i < 5; i++) assertEquals(1 << 5, f(4));
+%OptimizeFunctionOnNextCall(f);
+assertEquals(1 << 5, f(4));
var one = { valueOf: function() { return 1; } };
-for (var j = 0; j < 100000; j++) RunTests();
+assertEquals(1 << 5, f(4));
diff --git a/test/mjsunit/compiler/regress-3218915.js b/test/mjsunit/compiler/regress-3218915.js
index d27c319..dfce815 100644
--- a/test/mjsunit/compiler/regress-3218915.js
+++ b/test/mjsunit/compiler/regress-3218915.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
// Regression test for failure to deoptimize properly when the most recent
// side effect occurred in a comma expression in an effect context.
@@ -40,7 +42,9 @@
function test(x) { return observe(this, ((0, side_effect()), x + 1)); }
// Run test enough times to get it optimized.
-for (var i = 0; i < 1000000; ++i) test(0);
+for (var i = 0; i < 5; ++i) test(0);
+%OptimizeFunctionOnNextCall(test);
+test(0);
// Force test to deopt. If it behaves normally, it should return the global
// object. If the value of the call to side_effect() is lingering after the
diff --git a/test/mjsunit/compiler/regress-loadfield.js b/test/mjsunit/compiler/regress-loadfield.js
index a202891..a3da156 100644
--- a/test/mjsunit/compiler/regress-loadfield.js
+++ b/test/mjsunit/compiler/regress-loadfield.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
// Regression test for GVN on field loads.
function bar() {}
@@ -58,8 +60,10 @@
a.p10 = "";
a.p11 = "";
a.foo = "foo";
-for (var i = 0; i < 100000; i++) {
+for (var i = 0; i < 5; i++) {
test(a);
}
+%OptimizeFunctionOnNextCall(test);
+test(a);
test("");
diff --git a/test/mjsunit/compiler/regress-max.js b/test/mjsunit/compiler/regress-max.js
index 94c543a..ee2fd58 100644
--- a/test/mjsunit/compiler/regress-max.js
+++ b/test/mjsunit/compiler/regress-max.js
@@ -25,10 +25,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
// Test Math.max with negative zero as input.
-function f(x, y) { return Math.max(x, y) }
+for (var i = 0; i < 5; i++) Math.max(0, 0);
+%OptimizeFunctionOnNextCall(Math.max);
+Math.max(0, 0);
-for (var i = 0; i < 1000000; i++) f(0, 0);
-
-var r = f(-0, -0);
+var r = Math.max(-0, -0);
assertEquals(-Infinity, 1 / r);
diff --git a/test/mjsunit/compiler/regress-stacktrace-methods.js b/test/mjsunit/compiler/regress-stacktrace-methods.js
index 4900ccf..4d28727 100644
--- a/test/mjsunit/compiler/regress-stacktrace-methods.js
+++ b/test/mjsunit/compiler/regress-stacktrace-methods.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
// Test stack traces with method calls.
function Hest() {}
function Svin() {}
@@ -39,9 +41,12 @@
var s = new Svin();
var v = 0;
-for (var i = 0; i < 1000000; i++) {
+for (var i = 0; i < 5; i++) {
o.one(s);
}
+%OptimizeFunctionOnNextCall(Hest.prototype.one);
+%OptimizeFunctionOnNextCall(Hest.prototype.three);
+o.one(s);
v = 42;
@@ -57,8 +62,8 @@
assertTrue(p1 != -1);
assertTrue(p3 < p2);
assertTrue(p2 < p1);
- assertTrue(stack.indexOf("36:56") != -1);
- assertTrue(stack.indexOf("32:51") != -1);
- assertTrue(stack.indexOf("34:38") != -1);
- assertTrue(stack.indexOf("49:5") != -1);
+ assertTrue(stack.indexOf("38:56") != -1);
+ assertTrue(stack.indexOf("34:51") != -1);
+ assertTrue(stack.indexOf("36:38") != -1);
+ assertTrue(stack.indexOf("54:5") != -1);
}
diff --git a/test/mjsunit/compiler/simple-deopt.js b/test/mjsunit/compiler/simple-deopt.js
index 8befd9f..7f985ac 100644
--- a/test/mjsunit/compiler/simple-deopt.js
+++ b/test/mjsunit/compiler/simple-deopt.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
function f(x) {
return ~x;
}
@@ -59,7 +61,9 @@
function k(o) {
return o.g();
}
-for (var i = 0; i < 1000000; i++) k(obj);
+for (var i = 0; i < 5; i++) k(obj);
+%OptimizeFunctionOnNextCall(k);
+k(obj);
assertEquals(42, k(obj));
assertEquals(87, k({g: function() { return 87; }}));
@@ -88,9 +92,11 @@
var str = "abc";
var r;
function CallCharAt(n) { return str.charAt(n); }
-for (var i = 0; i < 1000000; i++) {
+for (var i = 0; i < 5; i++) {
r = CallCharAt(0);
}
+%OptimizeFunctionOnNextCall(CallCharAt);
+r = CallCharAt(0);
assertEquals("a", r);
diff --git a/test/mjsunit/compiler/simple-inlining.js b/test/mjsunit/compiler/simple-inlining.js
index 219580f..8bd37ea 100644
--- a/test/mjsunit/compiler/simple-inlining.js
+++ b/test/mjsunit/compiler/simple-inlining.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
// Test that we can inline a function that returns a constant.
function TestInlineConstant(o) {
// Effect context.
@@ -41,7 +43,9 @@
var o1 = {};
o1.f = function() { return 42; };
-for (var i = 0; i < 10000; i++) TestInlineConstant(o1);
+for (var i = 0; i < 5; i++) TestInlineConstant(o1);
+%OptimizeFunctionOnNextCall(TestInlineConstant);
+TestInlineConstant(o1);
TestInlineConstant({f: o1.f});
@@ -61,7 +65,9 @@
var o2 = {};
o2.g = function() { return this; };
-for (var i = 0; i < 10000; i++) TestInlineThis(o2);
+for (var i = 0; i < 5; i++) TestInlineThis(o2);
+%OptimizeFunctionOnNextCall(TestInlineThis);
+TestInlineThis(o2);
TestInlineThis({g: o2.g});
@@ -81,7 +87,9 @@
var o3 = {y:0,x:42};
o3.h = function() { return this.x; };
-for (var i = 0; i < 10000; i++) TestInlineThisX(o3);
+for (var i = 0; i < 5; i++) TestInlineThisX(o3);
+%OptimizeFunctionOnNextCall(TestInlineThisX);
+TestInlineThisX(o3);
TestInlineThisX({h: o3.h, x:42});
@@ -101,7 +109,9 @@
var o4 = {x:[1,2,3]};
o4.h = function() { return this.x.length; };
-for (var i = 0; i < 10000; i++) TestInlineThisXLength(o4);
+for (var i = 0; i < 5; i++) TestInlineThisXLength(o4);
+%OptimizeFunctionOnNextCall(TestInlineThisXLength);
+TestInlineThisXLength(o4);
TestInlineThisXLength({h: o4.h, x:[1,2,3]});
@@ -122,7 +132,9 @@
var o6 = {y:42}
var o5 = {e:o6};
o5.h = function() { return this.e.y; };
-for (var i = 0; i < 10000; i++) TestInlineThisXY(o5);
+for (var i = 0; i < 5; i++) TestInlineThisXY(o5);
+%OptimizeFunctionOnNextCall(TestInlineThisXY);
+TestInlineThisXY(o5);
TestInlineThisXY({h: o5.h, e:o6});
@@ -142,5 +154,7 @@
var o7 = {x:[42,43,44]};
o7.foo = function() { return this.x[0]; };
-for (var i = 0; i < 10000; i++) TestInlineThisX0(o7);
+for (var i = 0; i < 5; i++) TestInlineThisX0(o7);
+%OptimizeFunctionOnNextCall(TestInlineThisX0);
+TestInlineThisX0(o7);
TestInlineThisX0({foo: o7.foo, x:[42,0,0]});
diff --git a/test/mjsunit/compiler/switch-bailout.js b/test/mjsunit/compiler/switch-bailout.js
index 8011d44..084074e 100644
--- a/test/mjsunit/compiler/switch-bailout.js
+++ b/test/mjsunit/compiler/switch-bailout.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
// Test that bailing out of the optimized compilation doesn't mess with
// the labels in the AST.
function f(x) {
@@ -35,5 +37,7 @@
return 99;
}
-for (var i = 0; i < 10000; i++) f("foo");
+for (var i = 0; i < 5; i++) f("foo");
+%OptimizeFunctionOnNextCall(f);
+f("foo");
assertEquals(42, f("bar"));
diff --git a/test/mjsunit/const-eval-init.js b/test/mjsunit/const-eval-init.js
index 3f380d9..d350384 100644
--- a/test/mjsunit/const-eval-init.js
+++ b/test/mjsunit/const-eval-init.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
// Test the handling of initialization of deleted const variables.
// This only makes sense in local scopes since the declaration and
// initialization of consts in the global scope happen at the same
@@ -67,9 +69,11 @@
assertEquals(7, x);
}
-for (var i = 0; i < 10000; i++) {
+for (var i = 0; i < 5; i++) {
testAssignmentArgument();
}
+%OptimizeFunctionOnNextCall(testAssignmentArgument);
+testAssignmentArgument();
assertEquals(6, x);
__defineSetter__('x', function() { throw 42; });
diff --git a/test/mjsunit/external-array.js b/test/mjsunit/external-array.js
index 228e8f0..45d8be5 100644
--- a/test/mjsunit/external-array.js
+++ b/test/mjsunit/external-array.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
// This is a regression test for overlapping key and value registers.
function f(a) {
a[0] = 0;
@@ -32,9 +34,11 @@
}
var a = new Int32Array(2);
-for (var i = 0; i < 1000000; i++) {
+for (var i = 0; i < 5; i++) {
f(a);
}
+%OptimizeFunctionOnNextCall(f);
+f(a);
assertEquals(0, a[0]);
assertEquals(0, a[1]);
diff --git a/test/mjsunit/regress/regress-1079.js b/test/mjsunit/regress/regress-1079.js
index f3f3ce5..208dc5b 100644
--- a/test/mjsunit/regress/regress-1079.js
+++ b/test/mjsunit/regress/regress-1079.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
// Getting the arguments property of an optimized function should not crash,
// even if called through our optimized version of Function.prototype.apply.
@@ -39,7 +41,8 @@
}
}
-for (var i = 0; i < 100000; ++i) {
+for (var i = 0; i < 5; ++i) {
assertEquals(3, optimized(1, 2, 3).length);
}
-
+%OptimizeFunctionOnNextCall(optimized);
+assertEquals(3, optimized(1, 2, 3).length);
diff --git a/test/mjsunit/regress/regress-1106.js b/test/mjsunit/regress/regress-1106.js
index 382fd1b..e462d5d 100644
--- a/test/mjsunit/regress/regress-1106.js
+++ b/test/mjsunit/regress/regress-1106.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
// Test for issue 1106, where the optimizing compiler broke when accessing
// a property lying on a prototype of the global object, and that prototype
// object was in dictionary mode.
@@ -37,14 +39,18 @@
function f() { return foo; }
-for (i=0 ; i < 100000; ++i) {
+for (i=0 ; i < 5; ++i) {
assertEquals(5, f());
}
+%OptimizeFunctionOnNextCall(f);
+assertEquals(5, f());
// Test calls on functions defined in the prototype of the global object.
x.gee = function() { return 42; }
function g() { return gee(); }
-for (i=0 ; i < 100000; ++i) {
+for (i=0 ; i < 5; ++i) {
assertEquals(42, g());
}
+%OptimizeFunctionOnNextCall(g);
+assertEquals(42, g());
diff --git a/test/mjsunit/regress/regress-1166.js b/test/mjsunit/regress/regress-1166.js
index d75d397..8278aba 100644
--- a/test/mjsunit/regress/regress-1166.js
+++ b/test/mjsunit/regress/regress-1166.js
@@ -25,11 +25,16 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
// Deoptimization after a short-circuit logical operation in an effect
// context should not see the value of the expression.
function observe(x, y) { return x; }
function test(x) { return observe(1, ((false || false), x + 1)); }
-for (var i = 0; i < 10000000; ++i) test(0);
+for (var i = 0; i < 5; ++i) test(0);
+%OptimizeFunctionOnNextCall(test);
+test(0);
+
test("a");
diff --git a/test/mjsunit/regress/regress-1167.js b/test/mjsunit/regress/regress-1167.js
index 8437d83..2206f3d 100644
--- a/test/mjsunit/regress/regress-1167.js
+++ b/test/mjsunit/regress/regress-1167.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
// Deoptimization after a logical not in an effect context should not see a
// value for the logical not expression.
function test0(n) {
@@ -68,5 +70,7 @@
x + 1));
}
-for (var i = 0; i < 1000000; ++i) test2(0);
+for (var i = 0; i < 5; ++i) test2(0);
+%OptimizeFunctionOnNextCall(test2);
+test2(0);
test2(test2);
diff --git a/test/mjsunit/regress/regress-1210.js b/test/mjsunit/regress/regress-1210.js
index 9c708a5..7d4735a 100644
--- a/test/mjsunit/regress/regress-1210.js
+++ b/test/mjsunit/regress/regress-1210.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
// Deoptimization of the key expression in an arguments access should see
// the arguments object as the value of the receiver.
@@ -43,6 +45,8 @@
// Run enough to optimize assuming global 'a' is a smi.
for (var i = 0; i < 1000000; ++i) test(0);
+%OptimizeFunctionOnNextCall(test);
+test(0);
a = "hello";
test(0);
diff --git a/test/mjsunit/regress/regress-1229.js b/test/mjsunit/regress/regress-1229.js
index 4afb964..e16d278 100644
--- a/test/mjsunit/regress/regress-1229.js
+++ b/test/mjsunit/regress/regress-1229.js
@@ -56,11 +56,17 @@
return f(local_y, local_z); /* f should be inlined into h */
}
-for (var i = 0; i < 100000; i++) f(2, 3);
+for (var i = 0; i < 5; i++) f(2, 3);
+%OptimizeFunctionOnNextCall(f);
+f(2, 3);
-for (var i = 0; i < 100000; i++) g(3, 2);
+for (var i = 0; i < 5; i++) g(3, 2);
+%OptimizeFunctionOnNextCall(g);
+g(3, 2);
-for (var i = 0; i < 100000; i++) h(6, 4);
+for (var i = 0; i < 5; i++) h(6, 4);
+%OptimizeFunctionOnNextCall(h);
+h(6, 4);
// Check that %_IsConstructCall returns correct value when inlined
var NON_CONSTRUCT_MARKER = {};
@@ -76,4 +82,6 @@
assertEquals(construct, CONSTRUCT_MARKER);
}
-for (var i = 0; i < 100000; i++) new bar(1, 2, 3);
+for (var i = 0; i < 5; i++) new bar(1, 2, 3);
+%OptimizeFunctionOnNextCall(bar);
+bar(1, 2, 3);
diff --git a/test/mjsunit/regress/regress-1237.js b/test/mjsunit/regress/regress-1237.js
index f97f978..111df80 100644
--- a/test/mjsunit/regress/regress-1237.js
+++ b/test/mjsunit/regress/regress-1237.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
// Deoptimization after a conditional expression in an effect context should
// not see the value of the expression.
function observe(x, y) { return x; }
@@ -32,5 +34,8 @@
return observe(1, ((x? observe(observe.prototype.x): 'c'), x + 1));
}
-for (var i = 0; i < 10000000; ++i) test(0);
+for (var i = 0; i < 5; ++i) test(0);
+%OptimizeFunctionOnNextCall(test);
+test(0);
+
test("a");
diff --git a/test/mjsunit/regress/regress-1323.js b/test/mjsunit/regress/regress-1323.js
new file mode 100644
index 0000000..552a48d
--- /dev/null
+++ b/test/mjsunit/regress/regress-1323.js
@@ -0,0 +1,50 @@
+// Copyright 2011 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+// Regression test for load/store operating with wrong number of bits.
+function get(a, index) {
+ return a[index];
+}
+
+var a = new Float32Array(2);
+a[0] = 2.5;
+a[1] = 3.5;
+for (var i = 0; i < 5; i++) get(a, 0);
+%OptimizeFunctionOnNextCall(get);
+assertEquals(2.5, get(a, 0));
+assertEquals(3.5, get(a, 1));
+
+function set(a, index, value) {
+ a[index] = value;
+}
+for (var i = 0; i < 5; i++) set(a, 0, 4.5);
+%OptimizeFunctionOnNextCall(set);
+set(a, 0, 4.5);
+assertEquals(4.5, a[0]);
+assertEquals(3.5, a[1]);
diff --git a/test/mjsunit/regress/regress-3218915.js b/test/mjsunit/regress/regress-3218915.js
index 5fcbcec..4b08a6e 100644
--- a/test/mjsunit/regress/regress-3218915.js
+++ b/test/mjsunit/regress/regress-3218915.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
// Checks that comma expression in conditional context is processed correctly.
function withCommaExpressionInConditional(x) {
@@ -36,7 +38,9 @@
return (y = x + 1, y > 1) ? 'medium' : 'small';
}
-for (var i = 0; i < 10000; i++) {
+for (var i = 0; i < 5; i++) {
withCommaExpressionInConditional(i);
}
+%OptimizeFunctionOnNextCall(withCommaExpressionInConditional);
+withCommaExpressionInConditional(i);
withCommaExpressionInConditional("1")
diff --git a/test/mjsunit/regress/regress-962.js b/test/mjsunit/regress/regress-962.js
index f9f46e1..85ada0c 100644
--- a/test/mjsunit/regress/regress-962.js
+++ b/test/mjsunit/regress/regress-962.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
function L(scope) { this.s = new Object(); }
L.prototype.c = function() { return true; }
@@ -50,4 +52,6 @@
var ctx = new F;
-for (var i = 0; i < 10000; i++) ctx.foo();
+for (var i = 0; i < 5; i++) ctx.foo();
+%OptimizeFunctionOnNextCall(F.prototype.foo);
+ctx.foo();
diff --git a/test/mjsunit/string-charcodeat.js b/test/mjsunit/string-charcodeat.js
index f18d0a5..8be6a09 100644
--- a/test/mjsunit/string-charcodeat.js
+++ b/test/mjsunit/string-charcodeat.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
/**
* @fileoverview Check all sorts of borderline cases for charCodeAt.
*/
@@ -159,9 +161,11 @@
assertTrue(isNaN(str.charCodeAt(0x7fffffff)));
}
-for (var i = 0; i < 100000; i++) {
+for (var i = 0; i < 5; i++) {
ConsNotSmiIndex();
}
+%OptimizeFunctionOnNextCall(ConsNotSmiIndex);
+ConsNotSmiIndex();
for (var i = 0; i != 10; i++) {
@@ -222,6 +226,8 @@
assertEquals(99, "c".x(0));
}
-for (var i = 0; i < 10000; i++) {
+for (var i = 0; i < 5; i++) {
directlyOnPrototype();
}
+%OptimizeFunctionOnNextCall(directlyOnPrototype);
+directlyOnPrototype();
diff --git a/test/mjsunit/sum-0-plus-undefined-is-NaN.js b/test/mjsunit/sum-0-plus-undefined-is-NaN.js
index fb98d0c..5d662d1 100644
--- a/test/mjsunit/sum-0-plus-undefined-is-NaN.js
+++ b/test/mjsunit/sum-0-plus-undefined-is-NaN.js
@@ -1,4 +1,4 @@
-// Copyright 2010 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
/**
* @fileoverview Test addition of 0 and undefined.
*/
@@ -32,9 +34,11 @@
function sum(a, b) { return a + b; }
function test(x, y, expectNaN) {
- for (var i = 0; i < 1000; i++) {
+ for (var i = 0; i < 5; i++) {
assertEquals(expectNaN, isNaN(sum(x, y)));
}
+ %OptimizeFunctionOnNextCall(sum);
+ assertEquals(expectNaN, isNaN(sum(x, y)));
}
test(0, 1, false);
diff --git a/test/test262/harness-adapt.js b/test/test262/harness-adapt.js
index b52afdb..bc10a9d 100644
--- a/test/test262/harness-adapt.js
+++ b/test/test262/harness-adapt.js
@@ -43,7 +43,7 @@
}
Test262Error.prototype.toString = function() {
- return this.result;
+ return this.result + " " + error;
}
function registerTest(test) {
@@ -52,22 +52,24 @@
try {
var res = test.test.call($this);
} catch(e) {
- print(e);
- res = 'fail'; error = e;
+ res = 'fail';
+ error = e;
}
var retVal = /^s/i.test(test.id)
? (res === true || typeof res == 'undefined' ? 'pass' : 'fail')
: (res === true ? 'pass' : 'fail');
if (retVal != 'pass') {
+ var precondition = (test.precondition !== undefined)
+ ? test.precondition.toString()
+ : '';
+
throw new Test262Error(
test.id,
test.path,
test.description,
test.test.toString(),
- (test.precondition !== undefined)
- ? test.precondition.toString()
- : '',
+ precondition,
retVal,
error);
}
diff --git a/test/test262/test262.status b/test/test262/test262.status
index bdc8b9c..754984d 100644
--- a/test/test262/test262.status
+++ b/test/test262/test262.status
@@ -32,6 +32,20 @@
prefix ietestcenter
+
+#
+# Deliberate differences for compatibility with other browsers
+#
+# 15.9.5.43-0-9 and 15.9.5.43-0-10. V8 doesn't throw RangeError
+# from Date.prototype.toISOString when string is not a finite number.
+# This is compatible with Firefox and Safari.
+15.9.5.43-0-9: PASS || FAIL
+15.9.5.43-0-10: PASS || FAIL
+
+#
+# Unanalyzed failures which may be bugs or deliberate differences
+#
+
# BUG: 7.6 - SyntaxError expected: reserved words used as Identifier
# Names in UTF8: class (class)
7.6-30: FAIL
@@ -913,66 +927,6 @@
# of 'O', and 'desc' is accessor descriptor, test updating multiple
# attribute values of 'P' (10.6 [[DefineOwnProperty]] step 3)
15.2.3.7-6-a-292: FAIL
-# Bug? Object.preventExtensions - indexed properties cannot be added into the
-# returned object
-15.2.3.10-3-2: FAIL
-# Bug? Object.preventExtensions - indexed properties cannot be added into a
-# Function object
-15.2.3.10-3-3: FAIL
-# Bug? Object.preventExtensions - indexed properties cannot be added into an
-# Array object
-15.2.3.10-3-4: FAIL
-# Bug? Object.preventExtensions - indexed properties cannot be added into a
-# String object
-15.2.3.10-3-5-1: FAIL
-# Bug? Object.preventExtensions - indexed properties cannot be added into a
-# Boolean object
-15.2.3.10-3-6: FAIL
-# Bug? Object.preventExtensions - indexed properties cannot be added into a
-# Number object
-15.2.3.10-3-7: FAIL
-# Bug? Object.preventExtensions - indexed properties cannot be added into a Date
-# object
-15.2.3.10-3-8: FAIL
-# Bug? Object.preventExtensions - indexed properties cannot be added into a
-# RegExp object
-15.2.3.10-3-9: FAIL
-# Bug? Object.preventExtensions - indexed properties cannot be added into an
-# Error object
-15.2.3.10-3-10: FAIL
-# Bug? Object.preventExtensions - indexed properties cannot be added into an
-# Arguments object
-15.2.3.10-3-11: FAIL
-# Bug? Object.preventExtensions - named properties cannot be added into the
-# returned object
-15.2.3.10-3-12: FAIL
-# Bug? Object.preventExtensions - named properties cannot be added into a
-# Function object
-15.2.3.10-3-13: FAIL
-# Bug? Object.preventExtensions - named properties cannot be added into an Array
-# object
-15.2.3.10-3-14: FAIL
-# Bug? Object.preventExtensions - named properties cannot be added into a String
-# object
-15.2.3.10-3-15: FAIL
-# Bug? Object.preventExtensions - named properties cannot be added into a
-# Boolean object
-15.2.3.10-3-16: FAIL
-# Bug? Object.preventExtensions - named properties cannot be added into a Number
-# object
-15.2.3.10-3-17: FAIL
-# Bug? Object.preventExtensions - named properties cannot be added into a Date
-# object
-15.2.3.10-3-18: FAIL
-# Bug? Object.preventExtensions - named properties cannot be added into a RegExp
-# object
-15.2.3.10-3-19: FAIL
-# Bug? Object.preventExtensions - named properties cannot be added into an Error
-# object
-15.2.3.10-3-20: FAIL
-# Bug? Object.preventExtensions - named properties cannot be added into an
-# Arguments object
-15.2.3.10-3-21: FAIL
# Bug? Object.prototype.toString - '[object Undefined]' will be returned when
# 'this' value is undefined
15.2.4.2-1-1: FAIL