| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 virtual void PushBacktrack(Label* label); | 81 virtual void PushBacktrack(Label* label); |
| 82 virtual void PushCurrentPosition(); | 82 virtual void PushCurrentPosition(); |
| 83 virtual void PushRegister(int register_index); | 83 virtual void PushRegister(int register_index); |
| 84 virtual void ReadCurrentPositionFromRegister(int reg); | 84 virtual void ReadCurrentPositionFromRegister(int reg); |
| 85 virtual void ReadStackPointerFromRegister(int reg); | 85 virtual void ReadStackPointerFromRegister(int reg); |
| 86 virtual void SetRegister(int register_index, int to); | 86 virtual void SetRegister(int register_index, int to); |
| 87 virtual void Succeed(); | 87 virtual void Succeed(); |
| 88 virtual void WriteCurrentPositionToRegister(int reg); | 88 virtual void WriteCurrentPositionToRegister(int reg); |
| 89 virtual void WriteStackPointerToRegister(int reg); | 89 virtual void WriteStackPointerToRegister(int reg); |
| 90 | 90 |
| 91 template <typename T> |
| 92 static inline bool Execute(Code* code, |
| 93 T** input, |
| 94 int start_offset, |
| 95 int end_offset, |
| 96 int* output, |
| 97 bool at_start) { |
| 98 typedef bool (*matcher)(T**, int, int, int*, int); |
| 99 matcher matcher_func = FUNCTION_CAST<matcher>(code->entry()); |
| 100 int at_start_val = at_start ? 1 : 0; |
| 101 return matcher_func(input, start_offset, end_offset, output, at_start_val); |
| 102 } |
| 103 |
| 91 private: | 104 private: |
| 92 // Offsets from ebp of arguments to function. | 105 // Offsets from ebp of arguments to function. |
| 93 static const int kBackup_ebx = sizeof(uint32_t); | 106 static const int kBackup_ebx = sizeof(uint32_t); |
| 94 static const int kBackup_edi = kBackup_ebx + sizeof(uint32_t); | 107 static const int kBackup_edi = kBackup_ebx + sizeof(uint32_t); |
| 95 static const int kBackup_esi = kBackup_edi + sizeof(uint32_t); | 108 static const int kBackup_esi = kBackup_edi + sizeof(uint32_t); |
| 96 static const int kReturn_eip = kBackup_esi + sizeof(uint32_t); | 109 static const int kReturn_eip = kBackup_esi + sizeof(uint32_t); |
| 97 static const int kInputBuffer = kReturn_eip + sizeof(uint32_t); | 110 static const int kInputBuffer = kReturn_eip + sizeof(uint32_t); |
| 98 static const int kInputStartOffset = kInputBuffer + sizeof(uint32_t); | 111 static const int kInputStartOffset = kInputBuffer + sizeof(uint32_t); |
| 99 static const int kInputEndOffset = kInputStartOffset + sizeof(uint32_t); | 112 static const int kInputEndOffset = kInputStartOffset + sizeof(uint32_t); |
| 100 static const int kRegisterOutput = kInputEndOffset + sizeof(uint32_t); | 113 static const int kRegisterOutput = kInputEndOffset + sizeof(uint32_t); |
| 114 static const int kAtStart = kRegisterOutput + sizeof(uint32_t); |
| 101 | 115 |
| 102 // Initial size of code buffer. | 116 // Initial size of code buffer. |
| 103 static const size_t kRegExpCodeSize = 1024; | 117 static const size_t kRegExpCodeSize = 1024; |
| 104 // Initial size of constant buffers allocated during compilation. | 118 // Initial size of constant buffers allocated during compilation. |
| 105 static const int kRegExpConstantsSize = 256; | 119 static const int kRegExpConstantsSize = 256; |
| 106 // Only unroll loops up to this length. | 120 // Only unroll loops up to this length. |
| 107 static const int kMaxInlineStringTests = 8; | 121 static const int kMaxInlineStringTests = 8; |
| 108 // Special "character" marking end of input. | 122 // Special "character" marking end of input. |
| 109 static const uint32_t kEndOfInput = ~0; | 123 static const uint32_t kEndOfInput = ~0; |
| 110 | 124 |
| 111 // The ebp-relative location of a regexp register. | 125 // The ebp-relative location of a regexp register. |
| 112 Operand register_location(int register_index); | 126 Operand register_location(int register_index); |
| 113 | 127 |
| 114 // Byte size of chars in the string to match (decided by the Mode argument) | 128 // Byte size of chars in the string to match (decided by the Mode argument) |
| 115 size_t char_size(); | 129 size_t char_size(); |
| 116 | 130 |
| 117 // Records that a register is used. At the end, we need the number of | |
| 118 // registers used. | |
| 119 void RecordRegister(int register_index); | |
| 120 | |
| 121 // Equivalent to a conditional branch to the label, unless the label | 131 // Equivalent to a conditional branch to the label, unless the label |
| 122 // is NULL, in which case it is a conditional Backtrack. | 132 // is NULL, in which case it is a conditional Backtrack. |
| 123 void BranchOrBacktrack(Condition condition, Label* to); | 133 void BranchOrBacktrack(Condition condition, Label* to); |
| 124 | 134 |
| 125 // Generate code to perform case-canonicalization on the register. | 135 // Generate code to perform case-canonicalization on the register. |
| 126 void Canonicalize(Register register); | 136 void Canonicalize(Register register); |
| 127 | 137 |
| 128 // Read a character from input at the given offset from the current | 138 // Read a character from input at the given offset from the current |
| 129 // position. | 139 // position. |
| 130 void ReadChar(Register destination, int offset); | 140 void ReadChar(Register destination, int offset); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 157 Label start_label_; | 167 Label start_label_; |
| 158 Label success_label_; | 168 Label success_label_; |
| 159 Label exit_label_; | 169 Label exit_label_; |
| 160 // Handle used to represent the generated code object itself. | 170 // Handle used to represent the generated code object itself. |
| 161 Handle<Object> self_; | 171 Handle<Object> self_; |
| 162 }; | 172 }; |
| 163 | 173 |
| 164 }} // namespace v8::internal | 174 }} // namespace v8::internal |
| 165 | 175 |
| 166 #endif /* REGEXP_MACRO_ASSEMBLER_IA32_H_ */ | 176 #endif /* REGEXP_MACRO_ASSEMBLER_IA32_H_ */ |
| OLD | NEW |