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

Unified Diff: src/objects.h

Issue 2003483002: Refactor script position calculation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@20160517_refactor_position_info
Patch Set: Attempt to fix branch dependencies Created 4 years, 7 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/js/messages.js ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 0bce56c402ab7de3f98b3cf605e86f7524676a0c..89fc254b845fd7555a7f08d20b102fddf2feff29 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -6418,14 +6418,6 @@ class Script: public Struct {
// resource is accessible. Otherwise, always return true.
inline bool HasValidSource();
- // Convert code offset into column number.
- static int GetColumnNumber(Handle<Script> script, int code_offset);
-
- // Convert code offset into (zero-based) line number.
- // The non-handlified version does not allocate, but may be much slower.
- static int GetLineNumber(Handle<Script> script, int code_offset);
- int GetLineNumber(int code_pos);
-
static Handle<Object> GetNameOrSourceURL(Handle<Script> script);
// Set eval origin for stack trace formatting.
@@ -6438,6 +6430,33 @@ class Script: public Struct {
// Init line_ends array with source code positions of line ends.
static void InitLineEnds(Handle<Script> script);
+ // Convert code offset into column number.
+ static int GetColumnNumber(Handle<Script> script, int code_offset);
+
+ // Convert code offset into (zero-based) line number.
+ // The non-handlified version does not allocate, but may be much slower.
+ static int GetLineNumber(Handle<Script> script, int code_offset);
+ int GetLineNumber(int code_pos);
+
+ // Carries information about a source position.
+ struct PositionInfo {
+ PositionInfo() : line(-1), column(-1), line_start(-1), line_end(-1) {}
+
+ int line; // Zero-based line number.
+ int column; // Zero-based column number.
+ int line_start; // Position of first character in line.
+ int line_end; // Position of last (non-linebreak) character in line.
+ };
+
+ // Specifies whether to add offsets to position infos.
+ enum OffsetFlag { NO_OFFSET = 0, WITH_OFFSET = 1 };
+
+ // Retrieves information about the given position, optionally with an offset.
+ // Returns false on failure, and otherwise writes into the given info object
+ // on success.
+ bool GetPositionInfo(int position, PositionInfo* info,
+ OffsetFlag offset_flag);
+
// Get the JS object wrapping the given script; create it if none exists.
static Handle<JSObject> GetWrapper(Handle<Script> script);
« no previous file with comments | « src/js/messages.js ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698