| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 | 84 |
| 85 | 85 |
| 86 void RegExpMacroAssemblerIrregexp::PopRegister(int register_index) { | 86 void RegExpMacroAssemblerIrregexp::PopRegister(int register_index) { |
| 87 Emit(BC_POP_REGISTER); | 87 Emit(BC_POP_REGISTER); |
| 88 Emit(register_index); | 88 Emit(register_index); |
| 89 } | 89 } |
| 90 | 90 |
| 91 | 91 |
| 92 void RegExpMacroAssemblerIrregexp::PushRegister(int register_index) { | 92 void RegExpMacroAssemblerIrregexp::PushRegister( |
| 93 int register_index, |
| 94 StackCheckFlag check_stack_limit) { |
| 93 ASSERT(register_index >= 0); | 95 ASSERT(register_index >= 0); |
| 94 Emit(BC_PUSH_REGISTER); | 96 Emit(BC_PUSH_REGISTER); |
| 95 Emit(register_index); | 97 Emit(register_index); |
| 96 } | 98 } |
| 97 | 99 |
| 98 | 100 |
| 99 void RegExpMacroAssemblerIrregexp::WriteCurrentPositionToRegister( | 101 void RegExpMacroAssemblerIrregexp::WriteCurrentPositionToRegister( |
| 100 int register_index, int cp_offset) { | 102 int register_index, int cp_offset) { |
| 101 ASSERT(register_index >= 0); | 103 ASSERT(register_index >= 0); |
| 102 Emit(BC_SET_REGISTER_TO_CP); | 104 Emit(BC_SET_REGISTER_TO_CP); |
| 103 Emit(register_index); | 105 Emit(register_index); |
| 104 Emit32(cp_offset); // Current position offset. | 106 Emit32(cp_offset); // Current position offset. |
| 105 } | 107 } |
| 106 | 108 |
| 107 | 109 |
| 110 void RegExpMacroAssemblerIrregexp::ClearRegister(int reg) { |
| 111 SetRegister(reg, -1); |
| 112 } |
| 113 |
| 114 |
| 108 void RegExpMacroAssemblerIrregexp::ReadCurrentPositionFromRegister( | 115 void RegExpMacroAssemblerIrregexp::ReadCurrentPositionFromRegister( |
| 109 int register_index) { | 116 int register_index) { |
| 110 ASSERT(register_index >= 0); | 117 ASSERT(register_index >= 0); |
| 111 Emit(BC_SET_CP_TO_REGISTER); | 118 Emit(BC_SET_CP_TO_REGISTER); |
| 112 Emit(register_index); | 119 Emit(register_index); |
| 113 } | 120 } |
| 114 | 121 |
| 115 | 122 |
| 116 void RegExpMacroAssemblerIrregexp::WriteStackPointerToRegister( | 123 void RegExpMacroAssemblerIrregexp::WriteStackPointerToRegister( |
| 117 int register_index) { | 124 int register_index) { |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 int comparand, | 401 int comparand, |
| 395 Label* on_greater_or_equal) { | 402 Label* on_greater_or_equal) { |
| 396 ASSERT(comparand >= 0 && comparand <= 65535); | 403 ASSERT(comparand >= 0 && comparand <= 65535); |
| 397 Emit(BC_CHECK_REGISTER_GE); | 404 Emit(BC_CHECK_REGISTER_GE); |
| 398 Emit(register_index); | 405 Emit(register_index); |
| 399 Emit16(comparand); | 406 Emit16(comparand); |
| 400 EmitOrLink(on_greater_or_equal); | 407 EmitOrLink(on_greater_or_equal); |
| 401 } | 408 } |
| 402 | 409 |
| 403 | 410 |
| 411 void RegExpMacroAssemblerIrregexp::IfRegisterEqPos(int register_index, |
| 412 Label* on_eq) { |
| 413 Emit(BC_CHECK_REGISTER_EQ_POS); |
| 414 Emit(register_index); |
| 415 EmitOrLink(on_eq); |
| 416 } |
| 417 |
| 418 |
| 404 Handle<Object> RegExpMacroAssemblerIrregexp::GetCode(Handle<String> source) { | 419 Handle<Object> RegExpMacroAssemblerIrregexp::GetCode(Handle<String> source) { |
| 405 Bind(&backtrack_); | 420 Bind(&backtrack_); |
| 406 Emit(BC_POP_BT); | 421 Emit(BC_POP_BT); |
| 407 Handle<ByteArray> array = Factory::NewByteArray(length()); | 422 Handle<ByteArray> array = Factory::NewByteArray(length()); |
| 408 Copy(array->GetDataStartAddress()); | 423 Copy(array->GetDataStartAddress()); |
| 409 return array; | 424 return array; |
| 410 } | 425 } |
| 411 | 426 |
| 412 | 427 |
| 413 int RegExpMacroAssemblerIrregexp::length() { | 428 int RegExpMacroAssemblerIrregexp::length() { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 426 buffer_ = Vector<byte>::New(old_buffer.length() * 2); | 441 buffer_ = Vector<byte>::New(old_buffer.length() * 2); |
| 427 own_buffer_ = true; | 442 own_buffer_ = true; |
| 428 memcpy(buffer_.start(), old_buffer.start(), old_buffer.length()); | 443 memcpy(buffer_.start(), old_buffer.start(), old_buffer.length()); |
| 429 if (old_buffer_was_our_own) { | 444 if (old_buffer_was_our_own) { |
| 430 old_buffer.Dispose(); | 445 old_buffer.Dispose(); |
| 431 } | 446 } |
| 432 } | 447 } |
| 433 | 448 |
| 434 | 449 |
| 435 } } // namespace v8::internal | 450 } } // namespace v8::internal |
| OLD | NEW |