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: d2ccc599c7
PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
21745b50d5
commit
3b7c95220b
@ -39,7 +39,7 @@
|
||||
|
||||
# Reset this number to 0 on major V8 upgrades.
|
||||
# Increment by one for each non-official patch applied to deps/v8.
|
||||
'v8_embedder_string': '-node.12',
|
||||
'v8_embedder_string': '-node.13',
|
||||
|
||||
##### V8 defaults for Node.js #####
|
||||
|
||||
|
8
deps/v8/src/snapshot/serializer.cc
vendored
8
deps/v8/src/snapshot/serializer.cc
vendored
@ -115,10 +115,12 @@ void Serializer::SerializeRootObject(Object object) {
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void Serializer::PrintStack() {
|
||||
void Serializer::PrintStack() { PrintStack(std::cout); }
|
||||
|
||||
void Serializer::PrintStack(std::ostream& out) {
|
||||
for (const auto o : stack_) {
|
||||
o.Print();
|
||||
PrintF("\n");
|
||||
o.Print(out);
|
||||
out << "\n";
|
||||
}
|
||||
}
|
||||
#endif // DEBUG
|
||||
|
1
deps/v8/src/snapshot/serializer.h
vendored
1
deps/v8/src/snapshot/serializer.h
vendored
@ -250,6 +250,7 @@ class Serializer : public SerializerDeserializer {
|
||||
void PushStack(HeapObject o) { stack_.push_back(o); }
|
||||
void PopStack() { stack_.pop_back(); }
|
||||
void PrintStack();
|
||||
void PrintStack(std::ostream&);
|
||||
#endif // DEBUG
|
||||
|
||||
SerializerReferenceMap* reference_map() { return &reference_map_; }
|
||||
|
11
deps/v8/src/snapshot/startup-serializer.cc
vendored
11
deps/v8/src/snapshot/startup-serializer.cc
vendored
@ -71,7 +71,16 @@ bool IsUnexpectedCodeObject(Isolate* isolate, HeapObject obj) {
|
||||
#endif // DEBUG
|
||||
|
||||
void StartupSerializer::SerializeObject(HeapObject obj) {
|
||||
DCHECK(!obj.IsJSFunction());
|
||||
#ifdef DEBUG
|
||||
if (obj.IsJSFunction()) {
|
||||
v8::base::OS::PrintError("Reference stack:\n");
|
||||
PrintStack(std::cerr);
|
||||
obj.Print(std::cerr);
|
||||
FATAL(
|
||||
"JSFunction should be added through the context snapshot instead of "
|
||||
"the isolate snapshot");
|
||||
}
|
||||
#endif // DEBUG
|
||||
DCHECK(!IsUnexpectedCodeObject(isolate(), obj));
|
||||
|
||||
if (SerializeHotObject(obj)) return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user