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

Issue 119108: Add more debugging information to scripts compiled through eval (Closed)

Created:
11 years, 6 months ago by Søren Thygesen Gjesse
Modified:
9 years, 7 months ago
CC:
v8-dev
Visibility:
Public.

Description

Add more debugging information to scripts compiled through eval. Scripts now have a compilation type which can be host, eval or JSON. Host scripts are compiled through the API, eval scripts are compiled through call to evan and JSON scripts are compiled as a result of calling JSON.parse. For scripts scripts compiled through eval the JavaScript function in top of the stack and the pc offset into the code is stored in the script object. This makes it possible to calculate the source position of the eval call later when requested. This information can be obtained through the script mirror object and is part of the script mirror JSON serialization for the debugger protocol. Moved the enumeration ScripType into class Script and remamed to Type. The new compilation type enumeration is also inside the class Script. This information is now shown when using the scripts command in he developer shell debugger. Committed: http://code.google.com/p/v8/source/detail?r=2119

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Total comments: 24

Patch Set 4 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+288 lines, -55 lines) Patch
M src/accessors.h View 1 2 3 2 chunks +22 lines, -16 lines 0 comments Download
M src/accessors.cc View 1 2 3 3 chunks +68 lines, -3 lines 0 comments Download
M src/bootstrapper.cc View 1 2 3 5 chunks +30 lines, -6 lines 0 comments Download
M src/compiler.cc View 1 2 3 1 chunk +15 lines, -0 lines 0 comments Download
M src/d8.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/d8.js View 1 2 3 3 chunks +28 lines, -1 line 0 comments Download
M src/debug.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/debug-delay.js View 1 2 3 1 chunk +6 lines, -0 lines 0 comments Download
M src/factory.cc View 1 2 3 1 chunk +4 lines, -1 line 0 comments Download
M src/mirror-delay.js View 1 2 3 3 chunks +27 lines, -0 lines 0 comments Download
M src/objects.h View 1 2 3 3 chunks +32 lines, -11 lines 0 comments Download
M src/objects-inl.h View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download
M test/mjsunit/debug-compile-event.js View 1 2 3 4 chunks +31 lines, -4 lines 0 comments Download
M test/mjsunit/mirror-script.js View 1 2 3 3 chunks +19 lines, -11 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Søren Thygesen Gjesse
11 years, 6 months ago (2009-06-03 21:13:55 UTC) #1
Mads Ager (chromium)
LGTM http://codereview.chromium.org/119108/diff/1022/1032 File src/accessors.cc (right): http://codereview.chromium.org/119108/diff/1022/1032#newcode355 Line 355: Handle<Script> script(Script::cast(JSValue::cast(object)->value())); Any reason to use handles ...
11 years, 6 months ago (2009-06-04 19:47:27 UTC) #2
Søren Thygesen Gjesse
11 years, 6 months ago (2009-06-08 09:44:39 UTC) #3
http://codereview.chromium.org/119108/diff/1022/1032
File src/accessors.cc (right):

http://codereview.chromium.org/119108/diff/1022/1032#newcode355
Line 355: Handle<Script> script(Script::cast(JSValue::cast(object)->value()));
On 2009/06/04 19:47:27, Mads Ager wrote:
> Any reason to use handles here and not in ScriptGetCompilation?  It is not a
big
> deal, but maybe we should make the script accessors consistently use handles
(or
> consistently not use handles when we can safely avoid it)?

Script acessors now only uses handles when required.

http://codereview.chromium.org/119108/diff/1022/1032#newcode376
Line 376: // If this is a not a script compiled through eval there is no
position in the
On 2009/06/04 19:47:27, Mads Ager wrote:
> a not a -> not a
> 
> How about just: "If this is not a script compiled through eval there is no
eval
> position."

Done.

http://codereview.chromium.org/119108/diff/1022/1032#newcode378
Line 378: int compilation = Smi::cast(script->compilation())->value();
On 2009/06/04 19:47:27, Mads Ager wrote:
> int -> Script::CompilationType to be explicit?

Done.

http://codereview.chromium.org/119108/diff/1022/1026
File src/accessors.h (right):

http://codereview.chromium.org/119108/diff/1022/1026#newcode51
Line 51: V(ScriptCompilation)              \
On 2009/06/04 19:47:27, Mads Ager wrote:
> How about calling this CompilationType instead of just Compilation?

Done.

http://codereview.chromium.org/119108/diff/1022/1027
File src/compiler.cc (right):

http://codereview.chromium.org/119108/diff/1022/1027#newcode114
Line 114: if (is_eval || is_json) {
On 2009/06/04 19:47:27, Mads Ager wrote:
> If this information is only used in the debugger, we should move it inside the
> #ifdef ENABLE_DEBUGGER_SUPPORT.

Done.

http://codereview.chromium.org/119108/diff/1022/1035
File src/objects-inl.h (right):

http://codereview.chromium.org/119108/diff/1022/1035#newcode2115
Line 2115: ACCESSORS(Script, compilation, Smi, kCompilationOffset)
On 2009/06/04 19:47:27, Mads Ager wrote:
> compilation_type?

Done.

http://codereview.chromium.org/119108/diff/1022/1028
File src/objects.h (right):

http://codereview.chromium.org/119108/diff/1022/1028#newcode2643
Line 2643: // Script types.
On 2009/06/04 19:47:27, Mads Ager wrote:
> Script types -> Script compilation types
> 
> Compilation -> CompilationType?

Done.

http://codereview.chromium.org/119108/diff/1022/1024
File test/mjsunit/debug-compile-event.js (right):

http://codereview.chromium.org/119108/diff/1022/1024#newcode36
Line 36: var source_count = 0;  // Total number of scource compiled.
On 2009/06/04 19:47:27, Mads Ager wrote:
> source_count -> script_count?
> 
> scource -> sources/scripts  (below as well)

Done.

http://codereview.chromium.org/119108/diff/1022/1024#newcode39
Line 39: var json_compilations = 0;  // Number of scource compiled through
JSOn.parse.
On 2009/06/04 19:47:27, Mads Ager wrote:
> JSOn -> JSON

Done.

http://codereview.chromium.org/119108/diff/1022/1024#newcode78
Line 78: // For JSON the JSON source will be in parentheses .
On 2009/06/04 19:47:27, Mads Ager wrote:
> Remove space before period.

Done.

http://codereview.chromium.org/119108/diff/1022/1024#newcode119
Line 119: // Check the actual number of events (no compilation through the API
all source
On 2009/06/04 19:47:27, Mads Ager wrote:
> API all source -> API and all code?

Done (API as all code).

http://codereview.chromium.org/119108/diff/1022/1024#newcode120
Line 120: // compiled through evl except for one JSON.parse call).
On 2009/06/04 19:47:27, Mads Ager wrote:
> evl -> eval

Done.

Powered by Google App Engine
This is Rietveld 408576698