Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: runtime/vm/regexp_test.cc

Issue 1870343002: - Refactor Symbol allocation to expect a thread parameter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review feedback. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/regexp.cc ('k') | runtime/vm/report.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/regexp_assembler_ir.h" 10 #include "vm/regexp_assembler_ir.h"
11 #include "vm/unit_test.h" 11 #include "vm/unit_test.h"
12 12
13 namespace dart { 13 namespace dart {
14 14
15 static RawArray* Match(const String& pat, const String& str) { 15 static RawArray* Match(const String& pat, const String& str) {
16 Zone* zone = Thread::Current()->zone(); 16 Thread* thread = Thread::Current();
17 Zone* zone = thread->zone();
17 const RegExp& regexp = RegExp::Handle( 18 const RegExp& regexp = RegExp::Handle(
18 RegExpEngine::CreateRegExp(zone, pat, false, false)); 19 RegExpEngine::CreateRegExp(thread, pat, false, false));
19 const Smi& idx = Smi::Handle(Smi::New(0)); 20 const Smi& idx = Smi::Handle(Smi::New(0));
20 return IRRegExpMacroAssembler::Execute(regexp, str, idx, zone); 21 return IRRegExpMacroAssembler::Execute(regexp, str, idx, zone);
21 } 22 }
22 23
23 TEST_CASE(RegExp_OneByteString) { 24 TEST_CASE(RegExp_OneByteString) {
24 uint8_t chars[] = { 'a', 'b', 'c', 'b', 'a' }; 25 uint8_t chars[] = { 'a', 'b', 'c', 'b', 'a' };
25 intptr_t len = ARRAY_SIZE(chars); 26 intptr_t len = ARRAY_SIZE(chars);
26 const String& str = String::Handle( 27 const String& str = String::Handle(
27 OneByteString::New(chars, len, Heap::kNew)); 28 OneByteString::New(chars, len, Heap::kNew));
28 29
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 EXPECT(res_1.IsSmi()); 99 EXPECT(res_1.IsSmi());
99 EXPECT(res_2.IsSmi()); 100 EXPECT(res_2.IsSmi());
100 101
101 const Smi& smi_1 = Smi::Cast(res_1); 102 const Smi& smi_1 = Smi::Cast(res_1);
102 const Smi& smi_2 = Smi::Cast(res_2); 103 const Smi& smi_2 = Smi::Cast(res_2);
103 EXPECT_EQ(1, smi_1.Value()); 104 EXPECT_EQ(1, smi_1.Value());
104 EXPECT_EQ(3, smi_2.Value()); 105 EXPECT_EQ(3, smi_2.Value());
105 } 106 }
106 107
107 } // namespace dart 108 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/regexp.cc ('k') | runtime/vm/report.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698