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

deps: V8: cherry-pick beebee4f80ff #37293

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion common.gypi
Expand Up @@ -36,7 +36,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.18',
'v8_embedder_string': '-node.19',

##### V8 defaults for Node.js #####

Expand Down
3 changes: 2 additions & 1 deletion deps/v8/src/profiler/profiler-listener.cc
Expand Up @@ -113,7 +113,8 @@ void ProfilerListener::CodeCreateEvent(LogEventsAndTags tag,
// profiler as is stored on the code object, except that we transform source
// positions to line numbers here, because we only care about attributing
// ticks to a given line.
for (SourcePositionTableIterator it(abstract_code->source_position_table());
for (SourcePositionTableIterator it(
handle(abstract_code->source_position_table(), isolate_));
!it.done(); it.Advance()) {
int position = it.source_position().ScriptOffset();
int inlining_id = it.source_position().InliningId();
Expand Down
16 changes: 16 additions & 0 deletions test/addons/cpu-profiler-crash/binding.cc
@@ -0,0 +1,16 @@
#include "node.h"
#include "v8.h"
#include "v8-profiler.h"

static void StartCpuProfiler(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::CpuProfiler* profiler = v8::CpuProfiler::New(args.GetIsolate());
v8::Local<v8::String> profile_title = v8::String::NewFromUtf8(
args.GetIsolate(),
"testing",
v8::NewStringType::kInternalized).ToLocalChecked();
profiler->StartProfiling(profile_title, true);
}

NODE_MODULE_INIT(/* exports, module, context */) {
NODE_SET_METHOD(exports, "startCpuProfiler", StartCpuProfiler);
}
9 changes: 9 additions & 0 deletions test/addons/cpu-profiler-crash/binding.gyp
@@ -0,0 +1,9 @@
{
'targets': [
{
'target_name': 'binding',
'sources': [ 'binding.cc' ],
'includes': ['../common.gypi'],
}
]
}
20 changes: 20 additions & 0 deletions test/addons/cpu-profiler-crash/test.js
@@ -0,0 +1,20 @@
'use strict';

// This test crashes most of the time unless the v8 patch:
// https://github.com/v8/v8/commit/beebee4f80ff2eb91187ef1e8fa00b8ff82a20b3
// is applied.
const common = require('../../common');
const bindings = require(`./build/${common.buildType}/binding`);

function fn() { setImmediate(fn); }
setInterval(function() {
for (let i = 0; i < 1000000; i++)
fn();
clearInterval(this);
setTimeout(process.reallyExit, 2000);
}, 0);


setTimeout(() => {
bindings.startCpuProfiler();
}, 1000);