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 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 | 1271 |
1272 // Slow path for: | 1272 // Slow path for: |
1273 // ES#sec-regexp.prototype-@@replace | 1273 // ES#sec-regexp.prototype-@@replace |
1274 // RegExp.prototype [ @@replace ] ( string, replaceValue ) | 1274 // RegExp.prototype [ @@replace ] ( string, replaceValue ) |
1275 RUNTIME_FUNCTION(Runtime_RegExpReplace) { | 1275 RUNTIME_FUNCTION(Runtime_RegExpReplace) { |
1276 HandleScope scope(isolate); | 1276 HandleScope scope(isolate); |
1277 DCHECK(args.length() == 3); | 1277 DCHECK(args.length() == 3); |
1278 | 1278 |
1279 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, recv, 0); | 1279 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, recv, 0); |
1280 CONVERT_ARG_HANDLE_CHECKED(String, string, 1); | 1280 CONVERT_ARG_HANDLE_CHECKED(String, string, 1); |
1281 Handle<Object> replace_obj = args.at<Object>(2); | 1281 Handle<Object> replace_obj = args.at(2); |
1282 | 1282 |
1283 Factory* factory = isolate->factory(); | 1283 Factory* factory = isolate->factory(); |
1284 | 1284 |
1285 string = String::Flatten(string); | 1285 string = String::Flatten(string); |
1286 | 1286 |
1287 // Fast-path for unmodified JSRegExps. | 1287 // Fast-path for unmodified JSRegExps. |
1288 if (RegExpUtils::IsUnmodifiedRegExp(isolate, recv)) { | 1288 if (RegExpUtils::IsUnmodifiedRegExp(isolate, recv)) { |
1289 RETURN_RESULT_OR_FAILURE( | 1289 RETURN_RESULT_OR_FAILURE( |
1290 isolate, RegExpReplace(isolate, Handle<JSRegExp>::cast(recv), string, | 1290 isolate, RegExpReplace(isolate, Handle<JSRegExp>::cast(recv), string, |
1291 replace_obj)); | 1291 replace_obj)); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1451 | 1451 |
1452 RUNTIME_FUNCTION(Runtime_IsRegExp) { | 1452 RUNTIME_FUNCTION(Runtime_IsRegExp) { |
1453 SealHandleScope shs(isolate); | 1453 SealHandleScope shs(isolate); |
1454 DCHECK(args.length() == 1); | 1454 DCHECK(args.length() == 1); |
1455 CONVERT_ARG_CHECKED(Object, obj, 0); | 1455 CONVERT_ARG_CHECKED(Object, obj, 0); |
1456 return isolate->heap()->ToBoolean(obj->IsJSRegExp()); | 1456 return isolate->heap()->ToBoolean(obj->IsJSRegExp()); |
1457 } | 1457 } |
1458 | 1458 |
1459 } // namespace internal | 1459 } // namespace internal |
1460 } // namespace v8 | 1460 } // namespace v8 |
OLD | NEW |