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

Side by Side Diff: src/factory.cc

Issue 250773004: HashTableKey::AsObject() handlified. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/factory.h ('k') | src/heap.h » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "factory.h" 5 #include "factory.h"
6 6
7 #include "macro-assembler.h" 7 #include "macro-assembler.h"
8 #include "isolate-inl.h" 8 #include "isolate-inl.h"
9 #include "v8conversions.h" 9 #include "v8conversions.h"
10 10
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 273
274 MaybeHandle<String> Factory::NewStringFromTwoByte(Vector<const uc16> string, 274 MaybeHandle<String> Factory::NewStringFromTwoByte(Vector<const uc16> string,
275 PretenureFlag pretenure) { 275 PretenureFlag pretenure) {
276 CALL_HEAP_FUNCTION( 276 CALL_HEAP_FUNCTION(
277 isolate(), 277 isolate(),
278 isolate()->heap()->AllocateStringFromTwoByte(string, pretenure), 278 isolate()->heap()->AllocateStringFromTwoByte(string, pretenure),
279 String); 279 String);
280 } 280 }
281 281
282 282
283 Handle<String> Factory::NewInternalizedStringFromUtf8(Vector<const char> str,
284 int chars,
285 uint32_t hash_field) {
286 CALL_HEAP_FUNCTION(
287 isolate(),
288 isolate()->heap()->AllocateInternalizedStringFromUtf8(
289 str, chars, hash_field),
290 String);
291 }
292
293
294 MUST_USE_RESULT Handle<String> Factory::NewOneByteInternalizedString(
295 Vector<const uint8_t> str,
296 uint32_t hash_field) {
297 CALL_HEAP_FUNCTION(
298 isolate(),
299 isolate()->heap()->AllocateOneByteInternalizedString(str, hash_field),
300 String);
301 }
302
303
304 MUST_USE_RESULT Handle<String> Factory::NewTwoByteInternalizedString(
305 Vector<const uc16> str,
306 uint32_t hash_field) {
307 CALL_HEAP_FUNCTION(
308 isolate(),
309 isolate()->heap()->AllocateTwoByteInternalizedString(str, hash_field),
310 String);
311 }
312
313
314 template<typename T>
315 Handle<String> Factory::NewInternalizedStringImpl(
316 T t, int chars, uint32_t hash_field) {
317 CALL_HEAP_FUNCTION(
318 isolate(),
319 isolate()->heap()->AllocateInternalizedStringImpl(t, chars, hash_field),
320 String);
321 }
322
323 template
324 Handle<String> Factory::NewInternalizedStringImpl(String*, int, uint32_t);
325
326
327 MaybeHandle<Map> Factory::InternalizedStringMapForString(
328 Handle<String> string) {
329 // If the string is in new space it cannot be used as internalized.
330 if (isolate()->heap()->InNewSpace(*string)) return MaybeHandle<Map>();
331
332 // Find the corresponding internalized string map for strings.
333 switch (string->map()->instance_type()) {
334 case STRING_TYPE: return internalized_string_map();
335 case ASCII_STRING_TYPE: return ascii_internalized_string_map();
336 case EXTERNAL_STRING_TYPE: return external_internalized_string_map();
337 case EXTERNAL_ASCII_STRING_TYPE:
338 return external_ascii_internalized_string_map();
339 case EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE:
340 return external_internalized_string_with_one_byte_data_map();
341 case SHORT_EXTERNAL_STRING_TYPE:
342 return short_external_internalized_string_map();
343 case SHORT_EXTERNAL_ASCII_STRING_TYPE:
344 return short_external_ascii_internalized_string_map();
345 case SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE:
346 return short_external_internalized_string_with_one_byte_data_map();
347 default: return MaybeHandle<Map>(); // No match found.
348 }
349 }
350
351
283 MaybeHandle<SeqOneByteString> Factory::NewRawOneByteString( 352 MaybeHandle<SeqOneByteString> Factory::NewRawOneByteString(
284 int length, PretenureFlag pretenure) { 353 int length, PretenureFlag pretenure) {
285 CALL_HEAP_FUNCTION( 354 CALL_HEAP_FUNCTION(
286 isolate(), 355 isolate(),
287 isolate()->heap()->AllocateRawOneByteString(length, pretenure), 356 isolate()->heap()->AllocateRawOneByteString(length, pretenure),
288 SeqOneByteString); 357 SeqOneByteString);
289 } 358 }
290 359
291 360
292 MaybeHandle<SeqTwoByteString> Factory::NewRawTwoByteString( 361 MaybeHandle<SeqTwoByteString> Factory::NewRawTwoByteString(
(...skipping 1973 matching lines...) Expand 10 before | Expand all | Expand 10 after
2266 return Handle<Object>::null(); 2335 return Handle<Object>::null();
2267 } 2336 }
2268 2337
2269 2338
2270 Handle<Object> Factory::ToBoolean(bool value) { 2339 Handle<Object> Factory::ToBoolean(bool value) {
2271 return value ? true_value() : false_value(); 2340 return value ? true_value() : false_value();
2272 } 2341 }
2273 2342
2274 2343
2275 } } // namespace v8::internal 2344 } } // namespace v8::internal
OLDNEW
« 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