Revision: 10924
Author: [email protected]
Date: Mon Mar 5 06:41:07 2012
Log: Generate more compact code in regexp assembler with near jumps.
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com/9600016
http://code.google.com/p/v8/source/detail?r=10924
Modified:
/branches/bleeding_edge/src/ia32/regexp-macro-assembler-ia32.cc
/branches/bleeding_edge/src/x64/regexp-macro-assembler-x64.cc
=======================================
--- /branches/bleeding_edge/src/ia32/regexp-macro-assembler-ia32.cc Tue Feb
28 02:32:02 2012
+++ /branches/bleeding_edge/src/ia32/regexp-macro-assembler-ia32.cc Mon
Mar 5 06:41:07 2012
@@ -1,4 +1,4 @@
-// Copyright 2011 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -287,7 +287,7 @@
void RegExpMacroAssemblerIA32::CheckGreedyLoop(Label* on_equal) {
Label fallthrough;
__ cmp(edi, Operand(backtrack_stackpointer(), 0));
- __ j(not_equal, &fallthrough);
+ __ j(not_equal, &fallthrough, Label::kNear);
__ add(backtrack_stackpointer(), Immediate(kPointerSize)); // Pop.
BranchOrBacktrack(no_condition, on_equal);
__ bind(&fallthrough);
@@ -328,19 +328,19 @@
__ bind(&loop);
__ movzx_b(eax, Operand(edi, 0));
__ cmpb_al(Operand(edx, 0));
- __ j(equal, &loop_increment);
+ __ j(equal, &loop_increment, Label::kNear);
// Mismatch, try case-insensitive match (converting letters to
lower-case).
__ or_(eax, 0x20); // Convert match character to lower-case.
__ lea(ecx, Operand(eax, -'a'));
__ cmp(ecx, static_cast<int32_t>('z' - 'a')); // Is eax a lowercase
letter?
- __ j(above, &fail);
+ __ j(above, &fail, Label::kNear);
// Also convert capture character.
__ movzx_b(ecx, Operand(edx, 0));
__ or_(ecx, 0x20);
__ cmp(eax, ecx);
- __ j(not_equal, &fail);
+ __ j(not_equal, &fail, Label::kNear);
__ bind(&loop_increment);
// Increment pointers into match and capture strings.
@@ -349,7 +349,7 @@
// Compare to end of match, and loop if not done.
__ cmp(edi, ebx);
__ j(below, &loop);
- __ jmp(&success);
+ __ jmp(&success, Label::kNear);
__ bind(&fail);
// Restore original values before failing.
@@ -457,14 +457,14 @@
__ movzx_w(eax, Operand(edx, 0));
__ cmpw_ax(Operand(ebx, 0));
}
- __ j(not_equal, &fail);
+ __ j(not_equal, &fail, Label::kNear);
// Increment pointers into capture and match string.
__ add(edx, Immediate(char_size()));
__ add(ebx, Immediate(char_size()));
// Check if we have reached end of match area.
__ cmp(ebx, ecx);
__ j(below, &loop);
- __ jmp(&success);
+ __ jmp(&success, Label::kNear);
__ bind(&fail);
// Restore backtrack stackpointer.
@@ -542,7 +542,7 @@
// ASCII space characters are '\t'..'\r' and ' '.
Label success;
__ cmp(current_character(), ' ');
- __ j(equal, &success);
+ __ j(equal, &success, Label::kNear);
// Check range 0x09..0x0d
__ lea(eax, Operand(current_character(), -'\t'));
__ cmp(eax, '\r' - '\t');
@@ -611,7 +611,7 @@
if (mode_ != ASCII) {
// Table is 128 entries, so all ASCII characters can be tested.
__ cmp(current_character(), Immediate('z'));
- __ j(above, &done);
+ __ j(above, &done, Label::kNear);
}
ASSERT_EQ(0, word_character_map[0]); // Character '\0' is not a word
char.
ExternalReference word_map =
ExternalReference::re_word_character_map();
@@ -695,11 +695,11 @@
__ mov(ecx, esp);
__ sub(ecx, Operand::StaticVariable(stack_limit));
// Handle it if the stack pointer is already below the stack limit.
- __ j(below_equal, &stack_limit_hit);
+ __ j(below_equal, &stack_limit_hit, Label::kNear);
// Check if there is room for the variable number of registers above
// the stack limit.
__ cmp(ecx, num_registers_ * kPointerSize);
- __ j(above_equal, &stack_ok);
+ __ j(above_equal, &stack_ok, Label::kNear);
// Exit with OutOfMemory exception. There is not enough space on the
stack
// for our working registers.
__ mov(eax, EXCEPTION);
@@ -764,7 +764,7 @@
// Load previous char as initial value of current-character.
Label at_start;
__ cmp(Operand(ebp, kStartIndex), Immediate(0));
- __ j(equal, &at_start);
+ __ j(equal, &at_start, Label::kNear);
LoadCurrentCharacterUnchecked(-1, 1); // Load previous char.
__ jmp(&start_label_);
__ bind(&at_start);
@@ -1235,7 +1235,7 @@
ExternalReference stack_limit =
ExternalReference::address_of_stack_limit(masm_->isolate());
__ cmp(esp, Operand::StaticVariable(stack_limit));
- __ j(above, &no_preempt);
+ __ j(above, &no_preempt, Label::kNear);
SafeCall(&check_preempt_label_);
@@ -1248,7 +1248,7 @@
ExternalReference stack_limit =
ExternalReference::address_of_regexp_stack_limit(masm_->isolate());
__ cmp(backtrack_stackpointer(), Operand::StaticVariable(stack_limit));
- __ j(above, &no_stack_overflow);
+ __ j(above, &no_stack_overflow, Label::kNear);
SafeCall(&stack_overflow_label_);
=======================================
--- /branches/bleeding_edge/src/x64/regexp-macro-assembler-x64.cc Tue Feb
28 02:32:02 2012
+++ /branches/bleeding_edge/src/x64/regexp-macro-assembler-x64.cc Mon Mar
5 06:41:07 2012
@@ -1,4 +1,4 @@
-// Copyright 2011 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -318,7 +318,7 @@
void RegExpMacroAssemblerX64::CheckGreedyLoop(Label* on_equal) {
Label fallthrough;
__ cmpl(rdi, Operand(backtrack_stackpointer(), 0));
- __ j(not_equal, &fallthrough);
+ __ j(not_equal, &fallthrough, Label::kNear);
Drop();
BranchOrBacktrack(no_condition, on_equal);
__ bind(&fallthrough);
@@ -368,7 +368,7 @@
// al - input character
// dl - capture character
__ cmpb(rax, rdx);
- __ j(equal, &loop_increment);
+ __ j(equal, &loop_increment, Label::kNear);
// Mismatch, try case-insensitive match (converting letters to
lower-case).
// I.e., if or-ing with 0x20 makes values equal and in range 'a'-'z',
it's
@@ -585,7 +585,7 @@
// ASCII space characters are '\t'..'\r' and ' '.
Label success;
__ cmpl(current_character(), Immediate(' '));
- __ j(equal, &success);
+ __ j(equal, &success, Label::kNear);
// Check range 0x09..0x0d
__ lea(rax, Operand(current_character(), -'\t'));
__ cmpl(rax, Immediate('\r' - '\t'));
@@ -676,7 +676,7 @@
if (mode_ != ASCII) {
// Table is 128 entries, so all ASCII characters can be tested.
__ cmpl(current_character(), Immediate('z'));
- __ j(above, &done);
+ __ j(above, &done, Label::kNear);
}
__ movq(rbx, ExternalReference::re_word_character_map());
ASSERT_EQ(0, word_character_map[0]); // Character '\0' is not a word
char.
@@ -763,11 +763,11 @@
__ movq(kScratchRegister, stack_limit);
__ subq(rcx, Operand(kScratchRegister, 0));
// Handle it if the stack pointer is already below the stack limit.
- __ j(below_equal, &stack_limit_hit);
+ __ j(below_equal, &stack_limit_hit, Label::kNear);
// Check if there is room for the variable number of registers above
// the stack limit.
__ cmpq(rcx, Immediate(num_registers_ * kPointerSize));
- __ j(above_equal, &stack_ok);
+ __ j(above_equal, &stack_ok, Label::kNear);
// Exit with OutOfMemory exception. There is not enough space on the
stack
// for our working registers.
__ Set(rax, EXCEPTION);
@@ -833,7 +833,7 @@
// Load previous char as initial value of current-character.
Label at_start;
__ cmpb(Operand(rbp, kStartIndex), Immediate(0));
- __ j(equal, &at_start);
+ __ j(equal, &at_start, Label::kNear);
LoadCurrentCharacterUnchecked(-1, 1); // Load previous char.
__ jmp(&start_label_);
__ bind(&at_start);
@@ -1370,7 +1370,7 @@
ExternalReference::address_of_stack_limit(masm_.isolate());
__ load_rax(stack_limit);
__ cmpq(rsp, rax);
- __ j(above, &no_preempt);
+ __ j(above, &no_preempt, Label::kNear);
SafeCall(&check_preempt_label_);
@@ -1384,7 +1384,7 @@
ExternalReference::address_of_regexp_stack_limit(masm_.isolate());
__ load_rax(stack_limit);
__ cmpq(backtrack_stackpointer(), rax);
- __ j(above, &no_stack_overflow);
+ __ j(above, &no_stack_overflow, Label::kNear);
SafeCall(&stack_overflow_label_);
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev