Browse Source

src: remove unnecessary HandleScopes

API callback functions don't need to create a v8::HandleScope instance
because V8 already creates one in the JS->C++ adapter frame.

PR-URL: https://github.com/node-forward/node/pull/16
Reviewed-By: Fedor Indutny <fedor@indutny.com>
archived-io.js-v0.12
Ben Noordhuis 10 years ago
committed by Fedor Indutny
parent
commit
97585b0d7a
  1. 7
      src/cares_wrap.cc
  2. 5
      src/fs_event_wrap.cc
  3. 7
      src/handle_wrap.cc
  4. 26
      src/node.cc
  5. 5
      src/node_buffer.cc
  6. 6
      src/node_contextify.cc
  7. 131
      src/node_crypto.cc
  8. 6
      src/node_dtrace.cc
  9. 25
      src/node_file.cc
  10. 6
      src/node_http_parser.cc
  11. 14
      src/node_os.cc
  12. 4
      src/node_stat_watcher.cc
  13. 3
      src/node_v8.cc
  14. 9
      src/node_zlib.cc
  15. 16
      src/pipe_wrap.cc
  16. 5
      src/process_wrap.cc
  17. 7
      src/signal_wrap.cc
  18. 6
      src/smalloc.cc
  19. 1
      src/spawn_sync.cc
  20. 18
      src/stream_wrap.cc
  21. 36
      src/tcp_wrap.cc
  22. 1
      src/timer_wrap.cc
  23. 15
      src/tls_wrap.cc
  24. 10
      src/tty_wrap.cc
  25. 15
      src/udp_wrap.cc
  26. 2
      src/uv.cc

7
src/cares_wrap.cc

