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

Unified Diff: tools/parser-shell.cc

Issue 231073002: WIP: Parser: delay string internalization. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: more cleanup Created 6 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 | « tools/gyp/v8.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/parser-shell.cc
diff --git a/tools/parser-shell.cc b/tools/parser-shell.cc
index 4acdf7c034c778b72909e913878410afa09dbf2e..05b5a89b363f49965ae305c4bf6a655969773aec 100644
--- a/tools/parser-shell.cc
+++ b/tools/parser-shell.cc
@@ -44,6 +44,18 @@
using namespace v8::internal;
+class StringResource8 : public v8::String::ExternalAsciiStringResource {
+ public:
+ StringResource8(const char* data, int length)
+ : data_(data), length_(length) { }
+ virtual size_t length() const { return length_; }
+ virtual const char* data() const { return data_; }
+
+ private:
+ const char* data_;
+ int length_;
+};
+
std::pair<TimeDelta, TimeDelta> RunBaselineParser(
const char* fname, Encoding encoding, int repeat, v8::Isolate* isolate,
v8::Handle<v8::Context> context) {
@@ -63,7 +75,9 @@ std::pair<TimeDelta, TimeDelta> RunBaselineParser(
break;
}
case LATIN1: {
- source_handle = v8::String::NewFromOneByte(isolate, source);
+ StringResource8* string_resource =
+ new StringResource8(reinterpret_cast<const char*>(source), length);
+ source_handle = v8::String::NewExternal(isolate, string_resource);
break;
}
}
« no previous file with comments | « tools/gyp/v8.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698