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 2455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2466 end = Smi::cast(to)->value(); | 2466 end = Smi::cast(to)->value(); |
2467 } else { | 2467 } else { |
2468 CONVERT_DOUBLE_CHECKED(from_number, from); | 2468 CONVERT_DOUBLE_CHECKED(from_number, from); |
2469 CONVERT_DOUBLE_CHECKED(to_number, to); | 2469 CONVERT_DOUBLE_CHECKED(to_number, to); |
2470 start = FastD2I(from_number); | 2470 start = FastD2I(from_number); |
2471 end = FastD2I(to_number); | 2471 end = FastD2I(to_number); |
2472 } | 2472 } |
2473 RUNTIME_ASSERT(end >= start); | 2473 RUNTIME_ASSERT(end >= start); |
2474 RUNTIME_ASSERT(start >= 0); | 2474 RUNTIME_ASSERT(start >= 0); |
2475 RUNTIME_ASSERT(end <= value->length()); | 2475 RUNTIME_ASSERT(end <= value->length()); |
| 2476 Counters::sub_string_runtime.Increment(); |
2476 return value->SubString(start, end); | 2477 return value->SubString(start, end); |
2477 } | 2478 } |
2478 | 2479 |
2479 | 2480 |
2480 static Object* Runtime_StringMatch(Arguments args) { | 2481 static Object* Runtime_StringMatch(Arguments args) { |
2481 ASSERT_EQ(3, args.length()); | 2482 ASSERT_EQ(3, args.length()); |
2482 | 2483 |
2483 CONVERT_ARG_CHECKED(String, subject, 0); | 2484 CONVERT_ARG_CHECKED(String, subject, 0); |
2484 CONVERT_ARG_CHECKED(JSRegExp, regexp, 1); | 2485 CONVERT_ARG_CHECKED(JSRegExp, regexp, 1); |
2485 CONVERT_ARG_CHECKED(JSArray, regexp_info, 2); | 2486 CONVERT_ARG_CHECKED(JSArray, regexp_info, 2); |
(...skipping 5540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8026 } else { | 8027 } else { |
8027 // Handle last resort GC and make sure to allow future allocations | 8028 // Handle last resort GC and make sure to allow future allocations |
8028 // to grow the heap without causing GCs (if possible). | 8029 // to grow the heap without causing GCs (if possible). |
8029 Counters::gc_last_resort_from_js.Increment(); | 8030 Counters::gc_last_resort_from_js.Increment(); |
8030 Heap::CollectAllGarbage(false); | 8031 Heap::CollectAllGarbage(false); |
8031 } | 8032 } |
8032 } | 8033 } |
8033 | 8034 |
8034 | 8035 |
8035 } } // namespace v8::internal | 8036 } } // namespace v8::internal |
OLD | NEW |