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

Unified Diff: src/factory.cc

Issue 140953002: Refactor string internalization. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add virtual for real Created 6 years, 11 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/factory.h ('k') | src/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index 2b5cf8be1f4224e1179f474259297f89864c59c2..65888acbf00d48974464a5e2872b04f078360f0a 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -206,9 +206,8 @@ Handle<TypeFeedbackInfo> Factory::NewTypeFeedbackInfo() {
// Internalized strings are created in the old generation (data space).
Handle<String> Factory::InternalizeUtf8String(Vector<const char> string) {
- CALL_HEAP_FUNCTION(isolate(),
- isolate()->heap()->InternalizeUtf8String(string),
- String);
+ Utf8StringKey key(string, isolate()->heap()->HashSeed());
+ return InternalizeStringWithKey(&key);
}
@@ -221,24 +220,28 @@ Handle<String> Factory::InternalizeString(Handle<String> string) {
Handle<String> Factory::InternalizeOneByteString(Vector<const uint8_t> string) {
- CALL_HEAP_FUNCTION(isolate(),
- isolate()->heap()->InternalizeOneByteString(string),
- String);
+ OneByteStringKey key(string, isolate()->heap()->HashSeed());
+ return InternalizeStringWithKey(&key);
}
Handle<String> Factory::InternalizeOneByteString(
Handle<SeqOneByteString> string, int from, int length) {
- CALL_HEAP_FUNCTION(isolate(),
- isolate()->heap()->InternalizeOneByteString(
- string, from, length),
- String);
+ SubStringOneByteStringKey key(string, from, length);
+ return InternalizeStringWithKey(&key);
}
Handle<String> Factory::InternalizeTwoByteString(Vector<const uc16> string) {
+ TwoByteStringKey key(string, isolate()->heap()->HashSeed());
+ return InternalizeStringWithKey(&key);
+}
+
+
+template<class StringTableKey>
+Handle<String> Factory::InternalizeStringWithKey(StringTableKey* key) {
CALL_HEAP_FUNCTION(isolate(),
- isolate()->heap()->InternalizeTwoByteString(string),
+ isolate()->heap()->InternalizeStringWithKey(key),
String);
}
« no previous file with comments | « src/factory.h ('k') | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698