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

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

Issue 2551443002: [regexp] Migrate constructor and compile to CSA (Closed)
Patch Set: Remove unused variables 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
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 return Execution::Call(isolate, regexp_exec, regexp, argc, argv.start()); 112 return Execution::Call(isolate, regexp_exec, regexp, argc, argv.start());
113 } 113 }
114 } 114 }
115 115
116 Maybe<bool> RegExpUtils::IsRegExp(Isolate* isolate, Handle<Object> object) { 116 Maybe<bool> RegExpUtils::IsRegExp(Isolate* isolate, Handle<Object> object) {
117 if (!object->IsJSReceiver()) return Just(false); 117 if (!object->IsJSReceiver()) return Just(false);
118 118
119 Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(object); 119 Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(object);
120 120
121 if (isolate->regexp_function()->initial_map() == receiver->map()) {
122 // Fast-path for unmodified JSRegExp instances.
123 // TODO(ishell): Adapt for new fast-path logic.
124 return Just(true);
125 }
126
127 Handle<Object> match; 121 Handle<Object> match;
128 ASSIGN_RETURN_ON_EXCEPTION_VALUE( 122 ASSIGN_RETURN_ON_EXCEPTION_VALUE(
129 isolate, match, 123 isolate, match,
130 JSObject::GetProperty(receiver, isolate->factory()->match_symbol()), 124 JSObject::GetProperty(receiver, isolate->factory()->match_symbol()),
131 Nothing<bool>()); 125 Nothing<bool>());
132 126
133 if (!match->IsUndefined(isolate)) return Just(match->BooleanValue()); 127 if (!match->IsUndefined(isolate)) return Just(match->BooleanValue());
134 return Just(object->IsJSRegExp()); 128 return Just(object->IsJSRegExp());
135 } 129 }
136 130
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 177
184 const int last_index = Handle<Smi>::cast(last_index_obj)->value(); 178 const int last_index = Handle<Smi>::cast(last_index_obj)->value();
185 const int new_last_index = 179 const int new_last_index =
186 AdvanceStringIndex(isolate, string, last_index, unicode); 180 AdvanceStringIndex(isolate, string, last_index, unicode);
187 181
188 return SetLastIndex(isolate, regexp, new_last_index); 182 return SetLastIndex(isolate, regexp, new_last_index);
189 } 183 }
190 184
191 } // namespace internal 185 } // namespace internal
192 } // namespace v8 186 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698