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

Unified Diff: src/compiler.cc

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/compiler.h ('k') | src/messages.js » ('j') | src/preparse-data.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index 59c6a3693f796b484aa885837469a8a496ce256f..00c2667c1e38dfdabd73852f806d217b8f7bb150 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -31,6 +31,18 @@ namespace v8 {
namespace internal {
+ScriptData::ScriptData(const byte* data, int length)
+ : owns_data_(false), data_(data), length_(length) {
+ if (!IsAligned(reinterpret_cast<intptr_t>(data), kPointerAlignment)) {
+ byte* copy = NewArray<byte>(length);
+ ASSERT(IsAligned(reinterpret_cast<intptr_t>(data_), kPointerAlignment));
+ CopyBytes(copy, data, length);
+ data_ = copy;
+ AcquireDataOwnership();
+ }
+}
+
+
CompilationInfo::CompilationInfo(Handle<Script> script,
Zone* zone)
: flags_(StrictModeField::encode(SLOPPY)),
« no previous file with comments | « src/compiler.h ('k') | src/messages.js » ('j') | src/preparse-data.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698