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(); |
} |