Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: drop homegrown thread pool, use libplatform #1329

Merged
merged 1 commit into from
Apr 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ def configure_v8(o):
if options.shared_v8_libname:
o['libraries'] += ['-l%s' % options.shared_v8_libname]
elif options.shared_v8:
o['libraries'] += ['-lv8']
o['libraries'] += ['-lv8', '-lv8_platform']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bnoordhuis won't this be an issue when providing your own shared libname (since you can only provide one)? I guess it's irrelevant when my shared v8 patch lands..

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's an issue. And yes, it won't be an issue any more once shared library support is removed.

if options.shared_v8_includes:
o['include_dirs'] += [options.shared_v8_includes]

Expand Down
8 changes: 6 additions & 2 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@
'src/node_main.cc',
'src/node_os.cc',
'src/node_v8.cc',
'src/node_v8_platform.cc',
'src/node_stat_watcher.cc',
'src/node_watchdog.cc',
'src/node_zlib.cc',
Expand Down Expand Up @@ -312,7 +311,12 @@
'deps/v8/include/v8.h',
'deps/v8/include/v8-debug.h',
],
'dependencies': [ 'deps/v8/tools/gyp/v8.gyp:v8' ],
'dependencies': [
'deps/v8/tools/gyp/v8.gyp:v8',
'deps/v8/tools/gyp/v8.gyp:v8_libplatform',
],
# libplatform/libplatform.h includes include/v8platform.h
'include_dirs': [ 'deps/v8' ],
}],

[ 'node_shared_zlib=="false"', {
Expand Down
13 changes: 11 additions & 2 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "node_http_parser.h"
#include "node_javascript.h"
#include "node_version.h"
#include "node_v8_platform.h"

#if defined HAVE_PERFCTR
#include "node_counters.h"
Expand Down Expand Up @@ -38,6 +37,7 @@
#include "string_bytes.h"
#include "util.h"
#include "uv.h"
#include "libplatform/libplatform.h"
#include "v8-debug.h"
#include "v8-profiler.h"
#include "zlib.h"
Expand Down Expand Up @@ -140,6 +140,7 @@ static bool debugger_running;
static uv_async_t dispatch_debug_messages_async;

static Isolate* node_isolate = nullptr;
static v8::Platform* default_platform;

class ArrayBufferAllocator : public ArrayBuffer::Allocator {
public:
Expand Down Expand Up @@ -3824,8 +3825,11 @@ static void StartNodeInstance(void* arg) {

bool more;
do {
v8::platform::PumpMessageLoop(default_platform, isolate);
more = uv_run(env->event_loop(), UV_RUN_ONCE);

if (more == false) {
v8::platform::PumpMessageLoop(default_platform, isolate);
EmitBeforeExit(env);

// Emit `beforeExit` if the loop became alive either after emitting
Expand Down Expand Up @@ -3872,7 +3876,9 @@ int Start(int argc, char** argv) {
V8::SetEntropySource(crypto::EntropySource);
#endif

V8::InitializePlatform(new Platform(4));
const int thread_pool_size = 4;
default_platform = v8::platform::CreateDefaultPlatform(thread_pool_size);
V8::InitializePlatform(default_platform);
V8::Initialize();

int exit_code = 1;
Expand All @@ -3889,6 +3895,9 @@ int Start(int argc, char** argv) {
}
V8::Dispose();

delete default_platform;
default_platform = nullptr;

delete[] exec_argv;
exec_argv = nullptr;

Expand Down
178 changes: 0 additions & 178 deletions src/node_v8_platform.cc

This file was deleted.

74 changes: 0 additions & 74 deletions src/node_v8_platform.h

This file was deleted.