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

Side by Side Diff: src/runtime.cc

Issue 14296009: Inline String.fromCharCode in hydrogen. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 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/hydrogen.cc ('k') | test/mjsunit/string-fromcharcode.js » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 2399 matching lines...) Expand 10 before | Expand all | Expand 10 after
2410 generator->set_context(isolate->heap()->undefined_value()); 2410 generator->set_context(isolate->heap()->undefined_value());
2411 generator->set_continuation(0); 2411 generator->set_continuation(0);
2412 generator->set_operand_stack(isolate->heap()->empty_fixed_array()); 2412 generator->set_operand_stack(isolate->heap()->empty_fixed_array());
2413 2413
2414 return generator; 2414 return generator;
2415 } 2415 }
2416 2416
2417 2417
2418 MUST_USE_RESULT static MaybeObject* CharFromCode(Isolate* isolate, 2418 MUST_USE_RESULT static MaybeObject* CharFromCode(Isolate* isolate,
2419 Object* char_code) { 2419 Object* char_code) {
2420 uint32_t code; 2420 if (char_code->IsNumber()) {
2421 if (char_code->ToArrayIndex(&code)) { 2421 return isolate->heap()->LookupSingleCharacterStringFromCode(
2422 if (code <= 0xffff) { 2422 NumberToUint32(char_code) & 0xffff);
2423 return isolate->heap()->LookupSingleCharacterStringFromCode(code);
2424 }
2425 } 2423 }
2426 return isolate->heap()->empty_string(); 2424 return isolate->heap()->empty_string();
2427 } 2425 }
2428 2426
2429 2427
2430 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringCharCodeAt) { 2428 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringCharCodeAt) {
2431 NoHandleAllocation ha(isolate); 2429 NoHandleAllocation ha(isolate);
2432 ASSERT(args.length() == 2); 2430 ASSERT(args.length() == 2);
2433 2431
2434 CONVERT_ARG_CHECKED(String, subject, 0); 2432 CONVERT_ARG_CHECKED(String, subject, 0);
(...skipping 10772 matching lines...) Expand 10 before | Expand all | Expand 10 after
13207 // Handle last resort GC and make sure to allow future allocations 13205 // Handle last resort GC and make sure to allow future allocations
13208 // to grow the heap without causing GCs (if possible). 13206 // to grow the heap without causing GCs (if possible).
13209 isolate->counters()->gc_last_resort_from_js()->Increment(); 13207 isolate->counters()->gc_last_resort_from_js()->Increment();
13210 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13208 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13211 "Runtime::PerformGC"); 13209 "Runtime::PerformGC");
13212 } 13210 }
13213 } 13211 }
13214 13212
13215 13213
13216 } } // namespace v8::internal 13214 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | test/mjsunit/string-fromcharcode.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698