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

Side by Side Diff: runtime/vm/object.h

Issue 2734883002: ICData::NumberOfChecks is O(n) so don't call it in loops (Closed)
Patch Set: Add const Created 3 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
« no previous file with comments | « runtime/vm/jit_optimizer.cc ('k') | runtime/vm/object.cc » ('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 #ifndef RUNTIME_VM_OBJECT_H_ 5 #ifndef RUNTIME_VM_OBJECT_H_
6 #define RUNTIME_VM_OBJECT_H_ 6 #define RUNTIME_VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 1900 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 uint32_t DeoptReasons() const; 1911 uint32_t DeoptReasons() const;
1912 void SetDeoptReasons(uint32_t reasons) const; 1912 void SetDeoptReasons(uint32_t reasons) const;
1913 1913
1914 bool HasDeoptReason(ICData::DeoptReasonId reason) const; 1914 bool HasDeoptReason(ICData::DeoptReasonId reason) const;
1915 void AddDeoptReason(ICData::DeoptReasonId reason) const; 1915 void AddDeoptReason(ICData::DeoptReasonId reason) const;
1916 1916
1917 // The length of the array. This includes all sentinel entries including 1917 // The length of the array. This includes all sentinel entries including
1918 // the final one. 1918 // the final one.
1919 intptr_t Length() const; 1919 intptr_t Length() const;
1920 1920
1921 // Takes O(result) time!
1921 intptr_t NumberOfChecks() const; 1922 intptr_t NumberOfChecks() const;
1922 1923
1923 // Discounts any checks with usage of zero. 1924 // Discounts any checks with usage of zero.
1925 // Takes O(result)) time!
1924 intptr_t NumberOfUsedChecks() const; 1926 intptr_t NumberOfUsedChecks() const;
1925 1927
1928 // Takes O(n) time!
1929 bool NumberOfChecksIs(intptr_t n) const;
1930
1926 static intptr_t InstanceSize() { 1931 static intptr_t InstanceSize() {
1927 return RoundedAllocationSize(sizeof(RawICData)); 1932 return RoundedAllocationSize(sizeof(RawICData));
1928 } 1933 }
1929 1934
1930 static intptr_t target_name_offset() { 1935 static intptr_t target_name_offset() {
1931 return OFFSET_OF(RawICData, target_name_); 1936 return OFFSET_OF(RawICData, target_name_);
1932 } 1937 }
1933 1938
1934 static intptr_t state_bits_offset() { 1939 static intptr_t state_bits_offset() {
1935 return OFFSET_OF(RawICData, state_bits_); 1940 return OFFSET_OF(RawICData, state_bits_);
(...skipping 6982 matching lines...) Expand 10 before | Expand all | Expand 10 after
8918 8923
8919 inline void TypeArguments::SetHash(intptr_t value) const { 8924 inline void TypeArguments::SetHash(intptr_t value) const {
8920 // This is only safe because we create a new Smi, which does not cause 8925 // This is only safe because we create a new Smi, which does not cause
8921 // heap allocation. 8926 // heap allocation.
8922 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); 8927 StoreSmi(&raw_ptr()->hash_, Smi::New(value));
8923 } 8928 }
8924 8929
8925 } // namespace dart 8930 } // namespace dart
8926 8931
8927 #endif // RUNTIME_VM_OBJECT_H_ 8932 #endif // RUNTIME_VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/jit_optimizer.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698