| OLD | NEW | 
|---|
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1394   HandleScope scope;  // create a new handle scope | 1394   HandleScope scope;  // create a new handle scope | 
| 1395   ASSERT(args.length() == 3); | 1395   ASSERT(args.length() == 3); | 
| 1396 | 1396 | 
| 1397   CONVERT_ARG_CHECKED(String, sub, 0); | 1397   CONVERT_ARG_CHECKED(String, sub, 0); | 
| 1398   CONVERT_ARG_CHECKED(String, pat, 1); | 1398   CONVERT_ARG_CHECKED(String, pat, 1); | 
| 1399 | 1399 | 
| 1400   Object* index = args[2]; | 1400   Object* index = args[2]; | 
| 1401   uint32_t start_index; | 1401   uint32_t start_index; | 
| 1402   if (!Array::IndexFromObject(index, &start_index)) return Smi::FromInt(-1); | 1402   if (!Array::IndexFromObject(index, &start_index)) return Smi::FromInt(-1); | 
| 1403 | 1403 | 
|  | 1404   RUNTIME_ASSERT(start_index <= static_cast<uint32_t>(sub->length())); | 
| 1404   int position = Runtime::StringMatch(sub, pat, start_index); | 1405   int position = Runtime::StringMatch(sub, pat, start_index); | 
| 1405   return Smi::FromInt(position); | 1406   return Smi::FromInt(position); | 
| 1406 } | 1407 } | 
| 1407 | 1408 | 
| 1408 | 1409 | 
| 1409 static Object* Runtime_StringLastIndexOf(Arguments args) { | 1410 static Object* Runtime_StringLastIndexOf(Arguments args) { | 
| 1410   NoHandleAllocation ha; | 1411   NoHandleAllocation ha; | 
| 1411   ASSERT(args.length() == 3); | 1412   ASSERT(args.length() == 3); | 
| 1412 | 1413 | 
| 1413   CONVERT_CHECKED(String, sub, args[0]); | 1414   CONVERT_CHECKED(String, sub, args[0]); | 
| (...skipping 4390 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5804   } else { | 5805   } else { | 
| 5805     // Handle last resort GC and make sure to allow future allocations | 5806     // Handle last resort GC and make sure to allow future allocations | 
| 5806     // to grow the heap without causing GCs (if possible). | 5807     // to grow the heap without causing GCs (if possible). | 
| 5807     Counters::gc_last_resort_from_js.Increment(); | 5808     Counters::gc_last_resort_from_js.Increment(); | 
| 5808     Heap::CollectAllGarbage(); | 5809     Heap::CollectAllGarbage(); | 
| 5809   } | 5810   } | 
| 5810 } | 5811 } | 
| 5811 | 5812 | 
| 5812 | 5813 | 
| 5813 } }  // namespace v8::internal | 5814 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|