summaryrefslogtreecommitdiff
path: root/deps/v8
diff options
context:
space:
mode:
authorMatt Loring <mattloring@google.com>2017-05-23 12:17:17 -0700
committerAnna Henningsen <anna@addaleax.net>2017-05-26 10:32:54 +0200
commite6395cc07ae54f81699e369d292da29ecf113a16 (patch)
tree12ea34ec05e780bb873b100802819693a14fb838 /deps/v8
parent01a1022857ac29d2dae3eba288fb14ff4815f4d8 (diff)
downloadandroid-node-v8-e6395cc07ae54f81699e369d292da29ecf113a16.tar.gz
android-node-v8-e6395cc07ae54f81699e369d292da29ecf113a16.tar.bz2
android-node-v8-e6395cc07ae54f81699e369d292da29ecf113a16.zip
deps: cherry-pick 6803eef from V8 upstream
Original commit message: Allow embedder to set promise internal field count Asynchronous context tracking mechanisms in Node.js need to store some state on all promise objects. This change will allow embedders to configure the number of internal fields on promises as is already done for ArrayBuffers. BUG=v8:6435 Review-Url: https://codereview.chromium.org/2889863002 Cr-Commit-Position: refs/heads/master@{#45496} PR-URL: https://github.com/nodejs/node/pull/13175 Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'deps/v8')
-rw-r--r--deps/v8/BUILD.gn7
-rw-r--r--deps/v8/gypfiles/features.gypi5
-rw-r--r--deps/v8/include/v8-version.h2
-rw-r--r--deps/v8/include/v8.h6
-rw-r--r--deps/v8/src/bootstrapper.cc6
-rw-r--r--deps/v8/src/builtins/builtins-promise.cc8
-rw-r--r--deps/v8/src/objects.h2
7 files changed, 32 insertions, 4 deletions
diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn
index 8895103222..2a77a0ded0 100644
--- a/deps/v8/BUILD.gn
+++ b/deps/v8/BUILD.gn
@@ -38,6 +38,9 @@ declare_args() {
# Sets -dENABLE_DISASSEMBLER.
v8_enable_disassembler = ""
+ # Sets the number of internal fields on promise objects.
+ v8_promise_internal_field_count = 0
+
# Sets -dENABLE_GDB_JIT_INTERFACE.
v8_enable_gdbjit = ""
@@ -197,6 +200,10 @@ config("features") {
if (v8_enable_disassembler) {
defines += [ "ENABLE_DISASSEMBLER" ]
}
+ if (v8_promise_internal_field_count != 0) {
+ defines +=
+ [ "V8_PROMISE_INTERNAL_FIELD_COUNT=${v8_promise_internal_field_count}" ]
+ }
if (v8_enable_gdbjit) {
defines += [ "ENABLE_GDB_JIT_INTERFACE" ]
}
diff --git a/deps/v8/gypfiles/features.gypi b/deps/v8/gypfiles/features.gypi
index 0c4873c3a5..bd5cd7cd10 100644
--- a/deps/v8/gypfiles/features.gypi
+++ b/deps/v8/gypfiles/features.gypi
@@ -31,6 +31,8 @@
'variables': {
'v8_enable_disassembler%': 0,
+ 'v8_promise_internal_field_count%': 0,
+
'v8_enable_gdbjit%': 0,
'v8_enable_verify_csa%': 0,
@@ -77,6 +79,9 @@
['v8_enable_disassembler==1', {
'defines': ['ENABLE_DISASSEMBLER',],
}],
+ ['v8_promise_internal_field_count!=0', {
+ 'defines': ['V8_PROMISE_INTERNAL_FIELD_COUNT','v8_promise_internal_field_count'],
+ }],
['v8_enable_gdbjit==1', {
'defines': ['ENABLE_GDB_JIT_INTERFACE',],
}],
diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h
index f0866a2d9b..70e1a84d09 100644
--- a/deps/v8/include/v8-version.h
+++ b/deps/v8/include/v8-version.h
@@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 5
#define V8_MINOR_VERSION 8
#define V8_BUILD_NUMBER 283
-#define V8_PATCH_LEVEL 40
+#define V8_PATCH_LEVEL 41
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h
index e38f657b48..9ae8e1b948 100644
--- a/deps/v8/include/v8.h
+++ b/deps/v8/include/v8.h
@@ -3741,6 +3741,10 @@ class V8_EXPORT Function : public Object {
static void CheckCast(Value* obj);
};
+#ifndef V8_PROMISE_INTERNAL_FIELD_COUNT
+// The number of required internal fields can be defined by embedder.
+#define V8_PROMISE_INTERNAL_FIELD_COUNT 0
+#endif
/**
* An instance of the built-in Promise constructor (ES6 draft).
@@ -3822,6 +3826,8 @@ class V8_EXPORT Promise : public Object {
V8_INLINE static Promise* Cast(Value* obj);
+ static const int kEmbedderFieldCount = V8_PROMISE_INTERNAL_FIELD_COUNT;
+
private:
Promise();
static void CheckCast(Value* obj);
diff --git a/deps/v8/src/bootstrapper.cc b/deps/v8/src/bootstrapper.cc
index 8f9f92a08c..60e989ae17 100644
--- a/deps/v8/src/bootstrapper.cc
+++ b/deps/v8/src/bootstrapper.cc
@@ -1945,9 +1945,9 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Handle<JSObject> prototype =
factory->NewJSObject(isolate->object_function(), TENURED);
- Handle<JSFunction> promise_fun =
- InstallFunction(global, "Promise", JS_PROMISE_TYPE, JSPromise::kSize,
- prototype, Builtins::kPromiseConstructor);
+ Handle<JSFunction> promise_fun = InstallFunction(
+ global, "Promise", JS_PROMISE_TYPE, JSPromise::kSizeWithEmbedderFields,
+ prototype, Builtins::kPromiseConstructor);
InstallWithIntrinsicDefaultProto(isolate, promise_fun,
Context::PROMISE_FUNCTION_INDEX);
diff --git a/deps/v8/src/builtins/builtins-promise.cc b/deps/v8/src/builtins/builtins-promise.cc
index 0d0238d267..6d9fed83a9 100644
--- a/deps/v8/src/builtins/builtins-promise.cc
+++ b/deps/v8/src/builtins/builtins-promise.cc
@@ -31,6 +31,10 @@ void PromiseBuiltinsAssembler::PromiseInit(Node* promise) {
StoreObjectField(promise, JSPromise::kStatusOffset,
SmiConstant(v8::Promise::kPending));
StoreObjectField(promise, JSPromise::kFlagsOffset, SmiConstant(0));
+ for (int i = 0; i < v8::Promise::kEmbedderFieldCount; i++) {
+ int offset = JSPromise::kSize + i * kPointerSize;
+ StoreObjectFieldNoWriteBarrier(promise, offset, SmiConstant(Smi::kZero));
+ }
}
Node* PromiseBuiltinsAssembler::AllocateAndInitJSPromise(Node* context) {
@@ -62,6 +66,10 @@ Node* PromiseBuiltinsAssembler::AllocateAndSetJSPromise(Node* context,
StoreObjectFieldNoWriteBarrier(instance, JSPromise::kResultOffset, result);
StoreObjectFieldNoWriteBarrier(instance, JSPromise::kFlagsOffset,
SmiConstant(0));
+ for (int i = 0; i < v8::Promise::kEmbedderFieldCount; i++) {
+ int offset = JSPromise::kSize + i * kPointerSize;
+ StoreObjectFieldNoWriteBarrier(instance, offset, SmiConstant(Smi::kZero));
+ }
Label out(this);
GotoIfNot(IsPromiseHookEnabledOrDebugIsActive(), &out);
diff --git a/deps/v8/src/objects.h b/deps/v8/src/objects.h
index ca4c351317..3b4ff9bb75 100644
--- a/deps/v8/src/objects.h
+++ b/deps/v8/src/objects.h
@@ -8443,6 +8443,8 @@ class JSPromise : public JSObject {
kFulfillReactionsOffset + kPointerSize;
static const int kFlagsOffset = kRejectReactionsOffset + kPointerSize;
static const int kSize = kFlagsOffset + kPointerSize;
+ static const int kSizeWithEmbedderFields =
+ kSize + v8::Promise::kEmbedderFieldCount * kPointerSize;
// Flags layout.
static const int kHasHandlerBit = 0;