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

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

Issue 982873004: Thread/Isolate refactoring: new(Isolate) -> new(Zone) (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
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/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); 14 DECLARE_FLAG(bool, use_jscre);
15 15
16 static RawArray* Match(const String& pat, const String& str) { 16 static RawArray* Match(const String& pat, const String& str) {
17 Isolate* isolate = Isolate::Current(); 17 Zone* zone = Thread::Current()->zone();
18 const JSRegExp& regexp = JSRegExp::Handle( 18 const JSRegExp& regexp = JSRegExp::Handle(
19 RegExpEngine::CreateJSRegExp(isolate, pat, false, false)); 19 RegExpEngine::CreateJSRegExp(zone, pat, false, false));
20 const intptr_t cid = str.GetClassId(); 20 const intptr_t cid = str.GetClassId();
21 const Function& fn = Function::Handle(regexp.function(cid)); 21 const Function& fn = Function::Handle(regexp.function(cid));
22 EXPECT(!fn.IsNull()); 22 EXPECT(!fn.IsNull());
23 const Smi& idx = Smi::Handle(Smi::New(0)); 23 const Smi& idx = Smi::Handle(Smi::New(0));
24 return IRRegExpMacroAssembler::Execute(fn, str, idx, Isolate::Current()); 24 return IRRegExpMacroAssembler::Execute(fn, str, idx, zone);
25 } 25 }
26 26
27 TEST_CASE(RegExp_OneByteString) { 27 TEST_CASE(RegExp_OneByteString) {
28 if (FLAG_use_jscre) 28 if (FLAG_use_jscre)
29 return; 29 return;
30 30
31 uint8_t chars[] = { 'a', 'b', 'c', 'b', 'a' }; 31 uint8_t chars[] = { 'a', 'b', 'c', 'b', 'a' };
32 intptr_t len = ARRAY_SIZE(chars); 32 intptr_t len = ARRAY_SIZE(chars);
33 const String& str = String::Handle( 33 const String& str = String::Handle(
34 OneByteString::New(chars, len, Heap::kNew)); 34 OneByteString::New(chars, len, Heap::kNew));
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 EXPECT(res_1.IsSmi()); 114 EXPECT(res_1.IsSmi());
115 EXPECT(res_2.IsSmi()); 115 EXPECT(res_2.IsSmi());
116 116
117 const Smi& smi_1 = Smi::Cast(res_1); 117 const Smi& smi_1 = Smi::Cast(res_1);
118 const Smi& smi_2 = Smi::Cast(res_2); 118 const Smi& smi_2 = Smi::Cast(res_2);
119 EXPECT_EQ(1, smi_1.Value()); 119 EXPECT_EQ(1, smi_1.Value());
120 EXPECT_EQ(3, smi_2.Value()); 120 EXPECT_EQ(3, smi_2.Value());
121 } 121 }
122 122
123 } // namespace dart 123 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698