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

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

Issue 1589643002: Source positions for constructors and lots of async machinery (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 | « runtime/vm/raw_object_snapshot.cc ('k') | runtime/vm/runtime_entry.cc » ('j') | 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) 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_assembler_ir.h" 5 #include "vm/regexp_assembler_ir.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 18 matching lines...) Expand all
29 String::Handle(String::New(__FUNCTION__)), Heap::kOld)))))); 29 String::Handle(String::New(__FUNCTION__)), Heap::kOld))))));
30 30
31 #define PRINT(arg) if (FLAG_trace_irregexp) { Print(arg); } 31 #define PRINT(arg) if (FLAG_trace_irregexp) { Print(arg); }
32 32
33 namespace dart { 33 namespace dart {
34 34
35 DEFINE_FLAG(bool, trace_irregexp, false, "Trace irregexps"); 35 DEFINE_FLAG(bool, trace_irregexp, false, "Trace irregexps");
36 36
37 37
38 static const intptr_t kInvalidTryIndex = CatchClauseNode::kInvalidTryIndex; 38 static const intptr_t kInvalidTryIndex = CatchClauseNode::kInvalidTryIndex;
39 static const intptr_t kNoSourcePos = Scanner::kNoSourcePos; 39 static const intptr_t kNoSourcePos = Token::kNoSourcePos;
40 static const intptr_t kMinStackSize = 512; 40 static const intptr_t kMinStackSize = 512;
41 41
42 42
43 void PrintUtf16(uint16_t c) { 43 void PrintUtf16(uint16_t c) {
44 const char* format = (0x20 <= c && c <= 0x7F) ? 44 const char* format = (0x20 <= c && c <= 0x7F) ?
45 "%c" : (c <= 0xff) ? "\\x%02x" : "\\u%04x"; 45 "%c" : (c <= 0xff) ? "\\x%02x" : "\\u%04x";
46 OS::Print(format, c); 46 OS::Print(format, c);
47 } 47 }
48 48
49 49
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 desc.name, 581 desc.name,
582 desc.token_kind, 582 desc.token_kind,
583 arguments, 583 arguments,
584 Object::null_array(), 584 Object::null_array(),
585 desc.checked_argument_count, 585 desc.checked_argument_count,
586 ic_data_array_); 586 ic_data_array_);
587 } 587 }
588 588
589 589
590 LoadLocalInstr* IRRegExpMacroAssembler::LoadLocal(LocalVariable* local) const { 590 LoadLocalInstr* IRRegExpMacroAssembler::LoadLocal(LocalVariable* local) const {
591 return new(Z) LoadLocalInstr(*local); 591 return new(Z) LoadLocalInstr(*local, kNoSourcePos);
592 } 592 }
593 593
594 594
595 void IRRegExpMacroAssembler::StoreLocal(LocalVariable* local, 595 void IRRegExpMacroAssembler::StoreLocal(LocalVariable* local,
596 Value* value) { 596 Value* value) {
597 Do(new(Z) StoreLocalInstr(*local, value)); 597 Do(new(Z) StoreLocalInstr(*local, value, kNoSourcePos));
598 } 598 }
599 599
600 600
601 void IRRegExpMacroAssembler::set_current_instruction(Instruction* instruction) { 601 void IRRegExpMacroAssembler::set_current_instruction(Instruction* instruction) {
602 current_instruction_ = instruction; 602 current_instruction_ = instruction;
603 } 603 }
604 604
605 605
606 Value* IRRegExpMacroAssembler::Bind(Definition* definition) { 606 Value* IRRegExpMacroAssembler::Bind(Definition* definition) {
607 AppendInstruction(definition); 607 AppendInstruction(definition);
608 definition->set_temp_index(temp_id_.Alloc()); 608 definition->set_temp_index(temp_id_.Alloc());
609 609
610 return new(Z) Value(definition); 610 return new(Z) Value(definition);
611 } 611 }
612 612
613 613
614 void IRRegExpMacroAssembler::Do(Definition* definition) { 614 void IRRegExpMacroAssembler::Do(Definition* definition) {
615 AppendInstruction(definition); 615 AppendInstruction(definition);
616 } 616 }
617 617
618 618
619 Value* IRRegExpMacroAssembler::BindLoadLocal(const LocalVariable& local) { 619 Value* IRRegExpMacroAssembler::BindLoadLocal(const LocalVariable& local) {
620 if (local.IsConst()) { 620 if (local.IsConst()) {
621 return Bind(new(Z) ConstantInstr(*local.ConstValue())); 621 return Bind(new(Z) ConstantInstr(*local.ConstValue()));
622 } 622 }
623 ASSERT(!local.is_captured()); 623 ASSERT(!local.is_captured());
624 return Bind(new(Z) LoadLocalInstr(local)); 624 return Bind(new(Z) LoadLocalInstr(local, kNoSourcePos));
625 } 625 }
626 626
627 627
628 // In some cases, the V8 irregexp engine generates unreachable code by emitting 628 // In some cases, the V8 irregexp engine generates unreachable code by emitting
629 // a jmp not followed by a bind. We cannot do the same, since it is impossible 629 // a jmp not followed by a bind. We cannot do the same, since it is impossible
630 // to append to a block following a jmp. In such cases, assume that we are doing 630 // to append to a block following a jmp. In such cases, assume that we are doing
631 // the correct thing, but output a warning when tracing. 631 // the correct thing, but output a warning when tracing.
632 #define HANDLE_DEAD_CODE_EMISSION() \ 632 #define HANDLE_DEAD_CODE_EMISSION() \
633 if (current_instruction_ == NULL) { \ 633 if (current_instruction_ == NULL) { \
634 if (FLAG_trace_irregexp) { \ 634 if (FLAG_trace_irregexp) { \
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1917 } 1917 }
1918 1918
1919 // Here pattern_val might be untagged so this must not trigger a GC. 1919 // Here pattern_val might be untagged so this must not trigger a GC.
1920 Value* index_val = BindLoadLocal(*index); 1920 Value* index_val = BindLoadLocal(*index);
1921 1921
1922 return Bind(new(Z) LoadCodeUnitsInstr( 1922 return Bind(new(Z) LoadCodeUnitsInstr(
1923 pattern_val, 1923 pattern_val,
1924 index_val, 1924 index_val,
1925 characters, 1925 characters,
1926 specialization_cid_, 1926 specialization_cid_,
1927 Scanner::kNoSourcePos)); 1927 kNoSourcePos));
1928 } 1928 }
1929 1929
1930 1930
1931 #undef __ 1931 #undef __
1932 1932
1933 } // namespace dart 1933 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object_snapshot.cc ('k') | runtime/vm/runtime_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698