Commit c60fef30 authored by kasperl@chromium.org's avatar kasperl@chromium.org

Fix issues with running some of our tests with an embedded

snapshot. Changed the debug-script.js test to ignore the
exact number of extension scripts.


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@199 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent c275d66c
...@@ -37,8 +37,8 @@ class Snapshot { ...@@ -37,8 +37,8 @@ class Snapshot {
// could be found. // could be found.
static bool Initialize(const char* snapshot_file = NULL); static bool Initialize(const char* snapshot_file = NULL);
// Disable the use of the internal snapshot. // Returns whether or not the snapshot is enabled.
static void DisableInternal() { size_ = 0; } static bool IsEnabled() { return size_ != 0; }
// Write snapshot to the given file. Returns true if snapshot was written // Write snapshot to the given file. Returns true if snapshot was written
// successfully. // successfully.
......
...@@ -1429,7 +1429,7 @@ static const char* js_code_causing_out_of_memory = ...@@ -1429,7 +1429,7 @@ static const char* js_code_causing_out_of_memory =
// that come after them so they cannot run in parallel. // that come after them so they cannot run in parallel.
DISABLED_TEST(OutOfMemory) { DISABLED_TEST(OutOfMemory) {
// It's not possible to read a snapshot into a heap with different dimensions. // It's not possible to read a snapshot into a heap with different dimensions.
v8::internal::Snapshot::DisableInternal(); if (v8::internal::Snapshot::IsEnabled()) return;
// Set heap limits. // Set heap limits.
static const int K = 1024; static const int K = 1024;
v8::ResourceConstraints constraints; v8::ResourceConstraints constraints;
...@@ -1470,7 +1470,7 @@ v8::Handle<Value> ProvokeOutOfMemory(const v8::Arguments& args) { ...@@ -1470,7 +1470,7 @@ v8::Handle<Value> ProvokeOutOfMemory(const v8::Arguments& args) {
DISABLED_TEST(OutOfMemoryNested) { DISABLED_TEST(OutOfMemoryNested) {
// It's not possible to read a snapshot into a heap with different dimensions. // It's not possible to read a snapshot into a heap with different dimensions.
v8::internal::Snapshot::DisableInternal(); if (v8::internal::Snapshot::IsEnabled()) return;
// Set heap limits. // Set heap limits.
static const int K = 1024; static const int K = 1024;
v8::ResourceConstraints constraints; v8::ResourceConstraints constraints;
...@@ -1499,7 +1499,7 @@ DISABLED_TEST(OutOfMemoryNested) { ...@@ -1499,7 +1499,7 @@ DISABLED_TEST(OutOfMemoryNested) {
TEST(HugeConsStringOutOfMemory) { TEST(HugeConsStringOutOfMemory) {
// It's not possible to read a snapshot into a heap with different dimensions. // It's not possible to read a snapshot into a heap with different dimensions.
v8::internal::Snapshot::DisableInternal(); if (v8::internal::Snapshot::IsEnabled()) return;
v8::HandleScope scope; v8::HandleScope scope;
LocalContext context; LocalContext context;
// Set heap limits. // Set heap limits.
...@@ -4716,6 +4716,8 @@ TEST(DontLeakGlobalObjects) { ...@@ -4716,6 +4716,8 @@ TEST(DontLeakGlobalObjects) {
// Regression test for issues 1139850 and 1174891. // Regression test for issues 1139850 and 1174891.
v8::internal::V8::Initialize(NULL); v8::internal::V8::Initialize(NULL);
if (v8::internal::Snapshot::IsEnabled()) return;
EnsureNoSurvivingGlobalObjects(); EnsureNoSurvivingGlobalObjects();
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
...@@ -4757,6 +4759,7 @@ TEST(DontLeakGlobalObjects) { ...@@ -4757,6 +4759,7 @@ TEST(DontLeakGlobalObjects) {
THREADED_TEST(CheckForCrossContextObjectLiterals) { THREADED_TEST(CheckForCrossContextObjectLiterals) {
v8::internal::V8::Initialize(NULL); v8::internal::V8::Initialize(NULL);
if (v8::internal::Snapshot::IsEnabled()) return;
const int nof = 2; const int nof = 2;
const char* sources[nof] = { const char* sources[nof] = {
......
...@@ -78,12 +78,12 @@ TEST(MarkingStack) { ...@@ -78,12 +78,12 @@ TEST(MarkingStack) {
TEST(Promotion) { TEST(Promotion) {
// Test the situation that some objects in new space are promoted to the // Test the situation that some objects in new space are promoted to the
// old space // old space
if (Snapshot::IsEnabled()) return;
// Ensure that we get a compacting collection so that objects are promoted // Ensure that we get a compacting collection so that objects are promoted
// from new space. // from new space.
FLAG_gc_global = true; FLAG_gc_global = true;
FLAG_always_compact = true; FLAG_always_compact = true;
Snapshot::DisableInternal();
Heap::ConfigureHeap(2*256*KB, 4*MB); Heap::ConfigureHeap(2*256*KB, 4*MB);
InitializeVM(); InitializeVM();
...@@ -110,7 +110,7 @@ TEST(Promotion) { ...@@ -110,7 +110,7 @@ TEST(Promotion) {
TEST(NoPromotion) { TEST(NoPromotion) {
Snapshot::DisableInternal(); if (Snapshot::IsEnabled()) return;
Heap::ConfigureHeap(2*256*KB, 4*MB); Heap::ConfigureHeap(2*256*KB, 4*MB);
// Test the situation that some objects in new space are promoted to // Test the situation that some objects in new space are promoted to
......
...@@ -191,14 +191,14 @@ TEST(SerializeInternal) { ...@@ -191,14 +191,14 @@ TEST(SerializeInternal) {
// bootstrapped heap. // bootstrapped heap.
// (Smoke test.) // (Smoke test.)
TEST(Serialize) { TEST(Serialize) {
Snapshot::DisableInternal(); if (Snapshot::IsEnabled()) return;
Serialize(); Serialize();
} }
// Test that the heap isn't destroyed after a serialization. // Test that the heap isn't destroyed after a serialization.
TEST(SerializeNondestructive) { TEST(SerializeNondestructive) {
Snapshot::DisableInternal(); if (Snapshot::IsEnabled()) return;
StatsTable::SetCounterFunction(counter_function); StatsTable::SetCounterFunction(counter_function);
v8::HandleScope scope; v8::HandleScope scope;
v8::Persistent<v8::Context> env = v8::Context::New(); v8::Persistent<v8::Context> env = v8::Context::New();
......
...@@ -53,9 +53,8 @@ for (i = 0; i < scripts.length; i++) { ...@@ -53,9 +53,8 @@ for (i = 0; i < scripts.length; i++) {
} }
} }
// This has to be updated if the number of native and extension scripts change. // This has to be updated if the number of native scripts change.
assertEquals(12, native_count); assertEquals(12, native_count);
assertEquals(1, extension_count);
assertEquals(2, normal_count); // This script and mjsunit.js. assertEquals(2, normal_count); // This script and mjsunit.js.
// Test a builtins script. // Test a builtins script.
...@@ -75,8 +74,10 @@ assertEquals(Debug.ScriptType.Native, debug_delay_script.type); ...@@ -75,8 +74,10 @@ assertEquals(Debug.ScriptType.Native, debug_delay_script.type);
// Test an extension script. // Test an extension script.
var extension_gc_script = Debug.findScript('v8/gc'); var extension_gc_script = Debug.findScript('v8/gc');
assertEquals('v8/gc', extension_gc_script.name); if (extension_gc_script) {
assertEquals(Debug.ScriptType.Extension, extension_gc_script.type); assertEquals('v8/gc', extension_gc_script.name);
assertEquals(Debug.ScriptType.Extension, extension_gc_script.type);
}
// Test a normal script. // Test a normal script.
var mjsunit_js_script = Debug.findScript(/mjsunit.js/); var mjsunit_js_script = Debug.findScript(/mjsunit.js/);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment