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

Unified Diff: src/isolate.cc

Issue 995013005: Simplify pending message script handling. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix hardcoded constant. Created 5 years, 9 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') | src/serialize.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 23782cd1cfc1405557277a05976de7cf501d1a43..726209cfb4548356c8881e6042a6d0ddab11112b 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -91,7 +91,6 @@ void ThreadLocalTop::InitializeInternal() {
has_pending_message_ = false;
rethrowing_message_ = false;
pending_message_obj_ = NULL;
- pending_message_script_ = NULL;
scheduled_exception_ = NULL;
}
@@ -190,7 +189,6 @@ void Isolate::Iterate(ObjectVisitor* v, ThreadLocalTop* thread) {
// Visit the roots from the top for a given thread.
v->VisitPointer(&thread->pending_exception_);
v->VisitPointer(&(thread->pending_message_obj_));
- v->VisitPointer(bit_cast<Object**>(&(thread->pending_message_script_)));
v->VisitPointer(bit_cast<Object**>(&(thread->context_)));
v->VisitPointer(&thread->scheduled_exception_);
@@ -199,7 +197,6 @@ void Isolate::Iterate(ObjectVisitor* v, ThreadLocalTop* thread) {
block = block->next_) {
v->VisitPointer(bit_cast<Object**>(&(block->exception_)));
v->VisitPointer(bit_cast<Object**>(&(block->message_obj_)));
- v->VisitPointer(bit_cast<Object**>(&(block->message_script_)));
}
// Iterate over pointers on native execution stack.
@@ -989,7 +986,6 @@ Object* Isolate::Throw(Object* exception, MessageLocation* location) {
Handle<Object> message_obj = CreateMessage(exception_handle, location);
thread_local_top()->pending_message_obj_ = *message_obj;
- thread_local_top()->pending_message_script_ = *location->script();
// If the abort-on-uncaught-exception flag is specified, abort on any
// exception not caught by JavaScript, even when an external handler is
@@ -1161,11 +1157,8 @@ void Isolate::RestorePendingMessageFromTryCatch(v8::TryCatch* handler) {
DCHECK(handler->rethrow_);
DCHECK(handler->capture_message_);
Object* message = reinterpret_cast<Object*>(handler->message_obj_);
- Object* script = reinterpret_cast<Object*>(handler->message_script_);
DCHECK(message->IsJSMessageObject() || message->IsTheHole());
- DCHECK(script->IsScript() || script->IsTheHole());
thread_local_top()->pending_message_obj_ = message;
- thread_local_top()->pending_message_script_ = script;
}
@@ -1446,16 +1439,12 @@ void Isolate::ReportPendingMessages() {
HandleScope scope(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 = 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 {
- MessageHandler::ReportMessage(this, NULL, message_obj);
- }
+ Handle<JSValue> script_wrapper(JSValue::cast(message_obj->script()));
+ Handle<Script> script(Script::cast(script_wrapper->value()));
+ 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);
}
}
}
@@ -1471,8 +1460,8 @@ MessageLocation Isolate::GetMessageLocation() {
!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_));
+ Handle<JSValue> script_wrapper(JSValue::cast(message_obj->script()));
+ Handle<Script> script(Script::cast(script_wrapper->value()));
int start_pos = message_obj->start_position();
int end_pos = message_obj->end_position();
return MessageLocation(script, start_pos, end_pos);
@@ -1988,8 +1977,6 @@ bool Isolate::PropagatePendingExceptionToExternalTryCatch() {
v8::TryCatch* handler = try_catch_handler();
DCHECK(thread_local_top_.pending_message_obj_->IsJSMessageObject() ||
thread_local_top_.pending_message_obj_->IsTheHole());
- DCHECK(thread_local_top_.pending_message_script_->IsScript() ||
- thread_local_top_.pending_message_script_->IsTheHole());
handler->can_continue_ = true;
handler->has_terminated_ = false;
handler->exception_ = pending_exception();
@@ -1997,7 +1984,6 @@ bool Isolate::PropagatePendingExceptionToExternalTryCatch() {
if (thread_local_top_.pending_message_obj_->IsTheHole()) return true;
handler->message_obj_ = thread_local_top_.pending_message_obj_;
- handler->message_script_ = thread_local_top_.pending_message_script_;
}
return true;
}
« no previous file with comments | « src/isolate.h ('k') | src/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698