Reviewers: Benedikt Meurer,

Description:
Remove obsolete stack trace string in a message object.

The stack trace string is an ancient relic that is no longer being used.
We use the structured stack trace object instead.

[email protected]

Please review this at https://codereview.chromium.org/159013002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+5, -28 lines):
  M src/debug.cc
  M src/factory.h
  M src/factory.cc
  M src/flag-definitions.h
  M src/heap.h
  M src/heap.cc
  M src/isolate.cc
  M src/messages.h
  M src/messages.cc
  M src/objects-debug.cc
  M src/objects-inl.h
  M src/objects-printer.cc
  M src/objects.h


Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index d474e2059ce3b313276fe5e5c5c856a80580ed74..d46c7b1ac604aef73254a8365bdf5c0974012bbd 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -792,7 +792,7 @@ bool Debug::CompileDebuggerScript(Isolate* isolate, int index) {
     isolate->ComputeLocation(&computed_location);
     Handle<Object> message = MessageHandler::MakeMessageObject(
         isolate, "error_loading_debugger", &computed_location,
- Vector<Handle<Object> >::empty(), Handle<String>(), Handle<JSArray>());
+        Vector<Handle<Object> >::empty(), Handle<JSArray>());
     ASSERT(!isolate->has_pending_exception());
     if (!exception.is_null()) {
       isolate->set_pending_exception(*exception);
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index aead7be0cc934efc7af442b242b6fc72a126b7de..63bb44166d694d0dae0b219760b2617a2215434a 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -1572,7 +1572,6 @@ Handle<JSMessageObject> Factory::NewJSMessageObject(
     int start_position,
     int end_position,
     Handle<Object> script,
-    Handle<Object> stack_trace,
     Handle<Object> stack_frames) {
   CALL_HEAP_FUNCTION(isolate(),
                      isolate()->heap()->AllocateJSMessageObject(*type,
@@ -1580,7 +1579,6 @@ Handle<JSMessageObject> Factory::NewJSMessageObject(
                          start_position,
                          end_position,
                          *script,
-                         *stack_trace,
                          *stack_frames),
                      JSMessageObject);
 }
Index: src/factory.h
diff --git a/src/factory.h b/src/factory.h
index db25b09a91e7629e02c56fa1a94b07380c39b8b7..284e6f96a5fcf1c2baa78aa7128be53a89e356b9 100644
--- a/src/factory.h
+++ b/src/factory.h
@@ -528,7 +528,6 @@ class Factory {
       int start_position,
       int end_position,
       Handle<Object> script,
-      Handle<Object> stack_trace,
       Handle<Object> stack_frames);

   Handle<SeededNumberDictionary> DictionaryAtNumberPut(
Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index c0eaf16da2c22674c7e0d913cb2cffb40a98169d..05ee6fa3acc1679415b1c4e6c6e8c1a6b7e42533 100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -593,8 +593,6 @@ DEFINE_int(sim_stack_alignment, 8,
 // isolate.cc
 DEFINE_bool(abort_on_uncaught_exception, false,
"abort program (dump core) when an uncaught exception is thrown")
-DEFINE_bool(trace_exception, false,
-            "print stack trace when throwing exceptions")
 DEFINE_bool(randomize_hashes, true,
             "randomize hashes to avoid predictable hash collisions "
"(with snapshots this option cannot override the baked-in seed)")
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index dfe98ec080c38009871c4f2357d532e5ec8d40d1..1c05f445d37252f3f517b9d84636a64e9bc39bcf 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -3770,7 +3770,6 @@ MaybeObject* Heap::AllocateJSMessageObject(String* type,
                                            int start_position,
                                            int end_position,
                                            Object* script,
-                                           Object* stack_trace,
                                            Object* stack_frames) {
   Object* result;
   { MaybeObject* maybe_result = Allocate(message_object_map(), NEW_SPACE);
@@ -3785,7 +3784,6 @@ MaybeObject* Heap::AllocateJSMessageObject(String* type,
   message->set_start_position(start_position);
   message->set_end_position(end_position);
   message->set_script(script);
-  message->set_stack_trace(stack_trace);
   message->set_stack_frames(stack_frames);
   return result;
 }
Index: src/heap.h
diff --git a/src/heap.h b/src/heap.h
index 266cdb9684babcb887958522b7a5596aa181ff82..9800959d0b4c2e70fcba801824fe7229e8cb6b96 100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -1134,7 +1134,6 @@ class Heap {
       int start_position,
       int end_position,
       Object* script,
-      Object* stack_trace,
       Object* stack_frames);

   // Allocate a new external string object, which is backed by a string
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index 8a2f4219c763e014b89720d2c72fe84da981028b..a0a3227ba44e7c2adbb4f3c3bfdb65a86035e113 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -946,6 +946,9 @@ Failure* Isolate::ReThrow(MaybeObject* exception) {


 Failure* Isolate::ThrowIllegalOperation() {
+#ifdef DEBUG
+  PrintStack(stdout);
+#endif  // DEBUG
   return Throw(heap_.illegal_access_string());
 }

@@ -1122,8 +1125,6 @@ void Isolate::DoThrow(Object* exception, MessageLocation* location) { // while the bootstrapper is active since the infrastructure may not have
     // been properly initialized.
     if (!bootstrapping) {
-      Handle<String> stack_trace;
-      if (FLAG_trace_exception) stack_trace = StackTraceString();
       Handle<JSArray> stack_trace_object;
       if (capture_stack_trace_for_uncaught_exceptions_) {
         if (IsErrorObject(exception_handle)) {
@@ -1163,7 +1164,6 @@ void Isolate::DoThrow(Object* exception, MessageLocation* location) {
           "uncaught_exception",
           location,
           HandleVector<Object>(&exception_arg, 1),
-          stack_trace,
           stack_trace_object);
       thread_local_top()->pending_message_obj_ = *message_obj;
       if (location != NULL) {
Index: src/messages.cc
diff --git a/src/messages.cc b/src/messages.cc
index 3f4484a0987e0dfb828e4f668c34c6aca3290801..0077d0309f0794b38f7c1ea77f5e11aa46d20f02 100644
--- a/src/messages.cc
+++ b/src/messages.cc
@@ -61,7 +61,6 @@ Handle<JSMessageObject> MessageHandler::MakeMessageObject(
     const char* type,
     MessageLocation* loc,
     Vector< Handle<Object> > args,
-    Handle<String> stack_trace,
     Handle<JSArray> stack_frames) {
   Factory* factory = isolate->factory();
   Handle<String> type_handle = factory->InternalizeUtf8String(type);
@@ -82,10 +81,6 @@ Handle<JSMessageObject> MessageHandler::MakeMessageObject(
     script_handle = GetScriptWrapper(loc->script());
   }

-  Handle<Object> stack_trace_handle = stack_trace.is_null()
-      ? Handle<Object>::cast(factory->undefined_value())
-      : Handle<Object>::cast(stack_trace);
-
   Handle<Object> stack_frames_handle = stack_frames.is_null()
       ? Handle<Object>::cast(factory->undefined_value())
       : Handle<Object>::cast(stack_frames);
@@ -96,7 +91,6 @@ Handle<JSMessageObject> MessageHandler::MakeMessageObject(
                                   start,
                                   end,
                                   script_handle,
-                                  stack_trace_handle,
                                   stack_frames_handle);

   return message;
Index: src/messages.h
diff --git a/src/messages.h b/src/messages.h
index 5d84e46caa912d384b849752c32b299ac2c689ed..2f4be518b224ecbc72217aa1c380a8863171c759 100644
--- a/src/messages.h
+++ b/src/messages.h
@@ -95,7 +95,6 @@ class MessageHandler {
       const char* type,
       MessageLocation* loc,
       Vector< Handle<Object> > args,
-      Handle<String> stack_trace,
       Handle<JSArray> stack_frames);

   // Report a formatted message (needs JS allocation).
Index: src/objects-debug.cc
diff --git a/src/objects-debug.cc b/src/objects-debug.cc
index e33b46be7991009818f7df4300edf15647c6684b..099b55b1236e1f20f39039233b637e45e29c054e 100644
--- a/src/objects-debug.cc
+++ b/src/objects-debug.cc
@@ -490,7 +490,6 @@ void JSMessageObject::JSMessageObjectVerify() {
   VerifyObjectField(kEndPositionOffset);
   VerifyObjectField(kArgumentsOffset);
   VerifyObjectField(kScriptOffset);
-  VerifyObjectField(kStackTraceOffset);
   VerifyObjectField(kStackFramesOffset);
 }

Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index dbac0f4685e2d0e594014e97410698499d5b84ff..9ac1dc21a98d512706d17087371201b883a55b68 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -5680,7 +5680,6 @@ JSDate* JSDate::cast(Object* obj) {
 ACCESSORS(JSMessageObject, type, String, kTypeOffset)
 ACCESSORS(JSMessageObject, arguments, JSArray, kArgumentsOffset)
 ACCESSORS(JSMessageObject, script, Object, kScriptOffset)
-ACCESSORS(JSMessageObject, stack_trace, Object, kStackTraceOffset)
 ACCESSORS(JSMessageObject, stack_frames, Object, kStackFramesOffset)
 SMI_ACCESSORS(JSMessageObject, start_position, kStartPositionOffset)
 SMI_ACCESSORS(JSMessageObject, end_position, kEndPositionOffset)
Index: src/objects-printer.cc
diff --git a/src/objects-printer.cc b/src/objects-printer.cc
index 909d8f742100a74b29c464c376c6da192d723ef9..17eba0ee5e3561d37b52ab76d5c3ffe8a8cb747b 100644
--- a/src/objects-printer.cc
+++ b/src/objects-printer.cc
@@ -624,8 +624,6 @@ void JSMessageObject::JSMessageObjectPrint(FILE* out) {
   PrintF(out, "\n - end_position: %d", end_position());
   PrintF(out, "\n - script: ");
   script()->ShortPrint(out);
-  PrintF(out, "\n - stack_trace: ");
-  stack_trace()->ShortPrint(out);
   PrintF(out, "\n - stack_frames: ");
   stack_frames()->ShortPrint(out);
   PrintF(out, "\n");
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 6e3e94132def173e13fcfbaf03b797a5796c5aa9..5279efc17f3d0bb0d0df4ec476838350b0d21a50 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -7801,9 +7801,6 @@ class JSMessageObject: public JSObject {
   // [script]: the script from which the error message originated.
   DECL_ACCESSORS(script, Object)

-  // [stack_trace]: the stack trace for this error message.
-  DECL_ACCESSORS(stack_trace, Object)
-
   // [stack_frames]: an array of stack frames for this error object.
   DECL_ACCESSORS(stack_frames, Object)

@@ -7826,8 +7823,7 @@ class JSMessageObject: public JSObject {
   static const int kTypeOffset = JSObject::kHeaderSize;
   static const int kArgumentsOffset = kTypeOffset + kPointerSize;
   static const int kScriptOffset = kArgumentsOffset + kPointerSize;
-  static const int kStackTraceOffset = kScriptOffset + kPointerSize;
-  static const int kStackFramesOffset = kStackTraceOffset + kPointerSize;
+  static const int kStackFramesOffset = kScriptOffset + kPointerSize;
static const int kStartPositionOffset = kStackFramesOffset + kPointerSize; static const int kEndPositionOffset = kStartPositionOffset + kPointerSize;
   static const int kSize = kEndPositionOffset + kPointerSize;


--
--
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/groups/opt_out.

Reply via email to