OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/regexp.h" | 5 #include "vm/regexp.h" |
6 | 6 |
7 #include "vm/dart_entry.h" | 7 #include "vm/dart_entry.h" |
8 #include "vm/regexp_assembler.h" | 8 #include "vm/regexp_assembler.h" |
9 #include "vm/regexp_assembler_bytecode.h" | 9 #include "vm/regexp_assembler_bytecode.h" |
10 #include "vm/regexp_assembler_ir.h" | 10 #include "vm/regexp_assembler_ir.h" |
(...skipping 4999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5010 | 5010 |
5011 | 5011 |
5012 RegExpEngine::CompilationResult RegExpEngine::CompileIR( | 5012 RegExpEngine::CompilationResult RegExpEngine::CompileIR( |
5013 RegExpCompileData* data, | 5013 RegExpCompileData* data, |
5014 const ParsedFunction* parsed_function, | 5014 const ParsedFunction* parsed_function, |
5015 const ZoneGrowableArray<const ICData*>& ic_data_array) { | 5015 const ZoneGrowableArray<const ICData*>& ic_data_array) { |
5016 ASSERT(!FLAG_interpret_irregexp); | 5016 ASSERT(!FLAG_interpret_irregexp); |
5017 Zone* zone = Thread::Current()->zone(); | 5017 Zone* zone = Thread::Current()->zone(); |
5018 | 5018 |
5019 const Function& function = parsed_function->function(); | 5019 const Function& function = parsed_function->function(); |
5020 const intptr_t specialization_cid = function.regexp_cid(); | 5020 const intptr_t specialization_cid = function.string_specialization_cid(); |
5021 const bool is_one_byte = (specialization_cid == kOneByteStringCid || | 5021 const bool is_one_byte = (specialization_cid == kOneByteStringCid || |
5022 specialization_cid == kExternalOneByteStringCid); | 5022 specialization_cid == kExternalOneByteStringCid); |
5023 JSRegExp& regexp = JSRegExp::Handle(zone, function.regexp()); | 5023 JSRegExp& regexp = JSRegExp::Handle(zone, function.regexp()); |
5024 const String& pattern = String::Handle(zone, regexp.pattern()); | 5024 const String& pattern = String::Handle(zone, regexp.pattern()); |
5025 | 5025 |
5026 ASSERT(!regexp.IsNull()); | 5026 ASSERT(!regexp.IsNull()); |
5027 ASSERT(!pattern.IsNull()); | 5027 ASSERT(!pattern.IsNull()); |
5028 | 5028 |
5029 const bool ignore_case = regexp.is_ignore_case(); | 5029 const bool ignore_case = regexp.is_ignore_case(); |
5030 const bool is_global = regexp.is_global(); | 5030 const bool is_global = regexp.is_global(); |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5277 Heap::kOld))); | 5277 Heap::kOld))); |
5278 fn.SetParameterTypeAt(0, Type::Handle(zone, Type::DynamicType())); | 5278 fn.SetParameterTypeAt(0, Type::Handle(zone, Type::DynamicType())); |
5279 fn.SetParameterNameAt(0, Symbols::string_param()); | 5279 fn.SetParameterNameAt(0, Symbols::string_param()); |
5280 fn.SetParameterTypeAt(1, Type::Handle(zone, Type::DynamicType())); | 5280 fn.SetParameterTypeAt(1, Type::Handle(zone, Type::DynamicType())); |
5281 fn.SetParameterNameAt(1, Symbols::start_index_param()); | 5281 fn.SetParameterNameAt(1, Symbols::start_index_param()); |
5282 fn.set_result_type(Type::Handle(zone, Type::ArrayType())); | 5282 fn.set_result_type(Type::Handle(zone, Type::ArrayType())); |
5283 | 5283 |
5284 // Cache the result. | 5284 // Cache the result. |
5285 regexp.set_function(specialization_cid, fn); | 5285 regexp.set_function(specialization_cid, fn); |
5286 | 5286 |
5287 fn.set_regexp(regexp); | 5287 fn.SetRegExpData(regexp, specialization_cid); |
5288 fn.set_regexp_cid(specialization_cid); | |
5289 fn.set_is_debuggable(false); | 5288 fn.set_is_debuggable(false); |
5290 | 5289 |
5291 // The function is compiled lazily during the first call. | 5290 // The function is compiled lazily during the first call. |
5292 } | 5291 } |
5293 | 5292 |
5294 | 5293 |
5295 RawJSRegExp* RegExpEngine::CreateJSRegExp(Zone* zone, | 5294 RawJSRegExp* RegExpEngine::CreateJSRegExp(Zone* zone, |
5296 const String& pattern, | 5295 const String& pattern, |
5297 bool multi_line, | 5296 bool multi_line, |
5298 bool ignore_case) { | 5297 bool ignore_case) { |
(...skipping 20 matching lines...) Expand all Loading... |
5319 CreateSpecializedFunction(zone, regexp, kOneByteStringCid, owner); | 5318 CreateSpecializedFunction(zone, regexp, kOneByteStringCid, owner); |
5320 CreateSpecializedFunction(zone, regexp, kTwoByteStringCid, owner); | 5319 CreateSpecializedFunction(zone, regexp, kTwoByteStringCid, owner); |
5321 CreateSpecializedFunction(zone, regexp, kExternalOneByteStringCid, owner); | 5320 CreateSpecializedFunction(zone, regexp, kExternalOneByteStringCid, owner); |
5322 CreateSpecializedFunction(zone, regexp, kExternalTwoByteStringCid, owner); | 5321 CreateSpecializedFunction(zone, regexp, kExternalTwoByteStringCid, owner); |
5323 | 5322 |
5324 return regexp.raw(); | 5323 return regexp.raw(); |
5325 } | 5324 } |
5326 | 5325 |
5327 | 5326 |
5328 } // namespace dart | 5327 } // namespace dart |
OLD | NEW |