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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/js/messages.js ('k') | src/messages.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // The infrastructure used for (localized) message reporting in V8. 5 // The infrastructure used for (localized) message reporting in V8.
6 // 6 //
7 // Note: there's a big unresolved issue about ownership of the data 7 // Note: there's a big unresolved issue about ownership of the data
8 // structures used by this framework. 8 // structures used by this framework.
9 9
10 #ifndef V8_MESSAGES_H_ 10 #ifndef V8_MESSAGES_H_
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 Handle<JSMessageObject> message); 477 Handle<JSMessageObject> message);
478 478
479 static void DefaultMessageReport(Isolate* isolate, const MessageLocation* loc, 479 static void DefaultMessageReport(Isolate* isolate, const MessageLocation* loc,
480 Handle<Object> message_obj); 480 Handle<Object> message_obj);
481 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data); 481 static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data);
482 static base::SmartArrayPointer<char> GetLocalizedMessage(Isolate* isolate, 482 static base::SmartArrayPointer<char> GetLocalizedMessage(Isolate* isolate,
483 Handle<Object> data); 483 Handle<Object> data);
484 }; 484 };
485 485
486 486
487 class ErrorToStringHelper {
488 public:
489 ErrorToStringHelper() : visited_(0) {}
490
491 MUST_USE_RESULT MaybeHandle<String> Stringify(Isolate* isolate,
492 Handle<JSObject> error);
493
494 private:
495 class VisitedScope {
496 public:
497 VisitedScope(ErrorToStringHelper* helper, Handle<JSObject> error)
498 : helper_(helper), has_visited_(false) {
499 for (const Handle<JSObject>& visited : helper->visited_) {
500 if (visited.is_identical_to(error)) {
501 has_visited_ = true;
502 break;
503 }
504 }
505 helper->visited_.Add(error);
506 }
507 ~VisitedScope() { helper_->visited_.RemoveLast(); }
508 bool has_visited() { return has_visited_; }
509
510 private:
511 ErrorToStringHelper* helper_;
512 bool has_visited_;
513 };
514
515 static bool ShadowsInternalError(Isolate* isolate,
516 LookupIterator* property_lookup,
517 LookupIterator* internal_error_lookup);
518
519 static MUST_USE_RESULT MaybeHandle<String> GetStringifiedProperty(
520 Isolate* isolate, LookupIterator* property_lookup,
521 Handle<String> default_value);
522
523 List<Handle<JSObject> > visited_;
524 };
487 } // namespace internal 525 } // namespace internal
488 } // namespace v8 526 } // namespace v8
489 527
490 #endif // V8_MESSAGES_H_ 528 #endif // V8_MESSAGES_H_
OLDNEW
« 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