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

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 2734883002: ICData::NumberOfChecks is O(n) so don't call it in loops (Closed)
Patch Set: 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
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 #include "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "include/dart_mirrors_api.h" 6 #include "include/dart_mirrors_api.h"
7 #include "include/dart_native_api.h" 7 #include "include/dart_native_api.h"
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "lib/stacktrace.h" 10 #include "lib/stacktrace.h"
(...skipping 6555 matching lines...) Expand 10 before | Expand all | Expand 10 after
6566 6566
6567 JSONObject js_icdata(&js_icdatas); 6567 JSONObject js_icdata(&js_icdatas);
6568 js_icdata.AddProperty("deoptId", ic_data_.deopt_id()); 6568 js_icdata.AddProperty("deoptId", ic_data_.deopt_id());
6569 name_ = ic_data_.target_name(); 6569 name_ = ic_data_.target_name();
6570 name_ = String::RemovePrivateKey(name_); 6570 name_ = String::RemovePrivateKey(name_);
6571 js_icdata.AddProperty("selector", name_.ToCString()); 6571 js_icdata.AddProperty("selector", name_.ToCString());
6572 js_icdata.AddProperty("isStaticCall", ic_data_.is_static_call()); 6572 js_icdata.AddProperty("isStaticCall", ic_data_.is_static_call());
6573 intptr_t num_args_checked = ic_data_.NumArgsTested(); 6573 intptr_t num_args_checked = ic_data_.NumArgsTested();
6574 js_icdata.AddProperty("argsTested", num_args_checked); 6574 js_icdata.AddProperty("argsTested", num_args_checked);
6575 JSONArray js_entries(&js_icdata, "entries"); 6575 JSONArray js_entries(&js_icdata, "entries");
6576 for (intptr_t check = 0; check < ic_data_.NumberOfChecks(); 6576 intptr_t number_of_checks = ic_data_.NumberOfChecks();
6577 check++) { 6577 for (intptr_t check = 0; check < number_of_checks; check++) {
6578 GrowableArray<intptr_t> class_ids(num_args_checked); 6578 GrowableArray<intptr_t> class_ids(num_args_checked);
6579 ic_data_.GetClassIdsAt(check, &class_ids); 6579 ic_data_.GetClassIdsAt(check, &class_ids);
6580 for (intptr_t k = 0; k < num_args_checked; k++) { 6580 for (intptr_t k = 0; k < num_args_checked; k++) {
6581 ASSERT(class_ids[k] != kIllegalCid); 6581 ASSERT(class_ids[k] != kIllegalCid);
6582 js_entries.AddValue(class_ids[k]); 6582 js_entries.AddValue(class_ids[k]);
6583 } 6583 }
6584 js_entries.AddValue(ic_data_.GetCountAt(check)); 6584 js_entries.AddValue(ic_data_.GetCountAt(check));
6585 } 6585 }
6586 } 6586 }
6587 } 6587 }
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
6836 } 6836 }
6837 6837
6838 6838
6839 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { 6839 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) {
6840 #ifndef PRODUCT 6840 #ifndef PRODUCT
6841 Profiler::DumpStackTrace(context); 6841 Profiler::DumpStackTrace(context);
6842 #endif 6842 #endif
6843 } 6843 }
6844 6844
6845 } // namespace dart 6845 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698