diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2015-06-19 14:23:56 +0300 |
---|---|---|
committer | Rod Vagg <rod@vagg.org> | 2015-08-04 21:56:14 +0300 |
commit | 70d1f32f5605465a1a630a64f6f0d35f96c7709d (patch) | |
tree | 0a349040a686eafcb0a09943ebc733477dce2781 /src/node_v8.cc | |
parent | 4643b8b6671607a7aff60cbbd0b384dcf2f6959e (diff) |
deps: update v8 to 4.4.63.9
Upgrade the bundled V8 and update code in src/ and lib/ to the new API.
Notable backwards incompatible changes are the removal of the smalloc
module and dropped support for CESU-8 decoding. CESU-8 support can be
brought back if necessary by doing UTF-8 decoding ourselves.
This commit includes https://codereview.chromium.org/1192973004 to fix
a build error on python 2.6 systems. The original commit log follows:
Use optparse in js2c.py for python compatibility
Without this change, V8 won't build on RHEL/CentOS 6 because the
distro python is too old to know about the argparse module.
PR-URL: https://github.com/nodejs/io.js/pull/2022
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'src/node_v8.cc')
-rw-r--r-- | src/node_v8.cc | 51 |
1 files changed, 20 insertions, 31 deletions
diff --git a/src/node_v8.cc b/src/node_v8.cc index 2834a21496b..0a3e6e76338 100644 --- a/src/node_v8.cc +++ b/src/node_v8.cc @@ -7,8 +7,8 @@ namespace node { +using v8::ArrayBuffer; using v8::Context; -using v8::ExternalArrayType; using v8::Function; using v8::FunctionCallbackInfo; using v8::Handle; @@ -18,6 +18,7 @@ using v8::Local; using v8::Object; using v8::String; using v8::Uint32; +using v8::Uint32Array; using v8::V8; using v8::Value; @@ -29,31 +30,16 @@ using v8::Value; V(4, heap_size_limit, kHeapSizeLimitIndex) #define V(a, b, c) +1 -static const size_t kHeapStatisticsBufferLength = HEAP_STATISTICS_PROPERTIES(V); +static const size_t kHeapStatisticsPropertiesCount = + HEAP_STATISTICS_PROPERTIES(V); #undef V -static const ExternalArrayType kHeapStatisticsBufferType = - v8::kExternalUint32Array; - -void GetHeapStatistics(const FunctionCallbackInfo<Value>& args) { - CHECK(args.Length() == 1 && args[0]->IsObject()); - - Isolate* isolate = args.GetIsolate(); +void UpdateHeapStatisticsArrayBuffer(const FunctionCallbackInfo<Value>& args) { + Environment* env = Environment::GetCurrent(args); HeapStatistics s; - isolate->GetHeapStatistics(&s); - Local<Object> obj = args[0].As<Object>(); - uint32_t* data = - static_cast<uint32_t*>(obj->GetIndexedPropertiesExternalArrayData()); - - CHECK_NE(data, nullptr); - ASSERT_EQ(obj->GetIndexedPropertiesExternalArrayDataType(), - kHeapStatisticsBufferType); - ASSERT_EQ(obj->GetIndexedPropertiesExternalArrayDataLength(), - kHeapStatisticsBufferLength); - -#define V(i, name, _) \ - data[i] = static_cast<uint32_t>(s.name()); - + env->isolate()->GetHeapStatistics(&s); + uint32_t* const buffer = env->heap_statistics_buffer(); +#define V(index, name, _) buffer[index] = static_cast<uint32_t>(s.name()); HEAP_STATISTICS_PROPERTIES(V) #undef V } @@ -76,18 +62,21 @@ void InitializeV8Bindings(Handle<Object> target, Handle<Value> unused, Handle<Context> context) { Environment* env = Environment::GetCurrent(context); - env->SetMethod(target, "getHeapStatistics", GetHeapStatistics); + env->SetMethod(target, + "updateHeapStatisticsArrayBuffer", + UpdateHeapStatisticsArrayBuffer); env->SetMethod(target, "setFlagsFromString", SetFlagsFromString); - target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), - "kHeapStatisticsBufferLength"), - Uint32::NewFromUnsigned(env->isolate(), - kHeapStatisticsBufferLength)); + env->set_heap_statistics_buffer(new uint32_t[kHeapStatisticsPropertiesCount]); + + const size_t heap_statistics_buffer_byte_length = + sizeof(*env->heap_statistics_buffer()) * kHeapStatisticsPropertiesCount; target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), - "kHeapStatisticsBufferType"), - Uint32::NewFromUnsigned(env->isolate(), - kHeapStatisticsBufferType)); + "heapStatisticsArrayBuffer"), + ArrayBuffer::New(env->isolate(), + env->heap_statistics_buffer(), + heap_statistics_buffer_byte_length)); #define V(i, _, name) \ target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), #name), \ |