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

[v8.x backport] crypto: use non-deprecated v8::Object::Set #20931

Closed
wants to merge 49 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
4994b7f
http: add options to http.createServer()
Oct 19, 2017
5bfc1d1
http2: add http fallback options to .createServer
hekike Oct 27, 2017
852b996
http2: add req and res options to server creation
Oct 5, 2017
0829b54
doc: fix typo in http2.md
vsemozhetbyt Feb 19, 2018
f7d96ac
http2: pass session to DEBUG_HTTP2SESSION2
danbev May 18, 2018
83cd22e
tools: speed up lint-md-build
refack Nov 10, 2017
bdbef5f
src: remove superfluous check in backtrace_posix.cc
addaleax Nov 11, 2017
141e3e9
trace_events: add file pattern cli option
AndreasMadsen Jan 31, 2018
b2b85e5
src, test: node internals' postmortem metadata
Dec 26, 2017
d27ca6d
test: fix cctest -Wunused-variable warning
bnoordhuis Feb 2, 2018
591812f
src: do not redefine private for GenDebugSymbols
joyeecheung Feb 8, 2018
3a7ad60
src: expose uv.errmap to binding
joyeecheung Dec 25, 2017
4a55524
util: implement util.getSystemErrorName()
joyeecheung Jan 16, 2018
05076ac
errors: lazy load util in internal/errors.js
joyeecheung Jan 24, 2018
de86203
util: skip type checks in internal getSystemErrorName
joyeecheung Feb 3, 2018
64f4b19
errors: move error creation helpers to errors.js
joyeecheung Feb 3, 2018
a974479
errors: make message non-enumerable
BridgeAR Apr 1, 2018
4406f6e
test: set clientOpts.port property
danbev Apr 3, 2018
4f05d1b
test: remove test case 0 from tls-cnnic-whitelist
danbev Apr 13, 2018
6251f2a
crypto: remove BIO_set_shutdown
danbev Dec 7, 2017
4512116
tools: don't lint-md as part of main lint target
refack Dec 7, 2017
a6d6325
tls: use correct class name in deprecation message
addaleax Dec 9, 2017
4cd0ab5
src: make FSEventWrap/StatWatcher::Start more robust
TimothyGu Dec 3, 2017
e0a780b
url: added space to class string of iterator objects
prohaejin Dec 9, 2017
d81a3f4
url: added url fragment lookup table
Kimeiga Dec 8, 2017
b07b9f2
test: add test for postmortem metadata validation
cjihrig Dec 14, 2017
524efb9
lib, src: use process.config instead of regex
maclover7 Dec 21, 2017
3aefc25
test: fix unreliable async-hooks/test-signalwrap
Trott Dec 22, 2017
14f29e3
src: remove duplicate words in comments
tniessen Jan 1, 2018
b046412
http2: remove duplicate words in comments
tniessen Jan 1, 2018
d8c3ecc
perf_hooks: fix scheduling regression
apapirovski Jan 9, 2018
2b941c6
src: update make for new code coverage locations
mhdawson Jan 4, 2018
a337e3a
src: fix code coverage cleanup
mhdawson Jan 10, 2018
0230caf
test: refactor test-repl
addaleax Dec 31, 2017
07e8195
benchmark: add JSStreamWrap benchmark
addaleax Jan 4, 2018
5b8e46d
src: harden JSStream callbacks
addaleax Jan 7, 2018
0082efd
src: rename `On*` -> `Emit*` for stream callbacks
addaleax Dec 15, 2017
396c96e
build: make gyp user defined variables lowercase
danbev Oct 16, 2017
04c166a
build: add node_lib_target_name to cctest deps
danbev Feb 5, 2018
e37643c
src: refactor callback #defines into C++ templates
addaleax Jan 13, 2018
453077f
http: simplify parser lifetime tracking
addaleax Jan 13, 2018
29f49e9
deps: cherry-pick dbfe4a49d8 from upstream V8
Nov 9, 2017
c4c468b
module: Set dynamic import callback
Oct 1, 2017
a0c7df8
module: enable dynamic import flag for esmodules
MylesBorins Jan 25, 2018
1af6ac2
doc: Update tools/icu/README.md
srl295 Nov 10, 2017
de963da
tools: fix icu readme lint error
apapirovski Jan 30, 2018
1a3c296
stream: delete redundant code
Jan 14, 2018
4b2792a
stream: delete redundant code
Jan 15, 2018
2bbf95c
crypto: use non-deprecated v8::Object::Set
danbev Dec 6, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
lib/internal/v8_prof_polyfill.js
lib/punycode.js
test/addons/??_*
test/es-module/test-esm-dynamic-import.js
test/fixtures
tools/eslint
tools/icu
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ deps/npm/node_modules/.bin/

