Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(933)

Unified Diff: test/cctest/test-api.cc

Issue 6685088: Merge isolates to bleeding_edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-alloc.cc ('k') | test/cctest/test-assembler-arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
===================================================================
--- test/cctest/test-api.cc (revision 7267)
+++ test/cctest/test-api.cc (working copy)
@@ -34,7 +34,6 @@
#include "execution.h"
#include "snapshot.h"
#include "platform.h"
-#include "top.h"
#include "utils.h"
#include "cctest.h"
#include "parser.h"
@@ -398,11 +397,11 @@
CHECK(source->IsExternal());
CHECK_EQ(resource,
static_cast<TestResource*>(source->GetExternalStringResource()));
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
CHECK_EQ(0, TestResource::dispose_count);
}
- i::CompilationCache::Clear();
- i::Heap::CollectAllGarbage(false);
+ v8::internal::Isolate::Current()->compilation_cache()->Clear();
+ HEAP->CollectAllGarbage(false);
CHECK_EQ(1, TestResource::dispose_count);
}
@@ -419,11 +418,11 @@
Local<Value> value = script->Run();
CHECK(value->IsNumber());
CHECK_EQ(7, value->Int32Value());
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
CHECK_EQ(0, TestAsciiResource::dispose_count);
}
- i::CompilationCache::Clear();
- i::Heap::CollectAllGarbage(false);
+ i::Isolate::Current()->compilation_cache()->Clear();
+ HEAP->CollectAllGarbage(false);
CHECK_EQ(1, TestAsciiResource::dispose_count);
}
@@ -436,19 +435,19 @@
LocalContext env;
Local<String> source = String::New(two_byte_source);
// Trigger GCs so that the newly allocated string moves to old gen.
- i::Heap::CollectGarbage(i::NEW_SPACE); // in survivor space now
- i::Heap::CollectGarbage(i::NEW_SPACE); // in old gen now
+ HEAP->CollectGarbage(i::NEW_SPACE); // in survivor space now
+ HEAP->CollectGarbage(i::NEW_SPACE); // in old gen now
bool success = source->MakeExternal(new TestResource(two_byte_source));
CHECK(success);
Local<Script> script = Script::Compile(source);
Local<Value> value = script->Run();
CHECK(value->IsNumber());
CHECK_EQ(7, value->Int32Value());
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
CHECK_EQ(0, TestResource::dispose_count);
}
- i::CompilationCache::Clear();
- i::Heap::CollectAllGarbage(false);
+ i::Isolate::Current()->compilation_cache()->Clear();
+ HEAP->CollectAllGarbage(false);
CHECK_EQ(1, TestResource::dispose_count);
}
@@ -461,8 +460,8 @@
LocalContext env;
Local<String> source = v8_str(c_source);
// Trigger GCs so that the newly allocated string moves to old gen.
- i::Heap::CollectGarbage(i::NEW_SPACE); // in survivor space now
- i::Heap::CollectGarbage(i::NEW_SPACE); // in old gen now
+ HEAP->CollectGarbage(i::NEW_SPACE); // in survivor space now
+ HEAP->CollectGarbage(i::NEW_SPACE); // in old gen now
bool success = source->MakeExternal(
new TestAsciiResource(i::StrDup(c_source)));
CHECK(success);
@@ -470,11 +469,11 @@
Local<Value> value = script->Run();
CHECK(value->IsNumber());
CHECK_EQ(7, value->Int32Value());
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
CHECK_EQ(0, TestAsciiResource::dispose_count);
}
- i::CompilationCache::Clear();
- i::Heap::CollectAllGarbage(false);
+ i::Isolate::Current()->compilation_cache()->Clear();
+ HEAP->CollectAllGarbage(false);
CHECK_EQ(1, TestAsciiResource::dispose_count);
}
@@ -484,8 +483,8 @@
LocalContext env;
// Free some space in the new space so that we can check freshness.
- i::Heap::CollectGarbage(i::NEW_SPACE);
- i::Heap::CollectGarbage(i::NEW_SPACE);
+ HEAP->CollectGarbage(i::NEW_SPACE);
+ HEAP->CollectGarbage(i::NEW_SPACE);
uint16_t* two_byte_string = AsciiToTwoByteString("small");
Local<String> small_string = String::New(two_byte_string);
@@ -494,8 +493,8 @@
// We should refuse to externalize newly created small string.
CHECK(!small_string->CanMakeExternal());
// Trigger GCs so that the newly allocated string moves to old gen.
- i::Heap::CollectGarbage(i::NEW_SPACE); // in survivor space now
- i::Heap::CollectGarbage(i::NEW_SPACE); // in old gen now
+ HEAP->CollectGarbage(i::NEW_SPACE); // in survivor space now
+ HEAP->CollectGarbage(i::NEW_SPACE); // in old gen now
// Old space strings should be accepted.
CHECK(small_string->CanMakeExternal());
@@ -530,15 +529,15 @@
LocalContext env;
// Free some space in the new space so that we can check freshness.
- i::Heap::CollectGarbage(i::NEW_SPACE);
- i::Heap::CollectGarbage(i::NEW_SPACE);
+ HEAP->CollectGarbage(i::NEW_SPACE);
+ HEAP->CollectGarbage(i::NEW_SPACE);
Local<String> small_string = String::New("small");
// We should refuse to externalize newly created small string.
CHECK(!small_string->CanMakeExternal());
// Trigger GCs so that the newly allocated string moves to old gen.
- i::Heap::CollectGarbage(i::NEW_SPACE); // in survivor space now
- i::Heap::CollectGarbage(i::NEW_SPACE); // in old gen now
+ HEAP->CollectGarbage(i::NEW_SPACE); // in survivor space now
+ HEAP->CollectGarbage(i::NEW_SPACE); // in old gen now
// Old space strings should be accepted.
CHECK(small_string->CanMakeExternal());
@@ -570,13 +569,13 @@
String::NewExternal(new TestResource(two_byte_string));
i::Handle<i::String> istring = v8::Utils::OpenHandle(*string);
// Trigger GCs so that the newly allocated string moves to old gen.
- i::Heap::CollectGarbage(i::NEW_SPACE); // in survivor space now
- i::Heap::CollectGarbage(i::NEW_SPACE); // in old gen now
- i::Handle<i::String> isymbol = i::Factory::SymbolFromString(istring);
+ HEAP->CollectGarbage(i::NEW_SPACE); // in survivor space now
+ HEAP->CollectGarbage(i::NEW_SPACE); // in old gen now
+ i::Handle<i::String> isymbol = FACTORY->SymbolFromString(istring);
CHECK(isymbol->IsSymbol());
}
- i::Heap::CollectAllGarbage(false);
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
}
@@ -588,13 +587,13 @@
new TestAsciiResource(i::StrDup(one_byte_string)));
i::Handle<i::String> istring = v8::Utils::OpenHandle(*string);
// Trigger GCs so that the newly allocated string moves to old gen.
- i::Heap::CollectGarbage(i::NEW_SPACE); // in survivor space now
- i::Heap::CollectGarbage(i::NEW_SPACE); // in old gen now
- i::Handle<i::String> isymbol = i::Factory::SymbolFromString(istring);
+ HEAP->CollectGarbage(i::NEW_SPACE); // in survivor space now
+ HEAP->CollectGarbage(i::NEW_SPACE); // in old gen now
+ i::Handle<i::String> isymbol = FACTORY->SymbolFromString(istring);
CHECK(isymbol->IsSymbol());
}
- i::Heap::CollectAllGarbage(false);
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
}
@@ -607,12 +606,12 @@
Local<String> string =
String::NewExternal(new TestResource(two_byte_string));
i::Handle<i::String> istring = v8::Utils::OpenHandle(*string);
- i::Heap::CollectGarbage(i::NEW_SPACE);
- in_new_space = i::Heap::InNewSpace(*istring);
- CHECK(in_new_space || i::Heap::old_data_space()->Contains(*istring));
+ HEAP->CollectGarbage(i::NEW_SPACE);
+ in_new_space = HEAP->InNewSpace(*istring);
+ CHECK(in_new_space || HEAP->old_data_space()->Contains(*istring));
CHECK_EQ(0, TestResource::dispose_count);
}
- i::Heap::CollectGarbage(in_new_space ? i::NEW_SPACE : i::OLD_DATA_SPACE);
+ HEAP->CollectGarbage(in_new_space ? i::NEW_SPACE : i::OLD_DATA_SPACE);
CHECK_EQ(1, TestResource::dispose_count);
}
@@ -626,12 +625,12 @@
Local<String> string = String::NewExternal(
new TestAsciiResource(i::StrDup(one_byte_string)));
i::Handle<i::String> istring = v8::Utils::OpenHandle(*string);
- i::Heap::CollectGarbage(i::NEW_SPACE);
- in_new_space = i::Heap::InNewSpace(*istring);
- CHECK(in_new_space || i::Heap::old_data_space()->Contains(*istring));
+ HEAP->CollectGarbage(i::NEW_SPACE);
+ in_new_space = HEAP->InNewSpace(*istring);
+ CHECK(in_new_space || HEAP->old_data_space()->Contains(*istring));
CHECK_EQ(0, TestAsciiResource::dispose_count);
}
- i::Heap::CollectGarbage(in_new_space ? i::NEW_SPACE : i::OLD_DATA_SPACE);
+ HEAP->CollectGarbage(in_new_space ? i::NEW_SPACE : i::OLD_DATA_SPACE);
CHECK_EQ(1, TestAsciiResource::dispose_count);
}
@@ -671,11 +670,11 @@
Local<Value> value = script->Run();
CHECK(value->IsNumber());
CHECK_EQ(7, value->Int32Value());
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
CHECK_EQ(0, TestAsciiResource::dispose_count);
}
- i::CompilationCache::Clear();
- i::Heap::CollectAllGarbage(false);
+ i::Isolate::Current()->compilation_cache()->Clear();
+ HEAP->CollectAllGarbage(false);
CHECK_EQ(1, TestAsciiResourceWithDisposeControl::dispose_calls);
CHECK_EQ(0, TestAsciiResource::dispose_count);
@@ -692,11 +691,11 @@
Local<Value> value = script->Run();
CHECK(value->IsNumber());
CHECK_EQ(7, value->Int32Value());
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
CHECK_EQ(0, TestAsciiResource::dispose_count);
}
- i::CompilationCache::Clear();
- i::Heap::CollectAllGarbage(false);
+ i::Isolate::Current()->compilation_cache()->Clear();
+ HEAP->CollectAllGarbage(false);
CHECK_EQ(1, TestAsciiResourceWithDisposeControl::dispose_calls);
CHECK_EQ(1, TestAsciiResource::dispose_count);
}
@@ -742,9 +741,9 @@
CHECK(value->IsNumber());
CHECK_EQ(68, value->Int32Value());
}
- i::CompilationCache::Clear();
- i::Heap::CollectAllGarbage(false);
- i::Heap::CollectAllGarbage(false);
+ i::Isolate::Current()->compilation_cache()->Clear();
+ HEAP->CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
}
@@ -1579,12 +1578,12 @@
// Check reading and writing aligned pointers.
obj->SetPointerInInternalField(0, aligned);
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
CHECK_EQ(aligned, obj->GetPointerFromInternalField(0));
// Check reading and writing unaligned pointers.
obj->SetPointerInInternalField(0, unaligned);
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
CHECK_EQ(unaligned, obj->GetPointerFromInternalField(0));
delete[] data;
@@ -1610,19 +1609,19 @@
CHECK_EQ(1, static_cast<int>(reinterpret_cast<uintptr_t>(unaligned) & 0x1));
obj->SetPointerInInternalField(0, aligned);
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
CHECK_EQ(aligned, v8::External::Unwrap(obj->GetInternalField(0)));
obj->SetPointerInInternalField(0, unaligned);
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
CHECK_EQ(unaligned, v8::External::Unwrap(obj->GetInternalField(0)));
obj->SetInternalField(0, v8::External::Wrap(aligned));
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
CHECK_EQ(aligned, obj->GetPointerFromInternalField(0));
obj->SetInternalField(0, v8::External::Wrap(unaligned));
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
CHECK_EQ(unaligned, obj->GetPointerFromInternalField(0));
delete[] data;
@@ -1635,7 +1634,7 @@
// Ensure that the test starts with an fresh heap to test whether the hash
// code is based on the address.
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
Local<v8::Object> obj = v8::Object::New();
int hash = obj->GetIdentityHash();
int hash1 = obj->GetIdentityHash();
@@ -1645,7 +1644,7 @@
// objects should not be assigned the same hash code. If the test below fails
// the random number generator should be evaluated.
CHECK_NE(hash, hash2);
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
int hash3 = v8::Object::New()->GetIdentityHash();
// Make sure that the identity hash is not based on the initial address of
// the object alone. If the test below fails the random number generator
@@ -1682,7 +1681,7 @@
v8::Local<v8::String> empty = v8_str("");
v8::Local<v8::String> prop_name = v8_str("prop_name");
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
// Make sure delete of a non-existent hidden value works
CHECK(obj->DeleteHiddenValue(key));
@@ -1692,7 +1691,7 @@
CHECK(obj->SetHiddenValue(key, v8::Integer::New(2002)));
CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value());
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
// Make sure we do not find the hidden property.
CHECK(!obj->Has(empty));
@@ -1703,7 +1702,7 @@
CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value());
CHECK_EQ(2003, obj->Get(empty)->Int32Value());
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
// Add another property and delete it afterwards to force the object in
// slow case.
@@ -1714,7 +1713,7 @@
CHECK(obj->Delete(prop_name));
CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value());
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
CHECK(obj->DeleteHiddenValue(key));
CHECK(obj->GetHiddenValue(key).IsEmpty());
@@ -1847,7 +1846,7 @@
V8::AddImplicitReferences(g2s2, g2_children, 1);
}
// Do a full GC
- i::Heap::CollectGarbage(i::OLD_POINTER_SPACE);
+ HEAP->CollectGarbage(i::OLD_POINTER_SPACE);
// All object should be alive.
CHECK_EQ(0, NumberOfWeakCalls);
@@ -1871,7 +1870,7 @@
V8::AddImplicitReferences(g2s2, g2_children, 1);
}
- i::Heap::CollectGarbage(i::OLD_POINTER_SPACE);
+ HEAP->CollectGarbage(i::OLD_POINTER_SPACE);
// All objects should be gone. 5 global handles in total.
CHECK_EQ(5, NumberOfWeakCalls);
@@ -1880,7 +1879,7 @@
g1c1.MakeWeak(reinterpret_cast<void*>(1234), &WeakPointerCallback);
g2c1.MakeWeak(reinterpret_cast<void*>(1234), &WeakPointerCallback);
- i::Heap::CollectGarbage(i::OLD_POINTER_SPACE);
+ HEAP->CollectGarbage(i::OLD_POINTER_SPACE);
CHECK_EQ(7, NumberOfWeakCalls);
}
@@ -1936,7 +1935,7 @@
V8::AddImplicitReferences(g3s1, g3_children, 1);
}
// Do a full GC
- i::Heap::CollectGarbage(i::OLD_POINTER_SPACE);
+ HEAP->CollectGarbage(i::OLD_POINTER_SPACE);
// All object should be alive.
CHECK_EQ(0, NumberOfWeakCalls);
@@ -1960,7 +1959,7 @@
V8::AddImplicitReferences(g3s1, g3_children, 1);
}
- i::Heap::CollectGarbage(i::OLD_POINTER_SPACE);
+ HEAP->CollectGarbage(i::OLD_POINTER_SPACE);
// All objects should be gone. 7 global handles in total.
CHECK_EQ(7, NumberOfWeakCalls);
@@ -2264,8 +2263,6 @@
TEST(HugeConsStringOutOfMemory) {
// It's not possible to read a snapshot into a heap with different dimensions.
if (i::Snapshot::IsEnabled()) return;
- v8::HandleScope scope;
- LocalContext context;
// Set heap limits.
static const int K = 1024;
v8::ResourceConstraints constraints;
@@ -2276,6 +2273,9 @@
// Execute a script that causes out of memory.
v8::V8::IgnoreOutOfMemoryException();
+ v8::HandleScope scope;
+ LocalContext context;
+
// Build huge string. This should fail with out of memory exception.
Local<Value> result = CompileRun(
"var str = Array.prototype.join.call({length: 513}, \"A\").toUpperCase();"
@@ -2695,7 +2695,7 @@
if (try_catch.HasCaught()) {
CHECK_EQ(expected, count);
CHECK(result.IsEmpty());
- CHECK(!i::Top::has_scheduled_exception());
+ CHECK(!i::Isolate::Current()->has_scheduled_exception());
} else {
CHECK_NE(expected, count);
}
@@ -4387,7 +4387,7 @@
obj.Dispose();
obj.Clear();
in_scavenge = true;
- i::Heap::PerformScavenge();
+ HEAP->PerformScavenge();
in_scavenge = false;
*(reinterpret_cast<bool*>(data)) = true;
}
@@ -4424,7 +4424,7 @@
object_b.MakeWeak(&released_in_scavenge, &CheckIsNotInvokedInScavenge);
while (!object_a_disposed) {
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
}
CHECK(!released_in_scavenge);
}
@@ -4442,7 +4442,7 @@
CHECK_EQ(v8::Integer::New(3), args[2]);
CHECK_EQ(v8::Undefined(), args[3]);
v8::HandleScope scope;
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
return v8::Undefined();
}
@@ -6683,7 +6683,7 @@
v8::TryCatch try_catch;
CHECK(!o1->SetPrototype(o0));
CHECK(!try_catch.HasCaught());
- ASSERT(!i::Top::has_pending_exception());
+ ASSERT(!i::Isolate::Current()->has_pending_exception());
CHECK_EQ(42, CompileRun("function f() { return 42; }; f()")->Int32Value());
}
@@ -7065,7 +7065,7 @@
Local<String> name,
const AccessorInfo& info) {
ApiTestFuzzer::Fuzz();
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
return v8::Handle<Value>();
}
@@ -7795,7 +7795,7 @@
int* call_count = reinterpret_cast<int*>(v8::External::Unwrap(info.Data()));
++(*call_count);
if ((*call_count) % 20 == 0) {
- i::Heap::CollectAllGarbage(true);
+ HEAP->CollectAllGarbage(true);
}
return v8::Handle<Value>();
}
@@ -7833,7 +7833,7 @@
v8::Handle<v8::Value> DirectApiCallback(const v8::Arguments& args) {
static int count = 0;
if (count++ % 3 == 0) {
- i::Heap::CollectAllGarbage(true); // This should move the stub
+ HEAP-> CollectAllGarbage(true); // This should move the stub
GenerateSomeGarbage(); // This should ensure the old stub memory is flushed
}
return v8::Handle<v8::Value>();
@@ -7888,7 +7888,7 @@
v8::Handle<v8::Value> DirectGetterCallback(Local<String> name,
const v8::AccessorInfo& info) {
if (++p_getter_count % 3 == 0) {
- i::Heap::CollectAllGarbage(true);
+ HEAP->CollectAllGarbage(true);
GenerateSomeGarbage();
}
return v8::Handle<v8::Value>();
@@ -8803,7 +8803,8 @@
: RegisterThreadedTest::count();
active_tests_ = tests_being_run_ = end - start;
for (int i = 0; i < tests_being_run_; i++) {
- RegisterThreadedTest::nth(i)->fuzzer_ = new ApiTestFuzzer(i + start);
+ RegisterThreadedTest::nth(i)->fuzzer_ = new ApiTestFuzzer(
+ i::Isolate::Current(), i + start);
}
for (int i = 0; i < active_tests_; i++) {
RegisterThreadedTest::nth(i)->fuzzer_->Start();
@@ -9025,11 +9026,11 @@
// the first garbage collection but some of the maps have already
// been marked at that point. Therefore some of the maps are not
// collected until the second garbage collection.
- i::Heap::CollectAllGarbage(false);
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
int count = GetGlobalObjectsCount();
#ifdef DEBUG
- if (count != expected) i::Heap::TracePathToGlobal();
+ if (count != expected) HEAP->TracePathToGlobal();
#endif
CHECK_EQ(expected, count);
}
@@ -9095,7 +9096,7 @@
// weak callback of the first handle would be able to 'reallocate' it.
handle1.MakeWeak(NULL, NewPersistentHandleCallback);
handle2.Dispose();
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
}
@@ -9103,7 +9104,7 @@
void DisposeAndForceGcCallback(v8::Persistent<v8::Value> handle, void*) {
to_be_disposed.Dispose();
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
handle.Dispose();
}
@@ -9119,7 +9120,7 @@
}
handle1.MakeWeak(NULL, DisposeAndForceGcCallback);
to_be_disposed = handle2;
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
}
void DisposingCallback(v8::Persistent<v8::Value> handle, void*) {
@@ -9145,7 +9146,7 @@
}
handle2.MakeWeak(NULL, DisposingCallback);
handle3.MakeWeak(NULL, HandleCreatingCallback);
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
}
@@ -9391,7 +9392,32 @@
CheckProperties(elms->Get(v8::Integer::New(3)), elmc3, elmv3);
}
+THREADED_TEST(PropertyEnumeration2) {
+ v8::HandleScope scope;
+ LocalContext context;
+ v8::Handle<v8::Value> obj = v8::Script::Compile(v8::String::New(
+ "var result = [];"
+ "result[0] = {};"
+ "result[1] = {a: 1, b: 2};"
+ "result[2] = [1, 2, 3];"
+ "var proto = {x: 1, y: 2, z: 3};"
+ "var x = { __proto__: proto, w: 0, z: 1 };"
+ "result[3] = x;"
+ "result;"))->Run();
+ v8::Handle<v8::Array> elms = obj.As<v8::Array>();
+ CHECK_EQ(4, elms->Length());
+ int elmc0 = 0;
+ const char** elmv0 = NULL;
+ CheckProperties(elms->Get(v8::Integer::New(0)), elmc0, elmv0);
+ v8::Handle<v8::Value> val = elms->Get(v8::Integer::New(0));
+ v8::Handle<v8::Array> props = val.As<v8::Object>()->GetPropertyNames();
+ CHECK_EQ(0, props->Length());
+ for (uint32_t i = 0; i < props->Length(); i++) {
+ printf("p[%d]\n", i);
+ }
+}
+
static bool NamedSetAccessBlocker(Local<v8::Object> obj,
Local<Value> name,
v8::AccessType type,
@@ -9883,7 +9909,7 @@
gc_during_regexp_ = 0;
regexp_success_ = false;
gc_success_ = false;
- GCThread gc_thread(this);
+ GCThread gc_thread(i::Isolate::Current(), this);
gc_thread.Start();
v8::Locker::StartPreemption(1);
@@ -9902,8 +9928,8 @@
class GCThread : public i::Thread {
public:
- explicit GCThread(RegExpInterruptTest* test)
- : test_(test) {}
+ explicit GCThread(i::Isolate* isolate, RegExpInterruptTest* test)
+ : Thread(isolate), test_(test) {}
virtual void Run() {
test_->CollectGarbage();
}
@@ -9917,7 +9943,7 @@
{
v8::Locker lock;
// TODO(lrn): Perhaps create some garbage before collecting.
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
gc_count_++;
}
i::OS::Sleep(1);
@@ -10005,7 +10031,7 @@
gc_during_apply_ = 0;
apply_success_ = false;
gc_success_ = false;
- GCThread gc_thread(this);
+ GCThread gc_thread(i::Isolate::Current(), this);
gc_thread.Start();
v8::Locker::StartPreemption(1);
@@ -10024,8 +10050,8 @@
class GCThread : public i::Thread {
public:
- explicit GCThread(ApplyInterruptTest* test)
- : test_(test) {}
+ explicit GCThread(i::Isolate* isolate, ApplyInterruptTest* test)
+ : Thread(isolate), test_(test) {}
virtual void Run() {
test_->CollectGarbage();
}
@@ -10038,7 +10064,7 @@
while (gc_during_apply_ < kRequiredGCs) {
{
v8::Locker lock;
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
gc_count_++;
}
i::OS::Sleep(1);
@@ -10167,17 +10193,17 @@
CHECK(i::StringShape(string).IsExternal());
if (string->IsAsciiRepresentation()) {
// Check old map is not symbol or long.
- CHECK(string->map() == i::Heap::external_ascii_string_map());
+ CHECK(string->map() == HEAP->external_ascii_string_map());
// Morph external string to be TwoByte string.
- string->set_map(i::Heap::external_string_map());
+ string->set_map(HEAP->external_string_map());
i::ExternalTwoByteString* morphed =
i::ExternalTwoByteString::cast(string);
morphed->set_resource(uc16_resource);
} else {
// Check old map is not symbol or long.
- CHECK(string->map() == i::Heap::external_string_map());
+ CHECK(string->map() == HEAP->external_string_map());
// Morph external string to be ASCII string.
- string->set_map(i::Heap::external_ascii_string_map());
+ string->set_map(HEAP->external_ascii_string_map());
i::ExternalAsciiString* morphed =
i::ExternalAsciiString::cast(string);
morphed->set_resource(ascii_resource);
@@ -10201,9 +10227,9 @@
i::StrLength(c_string)));
Local<String> lhs(v8::Utils::ToLocal(
- i::Factory::NewExternalStringFromAscii(&ascii_resource)));
+ FACTORY->NewExternalStringFromAscii(&ascii_resource)));
Local<String> rhs(v8::Utils::ToLocal(
- i::Factory::NewExternalStringFromAscii(&ascii_resource)));
+ FACTORY->NewExternalStringFromAscii(&ascii_resource)));
env->Global()->Set(v8_str("lhs"), lhs);
env->Global()->Set(v8_str("rhs"), rhs);
@@ -10288,18 +10314,18 @@
// Create the input string for the regexp - the one we are going to change
// properties of.
- input_ = i::Factory::NewExternalStringFromAscii(&ascii_resource_);
+ input_ = FACTORY->NewExternalStringFromAscii(&ascii_resource_);
// Inject the input as a global variable.
i::Handle<i::String> input_name =
- i::Factory::NewStringFromAscii(i::Vector<const char>("input", 5));
- i::Top::global_context()->global()->SetProperty(
+ FACTORY->NewStringFromAscii(i::Vector<const char>("input", 5));
+ i::Isolate::Current()->global_context()->global()->SetProperty(
*input_name,
*input_,
NONE,
i::kNonStrictMode)->ToObjectChecked();
- MorphThread morph_thread(this);
+ MorphThread morph_thread(i::Isolate::Current(), this);
morph_thread.Start();
v8::Locker::StartPreemption(1);
LongRunningRegExp();
@@ -10319,8 +10345,9 @@
class MorphThread : public i::Thread {
public:
- explicit MorphThread(RegExpStringModificationTest* test)
- : test_(test) {}
+ explicit MorphThread(i::Isolate* isolate,
+ RegExpStringModificationTest* test)
+ : Thread(isolate), test_(test) {}
virtual void Run() {
test_->MorphString();
}
@@ -10753,14 +10780,14 @@
uint8_t* pixel_data = reinterpret_cast<uint8_t*>(malloc(kElementCount));
i::Handle<i::ExternalPixelArray> pixels =
i::Handle<i::ExternalPixelArray>::cast(
- i::Factory::NewExternalArray(kElementCount,
+ FACTORY->NewExternalArray(kElementCount,
v8::kExternalPixelArray,
pixel_data));
- i::Heap::CollectAllGarbage(false); // Force GC to trigger verification.
+ HEAP->CollectAllGarbage(false); // Force GC to trigger verification.
for (int i = 0; i < kElementCount; i++) {
pixels->set(i, i % 256);
}
- i::Heap::CollectAllGarbage(false); // Force GC to trigger verification.
+ HEAP->CollectAllGarbage(false); // Force GC to trigger verification.
for (int i = 0; i < kElementCount; i++) {
CHECK_EQ(i % 256, pixels->get(i));
CHECK_EQ(i % 256, pixel_data[i]);
@@ -11162,9 +11189,9 @@
uint8_t* pixel_data = reinterpret_cast<uint8_t*>(malloc(kElementCount));
i::Handle<i::ExternalPixelArray> pixels =
i::Handle<i::ExternalPixelArray>::cast(
- i::Factory::NewExternalArray(kElementCount,
- v8::kExternalPixelArray,
- pixel_data));
+ FACTORY->NewExternalArray(kElementCount,
+ v8::kExternalPixelArray,
+ pixel_data));
for (int i = 0; i < kElementCount; i++) {
pixels->set(i, i % 256);
}
@@ -11225,12 +11252,12 @@
static_cast<ElementType*>(malloc(kElementCount * element_size));
i::Handle<ExternalArrayClass> array =
i::Handle<ExternalArrayClass>::cast(
- i::Factory::NewExternalArray(kElementCount, array_type, array_data));
- i::Heap::CollectAllGarbage(false); // Force GC to trigger verification.
+ FACTORY->NewExternalArray(kElementCount, array_type, array_data));
+ HEAP->CollectAllGarbage(false); // Force GC to trigger verification.
for (int i = 0; i < kElementCount; i++) {
array->set(i, static_cast<ElementType>(i));
}
- i::Heap::CollectAllGarbage(false); // Force GC to trigger verification.
+ HEAP->CollectAllGarbage(false); // Force GC to trigger verification.
for (int i = 0; i < kElementCount; i++) {
CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(array->get(i)));
CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(array_data[i]));
@@ -11347,7 +11374,7 @@
" }"
"}"
"sum;");
- i::Heap::CollectAllGarbage(false); // Force GC to trigger verification.
+ HEAP->CollectAllGarbage(false); // Force GC to trigger verification.
CHECK_EQ(28, result->Int32Value());
// Make sure out-of-range loads do not throw.
@@ -11504,7 +11531,7 @@
static_cast<ElementType*>(malloc(kLargeElementCount * element_size));
i::Handle<ExternalArrayClass> large_array =
i::Handle<ExternalArrayClass>::cast(
- i::Factory::NewExternalArray(kLargeElementCount,
+ FACTORY->NewExternalArray(kLargeElementCount,
array_type,
array_data));
v8::Handle<v8::Object> large_obj = v8::Object::New();
@@ -11940,7 +11967,8 @@
static uint32_t* stack_limit;
static v8::Handle<Value> GetStackLimitCallback(const v8::Arguments& args) {
- stack_limit = reinterpret_cast<uint32_t*>(i::StackGuard::real_climit());
+ stack_limit = reinterpret_cast<uint32_t*>(
+ i::Isolate::Current()->stack_guard()->real_climit());
return v8::Undefined();
}
@@ -12206,7 +12234,7 @@
other_context->Enter();
CompileRun(source_simple);
other_context->Exit();
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
if (GetGlobalObjectsCount() == 1) break;
}
CHECK_GE(2, gc_count);
@@ -12228,7 +12256,7 @@
other_context->Enter();
CompileRun(source_eval);
other_context->Exit();
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
if (GetGlobalObjectsCount() == 1) break;
}
CHECK_GE(2, gc_count);
@@ -12255,7 +12283,7 @@
other_context->Enter();
CompileRun(source_exception);
other_context->Exit();
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
if (GetGlobalObjectsCount() == 1) break;
}
CHECK_GE(2, gc_count);
@@ -12473,26 +12501,26 @@
v8::V8::AddGCEpilogueCallback(EpilogueCallback);
CHECK_EQ(0, prologue_call_count);
CHECK_EQ(0, epilogue_call_count);
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
CHECK_EQ(1, prologue_call_count);
CHECK_EQ(1, epilogue_call_count);
v8::V8::AddGCPrologueCallback(PrologueCallbackSecond);
v8::V8::AddGCEpilogueCallback(EpilogueCallbackSecond);
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
CHECK_EQ(2, prologue_call_count);
CHECK_EQ(2, epilogue_call_count);
CHECK_EQ(1, prologue_call_count_second);
CHECK_EQ(1, epilogue_call_count_second);
v8::V8::RemoveGCPrologueCallback(PrologueCallback);
v8::V8::RemoveGCEpilogueCallback(EpilogueCallback);
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
CHECK_EQ(2, prologue_call_count);
CHECK_EQ(2, epilogue_call_count);
CHECK_EQ(2, prologue_call_count_second);
CHECK_EQ(2, epilogue_call_count_second);
v8::V8::RemoveGCPrologueCallback(PrologueCallbackSecond);
v8::V8::RemoveGCEpilogueCallback(EpilogueCallbackSecond);
- i::Heap::CollectAllGarbage(false);
+ HEAP->CollectAllGarbage(false);
CHECK_EQ(2, prologue_call_count);
CHECK_EQ(2, epilogue_call_count);
CHECK_EQ(2, prologue_call_count_second);
@@ -12520,7 +12548,7 @@
" return 'Different results for ' + key1 + ': ' + r1 + ' vs. ' + r1_;"
" return 'PASSED';"
"})()";
- i::Heap::ClearJSFunctionResultCaches();
+ HEAP->ClearJSFunctionResultCaches();
ExpectString(code, "PASSED");
}
@@ -12544,7 +12572,7 @@
" return 'FAILED: k0CacheSize is too small';"
" return 'PASSED';"
"})()";
- i::Heap::ClearJSFunctionResultCaches();
+ HEAP->ClearJSFunctionResultCaches();
ExpectString(code, "PASSED");
}
@@ -12569,7 +12597,7 @@
" };"
" return 'PASSED';"
"})()";
- i::Heap::ClearJSFunctionResultCaches();
+ HEAP->ClearJSFunctionResultCaches();
ExpectString(code, "PASSED");
}
@@ -12594,7 +12622,7 @@
" };"
" return 'PASSED';"
"})()";
- i::Heap::ClearJSFunctionResultCaches();
+ HEAP->ClearJSFunctionResultCaches();
ExpectString(code, "PASSED");
}
@@ -12612,7 +12640,7 @@
" };"
" return 'PASSED';"
"})()";
- i::Heap::ClearJSFunctionResultCaches();
+ HEAP->ClearJSFunctionResultCaches();
ExpectString(code, "PASSED");
}
@@ -12702,7 +12730,7 @@
void FailedAccessCheckCallbackGC(Local<v8::Object> target,
v8::AccessType type,
Local<v8::Value> data) {
- i::Heap::CollectAllGarbage(true);
+ HEAP->CollectAllGarbage(true);
}
@@ -12783,7 +12811,344 @@
v8::V8::SetFailedAccessCheckCallbackFunction(NULL);
}
+TEST(DefaultIsolateGetCurrent) {
+ CHECK(v8::Isolate::GetCurrent() != NULL);
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ CHECK(reinterpret_cast<i::Isolate*>(isolate)->IsDefaultIsolate());
+ printf("*** %s\n", "DefaultIsolateGetCurrent success");
+}
+TEST(IsolateNewDispose) {
+ v8::Isolate* current_isolate = v8::Isolate::GetCurrent();
+ v8::Isolate* isolate = v8::Isolate::New();
+ CHECK(isolate != NULL);
+ CHECK(!reinterpret_cast<i::Isolate*>(isolate)->IsDefaultIsolate());
+ CHECK(current_isolate != isolate);
+ CHECK(current_isolate == v8::Isolate::GetCurrent());
+
+ v8::V8::SetFatalErrorHandler(StoringErrorCallback);
+ last_location = last_message = NULL;
+ isolate->Dispose();
+ CHECK_EQ(last_location, NULL);
+ CHECK_EQ(last_message, NULL);
+}
+
+TEST(IsolateEnterExitDefault) {
+ v8::HandleScope scope;
+ LocalContext context;
+ v8::Isolate* current_isolate = v8::Isolate::GetCurrent();
+ CHECK(current_isolate != NULL); // Default isolate.
+ ExpectString("'hello'", "hello");
+ current_isolate->Enter();
+ ExpectString("'still working'", "still working");
+ current_isolate->Exit();
+ ExpectString("'still working 2'", "still working 2");
+ current_isolate->Exit();
+ // Default isolate is always, well, 'default current'.
+ CHECK_EQ(v8::Isolate::GetCurrent(), current_isolate);
+ // Still working since default isolate is auto-entering any thread
+ // that has no isolate and attempts to execute V8 APIs.
+ ExpectString("'still working 3'", "still working 3");
+}
+
+TEST(DisposeDefaultIsolate) {
+ v8::V8::SetFatalErrorHandler(StoringErrorCallback);
+
+ // Run some V8 code to trigger default isolate to become 'current'.
+ v8::HandleScope scope;
+ LocalContext context;
+ ExpectString("'run some V8'", "run some V8");
+
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ CHECK(reinterpret_cast<i::Isolate*>(isolate)->IsDefaultIsolate());
+ last_location = last_message = NULL;
+ isolate->Dispose();
+ // It is not possible to dispose default isolate via Isolate API.
+ CHECK_NE(last_location, NULL);
+ CHECK_NE(last_message, NULL);
+}
+
+TEST(RunDefaultAndAnotherIsolate) {
+ v8::HandleScope scope;
+ LocalContext context;
+
+ // Enter new isolate.
+ v8::Isolate* isolate = v8::Isolate::New();
+ CHECK(isolate);
+ isolate->Enter();
+ { // Need this block because subsequent Exit() will deallocate Heap,
+ // so we need all scope objects to be deconstructed when it happens.
+ v8::HandleScope scope_new;
+ LocalContext context_new;
+
+ // Run something in new isolate.
+ CompileRun("var foo = 153;");
+ ExpectTrue("function f() { return foo == 153; }; f()");
+ }
+ isolate->Exit();
+
+ // This runs automatically in default isolate.
+ // Variables in another isolate should be not available.
+ ExpectTrue("function f() {"
+ " try {"
+ " foo;"
+ " return false;"
+ " } catch(e) {"
+ " return true;"
+ " }"
+ "};"
+ "var bar = 371;"
+ "f()");
+
+ v8::V8::SetFatalErrorHandler(StoringErrorCallback);
+ last_location = last_message = NULL;
+ isolate->Dispose();
+ CHECK_EQ(last_location, NULL);
+ CHECK_EQ(last_message, NULL);
+
+ // Check that default isolate still runs.
+ ExpectTrue("function f() { return bar == 371; }; f()");
+}
+
+TEST(DisposeIsolateWhenInUse) {
+ v8::Isolate* isolate = v8::Isolate::New();
+ CHECK(isolate);
+ isolate->Enter();
+ v8::HandleScope scope;
+ LocalContext context;
+ // Run something in this isolate.
+ ExpectTrue("true");
+ v8::V8::SetFatalErrorHandler(StoringErrorCallback);
+ last_location = last_message = NULL;
+ // Still entered, should fail.
+ isolate->Dispose();
+ CHECK_NE(last_location, NULL);
+ CHECK_NE(last_message, NULL);
+}
+
+TEST(RunTwoIsolatesOnSingleThread) {
+ // Run isolate 1.
+ v8::Isolate* isolate1 = v8::Isolate::New();
+ isolate1->Enter();
+ v8::Persistent<v8::Context> context1 = v8::Context::New();
+
+ {
+ v8::Context::Scope cscope(context1);
+ v8::HandleScope scope;
+ // Run something in new isolate.
+ CompileRun("var foo = 'isolate 1';");
+ ExpectString("function f() { return foo; }; f()", "isolate 1");
+ }
+
+ // Run isolate 2.
+ v8::Isolate* isolate2 = v8::Isolate::New();
+ v8::Persistent<v8::Context> context2;
+
+ {
+ v8::Isolate::Scope iscope(isolate2);
+ context2 = v8::Context::New();
+ v8::Context::Scope cscope(context2);
+ v8::HandleScope scope;
+
+ // Run something in new isolate.
+ CompileRun("var foo = 'isolate 2';");
+ ExpectString("function f() { return foo; }; f()", "isolate 2");
+ }
+
+ {
+ v8::Context::Scope cscope(context1);
+ v8::HandleScope scope;
+ // Now again in isolate 1
+ ExpectString("function f() { return foo; }; f()", "isolate 1");
+ }
+
+ isolate1->Exit();
+
+ // Run some stuff in default isolate.
+ v8::Persistent<v8::Context> context_default = v8::Context::New();
+
+ {
+ v8::Context::Scope cscope(context_default);
+ v8::HandleScope scope;
+ // Variables in other isolates should be not available, verify there
+ // is an exception.
+ ExpectTrue("function f() {"
+ " try {"
+ " foo;"
+ " return false;"
+ " } catch(e) {"
+ " return true;"
+ " }"
+ "};"
+ "var isDefaultIsolate = true;"
+ "f()");
+ }
+
+ isolate1->Enter();
+
+ {
+ v8::Isolate::Scope iscope(isolate2);
+ v8::Context::Scope cscope(context2);
+ v8::HandleScope scope;
+ ExpectString("function f() { return foo; }; f()", "isolate 2");
+ }
+
+ {
+ v8::Context::Scope cscope(context1);
+ v8::HandleScope scope;
+ ExpectString("function f() { return foo; }; f()", "isolate 1");
+ }
+
+ {
+ v8::Isolate::Scope iscope(isolate2);
+ context2.Dispose();
+ }
+
+ context1.Dispose();
+ isolate1->Exit();
+
+ v8::V8::SetFatalErrorHandler(StoringErrorCallback);
+ last_location = last_message = NULL;
+
+ isolate1->Dispose();
+ CHECK_EQ(last_location, NULL);
+ CHECK_EQ(last_message, NULL);
+
+ isolate2->Dispose();
+ CHECK_EQ(last_location, NULL);
+ CHECK_EQ(last_message, NULL);
+
+ // Check that default isolate still runs.
+ {
+ v8::Context::Scope cscope(context_default);
+ v8::HandleScope scope;
+ ExpectTrue("function f() { return isDefaultIsolate; }; f()");
+ }
+}
+
+static int CalcFibonacci(v8::Isolate* isolate, int limit) {
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::HandleScope scope;
+ LocalContext context;
+ i::ScopedVector<char> code(1024);
+ i::OS::SNPrintF(code, "function fib(n) {"
+ " if (n <= 2) return 1;"
+ " return fib(n-1) + fib(n-2);"
+ "}"
+ "fib(%d)", limit);
+ Local<Value> value = CompileRun(code.start());
+ CHECK(value->IsNumber());
+ return static_cast<int>(value->NumberValue());
+}
+
+class IsolateThread : public v8::internal::Thread {
+ public:
+ explicit IsolateThread(v8::Isolate* isolate, int fib_limit)
+ : Thread(NULL),
+ isolate_(isolate),
+ fib_limit_(fib_limit),
+ result_(0) { }
+
+ void Run() {
+ result_ = CalcFibonacci(isolate_, fib_limit_);
+ }
+
+ int result() { return result_; }
+
+ private:
+ v8::Isolate* isolate_;
+ int fib_limit_;
+ int result_;
+};
+
+TEST(MultipleIsolatesOnIndividualThreads) {
+ v8::Isolate* isolate1 = v8::Isolate::New();
+ v8::Isolate* isolate2 = v8::Isolate::New();
+
+ IsolateThread thread1(isolate1, 21);
+ IsolateThread thread2(isolate2, 12);
+
+ // Compute some fibonacci numbers on 3 threads in 3 isolates.
+ thread1.Start();
+ thread2.Start();
+
+ int result1 = CalcFibonacci(v8::Isolate::GetCurrent(), 21);
+ int result2 = CalcFibonacci(v8::Isolate::GetCurrent(), 12);
+
+ thread1.Join();
+ thread2.Join();
+
+ // Compare results. The actual fibonacci numbers for 12 and 21 are taken
+ // (I'm lazy!) from http://en.wikipedia.org/wiki/Fibonacci_number
+ CHECK_EQ(result1, 10946);
+ CHECK_EQ(result2, 144);
+ CHECK_EQ(result1, thread1.result());
+ CHECK_EQ(result2, thread2.result());
+
+ isolate1->Dispose();
+ isolate2->Dispose();
+}
+
+
+class InitDefaultIsolateThread : public v8::internal::Thread {
+ public:
+ enum TestCase { IgnoreOOM, SetResourceConstraints, SetFatalHandler };
+
+ explicit InitDefaultIsolateThread(TestCase testCase)
+ : Thread(NULL),
+ testCase_(testCase),
+ result_(false) { }
+
+ void Run() {
+ switch (testCase_) {
+ case IgnoreOOM:
+ v8::V8::IgnoreOutOfMemoryException();
+ break;
+
+ case SetResourceConstraints: {
+ static const int K = 1024;
+ v8::ResourceConstraints constraints;
+ constraints.set_max_young_space_size(256 * K);
+ constraints.set_max_old_space_size(4 * K * K);
+ v8::SetResourceConstraints(&constraints);
+ break;
+ }
+
+ case SetFatalHandler:
+ v8::V8::SetFatalErrorHandler(NULL);
+ break;
+ }
+ result_ = true;
+ }
+
+ bool result() { return result_; }
+
+ private:
+ TestCase testCase_;
+ bool result_;
+};
+
+
+static void InitializeTestHelper(InitDefaultIsolateThread::TestCase testCase) {
+ InitDefaultIsolateThread thread(testCase);
+ thread.Start();
+ thread.Join();
+ CHECK_EQ(thread.result(), true);
+}
+
+TEST(InitializeDefaultIsolateOnSecondaryThread1) {
+ InitializeTestHelper(InitDefaultIsolateThread::IgnoreOOM);
+}
+
+TEST(InitializeDefaultIsolateOnSecondaryThread2) {
+ InitializeTestHelper(InitDefaultIsolateThread::SetResourceConstraints);
+}
+
+TEST(InitializeDefaultIsolateOnSecondaryThread3) {
+ InitializeTestHelper(InitDefaultIsolateThread::SetFatalHandler);
+}
+
+
TEST(StringCheckMultipleContexts) {
const char* code =
"(function() { return \"a\".charAt(0); })()";
@@ -12886,7 +13251,7 @@
"})()",
"ReferenceError: cell is not defined");
CompileRun("cell = \"new_second\";");
- i::Heap::CollectAllGarbage(true);
+ HEAP->CollectAllGarbage(true);
ExpectString("readCell()", "new_second");
ExpectString("readCell()", "new_second");
}
« no previous file with comments | « test/cctest/test-alloc.cc ('k') | test/cctest/test-assembler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698