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

Side by Side Diff: src/factory.cc

Issue 143223004: Generalize internalization of substrings. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add handling of sliced substrings 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/factory.h ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 220
221 221
222 Handle<String> Factory::InternalizeOneByteString(Vector<const uint8_t> string) { 222 Handle<String> Factory::InternalizeOneByteString(Vector<const uint8_t> string) {
223 OneByteStringKey key(string, isolate()->heap()->HashSeed()); 223 OneByteStringKey key(string, isolate()->heap()->HashSeed());
224 return InternalizeStringWithKey(&key); 224 return InternalizeStringWithKey(&key);
225 } 225 }
226 226
227 227
228 Handle<String> Factory::InternalizeOneByteString( 228 Handle<String> Factory::InternalizeOneByteString(
229 Handle<SeqOneByteString> string, int from, int length) { 229 Handle<SeqOneByteString> string, int from, int length) {
230 SubStringOneByteStringKey key(string, from, length); 230 SubStringKey<uint8_t> key(string, from, length);
231 return InternalizeStringWithKey(&key); 231 return InternalizeStringWithKey(&key);
232 } 232 }
233 233
234 234
235 Handle<String> Factory::InternalizeTwoByteString(Vector<const uc16> string) { 235 Handle<String> Factory::InternalizeTwoByteString(Vector<const uc16> string) {
236 TwoByteStringKey key(string, isolate()->heap()->HashSeed()); 236 TwoByteStringKey key(string, isolate()->heap()->HashSeed());
237 return InternalizeStringWithKey(&key); 237 return InternalizeStringWithKey(&key);
238 } 238 }
239 239
240 240
241 template<class StringTableKey> 241 template<class StringTableKey>
242 Handle<String> Factory::InternalizeStringWithKey(StringTableKey* key) { 242 Handle<String> Factory::InternalizeStringWithKey(StringTableKey* key) {
243 CALL_HEAP_FUNCTION(isolate(), 243 CALL_HEAP_FUNCTION(isolate(),
244 isolate()->heap()->InternalizeStringWithKey(key), 244 isolate()->heap()->InternalizeStringWithKey(key),
245 String); 245 String);
246 } 246 }
247 247
248 248
249 template Handle<String> Factory::InternalizeStringWithKey<
250 SubStringKey<uint8_t> > (SubStringKey<uint8_t>* key);
251 template Handle<String> Factory::InternalizeStringWithKey<
252 SubStringKey<uint16_t> > (SubStringKey<uint16_t>* key);
253
254
249 Handle<String> Factory::NewStringFromOneByte(Vector<const uint8_t> string, 255 Handle<String> Factory::NewStringFromOneByte(Vector<const uint8_t> string,
250 PretenureFlag pretenure) { 256 PretenureFlag pretenure) {
251 CALL_HEAP_FUNCTION( 257 CALL_HEAP_FUNCTION(
252 isolate(), 258 isolate(),
253 isolate()->heap()->AllocateStringFromOneByte(string, pretenure), 259 isolate()->heap()->AllocateStringFromOneByte(string, pretenure),
254 String); 260 String);
255 } 261 }
256 262
257 Handle<String> Factory::NewStringFromUtf8(Vector<const char> string, 263 Handle<String> Factory::NewStringFromUtf8(Vector<const char> string,
258 PretenureFlag pretenure) { 264 PretenureFlag pretenure) {
(...skipping 1751 matching lines...) Expand 10 before | Expand all | Expand 10 after
2010 return Handle<Object>::null(); 2016 return Handle<Object>::null();
2011 } 2017 }
2012 2018
2013 2019
2014 Handle<Object> Factory::ToBoolean(bool value) { 2020 Handle<Object> Factory::ToBoolean(bool value) {
2015 return value ? true_value() : false_value(); 2021 return value ? true_value() : false_value();
2016 } 2022 }
2017 2023
2018 2024
2019 } } // namespace v8::internal 2025 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698