summaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2010-11-30 11:34:27 -0800
committerRyan Dahl <ry@tinyclouds.org>2010-11-30 11:37:43 -0800
commit7286b7952150672cded846e5eee5c533e72f3e9e (patch)
treeca2402b34014b3ca916836eaf33156585501c466 /deps/v8/test/cctest
parent486c74e72bd015ac178f881806a1d36accdcecce (diff)
downloadnode-new-7286b7952150672cded846e5eee5c533e72f3e9e.tar.gz
Upgrade V8 to 2.5.9.1
Diffstat (limited to 'deps/v8/test/cctest')
-rw-r--r--deps/v8/test/cctest/test-api.cc27
-rw-r--r--deps/v8/test/cctest/test-conversions.cc6
-rw-r--r--deps/v8/test/cctest/test-heap-profiler.cc15
-rw-r--r--deps/v8/test/cctest/test-log.cc42
-rwxr-xr-xdeps/v8/test/cctest/test-parsing.cc3
5 files changed, 56 insertions, 37 deletions
diff --git a/deps/v8/test/cctest/test-api.cc b/deps/v8/test/cctest/test-api.cc
index 5322314417..8ce7a79a9b 100644
--- a/deps/v8/test/cctest/test-api.cc
+++ b/deps/v8/test/cctest/test-api.cc
@@ -7819,6 +7819,31 @@ THREADED_TEST(ObjectProtoToString) {
}
+THREADED_TEST(ObjectGetConstructorName) {
+ v8::HandleScope scope;
+ LocalContext context;
+ v8_compile("function Parent() {};"
+ "function Child() {};"
+ "Child.prototype = new Parent();"
+ "var outer = { inner: function() { } };"
+ "var p = new Parent();"
+ "var c = new Child();"
+ "var x = new outer.inner();")->Run();
+
+ Local<v8::Value> p = context->Global()->Get(v8_str("p"));
+ CHECK(p->IsObject() && p->ToObject()->GetConstructorName()->Equals(
+ v8_str("Parent")));
+
+ Local<v8::Value> c = context->Global()->Get(v8_str("c"));
+ CHECK(c->IsObject() && c->ToObject()->GetConstructorName()->Equals(
+ v8_str("Child")));
+
+ Local<v8::Value> x = context->Global()->Get(v8_str("x"));
+ CHECK(x->IsObject() && x->ToObject()->GetConstructorName()->Equals(
+ v8_str("outer.inner")));
+}
+
+
bool ApiTestFuzzer::fuzzing_ = false;
i::Semaphore* ApiTestFuzzer::all_tests_done_=
i::OS::CreateSemaphore(0);
@@ -8734,7 +8759,7 @@ TEST(PreCompileInvalidPreparseDataError) {
v8::ScriptData::PreCompile(script, i::StrLength(script));
CHECK(!sd->HasError());
// ScriptDataImpl private implementation details
- const int kHeaderSize = i::ScriptDataImpl::kHeaderSize;
+ const int kHeaderSize = i::PreparseDataConstants::kHeaderSize;
const int kFunctionEntrySize = i::FunctionEntry::kSize;
const int kFunctionEntryStartOffset = 0;
const int kFunctionEntryEndOffset = 1;
diff --git a/deps/v8/test/cctest/test-conversions.cc b/deps/v8/test/cctest/test-conversions.cc
index eef7184828..1b5cc2dee8 100644
--- a/deps/v8/test/cctest/test-conversions.cc
+++ b/deps/v8/test/cctest/test-conversions.cc
@@ -104,8 +104,10 @@ TEST(IntegerStrLiteral) {
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_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)));
CHECK_EQ(0.0, StringToDouble("0e0", ALLOW_HEX | ALLOW_OCTALS));
CHECK_EQ(0.0, StringToDouble("0e1", ALLOW_HEX | ALLOW_OCTALS));
diff --git a/deps/v8/test/cctest/test-heap-profiler.cc b/deps/v8/test/cctest/test-heap-profiler.cc
index 4dd7fe823f..95314d74a4 100644
--- a/deps/v8/test/cctest/test-heap-profiler.cc
+++ b/deps/v8/test/cctest/test-heap-profiler.cc
@@ -1178,4 +1178,19 @@ TEST(HeapSnapshotJSONSerializationAborting) {
CHECK_EQ(0, stream.eos_signaled());
}
+
+// Must not crash in debug mode.
+TEST(AggregatedHeapSnapshotJSONSerialization) {
+ v8::HandleScope scope;
+ LocalContext env;
+
+ const v8::HeapSnapshot* snapshot =
+ v8::HeapProfiler::TakeSnapshot(
+ v8::String::New("agg"), v8::HeapSnapshot::kAggregated);
+ TestJSONStream stream;
+ snapshot->Serialize(&stream, v8::HeapSnapshot::kJSON);
+ CHECK_GT(stream.size(), 0);
+ CHECK_EQ(1, stream.eos_signaled());
+}
+
#endif // ENABLE_LOGGING_AND_PROFILING
diff --git a/deps/v8/test/cctest/test-log.cc b/deps/v8/test/cctest/test-log.cc
index 7168737416..710c10e996 100644
--- a/deps/v8/test/cctest/test-log.cc
+++ b/deps/v8/test/cctest/test-log.cc
@@ -139,6 +139,12 @@ namespace internal {
class LoggerTestHelper : public AllStatic {
public:
static bool IsSamplerActive() { return Logger::IsProfilerSamplerActive(); }
+ static void ResetSamplesTaken() {
+ reinterpret_cast<Sampler*>(Logger::ticker_)->ResetSamplesTaken();
+ }
+ static bool has_samples_taken() {
+ return reinterpret_cast<Sampler*>(Logger::ticker_)->samples_taken() > 0;
+ }
};
} // namespace v8::internal
@@ -147,24 +153,6 @@ class LoggerTestHelper : public AllStatic {
using v8::internal::LoggerTestHelper;
-// Under Linux, we need to check if signals were delivered to avoid false
-// positives. Under other platforms profiling is done via a high-priority
-// thread, so this case never happen.
-static bool was_sigprof_received = true;
-#ifdef __linux__
-
-struct sigaction old_sigprof_handler;
-pthread_t our_thread;
-
-static void SigProfSignalHandler(int signal, siginfo_t* info, void* context) {
- if (signal != SIGPROF || !pthread_equal(pthread_self(), our_thread)) return;
- was_sigprof_received = true;
- old_sigprof_handler.sa_sigaction(signal, info, context);
-}
-
-#endif // __linux__
-
-
namespace {
class ScopedLoggerInitializer {
@@ -258,6 +246,9 @@ class LogBufferMatcher {
static void CheckThatProfilerWorks(LogBufferMatcher* matcher) {
+ CHECK(!LoggerTestHelper::IsSamplerActive());
+ LoggerTestHelper::ResetSamplesTaken();
+
Logger::ResumeProfiler(v8::PROFILER_MODULE_CPU, 0);
CHECK(LoggerTestHelper::IsSamplerActive());
@@ -266,19 +257,6 @@ static void CheckThatProfilerWorks(LogBufferMatcher* matcher) {
const char* code_creation = "\ncode-creation,"; // eq. to /^code-creation,/
CHECK_NE(NULL, matcher->Find(code_creation));
-#ifdef __linux__
- // Intercept SIGPROF handler to make sure that the test process
- // had received it. Under load, system can defer it causing test failure.
- // It is important to execute this after 'ResumeProfiler'.
- our_thread = pthread_self();
- was_sigprof_received = false;
- struct sigaction sa;
- sa.sa_sigaction = SigProfSignalHandler;
- sigemptyset(&sa.sa_mask);
- sa.sa_flags = SA_SIGINFO;
- CHECK_EQ(0, sigaction(SIGPROF, &sa, &old_sigprof_handler));
-#endif // __linux__
-
// Force compiler to generate new code by parametrizing source.
EmbeddedVector<char, 100> script_src;
i::OS::SNPrintF(script_src,
@@ -306,7 +284,7 @@ static void CheckThatProfilerWorks(LogBufferMatcher* matcher) {
CHECK_NE(NULL, matcher->Find(code_creation));
const char* tick = "\ntick,";
const bool ticks_found = matcher->Find(tick) != NULL;
- CHECK_EQ(was_sigprof_received, ticks_found);
+ CHECK_EQ(LoggerTestHelper::has_samples_taken(), ticks_found);
}
diff --git a/deps/v8/test/cctest/test-parsing.cc b/deps/v8/test/cctest/test-parsing.cc
index 243d47884a..a93fc2712d 100755
--- a/deps/v8/test/cctest/test-parsing.cc
+++ b/deps/v8/test/cctest/test-parsing.cc
@@ -263,8 +263,7 @@ TEST(StandAlonePreParser) {
i::CompleteParserRecorder log;
i::V8JavaScriptScanner scanner;
scanner.Initialize(i::Handle<i::String>::null(), &stream);
- v8::preparser::PreParser<i::V8JavaScriptScanner,
- i::CompleteParserRecorder> preparser;
+ v8::preparser::PreParser preparser;
bool result = preparser.PreParseProgram(&scanner, &log, true);
CHECK(result);
i::ScriptDataImpl data(log.ExtractData());