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

Unified Diff: src/isolate.cc

Issue 1496333002: Support intriscDefaultProto for Error functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: mark test262 test as fixed 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/bootstrapper.cc ('k') | src/js/messages.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index d5cda54a1859fac6cccb6b7e8bad31c340fb03d5..a3456c4600212a99cd1ec0eb3b9320f3e303b2ae 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -1348,21 +1348,14 @@ bool Isolate::ComputeLocationFromStackTrace(MessageLocation* target,
}
-// Traverse prototype chain to find out whether the object is derived from
-// the Error object.
-bool Isolate::IsErrorObject(Handle<Object> obj) {
- if (!obj->IsJSObject()) return false;
- Handle<Object> error_constructor = error_function();
- DisallowHeapAllocation no_gc;
- for (PrototypeIterator iter(this, *obj, PrototypeIterator::START_AT_RECEIVER);
- !iter.IsAtEnd(); iter.Advance()) {
- if (iter.GetCurrent()->IsJSProxy()) return false;
- if (iter.GetCurrent<JSObject>()->map()->GetConstructor() ==
- *error_constructor) {
- return true;
- }
- }
- return false;
+// Use stack_trace_symbol as proxy for [[ErrorData]].
+bool Isolate::IsErrorObject(Handle<Object> object) {
+ Handle<Name> symbol = factory()->stack_trace_symbol();
+ if (!object->IsJSObject()) return false;
+ Maybe<bool> has_stack_trace =
+ JSReceiver::HasOwnProperty(Handle<JSReceiver>::cast(object), symbol);
+ DCHECK(!has_stack_trace.IsNothing());
+ return has_stack_trace.FromJust();
}
« no previous file with comments | « src/bootstrapper.cc ('k') | src/js/messages.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698