class Int32;
class Integer;
class Isolate;
-class LocalContext;
class Number;
class NumberObject;
class Object;
class HeapObject;
class Isolate;
class Object;
-template<typename T>
-class CustomArguments;
+template<typename T> class CustomArguments;
class PropertyCallbackArguments;
class FunctionCallbackArguments;
}
#endif
private:
+ friend class Utils;
template<class F> friend class Persistent;
template<class F> friend class Local;
friend class Arguments;
template<class F> friend class FunctionCallbackInfo;
template<class F> friend class PropertyCallbackInfo;
- friend class String;
- friend class Object;
+ template<class F> friend class CustomArguments;
friend class AccessorInfo;
friend Handle<Primitive> Undefined(Isolate* isolate);
friend Handle<Primitive> Null(Isolate* isolate);
friend Handle<Boolean> True(Isolate* isolate);
friend Handle<Boolean> False(Isolate* isolate);
friend class Context;
- friend class InternalHandleHelper;
- friend class LocalContext;
friend class HandleScope;
#ifndef V8_USE_UNSAFE_HANDLES
#endif
private:
+ friend class Utils;
template<class F> friend class Persistent;
template<class F> friend class Handle;
friend class Arguments;
friend class Object;
friend class AccessorInfo;
friend class Context;
- friend class InternalHandleHelper;
- friend class LocalContext;
+ template<class F> friend class CustomArguments;
friend class HandleScope;
V8_INLINE(static Local<T> New(Isolate* isolate, T* that));
* to be separately disposed.
*/
template <class S> V8_INLINE(Persistent(Isolate* isolate, Handle<S> that))
- : val_(*New(isolate, that)) { }
+ : val_(New(isolate, *that)) { }
template <class S> V8_INLINE(Persistent(Isolate* isolate,
Persistent<S>& that)) // NOLINT
- : val_(*New(isolate, that)) { }
+ : val_(New(isolate, *that)) { }
#else
/**
}
#endif
+#ifdef V8_USE_UNSAFE_HANDLES
V8_DEPRECATED(static Persistent<T> New(Handle<T> that));
-
- /**
- * Creates a new persistent handle for an existing local or persistent handle.
- */
- // TODO(dcarney): remove before cutover
V8_INLINE(static Persistent<T> New(Isolate* isolate, Handle<T> that));
-#ifndef V8_USE_UNSAFE_HANDLES
- // TODO(dcarney): remove before cutover
V8_INLINE(static Persistent<T> New(Isolate* isolate, Persistent<T> that));
#endif
#endif
// TODO(dcarney): remove before cutover
template <class S> V8_INLINE(Persistent(S* that)) : val_(that) { }
- // TODO(dcarney): remove before cutover
- template <class S> V8_INLINE(Persistent(Persistent<S> that))
- : val_(*that) {
- TYPE_CHECK(T, S);
- }
+
// TODO(dcarney): remove before cutover
V8_INLINE(T* operator*() const) { return val_; }
#endif
private:
+ friend class Utils;
template<class F> friend class Handle;
template<class F> friend class Local;
+ template<class F> friend class Persistent;
template<class F> friend class ReturnValue;
- friend class ImplementationUtilities;
- friend class ObjectTemplate;
- friend class Context;
- friend class InternalHandleHelper;
- friend class LocalContext;
- V8_INLINE(static Persistent<T> New(Isolate* isolate, T* that));
+ V8_INLINE(static T* New(Isolate* isolate, T* that));
#ifndef V8_USE_UNSAFE_HANDLES
T* val_;
}
+#ifdef V8_USE_UNSAFE_HANDLES
template <class T>
Persistent<T> Persistent<T>::New(Handle<T> that) {
return New(Isolate::GetCurrent(), that.val_);
return New(Isolate::GetCurrent(), that.val_);
}
-#ifndef V8_USE_UNSAFE_HANDLES
template <class T>
Persistent<T> Persistent<T>::New(Isolate* isolate, Persistent<T> that) {
return New(Isolate::GetCurrent(), that.val_);
}
#endif
+
template <class T>
-Persistent<T> Persistent<T>::New(Isolate* isolate, T* that) {
- if (that == NULL) return Persistent<T>();
+T* Persistent<T>::New(Isolate* isolate, T* that) {
+ if (that == NULL) return NULL;
internal::Object** p = reinterpret_cast<internal::Object**>(that);
- return Persistent<T>(reinterpret_cast<T*>(
+ return reinterpret_cast<T*>(
V8::GlobalizeReference(reinterpret_cast<internal::Isolate*>(isolate),
- p)));
+ p));
}
if (!EnsureInitializedForIsolate(isolate, "v8::Undefined()")) {
return v8::Handle<v8::Primitive>();
}
- return v8::Handle<Primitive>(ToApi<Primitive>(
- isolate->factory()->undefined_value()));
+ return ToApiHandle<Primitive>(isolate->factory()->undefined_value());
}
if (!EnsureInitializedForIsolate(isolate, "v8::Null()")) {
return v8::Handle<v8::Primitive>();
}
- return v8::Handle<Primitive>(
- ToApi<Primitive>(isolate->factory()->null_value()));
+ return ToApiHandle<Primitive>(isolate->factory()->null_value());
}
if (!EnsureInitializedForIsolate(isolate, "v8::True()")) {
return v8::Handle<Boolean>();
}
- return v8::Handle<Boolean>(
- ToApi<Boolean>(isolate->factory()->true_value()));
+ return ToApiHandle<Boolean>(isolate->factory()->true_value());
}
if (!EnsureInitializedForIsolate(isolate, "v8::False()")) {
return v8::Handle<Boolean>();
}
- return v8::Handle<Boolean>(
- ToApi<Boolean>(isolate->factory()->false_value()));
+ return ToApiHandle<Boolean>(isolate->factory()->false_value());
}
result = Utils::OpenHandle(*ObjectTemplate::New());
Utils::OpenHandle(this)->set_prototype_template(*result);
}
- return Local<ObjectTemplate>(ToApi<ObjectTemplate>(result));
+ return ToApiHandle<ObjectTemplate>(result);
}
static Local<Operation> NewDescriptor(
Isolate* isolate,
const i::DeclaredAccessorDescriptorData& data,
- Data* previous_descriptor
- ) {
+ Data* previous_descriptor) {
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
i::Handle<i::DeclaredAccessorDescriptor> previous =
i::Handle<i::DeclaredAccessorDescriptor>();
}
i::Handle<i::DeclaredAccessorDescriptor> descriptor =
i::DeclaredAccessorDescriptor::Create(internal_isolate, data, previous);
- return Local<Operation>(
- reinterpret_cast<Operation*>(*Utils::ToLocal(descriptor)));
+ return Utils::Convert<i::DeclaredAccessorDescriptor, Operation>(descriptor);
}
|| EmptyCheck("v8::FunctionTemplate::InstanceTemplate()", this))
return Local<ObjectTemplate>();
ENTER_V8(isolate);
- if (Utils::OpenHandle(this)->instance_template()->IsUndefined()) {
+ i::Handle<i::FunctionTemplateInfo> handle = Utils::OpenHandle(this);
+ if (handle->instance_template()->IsUndefined()) {
Local<ObjectTemplate> templ =
- ObjectTemplate::New(v8::Handle<FunctionTemplate>(this));
- Utils::OpenHandle(this)->set_instance_template(*Utils::OpenHandle(*templ));
+ ObjectTemplate::New(ToApiHandle<FunctionTemplate>(handle));
+ handle->set_instance_template(*Utils::OpenHandle(*templ));
}
- i::Handle<i::ObjectTemplateInfo> result(i::ObjectTemplateInfo::cast(
- Utils::OpenHandle(this)->instance_template()));
+ i::Handle<i::ObjectTemplateInfo> result(
+ i::ObjectTemplateInfo::cast(handle->instance_template()));
return Utils::ToLocal(result);
}
raw_result = *result;
}
i::Handle<i::SharedFunctionInfo> result(raw_result, isolate);
- return Local<Script>(ToApi<Script>(result));
+ return ToApiHandle<Script>(result);
}
isolate->factory()->NewFunctionFromSharedFunctionInfo(
function,
isolate->global_context());
- return Local<Script>(ToApi<Script>(result));
+ return ToApiHandle<Script>(result);
}
str = i::Execution::ToString(obj, &has_pending_exception);
EXCEPTION_BAILOUT_CHECK(isolate, Local<String>());
}
- return Local<String>(ToApi<String>(str));
+ return ToApiHandle<String>(str);
}
str = i::Execution::ToDetailString(obj, &has_pending_exception);
EXCEPTION_BAILOUT_CHECK(isolate, Local<String>());
}
- return Local<String>(ToApi<String>(str));
+ return ToApiHandle<String>(str);
}
val = i::Execution::ToObject(obj, &has_pending_exception);
EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>());
}
- return Local<v8::Object>(ToApi<Object>(val));
+ return ToApiHandle<Object>(val);
}
Local<Boolean> Value::ToBoolean() const {
i::Handle<i::Object> obj = Utils::OpenHandle(this);
if (obj->IsBoolean()) {
- return Local<Boolean>(ToApi<Boolean>(obj));
+ return ToApiHandle<Boolean>(obj);
} else {
i::Isolate* isolate = i::Isolate::Current();
if (IsDeadCheck(isolate, "v8::Value::ToBoolean()")) {
ENTER_V8(isolate);
i::Handle<i::Object> val =
isolate->factory()->ToBoolean(obj->BooleanValue());
- return Local<Boolean>(ToApi<Boolean>(val));
+ return ToApiHandle<Boolean>(val);
}
}
num = i::Execution::ToNumber(obj, &has_pending_exception);
EXCEPTION_BAILOUT_CHECK(isolate, Local<Number>());
}
- return Local<Number>(ToApi<Number>(num));
+ return ToApiHandle<Number>(num);
}
num = i::Execution::ToInteger(obj, &has_pending_exception);
EXCEPTION_BAILOUT_CHECK(isolate, Local<Integer>());
}
- return Local<Integer>(ToApi<Integer>(num));
+ return ToApiHandle<Integer>(num);
}
num = i::Execution::ToInt32(obj, &has_pending_exception);
EXCEPTION_BAILOUT_CHECK(isolate, Local<Int32>());
}
- return Local<Int32>(ToApi<Int32>(num));
+ return ToApiHandle<Int32>(num);
}
num = i::Execution::ToUint32(obj, &has_pending_exception);
EXCEPTION_BAILOUT_CHECK(isolate, Local<Uint32>());
}
- return Local<Uint32>(ToApi<Uint32>(num));
+ return ToApiHandle<Uint32>(num);
}
return env;
}
-
+#ifdef V8_USE_UNSAFE_HANDLES
Persistent<Context> v8::Context::New(
v8::ExtensionConfiguration* extensions,
v8::Handle<ObjectTemplate> global_template,
if (env.is_null()) return Persistent<Context>();
return Persistent<Context>::New(external_isolate, Utils::ToLocal(env));
}
+#endif
Local<Context> v8::Context::New(
UniqueId id) {
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this);
internal_isolate->global_handles()->SetObjectGroupId(
- reinterpret_cast<i::Object**>(*object), id);
+ Utils::OpenPersistent(object).location(),
+ id);
}
void Isolate::SetReferenceFromGroup(UniqueId id,
const Persistent<Value>& object) {
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this);
- internal_isolate->global_handles()
- ->SetReferenceFromGroup(id, reinterpret_cast<i::Object**>(*object));
+ internal_isolate->global_handles()->SetReferenceFromGroup(
+ id,
+ Utils::OpenPersistent(object).location());
}
void Isolate::SetReference(const Persistent<Object>& parent,
const Persistent<Value>& child) {
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this);
+ i::Object** parent_location = Utils::OpenPersistent(parent).location();
internal_isolate->global_handles()->SetReference(
- i::Handle<i::HeapObject>::cast(Utils::OpenHandle(*parent)).location(),
- reinterpret_cast<i::Object**>(*child));
+ reinterpret_cast<i::HeapObject**>(parent_location),
+ Utils::OpenPersistent(child).location());
}
const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
const i::CodeEntry* entry = node->entry();
if (!entry->has_name_prefix()) {
- return Handle<String>(ToApi<String>(
- isolate->factory()->InternalizeUtf8String(entry->name())));
+ return ToApiHandle<String>(
+ isolate->factory()->InternalizeUtf8String(entry->name()));
} else {
- return Handle<String>(ToApi<String>(isolate->factory()->NewConsString(
+ return ToApiHandle<String>(isolate->factory()->NewConsString(
isolate->factory()->InternalizeUtf8String(entry->name_prefix()),
- isolate->factory()->InternalizeUtf8String(entry->name()))));
+ isolate->factory()->InternalizeUtf8String(entry->name())));
}
}
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfileNode::GetScriptResourceName");
const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
- return Handle<String>(ToApi<String>(isolate->factory()->InternalizeUtf8String(
- node->entry()->resource_name())));
+ return ToApiHandle<String>(isolate->factory()->InternalizeUtf8String(
+ node->entry()->resource_name()));
}
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfile::GetTitle");
const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
- return Handle<String>(ToApi<String>(isolate->factory()->InternalizeUtf8String(
- profile->title())));
+ return ToApiHandle<String>(isolate->factory()->InternalizeUtf8String(
+ profile->title()));
}
case i::HeapGraphEdge::kInternal:
case i::HeapGraphEdge::kProperty:
case i::HeapGraphEdge::kShortcut:
- return Handle<String>(ToApi<String>(
- isolate->factory()->InternalizeUtf8String(edge->name())));
+ return ToApiHandle<String>(
+ isolate->factory()->InternalizeUtf8String(edge->name()));
case i::HeapGraphEdge::kElement:
case i::HeapGraphEdge::kHidden:
- return Handle<Number>(ToApi<Number>(
- isolate->factory()->NewNumberFromInt(edge->index())));
+ return ToApiHandle<Number>(
+ isolate->factory()->NewNumberFromInt(edge->index()));
default: UNREACHABLE();
}
return v8::Undefined();
Handle<String> HeapGraphNode::GetName() const {
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapGraphNode::GetName");
- return Handle<String>(ToApi<String>(isolate->factory()->InternalizeUtf8String(
- ToInternal(this)->name())));
+ return ToApiHandle<String>(
+ isolate->factory()->InternalizeUtf8String(ToInternal(this)->name()));
}
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapGraphNode::GetHeapValue");
i::Handle<i::HeapObject> object = ToInternal(this)->GetHeapObject();
- return v8::Handle<Value>(!object.is_null() ?
- ToApi<Value>(object) : ToApi<Value>(
- isolate->factory()->undefined_value()));
+ return !object.is_null() ?
+ ToApiHandle<Value>(object) :
+ ToApiHandle<Value>(isolate->factory()->undefined_value());
}
Handle<String> HeapSnapshot::GetTitle() const {
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapSnapshot::GetTitle");
- return Handle<String>(ToApi<String>(isolate->factory()->InternalizeUtf8String(
- ToInternal(this)->title())));
+ return ToApiHandle<String>(
+ isolate->factory()->InternalizeUtf8String(ToInternal(this)->title()));
}
OPEN_HANDLE_LIST(DECLARE_OPEN_HANDLE)
#undef DECLARE_OPEN_HANDLE
-};
+ template<class From, class To>
+ static inline Local<To> Convert(v8::internal::Handle<From> obj) {
+ ASSERT(obj.is_null() || !obj->IsTheHole());
+ return Local<To>(reinterpret_cast<To*>(obj.location()));
+ }
-template <class T>
-inline T* ToApi(v8::internal::Handle<v8::internal::Object> obj) {
- return reinterpret_cast<T*>(obj.location());
-}
+ template <class T>
+ static inline v8::internal::Handle<v8::internal::Object> OpenPersistent(
+ const v8::Persistent<T>& persistent) {
+ return v8::internal::Handle<v8::internal::Object>(
+ reinterpret_cast<v8::internal::Object**>(persistent.val_));
+ }
+
+ template <class T>
+ static inline v8::internal::Handle<v8::internal::Object> OpenPersistent(
+ v8::Persistent<T>* persistent) {
+ return OpenPersistent(*persistent);
+ }
+};
template <class T>
}
-class InternalHandleHelper {
- public:
- template<class From, class To>
- static inline Local<To> Convert(v8::internal::Handle<From> obj) {
- return Local<To>(reinterpret_cast<To*>(obj.location()));
- }
-};
+template <class T>
+inline T* ToApi(v8::internal::Handle<v8::internal::Object> obj) {
+ return reinterpret_cast<T*>(obj.location());
+}
+
+template <class T>
+inline v8::Local<T> ToApiHandle(
+ v8::internal::Handle<v8::internal::Object> obj) {
+ return Utils::Convert<v8::internal::Object, T>(obj);
+}
// Implementations of ToLocal
#define MAKE_TO_LOCAL(Name, From, To) \
Local<v8::To> Utils::Name(v8::internal::Handle<v8::internal::From> obj) { \
- ASSERT(obj.is_null() || !obj->IsTheHole()); \
- return InternalHandleHelper::Convert<v8::internal::From, v8::To>(obj); \
+ return Convert<v8::internal::From, v8::To>(obj); \
}
#define MAKE_TO_LOCAL_TYPED_ARRAY(TypedArray, typeConst) \
Local<v8::TypedArray> Utils::ToLocal##TypedArray( \
v8::internal::Handle<v8::internal::JSTypedArray> obj) { \
- ASSERT(obj.is_null() || !obj->IsTheHole()); \
ASSERT(obj->type() == typeConst); \
- return InternalHandleHelper:: \
- Convert<v8::internal::JSTypedArray, v8::TypedArray>(obj); \
+ return Convert<v8::internal::JSTypedArray, v8::TypedArray>(obj); \
}
Object** handle = &this->end()[kReturnValueOffset];
// Nothing was set, return empty handle as per previous behaviour.
if ((*handle)->IsTheHole()) return v8::Handle<V>();
- return v8::Handle<V>(reinterpret_cast<V*>(handle));
+ return Utils::Convert<Object, V>(Handle<Object>(handle));
}
// Get the toJSONProtocol function on the event and get the JSON format.
Local<String> to_json_fun_name = String::New("toJSONProtocol");
Local<Function> to_json_fun =
- Function::Cast(*event_data->Get(to_json_fun_name));
+ Local<Function>::Cast(event_data->Get(to_json_fun_name));
Local<Value> event_json = to_json_fun->Call(event_data, 0, NULL);
if (try_catch.HasCaught()) {
Shell::ReportException(isolate, &try_catch);
// Get the debug command processor.
Local<String> fun_name = String::New("debugCommandProcessor");
- Local<Function> fun = Function::Cast(*exec_state->Get(fun_name));
+ Local<Function> fun = Local<Function>::Cast(exec_state->Get(fun_name));
Local<Object> cmd_processor =
- Object::Cast(*fun->Call(exec_state, 0, NULL));
+ Local<Object>::Cast(fun->Call(exec_state, 0, NULL));
if (try_catch.HasCaught()) {
Shell::ReportException(isolate, &try_catch);
return;
}
static void ReadBufferWeakCallback(v8::Isolate* isolate,
- Persistent<Value>* object,
+ Persistent<ArrayBuffer>* array_buffer,
uint8_t* data) {
- size_t byte_length = ArrayBuffer::Cast(**object)->ByteLength();
+ size_t byte_length =
+ Local<ArrayBuffer>::New(isolate, *array_buffer)->ByteLength();
isolate->AdjustAmountOfExternalAllocatedMemory(
-static_cast<intptr_t>(byte_length));
delete[] data;
- object->Dispose(isolate);
+ array_buffer->Dispose();
}
void Shell::ReadBuffer(const v8::FunctionCallbackInfo<v8::Value>& args) {
return;
}
Handle<v8::ArrayBuffer> buffer = ArrayBuffer::New(data, length);
- v8::Persistent<v8::Value> weak_handle(isolate, buffer);
- weak_handle.MakeWeak(data, ReadBufferWeakCallback);
+ v8::Persistent<v8::ArrayBuffer> weak_handle(isolate, buffer);
+ weak_handle.MakeWeak(isolate, data, ReadBufferWeakCallback);
weak_handle.MarkIndependent();
isolate->AdjustAmountOfExternalAllocatedMemory(length);
ScriptCache* script_cache = reinterpret_cast<ScriptCache*>(data);
// Find the location of the global handle.
Script** location =
- reinterpret_cast<Script**>(Utils::OpenHandle(**obj).location());
+ reinterpret_cast<Script**>(Utils::OpenPersistent(*obj).location());
ASSERT((*location)->IsScript());
// Remove the entry from the cache.
v8::Local<v8::String> fun_name =
v8::String::New("debugCommandProcessor");
v8::Local<v8::Function> fun =
- v8::Function::Cast(*api_exec_state->Get(fun_name));
+ v8::Local<v8::Function>::Cast(api_exec_state->Get(fun_name));
v8::Handle<v8::Boolean> running =
auto_continue ? v8::True() : v8::False();
static const int kArgc = 1;
v8::Handle<Value> argv[kArgc] = { running };
- cmd_processor = v8::Object::Cast(*fun->Call(api_exec_state, kArgc, argv));
+ cmd_processor = v8::Local<v8::Object>::Cast(
+ fun->Call(api_exec_state, kArgc, argv));
if (try_catch.HasCaught()) {
PrintLn(try_catch.Exception());
return;
v8::Local<v8::Value> request;
v8::TryCatch try_catch;
fun_name = v8::String::New("processDebugRequest");
- fun = v8::Function::Cast(*cmd_processor->Get(fun_name));
+ fun = v8::Local<v8::Function>::Cast(cmd_processor->Get(fun_name));
request = v8::String::New(command.text().start(),
command.text().length());
if (!try_catch.HasCaught()) {
// Get response string.
if (!response_val->IsUndefined()) {
- response = v8::String::Cast(*response_val);
+ response = v8::Local<v8::String>::Cast(response_val);
} else {
response = v8::String::New("");
}
// Get the running state.
fun_name = v8::String::New("isRunning");
- fun = v8::Function::Cast(*cmd_processor->Get(fun_name));
+ fun = v8::Local<v8::Function>::Cast(cmd_processor->Get(fun_name));
static const int kArgc = 1;
v8::Handle<Value> argv[kArgc] = { response };
v8::Local<v8::Value> running_val = fun->Call(cmd_processor, kArgc, argv);
static void ClearWrapperCache(v8::Isolate* v8_isolate,
Persistent<v8::Value>* handle,
void*) {
- Handle<Object> cache = Utils::OpenHandle(**handle);
+ Handle<Object> cache = Utils::OpenPersistent(handle);
JSValue* wrapper = JSValue::cast(*cache);
Foreign* foreign = Script::cast(wrapper->value())->wrapper();
ASSERT(foreign->foreign_address() ==
event.code_len = code->instruction_size();
Handle<Script> script_handle =
script != NULL ? Handle<Script>(script) : Handle<Script>();
- event.script = v8::Handle<v8::Script>(ToApi<v8::Script>(script_handle));
+ event.script = ToApiHandle<v8::Script>(script_handle);
event.name.str = name;
event.name.len = name_len;
// If we don't do this then we end up with a stray root pointing at the
// context even after we have disposed of the context.
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags, "mksnapshot");
- i::Object* raw_context = *(v8::Utils::OpenHandle(*context));
+ i::Object* raw_context = *v8::Utils::OpenPersistent(context);
context.Dispose(isolate);
CppByteSink sink(argv[1]);
// This results in a somewhat smaller snapshot, probably because it gets rid
v8::Persistent<v8::Value>* handle,
void* parameter) {
reinterpret_cast<TokenEnumerator*>(parameter)->TokenRemoved(
- Utils::OpenHandle(**handle).location());
+ Utils::OpenPersistent(handle).location());
handle->Dispose(isolate);
}
void* data) {
Isolate* isolate = reinterpret_cast<Isolate*>(external_isolate);
HandleScope scope(isolate);
- Handle<Object> internal_object = Utils::OpenHandle(**object);
+ Handle<Object> internal_object = Utils::OpenPersistent(object);
Handle<JSArrayBuffer> array_buffer(JSArrayBuffer::cast(*internal_object));
if (!array_buffer->is_external()) {
SetupArrayBuffer(isolate, array_buffer, false, data, allocated_length);
- v8::Isolate* external_isolate = reinterpret_cast<v8::Isolate*>(isolate);
- v8::Persistent<v8::Value> weak_handle(
- external_isolate, v8::Utils::ToLocal(Handle<Object>::cast(array_buffer)));
- weak_handle.MakeWeak(data, ArrayBufferWeakCallback);
- weak_handle.MarkIndependent(external_isolate);
+ Handle<Object> persistent = isolate->global_handles()->Create(*array_buffer);
+ GlobalHandles::MakeWeak(persistent.location(), data, ArrayBufferWeakCallback);
+ GlobalHandles::MarkIndependent(persistent.location());
+
isolate->heap()->AdjustAmountOfExternalAllocatedMemory(allocated_length);
return true;
#error both DEBUG and NDEBUG are set
#endif
-// TODO(dcarney): remove this
-#define V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR
-
// Basic includes
#include "../include/v8.h"
#include "v8globals.h"
const char* name_;
};
-namespace v8 {
// A LocalContext holds a reference to a v8::Context.
class LocalContext {
public:
v8::Handle<v8::ObjectTemplate>(),
v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>()) {
v8::Isolate* isolate = v8::Isolate::GetCurrent();
- HandleScope scope(isolate);
- context_.Reset(isolate,
- Context::New(isolate,
- extensions,
- global_template,
- global_object));
- context_->Enter();
+ v8::HandleScope scope(isolate);
+ v8::Local<v8::Context> context = v8::Context::New(isolate,
+ extensions,
+ global_template,
+ global_object);
+ context_.Reset(isolate, context);
+ context->Enter();
// We can't do this later perhaps because of a fatal error.
- isolate_ = context_->GetIsolate();
+ isolate_ = context->GetIsolate();
}
virtual ~LocalContext() {
- context_->Exit();
- context_.Dispose(isolate_);
+ v8::HandleScope scope(isolate_);
+ v8::Local<v8::Context>::New(isolate_, context_)->Exit();
+ context_.Dispose();
}
- v8::Context* operator->() { return *context_; }
- v8::Context* operator*() { return *context_; }
+ v8::Context* operator->() {
+ return *reinterpret_cast<v8::Context**>(&context_);
+ }
+ v8::Context* operator*() { return operator->(); }
bool IsReady() { return !context_.IsEmpty(); }
v8::Local<v8::Context> local() {
v8::Persistent<v8::Context> context_;
v8::Isolate* isolate_;
};
-}
-typedef v8::LocalContext LocalContext;
static inline v8::Local<v8::Value> v8_num(double x) {
return v8::Number::New(x);
v8::HandleScope handle_scope(isolate);
- v8::Handle<v8::Value> result =
+ v8::Local<v8::Value> result =
CompileRun("var ab1 = new ArrayBuffer(2);"
"var u8_a = new Uint8Array(ab1);"
"u8_a[0] = 0xAA;"
"u8_a[1] = 0xFF; u8_a.buffer");
- Local<v8::ArrayBuffer> ab1 = v8::ArrayBuffer::Cast(*result);
+ Local<v8::ArrayBuffer> ab1 = Local<v8::ArrayBuffer>::Cast(result);
CHECK_EQ(2, static_cast<int>(ab1->ByteLength()));
CHECK(!ab1->IsExternal());
ScopedArrayBufferContents ab1_contents(ab1->Externalize());
"var f32a = new Float32Array(ab, 4, 255);"
"var f64a = new Float64Array(ab, 8, 127);");
- v8::Handle<v8::ArrayBuffer> ab(v8::ArrayBuffer::Cast(*CompileRun("ab")));
-
- v8::Handle<v8::Uint8Array> u8a(v8::Uint8Array::Cast(*CompileRun("u8a")));
- v8::Handle<v8::Uint8ClampedArray> u8c(
- v8::Uint8ClampedArray::Cast(*CompileRun("u8c")));
- v8::Handle<v8::Int8Array> i8a(v8::Int8Array::Cast(*CompileRun("i8a")));
-
- v8::Handle<v8::Uint16Array> u16a(
- v8::Uint16Array::Cast(*CompileRun("u16a")));
- v8::Handle<v8::Int16Array> i16a(
- v8::Int16Array::Cast(*CompileRun("i16a")));
- v8::Handle<v8::Uint32Array> u32a(
- v8::Uint32Array::Cast(*CompileRun("u32a")));
- v8::Handle<v8::Int32Array> i32a(
- v8::Int32Array::Cast(*CompileRun("i32a")));
- v8::Handle<v8::Float32Array> f32a(
- v8::Float32Array::Cast(*CompileRun("f32a")));
- v8::Handle<v8::Float64Array> f64a(
- v8::Float64Array::Cast(*CompileRun("f64a")));
+ v8::Handle<v8::ArrayBuffer> ab =
+ Local<v8::ArrayBuffer>::Cast(CompileRun("ab"));
+
+ v8::Handle<v8::Uint8Array> u8a =
+ v8::Handle<v8::Uint8Array>::Cast(CompileRun("u8a"));
+ v8::Handle<v8::Uint8ClampedArray> u8c =
+ v8::Handle<v8::Uint8ClampedArray>::Cast(CompileRun("u8c"));
+ v8::Handle<v8::Int8Array> i8a =
+ v8::Handle<v8::Int8Array>::Cast(CompileRun("i8a"));
+
+ v8::Handle<v8::Uint16Array> u16a =
+ v8::Handle<v8::Uint16Array>::Cast(CompileRun("u16a"));
+ v8::Handle<v8::Int16Array> i16a =
+ v8::Handle<v8::Int16Array>::Cast(CompileRun("i16a"));
+ v8::Handle<v8::Uint32Array> u32a =
+ v8::Handle<v8::Uint32Array>::Cast(CompileRun("u32a"));
+ v8::Handle<v8::Int32Array> i32a =
+ v8::Handle<v8::Int32Array>::Cast(CompileRun("i32a"));
+ v8::Handle<v8::Float32Array> f32a =
+ v8::Handle<v8::Float32Array>::Cast(CompileRun("f32a"));
+ v8::Handle<v8::Float64Array> f64a =
+ v8::Handle<v8::Float64Array>::Cast(CompileRun("f64a"));
ScopedArrayBufferContents contents(ab->Externalize());
ab->Neuter();
}
+static UniqueId MakeUniqueId(const Persistent<Value>& p) {
+ return UniqueId(reinterpret_cast<uintptr_t>(*v8::Utils::OpenPersistent(p)));
+}
+
+
THREADED_TEST(ApiObjectGroups) {
LocalContext env;
v8::Isolate* iso = env->GetIsolate();
{
HandleScope scope(iso);
CHECK(Local<Object>::New(iso, g1s2.As<Object>())->
- Set(0, Local<Value>(*g2s2)));
+ Set(0, Local<Value>::New(iso, g2s2)));
CHECK(Local<Object>::New(iso, g2s1.As<Object>())->
- Set(0, Local<Value>(*g1s1)));
+ Set(0, Local<Value>::New(iso, g1s1)));
}
{
- UniqueId id1(reinterpret_cast<intptr_t>(*g1s1));
- UniqueId id2(reinterpret_cast<intptr_t>(*g2s2));
+ UniqueId id1 = MakeUniqueId(g1s1);
+ UniqueId id2 = MakeUniqueId(g2s2);
iso->SetObjectGroupId(g1s1, id1);
iso->SetObjectGroupId(g1s2, id1);
iso->SetReferenceFromGroup(id1, g1c1);
// Groups are deleted, rebuild groups.
{
- UniqueId id1(reinterpret_cast<intptr_t>(*g1s1));
- UniqueId id2(reinterpret_cast<intptr_t>(*g2s2));
+ UniqueId id1 = MakeUniqueId(g1s1);
+ UniqueId id2 = MakeUniqueId(g2s2);
iso->SetObjectGroupId(g1s1, id1);
iso->SetObjectGroupId(g1s2, id1);
iso->SetReferenceFromGroup(id1, g1c1);
// G1: { g1s1, g2s1 }, g1s1 implicitly references g2s1, ditto for other
// groups.
{
- UniqueId id1(reinterpret_cast<intptr_t>(*g1s1));
- UniqueId id2(reinterpret_cast<intptr_t>(*g2s1));
- UniqueId id3(reinterpret_cast<intptr_t>(*g3s1));
- UniqueId id4(reinterpret_cast<intptr_t>(*g4s1));
+ UniqueId id1 = MakeUniqueId(g1s1);
+ UniqueId id2 = MakeUniqueId(g2s1);
+ UniqueId id3 = MakeUniqueId(g3s1);
+ UniqueId id4 = MakeUniqueId(g4s1);
iso->SetObjectGroupId(g1s1, id1);
iso->SetObjectGroupId(g1s2, id1);
iso->SetReferenceFromGroup(id1, g2s1);
// Groups are deleted, rebuild groups.
{
- UniqueId id1(reinterpret_cast<intptr_t>(*g1s1));
- UniqueId id2(reinterpret_cast<intptr_t>(*g2s1));
- UniqueId id3(reinterpret_cast<intptr_t>(*g3s1));
- UniqueId id4(reinterpret_cast<intptr_t>(*g4s1));
+ UniqueId id1 = MakeUniqueId(g1s1);
+ UniqueId id2 = MakeUniqueId(g2s1);
+ UniqueId id3 = MakeUniqueId(g3s1);
+ UniqueId id4 = MakeUniqueId(g4s1);
iso->SetObjectGroupId(g1s1, id1);
iso->SetObjectGroupId(g1s2, id1);
iso->SetReferenceFromGroup(id1, g2s1);
g3s2.MarkPartiallyDependent(iso);
iso->SetObjectGroupId(g1s1, UniqueId(1));
iso->SetObjectGroupId(g1s2, UniqueId(1));
- Local<Object>::New(iso, g1s1.As<Object>())->Set(v8_str("x"),
- Local<Value>(*g2s1));
+ Local<Object>::New(iso, g1s1.As<Object>())->Set(
+ v8_str("x"), Local<Value>::New(iso, g2s1));
iso->SetObjectGroupId(g2s1, UniqueId(2));
iso->SetObjectGroupId(g2s2, UniqueId(2));
- Local<Object>::New(iso, g2s1.As<Object>())->Set(v8_str("x"),
- Local<Value>(*g3s1));
+ Local<Object>::New(iso, g2s1.As<Object>())->Set(
+ v8_str("x"), Local<Value>::New(iso, g3s1));
iso->SetObjectGroupId(g3s1, UniqueId(3));
iso->SetObjectGroupId(g3s2, UniqueId(3));
- Local<Object>::New(iso, g3s1.As<Object>())->Set(v8_str("x"),
- Local<Value>(*g1s1));
+ Local<Object>::New(iso, g3s1.As<Object>())->Set(
+ v8_str("x"), Local<Value>::New(iso, g1s1));
}
v8::internal::Heap* heap = reinterpret_cast<v8::internal::Isolate*>(
g3s2.MarkPartiallyDependent(isolate);
iso->SetObjectGroupId(g1s1, UniqueId(1));
iso->SetObjectGroupId(g1s2, UniqueId(1));
- Local<Object>::New(iso, g1s1.As<Object>())->Set(v8_str("x"),
- Local<Value>(*g2s1));
+ Local<Object>::New(iso, g1s1.As<Object>())->Set(
+ v8_str("x"), Local<Value>::New(iso, g2s1));
iso->SetObjectGroupId(g2s1, UniqueId(2));
iso->SetObjectGroupId(g2s2, UniqueId(2));
- Local<Object>::New(iso, g2s1.As<Object>())->Set(v8_str("x"),
- Local<Value>(*g3s1));
+ Local<Object>::New(iso, g2s1.As<Object>())->Set(
+ v8_str("x"), Local<Value>::New(iso, g3s1));
iso->SetObjectGroupId(g3s1, UniqueId(3));
iso->SetObjectGroupId(g3s2, UniqueId(3));
- Local<Object>::New(iso, g3s1.As<Object>())->Set(v8_str("x"),
- Local<Value>(*g1s1));
+ Local<Object>::New(iso, g3s1.As<Object>())->Set(
+ v8_str("x"), Local<Value>::New(iso, g1s1));
}
heap->CollectGarbage(i::NEW_SPACE);
for (int i = 0; i < 10; i++) {
CHECK(xValue.IsEmpty());
script->Run();
- CHECK_EQ(v8_num(4), Handle<Value>(*xValue));
+ CHECK_EQ(v8_num(4), Local<Value>::New(v8::Isolate::GetCurrent(), xValue));
xValue.Dispose(context->GetIsolate());
xValue.Clear();
}
for (int i = 0; i < 10; i++) {
CHECK(xValue.IsEmpty());
script->Run();
- CHECK_EQ(v8_num(4), Handle<Value>(*xValue));
+ CHECK_EQ(v8_num(4), Local<Value>::New(v8::Isolate::GetCurrent(), xValue));
xValue.Dispose(context->GetIsolate());
xValue.Clear();
}
"for(i = 0; i < 80000; i++) { keys[i] = i; };"
"keys.length = 25; keys;"));
Local<Value> result = indexed_property_names_script->Run();
- return Local<v8::Array>(::v8::Array::Cast(*result));
+ return Local<v8::Array>::Cast(result);
}
"}"
"keys = f(0, 1, 2, 3);"
"keys;"));
- Local<Value> result = indexed_property_names_script->Run();
- return Local<v8::Array>(static_cast<v8::Array*>(::v8::Object::Cast(*result)));
+ Local<Object> result =
+ Local<Object>::Cast(indexed_property_names_script->Run());
+ return *reinterpret_cast<Local<v8::Array>*>(&result);
}
~Whammy() { script_.Dispose(isolate_); }
v8::Handle<Script> getScript() {
if (script_.IsEmpty()) script_.Reset(isolate_, v8_compile("({}).blammo"));
- return Local<Script>(*script_);
+ return Local<Script>::New(isolate_, script_);
}
public:
Local<Value> s2 = global->Get(v8_str("sym2"));
Local<Value> s3 = global->Get(v8_str("sym3"));
Local<Value> s4 = global->Get(v8_str("sym4"));
- CHECK(SameSymbol(sym0, Handle<String>(String::Cast(*s0))));
- CHECK(SameSymbol(sym0b, Handle<String>(String::Cast(*s0b))));
- CHECK(SameSymbol(sym1, Handle<String>(String::Cast(*s1))));
- CHECK(SameSymbol(sym2, Handle<String>(String::Cast(*s2))));
- CHECK(SameSymbol(sym3, Handle<String>(String::Cast(*s3))));
- CHECK(SameSymbol(sym4, Handle<String>(String::Cast(*s4))));
+ CHECK(SameSymbol(sym0, Handle<String>::Cast(s0)));
+ CHECK(SameSymbol(sym0b, Handle<String>::Cast(s0b)));
+ CHECK(SameSymbol(sym1, Handle<String>::Cast(s1)));
+ CHECK(SameSymbol(sym2, Handle<String>::Cast(s2)));
+ CHECK(SameSymbol(sym3, Handle<String>::Cast(s3)));
+ CHECK(SameSymbol(sym4, Handle<String>::Cast(s4)));
}
v8::Persistent<v8::Value>* handle,
void*) {
v8::HandleScope scope(isolate);
- v8::Persistent<v8::Object>::New(isolate, v8::Object::New());
+ v8::Persistent<v8::Object>(isolate, v8::Object::New());
handle->Dispose(isolate);
}
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
Local<Value> set_value = CompileRun("new Set();");
- Local<Object> set_object(Object::Cast(*set_value));
+ Local<Object> set_object(Local<Object>::Cast(set_value));
CHECK_EQ(0, set_object->InternalFieldCount());
Local<Value> map_value = CompileRun("new Map();");
- Local<Object> map_object(Object::Cast(*map_value));
+ Local<Object> map_object(Local<Object>::Cast(map_value));
CHECK_EQ(0, map_object->InternalFieldCount());
}
inline ~DebugLocalContext() {
context_->Exit();
}
+ inline v8::Local<v8::Context> context() { return context_; }
inline v8::Context* operator->() { return *context_; }
inline v8::Context* operator*() { return *context_; }
inline bool IsReady() { return !context_.IsEmpty(); }
// Check whether the exception was uncaught.
v8::Local<v8::String> fun_name = v8::String::New("uncaught");
v8::Local<v8::Function> fun =
- v8::Function::Cast(*event_data->Get(fun_name));
- v8::Local<v8::Value> result = *fun->Call(event_data, 0, NULL);
+ v8::Local<v8::Function>::Cast(event_data->Get(fun_name));
+ v8::Local<v8::Value> result = fun->Call(event_data, 0, NULL);
if (result->IsTrue()) {
uncaught_exception_hit_count++;
}
// Enter and run function in the context.
{
v8::Context::Scope context_scope(context_1);
- expected_context = v8::Local<v8::Context>(*context_1);
+ expected_context = context_1;
expected_context_data = data_1;
v8::Local<v8::Function> f = CompileFunction(source, "f");
f->Call(context_1->Global(), 0, NULL);
if (event == v8::Break) {
break_point_hit_count++;
CHECK(debugger_context == v8::Context::GetCurrent());
- v8::Handle<v8::Function> func(v8::Function::Cast(*CompileRun(
+ v8::Handle<v8::Function> func = v8::Handle<v8::Function>::Cast(CompileRun(
"(function(exec_state) {\n"
" return (exec_state.frame(0).argumentValue(0).property('a').\n"
" value().value() == 1);\n"
- "})")));
+ "})"));
const int argc = 1;
v8::Handle<v8::Value> argv[argc] = { exec_state };
v8::Handle<v8::Value> result = func->Call(exec_state, argc, argv);
// Save handles to the debugger and debugee contexts to be used in
// NamedGetterWithCallingContextCheck.
- debugee_context = v8::Local<v8::Context>(*env);
+ debugee_context = env.context();
debugger_context = v8::Utils::ToLocal(debug->debug_context());
// Create object with 'a' property accessor.
CreateConstructor(context, "Accessible", internal_field, "x", descriptor);
// Setup object.
CompileRun("var accessible = new Accessible();");
- v8::Local<v8::Object> obj(
- v8::Object::Cast(*context->Global()->Get(v8_str("accessible"))));
+ v8::Local<v8::Object> obj = v8::Local<v8::Object>::Cast(
+ context->Global()->Get(v8_str("accessible")));
obj->SetAlignedPointerInInternalField(internal_field, internal_object);
bool added_accessor;
added_accessor = obj->SetAccessor(v8_str("y"), descriptor);
TEST(StrictUndeclaredGlobalVariable) {
HandleScope scope(Isolate::GetCurrent());
v8::Local<v8::String> var_name = v8_str("x");
- v8::LocalContext context;
+ LocalContext context;
v8::TryCatch try_catch;
v8::Local<v8::Script> script = v8_compile("\"use strict\"; x = 42;");
v8::Handle<v8::Object> proto = v8::Object::New();
v8::FunctionTemplate::New());
obj->SetClassName(v8_str("Obj"));
v8::Handle<v8::ObjectTemplate> proto = obj->PrototypeTemplate();
- v8::Local<v8::Signature> signature =
- v8::Signature::New(v8::Handle<v8::FunctionTemplate>(*obj));
+ v8::Local<v8::Signature> signature = v8::Signature::New(obj);
proto->Set(v8_str("method1"),
v8::FunctionTemplate::New(ObjMethod1,
v8::Handle<v8::Value>(),
TEST(PerIsolateState) {
HarmonyIsolate isolate;
HandleScope scope(isolate.GetIsolate());
- v8::LocalContext context1;
+ LocalContext context1;
CompileRun(
"var count = 0;"
"var calls = 0;"
"(function() { obj.foo = 'bar'; })");
Handle<Value> notify_fun2;
{
- v8::LocalContext context2;
+ LocalContext context2;
context2->Global()->Set(String::New("obj"), obj);
notify_fun2 = CompileRun(
"(function() { obj.foo = 'baz'; })");
}
Handle<Value> notify_fun3;
{
- v8::LocalContext context3;
+ LocalContext context3;
context3->Global()->Set(String::New("obj"), obj);
notify_fun3 = CompileRun(
"(function() { obj.foo = 'bat'; })");
}
{
- v8::LocalContext context4;
+ LocalContext context4;
context4->Global()->Set(String::New("observer"), observer);
context4->Global()->Set(String::New("fun1"), notify_fun1);
context4->Global()->Set(String::New("fun2"), notify_fun2);
TEST(EndOfMicrotaskDelivery) {
HarmonyIsolate isolate;
HandleScope scope(isolate.GetIsolate());
- v8::LocalContext context;
+ LocalContext context;
CompileRun(
"var obj = {};"
"var count = 0;"
TEST(DeliveryOrdering) {
HarmonyIsolate isolate;
HandleScope scope(isolate.GetIsolate());
- v8::LocalContext context;
+ LocalContext context;
CompileRun(
"var obj1 = {};"
"var obj2 = {};"
TEST(DeliveryOrderingReentrant) {
HarmonyIsolate isolate;
HandleScope scope(isolate.GetIsolate());
- v8::LocalContext context;
+ LocalContext context;
CompileRun(
"var obj = {};"
"var reentered = false;"
TEST(DeliveryOrderingDeliverChangeRecords) {
HarmonyIsolate isolate;
HandleScope scope(isolate.GetIsolate());
- v8::LocalContext context;
+ LocalContext context;
CompileRun(
"var obj = {};"
"var ordering = [];"
HarmonyIsolate isolate;
HandleScope scope(isolate.GetIsolate());
// Initializing this context sets up initial hash tables.
- v8::LocalContext context;
+ LocalContext context;
Handle<Value> obj = CompileRun("obj = {};");
Handle<Value> observer = CompileRun(
"var ran = false;"
"(function() { ran = true })");
{
// As does initializing this context.
- v8::LocalContext context2;
+ LocalContext context2;
context2->Global()->Set(String::New("obj"), obj);
context2->Global()->Set(String::New("observer"), observer);
CompileRun(
TEST(GlobalObjectObservation) {
HarmonyIsolate isolate;
- v8::LocalContext context;
+ LocalContext context;
HandleScope scope(isolate.GetIsolate());
Handle<Object> global_proxy = context->Global();
Handle<Object> inner_global = global_proxy->GetPrototype().As<Object>();
// to the old context.
context->DetachGlobal();
{
- v8::LocalContext context2;
+ LocalContext context2;
context2->DetachGlobal();
context2->ReattachGlobal(global_proxy);
CompileRun(
// Attaching by passing to Context::New
{
// Delegates to Context::New
- v8::LocalContext context3(NULL, Handle<ObjectTemplate>(), global_proxy);
+ LocalContext context3(NULL, Handle<ObjectTemplate>(), global_proxy);
CompileRun(
"var records3 = [];"
"Object.observe(this, function(r) { [].push.apply(records3, r) });"
TEST(APITestBasicMutation) {
HarmonyIsolate isolate;
HandleScope scope(isolate.GetIsolate());
- v8::LocalContext context;
+ LocalContext context;
Handle<Object> obj = Handle<Object>::Cast(CompileRun(
"var records = [];"
"var obj = {};"
TEST(HiddenPrototypeObservation) {
HarmonyIsolate isolate;
HandleScope scope(isolate.GetIsolate());
- v8::LocalContext context;
+ LocalContext context;
Handle<FunctionTemplate> tmpl = FunctionTemplate::New();
tmpl->SetHiddenPrototype(true);
tmpl->InstanceTemplate()->Set(String::New("foo"), Number::New(75));
TEST(ObservationWeakMap) {
HarmonyIsolate isolate;
HandleScope scope(isolate.GetIsolate());
- v8::LocalContext context;
+ LocalContext context;
CompileRun(
"var obj = {};"
"Object.observe(obj, function(){});"
v8::Local<v8::Context>::New(v8_isolate, env)->Exit();
}
- Object* raw_context = *(v8::Utils::OpenHandle(*env));
+ i::Object* raw_context = *v8::Utils::OpenPersistent(env);
env.Dispose(v8_isolate);
CompileRun("var ab1 = new ArrayBuffer(256);"
"var ab2 = new ArrayBuffer(256);"
"var ab3 = new ArrayBuffer(256);");
- v8::Handle<v8::ArrayBuffer> ab1(
- v8::ArrayBuffer::Cast(*CompileRun("ab1")));
- v8::Handle<v8::ArrayBuffer> ab2(
- v8::ArrayBuffer::Cast(*CompileRun("ab2")));
- v8::Handle<v8::ArrayBuffer> ab3(
- v8::ArrayBuffer::Cast(*CompileRun("ab3")));
+ v8::Handle<v8::ArrayBuffer> ab1 =
+ v8::Handle<v8::ArrayBuffer>::Cast(CompileRun("ab1"));
+ v8::Handle<v8::ArrayBuffer> ab2 =
+ v8::Handle<v8::ArrayBuffer>::Cast(CompileRun("ab2"));
+ v8::Handle<v8::ArrayBuffer> ab3 =
+ v8::Handle<v8::ArrayBuffer>::Cast(CompileRun("ab3"));
CHECK_EQ(3, CountArrayBuffersInWeakList(isolate->heap()));
CHECK(HasArrayBufferInWeakList(isolate->heap(),
for (int j = 1; j <= 3; j++) {
if (j == i) continue;
i::OS::SNPrintF(source, "ab%d", j);
- v8::Handle<v8::ArrayBuffer> ab(
- v8::ArrayBuffer::Cast(*CompileRun(source.start())));
+ v8::Handle<v8::ArrayBuffer> ab =
+ v8::Handle<v8::ArrayBuffer>::Cast(CompileRun(source.start()));
CHECK(HasArrayBufferInWeakList(isolate->heap(),
*v8::Utils::OpenHandle(*ab)));
}
constructor, constructor, constructor);
CompileRun(source.start());
- v8::Handle<v8::ArrayBuffer> ab(v8::ArrayBuffer::Cast(*CompileRun("ab")));
- v8::Handle<TypedArray> ta1(TypedArray::Cast(*CompileRun("ta1")));
- v8::Handle<TypedArray> ta2(TypedArray::Cast(*CompileRun("ta2")));
- v8::Handle<TypedArray> ta3(TypedArray::Cast(*CompileRun("ta3")));
+ v8::Handle<v8::ArrayBuffer> ab =
+ v8::Handle<v8::ArrayBuffer>::Cast(CompileRun("ab"));
+ v8::Handle<TypedArray> ta1 =
+ v8::Handle<TypedArray>::Cast(CompileRun("ta1"));
+ v8::Handle<TypedArray> ta2 =
+ v8::Handle<TypedArray>::Cast(CompileRun("ta2"));
+ v8::Handle<TypedArray> ta3 =
+ v8::Handle<TypedArray>::Cast(CompileRun("ta3"));
CHECK_EQ(1, CountArrayBuffersInWeakList(isolate->heap()));
Handle<JSArrayBuffer> iab = v8::Utils::OpenHandle(*ab);
CHECK_EQ(3, CountTypedArrays(*iab));
{
v8::HandleScope s2(context->GetIsolate());
- v8::Handle<v8::ArrayBuffer> ab(v8::ArrayBuffer::Cast(*CompileRun("ab")));
+ v8::Handle<v8::ArrayBuffer> ab =
+ v8::Handle<v8::ArrayBuffer>::Cast(CompileRun("ab"));
Handle<JSArrayBuffer> iab = v8::Utils::OpenHandle(*ab);
CHECK_EQ(2, CountTypedArrays(*iab));
for (int j = 1; j <= 3; j++) {
if (j == i) continue;
i::OS::SNPrintF(source, "ta%d", j);
- v8::Handle<TypedArray> ta(
- TypedArray::Cast(*CompileRun(source.start())));
+ v8::Handle<TypedArray> ta =
+ v8::Handle<TypedArray>::Cast(CompileRun(source.start()));
CHECK(HasTypedArrayInWeakList(*iab, *v8::Utils::OpenHandle(*ta)));
}
}
{
v8::HandleScope s3(context->GetIsolate());
- v8::Handle<v8::ArrayBuffer> ab(v8::ArrayBuffer::Cast(*CompileRun("ab")));
+ v8::Handle<v8::ArrayBuffer> ab =
+ v8::Handle<v8::ArrayBuffer>::Cast(CompileRun("ab"));
Handle<JSArrayBuffer> iab = v8::Utils::OpenHandle(*ab);
CHECK_EQ(0, CountTypedArrays(*iab));
}