Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 25 matching lines...) Expand all Loading... | |
| 36 #include "jsregexp-inl.h" | 36 #include "jsregexp-inl.h" |
| 37 #include "platform.h" | 37 #include "platform.h" |
| 38 #include "runtime.h" | 38 #include "runtime.h" |
| 39 #include "top.h" | 39 #include "top.h" |
| 40 #include "compilation-cache.h" | 40 #include "compilation-cache.h" |
| 41 #include "string-stream.h" | 41 #include "string-stream.h" |
| 42 #include "parser.h" | 42 #include "parser.h" |
| 43 #include "assembler-re2k.h" | 43 #include "assembler-re2k.h" |
| 44 #include "regexp-macro-assembler.h" | 44 #include "regexp-macro-assembler.h" |
| 45 #include "regexp-macro-assembler-re2k.h" | 45 #include "regexp-macro-assembler-re2k.h" |
| 46 #include "regexp-macro-assembler-ia32.h" | |
| 46 #include "interpreter-re2k.h" | 47 #include "interpreter-re2k.h" |
| 47 | 48 |
| 48 // Including pcre.h undefines DEBUG to avoid getting debug output from | 49 // Including pcre.h undefines DEBUG to avoid getting debug output from |
| 49 // the JSCRE implementation. Make sure to redefine it in debug mode | 50 // the JSCRE implementation. Make sure to redefine it in debug mode |
| 50 // after having included the header file. | 51 // after having included the header file. |
| 51 #ifdef DEBUG | 52 #ifdef DEBUG |
| 52 #include "third_party/jscre/pcre.h" | 53 #include "third_party/jscre/pcre.h" |
| 53 #define DEBUG | 54 #define DEBUG |
| 54 #else | 55 #else |
| 55 #include "third_party/jscre/pcre.h" | 56 #include "third_party/jscre/pcre.h" |
| (...skipping 2227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2283 RegExpNode* node = RegExpQuantifier::ToNode(0, | 2284 RegExpNode* node = RegExpQuantifier::ToNode(0, |
| 2284 RegExpQuantifier::kInfinity, | 2285 RegExpQuantifier::kInfinity, |
| 2285 false, | 2286 false, |
| 2286 new RegExpCharacterClass('*'), | 2287 new RegExpCharacterClass('*'), |
| 2287 &compiler, | 2288 &compiler, |
| 2288 captured_body, | 2289 captured_body, |
| 2289 compiler.backtrack()); | 2290 compiler.backtrack()); |
| 2290 if (node_return != NULL) *node_return = node; | 2291 if (node_return != NULL) *node_return = node; |
| 2291 Analysis analysis; | 2292 Analysis analysis; |
| 2292 analysis.EnsureAnalyzed(node); | 2293 analysis.EnsureAnalyzed(node); |
| 2293 byte codes[1024]; | |
| 2294 Re2kAssembler assembler(Vector<byte>(codes, 1024)); | |
| 2295 RegExpMacroAssemblerRe2k macro_assembler(&assembler); | |
| 2296 return compiler.Assemble(¯o_assembler, | |
| 2297 node, | |
| 2298 input->capture_count, | |
| 2299 ignore_case); | |
| 2300 } | |
| 2301 | 2294 |
| 2302 RegExpMacroAssembler::RegExpMacroAssembler() { | 2295 if (FLAG_re2k_native) { |
|
Erik Corry
2008/11/21 13:03:04
We should probably either ignore the flag on ARM o
Lasse Reichstein
2008/11/24 08:32:33
Done.
| |
| 2303 } | 2296 // DON'T USE ON ARM YET! |
| 2304 | 2297 #if defined __arm__ || defined ARM || defined __thumb__ |
| 2305 RegExpMacroAssembler::~RegExpMacroAssembler() { | 2298 UNREACHABLE(); |
| 2299 return NULL; | |
| 2300 #else | |
| 2301 // FIXME. | |
|
Erik Corry
2008/11/21 13:03:04
Thuis should be a TODO with a name or issue number
Lasse Reichstein
2008/11/24 08:32:33
Done.
| |
| 2302 // Don't compile *here*, we don't know the input type yet! This won't work! | |
|
Erik Corry
2008/11/21 13:03:04
For now we just do 16 bit always for the bytecode
Lasse Reichstein
2008/11/24 08:32:33
The ia32 code will also assume 16-bit strings then
| |
| 2303 RegExpMacroAssemblerIA32 macro_assembler(RegExpMacroAssemblerIA32::ASCII, | |
| 2304 input->capture_count, | |
| 2305 ignore_case); | |
| 2306 return compiler.Assemble(¯o_assembler, | |
| 2307 node, | |
| 2308 input->capture_count, | |
| 2309 ignore_case); | |
| 2310 #endif | |
| 2311 } else { | |
| 2312 byte codes[1024]; | |
| 2313 Re2kAssembler assembler(Vector<byte>(codes, 1024)); | |
| 2314 RegExpMacroAssemblerRe2k macro_assembler(&assembler); | |
| 2315 return compiler.Assemble(¯o_assembler, | |
| 2316 node, | |
| 2317 input->capture_count, | |
| 2318 ignore_case); | |
| 2319 } | |
| 2306 } | 2320 } |
| 2307 | 2321 |
| 2308 | 2322 |
| 2309 }} // namespace v8::internal | 2323 }} // namespace v8::internal |
| OLD | NEW |