# test artifacts
tools/faketime
tools/remark-cli
tools/remark-preset-lint-node
tools/remark-cli/node_modules
tools/remark-preset-lint-node/node_modules
icu_config.gypi
*.tap

Expand Down
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ check: test
coverage-clean:
if [ -d lib_ ]; then $(RM) -r lib; mv lib_ lib; fi
$(RM) -r node_modules
$(RM) -r gcovr testing
$(RM) -r gcovr build
$(RM) -r out/$(BUILDTYPE)/.coverage
$(RM) -r .cov_tmp
$(RM) out/$(BUILDTYPE)/obj.target/node/{src,gen}/*.gcda
Expand All @@ -162,11 +162,11 @@ coverage-build: all
$(NODE) ./deps/npm install nyc --no-save --no-package-lock; fi
if [ ! -d gcovr ]; then git clone --depth=1 \
--single-branch git://github.com/gcovr/gcovr.git; fi
if [ ! -d testing ]; then git clone --depth=1 \
--single-branch https://github.com/nodejs/testing.git; fi
if [ ! -d build ]; then git clone --depth=1 \
--single-branch https://github.com/nodejs/build.git; fi
if [ ! -f gcovr/scripts/gcovr.orig ]; then \
(cd gcovr && patch -N -p1 < \
"$(CURDIR)/testing/coverage/gcovr-patches.diff"); fi
"$(CURDIR)/build/jenkins/scripts/coverage/gcovr-patches.diff"); fi
if [ -d lib_ ]; then $(RM) -r lib; mv lib_ lib; fi
mv lib lib_
$(NODE) ./node_modules/.bin/nyc instrument --extension .js --extension .mjs lib_/ lib/
Expand Down Expand Up @@ -1123,7 +1123,6 @@ lint: ## Run JS, C++, MD and doc linters.
@EXIT_STATUS=0 ; \
$(MAKE) lint-js || EXIT_STATUS=$$? ; \
$(MAKE) lint-cpp || EXIT_STATUS=$$? ; \
$(MAKE) lint-md || EXIT_STATUS=$$? ; \
$(MAKE) lint-addon-docs || EXIT_STATUS=$$? ; \
$(MAKE) lint-md || EXIT_STATUS=$$? ; \
exit $$EXIT_STATUS
Expand Down
107 changes: 107 additions & 0 deletions benchmark/net/net-wrap-js-stream-passthrough.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
// test the speed of .pipe() with JSStream wrapping for PassThrough streams
'use strict';

const common = require('../common.js');
const { PassThrough } = require('stream');

const bench = common.createBenchmark(main, {
len: [102400, 1024 * 1024 * 16],
type: ['utf', 'asc', 'buf'],
dur: [5],
}, {
flags: ['--expose-internals']
});

var dur;
var len;
var type;
var chunk;
var encoding;
var JSStreamWrap; // Can only require internals inside main().

function main(conf) {
dur = +conf.dur;
len = +conf.len;
type = conf.type;
JSStreamWrap = require('internal/wrap_js_stream');

switch (type) {
case 'buf':
chunk = Buffer.alloc(len, 'x');
break;
case 'utf':
encoding = 'utf8';
chunk = 'ü'.repeat(len / 2);
break;
case 'asc':
encoding = 'ascii';
chunk = 'x'.repeat(len);
break;
default:
throw new Error(`invalid type: ${type}`);
}

doBenchmark();
}

function Writer() {
this.received = 0;
this.writable = true;
}

Writer.prototype.write = function(chunk, encoding, cb) {
this.received += chunk.length;

if (typeof encoding === 'function')
encoding();
else if (typeof cb === 'function')
cb();

return true;
};

// doesn't matter, never emits anything.
Writer.prototype.on = function() {};
Writer.prototype.once = function() {};
Writer.prototype.emit = function() {};
Writer.prototype.prependListener = function() {};


function flow() {
const dest = this.dest;
const res = dest.write(chunk, encoding);
if (!res)
dest.once('drain', this.flow);
else
process.nextTick(this.flow);
}

function Reader() {
this.flow = flow.bind(this);
this.readable = true;
}

Reader.prototype.pipe = function(dest) {
this.dest = dest;
this.flow();
return dest;
};


function doBenchmark() {
const reader = new Reader();
const writer = new Writer();

// the actual benchmark.
const fakeSocket = new JSStreamWrap(new PassThrough());
bench.start();
reader.pipe(fakeSocket);
fakeSocket.pipe(writer);

setTimeout(function() {
const bytes = writer.received;
const gbits = (bytes * 8) / (1024 * 1024 * 1024);
bench.end(gbits);
process.exit(0);
}, dur * 1000);
}
20 changes: 10 additions & 10 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -40,29 +40,29 @@

'conditions': [
['GENERATOR=="ninja"', {
'OBJ_DIR': '<(PRODUCT_DIR)/obj',
'V8_BASE': '<(PRODUCT_DIR)/obj/deps/v8/src/libv8_base.a',
'obj_dir': '<(PRODUCT_DIR)/obj',
'v8_base': '<(PRODUCT_DIR)/obj/deps/v8/src/libv8_base.a',
}, {
'OBJ_DIR%': '<(PRODUCT_DIR)/obj.target',
'V8_BASE%': '<(PRODUCT_DIR)/obj.target/deps/v8/src/libv8_base.a',
'obj_dir%': '<(PRODUCT_DIR)/obj.target',
'v8_base%': '<(PRODUCT_DIR)/obj.target/deps/v8/src/libv8_base.a',
}],
['OS == "win"', {
'os_posix': 0,
'v8_postmortem_support%': 'false',
'OBJ_DIR': '<(PRODUCT_DIR)/obj',
'V8_BASE': '<(PRODUCT_DIR)/lib/v8_libbase.lib',
'obj_dir': '<(PRODUCT_DIR)/obj',
'v8_base': '<(PRODUCT_DIR)/lib/v8_libbase.lib',
}, {
'os_posix': 1,
'v8_postmortem_support%': 'true',
}],
['OS== "mac"', {
'OBJ_DIR%': '<(PRODUCT_DIR)/obj.target',
'V8_BASE': '<(PRODUCT_DIR)/libv8_base.a',
'obj_dir%': '<(PRODUCT_DIR)/obj.target',
'v8_base': '<(PRODUCT_DIR)/libv8_base.a',
}],
['openssl_fips != ""', {
'OPENSSL_PRODUCT': '<(STATIC_LIB_PREFIX)crypto<(STATIC_LIB_SUFFIX)',
'openssl_product': '<(STATIC_LIB_PREFIX)crypto<(STATIC_LIB_SUFFIX)',
}, {
'OPENSSL_PRODUCT': '<(STATIC_LIB_PREFIX)openssl<(STATIC_LIB_SUFFIX)',
'openssl_product': '<(STATIC_LIB_PREFIX)openssl<(STATIC_LIB_SUFFIX)',
}],
['OS=="mac"', {
'clang%': 1,
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/include/v8-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 6
#define V8_MINOR_VERSION 2
#define V8_BUILD_NUMBER 414
#define V8_PATCH_LEVEL 54
#define V8_PATCH_LEVEL 55

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down
75 changes: 67 additions & 8 deletions deps/v8/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class String;
class StringObject;
class Symbol;
class SymbolObject;
class PrimitiveArray;
class Private;
class Uint32;
class Utils;
Expand Down Expand Up @@ -978,6 +979,48 @@ class V8_EXPORT Data {
Data();
};

/**
* This is an unfinished experimental feature, and is only exposed
* here for internal testing purposes. DO NOT USE.
*
* A container type that holds relevant metadata for module loading.
*
* This is passed back to the embedder as part of
* HostImportDynamicallyCallback for module loading.
*/
class V8_EXPORT ScriptOrModule {
public:
/**
* The name that was passed by the embedder as ResourceName to the
* ScriptOrigin. This can be either a v8::String or v8::Undefined.
*/
Local<Value> GetResourceName();

/**
* The options that were passed by the embedder as HostDefinedOptions to
* the ScriptOrigin.
*/
Local<PrimitiveArray> GetHostDefinedOptions();
};

