| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1472 return CharCodeAt(subject, index); | 1472 return CharCodeAt(subject, index); |
| 1473 } | 1473 } |
| 1474 | 1474 |
| 1475 | 1475 |
| 1476 static Object* Runtime_StringCharAt(Arguments args) { | 1476 static Object* Runtime_StringCharAt(Arguments args) { |
| 1477 NoHandleAllocation ha; | 1477 NoHandleAllocation ha; |
| 1478 ASSERT(args.length() == 2); | 1478 ASSERT(args.length() == 2); |
| 1479 | 1479 |
| 1480 CONVERT_CHECKED(String, subject, args[0]); | 1480 CONVERT_CHECKED(String, subject, args[0]); |
| 1481 Object* index = args[1]; | 1481 Object* index = args[1]; |
| 1482 return CharFromCode(CharCodeAt(subject, index)); | 1482 Object* code = CharCodeAt(subject, index); |
| 1483 if (code == Heap::nan_value()) { |
| 1484 return Heap::undefined_value(); |
| 1485 } |
| 1486 return CharFromCode(code); |
| 1483 } | 1487 } |
| 1484 | 1488 |
| 1485 | 1489 |
| 1486 static Object* Runtime_CharFromCode(Arguments args) { | 1490 static Object* Runtime_CharFromCode(Arguments args) { |
| 1487 NoHandleAllocation ha; | 1491 NoHandleAllocation ha; |
| 1488 ASSERT(args.length() == 1); | 1492 ASSERT(args.length() == 1); |
| 1489 return CharFromCode(args[0]); | 1493 return CharFromCode(args[0]); |
| 1490 } | 1494 } |
| 1491 | 1495 |
| 1492 // Forward declarations. | 1496 // Forward declarations. |
| (...skipping 6657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8150 } else { | 8154 } else { |
| 8151 // Handle last resort GC and make sure to allow future allocations | 8155 // Handle last resort GC and make sure to allow future allocations |
| 8152 // to grow the heap without causing GCs (if possible). | 8156 // to grow the heap without causing GCs (if possible). |
| 8153 Counters::gc_last_resort_from_js.Increment(); | 8157 Counters::gc_last_resort_from_js.Increment(); |
| 8154 Heap::CollectAllGarbage(false); | 8158 Heap::CollectAllGarbage(false); |
| 8155 } | 8159 } |
| 8156 } | 8160 } |
| 8157 | 8161 |
| 8158 | 8162 |
| 8159 } } // namespace v8::internal | 8163 } } // namespace v8::internal |
| OLD | NEW |