Revision: 22001
Author:   [email protected]
Date:     Wed Jun 25 09:13:09 2014 UTC
Log:      Do not unnecessarily expose execution state in debug event data.

When we fire a debug event, we create duplicate execution state objects,
one as argument for the debug event listener, one as property on the
debug event data object. The latter is never used by chrome.

[email protected]

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

Deleted:
 /branches/bleeding_edge/test/mjsunit/mjsunit-assertoptimized.js
Modified:
 /branches/bleeding_edge/src/debug-debugger.js
 /branches/bleeding_edge/src/debug.cc
 /branches/bleeding_edge/test/mjsunit/mjsunit.status

=======================================
--- /branches/bleeding_edge/test/mjsunit/mjsunit-assertoptimized.js Wed Jun 25 08:01:13 2014 UTC
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Flags: --allow-natives-syntax --crankshaft
-
-function f() {};
-f();
-f();
-%OptimizeFunctionOnNextCall(f);
-f();
-assertOptimized(f);
-assertThrows(function() { assertUnoptimized(f); });
-%DeoptimizeFunction(f);
-assertUnoptimized(f);
-assertThrows(function() { assertOptimized(f); });
-quit();  // Prevent stress runs.
=======================================
--- /branches/bleeding_edge/src/debug-debugger.js Tue Jun 10 09:42:41 2014 UTC +++ /branches/bleeding_edge/src/debug-debugger.js Wed Jun 25 09:13:09 2014 UTC
@@ -986,44 +986,39 @@
 };


