Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(510)

Unified Diff: src/messages.h

Issue 1510173002: Revert of Make Error.prototype.toString spec compliant; and fix various side-effect-free error printing metho… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/js/messages.js ('k') | src/messages.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/messages.h
diff --git a/src/messages.h b/src/messages.h
index b98d1a87d6c95d30692175ebadd423baab35a315..2f48c1020958ead7382190d8098e9586cbe1ce58 100644
--- a/src/messages.h
+++ b/src/messages.h
@@ -484,6 +484,44 @@
};
+class ErrorToStringHelper {
+ public:
+ ErrorToStringHelper() : visited_(0) {}
+
+ MUST_USE_RESULT MaybeHandle<String> Stringify(Isolate* isolate,
+ Handle<JSObject> error);
+
+ private:
+ class VisitedScope {
+ public:
+ VisitedScope(ErrorToStringHelper* helper, Handle<JSObject> error)
+ : helper_(helper), has_visited_(false) {
+ for (const Handle<JSObject>& visited : helper->visited_) {
+ if (visited.is_identical_to(error)) {
+ has_visited_ = true;
+ break;
+ }
+ }
+ helper->visited_.Add(error);
+ }
+ ~VisitedScope() { helper_->visited_.RemoveLast(); }
+ bool has_visited() { return has_visited_; }
+
+ private:
+ ErrorToStringHelper* helper_;
+ bool has_visited_;
+ };
+
+ static bool ShadowsInternalError(Isolate* isolate,
+ LookupIterator* property_lookup,
+ LookupIterator* internal_error_lookup);
+
+ static MUST_USE_RESULT MaybeHandle<String> GetStringifiedProperty(
+ Isolate* isolate, LookupIterator* property_lookup,
+ Handle<String> default_value);
+
+ List<Handle<JSObject> > visited_;
+};
} // namespace internal
} // namespace v8
« no previous file with comments | « src/js/messages.js ('k') | src/messages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698