-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TEST=ci Bug: #50648 Change-Id: I02e89c0def9913f12bf7fdd2ef8f3ff6cba231e3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278808 Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
- Loading branch information
1 parent
f9524f8
commit e210ee3
Showing
5 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import "dart:_internal" show intern; | ||
import "package:expect/expect.dart"; | ||
|
||
@pragma("vm:never-inline") | ||
String genString(int i) => "abc-${i}-xyz"; | ||
|
||
main() { | ||
int random = Object().hashCode; | ||
var a = genString(random); | ||
var b = genString(random); | ||
Expect.notIdentical(a, b); | ||
|
||
var internedA = intern(a); | ||
Expect.equals(a, internedA); | ||
// Likely, but not guarenteed: Expect.identical(a, internedA); | ||
var internedB = intern(b); | ||
Expect.equals(b, internedB); | ||
// Likely, but not guarenteed: Expect.identical(a, internedB); | ||
Expect.identical(internedA, internedB); | ||
} |
17 changes: 17 additions & 0 deletions
17
runtime/tests/vm/dart/weak_canonical_string_table_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
// VMOptions=--old_gen_heap_size=20 | ||
|
||
import "dart:_internal" show intern; | ||
|
||
@pragma("vm:never-inline") | ||
use(x) => x; | ||
|
||
main() { | ||
const MB = 1 << 20; | ||
for (var i = 0; i < 20 * MB; i++) { | ||
use(intern((i.toString()))); // Should not hit OutOfMemory | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters