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

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

Issue 12282038: Remove deprecated string features. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge to head Created 7 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
« no previous file with comments | « runtime/vm/bootstrap_natives.h ('k') | runtime/vm/flow_graph_optimizer.h » ('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) 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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "platform/assert.h" 6 #include "platform/assert.h"
7 #include "platform/json.h" 7 #include "platform/json.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/dart_api_impl.h" 10 #include "vm/dart_api_impl.h"
(...skipping 7392 matching lines...) Expand 10 before | Expand all | Expand 10 after
7403 TEST_CASE(ExternalStringDeoptimize) { 7403 TEST_CASE(ExternalStringDeoptimize) {
7404 const char* kScriptChars = 7404 const char* kScriptChars =
7405 "String str = 'A';\n" 7405 "String str = 'A';\n"
7406 "class A {\n" 7406 "class A {\n"
7407 " static change_str(String s) native 'A_change_str';\n" 7407 " static change_str(String s) native 'A_change_str';\n"
7408 "}\n" 7408 "}\n"
7409 "sum_chars(String s, bool b) {\n" 7409 "sum_chars(String s, bool b) {\n"
7410 " var result = 0;\n" 7410 " var result = 0;\n"
7411 " for (var i = 0; i < s.length; i++) {\n" 7411 " for (var i = 0; i < s.length; i++) {\n"
7412 " if (b && i == 0) A.change_str(str);\n" 7412 " if (b && i == 0) A.change_str(str);\n"
7413 " result += s.charCodeAt(i);" 7413 " result += s.codeUnitAt(i);"
7414 " }\n" 7414 " }\n"
7415 " return result;\n" 7415 " return result;\n"
7416 "}\n" 7416 "}\n"
7417 "main() {\n" 7417 "main() {\n"
7418 " str = '$str$str';\n" 7418 " str = '$str$str';\n"
7419 " for (var i = 0; i < 2000; i++) sum_chars(str, false);\n" 7419 " for (var i = 0; i < 2000; i++) sum_chars(str, false);\n"
7420 " var x = sum_chars(str, false);\n" 7420 " var x = sum_chars(str, false);\n"
7421 " var y = sum_chars(str, true);\n" 7421 " var y = sum_chars(str, true);\n"
7422 " return x + y;\n" 7422 " return x + y;\n"
7423 "}\n"; 7423 "}\n";
7424 Dart_Handle lib = 7424 Dart_Handle lib =
7425 TestCase::LoadTestScript(kScriptChars, 7425 TestCase::LoadTestScript(kScriptChars,
7426 &ExternalStringDeoptimize_native_lookup); 7426 &ExternalStringDeoptimize_native_lookup);
7427 Dart_Handle result = Dart_Invoke(lib, 7427 Dart_Handle result = Dart_Invoke(lib,
7428 NewString("main"), 7428 NewString("main"),
7429 0, 7429 0,
7430 NULL); 7430 NULL);
7431 int64_t value = 0; 7431 int64_t value = 0;
7432 result = Dart_IntegerToInt64(result, &value); 7432 result = Dart_IntegerToInt64(result, &value);
7433 EXPECT_VALID(result); 7433 EXPECT_VALID(result);
7434 EXPECT_EQ(260, value); 7434 EXPECT_EQ(260, value);
7435 } 7435 }
7436 7436
7437 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 7437 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
7438 7438
7439 } // namespace dart 7439 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/bootstrap_natives.h ('k') | runtime/vm/flow_graph_optimizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698