Chromium Code Reviews| Index: src/isolate.cc |
| diff --git a/src/isolate.cc b/src/isolate.cc |
| index a49eee6e86a6a09de2541e39d555605694a06002..2595d2ff74a6892e0bf5686549e85fda0990df4e 100644 |
| --- a/src/isolate.cc |
| +++ b/src/isolate.cc |
| @@ -1047,15 +1047,15 @@ void Isolate::ComputeLocation(MessageLocation* target) { |
| } |
| -void Isolate::ComputeLocationFromStackTrace(MessageLocation* target, |
| +bool Isolate::ComputeLocationFromStackTrace(MessageLocation* target, |
| Handle<Object> exception) { |
| *target = MessageLocation(Handle<Script>(heap_.empty_script()), -1, -1); |
| - if (!exception->IsJSObject()) return; |
| + if (!exception->IsJSObject()) return false; |
| Handle<Name> key = factory()->stack_trace_symbol(); |
| Handle<Object> property = |
| JSObject::GetDataProperty(Handle<JSObject>::cast(exception), key); |
| - if (!property->IsJSArray()) return; |
| + if (!property->IsJSArray()) return false; |
| Handle<JSArray> simple_stack_trace = Handle<JSArray>::cast(property); |
| Handle<FixedArray> elements(FixedArray::cast(simple_stack_trace->elements())); |
| @@ -1075,9 +1075,10 @@ void Isolate::ComputeLocationFromStackTrace(MessageLocation* target, |
| int pos = code->SourcePosition(pc); |
| Handle<Script> casted_script(Script::cast(script)); |
| *target = MessageLocation(casted_script, pos, pos + 1); |
| - break; |
| + return true; |
| } |
| } |
| + return false; |
| } |
| @@ -1149,10 +1150,6 @@ Handle<JSMessageObject> Isolate::CreateMessage(Handle<Object> exception, |
| // at this throw site. |
| stack_trace_object = |
| GetDetailedStackTrace(Handle<JSObject>::cast(exception)); |
| - if (!location) { |
| - ComputeLocationFromStackTrace(&potential_computed_location, exception); |
| - location = &potential_computed_location; |
| - } |
| } |
| if (stack_trace_object.is_null()) { |
| // Not an error object, we capture stack and location at throw site. |
| @@ -1162,7 +1159,10 @@ Handle<JSMessageObject> Isolate::CreateMessage(Handle<Object> exception, |
| } |
| } |
| if (!location) { |
| - ComputeLocation(&potential_computed_location); |
| + if (!ComputeLocationFromStackTrace(&potential_computed_location, |
|
aandrey
2014/10/31 15:13:54
this was under the (capture_stack_trace_for_uncaug
|
| + exception)) { |
| + ComputeLocation(&potential_computed_location); |
| + } |
| location = &potential_computed_location; |
| } |