OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // Generic RegExp methods. Dispatches to implementation specific methods. | 168 // Generic RegExp methods. Dispatches to implementation specific methods. |
169 | 169 |
170 | 170 |
171 Handle<Object> RegExpImpl::Compile(Handle<JSRegExp> re, | 171 Handle<Object> RegExpImpl::Compile(Handle<JSRegExp> re, |
172 Handle<String> pattern, | 172 Handle<String> pattern, |
173 Handle<String> flag_str) { | 173 Handle<String> flag_str) { |
174 Isolate* isolate = re->GetIsolate(); | 174 Isolate* isolate = re->GetIsolate(); |
175 Zone zone(isolate); | 175 Zone zone(isolate); |
176 JSRegExp::Flags flags = RegExpFlagsFromString(flag_str); | 176 JSRegExp::Flags flags = RegExpFlagsFromString(flag_str); |
177 CompilationCache* compilation_cache = isolate->compilation_cache(); | 177 CompilationCache* compilation_cache = isolate->compilation_cache(); |
178 Handle<FixedArray> cached = compilation_cache->LookupRegExp(pattern, flags); | 178 MaybeHandle<FixedArray> maybe_cached = |
179 bool in_cache = !cached.is_null(); | 179 compilation_cache->LookupRegExp(pattern, flags); |
| 180 Handle<FixedArray> cached; |
| 181 bool in_cache = maybe_cached.ToHandle(&cached); |
180 LOG(isolate, RegExpCompileEvent(re, in_cache)); | 182 LOG(isolate, RegExpCompileEvent(re, in_cache)); |
181 | 183 |
182 Handle<Object> result; | 184 Handle<Object> result; |
183 if (in_cache) { | 185 if (in_cache) { |
184 re->set_data(*cached); | 186 re->set_data(*cached); |
185 return re; | 187 return re; |
186 } | 188 } |
187 pattern = FlattenGetString(pattern); | 189 pattern = FlattenGetString(pattern); |
188 PostponeInterruptsScope postpone(isolate); | 190 PostponeInterruptsScope postpone(isolate); |
189 RegExpCompileData parse_result; | 191 RegExpCompileData parse_result; |
(...skipping 5935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6125 } | 6127 } |
6126 | 6128 |
6127 return compiler.Assemble(¯o_assembler, | 6129 return compiler.Assemble(¯o_assembler, |
6128 node, | 6130 node, |
6129 data->capture_count, | 6131 data->capture_count, |
6130 pattern); | 6132 pattern); |
6131 } | 6133 } |
6132 | 6134 |
6133 | 6135 |
6134 }} // namespace v8::internal | 6136 }} // namespace v8::internal |
OLD | NEW |