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

Unified Diff: src/parser.h

Issue 3185026: Reordered function entries in PreParse data to be ordered by start position. (Closed)
Patch Set: Added parentheses. Created 10 years, 4 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 | « no previous file | src/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.h
diff --git a/src/parser.h b/src/parser.h
index 225a36832ef31ed852a017ae88c30f4738af6230..2952581af92c7313c203e4fb67178045d644c963 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -68,11 +68,18 @@ class FunctionEntry BASE_EMBEDDED {
void set_literal_count(int value) { backing_[kLiteralCountOffset] = value; }
int property_count() { return backing_[kPropertyCountOffset]; }
- void set_property_count(int value) { backing_[kPropertyCountOffset] = value; }
+ void set_property_count(int value) {
+ backing_[kPropertyCountOffset] = value;
+ }
+
+ int predata_skip() { return backing_[kPredataSkipOffset]; }
+ void set_predata_skip(int value) {
+ backing_[kPredataSkipOffset] = value;
+ }
bool is_valid() { return backing_.length() > 0; }
- static const int kSize = 4;
+ static const int kSize = 5;
private:
Vector<unsigned> backing_;
@@ -80,6 +87,7 @@ class FunctionEntry BASE_EMBEDDED {
static const int kEndPosOffset = 1;
static const int kLiteralCountOffset = 2;
static const int kPropertyCountOffset = 3;
+ static const int kPredataSkipOffset = 4;
};
@@ -87,12 +95,13 @@ class ScriptDataImpl : public ScriptData {
public:
explicit ScriptDataImpl(Vector<unsigned> store)
: store_(store),
- last_entry_(0) { }
+ index_(kHeaderSize) { }
virtual ~ScriptDataImpl();
virtual int Length();
virtual const char* Data();
virtual bool HasError();
- FunctionEntry GetFunctionEnd(int start);
+ FunctionEntry GetFunctionEntry(int start);
+ void SkipFunctionEntry(int start);
bool SanityCheck();
Scanner::Location MessageLocation();
@@ -102,31 +111,33 @@ class ScriptDataImpl : public ScriptData {
bool has_error() { return store_[kHasErrorOffset]; }
unsigned magic() { return store_[kMagicOffset]; }
unsigned version() { return store_[kVersionOffset]; }
+ // Skip forward in the preparser data by the given number
+ // of unsigned ints.
+ virtual void Skip(int entries) {
+ ASSERT(entries >= 0);
+ ASSERT(entries <= store_.length() - index_);
+ index_ += entries;
+ }
static const unsigned kMagicNumber = 0xBadDead;
static const unsigned kCurrentVersion = 1;
- static const unsigned kMagicOffset = 0;
- static const unsigned kVersionOffset = 1;
- static const unsigned kHasErrorOffset = 2;
- static const unsigned kSizeOffset = 3;
- static const unsigned kHeaderSize = 4;
+ static const int kMagicOffset = 0;
+ static const int kVersionOffset = 1;
+ static const int kHasErrorOffset = 2;
+ static const int kSizeOffset = 3;
+ static const int kHeaderSize = 4;
private:
+ Vector<unsigned> store_;
+ int index_;
+
unsigned Read(int position);
unsigned* ReadAddress(int position);
- int EntryCount();
- FunctionEntry nth(int n);
-
- Vector<unsigned> store_;
+ void FindStart(int position);
// Read strings written by ParserRecorder::WriteString.
static const char* ReadString(unsigned* start, int* chars);
-
- // The last entry returned. This is used to make lookup faster:
- // the next entry to return is typically the next entry so lookup
- // will usually be much faster if we start from the last entry.
- int last_entry_;
};
« no previous file with comments | « no previous file | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698