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

Side by Side Diff: vm/benchmark_test.cc

Issue 11280241: Fix StringBase_createFromCodePoints to correctly accept Latin-1 characters (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 "vm/benchmark_test.h" 5 #include "vm/benchmark_test.h"
6 6
7 #include "bin/file.h" 7 #include "bin/file.h"
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 10
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 // 196 //
197 BENCHMARK(DartStringAccess) { 197 BENCHMARK(DartStringAccess) {
198 const int kNumIterations = 10000000; 198 const int kNumIterations = 10000000;
199 Timer timer(true, "DartStringAccess benchmark"); 199 Timer timer(true, "DartStringAccess benchmark");
200 timer.Start(); 200 timer.Start();
201 Dart_EnterScope(); 201 Dart_EnterScope();
202 202
203 // Create strings. 203 // Create strings.
204 uint8_t data8[] = { 'o', 'n', 'e', 0xFF }; 204 uint8_t data8[] = { 'o', 'n', 'e', 0xFF };
205 int external_peer_data = 123; 205 int external_peer_data = 123;
206 Dart_Handle external_string = Dart_NewExternalUTF8String(data8, 206 Dart_Handle external_string = Dart_NewExternalLatin1String(
207 ARRAY_SIZE(data8), 207 data8, ARRAY_SIZE(data8), &external_peer_data, NULL);
208 &external_peer_data,
209 NULL);
210 Dart_Handle internal_string = NewString("two"); 208 Dart_Handle internal_string = NewString("two");
211 209
212 // Run benchmark. 210 // Run benchmark.
213 for (int64_t i = 0; i < kNumIterations; i++) { 211 for (int64_t i = 0; i < kNumIterations; i++) {
214 EXPECT(Dart_IsString(internal_string)); 212 EXPECT(Dart_IsString(internal_string));
215 EXPECT(!Dart_IsExternalString(internal_string)); 213 EXPECT(!Dart_IsExternalString(internal_string));
216 EXPECT_VALID(external_string); 214 EXPECT_VALID(external_string);
217 EXPECT(Dart_IsExternalString(external_string)); 215 EXPECT(Dart_IsExternalString(external_string));
218 void* external_peer = NULL; 216 void* external_peer = NULL;
219 EXPECT_VALID(Dart_ExternalStringGetPeer(external_string, &external_peer)); 217 EXPECT_VALID(Dart_ExternalStringGetPeer(external_string, &external_peer));
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 Dart_Handle cls = Dart_GetClass(lib, NewString("StackFrameTest")); 382 Dart_Handle cls = Dart_GetClass(lib, NewString("StackFrameTest"));
385 Dart_Handle result = Dart_Invoke(cls, NewString("testMain"), 0, NULL); 383 Dart_Handle result = Dart_Invoke(cls, NewString("testMain"), 0, NULL);
386 EXPECT_VALID(result); 384 EXPECT_VALID(result);
387 int64_t elapsed_time = 0; 385 int64_t elapsed_time = 0;
388 result = Dart_IntegerToInt64(result, &elapsed_time); 386 result = Dart_IntegerToInt64(result, &elapsed_time);
389 EXPECT_VALID(result); 387 EXPECT_VALID(result);
390 benchmark->set_score(elapsed_time); 388 benchmark->set_score(elapsed_time);
391 } 389 }
392 390
393 } // namespace dart 391 } // namespace dart
OLDNEW
« no previous file with comments | « lib/string.cc ('k') | vm/dart_api_impl.cc » ('j') | vm/dart_api_impl_test.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698