| Index: src/api.cc
|
| diff --git a/src/api.cc b/src/api.cc
|
| index 6cb4db5cff57edf464a7835addcc64cb669456a4..523b0cec65dc28a42117d075c924c4e9aba808c3 100644
|
| --- a/src/api.cc
|
| +++ b/src/api.cc
|
| @@ -1078,32 +1078,42 @@ static Local<FunctionTemplate> FunctionTemplateNew(
|
| }
|
|
|
| Local<FunctionTemplate> FunctionTemplate::New(
|
| + Isolate* isolate,
|
| FunctionCallback callback,
|
| v8::Handle<Value> data,
|
| v8::Handle<Signature> signature,
|
| int length) {
|
| - i::Isolate* isolate = i::Isolate::Current();
|
| - EnsureInitializedForIsolate(isolate, "v8::FunctionTemplate::New()");
|
| - LOG_API(isolate, "FunctionTemplate::New");
|
| - ENTER_V8(isolate);
|
| + i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
| + EnsureInitializedForIsolate(i_isolate, "v8::FunctionTemplate::New()");
|
| + LOG_API(i_isolate, "FunctionTemplate::New");
|
| + ENTER_V8(i_isolate);
|
| return FunctionTemplateNew(
|
| - isolate, callback, data, signature, length, false);
|
| + i_isolate, callback, data, signature, length, false);
|
| }
|
|
|
|
|
| -Local<Signature> Signature::New(Handle<FunctionTemplate> receiver,
|
| - int argc, Handle<FunctionTemplate> argv[]) {
|
| - i::Isolate* isolate = i::Isolate::Current();
|
| - EnsureInitializedForIsolate(isolate, "v8::Signature::New()");
|
| - LOG_API(isolate, "Signature::New");
|
| - ENTER_V8(isolate);
|
| +Local<FunctionTemplate> FunctionTemplate::New(
|
| + FunctionCallback callback,
|
| + v8::Handle<Value> data,
|
| + v8::Handle<Signature> signature,
|
| + int length) {
|
| + return New(Isolate::GetCurrent(), callback, data, signature, length);
|
| +}
|
| +
|
| +Local<Signature> Signature::New(Isolate* isolate,
|
| + Handle<FunctionTemplate> receiver, int argc,
|
| + Handle<FunctionTemplate> argv[]) {
|
| + i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
| + EnsureInitializedForIsolate(i_isolate, "v8::Signature::New()");
|
| + LOG_API(i_isolate, "Signature::New");
|
| + ENTER_V8(i_isolate);
|
| i::Handle<i::Struct> struct_obj =
|
| - isolate->factory()->NewStruct(i::SIGNATURE_INFO_TYPE);
|
| + i_isolate->factory()->NewStruct(i::SIGNATURE_INFO_TYPE);
|
| i::Handle<i::SignatureInfo> obj =
|
| i::Handle<i::SignatureInfo>::cast(struct_obj);
|
| if (!receiver.IsEmpty()) obj->set_receiver(*Utils::OpenHandle(*receiver));
|
| if (argc > 0) {
|
| - i::Handle<i::FixedArray> args = isolate->factory()->NewFixedArray(argc);
|
| + i::Handle<i::FixedArray> args = i_isolate->factory()->NewFixedArray(argc);
|
| for (int i = 0; i < argc; i++) {
|
| if (!argv[i].IsEmpty())
|
| args->set(i, *Utils::OpenHandle(*argv[i]));
|
| @@ -1114,6 +1124,20 @@ Local<Signature> Signature::New(Handle<FunctionTemplate> receiver,
|
| }
|
|
|
|
|
| +Local<Signature> Signature::New(Handle<FunctionTemplate> receiver,
|
| + int argc, Handle<FunctionTemplate> argv[]) {
|
| + return New(Isolate::GetCurrent(), receiver, argc, argv);
|
| +}
|
| +
|
| +
|
| +Local<AccessorSignature> AccessorSignature::New(
|
| + Isolate* isolate,
|
| + Handle<FunctionTemplate> receiver) {
|
| + return Utils::AccessorSignatureToLocal(Utils::OpenHandle(*receiver));
|
| +}
|
| +
|
| +
|
| +// While this is just a cast, it's lame not to use an Isolate parameter.
|
| Local<AccessorSignature> AccessorSignature::New(
|
| Handle<FunctionTemplate> receiver) {
|
| return Utils::AccessorSignatureToLocal(Utils::OpenHandle(*receiver));
|
| @@ -1363,7 +1387,7 @@ Local<ObjectTemplate> FunctionTemplate::InstanceTemplate() {
|
| i::Handle<i::FunctionTemplateInfo> handle = Utils::OpenHandle(this);
|
| if (handle->instance_template()->IsUndefined()) {
|
| Local<ObjectTemplate> templ =
|
| - ObjectTemplate::New(ToApiHandle<FunctionTemplate>(handle));
|
| + ObjectTemplate::New(isolate, ToApiHandle<FunctionTemplate>(handle));
|
| handle->set_instance_template(*Utils::OpenHandle(*templ));
|
| }
|
| i::Handle<i::ObjectTemplateInfo> result(
|
| @@ -1410,14 +1434,19 @@ void FunctionTemplate::RemovePrototype() {
|
| // --- O b j e c t T e m p l a t e ---
|
|
|
|
|
| +Local<ObjectTemplate> ObjectTemplate::New(Isolate* isolate) {
|
| + return New(reinterpret_cast<i::Isolate*>(isolate), Local<FunctionTemplate>());
|
| +}
|
| +
|
| +
|
| Local<ObjectTemplate> ObjectTemplate::New() {
|
| - return New(Local<FunctionTemplate>());
|
| + return New(i::Isolate::Current(), Local<FunctionTemplate>());
|
| }
|
|
|
|
|
| Local<ObjectTemplate> ObjectTemplate::New(
|
| + i::Isolate* isolate,
|
| v8::Handle<FunctionTemplate> constructor) {
|
| - i::Isolate* isolate = i::Isolate::Current();
|
| EnsureInitializedForIsolate(isolate, "v8::ObjectTemplate::New()");
|
| LOG_API(isolate, "ObjectTemplate::New");
|
| ENTER_V8(isolate);
|
| @@ -2108,18 +2137,18 @@ Local<String> Message::Get() const {
|
| i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
|
| ON_BAILOUT(isolate, "v8::Message::Get()", return Local<String>());
|
| ENTER_V8(isolate);
|
| - HandleScope scope(reinterpret_cast<Isolate*>(isolate));
|
| + EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
|
| i::Handle<i::Object> obj = Utils::OpenHandle(this);
|
| i::Handle<i::String> raw_result = i::MessageHandler::GetMessage(isolate, obj);
|
| Local<String> result = Utils::ToLocal(raw_result);
|
| - return scope.Close(result);
|
| + return scope.Escape(result);
|
| }
|
|
|
|
|
| v8::Handle<Value> Message::GetScriptResourceName() const {
|
| i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
|
| ENTER_V8(isolate);
|
| - HandleScope scope(reinterpret_cast<Isolate*>(isolate));
|
| + EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
|
| i::Handle<i::JSMessageObject> message =
|
| i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
|
| // Return this.script.name.
|
| @@ -2128,14 +2157,14 @@ v8::Handle<Value> Message::GetScriptResourceName() const {
|
| isolate));
|
| i::Handle<i::Object> resource_name(i::Script::cast(script->value())->name(),
|
| isolate);
|
| - return scope.Close(Utils::ToLocal(resource_name));
|
| + return scope.Escape(Utils::ToLocal(resource_name));
|
| }
|
|
|
|
|
| v8::Handle<Value> Message::GetScriptData() const {
|
| i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
|
| ENTER_V8(isolate);
|
| - HandleScope scope(reinterpret_cast<Isolate*>(isolate));
|
| + EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
|
| i::Handle<i::JSMessageObject> message =
|
| i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
|
| // Return this.script.data.
|
| @@ -2143,21 +2172,21 @@ v8::Handle<Value> Message::GetScriptData() const {
|
| i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script(),
|
| isolate));
|
| i::Handle<i::Object> data(i::Script::cast(script->value())->data(), isolate);
|
| - return scope.Close(Utils::ToLocal(data));
|
| + return scope.Escape(Utils::ToLocal(data));
|
| }
|
|
|
|
|
| v8::Handle<v8::StackTrace> Message::GetStackTrace() const {
|
| i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
|
| ENTER_V8(isolate);
|
| - HandleScope scope(reinterpret_cast<Isolate*>(isolate));
|
| + EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
|
| i::Handle<i::JSMessageObject> message =
|
| i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
|
| i::Handle<i::Object> stackFramesObj(message->stack_frames(), isolate);
|
| if (!stackFramesObj->IsJSArray()) return v8::Handle<v8::StackTrace>();
|
| i::Handle<i::JSArray> stackTrace =
|
| i::Handle<i::JSArray>::cast(stackFramesObj);
|
| - return scope.Close(Utils::StackTraceToLocal(stackTrace));
|
| + return scope.Escape(Utils::StackTraceToLocal(stackTrace));
|
| }
|
|
|
|
|
| @@ -2277,24 +2306,29 @@ Local<String> Message::GetSourceLine() const {
|
| i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
|
| ON_BAILOUT(isolate, "v8::Message::GetSourceLine()", return Local<String>());
|
| ENTER_V8(isolate);
|
| - HandleScope scope(reinterpret_cast<Isolate*>(isolate));
|
| + EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
|
| EXCEPTION_PREAMBLE(isolate);
|
| i::Handle<i::Object> result = CallV8HeapFunction("GetSourceLine",
|
| Utils::OpenHandle(this),
|
| &has_pending_exception);
|
| EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::String>());
|
| if (result->IsString()) {
|
| - return scope.Close(Utils::ToLocal(i::Handle<i::String>::cast(result)));
|
| + return scope.Escape(Utils::ToLocal(i::Handle<i::String>::cast(result)));
|
| } else {
|
| return Local<String>();
|
| }
|
| }
|
|
|
|
|
| +void Message::PrintCurrentStackTrace(Isolate* isolate, FILE* out) {
|
| + i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
| + ENTER_V8(i_isolate);
|
| + i_isolate->PrintCurrentStackTrace(out);
|
| +}
|
| +
|
| +
|
| void Message::PrintCurrentStackTrace(FILE* out) {
|
| - i::Isolate* isolate = i::Isolate::Current();
|
| - ENTER_V8(isolate);
|
| - isolate->PrintCurrentStackTrace(out);
|
| + PrintCurrentStackTrace(Isolate::GetCurrent(), out);
|
| }
|
|
|
|
|
| @@ -2303,11 +2337,11 @@ void Message::PrintCurrentStackTrace(FILE* out) {
|
| Local<StackFrame> StackTrace::GetFrame(uint32_t index) const {
|
| i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
|
| ENTER_V8(isolate);
|
| - HandleScope scope(reinterpret_cast<Isolate*>(isolate));
|
| + EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
|
| i::Handle<i::JSArray> self = Utils::OpenHandle(this);
|
| i::Object* raw_object = self->GetElementNoExceptionThrown(isolate, index);
|
| i::Handle<i::JSObject> obj(i::JSObject::cast(raw_object));
|
| - return scope.Close(Utils::StackFrameToLocal(obj));
|
| + return scope.Escape(Utils::StackFrameToLocal(obj));
|
| }
|
|
|
|
|
| @@ -2325,16 +2359,24 @@ Local<Array> StackTrace::AsArray() {
|
| }
|
|
|
|
|
| -Local<StackTrace> StackTrace::CurrentStackTrace(int frame_limit,
|
| +Local<StackTrace> StackTrace::CurrentStackTrace(
|
| + Isolate* isolate,
|
| + int frame_limit,
|
| StackTraceOptions options) {
|
| - i::Isolate* isolate = i::Isolate::Current();
|
| - ENTER_V8(isolate);
|
| + i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
| + ENTER_V8(i_isolate);
|
| i::Handle<i::JSArray> stackTrace =
|
| - isolate->CaptureCurrentStackTrace(frame_limit, options);
|
| + i_isolate->CaptureCurrentStackTrace(frame_limit, options);
|
| return Utils::StackTraceToLocal(stackTrace);
|
| }
|
|
|
|
|
| +Local<StackTrace> StackTrace::CurrentStackTrace(int frame_limit,
|
| + StackTraceOptions options) {
|
| + return CurrentStackTrace(Isolate::GetCurrent(), frame_limit, options);
|
| +}
|
| +
|
| +
|
| // --- S t a c k F r a m e ---
|
|
|
| int StackFrame::GetLineNumber() const {
|
| @@ -2379,39 +2421,39 @@ int StackFrame::GetScriptId() const {
|
| Local<String> StackFrame::GetScriptName() const {
|
| i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
|
| ENTER_V8(isolate);
|
| - HandleScope scope(reinterpret_cast<Isolate*>(isolate));
|
| + EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
|
| i::Handle<i::JSObject> self = Utils::OpenHandle(this);
|
| i::Handle<i::Object> name = GetProperty(self, "scriptName");
|
| if (!name->IsString()) {
|
| return Local<String>();
|
| }
|
| - return scope.Close(Local<String>::Cast(Utils::ToLocal(name)));
|
| + return scope.Escape(Local<String>::Cast(Utils::ToLocal(name)));
|
| }
|
|
|
|
|
| Local<String> StackFrame::GetScriptNameOrSourceURL() const {
|
| i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
|
| ENTER_V8(isolate);
|
| - HandleScope scope(reinterpret_cast<Isolate*>(isolate));
|
| + EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
|
| i::Handle<i::JSObject> self = Utils::OpenHandle(this);
|
| i::Handle<i::Object> name = GetProperty(self, "scriptNameOrSourceURL");
|
| if (!name->IsString()) {
|
| return Local<String>();
|
| }
|
| - return scope.Close(Local<String>::Cast(Utils::ToLocal(name)));
|
| + return scope.Escape(Local<String>::Cast(Utils::ToLocal(name)));
|
| }
|
|
|
|
|
| Local<String> StackFrame::GetFunctionName() const {
|
| i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
|
| ENTER_V8(isolate);
|
| - HandleScope scope(reinterpret_cast<Isolate*>(isolate));
|
| + EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
|
| i::Handle<i::JSObject> self = Utils::OpenHandle(this);
|
| i::Handle<i::Object> name = GetProperty(self, "functionName");
|
| if (!name->IsString()) {
|
| return Local<String>();
|
| }
|
| - return scope.Close(Local<String>::Cast(Utils::ToLocal(name)));
|
| + return scope.Escape(Local<String>::Cast(Utils::ToLocal(name)));
|
| }
|
|
|
|
|
| @@ -4018,8 +4060,7 @@ bool v8::Object::IsCallable() {
|
| ENTER_V8(isolate);
|
| i::HandleScope scope(isolate);
|
| i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
|
| - if (obj->IsJSFunction()) return true;
|
| - return i::Execution::GetFunctionDelegate(isolate, obj)->IsJSFunction();
|
| + return obj->IsCallable();
|
| }
|
|
|
|
|
| @@ -4123,7 +4164,7 @@ Local<v8::Object> Function::NewInstance(int argc,
|
| ENTER_V8(isolate);
|
| i::Logger::TimerEventScope timer_scope(
|
| isolate, i::Logger::TimerEventScope::v8_execute);
|
| - HandleScope scope(reinterpret_cast<Isolate*>(isolate));
|
| + EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
|
| i::Handle<i::JSFunction> function = Utils::OpenHandle(this);
|
| STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**));
|
| i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
|
| @@ -4131,7 +4172,7 @@ Local<v8::Object> Function::NewInstance(int argc,
|
| i::Handle<i::Object> returned =
|
| i::Execution::New(function, argc, args, &has_pending_exception);
|
| EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>());
|
| - return scope.Close(Utils::ToLocal(i::Handle<i::JSObject>::cast(returned)));
|
| + return scope.Escape(Utils::ToLocal(i::Handle<i::JSObject>::cast(returned)));
|
| }
|
|
|
|
|
| @@ -5283,7 +5324,6 @@ static i::Handle<i::Context> CreateEnvironment(
|
| global_constructor->set_needs_access_check(
|
| proxy_constructor->needs_access_check());
|
| }
|
| - isolate->runtime_profiler()->Reset();
|
| }
|
| // Leave V8.
|
|
|
| @@ -5652,18 +5692,25 @@ bool RedirectToExternalString(i::Isolate* isolate,
|
|
|
|
|
| Local<String> v8::String::NewExternal(
|
| + Isolate* isolate,
|
| v8::String::ExternalStringResource* resource) {
|
| - i::Isolate* isolate = i::Isolate::Current();
|
| - EnsureInitializedForIsolate(isolate, "v8::String::NewExternal()");
|
| - LOG_API(isolate, "String::NewExternal");
|
| - ENTER_V8(isolate);
|
| + i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
| + EnsureInitializedForIsolate(i_isolate, "v8::String::NewExternal()");
|
| + LOG_API(i_isolate, "String::NewExternal");
|
| + ENTER_V8(i_isolate);
|
| CHECK(resource && resource->data());
|
| - i::Handle<i::String> result = NewExternalStringHandle(isolate, resource);
|
| - isolate->heap()->external_string_table()->AddString(*result);
|
| + i::Handle<i::String> result = NewExternalStringHandle(i_isolate, resource);
|
| + i_isolate->heap()->external_string_table()->AddString(*result);
|
| return Utils::ToLocal(result);
|
| }
|
|
|
|
|
| +Local<String> v8::String::NewExternal(
|
| + v8::String::ExternalStringResource* resource) {
|
| + return NewExternal(Isolate::GetCurrent(), resource);
|
| +}
|
| +
|
| +
|
| bool v8::String::MakeExternal(v8::String::ExternalStringResource* resource) {
|
| i::Handle<i::String> obj = Utils::OpenHandle(this);
|
| i::Isolate* isolate = obj->GetIsolate();
|
| @@ -5692,8 +5739,8 @@ bool v8::String::MakeExternal(v8::String::ExternalStringResource* resource) {
|
| external = obj;
|
| }
|
|
|
| - ASSERT(external->IsExternalString());
|
| - if (result && !external->IsInternalizedString()) {
|
| + if (result) {
|
| + ASSERT(external->IsExternalString());
|
| isolate->heap()->external_string_table()->AddString(*external);
|
| }
|
| return result;
|
| @@ -5701,18 +5748,26 @@ bool v8::String::MakeExternal(v8::String::ExternalStringResource* resource) {
|
|
|
|
|
| Local<String> v8::String::NewExternal(
|
| + Isolate* isolate,
|
| v8::String::ExternalAsciiStringResource* resource) {
|
| - i::Isolate* isolate = i::Isolate::Current();
|
| - EnsureInitializedForIsolate(isolate, "v8::String::NewExternal()");
|
| - LOG_API(isolate, "String::NewExternal");
|
| - ENTER_V8(isolate);
|
| + i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
| + EnsureInitializedForIsolate(i_isolate, "v8::String::NewExternal()");
|
| + LOG_API(i_isolate, "String::NewExternal");
|
| + ENTER_V8(i_isolate);
|
| CHECK(resource && resource->data());
|
| - i::Handle<i::String> result = NewExternalAsciiStringHandle(isolate, resource);
|
| - isolate->heap()->external_string_table()->AddString(*result);
|
| + i::Handle<i::String> result =
|
| + NewExternalAsciiStringHandle(i_isolate, resource);
|
| + i_isolate->heap()->external_string_table()->AddString(*result);
|
| return Utils::ToLocal(result);
|
| }
|
|
|
|
|
| +Local<String> v8::String::NewExternal(
|
| + v8::String::ExternalAsciiStringResource* resource) {
|
| + return NewExternal(Isolate::GetCurrent(), resource);
|
| +}
|
| +
|
| +
|
| bool v8::String::MakeExternal(
|
| v8::String::ExternalAsciiStringResource* resource) {
|
| i::Handle<i::String> obj = Utils::OpenHandle(this);
|
| @@ -5742,8 +5797,8 @@ bool v8::String::MakeExternal(
|
| external = obj;
|
| }
|
|
|
| - ASSERT(external->IsExternalString());
|
| - if (result && !external->IsInternalizedString()) {
|
| + if (result) {
|
| + ASSERT(external->IsExternalString());
|
| isolate->heap()->external_string_table()->AddString(*external);
|
| }
|
| return result;
|
| @@ -5768,28 +5823,38 @@ bool v8::String::CanMakeExternal() {
|
| }
|
|
|
|
|
| -Local<v8::Object> v8::Object::New() {
|
| - i::Isolate* isolate = i::Isolate::Current();
|
| - EnsureInitializedForIsolate(isolate, "v8::Object::New()");
|
| - LOG_API(isolate, "Object::New");
|
| - ENTER_V8(isolate);
|
| +Local<v8::Object> v8::Object::New(Isolate* isolate) {
|
| + i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
| + EnsureInitializedForIsolate(i_isolate, "v8::Object::New()");
|
| + LOG_API(i_isolate, "Object::New");
|
| + ENTER_V8(i_isolate);
|
| i::Handle<i::JSObject> obj =
|
| - isolate->factory()->NewJSObject(isolate->object_function());
|
| + i_isolate->factory()->NewJSObject(i_isolate->object_function());
|
| return Utils::ToLocal(obj);
|
| }
|
|
|
|
|
| -Local<v8::Value> v8::NumberObject::New(double value) {
|
| - i::Isolate* isolate = i::Isolate::Current();
|
| - EnsureInitializedForIsolate(isolate, "v8::NumberObject::New()");
|
| - LOG_API(isolate, "NumberObject::New");
|
| - ENTER_V8(isolate);
|
| - i::Handle<i::Object> number = isolate->factory()->NewNumber(value);
|
| - i::Handle<i::Object> obj = isolate->factory()->ToObject(number);
|
| +Local<v8::Object> v8::Object::New() {
|
| + return New(Isolate::GetCurrent());
|
| +}
|
| +
|
| +
|
| +Local<v8::Value> v8::NumberObject::New(Isolate* isolate, double value) {
|
| + i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
| + EnsureInitializedForIsolate(i_isolate, "v8::NumberObject::New()");
|
| + LOG_API(i_isolate, "NumberObject::New");
|
| + ENTER_V8(i_isolate);
|
| + i::Handle<i::Object> number = i_isolate->factory()->NewNumber(value);
|
| + i::Handle<i::Object> obj = i_isolate->factory()->ToObject(number);
|
| return Utils::ToLocal(obj);
|
| }
|
|
|
|
|
| +Local<v8::Value> v8::NumberObject::New(double value) {
|
| + return New(Isolate::GetCurrent(), value);
|
| +}
|
| +
|
| +
|
| double v8::NumberObject::ValueOf() const {
|
| i::Isolate* isolate = i::Isolate::Current();
|
| LOG_API(isolate, "NumberObject::NumberValue");
|
| @@ -5864,23 +5929,28 @@ Local<v8::Symbol> v8::SymbolObject::ValueOf() const {
|
| }
|
|
|
|
|
| -Local<v8::Value> v8::Date::New(double time) {
|
| - i::Isolate* isolate = i::Isolate::Current();
|
| - EnsureInitializedForIsolate(isolate, "v8::Date::New()");
|
| - LOG_API(isolate, "Date::New");
|
| +Local<v8::Value> v8::Date::New(Isolate* isolate, double time) {
|
| + i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
| + EnsureInitializedForIsolate(i_isolate, "v8::Date::New()");
|
| + LOG_API(i_isolate, "Date::New");
|
| if (std::isnan(time)) {
|
| // Introduce only canonical NaN value into the VM, to avoid signaling NaNs.
|
| time = i::OS::nan_value();
|
| }
|
| - ENTER_V8(isolate);
|
| - EXCEPTION_PREAMBLE(isolate);
|
| + ENTER_V8(i_isolate);
|
| + EXCEPTION_PREAMBLE(i_isolate);
|
| i::Handle<i::Object> obj =
|
| - i::Execution::NewDate(isolate, time, &has_pending_exception);
|
| - EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Value>());
|
| + i::Execution::NewDate(i_isolate, time, &has_pending_exception);
|
| + EXCEPTION_BAILOUT_CHECK(i_isolate, Local<v8::Value>());
|
| return Utils::ToLocal(obj);
|
| }
|
|
|
|
|
| +Local<v8::Value> v8::Date::New(double time) {
|
| + return New(Isolate::GetCurrent(), time);
|
| +}
|
| +
|
| +
|
| double v8::Date::ValueOf() const {
|
| i::Isolate* isolate = i::Isolate::Current();
|
| LOG_API(isolate, "Date::NumberValue");
|
| @@ -5890,22 +5960,22 @@ double v8::Date::ValueOf() const {
|
| }
|
|
|
|
|
| -void v8::Date::DateTimeConfigurationChangeNotification() {
|
| - i::Isolate* isolate = i::Isolate::Current();
|
| - ON_BAILOUT(isolate, "v8::Date::DateTimeConfigurationChangeNotification()",
|
| +void v8::Date::DateTimeConfigurationChangeNotification(Isolate* isolate) {
|
| + i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
| + ON_BAILOUT(i_isolate, "v8::Date::DateTimeConfigurationChangeNotification()",
|
| return);
|
| - LOG_API(isolate, "Date::DateTimeConfigurationChangeNotification");
|
| - ENTER_V8(isolate);
|
| + LOG_API(i_isolate, "Date::DateTimeConfigurationChangeNotification");
|
| + ENTER_V8(i_isolate);
|
|
|
| - isolate->date_cache()->ResetDateCache();
|
| + i_isolate->date_cache()->ResetDateCache();
|
|
|
| - i::HandleScope scope(isolate);
|
| + i::HandleScope scope(i_isolate);
|
| // Get the function ResetDateCache (defined in date.js).
|
| i::Handle<i::String> func_name_str =
|
| - isolate->factory()->InternalizeOneByteString(
|
| + i_isolate->factory()->InternalizeOneByteString(
|
| STATIC_ASCII_VECTOR("ResetDateCache"));
|
| i::MaybeObject* result =
|
| - isolate->js_builtins_object()->GetProperty(*func_name_str);
|
| + i_isolate->js_builtins_object()->GetProperty(*func_name_str);
|
| i::Object* object_func;
|
| if (!result->ToObject(&object_func)) {
|
| return;
|
| @@ -5918,7 +5988,7 @@ void v8::Date::DateTimeConfigurationChangeNotification() {
|
| // Call ResetDateCache(0 but expect no exceptions:
|
| bool caught_exception = false;
|
| i::Execution::TryCall(func,
|
| - isolate->js_builtins_object(),
|
| + i_isolate->js_builtins_object(),
|
| 0,
|
| NULL,
|
| &caught_exception);
|
| @@ -5926,6 +5996,11 @@ void v8::Date::DateTimeConfigurationChangeNotification() {
|
| }
|
|
|
|
|
| +void v8::Date::DateTimeConfigurationChangeNotification() {
|
| + DateTimeConfigurationChangeNotification(Isolate::GetCurrent());
|
| +}
|
| +
|
| +
|
| static i::Handle<i::String> RegExpFlagsToString(RegExp::Flags flags) {
|
| i::Isolate* isolate = i::Isolate::Current();
|
| uint8_t flags_buf[3];
|
| @@ -5977,20 +6052,25 @@ v8::RegExp::Flags v8::RegExp::GetFlags() const {
|
| }
|
|
|
|
|
| -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(isolate);
|
| +Local<v8::Array> v8::Array::New(Isolate* isolate, int length) {
|
| + i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
| + EnsureInitializedForIsolate(i_isolate, "v8::Array::New()");
|
| + LOG_API(i_isolate, "Array::New");
|
| + ENTER_V8(i_isolate);
|
| int real_length = length > 0 ? length : 0;
|
| - i::Handle<i::JSArray> obj = isolate->factory()->NewJSArray(real_length);
|
| + i::Handle<i::JSArray> obj = i_isolate->factory()->NewJSArray(real_length);
|
| i::Handle<i::Object> length_obj =
|
| - isolate->factory()->NewNumberFromInt(real_length);
|
| + i_isolate->factory()->NewNumberFromInt(real_length);
|
| obj->set_length(*length_obj);
|
| return Utils::ToLocal(obj);
|
| }
|
|
|
|
|
| +Local<v8::Array> v8::Array::New(int length) {
|
| + return New(Isolate::GetCurrent(), length);
|
| +}
|
| +
|
| +
|
| uint32_t v8::Array::Length() const {
|
| i::Handle<i::JSArray> obj = Utils::OpenHandle(this);
|
| i::Object* length = obj->length();
|
| @@ -6074,30 +6154,41 @@ size_t v8::ArrayBuffer::ByteLength() const {
|
| }
|
|
|
|
|
| -Local<ArrayBuffer> v8::ArrayBuffer::New(size_t byte_length) {
|
| - i::Isolate* isolate = i::Isolate::Current();
|
| - EnsureInitializedForIsolate(isolate, "v8::ArrayBuffer::New(size_t)");
|
| - LOG_API(isolate, "v8::ArrayBuffer::New(size_t)");
|
| - ENTER_V8(isolate);
|
| +Local<ArrayBuffer> v8::ArrayBuffer::New(Isolate* isolate, size_t byte_length) {
|
| + i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
| + EnsureInitializedForIsolate(i_isolate, "v8::ArrayBuffer::New(size_t)");
|
| + LOG_API(i_isolate, "v8::ArrayBuffer::New(size_t)");
|
| + ENTER_V8(i_isolate);
|
| i::Handle<i::JSArrayBuffer> obj =
|
| - isolate->factory()->NewJSArrayBuffer();
|
| - i::Runtime::SetupArrayBufferAllocatingData(isolate, obj, byte_length);
|
| + i_isolate->factory()->NewJSArrayBuffer();
|
| + i::Runtime::SetupArrayBufferAllocatingData(i_isolate, obj, byte_length);
|
| return Utils::ToLocal(obj);
|
| }
|
|
|
|
|
| -Local<ArrayBuffer> v8::ArrayBuffer::New(void* data, size_t byte_length) {
|
| - i::Isolate* isolate = i::Isolate::Current();
|
| - EnsureInitializedForIsolate(isolate, "v8::ArrayBuffer::New(void*, size_t)");
|
| - LOG_API(isolate, "v8::ArrayBuffer::New(void*, size_t)");
|
| - ENTER_V8(isolate);
|
| +Local<ArrayBuffer> v8::ArrayBuffer::New(size_t byte_length) {
|
| + return New(Isolate::GetCurrent(), byte_length);
|
| +}
|
| +
|
| +
|
| +Local<ArrayBuffer> v8::ArrayBuffer::New(Isolate* isolate, void* data,
|
| + size_t byte_length) {
|
| + i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
| + EnsureInitializedForIsolate(i_isolate, "v8::ArrayBuffer::New(void*, size_t)");
|
| + LOG_API(i_isolate, "v8::ArrayBuffer::New(void*, size_t)");
|
| + ENTER_V8(i_isolate);
|
| i::Handle<i::JSArrayBuffer> obj =
|
| - isolate->factory()->NewJSArrayBuffer();
|
| - i::Runtime::SetupArrayBuffer(isolate, obj, true, data, byte_length);
|
| + i_isolate->factory()->NewJSArrayBuffer();
|
| + i::Runtime::SetupArrayBuffer(i_isolate, obj, true, data, byte_length);
|
| return Utils::ToLocal(obj);
|
| }
|
|
|
|
|
| +Local<ArrayBuffer> v8::ArrayBuffer::New(void* data, size_t byte_length) {
|
| + return New(Isolate::GetCurrent(), data, byte_length);
|
| +}
|
| +
|
| +
|
| Local<ArrayBuffer> v8::ArrayBufferView::Buffer() {
|
| i::Handle<i::JSArrayBufferView> obj = Utils::OpenHandle(this);
|
| ASSERT(obj->buffer()->IsJSArrayBuffer());
|
| @@ -6286,18 +6377,28 @@ Local<Number> v8::Number::New(Isolate* isolate, double value) {
|
| Local<Integer> v8::Integer::New(int32_t value) {
|
| i::Isolate* isolate = i::Isolate::UncheckedCurrent();
|
| EnsureInitializedForIsolate(isolate, "v8::Integer::New()");
|
| - return v8::Integer::New(value, reinterpret_cast<Isolate*>(isolate));
|
| + return v8::Integer::New(reinterpret_cast<Isolate*>(isolate), value);
|
| }
|
|
|
|
|
| Local<Integer> Integer::NewFromUnsigned(uint32_t value) {
|
| i::Isolate* isolate = i::Isolate::Current();
|
| EnsureInitializedForIsolate(isolate, "v8::Integer::NewFromUnsigned()");
|
| - return Integer::NewFromUnsigned(value, reinterpret_cast<Isolate*>(isolate));
|
| + return Integer::NewFromUnsigned(reinterpret_cast<Isolate*>(isolate), value);
|
| }
|
|
|
|
|
| Local<Integer> v8::Integer::New(int32_t value, Isolate* isolate) {
|
| + return Integer::New(isolate, value);
|
| +}
|
| +
|
| +
|
| +Local<Integer> v8::Integer::NewFromUnsigned(uint32_t value, Isolate* isolate) {
|
| + return Integer::NewFromUnsigned(isolate, value);
|
| +}
|
| +
|
| +
|
| +Local<Integer> v8::Integer::New(Isolate* isolate, int32_t value) {
|
| i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
| ASSERT(internal_isolate->IsInitialized());
|
| if (i::Smi::IsValid(value)) {
|
| @@ -6310,7 +6411,7 @@ Local<Integer> v8::Integer::New(int32_t value, Isolate* isolate) {
|
| }
|
|
|
|
|
| -Local<Integer> v8::Integer::NewFromUnsigned(uint32_t value, Isolate* isolate) {
|
| +Local<Integer> v8::Integer::NewFromUnsigned(Isolate* isolate, uint32_t value) {
|
| i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
| ASSERT(internal_isolate->IsInitialized());
|
| bool fits_into_int32_t = (value & (1 << 31)) == 0;
|
| @@ -6973,7 +7074,7 @@ Local<Value> Debug::GetMirror(v8::Handle<v8::Value> obj) {
|
| if (!isolate->IsInitialized()) return Local<Value>();
|
| ON_BAILOUT(isolate, "v8::Debug::GetMirror()", return Local<Value>());
|
| ENTER_V8(isolate);
|
| - v8::HandleScope scope(reinterpret_cast<Isolate*>(isolate));
|
| + v8::EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
|
| i::Debug* isolate_debug = isolate->debug();
|
| isolate_debug->Load();
|
| i::Handle<i::JSObject> debug(isolate_debug->debug_context()->global_object());
|
| @@ -6985,11 +7086,10 @@ Local<Value> Debug::GetMirror(v8::Handle<v8::Value> obj) {
|
| const int kArgc = 1;
|
| v8::Handle<v8::Value> argv[kArgc] = { obj };
|
| EXCEPTION_PREAMBLE(isolate);
|
| - v8::Handle<v8::Value> result = v8_fun->Call(Utils::ToLocal(debug),
|
| - kArgc,
|
| - argv);
|
| + v8::Local<v8::Value> result =
|
| + v8_fun->Call(Utils::ToLocal(debug), kArgc, argv);
|
| EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
|
| - return scope.Close(result);
|
| + return scope.Escape(result);
|
| }
|
|
|
|
|
| @@ -7401,8 +7501,9 @@ const HeapSnapshot* HeapProfiler::TakeHeapSnapshot(
|
| }
|
|
|
|
|
| -void HeapProfiler::StartTrackingHeapObjects() {
|
| - reinterpret_cast<i::HeapProfiler*>(this)->StartHeapObjectsTracking();
|
| +void HeapProfiler::StartTrackingHeapObjects(bool track_allocations) {
|
| + reinterpret_cast<i::HeapProfiler*>(this)->StartHeapObjectsTracking(
|
| + track_allocations);
|
| }
|
|
|
|
|
| @@ -7441,12 +7542,12 @@ void HeapProfiler::SetRetainedObjectInfo(UniqueId id,
|
|
|
|
|
| void HeapProfiler::StartRecordingHeapAllocations() {
|
| - reinterpret_cast<i::HeapProfiler*>(this)->StartHeapAllocationsRecording();
|
| + reinterpret_cast<i::HeapProfiler*>(this)->StartHeapObjectsTracking(true);
|
| }
|
|
|
|
|
| void HeapProfiler::StopRecordingHeapAllocations() {
|
| - reinterpret_cast<i::HeapProfiler*>(this)->StopHeapAllocationsRecording();
|
| + reinterpret_cast<i::HeapProfiler*>(this)->StopHeapObjectsTracking();
|
| }
|
|
|
|
|
|
|