Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: src/regexp/regexp-utils.cc

Issue 2587013002: [runtime] Add fast-paths for common conversion methods (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 177 const int last_index = PositiveNumberToUint32(*last_index_obj);
178 const int last_index = Handle<Smi>::cast(last_index_obj)->value();
179 const int new_last_index = 178 const int new_last_index =
180 AdvanceStringIndex(isolate, string, last_index, unicode); 179 AdvanceStringIndex(isolate, string, last_index, unicode);
181 180
182 return SetLastIndex(isolate, regexp, new_last_index); 181 return SetLastIndex(isolate, regexp, new_last_index);
183 } 182 }
184 183
185 } // namespace internal 184 } // namespace internal
186 } // namespace v8 185 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698