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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 CHECK(result.tree != NULL); | 91 CHECK(result.tree != NULL); |
92 CHECK(result.error.is_null()); | 92 CHECK(result.error.is_null()); |
93 SmartArrayPointer<const char> output = | 93 SmartArrayPointer<const char> output = |
94 result.tree->ToString(Isolate::Current()->runtime_zone()); | 94 result.tree->ToString(Isolate::Current()->runtime_zone()); |
95 return output; | 95 return output; |
96 } | 96 } |
97 | 97 |
98 static bool CheckSimple(const char* input) { | 98 static bool CheckSimple(const char* input) { |
99 V8::Initialize(NULL); | 99 V8::Initialize(NULL); |
100 v8::HandleScope scope; | 100 v8::HandleScope scope; |
101 unibrow::Utf8InputBuffer<> buffer(input, StrLength(input)); | |
102 ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT); | 101 ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT); |
103 FlatStringReader reader(Isolate::Current(), CStrVector(input)); | 102 FlatStringReader reader(Isolate::Current(), CStrVector(input)); |
104 RegExpCompileData result; | 103 RegExpCompileData result; |
105 CHECK(v8::internal::RegExpParser::ParseRegExp( | 104 CHECK(v8::internal::RegExpParser::ParseRegExp( |
106 &reader, false, &result, Isolate::Current()->runtime_zone())); | 105 &reader, false, &result, Isolate::Current()->runtime_zone())); |
107 CHECK(result.tree != NULL); | 106 CHECK(result.tree != NULL); |
108 CHECK(result.error.is_null()); | 107 CHECK(result.error.is_null()); |
109 return result.simple; | 108 return result.simple; |
110 } | 109 } |
111 | 110 |
112 struct MinMaxPair { | 111 struct MinMaxPair { |
113 int min_match; | 112 int min_match; |
114 int max_match; | 113 int max_match; |
115 }; | 114 }; |
116 | 115 |
117 static MinMaxPair CheckMinMaxMatch(const char* input) { | 116 static MinMaxPair CheckMinMaxMatch(const char* input) { |
118 V8::Initialize(NULL); | 117 V8::Initialize(NULL); |
119 v8::HandleScope scope; | 118 v8::HandleScope scope; |
120 unibrow::Utf8InputBuffer<> buffer(input, StrLength(input)); | |
121 ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT); | 119 ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT); |
122 FlatStringReader reader(Isolate::Current(), CStrVector(input)); | 120 FlatStringReader reader(Isolate::Current(), CStrVector(input)); |
123 RegExpCompileData result; | 121 RegExpCompileData result; |
124 CHECK(v8::internal::RegExpParser::ParseRegExp( | 122 CHECK(v8::internal::RegExpParser::ParseRegExp( |
125 &reader, false, &result, Isolate::Current()->runtime_zone())); | 123 &reader, false, &result, Isolate::Current()->runtime_zone())); |
126 CHECK(result.tree != NULL); | 124 CHECK(result.tree != NULL); |
127 CHECK(result.error.is_null()); | 125 CHECK(result.error.is_null()); |
128 int min_match = result.tree->min_match(); | 126 int min_match = result.tree->min_match(); |
129 int max_match = result.tree->max_match(); | 127 int max_match = result.tree->max_match(); |
130 MinMaxPair pair = { min_match, max_match }; | 128 MinMaxPair pair = { min_match, max_match }; |
(...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1802 ZoneList<CharacterRange> first_only(4, Isolate::Current()->runtime_zone()); | 1800 ZoneList<CharacterRange> first_only(4, Isolate::Current()->runtime_zone()); |
1803 ZoneList<CharacterRange> second_only(4, Isolate::Current()->runtime_zone()); | 1801 ZoneList<CharacterRange> second_only(4, Isolate::Current()->runtime_zone()); |
1804 ZoneList<CharacterRange> both(4, Isolate::Current()->runtime_zone()); | 1802 ZoneList<CharacterRange> both(4, Isolate::Current()->runtime_zone()); |
1805 } | 1803 } |
1806 | 1804 |
1807 | 1805 |
1808 TEST(Graph) { | 1806 TEST(Graph) { |
1809 V8::Initialize(NULL); | 1807 V8::Initialize(NULL); |
1810 Execute("\\b\\w+\\b", false, true, true); | 1808 Execute("\\b\\w+\\b", false, true, true); |
1811 } | 1809 } |
OLD | NEW |