| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |