Michaël Zasso
98b5d66629
src: do not pass code to ScriptCompiler::CreateCodeCacheForFunction
...
This is unnecessary, deprecated, and removed in V8 7.0.
PR-URL: https://github.com/nodejs/node/pull/22596
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-08-31 08:37:22 +02:00
Ujjwal Sharma
1abbe0a212
vm: add bindings for v8::CompileFunctionInContext
...
Adds a method compileFunction to the vm module, which serves as a
binding for v8::CompileFunctionInContext with appropriate args for
specifying the details, and provide params for the wrapper.
Eventually, we would be changing Module._compile to use this internally
over the standard Module.wrap
PR-URL: https://github.com/nodejs/node/pull/21571
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-08-29 16:41:01 +02:00
Michaël Zasso
08aad66411
src,deps: add isolate parameter to String::Concat
...
Partially backport an upstream commit that deprecates String::Concat
without the isolate parameter. This overload has already been removed
in V8 7.0.
PR-URL: https://github.com/nodejs/node/pull/22521
Refs: https://github.com/v8/v8/commit/8a011b57d8b26e9cfe1c20a2ef26adb14be6ecc2
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2018-08-28 14:11:20 +02:00
Timothy Gu
85c356c10e
src: implement query callbacks for vm
...
This allows using a Proxy object as the sandbox for a VM context.
PR-URL: https://github.com/nodejs/node/pull/22390
Fixes: https://github.com/nodejs/node/issues/17480
Fixes: https://github.com/nodejs/node/issues/17481
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-08-23 23:09:19 -04:00
James M Snell
4963a04b30
vm: move process.binding('contextify') to internalBinding
...
PR-URL: https://github.com/nodejs/node/pull/22419
Refs: https://github.com/nodejs/node/issues/22160
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-08-23 16:09:19 -07:00
Jon Moss
bd2ee60eae
src: remove unused env->vm_parsing_context_symbol
...
Stopped being used via 77b52fd58f , was
originally added in d932e80231 .
For the one remaining usecase inside of `lib/vm.js`, define a Symbol at
the top of the file.
PR-URL: https://github.com/nodejs/node/pull/22034
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2018-08-04 15:32:35 -04:00
Joyee Cheung
28a3e280ec
src: add proper MemoryInfoName to wrappers
...
- Use camel case names for memory retainers inherited from AsyncWrap
instead of their provider names (which are all in upper case)
- Assign class names to wraps so that they appear in the heap snapshot
as nodes with class names as node names. Previously some nodes are
named with reference names, which are supposed to be edge names
instead.
PR-URL: https://github.com/nodejs/node/pull/21939
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2018-07-27 15:51:19 +08:00
Anna Henningsen
57e301539b
src: enable more detailed memory tracking
...
This will enable more detailed heap snapshots based on
a newer V8 API.
This commit itself is not tied to that API and could
be backported.
PR-URL: https://github.com/nodejs/node/pull/21742
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-07-13 19:53:15 +02:00
Gus Caplan
4f67c6f667
vm: add Script.createCodeCache()
...
PR-URL: https://github.com/nodejs/node/pull/20300
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Yang Guo <yangguo@chromium.org >
2018-06-26 16:38:13 -05:00
Tobias Nießen
39f209649f
src: add CHECK_NULL/CHECK_NOT_NULL macros
...
This change introduces CHECK_NULL and CHECK_NOT_NULL macros
similar to their definition in v8 and replaces instances of
CHECK/CHECK_EQ/CHECK_NE with these where it seems appropriate.
PR-URL: https://github.com/nodejs/node/pull/20914
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-05-26 12:29:31 +02:00
James M Snell
8630eea171
vm,trace_events: add node.vm.script trace events category
...
Add basic trace events for node_contextify. These generally
align very well with V8.ScriptCompile and V8.ScriptExecute
trace events and provide good additional context. For instance,
using the node.vm.script trace category at startup allows us to
see exactly how long compilation and init of each of our core
modules adds to the startup time.
PR-URL: https://github.com/nodejs/node/pull/20728
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2018-05-16 14:34:41 -07:00
Daniel Bevenius
f9c6fd0a02
src: use unqualified names in node_contextify.cc
...
This commit removes the usage of qualified names for consistency.
PR-URL: https://github.com/nodejs/node/pull/20669
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-05-13 16:57:02 +02:00
Anna Henningsen
bcb324c3ff
src: add can_call_into_js flag
...
This prevents calls back into JS from the shutdown phase.
Many thanks for Stephen Belanger for reviewing the original version of
this commit in the Ayo.js project.
Refs: https://github.com/ayojs/ayo/pull/82
PR-URL: https://github.com/nodejs/node/pull/19377
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-05-10 14:15:17 +02:00
Anna Henningsen
bd20110286
src: refactor BaseObject internal field management
...
- Instead of storing a pointer whose type refers to the specific
subclass of `BaseObject`, just store a `BaseObject*` directly.
This means in particular that one can cast to classes along
the way of the inheritance chain without issues, and that
`BaseObject*` no longer needs to be the first superclass
in the case of multiple inheritance.
In particular, this renders hack-y solutions to this problem (like
ddc19be6de ) obsolete and addresses
a `TODO` comment of mine.
- Move wrapping/unwrapping methods to the `BaseObject` class.
We use these almost exclusively for `BaseObject`s, and I hope
that this gives a better idea of how (and for what) these are used
in our code.
- Perform initialization/deinitialization of the internal field
in the `BaseObject*` constructor/destructor. This makes the code
a bit more obviously correct, avoids explicit calls for this
in subclass constructors, and in particular allows us to avoid
crash situations when we previously called `ClearWrap()`
during GC.
This also means that we enforce that the object passed to the
`BaseObject` constructor needs to have an internal field.
This is the only reason for the test change.
- Change the signature of `MakeWeak()` to not require a pointer
argument. Previously, this would always have been the same
as `this`, and no other value made sense. Also, the parameter
was something that I personally found somewhat confusing
when becoming familiar with Node’s code.
- Add a `TODO` comment that motivates switching to real inheritance
for the JS types we expose from the native side. This patch
brings us a lot closer to being able to do that.
- Some less significant drive-by cleanup.
Since we *effectively* already store the `BaseObject*` pointer
anyway since ddc19be6de , I do not
think that this is going to have any impact on diagnostic tooling.
Fixes: https://github.com/nodejs/node/issues/18897
PR-URL: https://github.com/nodejs/node/pull/20455
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
2018-05-04 00:57:39 +02:00
Anna Henningsen
a9b0d8235d
src: access ContextifyContext* more directly in property cbs
...
PR-URL: https://github.com/nodejs/node/pull/20455
Fixes: https://github.com/nodejs/node/issues/18897
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
2018-05-04 00:57:38 +02:00
Joyee Cheung
3152b7c0d3
src: assign ERR_SCRIPT_EXECUTION_* codes in C++
...
Also modifies the error messages so they include more information
and are more consistent.
- The message of ERR_SCRIPT_EXECUTION_INTERRUPTED now mentions
SIGINT and the trailing period is dropped for consistency.
- Added ERR_SCRIPT_EXECUTION_TIMEOUT and include the timeout
in the message.
PR-URL: https://github.com/nodejs/node/pull/20147
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-04-25 23:46:08 +08:00
Joyee Cheung
3eeb346aa9
src: CancelTerminateExecution before throwing errors
...
Terminating the execution of a script would create a pending
exception, therefore we should cancel the termination
*before* throwing a new exception, otherwise the attempt to
create a custom error may fail.
PR-URL: https://github.com/nodejs/node/pull/20146
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-04-22 18:13:31 +08:00
Anna Henningsen
1f3fbd43b7
src: remove MarkIndependent() calls
...
The method has been deprecated in upstream V8, with messaging
indicating that it is the default for handles to be independent
now anyway.
PR-URL: https://github.com/nodejs/node/pull/20108
Refs: https://github.com/v8/v8/commit/71ad48fb8f214e80518ba0419796e4c571351255
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-04-22 11:23:29 +02:00
Michaël Zasso
77b52fd58f
module: move options checks from C++ to JS
...
PR-URL: https://github.com/nodejs/node/pull/19822
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-04-07 15:10:27 +02:00
Michaël Zasso
34d988f122
vm: move options checks from C++ to JS
...
Also introduces stronger type validations for options passed to vm
functions.
PR-URL: https://github.com/nodejs/node/pull/19398
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2018-04-03 17:59:22 +02:00
Daniel Bevenius
ebbf393600
src: name all builtin init functions Initialize
...
This commit renames a few of the builtin modules init functions to
Initialize for consistency.
PR-URL: https://github.com/nodejs/node/pull/19550
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-03-26 08:23:49 +02:00
Sarat Addepalli
c6c957d3cc
src: fix upcoming V8 deprecation warnings
...
PR-URL: https://github.com/nodejs/node/pull/19490
Fixes: https://github.com/nodejs/node/issues/18909
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2018-03-23 08:50:03 +01:00
dustinnewman98
49b2969ef4
vm: migrate isContext to internal/errors
...
PR-URL: https://github.com/nodejs/node/pull/19268
Refs: https://github.com/nodejs/node/issues/18106
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Jon Moss <me@jonathanmoss.me >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Yuta Hiroto <hello@hiroppy.me >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-03-22 15:54:52 +01:00
Gus Caplan
cb5f358ee7
vm: add code generation options
...
Adds options to a VM Context to disable code generation from strings
(such as eval or new Function) and WASM code generation
(WebAssembly.compile).
PR-URL: https://github.com/nodejs/node/pull/19016
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
2018-03-12 14:39:21 -05:00
Gus Caplan
c9b4de55c0
src: standardise context embedder indices
...
PR-URL: https://github.com/nodejs/node/pull/19135
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Matheus Marchini <matheus@sthima.com >
2018-03-07 12:19:38 -06:00
Mythri Alle
3b1e5d9cf7
src: request code cache explicitly
...
Earlier we used to produce code cache along with compile. Now V8 has
added an API to request code cache. Support for producing code cache
along with compile will be removed soon.
PR-URL: https://github.com/nodejs/node/pull/18453
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Yang Guo <yangguo@chromium.org >
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2018-03-07 16:48:52 +01:00
Ben Noordhuis
d4024815b7
src: remove unnecessary Reset() calls
...
The previous commit made persistent handles auto-reset on destruction.
This commit removes the Reset() calls that are now no longer necessary.
PR-URL: https://github.com/nodejs/node/pull/18656
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2018-02-21 15:24:18 +01:00
Ben Noordhuis
992703f2b5
src: prevent persistent handle resource leaks
...
Replace v8::Persistent with node::Persistent, a specialization that
resets the persistent handle on destruction. Prevents accidental
resource leaks when forgetting to call .Reset() manually.
I'm fairly confident this commit fixes a number of resource leaks that
have gone undiagnosed so far.
PR-URL: https://github.com/nodejs/node/pull/18656
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2018-02-21 15:24:18 +01:00
Timothy Gu
2033a9f436
src: factor out some common vm functions
...
PR-URL: https://github.com/nodejs/node/pull/17560
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
2018-01-30 17:00:57 -08:00
Gus Caplan
3bf34f27a1
src: flatten ContextifyContext
...
Flattens ContextifyContext allows the context interface to be used in
other parts of the code base.
PR-URL: https://github.com/nodejs/node/pull/17560
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
2018-01-30 17:00:57 -08:00
Timothy Gu
2cb2145162
vm: allow modifying context name in inspector
...
The `auxData` field is not exposed to JavaScript, as DevTools uses it
for its `isDefault` parameter, which is implemented faithfully,
contributing to the nice indentation in the context selection panel.
Without the indentation, when `Target` domain gets implemented (along
with a single Inspector for cluster) in #16627 , subprocesses and VM
contexts will be mixed up, causing confusion.
PR-URL: https://github.com/nodejs/node/pull/17720
Refs: https://github.com/nodejs/node/pull/14231#issuecomment-315924067
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Jon Moss <me@jonathanmoss.me >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-12-23 14:05:18 +08:00
Daniel Bevenius
51c6737d3c
src: remove unused variable in node_contextify
...
Currently the following warning is show when building:
../src/node_contextify.cc:642:10:
warning: unused variable 'display_errors' [-Wunused-variable]
bool display_errors = maybe_display_errors.ToChecked();
This commit removes the unused variable which became unused in commit
aeddc3676b ("src: remove tracking for
exception arrow data").
PR-URL: https://github.com/nodejs/node/pull/17491
Refs: https://github.com/nodejs/node/pull/17394
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-12-08 11:22:10 +01:00
Anna Henningsen
b73e66e949
vm: never abort on caught syntax error
...
Keep track of C++ `TryCatch` state to avoid aborting when
an exception is thrown inside one, and re-throw in JS
to make sure the exception is being picked up a second time by
a second uncaught exception handler, if necessary.
Add a bit of a hack to `AppendExceptionLine` to avoid overriding
the line responsible for re-throwing the exception.
PR-URL: https://github.com/nodejs/node/pull/17394
Fixes: https://github.com/nodejs/node/issues/13258
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-12-05 23:49:36 +01:00
Anna Henningsen
aeddc3676b
src: remove tracking for exception arrow data
...
This is unnecessary since we only run `AppendExceptionLine()`
once per exception at this point anyway.
PR-URL: https://github.com/nodejs/node/pull/17394
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-12-05 23:49:36 +01:00
Leko
19221d1d6f
src: use non-deprecated versions of ->To*() utils
...
Squashed from multiple commits:
- src: replace ->To*(isolate) with ->To*(context).ToLocalChecked()
- test: use .As<Object> on Exception::Error
> Exception::Error always returns an object, so e.As<Object>() should also work fine
See https://github.com/nodejs/node/pull/17343#discussion_r153232027
- test: use .As<Object> instead of ->ToObject
we already checked that its a buffer
- src: use FromMaybe instead of ToLocalChecked
It fixed this test case: 19a1b2e414
- src: pass context to Get()
Dont pass Local<Context> is deprecated soon.
So we migrate to maybe version.
- src: return if Get or ToObject return an empty before call ToLocalChecked
Refs: https://github.com/nodejs/node/issues/17244
PR-URL: https://github.com/nodejs/node/pull/17343
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
2017-12-01 20:37:58 +01:00
Ben Noordhuis
6f724e1563
lib,src: remove vm.runInDebugContext()
...
The V8 API it is based on is deprecated and scheduled for removal later
this year. Remove it.
PR-URL: https://github.com/nodejs/node/pull/13295
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
2017-11-24 00:13:44 +01:00
Daniel Bevenius
a515e593f3
src: rename base-object -> base_object
...
This commit renames base-object to base_object for consitency with other
c++ source files.
PR-URL: https://github.com/nodejs/node/pull/17022
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
2017-11-17 12:49:10 +01:00
Yihong Wang
8680bb9f1a
src: explicitly register built-in modules
...
Previously, built-in modules are registered before main() via
__attribute__((constructor)) mechanism in GCC and similiar
mechanism in MSVC. This causes some issues when node is built as
static library. Calling module registration function for built-in
modules in node::Init() helps to avoid the issues.
Signed-off-by: Yihong Wang <yh.wang@ibm.com >
PR-URL: https://github.com/nodejs/node/pull/16565
Refs: https://github.com/nodejs/node/pull/14986#issuecomment-332758206
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-11-13 23:17:34 +00:00
Franziska Hinkelmann
f0c674d95b
src: explain implementation of vm module
...
The vm module uses interceptors on the object template. This is not
straight forward and a comment in the source will help the next
person working on this.
PR-URL: https://github.com/nodejs/node/pull/16962
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-11-12 11:09:03 -08:00
Toon Verwaest
ba885c42ef
src: remove unnecessary call to SetHiddenPrototype
...
Currently the template for the global object is explicitly marked as
hidden. This is unnecessary since the global object is automatically
marked as hidden by V8. Getting rid of this call gets rid of the last
use of SetHiddenPrototype.
PR-URL: https://github.com/nodejs/node/pull/16554
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
2017-11-06 15:09:05 +01:00
Joyee Cheung
cdb263d3ba
src: do not include x.h if x-inl.h is included
...
PR-URL: https://github.com/nodejs/node/pull/16548
Fixes: https://github.com/nodejs/node/issues/16519
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-10-30 18:56:38 +08:00
Franziska Hinkelmann
5856c836ea
src: fix vm module for strict mode
...
This patch fixes the problem with variables that
are declared only on the sandbox but not on the
global proxy.
PR-URL: https://github.com/nodejs/node/pull/16487
Fixes: https://github.com/nodejs/node/issues/12300
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-10-27 10:12:02 +02:00
Michaël Zasso
f0b871bada
src: remove unused warning in node_contextify
...
PR-URL: https://github.com/nodejs/node/pull/16408
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
2017-10-26 10:24:38 +02:00
Franziska Hinkelmann
f1d6b04ac9
src: use new V8 API in vm module
...
Remove the CopyProperties() hack in the vm module, i.e., Contextify.
Use different V8 API methods, that allow interception of
DefineProperty() and do not flatten accessor descriptors to
property descriptors.
Move many known issues to test cases. Factor out the last test in
test-vm-context.js for
https://github.com/nodejs/node/issues/10223
into its own file, test-vm-strict-assign.js.
Part of this CL is taken from a stalled PR by
https://github.com/AnnaMag
https://github.com/nodejs/node/pull/13265
This PR requires a backport of
https://chromium.googlesource.com/v8/v8/+/37a3a15c3e52e2146e45f41c427f24414e4d7f6f
PR-URL: https://github.com/nodejs/node/pull/16293
Fixes: https://github.com/nodejs/node/issues/2734
Fixes: https://github.com/nodejs/node/issues/10223
Fixes: https://github.com/nodejs/node/issues/11803
Fixes: https://github.com/nodejs/node/issues/11902
Ref: https://github.com/nodejs/node/issues/6283
Ref: https://github.com/nodejs/node/pull/15114
Ref: https://github.com/nodejs/node/pull/13265
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2017-10-23 14:35:09 +02:00
Anna Henningsen
290315ace7
src: refactor #include handling
...
`node_internals.h` already includes the most common headers,
so double includes can be avoided in a lot of cases. Also don’t include
`node_internals.h` from `node.h` implicitly anymore, as that is mostly
unnecessary.
PR-URL: https://github.com/nodejs/node/pull/14697
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-09-14 17:38:38 +02:00
Ben Noordhuis
668ad44922
intl: unexpose Intl.v8BreakIterator
...
It was never an official Ecma-402 API, it is about to be superseded
by `Intl.Segmenter` and it's prone to crash under some circumstances.
Searches don't turn up any usage in the wild and the recommendation
from the V8 team is to remove it. Now seems like a good a time as
any to do that.
Fixes: https://github.com/nodejs/node/issues/8865
Fixes: https://github.com/nodejs/node/issues/14909
Refs: https://github.com/tc39/proposal-intl-segmenter
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/620755
PR-URL: https://github.com/nodejs/node/pull/15238
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-09-10 22:00:25 +02:00
Timothy Gu
d932e80231
vm: support parsing a script in a specific context
...
PR-URL: https://github.com/nodejs/node/pull/14888
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com >
2017-09-05 10:47:42 +08:00
Marcel Laverdet
e018c33111
vm: fix race condition with timeout param
...
This fixes a race condition in the watchdog timer used for vm timeouts.
The condition would terminate the main stack's execution instead of the
code running under the sandbox.
PR-URL: https://github.com/nodejs/node/pull/13074
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-05-23 21:00:40 +02:00
Marcel Laverdet
3c5bfba28b
vm: fix displayErrors in runIn.. functions
...
This option has been broken for almost a year when used with any of the
vm.runIn.. family of functions, except for syntax errors.
PR-URL: https://github.com/nodejs/node/pull/13074
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-05-23 20:59:24 +02:00
Gabriel Schulhof
276720921b
addons: remove semicolons from after module definition
...
Having semicolons there runs counter to our documentation and illicits
warnings in pedantic mode. This removes semicolons from after uses of
NODE_MODULE and NODE_MODULE_CONTEXT_AWARE_BUILTIN.
PR-URL: https://github.com/nodejs/node/pull/12919
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com >
2017-05-15 20:33:06 +02:00