-function MakeBreakEvent(exec_state, break_points_hit) {
-  return new BreakEvent(exec_state, break_points_hit);
+function MakeBreakEvent(break_id, break_points_hit) {
+  return new BreakEvent(break_id, break_points_hit);
 }


-function BreakEvent(exec_state, break_points_hit) {
-  this.exec_state_ = exec_state;
+function BreakEvent(break_id, break_points_hit) {
+  this.frame_ = new FrameMirror(break_id, 0);
   this.break_points_hit_ = break_points_hit;
 }


-BreakEvent.prototype.executionState = function() {
-  return this.exec_state_;
-};
-
-
 BreakEvent.prototype.eventType = function() {
   return Debug.DebugEvent.Break;
 };


 BreakEvent.prototype.func = function() {
-  return this.exec_state_.frame(0).func();
+  return this.frame_.func();
 };


 BreakEvent.prototype.sourceLine = function() {
-  return this.exec_state_.frame(0).sourceLine();
+  return this.frame_.sourceLine();
 };


 BreakEvent.prototype.sourceColumn = function() {
-  return this.exec_state_.frame(0).sourceColumn();
+  return this.frame_.sourceColumn();
 };


 BreakEvent.prototype.sourceLineText = function() {
-  return this.exec_state_.frame(0).sourceLineText();
+  return this.frame_.sourceLineText();
 };


@@ -1036,8 +1031,7 @@
   var o = { seq: next_response_seq++,
             type: "event",
             event: "break",
- body: { invocationText: this.exec_state_.frame(0).invocationText(),
-                  }
+            body: { invocationText: this.frame_.invocationText() }
           };

   // Add script related information to the event if available.
@@ -1070,24 +1064,19 @@
 };


-function MakeExceptionEvent(exec_state, exception, uncaught, promise) {
-  return new ExceptionEvent(exec_state, exception, uncaught, promise);
+function MakeExceptionEvent(break_id, exception, uncaught, promise) {
+  return new ExceptionEvent(break_id, exception, uncaught, promise);
 }


-function ExceptionEvent(exec_state, exception, uncaught, promise) {
-  this.exec_state_ = exec_state;
+function ExceptionEvent(break_id, exception, uncaught, promise) {
+  this.exec_state_ = new ExecutionState(break_id);
   this.exception_ = exception;
   this.uncaught_ = uncaught;
   this.promise_ = promise;
 }


-ExceptionEvent.prototype.executionState = function() {
-  return this.exec_state_;
-};
-
-
 ExceptionEvent.prototype.eventType = function() {
   return Debug.DebugEvent.Exception;
 };
@@ -1154,23 +1143,17 @@
 };


-function MakeCompileEvent(exec_state, script, before) {
-  return new CompileEvent(exec_state, script, before);
+function MakeCompileEvent(script, before) {
+  return new CompileEvent(script, before);
 }


-function CompileEvent(exec_state, script, before) {
-  this.exec_state_ = exec_state;
+function CompileEvent(script, before) {
   this.script_ = MakeMirror(script);
   this.before_ = before;
 }


-CompileEvent.prototype.executionState = function() {
-  return this.exec_state_;
-};
-
-
 CompileEvent.prototype.eventType = function() {
   if (this.before_) {
     return Debug.DebugEvent.BeforeCompile;
@@ -1200,13 +1183,12 @@
 };


-function MakeScriptCollectedEvent(exec_state, id) {
-  return new ScriptCollectedEvent(exec_state, id);
+function MakeScriptCollectedEvent(id) {
+  return new ScriptCollectedEvent(id);
 }


-function ScriptCollectedEvent(exec_state, id) {
-  this.exec_state_ = exec_state;
+function ScriptCollectedEvent(id) {
   this.id_ = id;
 }

@@ -1216,11 +1198,6 @@
 };


-ScriptCollectedEvent.prototype.executionState = function() {
-  return this.exec_state_;
-};
-
-
 ScriptCollectedEvent.prototype.toJSONProtocol = function() {
   var o = new ProtocolMessage();
   o.running = true;
=======================================
--- /branches/bleeding_edge/src/debug.cc        Fri Jun 20 08:40:11 2014 UTC
+++ /branches/bleeding_edge/src/debug.cc        Wed Jun 25 09:13:09 2014 UTC
@@ -2534,10 +2534,9 @@


MaybeHandle<Object> Debug::MakeBreakEvent(Handle<Object> break_points_hit) {
-  Handle<Object> exec_state;
- if (!MakeExecutionState().ToHandle(&exec_state)) return MaybeHandle<Object>();
   // Create the new break event object.
-  Handle<Object> argv[] = { exec_state, break_points_hit };
+ Handle<Object> argv[] = { isolate_->factory()->NewNumberFromInt(break_id()),
+                            break_points_hit };
   return MakeJSObject("MakeBreakEvent", ARRAY_SIZE(argv), argv);
 }

@@ -2545,10 +2544,8 @@
 MaybeHandle<Object> Debug::MakeExceptionEvent(Handle<Object> exception,
                                               bool uncaught,
                                               Handle<Object> promise) {
-  Handle<Object> exec_state;
- if (!MakeExecutionState().ToHandle(&exec_state)) return MaybeHandle<Object>();
   // Create the new exception event object.
-  Handle<Object> argv[] = { exec_state,
+ Handle<Object> argv[] = { isolate_->factory()->NewNumberFromInt(break_id()),
                             exception,
                             isolate_->factory()->ToBoolean(uncaught),
                             promise };
@@ -2558,23 +2555,18 @@

 MaybeHandle<Object> Debug::MakeCompileEvent(Handle<Script> script,
                                             bool before) {
-  Handle<Object> exec_state;
- if (!MakeExecutionState().ToHandle(&exec_state)) return MaybeHandle<Object>();
   // Create the compile event object.
   Handle<Object> script_wrapper = Script::GetWrapper(script);
-  Handle<Object> argv[] = { exec_state,
-                            script_wrapper,
+  Handle<Object> argv[] = { script_wrapper,
                             isolate_->factory()->ToBoolean(before) };
   return MakeJSObject("MakeCompileEvent", ARRAY_SIZE(argv), argv);
 }


 MaybeHandle<Object> Debug::MakeScriptCollectedEvent(int id) {
-  Handle<Object> exec_state;
- if (!MakeExecutionState().ToHandle(&exec_state)) return MaybeHandle<Object>();
   // Create the script collected event object.
   Handle<Object> id_object = Handle<Smi>(Smi::FromInt(id), isolate_);
-  Handle<Object> argv[] = { exec_state, id_object };
+  Handle<Object> argv[] = { id_object };
   return MakeJSObject("MakeScriptCollectedEvent", ARRAY_SIZE(argv), argv);
 }

=======================================
--- /branches/bleeding_edge/test/mjsunit/mjsunit.status Wed Jun 25 09:05:28 2014 UTC +++ /branches/bleeding_edge/test/mjsunit/mjsunit.status Wed Jun 25 09:13:09 2014 UTC
@@ -259,7 +259,6 @@
   'big-array-literal': [SKIP],
   'big-object-literal': [SKIP],
   'regress/regress-crbug-178790': [SKIP],
-  'mjsunit-assertoptimized': [SKIP],
 }],  # 'asan == True'

##############################################################################

--
--
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