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

Side by Side Diff: dart/sdk/lib/_internal/lib/collection_dev_patch.dart

Issue 57773002: Repro for OOM bug in test.dart (applies to r29345). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 import 'dart:_foreign_helper' show JS; 5 import 'dart:_js_helper' show Primitives;
6 6
7 patch class Symbol implements core.Symbol { 7 patch class Symbol implements core.Symbol {
8 patch const Symbol(String name) 8 patch const Symbol(String name)
9 : this._name = name; 9 : this._name = name;
10 } 10 }
11 11
12 /**
13 * This is the low-level method that is used to implement
14 * [print]. It is possible to override this function from JavaScript
15 * by defining a function in JavaScript called "dartPrint".
16 */
17 patch void printToConsole(String line) { 12 patch void printToConsole(String line) {
18 if (JS('bool', r'typeof dartPrint == "function"')) { 13 Primitives.printString('$line');
19 // Support overriding print from JavaScript.
20 JS('void', r'dartPrint(#)', line);
21 return;
22 }
23
24 // Inside browser or nodejs.
25 if (JS('bool', r'typeof console == "object"') &&
26 JS('bool', r'typeof console.log == "function"')) {
27 JS('void', r'console.log(#)', line);
28 return;
29 }
30
31 // Don't throw inside IE, the console is only defined if dev tools is open.
32 if (JS('bool', r'typeof window == "object"')) {
33 return;
34 }
35
36 // Running in d8, the V8 developer shell, or in Firefox' js-shell.
37 if (JS('bool', r'typeof print == "function"')) {
38 JS('void', r'print(#)', line);
39 return;
40 }
41
42 // This is somewhat nasty, but we don't want to drag in a bunch of
43 // dependencies to handle a situation that cannot happen. So we
44 // avoid using Dart [:throw:] and Dart [toString].
45 JS('void', 'throw "Unable to print message: " + String(#)', line);
46 } 14 }
OLDNEW
« no previous file with comments | « dart/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart ('k') | dart/sdk/lib/_internal/lib/js_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698