Commit 37729a52 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

Simplify and correctify pending message location handling.

This makes sure that the pending message location is only tracked by
the message object, as only this is saved for finally-blocks. The
location information is duplicated and becomes stale.

R=titzer@chromium.org
TEST=maeh, not so much.

Review URL: https://codereview.chromium.org/987353002

Cr-Commit-Position: refs/heads/master@{#27109}
parent a3e06f54
......@@ -6089,8 +6089,6 @@ class V8_EXPORT TryCatch {
void* message_obj_;
void* message_script_;
void* js_stack_comparable_address_;
int message_start_pos_;
int message_end_pos_;
bool is_verbose_ : 1;
bool can_continue_ : 1;
bool capture_message_ : 1;
......
......@@ -2144,8 +2144,6 @@ void v8::TryCatch::ResetInternal() {
exception_ = the_hole;
message_obj_ = the_hole;
message_script_ = the_hole;
message_start_pos_ = 0;
message_end_pos_ = 0;
}
......
......@@ -990,8 +990,6 @@ Object* Isolate::Throw(Object* exception, MessageLocation* location) {
thread_local_top()->pending_message_obj_ = *message_obj;
thread_local_top()->pending_message_script_ = *location->script();
thread_local_top()->pending_message_start_pos_ = location->start_pos();
thread_local_top()->pending_message_end_pos_ = location->end_pos();
// If the abort-on-uncaught-exception flag is specified, abort on any
// exception not caught by JavaScript, even when an external handler is
......@@ -1168,8 +1166,6 @@ void Isolate::RestorePendingMessageFromTryCatch(v8::TryCatch* handler) {
DCHECK(script->IsScript() || script->IsTheHole());
thread_local_top()->pending_message_obj_ = message;
thread_local_top()->pending_message_script_ = script;
thread_local_top()->pending_message_start_pos_ = handler->message_start_pos_;
thread_local_top()->pending_message_end_pos_ = handler->message_end_pos_;
}
......@@ -1448,13 +1444,13 @@ void Isolate::ReportPendingMessages() {
thread_local_top_.has_pending_message_ = false;
if (!thread_local_top_.pending_message_obj_->IsTheHole()) {
HandleScope scope(this);
Handle<Object> message_obj(thread_local_top_.pending_message_obj_,
this);
Handle<JSMessageObject> message_obj(
JSMessageObject::cast(thread_local_top_.pending_message_obj_));
if (!thread_local_top_.pending_message_script_->IsTheHole()) {
Handle<Script> script(
Script::cast(thread_local_top_.pending_message_script_));
int start_pos = thread_local_top_.pending_message_start_pos_;
int end_pos = thread_local_top_.pending_message_end_pos_;
int start_pos = message_obj->start_position();
int end_pos = message_obj->end_position();
MessageLocation location(script, start_pos, end_pos);
MessageHandler::ReportMessage(this, &location, message_obj);
} else {
......@@ -1473,10 +1469,12 @@ MessageLocation Isolate::GetMessageLocation() {
if (thread_local_top_.pending_exception_ != heap()->termination_exception() &&
thread_local_top_.has_pending_message_ &&
!thread_local_top_.pending_message_obj_->IsTheHole()) {
Handle<JSMessageObject> message_obj(
JSMessageObject::cast(thread_local_top_.pending_message_obj_));
Handle<Script> script(
Script::cast(thread_local_top_.pending_message_script_));
int start_pos = thread_local_top_.pending_message_start_pos_;
int end_pos = thread_local_top_.pending_message_end_pos_;
int start_pos = message_obj->start_position();
int end_pos = message_obj->end_position();
return MessageLocation(script, start_pos, end_pos);
}
......@@ -2000,8 +1998,6 @@ bool Isolate::PropagatePendingExceptionToExternalTryCatch() {
handler->message_obj_ = thread_local_top_.pending_message_obj_;
handler->message_script_ = thread_local_top_.pending_message_script_;
handler->message_start_pos_ = thread_local_top_.pending_message_start_pos_;
handler->message_end_pos_ = thread_local_top_.pending_message_end_pos_;
}
return true;
}
......
......@@ -286,8 +286,6 @@ class ThreadLocalTop BASE_EMBEDDED {
bool rethrowing_message_;
Object* pending_message_obj_;
Object* pending_message_script_;
int pending_message_start_pos_;
int pending_message_end_pos_;
// Use a separate value for scheduled exceptions to preserve the
// invariants that hold about pending_exception. We may want to
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment