Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5505511

Browse filesBrowse files
islandryuaduh95
authored andcommitted
build: enable -DV8_ENABLE_CHECKS flag
Fixes: #61301 PR-URL: #61327 Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
1 parent 83cffd9 commit 5505511
Copy full SHA for 5505511

8 files changed

+21-14Lines changed: 21 additions & 14 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎configure.py‎

Copy file name to clipboardExpand all lines: configure.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1809,7 +1809,7 @@ def configure_library(lib, output, pkgname=None):
18091809

18101810

18111811
def configure_v8(o, configs):
1812-
set_configuration_variable(configs, 'v8_enable_v8_checks', release=1, debug=0)
1812+
set_configuration_variable(configs, 'v8_enable_v8_checks', release=0, debug=1)
18131813

18141814
o['variables']['v8_enable_webassembly'] = 0 if options.v8_lite_mode else 1
18151815
o['variables']['v8_enable_javascript_promise_hooks'] = 1
Collapse file

‎doc/api/util.md‎

Copy file name to clipboardExpand all lines: doc/api/util.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ changes:
580580

581581
> Stability: 1.1 - Active development
582582
583-
* `frameCount` {number} Optional number of frames to capture as call site objects.
583+
* `frameCount` {integer} Optional number of frames to capture as call site objects.
584584
**Default:** `10`. Allowable range is between 1 and 200.
585585
* `options` {Object} Optional
586586
* `sourceMap` {boolean} Reconstruct the original location in the stacktrace from the source-map.
Collapse file

‎lib/util.js‎

Copy file name to clipboardExpand all lines: lib/util.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ const {
6666
validateString,
6767
validateOneOf,
6868
validateObject,
69+
validateInteger,
6970
} = require('internal/validators');
7071
const {
7172
isReadableStream,
@@ -452,7 +453,7 @@ function getCallSites(frameCount = 10, options) {
452453
}
453454

454455
// Using kDefaultMaxCallStackSizeToCapture as reference
455-
validateNumber(frameCount, 'frameCount', 1, 200);
456+
validateInteger(frameCount, 'frameCount', 1, 200);
456457
// If options.sourceMaps is true or if sourceMaps are enabled but the option.sourceMaps is not set explicitly to false
457458
if (options.sourceMap === true || (getOptionValue('--enable-source-maps') && options.sourceMap !== false)) {
458459
return mapCallSite(binding.getCallSites(frameCount));
Collapse file

‎src/heap_utils.cc‎

Copy file name to clipboardExpand all lines: src/heap_utils.cc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class JSGraph : public EmbedderGraph {
8989
}
9090

9191
Node* V8Node(const Local<v8::Value>& value) override {
92-
return V8Node(value.As<v8::Data>());
92+
return V8Node(v8::Local<v8::Data>(value));
9393
}
9494

9595
Node* AddNode(std::unique_ptr<Node> node) override {
Collapse file

‎src/node_builtins.cc‎

Copy file name to clipboardExpand all lines: src/node_builtins.cc
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "node_threadsafe_cow-inl.h"
99
#include "simdutf.h"
1010
#include "util-inl.h"
11+
#include "v8-value.h"
1112

1213
namespace node {
1314
namespace builtins {
Collapse file

‎src/node_util.cc‎

Copy file name to clipboardExpand all lines: src/node_util.cc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ static void GetCallSites(const FunctionCallbackInfo<Value>& args) {
258258
Environment* env = Environment::GetCurrent(context);
259259

260260
CHECK_EQ(args.Length(), 1);
261-
CHECK(args[0]->IsNumber());
261+
CHECK(args[0]->IsUint32());
262262
const uint32_t frames = args[0].As<Uint32>()->Value();
263263
CHECK(frames >= 1 && frames <= 200);
264264

Collapse file

‎src/util-inl.h‎

Copy file name to clipboardExpand all lines: src/util-inl.h
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#ifndef SRC_UTIL_INL_H_
2323
#define SRC_UTIL_INL_H_
2424

25+
#include "v8-isolate.h"
2526
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
2627

2728
#include <cmath>
@@ -678,10 +679,15 @@ T FromV8Value(v8::Local<v8::Value> value) {
678679
"Type is out of unsigned integer range");
679680
if constexpr (!loose) {
680681
CHECK(value->IsUint32());
682+
return static_cast<T>(value.As<v8::Uint32>()->Value());
681683
} else {
682684
CHECK(value->IsNumber());
685+
v8::Isolate* isolate = v8::Isolate::GetCurrent();
686+
v8::Local<v8::Context> context = isolate->GetCurrentContext();
687+
v8::Maybe<uint32_t> maybe = value->Uint32Value(context);
688+
CHECK(!maybe.IsNothing());
689+
return static_cast<T>(maybe.FromJust());
683690
}
684-
return static_cast<T>(value.As<v8::Uint32>()->Value());
685691
} else if constexpr (std::is_integral_v<T> && std::is_signed_v<T>) {
686692
static_assert(
687693
std::numeric_limits<T>::max() <= std::numeric_limits<int32_t>::max() &&
Collapse file

‎test/parallel/test-util-getcallsites.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-util-getcallsites.js
+7-8Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,14 @@ const assert = require('node:assert');
3131
);
3232
}
3333

34-
// Guarantee dot-right numbers are ignored
34+
// frameCount must be an integer
3535
{
36-
const callSites = getCallSites(3.6);
37-
assert.strictEqual(callSites.length, 3);
38-
}
39-
40-
{
41-
const callSites = getCallSites(3.4);
42-
assert.strictEqual(callSites.length, 3);
36+
assert.throws(() => {
37+
const callSites = getCallSites(3.6);
38+
assert.strictEqual(callSites.length, 3);
39+
}, common.expectsError({
40+
code: 'ERR_OUT_OF_RANGE'
41+
}));
4342
}
4443

4544
{

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.