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

Side by Side Diff: src/arm/regexp-macro-assembler-arm.cc

Issue 3844006: Limit end-anchored regexps to testing end of string where possible. (Closed)
Patch Set: Created 10 years, 2 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 | « src/arm/regexp-macro-assembler-arm.h ('k') | src/ast.h » ('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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 135 }
136 136
137 137
138 int RegExpMacroAssemblerARM::stack_limit_slack() { 138 int RegExpMacroAssemblerARM::stack_limit_slack() {
139 return RegExpStack::kStackLimitSlack; 139 return RegExpStack::kStackLimitSlack;
140 } 140 }
141 141
142 142
143 void RegExpMacroAssemblerARM::AdvanceCurrentPosition(int by) { 143 void RegExpMacroAssemblerARM::AdvanceCurrentPosition(int by) {
144 if (by != 0) { 144 if (by != 0) {
145 Label inside_string;
146 __ add(current_input_offset(), 145 __ add(current_input_offset(),
147 current_input_offset(), Operand(by * char_size())); 146 current_input_offset(), Operand(by * char_size()));
148 } 147 }
149 } 148 }
150 149
151 150
152 void RegExpMacroAssemblerARM::AdvanceRegister(int reg, int by) { 151 void RegExpMacroAssemblerARM::AdvanceRegister(int reg, int by) {
153 ASSERT(reg >= 0); 152 ASSERT(reg >= 0);
154 ASSERT(reg < num_registers_); 153 ASSERT(reg < num_registers_);
155 if (by != 0) { 154 if (by != 0) {
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 } 919 }
921 920
922 921
923 void RegExpMacroAssemblerARM::ReadStackPointerFromRegister(int reg) { 922 void RegExpMacroAssemblerARM::ReadStackPointerFromRegister(int reg) {
924 __ ldr(backtrack_stackpointer(), register_location(reg)); 923 __ ldr(backtrack_stackpointer(), register_location(reg));
925 __ ldr(r0, MemOperand(frame_pointer(), kStackHighEnd)); 924 __ ldr(r0, MemOperand(frame_pointer(), kStackHighEnd));
926 __ add(backtrack_stackpointer(), backtrack_stackpointer(), Operand(r0)); 925 __ add(backtrack_stackpointer(), backtrack_stackpointer(), Operand(r0));
927 } 926 }
928 927
929 928
929 void RegExpMacroAssemblerARM::SetCurrentPositionFromEnd(int by) {
930 Label after_position;
Lasse Reichstein 2010/10/19 13:39:24 There is no NearLabel for ARM.
931 __ cmp(current_input_offset(), Operand(-by * char_size()));
932 __ b(ge, &after_position);
Lasse Reichstein 2010/10/19 13:39:24 Comparison must be signed, since either value can
933 __ mov(current_input_offset(), Operand(-by * char_size()));
934 // On RegExp code entry (where this operation is used), the character before
935 // the current position is expected to be already loaded.
936 // We have advanced the position, so it's safe to read backwards.
937 LoadCurrentCharacterUnchecked(-1, 1);
938 __ bind(&after_position);
939 }
940
941
930 void RegExpMacroAssemblerARM::SetRegister(int register_index, int to) { 942 void RegExpMacroAssemblerARM::SetRegister(int register_index, int to) {
931 ASSERT(register_index >= num_saved_registers_); // Reserved for positions! 943 ASSERT(register_index >= num_saved_registers_); // Reserved for positions!
932 __ mov(r0, Operand(to)); 944 __ mov(r0, Operand(to));
933 __ str(r0, register_location(register_index)); 945 __ str(r0, register_location(register_index));
934 } 946 }
935 947
936 948
937 void RegExpMacroAssemblerARM::Succeed() { 949 void RegExpMacroAssemblerARM::Succeed() {
938 __ jmp(&success_label_); 950 __ jmp(&success_label_);
939 } 951 }
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 __ ldr(pc, MemOperand(sp, stack_alignment, PostIndex)); 1262 __ ldr(pc, MemOperand(sp, stack_alignment, PostIndex));
1251 } 1263 }
1252 1264
1253 #undef __ 1265 #undef __
1254 1266
1255 #endif // V8_INTERPRETED_REGEXP 1267 #endif // V8_INTERPRETED_REGEXP
1256 1268
1257 }} // namespace v8::internal 1269 }} // namespace v8::internal
1258 1270
1259 #endif // V8_TARGET_ARCH_ARM 1271 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/regexp-macro-assembler-arm.h ('k') | src/ast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698