/**
* This is an unfinished experimental feature, and is only exposed
* here for internal testing purposes. DO NOT USE.
*
* An array to hold Primitive values. This is used by the embedder to
* pass host defined options to the ScriptOptions during compilation.
*
* This is passed back to the embedder as part of
* HostImportDynamicallyCallback for module loading.
*
*/
class V8_EXPORT PrimitiveArray {
public:
static Local<PrimitiveArray> New(Isolate* isolate, int length);
int Length() const;
void Set(int index, Local<Primitive> item);
Local<Primitive> Get(int index);
};

/**
* The optional attributes of ScriptOrigin.
Expand Down Expand Up @@ -1027,13 +1070,17 @@ class ScriptOrigin {
Local<Value> source_map_url = Local<Value>(),
Local<Boolean> resource_is_opaque = Local<Boolean>(),
Local<Boolean> is_wasm = Local<Boolean>(),
Local<Boolean> is_module = Local<Boolean>());
Local<Boolean> is_module = Local<Boolean>() /*,
// Backed out for ABI compatibility with V8 6.2
Local<PrimitiveArray> host_defined_options = Local<PrimitiveArray>() */);

V8_INLINE Local<Value> ResourceName() const;
V8_INLINE Local<Integer> ResourceLineOffset() const;
V8_INLINE Local<Integer> ResourceColumnOffset() const;
V8_INLINE Local<Integer> ScriptID() const;
V8_INLINE Local<Value> SourceMapUrl() const;
// Backed out for ABI compatibility with V8 6.2
// V8_INLINE Local<PrimitiveArray> HostDefinedOptions() const;
V8_INLINE ScriptOriginOptions Options() const { return options_; }

