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 492b7cb

Browse filesBrowse files
committed
deps: V8: cherry-pick d2ccc59
Original commit message: [snapshot] print reference stack for JSFunctions in the isolate snapshot This helps debugging incorrect usage of the SnapshotCreator API in debug mode. Change-Id: Ibd9db76a5f460cdf7ea6d14e865592ebaf69aeef Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1648240 Reviewed-by: Yang Guo <yangguo@chromium.org> Commit-Queue: Yang Guo <yangguo@chromium.org> Cr-Commit-Position: refs/heads/master@{#62095} Refs: v8/v8@d2ccc59 Backport-PR-URL: #28955 PR-URL: #28016 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann (רפאל פלחי) <refack@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
1 parent 945955f commit 492b7cb
Copy full SHA for 492b7cb

File tree

Expand file treeCollapse file tree

4 files changed

+17
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+17
-5
lines changed
Open diff view settings
Collapse file

‎common.gypi‎

Copy file name to clipboardExpand all lines: common.gypi
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
# Reset this number to 0 on major V8 upgrades.
4040
# Increment by one for each non-official patch applied to deps/v8.
41-
'v8_embedder_string': '-node.12',
41+
'v8_embedder_string': '-node.13',
4242

4343
##### V8 defaults for Node.js #####
4444

Collapse file

‎deps/v8/src/snapshot/serializer.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/snapshot/serializer.cc
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,12 @@ void Serializer::SerializeRootObject(Object object) {
115115
}
116116

117117
#ifdef DEBUG
118-
void Serializer::PrintStack() {
118+
void Serializer::PrintStack() { PrintStack(std::cout); }
119+
120+
void Serializer::PrintStack(std::ostream& out) {
119121
for (const auto o : stack_) {
120-
o.Print();
121-
PrintF("\n");
122+
o.Print(out);
123+
out << "\n";
122124
}
123125
}
124126
#endif // DEBUG
Collapse file

‎deps/v8/src/snapshot/serializer.h‎

Copy file name to clipboardExpand all lines: deps/v8/src/snapshot/serializer.h
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ class Serializer : public SerializerDeserializer {
250250
void PushStack(HeapObject o) { stack_.push_back(o); }
251251
void PopStack() { stack_.pop_back(); }
252252
void PrintStack();
253+
void PrintStack(std::ostream&);
253254
#endif // DEBUG
254255

255256
SerializerReferenceMap* reference_map() { return &reference_map_; }
Collapse file

‎deps/v8/src/snapshot/startup-serializer.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/snapshot/startup-serializer.cc
+10-1Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,16 @@ bool IsUnexpectedCodeObject(Isolate* isolate, HeapObject obj) {
7171
#endif // DEBUG
7272

7373
void StartupSerializer::SerializeObject(HeapObject obj) {
74-
DCHECK(!obj.IsJSFunction());
74+
#ifdef DEBUG
75+
if (obj.IsJSFunction()) {
76+
v8::base::OS::PrintError("Reference stack:\n");
77+
PrintStack(std::cerr);
78+
obj.Print(std::cerr);
79+
FATAL(
80+
"JSFunction should be added through the context snapshot instead of "
81+
"the isolate snapshot");
82+
}
83+
#endif // DEBUG
7584
DCHECK(!IsUnexpectedCodeObject(isolate(), obj));
7685

7786
if (SerializeHotObject(obj)) return;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.