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

Unified Diff: src/api.cc

Issue 6730031: Get rid of more TLS fetches in API implementation. (Closed)
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index ed773cfe781d668864aa1892ab77599fc3db9225..0a7da7d74015c952ef71380634d93dd4aa1d17b0 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -55,14 +55,14 @@
// TODO(isolates): avoid repeated TLS reads in function prologues.
#ifdef ENABLE_VMSTATE_TRACKING
-#define ENTER_V8 \
- ASSERT(i::Isolate::Current()->IsInitialized()); \
- i::VMState __state__(i::Isolate::Current(), i::OTHER)
-#define LEAVE_V8 \
- i::VMState __state__(i::Isolate::Current(), i::EXTERNAL)
+#define ENTER_V8(isolate) \
+ ASSERT((isolate)->IsInitialized()); \
+ i::VMState __state__((isolate), i::OTHER)
+#define LEAVE_V8(isolate) \
+ i::VMState __state__((isolate), i::EXTERNAL)
#else
-#define ENTER_V8 ((void) 0)
-#define LEAVE_V8 ((void) 0)
+#define ENTER_V8(isolate) ((void) 0)
+#define LEAVE_V8(isolate) ((void) 0)
#endif
namespace v8 {
@@ -75,25 +75,25 @@ namespace v8 {
}
-#define EXCEPTION_PREAMBLE() \
- i::Isolate::Current()->handle_scope_implementer()->IncrementCallDepth(); \
- ASSERT(!i::Isolate::Current()->external_caught_exception()); \
+#define EXCEPTION_PREAMBLE(isolate) \
+ (isolate)->handle_scope_implementer()->IncrementCallDepth(); \
+ ASSERT(!(isolate)->external_caught_exception()); \
bool has_pending_exception = false
-#define EXCEPTION_BAILOUT_CHECK(value) \
+#define EXCEPTION_BAILOUT_CHECK(isolate, value) \
do { \
i::HandleScopeImplementer* handle_scope_implementer = \
- isolate->handle_scope_implementer(); \
+ (isolate)->handle_scope_implementer(); \
handle_scope_implementer->DecrementCallDepth(); \
if (has_pending_exception) { \
if (handle_scope_implementer->CallDepthIsZero() && \
- i::Isolate::Current()->is_out_of_memory()) { \
+ (isolate)->is_out_of_memory()) { \
if (!handle_scope_implementer->ignore_out_of_memory()) \
i::V8::FatalProcessOutOfMemory(NULL); \
} \
bool call_depth_is_zero = handle_scope_implementer->CallDepthIsZero(); \
- i::Isolate::Current()->OptionalRescheduleException(call_depth_is_zero); \
+ (isolate)->OptionalRescheduleException(call_depth_is_zero); \
return value; \
} \
} while (false)
@@ -191,11 +191,12 @@ void i::V8::FatalProcessOutOfMemory(const char* location, bool take_snapshot) {
heap_stats.os_error = &os_error;
int end_marker;
heap_stats.end_marker = &end_marker;
- HEAP->RecordStats(&heap_stats, take_snapshot);
+ i::Isolate* isolate = i::Isolate::Current();
+ isolate->heap()->RecordStats(&heap_stats, take_snapshot);
i::V8::SetFatalError();
FatalErrorCallback callback = GetFatalErrorHandler();
{
- LEAVE_V8;
+ LEAVE_V8(isolate);
callback(location, "Allocation failed - process out of memory");
}
// If the callback returns, we stop execution.
@@ -282,11 +283,6 @@ static inline bool EnsureInitializedForIsolate(i::Isolate* isolate,
return ApiCheck(InitializeHelper(), location, "Error initializing V8");
}
-static inline bool EnsureInitialized(const char* location) {
- i::Isolate* isolate = i::Isolate::UncheckedCurrent();
- return EnsureInitializedForIsolate(isolate, location);
-}
-
// Some initializing API functions are called early and may be
// called on a thread different from static initializer thread.
// If Isolate API is used, Isolate::Enter() will initialize TLS so
@@ -320,8 +316,12 @@ void ImplementationUtilities::ZapHandleRange(i::Object** begin,
v8::Handle<v8::Primitive> ImplementationUtilities::Undefined() {
- if (!EnsureInitialized("v8::Undefined()")) return v8::Handle<v8::Primitive>();
- return v8::Handle<Primitive>(ToApi<Primitive>(FACTORY->undefined_value()));
+ i::Isolate* isolate = i::Isolate::Current();
+ if (!EnsureInitializedForIsolate(isolate, "v8::Undefined()")) {
+ return v8::Handle<v8::Primitive>();
+ }
+ return v8::Handle<Primitive>(ToApi<Primitive>(
+ isolate->factory()->undefined_value()));
}
@@ -335,14 +335,22 @@ v8::Handle<v8::Primitive> ImplementationUtilities::Null() {
v8::Handle<v8::Boolean> ImplementationUtilities::True() {
- if (!EnsureInitialized("v8::True()")) return v8::Handle<v8::Boolean>();
- return v8::Handle<v8::Boolean>(ToApi<Boolean>(FACTORY->true_value()));
+ i::Isolate* isolate = i::Isolate::Current();
+ if (!EnsureInitializedForIsolate(isolate, "v8::True()")) {
+ return v8::Handle<v8::Boolean>();
+ }
+ return v8::Handle<v8::Boolean>(ToApi<Boolean>(
+ isolate->factory()->true_value()));
}
v8::Handle<v8::Boolean> ImplementationUtilities::False() {
- if (!EnsureInitialized("v8::False()")) return v8::Handle<v8::Boolean>();
- return v8::Handle<v8::Boolean>(ToApi<Boolean>(FACTORY->false_value()));
+ i::Isolate* isolate = i::Isolate::Current();
+ if (!EnsureInitializedForIsolate(isolate, "v8::False()")) {
+ return v8::Handle<v8::Boolean>();
+ }
+ return v8::Handle<v8::Boolean>(ToApi<Boolean>(
+ isolate->factory()->false_value()));
}
void V8::SetFlagsFromString(const char* str, int length) {
@@ -360,7 +368,7 @@ v8::Handle<Value> ThrowException(v8::Handle<v8::Value> value) {
if (IsDeadCheck(isolate, "v8::ThrowException()")) {
return v8::Handle<Value>();
}
- ENTER_V8;
+ ENTER_V8(isolate);
// If we're passed an empty handle, we throw an undefined exception
// to deal more gracefully with out of memory situations.
if (value.IsEmpty()) {
@@ -550,7 +558,8 @@ void HandleScope::Leave() {
int HandleScope::NumberOfHandles() {
- EnsureInitialized("HandleScope::NumberOfHandles");
+ EnsureInitializedForIsolate(
+ i::Isolate::Current(), "HandleScope::NumberOfHandles");
return i::HandleScope::NumberOfHandles();
}
@@ -571,7 +580,8 @@ void Context::Enter() {
// TODO(isolates): Context should have a pointer to isolate.
i::Isolate* isolate = i::Isolate::Current();
if (IsDeadCheck(isolate, "v8::Context::Enter()")) return;
- ENTER_V8;
+ ENTER_V8(isolate);
+
i::Handle<i::Context> env = Utils::OpenHandle(this);
isolate->handle_scope_implementer()->EnterContext(env);
@@ -602,7 +612,7 @@ void Context::SetData(v8::Handle<String> data) {
// TODO(isolates): Context should have a pointer to isolate.
i::Isolate* isolate = i::Isolate::Current();
if (IsDeadCheck(isolate, "v8::Context::SetData()")) return;
- ENTER_V8;
+ ENTER_V8(isolate);
{
i::HandleScope scope(isolate);
i::Handle<i::Context> env = Utils::OpenHandle(this);
@@ -621,7 +631,7 @@ v8::Local<v8::Value> Context::GetData() {
if (IsDeadCheck(isolate, "v8::Context::GetData()")) {
return v8::Local<Value>();
}
- ENTER_V8;
+ ENTER_V8(isolate);
i::Object* raw_result = NULL;
{
i::HandleScope scope(isolate);
@@ -673,10 +683,11 @@ i::Object** v8::HandleScope::RawClose(i::Object** value) {
// NeanderObject constructor. When you add one to the site calling the
// constructor you should check that you ensured the VM was not dead first.
NeanderObject::NeanderObject(int size) {
- EnsureInitialized("v8::Nowhere");
- ENTER_V8;
- value_ = FACTORY->NewNeanderObject();
- i::Handle<i::FixedArray> elements = FACTORY->NewFixedArray(size);
+ i::Isolate* isolate = i::Isolate::Current();
+ EnsureInitializedForIsolate(isolate, "v8::Nowhere");
+ ENTER_V8(isolate);
+ value_ = isolate->factory()->NewNeanderObject();
+ i::Handle<i::FixedArray> elements = isolate->factory()->NewFixedArray(size);
value_->set_elements(*elements);
}
@@ -740,7 +751,7 @@ void Template::Set(v8::Handle<String> name, v8::Handle<Data> value,
v8::PropertyAttribute attribute) {
i::Isolate* isolate = i::Isolate::Current();
if (IsDeadCheck(isolate, "v8::Template::Set()")) return;
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::Object> list(Utils::OpenHandle(this)->property_list());
if (list->IsUndefined()) {
@@ -763,11 +774,11 @@ static void InitializeFunctionTemplate(
Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::FunctionTemplate::PrototypeTemplate()")) {
return Local<ObjectTemplate>();
}
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::Object> result(Utils::OpenHandle(this)->prototype_template());
if (result->IsUndefined()) {
result = Utils::OpenHandle(*ObjectTemplate::New());
@@ -778,9 +789,9 @@ Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() {
void FunctionTemplate::Inherit(v8::Handle<FunctionTemplate> value) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::FunctionTemplate::Inherit()")) return;
- ENTER_V8;
+ ENTER_V8(isolate);
Utils::OpenHandle(this)->set_parent_template(*Utils::OpenHandle(*value));
}
@@ -790,7 +801,7 @@ Local<FunctionTemplate> FunctionTemplate::New(InvocationCallback callback,
i::Isolate* isolate = i::Isolate::Current();
EnsureInitializedForIsolate(isolate, "v8::FunctionTemplate::New()");
LOG_API(isolate, "FunctionTemplate::New");
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::Struct> struct_obj =
isolate->factory()->NewStruct(i::FUNCTION_TEMPLATE_INFO_TYPE);
i::Handle<i::FunctionTemplateInfo> obj =
@@ -817,7 +828,7 @@ Local<Signature> Signature::New(Handle<FunctionTemplate> receiver,
i::Isolate* isolate = i::Isolate::Current();
EnsureInitializedForIsolate(isolate, "v8::Signature::New()");
LOG_API(isolate, "Signature::New");
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::Struct> struct_obj =
isolate->factory()->NewStruct(i::SIGNATURE_INFO_TYPE);
i::Handle<i::SignatureInfo> obj =
@@ -845,7 +856,7 @@ Local<TypeSwitch> TypeSwitch::New(int argc, Handle<FunctionTemplate> types[]) {
i::Isolate* isolate = i::Isolate::Current();
EnsureInitializedForIsolate(isolate, "v8::TypeSwitch::New()");
LOG_API(isolate, "TypeSwitch::New");
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::FixedArray> vector = isolate->factory()->NewFixedArray(argc);
for (int i = 0; i < argc; i++)
vector->set(i, *Utils::OpenHandle(*types[i]));
@@ -880,9 +891,9 @@ int TypeSwitch::match(v8::Handle<Value> value) {
void FunctionTemplate::SetCallHandler(InvocationCallback callback,
v8::Handle<Value> data) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::FunctionTemplate::SetCallHandler()")) return;
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::Struct> struct_obj =
isolate->factory()->NewStruct(i::CALL_HANDLER_INFO_TYPE);
@@ -924,12 +935,12 @@ void FunctionTemplate::AddInstancePropertyAccessor(
v8::Handle<Value> data,
v8::AccessControl settings,
v8::PropertyAttribute attributes) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate,
"v8::FunctionTemplate::AddInstancePropertyAccessor()")) {
return;
}
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::AccessorInfo> obj = MakeAccessorInfo(name,
@@ -946,11 +957,11 @@ void FunctionTemplate::AddInstancePropertyAccessor(
Local<ObjectTemplate> FunctionTemplate::InstanceTemplate() {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::FunctionTemplate::InstanceTemplate()")
|| EmptyCheck("v8::FunctionTemplate::InstanceTemplate()", this))
return Local<ObjectTemplate>();
- ENTER_V8;
+ ENTER_V8(isolate);
if (Utils::OpenHandle(this)->instance_template()->IsUndefined()) {
Local<ObjectTemplate> templ =
ObjectTemplate::New(v8::Handle<FunctionTemplate>(this));
@@ -963,19 +974,19 @@ Local<ObjectTemplate> FunctionTemplate::InstanceTemplate() {
void FunctionTemplate::SetClassName(Handle<String> name) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::FunctionTemplate::SetClassName()")) return;
- ENTER_V8;
+ ENTER_V8(isolate);
Utils::OpenHandle(this)->set_class_name(*Utils::OpenHandle(*name));
}
void FunctionTemplate::SetHiddenPrototype(bool value) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::FunctionTemplate::SetHiddenPrototype()")) {
return;
}
- ENTER_V8;
+ ENTER_V8(isolate);
Utils::OpenHandle(this)->set_hidden_prototype(value);
}
@@ -987,12 +998,12 @@ void FunctionTemplate::SetNamedInstancePropertyHandler(
NamedPropertyDeleter remover,
NamedPropertyEnumerator enumerator,
Handle<Value> data) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate,
"v8::FunctionTemplate::SetNamedInstancePropertyHandler()")) {
return;
}
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::Struct> struct_obj =
isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE);
@@ -1018,12 +1029,12 @@ void FunctionTemplate::SetIndexedInstancePropertyHandler(
IndexedPropertyDeleter remover,
IndexedPropertyEnumerator enumerator,
Handle<Value> data) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate,
"v8::FunctionTemplate::SetIndexedInstancePropertyHandler()")) {
return;
}
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::Struct> struct_obj =
isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE);
@@ -1045,12 +1056,12 @@ void FunctionTemplate::SetIndexedInstancePropertyHandler(
void FunctionTemplate::SetInstanceCallAsFunctionHandler(
InvocationCallback callback,
Handle<Value> data) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate,
"v8::FunctionTemplate::SetInstanceCallAsFunctionHandler()")) {
return;
}
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::Struct> struct_obj =
isolate->factory()->NewStruct(i::CALL_HANDLER_INFO_TYPE);
@@ -1079,9 +1090,9 @@ Local<ObjectTemplate> ObjectTemplate::New(
}
EnsureInitializedForIsolate(isolate, "v8::ObjectTemplate::New()");
LOG_API(isolate, "ObjectTemplate::New");
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::Struct> struct_obj =
- isolate->factory()->NewStruct(i::OBJECT_TEMPLATE_INFO_TYPE);
+ isolate->factory()->NewStruct(i::OBJECT_TEMPLATE_INFO_TYPE);
i::Handle<i::ObjectTemplateInfo> obj =
i::Handle<i::ObjectTemplateInfo>::cast(struct_obj);
InitializeTemplate(obj, Consts::OBJECT_TEMPLATE);
@@ -1110,9 +1121,9 @@ void ObjectTemplate::SetAccessor(v8::Handle<String> name,
v8::Handle<Value> data,
AccessControl settings,
PropertyAttribute attribute) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::ObjectTemplate::SetAccessor()")) return;
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
EnsureConstructor(this);
i::FunctionTemplateInfo* constructor =
@@ -1133,12 +1144,12 @@ void ObjectTemplate::SetNamedPropertyHandler(NamedPropertyGetter getter,
NamedPropertyDeleter remover,
NamedPropertyEnumerator enumerator,
Handle<Value> data) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::ObjectTemplate::SetNamedPropertyHandler()")) {
return;
}
- ENTER_V8;
- HandleScope scope;
+ ENTER_V8(isolate);
+ i::HandleScope scope(isolate);
EnsureConstructor(this);
i::FunctionTemplateInfo* constructor =
i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor());
@@ -1153,9 +1164,9 @@ void ObjectTemplate::SetNamedPropertyHandler(NamedPropertyGetter getter,
void ObjectTemplate::MarkAsUndetectable() {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::ObjectTemplate::MarkAsUndetectable()")) return;
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
EnsureConstructor(this);
i::FunctionTemplateInfo* constructor =
@@ -1170,11 +1181,11 @@ void ObjectTemplate::SetAccessCheckCallbacks(
IndexedSecurityCallback indexed_callback,
Handle<Value> data,
bool turned_on_by_default) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::ObjectTemplate::SetAccessCheckCallbacks()")) {
return;
}
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
EnsureConstructor(this);
@@ -1204,11 +1215,11 @@ void ObjectTemplate::SetIndexedPropertyHandler(
IndexedPropertyDeleter remover,
IndexedPropertyEnumerator enumerator,
Handle<Value> data) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::ObjectTemplate::SetIndexedPropertyHandler()")) {
return;
}
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
EnsureConstructor(this);
i::FunctionTemplateInfo* constructor =
@@ -1225,12 +1236,12 @@ void ObjectTemplate::SetIndexedPropertyHandler(
void ObjectTemplate::SetCallAsFunctionHandler(InvocationCallback callback,
Handle<Value> data) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate,
"v8::ObjectTemplate::SetCallAsFunctionHandler()")) {
return;
}
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
EnsureConstructor(this);
i::FunctionTemplateInfo* constructor =
@@ -1241,7 +1252,7 @@ void ObjectTemplate::SetCallAsFunctionHandler(InvocationCallback callback,
int ObjectTemplate::InternalFieldCount() {
- if (IsDeadCheck(i::Isolate::Current(),
+ if (IsDeadCheck(Utils::OpenHandle(this)->GetIsolate(),
"v8::ObjectTemplate::InternalFieldCount()")) {
return 0;
}
@@ -1250,7 +1261,7 @@ int ObjectTemplate::InternalFieldCount() {
void ObjectTemplate::SetInternalFieldCount(int value) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::ObjectTemplate::SetInternalFieldCount()")) {
return;
}
@@ -1259,7 +1270,7 @@ void ObjectTemplate::SetInternalFieldCount(int value) {
"Invalid internal field count")) {
return;
}
- ENTER_V8;
+ ENTER_V8(isolate);
if (value > 0) {
// The internal field count is set by the constructor function's
// construct code, so we ensure that there is a constructor
@@ -1324,7 +1335,7 @@ Local<Script> Script::New(v8::Handle<String> source,
i::Isolate* isolate = i::Isolate::Current();
ON_BAILOUT(isolate, "v8::Script::New()", return Local<Script>());
LOG_API(isolate, "Script::New");
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::String> str = Utils::OpenHandle(*source);
i::Handle<i::Object> name_obj;
int line_offset = 0;
@@ -1340,7 +1351,7 @@ Local<Script> Script::New(v8::Handle<String> source,
column_offset = static_cast<int>(origin->ResourceColumnOffset()->Value());
}
}
- EXCEPTION_PREAMBLE();
+ EXCEPTION_PREAMBLE(isolate);
i::ScriptDataImpl* pre_data_impl = static_cast<i::ScriptDataImpl*>(pre_data);
// We assert that the pre-data is sane, even though we can actually
// handle it if it turns out not to be in release mode.
@@ -1359,7 +1370,7 @@ Local<Script> Script::New(v8::Handle<String> source,
Utils::OpenHandle(*script_data),
i::NOT_NATIVES_CODE);
has_pending_exception = result.is_null();
- EXCEPTION_BAILOUT_CHECK(Local<Script>());
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<Script>());
return Local<Script>(ToApi<Script>(result));
}
@@ -1378,7 +1389,7 @@ Local<Script> Script::Compile(v8::Handle<String> source,
i::Isolate* isolate = i::Isolate::Current();
ON_BAILOUT(isolate, "v8::Script::Compile()", return Local<Script>());
LOG_API(isolate, "Script::Compile");
- ENTER_V8;
+ ENTER_V8(isolate);
Local<Script> generic = New(source, origin, pre_data, script_data);
if (generic.IsEmpty())
return generic;
@@ -1405,29 +1416,29 @@ Local<Value> Script::Run() {
i::Isolate* isolate = i::Isolate::Current();
ON_BAILOUT(isolate, "v8::Script::Run()", return Local<Value>());
LOG_API(isolate, "Script::Run");
- ENTER_V8;
+ ENTER_V8(isolate);
i::Object* raw_result = NULL;
{
- HandleScope scope;
+ i::HandleScope scope(isolate);
i::Handle<i::Object> obj = Utils::OpenHandle(this);
i::Handle<i::JSFunction> fun;
if (obj->IsSharedFunctionInfo()) {
i::Handle<i::SharedFunctionInfo>
- function_info(i::SharedFunctionInfo::cast(*obj));
+ function_info(i::SharedFunctionInfo::cast(*obj), isolate);
fun = isolate->factory()->NewFunctionFromSharedFunctionInfo(
function_info, isolate->global_context());
} else {
- fun = i::Handle<i::JSFunction>(i::JSFunction::cast(*obj));
+ fun = i::Handle<i::JSFunction>(i::JSFunction::cast(*obj), isolate);
}
- EXCEPTION_PREAMBLE();
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> receiver(
- isolate->context()->global_proxy());
+ isolate->context()->global_proxy(), isolate);
i::Handle<i::Object> result =
i::Execution::Call(fun, receiver, 0, NULL, &has_pending_exception);
- EXCEPTION_BAILOUT_CHECK(Local<Value>());
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
raw_result = *result;
}
- i::Handle<i::Object> result(raw_result);
+ i::Handle<i::Object> result(raw_result, isolate);
return Utils::ToLocal(result);
}
@@ -1579,9 +1590,9 @@ void v8::TryCatch::SetCaptureMessage(bool value) {
Local<String> Message::Get() const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Message::Get()", return Local<String>());
- ENTER_V8;
+ ENTER_V8(isolate);
HandleScope scope;
i::Handle<i::Object> obj = Utils::OpenHandle(this);
i::Handle<i::String> raw_result = i::MessageHandler::GetMessage(obj);
@@ -1591,11 +1602,11 @@ Local<String> Message::Get() const {
v8::Handle<Value> Message::GetScriptResourceName() const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::Message::GetScriptResourceName()")) {
return Local<String>();
}
- ENTER_V8;
+ ENTER_V8(isolate);
HandleScope scope;
i::Handle<i::JSMessageObject> message =
i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
@@ -1608,11 +1619,11 @@ v8::Handle<Value> Message::GetScriptResourceName() const {
v8::Handle<Value> Message::GetScriptData() const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::Message::GetScriptResourceData()")) {
return Local<Value>();
}
- ENTER_V8;
+ ENTER_V8(isolate);
HandleScope scope;
i::Handle<i::JSMessageObject> message =
i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
@@ -1625,11 +1636,11 @@ v8::Handle<Value> Message::GetScriptData() const {
v8::Handle<v8::StackTrace> Message::GetStackTrace() const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::Message::GetStackTrace()")) {
return Local<v8::StackTrace>();
}
- ENTER_V8;
+ ENTER_V8(isolate);
HandleScope scope;
i::Handle<i::JSMessageObject> message =
i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
@@ -1671,24 +1682,24 @@ static i::Handle<i::Object> CallV8HeapFunction(const char* name,
int Message::GetLineNumber() const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Message::GetLineNumber()", return kNoLineNumberInfo);
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
- EXCEPTION_PREAMBLE();
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> result = CallV8HeapFunction("GetLineNumber",
Utils::OpenHandle(this),
&has_pending_exception);
- EXCEPTION_BAILOUT_CHECK(0);
+ EXCEPTION_BAILOUT_CHECK(isolate, 0);
return static_cast<int>(result->Number());
}
int Message::GetStartPosition() const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::Message::GetStartPosition()")) return 0;
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::JSMessageObject> message =
i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
@@ -1697,9 +1708,9 @@ int Message::GetStartPosition() const {
int Message::GetEndPosition() const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::Message::GetEndPosition()")) return 0;
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::JSMessageObject> message =
i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
@@ -1708,35 +1719,35 @@ int Message::GetEndPosition() const {
int Message::GetStartColumn() const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::Message::GetStartColumn()")) {
return kNoColumnInfo;
}
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this);
- EXCEPTION_PREAMBLE();
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> start_col_obj = CallV8HeapFunction(
"GetPositionInLine",
data_obj,
&has_pending_exception);
- EXCEPTION_BAILOUT_CHECK(0);
+ EXCEPTION_BAILOUT_CHECK(isolate, 0);
return static_cast<int>(start_col_obj->Number());
}
int Message::GetEndColumn() const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::Message::GetEndColumn()")) return kNoColumnInfo;
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this);
- EXCEPTION_PREAMBLE();
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> start_col_obj = CallV8HeapFunction(
"GetPositionInLine",
data_obj,
&has_pending_exception);
- EXCEPTION_BAILOUT_CHECK(0);
+ EXCEPTION_BAILOUT_CHECK(isolate, 0);
i::Handle<i::JSMessageObject> message =
i::Handle<i::JSMessageObject>::cast(data_obj);
int start = message->start_position();
@@ -1746,15 +1757,15 @@ int Message::GetEndColumn() const {
Local<String> Message::GetSourceLine() const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Message::GetSourceLine()", return Local<String>());
- ENTER_V8;
+ ENTER_V8(isolate);
HandleScope scope;
- EXCEPTION_PREAMBLE();
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> result = CallV8HeapFunction("GetSourceLine",
Utils::OpenHandle(this),
&has_pending_exception);
- EXCEPTION_BAILOUT_CHECK(Local<v8::String>());
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::String>());
if (result->IsString()) {
return scope.Close(Utils::ToLocal(i::Handle<i::String>::cast(result)));
} else {
@@ -1766,7 +1777,7 @@ Local<String> Message::GetSourceLine() const {
void Message::PrintCurrentStackTrace(FILE* out) {
i::Isolate* isolate = i::Isolate::Current();
if (IsDeadCheck(isolate, "v8::Message::PrintCurrentStackTrace()")) return;
- ENTER_V8;
+ ENTER_V8(isolate);
isolate->PrintCurrentStackTrace(out);
}
@@ -1774,11 +1785,11 @@ void Message::PrintCurrentStackTrace(FILE* out) {
// --- S t a c k T r a c e ---
Local<StackFrame> StackTrace::GetFrame(uint32_t index) const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::StackTrace::GetFrame()")) {
return Local<StackFrame>();
}
- ENTER_V8;
+ ENTER_V8(isolate);
HandleScope scope;
i::Handle<i::JSArray> self = Utils::OpenHandle(this);
i::Object* raw_object = self->GetElementNoExceptionThrown(index);
@@ -1788,17 +1799,17 @@ Local<StackFrame> StackTrace::GetFrame(uint32_t index) const {
int StackTrace::GetFrameCount() const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::StackTrace::GetFrameCount()")) return -1;
- ENTER_V8;
+ ENTER_V8(isolate);
return i::Smi::cast(Utils::OpenHandle(this)->length())->value();
}
Local<Array> StackTrace::AsArray() {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::StackTrace::AsArray()")) Local<Array>();
- ENTER_V8;
+ ENTER_V8(isolate);
return Utils::ToLocal(Utils::OpenHandle(this));
}
@@ -1809,7 +1820,7 @@ Local<StackTrace> StackTrace::CurrentStackTrace(int frame_limit,
if (IsDeadCheck(isolate, "v8::StackTrace::CurrentStackTrace()")) {
Local<StackTrace>();
}
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::JSArray> stackTrace =
isolate->CaptureCurrentStackTrace(frame_limit, options);
return Utils::StackTraceToLocal(stackTrace);
@@ -1819,11 +1830,11 @@ Local<StackTrace> StackTrace::CurrentStackTrace(int frame_limit,
// --- S t a c k F r a m e ---
int StackFrame::GetLineNumber() const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::StackFrame::GetLineNumber()")) {
return Message::kNoLineNumberInfo;
}
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> line = GetProperty(self, "lineNumber");
@@ -1835,11 +1846,11 @@ int StackFrame::GetLineNumber() const {
int StackFrame::GetColumn() const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::StackFrame::GetColumn()")) {
return Message::kNoColumnInfo;
}
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> column = GetProperty(self, "column");
@@ -1851,11 +1862,11 @@ int StackFrame::GetColumn() const {
Local<String> StackFrame::GetScriptName() const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::StackFrame::GetScriptName()")) {
return Local<String>();
}
- ENTER_V8;
+ ENTER_V8(isolate);
HandleScope scope;
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> name = GetProperty(self, "scriptName");
@@ -1867,11 +1878,11 @@ Local<String> StackFrame::GetScriptName() const {
Local<String> StackFrame::GetScriptNameOrSourceURL() const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::StackFrame::GetScriptNameOrSourceURL()")) {
return Local<String>();
}
- ENTER_V8;
+ ENTER_V8(isolate);
HandleScope scope;
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> name = GetProperty(self, "scriptNameOrSourceURL");
@@ -1883,11 +1894,11 @@ Local<String> StackFrame::GetScriptNameOrSourceURL() const {
Local<String> StackFrame::GetFunctionName() const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::StackFrame::GetFunctionName()")) {
return Local<String>();
}
- ENTER_V8;
+ ENTER_V8(isolate);
HandleScope scope;
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> name = GetProperty(self, "functionName");
@@ -1899,9 +1910,9 @@ Local<String> StackFrame::GetFunctionName() const {
bool StackFrame::IsEval() const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::StackFrame::IsEval()")) return false;
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> is_eval = GetProperty(self, "isEval");
@@ -1910,9 +1921,9 @@ bool StackFrame::IsEval() const {
bool StackFrame::IsConstructor() const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::StackFrame::IsConstructor()")) return false;
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> is_constructor = GetProperty(self, "isConstructor");
@@ -2037,74 +2048,76 @@ bool Value::IsRegExp() const {
Local<String> Value::ToString() const {
- i::Isolate* isolate = i::Isolate::Current();
- if (IsDeadCheck(isolate, "v8::Value::ToString()")) {
- return Local<String>();
- }
- LOG_API(isolate, "ToString");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
i::Handle<i::Object> str;
if (obj->IsString()) {
str = obj;
} else {
- ENTER_V8;
- EXCEPTION_PREAMBLE();
+ i::Isolate* isolate = i::Isolate::Current();
+ if (IsDeadCheck(isolate, "v8::Value::ToString()")) {
+ return Local<String>();
+ }
+ LOG_API(isolate, "ToString");
+ ENTER_V8(isolate);
+ EXCEPTION_PREAMBLE(isolate);
str = i::Execution::ToString(obj, &has_pending_exception);
- EXCEPTION_BAILOUT_CHECK(Local<String>());
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<String>());
}
return Local<String>(ToApi<String>(str));
}
Local<String> Value::ToDetailString() const {
- i::Isolate* isolate = i::Isolate::Current();
- if (IsDeadCheck(isolate, "v8::Value::ToDetailString()")) {
- return Local<String>();
- }
- LOG_API(isolate, "ToDetailString");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
i::Handle<i::Object> str;
if (obj->IsString()) {
str = obj;
} else {
- ENTER_V8;
- EXCEPTION_PREAMBLE();
+ i::Isolate* isolate = i::Isolate::Current();
+ if (IsDeadCheck(isolate, "v8::Value::ToDetailString()")) {
+ return Local<String>();
+ }
+ LOG_API(isolate, "ToDetailString");
+ ENTER_V8(isolate);
+ EXCEPTION_PREAMBLE(isolate);
str = i::Execution::ToDetailString(obj, &has_pending_exception);
- EXCEPTION_BAILOUT_CHECK(Local<String>());
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<String>());
}
return Local<String>(ToApi<String>(str));
}
Local<v8::Object> Value::ToObject() const {
- i::Isolate* isolate = i::Isolate::Current();
- if (IsDeadCheck(isolate, "v8::Value::ToObject()")) return Local<v8::Object>();
- LOG_API(isolate, "ToObject");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
i::Handle<i::Object> val;
if (obj->IsJSObject()) {
val = obj;
} else {
- ENTER_V8;
- EXCEPTION_PREAMBLE();
+ i::Isolate* isolate = i::Isolate::Current();
+ if (IsDeadCheck(isolate, "v8::Value::ToObject()")) {
+ return Local<v8::Object>();
+ }
+ LOG_API(isolate, "ToObject");
+ ENTER_V8(isolate);
+ EXCEPTION_PREAMBLE(isolate);
val = i::Execution::ToObject(obj, &has_pending_exception);
- EXCEPTION_BAILOUT_CHECK(Local<v8::Object>());
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>());
}
return Local<v8::Object>(ToApi<Object>(val));
}
Local<Boolean> Value::ToBoolean() const {
- i::Isolate* isolate = i::Isolate::Current();
- if (IsDeadCheck(isolate, "v8::Value::ToBoolean()")) {
- return Local<Boolean>();
- }
- LOG_API(isolate, "ToBoolean");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
if (obj->IsBoolean()) {
return Local<Boolean>(ToApi<Boolean>(obj));
} else {
- ENTER_V8;
+ i::Isolate* isolate = i::Isolate::Current();
+ if (IsDeadCheck(isolate, "v8::Value::ToBoolean()")) {
+ return Local<Boolean>();
+ }
+ LOG_API(isolate, "ToBoolean");
+ ENTER_V8(isolate);
i::Handle<i::Object> val = i::Execution::ToBoolean(obj);
return Local<Boolean>(ToApi<Boolean>(val));
}
@@ -2112,36 +2125,38 @@ Local<Boolean> Value::ToBoolean() const {
Local<Number> Value::ToNumber() const {
- i::Isolate* isolate = i::Isolate::Current();
- if (IsDeadCheck(isolate, "v8::Value::ToNumber()")) return Local<Number>();
- LOG_API(isolate, "ToNumber");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
i::Handle<i::Object> num;
if (obj->IsNumber()) {
num = obj;
} else {
- ENTER_V8;
- EXCEPTION_PREAMBLE();
+ i::Isolate* isolate = i::Isolate::Current();
+ if (IsDeadCheck(isolate, "v8::Value::ToNumber()")) {
+ return Local<Number>();
+ }
+ LOG_API(isolate, "ToNumber");
+ ENTER_V8(isolate);
+ EXCEPTION_PREAMBLE(isolate);
num = i::Execution::ToNumber(obj, &has_pending_exception);
- EXCEPTION_BAILOUT_CHECK(Local<Number>());
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<Number>());
}
return Local<Number>(ToApi<Number>(num));
}
Local<Integer> Value::ToInteger() const {
- i::Isolate* isolate = i::Isolate::Current();
- if (IsDeadCheck(isolate, "v8::Value::ToInteger()")) return Local<Integer>();
- LOG_API(isolate, "ToInteger");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
i::Handle<i::Object> num;
if (obj->IsSmi()) {
num = obj;
} else {
- ENTER_V8;
- EXCEPTION_PREAMBLE();
+ i::Isolate* isolate = i::Isolate::Current();
+ if (IsDeadCheck(isolate, "v8::Value::ToInteger()")) return Local<Integer>();
+ LOG_API(isolate, "ToInteger");
+ ENTER_V8(isolate);
+ EXCEPTION_PREAMBLE(isolate);
num = i::Execution::ToInteger(obj, &has_pending_exception);
- EXCEPTION_BAILOUT_CHECK(Local<Integer>());
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<Integer>());
}
return Local<Integer>(ToApi<Integer>(num));
}
@@ -2229,14 +2244,14 @@ void v8::RegExp::CheckCast(v8::Value* that) {
bool Value::BooleanValue() const {
- i::Isolate* isolate = i::Isolate::Current();
- if (IsDeadCheck(isolate, "v8::Value::BooleanValue()")) return false;
- LOG_API(isolate, "BooleanValue");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
if (obj->IsBoolean()) {
return obj->IsTrue();
} else {
- ENTER_V8;
+ i::Isolate* isolate = i::Isolate::Current();
+ if (IsDeadCheck(isolate, "v8::Value::BooleanValue()")) return false;
+ LOG_API(isolate, "BooleanValue");
+ ENTER_V8(isolate);
i::Handle<i::Object> value = i::Execution::ToBoolean(obj);
return value->IsTrue();
}
@@ -2244,38 +2259,38 @@ bool Value::BooleanValue() const {
double Value::NumberValue() const {
- i::Isolate* isolate = i::Isolate::Current();
- if (IsDeadCheck(isolate, "v8::Value::NumberValue()")) {
- return i::OS::nan_value();
- }
- LOG_API(isolate, "NumberValue");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
i::Handle<i::Object> num;
if (obj->IsNumber()) {
num = obj;
} else {
- ENTER_V8;
- EXCEPTION_PREAMBLE();
+ i::Isolate* isolate = i::Isolate::Current();
+ if (IsDeadCheck(isolate, "v8::Value::NumberValue()")) {
+ return i::OS::nan_value();
+ }
+ LOG_API(isolate, "NumberValue");
+ ENTER_V8(isolate);
+ EXCEPTION_PREAMBLE(isolate);
num = i::Execution::ToNumber(obj, &has_pending_exception);
- EXCEPTION_BAILOUT_CHECK(i::OS::nan_value());
+ EXCEPTION_BAILOUT_CHECK(isolate, i::OS::nan_value());
}
return num->Number();
}
int64_t Value::IntegerValue() const {
- i::Isolate* isolate = i::Isolate::Current();
- if (IsDeadCheck(isolate, "v8::Value::IntegerValue()")) return 0;
- LOG_API(isolate, "IntegerValue");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
i::Handle<i::Object> num;
if (obj->IsNumber()) {
num = obj;
} else {
- ENTER_V8;
- EXCEPTION_PREAMBLE();
+ i::Isolate* isolate = i::Isolate::Current();
+ if (IsDeadCheck(isolate, "v8::Value::IntegerValue()")) return 0;
+ LOG_API(isolate, "IntegerValue");
+ ENTER_V8(isolate);
+ EXCEPTION_PREAMBLE(isolate);
num = i::Execution::ToInteger(obj, &has_pending_exception);
- EXCEPTION_BAILOUT_CHECK(0);
+ EXCEPTION_BAILOUT_CHECK(isolate, 0);
}
if (num->IsSmi()) {
return i::Smi::cast(*num)->value();
@@ -2286,55 +2301,55 @@ int64_t Value::IntegerValue() const {
Local<Int32> Value::ToInt32() const {
- i::Isolate* isolate = i::Isolate::Current();
- if (IsDeadCheck(isolate, "v8::Value::ToInt32()")) return Local<Int32>();
- LOG_API(isolate, "ToInt32");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
i::Handle<i::Object> num;
if (obj->IsSmi()) {
num = obj;
} else {
- ENTER_V8;
- EXCEPTION_PREAMBLE();
+ i::Isolate* isolate = i::Isolate::Current();
+ if (IsDeadCheck(isolate, "v8::Value::ToInt32()")) return Local<Int32>();
+ LOG_API(isolate, "ToInt32");
+ ENTER_V8(isolate);
+ EXCEPTION_PREAMBLE(isolate);
num = i::Execution::ToInt32(obj, &has_pending_exception);
- EXCEPTION_BAILOUT_CHECK(Local<Int32>());
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<Int32>());
}
return Local<Int32>(ToApi<Int32>(num));
}
Local<Uint32> Value::ToUint32() const {
- i::Isolate* isolate = i::Isolate::Current();
- if (IsDeadCheck(isolate, "v8::Value::ToUint32()")) return Local<Uint32>();
- LOG_API(isolate, "ToUInt32");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
i::Handle<i::Object> num;
if (obj->IsSmi()) {
num = obj;
} else {
- ENTER_V8;
- EXCEPTION_PREAMBLE();
+ i::Isolate* isolate = i::Isolate::Current();
+ if (IsDeadCheck(isolate, "v8::Value::ToUint32()")) return Local<Uint32>();
+ LOG_API(isolate, "ToUInt32");
+ ENTER_V8(isolate);
+ EXCEPTION_PREAMBLE(isolate);
num = i::Execution::ToUint32(obj, &has_pending_exception);
- EXCEPTION_BAILOUT_CHECK(Local<Uint32>());
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<Uint32>());
}
return Local<Uint32>(ToApi<Uint32>(num));
}
Local<Uint32> Value::ToArrayIndex() const {
- i::Isolate* isolate = i::Isolate::Current();
- if (IsDeadCheck(isolate, "v8::Value::ToArrayIndex()")) return Local<Uint32>();
- LOG_API(isolate, "ToArrayIndex");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
if (obj->IsSmi()) {
if (i::Smi::cast(*obj)->value() >= 0) return Utils::Uint32ToLocal(obj);
return Local<Uint32>();
}
- ENTER_V8;
- EXCEPTION_PREAMBLE();
+ i::Isolate* isolate = i::Isolate::Current();
+ if (IsDeadCheck(isolate, "v8::Value::ToArrayIndex()")) return Local<Uint32>();
+ LOG_API(isolate, "ToArrayIndex");
+ ENTER_V8(isolate);
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> string_obj =
i::Execution::ToString(obj, &has_pending_exception);
- EXCEPTION_BAILOUT_CHECK(Local<Uint32>());
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<Uint32>());
i::Handle<i::String> str = i::Handle<i::String>::cast(string_obj);
uint32_t index;
if (str->AsArrayIndex(&index)) {
@@ -2351,19 +2366,18 @@ Local<Uint32> Value::ToArrayIndex() const {
int32_t Value::Int32Value() const {
- i::Isolate* isolate = i::Isolate::Current();
- if (IsDeadCheck(isolate, "v8::Value::Int32Value()")) return 0;
- LOG_API(isolate, "Int32Value");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
if (obj->IsSmi()) {
return i::Smi::cast(*obj)->value();
} else {
+ i::Isolate* isolate = i::Isolate::Current();
+ if (IsDeadCheck(isolate, "v8::Value::Int32Value()")) return 0;
LOG_API(isolate, "Int32Value (slow)");
- ENTER_V8;
- EXCEPTION_PREAMBLE();
+ ENTER_V8(isolate);
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> num =
i::Execution::ToInt32(obj, &has_pending_exception);
- EXCEPTION_BAILOUT_CHECK(0);
+ EXCEPTION_BAILOUT_CHECK(isolate, 0);
if (num->IsSmi()) {
return i::Smi::cast(*num)->value();
} else {
@@ -2381,7 +2395,7 @@ bool Value::Equals(Handle<Value> that) const {
return false;
}
LOG_API(isolate, "Equals");
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::Object> obj = Utils::OpenHandle(this);
i::Handle<i::Object> other = Utils::OpenHandle(*that);
// If both obj and other are JSObjects, we'd better compare by identity
@@ -2391,10 +2405,10 @@ bool Value::Equals(Handle<Value> that) const {
return *obj == *other;
}
i::Object** args[1] = { other.location() };
- EXCEPTION_PREAMBLE();
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> result =
CallV8HeapFunction("EQUALS", obj, 1, args, &has_pending_exception);
- EXCEPTION_BAILOUT_CHECK(false);
+ EXCEPTION_BAILOUT_CHECK(isolate, false);
return *result == i::Smi::FromInt(i::EQUAL);
}
@@ -2432,18 +2446,18 @@ bool Value::StrictEquals(Handle<Value> that) const {
uint32_t Value::Uint32Value() const {
- i::Isolate* isolate = i::Isolate::Current();
- if (IsDeadCheck(isolate, "v8::Value::Uint32Value()")) return 0;
- LOG_API(isolate, "Uint32Value");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
if (obj->IsSmi()) {
return i::Smi::cast(*obj)->value();
} else {
- ENTER_V8;
- EXCEPTION_PREAMBLE();
+ i::Isolate* isolate = i::Isolate::Current();
+ if (IsDeadCheck(isolate, "v8::Value::Uint32Value()")) return 0;
+ LOG_API(isolate, "Uint32Value");
+ ENTER_V8(isolate);
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> num =
i::Execution::ToUint32(obj, &has_pending_exception);
- EXCEPTION_BAILOUT_CHECK(0);
+ EXCEPTION_BAILOUT_CHECK(isolate, 0);
if (num->IsSmi()) {
return i::Smi::cast(*num)->value();
} else {
@@ -2455,14 +2469,14 @@ uint32_t Value::Uint32Value() const {
bool v8::Object::Set(v8::Handle<Value> key, v8::Handle<Value> value,
v8::PropertyAttribute attribs) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Object::Set()", return false);
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::Object> self = Utils::OpenHandle(this);
i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
- EXCEPTION_PREAMBLE();
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> obj = i::SetProperty(
self,
key_obj,
@@ -2470,26 +2484,26 @@ bool v8::Object::Set(v8::Handle<Value> key, v8::Handle<Value> value,
static_cast<PropertyAttributes>(attribs),
i::kNonStrictMode);
has_pending_exception = obj.is_null();
- EXCEPTION_BAILOUT_CHECK(false);
+ EXCEPTION_BAILOUT_CHECK(isolate, false);
return true;
}
bool v8::Object::Set(uint32_t index, v8::Handle<Value> value) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Object::Set()", return false);
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
- EXCEPTION_PREAMBLE();
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> obj = i::SetElement(
self,
index,
value_obj,
i::kNonStrictMode);
has_pending_exception = obj.is_null();
- EXCEPTION_BAILOUT_CHECK(false);
+ EXCEPTION_BAILOUT_CHECK(isolate, false);
return true;
}
@@ -2497,29 +2511,29 @@ bool v8::Object::Set(uint32_t index, v8::Handle<Value> value) {
bool v8::Object::ForceSet(v8::Handle<Value> key,
v8::Handle<Value> value,
v8::PropertyAttribute attribs) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Object::ForceSet()", return false);
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
- EXCEPTION_PREAMBLE();
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> obj = i::ForceSetProperty(
self,
key_obj,
value_obj,
static_cast<PropertyAttributes>(attribs));
has_pending_exception = obj.is_null();
- EXCEPTION_BAILOUT_CHECK(false);
+ EXCEPTION_BAILOUT_CHECK(isolate, false);
return true;
}
bool v8::Object::ForceDelete(v8::Handle<Value> key) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Object::ForceDelete()", return false);
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
@@ -2528,45 +2542,46 @@ bool v8::Object::ForceDelete(v8::Handle<Value> key) {
// as optimized code does not always handle access checks.
i::Deoptimizer::DeoptimizeGlobalObject(*self);
- EXCEPTION_PREAMBLE();
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> obj = i::ForceDeleteProperty(self, key_obj);
has_pending_exception = obj.is_null();
- EXCEPTION_BAILOUT_CHECK(false);
+ EXCEPTION_BAILOUT_CHECK(isolate, false);
return obj->IsTrue();
}
Local<Value> v8::Object::Get(v8::Handle<Value> key) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Object::Get()", return Local<v8::Value>());
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::Object> self = Utils::OpenHandle(this);
i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
- EXCEPTION_PREAMBLE();
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> result = i::GetProperty(self, key_obj);
has_pending_exception = result.is_null();
- EXCEPTION_BAILOUT_CHECK(Local<Value>());
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
return Utils::ToLocal(result);
}
Local<Value> v8::Object::Get(uint32_t index) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Object::Get()", return Local<v8::Value>());
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
- EXCEPTION_PREAMBLE();
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> result = i::GetElement(self, index);
has_pending_exception = result.is_null();
- EXCEPTION_BAILOUT_CHECK(Local<Value>());
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
return Utils::ToLocal(result);
}
Local<Value> v8::Object::GetPrototype() {
- ON_BAILOUT(i::Isolate::Current(), "v8::Object::GetPrototype()",
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ON_BAILOUT(isolate, "v8::Object::GetPrototype()",
return Local<v8::Value>());
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::Object> self = Utils::OpenHandle(this);
i::Handle<i::Object> result = i::GetPrototype(self);
return Utils::ToLocal(result);
@@ -2574,25 +2589,26 @@ Local<Value> v8::Object::GetPrototype() {
bool v8::Object::SetPrototype(Handle<Value> value) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Object::SetPrototype()", return false);
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
- EXCEPTION_PREAMBLE();
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> result = i::SetPrototype(self, value_obj);
has_pending_exception = result.is_null();
- EXCEPTION_BAILOUT_CHECK(false);
+ EXCEPTION_BAILOUT_CHECK(isolate, false);
return true;
}
Local<Object> v8::Object::FindInstanceInPrototypeChain(
v8::Handle<FunctionTemplate> tmpl) {
- ON_BAILOUT(i::Isolate::Current(),
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ON_BAILOUT(isolate,
"v8::Object::FindInstanceInPrototypeChain()",
return Local<v8::Object>());
- ENTER_V8;
+ ENTER_V8(isolate);
i::JSObject* object = *Utils::OpenHandle(this);
i::FunctionTemplateInfo* tmpl_info = *Utils::OpenHandle(*tmpl);
while (!object->IsInstanceOf(tmpl_info)) {
@@ -2605,11 +2621,11 @@ Local<Object> v8::Object::FindInstanceInPrototypeChain(
Local<Array> v8::Object::GetPropertyNames() {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Object::GetPropertyNames()",
return Local<v8::Array>());
- ENTER_V8;
- v8::HandleScope scope;
+ ENTER_V8(isolate);
+ i::HandleScope scope(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::FixedArray> value =
i::GetKeysInFixedArrayFor(self, i::INCLUDE_PROTOS);
@@ -2619,14 +2635,15 @@ Local<Array> v8::Object::GetPropertyNames() {
i::Handle<i::FixedArray> elms = isolate->factory()->CopyFixedArray(value);
i::Handle<i::JSArray> result =
isolate->factory()->NewJSArrayWithElements(elms);
- return scope.Close(Utils::ToLocal(result));
+ return Utils::ToLocal(scope.CloseAndEscape(result));
}
Local<String> v8::Object::ObjectProtoToString() {
- ON_BAILOUT(i::Isolate::Current(), "v8::Object::ObjectProtoToString()",
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ON_BAILOUT(isolate, "v8::Object::ObjectProtoToString()",
return Local<v8::String>());
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> name(self->class_name());
@@ -2677,10 +2694,10 @@ Local<String> v8::Object::ObjectProtoToString() {
Local<String> v8::Object::GetConstructorName() {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Object::GetConstructorName()",
return Local<v8::String>());
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::String> name(self->constructor_name());
return Utils::ToLocal(name);
@@ -2688,9 +2705,9 @@ Local<String> v8::Object::GetConstructorName() {
bool v8::Object::Delete(v8::Handle<String> key) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Object::Delete()", return false);
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
@@ -2699,8 +2716,9 @@ bool v8::Object::Delete(v8::Handle<String> key) {
bool v8::Object::Has(v8::Handle<String> key) {
- ON_BAILOUT(i::Isolate::Current(), "v8::Object::Has()", return false);
- ENTER_V8;
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ON_BAILOUT(isolate, "v8::Object::Has()", return false);
+ ENTER_V8(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
return self->HasProperty(*key_obj);
@@ -2708,9 +2726,10 @@ bool v8::Object::Has(v8::Handle<String> key) {
bool v8::Object::Delete(uint32_t index) {
- ON_BAILOUT(i::Isolate::Current(), "v8::Object::DeleteProperty()",
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ON_BAILOUT(isolate, "v8::Object::DeleteProperty()",
return false);
- ENTER_V8;
+ ENTER_V8(isolate);
HandleScope scope;
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
return i::DeleteElement(self, index)->IsTrue();
@@ -2718,7 +2737,8 @@ bool v8::Object::Delete(uint32_t index) {
bool v8::Object::Has(uint32_t index) {
- ON_BAILOUT(i::Isolate::Current(), "v8::Object::HasProperty()", return false);
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ON_BAILOUT(isolate, "v8::Object::HasProperty()", return false);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
return self->HasElement(index);
}
@@ -2730,9 +2750,9 @@ bool Object::SetAccessor(Handle<String> name,
v8::Handle<Value> data,
AccessControl settings,
PropertyAttribute attributes) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Object::SetAccessor()", return false);
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::AccessorInfo> info = MakeAccessorInfo(name,
getter, setter, data,
@@ -2743,7 +2763,8 @@ bool Object::SetAccessor(Handle<String> name,
bool v8::Object::HasRealNamedProperty(Handle<String> key) {
- ON_BAILOUT(i::Isolate::Current(), "v8::Object::HasRealNamedProperty()",
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ON_BAILOUT(isolate, "v8::Object::HasRealNamedProperty()",
return false);
return Utils::OpenHandle(this)->HasRealNamedProperty(
*Utils::OpenHandle(*key));
@@ -2751,31 +2772,35 @@ bool v8::Object::HasRealNamedProperty(Handle<String> key) {
bool v8::Object::HasRealIndexedProperty(uint32_t index) {
- ON_BAILOUT(i::Isolate::Current(), "v8::Object::HasRealIndexedProperty()",
+ ON_BAILOUT(Utils::OpenHandle(this)->GetIsolate(),
+ "v8::Object::HasRealIndexedProperty()",
return false);
return Utils::OpenHandle(this)->HasRealElementProperty(index);
}
bool v8::Object::HasRealNamedCallbackProperty(Handle<String> key) {
- ON_BAILOUT(i::Isolate::Current(),
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ON_BAILOUT(isolate,
"v8::Object::HasRealNamedCallbackProperty()",
return false);
- ENTER_V8;
+ ENTER_V8(isolate);
return Utils::OpenHandle(this)->HasRealNamedCallbackProperty(
*Utils::OpenHandle(*key));
}
bool v8::Object::HasNamedLookupInterceptor() {
- ON_BAILOUT(i::Isolate::Current(), "v8::Object::HasNamedLookupInterceptor()",
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ON_BAILOUT(isolate, "v8::Object::HasNamedLookupInterceptor()",
return false);
return Utils::OpenHandle(this)->HasNamedInterceptor();
}
bool v8::Object::HasIndexedLookupInterceptor() {
- ON_BAILOUT(i::Isolate::Current(), "v8::Object::HasIndexedLookupInterceptor()",
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ON_BAILOUT(isolate, "v8::Object::HasIndexedLookupInterceptor()",
return false);
return Utils::OpenHandle(this)->HasIndexedInterceptor();
}
@@ -2783,10 +2808,11 @@ bool v8::Object::HasIndexedLookupInterceptor() {
Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain(
Handle<String> key) {
- ON_BAILOUT(i::Isolate::Current(),
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ON_BAILOUT(isolate,
"v8::Object::GetRealNamedPropertyInPrototypeChain()",
return Local<Value>());
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this);
i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
i::LookupResult lookup;
@@ -2806,9 +2832,10 @@ Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain(
Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) {
- ON_BAILOUT(i::Isolate::Current(), "v8::Object::GetRealNamedProperty()",
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ON_BAILOUT(isolate, "v8::Object::GetRealNamedProperty()",
return Local<Value>());
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this);
i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
i::LookupResult lookup;
@@ -2831,9 +2858,9 @@ Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) {
// Because the object gets a new map, existing inline cache caching
// the old map of this object will fail.
void v8::Object::TurnOnAccessCheck() {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Object::TurnOnAccessCheck()", return);
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
@@ -2842,7 +2869,7 @@ void v8::Object::TurnOnAccessCheck() {
i::Deoptimizer::DeoptimizeGlobalObject(*obj);
i::Handle<i::Map> new_map =
- isolate->factory()->CopyMapDropTransitions(i::Handle<i::Map>(obj->map()));
+ isolate->factory()->CopyMapDropTransitions(i::Handle<i::Map>(obj->map()));
new_map->set_is_access_check_needed(true);
obj->set_map(*new_map);
}
@@ -2854,22 +2881,22 @@ bool v8::Object::IsDirty() {
Local<v8::Object> v8::Object::Clone() {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Object::Clone()", return Local<Object>());
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
- EXCEPTION_PREAMBLE();
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::JSObject> result = i::Copy(self);
has_pending_exception = result.is_null();
- EXCEPTION_BAILOUT_CHECK(Local<Object>());
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>());
return Utils::ToLocal(result);
}
int v8::Object::GetIdentityHash() {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Object::GetIdentityHash()", return 0);
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> hidden_props_obj(i::GetHiddenProperties(self, true));
@@ -2910,15 +2937,15 @@ int v8::Object::GetIdentityHash() {
bool v8::Object::SetHiddenValue(v8::Handle<v8::String> key,
v8::Handle<v8::Value> value) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Object::SetHiddenValue()", return false);
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> hidden_props(i::GetHiddenProperties(self, true));
i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
- EXCEPTION_PREAMBLE();
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> obj = i::SetProperty(
hidden_props,
key_obj,
@@ -2926,26 +2953,26 @@ bool v8::Object::SetHiddenValue(v8::Handle<v8::String> key,
static_cast<PropertyAttributes>(None),
i::kNonStrictMode);
has_pending_exception = obj.is_null();
- EXCEPTION_BAILOUT_CHECK(false);
+ EXCEPTION_BAILOUT_CHECK(isolate, false);
return true;
}
v8::Local<v8::Value> v8::Object::GetHiddenValue(v8::Handle<v8::String> key) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Object::GetHiddenValue()",
return Local<v8::Value>());
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> hidden_props(i::GetHiddenProperties(self, false));
if (hidden_props->IsUndefined()) {
return v8::Local<v8::Value>();
}
i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
- EXCEPTION_PREAMBLE();
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> result = i::GetProperty(hidden_props, key_obj);
has_pending_exception = result.is_null();
- EXCEPTION_BAILOUT_CHECK(v8::Local<v8::Value>());
+ EXCEPTION_BAILOUT_CHECK(isolate, v8::Local<v8::Value>());
if (result->IsUndefined()) {
return v8::Local<v8::Value>();
}
@@ -2954,9 +2981,9 @@ v8::Local<v8::Value> v8::Object::GetHiddenValue(v8::Handle<v8::String> key) {
bool v8::Object::DeleteHiddenValue(v8::Handle<v8::String> key) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::DeleteHiddenValue()", return false);
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> hidden_props(i::GetHiddenProperties(self, false));
@@ -2975,8 +3002,9 @@ void PrepareExternalArrayElements(i::Handle<i::JSObject> object,
void* data,
ExternalArrayType array_type,
int length) {
+ i::Isolate* isolate = object->GetIsolate();
i::Handle<i::ExternalArray> array =
- FACTORY->NewExternalArray(length, array_type, data);
+ isolate->factory()->NewExternalArray(length, array_type, data);
// If the object already has external elements, create a new, unique
// map if the element type is now changing, because assumptions about
@@ -2985,10 +3013,10 @@ void PrepareExternalArrayElements(i::Handle<i::JSObject> object,
bool cant_reuse_map =
elements->map()->IsUndefined() ||
!elements->map()->has_external_array_elements() ||
- elements->map() != HEAP->MapForExternalArrayType(array_type);
+ elements->map() != isolate->heap()->MapForExternalArrayType(array_type);
if (cant_reuse_map) {
i::Handle<i::Map> external_array_map =
- FACTORY->GetExternalArrayElementsMap(
+ isolate->factory()->GetExternalArrayElementsMap(
i::Handle<i::Map>(object->map()),
array_type,
object->HasFastProperties());
@@ -3001,9 +3029,9 @@ void PrepareExternalArrayElements(i::Handle<i::JSObject> object,
void v8::Object::SetIndexedPropertiesToPixelData(uint8_t* data, int length) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::SetElementsToPixelData()", return);
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
if (!ApiCheck(length <= i::ExternalPixelArray::kMaxLength,
"v8::Object::SetIndexedPropertiesToPixelData()",
@@ -3021,17 +3049,17 @@ void v8::Object::SetIndexedPropertiesToPixelData(uint8_t* data, int length) {
bool v8::Object::HasIndexedPropertiesInPixelData() {
- ON_BAILOUT(i::Isolate::Current(), "v8::HasIndexedPropertiesInPixelData()",
- return false);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
+ ON_BAILOUT(self->GetIsolate(), "v8::HasIndexedPropertiesInPixelData()",
+ return false);
return self->HasExternalPixelElements();
}
uint8_t* v8::Object::GetIndexedPropertiesPixelData() {
- ON_BAILOUT(i::Isolate::Current(), "v8::GetIndexedPropertiesPixelData()",
- return NULL);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
+ ON_BAILOUT(self->GetIsolate(), "v8::GetIndexedPropertiesPixelData()",
+ return NULL);
if (self->HasExternalPixelElements()) {
return i::ExternalPixelArray::cast(self->elements())->
external_pixel_pointer();
@@ -3042,9 +3070,9 @@ uint8_t* v8::Object::GetIndexedPropertiesPixelData() {
int v8::Object::GetIndexedPropertiesPixelDataLength() {
- ON_BAILOUT(i::Isolate::Current(), "v8::GetIndexedPropertiesPixelDataLength()",
- return -1);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
+ ON_BAILOUT(self->GetIsolate(), "v8::GetIndexedPropertiesPixelDataLength()",
+ return -1);
if (self->HasExternalPixelElements()) {
return i::ExternalPixelArray::cast(self->elements())->length();
} else {
@@ -3056,9 +3084,9 @@ void v8::Object::SetIndexedPropertiesToExternalArrayData(
void* data,
ExternalArrayType array_type,
int length) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::SetIndexedPropertiesToExternalArrayData()", return);
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
if (!ApiCheck(length <= i::ExternalArray::kMaxLength,
"v8::Object::SetIndexedPropertiesToExternalArrayData()",
@@ -3076,19 +3104,19 @@ void v8::Object::SetIndexedPropertiesToExternalArrayData(
bool v8::Object::HasIndexedPropertiesInExternalArrayData() {
- ON_BAILOUT(i::Isolate::Current(),
+ i::Handle<i::JSObject> self = Utils::OpenHandle(this);
+ ON_BAILOUT(self->GetIsolate(),
"v8::HasIndexedPropertiesInExternalArrayData()",
return false);
- i::Handle<i::JSObject> self = Utils::OpenHandle(this);
return self->HasExternalArrayElements();
}
void* v8::Object::GetIndexedPropertiesExternalArrayData() {
- ON_BAILOUT(i::Isolate::Current(),
+ i::Handle<i::JSObject> self = Utils::OpenHandle(this);
+ ON_BAILOUT(self->GetIsolate(),
"v8::GetIndexedPropertiesExternalArrayData()",
return NULL);
- i::Handle<i::JSObject> self = Utils::OpenHandle(this);
if (self->HasExternalArrayElements()) {
return i::ExternalArray::cast(self->elements())->external_pointer();
} else {
@@ -3098,10 +3126,10 @@ void* v8::Object::GetIndexedPropertiesExternalArrayData() {
ExternalArrayType v8::Object::GetIndexedPropertiesExternalArrayDataType() {
- ON_BAILOUT(i::Isolate::Current(),
+ i::Handle<i::JSObject> self = Utils::OpenHandle(this);
+ ON_BAILOUT(self->GetIsolate(),
"v8::GetIndexedPropertiesExternalArrayDataType()",
return static_cast<ExternalArrayType>(-1));
- i::Handle<i::JSObject> self = Utils::OpenHandle(this);
switch (self->elements()->map()->instance_type()) {
case i::EXTERNAL_BYTE_ARRAY_TYPE:
return kExternalByteArray;
@@ -3126,10 +3154,10 @@ ExternalArrayType v8::Object::GetIndexedPropertiesExternalArrayDataType() {
int v8::Object::GetIndexedPropertiesExternalArrayDataLength() {
- ON_BAILOUT(i::Isolate::Current(),
+ i::Handle<i::JSObject> self = Utils::OpenHandle(this);
+ ON_BAILOUT(self->GetIsolate(),
"v8::GetIndexedPropertiesExternalArrayDataLength()",
return 0);
- i::Handle<i::JSObject> self = Utils::OpenHandle(this);
if (self->HasExternalArrayElements()) {
return i::ExternalArray::cast(self->elements())->length();
} else {
@@ -3145,29 +3173,29 @@ Local<v8::Object> Function::NewInstance() const {
Local<v8::Object> Function::NewInstance(int argc,
v8::Handle<v8::Value> argv[]) const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Function::NewInstance()",
return Local<v8::Object>());
LOG_API(isolate, "Function::NewInstance");
- ENTER_V8;
+ ENTER_V8(isolate);
HandleScope scope;
i::Handle<i::JSFunction> function = Utils::OpenHandle(this);
STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**));
i::Object*** args = reinterpret_cast<i::Object***>(argv);
- EXCEPTION_PREAMBLE();
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> returned =
i::Execution::New(function, argc, args, &has_pending_exception);
- EXCEPTION_BAILOUT_CHECK(Local<v8::Object>());
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>());
return scope.Close(Utils::ToLocal(i::Handle<i::JSObject>::cast(returned)));
}
Local<v8::Value> Function::Call(v8::Handle<v8::Object> recv, int argc,
v8::Handle<v8::Value> argv[]) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Function::Call()", return Local<v8::Value>());
LOG_API(isolate, "Function::Call");
- ENTER_V8;
+ ENTER_V8(isolate);
i::Object* raw_result = NULL;
{
i::HandleScope scope(isolate);
@@ -3175,10 +3203,10 @@ Local<v8::Value> Function::Call(v8::Handle<v8::Object> recv, int argc,
i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv);
STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**));
i::Object*** args = reinterpret_cast<i::Object***>(argv);
- EXCEPTION_PREAMBLE();
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> returned =
i::Execution::Call(fun, recv_obj, argc, args, &has_pending_exception);
- EXCEPTION_BAILOUT_CHECK(Local<Object>());
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>());
raw_result = *returned;
}
i::Handle<i::Object> result(raw_result);
@@ -3187,7 +3215,8 @@ Local<v8::Value> Function::Call(v8::Handle<v8::Object> recv, int argc,
void Function::SetName(v8::Handle<v8::String> name) {
- ENTER_V8;
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ENTER_V8(isolate);
i::Handle<i::JSFunction> func = Utils::OpenHandle(this);
func->shared()->set_name(*Utils::OpenHandle(*name));
}
@@ -3242,10 +3271,10 @@ int String::WriteUtf8(char* buffer,
int capacity,
int* nchars_ref,
WriteHints hints) const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::String::WriteUtf8()")) return 0;
LOG_API(isolate, "String::WriteUtf8");
- ENTER_V8;
+ ENTER_V8(isolate);
i::StringInputBuffer& write_input_buffer = *isolate->write_input_buffer();
i::Handle<i::String> str = Utils::OpenHandle(this);
isolate->string_tracker()->RecordWrite(str);
@@ -3299,10 +3328,10 @@ int String::WriteAscii(char* buffer,
int start,
int length,
WriteHints hints) const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::String::WriteAscii()")) return 0;
LOG_API(isolate, "String::WriteAscii");
- ENTER_V8;
+ ENTER_V8(isolate);
i::StringInputBuffer& write_input_buffer = *isolate->write_input_buffer();
ASSERT(start >= 0 && length >= -1);
i::Handle<i::String> str = Utils::OpenHandle(this);
@@ -3333,10 +3362,10 @@ int String::Write(uint16_t* buffer,
int start,
int length,
WriteHints hints) const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::String::Write()")) return 0;
LOG_API(isolate, "String::Write");
- ENTER_V8;
+ ENTER_V8(isolate);
ASSERT(start >= 0 && length >= -1);
i::Handle<i::String> str = Utils::OpenHandle(this);
isolate->string_tracker()->RecordWrite(str);
@@ -3358,15 +3387,20 @@ int String::Write(uint16_t* buffer,
bool v8::String::IsExternal() const {
- EnsureInitialized("v8::String::IsExternal()");
i::Handle<i::String> str = Utils::OpenHandle(this);
+ if (IsDeadCheck(str->GetIsolate(), "v8::String::IsExternal()")) {
+ return false;
+ }
+ EnsureInitializedForIsolate(str->GetIsolate(), "v8::String::IsExternal()");
return i::StringShape(*str).IsExternalTwoByte();
}
bool v8::String::IsExternalAscii() const {
- EnsureInitialized("v8::String::IsExternalAscii()");
i::Handle<i::String> str = Utils::OpenHandle(this);
+ if (IsDeadCheck(str->GetIsolate(), "v8::String::IsExternalAscii()")) {
+ return false;
+ }
return i::StringShape(*str).IsExternalAscii();
}
@@ -3387,8 +3421,11 @@ void v8::String::VerifyExternalStringResource(
v8::String::ExternalAsciiStringResource*
v8::String::GetExternalAsciiStringResource() const {
- EnsureInitialized("v8::String::GetExternalAsciiStringResource()");
i::Handle<i::String> str = Utils::OpenHandle(this);
+ if (IsDeadCheck(str->GetIsolate(),
+ "v8::String::GetExternalAsciiStringResource()")) {
+ return NULL;
+ }
if (i::StringShape(*str).IsExternalAscii()) {
void* resource = i::Handle<i::ExternalAsciiString>::cast(str)->resource();
return reinterpret_cast<ExternalAsciiStringResource*>(resource);
@@ -3446,19 +3483,19 @@ uint32_t Uint32::Value() const {
int v8::Object::InternalFieldCount() {
- if (IsDeadCheck(i::Isolate::Current(), "v8::Object::InternalFieldCount()")) {
+ i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
+ if (IsDeadCheck(obj->GetIsolate(), "v8::Object::InternalFieldCount()")) {
return 0;
}
- i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
return obj->GetInternalFieldCount();
}
Local<Value> v8::Object::CheckedGetInternalField(int index) {
- if (IsDeadCheck(i::Isolate::Current(), "v8::Object::GetInternalField()")) {
+ i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
+ if (IsDeadCheck(obj->GetIsolate(), "v8::Object::GetInternalField()")) {
return Local<Value>();
}
- i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
if (!ApiCheck(index < obj->GetInternalFieldCount(),
"v8::Object::GetInternalField()",
"Reading internal field out of bounds")) {
@@ -3475,16 +3512,17 @@ Local<Value> v8::Object::CheckedGetInternalField(int index) {
void v8::Object::SetInternalField(int index, v8::Handle<Value> value) {
- if (IsDeadCheck(i::Isolate::Current(), "v8::Object::SetInternalField()")) {
+ i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
+ i::Isolate* isolate = obj->GetIsolate();
+ if (IsDeadCheck(isolate, "v8::Object::SetInternalField()")) {
return;
}
- i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
if (!ApiCheck(index < obj->GetInternalFieldCount(),
"v8::Object::SetInternalField()",
"Writing internal field out of bounds")) {
return;
}
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::Object> val = Utils::OpenHandle(*value);
obj->SetInternalField(index, *val);
}
@@ -3508,13 +3546,15 @@ static i::Smi* EncodeAsSmi(void* ptr) {
void v8::Object::SetPointerInInternalField(int index, void* value) {
- ENTER_V8;
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ENTER_V8(isolate);
if (CanBeEncodedAsSmi(value)) {
Utils::OpenHandle(this)->SetInternalField(index, EncodeAsSmi(value));
} else {
HandleScope scope;
i::Handle<i::Proxy> proxy =
- FACTORY->NewProxy(reinterpret_cast<i::Address>(value), i::TENURED);
+ isolate->factory()->NewProxy(
+ reinterpret_cast<i::Address>(value), i::TENURED);
if (!proxy.is_null())
Utils::OpenHandle(this)->SetInternalField(index, *proxy);
}
@@ -3610,7 +3650,7 @@ Persistent<Context> v8::Context::New(
// Enter V8 via an ENTER_V8 scope.
i::Handle<i::Context> env;
{
- ENTER_V8;
+ ENTER_V8(isolate);
v8::Handle<ObjectTemplate> proxy_template = global_template;
i::Handle<i::FunctionTemplateInfo> proxy_constructor;
i::Handle<i::FunctionTemplateInfo> global_constructor;
@@ -3669,10 +3709,11 @@ Persistent<Context> v8::Context::New(
void v8::Context::SetSecurityToken(Handle<Value> token) {
- if (IsDeadCheck(i::Isolate::Current(), "v8::Context::SetSecurityToken()")) {
+ i::Isolate* isolate = i::Isolate::Current();
+ if (IsDeadCheck(isolate, "v8::Context::SetSecurityToken()")) {
return;
}
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::Context> env = Utils::OpenHandle(this);
i::Handle<i::Object> token_handle = Utils::OpenHandle(*token);
env->set_security_token(*token_handle);
@@ -3680,18 +3721,20 @@ void v8::Context::SetSecurityToken(Handle<Value> token) {
void v8::Context::UseDefaultSecurityToken() {
- if (IsDeadCheck(i::Isolate::Current(),
+ i::Isolate* isolate = i::Isolate::Current();
+ if (IsDeadCheck(isolate,
"v8::Context::UseDefaultSecurityToken()")) {
return;
}
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::Context> env = Utils::OpenHandle(this);
env->set_security_token(env->global());
}
Handle<Value> v8::Context::GetSecurityToken() {
- if (IsDeadCheck(i::Isolate::Current(), "v8::Context::GetSecurityToken()")) {
+ i::Isolate* isolate = i::Isolate::Current();
+ if (IsDeadCheck(isolate, "v8::Context::GetSecurityToken()")) {
return Handle<Value>();
}
i::Handle<i::Context> env = Utils::OpenHandle(this);
@@ -3765,7 +3808,7 @@ v8::Local<v8::Object> Context::Global() {
void Context::DetachGlobal() {
i::Isolate* isolate = i::Isolate::Current();
if (IsDeadCheck(isolate, "v8::Context::DetachGlobal()")) return;
- ENTER_V8;
+ ENTER_V8(isolate);
i::Object** ctx = reinterpret_cast<i::Object**>(this);
i::Handle<i::Context> context =
i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx));
@@ -3776,7 +3819,7 @@ void Context::DetachGlobal() {
void Context::ReattachGlobal(Handle<Object> global_object) {
i::Isolate* isolate = i::Isolate::Current();
if (IsDeadCheck(isolate, "v8::Context::ReattachGlobal()")) return;
- ENTER_V8;
+ ENTER_V8(isolate);
i::Object** ctx = reinterpret_cast<i::Object**>(this);
i::Handle<i::Context> context =
i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx));
@@ -3796,12 +3839,12 @@ Local<v8::Object> ObjectTemplate::NewInstance() {
ON_BAILOUT(isolate, "v8::ObjectTemplate::NewInstance()",
return Local<v8::Object>());
LOG_API(isolate, "ObjectTemplate::NewInstance");
- ENTER_V8;
- EXCEPTION_PREAMBLE();
+ ENTER_V8(isolate);
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> obj =
i::Execution::InstantiateObject(Utils::OpenHandle(this),
&has_pending_exception);
- EXCEPTION_BAILOUT_CHECK(Local<v8::Object>());
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>());
return Utils::ToLocal(i::Handle<i::JSObject>::cast(obj));
}
@@ -3811,12 +3854,12 @@ Local<v8::Function> FunctionTemplate::GetFunction() {
ON_BAILOUT(isolate, "v8::FunctionTemplate::GetFunction()",
return Local<v8::Function>());
LOG_API(isolate, "FunctionTemplate::GetFunction");
- ENTER_V8;
- EXCEPTION_PREAMBLE();
+ ENTER_V8(isolate);
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> obj =
i::Execution::InstantiateFunction(Utils::OpenHandle(this),
&has_pending_exception);
- EXCEPTION_BAILOUT_CHECK(Local<v8::Function>());
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Function>());
return Utils::ToLocal(i::Handle<i::JSFunction>::cast(obj));
}
@@ -3843,7 +3886,7 @@ Local<Value> v8::External::Wrap(void* data) {
STATIC_ASSERT(sizeof(data) == sizeof(i::Address));
LOG_API(isolate, "External::Wrap");
EnsureInitializedForIsolate(isolate, "v8::External::Wrap()");
- ENTER_V8;
+ ENTER_V8(isolate);
v8::Local<v8::Value> result = CanBeEncodedAsSmi(data)
? Utils::ToLocal(i::Handle<i::Object>(EncodeAsSmi(data)))
@@ -3888,7 +3931,7 @@ Local<External> v8::External::New(void* data) {
i::Isolate* isolate = i::Isolate::Current();
LOG_API(isolate, "External::New");
EnsureInitializedForIsolate(isolate, "v8::External::New()");
- ENTER_V8;
+ ENTER_V8(isolate);
return ExternalNewImpl(data);
}
@@ -3913,7 +3956,7 @@ Local<String> v8::String::New(const char* data, int length) {
EnsureInitializedForIsolate(isolate, "v8::String::New()");
LOG_API(isolate, "String::New(char)");
if (length == 0) return Empty();
- ENTER_V8;
+ ENTER_V8(isolate);
if (length == -1) length = i::StrLength(data);
i::Handle<i::String> result =
isolate->factory()->NewStringFromUtf8(
@@ -3925,9 +3968,9 @@ Local<String> v8::String::New(const char* data, int length) {
Local<String> v8::String::Concat(Handle<String> left, Handle<String> right) {
i::Handle<i::String> left_string = Utils::OpenHandle(*left);
i::Isolate* isolate = left_string->GetIsolate();
- EnsureInitializedForIsolate(isolate, "v8::String::Concat()");
- LOG_API(isolate, "String::Concat()");
- ENTER_V8;
+ EnsureInitializedForIsolate(isolate, "v8::String::New()");
+ LOG_API(isolate, "String::New(char)");
+ ENTER_V8(isolate);
i::Handle<i::String> right_string = Utils::OpenHandle(*right);
i::Handle<i::String> result = isolate->factory()->NewConsString(left_string,
right_string);
@@ -3939,7 +3982,7 @@ Local<String> v8::String::NewUndetectable(const char* data, int length) {
i::Isolate* isolate = i::Isolate::Current();
EnsureInitializedForIsolate(isolate, "v8::String::NewUndetectable()");
LOG_API(isolate, "String::NewUndetectable(char)");
- ENTER_V8;
+ ENTER_V8(isolate);
if (length == -1) length = i::StrLength(data);
i::Handle<i::String> result =
isolate->factory()->NewStringFromUtf8(
@@ -3961,7 +4004,7 @@ Local<String> v8::String::New(const uint16_t* data, int length) {
EnsureInitializedForIsolate(isolate, "v8::String::New()");
LOG_API(isolate, "String::New(uint16_)");
if (length == 0) return Empty();
- ENTER_V8;
+ ENTER_V8(isolate);
if (length == -1) length = TwoByteStringLength(data);
i::Handle<i::String> result =
isolate->factory()->NewStringFromTwoByte(
@@ -3974,7 +4017,7 @@ Local<String> v8::String::NewUndetectable(const uint16_t* data, int length) {
i::Isolate* isolate = i::Isolate::Current();
EnsureInitializedForIsolate(isolate, "v8::String::NewUndetectable()");
LOG_API(isolate, "String::NewUndetectable(uint16_)");
- ENTER_V8;
+ ENTER_V8(isolate);
if (length == -1) length = TwoByteStringLength(data);
i::Handle<i::String> result =
isolate->factory()->NewStringFromTwoByte(
@@ -4005,7 +4048,7 @@ Local<String> v8::String::NewExternal(
i::Isolate* isolate = i::Isolate::Current();
EnsureInitializedForIsolate(isolate, "v8::String::NewExternal()");
LOG_API(isolate, "String::NewExternal");
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::String> result = NewExternalStringHandle(isolate, resource);
isolate->heap()->external_string_table()->AddString(*result);
return Utils::ToLocal(result);
@@ -4016,8 +4059,10 @@ bool v8::String::MakeExternal(v8::String::ExternalStringResource* resource) {
i::Handle<i::String> obj = Utils::OpenHandle(this);
i::Isolate* isolate = obj->GetIsolate();
if (IsDeadCheck(isolate, "v8::String::MakeExternal()")) return false;
- if (this->IsExternal()) return false; // Already an external string.
- ENTER_V8;
+ if (i::StringShape(*obj).IsExternalTwoByte()) {
+ return false; // Already an external string.
+ }
+ ENTER_V8(isolate);
if (isolate->string_tracker()->IsFreshUnusedString(obj)) {
return false;
}
@@ -4034,7 +4079,7 @@ Local<String> v8::String::NewExternal(
i::Isolate* isolate = i::Isolate::Current();
EnsureInitializedForIsolate(isolate, "v8::String::NewExternal()");
LOG_API(isolate, "String::NewExternal");
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::String> result = NewExternalAsciiStringHandle(isolate, resource);
isolate->heap()->external_string_table()->AddString(*result);
return Utils::ToLocal(result);
@@ -4046,8 +4091,10 @@ bool v8::String::MakeExternal(
i::Handle<i::String> obj = Utils::OpenHandle(this);
i::Isolate* isolate = obj->GetIsolate();
if (IsDeadCheck(isolate, "v8::String::MakeExternal()")) return false;
- if (this->IsExternal()) return false; // Already an external string.
- ENTER_V8;
+ if (i::StringShape(*obj).IsExternalTwoByte()) {
+ return false; // Already an external string.
+ }
+ ENTER_V8(isolate);
if (isolate->string_tracker()->IsFreshUnusedString(obj)) {
return false;
}
@@ -4078,7 +4125,7 @@ Local<v8::Object> v8::Object::New() {
i::Isolate* isolate = i::Isolate::Current();
EnsureInitializedForIsolate(isolate, "v8::Object::New()");
LOG_API(isolate, "Object::New");
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::JSObject> obj =
isolate->factory()->NewJSObject(isolate->object_function());
return Utils::ToLocal(obj);
@@ -4093,11 +4140,11 @@ Local<v8::Value> v8::Date::New(double time) {
// Introduce only canonical NaN value into the VM, to avoid signaling NaNs.
time = i::OS::nan_value();
}
- ENTER_V8;
- EXCEPTION_PREAMBLE();
+ ENTER_V8(isolate);
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> obj =
i::Execution::NewDate(time, &has_pending_exception);
- EXCEPTION_BAILOUT_CHECK(Local<v8::Value>());
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Value>());
return Utils::ToLocal(obj);
}
@@ -4117,7 +4164,7 @@ void v8::Date::DateTimeConfigurationChangeNotification() {
ON_BAILOUT(isolate, "v8::Date::DateTimeConfigurationChangeNotification()",
return);
LOG_API(isolate, "Date::DateTimeConfigurationChangeNotification");
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
// Get the function ResetDateCache (defined in date-delay.js).
@@ -4157,22 +4204,22 @@ static i::Handle<i::String> RegExpFlagsToString(RegExp::Flags flags) {
Local<v8::RegExp> v8::RegExp::New(Handle<String> pattern,
Flags flags) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(*pattern)->GetIsolate();
EnsureInitializedForIsolate(isolate, "v8::RegExp::New()");
LOG_API(isolate, "RegExp::New");
- ENTER_V8;
- EXCEPTION_PREAMBLE();
+ ENTER_V8(isolate);
+ EXCEPTION_PREAMBLE(isolate);
i::Handle<i::JSRegExp> obj = i::Execution::NewJSRegExp(
Utils::OpenHandle(*pattern),
RegExpFlagsToString(flags),
&has_pending_exception);
- EXCEPTION_BAILOUT_CHECK(Local<v8::RegExp>());
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::RegExp>());
return Utils::ToLocal(i::Handle<i::JSRegExp>::cast(obj));
}
Local<v8::String> v8::RegExp::GetSource() const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::RegExp::GetSource()")) {
return Local<v8::String>();
}
@@ -4204,7 +4251,7 @@ Local<v8::Array> v8::Array::New(int length) {
i::Isolate* isolate = i::Isolate::Current();
EnsureInitializedForIsolate(isolate, "v8::Array::New()");
LOG_API(isolate, "Array::New");
- ENTER_V8;
+ ENTER_V8(isolate);
int real_length = length > 0 ? length : 0;
i::Handle<i::JSArray> obj = isolate->factory()->NewJSArray(real_length);
obj->set_length(*isolate->factory()->NewNumberFromInt(real_length));
@@ -4213,7 +4260,7 @@ Local<v8::Array> v8::Array::New(int length) {
uint32_t v8::Array::Length() const {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::Array::Length()")) return 0;
i::Handle<i::JSArray> obj = Utils::OpenHandle(this);
i::Object* length = obj->length();
@@ -4226,7 +4273,7 @@ uint32_t v8::Array::Length() const {
Local<Object> Array::CloneElementAt(uint32_t index) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Array::CloneElementAt()", return Local<Object>());
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
if (!self->HasFastElements()) {
@@ -4238,11 +4285,11 @@ Local<Object> Array::CloneElementAt(uint32_t index) {
return Local<Object>();
}
i::Handle<i::JSObject> paragon_handle(i::JSObject::cast(paragon));
- EXCEPTION_PREAMBLE();
- ENTER_V8;
+ EXCEPTION_PREAMBLE(isolate);
+ ENTER_V8(isolate);
i::Handle<i::JSObject> result = i::Copy(paragon_handle);
has_pending_exception = result.is_null();
- EXCEPTION_BAILOUT_CHECK(Local<Object>());
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>());
return Utils::ToLocal(result);
}
@@ -4251,7 +4298,7 @@ Local<String> v8::String::NewSymbol(const char* data, int length) {
i::Isolate* isolate = i::Isolate::Current();
EnsureInitializedForIsolate(isolate, "v8::String::NewSymbol()");
LOG_API(isolate, "String::NewSymbol(char)");
- ENTER_V8;
+ ENTER_V8(isolate);
if (length == -1) length = i::StrLength(data);
i::Handle<i::String> result =
isolate->factory()->LookupSymbol(i::Vector<const char>(data, length));
@@ -4266,7 +4313,7 @@ Local<Number> v8::Number::New(double value) {
// Introduce only canonical NaN value into the VM, to avoid signaling NaNs.
value = i::OS::nan_value();
}
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::Object> result = isolate->factory()->NewNumber(value);
return Utils::NumberToLocal(result);
}
@@ -4279,7 +4326,7 @@ Local<Integer> v8::Integer::New(int32_t value) {
return Utils::IntegerToLocal(i::Handle<i::Object>(i::Smi::FromInt(value),
isolate));
}
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::Object> result = isolate->factory()->NewNumber(value);
return Utils::IntegerToLocal(result);
}
@@ -4290,8 +4337,9 @@ Local<Integer> Integer::NewFromUnsigned(uint32_t value) {
if (fits_into_int32_t) {
return Integer::New(static_cast<int32_t>(value));
}
- ENTER_V8;
- i::Handle<i::Object> result = FACTORY->NewNumber(value);
+ i::Isolate* isolate = i::Isolate::Current();
+ ENTER_V8(isolate);
+ i::Handle<i::Object> result = isolate->factory()->NewNumber(value);
return Utils::IntegerToLocal(result);
}
@@ -4306,7 +4354,7 @@ bool V8::AddMessageListener(MessageCallback that, Handle<Value> data) {
i::Isolate* isolate = i::Isolate::Current();
EnsureInitializedForIsolate(isolate, "v8::V8::AddMessageListener()");
ON_BAILOUT(isolate, "v8::V8::AddMessageListener()", return false);
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
NeanderArray listeners(isolate->factory()->message_listeners());
NeanderObject obj(2);
@@ -4323,7 +4371,7 @@ void V8::RemoveMessageListeners(MessageCallback that) {
i::Isolate* isolate = i::Isolate::Current();
EnsureInitializedForIsolate(isolate, "v8::V8::RemoveMessageListener()");
ON_BAILOUT(isolate, "v8::V8::RemoveMessageListeners()", return);
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
NeanderArray listeners(isolate->factory()->message_listeners());
for (int i = 0; i < listeners.length(); i++) {
@@ -4548,16 +4596,16 @@ int V8::GetLogLines(int from_pos, char* dest_buf, int max_size) {
int V8::GetCurrentThreadId() {
- API_ENTRY_CHECK("V8::GetCurrentThreadId()");
- EnsureInitialized("V8::GetCurrentThreadId()");
- return i::Isolate::Current()->thread_id();
+ i::Isolate* isolate = i::Isolate::Current();
+ EnsureInitializedForIsolate(isolate, "V8::GetCurrentThreadId()");
+ return isolate->thread_id();
}
void V8::TerminateExecution(int thread_id) {
i::Isolate* isolate = i::Isolate::Current();
if (!isolate->IsInitialized()) return;
- API_ENTRY_CHECK("V8::GetCurrentThreadId()");
+ API_ENTRY_CHECK("V8::TerminateExecution()");
// If the thread_id identifies the current thread just terminate
// execution right away. Otherwise, ask the thread manager to
// terminate the thread with the given id if any.
@@ -4626,14 +4674,15 @@ void Isolate::Exit() {
String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) {
- EnsureInitialized("v8::String::Utf8Value::Utf8Value()");
+ i::Isolate* isolate = i::Isolate::Current();
+ if (IsDeadCheck(isolate, "v8::String::Utf8Value::Utf8Value()")) return;
if (obj.IsEmpty()) {
str_ = NULL;
length_ = 0;
return;
}
- ENTER_V8;
- HandleScope scope;
+ ENTER_V8(isolate);
+ i::HandleScope scope(isolate);
TryCatch try_catch;
Handle<String> str = obj->ToString();
if (str.IsEmpty()) {
@@ -4653,14 +4702,15 @@ String::Utf8Value::~Utf8Value() {
String::AsciiValue::AsciiValue(v8::Handle<v8::Value> obj) {
- EnsureInitialized("v8::String::AsciiValue::AsciiValue()");
+ i::Isolate* isolate = i::Isolate::Current();
+ if (IsDeadCheck(isolate, "v8::String::AsciiValue::AsciiValue()")) return;
if (obj.IsEmpty()) {
str_ = NULL;
length_ = 0;
return;
}
- ENTER_V8;
- HandleScope scope;
+ ENTER_V8(isolate);
+ i::HandleScope scope(isolate);
TryCatch try_catch;
Handle<String> str = obj->ToString();
if (str.IsEmpty()) {
@@ -4680,14 +4730,15 @@ String::AsciiValue::~AsciiValue() {
String::Value::Value(v8::Handle<v8::Value> obj) {
- EnsureInitialized("v8::String::Value::Value()");
+ i::Isolate* isolate = i::Isolate::Current();
+ if (IsDeadCheck(isolate, "v8::String::Value::Value()")) return;
if (obj.IsEmpty()) {
str_ = NULL;
length_ = 0;
return;
}
- ENTER_V8;
- HandleScope scope;
+ ENTER_V8(isolate);
+ i::HandleScope scope(isolate);
TryCatch try_catch;
Handle<String> str = obj->ToString();
if (str.IsEmpty()) {
@@ -4709,7 +4760,7 @@ Local<Value> Exception::RangeError(v8::Handle<v8::String> raw_message) {
i::Isolate* isolate = i::Isolate::Current();
LOG_API(isolate, "RangeError");
ON_BAILOUT(isolate, "v8::Exception::RangeError()", return Local<Value>());
- ENTER_V8;
+ ENTER_V8(isolate);
i::Object* error;
{
i::HandleScope scope(isolate);
@@ -4725,7 +4776,7 @@ Local<Value> Exception::ReferenceError(v8::Handle<v8::String> raw_message) {
i::Isolate* isolate = i::Isolate::Current();
LOG_API(isolate, "ReferenceError");
ON_BAILOUT(isolate, "v8::Exception::ReferenceError()", return Local<Value>());
- ENTER_V8;
+ ENTER_V8(isolate);
i::Object* error;
{
i::HandleScope scope(isolate);
@@ -4742,7 +4793,7 @@ Local<Value> Exception::SyntaxError(v8::Handle<v8::String> raw_message) {
i::Isolate* isolate = i::Isolate::Current();
LOG_API(isolate, "SyntaxError");
ON_BAILOUT(isolate, "v8::Exception::SyntaxError()", return Local<Value>());
- ENTER_V8;
+ ENTER_V8(isolate);
i::Object* error;
{
i::HandleScope scope(isolate);
@@ -4758,7 +4809,7 @@ Local<Value> Exception::TypeError(v8::Handle<v8::String> raw_message) {
i::Isolate* isolate = i::Isolate::Current();
LOG_API(isolate, "TypeError");
ON_BAILOUT(isolate, "v8::Exception::TypeError()", return Local<Value>());
- ENTER_V8;
+ ENTER_V8(isolate);
i::Object* error;
{
i::HandleScope scope(isolate);
@@ -4774,7 +4825,7 @@ Local<Value> Exception::Error(v8::Handle<v8::String> raw_message) {
i::Isolate* isolate = i::Isolate::Current();
LOG_API(isolate, "Error");
ON_BAILOUT(isolate, "v8::Exception::Error()", return Local<Value>());
- ENTER_V8;
+ ENTER_V8(isolate);
i::Object* error;
{
i::HandleScope scope(isolate);
@@ -4806,7 +4857,7 @@ bool Debug::SetDebugEventListener(EventCallback that, Handle<Value> data) {
i::Isolate* isolate = i::Isolate::Current();
EnsureInitializedForIsolate(isolate, "v8::Debug::SetDebugEventListener()");
ON_BAILOUT(isolate, "v8::Debug::SetDebugEventListener()", return false);
- ENTER_V8;
+ ENTER_V8(isolate);
isolate->set_debug_event_callback(that);
@@ -4824,7 +4875,7 @@ bool Debug::SetDebugEventListener2(EventCallback2 that, Handle<Value> data) {
i::Isolate* isolate = i::Isolate::Current();
EnsureInitializedForIsolate(isolate, "v8::Debug::SetDebugEventListener2()");
ON_BAILOUT(isolate, "v8::Debug::SetDebugEventListener2()", return false);
- ENTER_V8;
+ ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::Object> proxy = isolate->factory()->undefined_value();
if (that != NULL) {
@@ -4840,7 +4891,7 @@ bool Debug::SetDebugEventListener(v8::Handle<v8::Object> that,
Handle<Value> data) {
i::Isolate* isolate = i::Isolate::Current();
ON_BAILOUT(isolate, "v8::Debug::SetDebugEventListener()", return false);
- ENTER_V8;
+ ENTER_V8(isolate);
isolate->debugger()->SetEventListener(Utils::OpenHandle(*that),
Utils::OpenHandle(*data));
return true;
@@ -4890,11 +4941,12 @@ static void MessageHandlerWrapper(const v8::Debug::Message& message) {
void Debug::SetMessageHandler(v8::Debug::MessageHandler handler,
bool message_handler_thread) {
- EnsureInitialized("v8::Debug::SetMessageHandler");
- ENTER_V8;
i::Isolate* isolate = i::Isolate::Current();
+ EnsureInitializedForIsolate(isolate, "v8::Debug::SetMessageHandler");
+ ENTER_V8(isolate);
+
// Message handler thread not supported any more. Parameter temporally left in
- // the API for client compatability reasons.
+ // the API for client compatibility reasons.
CHECK(!message_handler_thread);
// TODO(sgjesse) support the old message handler API through a simple wrapper.
@@ -4908,9 +4960,10 @@ void Debug::SetMessageHandler(v8::Debug::MessageHandler handler,
void Debug::SetMessageHandler2(v8::Debug::MessageHandler2 handler) {
- EnsureInitialized("v8::Debug::SetMessageHandler");
- ENTER_V8;
- i::Isolate::Current()->debugger()->SetMessageHandler(handler);
+ i::Isolate* isolate = i::Isolate::Current();
+ EnsureInitializedForIsolate(isolate, "v8::Debug::SetMessageHandler");
+ ENTER_V8(isolate);
+ isolate->debugger()->SetMessageHandler(handler);
}
@@ -4931,17 +4984,20 @@ void Debug::SendCommand(const uint16_t* command, int length,
void Debug::SetHostDispatchHandler(HostDispatchHandler handler,
int period) {
- EnsureInitialized("v8::Debug::SetHostDispatchHandler");
- ENTER_V8;
- i::Isolate::Current()->debugger()->SetHostDispatchHandler(handler, period);
+ i::Isolate* isolate = i::Isolate::Current();
+ EnsureInitializedForIsolate(isolate, "v8::Debug::SetHostDispatchHandler");
+ ENTER_V8(isolate);
+ isolate->debugger()->SetHostDispatchHandler(handler, period);
}
void Debug::SetDebugMessageDispatchHandler(
DebugMessageDispatchHandler handler, bool provide_locker) {
- EnsureInitialized("v8::Debug::SetDebugMessageDispatchHandler");
- ENTER_V8;
- i::Isolate::Current()->debugger()->SetDebugMessageDispatchHandler(
+ i::Isolate* isolate = i::Isolate::Current();
+ EnsureInitializedForIsolate(isolate,
+ "v8::Debug::SetDebugMessageDispatchHandler");
+ ENTER_V8(isolate);
+ isolate->debugger()->SetDebugMessageDispatchHandler(
handler, provide_locker);
}
@@ -4951,20 +5007,19 @@ Local<Value> Debug::Call(v8::Handle<v8::Function> fun,
i::Isolate* isolate = i::Isolate::Current();
if (!isolate->IsInitialized()) return Local<Value>();
ON_BAILOUT(isolate, "v8::Debug::Call()", return Local<Value>());
- ENTER_V8;
+ ENTER_V8(isolate);
i::Handle<i::Object> result;
- EXCEPTION_PREAMBLE();
+ EXCEPTION_PREAMBLE(isolate);
if (data.IsEmpty()) {
- result = isolate->debugger()->Call(
- Utils::OpenHandle(*fun),
- isolate->factory()->undefined_value(),
- &has_pending_exception);
+ result = isolate->debugger()->Call(Utils::OpenHandle(*fun),
+ isolate->factory()->undefined_value(),
+ &has_pending_exception);
} else {
result = isolate->debugger()->Call(Utils::OpenHandle(*fun),
- Utils::OpenHandle(*data),
- &has_pending_exception);
+ Utils::OpenHandle(*data),
+ &has_pending_exception);
}
- EXCEPTION_BAILOUT_CHECK(Local<Value>());
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
return Utils::ToLocal(result);
}
@@ -4973,7 +5028,7 @@ Local<Value> Debug::GetMirror(v8::Handle<v8::Value> obj) {
i::Isolate* isolate = i::Isolate::Current();
if (!isolate->IsInitialized()) return Local<Value>();
ON_BAILOUT(isolate, "v8::Debug::GetMirror()", return Local<Value>());
- ENTER_V8;
+ ENTER_V8(isolate);
v8::HandleScope scope;
i::Debug* isolate_debug = isolate->debug();
isolate_debug->Load();
@@ -4985,11 +5040,11 @@ Local<Value> Debug::GetMirror(v8::Handle<v8::Value> obj) {
v8::Handle<v8::Function> v8_fun = Utils::ToLocal(fun);
const int kArgc = 1;
v8::Handle<v8::Value> argv[kArgc] = { obj };
- EXCEPTION_PREAMBLE();
+ EXCEPTION_PREAMBLE(isolate);
v8::Handle<v8::Value> result = v8_fun->Call(Utils::ToLocal(debug),
kArgc,
argv);
- EXCEPTION_BAILOUT_CHECK(Local<Value>());
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
return scope.Close(result);
}
@@ -5004,8 +5059,9 @@ void Debug::ProcessDebugMessages() {
}
Local<Context> Debug::GetDebugContext() {
- EnsureInitialized("v8::Debug::GetDebugContext()");
- ENTER_V8;
+ i::Isolate* isolate = i::Isolate::Current();
+ EnsureInitializedForIsolate(isolate, "v8::Debug::GetDebugContext()");
+ ENTER_V8(isolate);
return Utils::ToLocal(i::Isolate::Current()->debugger()->GetDebugContext());
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698