private:
Expand All @@ -1043,6 +1090,8 @@ class ScriptOrigin {
ScriptOriginOptions options_;
Local<Integer> script_id_;
Local<Value> source_map_url_;
// Backed out for ABI compatibility with V8 6.2
// Local<PrimitiveArray> host_defined_options_;
};

/**
Expand Down Expand Up @@ -1289,6 +1338,7 @@ class V8_EXPORT ScriptCompiler {
Local<Integer> resource_column_offset;
ScriptOriginOptions resource_options;
Local<Value> source_map_url;
// Local<PrimitiveArray> host_defined_options;

// Cached data from previous compilation (if a kConsume*Cache flag is
// set), or hold newly generated cache data (kProduce*Cache flags) are
Expand Down Expand Up @@ -6156,8 +6206,8 @@ typedef void (*DeprecatedCallCompletedCallback)();
* embedder to load a module. This is used as part of the dynamic
* import syntax.
*
* The referrer is the name of the file which calls the dynamic
* import. The referrer can be used to resolve the module location.
* The referrer contains metadata about the script/module that calls
* import.
*
* The specifier is the name of the module that should be imported.
*
Expand All @@ -6172,7 +6222,8 @@ typedef void (*DeprecatedCallCompletedCallback)();
* that exception by returning an empty MaybeLocal.
*/
typedef MaybeLocal<Promise> (*HostImportModuleDynamicallyCallback)(
Local<Context> context, Local<String> referrer, Local<String> specifier);
Local<Context> context, Local<ScriptOrModule> referrer,
Local<String> specifier);

/**
* PromiseHook with type kInit is called when a new promise is
Expand Down Expand Up @@ -9511,7 +9562,9 @@ ScriptOrigin::ScriptOrigin(Local<Value> resource_name,
Local<Integer> script_id,
Local<Value> source_map_url,
Local<Boolean> resource_is_opaque,
Local<Boolean> is_wasm, Local<Boolean> is_module)
Local<Boolean> is_wasm, Local<Boolean> is_module /*,
// Backed out for ABI compatibility with V8 6.2
Local<PrimitiveArray> host_defined_options */)
: resource_name_(resource_name),
resource_line_offset_(resource_line_offset),
resource_column_offset_(resource_column_offset),
Expand All @@ -9521,10 +9574,16 @@ ScriptOrigin::ScriptOrigin(Local<Value> resource_name,
!is_wasm.IsEmpty() && is_wasm->IsTrue(),
!is_module.IsEmpty() && is_module->IsTrue()),
script_id_(script_id),
source_map_url_(source_map_url) {}
source_map_url_(source_map_url) /*,
// Backed out for ABI compatibility with V8 6.2
host_defined_options_(host_defined_options) */ {}

Local<Value> ScriptOrigin::ResourceName() const { return resource_name_; }

// Backed out for ABI compatibility with V8 6.2
// Local<PrimitiveArray> ScriptOrigin::HostDefinedOptions() const {
// return host_defined_options_;
// }

Local<Integer> ScriptOrigin::ResourceLineOffset() const {
return resource_line_offset_;
Expand All @@ -9541,7 +9600,6 @@ Local<Integer> ScriptOrigin::ScriptID() const { return script_id_; }

Local<Value> ScriptOrigin::SourceMapUrl() const { return source_map_url_; }


ScriptCompiler::Source::Source(Local<String> string, const ScriptOrigin& origin,
CachedData* data)
: source_string(string),
Expand All @@ -9550,9 +9608,10 @@ ScriptCompiler::Source::Source(Local<String> string, const ScriptOrigin& origin,
resource_column_offset(origin.ResourceColumnOffset()),
resource_options(origin.Options()),
source_map_url(origin.SourceMapUrl()),
// Backed out for ABI compatibility with V8 6.2
// host_defined_options(origin.HostDefinedOptions()),
cached_data(data) {}


ScriptCompiler::Source::Source(Local<String> string,
CachedData* data)
: source_string(string), cached_data(data) {}
Expand Down
Loading