| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/regexp/regexp-utils.h" | 5 #include "src/regexp/regexp-utils.h" |
| 6 | 6 |
| 7 #include "src/factory.h" | 7 #include "src/factory.h" |
| 8 #include "src/isolate.h" | 8 #include "src/isolate.h" |
| 9 #include "src/objects-inl.h" | 9 #include "src/objects-inl.h" |
| 10 #include "src/regexp/jsregexp.h" | 10 #include "src/regexp/jsregexp.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 Object); | 147 Object); |
| 148 } | 148 } |
| 149 | 149 |
| 150 { | 150 { |
| 151 Handle<JSFunction> regexp_exec = isolate->regexp_exec_function(); | 151 Handle<JSFunction> regexp_exec = isolate->regexp_exec_function(); |
| 152 | 152 |
| 153 const int argc = 1; | 153 const int argc = 1; |
| 154 ScopedVector<Handle<Object>> argv(argc); | 154 ScopedVector<Handle<Object>> argv(argc); |
| 155 argv[0] = string; | 155 argv[0] = string; |
| 156 | 156 |
| 157 return Execution::Call(isolate, exec, regexp_exec, argc, argv.start()); | 157 return Execution::Call(isolate, regexp_exec, regexp, argc, argv.start()); |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 | 160 |
| 161 Maybe<bool> RegExpUtils::IsRegExp(Isolate* isolate, Handle<Object> object) { | 161 Maybe<bool> RegExpUtils::IsRegExp(Isolate* isolate, Handle<Object> object) { |
| 162 if (!object->IsJSReceiver()) return Just(false); | 162 if (!object->IsJSReceiver()) return Just(false); |
| 163 | 163 |
| 164 Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(object); | 164 Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(object); |
| 165 | 165 |
| 166 if (isolate->regexp_function()->initial_map() == receiver->map()) { | 166 if (isolate->regexp_function()->initial_map() == receiver->map()) { |
| 167 // Fast-path for unmodified JSRegExp instances. | 167 // Fast-path for unmodified JSRegExp instances. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 221 |
| 222 const int last_index = Handle<Smi>::cast(last_index_obj)->value(); | 222 const int last_index = Handle<Smi>::cast(last_index_obj)->value(); |
| 223 const int new_last_index = | 223 const int new_last_index = |
| 224 last_index + AdvanceStringIndex(isolate, string, last_index, unicode); | 224 last_index + AdvanceStringIndex(isolate, string, last_index, unicode); |
| 225 | 225 |
| 226 return SetLastIndex(isolate, regexp, new_last_index); | 226 return SetLastIndex(isolate, regexp, new_last_index); |
| 227 } | 227 } |
| 228 | 228 |
| 229 } // namespace internal | 229 } // namespace internal |
| 230 } // namespace v8 | 230 } // namespace v8 |
| OLD | NEW |