OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
6 | 6 |
7 #include "vm/isolate.h" | 7 #include "vm/isolate.h" |
8 #include "vm/object.h" | 8 #include "vm/object.h" |
9 #include "vm/regexp.h" | 9 #include "vm/regexp.h" |
10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
11 | 11 |
12 namespace dart { | 12 namespace dart { |
13 | 13 |
14 DECLARE_FLAG(bool, use_jscre); | |
15 | |
16 static RawArray* Match(const String& pat, const String& str) { | 14 static RawArray* Match(const String& pat, const String& str) { |
17 Zone* zone = Thread::Current()->zone(); | 15 Zone* zone = Thread::Current()->zone(); |
18 const JSRegExp& regexp = JSRegExp::Handle( | 16 const JSRegExp& regexp = JSRegExp::Handle( |
19 RegExpEngine::CreateJSRegExp(zone, pat, false, false)); | 17 RegExpEngine::CreateJSRegExp(zone, pat, false, false)); |
20 const intptr_t cid = str.GetClassId(); | 18 const intptr_t cid = str.GetClassId(); |
21 const Function& fn = Function::Handle(regexp.function(cid)); | 19 const Function& fn = Function::Handle(regexp.function(cid)); |
22 EXPECT(!fn.IsNull()); | 20 EXPECT(!fn.IsNull()); |
23 const Smi& idx = Smi::Handle(Smi::New(0)); | 21 const Smi& idx = Smi::Handle(Smi::New(0)); |
24 return IRRegExpMacroAssembler::Execute(fn, str, idx, zone); | 22 return IRRegExpMacroAssembler::Execute(fn, str, idx, zone); |
25 } | 23 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 EXPECT(res_1.IsSmi()); | 100 EXPECT(res_1.IsSmi()); |
103 EXPECT(res_2.IsSmi()); | 101 EXPECT(res_2.IsSmi()); |
104 | 102 |
105 const Smi& smi_1 = Smi::Cast(res_1); | 103 const Smi& smi_1 = Smi::Cast(res_1); |
106 const Smi& smi_2 = Smi::Cast(res_2); | 104 const Smi& smi_2 = Smi::Cast(res_2); |
107 EXPECT_EQ(1, smi_1.Value()); | 105 EXPECT_EQ(1, smi_1.Value()); |
108 EXPECT_EQ(3, smi_2.Value()); | 106 EXPECT_EQ(3, smi_2.Value()); |
109 } | 107 } |
110 | 108 |
111 } // namespace dart | 109 } // namespace dart |
OLD | NEW |