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 8f2083e

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 d5beb4f commit 8f2083e
Copy full SHA for 8f2083e

8 files changed

+26-20Lines changed: 26 additions & 20 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
+5-6Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,7 +1907,7 @@ def configure_library(lib, output, pkgname=None):
19071907

19081908

19091909
def configure_v8(o, configs):
1910-
set_configuration_variable(configs, 'v8_enable_v8_checks', release=1, debug=0)
1910+
set_configuration_variable(configs, 'v8_enable_v8_checks', release=0, debug=1)
19111911

19121912
o['variables']['v8_enable_webassembly'] = 0 if options.v8_lite_mode else 1
19131913
o['variables']['v8_enable_javascript_promise_hooks'] = 1
@@ -2537,11 +2537,10 @@ def make_bin_override():
25372537
del configurations['Release']['variables']
25382538
config_debug_vars = configurations['Debug']['variables']
25392539
del configurations['Debug']['variables']
2540-
output['conditions'].append(['build_type=="Release"', {
2541-
'variables': config_release_vars,
2542-
}, {
2543-
'variables': config_debug_vars,
2544-
}])
2540+
if options.debug:
2541+
variables = variables | config_debug_vars
2542+
else:
2543+
variables = variables | config_release_vars
25452544

25462545
# make_global_settings should be a root level element too
25472546
if 'make_global_settings' in output:
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
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "quic/guard.h"
1010
#include "simdutf.h"
1111
#include "util-inl.h"
12+
#include "v8-value.h"
1213

1314
namespace node {
1415
namespace builtins {
@@ -441,7 +442,7 @@ void BuiltinLoader::SaveCodeCache(const std::string& id, Local<Data> data) {
441442
new_cached_data.reset(
442443
ScriptCompiler::CreateCodeCache(mod->GetUnboundModuleScript()));
443444
} else {
444-
Local<Function> fun = data.As<Function>();
445+
Local<Function> fun = data.As<Value>().As<Function>();
445446
new_cached_data.reset(ScriptCompiler::CreateCodeCacheForFunction(fun));
446447
}
447448
CHECK_NOT_NULL(new_cached_data);
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.