summaryrefslogtreecommitdiff
path: root/src/env.h
diff options
context:
space:
mode:
authorTimothy Gu <timothygu99@gmail.com>2018-06-22 01:25:12 -0400
committerTimothy Gu <timothygu99@gmail.com>2018-06-25 23:15:35 -0400
commit65f617314d1ea2df8b9e16fb7e7078b5913c749c (patch)
tree719a8cf6099c336eddf75af226ca1bfbd0b73965 /src/env.h
parentcd8adfaf98613fb0ae4ba71018a236906f67f286 (diff)
downloadandroid-node-v8-65f617314d1ea2df8b9e16fb7e7078b5913c749c.tar.gz
android-node-v8-65f617314d1ea2df8b9e16fb7e7078b5913c749c.tar.bz2
android-node-v8-65f617314d1ea2df8b9e16fb7e7078b5913c749c.zip
src: start annotating native code side effect
PR-URL: https://github.com/nodejs/node/pull/21458 Refs: https://github.com/nodejs/node/issues/20977 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/env.h')
-rw-r--r--src/env.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/env.h b/src/env.h
index 3d047166b2..5a2c9e968f 100644
--- a/src/env.h
+++ b/src/env.h
@@ -752,12 +752,15 @@ class Environment {
v8::Local<v8::Signature> signature =
v8::Local<v8::Signature>(),
v8::ConstructorBehavior behavior =
- v8::ConstructorBehavior::kAllow);
+ v8::ConstructorBehavior::kAllow,
+ v8::SideEffectType side_effect =
+ v8::SideEffectType::kHasSideEffect);
// Convenience methods for NewFunctionTemplate().
inline void SetMethod(v8::Local<v8::Object> that,
const char* name,
v8::FunctionCallback callback);
+
inline void SetProtoMethod(v8::Local<v8::FunctionTemplate> that,
const char* name,
v8::FunctionCallback callback);
@@ -765,6 +768,18 @@ class Environment {
const char* name,
v8::FunctionCallback callback);
+ // Safe variants denote the function has no side effects.
+ inline void SetMethodNoSideEffect(v8::Local<v8::Object> that,
+ const char* name,
+ v8::FunctionCallback callback);
+ inline void SetProtoMethodNoSideEffect(v8::Local<v8::FunctionTemplate> that,
+ const char* name,
+ v8::FunctionCallback callback);
+ inline void SetTemplateMethodNoSideEffect(
+ v8::Local<v8::FunctionTemplate> that,
+ const char* name,
+ v8::FunctionCallback callback);
+
void BeforeExit(void (*cb)(void* arg), void* arg);
void RunBeforeExitCallbacks();
void AtExit(void (*cb)(void* arg), void* arg);