From: dcarney@chromium.org Date: Tue, 28 May 2013 11:54:52 +0000 (+0000) Subject: remove most V8_ALLOW_ACCESS_TO_* defines from test classes X-Git-Tag: upstream/4.7.83~14092 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ff2a76b5d572930eef0f2798d0c6f5781603ba24;p=platform%2Fupstream%2Fv8.git remove most V8_ALLOW_ACCESS_TO_* defines from test classes R=svenpanne@chromium.org BUG= Review URL: https://codereview.chromium.org/15964004 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14849 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/include/v8.h b/include/v8.h index 9f6190a4c..51040fe1a 100644 --- a/include/v8.h +++ b/include/v8.h @@ -563,6 +563,7 @@ template class Persistent // NOLINT #endif +#ifdef V8_USE_UNSAFE_HANDLES template V8_INLINE(static Persistent Cast(Persistent that)) { #ifdef V8_ENABLE_CHECKS // If we're going to perform the type check then we have to check @@ -576,6 +577,22 @@ template class Persistent // NOLINT return Persistent::Cast(*this); } +#else + template + V8_INLINE(static Persistent& Cast(Persistent& that)) { // NOLINT +#ifdef V8_ENABLE_CHECKS + // If we're going to perform the type check then we have to check + // that the handle isn't empty before doing the checked cast. + if (!that.IsEmpty()) T::Cast(*that); +#endif + return reinterpret_cast&>(that); + } + + template V8_INLINE(Persistent& As()) { // NOLINT + return Persistent::Cast(*this); + } +#endif + V8_DEPRECATED(static Persistent New(Handle that)); /** diff --git a/test/cctest/cctest.cc b/test/cctest/cctest.cc index 5507ac6f3..b241f32a0 100644 --- a/test/cctest/cctest.cc +++ b/test/cctest/cctest.cc @@ -25,9 +25,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT -#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW - #include #include "cctest.h" #include "debug.h" @@ -70,14 +67,19 @@ void CcTest::InitializeVM(CcTestExtensionFlags extensions) { if (extensions.Contains(Name##_ID)) extension_names[extension_count++] = Id; EXTENSION_LIST(CHECK_EXTENSION_FLAG) #undef CHECK_EXTENSION_FLAG + v8::Isolate* isolate = default_isolate(); if (context_.IsEmpty()) { - v8::Isolate* isolate = default_isolate(); v8::HandleScope scope(isolate); v8::ExtensionConfiguration config(extension_count, extension_names); v8::Local context = v8::Context::New(isolate, &config); - context_ = v8::Persistent::New(isolate, context); + context_.Reset(isolate, context); + } + { + v8::HandleScope scope(isolate); + v8::Local context = + v8::Local::New(isolate, context_); + context->Enter(); } - context_->Enter(); } diff --git a/test/cctest/test-assembler-arm.cc b/test/cctest/test-assembler-arm.cc index 9acb90ab2..61eaa98e3 100644 --- a/test/cctest/test-assembler-arm.cc +++ b/test/cctest/test-assembler-arm.cc @@ -25,10 +25,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT -#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW - #include "v8.h" #include "disassembler.h" diff --git a/test/cctest/test-assembler-ia32.cc b/test/cctest/test-assembler-ia32.cc index 7c8e70cdb..8d39ee73f 100644 --- a/test/cctest/test-assembler-ia32.cc +++ b/test/cctest/test-assembler-ia32.cc @@ -27,10 +27,6 @@ #include -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT -#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW - #include "v8.h" #include "disassembler.h" diff --git a/test/cctest/test-assembler-x64.cc b/test/cctest/test-assembler-x64.cc index a989fbbd4..669475ad8 100644 --- a/test/cctest/test-assembler-x64.cc +++ b/test/cctest/test-assembler-x64.cc @@ -27,10 +27,6 @@ #include -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT -#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW - #include "v8.h" #include "macro-assembler.h" diff --git a/test/cctest/test-compiler.cc b/test/cctest/test-compiler.cc index cff0f8241..f20043548 100644 --- a/test/cctest/test-compiler.cc +++ b/test/cctest/test-compiler.cc @@ -28,10 +28,6 @@ #include #include -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT - #include "v8.h" #include "compiler.h" diff --git a/test/cctest/test-cpu-profiler.cc b/test/cctest/test-cpu-profiler.cc index 3eebf96a6..2234e1188 100644 --- a/test/cctest/test-cpu-profiler.cc +++ b/test/cctest/test-cpu-profiler.cc @@ -27,10 +27,6 @@ // // Tests of profiles generator and utilities. -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT - #define V8_DISABLE_DEPRECATIONS 1 #include "v8.h" #include "cpu-profiler-inl.h" diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc index c4df73ebb..d802a85aa 100644 --- a/test/cctest/test-debug.cc +++ b/test/cctest/test-debug.cc @@ -29,10 +29,6 @@ #include -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT - #include "v8.h" #include "api.h" @@ -6626,7 +6622,15 @@ TEST(ScriptCollectedEventContext) { v8::HandleScope scope(isolate); context.Reset(isolate, v8::Context::New(isolate)); } - context->Enter(); + + // Enter context. We can't have a handle to the context in the outer + // scope, so we have to do it the hard way. + { + v8::HandleScope scope(isolate); + v8::Local local_context = + v8::Local::New(isolate, context); + local_context->Enter(); + } // Request the loaded scripts to initialize the debugger script cache. debug->GetLoadedScripts(); @@ -6639,7 +6643,13 @@ TEST(ScriptCollectedEventContext) { v8::Script::Compile(v8::String::New("eval('a=1')"))->Run(); v8::Script::Compile(v8::String::New("eval('a=2')"))->Run(); - context->Exit(); + // Leave context + { + v8::HandleScope scope(isolate); + v8::Local local_context = + v8::Local::New(isolate, context); + local_context->Exit(); + } context.Dispose(isolate); // Do garbage collection to collect the script above which is no longer diff --git a/test/cctest/test-declarative-accessors.cc b/test/cctest/test-declarative-accessors.cc index b09a29d1e..a14c7fae2 100644 --- a/test/cctest/test-declarative-accessors.cc +++ b/test/cctest/test-declarative-accessors.cc @@ -27,9 +27,6 @@ #include -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT - #include "v8.h" #include "cctest.h" @@ -298,7 +295,6 @@ TEST(HandleDereferenceRead) { ->NewHandleDereference(helper.isolate_); HandleArray* array = *helper.handle_array_; v8::Handle expected = v8_str("whatever"); - array->handles_[index] = v8::Persistent::New(helper.isolate_, - expected); + array->handles_[index].Reset(helper.isolate_, expected); VerifyRead(descriptor, internal_field, array, expected); } diff --git a/test/cctest/test-decls.cc b/test/cctest/test-decls.cc index 6be5303cd..de45cbcdb 100644 --- a/test/cctest/test-decls.cc +++ b/test/cctest/test-decls.cc @@ -27,11 +27,6 @@ #include -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW -#define V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT - #include "v8.h" #include "heap.h" @@ -57,8 +52,11 @@ class DeclarationContext { virtual ~DeclarationContext() { if (is_initialized_) { - context_->Exit(); - context_.Dispose(context_->GetIsolate()); + Isolate* isolate = Isolate::GetCurrent(); + HandleScope scope(isolate); + Local context = Local::New(isolate, context_); + context->Exit(); + context_.Dispose(isolate); } } @@ -127,14 +125,14 @@ void DeclarationContext::InitializeIfNeeded() { &HandleQuery, 0, 0, data); - context_.Reset(isolate, - Context::New(isolate, - 0, - function->InstanceTemplate(), - Local())); - context_->Enter(); + Local context = Context::New(isolate, + 0, + function->InstanceTemplate(), + Local()); + context_.Reset(isolate, context); + context->Enter(); is_initialized_ = true; - PostInitializeContext(Local::New(isolate, context_)); + PostInitializeContext(context); } diff --git a/test/cctest/test-disasm-arm.cc b/test/cctest/test-disasm-arm.cc index 84f0d8630..85b472d30 100644 --- a/test/cctest/test-disasm-arm.cc +++ b/test/cctest/test-disasm-arm.cc @@ -28,10 +28,6 @@ #include -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT -#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW - #include "v8.h" #include "debug.h" diff --git a/test/cctest/test-disasm-ia32.cc b/test/cctest/test-disasm-ia32.cc index f81b173e1..ca81a5a4f 100644 --- a/test/cctest/test-disasm-ia32.cc +++ b/test/cctest/test-disasm-ia32.cc @@ -27,10 +27,6 @@ #include -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT -#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW - #include "v8.h" #include "debug.h" diff --git a/test/cctest/test-func-name-inference.cc b/test/cctest/test-func-name-inference.cc index 5ebc679c1..a86dfd28a 100644 --- a/test/cctest/test-func-name-inference.cc +++ b/test/cctest/test-func-name-inference.cc @@ -26,11 +26,6 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW -#define V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT - #include "v8.h" #include "api.h" diff --git a/test/cctest/test-hashing.cc b/test/cctest/test-hashing.cc index 154761313..4906296ba 100644 --- a/test/cctest/test-hashing.cc +++ b/test/cctest/test-hashing.cc @@ -27,9 +27,6 @@ #include -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT - #include "v8.h" #include "factory.h" diff --git a/test/cctest/test-heap-profiler.cc b/test/cctest/test-heap-profiler.cc index 9b53879b2..254cd1e49 100644 --- a/test/cctest/test-heap-profiler.cc +++ b/test/cctest/test-heap-profiler.cc @@ -29,9 +29,6 @@ #include -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT - #include "v8.h" #include "cctest.h" @@ -1137,14 +1134,11 @@ TEST(HeapSnapshotRetainedObjectInfo) { 1, TestRetainedObjectInfo::WrapperInfoCallback); heap_profiler->SetWrapperClassInfoProvider( 2, TestRetainedObjectInfo::WrapperInfoCallback); - v8::Persistent p_AAA = - v8::Persistent::New(isolate, v8_str("AAA")); + v8::Persistent p_AAA(isolate, v8_str("AAA")); p_AAA.SetWrapperClassId(isolate, 1); - v8::Persistent p_BBB = - v8::Persistent::New(isolate, v8_str("BBB")); + v8::Persistent p_BBB(isolate, v8_str("BBB")); p_BBB.SetWrapperClassId(isolate, 1); - v8::Persistent p_CCC = - v8::Persistent::New(isolate, v8_str("CCC")); + v8::Persistent p_CCC(isolate, v8_str("CCC")); p_CCC.SetWrapperClassId(isolate, 2); CHECK_EQ(0, TestRetainedObjectInfo::instances.length()); const v8::HeapSnapshot* snapshot = @@ -1196,8 +1190,7 @@ class GraphWithImplicitRefs { instance_ = this; isolate_ = (*env)->GetIsolate(); for (int i = 0; i < kObjectsCount; i++) { - objects_[i] = - v8::Persistent::New(isolate_, v8::Object::New()); + objects_[i].Reset(isolate_, v8::Object::New()); } (*env)->Global()->Set(v8_str("root_object"), v8::Local::New(isolate_, objects_[0])); @@ -1213,15 +1206,15 @@ class GraphWithImplicitRefs { private: void AddImplicitReferences() { // 0 -> 1 - isolate_->SetObjectGroupId(v8::Persistent::Cast(objects_[0]), + isolate_->SetObjectGroupId(objects_[0], v8::UniqueId(1)); isolate_->SetReferenceFromGroup( - v8::UniqueId(1), v8::Persistent::Cast(objects_[1])); + v8::UniqueId(1), objects_[1]); // Adding two more references: 1 -> 2, 1 -> 3 - isolate_->SetReference(v8::Persistent::Cast(objects_[1]), - v8::Persistent::Cast(objects_[2])); - isolate_->SetReference(v8::Persistent::Cast(objects_[1]), - v8::Persistent::Cast(objects_[3])); + isolate_->SetReference(objects_[1].As(), + objects_[2]); + isolate_->SetReference(objects_[1].As(), + objects_[3]); } v8::Persistent objects_[kObjectsCount]; @@ -1611,8 +1604,7 @@ TEST(WeakGlobalHandle) { CHECK(!HasWeakGlobalHandle()); - v8::Persistent handle = - v8::Persistent::New(env->GetIsolate(), v8::Object::New()); + v8::Persistent handle(env->GetIsolate(), v8::Object::New()); handle.MakeWeak(env->GetIsolate(), NULL, PersistentHandleCallback); diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc index 8967ff594..1122fa98c 100644 --- a/test/cctest/test-heap.cc +++ b/test/cctest/test-heap.cc @@ -27,10 +27,6 @@ #include -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT - #include "v8.h" #include "compilation-cache.h" @@ -1663,21 +1659,23 @@ TEST(LeakNativeContextViaMap) { i::FLAG_allow_natives_syntax = true; v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::HandleScope outer_scope(isolate); - v8::Persistent ctx1; - v8::Persistent ctx2; + v8::Persistent ctx1p; + v8::Persistent ctx2p; { v8::HandleScope scope(isolate); - ctx1.Reset(isolate, v8::Context::New(isolate)); - ctx2.Reset(isolate, v8::Context::New(isolate)); + ctx1p.Reset(isolate, v8::Context::New(isolate)); + ctx2p.Reset(isolate, v8::Context::New(isolate)); + v8::Local::New(isolate, ctx1p)->Enter(); } - ctx1->Enter(); HEAP->CollectAllAvailableGarbage(); CHECK_EQ(4, NumberOfGlobalObjects()); { - v8::HandleScope inner_scope(v8::Isolate::GetCurrent()); + v8::HandleScope inner_scope(isolate); CompileRun("var v = {x: 42}"); + v8::Local ctx1 = v8::Local::New(isolate, ctx1p); + v8::Local ctx2 = v8::Local::New(isolate, ctx2p); v8::Local v = ctx1->Global()->Get(v8_str("v")); ctx2->Enter(); ctx2->Global()->Set(v8_str("o"), v); @@ -1689,13 +1687,13 @@ TEST(LeakNativeContextViaMap) { CHECK_EQ(42, res->Int32Value()); ctx2->Global()->Set(v8_str("o"), v8::Int32::New(0)); ctx2->Exit(); - ctx1->Exit(); - ctx1.Dispose(ctx1->GetIsolate()); + v8::Local::New(isolate, ctx1)->Exit(); + ctx1p.Dispose(isolate); v8::V8::ContextDisposedNotification(); } HEAP->CollectAllAvailableGarbage(); CHECK_EQ(2, NumberOfGlobalObjects()); - ctx2.Dispose(ctx2->GetIsolate()); + ctx2p.Dispose(isolate); HEAP->CollectAllAvailableGarbage(); CHECK_EQ(0, NumberOfGlobalObjects()); } @@ -1707,21 +1705,23 @@ TEST(LeakNativeContextViaFunction) { i::FLAG_allow_natives_syntax = true; v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::HandleScope outer_scope(isolate); - v8::Persistent ctx1; - v8::Persistent ctx2; + v8::Persistent ctx1p; + v8::Persistent ctx2p; { v8::HandleScope scope(isolate); - ctx1.Reset(isolate, v8::Context::New(isolate)); - ctx2.Reset(isolate, v8::Context::New(isolate)); + ctx1p.Reset(isolate, v8::Context::New(isolate)); + ctx2p.Reset(isolate, v8::Context::New(isolate)); + v8::Local::New(isolate, ctx1p)->Enter(); } - ctx1->Enter(); HEAP->CollectAllAvailableGarbage(); CHECK_EQ(4, NumberOfGlobalObjects()); { - v8::HandleScope inner_scope(v8::Isolate::GetCurrent()); + v8::HandleScope inner_scope(isolate); CompileRun("var v = function() { return 42; }"); + v8::Local ctx1 = v8::Local::New(isolate, ctx1p); + v8::Local ctx2 = v8::Local::New(isolate, ctx2p); v8::Local v = ctx1->Global()->Get(v8_str("v")); ctx2->Enter(); ctx2->Global()->Set(v8_str("o"), v); @@ -1734,12 +1734,12 @@ TEST(LeakNativeContextViaFunction) { ctx2->Global()->Set(v8_str("o"), v8::Int32::New(0)); ctx2->Exit(); ctx1->Exit(); - ctx1.Dispose(ctx1->GetIsolate()); + ctx1p.Dispose(ctx1->GetIsolate()); v8::V8::ContextDisposedNotification(); } HEAP->CollectAllAvailableGarbage(); CHECK_EQ(2, NumberOfGlobalObjects()); - ctx2.Dispose(ctx2->GetIsolate()); + ctx2p.Dispose(isolate); HEAP->CollectAllAvailableGarbage(); CHECK_EQ(0, NumberOfGlobalObjects()); } @@ -1749,21 +1749,23 @@ TEST(LeakNativeContextViaMapKeyed) { i::FLAG_allow_natives_syntax = true; v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::HandleScope outer_scope(isolate); - v8::Persistent ctx1; - v8::Persistent ctx2; + v8::Persistent ctx1p; + v8::Persistent ctx2p; { v8::HandleScope scope(isolate); - ctx1.Reset(isolate, v8::Context::New(isolate)); - ctx2.Reset(isolate, v8::Context::New(isolate)); + ctx1p.Reset(isolate, v8::Context::New(isolate)); + ctx2p.Reset(isolate, v8::Context::New(isolate)); + v8::Local::New(isolate, ctx1p)->Enter(); } - ctx1->Enter(); HEAP->CollectAllAvailableGarbage(); CHECK_EQ(4, NumberOfGlobalObjects()); { - v8::HandleScope inner_scope(v8::Isolate::GetCurrent()); + v8::HandleScope inner_scope(isolate); CompileRun("var v = [42, 43]"); + v8::Local ctx1 = v8::Local::New(isolate, ctx1p); + v8::Local ctx2 = v8::Local::New(isolate, ctx2p); v8::Local v = ctx1->Global()->Get(v8_str("v")); ctx2->Enter(); ctx2->Global()->Set(v8_str("o"), v); @@ -1776,12 +1778,12 @@ TEST(LeakNativeContextViaMapKeyed) { ctx2->Global()->Set(v8_str("o"), v8::Int32::New(0)); ctx2->Exit(); ctx1->Exit(); - ctx1.Dispose(ctx1->GetIsolate()); + ctx1p.Dispose(ctx1->GetIsolate()); v8::V8::ContextDisposedNotification(); } HEAP->CollectAllAvailableGarbage(); CHECK_EQ(2, NumberOfGlobalObjects()); - ctx2.Dispose(ctx2->GetIsolate()); + ctx2p.Dispose(isolate); HEAP->CollectAllAvailableGarbage(); CHECK_EQ(0, NumberOfGlobalObjects()); } @@ -1791,21 +1793,23 @@ TEST(LeakNativeContextViaMapProto) { i::FLAG_allow_natives_syntax = true; v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::HandleScope outer_scope(isolate); - v8::Persistent ctx1; - v8::Persistent ctx2; + v8::Persistent ctx1p; + v8::Persistent ctx2p; { v8::HandleScope scope(isolate); - ctx1.Reset(isolate, v8::Context::New(isolate)); - ctx2.Reset(isolate, v8::Context::New(isolate)); + ctx1p.Reset(isolate, v8::Context::New(isolate)); + ctx2p.Reset(isolate, v8::Context::New(isolate)); + v8::Local::New(isolate, ctx1p)->Enter(); } - ctx1->Enter(); HEAP->CollectAllAvailableGarbage(); CHECK_EQ(4, NumberOfGlobalObjects()); { - v8::HandleScope inner_scope(v8::Isolate::GetCurrent()); + v8::HandleScope inner_scope(isolate); CompileRun("var v = { y: 42}"); + v8::Local ctx1 = v8::Local::New(isolate, ctx1p); + v8::Local ctx2 = v8::Local::New(isolate, ctx2p); v8::Local v = ctx1->Global()->Get(v8_str("v")); ctx2->Enter(); ctx2->Global()->Set(v8_str("o"), v); @@ -1822,12 +1826,12 @@ TEST(LeakNativeContextViaMapProto) { ctx2->Global()->Set(v8_str("o"), v8::Int32::New(0)); ctx2->Exit(); ctx1->Exit(); - ctx1.Dispose(ctx1->GetIsolate()); + ctx1p.Dispose(isolate); v8::V8::ContextDisposedNotification(); } HEAP->CollectAllAvailableGarbage(); CHECK_EQ(2, NumberOfGlobalObjects()); - ctx2.Dispose(ctx2->GetIsolate()); + ctx2p.Dispose(isolate); HEAP->CollectAllAvailableGarbage(); CHECK_EQ(0, NumberOfGlobalObjects()); } diff --git a/test/cctest/test-lockers.cc b/test/cctest/test-lockers.cc index fbff717cd..9d2453595 100644 --- a/test/cctest/test-lockers.cc +++ b/test/cctest/test-lockers.cc @@ -27,9 +27,6 @@ #include -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT - #include "v8.h" #include "api.h" diff --git a/test/cctest/test-log-stack-tracer.cc b/test/cctest/test-log-stack-tracer.cc index 3c34ede8b..ca6c7aea4 100644 --- a/test/cctest/test-log-stack-tracer.cc +++ b/test/cctest/test-log-stack-tracer.cc @@ -29,10 +29,6 @@ #include -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT -#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW - #include "v8.h" #include "api.h" diff --git a/test/cctest/test-log.cc b/test/cctest/test-log.cc index 3288fc8a6..d2ef02d6b 100644 --- a/test/cctest/test-log.cc +++ b/test/cctest/test-log.cc @@ -34,11 +34,6 @@ #include #endif // __linux__ -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW -#define V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT - #include "v8.h" #include "log.h" #include "cpu-profiler.h" @@ -405,9 +400,9 @@ TEST(LogCallbacks) { ScopedLoggerInitializer initialize_logger(false); Logger* logger = initialize_logger.logger(); - v8::Persistent obj = - v8::Persistent::New(v8::Isolate::GetCurrent(), - v8::FunctionTemplate::New()); + v8::Local obj = + v8::Local::New(v8::Isolate::GetCurrent(), + v8::FunctionTemplate::New()); obj->SetClassName(v8_str("Obj")); v8::Handle proto = obj->PrototypeTemplate(); v8::Local signature = @@ -434,8 +429,6 @@ TEST(LogCallbacks) { ObjMethod1); CHECK_NE(NULL, StrNStr(log.start(), ref_data.start(), log.length())); - - obj.Dispose(v8::Isolate::GetCurrent()); } @@ -458,9 +451,9 @@ TEST(LogAccessorCallbacks) { ScopedLoggerInitializer initialize_logger(false); Logger* logger = initialize_logger.logger(); - v8::Persistent obj = - v8::Persistent::New(v8::Isolate::GetCurrent(), - v8::FunctionTemplate::New()); + v8::Local obj = + v8::Local::New(v8::Isolate::GetCurrent(), + v8::FunctionTemplate::New()); obj->SetClassName(v8_str("Obj")); v8::Handle inst = obj->InstanceTemplate(); inst->SetAccessor(v8_str("prop1"), Prop1Getter, Prop1Setter); @@ -493,8 +486,6 @@ TEST(LogAccessorCallbacks) { Prop2Getter); CHECK_NE(NULL, StrNStr(log.start(), prop2_getter_record.start(), log.length())); - - obj.Dispose(v8::Isolate::GetCurrent()); } diff --git a/test/cctest/test-mark-compact.cc b/test/cctest/test-mark-compact.cc index dc21ac2e3..4b8ba812b 100644 --- a/test/cctest/test-mark-compact.cc +++ b/test/cctest/test-mark-compact.cc @@ -36,10 +36,6 @@ #endif -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT - #include "v8.h" #include "global-handles.h" diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc index 170ec76a1..e81bf3271 100644 --- a/test/cctest/test-parsing.cc +++ b/test/cctest/test-parsing.cc @@ -29,9 +29,6 @@ #include #include -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT - #include "v8.h" #include "cctest.h" diff --git a/test/cctest/test-profile-generator.cc b/test/cctest/test-profile-generator.cc index b7c123a6c..70091d903 100644 --- a/test/cctest/test-profile-generator.cc +++ b/test/cctest/test-profile-generator.cc @@ -27,9 +27,6 @@ // // Tests of profiles generator and utilities. -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT - #include "v8.h" #include "profile-generator-inl.h" #include "cctest.h" diff --git a/test/cctest/test-random.cc b/test/cctest/test-random.cc index 0837ab3e3..430355ca5 100644 --- a/test/cctest/test-random.cc +++ b/test/cctest/test-random.cc @@ -25,10 +25,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT -#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW - #include "v8.h" #include "cctest.h" diff --git a/test/cctest/test-regexp.cc b/test/cctest/test-regexp.cc index f311dcc57..6bcf5f576 100644 --- a/test/cctest/test-regexp.cc +++ b/test/cctest/test-regexp.cc @@ -28,10 +28,6 @@ #include -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT -#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW - #include "v8.h" #include "ast.h" diff --git a/test/cctest/test-serialize.cc b/test/cctest/test-serialize.cc index 0cf80440f..f87eb96e9 100644 --- a/test/cctest/test-serialize.cc +++ b/test/cctest/test-serialize.cc @@ -29,10 +29,6 @@ #include "sys/stat.h" -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT -#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW - #include "v8.h" #include "debug.h" @@ -373,16 +369,19 @@ TEST(PartialSerialization) { Serializer::Enable(); v8::V8::Initialize(); Isolate* isolate = Isolate::Current(); + v8::Isolate* v8_isolate = reinterpret_cast(isolate); Heap* heap = isolate->heap(); v8::Persistent env; { HandleScope scope(isolate); - env.Reset(v8::Isolate::GetCurrent(), - v8::Context::New(v8::Isolate::GetCurrent())); + env.Reset(v8_isolate, v8::Context::New(v8_isolate)); } ASSERT(!env.IsEmpty()); - env->Enter(); + { + v8::HandleScope handle_scope(v8_isolate); + v8::Local::New(v8_isolate, env)->Enter(); + } // Make sure all builtin scripts are cached. { HandleScope scope(isolate); for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { @@ -394,7 +393,7 @@ TEST(PartialSerialization) { Object* raw_foo; { - v8::HandleScope handle_scope(env->GetIsolate()); + v8::HandleScope handle_scope(v8_isolate); v8::Local foo = v8::String::New("foo"); ASSERT(!foo.IsEmpty()); raw_foo = *(v8::Utils::OpenHandle(*foo)); @@ -404,8 +403,11 @@ TEST(PartialSerialization) { Vector startup_name = Vector::New(file_name_length + 1); OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file); - env->Exit(); - env.Dispose(env->GetIsolate()); + { + v8::HandleScope handle_scope(v8_isolate); + v8::Local::New(v8_isolate, env)->Exit(); + } + env.Dispose(v8_isolate); FileByteSink startup_sink(startup_name.start()); StartupSerializer startup_serializer(&startup_sink); @@ -512,16 +514,19 @@ TEST(ContextSerialization) { Serializer::Enable(); v8::V8::Initialize(); Isolate* isolate = Isolate::Current(); + v8::Isolate* v8_isolate = reinterpret_cast(isolate); Heap* heap = isolate->heap(); v8::Persistent env; { HandleScope scope(isolate); - env.Reset(v8::Isolate::GetCurrent(), - v8::Context::New(v8::Isolate::GetCurrent())); + env.Reset(v8_isolate, v8::Context::New(v8_isolate)); } ASSERT(!env.IsEmpty()); - env->Enter(); + { + v8::HandleScope handle_scope(v8_isolate); + v8::Local::New(v8_isolate, env)->Enter(); + } // Make sure all builtin scripts are cached. { HandleScope scope(isolate); for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { @@ -536,11 +541,14 @@ TEST(ContextSerialization) { Vector startup_name = Vector::New(file_name_length + 1); OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file); - env->Exit(); + { + v8::HandleScope handle_scope(v8_isolate); + v8::Local::New(v8_isolate, env)->Exit(); + } Object* raw_context = *(v8::Utils::OpenHandle(*env)); - env.Dispose(env->GetIsolate()); + env.Dispose(v8_isolate); FileByteSink startup_sink(startup_name.start()); StartupSerializer startup_serializer(&startup_sink); diff --git a/test/cctest/test-strings.cc b/test/cctest/test-strings.cc index 77e8e1b96..2889172f5 100644 --- a/test/cctest/test-strings.cc +++ b/test/cctest/test-strings.cc @@ -32,10 +32,6 @@ #include -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT -#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW - #include "v8.h" #include "api.h" diff --git a/test/cctest/test-symbols.cc b/test/cctest/test-symbols.cc index e1b3ea77e..6a8323bea 100644 --- a/test/cctest/test-symbols.cc +++ b/test/cctest/test-symbols.cc @@ -5,10 +5,6 @@ // of ConsStrings. These operations may not be very fast, but they // should be possible without getting errors due to too deep recursion. -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT -#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW - #include "v8.h" #include "cctest.h" diff --git a/test/cctest/test-thread-termination.cc b/test/cctest/test-thread-termination.cc index 4008663c3..524a56402 100644 --- a/test/cctest/test-thread-termination.cc +++ b/test/cctest/test-thread-termination.cc @@ -25,10 +25,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT -#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW - #include "v8.h" #include "platform.h" #include "cctest.h" diff --git a/test/cctest/test-threads.cc b/test/cctest/test-threads.cc index edec8bfbe..3b9c1ad80 100644 --- a/test/cctest/test-threads.cc +++ b/test/cctest/test-threads.cc @@ -25,10 +25,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// TODO(dcarney): remove -#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT -#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW - #include "v8.h" #include "platform.h"