~ubuntu-branches/ubuntu/trusty/libv8/trusty

« back to all changes in this revision

Viewing changes to src/interpreter-irregexp.cc

  • Committer: Package Import Robot
  • Author(s): Jérémy Lal
  • Date: 2012-02-20 14:08:17 UTC
  • mfrom: (15.1.24 sid)
  • Revision ID: package-import@ubuntu.com-20120220140817-bsvmeoa4sxsj5hbz
Tags: 3.7.12.22-3
Fix mipsel build, allow test debug-step-3 to fail (non-crucial)

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include "utils.h"
34
34
#include "ast.h"
35
35
#include "bytecodes-irregexp.h"
 
36
#include "jsregexp.h"
36
37
#include "interpreter-irregexp.h"
37
38
 
38
 
 
39
39
namespace v8 {
40
40
namespace internal {
41
41
 
187
187
 
188
188
 
189
189
template <typename Char>
190
 
static bool RawMatch(Isolate* isolate,
191
 
                     const byte* code_base,
192
 
                     Vector<const Char> subject,
193
 
                     int* registers,
194
 
                     int current,
195
 
                     uint32_t current_char) {
 
190
static RegExpImpl::IrregexpResult RawMatch(Isolate* isolate,
 
191
                                           const byte* code_base,
 
192
                                           Vector<const Char> subject,
 
193
                                           int* registers,
 
194
                                           int current,
 
195
                                           uint32_t current_char) {
196
196
  const byte* pc = code_base;
197
197
  // BacktrackStack ensures that the memory allocated for the backtracking stack
198
198
  // is returned to the system or cached if there is no stack being cached at
211
211
    switch (insn & BYTECODE_MASK) {
212
212
      BYTECODE(BREAK)
213
213
        UNREACHABLE();
214
 
        return false;
 
214
        return RegExpImpl::RE_FAILURE;
215
215
      BYTECODE(PUSH_CP)
216
216
        if (--backtrack_stack_space < 0) {
217
 
          return false;  // No match on backtrack stack overflow.
 
217
          return RegExpImpl::RE_EXCEPTION;
218
218
        }
219
219
        *backtrack_sp++ = current;
220
220
        pc += BC_PUSH_CP_LENGTH;
221
221
        break;
222
222
      BYTECODE(PUSH_BT)
223
223
        if (--backtrack_stack_space < 0) {
224
 
          return false;  // No match on backtrack stack overflow.
 
224
          return RegExpImpl::RE_EXCEPTION;
225
225
        }
226
226
        *backtrack_sp++ = Load32Aligned(pc + 4);
227
227
        pc += BC_PUSH_BT_LENGTH;
228
228
        break;
229
229
      BYTECODE(PUSH_REGISTER)
230
230
        if (--backtrack_stack_space < 0) {
231
 
          return false;  // No match on backtrack stack overflow.
 
231
          return RegExpImpl::RE_EXCEPTION;
232
232
        }
233
233
        *backtrack_sp++ = registers[insn >> BYTECODE_SHIFT];
234
234
        pc += BC_PUSH_REGISTER_LENGTH;
278
278
        pc += BC_POP_REGISTER_LENGTH;
279
279
        break;
280
280
      BYTECODE(FAIL)
281
 
        return false;
 
281
        return RegExpImpl::RE_FAILURE;
282
282
      BYTECODE(SUCCEED)
283
 
        return true;
 
283
        return RegExpImpl::RE_SUCCESS;
284
284
      BYTECODE(ADVANCE_CP)
285
285
        current += insn >> BYTECODE_SHIFT;
286
286
        pc += BC_ADVANCE_CP_LENGTH;
625
625
}
626
626
 
627
627
 
628
 
bool IrregexpInterpreter::Match(Isolate* isolate,
629
 
                                Handle<ByteArray> code_array,
630
 
                                Handle<String> subject,
631
 
                                int* registers,
632
 
                                int start_position) {
 
628
RegExpImpl::IrregexpResult IrregexpInterpreter::Match(
 
629
    Isolate* isolate,
 
630
    Handle<ByteArray> code_array,
 
631
    Handle<String> subject,
 
632
    int* registers,
 
633
    int start_position) {
633
634
  ASSERT(subject->IsFlat());
634
635
 
635
636
  AssertNoAllocation a;