Revision: 20571
Author:   [email protected]
Date:     Tue Apr  8 09:44:24 2014 UTC
Log:      Change exception type to Object.

[email protected]

Review URL: https://codereview.chromium.org/227163008
http://code.google.com/p/v8/source/detail?r=20571

Modified:
 /branches/bleeding_edge/src/isolate.cc
 /branches/bleeding_edge/src/isolate.h
 /branches/bleeding_edge/src/liveedit.cc
 /branches/bleeding_edge/src/messages.cc
 /branches/bleeding_edge/src/runtime.cc
 /branches/bleeding_edge/test/cctest/test-compiler.cc
 /branches/bleeding_edge/test/cctest/test-parsing.cc

=======================================
--- /branches/bleeding_edge/src/isolate.cc      Fri Apr  4 12:06:11 2014 UTC
+++ /branches/bleeding_edge/src/isolate.cc      Tue Apr  8 09:44:24 2014 UTC
@@ -264,21 +264,11 @@

 void Isolate::Iterate(ObjectVisitor* v, ThreadLocalTop* thread) {
   // Visit the roots from the top for a given thread.
-  Object* pending;
-  // The pending exception can sometimes be a failure.  We can't show
-  // that to the GC, which only understands objects.
-  if (thread->pending_exception_->ToObject(&pending)) {
-    v->VisitPointer(&pending);
-    thread->pending_exception_ = pending;  // In case GC updated it.
-  }
+  v->VisitPointer(&thread->pending_exception_);
   v->VisitPointer(&(thread->pending_message_obj_));
   v->VisitPointer(BitCast<Object**>(&(thread->pending_message_script_)));
   v->VisitPointer(BitCast<Object**>(&(thread->context_)));
-  Object* scheduled;
-  if (thread->scheduled_exception_->ToObject(&scheduled)) {
-    v->VisitPointer(&scheduled);
-    thread->scheduled_exception_ = scheduled;
-  }
+  v->VisitPointer(&thread->scheduled_exception_);

   for (v8::TryCatch* block = thread->TryCatchHandler();
        block != NULL;
@@ -912,7 +902,7 @@
 }


-Failure* Isolate::ReThrow(MaybeObject* exception) {
+Failure* Isolate::ReThrow(Object* exception) {
   bool can_be_caught_externally = false;
   bool catchable_by_javascript = is_catchable_by_javascript(exception);
ShouldReportException(&can_be_caught_externally, catchable_by_javascript);
@@ -969,7 +959,7 @@


 Failure* Isolate::PromoteScheduledException() {
-  MaybeObject* thrown = scheduled_exception();
+  Object* thrown = scheduled_exception();
   clear_scheduled_exception();
   // Re-throw the exception to avoid getting repeated error reporting.
   return ReThrow(thrown);
@@ -1813,9 +1803,6 @@
     try_catch_handler()->exception_ = heap()->null_value();
   } else {
     v8::TryCatch* handler = try_catch_handler();
-    // At this point all non-object (failure) exceptions have
-    // been dealt with so this shouldn't fail.
-    ASSERT(!pending_exception()->IsFailure());
     ASSERT(thread_local_top_.pending_message_obj_->IsJSMessageObject() ||
            thread_local_top_.pending_message_obj_->IsTheHole());
     ASSERT(thread_local_top_.pending_message_script_->IsScript() ||
=======================================
--- /branches/bleeding_edge/src/isolate.h       Fri Apr  4 12:06:11 2014 UTC
+++ /branches/bleeding_edge/src/isolate.h       Tue Apr  8 09:44:24 2014 UTC
@@ -292,7 +292,7 @@
   // lookups.
   Context* context_;
   ThreadId thread_id_;
-  MaybeObject* pending_exception_;
+  Object* pending_exception_;
   bool has_pending_message_;
   bool rethrowing_message_;
   Object* pending_message_obj_;
@@ -302,7 +302,7 @@
   // Use a separate value for scheduled exceptions to preserve the
   // invariants that hold about pending_exception.  We may want to
   // unify them later.
-  MaybeObject* scheduled_exception_;
+  Object* scheduled_exception_;
   bool external_caught_exception_;
   SaveContext* save_context_;
   v8::TryCatch* catcher_;
@@ -608,24 +608,28 @@
   THREAD_LOCAL_TOP_ACCESSOR(ThreadId, thread_id)

   // Interface to pending exception.
-  MaybeObject* pending_exception() {
+  Object* pending_exception() {
     ASSERT(has_pending_exception());
+    ASSERT(!thread_local_top_.pending_exception_->IsFailure());
     return thread_local_top_.pending_exception_;
   }

-  void set_pending_exception(MaybeObject* exception) {
+  void set_pending_exception(Object* exception) {
+    ASSERT(!exception->IsFailure());
     thread_local_top_.pending_exception_ = exception;
   }

   void clear_pending_exception() {
+    ASSERT(!thread_local_top_.pending_exception_->IsFailure());
     thread_local_top_.pending_exception_ = heap_.the_hole_value();
   }

-  MaybeObject** pending_exception_address() {
+  Object** pending_exception_address() {
     return &thread_local_top_.pending_exception_;
   }

   bool has_pending_exception() {
+    ASSERT(!thread_local_top_.pending_exception_->IsFailure());
     return !thread_local_top_.pending_exception_->IsTheHole();
   }

@@ -648,7 +652,7 @@

   THREAD_LOCAL_TOP_ACCESSOR(v8::TryCatch*, catcher)

-  MaybeObject** scheduled_exception_address() {
+  Object** scheduled_exception_address() {
     return &thread_local_top_.scheduled_exception_;
   }

@@ -665,20 +669,23 @@
         &thread_local_top_.pending_message_script_);
   }

-  MaybeObject* scheduled_exception() {
+  Object* scheduled_exception() {
     ASSERT(has_scheduled_exception());
+    ASSERT(!thread_local_top_.scheduled_exception_->IsFailure());
     return thread_local_top_.scheduled_exception_;
   }
   bool has_scheduled_exception() {
+    ASSERT(!thread_local_top_.scheduled_exception_->IsFailure());
return thread_local_top_.scheduled_exception_ != heap_.the_hole_value();
   }
   void clear_scheduled_exception() {
+    ASSERT(!thread_local_top_.scheduled_exception_->IsFailure());
     thread_local_top_.scheduled_exception_ = heap_.the_hole_value();
   }

   bool IsExternallyCaught();

-  bool is_catchable_by_javascript(MaybeObject* exception) {
+  bool is_catchable_by_javascript(Object* exception) {
     return exception != heap()->termination_exception();
   }

@@ -737,8 +744,7 @@
       // Scope currently can only be used for regular exceptions, not
       // failures like OOM or termination exception.
       isolate_(isolate),
- pending_exception_(isolate_->pending_exception()->ToObjectUnchecked(),
-                         isolate_),
+      pending_exception_(isolate_->pending_exception(), isolate_),
       catcher_(isolate_->catcher())
     { }

@@ -819,7 +825,7 @@
   // Re-throw an exception.  This involves no error reporting since
   // error reporting was handled when the exception was thrown
   // originally.
-  Failure* ReThrow(MaybeObject* exception);
+  Failure* ReThrow(Object* exception);
   void ScheduleThrow(Object* exception);
   // Re-set pending message, script and positions reported to the TryCatch
   // back to the TLS for re-use when rethrowing.
=======================================
--- /branches/bleeding_edge/src/liveedit.cc     Tue Apr  8 07:04:13 2014 UTC
+++ /branches/bleeding_edge/src/liveedit.cc     Tue Apr  8 09:44:24 2014 UTC
@@ -832,8 +832,7 @@
   // A logical 'catch' section.
   Handle<JSObject> rethrow_exception;
   if (isolate->has_pending_exception()) {
- Handle<Object> exception(isolate->pending_exception()->ToObjectChecked(),
-                             isolate);
+    Handle<Object> exception(isolate->pending_exception(), isolate);
     MessageLocation message_location = isolate->GetMessageLocation();

     isolate->clear_pending_message();
=======================================
--- /branches/bleeding_edge/src/messages.cc     Tue Feb 11 09:29:51 2014 UTC
+++ /branches/bleeding_edge/src/messages.cc     Tue Apr  8 09:44:24 2014 UTC
@@ -107,7 +107,7 @@
   // We pass the exception object into the message handler callback though.
   Object* exception_object = isolate->heap()->undefined_value();
   if (isolate->has_pending_exception()) {
-    isolate->pending_exception()->ToObject(&exception_object);
+    exception_object = isolate->pending_exception();
   }
   Handle<Object> exception_handle(exception_object, isolate);

=======================================
--- /branches/bleeding_edge/src/runtime.cc      Tue Apr  8 07:04:13 2014 UTC
+++ /branches/bleeding_edge/src/runtime.cc      Tue Apr  8 09:44:24 2014 UTC
@@ -10802,7 +10802,7 @@
             handle(name, isolate));
         Handle<Object> value;
         if (maybe_value.ToHandle(&value)) return *value;
-        MaybeObject* exception = heap->isolate()->pending_exception();
+        Object* exception = heap->isolate()->pending_exception();
         heap->isolate()->clear_pending_exception();
         if (caught_exception != NULL) *caught_exception = true;
         return exception;
=======================================
--- /branches/bleeding_edge/test/cctest/test-compiler.cc Fri Apr 4 12:06:11 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-compiler.cc Tue Apr 8 09:44:24 2014 UTC
@@ -220,7 +220,7 @@
   Handle<JSObject> global(isolate->context()->global_object());
   Execution::Call(isolate, fun, global, 0, NULL, &has_pending_exception);
   CHECK(has_pending_exception);
- CHECK_EQ(42.0, isolate->pending_exception()->ToObjectChecked()->Number());
+  CHECK_EQ(42.0, isolate->pending_exception()->Number());
 }


=======================================
--- /branches/bleeding_edge/test/cctest/test-parsing.cc Tue Apr 8 07:04:13 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-parsing.cc Tue Apr 8 09:44:24 2014 UTC
@@ -1339,10 +1339,8 @@
   if (function == NULL) {
     // Extract exception from the parser.
     CHECK(isolate->has_pending_exception());
-    i::MaybeObject* maybe_object = isolate->pending_exception();
-    i::JSObject* exception = NULL;
-    CHECK(maybe_object->To(&exception));
-    i::Handle<i::JSObject> exception_handle(exception);
+    i::Handle<i::JSObject> exception_handle(
+        i::JSObject::cast(isolate->pending_exception()));
     i::Handle<i::String> message_string =
i::Handle<i::String>::cast(i::GetProperty(exception_handle, "message"));

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to