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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 Isolate* isolate, Handle<JSReceiver> regexp, Handle<String> string, | 167 Isolate* isolate, Handle<JSReceiver> regexp, Handle<String> string, |
168 bool unicode) { | 168 bool unicode) { |
169 Handle<Object> last_index_obj; | 169 Handle<Object> last_index_obj; |
170 ASSIGN_RETURN_ON_EXCEPTION( | 170 ASSIGN_RETURN_ON_EXCEPTION( |
171 isolate, last_index_obj, | 171 isolate, last_index_obj, |
172 Object::GetProperty(regexp, isolate->factory()->lastIndex_string()), | 172 Object::GetProperty(regexp, isolate->factory()->lastIndex_string()), |
173 Object); | 173 Object); |
174 | 174 |
175 ASSIGN_RETURN_ON_EXCEPTION(isolate, last_index_obj, | 175 ASSIGN_RETURN_ON_EXCEPTION(isolate, last_index_obj, |
176 Object::ToLength(isolate, last_index_obj), Object); | 176 Object::ToLength(isolate, last_index_obj), Object); |
177 const int last_index = PositiveNumberToUint32(*last_index_obj); | 177 |
| 178 const int last_index = Handle<Smi>::cast(last_index_obj)->value(); |
178 const int new_last_index = | 179 const int new_last_index = |
179 AdvanceStringIndex(isolate, string, last_index, unicode); | 180 AdvanceStringIndex(isolate, string, last_index, unicode); |
180 | 181 |
181 return SetLastIndex(isolate, regexp, new_last_index); | 182 return SetLastIndex(isolate, regexp, new_last_index); |
182 } | 183 } |
183 | 184 |
184 } // namespace internal | 185 } // namespace internal |
185 } // namespace v8 | 186 } // namespace v8 |
OLD | NEW |