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

Unified Diff: src/compiler.h

Issue 376223002: Refactor ScriptData class for cached compile data. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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/api.cc ('k') | src/compiler.cc » ('j') | src/preparse-data.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler.h
diff --git a/src/compiler.h b/src/compiler.h
index b0c4e11856c3c4721c5a6a44ef31d398101fbf14..58fb16409bddc7d69210a643942a2c597d17e9c7 100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -13,7 +13,6 @@ namespace v8 {
namespace internal {
class AstValueFactory;
-class ScriptData;
class HydrogenCodeStub;
// ParseRestriction is used to restrict the set of valid statements in a
@@ -35,6 +34,36 @@ struct OffsetRange {
int to;
};
+
+class ScriptData {
+ public:
+ ScriptData(const byte* data, int length);
+ ~ScriptData() {
+ if (owns_data_) DeleteArray(data_);
+ }
+
+ const byte* data() const { return data_; }
+ int length() const { return length_; }
+
+ void AcquireDataOwnership() {
+ ASSERT(!owns_data_);
+ owns_data_ = true;
+ }
+
+ void ReleaseDataOwnership() {
+ ASSERT(owns_data_);
+ owns_data_ = false;
+ }
+
+ private:
+ bool owns_data_;
+ const byte* data_;
+ int length_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScriptData);
+};
+
+
// CompilationInfo encapsulates some information known at compile time. It
// is constructed based on the resources available at compile-time.
class CompilationInfo {
@@ -722,7 +751,6 @@ class CompilationPhase BASE_EMBEDDED {
DISALLOW_COPY_AND_ASSIGN(CompilationPhase);
};
-
} } // namespace v8::internal
#endif // V8_COMPILER_H_
« no previous file with comments | « src/api.cc ('k') | src/compiler.cc » ('j') | src/preparse-data.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698