Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 delete masm_; | 104 delete masm_; |
| 105 // Unuse labels in case we throw away the assembler without calling GetCode. | 105 // Unuse labels in case we throw away the assembler without calling GetCode. |
| 106 entry_label_.Unuse(); | 106 entry_label_.Unuse(); |
| 107 start_label_.Unuse(); | 107 start_label_.Unuse(); |
| 108 success_label_.Unuse(); | 108 success_label_.Unuse(); |
| 109 exit_label_.Unuse(); | 109 exit_label_.Unuse(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 | 112 |
| 113 void RegExpMacroAssemblerIA32::AdvanceCurrentPosition(int by) { | 113 void RegExpMacroAssemblerIA32::AdvanceCurrentPosition(int by) { |
| 114 ASSERT(by > 0); | 114 if (by != 0) { |
| 115 Label inside_string; | 115 Label inside_string; |
| 116 __ add(Operand(edi), Immediate(by * char_size())); | 116 __ add(Operand(edi), Immediate(by * char_size())); |
| 117 } | |
| 117 } | 118 } |
| 118 | 119 |
| 119 | 120 |
| 120 void RegExpMacroAssemblerIA32::AdvanceRegister(int reg, int by) { | 121 void RegExpMacroAssemblerIA32::AdvanceRegister(int reg, int by) { |
| 121 ASSERT(reg >= 0); | 122 ASSERT(reg >= 0); |
| 122 ASSERT(reg < num_registers_); | 123 ASSERT(reg < num_registers_); |
| 123 __ add(register_location(reg), Immediate(by)); | 124 __ add(register_location(reg), Immediate(by)); |
| 124 } | 125 } |
| 125 | 126 |
| 126 | 127 |
| 127 void RegExpMacroAssemblerIA32::Backtrack() { | 128 void RegExpMacroAssemblerIA32::Backtrack() { |
| 128 __ pop(ecx); | 129 __ pop(ecx); |
| 129 __ add(Operand(ecx), Immediate(self_)); | 130 __ add(Operand(ecx), Immediate(self_)); |
| 130 __ jmp(Operand(ecx)); | 131 __ jmp(Operand(ecx)); |
| 131 } | 132 } |
| 132 | 133 |
| 133 | 134 |
| 134 void RegExpMacroAssemblerIA32::Bind(Label* label) { | 135 void RegExpMacroAssemblerIA32::Bind(Label* label) { |
| 135 __ bind(label); | 136 __ bind(label); |
| 136 } | 137 } |
| 137 | 138 |
| 138 void RegExpMacroAssemblerIA32::CheckBitmap(uc16 start, | 139 void RegExpMacroAssemblerIA32::CheckBitmap(uc16 start, |
| 139 Label* bitmap, | 140 Label* bitmap, |
| 140 Label* on_zero) { | 141 Label* on_zero) { |
| 141 UNREACHABLE(); | 142 UNIMPLEMENTED(); |
| 142 __ mov(eax, current_character()); | 143 __ mov(eax, current_character()); |
| 143 __ sub(Operand(eax), Immediate(start)); | 144 __ sub(Operand(eax), Immediate(start)); |
| 144 __ cmp(eax, 64); // FIXME: 64 = length_of_bitmap_in_bits. | 145 __ cmp(eax, 64); // FIXME: 64 = length_of_bitmap_in_bits. |
| 145 BranchOrBacktrack(greater_equal, on_zero); | 146 BranchOrBacktrack(greater_equal, on_zero); |
| 146 __ mov(ebx, eax); | 147 __ mov(ebx, eax); |
| 147 __ shr(ebx, 3); | 148 __ shr(ebx, 3); |
| 148 // TODO(lrn): Where is the bitmap stored? Pass the bitmap as argument instead. | 149 // TODO(lrn): Where is the bitmap stored? Pass the bitmap as argument instead. |
| 149 // __ mov(ecx, position_of_bitmap); | 150 // __ mov(ecx, position_of_bitmap); |
| 150 __ movzx_b(ebx, Operand(ecx, ebx, times_1, 0)); | 151 __ movzx_b(ebx, Operand(ecx, ebx, times_1, 0)); |
| 151 __ and_(eax, (1<<3)-1); | 152 __ and_(eax, (1<<3)-1); |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 676 // Private methods: | 677 // Private methods: |
| 677 | 678 |
| 678 | 679 |
| 679 static unibrow::Mapping<unibrow::Ecma262Canonicalize> canonicalize; | 680 static unibrow::Mapping<unibrow::Ecma262Canonicalize> canonicalize; |
| 680 | 681 |
| 681 | 682 |
| 682 int RegExpMacroAssemblerIA32::CaseInsensitiveCompareUC16(uc16** buffer, | 683 int RegExpMacroAssemblerIA32::CaseInsensitiveCompareUC16(uc16** buffer, |
| 683 int byte_offset1, | 684 int byte_offset1, |
| 684 int byte_offset2, | 685 int byte_offset2, |
| 685 size_t byte_length) { | 686 size_t byte_length) { |
| 687 // This function MUST NOT cause a garbage collection. A GC might move | |
|
Erik Corry
2008/12/08 12:47:52
Instead of shouting RFC-style I would prefer 'is n
| |
| 688 // the calling generated code and invalidate the stacked return address. | |
| 686 ASSERT(byte_length % 2 == 0); | 689 ASSERT(byte_length % 2 == 0); |
| 687 Address buffer_address = reinterpret_cast<Address>(*buffer); | 690 Address buffer_address = reinterpret_cast<Address>(*buffer); |
| 688 uc16* substring1 = reinterpret_cast<uc16*>(buffer_address + byte_offset1); | 691 uc16* substring1 = reinterpret_cast<uc16*>(buffer_address + byte_offset1); |
| 689 uc16* substring2 = reinterpret_cast<uc16*>(buffer_address + byte_offset2); | 692 uc16* substring2 = reinterpret_cast<uc16*>(buffer_address + byte_offset2); |
| 690 size_t length = byte_length >> 1; | 693 size_t length = byte_length >> 1; |
| 691 | 694 |
| 692 for (size_t i = 0; i < length; i++) { | 695 for (size_t i = 0; i < length; i++) { |
| 693 unibrow::uchar c1 = substring1[i]; | 696 unibrow::uchar c1 = substring1[i]; |
| 694 unibrow::uchar c2 = substring2[i]; | 697 unibrow::uchar c2 = substring2[i]; |
| 695 if (c1 != c2) { | 698 if (c1 != c2) { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 795 | 798 |
| 796 | 799 |
| 797 void RegExpMacroAssemblerIA32::LoadConstantBufferAddress(Register reg, | 800 void RegExpMacroAssemblerIA32::LoadConstantBufferAddress(Register reg, |
| 798 ArraySlice* buffer) { | 801 ArraySlice* buffer) { |
| 799 __ mov(reg, buffer->array()); | 802 __ mov(reg, buffer->array()); |
| 800 __ add(Operand(reg), Immediate(buffer->base_offset())); | 803 __ add(Operand(reg), Immediate(buffer->base_offset())); |
| 801 } | 804 } |
| 802 | 805 |
| 803 #undef __ | 806 #undef __ |
| 804 }} // namespace v8::internal | 807 }} // namespace v8::internal |
| OLD | NEW |