Permalink
Browse files

src: pass node_isolate to Integer::New

  • Loading branch information...
1 parent 412b3ce commit 6573fc35022b783d1f93b79dbf127cf2b6c8fc23 @bnoordhuis bnoordhuis committed Jan 6, 2013
View
@@ -203,7 +203,7 @@ static Local<Array> HostentToAddresses(struct hostent* host) {
uv_inet_ntop(host->h_addrtype, host->h_addr_list[i], ip, sizeof(ip));
Local<String> address = String::New(ip);
- addresses->Set(Integer::New(i), address);
+ addresses->Set(Integer::New(i, node_isolate), address);
}
return scope.Close(addresses);
@@ -216,7 +216,7 @@ static Local<Array> HostentToNames(struct hostent* host) {
for (int i = 0; host->h_aliases[i]; ++i) {
Local<String> address = String::New(host->h_aliases[i]);
- names->Set(Integer::New(i), address);
+ names->Set(Integer::New(i, node_isolate), address);
}
return scope.Close(names);
@@ -337,13 +337,13 @@ class QueryWrap {
void CallOnComplete(Local<Value> answer) {
HandleScope scope;
- Local<Value> argv[2] = { Integer::New(0), answer };
+ Local<Value> argv[2] = { Integer::New(0, node_isolate), answer };
MakeCallback(object_, oncomplete_sym, ARRAY_SIZE(argv), argv);
}
void CallOnComplete(Local<Value> answer, Local<Value> family) {
HandleScope scope;
- Local<Value> argv[3] = { Integer::New(0), answer, family };
+ Local<Value> argv[3] = { Integer::New(0, node_isolate), answer, family };
MakeCallback(object_, oncomplete_sym, ARRAY_SIZE(argv), argv);
}
@@ -352,7 +352,7 @@ class QueryWrap {
SetAresErrno(status);
HandleScope scope;
- Local<Value> argv[1] = { Integer::New(-1) };
+ Local<Value> argv[1] = { Integer::New(-1, node_isolate) };
MakeCallback(object_, oncomplete_sym, ARRAY_SIZE(argv), argv);
}
@@ -491,8 +491,9 @@ class QueryMxWrap: public QueryWrap {
mx_current = mx_current->next) {
Local<Object> mx_record = Object::New();
mx_record->Set(exchange_symbol, String::New(mx_current->host));
- mx_record->Set(priority_symbol, Integer::New(mx_current->priority));
- mx_records->Set(Integer::New(i++), mx_record);
+ mx_record->Set(priority_symbol,
+ Integer::New(mx_current->priority, node_isolate));
+ mx_records->Set(Integer::New(i++, node_isolate), mx_record);
}
ares_free_data(mx_start);
@@ -549,7 +550,7 @@ class QueryTxtWrap: public QueryWrap {
struct ares_txt_reply *current = txt_out;
for (int i = 0; current; ++i, current = current->next) {
Local<String> txt = String::New(reinterpret_cast<char*>(current->txt));
- txt_records->Set(Integer::New(i), txt);
+ txt_records->Set(Integer::New(i, node_isolate), txt);
}
ares_free_data(txt_out);
@@ -593,10 +594,13 @@ class QuerySrvWrap: public QueryWrap {
srv_current = srv_current->next) {
Local<Object> srv_record = Object::New();
srv_record->Set(name_symbol, String::New(srv_current->host));
- srv_record->Set(port_symbol, Integer::New(srv_current->port));
- srv_record->Set(priority_symbol, Integer::New(srv_current->priority));
- srv_record->Set(weight_symbol, Integer::New(srv_current->weight));
- srv_records->Set(Integer::New(i++), srv_record);
+ srv_record->Set(port_symbol,
+ Integer::New(srv_current->port, node_isolate));
+ srv_record->Set(priority_symbol,
+ Integer::New(srv_current->priority, node_isolate));
+ srv_record->Set(weight_symbol,
+ Integer::New(srv_current->weight, node_isolate));
+ srv_records->Set(Integer::New(i++, node_isolate), srv_record);
}
ares_free_data(srv_start);
@@ -652,7 +656,7 @@ class GetHostByNameWrap: public QueryWrap {
HandleScope scope;
Local<Array> addresses = HostentToAddresses(host);
- Local<Integer> family = Integer::New(host->h_addrtype);
+ Local<Integer> family = Integer::New(host->h_addrtype, node_isolate);
this->CallOnComplete(addresses, family);
}
@@ -820,14 +824,14 @@ static Handle<Value> IsIP(const Arguments& args) {
char address_buffer[sizeof(struct in6_addr)];
if (uv_inet_pton(AF_INET, *ip, &address_buffer).code == UV_OK) {
- return scope.Close(v8::Integer::New(4));
+ return scope.Close(v8::Integer::New(4, node_isolate));
}
if (uv_inet_pton(AF_INET6, *ip, &address_buffer).code == UV_OK) {
- return scope.Close(v8::Integer::New(6));
+ return scope.Close(v8::Integer::New(6, node_isolate));
}
- return scope.Close(v8::Integer::New(0));
+ return scope.Close(v8::Integer::New(0, node_isolate));
}
@@ -906,9 +910,12 @@ static void Initialize(Handle<Object> target) {
NODE_SET_METHOD(target, "getaddrinfo", GetAddrInfo);
NODE_SET_METHOD(target, "isIP", IsIP);
- target->Set(String::NewSymbol("AF_INET"), Integer::New(AF_INET));
- target->Set(String::NewSymbol("AF_INET6"), Integer::New(AF_INET6));
- target->Set(String::NewSymbol("AF_UNSPEC"), Integer::New(AF_UNSPEC));
+ target->Set(String::NewSymbol("AF_INET"),
+ Integer::New(AF_INET, node_isolate));
+ target->Set(String::NewSymbol("AF_INET6"),
+ Integer::New(AF_INET6, node_isolate));
+ target->Set(String::NewSymbol("AF_UNSPEC"),
+ Integer::New(AF_UNSPEC, node_isolate));
oncomplete_sym = NODE_PSYMBOL("oncomplete");
}
View
@@ -110,7 +110,7 @@ Handle<Value> FSEventWrap::Start(const Arguments& args) {
SetErrno(uv_last_error(uv_default_loop()));
}
- return scope.Close(Integer::New(r));
+ return scope.Close(Integer::New(r, node_isolate));
}
@@ -150,7 +150,7 @@ void FSEventWrap::OnEvent(uv_fs_event_t* handle, const char* filename,
}
Local<Value> argv[3] = {
- Integer::New(status),
+ Integer::New(status, node_isolate),
eventStr,
filename ? (Local<Value>)String::New(filename) : Local<Value>::New(v8::Null())
};
View
@@ -720,7 +720,7 @@ Local<Value> ErrnoException(int errorno,
Local<Object> obj = e->ToObject();
- obj->Set(errno_symbol, Integer::New(errorno));
+ obj->Set(errno_symbol, Integer::New(errorno, node_isolate));
obj->Set(code_symbol, estring);
if (path) obj->Set(errpath_symbol, String::New(path));
if (syscall) obj->Set(syscall_symbol, String::NewSymbol(syscall));
@@ -792,7 +792,7 @@ Local<Value> UVException(int errorno,
Local<Object> obj = e->ToObject();
// TODO errno should probably go
- obj->Set(errno_symbol, Integer::New(errorno));
+ obj->Set(errno_symbol, Integer::New(errorno, node_isolate));
obj->Set(code_symbol, estring);
if (path) obj->Set(errpath_symbol, path_str);
if (syscall) obj->Set(syscall_symbol, String::NewSymbol(syscall));
@@ -853,7 +853,7 @@ Local<Value> WinapiErrnoException(int errorno,
Local<Object> obj = e->ToObject();
- obj->Set(errno_symbol, Integer::New(errorno));
+ obj->Set(errno_symbol, Integer::New(errorno, node_isolate));
if (path) obj->Set(errpath_symbol, String::New(path));
if (syscall) obj->Set(syscall_symbol, String::NewSymbol(syscall));
return e;
@@ -944,7 +944,7 @@ MakeCallback(const Handle<Object> object,
Local<Array> argArray = Array::New(argc);
for (int i = 0; i < argc; i++) {
- argArray->Set(Integer::New(i), argv[i]);
+ argArray->Set(Integer::New(i, node_isolate), argv[i]);
}
Local<Value> object_l = Local<Value>::New(object);
@@ -1501,14 +1501,14 @@ static gid_t gid_by_name(Handle<Value> value) {
static Handle<Value> GetUid(const Arguments& args) {
HandleScope scope;
int uid = getuid();
- return scope.Close(Integer::New(uid));
+ return scope.Close(Integer::New(uid, node_isolate));
}
static Handle<Value> GetGid(const Arguments& args) {
HandleScope scope;
int gid = getgid();
- return scope.Close(Integer::New(gid));
+ return scope.Close(Integer::New(gid, node_isolate));
}
@@ -1577,14 +1577,14 @@ static Handle<Value> GetGroups(const Arguments& args) {
gid_t egid = getegid();
for (int i = 0; i < ngroups; i++) {
- groups_list->Set(i, Integer::New(groups[i]));
+ groups_list->Set(i, Integer::New(groups[i], node_isolate));
if (groups[i] == egid) seen_egid = true;
}
delete[] groups;
if (seen_egid == false) {
- groups_list->Set(ngroups, Integer::New(egid));
+ groups_list->Set(ngroups, Integer::New(egid, node_isolate));
}
return scope.Close(groups_list);
@@ -1721,9 +1721,11 @@ v8::Handle<v8::Value> MemoryUsage(const v8::Arguments& args) {
HeapStatistics v8_heap_stats;
V8::GetHeapStatistics(&v8_heap_stats);
info->Set(heap_total_symbol,
- Integer::NewFromUnsigned(v8_heap_stats.total_heap_size()));
+ Integer::NewFromUnsigned(v8_heap_stats.total_heap_size(),
+ node_isolate));
info->Set(heap_used_symbol,
- Integer::NewFromUnsigned(v8_heap_stats.used_heap_size()));
+ Integer::NewFromUnsigned(v8_heap_stats.used_heap_size(),
+ node_isolate));
return scope.Close(info);
}
@@ -1742,7 +1744,7 @@ Handle<Value> Kill(const Arguments& args) {
if (err.code != UV_OK) {
SetErrno(err);
- return scope.Close(Integer::New(-1));
+ return scope.Close(Integer::New(-1, node_isolate));
}
return Undefined();
@@ -1775,8 +1777,8 @@ Handle<Value> Hrtime(const v8::Arguments& args) {
}
Local<Array> tuple = Array::New(2);
- tuple->Set(0, Integer::NewFromUnsigned(t / NANOS_PER_SEC));
- tuple->Set(1, Integer::NewFromUnsigned(t % NANOS_PER_SEC));
+ tuple->Set(0, Integer::NewFromUnsigned(t / NANOS_PER_SEC, node_isolate));
+ tuple->Set(1, Integer::NewFromUnsigned(t % NANOS_PER_SEC, node_isolate));
return scope.Close(tuple);
}
@@ -2048,7 +2050,7 @@ static Handle<Integer> EnvQuery(Local<String> property,
#ifdef __POSIX__
String::Utf8Value key(property);
if (getenv(*key)) {
- return scope.Close(Integer::New(None));
+ return scope.Close(Integer::New(0, node_isolate));
}
#else // _WIN32
String::Value key(property);
@@ -2059,9 +2061,10 @@ static Handle<Integer> EnvQuery(Local<String> property,
// Environment variables that start with '=' are hidden and read-only.
return scope.Close(Integer::New(v8::ReadOnly ||
v8::DontDelete ||
- v8::DontEnum));
+ v8::DontEnum,
+ node_isolate));
} else {
- return scope.Close(Integer::New(None));
+ return scope.Close(Integer::New(0, node_isolate));
}
}
#endif
@@ -2163,7 +2166,7 @@ static Handle<Object> GetFeatures() {
static Handle<Value> DebugPortGetter(Local<String> property,
const AccessorInfo& info) {
HandleScope scope;
- return scope.Close(Integer::NewFromUnsigned(debug_port));
+ return scope.Close(Integer::NewFromUnsigned(debug_port, node_isolate));
}
@@ -2242,18 +2245,18 @@ Handle<Object> SetupProcessObject(int argc, char *argv[]) {
// process.argv
Local<Array> arguments = Array::New(argc - option_end_index + 1);
- arguments->Set(Integer::New(0), String::New(argv[0]));
+ arguments->Set(Integer::New(0, node_isolate), String::New(argv[0]));
for (j = 1, i = option_end_index; i < argc; j++, i++) {
Local<String> arg = String::New(argv[i]);
- arguments->Set(Integer::New(j), arg);
+ arguments->Set(Integer::New(j, node_isolate), arg);
}
// assign it
process->Set(String::NewSymbol("argv"), arguments);
// process.execArgv
Local<Array> execArgv = Array::New(option_end_index - 1);
for (j = 1, i = 0; j < option_end_index; j++, i++) {
- execArgv->Set(Integer::New(i), String::New(argv[j]));
+ execArgv->Set(Integer::New(i, node_isolate), String::New(argv[j]));
}
// assign it
process->Set(String::NewSymbol("execArgv"), execArgv);
@@ -2270,7 +2273,7 @@ Handle<Object> SetupProcessObject(int argc, char *argv[]) {
Local<Object> env = envTemplate->NewInstance();
process->Set(String::NewSymbol("env"), env);
- process->Set(String::NewSymbol("pid"), Integer::New(getpid()));
+ process->Set(String::NewSymbol("pid"), Integer::New(getpid(), node_isolate));
process->Set(String::NewSymbol("features"), GetFeatures());
// -e, --eval
@@ -2912,7 +2915,7 @@ void EmitExit(v8::Handle<v8::Object> process_l) {
Local<Value> emit_v = process_l->Get(String::New("emit"));
assert(emit_v->IsFunction());
Local<Function> emit = Local<Function>::Cast(emit_v);
- Local<Value> args[] = { String::New("exit"), Integer::New(0) };
+ Local<Value> args[] = { String::New("exit"), Integer::New(0, node_isolate) };
TryCatch try_catch;
emit->Call(process_l, 2, args);
if (try_catch.HasCaught()) {
Oops, something went wrong.

0 comments on commit 6573fc3

Please sign in to comment.