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

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

Issue 2949803002: New growth strategy for growable arrays (Closed)
Patch Set: Branch-free grow size computation. Renamed function names to be clearer. Created 3 years, 6 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/debugger.cc ('k') | runtime/vm/exceptions.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 #include "include/dart_tools_api.h" 5 #include "include/dart_tools_api.h"
6 6
7 #include "vm/class_finalizer.h" 7 #include "vm/class_finalizer.h"
8 #include "vm/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_api_state.h" 10 #include "vm/dart_api_state.h"
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); 789 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in);
790 const Script& script = Script::Handle(lib.LookupScript(script_url)); 790 const Script& script = Script::Handle(lib.LookupScript(script_url));
791 if (script.IsNull()) { 791 if (script.IsNull()) {
792 return Api::NewError("%s: script '%s' not found in library '%s'", 792 return Api::NewError("%s: script '%s' not found in library '%s'",
793 CURRENT_FUNC, script_url.ToCString(), 793 CURRENT_FUNC, script_url.ToCString(),
794 String::Handle(lib.url()).ToCString()); 794 String::Handle(lib.url()).ToCString());
795 } 795 }
796 796
797 const GrowableObjectArray& info = 797 const GrowableObjectArray& info =
798 GrowableObjectArray::Handle(script.GenerateLineNumberArray()); 798 GrowableObjectArray::Handle(script.GenerateLineNumberArray());
799 return Api::NewHandle(T, Array::MakeArray(info)); 799 return Api::NewHandle(T, Array::MakeFixedLength(info));
800 } 800 }
801 801
802 802
803 DART_EXPORT Dart_Handle Dart_GenerateScriptSource(Dart_Handle library_url_in, 803 DART_EXPORT Dart_Handle Dart_GenerateScriptSource(Dart_Handle library_url_in,
804 Dart_Handle script_url_in) { 804 Dart_Handle script_url_in) {
805 DARTSCOPE(Thread::Current()); 805 DARTSCOPE(Thread::Current());
806 UNWRAP_AND_CHECK_PARAM(String, library_url, library_url_in); 806 UNWRAP_AND_CHECK_PARAM(String, library_url, library_url_in);
807 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); 807 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in);
808 808
809 const Library& library = 809 const Library& library =
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 prefix = it.GetNext(); 922 prefix = it.GetNext();
923 prefix_name = prefix.name(); 923 prefix_name = prefix.name();
924 ASSERT(!prefix_name.IsNull()); 924 ASSERT(!prefix_name.IsNull());
925 prefix_name = String::Concat(prefix_name, Symbols::Dot()); 925 prefix_name = String::Concat(prefix_name, Symbols::Dot());
926 for (int32_t i = 0; i < prefix.num_imports(); i++) { 926 for (int32_t i = 0; i < prefix.num_imports(); i++) {
927 imported = prefix.GetLibrary(i); 927 imported = prefix.GetLibrary(i);
928 import_list.Add(prefix_name); 928 import_list.Add(prefix_name);
929 import_list.Add(Smi::Handle(Smi::New(imported.index()))); 929 import_list.Add(Smi::Handle(Smi::New(imported.index())));
930 } 930 }
931 } 931 }
932 return Api::NewHandle(T, Array::MakeArray(import_list)); 932 return Api::NewHandle(T, Array::MakeFixedLength(import_list));
933 } 933 }
934 934
935 935
936 DART_EXPORT Dart_Handle Dart_GetLibraryURL(intptr_t library_id) { 936 DART_EXPORT Dart_Handle Dart_GetLibraryURL(intptr_t library_id) {
937 DARTSCOPE(Thread::Current()); 937 DARTSCOPE(Thread::Current());
938 const Library& lib = Library::Handle(Z, Library::GetLibrary(library_id)); 938 const Library& lib = Library::Handle(Z, Library::GetLibrary(library_id));
939 if (lib.IsNull()) { 939 if (lib.IsNull()) {
940 return Api::NewError("%s: %" Pd " is not a valid library id", CURRENT_FUNC, 940 return Api::NewError("%s: %" Pd " is not a valid library id", CURRENT_FUNC,
941 library_id); 941 library_id);
942 } 942 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 987
988 #else 988 #else
989 989
990 DART_EXPORT void Dart_SetPausedEventHandler(Dart_PausedEventHandler handler) { 990 DART_EXPORT void Dart_SetPausedEventHandler(Dart_PausedEventHandler handler) {
991 // NOOP. 991 // NOOP.
992 } 992 }
993 993
994 #endif // !PRODUCT 994 #endif // !PRODUCT
995 995
996 } // namespace dart 996 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/debugger.cc ('k') | runtime/vm/exceptions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698