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

Unified Diff: runtime/vm/object_test.cc

Issue 2363413004: VM: Avoid allocating strings when disassembling code. (Closed)
Patch Set: addressed comments Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object_service.cc ('k') | runtime/vm/profiler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object_test.cc
diff --git a/runtime/vm/object_test.cc b/runtime/vm/object_test.cc
index 52ab4260b6472ff0789f2afc1b5b522056a8feea..73e2d707c1aa25e111892a218e69362df0da906d 100644
--- a/runtime/vm/object_test.cc
+++ b/runtime/vm/object_test.cc
@@ -407,9 +407,8 @@ VM_TEST_CASE(StringEncodeIRI) {
"file%3A%2F%2F%2Fusr%2Flocal%2Fjohnmccutchan%2Fworkspace%2F"
"dart-repo%2Fdart%2Ftest.dart";
const String& input = String::Handle(String::New(kInput));
- const String& output = String::Handle(String::New(kOutput));
- const String& encoded = String::Handle(String::EncodeIRI(input));
- EXPECT(output.Equals(encoded));
+ const char* encoded = String::EncodeIRI(input);
+ EXPECT(strcmp(encoded, kOutput) == 0);
}
@@ -449,7 +448,7 @@ VM_TEST_CASE(StringIRITwoByte) {
const uint16_t kOutput[kOutputLen] =
{ 'x', '%', '2', 'F', '%', 'C', '4', '%', '8', '0' };
const String& output = String::Handle(String::FromUTF16(kOutput, kOutputLen));
- const String& encoded = String::Handle(String::EncodeIRI(input));
+ const String& encoded = String::Handle(String::New(String::EncodeIRI(input)));
EXPECT(output.Equals(encoded));
const String& decoded = String::Handle(String::DecodeIRI(output));
EXPECT(input.Equals(decoded));
« no previous file with comments | « runtime/vm/object_service.cc ('k') | runtime/vm/profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698