| Index: runtime/vm/regexp_assembler_ir.cc
|
| diff --git a/runtime/vm/regexp_assembler_ir.cc b/runtime/vm/regexp_assembler_ir.cc
|
| index 3098c649d805eda988457b2b45c4b4692e91d0a4..2d4832910c5fedeb622855aff6bb439dafd5b609 100644
|
| --- a/runtime/vm/regexp_assembler_ir.cc
|
| +++ b/runtime/vm/regexp_assembler_ir.cc
|
| @@ -40,7 +40,6 @@ namespace dart {
|
| static const intptr_t kInvalidTryIndex = CatchClauseNode::kInvalidTryIndex;
|
| static const intptr_t kMinStackSize = 512;
|
|
|
| -
|
| /*
|
| * This assembler uses the following main local variables:
|
| * - stack_: A pointer to a growable list which we use as an all-purpose stack
|
| @@ -142,10 +141,8 @@ IRRegExpMacroAssembler::IRRegExpMacroAssembler(
|
| set_current_instruction(start_block_);
|
| }
|
|
|
| -
|
| IRRegExpMacroAssembler::~IRRegExpMacroAssembler() {}
|
|
|
| -
|
| void IRRegExpMacroAssembler::InitializeLocals() {
|
| // All generated functions are expected to have a current-context variable.
|
| // This variable is unused in irregexp functions.
|
| @@ -173,7 +170,6 @@ void IRRegExpMacroAssembler::InitializeLocals() {
|
| RegExpMacroAssembler::kParamStartOffsetIndex);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::GenerateEntryBlock() {
|
| set_current_instruction(entry_block_->normal_entry());
|
| TAG();
|
| @@ -211,7 +207,6 @@ void IRRegExpMacroAssembler::GenerateEntryBlock() {
|
| current_instruction_->Goto(start_block_);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::GenerateBacktrackBlock() {
|
| set_current_instruction(backtrack_block_);
|
| TAG();
|
| @@ -240,7 +235,6 @@ void IRRegExpMacroAssembler::GenerateBacktrackBlock() {
|
| }
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::GenerateSuccessBlock() {
|
| set_current_instruction(success_block_);
|
| TAG();
|
| @@ -276,7 +270,6 @@ void IRRegExpMacroAssembler::GenerateSuccessBlock() {
|
| TokenPosition::kNoSource, Bind(LoadLocal(result_)), GetNextDeoptId()));
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::GenerateExitBlock() {
|
| set_current_instruction(exit_block_);
|
| TAG();
|
| @@ -286,14 +279,12 @@ void IRRegExpMacroAssembler::GenerateExitBlock() {
|
| TokenPosition::kNoSource, Bind(LoadLocal(result_)), GetNextDeoptId()));
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::FinalizeRegistersArray() {
|
| ASSERT(registers_count_ >= saved_registers_count_);
|
| registers_array_ =
|
| TypedData::New(kTypedDataInt32ArrayCid, registers_count_, Heap::kOld);
|
| }
|
|
|
| -
|
| #if defined(TARGET_ARCH_ARM64) || defined(TARGET_ARCH_ARM)
|
| // Disabling unaligned accesses forces the regexp engine to load characters one
|
| // by one instead of up to 4 at once, along with the associated performance hit.
|
| @@ -308,7 +299,6 @@ bool IRRegExpMacroAssembler::CanReadUnaligned() {
|
| return kEnableUnalignedAccesses && !slow_safe();
|
| }
|
|
|
| -
|
| RawArray* IRRegExpMacroAssembler::Execute(const RegExp& regexp,
|
| const String& input,
|
| const Smi& start_offset,
|
| @@ -343,7 +333,6 @@ RawArray* IRRegExpMacroAssembler::Execute(const RegExp& regexp,
|
| return Array::Cast(retval).raw();
|
| }
|
|
|
| -
|
| LocalVariable* IRRegExpMacroAssembler::Parameter(const String& name,
|
| intptr_t index) const {
|
| LocalVariable* local =
|
| @@ -356,7 +345,6 @@ LocalVariable* IRRegExpMacroAssembler::Parameter(const String& name,
|
| return local;
|
| }
|
|
|
| -
|
| LocalVariable* IRRegExpMacroAssembler::Local(const String& name) {
|
| LocalVariable* local =
|
| new (Z) LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
|
| @@ -366,30 +354,25 @@ LocalVariable* IRRegExpMacroAssembler::Local(const String& name) {
|
| return local;
|
| }
|
|
|
| -
|
| ConstantInstr* IRRegExpMacroAssembler::Int64Constant(int64_t value) const {
|
| return new (Z)
|
| ConstantInstr(Integer::ZoneHandle(Z, Integer::New(value, Heap::kOld)));
|
| }
|
|
|
| -
|
| ConstantInstr* IRRegExpMacroAssembler::Uint64Constant(uint64_t value) const {
|
| return new (Z) ConstantInstr(
|
| Integer::ZoneHandle(Z, Integer::NewFromUint64(value, Heap::kOld)));
|
| }
|
|
|
| -
|
| ConstantInstr* IRRegExpMacroAssembler::BoolConstant(bool value) const {
|
| return new (Z) ConstantInstr(value ? Bool::True() : Bool::False());
|
| }
|
|
|
| -
|
| ConstantInstr* IRRegExpMacroAssembler::StringConstant(const char* value) const {
|
| return new (Z)
|
| ConstantInstr(String::ZoneHandle(Z, String::New(value, Heap::kOld)));
|
| }
|
|
|
| -
|
| ConstantInstr* IRRegExpMacroAssembler::WordCharacterMapConstant() const {
|
| const Library& lib = Library::Handle(Z, Library::CoreLibrary());
|
| const Class& regexp_class =
|
| @@ -409,7 +392,6 @@ ConstantInstr* IRRegExpMacroAssembler::WordCharacterMapConstant() const {
|
| Instance::ZoneHandle(Z, word_character_field.StaticValue()));
|
| }
|
|
|
| -
|
| ComparisonInstr* IRRegExpMacroAssembler::Comparison(ComparisonKind kind,
|
| PushArgumentInstr* lhs,
|
| PushArgumentInstr* rhs) {
|
| @@ -458,7 +440,6 @@ ComparisonInstr* IRRegExpMacroAssembler::Comparison(ComparisonKind kind,
|
| return Comparison(kind, lhs_push, rhs_push);
|
| }
|
|
|
| -
|
| StaticCallInstr* IRRegExpMacroAssembler::StaticCall(
|
| const Function& function) const {
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
| @@ -466,7 +447,6 @@ StaticCallInstr* IRRegExpMacroAssembler::StaticCall(
|
| return StaticCall(function, arguments);
|
| }
|
|
|
| -
|
| StaticCallInstr* IRRegExpMacroAssembler::StaticCall(
|
| const Function& function,
|
| PushArgumentInstr* arg1) const {
|
| @@ -477,7 +457,6 @@ StaticCallInstr* IRRegExpMacroAssembler::StaticCall(
|
| return StaticCall(function, arguments);
|
| }
|
|
|
| -
|
| StaticCallInstr* IRRegExpMacroAssembler::StaticCall(
|
| const Function& function,
|
| PushArgumentInstr* arg1,
|
| @@ -490,7 +469,6 @@ StaticCallInstr* IRRegExpMacroAssembler::StaticCall(
|
| return StaticCall(function, arguments);
|
| }
|
|
|
| -
|
| StaticCallInstr* IRRegExpMacroAssembler::StaticCall(
|
| const Function& function,
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments) const {
|
| @@ -500,7 +478,6 @@ StaticCallInstr* IRRegExpMacroAssembler::StaticCall(
|
| ic_data_array_, GetNextDeoptId());
|
| }
|
|
|
| -
|
| InstanceCallInstr* IRRegExpMacroAssembler::InstanceCall(
|
| const InstanceCallDescriptor& desc,
|
| PushArgumentInstr* arg1) const {
|
| @@ -511,7 +488,6 @@ InstanceCallInstr* IRRegExpMacroAssembler::InstanceCall(
|
| return InstanceCall(desc, arguments);
|
| }
|
|
|
| -
|
| InstanceCallInstr* IRRegExpMacroAssembler::InstanceCall(
|
| const InstanceCallDescriptor& desc,
|
| PushArgumentInstr* arg1,
|
| @@ -524,7 +500,6 @@ InstanceCallInstr* IRRegExpMacroAssembler::InstanceCall(
|
| return InstanceCall(desc, arguments);
|
| }
|
|
|
| -
|
| InstanceCallInstr* IRRegExpMacroAssembler::InstanceCall(
|
| const InstanceCallDescriptor& desc,
|
| PushArgumentInstr* arg1,
|
| @@ -539,7 +514,6 @@ InstanceCallInstr* IRRegExpMacroAssembler::InstanceCall(
|
| return InstanceCall(desc, arguments);
|
| }
|
|
|
| -
|
| InstanceCallInstr* IRRegExpMacroAssembler::InstanceCall(
|
| const InstanceCallDescriptor& desc,
|
| ZoneGrowableArray<PushArgumentInstr*>* arguments) const {
|
| @@ -550,22 +524,18 @@ InstanceCallInstr* IRRegExpMacroAssembler::InstanceCall(
|
| ic_data_array_, GetNextDeoptId());
|
| }
|
|
|
| -
|
| LoadLocalInstr* IRRegExpMacroAssembler::LoadLocal(LocalVariable* local) const {
|
| return new (Z) LoadLocalInstr(*local, TokenPosition::kNoSource);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::StoreLocal(LocalVariable* local, Value* value) {
|
| Do(new (Z) StoreLocalInstr(*local, value, TokenPosition::kNoSource));
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::set_current_instruction(Instruction* instruction) {
|
| current_instruction_ = instruction;
|
| }
|
|
|
| -
|
| Value* IRRegExpMacroAssembler::Bind(Definition* definition) {
|
| AppendInstruction(definition);
|
| definition->set_temp_index(temp_id_.Alloc());
|
| @@ -573,12 +543,10 @@ Value* IRRegExpMacroAssembler::Bind(Definition* definition) {
|
| return new (Z) Value(definition);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::Do(Definition* definition) {
|
| AppendInstruction(definition);
|
| }
|
|
|
| -
|
| Value* IRRegExpMacroAssembler::BindLoadLocal(const LocalVariable& local) {
|
| if (local.IsConst()) {
|
| return Bind(new (Z) ConstantInstr(*local.ConstValue()));
|
| @@ -587,7 +555,6 @@ Value* IRRegExpMacroAssembler::BindLoadLocal(const LocalVariable& local) {
|
| return Bind(new (Z) LoadLocalInstr(local, TokenPosition::kNoSource));
|
| }
|
|
|
| -
|
| // In some cases, the V8 irregexp engine generates unreachable code by emitting
|
| // a jmp not followed by a bind. We cannot do the same, since it is impossible
|
| // to append to a block following a jmp. In such cases, assume that we are doing
|
| @@ -617,7 +584,6 @@ void IRRegExpMacroAssembler::AppendInstruction(Instruction* instruction) {
|
| set_current_instruction(instruction);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::CloseBlockWith(Instruction* instruction) {
|
| HANDLE_DEAD_CODE_EMISSION();
|
|
|
| @@ -631,7 +597,6 @@ void IRRegExpMacroAssembler::CloseBlockWith(Instruction* instruction) {
|
| set_current_instruction(NULL);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::GoTo(BlockLabel* to) {
|
| if (to == NULL) {
|
| Backtrack();
|
| @@ -641,7 +606,6 @@ void IRRegExpMacroAssembler::GoTo(BlockLabel* to) {
|
| }
|
| }
|
|
|
| -
|
| // Closes the current block with a goto, and unsets current_instruction_.
|
| // BindBlock() must be called before emission can continue.
|
| void IRRegExpMacroAssembler::GoTo(JoinEntryInstr* to) {
|
| @@ -653,7 +617,6 @@ void IRRegExpMacroAssembler::GoTo(JoinEntryInstr* to) {
|
| set_current_instruction(NULL);
|
| }
|
|
|
| -
|
| PushArgumentInstr* IRRegExpMacroAssembler::PushArgument(Value* value) {
|
| arg_id_.Alloc();
|
| PushArgumentInstr* push = new (Z) PushArgumentInstr(value);
|
| @@ -662,18 +625,15 @@ PushArgumentInstr* IRRegExpMacroAssembler::PushArgument(Value* value) {
|
| return push;
|
| }
|
|
|
| -
|
| PushArgumentInstr* IRRegExpMacroAssembler::PushLocal(LocalVariable* local) {
|
| return PushArgument(Bind(LoadLocal(local)));
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::Print(const char* str) {
|
| Print(PushArgument(Bind(new (Z) ConstantInstr(
|
| String::ZoneHandle(Z, String::New(str, Heap::kOld))))));
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::Print(PushArgumentInstr* argument) {
|
| const Library& lib = Library::Handle(Library::CoreLibrary());
|
| const Function& print_fn =
|
| @@ -681,19 +641,16 @@ void IRRegExpMacroAssembler::Print(PushArgumentInstr* argument) {
|
| Do(StaticCall(print_fn, argument));
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::PrintBlocks() {
|
| for (intptr_t i = 0; i < blocks_.length(); i++) {
|
| FlowGraphPrinter::PrintBlock(blocks_[i], false);
|
| }
|
| }
|
|
|
| -
|
| intptr_t IRRegExpMacroAssembler::stack_limit_slack() {
|
| return 32;
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::AdvanceCurrentPosition(intptr_t by) {
|
| TAG();
|
| if (by != 0) {
|
| @@ -705,7 +662,6 @@ void IRRegExpMacroAssembler::AdvanceCurrentPosition(intptr_t by) {
|
| }
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::AdvanceRegister(intptr_t reg, intptr_t by) {
|
| TAG();
|
| ASSERT(reg >= 0);
|
| @@ -721,13 +677,11 @@ void IRRegExpMacroAssembler::AdvanceRegister(intptr_t reg, intptr_t by) {
|
| }
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::Backtrack() {
|
| TAG();
|
| GoTo(backtrack_block_);
|
| }
|
|
|
| -
|
| // A BindBlock is analogous to assigning a label to a basic block.
|
| // If the BlockLabel does not yet contain a block, it is created.
|
| // If there is a current instruction, append a goto to the bound block.
|
| @@ -747,13 +701,11 @@ void IRRegExpMacroAssembler::BindBlock(BlockLabel* label) {
|
| PRINT(PushArgument(Bind(Uint64Constant(label->block()->block_id()))));
|
| }
|
|
|
| -
|
| intptr_t IRRegExpMacroAssembler::GetNextLocalIndex() {
|
| intptr_t id = local_id_.Alloc();
|
| return kFirstLocalSlotFromFp - id;
|
| }
|
|
|
| -
|
| Value* IRRegExpMacroAssembler::LoadRegister(intptr_t index) {
|
| PushArgumentInstr* registers_push = PushLocal(registers_);
|
| PushArgumentInstr* index_push = PushRegisterIndex(index);
|
| @@ -768,7 +720,6 @@ void IRRegExpMacroAssembler::StoreRegister(intptr_t index, intptr_t value) {
|
| StoreRegister(registers_push, index_push, value_push);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::StoreRegister(PushArgumentInstr* registers,
|
| PushArgumentInstr* index,
|
| PushArgumentInstr* value) {
|
| @@ -784,7 +735,6 @@ PushArgumentInstr* IRRegExpMacroAssembler::PushRegisterIndex(intptr_t index) {
|
| return PushArgument(Bind(Uint64Constant(index)));
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::CheckCharacter(uint32_t c, BlockLabel* on_equal) {
|
| TAG();
|
| Definition* cur_char_def = LoadLocal(current_character_);
|
| @@ -793,7 +743,6 @@ void IRRegExpMacroAssembler::CheckCharacter(uint32_t c, BlockLabel* on_equal) {
|
| BranchOrBacktrack(Comparison(kEQ, cur_char_def, char_def), on_equal);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::CheckCharacterGT(uint16_t limit,
|
| BlockLabel* on_greater) {
|
| TAG();
|
| @@ -802,7 +751,6 @@ void IRRegExpMacroAssembler::CheckCharacterGT(uint16_t limit,
|
| on_greater);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::CheckAtStart(BlockLabel* on_at_start) {
|
| TAG();
|
|
|
| @@ -824,7 +772,6 @@ void IRRegExpMacroAssembler::CheckAtStart(BlockLabel* on_at_start) {
|
| BindBlock(¬_at_start);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::CheckNotAtStart(BlockLabel* on_not_at_start) {
|
| TAG();
|
|
|
| @@ -842,7 +789,6 @@ void IRRegExpMacroAssembler::CheckNotAtStart(BlockLabel* on_not_at_start) {
|
| BranchOrBacktrack(Comparison(kNE, neg_len_def, offset_def), on_not_at_start);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::CheckCharacterLT(uint16_t limit,
|
| BlockLabel* on_less) {
|
| TAG();
|
| @@ -851,7 +797,6 @@ void IRRegExpMacroAssembler::CheckCharacterLT(uint16_t limit,
|
| on_less);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::CheckGreedyLoop(BlockLabel* on_equal) {
|
| TAG();
|
|
|
| @@ -869,7 +814,6 @@ void IRRegExpMacroAssembler::CheckGreedyLoop(BlockLabel* on_equal) {
|
| BindBlock(&fallthrough);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::CheckNotBackReferenceIgnoreCase(
|
| intptr_t start_reg,
|
| BlockLabel* on_no_match) {
|
| @@ -897,7 +841,6 @@ void IRRegExpMacroAssembler::CheckNotBackReferenceIgnoreCase(
|
| Comparison(kEQ, LoadLocal(capture_length_), Uint64Constant(0)),
|
| &fallthrough);
|
|
|
| -
|
| // Check that there are sufficient characters left in the input.
|
| PushArgumentInstr* pos_push = PushLocal(current_position_);
|
| PushArgumentInstr* len_push = PushLocal(capture_length_);
|
| @@ -1019,7 +962,6 @@ void IRRegExpMacroAssembler::CheckNotBackReferenceIgnoreCase(
|
| BindBlock(&fallthrough);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::CheckNotBackReference(intptr_t start_reg,
|
| BlockLabel* on_no_match) {
|
| TAG();
|
| @@ -1100,7 +1042,6 @@ void IRRegExpMacroAssembler::CheckNotBackReference(intptr_t start_reg,
|
| BindBlock(&fallthrough);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::CheckNotCharacter(uint32_t c,
|
| BlockLabel* on_not_equal) {
|
| TAG();
|
| @@ -1109,7 +1050,6 @@ void IRRegExpMacroAssembler::CheckNotCharacter(uint32_t c,
|
| on_not_equal);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::CheckCharacterAfterAnd(uint32_t c,
|
| uint32_t mask,
|
| BlockLabel* on_equal) {
|
| @@ -1126,7 +1066,6 @@ void IRRegExpMacroAssembler::CheckCharacterAfterAnd(uint32_t c,
|
| BranchOrBacktrack(Comparison(kEQ, actual_def, expected_def), on_equal);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::CheckNotCharacterAfterAnd(
|
| uint32_t c,
|
| uint32_t mask,
|
| @@ -1144,7 +1083,6 @@ void IRRegExpMacroAssembler::CheckNotCharacterAfterAnd(
|
| BranchOrBacktrack(Comparison(kNE, actual_def, expected_def), on_not_equal);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::CheckNotCharacterAfterMinusAnd(
|
| uint16_t c,
|
| uint16_t minus,
|
| @@ -1167,7 +1105,6 @@ void IRRegExpMacroAssembler::CheckNotCharacterAfterMinusAnd(
|
| BranchOrBacktrack(Comparison(kNE, actual_def, expected_def), on_not_equal);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::CheckCharacterInRange(uint16_t from,
|
| uint16_t to,
|
| BlockLabel* on_in_range) {
|
| @@ -1189,7 +1126,6 @@ void IRRegExpMacroAssembler::CheckCharacterInRange(uint16_t from,
|
| BindBlock(&on_not_in_range);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::CheckCharacterNotInRange(
|
| uint16_t from,
|
| uint16_t to,
|
| @@ -1206,7 +1142,6 @@ void IRRegExpMacroAssembler::CheckCharacterNotInRange(
|
| on_not_in_range);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::CheckBitInTable(const TypedData& table,
|
| BlockLabel* on_bit_set) {
|
| TAG();
|
| @@ -1230,7 +1165,6 @@ void IRRegExpMacroAssembler::CheckBitInTable(const TypedData& table,
|
| BranchOrBacktrack(Comparison(kNE, byte_def, zero_def), on_bit_set);
|
| }
|
|
|
| -
|
| bool IRRegExpMacroAssembler::CheckSpecialCharacterClass(
|
| uint16_t type,
|
| BlockLabel* on_no_match) {
|
| @@ -1367,7 +1301,6 @@ bool IRRegExpMacroAssembler::CheckSpecialCharacterClass(
|
| }
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::Fail() {
|
| TAG();
|
| ASSERT(FAILURE == 0); // Return value for failure is zero.
|
| @@ -1377,7 +1310,6 @@ void IRRegExpMacroAssembler::Fail() {
|
| GoTo(exit_block_);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::IfRegisterGE(intptr_t reg,
|
| intptr_t comparand,
|
| BlockLabel* if_ge) {
|
| @@ -1387,7 +1319,6 @@ void IRRegExpMacroAssembler::IfRegisterGE(intptr_t reg,
|
| BranchOrBacktrack(Comparison(kGTE, reg_push, pos), if_ge);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::IfRegisterLT(intptr_t reg,
|
| intptr_t comparand,
|
| BlockLabel* if_lt) {
|
| @@ -1397,7 +1328,6 @@ void IRRegExpMacroAssembler::IfRegisterLT(intptr_t reg,
|
| BranchOrBacktrack(Comparison(kLT, reg_push, pos), if_lt);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::IfRegisterEqPos(intptr_t reg, BlockLabel* if_eq) {
|
| TAG();
|
| PushArgumentInstr* reg_push = PushArgument(LoadRegister(reg));
|
| @@ -1405,13 +1335,11 @@ void IRRegExpMacroAssembler::IfRegisterEqPos(intptr_t reg, BlockLabel* if_eq) {
|
| BranchOrBacktrack(Comparison(kEQ, reg_push, pos), if_eq);
|
| }
|
|
|
| -
|
| RegExpMacroAssembler::IrregexpImplementation
|
| IRRegExpMacroAssembler::Implementation() {
|
| return kIRImplementation;
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::LoadCurrentCharacter(intptr_t cp_offset,
|
| BlockLabel* on_end_of_input,
|
| bool check_bounds,
|
| @@ -1425,13 +1353,11 @@ void IRRegExpMacroAssembler::LoadCurrentCharacter(intptr_t cp_offset,
|
| LoadCurrentCharacterUnchecked(cp_offset, characters);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::PopCurrentPosition() {
|
| TAG();
|
| StoreLocal(current_position_, Bind(PopStack()));
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::PopRegister(intptr_t reg) {
|
| TAG();
|
| ASSERT(reg < registers_count_);
|
| @@ -1441,7 +1367,6 @@ void IRRegExpMacroAssembler::PopRegister(intptr_t reg) {
|
| StoreRegister(registers_push, index_push, pop_push);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::PushStack(Definition* definition) {
|
| PushArgumentInstr* stack_push = PushLocal(stack_);
|
| PushArgumentInstr* stack_pointer_push = PushLocal(stack_pointer_);
|
| @@ -1454,7 +1379,6 @@ void IRRegExpMacroAssembler::PushStack(Definition* definition) {
|
| stack_push, stack_pointer_push, value_push));
|
| }
|
|
|
| -
|
| Definition* IRRegExpMacroAssembler::PopStack() {
|
| PushArgumentInstr* stack_push = PushLocal(stack_);
|
| PushArgumentInstr* stack_pointer_push1 = PushLocal(stack_pointer_);
|
| @@ -1465,7 +1389,6 @@ Definition* IRRegExpMacroAssembler::PopStack() {
|
| stack_push, stack_pointer_push1);
|
| }
|
|
|
| -
|
| Definition* IRRegExpMacroAssembler::PeekStack() {
|
| PushArgumentInstr* stack_push = PushLocal(stack_);
|
| PushArgumentInstr* stack_pointer_push = PushLocal(stack_pointer_);
|
| @@ -1473,7 +1396,6 @@ Definition* IRRegExpMacroAssembler::PeekStack() {
|
| stack_push, stack_pointer_push);
|
| }
|
|
|
| -
|
| // Pushes the location corresponding to label to the backtracking stack.
|
| void IRRegExpMacroAssembler::PushBacktrack(BlockLabel* label) {
|
| TAG();
|
| @@ -1491,13 +1413,11 @@ void IRRegExpMacroAssembler::PushBacktrack(BlockLabel* label) {
|
| CheckStackLimit();
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::PushCurrentPosition() {
|
| TAG();
|
| PushStack(LoadLocal(current_position_));
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::PushRegister(intptr_t reg) {
|
| TAG();
|
| // TODO(zerny): Refactor PushStack so it can be reused here.
|
| @@ -1513,7 +1433,6 @@ void IRRegExpMacroAssembler::PushRegister(intptr_t reg) {
|
| CheckStackLimit();
|
| }
|
|
|
| -
|
| // Checks that (stack.capacity - stack_limit_slack) > stack_pointer.
|
| // This ensures that up to stack_limit_slack stack pushes can be
|
| // done without exhausting the stack space. If the check fails the
|
| @@ -1543,7 +1462,6 @@ void IRRegExpMacroAssembler::CheckStackLimit() {
|
| BindBlock(&fallthrough);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::GrowStack() {
|
| TAG();
|
| const Library& lib = Library::Handle(Library::InternalLibrary());
|
| @@ -1564,7 +1482,6 @@ void IRRegExpMacroAssembler::GrowStack() {
|
| stack_cell_push, index_push, stack_push));
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::ReadCurrentPositionFromRegister(intptr_t reg) {
|
| TAG();
|
| StoreLocal(current_position_, LoadRegister(reg));
|
| @@ -1598,7 +1515,6 @@ void IRRegExpMacroAssembler::SetCurrentPositionFromEnd(intptr_t by) {
|
| BindBlock(&after_position);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::SetRegister(intptr_t reg, intptr_t to) {
|
| TAG();
|
| // Reserved for positions!
|
| @@ -1606,14 +1522,12 @@ void IRRegExpMacroAssembler::SetRegister(intptr_t reg, intptr_t to) {
|
| StoreRegister(reg, to);
|
| }
|
|
|
| -
|
| bool IRRegExpMacroAssembler::Succeed() {
|
| TAG();
|
| GoTo(success_block_);
|
| return global();
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::WriteCurrentPositionToRegister(
|
| intptr_t reg,
|
| intptr_t cp_offset) {
|
| @@ -1629,7 +1543,6 @@ void IRRegExpMacroAssembler::WriteCurrentPositionToRegister(
|
| StoreRegister(registers_push, index_push, neg_off_push);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::ClearRegisters(intptr_t reg_from,
|
| intptr_t reg_to) {
|
| TAG();
|
| @@ -1650,7 +1563,6 @@ void IRRegExpMacroAssembler::ClearRegisters(intptr_t reg_from,
|
| }
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::WriteStackPointerToRegister(intptr_t reg) {
|
| TAG();
|
|
|
| @@ -1660,10 +1572,8 @@ void IRRegExpMacroAssembler::WriteStackPointerToRegister(intptr_t reg) {
|
| StoreRegister(registers_push, index_push, tip_push);
|
| }
|
|
|
| -
|
| // Private methods:
|
|
|
| -
|
| void IRRegExpMacroAssembler::CheckPosition(intptr_t cp_offset,
|
| BlockLabel* on_outside_input) {
|
| TAG();
|
| @@ -1676,7 +1586,6 @@ void IRRegExpMacroAssembler::CheckPosition(intptr_t cp_offset,
|
| BranchOrBacktrack(Comparison(kGTE, curpos_def, cp_off_def), on_outside_input);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::BranchOrBacktrack(ComparisonInstr* comparison,
|
| BlockLabel* true_successor) {
|
| if (comparison == NULL) { // No condition
|
| @@ -1707,7 +1616,6 @@ void IRRegExpMacroAssembler::BranchOrBacktrack(ComparisonInstr* comparison,
|
| BindBlock(&fallthrough);
|
| }
|
|
|
| -
|
| TargetEntryInstr* IRRegExpMacroAssembler::TargetWithJoinGoto(
|
| JoinEntryInstr* dst) {
|
| TargetEntryInstr* target = new (Z)
|
| @@ -1719,7 +1627,6 @@ TargetEntryInstr* IRRegExpMacroAssembler::TargetWithJoinGoto(
|
| return target;
|
| }
|
|
|
| -
|
| IndirectEntryInstr* IRRegExpMacroAssembler::IndirectWithJoinGoto(
|
| JoinEntryInstr* dst) {
|
| IndirectEntryInstr* target =
|
| @@ -1732,7 +1639,6 @@ IndirectEntryInstr* IRRegExpMacroAssembler::IndirectWithJoinGoto(
|
| return target;
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::CheckPreemption(bool is_backtrack) {
|
| TAG();
|
|
|
| @@ -1746,19 +1652,16 @@ void IRRegExpMacroAssembler::CheckPreemption(bool is_backtrack) {
|
| : CheckStackOverflowInstr::kOsrOnly));
|
| }
|
|
|
| -
|
| Definition* IRRegExpMacroAssembler::Add(PushArgumentInstr* lhs,
|
| PushArgumentInstr* rhs) {
|
| return InstanceCall(InstanceCallDescriptor::FromToken(Token::kADD), lhs, rhs);
|
| }
|
|
|
| -
|
| Definition* IRRegExpMacroAssembler::Sub(PushArgumentInstr* lhs,
|
| PushArgumentInstr* rhs) {
|
| return InstanceCall(InstanceCallDescriptor::FromToken(Token::kSUB), lhs, rhs);
|
| }
|
|
|
| -
|
| void IRRegExpMacroAssembler::LoadCurrentCharacterUnchecked(
|
| intptr_t cp_offset,
|
| intptr_t characters) {
|
| @@ -1789,12 +1692,10 @@ void IRRegExpMacroAssembler::LoadCurrentCharacterUnchecked(
|
| PRINT(PushLocal(current_character_));
|
| }
|
|
|
| -
|
| Value* IRRegExpMacroAssembler::CharacterAt(LocalVariable* index) {
|
| return LoadCodeUnitsAt(index, 1);
|
| }
|
|
|
| -
|
| Value* IRRegExpMacroAssembler::LoadCodeUnitsAt(LocalVariable* index,
|
| intptr_t characters) {
|
| // Bind the pattern as the load receiver.
|
| @@ -1828,7 +1729,6 @@ Value* IRRegExpMacroAssembler::LoadCodeUnitsAt(LocalVariable* index,
|
| TokenPosition::kNoSource));
|
| }
|
|
|
| -
|
| #undef __
|
|
|
| } // namespace dart
|
|
|