@ -841,7 +841,6 @@ class GetHostByNameWrap: public QueryWrap {
template <class Wrap>
static void Query(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
assert(!args.IsConstructCall());
@ -992,7 +991,6 @@ void AfterGetNameInfo(uv_getnameinfo_t* req,
static void IsIP(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
node::Utf8Value ip(args[0]);
char address_buffer[sizeof(struct in6_addr)];
@ -1008,7 +1006,6 @@ static void IsIP(const FunctionCallbackInfo<Value>& args) {
static void GetAddrInfo(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
assert(args[0]->IsObject());
@ -1062,7 +1059,6 @@ static void GetAddrInfo(const FunctionCallbackInfo<Value>& args) {
static void GetNameInfo(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(env->isolate());
CHECK(args[0]->IsObject());
CHECK(args[1]->IsString());
@ -1094,7 +1090,6 @@ static void GetNameInfo(const FunctionCallbackInfo<Value>& args) {
static void GetServers(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
Local<Array> server_array = Array::New(env->isolate());
@ -1124,7 +1119,6 @@ static void GetServers(const FunctionCallbackInfo<Value>& args) {
static void SetServers(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
assert(args[0]->IsArray());
@ -1194,7 +1188,6 @@ static void SetServers(const FunctionCallbackInfo<Value>& args) {
static void StrError(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
const char* errmsg = ares_strerror(args[0]->Int32Value());
args.GetReturnValue().Set(OneByteString(env->isolate(), errmsg));
}

5
src/fs_event_wrap.cc

@ -96,7 +96,6 @@ void FSEventWrap::Initialize(Handle<Object> target,
void FSEventWrap::New(const FunctionCallbackInfo<Value>& args) {
assert(args.IsConstructCall());
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
new FSEventWrap(env, args.This());
}
@ -104,7 +103,6 @@ void FSEventWrap::New(const FunctionCallbackInfo<Value>& args) {
void FSEventWrap::Start(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
FSEventWrap* wrap = Unwrap<FSEventWrap>(args.Holder());
@ -186,9 +184,6 @@ void FSEventWrap::OnEvent(uv_fs_event_t* handle, const char* filename,
void FSEventWrap::Close(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
FSEventWrap* wrap = Unwrap<FSEventWrap>(args.Holder());
if (wrap == NULL || wrap->initialized_ == false)

7
src/handle_wrap.cc

@ -41,9 +41,6 @@ using v8::Value;
void HandleWrap::Ref(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
HandleWrap* wrap = Unwrap<HandleWrap>(args.Holder());
if (wrap != NULL && wrap->handle__ != NULL) {
@ -54,9 +51,6 @@ void HandleWrap::Ref(const FunctionCallbackInfo<Value>& args) {
void HandleWrap::Unref(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
HandleWrap* wrap = Unwrap<HandleWrap>(args.Holder());
if (wrap != NULL && wrap->handle__ != NULL) {
@ -68,7 +62,6 @@ void HandleWrap::Unref(const FunctionCallbackInfo<Value>& args) {
void HandleWrap::Close(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
HandleWrap* wrap = Unwrap<HandleWrap>(args.Holder());

26
src/node.cc

@ -909,7 +909,6 @@ Local<Value> WinapiErrnoException(Isolate* isolate,
void SetupAsyncListener(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
assert(args[0]->IsObject());
@ -979,7 +978,6 @@ void RunMicrotasks(const FunctionCallbackInfo<Value>& args) {
void SetupNextTick(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
assert(args[0]->IsObject());
@ -1552,7 +1550,6 @@ static Local<Value> ExecuteString(Environment* env,
static void GetActiveRequests(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
Local<Array> ary = Array::New(args.GetIsolate());
QUEUE* q = NULL;
@ -1573,7 +1570,6 @@ static void GetActiveRequests(const FunctionCallbackInfo<Value>& args) {
// implemented here for consistency with GetActiveRequests().
void GetActiveHandles(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
Local<Array> ary = Array::New(env->isolate());
QUEUE* q = NULL;
@ -1603,7 +1599,6 @@ static void Abort(const FunctionCallbackInfo<Value>& args) {
static void Chdir(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (args.Length() != 1 || !args[0]->IsString()) {
// FIXME(bnoordhuis) ThrowTypeError?
@ -1620,7 +1615,6 @@ static void Chdir(const FunctionCallbackInfo<Value>& args) {
static void Cwd(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
#ifdef _WIN32
/* MAX_PATH is in characters, not bytes. Make sure we have enough headroom. */
char buf[MAX_PATH * 4];
@ -1644,7 +1638,6 @@ static void Cwd(const FunctionCallbackInfo<Value>& args) {
static void Umask(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
uint32_t old;
if (args.Length() < 1 || args[0]->IsUndefined()) {
@ -1793,7 +1786,6 @@ static void GetGid(const FunctionCallbackInfo<Value>& args) {
static void SetGid(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (!args[0]->IsUint32() && !args[0]->IsString()) {
return env->ThrowTypeError("setgid argument must be a number or a string");
@ -1813,7 +1805,6 @@ static void SetGid(const FunctionCallbackInfo<Value>& args) {
static void SetUid(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (!args[0]->IsUint32() && !args[0]->IsString()) {
return env->ThrowTypeError("setuid argument must be a number or a string");
@ -1833,7 +1824,6 @@ static void SetUid(const FunctionCallbackInfo<Value>& args) {
static void GetGroups(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
int ngroups = getgroups(0, NULL);
@ -1872,7 +1862,6 @@ static void GetGroups(const FunctionCallbackInfo<Value>& args) {
static void SetGroups(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (!args[0]->IsArray()) {
return env->ThrowTypeError("argument 1 must be an array");
@ -1904,7 +1893,6 @@ static void SetGroups(const FunctionCallbackInfo<Value>& args) {
static void InitGroups(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (!args[0]->IsUint32() && !args[0]->IsString()) {
return env->ThrowTypeError("argument 1 must be a number or a string");
@ -1954,15 +1942,12 @@ static void InitGroups(const FunctionCallbackInfo<Value>& args) {
void Exit(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
exit(args[0]->Int32Value());
}
static void Uptime(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
double uptime;
uv_update_time(env->event_loop());
@ -1974,7 +1959,6 @@ static void Uptime(const FunctionCallbackInfo<Value>& args) {
void MemoryUsage(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
size_t rss;
int err = uv_resident_set_memory(&rss);
@ -2002,7 +1986,6 @@ void MemoryUsage(const FunctionCallbackInfo<Value>& args) {
void Kill(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (args.Length() != 2) {
return env->ThrowError("Bad argument.");
@ -2024,7 +2007,6 @@ void Kill(const FunctionCallbackInfo<Value>& args) {
// Pass in an Array from a previous hrtime() call to instead get a time diff.
void Hrtime(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
uint64_t t = uv_hrtime();
@ -2079,7 +2061,6 @@ typedef void (UV_DYNAMIC* extInit)(Handle<Object> exports);
// when two contexts try to load the same shared object. Maybe have a shadow
// cache that's a plain C list or hash table that's shared across contexts?
void DLOpen(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
struct node_module* mp;
uv_lib_t lib;
@ -2223,7 +2204,6 @@ void OnMessage(Handle<Message> message, Handle<Value> error) {
static void Binding(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
Local<String> module = args[0]->ToString();
@ -2528,7 +2508,6 @@ static void DebugEnd(const FunctionCallbackInfo<Value>& args);
void NeedImmediateCallbackGetter(Local<String> property,
const PropertyCallbackInfo<Value>& info) {
HandleScope handle_scope(info.GetIsolate());
Environment* env = Environment::GetCurrent(info.GetIsolate());
const uv_check_t* immediate_check_handle = env->immediate_check_handle();
bool active = uv_is_active(
@ -2589,14 +2568,12 @@ void StopProfilerIdleNotifier(Environment* env) {
void StartProfilerIdleNotifier(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
StartProfilerIdleNotifier(env);
}
void StopProfilerIdleNotifier(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
StopProfilerIdleNotifier(env);
}
@ -2847,7 +2824,6 @@ static void SignalExit(int signo) {
// function, it is useful to bypass JavaScript entirely.
static void RawDebug(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
assert(args.Length() == 1 && args[0]->IsString() &&
"must be called with a single string");
@ -3217,7 +3193,6 @@ static void RegisterSignalHandler(int signal,
void DebugProcess(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (args.Length() != 1) {
return env->ThrowError("Invalid number of arguments.");
@ -3306,7 +3281,6 @@ static int RegisterDebugSignalHandler() {
static void DebugProcess(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
Environment* env = Environment::GetCurrent(isolate);
HandleScope scope(isolate);
DWORD pid;
HANDLE process = NULL;
HANDLE thread = NULL;

5
src/node_buffer.cc

@ -257,7 +257,6 @@ Local<Object> Use(Environment* env, char* data, uint32_t length) {
template <encoding encoding>
void StringSlice(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
ARGS_THIS(args.This())
SLICE_START_END(args[0], args[1], obj_length)
@ -300,7 +299,6 @@ void Base64Slice(const FunctionCallbackInfo<Value>& args) {
// bytesCopied = buffer.copy(target[, targetStart][, sourceStart][, sourceEnd]);
void Copy(const FunctionCallbackInfo<Value> &args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
Local<Object> target = args[0]->ToObject();
@ -381,7 +379,6 @@ void Fill(const FunctionCallbackInfo<Value>& args) {
template <encoding encoding>
void StringWrite(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
ARGS_THIS(args.This())
@ -546,7 +543,6 @@ void WriteDoubleBE(const FunctionCallbackInfo<Value>& args) {
void ByteLength(const FunctionCallbackInfo<Value> &args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (!args[0]->IsString())
return env->ThrowTypeError("Argument must be a string");
@ -595,7 +591,6 @@ void Compare(const FunctionCallbackInfo<Value> &args) {
// pass Buffer object to load prototype methods
void SetupBufferJS(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
assert(args[0]->IsFunction());

6
src/node_contextify.cc

@ -253,7 +253,6 @@ class ContextifyContext {
static void RunInDebugContext(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Local<String> script_source(args[0]->ToString());
if (script_source.IsEmpty())
return; // Exception pending.
@ -267,7 +266,6 @@ class ContextifyContext {
static void MakeContext(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (!args[0]->IsObject()) {
return env->ThrowTypeError("sandbox argument must be an object.");
@ -298,7 +296,6 @@ class ContextifyContext {
static void IsContext(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (!args[0]->IsObject()) {
env->ThrowTypeError("sandbox must be an object");
@ -473,7 +470,6 @@ class ContextifyScript : public BaseObject {
// args: code, [options]
static void New(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (!args.IsConstructCall()) {
return env->ThrowError("Must call vm.Script as a constructor.");
@ -516,7 +512,6 @@ class ContextifyScript : public BaseObject {
// args: [options]
static void RunInThisContext(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
HandleScope handle_scope(isolate);
// Assemble arguments
TryCatch try_catch;
@ -535,7 +530,6 @@ class ContextifyScript : public BaseObject {
// args: sandbox, [options]
static void RunInContext(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
int64_t timeout;
bool display_errors;

131
src/node_crypto.cc

@ -299,15 +299,12 @@ void SecureContext::Initialize(Environment* env, Handle<Object> target) {
void SecureContext::New(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
new SecureContext(env, args.This());
}
void SecureContext::Init(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
SecureContext* sc = Unwrap<SecureContext>(args.Holder());
Environment* env = sc->env();
@ -434,7 +431,6 @@ static X509* LoadX509(Environment* env, Handle<Value> v) {
void SecureContext::SetKey(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
SecureContext* sc = Unwrap<SecureContext>(args.Holder());
@ -580,7 +576,6 @@ int SSL_CTX_use_certificate_chain(SSL_CTX* ctx,
void SecureContext::SetCert(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
SecureContext* sc = Unwrap<SecureContext>(args.Holder());
@ -612,7 +607,6 @@ void SecureContext::SetCert(const FunctionCallbackInfo<Value>& args) {
void SecureContext::AddCACert(const FunctionCallbackInfo<Value>& args) {
bool newCAStore = false;
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
SecureContext* sc = Unwrap<SecureContext>(args.Holder());
@ -642,7 +636,6 @@ void SecureContext::AddCACert(const FunctionCallbackInfo<Value>& args) {
void SecureContext::AddCRL(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
SecureContext* sc = Unwrap<SecureContext>(args.Holder());
@ -674,8 +667,6 @@ void SecureContext::AddCRL(const FunctionCallbackInfo<Value>& args) {
void SecureContext::AddRootCerts(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
SecureContext* sc = Unwrap<SecureContext>(args.Holder());
assert(sc->ca_store_ == NULL);
@ -711,8 +702,6 @@ void SecureContext::AddRootCerts(const FunctionCallbackInfo<Value>& args) {
void SecureContext::SetCiphers(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
SecureContext* sc = Unwrap<SecureContext>(args.Holder());
if (args.Length() != 1 || !args[0]->IsString()) {
@ -725,8 +714,6 @@ void SecureContext::SetCiphers(const FunctionCallbackInfo<Value>& args) {
void SecureContext::SetECDHCurve(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
SecureContext* sc = Unwrap<SecureContext>(args.Holder());
Environment* env = sc->env();
@ -753,8 +740,6 @@ void SecureContext::SetECDHCurve(const FunctionCallbackInfo<Value>& args) {
void SecureContext::SetDHParam(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
SecureContext* sc = Unwrap<SecureContext>(args.This());
Environment* env = sc->env();
@ -784,8 +769,6 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo<Value>& args) {
void SecureContext::SetOptions(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
SecureContext* sc = Unwrap<SecureContext>(args.Holder());
if (args.Length() != 1 || !args[0]->IntegerValue()) {
@ -798,8 +781,6 @@ void SecureContext::SetOptions(const FunctionCallbackInfo<Value>& args) {
void SecureContext::SetSessionIdContext(
const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
SecureContext* sc = Unwrap<SecureContext>(args.Holder());
if (args.Length() != 1 || !args[0]->IsString()) {
@ -835,8 +816,6 @@ void SecureContext::SetSessionIdContext(
void SecureContext::SetSessionTimeout(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
SecureContext* sc = Unwrap<SecureContext>(args.Holder());
if (args.Length() != 1 || !args[0]->IsInt32()) {
@ -849,7 +828,6 @@ void SecureContext::SetSessionTimeout(const FunctionCallbackInfo<Value>& args) {
void SecureContext::Close(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
SecureContext* sc = Unwrap<SecureContext>(args.Holder());
sc->FreeCTXMem();
}
@ -858,7 +836,6 @@ void SecureContext::Close(const FunctionCallbackInfo<Value>& args) {
// Takes .pfx or .p12 and password in string or buffer format
void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
BIO* in = NULL;
PKCS12* p12 = NULL;
@ -924,7 +901,6 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) {
void SecureContext::GetTicketKeys(const FunctionCallbackInfo<Value>& args) {
#if !defined(OPENSSL_NO_TLSEXT) && defined(SSL_CTX_get_tlsext_ticket_keys)
HandleScope handle_scope(args.GetIsolate());
SecureContext* wrap = Unwrap<SecureContext>(args.Holder());
@ -942,7 +918,6 @@ void SecureContext::GetTicketKeys(const FunctionCallbackInfo<Value>& args) {
void SecureContext::SetTicketKeys(const FunctionCallbackInfo<Value>& args) {
#if !defined(OPENSSL_NO_TLSEXT) && defined(SSL_CTX_get_tlsext_ticket_keys)
HandleScope scope(args.GetIsolate());
SecureContext* wrap = Unwrap<SecureContext>(args.Holder());
if (args.Length() < 1 ||
@ -974,7 +949,6 @@ void SecureContext::CtxGetter(Local<String> property,
template <bool primary>
void SecureContext::GetCertificate(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
SecureContext* wrap = Unwrap<SecureContext>(args.Holder());
Environment* env = wrap->env();
X509* cert;
@ -1298,8 +1272,6 @@ static Local<Object> X509ToObject(Environment* env, X509* cert) {
template <class Base>
void SSLWrap<Base>::GetPeerCertificate(
const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Base* w = Unwrap<Base>(args.Holder());
Environment* env = w->ssl_env();
@ -1406,7 +1378,6 @@ void SSLWrap<Base>::GetPeerCertificate(
template <class Base>
void SSLWrap<Base>::GetSession(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
Base* w = Unwrap<Base>(args.Holder());
@ -1428,7 +1399,6 @@ void SSLWrap<Base>::GetSession(const FunctionCallbackInfo<Value>& args) {
template <class Base>
void SSLWrap<Base>::SetSession(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
Base* w = Unwrap<Base>(args.Holder());
@ -1460,8 +1430,6 @@ void SSLWrap<Base>::SetSession(const FunctionCallbackInfo<Value>& args) {
template <class Base>
void SSLWrap<Base>::LoadSession(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Base* w = Unwrap<Base>(args.Holder());
Environment* env = w->ssl_env();
@ -1493,7 +1461,6 @@ void SSLWrap<Base>::LoadSession(const FunctionCallbackInfo<Value>& args) {
template <class Base>
void SSLWrap<Base>::IsSessionReused(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Base* w = Unwrap<Base>(args.Holder());
bool yes = SSL_session_reused(w->ssl_);
args.GetReturnValue().Set(yes);
@ -1502,7 +1469,6 @@ void SSLWrap<Base>::IsSessionReused(const FunctionCallbackInfo<Value>& args) {
template <class Base>
void SSLWrap<Base>::EndParser(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Base* w = Unwrap<Base>(args.Holder());
w->hello_parser_.End();
}
@ -1510,8 +1476,6 @@ void SSLWrap<Base>::EndParser(const FunctionCallbackInfo<Value>& args) {
template <class Base>
void SSLWrap<Base>::Renegotiate(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Base* w = Unwrap<Base>(args.Holder());
ClearErrorOnReturn clear_error_on_return;
@ -1524,8 +1488,6 @@ void SSLWrap<Base>::Renegotiate(const FunctionCallbackInfo<Value>& args) {
template <class Base>
void SSLWrap<Base>::Shutdown(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Base* w = Unwrap<Base>(args.Holder());
int rv = SSL_shutdown(w->ssl_);
@ -1535,8 +1497,6 @@ void SSLWrap<Base>::Shutdown(const FunctionCallbackInfo<Value>& args) {
template <class Base>
void SSLWrap<Base>::GetTLSTicket(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Base* w = Unwrap<Base>(args.Holder());
Environment* env = w->ssl_env();
@ -1554,8 +1514,6 @@ void SSLWrap<Base>::GetTLSTicket(const FunctionCallbackInfo<Value>& args) {
template <class Base>
void SSLWrap<Base>::NewSessionDone(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Base* w = Unwrap<Base>(args.Holder());
w->new_session_wait_ = false;
w->NewSessionDoneCb();
@ -1607,7 +1565,6 @@ void SSLWrap<Base>::SetMaxSendFragment(
template <class Base>
void SSLWrap<Base>::IsInitFinished(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Base* w = Unwrap<Base>(args.Holder());
bool yes = SSL_is_init_finished(w->ssl_);
args.GetReturnValue().Set(yes);
@ -1616,8 +1573,6 @@ void SSLWrap<Base>::IsInitFinished(const FunctionCallbackInfo<Value>& args) {
template <class Base>
void SSLWrap<Base>::VerifyError(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Base* w = Unwrap<Base>(args.Holder());
// XXX(bnoordhuis) The UNABLE_TO_GET_ISSUER_CERT error when there is no
@ -1681,8 +1636,6 @@ void SSLWrap<Base>::VerifyError(const FunctionCallbackInfo<Value>& args) {
template <class Base>
void SSLWrap<Base>::GetCurrentCipher(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Base* w = Unwrap<Base>(args.Holder());
Environment* env = w->ssl_env();
@ -1783,8 +1736,6 @@ int SSLWrap<Base>::SelectNextProtoCallback(SSL* s,
template <class Base>
void SSLWrap<Base>::GetNegotiatedProto(
const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Base* w = Unwrap<Base>(args.Holder());
if (w->is_client()) {
@ -1809,8 +1760,6 @@ void SSLWrap<Base>::GetNegotiatedProto(
template <class Base>
void SSLWrap<Base>::SetNPNProtocols(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Base* w = Unwrap<Base>(args.Holder());
if (args.Length() < 1 || !Buffer::HasInstance(args[0]))
@ -2156,7 +2105,6 @@ int Connection::SelectSNIContextCallback_(SSL *s, int *ad, void* arg) {
void Connection::New(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (args.Length() < 1 || !args[0]->IsObject()) {
env->ThrowError("First argument must be a tls module SecureContext");
@ -2249,8 +2197,6 @@ void Connection::SSLInfoCallback(const SSL *ssl_, int where, int ret) {
void Connection::EncIn(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Connection* conn = Unwrap<Connection>(args.Holder());
Environment* env = conn->env();
@ -2300,8 +2246,6 @@ void Connection::EncIn(const FunctionCallbackInfo<Value>& args) {
void Connection::ClearOut(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Connection* conn = Unwrap<Connection>(args.Holder());
Environment* env = conn->env();
@ -2356,7 +2300,6 @@ void Connection::ClearOut(const FunctionCallbackInfo<Value>& args) {
void Connection::ClearPending(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Connection* conn = Unwrap<Connection>(args.Holder());
int bytes_pending = BIO_pending(conn->bio_read_);
args.GetReturnValue().Set(bytes_pending);
@ -2364,7 +2307,6 @@ void Connection::ClearPending(const FunctionCallbackInfo<Value>& args) {
void Connection::EncPending(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Connection* conn = Unwrap<Connection>(args.Holder());
int bytes_pending = BIO_pending(conn->bio_write_);
args.GetReturnValue().Set(bytes_pending);
@ -2372,8 +2314,6 @@ void Connection::EncPending(const FunctionCallbackInfo<Value>& args) {
void Connection::EncOut(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Connection* conn = Unwrap<Connection>(args.Holder());
Environment* env = conn->env();
@ -2404,8 +2344,6 @@ void Connection::EncOut(const FunctionCallbackInfo<Value>& args) {
void Connection::ClearIn(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Connection* conn = Unwrap<Connection>(args.Holder());
Environment* env = conn->env();
@ -2460,8 +2398,6 @@ void Connection::ClearIn(const FunctionCallbackInfo<Value>& args) {
void Connection::Start(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Connection* conn = Unwrap<Connection>(args.Holder());
int rv = 0;
@ -2485,8 +2421,6 @@ void Connection::Start(const FunctionCallbackInfo<Value>& args) {
void Connection::Close(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Connection* conn = Unwrap<Connection>(args.Holder());
if (conn->ssl_ != NULL) {
@ -2498,8 +2432,6 @@ void Connection::Close(const FunctionCallbackInfo<Value>& args) {
#ifdef SSL_CTRL_SET_TLSEXT_SERVERNAME_CB
void Connection::GetServername(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Connection* conn = Unwrap<Connection>(args.Holder());
if (conn->is_server() && !conn->servername_.IsEmpty()) {
@ -2511,8 +2443,6 @@ void Connection::GetServername(const FunctionCallbackInfo<Value>& args) {
void Connection::SetSNICallback(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Connection* conn = Unwrap<Connection>(args.Holder());
Environment* env = conn->env();
@ -2548,7 +2478,6 @@ void CipherBase::Initialize(Environment* env, Handle<Object> target) {
void CipherBase::New(const FunctionCallbackInfo<Value>& args) {
assert(args.IsConstructCall() == true);
HandleScope handle_scope(args.GetIsolate());
CipherKind kind = args[0]->IsTrue() ? kCipher : kDecipher;
Environment* env = Environment::GetCurrent(args.GetIsolate());
new CipherBase(env, args.This(), kind);
@ -2596,8 +2525,6 @@ void CipherBase::Init(const char* cipher_type,
void CipherBase::Init(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
CipherBase* cipher = Unwrap<CipherBase>(args.Holder());
if (args.Length() < 2 ||
@ -2648,8 +2575,6 @@ void CipherBase::InitIv(const char* cipher_type,
void CipherBase::InitIv(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
CipherBase* cipher = Unwrap<CipherBase>(args.Holder());
Environment* env = cipher->env();
@ -2691,7 +2616,6 @@ bool CipherBase::GetAuthTag(char** out, unsigned int* out_len) const {
void CipherBase::GetAuthTag(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(args.GetIsolate());
CipherBase* cipher = Unwrap<CipherBase>(args.Holder());
char* out = NULL;
@ -2718,7 +2642,6 @@ bool CipherBase::SetAuthTag(const char* data, unsigned int len) {
void CipherBase::SetAuthTag(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
Local<Object> buf = args[0].As<Object>();
@ -2749,7 +2672,6 @@ bool CipherBase::SetAAD(const char* data, unsigned int len) {
void CipherBase::SetAAD(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope handle_scope(env->isolate());
ASSERT_IS_BUFFER(args[0]);
@ -2788,7 +2710,6 @@ bool CipherBase::Update(const char* data,
void CipherBase::Update(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
CipherBase* cipher = Unwrap<CipherBase>(args.Holder());
@ -2843,7 +2764,6 @@ bool CipherBase::SetAutoPadding(bool auto_padding) {
void CipherBase::SetAutoPadding(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
CipherBase* cipher = Unwrap<CipherBase>(args.Holder());
cipher->SetAutoPadding(args.Length() < 1 || args[0]->BooleanValue());
}
@ -2878,7 +2798,6 @@ bool CipherBase::Final(unsigned char** out, int *out_len) {
void CipherBase::Final(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
CipherBase* cipher = Unwrap<CipherBase>(args.Holder());
@ -2924,7 +2843,6 @@ void Hmac::Initialize(Environment* env, v8::Handle<v8::Object> target) {
void Hmac::New(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
new Hmac(env, args.This());
}
@ -2949,8 +2867,6 @@ void Hmac::HmacInit(const char* hash_type, const char* key, int key_len) {
void Hmac::HmacInit(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Hmac* hmac = Unwrap<Hmac>(args.Holder());
Environment* env = hmac->env();
@ -2977,7 +2893,6 @@ bool Hmac::HmacUpdate(const char* data, int len) {
void Hmac::HmacUpdate(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
Hmac* hmac = Unwrap<Hmac>(args.Holder());
@ -3024,7 +2939,6 @@ bool Hmac::HmacDigest(unsigned char** md_value, unsigned int* md_len) {
void Hmac::HmacDigest(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
Hmac* hmac = Unwrap<Hmac>(args.Holder());
@ -3065,7 +2979,6 @@ void Hash::Initialize(Environment* env, v8::Handle<v8::Object> target) {
void Hash::New(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (args.Length() == 0 || !args[0]->IsString()) {
return env->ThrowError("Must give hashtype string as argument");
@ -3102,7 +3015,6 @@ bool Hash::HashUpdate(const char* data, int len) {
void Hash::HashUpdate(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
Hash* hash = Unwrap<Hash>(args.Holder());
@ -3138,7 +3050,6 @@ void Hash::HashUpdate(const FunctionCallbackInfo<Value>& args) {
void Hash::HashDigest(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
Hash* hash = Unwrap<Hash>(args.Holder());
@ -3220,7 +3131,6 @@ void Sign::Initialize(Environment* env, v8::Handle<v8::Object> target) {
void Sign::New(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
new Sign(env, args.This());
}
@ -3242,8 +3152,6 @@ SignBase::Error Sign::SignInit(const char* sign_type) {
void Sign::SignInit(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Sign* sign = Unwrap<Sign>(args.Holder());
if (args.Length() == 0 || !args[0]->IsString()) {
@ -3266,7 +3174,6 @@ SignBase::Error Sign::SignUpdate(const char* data, int len) {
void Sign::SignUpdate(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
Sign* sign = Unwrap<Sign>(args.Holder());
@ -3343,7 +3250,6 @@ SignBase::Error Sign::SignFinal(const char* key_pem,
void Sign::SignFinal(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
Sign* sign = Unwrap<Sign>(args.Holder());
@ -3402,7 +3308,6 @@ void Verify::Initialize(Environment* env, v8::Handle<v8::Object> target) {
void Verify::New(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
new Verify(env, args.This());
}
@ -3424,8 +3329,6 @@ SignBase::Error Verify::VerifyInit(const char* verify_type) {
void Verify::VerifyInit(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Verify* verify = Unwrap<Verify>(args.Holder());
if (args.Length() == 0 || !args[0]->IsString()) {
@ -3450,7 +3353,6 @@ SignBase::Error Verify::VerifyUpdate(const char* data, int len) {
void Verify::VerifyUpdate(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
Verify* verify = Unwrap<Verify>(args.Holder());
@ -3558,7 +3460,6 @@ SignBase::Error Verify::VerifyFinal(const char* key_pem,
void Verify::VerifyFinal(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
Verify* verify = Unwrap<Verify>(args.Holder());
@ -3691,7 +3592,6 @@ template <PublicKeyCipher::Operation operation,
PublicKeyCipher::EVP_PKEY_cipher_t EVP_PKEY_cipher>
void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
ASSERT_IS_BUFFER(args[0]);
char* kbuf = Buffer::Data(args[0]);
@ -3823,8 +3723,6 @@ bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) {
void DiffieHellman::DiffieHellmanGroup(
const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
DiffieHellman* diffieHellman = new DiffieHellman(env, args.This());
@ -3855,8 +3753,6 @@ void DiffieHellman::DiffieHellmanGroup(
void DiffieHellman::New(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
DiffieHellman* diffieHellman =
new DiffieHellman(env, args.This());
@ -3890,7 +3786,6 @@ void DiffieHellman::New(const FunctionCallbackInfo<Value>& args) {
void DiffieHellman::GenerateKeys(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
DiffieHellman* diffieHellman = Unwrap<DiffieHellman>(args.Holder());
@ -3914,7 +3809,6 @@ void DiffieHellman::GenerateKeys(const FunctionCallbackInfo<Value>& args) {
void DiffieHellman::GetPrime(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
DiffieHellman* diffieHellman = Unwrap<DiffieHellman>(args.Holder());
@ -3933,7 +3827,6 @@ void DiffieHellman::GetPrime(const FunctionCallbackInfo<Value>& args) {
void DiffieHellman::GetGenerator(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
DiffieHellman* diffieHellman = Unwrap<DiffieHellman>(args.Holder());
@ -3952,7 +3845,6 @@ void DiffieHellman::GetGenerator(const FunctionCallbackInfo<Value>& args) {
void DiffieHellman::GetPublicKey(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
DiffieHellman* diffieHellman = Unwrap<DiffieHellman>(args.Holder());
@ -3976,7 +3868,6 @@ void DiffieHellman::GetPublicKey(const FunctionCallbackInfo<Value>& args) {
void DiffieHellman::GetPrivateKey(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
DiffieHellman* diffieHellman = Unwrap<DiffieHellman>(args.Holder());
@ -4000,7 +3891,6 @@ void DiffieHellman::GetPrivateKey(const FunctionCallbackInfo<Value>& args) {
void DiffieHellman::ComputeSecret(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
DiffieHellman* diffieHellman = Unwrap<DiffieHellman>(args.Holder());
@ -4071,8 +3961,6 @@ void DiffieHellman::ComputeSecret(const FunctionCallbackInfo<Value>& args) {
void DiffieHellman::SetPublicKey(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
DiffieHellman* diffieHellman = Unwrap<DiffieHellman>(args.Holder());
Environment* env = diffieHellman->env();
@ -4092,8 +3980,6 @@ void DiffieHellman::SetPublicKey(const FunctionCallbackInfo<Value>& args) {
void DiffieHellman::SetPrivateKey(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
DiffieHellman* diffieHellman = Unwrap<DiffieHellman>(args.Holder());
Environment* env = diffieHellman->env();
@ -4156,7 +4042,6 @@ void ECDH::Initialize(Environment* env, Handle<Object> target) {
void ECDH::New(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
// TODO(indutny): Support raw curves?
CHECK(args[0]->IsString());
@ -4176,7 +4061,6 @@ void ECDH::New(const FunctionCallbackInfo<Value>& args) {
void ECDH::GenerateKeys(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
ECDH* ecdh = Unwrap<ECDH>(args.Holder());
@ -4218,7 +4102,6 @@ EC_POINT* ECDH::BufferToPoint(char* data, size_t len) {
void ECDH::ComputeSecret(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
ASSERT_IS_BUFFER(args[0]);
@ -4248,7 +4131,6 @@ void ECDH::ComputeSecret(const FunctionCallbackInfo<Value>& args) {
void ECDH::GetPublicKey(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
// Conversion form
CHECK_EQ(args.Length(), 1);
@ -4287,7 +4169,6 @@ void ECDH::GetPublicKey(const FunctionCallbackInfo<Value>& args) {
void ECDH::GetPrivateKey(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
ECDH* ecdh = Unwrap<ECDH>(args.Holder());
@ -4315,7 +4196,6 @@ void ECDH::GetPrivateKey(const FunctionCallbackInfo<Value>& args) {
void ECDH::SetPrivateKey(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
ECDH* ecdh = Unwrap<ECDH>(args.Holder());
@ -4335,7 +4215,6 @@ void ECDH::SetPrivateKey(const FunctionCallbackInfo<Value>& args) {
void ECDH::SetPublicKey(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
ECDH* ecdh = Unwrap<ECDH>(args.Holder());
@ -4499,7 +4378,6 @@ void EIO_PBKDF2After(uv_work_t* work_req, int status) {
void PBKDF2(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
const EVP_MD* digest = NULL;
const char* type_error = NULL;
@ -4737,7 +4615,6 @@ void RandomBytesAfter(uv_work_t* work_req, int status) {
template <bool pseudoRandom>
void RandomBytes(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
// maybe allow a buffer to write to? cuts down on object creation
@ -4780,7 +4657,6 @@ void RandomBytes(const FunctionCallbackInfo<Value>& args) {
void GetSSLCiphers(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
SSL_CTX* ctx = SSL_CTX_new(TLSv1_server_method());
if (ctx == NULL) {
@ -4836,7 +4712,6 @@ static void array_push_back(const TypeName* md,
void GetCiphers(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
CipherPushContext ctx(env);
EVP_CIPHER_do_all_sorted(array_push_back<EVP_CIPHER>, &ctx);
args.GetReturnValue().Set(ctx.arr);
@ -4845,7 +4720,6 @@ void GetCiphers(const FunctionCallbackInfo<Value>& args) {
void GetHashes(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
CipherPushContext ctx(env);
EVP_MD_do_all_sorted(array_push_back<EVP_MD>, &ctx);
args.GetReturnValue().Set(ctx.arr);
@ -4869,7 +4743,6 @@ void Certificate::Initialize(Environment* env, Handle<Object> target) {
void Certificate::New(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
new Certificate(env, args.This());
}
@ -4902,8 +4775,6 @@ bool Certificate::VerifySpkac(const char* data, unsigned int len) {
void Certificate::VerifySpkac(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Certificate* certificate = Unwrap<Certificate>(args.Holder());
Environment* env = certificate->env();
bool i = false;
@ -4969,7 +4840,6 @@ const char* Certificate::ExportPublicKey(const char* data, int len) {
void Certificate::ExportPublicKey(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
Certificate* certificate = Unwrap<Certificate>(args.Holder());
@ -5013,7 +4883,6 @@ const char* Certificate::ExportChallenge(const char* data, int len) {
void Certificate::ExportChallenge(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
Certificate* crt = Unwrap<Certificate>(args.Holder());

6
src/node_dtrace.cc

@ -148,7 +148,6 @@ void DTRACE_NET_SERVER_CONNECTION(const FunctionCallbackInfo<Value>& args) {
if (!NODE_NET_SERVER_CONNECTION_ENABLED())
return;
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
SLURP_CONNECTION(args[0], conn);
NODE_NET_SERVER_CONNECTION(&conn, conn.remote, conn.port, conn.fd);
}
@ -158,7 +157,6 @@ void DTRACE_NET_STREAM_END(const FunctionCallbackInfo<Value>& args) {
if (!NODE_NET_STREAM_END_ENABLED())
return;
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
SLURP_CONNECTION(args[0], conn);
NODE_NET_STREAM_END(&conn, conn.remote, conn.port, conn.fd);
}
@ -168,7 +166,6 @@ void DTRACE_NET_SOCKET_READ(const FunctionCallbackInfo<Value>& args) {
if (!NODE_NET_SOCKET_READ_ENABLED())
return;
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
SLURP_CONNECTION(args[0], conn);
if (!args[1]->IsNumber()) {
@ -184,7 +181,6 @@ void DTRACE_NET_SOCKET_WRITE(const FunctionCallbackInfo<Value>& args) {
if (!NODE_NET_SOCKET_WRITE_ENABLED())
return;
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
SLURP_CONNECTION(args[0], conn);
if (!args[1]->IsNumber()) {
@ -234,7 +230,6 @@ void DTRACE_HTTP_SERVER_RESPONSE(const FunctionCallbackInfo<Value>& args) {
if (!NODE_HTTP_SERVER_RESPONSE_ENABLED())
return;
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
SLURP_CONNECTION(args[0], conn);
NODE_HTTP_SERVER_RESPONSE(&conn, conn.remote, conn.port, conn.fd);
}
@ -284,7 +279,6 @@ void DTRACE_HTTP_CLIENT_RESPONSE(const FunctionCallbackInfo<Value>& args) {
if (!NODE_HTTP_CLIENT_RESPONSE_ENABLED())
return;
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
SLURP_CONNECTION_HTTP_CLIENT_RESPONSE(args[0], args[1], conn);
NODE_HTTP_CLIENT_RESPONSE(&conn, conn.remote, conn.port, conn.fd);
}

25
src/node_file.cc

@ -313,7 +313,6 @@ struct fs_req_wrap {
static void Close(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (args.Length() < 1 || !args[0]->IsInt32()) {
return THROW_BAD_ARGS;
@ -428,7 +427,6 @@ Local<Value> BuildStatsObject(Environment* env, const uv_stat_t* s) {
static void Stat(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (args.Length() < 1)
return TYPE_ERROR("path required");
@ -448,7 +446,6 @@ static void Stat(const FunctionCallbackInfo<Value>& args) {
static void LStat(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (args.Length() < 1)
return TYPE_ERROR("path required");
@ -468,7 +465,6 @@ static void LStat(const FunctionCallbackInfo<Value>& args) {
static void FStat(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (args.Length() < 1 || !args[0]->IsInt32()) {
return THROW_BAD_ARGS;
@ -487,7 +483,6 @@ static void FStat(const FunctionCallbackInfo<Value>& args) {
static void Symlink(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
int len = args.Length();
if (len < 1)
@ -523,7 +518,6 @@ static void Symlink(const FunctionCallbackInfo<Value>& args) {
static void Link(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
int len = args.Length();
if (len < 1)
@ -547,7 +541,6 @@ static void Link(const FunctionCallbackInfo<Value>& args) {
static void ReadLink(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (args.Length() < 1)
return TYPE_ERROR("path required");
@ -568,7 +561,6 @@ static void ReadLink(const FunctionCallbackInfo<Value>& args) {
static void Rename(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
int len = args.Length();
if (len < 1)
@ -592,7 +584,6 @@ static void Rename(const FunctionCallbackInfo<Value>& args) {
static void FTruncate(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (args.Length() < 2 || !args[0]->IsInt32()) {
return THROW_BAD_ARGS;
@ -612,7 +603,6 @@ static void FTruncate(const FunctionCallbackInfo<Value>& args) {
static void Fdatasync(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (args.Length() < 1 || !args[0]->IsInt32()) {
return THROW_BAD_ARGS;
@ -629,7 +619,6 @@ static void Fdatasync(const FunctionCallbackInfo<Value>& args) {
static void Fsync(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (args.Length() < 1 || !args[0]->IsInt32()) {
return THROW_BAD_ARGS;
@ -646,7 +635,6 @@ static void Fsync(const FunctionCallbackInfo<Value>& args) {
static void Unlink(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (args.Length() < 1)
return TYPE_ERROR("path required");
@ -664,7 +652,6 @@ static void Unlink(const FunctionCallbackInfo<Value>& args) {
static void RMDir(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (args.Length() < 1)
return TYPE_ERROR("path required");
@ -682,7 +669,6 @@ static void RMDir(const FunctionCallbackInfo<Value>& args) {
static void MKDir(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (args.Length() < 2 || !args[0]->IsString() || !args[1]->IsInt32()) {
return THROW_BAD_ARGS;
@ -700,7 +686,6 @@ static void MKDir(const FunctionCallbackInfo<Value>& args) {
static void ReadDir(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (args.Length() < 1)
return TYPE_ERROR("path required");
@ -738,7 +723,6 @@ static void ReadDir(const FunctionCallbackInfo<Value>& args) {
static void Open(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
int len = args.Length();
if (len < 1)
@ -778,7 +762,6 @@ static void Open(const FunctionCallbackInfo<Value>& args) {
// if null, write from the current position
static void WriteBuffer(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
assert(args[0]->IsInt32());
assert(Buffer::HasInstance(args[1]));
@ -824,7 +807,6 @@ static void WriteBuffer(const FunctionCallbackInfo<Value>& args) {
// if null, write from the current position
// 3 enc encoding of string
static void WriteString(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
if (!args[0]->IsInt32())
@ -898,7 +880,6 @@ static void WriteString(const FunctionCallbackInfo<Value>& args) {
*/
static void Read(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (args.Length() < 2 || !args[0]->IsInt32()) {
return THROW_BAD_ARGS;
@ -952,7 +933,6 @@ static void Read(const FunctionCallbackInfo<Value>& args) {
*/
static void Chmod(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (args.Length() < 2 || !args[0]->IsString() || !args[1]->IsInt32()) {
return THROW_BAD_ARGS;
@ -973,7 +953,6 @@ static void Chmod(const FunctionCallbackInfo<Value>& args) {
*/
static void FChmod(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (args.Length() < 2 || !args[0]->IsInt32() || !args[1]->IsInt32()) {
return THROW_BAD_ARGS;
@ -994,7 +973,6 @@ static void FChmod(const FunctionCallbackInfo<Value>& args) {
*/
static void Chown(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
int len = args.Length();
if (len < 1)
@ -1027,7 +1005,6 @@ static void Chown(const FunctionCallbackInfo<Value>& args) {
*/
static void FChown(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
int len = args.Length();
if (len < 1)
@ -1057,7 +1034,6 @@ static void FChown(const FunctionCallbackInfo<Value>& args) {
static void UTimes(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
int len = args.Length();
if (len < 1)
@ -1086,7 +1062,6 @@ static void UTimes(const FunctionCallbackInfo<Value>& args) {
static void FUTimes(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
int len = args.Length();
if (len < 1)

6
src/node_http_parser.cc

@ -350,7 +350,6 @@ class Parser : public BaseObject {
static void New(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
http_parser_type type =
static_cast<http_parser_type>(args[0]->Int32Value());
@ -360,7 +359,6 @@ class Parser : public BaseObject {
static void Close(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Parser* parser = Unwrap<Parser>(args.Holder());
delete parser;
}
@ -382,7 +380,6 @@ class Parser : public BaseObject {
// var bytesParsed = parser->execute(buffer);
static void Execute(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
Parser* parser = Unwrap<Parser>(args.Holder());
@ -438,7 +435,6 @@ class Parser : public BaseObject {
static void Finish(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
Parser* parser = Unwrap<Parser>(args.Holder());
@ -465,7 +461,6 @@ class Parser : public BaseObject {
static void Reinitialize(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
http_parser_type type =
@ -481,7 +476,6 @@ class Parser : public BaseObject {
template <bool should_pause>
static void Pause(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
Parser* parser = Unwrap<Parser>(args.Holder());
// Should always be called from the same context.

14
src/node_os.cc

@ -51,7 +51,6 @@ using v8::Array;
using v8::Context;
using v8::FunctionCallbackInfo;
using v8::Handle;
using v8::HandleScope;
using v8::Integer;
using v8::Local;
using v8::Number;
@ -62,7 +61,6 @@ using v8::Value;
static void GetEndianness(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
const char* rval = IsBigEndian() ? "BE" : "LE";
args.GetReturnValue().Set(OneByteString(env->isolate(), rval));
}
@ -70,7 +68,6 @@ static void GetEndianness(const FunctionCallbackInfo<Value>& args) {
static void GetHostname(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
char buf[MAXHOSTNAMELEN + 1];
if (gethostname(buf, sizeof(buf))) {
@ -89,7 +86,6 @@ static void GetHostname(const FunctionCallbackInfo<Value>& args) {
static void GetOSType(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
const char* rval;
#ifdef __POSIX__
@ -108,7 +104,6 @@ static void GetOSType(const FunctionCallbackInfo<Value>& args) {
static void GetOSRelease(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
const char* rval;
#ifdef __POSIX__
@ -140,7 +135,6 @@ static void GetOSRelease(const FunctionCallbackInfo<Value>& args) {
static void GetCPUInfo(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
uv_cpu_info_t* cpu_infos;
int count, i;
@ -180,8 +174,6 @@ static void GetCPUInfo(const FunctionCallbackInfo<Value>& args) {
static void GetFreeMemory(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
double amount = uv_get_free_memory();
if (amount < 0)
return;
@ -190,8 +182,6 @@ static void GetFreeMemory(const FunctionCallbackInfo<Value>& args) {
static void GetTotalMemory(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
double amount = uv_get_total_memory();
if (amount < 0)
return;
@ -200,8 +190,6 @@ static void GetTotalMemory(const FunctionCallbackInfo<Value>& args) {
static void GetUptime(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
double uptime;
int err = uv_uptime(&uptime);
if (err == 0)
@ -211,7 +199,6 @@ static void GetUptime(const FunctionCallbackInfo<Value>& args) {
static void GetLoadAvg(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
double loadavg[3];
uv_loadavg(loadavg);
Local<Array> loads = Array::New(env->isolate(), 3);
@ -224,7 +211,6 @@ static void GetLoadAvg(const FunctionCallbackInfo<Value>& args) {
static void GetInterfaceAddresses(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
uv_interface_address_t* interfaces;
int count, i;
char ip[INET6_ADDRSTRLEN];

4
src/node_stat_watcher.cc

@ -101,7 +101,6 @@ void StatWatcher::Callback(uv_fs_poll_t* handle,
void StatWatcher::New(const FunctionCallbackInfo<Value>& args) {
assert(args.IsConstructCall());
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
new StatWatcher(env, args.This());
}
@ -109,8 +108,6 @@ void StatWatcher::New(const FunctionCallbackInfo<Value>& args) {
void StatWatcher::Start(const FunctionCallbackInfo<Value>& args) {
assert(args.Length() == 3);
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
StatWatcher* wrap = Unwrap<StatWatcher>(args.Holder());
node::Utf8Value path(args[0]);
@ -127,7 +124,6 @@ void StatWatcher::Start(const FunctionCallbackInfo<Value>& args) {
void StatWatcher::Stop(const FunctionCallbackInfo<Value>& args) {
StatWatcher* wrap = Unwrap<StatWatcher>(args.Holder());
Environment* env = wrap->env();
HandleScope handle_scope(env->isolate());
Context::Scope context_scope(env->context());
wrap->MakeCallback(env->onstop_string(), 0, NULL);
wrap->Stop();

3
src/node_v8.cc

@ -173,7 +173,6 @@ void Environment::StopGarbageCollectionTracking() {
void StartGarbageCollectionTracking(const FunctionCallbackInfo<Value>& args) {
CHECK(args[0]->IsFunction() == true);
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
env->StartGarbageCollectionTracking(args[0].As<Function>());
}
@ -181,7 +180,6 @@ void StartGarbageCollectionTracking(const FunctionCallbackInfo<Value>& args) {
void GetHeapStatistics(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
HandleScope handle_scope(isolate);
Environment* env = Environment::GetCurrent(isolate);
HeapStatistics s;
isolate->GetHeapStatistics(&s);
@ -202,7 +200,6 @@ void GetHeapStatistics(const FunctionCallbackInfo<Value>& args) {
void StopGarbageCollectionTracking(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment::GetCurrent(args.GetIsolate())->StopGarbageCollectionTracking();
}

9
src/node_zlib.cc

@ -128,8 +128,6 @@ class ZCtx : public AsyncWrap {
static void Close(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
ZCtx* ctx = Unwrap<ZCtx>(args.Holder());
ctx->Close();
}
@ -138,8 +136,6 @@ class ZCtx : public AsyncWrap {
// write(flush, in, in_off, in_len, out, out_off, out_len)
template <bool async>
static void Write(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
assert(args.Length() == 7);
ZCtx* ctx = Unwrap<ZCtx>(args.Holder());
@ -224,7 +220,6 @@ class ZCtx : public AsyncWrap {
static void AfterSync(ZCtx* ctx, const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
Local<Integer> avail_out = Integer::New(env->isolate(),
ctx->strm_.avail_out);
Local<Integer> avail_in = Integer::New(env->isolate(),
@ -370,7 +365,6 @@ class ZCtx : public AsyncWrap {
}
static void New(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
if (args.Length() < 1 || !args[0]->IsInt32()) {
@ -388,7 +382,6 @@ class ZCtx : public AsyncWrap {
// just pull the ints out of the args and call the other Init
static void Init(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
assert((args.Length() == 4 || args.Length() == 5) &&
"init(windowBits, level, memLevel, strategy, [dictionary])");
@ -429,7 +422,6 @@ class ZCtx : public AsyncWrap {
static void Params(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
assert(args.Length() == 2 && "params(level, strategy)");
@ -440,7 +432,6 @@ class ZCtx : public AsyncWrap {
static void Reset(const FunctionCallbackInfo<Value> &args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
ZCtx* ctx = Unwrap<ZCtx>(args.Holder());

16
src/pipe_wrap.cc

@ -127,7 +127,6 @@ void PipeWrap::New(const FunctionCallbackInfo<Value>& args) {
// Therefore we assert that we are not trying to call this as a
// normal function.
assert(args.IsConstructCall());
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
new PipeWrap(env, args.This(), args[0]->IsTrue());
}
@ -146,11 +145,7 @@ PipeWrap::PipeWrap(Environment* env, Handle<Object> object, bool ipc)
void PipeWrap::Bind(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
PipeWrap* wrap = Unwrap<PipeWrap>(args.Holder());
node::Utf8Value name(args[0]);
int err = uv_pipe_bind(&wrap->handle_, *name);
args.GetReturnValue().Set(err);
@ -159,24 +154,15 @@ void PipeWrap::Bind(const FunctionCallbackInfo<Value>& args) {
#ifdef _WIN32
void PipeWrap::SetPendingInstances(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
PipeWrap* wrap = Unwrap<PipeWrap>(args.Holder());
int instances = args[0]->Int32Value();
uv_pipe_pending_instances(&wrap->handle_, instances);
}
#endif
void PipeWrap::Listen(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
PipeWrap* wrap = Unwrap<PipeWrap>(args.Holder());
int backlog = args[0]->Int32Value();
int err = uv_listen(reinterpret_cast<uv_stream_t*>(&wrap->handle_),
backlog,
@ -262,7 +248,6 @@ void PipeWrap::AfterConnect(uv_connect_t* req, int status) {
void PipeWrap::Open(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
PipeWrap* wrap = Unwrap<PipeWrap>(args.Holder());
@ -276,7 +261,6 @@ void PipeWrap::Open(const FunctionCallbackInfo<Value>& args) {
void PipeWrap::Connect(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
PipeWrap* wrap = Unwrap<PipeWrap>(args.Holder());

5
src/process_wrap.cc

@ -74,7 +74,6 @@ class ProcessWrap : public HandleWrap {
// Therefore we assert that we are not trying to call this as a
// normal function.
assert(args.IsConstructCall());
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
new ProcessWrap(env, args.This());
}
@ -131,7 +130,6 @@ class ProcessWrap : public HandleWrap {
}
static void Spawn(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
ProcessWrap* wrap = Unwrap<ProcessWrap>(args.Holder());
@ -254,10 +252,7 @@ class ProcessWrap : public HandleWrap {
}
static void Kill(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
ProcessWrap* wrap = Unwrap<ProcessWrap>(args.Holder());
int signal = args[0]->Int32Value();
int err = uv_process_kill(&wrap->process_, signal);
args.GetReturnValue().Set(err);

7
src/signal_wrap.cc

@ -68,7 +68,6 @@ class SignalWrap : public HandleWrap {
// Therefore we assert that we are not trying to call this as a
// normal function.
assert(args.IsConstructCall());
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
new SignalWrap(env, args.This());
}
@ -86,20 +85,14 @@ class SignalWrap : public HandleWrap {
}
static void Start(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
SignalWrap* wrap = Unwrap<SignalWrap>(args.Holder());
int signum = args[0]->Int32Value();
int err = uv_signal_start(&wrap->handle_, OnSignal, signum);
args.GetReturnValue().Set(err);
}
static void Stop(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
SignalWrap* wrap = Unwrap<SignalWrap>(args.Holder());
int err = uv_signal_stop(&wrap->handle_);
args.GetReturnValue().Set(err);
}

6
src/smalloc.cc

@ -173,7 +173,6 @@ size_t ExternalArraySize(enum ExternalArrayType type) {
// copyOnto(source, source_start, dest, dest_start, copy_length)
void CopyOnto(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
if (!args[0]->IsObject())
return env->ThrowTypeError("source must be an object");
@ -249,9 +248,6 @@ void CopyOnto(const FunctionCallbackInfo<Value>& args) {
// for internal use:
// dest._data = sliceOnto(source, dest, start, end);
void SliceOnto(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
Local<Object> source = args[0].As<Object>();
Local<Object> dest = args[1].As<Object>();
@ -291,7 +287,6 @@ void SliceOnto(const FunctionCallbackInfo<Value>& args) {
// alloc(obj, n[, type]);
void Alloc(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
Local<Object> obj = args[0].As<Object>();
@ -449,7 +444,6 @@ bool HasExternalData(Environment* env, Local<Object> obj) {
void AllocTruncate(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
Local<Object> obj = args[0].As<Object>();

1
src/spawn_sync.cc

@ -362,7 +362,6 @@ void SyncProcessRunner::Initialize(Handle<Object> target,
void SyncProcessRunner::Spawn(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
HandleScope scope(isolate);
SyncProcessRunner p(Environment::GetCurrent(isolate));
Local<Value> result = p.Run(args[0]);
args.GetReturnValue().Set(result);

18
src/stream_wrap.cc

@ -90,23 +90,14 @@ void StreamWrap::UpdateWriteQueueSize() {
}
void StreamWrap::ReadStart(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
StreamWrap* wrap = Unwrap<StreamWrap>(args.Holder());
int err = uv_read_start(wrap->stream(), OnAlloc, OnRead);
args.GetReturnValue().Set(err);
}
void StreamWrap::ReadStop(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
StreamWrap* wrap = Unwrap<StreamWrap>(args.Holder());
int err = uv_read_stop(wrap->stream());
args.GetReturnValue().Set(err);
}
@ -190,7 +181,6 @@ size_t StreamWrap::WriteBuffer(Handle<Value> val, uv_buf_t* buf) {
void StreamWrap::WriteBuffer(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
StreamWrap* wrap = Unwrap<StreamWrap>(args.Holder());
@ -247,7 +237,6 @@ void StreamWrap::WriteBuffer(const FunctionCallbackInfo<Value>& args) {
template <enum encoding encoding>
void StreamWrap::WriteStringImpl(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
int err;
@ -376,7 +365,6 @@ void StreamWrap::WriteStringImpl(const FunctionCallbackInfo<Value>& args) {
void StreamWrap::Writev(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
StreamWrap* wrap = Unwrap<StreamWrap>(args.Holder());
@ -505,14 +493,9 @@ void StreamWrap::WriteBinaryString(const FunctionCallbackInfo<Value>& args) {
}
void StreamWrap::SetBlocking(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
StreamWrap* wrap = Unwrap<StreamWrap>(args.Holder());
assert(args.Length() > 0);
int err = uv_stream_set_blocking(wrap->stream(), args[0]->IsTrue());
args.GetReturnValue().Set(err);
}
@ -552,7 +535,6 @@ void StreamWrap::AfterWrite(uv_write_t* req, int status) {
void StreamWrap::Shutdown(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
StreamWrap* wrap = Unwrap<StreamWrap>(args.Holder());

36
src/tcp_wrap.cc

@ -148,7 +148,6 @@ void TCPWrap::New(const FunctionCallbackInfo<Value>& args) {
// Therefore we assert that we are not trying to call this as a
// normal function.
assert(args.IsConstructCall());
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
TCPWrap* wrap = new TCPWrap(env, args.This());
assert(wrap);
@ -173,7 +172,6 @@ TCPWrap::~TCPWrap() {
void TCPWrap::GetSockName(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
struct sockaddr_storage address;
@ -196,7 +194,6 @@ void TCPWrap::GetSockName(const FunctionCallbackInfo<Value>& args) {
void TCPWrap::GetPeerName(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
struct sockaddr_storage address;
@ -219,11 +216,7 @@ void TCPWrap::GetPeerName(const FunctionCallbackInfo<Value>& args) {
void TCPWrap::SetNoDelay(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
TCPWrap* wrap = Unwrap<TCPWrap>(args.Holder());
int enable = static_cast<int>(args[0]->BooleanValue());
int err = uv_tcp_nodelay(&wrap->handle_, enable);
args.GetReturnValue().Set(err);
@ -231,14 +224,9 @@ void TCPWrap::SetNoDelay(const FunctionCallbackInfo<Value>& args) {
void TCPWrap::SetKeepAlive(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
TCPWrap* wrap = Unwrap<TCPWrap>(args.Holder());
int enable = args[0]->Int32Value();
unsigned int delay = args[1]->Uint32Value();
int err = uv_tcp_keepalive(&wrap->handle_, enable, delay);
args.GetReturnValue().Set(err);
}
@ -246,11 +234,7 @@ void TCPWrap::SetKeepAlive(const FunctionCallbackInfo<Value>& args) {
#ifdef _WIN32
void TCPWrap::SetSimultaneousAccepts(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
TCPWrap* wrap = Unwrap<TCPWrap>(args.Holder());
bool enable = args[0]->BooleanValue();
int err = uv_tcp_simultaneous_accepts(&wrap->handle_, enable);
args.GetReturnValue().Set(err);
@ -259,8 +243,6 @@ void TCPWrap::SetSimultaneousAccepts(const FunctionCallbackInfo<Value>& args) {
void TCPWrap::Open(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
TCPWrap* wrap = Unwrap<TCPWrap>(args.Holder());
int fd = static_cast<int>(args[0]->IntegerValue());
uv_tcp_open(&wrap->handle_, fd);
@ -268,14 +250,9 @@ void TCPWrap::Open(const FunctionCallbackInfo<Value>& args) {
void TCPWrap::Bind(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
TCPWrap* wrap = Unwrap<TCPWrap>(args.Holder());
node::Utf8Value ip_address(args[0]);
int port = args[1]->Int32Value();
sockaddr_in addr;
int err = uv_ip4_addr(*ip_address, port, &addr);
if (err == 0) {
@ -283,20 +260,14 @@ void TCPWrap::Bind(const FunctionCallbackInfo<Value>& args) {
reinterpret_cast<const sockaddr*>(&addr),
0);
}
args.GetReturnValue().Set(err);
}
void TCPWrap::Bind6(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
TCPWrap* wrap = Unwrap<TCPWrap>(args.Holder());
node::Utf8Value ip6_address(args[0]);
int port = args[1]->Int32Value();
sockaddr_in6 addr;
int err = uv_ip6_addr(*ip6_address, port, &addr);
if (err == 0) {
@ -304,17 +275,12 @@ void TCPWrap::Bind6(const FunctionCallbackInfo<Value>& args) {
reinterpret_cast<const sockaddr*>(&addr),
0);
}
args.GetReturnValue().Set(err);
}
void TCPWrap::Listen(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
TCPWrap* wrap = Unwrap<TCPWrap>(args.Holder());
int backlog = args[0]->Int32Value();
int err = uv_listen(reinterpret_cast<uv_stream_t*>(&wrap->handle_),
backlog,
@ -387,7 +353,6 @@ void TCPWrap::AfterConnect(uv_connect_t* req, int status) {
void TCPWrap::Connect(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
TCPWrap* wrap = Unwrap<TCPWrap>(args.Holder());
@ -421,7 +386,6 @@ void TCPWrap::Connect(const FunctionCallbackInfo<Value>& args) {
void TCPWrap::Connect6(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
TCPWrap* wrap = Unwrap<TCPWrap>(args.Holder());

1
src/timer_wrap.cc

@ -79,7 +79,6 @@ class TimerWrap : public HandleWrap {
// Therefore we assert that we are not trying to call this as a
// normal function.
assert(args.IsConstructCall());
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
new TimerWrap(env, args.This());
}

15
src/tls_wrap.cc

@ -206,7 +206,6 @@ void TLSCallbacks::InitSSL() {
void TLSCallbacks::Wrap(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
if (args.Length() < 1 || !args[0]->IsObject()) {
@ -240,8 +239,6 @@ void TLSCallbacks::Wrap(const FunctionCallbackInfo<Value>& args) {
void TLSCallbacks::Receive(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
TLSCallbacks* wrap = Unwrap<TLSCallbacks>(args.Holder());
CHECK(Buffer::HasInstance(args[0]));
@ -267,7 +264,6 @@ void TLSCallbacks::Receive(const FunctionCallbackInfo<Value>& args) {
void TLSCallbacks::Start(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
TLSCallbacks* wrap = Unwrap<TLSCallbacks>(args.Holder());
@ -685,7 +681,6 @@ int TLSCallbacks::DoShutdown(ShutdownWrap* req_wrap, uv_shutdown_cb cb) {
void TLSCallbacks::SetVerifyMode(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
TLSCallbacks* wrap = Unwrap<TLSCallbacks>(args.Holder());
@ -716,22 +711,14 @@ void TLSCallbacks::SetVerifyMode(const FunctionCallbackInfo<Value>& args) {
void TLSCallbacks::EnableSessionCallbacks(
const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
TLSCallbacks* wrap = Unwrap<TLSCallbacks>(args.Holder());
wrap->enable_session_callbacks();
EnableHelloParser(args);
}
void TLSCallbacks::EnableHelloParser(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
TLSCallbacks* wrap = Unwrap<TLSCallbacks>(args.Holder());
NodeBIO::FromBIO(wrap->enc_in_)->set_initial(kMaxHelloLength);
wrap->hello_parser_.Start(SSLWrap<TLSCallbacks>::OnClientHello,
OnClientHelloParseEnd,
@ -748,7 +735,6 @@ void TLSCallbacks::OnClientHelloParseEnd(void* arg) {
#ifdef SSL_CTRL_SET_TLSEXT_SERVERNAME_CB
void TLSCallbacks::GetServername(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
TLSCallbacks* wrap = Unwrap<TLSCallbacks>(args.Holder());
@ -764,7 +750,6 @@ void TLSCallbacks::GetServername(const FunctionCallbackInfo<Value>& args) {
void TLSCallbacks::SetServername(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
TLSCallbacks* wrap = Unwrap<TLSCallbacks>(args.Holder());

10
src/tty_wrap.cc

@ -39,7 +39,6 @@ using v8::Function;
using v8::FunctionCallbackInfo;
using v8::FunctionTemplate;
using v8::Handle;
using v8::HandleScope;
using v8::Integer;
using v8::Local;
using v8::Object;
@ -100,7 +99,6 @@ uv_tty_t* TTYWrap::UVHandle() {
void TTYWrap::GuessHandleType(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
int fd = args[0]->Int32Value();
assert(fd >= 0);
@ -123,8 +121,6 @@ void TTYWrap::GuessHandleType(const FunctionCallbackInfo<Value>& args) {
void TTYWrap::IsTTY(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
int fd = args[0]->Int32Value();
assert(fd >= 0);
bool rc = uv_guess_handle(fd) == UV_TTY;
@ -134,7 +130,6 @@ void TTYWrap::IsTTY(const FunctionCallbackInfo<Value>& args) {
void TTYWrap::GetWindowSize(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
TTYWrap* wrap = Unwrap<TTYWrap>(args.Holder());
assert(args[0]->IsArray());
@ -153,18 +148,13 @@ void TTYWrap::GetWindowSize(const FunctionCallbackInfo<Value>& args) {
void TTYWrap::SetRawMode(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
TTYWrap* wrap = Unwrap<TTYWrap>(args.Holder());
int err = uv_tty_set_mode(&wrap->handle_, args[0]->IsTrue());
args.GetReturnValue().Set(err);
}
void TTYWrap::New(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
// This constructor should not be exposed to public javascript.

15
src/udp_wrap.cc

@ -129,7 +129,6 @@ void UDPWrap::Initialize(Handle<Object> target,
void UDPWrap::New(const FunctionCallbackInfo<Value>& args) {
assert(args.IsConstructCall());
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
new UDPWrap(env, args.This());
}
@ -147,9 +146,6 @@ void UDPWrap::GetFD(Local<String>, const PropertyCallbackInfo<Value>& args) {
void UDPWrap::DoBind(const FunctionCallbackInfo<Value>& args, int family) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
UDPWrap* wrap = Unwrap<UDPWrap>(args.Holder());
// bind(ip, port, flags)
@ -195,7 +191,6 @@ void UDPWrap::Bind6(const FunctionCallbackInfo<Value>& args) {
#define X(name, fn) \
void UDPWrap::name(const FunctionCallbackInfo<Value>& args) { \
HandleScope scope(args.GetIsolate()); \
UDPWrap* wrap = Unwrap<UDPWrap>(args.Holder()); \
assert(args.Length() == 1); \
int flag = args[0]->Int32Value(); \
@ -213,8 +208,6 @@ X(SetMulticastLoopback, uv_udp_set_multicast_loop)
void UDPWrap::SetMembership(const FunctionCallbackInfo<Value>& args,
uv_membership membership) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
UDPWrap* wrap = Unwrap<UDPWrap>(args.Holder());
assert(args.Length() == 2);
@ -246,7 +239,6 @@ void UDPWrap::DropMembership(const FunctionCallbackInfo<Value>& args) {
void UDPWrap::DoSend(const FunctionCallbackInfo<Value>& args, int family) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
UDPWrap* wrap = Unwrap<UDPWrap>(args.Holder());
@ -317,10 +309,7 @@ void UDPWrap::Send6(const FunctionCallbackInfo<Value>& args) {
void UDPWrap::RecvStart(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
UDPWrap* wrap = Unwrap<UDPWrap>(args.Holder());
int err = uv_udp_recv_start(&wrap->handle_, OnAlloc, OnRecv);
// UV_EALREADY means that the socket is already bound but that's okay
if (err == UV_EALREADY)
@ -330,17 +319,13 @@ void UDPWrap::RecvStart(const FunctionCallbackInfo<Value>& args) {
void UDPWrap::RecvStop(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
UDPWrap* wrap = Unwrap<UDPWrap>(args.Holder());
int r = uv_udp_recv_stop(&wrap->handle_);
args.GetReturnValue().Set(r);
}
void UDPWrap::GetSockName(const FunctionCallbackInfo<Value>& args) {
HandleScope handle_scope(args.GetIsolate());
Environment* env = Environment::GetCurrent(args.GetIsolate());
struct sockaddr_storage address;

2
src/uv.cc

@ -31,7 +31,6 @@ using v8::Context;
using v8::FunctionCallbackInfo;
using v8::FunctionTemplate;
using v8::Handle;
using v8::HandleScope;
using v8::Integer;
using v8::Object;
using v8::String;
@ -40,7 +39,6 @@ using v8::Value;
void ErrName(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
int err = args[0]->Int32Value();
if (err >= 0)
return env->ThrowError("err >= 0");

Loading…
Cancel
Save