ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 1 | // Copyright 2008 the V8 project authors. All rights reserved. |
| 2 | // Redistribution and use in source and binary forms, with or without |
| 3 | // modification, are permitted provided that the following conditions are |
| 4 | // met: |
| 5 | // |
| 6 | // * Redistributions of source code must retain the above copyright |
| 7 | // notice, this list of conditions and the following disclaimer. |
| 8 | // * Redistributions in binary form must reproduce the above |
| 9 | // copyright notice, this list of conditions and the following |
| 10 | // disclaimer in the documentation and/or other materials provided |
| 11 | // with the distribution. |
| 12 | // * Neither the name of Google Inc. nor the names of its |
| 13 | // contributors may be used to endorse or promote products derived |
| 14 | // from this software without specific prior written permission. |
| 15 | // |
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
| 28 | #include "v8.h" |
| 29 | #include "ast.h" |
| 30 | #include "regexp-macro-assembler.h" |
| 31 | #include "regexp-macro-assembler-tracer.h" |
| 32 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 33 | namespace v8 { |
| 34 | namespace internal { |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 35 | |
| 36 | RegExpMacroAssemblerTracer::RegExpMacroAssemblerTracer( |
| 37 | RegExpMacroAssembler* assembler) : |
| 38 | assembler_(assembler) { |
| 39 | unsigned int type = assembler->Implementation(); |
lrn@chromium.org | c34f580 | 2010-04-28 12:53:43 +0000 | [diff] [blame] | 40 | ASSERT(type < 4); |
| 41 | const char* impl_names[4] = {"IA32", "ARM", "X64", "Bytecode"}; |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 42 | PrintF("RegExpMacroAssembler%s();\n", impl_names[type]); |
| 43 | } |
| 44 | |
| 45 | |
| 46 | RegExpMacroAssemblerTracer::~RegExpMacroAssemblerTracer() { |
| 47 | } |
| 48 | |
| 49 | |
kmillikin@chromium.org | f05f291 | 2010-09-30 10:07:24 +0000 | [diff] [blame] | 50 | // This is used for printing out debugging information. It makes an integer |
| 51 | // that is closely related to the address of an object. |
| 52 | static int LabelToInt(Label* label) { |
| 53 | return static_cast<int>(reinterpret_cast<intptr_t>(label)); |
| 54 | } |
| 55 | |
| 56 | |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 57 | void RegExpMacroAssemblerTracer::Bind(Label* label) { |
kmillikin@chromium.org | f05f291 | 2010-09-30 10:07:24 +0000 | [diff] [blame] | 58 | PrintF("label[%08x]: (Bind)\n", LabelToInt(label)); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 59 | assembler_->Bind(label); |
| 60 | } |
| 61 | |
| 62 | |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 63 | void RegExpMacroAssemblerTracer::AdvanceCurrentPosition(int by) { |
| 64 | PrintF(" AdvanceCurrentPosition(by=%d);\n", by); |
| 65 | assembler_->AdvanceCurrentPosition(by); |
| 66 | } |
| 67 | |
| 68 | |
ager@chromium.org | 8bb6058 | 2008-12-11 12:02:20 +0000 | [diff] [blame] | 69 | void RegExpMacroAssemblerTracer::CheckGreedyLoop(Label* label) { |
kmillikin@chromium.org | f05f291 | 2010-09-30 10:07:24 +0000 | [diff] [blame] | 70 | PrintF(" CheckGreedyLoop(label[%08x]);\n\n", LabelToInt(label)); |
ager@chromium.org | 8bb6058 | 2008-12-11 12:02:20 +0000 | [diff] [blame] | 71 | assembler_->CheckGreedyLoop(label); |
| 72 | } |
| 73 | |
| 74 | |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 75 | void RegExpMacroAssemblerTracer::PopCurrentPosition() { |
| 76 | PrintF(" PopCurrentPosition();\n"); |
| 77 | assembler_->PopCurrentPosition(); |
| 78 | } |
| 79 | |
| 80 | |
| 81 | void RegExpMacroAssemblerTracer::PushCurrentPosition() { |
| 82 | PrintF(" PushCurrentPosition();\n"); |
| 83 | assembler_->PushCurrentPosition(); |
| 84 | } |
| 85 | |
| 86 | |
| 87 | void RegExpMacroAssemblerTracer::Backtrack() { |
| 88 | PrintF(" Backtrack();\n"); |
| 89 | assembler_->Backtrack(); |
| 90 | } |
| 91 | |
| 92 | |
| 93 | void RegExpMacroAssemblerTracer::GoTo(Label* label) { |
kmillikin@chromium.org | f05f291 | 2010-09-30 10:07:24 +0000 | [diff] [blame] | 94 | PrintF(" GoTo(label[%08x]);\n\n", LabelToInt(label)); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 95 | assembler_->GoTo(label); |
| 96 | } |
| 97 | |
| 98 | |
| 99 | void RegExpMacroAssemblerTracer::PushBacktrack(Label* label) { |
kmillikin@chromium.org | f05f291 | 2010-09-30 10:07:24 +0000 | [diff] [blame] | 100 | PrintF(" PushBacktrack(label[%08x]);\n", LabelToInt(label)); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 101 | assembler_->PushBacktrack(label); |
| 102 | } |
| 103 | |
| 104 | |
| 105 | void RegExpMacroAssemblerTracer::Succeed() { |
| 106 | PrintF(" Succeed();\n"); |
| 107 | assembler_->Succeed(); |
| 108 | } |
| 109 | |
| 110 | |
| 111 | void RegExpMacroAssemblerTracer::Fail() { |
| 112 | PrintF(" Fail();\n"); |
| 113 | assembler_->Fail(); |
| 114 | } |
| 115 | |
| 116 | |
| 117 | void RegExpMacroAssemblerTracer::PopRegister(int register_index) { |
| 118 | PrintF(" PopRegister(register=%d);\n", register_index); |
| 119 | assembler_->PopRegister(register_index); |
| 120 | } |
| 121 | |
| 122 | |
ager@chromium.org | 3291210 | 2009-01-16 10:38:43 +0000 | [diff] [blame] | 123 | void RegExpMacroAssemblerTracer::PushRegister( |
| 124 | int register_index, |
| 125 | StackCheckFlag check_stack_limit) { |
| 126 | PrintF(" PushRegister(register=%d, %s);\n", |
| 127 | register_index, |
| 128 | check_stack_limit ? "check stack limit" : ""); |
| 129 | assembler_->PushRegister(register_index, check_stack_limit); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 130 | } |
| 131 | |
| 132 | |
| 133 | void RegExpMacroAssemblerTracer::AdvanceRegister(int reg, int by) { |
| 134 | PrintF(" AdvanceRegister(register=%d, by=%d);\n", reg, by); |
| 135 | assembler_->AdvanceRegister(reg, by); |
| 136 | } |
| 137 | |
| 138 | |
whesse@chromium.org | 4a5224e | 2010-10-20 12:37:07 +0000 | [diff] [blame] | 139 | void RegExpMacroAssemblerTracer::SetCurrentPositionFromEnd(int by) { |
| 140 | PrintF(" SetCurrentPositionFromEnd(by=%d);\n", by); |
| 141 | assembler_->SetCurrentPositionFromEnd(by); |
| 142 | } |
| 143 | |
| 144 | |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 145 | void RegExpMacroAssemblerTracer::SetRegister(int register_index, int to) { |
| 146 | PrintF(" SetRegister(register=%d, to=%d);\n", register_index, to); |
| 147 | assembler_->SetRegister(register_index, to); |
| 148 | } |
| 149 | |
| 150 | |
ager@chromium.org | 8bb6058 | 2008-12-11 12:02:20 +0000 | [diff] [blame] | 151 | void RegExpMacroAssemblerTracer::WriteCurrentPositionToRegister(int reg, |
| 152 | int cp_offset) { |
| 153 | PrintF(" WriteCurrentPositionToRegister(register=%d,cp_offset=%d);\n", |
| 154 | reg, |
| 155 | cp_offset); |
| 156 | assembler_->WriteCurrentPositionToRegister(reg, cp_offset); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 157 | } |
| 158 | |
| 159 | |
ager@chromium.org | ddb913d | 2009-01-27 10:01:48 +0000 | [diff] [blame] | 160 | void RegExpMacroAssemblerTracer::ClearRegisters(int reg_from, int reg_to) { |
| 161 | PrintF(" ClearRegister(from=%d, to=%d);\n", reg_from, reg_to); |
| 162 | assembler_->ClearRegisters(reg_from, reg_to); |
ager@chromium.org | 3291210 | 2009-01-16 10:38:43 +0000 | [diff] [blame] | 163 | } |
| 164 | |
| 165 | |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 166 | void RegExpMacroAssemblerTracer::ReadCurrentPositionFromRegister(int reg) { |
| 167 | PrintF(" ReadCurrentPositionFromRegister(register=%d);\n", reg); |
| 168 | assembler_->ReadCurrentPositionFromRegister(reg); |
| 169 | } |
| 170 | |
| 171 | |
| 172 | void RegExpMacroAssemblerTracer::WriteStackPointerToRegister(int reg) { |
| 173 | PrintF(" WriteStackPointerToRegister(register=%d);\n", reg); |
| 174 | assembler_->WriteStackPointerToRegister(reg); |
| 175 | } |
| 176 | |
| 177 | |
| 178 | void RegExpMacroAssemblerTracer::ReadStackPointerFromRegister(int reg) { |
| 179 | PrintF(" ReadStackPointerFromRegister(register=%d);\n", reg); |
| 180 | assembler_->ReadStackPointerFromRegister(reg); |
| 181 | } |
| 182 | |
| 183 | |
| 184 | void RegExpMacroAssemblerTracer::LoadCurrentCharacter(int cp_offset, |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 185 | Label* on_end_of_input, |
| 186 | bool check_bounds, |
| 187 | int characters) { |
| 188 | const char* check_msg = check_bounds ? "" : " (unchecked)"; |
| 189 | PrintF(" LoadCurrentCharacter(cp_offset=%d, label[%08x]%s (%d chars));\n", |
ager@chromium.org | 8bb6058 | 2008-12-11 12:02:20 +0000 | [diff] [blame] | 190 | cp_offset, |
kmillikin@chromium.org | f05f291 | 2010-09-30 10:07:24 +0000 | [diff] [blame] | 191 | LabelToInt(on_end_of_input), |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 192 | check_msg, |
| 193 | characters); |
| 194 | assembler_->LoadCurrentCharacter(cp_offset, |
| 195 | on_end_of_input, |
| 196 | check_bounds, |
| 197 | characters); |
ager@chromium.org | 8bb6058 | 2008-12-11 12:02:20 +0000 | [diff] [blame] | 198 | } |
| 199 | |
| 200 | |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 201 | void RegExpMacroAssemblerTracer::CheckCharacterLT(uc16 limit, Label* on_less) { |
kmillikin@chromium.org | f05f291 | 2010-09-30 10:07:24 +0000 | [diff] [blame] | 202 | PrintF(" CheckCharacterLT(c='u%04x', label[%08x]);\n", |
| 203 | limit, LabelToInt(on_less)); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 204 | assembler_->CheckCharacterLT(limit, on_less); |
| 205 | } |
| 206 | |
| 207 | |
| 208 | void RegExpMacroAssemblerTracer::CheckCharacterGT(uc16 limit, |
| 209 | Label* on_greater) { |
kmillikin@chromium.org | f05f291 | 2010-09-30 10:07:24 +0000 | [diff] [blame] | 210 | PrintF(" CheckCharacterGT(c='u%04x', label[%08x]);\n", |
| 211 | limit, LabelToInt(on_greater)); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 212 | assembler_->CheckCharacterGT(limit, on_greater); |
| 213 | } |
| 214 | |
| 215 | |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 216 | void RegExpMacroAssemblerTracer::CheckCharacter(uint32_t c, Label* on_equal) { |
kmillikin@chromium.org | f05f291 | 2010-09-30 10:07:24 +0000 | [diff] [blame] | 217 | PrintF(" CheckCharacter(c='u%04x', label[%08x]);\n", |
| 218 | c, LabelToInt(on_equal)); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 219 | assembler_->CheckCharacter(c, on_equal); |
| 220 | } |
| 221 | |
| 222 | |
ager@chromium.org | ddb913d | 2009-01-27 10:01:48 +0000 | [diff] [blame] | 223 | void RegExpMacroAssemblerTracer::CheckAtStart(Label* on_at_start) { |
kmillikin@chromium.org | f05f291 | 2010-09-30 10:07:24 +0000 | [diff] [blame] | 224 | PrintF(" CheckAtStart(label[%08x]);\n", LabelToInt(on_at_start)); |
ager@chromium.org | ddb913d | 2009-01-27 10:01:48 +0000 | [diff] [blame] | 225 | assembler_->CheckAtStart(on_at_start); |
| 226 | } |
| 227 | |
| 228 | |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 229 | void RegExpMacroAssemblerTracer::CheckNotAtStart(Label* on_not_at_start) { |
kmillikin@chromium.org | f05f291 | 2010-09-30 10:07:24 +0000 | [diff] [blame] | 230 | PrintF(" CheckNotAtStart(label[%08x]);\n", LabelToInt(on_not_at_start)); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 231 | assembler_->CheckNotAtStart(on_not_at_start); |
| 232 | } |
| 233 | |
| 234 | |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 235 | void RegExpMacroAssemblerTracer::CheckNotCharacter(uint32_t c, |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 236 | Label* on_not_equal) { |
kmillikin@chromium.org | f05f291 | 2010-09-30 10:07:24 +0000 | [diff] [blame] | 237 | PrintF(" CheckNotCharacter(c='u%04x', label[%08x]);\n", |
| 238 | c, LabelToInt(on_not_equal)); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 239 | assembler_->CheckNotCharacter(c, on_not_equal); |
| 240 | } |
| 241 | |
| 242 | |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 243 | void RegExpMacroAssemblerTracer::CheckCharacterAfterAnd( |
| 244 | uint32_t c, |
| 245 | uint32_t mask, |
| 246 | Label* on_equal) { |
| 247 | PrintF(" CheckCharacterAfterAnd(c='u%04x', mask=0x%04x, label[%08x]);\n", |
| 248 | c, |
| 249 | mask, |
kmillikin@chromium.org | f05f291 | 2010-09-30 10:07:24 +0000 | [diff] [blame] | 250 | LabelToInt(on_equal)); |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 251 | assembler_->CheckCharacterAfterAnd(c, mask, on_equal); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 252 | } |
| 253 | |
| 254 | |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 255 | void RegExpMacroAssemblerTracer::CheckNotCharacterAfterAnd( |
| 256 | uint32_t c, |
| 257 | uint32_t mask, |
| 258 | Label* on_not_equal) { |
| 259 | PrintF(" CheckNotCharacterAfterAnd(c='u%04x', mask=0x%04x, label[%08x]);\n", |
| 260 | c, |
| 261 | mask, |
kmillikin@chromium.org | f05f291 | 2010-09-30 10:07:24 +0000 | [diff] [blame] | 262 | LabelToInt(on_not_equal)); |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 263 | assembler_->CheckNotCharacterAfterAnd(c, mask, on_not_equal); |
| 264 | } |
| 265 | |
| 266 | |
| 267 | void RegExpMacroAssemblerTracer::CheckNotCharacterAfterMinusAnd( |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 268 | uc16 c, |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 269 | uc16 minus, |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 270 | uc16 mask, |
| 271 | Label* on_not_equal) { |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 272 | PrintF(" CheckNotCharacterAfterMinusAnd(c='u%04x', minus=%04x, mask=0x%04x, " |
| 273 | "label[%08x]);\n", |
| 274 | c, |
| 275 | minus, |
| 276 | mask, |
kmillikin@chromium.org | f05f291 | 2010-09-30 10:07:24 +0000 | [diff] [blame] | 277 | LabelToInt(on_not_equal)); |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 278 | assembler_->CheckNotCharacterAfterMinusAnd(c, minus, mask, on_not_equal); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 279 | } |
| 280 | |
| 281 | |
| 282 | void RegExpMacroAssemblerTracer::CheckNotBackReference(int start_reg, |
| 283 | Label* on_no_match) { |
| 284 | PrintF(" CheckNotBackReference(register=%d, label[%08x]);\n", start_reg, |
kmillikin@chromium.org | f05f291 | 2010-09-30 10:07:24 +0000 | [diff] [blame] | 285 | LabelToInt(on_no_match)); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 286 | assembler_->CheckNotBackReference(start_reg, on_no_match); |
| 287 | } |
| 288 | |
| 289 | |
| 290 | void RegExpMacroAssemblerTracer::CheckNotBackReferenceIgnoreCase( |
| 291 | int start_reg, |
| 292 | Label* on_no_match) { |
| 293 | PrintF(" CheckNotBackReferenceIgnoreCase(register=%d, label[%08x]);\n", |
kmillikin@chromium.org | f05f291 | 2010-09-30 10:07:24 +0000 | [diff] [blame] | 294 | start_reg, LabelToInt(on_no_match)); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 295 | assembler_->CheckNotBackReferenceIgnoreCase(start_reg, on_no_match); |
| 296 | } |
| 297 | |
| 298 | |
| 299 | void RegExpMacroAssemblerTracer::CheckNotRegistersEqual(int reg1, |
| 300 | int reg2, |
| 301 | Label* on_not_equal) { |
| 302 | PrintF(" CheckNotRegistersEqual(reg1=%d, reg2=%d, label[%08x]);\n", |
| 303 | reg1, |
| 304 | reg2, |
kmillikin@chromium.org | f05f291 | 2010-09-30 10:07:24 +0000 | [diff] [blame] | 305 | LabelToInt(on_not_equal)); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 306 | assembler_->CheckNotRegistersEqual(reg1, reg2, on_not_equal); |
| 307 | } |
| 308 | |
| 309 | |
| 310 | void RegExpMacroAssemblerTracer::CheckCharacters(Vector<const uc16> str, |
| 311 | int cp_offset, |
ager@chromium.org | 8bb6058 | 2008-12-11 12:02:20 +0000 | [diff] [blame] | 312 | Label* on_failure, |
| 313 | bool check_end_of_string) { |
| 314 | PrintF(" %s(str=\"", |
| 315 | check_end_of_string ? "CheckCharacters" : "CheckCharactersUnchecked"); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 316 | for (int i = 0; i < str.length(); i++) { |
| 317 | PrintF("u%04x", str[i]); |
| 318 | } |
kmillikin@chromium.org | f05f291 | 2010-09-30 10:07:24 +0000 | [diff] [blame] | 319 | PrintF("\", cp_offset=%d, label[%08x])\n", |
| 320 | cp_offset, LabelToInt(on_failure)); |
ager@chromium.org | 8bb6058 | 2008-12-11 12:02:20 +0000 | [diff] [blame] | 321 | assembler_->CheckCharacters(str, cp_offset, on_failure, check_end_of_string); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 322 | } |
| 323 | |
| 324 | |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 325 | bool RegExpMacroAssemblerTracer::CheckSpecialCharacterClass( |
| 326 | uc16 type, |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 327 | Label* on_no_match) { |
| 328 | bool supported = assembler_->CheckSpecialCharacterClass(type, |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 329 | on_no_match); |
fschneider@chromium.org | 0c20e67 | 2010-01-14 15:28:53 +0000 | [diff] [blame] | 330 | PrintF(" CheckSpecialCharacterClass(type='%c', label[%08x]): %s;\n", |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 331 | type, |
kmillikin@chromium.org | f05f291 | 2010-09-30 10:07:24 +0000 | [diff] [blame] | 332 | LabelToInt(on_no_match), |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 333 | supported ? "true" : "false"); |
| 334 | return supported; |
| 335 | } |
| 336 | |
| 337 | |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 338 | void RegExpMacroAssemblerTracer::IfRegisterLT(int register_index, |
| 339 | int comparand, Label* if_lt) { |
| 340 | PrintF(" IfRegisterLT(register=%d, number=%d, label[%08x]);\n", |
kmillikin@chromium.org | f05f291 | 2010-09-30 10:07:24 +0000 | [diff] [blame] | 341 | register_index, comparand, LabelToInt(if_lt)); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 342 | assembler_->IfRegisterLT(register_index, comparand, if_lt); |
| 343 | } |
| 344 | |
| 345 | |
ager@chromium.org | 3291210 | 2009-01-16 10:38:43 +0000 | [diff] [blame] | 346 | void RegExpMacroAssemblerTracer::IfRegisterEqPos(int register_index, |
| 347 | Label* if_eq) { |
| 348 | PrintF(" IfRegisterEqPos(register=%d, label[%08x]);\n", |
kmillikin@chromium.org | f05f291 | 2010-09-30 10:07:24 +0000 | [diff] [blame] | 349 | register_index, LabelToInt(if_eq)); |
ager@chromium.org | 3291210 | 2009-01-16 10:38:43 +0000 | [diff] [blame] | 350 | assembler_->IfRegisterEqPos(register_index, if_eq); |
| 351 | } |
| 352 | |
| 353 | |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 354 | void RegExpMacroAssemblerTracer::IfRegisterGE(int register_index, |
| 355 | int comparand, Label* if_ge) { |
| 356 | PrintF(" IfRegisterGE(register=%d, number=%d, label[%08x]);\n", |
kmillikin@chromium.org | f05f291 | 2010-09-30 10:07:24 +0000 | [diff] [blame] | 357 | register_index, comparand, LabelToInt(if_ge)); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 358 | assembler_->IfRegisterGE(register_index, comparand, if_ge); |
| 359 | } |
| 360 | |
| 361 | |
| 362 | RegExpMacroAssembler::IrregexpImplementation |
| 363 | RegExpMacroAssemblerTracer::Implementation() { |
| 364 | return assembler_->Implementation(); |
| 365 | } |
| 366 | |
| 367 | |
ager@chromium.org | 8bb6058 | 2008-12-11 12:02:20 +0000 | [diff] [blame] | 368 | Handle<Object> RegExpMacroAssemblerTracer::GetCode(Handle<String> source) { |
| 369 | PrintF(" GetCode(%s);\n", *(source->ToCString())); |
| 370 | return assembler_->GetCode(source); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 371 | } |
| 372 | |
| 373 | }} // namespace v8::internal |