dce10bba79
Problems this addresses: 1. dart2js has hashCode functions like get hashCode = this.x.hashCode + 17 * this.y.hashCode When x and y are ints or bools VM optimizing compiler inlined the call to Object.hashCode and generated MegamorphicLookups for Object._identityHashCode. 2. HashMaps with _Smi keys had a double MegamorphicLookup: The hash table reasonably calls MegamorphicLookup(get:hashCode) which returns Object.hashCode; the compiled Object.hashCode is essentially MegamorphicLookup(get:_identityHashCode), which returns _Smi._identityHashCode which finally returns 'this'. 3. _interpolateSingle's call to o.toString() is megamorphic. We can avoid it for the common case of String arguments, this is often comming from StringBuffer.write() with a literal or interpolated argument. R=srdjan@google.com Review URL: https://codereview.chromium.org/1820653002 .
18 lines
545 B
Dart
18 lines
545 B
Dart
// Copyright (c) 2012, 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.
|
|
|
|
// Dart core library.
|
|
|
|
patch class bool {
|
|
|
|
/* patch */ const factory bool.fromEnvironment(String name,
|
|
{bool defaultValue: false})
|
|
native "Bool_fromEnvironment";
|
|
|
|
int get _identityHashCode {
|
|
return this ? 1231 : 1237;
|
|
}
|
|
int get hashCode => _identityHashCode;
|
|
}
|