| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/ast.h" | 8 #include "src/ast.h" |
| 9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
| 10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 namespace v8 { | 23 namespace v8 { |
| 24 namespace internal { | 24 namespace internal { |
| 25 | 25 |
| 26 RegExpBuilder::RegExpBuilder(Zone* zone) | 26 RegExpBuilder::RegExpBuilder(Zone* zone) |
| 27 : zone_(zone), | 27 : zone_(zone), |
| 28 pending_empty_(false), | 28 pending_empty_(false), |
| 29 characters_(NULL), | 29 characters_(NULL), |
| 30 terms_(), | 30 terms_(), |
| 31 alternatives_() | 31 alternatives_() |
| 32 #ifdef DEBUG | 32 #if DCHECK_IS_ON |
| 33 , last_added_(ADD_NONE) | 33 , |
| 34 last_added_(ADD_NONE) |
| 34 #endif | 35 #endif |
| 35 {} | 36 { |
| 37 } |
| 36 | 38 |
| 37 | 39 |
| 38 void RegExpBuilder::FlushCharacters() { | 40 void RegExpBuilder::FlushCharacters() { |
| 39 pending_empty_ = false; | 41 pending_empty_ = false; |
| 40 if (characters_ != NULL) { | 42 if (characters_ != NULL) { |
| 41 RegExpTree* atom = new(zone()) RegExpAtom(characters_->ToConstVector()); | 43 RegExpTree* atom = new(zone()) RegExpAtom(characters_->ToConstVector()); |
| 42 characters_ = NULL; | 44 characters_ = NULL; |
| 43 text_.Add(atom, zone()); | 45 text_.Add(atom, zone()); |
| 44 LAST(ADD_ATOM); | 46 LAST(ADD_ATOM); |
| 45 } | 47 } |
| (...skipping 4652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4698 } else if (FLAG_regexp_possessive_quantifier && current() == '+') { | 4700 } else if (FLAG_regexp_possessive_quantifier && current() == '+') { |
| 4699 // FLAG_regexp_possessive_quantifier is a debug-only flag. | 4701 // FLAG_regexp_possessive_quantifier is a debug-only flag. |
| 4700 quantifier_type = RegExpQuantifier::POSSESSIVE; | 4702 quantifier_type = RegExpQuantifier::POSSESSIVE; |
| 4701 Advance(); | 4703 Advance(); |
| 4702 } | 4704 } |
| 4703 builder->AddQuantifierToAtom(min, max, quantifier_type); | 4705 builder->AddQuantifierToAtom(min, max, quantifier_type); |
| 4704 } | 4706 } |
| 4705 } | 4707 } |
| 4706 | 4708 |
| 4707 | 4709 |
| 4708 #ifdef DEBUG | 4710 #if DCHECK_IS_ON |
| 4709 // Currently only used in an DCHECK. | 4711 // Currently only used in an DCHECK. |
| 4710 static bool IsSpecialClassEscape(uc32 c) { | 4712 static bool IsSpecialClassEscape(uc32 c) { |
| 4711 switch (c) { | 4713 switch (c) { |
| 4712 case 'd': case 'D': | 4714 case 'd': case 'D': |
| 4713 case 's': case 'S': | 4715 case 's': case 'S': |
| 4714 case 'w': case 'W': | 4716 case 'w': case 'W': |
| 4715 return true; | 4717 return true; |
| 4716 default: | 4718 default: |
| 4717 return false; | 4719 return false; |
| 4718 } | 4720 } |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5341 } | 5343 } |
| 5342 | 5344 |
| 5343 // Hash key is used exclusively by template call site caching. There are no | 5345 // Hash key is used exclusively by template call site caching. There are no |
| 5344 // real security implications for unseeded hashes, and no issues with changing | 5346 // real security implications for unseeded hashes, and no issues with changing |
| 5345 // the hashing algorithm to improve performance or entropy. | 5347 // the hashing algorithm to improve performance or entropy. |
| 5346 *hash = running_hash; | 5348 *hash = running_hash; |
| 5347 | 5349 |
| 5348 return raw_strings; | 5350 return raw_strings; |
| 5349 } | 5351 } |
| 5350 } } // namespace v8::internal | 5352 } } // namespace v8::internal |
| OLD | NEW |