summaryrefslogtreecommitdiff
path: root/src/timer_wrap.cc
Commit message (Collapse)AuthorAgeFilesLines
* timer_wrap: remove HandleScopes, check return sizeTrevor Norris2014-09-291-14/+9
| | | | | | | | | | | Calls from JS to C++ have an implicit HandleScope. So there is no need to instantiate a new HandleScope in these basic cases. Check if the returned int64_t is an SMI and cast the return value to uint32_t instead of a double. Prevents needing to box the return value, and saves a small amount of execution time. Signed-off-by: Trevor Norris <trev.norris@gmail.com>
* src: update uv callbacks after API changesSaúl Ibarra Corretgé2014-04-071-3/+2
| | | | | async, timer, prepare, idle and check handles no longer get a status parameter since they can never fail.
* node: add signature to SET_PROTOTYPE_METHODC. Scott Ananian2014-04-021-5/+5
| | | | | | | | | | This prevents segfaults when a native method is reassigned to a different object (which corrupts args.This()). When unwrapping, clients should use args.Holder() instead of args.This(). Closes #6690. Signed-off-by: Trevor Norris <trev.norris@gmail.com>
* src: update to v8 3.24 APIsFedor Indutny2014-03-131-3/+4
|
* src: remove `node_isolate` from sourceFedor Indutny2014-02-221-10/+16
| | | | fix #6899
* async_wrap: add provider types/pass to constructorTrevor Norris2014-02-051-1/+4
| | | | | | | These will be used to allow users to filter for which types of calls they wish their callbacks to run. Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
* node: register modules from DSO constructorsKeith M Wesolowski2014-01-271-1/+1
| | | | | | | Built-in modules should be automatically registered, replacing the static module list. Add-on modules should also be automatically registered via DSO constructors. This improves flexibility in adding built-in modules and is also a prerequisite to pure-C addon modules.
* src: fix Context::Scope usageBen Noordhuis2013-11-121-1/+1
| | | | | env->context() may or may not create a new Local. It currently does not but don't depend on that behavior, create a HandleScope first.
* src: fix Environment::GetCurrent() usageBen Noordhuis2013-11-111-2/+2
| | | | | | Create a HandleScope before calling the Environment::GetCurrent() that takes a v8::Isolate* as an argument because it creates a handle with the call to v8::Isolate::CurrentContext().
* node: add AsyncListener supportTrevor Norris2013-10-311-1/+3
| | | | | | | | | AsyncListener is a JS API that works in tandem with the AsyncWrap class to allow the user to be alerted to key events in the life cycle of an asynchronous event. The AsyncWrap class has its own MakeCallback implementation that core will be migrated to use, and uses state sharing techniques to allow quicker communication between JS and C++ whether the async event callbacks need to be called.
* src: shorten Object{Wrap,Unwrap}Trevor Norris2013-10-291-5/+5
| | | | | | Going back to the original names of Wrap/Unwrap now that most all the class members that duplicate the name and functionality have been removed.
* src: use function to get internal pointerTrevor Norris2013-10-291-10/+7
| | | | Remove the NODE_{WRAP,UNWRAP} macros and instead use template functions.
* src: add multi-context supportBen Noordhuis2013-09-061-18/+21
| | | | | | | | | | | | | | | | | | | | | | | This commit makes it possible to use multiple V8 execution contexts within a single event loop. Put another way, handle and request wrap objects now "remember" the context they belong to and switch back to that context when the time comes to call into JS land. This could have been done in a quick and hacky way by calling v8::Object::GetCreationContext() on the wrap object right before making a callback but that leaves a fairly wide margin for bugs. Instead, we make the context explicit through a new Environment class that encapsulates everything (or almost everything) that belongs to the context. Variables that used to be a static or a global are now members of the aforementioned class. An additional benefit is that this approach should make it relatively straightforward to add full isolate support in due course. There is no JavaScript API yet but that will be added in the near future. This work was graciously sponsored by GitHub, Inc.
* timer_wrap: Timer.now always update loop timeTimothy J Fontaine2013-08-281-0/+1
| | | | | | | | In `Timer.now` always update the loop time by calling uv_update_time. Previously we were trying to cache the loop time to prevent extra syscalls. While a noble goal, it can cause timers to fire early in certain circumstances. Especially seen in cpu bound work loads or work loads with synchronous file operations.
* src: fix up unused/unordered importsBen Noordhuis2013-08-271-1/+0
|
* timers: dispatch ontimeout callback by array indexBen Noordhuis2013-08-151-4/+6
| | | | | | | Achieve a minor speed-up by looking up the timeout callback on the timer object by using an array index rather than a named property. Gives a performance boost of about 1% on the misc/timers benchmarks.
* src: fix build break from generic macro nameTrevor Norris2013-08-121-5/+5
| | | | | WRAP is too generic a macro name and causes the build to fail from conflicts. They have been prepended with NODE_.
* src: centralize class wrap/unwrapTrevor Norris2013-08-121-5/+10
| | | | | While almost all cases were handled by simple WRAP/UNWRAP macros, this extends those to cover all known occurrences.
* src: use v8::String::NewFrom*() functionsBen Noordhuis2013-08-091-3/+4
| | | | | | | | | | | | | | | | | | | | | | * Change calls to String::New() and String::NewSymbol() to their respective one-byte, two-byte and UTF-8 counterparts. * Add a FIXED_ONE_BYTE_STRING macro that takes a string literal and turns it into a v8::Local<v8::String>. * Add helper functions that make v8::String::NewFromOneByte() easier to work with. Said function expects a `const uint8_t*` but almost every call site deals with `const char*` or `const unsigned char*`. Helps us avoid doing reinterpret_casts all over the place. * Code that handles file system paths keeps using UTF-8 for backwards compatibility reasons. At least now the use of UTF-8 is explicit. * Remove v8::String::NewSymbol() entirely. Almost all call sites were effectively minor de-optimizations. If you create a string only once, there is no point in making it a symbol. If you are create the same string repeatedly, it should probably be cached in a persistent handle.
* src: remove no-op HandleWrap::Initialize()Ben Noordhuis2013-08-071-2/+0
| | | | It's never been used and we probably never will. Remove it.
* src: lint c++ codeFedor Indutny2013-07-311-1/+1
|
* src, lib: update after internal api changeBen Noordhuis2013-07-201-10/+6
| | | | | | | | Libuv now returns errors directly. Make everything in src/ and lib/ follow suit. The changes to lib/ are not strictly necessary but they remove the need for the abominations that are process._errno and node::SetErrno().
* lib, src: upgrade after v8 api changeBen Noordhuis2013-07-061-40/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a big commit that touches just about every file in the src/ directory. The V8 API has changed in significant ways. The most important changes are: * Binding functions take a const v8::FunctionCallbackInfo<T>& argument rather than a const v8::Arguments& argument. * Binding functions return void rather than v8::Handle<v8::Value>. The return value is returned with the args.GetReturnValue().Set() family of functions. * v8::Persistent<T> no longer derives from v8::Handle<T> and no longer allows you to directly dereference the object that the persistent handle points to. This means that the common pattern of caching oft-used JS values in a persistent handle no longer quite works, you first need to reconstruct a v8::Local<T> from the persistent handle with the Local<T>::New(isolate, persistent) factory method. A handful of (internal) convenience classes and functions have been added to make dealing with the new API a little easier. The most visible one is node::Cached<T>, which wraps a v8::Persistent<T> with some template sugar. It can hold arbitrary types but so far it's exclusively used for v8::Strings (which was by far the most commonly cached handle type.)
* src: clean up `using` directivesBen Noordhuis2013-06-171-9/+7
| | | | Remove the unused ones and alphabetically sort the ones that remain.
* src: simplify HandleWrap initializationBen Noordhuis2013-05-301-1/+0
|
* src: replace c-style casts with c++-style castsBen Noordhuis2013-05-301-1/+1
|
* timers: use uv_now instead of Date.nowTimothy J Fontaine2013-05-221-0/+9
| | | | | | | | This saves a few calls to gettimeofday which can be expensive, and potentially subject to clock drift. Instead use the loop time which uses hrtime internally. fixes #5497
* src: pass Isolate to all applicable apiTrevor Norris2013-03-201-14/+14
| | | | | | Update the api to pass node_isolate to all supported methods. Much thanks to Ben Noordhuis and his work in 51f6e6a.
* src, test: downgrade to v8 3.14 apiBen Noordhuis2013-02-251-6/+6
|
* src: pass node_isolate to Integer::NewBen Noordhuis2013-01-071-6/+6
|
* export HandleWrap Unref Ref in tcp/udp/timer/pipeTimothy J Fontaine2012-07-231-0/+2
|
* deps: upgrade libuv to a478847Ben Noordhuis2012-05-221-37/+0
| | | | | The event loop's reference counting scheme in this version of libuv has changed. Update the libuv bindings to reflect that fact.
* Make UNWRAP macro generic.Oleg Efimov2012-05-211-17/+5
|
* MakeCallback: Consistent symbol usageisaacs2012-04-171-1/+4
|
* core: use proper #include directivesBen Noordhuis2012-03-101-2/+2
|
* Revert support for isolates.Ben Noordhuis2012-02-061-10/+9
| | | | | | | | | | | | It was decided that the performance benefits that isolates offer (faster spin-up times for worker processes, faster inter-worker communication, possibly a lower memory footprint) are not actual bottlenecks for most people and do not outweigh the potential stability issues and intrusive changes to the code base that first-class support for isolates requires. Hence, this commit backs out all isolates-related changes. Good bye, isolates. We hardly knew ye.
* Add node::Loop() and don't inc node_isolate.h in *.ccRyan Dahl2011-12-291-10/+10
| | | | | node::Loop() replaces the NODE_LOOP macro. This avoids hitting v8::Isolate::GetCurrent() for each loop lookup when HAVE_ISOLATE==0
* Remove node_isolate.h from node.hRyan Dahl2011-12-291-0/+1
|
* isolates: isolate-ify the main loopBen Noordhuis2011-12-291-9/+9
|
* Remove stray NODE_MODULE() semi-colons.Ben Noordhuis2011-11-091-1/+1
|
* Add missing copyright headersRyan Dahl2011-11-021-0/+21
|
* Display sys_errno when UV_UNKNOWN is returnedRyan Dahl2011-10-191-5/+7
|
* timer_wrap: add sanity check assertBen Noordhuis2011-10-141-0/+3
|
* Upgrade libuv to ea4271fRyan Dahl2011-08-311-9/+9
| | | | Required adding uv_default_loop() in many places.
* Move HandleWrap rules to one placeRyan Dahl2011-07-181-21/+0
|
* Abstract out HandleWrap classRyan Dahl2011-07-181-37/+8
|
* Fix test-net-pingpong.js on windowsHenry Rawas2011-06-281-2/+0
|
* Upgrade libuv to f9b9bb44bd6e2b74729b5d1ff481adf4213e9a0bRyan Dahl2011-06-281-1/+1
|
* libuv wraps: Dispose of JS object on close()Ryan Dahl2011-06-141-3/+6
|
* Upgrade libuvRyan Dahl2011-06-101-3/+4
|