OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/conversions-inl.h" | 8 #include "src/conversions-inl.h" |
9 #include "src/isolate-inl.h" | 9 #include "src/isolate-inl.h" |
10 #include "src/messages.h" | 10 #include "src/messages.h" |
(...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1488 | 1488 |
1489 // Slow path for: | 1489 // Slow path for: |
1490 // ES#sec-regexp.prototype-@@replace | 1490 // ES#sec-regexp.prototype-@@replace |
1491 // RegExp.prototype [ @@replace ] ( string, replaceValue ) | 1491 // RegExp.prototype [ @@replace ] ( string, replaceValue ) |
1492 RUNTIME_FUNCTION(Runtime_RegExpReplace) { | 1492 RUNTIME_FUNCTION(Runtime_RegExpReplace) { |
1493 HandleScope scope(isolate); | 1493 HandleScope scope(isolate); |
1494 DCHECK(args.length() == 3); | 1494 DCHECK(args.length() == 3); |
1495 | 1495 |
1496 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, recv, 0); | 1496 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, recv, 0); |
1497 CONVERT_ARG_HANDLE_CHECKED(String, string, 1); | 1497 CONVERT_ARG_HANDLE_CHECKED(String, string, 1); |
1498 Handle<Object> replace_obj = args.at<Object>(2); | 1498 Handle<Object> replace_obj = args.at(2); |
1499 | 1499 |
1500 Factory* factory = isolate->factory(); | 1500 Factory* factory = isolate->factory(); |
1501 | 1501 |
1502 string = String::Flatten(string); | 1502 string = String::Flatten(string); |
1503 | 1503 |
1504 // Fast-path for unmodified JSRegExps. | 1504 // Fast-path for unmodified JSRegExps. |
1505 if (RegExpUtils::IsUnmodifiedRegExp(isolate, recv)) { | 1505 if (RegExpUtils::IsUnmodifiedRegExp(isolate, recv)) { |
1506 RETURN_RESULT_OR_FAILURE( | 1506 RETURN_RESULT_OR_FAILURE( |
1507 isolate, RegExpReplace(isolate, Handle<JSRegExp>::cast(recv), string, | 1507 isolate, RegExpReplace(isolate, Handle<JSRegExp>::cast(recv), string, |
1508 replace_obj)); | 1508 replace_obj)); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1680 | 1680 |
1681 RUNTIME_FUNCTION(Runtime_IsRegExp) { | 1681 RUNTIME_FUNCTION(Runtime_IsRegExp) { |
1682 SealHandleScope shs(isolate); | 1682 SealHandleScope shs(isolate); |
1683 DCHECK(args.length() == 1); | 1683 DCHECK(args.length() == 1); |
1684 CONVERT_ARG_CHECKED(Object, obj, 0); | 1684 CONVERT_ARG_CHECKED(Object, obj, 0); |
1685 return isolate->heap()->ToBoolean(obj->IsJSRegExp()); | 1685 return isolate->heap()->ToBoolean(obj->IsJSRegExp()); |
1686 } | 1686 } |
1687 | 1687 |
1688 } // namespace internal | 1688 } // namespace internal |
1689 } // namespace v8 | 1689 } // namespace v8 |
OLD | NEW |