File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,16 +19,24 @@ Persistent<String> callback_symbol;
1919Persistent<String> on_io_symbol;
2020
2121
22- static inline Local<Integer > AddressToJS (void * address) {
22+ static inline Local<Value > AddressToJS (void * address) {
2323 intptr_t diff = (intptr_t )address - (intptr_t )&etext;
24- assert (diff > 0 && diff < 0x7FFFFFFF );
25- return Integer::New (diff);
24+ if (diff < 0x7FFFFFFF && diff > 0 ) {
25+ return Integer::New (diff);
26+ } else {
27+ return External::New (address);
28+ }
2629}
2730
2831
2932template <class T >
3033static inline T* JSToAddress (Local<Value> v) {
31- return static_cast <T*>((void *)(v->IntegerValue () + &etext));
34+ if (v->IsExternal ()) {
35+ return static_cast <T*>(External::Unwrap (v));
36+ } else {
37+ assert (v->IsInt32 ());
38+ return static_cast <T*>((void *)(v->IntegerValue () + &etext));
39+ }
3240}
3341
3442
You can’t perform that action at this time.
0 commit comments