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

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

Issue 18587: Eliminate the code that handles fallback to JSCRE. The only way to get... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 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 side-by-side diff with in-line comments
Download patch
« src/regexp-macro-assembler.h ('K') | « src/regexp-macro-assembler.h ('k') | no next file » | 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 1141)
+++ src/regexp-macro-assembler-irregexp.cc (working copy)
@@ -84,6 +84,8 @@
void RegExpMacroAssemblerIrregexp::PopRegister(int register_index) {
+ ASSERT(register_index >= 0);
+ ASSERT(register_index <= kMaxRegister);
Emit(BC_POP_REGISTER, register_index);
}
@@ -92,6 +94,7 @@
int register_index,
StackCheckFlag check_stack_limit) {
ASSERT(register_index >= 0);
+ ASSERT(register_index <= kMaxRegister);
Emit(BC_PUSH_REGISTER, register_index);
}
@@ -99,6 +102,7 @@
void RegExpMacroAssemblerIrregexp::WriteCurrentPositionToRegister(
int register_index, int cp_offset) {
ASSERT(register_index >= 0);
+ ASSERT(register_index <= kMaxRegister);
Emit(BC_SET_REGISTER_TO_CP, register_index);
Emit32(cp_offset); // Current position offset.
}
@@ -112,6 +116,7 @@
void RegExpMacroAssemblerIrregexp::ReadCurrentPositionFromRegister(
int register_index) {
ASSERT(register_index >= 0);
+ ASSERT(register_index <= kMaxRegister);
Emit(BC_SET_CP_TO_REGISTER, register_index);
}
@@ -119,6 +124,7 @@
void RegExpMacroAssemblerIrregexp::WriteStackPointerToRegister(
int register_index) {
ASSERT(register_index >= 0);
+ ASSERT(register_index <= kMaxRegister);
Emit(BC_SET_REGISTER_TO_SP, register_index);
}
@@ -126,12 +132,14 @@
void RegExpMacroAssemblerIrregexp::ReadStackPointerFromRegister(
int register_index) {
ASSERT(register_index >= 0);
+ ASSERT(register_index <= kMaxRegister);
Emit(BC_SET_SP_TO_REGISTER, register_index);
}
void RegExpMacroAssemblerIrregexp::SetRegister(int register_index, int to) {
ASSERT(register_index >= 0);
+ ASSERT(register_index <= kMaxRegister);
Emit(BC_SET_REGISTER, register_index);
Emit32(to);
}
@@ -139,6 +147,7 @@
void RegExpMacroAssemblerIrregexp::AdvanceRegister(int register_index, int by) {
ASSERT(register_index >= 0);
+ ASSERT(register_index <= kMaxRegister);
Emit(BC_ADVANCE_REGISTER, register_index);
Emit32(by);
}
@@ -182,6 +191,8 @@
void RegExpMacroAssemblerIrregexp::AdvanceCurrentPosition(int by) {
+ ASSERT(by >= kMinCPOffset);
+ ASSERT(by <= kMaxCPOffset);
Emit(BC_ADVANCE_CP, by);
}
@@ -197,6 +208,8 @@
Label* on_failure,
bool check_bounds,
int characters) {
+ ASSERT(cp_offset >= kMinCPOffset);
+ ASSERT(cp_offset <= kMaxCPOffset);
int bytecode;
if (check_bounds) {
if (characters == 4) {
@@ -315,6 +328,8 @@
void RegExpMacroAssemblerIrregexp::CheckNotBackReference(int start_reg,
Label* on_not_equal) {
+ ASSERT(start_reg >= 0);
+ ASSERT(start_reg <= kMaxRegister);
Emit(BC_CHECK_NOT_BACK_REF, start_reg);
EmitOrLink(on_not_equal);
}
@@ -323,6 +338,8 @@
void RegExpMacroAssemblerIrregexp::CheckNotBackReferenceIgnoreCase(
int start_reg,
Label* on_not_equal) {
+ ASSERT(start_reg >= 0);
+ ASSERT(start_reg <= kMaxRegister);
Emit(BC_CHECK_NOT_BACK_REF_NO_CASE, start_reg);
EmitOrLink(on_not_equal);
}
@@ -331,6 +348,8 @@
void RegExpMacroAssemblerIrregexp::CheckNotRegistersEqual(int reg1,
int reg2,
Label* on_not_equal) {
+ ASSERT(reg1 >= 0);
+ ASSERT(reg1 <= kMaxRegister);
Emit(BC_CHECK_NOT_REGS_EQUAL, reg1);
Emit32(reg2);
EmitOrLink(on_not_equal);
@@ -373,6 +392,8 @@
int cp_offset,
Label* on_failure,
bool check_end_of_string) {
+ ASSERT(cp_offset >= kMinCPOffset);
+ ASSERT(cp_offset + str.length() - 1 <= kMaxCPOffset);
// It is vital that this loop is backwards due to the unchecked character
// load below.
for (int i = str.length() - 1; i >= 0; i--) {
@@ -391,7 +412,8 @@
void RegExpMacroAssemblerIrregexp::IfRegisterLT(int register_index,
int comparand,
Label* on_less_than) {
- ASSERT(comparand >= 0 && comparand <= 65535);
+ ASSERT(register_index >= 0);
+ ASSERT(register_index <= kMaxRegister);
Emit(BC_CHECK_REGISTER_LT, register_index);
Emit32(comparand);
EmitOrLink(on_less_than);
@@ -401,7 +423,8 @@
void RegExpMacroAssemblerIrregexp::IfRegisterGE(int register_index,
int comparand,
Label* on_greater_or_equal) {
- ASSERT(comparand >= 0 && comparand <= 65535);
+ ASSERT(register_index >= 0);
+ ASSERT(register_index <= kMaxRegister);
Emit(BC_CHECK_REGISTER_GE, register_index);
Emit32(comparand);
EmitOrLink(on_greater_or_equal);
@@ -410,6 +433,8 @@
void RegExpMacroAssemblerIrregexp::IfRegisterEqPos(int register_index,
Label* on_eq) {
+ ASSERT(register_index >= 0);
+ ASSERT(register_index <= kMaxRegister);
Emit(BC_CHECK_REGISTER_EQ_POS, register_index);
EmitOrLink(on_eq);
}
« src/regexp-macro-assembler.h ('K') | « src/regexp-macro-assembler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698