| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "regexp-macro-assembler.h" | 42 #include "regexp-macro-assembler.h" |
| 43 #include "regexp-macro-assembler-tracer.h" | 43 #include "regexp-macro-assembler-tracer.h" |
| 44 #include "regexp-macro-assembler-irregexp.h" | 44 #include "regexp-macro-assembler-irregexp.h" |
| 45 #include "regexp-stack.h" | 45 #include "regexp-stack.h" |
| 46 | 46 |
| 47 #ifndef V8_INTERPRETED_REGEXP | 47 #ifndef V8_INTERPRETED_REGEXP |
| 48 #if V8_TARGET_ARCH_IA32 | 48 #if V8_TARGET_ARCH_IA32 |
| 49 #include "ia32/regexp-macro-assembler-ia32.h" | 49 #include "ia32/regexp-macro-assembler-ia32.h" |
| 50 #elif V8_TARGET_ARCH_X64 | 50 #elif V8_TARGET_ARCH_X64 |
| 51 #include "x64/regexp-macro-assembler-x64.h" | 51 #include "x64/regexp-macro-assembler-x64.h" |
| 52 #elif V8_TARGET_ARCH_A64 | |
| 53 #include "a64/regexp-macro-assembler-a64.h" | |
| 54 #elif V8_TARGET_ARCH_ARM | 52 #elif V8_TARGET_ARCH_ARM |
| 55 #include "arm/regexp-macro-assembler-arm.h" | 53 #include "arm/regexp-macro-assembler-arm.h" |
| 56 #elif V8_TARGET_ARCH_MIPS | 54 #elif V8_TARGET_ARCH_MIPS |
| 57 #include "mips/regexp-macro-assembler-mips.h" | 55 #include "mips/regexp-macro-assembler-mips.h" |
| 58 #else | 56 #else |
| 59 #error Unsupported target architecture. | 57 #error Unsupported target architecture. |
| 60 #endif | 58 #endif |
| 61 #endif | 59 #endif |
| 62 | 60 |
| 63 #include "interpreter-irregexp.h" | 61 #include "interpreter-irregexp.h" |
| (...skipping 3528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3592 } | 3590 } |
| 3593 | 3591 |
| 3594 private: | 3592 private: |
| 3595 static const int kAFew = 10; | 3593 static const int kAFew = 10; |
| 3596 ZoneList<AlternativeGeneration*> alt_gens_; | 3594 ZoneList<AlternativeGeneration*> alt_gens_; |
| 3597 AlternativeGeneration a_few_alt_gens_[kAFew]; | 3595 AlternativeGeneration a_few_alt_gens_[kAFew]; |
| 3598 }; | 3596 }; |
| 3599 | 3597 |
| 3600 | 3598 |
| 3601 // The '2' variant is has inclusive from and exclusive to. | 3599 // The '2' variant is has inclusive from and exclusive to. |
| 3602 // This covers \s as defined in ECMA-262 5.1, 15.10.2.12, | 3600 static const int kSpaceRanges[] = { '\t', '\r' + 1, ' ', ' ' + 1, 0x00A0, |
| 3603 // which include WhiteSpace (7.2) or LineTerminator (7.3) values. | 3601 0x00A1, 0x1680, 0x1681, 0x180E, 0x180F, 0x2000, 0x200B, 0x2028, 0x202A, |
| 3604 static const int kSpaceRanges[] = { '\t', '\r' + 1, ' ', ' ' + 1, | 3602 0x202F, 0x2030, 0x205F, 0x2060, 0x3000, 0x3001, 0xFEFF, 0xFF00, 0x10000 }; |
| 3605 0x00A0, 0x00A1, 0x1680, 0x1681, 0x180E, 0x180F, 0x2000, 0x200B, | |
| 3606 0x2028, 0x202A, 0x202F, 0x2030, 0x205F, 0x2060, 0x3000, 0x3001, | |
| 3607 0xFEFF, 0xFF00, 0x10000 }; | |
| 3608 static const int kSpaceRangeCount = ARRAY_SIZE(kSpaceRanges); | 3603 static const int kSpaceRangeCount = ARRAY_SIZE(kSpaceRanges); |
| 3609 | 3604 |
| 3610 static const int kWordRanges[] = { | 3605 static const int kWordRanges[] = { |
| 3611 '0', '9' + 1, 'A', 'Z' + 1, '_', '_' + 1, 'a', 'z' + 1, 0x10000 }; | 3606 '0', '9' + 1, 'A', 'Z' + 1, '_', '_' + 1, 'a', 'z' + 1, 0x10000 }; |
| 3612 static const int kWordRangeCount = ARRAY_SIZE(kWordRanges); | 3607 static const int kWordRangeCount = ARRAY_SIZE(kWordRanges); |
| 3613 static const int kDigitRanges[] = { '0', '9' + 1, 0x10000 }; | 3608 static const int kDigitRanges[] = { '0', '9' + 1, 0x10000 }; |
| 3614 static const int kDigitRangeCount = ARRAY_SIZE(kDigitRanges); | 3609 static const int kDigitRangeCount = ARRAY_SIZE(kDigitRanges); |
| 3615 static const int kSurrogateRanges[] = { 0xd800, 0xe000, 0x10000 }; | 3610 static const int kSurrogateRanges[] = { 0xd800, 0xe000, 0x10000 }; |
| 3616 static const int kSurrogateRangeCount = ARRAY_SIZE(kSurrogateRanges); | 3611 static const int kSurrogateRangeCount = ARRAY_SIZE(kSurrogateRanges); |
| 3617 static const int kLineTerminatorRanges[] = { 0x000A, 0x000B, 0x000D, 0x000E, | 3612 static const int kLineTerminatorRanges[] = { 0x000A, 0x000B, 0x000D, 0x000E, |
| (...skipping 2465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6083 | 6078 |
| 6084 #if V8_TARGET_ARCH_IA32 | 6079 #if V8_TARGET_ARCH_IA32 |
| 6085 RegExpMacroAssemblerIA32 macro_assembler(mode, (data->capture_count + 1) * 2, | 6080 RegExpMacroAssemblerIA32 macro_assembler(mode, (data->capture_count + 1) * 2, |
| 6086 zone); | 6081 zone); |
| 6087 #elif V8_TARGET_ARCH_X64 | 6082 #elif V8_TARGET_ARCH_X64 |
| 6088 RegExpMacroAssemblerX64 macro_assembler(mode, (data->capture_count + 1) * 2, | 6083 RegExpMacroAssemblerX64 macro_assembler(mode, (data->capture_count + 1) * 2, |
| 6089 zone); | 6084 zone); |
| 6090 #elif V8_TARGET_ARCH_ARM | 6085 #elif V8_TARGET_ARCH_ARM |
| 6091 RegExpMacroAssemblerARM macro_assembler(mode, (data->capture_count + 1) * 2, | 6086 RegExpMacroAssemblerARM macro_assembler(mode, (data->capture_count + 1) * 2, |
| 6092 zone); | 6087 zone); |
| 6093 #elif V8_TARGET_ARCH_A64 | |
| 6094 RegExpMacroAssemblerA64 macro_assembler(mode, (data->capture_count + 1) * 2, | |
| 6095 zone); | |
| 6096 #elif V8_TARGET_ARCH_MIPS | 6088 #elif V8_TARGET_ARCH_MIPS |
| 6097 RegExpMacroAssemblerMIPS macro_assembler(mode, (data->capture_count + 1) * 2, | 6089 RegExpMacroAssemblerMIPS macro_assembler(mode, (data->capture_count + 1) * 2, |
| 6098 zone); | 6090 zone); |
| 6099 #else | |
| 6100 #error "Unsupported architecture" | |
| 6101 #endif | 6091 #endif |
| 6102 | 6092 |
| 6103 #else // V8_INTERPRETED_REGEXP | 6093 #else // V8_INTERPRETED_REGEXP |
| 6104 // Interpreted regexp implementation. | 6094 // Interpreted regexp implementation. |
| 6105 EmbeddedVector<byte, 1024> codes; | 6095 EmbeddedVector<byte, 1024> codes; |
| 6106 RegExpMacroAssemblerIrregexp macro_assembler(codes, zone); | 6096 RegExpMacroAssemblerIrregexp macro_assembler(codes, zone); |
| 6107 #endif // V8_INTERPRETED_REGEXP | 6097 #endif // V8_INTERPRETED_REGEXP |
| 6108 | 6098 |
| 6109 // Inserted here, instead of in Assembler, because it depends on information | 6099 // Inserted here, instead of in Assembler, because it depends on information |
| 6110 // in the AST that isn't replicated in the Node structure. | 6100 // in the AST that isn't replicated in the Node structure. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 6123 } | 6113 } |
| 6124 | 6114 |
| 6125 return compiler.Assemble(¯o_assembler, | 6115 return compiler.Assemble(¯o_assembler, |
| 6126 node, | 6116 node, |
| 6127 data->capture_count, | 6117 data->capture_count, |
| 6128 pattern); | 6118 pattern); |
| 6129 } | 6119 } |
| 6130 | 6120 |
| 6131 | 6121 |
| 6132 }} // namespace v8::internal | 6122 }} // namespace v8::internal |
| OLD | NEW |