Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index 6c189947a7b17abd52a1c503a810e9c0c764532e..6633830e8f1f804a0fe44ad976ed8e16aaf5be28 100644 |
--- a/src/objects.h |
+++ b/src/objects.h |
@@ -168,6 +168,8 @@ |
namespace v8 { |
namespace internal { |
+struct InliningPosition; |
+ |
enum KeyedAccessStoreMode { |
STANDARD_STORE, |
STORE_TRANSITION_TO_OBJECT, |
@@ -4901,6 +4903,32 @@ class ByteArray: public FixedArrayBase { |
DISALLOW_IMPLICIT_CONSTRUCTORS(ByteArray); |
}; |
+// Wrapper class for ByteArray which can store arbitrary C++ classes, as long |
+// as they can be copied with memcpy. |
+template <class T> |
+class PodArray : public ByteArray { |
+ public: |
+ static Handle<PodArray<T>> New(Isolate* isolate, int length, |
+ PretenureFlag pretenure = NOT_TENURED); |
+ void copy_out(int index, T* result) { |
+ ByteArray::copy_out(index * sizeof(T), reinterpret_cast<byte*>(result), |
+ sizeof(T)); |
+ } |
+ T get(int index) { |
+ T result; |
+ copy_out(index, &result); |
+ return result; |
+ } |
+ void set(int index, const T& value) { |
+ copy_in(index * sizeof(T), reinterpret_cast<const byte*>(&value), |
+ sizeof(T)); |
+ } |
+ int length() { return ByteArray::length() / sizeof(T); } |
+ DECLARE_CAST(PodArray<T>) |
+ |
+ private: |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(PodArray<T>); |
+}; |
// BytecodeArray represents a sequence of interpreter bytecodes. |
class BytecodeArray : public FixedArrayBase { |
@@ -5133,7 +5161,6 @@ TYPED_ARRAYS(FIXED_TYPED_ARRAY_TRAITS) |
#undef FIXED_TYPED_ARRAY_TRAITS |
- |
// DeoptimizationInputData is a fixed array used to hold the deoptimization |
// data for code generated by the Hydrogen/Lithium compiler. It also |
// contains information about functions that were inlined. If N different |
@@ -5152,7 +5179,8 @@ class DeoptimizationInputData: public FixedArray { |
static const int kOptimizationIdIndex = 5; |
static const int kSharedFunctionInfoIndex = 6; |
static const int kWeakCellCacheIndex = 7; |
- static const int kFirstDeoptEntryIndex = 8; |
+ static const int kInliningPositionsIndex = 8; |
+ static const int kFirstDeoptEntryIndex = 9; |
// Offsets of deopt entry elements relative to the start of the entry. |
static const int kAstIdRawOffset = 0; |
@@ -5174,6 +5202,7 @@ class DeoptimizationInputData: public FixedArray { |
DECLARE_ELEMENT_ACCESSORS(OptimizationId, Smi) |
DECLARE_ELEMENT_ACCESSORS(SharedFunctionInfo, Object) |
DECLARE_ELEMENT_ACCESSORS(WeakCellCache, Object) |
+ DECLARE_ELEMENT_ACCESSORS(InliningPositions, PodArray<InliningPosition>) |
#undef DECLARE_ELEMENT_ACCESSORS |
@@ -5215,7 +5244,6 @@ class DeoptimizationInputData: public FixedArray { |
static int LengthFor(int entry_count) { return IndexForEntry(entry_count); } |
}; |
- |
// DeoptimizationOutputData is a fixed array used to hold the deoptimization |
// data for code generated by the full compiler. |
// The format of the these objects is |
@@ -7101,14 +7129,6 @@ 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) {} |
@@ -7116,7 +7136,7 @@ class Script: public Struct { |
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. |
+ int line_end; // Position of final linebreak character in line. |
}; |
// Specifies whether to add offsets to position infos. |
@@ -7125,8 +7145,20 @@ class Script: public Struct { |
// Retrieves information about the given position, optionally with an offset. |
// Returns false on failure, and otherwise writes into the given info object |
// on success. |
+ // The static method should is preferable for handlified callsites because it |
+ // initializes the line ends array, avoiding expensive recomputations. |
+ // The non-static version is not allocating and safe for unhandlified |
+ // callsites. |
+ static bool GetPositionInfo(Handle<Script> script, int position, |
+ PositionInfo* info, OffsetFlag offset_flag); |
bool GetPositionInfo(int position, PositionInfo* info, |
- OffsetFlag offset_flag); |
+ OffsetFlag offset_flag) const; |
+ |
+ // Wrappers for GetPositionInfo |
+ static int GetColumnNumber(Handle<Script> script, int code_offset); |
+ int GetColumnNumber(int code_pos) const; |
+ static int GetLineNumber(Handle<Script> script, int code_offset); |
+ int GetLineNumber(int code_pos) const; |
// Get the JS object wrapping the given script; create it if none exists. |
static Handle<JSObject> GetWrapper(Handle<Script> script); |
@@ -7170,8 +7202,6 @@ class Script: public Struct { |
static const int kSize = kSourceMappingUrlOffset + kPointerSize; |
private: |
- int GetLineNumberWithArray(int code_pos); |
- |
// Bit positions in the flags field. |
static const int kCompilationTypeBit = 0; |
static const int kCompilationStateBit = 1; |