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

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
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 2398 matching lines...) Expand 10 before | Expand all | Expand 10 after
2409 generator->set_continuation(0); 2409 generator->set_continuation(0);
2410 generator->set_operand_stack(isolate->heap()->empty_fixed_array()); 2410 generator->set_operand_stack(isolate->heap()->empty_fixed_array());
2411 2411
2412 return generator; 2412 return generator;
2413 } 2413 }
2414 2414
2415 2415
2416 MUST_USE_RESULT static MaybeObject* CharFromCode(Isolate* isolate, 2416 MUST_USE_RESULT static MaybeObject* CharFromCode(Isolate* isolate,
2417 Object* char_code) { 2417 Object* char_code) {
2418 uint32_t code; 2418 uint32_t code;
2419 if (char_code->ToArrayIndex(&code)) { 2419 if (char_code->ToArrayIndex(&code)) {
Toon Verwaest 2013/04/16 22:19:30 This currently works by accident I presume; given
2420 if (code <= 0xffff) { 2420 return isolate->heap()->LookupSingleCharacterStringFromCode(code & 0xffff);
2421 return isolate->heap()->LookupSingleCharacterStringFromCode(code);
2422 }
2423 } 2421 }
2424 return isolate->heap()->empty_string(); 2422 return isolate->heap()->empty_string();
2425 } 2423 }
2426 2424
2427 2425
2428 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringCharCodeAt) { 2426 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringCharCodeAt) {
2429 NoHandleAllocation ha(isolate); 2427 NoHandleAllocation ha(isolate);
2430 ASSERT(args.length() == 2); 2428 ASSERT(args.length() == 2);
2431 2429
2432 CONVERT_ARG_CHECKED(String, subject, 0); 2430 CONVERT_ARG_CHECKED(String, subject, 0);
(...skipping 10772 matching lines...) Expand 10 before | Expand all | Expand 10 after
13205 // Handle last resort GC and make sure to allow future allocations 13203 // Handle last resort GC and make sure to allow future allocations
13206 // to grow the heap without causing GCs (if possible). 13204 // to grow the heap without causing GCs (if possible).
13207 isolate->counters()->gc_last_resort_from_js()->Increment(); 13205 isolate->counters()->gc_last_resort_from_js()->Increment();
13208 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13206 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13209 "Runtime::PerformGC"); 13207 "Runtime::PerformGC");
13210 } 13208 }
13211 } 13209 }
13212 13210
13213 13211
13214 } } // namespace v8::internal 13212 } } // namespace v8::internal
OLDNEW
« src/hydrogen.cc ('K') | « src/hydrogen.cc ('k') | test/mjsunit/string-fromcharcode.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698