*/
bool IsDataView() const;
- Local<Boolean> ToBoolean() const;
- Local<Number> ToNumber() const;
- Local<String> ToString() const;
- Local<String> ToDetailString() const;
- Local<Object> ToObject() const;
- Local<Integer> ToInteger() const;
- Local<Uint32> ToUint32() const;
- Local<Int32> ToInt32() const;
+ Local<Boolean> ToBoolean(Isolate* isolate) const;
+ Local<Number> ToNumber(Isolate* isolate) const;
+ Local<String> ToString(Isolate* isolate) const;
+ Local<String> ToDetailString(Isolate* isolate) const;
+ Local<Object> ToObject(Isolate* isolate) const;
+ Local<Integer> ToInteger(Isolate* isolate) const;
+ Local<Uint32> ToUint32(Isolate* isolate) const;
+ Local<Int32> ToInt32(Isolate* isolate) const;
+
+ // TODO(dcarney): deprecate all these.
+ inline Local<Boolean> ToBoolean() const;
+ inline Local<Number> ToNumber() const;
+ inline Local<String> ToString() const;
+ inline Local<String> ToDetailString() const;
+ inline Local<Object> ToObject() const;
+ inline Local<Integer> ToInteger() const;
+ inline Local<Uint32> ToUint32() const;
+ inline Local<Int32> ToInt32() const;
/**
* Attempts to convert a string to an array index.
}
+Local<Boolean> Value::ToBoolean() const {
+ return ToBoolean(Isolate::GetCurrent());
+}
+
+
+Local<Number> Value::ToNumber() const {
+ return ToNumber(Isolate::GetCurrent());
+}
+
+
+Local<String> Value::ToString() const {
+ return ToString(Isolate::GetCurrent());
+}
+
+
+Local<String> Value::ToDetailString() const {
+ return ToDetailString(Isolate::GetCurrent());
+}
+
+
+Local<Object> Value::ToObject() const {
+ return ToObject(Isolate::GetCurrent());
+}
+
+
+Local<Integer> Value::ToInteger() const {
+ return ToInteger(Isolate::GetCurrent());
+}
+
+
+Local<Uint32> Value::ToUint32() const {
+ return ToUint32(Isolate::GetCurrent());
+}
+
+
+Local<Int32> Value::ToInt32() const { return ToInt32(Isolate::GetCurrent()); }
+
+
Name* Name::Cast(v8::Value* value) {
#ifdef V8_ENABLE_CHECKS
CheckCast(value);
}
-Local<String> Value::ToString() const {
+Local<String> Value::ToString(Isolate* v8_isolate) const {
i::Handle<i::Object> obj = Utils::OpenHandle(this);
i::Handle<i::Object> str;
if (obj->IsString()) {
str = obj;
} else {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
LOG_API(isolate, "ToString");
ENTER_V8(isolate);
EXCEPTION_PREAMBLE(isolate);
}
-Local<String> Value::ToDetailString() const {
+Local<String> Value::ToDetailString(Isolate* v8_isolate) const {
i::Handle<i::Object> obj = Utils::OpenHandle(this);
i::Handle<i::Object> str;
if (obj->IsString()) {
str = obj;
} else {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
LOG_API(isolate, "ToDetailString");
ENTER_V8(isolate);
EXCEPTION_PREAMBLE(isolate);
}
-Local<v8::Object> Value::ToObject() const {
+Local<v8::Object> Value::ToObject(Isolate* v8_isolate) const {
i::Handle<i::Object> obj = Utils::OpenHandle(this);
i::Handle<i::Object> val;
if (obj->IsJSObject()) {
val = obj;
} else {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
LOG_API(isolate, "ToObject");
ENTER_V8(isolate);
EXCEPTION_PREAMBLE(isolate);
}
-Local<Boolean> Value::ToBoolean() const {
+Local<Boolean> Value::ToBoolean(Isolate* v8_isolate) const {
i::Handle<i::Object> obj = Utils::OpenHandle(this);
if (obj->IsBoolean()) {
return ToApiHandle<Boolean>(obj);
} else {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
LOG_API(isolate, "ToBoolean");
ENTER_V8(isolate);
i::Handle<i::Object> val =
}
-Local<Number> Value::ToNumber() const {
+Local<Number> Value::ToNumber(Isolate* v8_isolate) const {
i::Handle<i::Object> obj = Utils::OpenHandle(this);
i::Handle<i::Object> num;
if (obj->IsNumber()) {
num = obj;
} else {
- i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate();
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
LOG_API(isolate, "ToNumber");
ENTER_V8(isolate);
EXCEPTION_PREAMBLE(isolate);
}
-Local<Integer> Value::ToInteger() const {
+Local<Integer> Value::ToInteger(Isolate* v8_isolate) const {
i::Handle<i::Object> obj = Utils::OpenHandle(this);
i::Handle<i::Object> num;
if (obj->IsSmi()) {
num = obj;
} else {
- i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate();
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
LOG_API(isolate, "ToInteger");
ENTER_V8(isolate);
EXCEPTION_PREAMBLE(isolate);
}
-Local<Int32> Value::ToInt32() const {
+Local<Int32> Value::ToInt32(Isolate* v8_isolate) const {
i::Handle<i::Object> obj = Utils::OpenHandle(this);
i::Handle<i::Object> num;
if (obj->IsSmi()) {
num = obj;
} else {
- i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate();
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
LOG_API(isolate, "ToInt32");
ENTER_V8(isolate);
EXCEPTION_PREAMBLE(isolate);
}
-Local<Uint32> Value::ToUint32() const {
+Local<Uint32> Value::ToUint32(Isolate* v8_isolate) const {
i::Handle<i::Object> obj = Utils::OpenHandle(this);
i::Handle<i::Object> num;
if (obj->IsSmi()) {
num = obj;
} else {
- i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate();
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
LOG_API(isolate, "ToUInt32");
ENTER_V8(isolate);
EXCEPTION_PREAMBLE(isolate);
ENTER_V8(isolate);
i::HandleScope scope(isolate);
TryCatch try_catch;
- Handle<String> str = obj->ToString();
+ Handle<String> str = obj->ToString(reinterpret_cast<v8::Isolate*>(isolate));
if (str.IsEmpty()) return;
i::Handle<i::String> i_str = Utils::OpenHandle(*str);
length_ = v8::Utf8Length(*i_str, isolate);
ENTER_V8(isolate);
i::HandleScope scope(isolate);
TryCatch try_catch;
- Handle<String> str = obj->ToString();
+ Handle<String> str = obj->ToString(reinterpret_cast<v8::Isolate*>(isolate));
if (str.IsEmpty()) return;
length_ = str->Length();
str_ = i::NewArray<uint16_t>(length_ + 1);
int name_length = 0;
uint16_t* name_buffer = NULL;
if (name->IsString()) {
- Local<String> name_string = name->ToString();
+ Local<String> name_string = Local<String>::Cast(name);
name_length = name_string->Length();
name_buffer = new uint16_t[name_length];
name_string->Write(name_buffer, 0, name_length);
Throw(args.GetIsolate(), "Invalid argument");
return;
}
- int index = data->RealmFind(args[0]->ToObject()->CreationContext());
+ int index = data->RealmFind(args[0]->ToObject(isolate)->CreationContext());
if (index == -1) return;
args.GetReturnValue().Set(index);
}
Throw(args.GetIsolate(), "Invalid argument");
return;
}
- ScriptCompiler::Source script_source(args[1]->ToString());
+ ScriptCompiler::Source script_source(args[1]->ToString(isolate));
Handle<UnboundScript> script = ScriptCompiler::CompileUnbound(
isolate, &script_source);
if (script.IsEmpty()) return;
// Explicitly catch potential exceptions in toString().
v8::TryCatch try_catch;
- Handle<String> str_obj = args[i]->ToString();
+ Handle<String> str_obj = args[i]->ToString(args.GetIsolate());
if (try_catch.HasCaught()) {
try_catch.ReThrow();
return;