summaryrefslogtreecommitdiff
path: root/deps/v8/samples
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2016-09-06 22:49:51 +0200
committerMichaël Zasso <targos@protonmail.com>2016-09-22 09:51:19 +0200
commitec02b811a8a5c999bab4de312be2d732b7d9d50b (patch)
treeca3068017254f238cf413a451c57a803572983a4 /deps/v8/samples
parentd2eb7ce0105369a9cad82787cb33a665e9bd00ad (diff)
downloadandroid-node-v8-ec02b811a8a5c999bab4de312be2d732b7d9d50b.tar.gz
android-node-v8-ec02b811a8a5c999bab4de312be2d732b7d9d50b.tar.bz2
android-node-v8-ec02b811a8a5c999bab4de312be2d732b7d9d50b.zip
deps: update V8 to 5.4.500.27
Pick up latest commit from the 5.4-lkgr branch. deps: edit V8 gitignore to allow trace event copy deps: update V8 trace event to 315bf1e2d45be7d53346c31cfcc37424a32c30c8 deps: edit V8 gitignore to allow gtest_prod.h copy deps: update V8 gtest to 6f8a66431cb592dad629028a50b3dd418a408c87 PR-URL: https://github.com/nodejs/node/pull/8317 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Diffstat (limited to 'deps/v8/samples')
-rw-r--r--deps/v8/samples/hello-world.cc18
-rw-r--r--deps/v8/samples/process.cc17
-rw-r--r--deps/v8/samples/samples.gyp14
-rw-r--r--deps/v8/samples/shell.cc18
4 files changed, 21 insertions, 46 deletions
diff --git a/deps/v8/samples/hello-world.cc b/deps/v8/samples/hello-world.cc
index 3b952d816b..9e5188f479 100644
--- a/deps/v8/samples/hello-world.cc
+++ b/deps/v8/samples/hello-world.cc
@@ -11,29 +11,18 @@
using namespace v8;
-class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
- public:
- virtual void* Allocate(size_t length) {
- void* data = AllocateUninitialized(length);
- return data == NULL ? data : memset(data, 0, length);
- }
- virtual void* AllocateUninitialized(size_t length) { return malloc(length); }
- virtual void Free(void* data, size_t) { free(data); }
-};
-
-
int main(int argc, char* argv[]) {
// Initialize V8.
- V8::InitializeICU();
+ V8::InitializeICUDefaultLocation(argv[0]);
V8::InitializeExternalStartupData(argv[0]);
Platform* platform = platform::CreateDefaultPlatform();
V8::InitializePlatform(platform);
V8::Initialize();
// Create a new Isolate and make it the current one.
- ArrayBufferAllocator allocator;
Isolate::CreateParams create_params;
- create_params.array_buffer_allocator = &allocator;
+ create_params.array_buffer_allocator =
+ v8::ArrayBuffer::Allocator::NewDefaultAllocator();
Isolate* isolate = Isolate::New(create_params);
{
Isolate::Scope isolate_scope(isolate);
@@ -68,5 +57,6 @@ int main(int argc, char* argv[]) {
V8::Dispose();
V8::ShutdownPlatform();
delete platform;
+ delete create_params.array_buffer_allocator;
return 0;
}
diff --git a/deps/v8/samples/process.cc b/deps/v8/samples/process.cc
index cfbd054c16..29ddb5cf2f 100644
--- a/deps/v8/samples/process.cc
+++ b/deps/v8/samples/process.cc
@@ -38,17 +38,6 @@
using namespace std;
using namespace v8;
-class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
- public:
- virtual void* Allocate(size_t length) {
- void* data = AllocateUninitialized(length);
- return data == NULL ? data : memset(data, 0, length);
- }
- virtual void* AllocateUninitialized(size_t length) { return malloc(length); }
- virtual void Free(void* data, size_t) { free(data); }
-};
-
-
// These interfaces represent an existing request processing interface.
// The idea is to imagine a real application that uses these interfaces
// and then add scripting capabilities that allow you to interact with
@@ -687,7 +676,7 @@ void PrintMap(map<string, string>* m) {
int main(int argc, char* argv[]) {
- v8::V8::InitializeICU();
+ v8::V8::InitializeICUDefaultLocation(argv[0]);
v8::V8::InitializeExternalStartupData(argv[0]);
v8::Platform* platform = v8::platform::CreateDefaultPlatform();
v8::V8::InitializePlatform(platform);
@@ -699,9 +688,9 @@ int main(int argc, char* argv[]) {
fprintf(stderr, "No script was specified.\n");
return 1;
}
- ArrayBufferAllocator array_buffer_allocator;
Isolate::CreateParams create_params;
- create_params.array_buffer_allocator = &array_buffer_allocator;
+ create_params.array_buffer_allocator =
+ v8::ArrayBuffer::Allocator::NewDefaultAllocator();
Isolate* isolate = Isolate::New(create_params);
Isolate::Scope isolate_scope(isolate);
HandleScope scope(isolate);
diff --git a/deps/v8/samples/samples.gyp b/deps/v8/samples/samples.gyp
index 7e0608b213..e5e9ef0f8c 100644
--- a/deps/v8/samples/samples.gyp
+++ b/deps/v8/samples/samples.gyp
@@ -29,13 +29,14 @@
'variables': {
'v8_code': 1,
'v8_enable_i18n_support%': 1,
+ 'v8_toolset_for_shell%': 'target',
},
- 'includes': ['../build/toolchain.gypi', '../build/features.gypi'],
+ 'includes': ['../gypfiles/toolchain.gypi', '../gypfiles/features.gypi'],
'target_defaults': {
'type': 'executable',
'dependencies': [
- '../tools/gyp/v8.gyp:v8',
- '../tools/gyp/v8.gyp:v8_libplatform',
+ '../src/v8.gyp:v8',
+ '../src/v8.gyp:v8_libplatform',
],
'include_dirs': [
'..',
@@ -56,10 +57,15 @@
},
'targets': [
{
- 'target_name': 'shell',
+ 'target_name': 'v8_shell',
'sources': [
'shell.cc',
],
+ 'conditions': [
+ [ 'want_separate_host_toolset==1', {
+ 'toolsets': [ '<(v8_toolset_for_shell)', ],
+ }],
+ ],
},
{
'target_name': 'hello-world',
diff --git a/deps/v8/samples/shell.cc b/deps/v8/samples/shell.cc
index b89ffdd180..e042815e7a 100644
--- a/deps/v8/samples/shell.cc
+++ b/deps/v8/samples/shell.cc
@@ -63,27 +63,16 @@ void ReportException(v8::Isolate* isolate, v8::TryCatch* handler);
static bool run_shell;
-class ShellArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
- public:
- virtual void* Allocate(size_t length) {
- void* data = AllocateUninitialized(length);
- return data == NULL ? data : memset(data, 0, length);
- }
- virtual void* AllocateUninitialized(size_t length) { return malloc(length); }
- virtual void Free(void* data, size_t) { free(data); }
-};
-
-
int main(int argc, char* argv[]) {
- v8::V8::InitializeICU();
+ v8::V8::InitializeICUDefaultLocation(argv[0]);
v8::V8::InitializeExternalStartupData(argv[0]);
v8::Platform* platform = v8::platform::CreateDefaultPlatform();
v8::V8::InitializePlatform(platform);
v8::V8::Initialize();
v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
- ShellArrayBufferAllocator array_buffer_allocator;
v8::Isolate::CreateParams create_params;
- create_params.array_buffer_allocator = &array_buffer_allocator;
+ create_params.array_buffer_allocator =
+ v8::ArrayBuffer::Allocator::NewDefaultAllocator();
v8::Isolate* isolate = v8::Isolate::New(create_params);
run_shell = (argc == 1);
int result;
@@ -103,6 +92,7 @@ int main(int argc, char* argv[]) {
v8::V8::Dispose();
v8::V8::ShutdownPlatform();
delete platform;
+ delete create_params.array_buffer_allocator;
return result;
}