mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
70d1f32f56
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>
28 lines
889 B
C++
28 lines
889 B
C++
#include "node.h"
|
|
#include "v8.h"
|
|
#include "v8-profiler.h"
|
|
|
|
namespace {
|
|
|
|
inline void Test(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
|
v8::Isolate* const isolate = args.GetIsolate();
|
|
const v8::HeapSnapshot* const heap_snapshot =
|
|
isolate->GetHeapProfiler()->TakeHeapSnapshot();
|
|
struct : public v8::OutputStream {
|
|
WriteResult WriteAsciiChunk(char*, int) override { return kContinue; }
|
|
void EndOfStream() override {}
|
|
} output_stream;
|
|
heap_snapshot->Serialize(&output_stream, v8::HeapSnapshot::kJSON);
|
|
const_cast<v8::HeapSnapshot*>(heap_snapshot)->Delete();
|
|
}
|
|
|
|
inline void Initialize(v8::Local<v8::Object> binding) {
|
|
v8::Isolate* const isolate = binding->GetIsolate();
|
|
binding->Set(v8::String::NewFromUtf8(isolate, "test"),
|
|
v8::FunctionTemplate::New(isolate, Test)->GetFunction());
|
|
}
|
|
|
|
NODE_MODULE(test, Initialize)
|
|
|
|
} // anonymous namespace
|