| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 24 matching lines...) Expand all Loading... |
| 35 #include "runtime.h" | 35 #include "runtime.h" |
| 36 #include "top.h" | 36 #include "top.h" |
| 37 #include "compilation-cache.h" | 37 #include "compilation-cache.h" |
| 38 #include "string-stream.h" | 38 #include "string-stream.h" |
| 39 #include "parser.h" | 39 #include "parser.h" |
| 40 #include "regexp-macro-assembler.h" | 40 #include "regexp-macro-assembler.h" |
| 41 #include "regexp-macro-assembler-tracer.h" | 41 #include "regexp-macro-assembler-tracer.h" |
| 42 #include "regexp-macro-assembler-irregexp.h" | 42 #include "regexp-macro-assembler-irregexp.h" |
| 43 #include "regexp-stack.h" | 43 #include "regexp-stack.h" |
| 44 | 44 |
| 45 #ifdef ARM | 45 #ifdef V8_ARCH_ARM |
| 46 #include "arm/regexp-macro-assembler-arm.h" | 46 #include "arm/regexp-macro-assembler-arm.h" |
| 47 #else // IA32 | 47 #endif |
| 48 |
| 49 #ifdef V8_ARCH_X64 |
| 50 #include "x64/macro-assembler-x64.h" |
| 51 #include "x64/regexp-macro-assembler-x64.h" |
| 52 #endif |
| 53 |
| 54 #ifdef V8_ARCH_IA32 |
| 48 #include "ia32/macro-assembler-ia32.h" | 55 #include "ia32/macro-assembler-ia32.h" |
| 49 #include "ia32/regexp-macro-assembler-ia32.h" | 56 #include "ia32/regexp-macro-assembler-ia32.h" |
| 50 #endif | 57 #endif |
| 51 | 58 |
| 52 #include "interpreter-irregexp.h" | 59 #include "interpreter-irregexp.h" |
| 53 | 60 |
| 54 | 61 |
| 55 namespace v8 { namespace internal { | 62 namespace v8 { namespace internal { |
| 56 | 63 |
| 57 | 64 |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 last_match_info->EnsureSize(number_of_capture_registers + kLastMatchOverhead); | 424 last_match_info->EnsureSize(number_of_capture_registers + kLastMatchOverhead); |
| 418 | 425 |
| 419 int* offsets_vector = offsets.vector(); | 426 int* offsets_vector = offsets.vector(); |
| 420 bool rc; | 427 bool rc; |
| 421 | 428 |
| 422 // Dispatch to the correct RegExp implementation. | 429 // Dispatch to the correct RegExp implementation. |
| 423 | 430 |
| 424 Handle<String> original_subject = subject; | 431 Handle<String> original_subject = subject; |
| 425 Handle<FixedArray> regexp(FixedArray::cast(jsregexp->data())); | 432 Handle<FixedArray> regexp(FixedArray::cast(jsregexp->data())); |
| 426 if (UseNativeRegexp()) { | 433 if (UseNativeRegexp()) { |
| 427 #ifdef ARM | 434 #ifdef V8_ARCH_ARM |
| 428 UNREACHABLE(); | 435 UNREACHABLE(); |
| 429 #else | 436 #endif |
| 437 #ifdef V8_ARCH_X64 |
| 438 UNIMPLEMENTED(); |
| 439 #endif |
| 440 #ifdef V8_ARCH_IA32 |
| 430 RegExpMacroAssemblerIA32::Result res; | 441 RegExpMacroAssemblerIA32::Result res; |
| 431 do { | 442 do { |
| 432 bool is_ascii = StringShape(*subject).IsAsciiRepresentation(); | 443 bool is_ascii = StringShape(*subject).IsAsciiRepresentation(); |
| 433 if (!EnsureCompiledIrregexp(jsregexp, is_ascii)) { | 444 if (!EnsureCompiledIrregexp(jsregexp, is_ascii)) { |
| 434 return Handle<Object>::null(); | 445 return Handle<Object>::null(); |
| 435 } | 446 } |
| 436 Handle<Code> code(RegExpImpl::IrregexpNativeCode(*regexp, is_ascii)); | 447 Handle<Code> code(RegExpImpl::IrregexpNativeCode(*regexp, is_ascii)); |
| 437 res = RegExpMacroAssemblerIA32::Match(code, | 448 res = RegExpMacroAssemblerIA32::Match(code, |
| 438 subject, | 449 subject, |
| 439 offsets_vector, | 450 offsets_vector, |
| (...skipping 3987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4427 node = loop_node; | 4438 node = loop_node; |
| 4428 } | 4439 } |
| 4429 } | 4440 } |
| 4430 data->node = node; | 4441 data->node = node; |
| 4431 Analysis analysis(ignore_case); | 4442 Analysis analysis(ignore_case); |
| 4432 analysis.EnsureAnalyzed(node); | 4443 analysis.EnsureAnalyzed(node); |
| 4433 | 4444 |
| 4434 NodeInfo info = *node->info(); | 4445 NodeInfo info = *node->info(); |
| 4435 | 4446 |
| 4436 if (RegExpImpl::UseNativeRegexp()) { | 4447 if (RegExpImpl::UseNativeRegexp()) { |
| 4437 #ifdef ARM | 4448 #ifdef V8_ARCH_ARM |
| 4438 UNREACHABLE(); | 4449 UNREACHABLE(); |
| 4439 #else // IA32 | 4450 #endif |
| 4451 #ifdef V8_ARCH_X64 |
| 4452 UNREACHABLE(); |
| 4453 #endif |
| 4454 #ifdef V8_ARCH_IA32 |
| 4440 RegExpMacroAssemblerIA32::Mode mode; | 4455 RegExpMacroAssemblerIA32::Mode mode; |
| 4441 if (is_ascii) { | 4456 if (is_ascii) { |
| 4442 mode = RegExpMacroAssemblerIA32::ASCII; | 4457 mode = RegExpMacroAssemblerIA32::ASCII; |
| 4443 } else { | 4458 } else { |
| 4444 mode = RegExpMacroAssemblerIA32::UC16; | 4459 mode = RegExpMacroAssemblerIA32::UC16; |
| 4445 } | 4460 } |
| 4446 RegExpMacroAssemblerIA32 macro_assembler(mode, | 4461 RegExpMacroAssemblerIA32 macro_assembler(mode, |
| 4447 (data->capture_count + 1) * 2); | 4462 (data->capture_count + 1) * 2); |
| 4448 return compiler.Assemble(¯o_assembler, | 4463 return compiler.Assemble(¯o_assembler, |
| 4449 node, | 4464 node, |
| 4450 data->capture_count, | 4465 data->capture_count, |
| 4451 pattern); | 4466 pattern); |
| 4452 #endif | 4467 #endif |
| 4453 } | 4468 } |
| 4454 EmbeddedVector<byte, 1024> codes; | 4469 EmbeddedVector<byte, 1024> codes; |
| 4455 RegExpMacroAssemblerIrregexp macro_assembler(codes); | 4470 RegExpMacroAssemblerIrregexp macro_assembler(codes); |
| 4456 return compiler.Assemble(¯o_assembler, | 4471 return compiler.Assemble(¯o_assembler, |
| 4457 node, | 4472 node, |
| 4458 data->capture_count, | 4473 data->capture_count, |
| 4459 pattern); | 4474 pattern); |
| 4460 } | 4475 } |
| 4461 | 4476 |
| 4462 | 4477 |
| 4463 }} // namespace v8::internal | 4478 }} // namespace v8::internal |
| OLD | NEW |