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

Unified Diff: src/isolate.cc

Issue 696703002: Follow up to fix v8::Exception::GetMessage() actually do what it was intended to. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 months 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/isolate.h ('k') | test/cctest/test-api.cc » ('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 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;
}
« no previous file with comments | « src/isolate.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698