I'm not sure what is actually causing
node_g test/mjsunit/test-tcp-many-clients.js
to run slowly, but I traced the problem to
afd9e714d3.
Somehow it has to do with promoting the compilation of src/util.js. That
change wasn't actually intended to be included in afd9e7 commit anyway, so
I'm reverting it here.
Simplify and inline ObjectWrap::Wrap
Inline and clean up ObjectWrap::Unwrap
Move ObjectWrap into its own file.
Remove handle from ObjectWrap constructor. add obj->Wrap(handle)
Simplify Attach/Detach in ObjectWrap
Remove ObjectWrap::InformV8ofAllocation. (Too messy/complex.)
This is a rather large refactor! Mostly for the better side. I've had to
remove some functionality like req.interrupt(). A lot of other work is left
messy or incomplete.
The constructor for TCP servers can no longer take a connection handler for
purely technical reasons. (The constructor for EventEmitter is implemented
in C++ but addListener is in javascript, and I don't want to make too many
C++ -> Javascript references.) Thus I introduce new constructor methods to
ease the creation of the servers:
node.tcp.createServer()
node.http.createServer()
These work almost the same as the old constructors.
In general we're working towards a future where no constructors are
publicly exposed or take arguments.
The HTTP events like "on_uri" are not yet using the event interface.
onMessage still is a constructor - but this will change soon.
onExit() is similar to the onLoad() callback. onExit() is called on each
module just before the process exits. This can be used to check state in
unit tests, but not to perform I/O. The process will forcibly exit as soon
as all of the onExit callbacks are made.
This is sloppy: after each ObjectWrap allocation the user needs to
call ObjectWrap::InformV8ofAllocation(). In addition each class deriving
from ObjectWrap needs to implement the virtual method size() which should
return the size of the derived class. If I was better at C++ I could
possibly make this less ugly. For now this is how it is.
Memory usage looks much better after this commit.