Upload Kmake

This commit is contained in:
Gorochu
2026-05-26 23:36:42 -07:00
parent ba051b2f74
commit 555ec72358
41615 changed files with 13344630 additions and 1 deletions

View File

@ -0,0 +1,31 @@
#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();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
binding->Set(context, v8::String::NewFromUtf8(
isolate, "test").ToLocalChecked(),
v8::FunctionTemplate::New(isolate, Test)
->GetFunction(context)
.ToLocalChecked()).FromJust();
}
NODE_MODULE(NODE_GYP_MODULE_NAME, Initialize)
} // anonymous namespace

View File

@ -0,0 +1,10 @@
{
'targets': [
{
'target_name': 'binding',
'sources': [ 'binding.cc' ],
'win_delay_load_hook': 'false',
'includes': ['../common.gypi'],
}
]
}

View File

@ -0,0 +1,14 @@
'use strict';
const common = require('../../common');
const binding = require(`./build/${common.buildType}/binding`);
// Create an AsyncWrap object.
const timer = setTimeout(common.mustNotCall(), 1);
timer.unref();
// Stress-test the heap profiler.
binding.test();
clearTimeout(timer);