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

Unified Diff: src/regexp-macro-assembler-irregexp.cc

Issue 14194: * Generate quick checks based on mask and compare for... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 12 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/regexp-macro-assembler-irregexp.h ('k') | src/regexp-macro-assembler-tracer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/regexp-macro-assembler-irregexp.cc
===================================================================
--- src/regexp-macro-assembler-irregexp.cc (revision 1004)
+++ src/regexp-macro-assembler-irregexp.cc (working copy)
@@ -44,6 +44,7 @@
RegExpMacroAssemblerIrregexp::~RegExpMacroAssemblerIrregexp() {
+ if (backtrack_.is_linked()) backtrack_.Unuse();
}
@@ -196,20 +197,35 @@
void RegExpMacroAssemblerIrregexp::LoadCurrentCharacter(int cp_offset,
- Label* on_failure) {
- Emit(BC_LOAD_CURRENT_CHAR);
+ Label* on_failure,
+ bool check_bounds,
+ int characters) {
+ int bytecode;
+ if (check_bounds) {
+ if (characters == 4) {
+ bytecode = BC_LOAD_4_CURRENT_CHARS;
+ } else if (characters == 2) {
+ bytecode = BC_LOAD_2_CURRENT_CHARS;
+ } else {
+ ASSERT(characters == 1);
+ bytecode = BC_LOAD_CURRENT_CHAR;
+ }
+ } else {
+ if (characters == 4) {
+ bytecode = BC_LOAD_4_CURRENT_CHARS_UNCHECKED;
+ } else if (characters == 2) {
+ bytecode = BC_LOAD_2_CURRENT_CHARS_UNCHECKED;
+ } else {
+ ASSERT(characters == 1);
+ bytecode = BC_LOAD_CURRENT_CHAR_UNCHECKED;
+ }
+ }
+ Emit(bytecode);
Emit32(cp_offset);
- EmitOrLink(on_failure);
+ if (check_bounds) EmitOrLink(on_failure);
}
-void RegExpMacroAssemblerIrregexp::LoadCurrentCharacterUnchecked(
- int cp_offset) {
- Emit(BC_LOAD_CURRENT_CHAR_UNCHECKED);
- Emit32(cp_offset);
-}
-
-
void RegExpMacroAssemblerIrregexp::CheckCharacterLT(uc16 limit,
Label* on_less) {
Emit(BC_CHECK_LT);
@@ -226,9 +242,9 @@
}
-void RegExpMacroAssemblerIrregexp::CheckCharacter(uc16 c, Label* on_equal) {
+void RegExpMacroAssemblerIrregexp::CheckCharacter(uint32_t c, Label* on_equal) {
Emit(BC_CHECK_CHAR);
- Emit16(c);
+ Emit32(c);
EmitOrLink(on_equal);
}
@@ -239,31 +255,44 @@
}
-void RegExpMacroAssemblerIrregexp::CheckNotCharacter(uc16 c,
+void RegExpMacroAssemblerIrregexp::CheckNotCharacter(uint32_t c,
Label* on_not_equal) {
Emit(BC_CHECK_NOT_CHAR);
- Emit16(c);
+ Emit32(c);
EmitOrLink(on_not_equal);
}
-void RegExpMacroAssemblerIrregexp::CheckNotCharacterAfterOr(
- uc16 c,
- uc16 mask,
+void RegExpMacroAssemblerIrregexp::CheckCharacterAfterAnd(
+ uint32_t c,
+ uint32_t mask,
+ Label* on_equal) {
+ Emit(BC_AND_CHECK_CHAR);
+ Emit32(c);
+ Emit32(mask);
+ EmitOrLink(on_equal);
+}
+
+
+void RegExpMacroAssemblerIrregexp::CheckNotCharacterAfterAnd(
+ uint32_t c,
+ uint32_t mask,
Label* on_not_equal) {
- Emit(BC_OR_CHECK_NOT_CHAR);
- Emit16(c);
- Emit16(mask);
+ Emit(BC_AND_CHECK_NOT_CHAR);
+ Emit32(c);
+ Emit32(mask);
EmitOrLink(on_not_equal);
}
-void RegExpMacroAssemblerIrregexp::CheckNotCharacterAfterMinusOr(
+void RegExpMacroAssemblerIrregexp::CheckNotCharacterAfterMinusAnd(
uc16 c,
+ uc16 minus,
uc16 mask,
Label* on_not_equal) {
- Emit(BC_MINUS_OR_CHECK_NOT_CHAR);
+ Emit(BC_MINUS_AND_CHECK_NOT_CHAR);
Emit16(c);
+ Emit16(minus);
Emit16(mask);
EmitOrLink(on_not_equal);
}
@@ -344,7 +373,7 @@
Emit32(cp_offset + i);
}
Emit(BC_CHECK_NOT_CHAR);
- Emit16(str[i]);
+ Emit32(str[i]);
EmitOrLink(on_failure);
}
}
« no previous file with comments | « src/regexp-macro-assembler-irregexp.h ('k') | src/regexp-macro-assembler-tracer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698