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 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 | 1009 |
1010 return *value; | 1010 return *value; |
1011 } | 1011 } |
1012 | 1012 |
1013 | 1013 |
1014 static Object* Runtime_RegExpExec(Arguments args) { | 1014 static Object* Runtime_RegExpExec(Arguments args) { |
1015 HandleScope scope; | 1015 HandleScope scope; |
1016 ASSERT(args.length() == 4); | 1016 ASSERT(args.length() == 4); |
1017 CONVERT_ARG_CHECKED(JSRegExp, regexp, 0); | 1017 CONVERT_ARG_CHECKED(JSRegExp, regexp, 0); |
1018 CONVERT_ARG_CHECKED(String, subject, 1); | 1018 CONVERT_ARG_CHECKED(String, subject, 1); |
1019 // Due to the way the JS files are constructed this must be less than the | 1019 // Due to the way the JS calls are constructed this must be less than the |
1020 // length of a string, i.e. it is always a Smi. We check anyway for security. | 1020 // length of a string, i.e. it is always a Smi. We check anyway for security. |
1021 CONVERT_CHECKED(Smi, index, args[2]); | 1021 CONVERT_SMI_CHECKED(index, args[2]); |
1022 CONVERT_ARG_CHECKED(JSArray, last_match_info, 3); | 1022 CONVERT_ARG_CHECKED(JSArray, last_match_info, 3); |
1023 RUNTIME_ASSERT(last_match_info->HasFastElements()); | 1023 RUNTIME_ASSERT(last_match_info->HasFastElements()); |
1024 RUNTIME_ASSERT(index->value() >= 0); | 1024 RUNTIME_ASSERT(index >= 0); |
1025 RUNTIME_ASSERT(index->value() <= subject->length()); | 1025 RUNTIME_ASSERT(index <= subject->length()); |
1026 Handle<Object> result = RegExpImpl::Exec(regexp, | 1026 Handle<Object> result = RegExpImpl::Exec(regexp, |
1027 subject, | 1027 subject, |
1028 index->value(), | 1028 index, |
1029 last_match_info); | 1029 last_match_info); |
1030 if (result.is_null()) return Failure::Exception(); | 1030 if (result.is_null()) return Failure::Exception(); |
1031 return *result; | 1031 return *result; |
1032 } | 1032 } |
1033 | 1033 |
1034 | 1034 |
1035 static Object* Runtime_MaterializeRegExpLiteral(Arguments args) { | 1035 static Object* Runtime_MaterializeRegExpLiteral(Arguments args) { |
1036 HandleScope scope; | 1036 HandleScope scope; |
1037 ASSERT(args.length() == 4); | 1037 ASSERT(args.length() == 4); |
1038 CONVERT_ARG_CHECKED(FixedArray, literals, 0); | 1038 CONVERT_ARG_CHECKED(FixedArray, literals, 0); |
(...skipping 6517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7556 } else { | 7556 } else { |
7557 // Handle last resort GC and make sure to allow future allocations | 7557 // Handle last resort GC and make sure to allow future allocations |
7558 // to grow the heap without causing GCs (if possible). | 7558 // to grow the heap without causing GCs (if possible). |
7559 Counters::gc_last_resort_from_js.Increment(); | 7559 Counters::gc_last_resort_from_js.Increment(); |
7560 Heap::CollectAllGarbage(); | 7560 Heap::CollectAllGarbage(); |
7561 } | 7561 } |
7562 } | 7562 } |
7563 | 7563 |
7564 | 7564 |
7565 } } // namespace v8::internal | 7565 } } // namespace v8::internal |
OLD | NEW |