From 0157c9f9e1aa6ace22bf6f630a3f7cd56e73c693 Mon Sep 17 00:00:00 2001 From: "dcarney@chromium.org" Date: Tue, 3 Sep 2013 06:59:01 +0000 Subject: [PATCH] remove Isolate::Current from most files starting with 'd' and 'e' R=svenpanne@chromium.org BUG= Review URL: https://codereview.chromium.org/23606012 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16490 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/accessors.cc | 6 +++-- src/api.cc | 40 ++++++++++++++-------------- src/d8.cc | 4 +-- src/debug-agent.h | 4 +-- src/debug.cc | 66 ++++++++++++++++++++++----------------------- src/debug.h | 11 +++++--- src/disassembler.cc | 2 +- src/elements.cc | 1 - src/execution.cc | 68 ++++++++++++++++++++++++----------------------- src/execution.h | 43 +++++++++++++++++++----------- src/factory.cc | 3 ++- src/ic.cc | 2 +- src/isolate.cc | 3 ++- src/json-stringifier.h | 6 +++-- src/objects.cc | 3 ++- src/runtime.cc | 46 ++++++++++++++++++-------------- test/cctest/test-debug.cc | 3 ++- test/cctest/test-heap.cc | 9 ++++--- 18 files changed, 177 insertions(+), 143 deletions(-) diff --git a/src/accessors.cc b/src/accessors.cc index b87d921..766d4da 100644 --- a/src/accessors.cc +++ b/src/accessors.cc @@ -127,9 +127,11 @@ MaybeObject* Accessors::ArraySetLength(Isolate* isolate, Handle value_handle(value, isolate); bool has_exception; - Handle uint32_v = Execution::ToUint32(value_handle, &has_exception); + Handle uint32_v = + Execution::ToUint32(isolate, value_handle, &has_exception); if (has_exception) return Failure::Exception(); - Handle number_v = Execution::ToNumber(value_handle, &has_exception); + Handle number_v = + Execution::ToNumber(isolate, value_handle, &has_exception); if (has_exception) return Failure::Exception(); if (uint32_v->Number() == number_v->Number()) { diff --git a/src/api.cc b/src/api.cc index 6de4dfd..3859479 100644 --- a/src/api.cc +++ b/src/api.cc @@ -2738,7 +2738,7 @@ Local Value::ToString() const { LOG_API(isolate, "ToString"); ENTER_V8(isolate); EXCEPTION_PREAMBLE(isolate); - str = i::Execution::ToString(obj, &has_pending_exception); + str = i::Execution::ToString(isolate, obj, &has_pending_exception); EXCEPTION_BAILOUT_CHECK(isolate, Local()); } return ToApiHandle(str); @@ -2758,7 +2758,7 @@ Local Value::ToDetailString() const { LOG_API(isolate, "ToDetailString"); ENTER_V8(isolate); EXCEPTION_PREAMBLE(isolate); - str = i::Execution::ToDetailString(obj, &has_pending_exception); + str = i::Execution::ToDetailString(isolate, obj, &has_pending_exception); EXCEPTION_BAILOUT_CHECK(isolate, Local()); } return ToApiHandle(str); @@ -2778,7 +2778,7 @@ Local Value::ToObject() const { LOG_API(isolate, "ToObject"); ENTER_V8(isolate); EXCEPTION_PREAMBLE(isolate); - val = i::Execution::ToObject(obj, &has_pending_exception); + val = i::Execution::ToObject(isolate, obj, &has_pending_exception); EXCEPTION_BAILOUT_CHECK(isolate, Local()); } return ToApiHandle(val); @@ -2816,7 +2816,7 @@ Local Value::ToNumber() const { LOG_API(isolate, "ToNumber"); ENTER_V8(isolate); EXCEPTION_PREAMBLE(isolate); - num = i::Execution::ToNumber(obj, &has_pending_exception); + num = i::Execution::ToNumber(isolate, obj, &has_pending_exception); EXCEPTION_BAILOUT_CHECK(isolate, Local()); } return ToApiHandle(num); @@ -2834,7 +2834,7 @@ Local Value::ToInteger() const { LOG_API(isolate, "ToInteger"); ENTER_V8(isolate); EXCEPTION_PREAMBLE(isolate); - num = i::Execution::ToInteger(obj, &has_pending_exception); + num = i::Execution::ToInteger(isolate, obj, &has_pending_exception); EXCEPTION_BAILOUT_CHECK(isolate, Local()); } return ToApiHandle(num); @@ -3054,7 +3054,7 @@ double Value::NumberValue() const { LOG_API(isolate, "NumberValue"); ENTER_V8(isolate); EXCEPTION_PREAMBLE(isolate); - num = i::Execution::ToNumber(obj, &has_pending_exception); + num = i::Execution::ToNumber(isolate, obj, &has_pending_exception); EXCEPTION_BAILOUT_CHECK(isolate, i::OS::nan_value()); } return num->Number(); @@ -3072,7 +3072,7 @@ int64_t Value::IntegerValue() const { LOG_API(isolate, "IntegerValue"); ENTER_V8(isolate); EXCEPTION_PREAMBLE(isolate); - num = i::Execution::ToInteger(obj, &has_pending_exception); + num = i::Execution::ToInteger(isolate, obj, &has_pending_exception); EXCEPTION_BAILOUT_CHECK(isolate, 0); } if (num->IsSmi()) { @@ -3094,7 +3094,7 @@ Local Value::ToInt32() const { LOG_API(isolate, "ToInt32"); ENTER_V8(isolate); EXCEPTION_PREAMBLE(isolate); - num = i::Execution::ToInt32(obj, &has_pending_exception); + num = i::Execution::ToInt32(isolate, obj, &has_pending_exception); EXCEPTION_BAILOUT_CHECK(isolate, Local()); } return ToApiHandle(num); @@ -3112,7 +3112,7 @@ Local Value::ToUint32() const { LOG_API(isolate, "ToUInt32"); ENTER_V8(isolate); EXCEPTION_PREAMBLE(isolate); - num = i::Execution::ToUint32(obj, &has_pending_exception); + num = i::Execution::ToUint32(isolate, obj, &has_pending_exception); EXCEPTION_BAILOUT_CHECK(isolate, Local()); } return ToApiHandle(num); @@ -3131,7 +3131,7 @@ Local Value::ToArrayIndex() const { ENTER_V8(isolate); EXCEPTION_PREAMBLE(isolate); i::Handle string_obj = - i::Execution::ToString(obj, &has_pending_exception); + i::Execution::ToString(isolate, obj, &has_pending_exception); EXCEPTION_BAILOUT_CHECK(isolate, Local()); i::Handle str = i::Handle::cast(string_obj); uint32_t index; @@ -3159,7 +3159,7 @@ int32_t Value::Int32Value() const { ENTER_V8(isolate); EXCEPTION_PREAMBLE(isolate); i::Handle num = - i::Execution::ToInt32(obj, &has_pending_exception); + i::Execution::ToInt32(isolate, obj, &has_pending_exception); EXCEPTION_BAILOUT_CHECK(isolate, 0); if (num->IsSmi()) { return i::Smi::cast(*num)->value(); @@ -3240,7 +3240,7 @@ uint32_t Value::Uint32Value() const { ENTER_V8(isolate); EXCEPTION_PREAMBLE(isolate); i::Handle num = - i::Execution::ToUint32(obj, &has_pending_exception); + i::Execution::ToUint32(isolate, obj, &has_pending_exception); EXCEPTION_BAILOUT_CHECK(isolate, 0); if (num->IsSmi()) { return i::Smi::cast(*num)->value(); @@ -3377,7 +3377,7 @@ PropertyAttribute v8::Object::GetPropertyAttributes(v8::Handle key) { i::Handle key_obj = Utils::OpenHandle(*key); if (!key_obj->IsName()) { EXCEPTION_PREAMBLE(isolate); - key_obj = i::Execution::ToString(key_obj, &has_pending_exception); + key_obj = i::Execution::ToString(isolate, key_obj, &has_pending_exception); EXCEPTION_BAILOUT_CHECK(isolate, static_cast(NONE)); } i::Handle key_name = i::Handle::cast(key_obj); @@ -4079,7 +4079,7 @@ bool v8::Object::IsCallable() { i::HandleScope scope(isolate); i::Handle obj = Utils::OpenHandle(this); if (obj->IsJSFunction()) return true; - return i::Execution::GetFunctionDelegate(obj)->IsJSFunction(); + return i::Execution::GetFunctionDelegate(isolate, obj)->IsJSFunction(); } @@ -4103,8 +4103,8 @@ Local Object::CallAsFunction(v8::Handle recv, fun = i::Handle::cast(obj); } else { EXCEPTION_PREAMBLE(isolate); - i::Handle delegate = - i::Execution::TryGetFunctionDelegate(obj, &has_pending_exception); + i::Handle delegate = i::Execution::TryGetFunctionDelegate( + isolate, obj, &has_pending_exception); EXCEPTION_BAILOUT_CHECK(isolate, Local()); fun = i::Handle::cast(delegate); recv_obj = obj; @@ -4140,8 +4140,8 @@ Local Object::CallAsConstructor(int argc, i::Handle::cast(returned))); } EXCEPTION_PREAMBLE(isolate); - i::Handle delegate = - i::Execution::TryGetConstructorDelegate(obj, &has_pending_exception); + i::Handle delegate = i::Execution::TryGetConstructorDelegate( + isolate, obj, &has_pending_exception); EXCEPTION_BAILOUT_CHECK(isolate, Local()); if (!delegate->IsUndefined()) { i::Handle fun = i::Handle::cast(delegate); @@ -6050,7 +6050,7 @@ Local v8::Date::New(double time) { ENTER_V8(isolate); EXCEPTION_PREAMBLE(isolate); i::Handle obj = - i::Execution::NewDate(time, &has_pending_exception); + i::Execution::NewDate(isolate, time, &has_pending_exception); EXCEPTION_BAILOUT_CHECK(isolate, Local()); return Utils::ToLocal(obj); } @@ -7170,7 +7170,7 @@ void Debug::DisableAgent() { void Debug::ProcessDebugMessages() { - i::Execution::ProcessDebugMessages(true); + i::Execution::ProcessDebugMessages(i::Isolate::Current(), true); } diff --git a/src/d8.cc b/src/d8.cc index 6f41dc4..67d0d58 100644 --- a/src/d8.cc +++ b/src/d8.cc @@ -766,7 +766,7 @@ void Shell::InstallUtilityScript(Isolate* isolate) { #ifdef ENABLE_DEBUGGER_SUPPORT if (i::FLAG_debugger) printf("JavaScript debugger enabled\n"); // Install the debugger object in the utility scope - i::Debug* debug = i::Isolate::Current()->debug(); + i::Debug* debug = reinterpret_cast(isolate)->debug(); debug->Load(); i::Handle js_debug = i::Handle(debug->debug_context()->global_object()); @@ -935,7 +935,7 @@ Local Shell::CreateEvaluationContext(Isolate* isolate) { Context::Scope scope(context); #ifndef V8_SHARED - i::Factory* factory = i::Isolate::Current()->factory(); + i::Factory* factory = reinterpret_cast(isolate)->factory(); i::JSArguments js_args = i::FLAG_js_arguments; i::Handle arguments_array = factory->NewFixedArray(js_args.argc()); diff --git a/src/debug-agent.h b/src/debug-agent.h index 3f22715..9d7c62b 100644 --- a/src/debug-agent.h +++ b/src/debug-agent.h @@ -43,9 +43,9 @@ class DebuggerAgentSession; // handles connection from a remote debugger. class DebuggerAgent: public Thread { public: - DebuggerAgent(const char* name, int port) + DebuggerAgent(Isolate* isolate, const char* name, int port) : Thread(name), - isolate_(Isolate::Current()), + isolate_(isolate), name_(StrDup(name)), port_(port), server_(OS::CreateSocket()), terminate_(false), session_(NULL), diff --git a/src/debug.cc b/src/debug.cc index 603a2d7..ce3eee0 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -86,8 +86,9 @@ static void PrintLn(v8::Local value) { } -static Handle ComputeCallDebugPrepareStepIn(int argc, Code::Kind kind) { - Isolate* isolate = Isolate::Current(); +static Handle ComputeCallDebugPrepareStepIn(Isolate* isolate, + int argc, + Code::Kind kind) { return isolate->stub_cache()->ComputeCallDebugPrepareStepIn(argc, kind); } @@ -433,7 +434,7 @@ void BreakLocationIterator::PrepareStepIn(Isolate* isolate) { // the call in the original code as it is the code there that will be // executed in place of the debug break call. Handle stub = ComputeCallDebugPrepareStepIn( - target_code->arguments_count(), target_code->kind()); + isolate, target_code->arguments_count(), target_code->kind()); if (IsDebugBreak()) { original_rinfo()->set_target_address(stub->entry()); } else { @@ -633,7 +634,7 @@ const int Debug::kFrameDropperFrameSize = 4; void ScriptCache::Add(Handle