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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/jsregexp-inl.h" | 8 #include "src/jsregexp-inl.h" |
9 #include "src/jsregexp.h" | 9 #include "src/jsregexp.h" |
10 #include "src/runtime/runtime-utils.h" | 10 #include "src/runtime/runtime-utils.h" |
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
922 DCHECK(args.length() == 4); | 922 DCHECK(args.length() == 4); |
923 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); | 923 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); |
924 CONVERT_SMI_ARG_CHECKED(index, 1); | 924 CONVERT_SMI_ARG_CHECKED(index, 1); |
925 CONVERT_ARG_HANDLE_CHECKED(String, pattern, 2); | 925 CONVERT_ARG_HANDLE_CHECKED(String, pattern, 2); |
926 CONVERT_ARG_HANDLE_CHECKED(String, flags, 3); | 926 CONVERT_ARG_HANDLE_CHECKED(String, flags, 3); |
927 | 927 |
928 // Get the RegExp function from the context in the literals array. | 928 // Get the RegExp function from the context in the literals array. |
929 // This is the RegExp function from the context in which the | 929 // This is the RegExp function from the context in which the |
930 // function was created. We do not use the RegExp function from the | 930 // function was created. We do not use the RegExp function from the |
931 // current native context because this might be the RegExp function | 931 // current native context because this might be the RegExp function |
932 // from another context which we should not have access to. | 932 // from another context which we should not have access to. |
Michael Starzinger
2015/02/25 21:32:33
nit: The entire comment is obsolete. Let's drop it
Toon Verwaest
2015/02/25 21:57:47
Done.
| |
933 Handle<JSFunction> constructor = Handle<JSFunction>( | 933 Handle<JSFunction> constructor = isolate->regexp_function(); |
934 JSFunction::NativeContextFromLiterals(*literals)->regexp_function()); | |
935 // Compute the regular expression literal. | 934 // Compute the regular expression literal. |
936 Handle<Object> regexp; | 935 Handle<Object> regexp; |
937 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 936 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
938 isolate, regexp, | 937 isolate, regexp, |
939 RegExpImpl::CreateRegExpLiteral(constructor, pattern, flags)); | 938 RegExpImpl::CreateRegExpLiteral(constructor, pattern, flags)); |
940 literals->set(index, *regexp); | 939 literals->set(index, *regexp); |
941 return *regexp; | 940 return *regexp; |
942 } | 941 } |
943 | 942 |
944 | 943 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1123 | 1122 |
1124 | 1123 |
1125 RUNTIME_FUNCTION(RuntimeReference_IsRegExp) { | 1124 RUNTIME_FUNCTION(RuntimeReference_IsRegExp) { |
1126 SealHandleScope shs(isolate); | 1125 SealHandleScope shs(isolate); |
1127 DCHECK(args.length() == 1); | 1126 DCHECK(args.length() == 1); |
1128 CONVERT_ARG_CHECKED(Object, obj, 0); | 1127 CONVERT_ARG_CHECKED(Object, obj, 0); |
1129 return isolate->heap()->ToBoolean(obj->IsJSRegExp()); | 1128 return isolate->heap()->ToBoolean(obj->IsJSRegExp()); |
1130 } | 1129 } |
1131 } | 1130 } |
1132 } // namespace v8::internal | 1131 } // namespace v8::internal |
OLD | NEW |