Commit ff2a76b5 authored by dcarney@chromium.org's avatar dcarney@chromium.org

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
parent e8775db3
......@@ -563,6 +563,7 @@ template <class T> class Persistent // NOLINT
#endif
#ifdef V8_USE_UNSAFE_HANDLES
template <class S> V8_INLINE(static Persistent<T> Cast(Persistent<S> 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 T> class Persistent // NOLINT
return Persistent<S>::Cast(*this);
}
#else
template <class S>
V8_INLINE(static Persistent<T>& Cast(Persistent<S>& 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<Persistent<T>&>(that);
}
template <class S> V8_INLINE(Persistent<S>& As()) { // NOLINT
return Persistent<S>::Cast(*this);
}
#endif
V8_DEPRECATED(static Persistent<T> New(Handle<T> that));
/**
......
......@@ -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 <v8.h>
#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<v8::Context> context = v8::Context::New(isolate, &config);
context_ = v8::Persistent<v8::Context>::New(isolate, context);
context_.Reset(isolate, context);
}
{
v8::HandleScope scope(isolate);
v8::Local<v8::Context> context =
v8::Local<v8::Context>::New(isolate, context_);
context->Enter();
}
context_->Enter();
}
......
......@@ -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"
......
......@@ -27,10 +27,6 @@
#include <stdlib.h>
// TODO(dcarney): remove
#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT
#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW
#include "v8.h"
#include "disassembler.h"
......
......@@ -27,10 +27,6 @@
#include <stdlib.h>
// TODO(dcarney): remove
#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT
#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW
#include "v8.h"
#include "macro-assembler.h"
......
......@@ -28,10 +28,6 @@
#include <stdlib.h>
#include <wchar.h>
// TODO(dcarney): remove
#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW
#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT
#include "v8.h"
#include "compiler.h"
......
......@@ -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"
......
......@@ -29,10 +29,6 @@
#include <stdlib.h>
// 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<v8::Context> local_context =
v8::Local<v8::Context>::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<v8::Context> local_context =
v8::Local<v8::Context>::New(isolate, context);
local_context->Exit();
}
context.Dispose(isolate);
// Do garbage collection to collect the script above which is no longer
......
......@@ -27,9 +27,6 @@
#include <stdlib.h>
// 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<v8::String> expected = v8_str("whatever");
array->handles_[index] = v8::Persistent<v8::Value>::New(helper.isolate_,
expected);
array->handles_[index].Reset(helper.isolate_, expected);
VerifyRead(descriptor, internal_field, array, expected);
}
......@@ -27,11 +27,6 @@
#include <stdlib.h>
// 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> context = Local<Context>::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<Value>()));
context_->Enter();
Local<Context> context = Context::New(isolate,
0,
function->InstanceTemplate(),
Local<Value>());
context_.Reset(isolate, context);
context->Enter();
is_initialized_ = true;
PostInitializeContext(Local<Context>::New(isolate, context_));
PostInitializeContext(context);
}
......
......@@ -28,10 +28,6 @@
#include <stdlib.h>
// TODO(dcarney): remove
#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT
#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW
#include "v8.h"
#include "debug.h"
......
......@@ -27,10 +27,6 @@
#include <stdlib.h>
// TODO(dcarney): remove
#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT
#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW
#include "v8.h"
#include "debug.h"
......
......@@ -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"
......
......@@ -27,9 +27,6 @@
#include <stdlib.h>
// TODO(dcarney): remove
#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT
#include "v8.h"
#include "factory.h"
......
......@@ -29,9 +29,6 @@
#include <ctype.h>
// 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<v8::String> p_AAA =
v8::Persistent<v8::String>::New(isolate, v8_str("AAA"));
v8::Persistent<v8::String> p_AAA(isolate, v8_str("AAA"));
p_AAA.SetWrapperClassId(isolate, 1);
v8::Persistent<v8::String> p_BBB =
v8::Persistent<v8::String>::New(isolate, v8_str("BBB"));
v8::Persistent<v8::String> p_BBB(isolate, v8_str("BBB"));
p_BBB.SetWrapperClassId(isolate, 1);
v8::Persistent<v8::String> p_CCC =
v8::Persistent<v8::String>::New(isolate, v8_str("CCC"));
v8::Persistent<v8::String> 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<v8::Object>::New(isolate_, v8::Object::New());
objects_[i].Reset(isolate_, v8::Object::New());
}
(*env)->Global()->Set(v8_str("root_object"),
v8::Local<v8::Value>::New(isolate_, objects_[0]));
......@@ -1213,15 +1206,15 @@ class GraphWithImplicitRefs {
private:
void AddImplicitReferences() {
// 0 -> 1
isolate_->SetObjectGroupId(v8::Persistent<v8::Object>::Cast(objects_[0]),
isolate_->SetObjectGroupId(objects_[0],
v8::UniqueId(1));
isolate_->SetReferenceFromGroup(
v8::UniqueId(1), v8::Persistent<v8::Object>::Cast(objects_[1]));
v8::UniqueId(1), objects_[1]);
// Adding two more references: 1 -> 2, 1 -> 3
isolate_->SetReference(v8::Persistent<v8::Object>::Cast(objects_[1]),
v8::Persistent<v8::Object>::Cast(objects_[2]));
isolate_->SetReference(v8::Persistent<v8::Object>::Cast(objects_[1]),
v8::Persistent<v8::Object>::Cast(objects_[3]));
isolate_->SetReference(objects_[1].As<v8::Object>(),
objects_[2]);
isolate_->SetReference(objects_[1].As<v8::Object>(),
objects_[3]);
}
v8::Persistent<v8::Value> objects_[kObjectsCount];
......@@ -1611,8 +1604,7 @@ TEST(WeakGlobalHandle) {
CHECK(!HasWeakGlobalHandle());
v8::Persistent<v8::Object> handle =
v8::Persistent<v8::Object>::New(env->GetIsolate(), v8::Object::New());
v8::Persistent<v8::Object> handle(env->GetIsolate(), v8::Object::New());
handle.MakeWeak<v8::Value, void>(env->GetIsolate(),
NULL,
PersistentHandleCallback);
......
......@@ -27,10 +27,6 @@
#include <stdlib.h>
// 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<v8::Context> ctx1;
v8::Persistent<v8::Context> ctx2;
v8::Persistent<v8::Context> ctx1p;
v8::Persistent<v8::Context> 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<v8::Context>::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<v8::Context> ctx1 = v8::Local<v8::Context>::New(isolate, ctx1p);
v8::Local<v8::Context> ctx2 = v8::Local<v8::Context>::New(isolate, ctx2p);
v8::Local<v8::Value> 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<v8::Context>::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<v8::Context> ctx1;
v8::Persistent<v8::Context> ctx2;
v8::Persistent<v8::Context> ctx1p;
v8::Persistent<v8::Context> 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<v8::Context>::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<v8::Context> ctx1 = v8::Local<v8::Context>::New(isolate, ctx1p);
v8::Local<v8::Context> ctx2 = v8::Local<v8::Context>::New(isolate, ctx2p);
v8::Local<v8::Value> 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<v8::Context> ctx1;
v8::Persistent<v8::Context> ctx2;
v8::Persistent<v8::Context> ctx1p;
v8::Persistent<v8::Context> 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<v8::Context>::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<v8::Context> ctx1 = v8::Local<v8::Context>::New(isolate, ctx1p);
v8::Local<v8::Context> ctx2 = v8::Local<v8::Context>::New(isolate, ctx2p);
v8::Local<v8::Value> 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<v8::Context> ctx1;
v8::Persistent<v8::Context> ctx2;
v8::Persistent<v8::Context> ctx1p;
v8::Persistent<v8::Context> 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<v8::Context>::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<v8::Context> ctx1 = v8::Local<v8::Context>::New(isolate, ctx1p);
v8::Local<v8::Context> ctx2 = v8::Local<v8::Context>::New(isolate, ctx2p);
v8::Local<v8::Value> 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());
}
......
......@@ -27,9 +27,6 @@
#include <limits.h>
// TODO(dcarney): remove
#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT
#include "v8.h"
#include "api.h"
......
......@@ -29,10 +29,6 @@
#include <stdlib.h>
// TODO(dcarney): remove
#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT
#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW
#include "v8.h"
#include "api.h"
......
......@@ -34,11 +34,6 @@
#include <cmath>
#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<v8::FunctionTemplate> obj =
v8::Persistent<v8::FunctionTemplate>::New(v8::Isolate::GetCurrent(),
v8::FunctionTemplate::New());
v8::Local<v8::FunctionTemplate> obj =
v8::Local<v8::FunctionTemplate>::New(v8::Isolate::GetCurrent(),
v8::FunctionTemplate::New());
obj->SetClassName(v8_str("Obj"));
v8::Handle<v8::ObjectTemplate> proto = obj->PrototypeTemplate();
v8::Local<v8::Signature> 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<v8::FunctionTemplate> obj =
v8::Persistent<v8::FunctionTemplate>::New(v8::Isolate::GetCurrent(),
v8::FunctionTemplate::New());
v8::Local<v8::FunctionTemplate> obj =
v8::Local<v8::FunctionTemplate>::New(v8::Isolate::GetCurrent(),
v8::FunctionTemplate::New());
obj->SetClassName(v8_str("Obj"));
v8::Handle<v8::ObjectTemplate> 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());
}
......
......@@ -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"
......
......@@ -29,9 +29,6 @@
#include <stdio.h>
#include <string.h>
// TODO(dcarney): remove
#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT
#include "v8.h"
#include "cctest.h"
......
......@@ -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"
......
......@@ -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"
......
......@@ -28,10 +28,6 @@
#include <stdlib.h>
// TODO(dcarney): remove
#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT
#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW
#include "v8.h"
#include "ast.h"
......
......@@ -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<v8::Isolate*>(isolate);
Heap* heap = isolate->heap();
v8::Persistent<v8::Context> 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<v8::Context>::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<v8::String> foo = v8::String::New("foo");
ASSERT(!foo.IsEmpty());
raw_foo = *(v8::Utils::OpenHandle(*foo));
......@@ -404,8 +403,11 @@ TEST(PartialSerialization) {
Vector<char> startup_name = Vector<char>::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<v8::Context>::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<v8::Isolate*>(isolate);
Heap* heap = isolate->heap();
v8::Persistent<v8::Context> 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<v8::Context>::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<char> startup_name = Vector<char>::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<v8::Context>::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);
......
......@@ -32,10 +32,6 @@
#include <stdlib.h>
// TODO(dcarney): remove
#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT
#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW
#include "v8.h"
#include "api.h"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
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