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

Side by Side Diff: runtime/vm/regexp_assembler_bytecode.cc

Issue 1969453002: Timeline event for compiling irregexp bytecode. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 months 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 | « no previous file | 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 (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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_assembler_bytecode.h" 5 #include "vm/regexp_assembler_bytecode.h"
6 6
7 #include "vm/regexp_assembler_bytecode_inl.h" 7 #include "vm/regexp_assembler_bytecode_inl.h"
8 #include "vm/exceptions.h" 8 #include "vm/exceptions.h"
9 #include "vm/object_store.h" 9 #include "vm/object_store.h"
10 #include "vm/regexp_bytecodes.h" 10 #include "vm/regexp_bytecodes.h"
11 #include "vm/regexp_assembler.h" 11 #include "vm/regexp_assembler.h"
12 #include "vm/regexp.h" 12 #include "vm/regexp.h"
13 #include "vm/regexp_parser.h" 13 #include "vm/regexp_parser.h"
14 #include "vm/regexp_interpreter.h" 14 #include "vm/regexp_interpreter.h"
15 #include "vm/timeline.h"
15 16
16 namespace dart { 17 namespace dart {
17 18
18 BytecodeRegExpMacroAssembler::BytecodeRegExpMacroAssembler( 19 BytecodeRegExpMacroAssembler::BytecodeRegExpMacroAssembler(
19 ZoneGrowableArray<uint8_t>* buffer, 20 ZoneGrowableArray<uint8_t>* buffer,
20 Zone* zone) 21 Zone* zone)
21 : RegExpMacroAssembler(zone), 22 : RegExpMacroAssembler(zone),
22 buffer_(buffer), 23 buffer_(buffer),
23 pc_(0), 24 pc_(0),
24 advance_current_end_(kInvalidPC) { } 25 advance_current_end_(kInvalidPC) { }
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 454
454 455
455 static intptr_t Prepare(const RegExp& regexp, 456 static intptr_t Prepare(const RegExp& regexp,
456 const String& subject, 457 const String& subject,
457 Zone* zone) { 458 Zone* zone) {
458 bool is_one_byte = subject.IsOneByteString() || 459 bool is_one_byte = subject.IsOneByteString() ||
459 subject.IsExternalOneByteString(); 460 subject.IsExternalOneByteString();
460 461
461 if (regexp.bytecode(is_one_byte) == TypedData::null()) { 462 if (regexp.bytecode(is_one_byte) == TypedData::null()) {
462 const String& pattern = String::Handle(zone, regexp.pattern()); 463 const String& pattern = String::Handle(zone, regexp.pattern());
464 NOT_IN_PRODUCT(TimelineDurationScope tds(Thread::Current(),
465 Timeline::GetCompilerStream(),
466 "CompileIrregexpBytecode");
467 if (tds.enabled()) {
468 tds.SetNumArguments(1);
469 tds.CopyArgument(0, "pattern", pattern.ToCString());
470 }); // !PRODUCT
463 471
464 const bool multiline = regexp.is_multi_line(); 472 const bool multiline = regexp.is_multi_line();
465 RegExpCompileData* compile_data = new(zone) RegExpCompileData(); 473 RegExpCompileData* compile_data = new(zone) RegExpCompileData();
466 if (!RegExpParser::ParseRegExp(pattern, multiline, compile_data)) { 474 if (!RegExpParser::ParseRegExp(pattern, multiline, compile_data)) {
467 // Parsing failures are handled in the RegExp factory constructor. 475 // Parsing failures are handled in the RegExp factory constructor.
468 UNREACHABLE(); 476 UNREACHABLE();
469 } 477 }
470 478
471 regexp.set_num_bracket_expressions(compile_data->capture_count); 479 regexp.set_num_bracket_expressions(compile_data->capture_count);
472 if (compile_data->simple) { 480 if (compile_data->simple) {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 } 593 }
586 if (result == IrregexpInterpreter::RE_EXCEPTION) { 594 if (result == IrregexpInterpreter::RE_EXCEPTION) {
587 UNREACHABLE(); 595 UNREACHABLE();
588 } 596 }
589 ASSERT(result == IrregexpInterpreter::RE_FAILURE); 597 ASSERT(result == IrregexpInterpreter::RE_FAILURE);
590 return Instance::null(); 598 return Instance::null();
591 } 599 }
592 600
593 601
594 } // namespace dart 602 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698