Revert r19024 due to performance regressions.

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/9615010

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10940 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
yangguo@chromium.org 2012-03-06 11:52:46 +00:00
parent 20a6c9ba31
commit 5a06f5d5f6
2 changed files with 25 additions and 25 deletions

View File

@ -1,4 +1,4 @@
// Copyright 2012 the V8 project authors. All rights reserved. // Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
@ -287,7 +287,7 @@ void RegExpMacroAssemblerIA32::CheckCharacters(Vector<const uc16> str,
void RegExpMacroAssemblerIA32::CheckGreedyLoop(Label* on_equal) { void RegExpMacroAssemblerIA32::CheckGreedyLoop(Label* on_equal) {
Label fallthrough; Label fallthrough;
__ cmp(edi, Operand(backtrack_stackpointer(), 0)); __ cmp(edi, Operand(backtrack_stackpointer(), 0));
__ j(not_equal, &fallthrough, Label::kNear); __ j(not_equal, &fallthrough);
__ add(backtrack_stackpointer(), Immediate(kPointerSize)); // Pop. __ add(backtrack_stackpointer(), Immediate(kPointerSize)); // Pop.
BranchOrBacktrack(no_condition, on_equal); BranchOrBacktrack(no_condition, on_equal);
__ bind(&fallthrough); __ bind(&fallthrough);
@ -328,19 +328,19 @@ void RegExpMacroAssemblerIA32::CheckNotBackReferenceIgnoreCase(
__ bind(&loop); __ bind(&loop);
__ movzx_b(eax, Operand(edi, 0)); __ movzx_b(eax, Operand(edi, 0));
__ cmpb_al(Operand(edx, 0)); __ cmpb_al(Operand(edx, 0));
__ j(equal, &loop_increment, Label::kNear); __ j(equal, &loop_increment);
// Mismatch, try case-insensitive match (converting letters to lower-case). // Mismatch, try case-insensitive match (converting letters to lower-case).
__ or_(eax, 0x20); // Convert match character to lower-case. __ or_(eax, 0x20); // Convert match character to lower-case.
__ lea(ecx, Operand(eax, -'a')); __ lea(ecx, Operand(eax, -'a'));
__ cmp(ecx, static_cast<int32_t>('z' - 'a')); // Is eax a lowercase letter? __ cmp(ecx, static_cast<int32_t>('z' - 'a')); // Is eax a lowercase letter?
__ j(above, &fail, Label::kNear); __ j(above, &fail);
// Also convert capture character. // Also convert capture character.
__ movzx_b(ecx, Operand(edx, 0)); __ movzx_b(ecx, Operand(edx, 0));
__ or_(ecx, 0x20); __ or_(ecx, 0x20);
__ cmp(eax, ecx); __ cmp(eax, ecx);
__ j(not_equal, &fail, Label::kNear); __ j(not_equal, &fail);
__ bind(&loop_increment); __ bind(&loop_increment);
// Increment pointers into match and capture strings. // Increment pointers into match and capture strings.
@ -349,7 +349,7 @@ void RegExpMacroAssemblerIA32::CheckNotBackReferenceIgnoreCase(
// Compare to end of match, and loop if not done. // Compare to end of match, and loop if not done.
__ cmp(edi, ebx); __ cmp(edi, ebx);
__ j(below, &loop); __ j(below, &loop);
__ jmp(&success, Label::kNear); __ jmp(&success);
__ bind(&fail); __ bind(&fail);
// Restore original values before failing. // Restore original values before failing.
@ -457,14 +457,14 @@ void RegExpMacroAssemblerIA32::CheckNotBackReference(
__ movzx_w(eax, Operand(edx, 0)); __ movzx_w(eax, Operand(edx, 0));
__ cmpw_ax(Operand(ebx, 0)); __ cmpw_ax(Operand(ebx, 0));
} }
__ j(not_equal, &fail, Label::kNear); __ j(not_equal, &fail);
// Increment pointers into capture and match string. // Increment pointers into capture and match string.
__ add(edx, Immediate(char_size())); __ add(edx, Immediate(char_size()));
__ add(ebx, Immediate(char_size())); __ add(ebx, Immediate(char_size()));
// Check if we have reached end of match area. // Check if we have reached end of match area.
__ cmp(ebx, ecx); __ cmp(ebx, ecx);
__ j(below, &loop); __ j(below, &loop);
__ jmp(&success, Label::kNear); __ jmp(&success);
__ bind(&fail); __ bind(&fail);
// Restore backtrack stackpointer. // Restore backtrack stackpointer.
@ -542,7 +542,7 @@ bool RegExpMacroAssemblerIA32::CheckSpecialCharacterClass(uc16 type,
// ASCII space characters are '\t'..'\r' and ' '. // ASCII space characters are '\t'..'\r' and ' '.
Label success; Label success;
__ cmp(current_character(), ' '); __ cmp(current_character(), ' ');
__ j(equal, &success, Label::kNear); __ j(equal, &success);
// Check range 0x09..0x0d // Check range 0x09..0x0d
__ lea(eax, Operand(current_character(), -'\t')); __ lea(eax, Operand(current_character(), -'\t'));
__ cmp(eax, '\r' - '\t'); __ cmp(eax, '\r' - '\t');
@ -611,7 +611,7 @@ bool RegExpMacroAssemblerIA32::CheckSpecialCharacterClass(uc16 type,
if (mode_ != ASCII) { if (mode_ != ASCII) {
// Table is 128 entries, so all ASCII characters can be tested. // Table is 128 entries, so all ASCII characters can be tested.
__ cmp(current_character(), Immediate('z')); __ cmp(current_character(), Immediate('z'));
__ j(above, &done, Label::kNear); __ j(above, &done);
} }
ASSERT_EQ(0, word_character_map[0]); // Character '\0' is not a word char. ASSERT_EQ(0, word_character_map[0]); // Character '\0' is not a word char.
ExternalReference word_map = ExternalReference::re_word_character_map(); ExternalReference word_map = ExternalReference::re_word_character_map();
@ -695,11 +695,11 @@ Handle<HeapObject> RegExpMacroAssemblerIA32::GetCode(Handle<String> source) {
__ mov(ecx, esp); __ mov(ecx, esp);
__ sub(ecx, Operand::StaticVariable(stack_limit)); __ sub(ecx, Operand::StaticVariable(stack_limit));
// Handle it if the stack pointer is already below the stack limit. // Handle it if the stack pointer is already below the stack limit.
__ j(below_equal, &stack_limit_hit, Label::kNear); __ j(below_equal, &stack_limit_hit);
// Check if there is room for the variable number of registers above // Check if there is room for the variable number of registers above
// the stack limit. // the stack limit.
__ cmp(ecx, num_registers_ * kPointerSize); __ cmp(ecx, num_registers_ * kPointerSize);
__ j(above_equal, &stack_ok, Label::kNear); __ j(above_equal, &stack_ok);
// Exit with OutOfMemory exception. There is not enough space on the stack // Exit with OutOfMemory exception. There is not enough space on the stack
// for our working registers. // for our working registers.
__ mov(eax, EXCEPTION); __ mov(eax, EXCEPTION);
@ -764,7 +764,7 @@ Handle<HeapObject> RegExpMacroAssemblerIA32::GetCode(Handle<String> source) {
// Load previous char as initial value of current-character. // Load previous char as initial value of current-character.
Label at_start; Label at_start;
__ cmp(Operand(ebp, kStartIndex), Immediate(0)); __ cmp(Operand(ebp, kStartIndex), Immediate(0));
__ j(equal, &at_start, Label::kNear); __ j(equal, &at_start);
LoadCurrentCharacterUnchecked(-1, 1); // Load previous char. LoadCurrentCharacterUnchecked(-1, 1); // Load previous char.
__ jmp(&start_label_); __ jmp(&start_label_);
__ bind(&at_start); __ bind(&at_start);
@ -1235,7 +1235,7 @@ void RegExpMacroAssemblerIA32::CheckPreemption() {
ExternalReference stack_limit = ExternalReference stack_limit =
ExternalReference::address_of_stack_limit(masm_->isolate()); ExternalReference::address_of_stack_limit(masm_->isolate());
__ cmp(esp, Operand::StaticVariable(stack_limit)); __ cmp(esp, Operand::StaticVariable(stack_limit));
__ j(above, &no_preempt, Label::kNear); __ j(above, &no_preempt);
SafeCall(&check_preempt_label_); SafeCall(&check_preempt_label_);
@ -1248,7 +1248,7 @@ void RegExpMacroAssemblerIA32::CheckStackLimit() {
ExternalReference stack_limit = ExternalReference stack_limit =
ExternalReference::address_of_regexp_stack_limit(masm_->isolate()); ExternalReference::address_of_regexp_stack_limit(masm_->isolate());
__ cmp(backtrack_stackpointer(), Operand::StaticVariable(stack_limit)); __ cmp(backtrack_stackpointer(), Operand::StaticVariable(stack_limit));
__ j(above, &no_stack_overflow, Label::kNear); __ j(above, &no_stack_overflow);
SafeCall(&stack_overflow_label_); SafeCall(&stack_overflow_label_);

View File

@ -1,4 +1,4 @@
// Copyright 2012 the V8 project authors. All rights reserved. // Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
@ -318,7 +318,7 @@ void RegExpMacroAssemblerX64::CheckCharacters(Vector<const uc16> str,
void RegExpMacroAssemblerX64::CheckGreedyLoop(Label* on_equal) { void RegExpMacroAssemblerX64::CheckGreedyLoop(Label* on_equal) {
Label fallthrough; Label fallthrough;
__ cmpl(rdi, Operand(backtrack_stackpointer(), 0)); __ cmpl(rdi, Operand(backtrack_stackpointer(), 0));
__ j(not_equal, &fallthrough, Label::kNear); __ j(not_equal, &fallthrough);
Drop(); Drop();
BranchOrBacktrack(no_condition, on_equal); BranchOrBacktrack(no_condition, on_equal);
__ bind(&fallthrough); __ bind(&fallthrough);
@ -368,7 +368,7 @@ void RegExpMacroAssemblerX64::CheckNotBackReferenceIgnoreCase(
// al - input character // al - input character
// dl - capture character // dl - capture character
__ cmpb(rax, rdx); __ cmpb(rax, rdx);
__ j(equal, &loop_increment, Label::kNear); __ j(equal, &loop_increment);
// Mismatch, try case-insensitive match (converting letters to lower-case). // 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 // I.e., if or-ing with 0x20 makes values equal and in range 'a'-'z', it's
@ -585,7 +585,7 @@ bool RegExpMacroAssemblerX64::CheckSpecialCharacterClass(uc16 type,
// ASCII space characters are '\t'..'\r' and ' '. // ASCII space characters are '\t'..'\r' and ' '.
Label success; Label success;
__ cmpl(current_character(), Immediate(' ')); __ cmpl(current_character(), Immediate(' '));
__ j(equal, &success, Label::kNear); __ j(equal, &success);
// Check range 0x09..0x0d // Check range 0x09..0x0d
__ lea(rax, Operand(current_character(), -'\t')); __ lea(rax, Operand(current_character(), -'\t'));
__ cmpl(rax, Immediate('\r' - '\t')); __ cmpl(rax, Immediate('\r' - '\t'));
@ -676,7 +676,7 @@ bool RegExpMacroAssemblerX64::CheckSpecialCharacterClass(uc16 type,
if (mode_ != ASCII) { if (mode_ != ASCII) {
// Table is 128 entries, so all ASCII characters can be tested. // Table is 128 entries, so all ASCII characters can be tested.
__ cmpl(current_character(), Immediate('z')); __ cmpl(current_character(), Immediate('z'));
__ j(above, &done, Label::kNear); __ j(above, &done);
} }
__ movq(rbx, ExternalReference::re_word_character_map()); __ movq(rbx, ExternalReference::re_word_character_map());
ASSERT_EQ(0, word_character_map[0]); // Character '\0' is not a word char. ASSERT_EQ(0, word_character_map[0]); // Character '\0' is not a word char.
@ -763,11 +763,11 @@ Handle<HeapObject> RegExpMacroAssemblerX64::GetCode(Handle<String> source) {
__ movq(kScratchRegister, stack_limit); __ movq(kScratchRegister, stack_limit);
__ subq(rcx, Operand(kScratchRegister, 0)); __ subq(rcx, Operand(kScratchRegister, 0));
// Handle it if the stack pointer is already below the stack limit. // Handle it if the stack pointer is already below the stack limit.
__ j(below_equal, &stack_limit_hit, Label::kNear); __ j(below_equal, &stack_limit_hit);
// Check if there is room for the variable number of registers above // Check if there is room for the variable number of registers above
// the stack limit. // the stack limit.
__ cmpq(rcx, Immediate(num_registers_ * kPointerSize)); __ cmpq(rcx, Immediate(num_registers_ * kPointerSize));
__ j(above_equal, &stack_ok, Label::kNear); __ j(above_equal, &stack_ok);
// Exit with OutOfMemory exception. There is not enough space on the stack // Exit with OutOfMemory exception. There is not enough space on the stack
// for our working registers. // for our working registers.
__ Set(rax, EXCEPTION); __ Set(rax, EXCEPTION);
@ -833,7 +833,7 @@ Handle<HeapObject> RegExpMacroAssemblerX64::GetCode(Handle<String> source) {
// Load previous char as initial value of current-character. // Load previous char as initial value of current-character.
Label at_start; Label at_start;
__ cmpb(Operand(rbp, kStartIndex), Immediate(0)); __ cmpb(Operand(rbp, kStartIndex), Immediate(0));
__ j(equal, &at_start, Label::kNear); __ j(equal, &at_start);
LoadCurrentCharacterUnchecked(-1, 1); // Load previous char. LoadCurrentCharacterUnchecked(-1, 1); // Load previous char.
__ jmp(&start_label_); __ jmp(&start_label_);
__ bind(&at_start); __ bind(&at_start);
@ -1370,7 +1370,7 @@ void RegExpMacroAssemblerX64::CheckPreemption() {
ExternalReference::address_of_stack_limit(masm_.isolate()); ExternalReference::address_of_stack_limit(masm_.isolate());
__ load_rax(stack_limit); __ load_rax(stack_limit);
__ cmpq(rsp, rax); __ cmpq(rsp, rax);
__ j(above, &no_preempt, Label::kNear); __ j(above, &no_preempt);
SafeCall(&check_preempt_label_); SafeCall(&check_preempt_label_);
@ -1384,7 +1384,7 @@ void RegExpMacroAssemblerX64::CheckStackLimit() {
ExternalReference::address_of_regexp_stack_limit(masm_.isolate()); ExternalReference::address_of_regexp_stack_limit(masm_.isolate());
__ load_rax(stack_limit); __ load_rax(stack_limit);
__ cmpq(backtrack_stackpointer(), rax); __ cmpq(backtrack_stackpointer(), rax);
__ j(above, &no_stack_overflow, Label::kNear); __ j(above, &no_stack_overflow);
SafeCall(&stack_overflow_label_); SafeCall(&stack_overflow_label_);