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

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

Issue 1562993003: Add the forceCompile param to _getSourceReport. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code review Created 4 years, 11 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 "vm/service.h" 5 #include "vm/service.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "platform/globals.h" 9 #include "platform/globals.h"
10 10
(...skipping 2314 matching lines...) Expand 10 before | Expand all | Expand 10 after
2325 static const EnumListParameter* reports_parameter = 2325 static const EnumListParameter* reports_parameter =
2326 new EnumListParameter("reports", true, report_enum_names); 2326 new EnumListParameter("reports", true, report_enum_names);
2327 2327
2328 2328
2329 static const MethodParameter* get_source_report_params[] = { 2329 static const MethodParameter* get_source_report_params[] = {
2330 ISOLATE_PARAMETER, 2330 ISOLATE_PARAMETER,
2331 reports_parameter, 2331 reports_parameter,
2332 new IdParameter("scriptId", false), 2332 new IdParameter("scriptId", false),
2333 new UIntParameter("tokenPos", false), 2333 new UIntParameter("tokenPos", false),
2334 new UIntParameter("endTokenPos", false), 2334 new UIntParameter("endTokenPos", false),
2335 new BoolParameter("forceCompile", false),
2335 NULL, 2336 NULL,
2336 }; 2337 };
2337 2338
2338 2339
2339 static bool GetSourceReport(Thread* thread, JSONStream* js) { 2340 static bool GetSourceReport(Thread* thread, JSONStream* js) {
2340 const char* reports_str = js->LookupParam("reports"); 2341 const char* reports_str = js->LookupParam("reports");
2341 const char** reports = reports_parameter->Parse(thread->zone(), reports_str); 2342 const char** reports = reports_parameter->Parse(thread->zone(), reports_str);
2342 intptr_t report_set = 0; 2343 intptr_t report_set = 0;
2343 while (*reports != NULL) { 2344 while (*reports != NULL) {
2344 if (strcmp(*reports, kCallSitesStr) == 0) { 2345 if (strcmp(*reports, kCallSitesStr) == 0) {
2345 report_set |= SourceReport::kCallSites; 2346 report_set |= SourceReport::kCallSites;
2346 } else if (strcmp(*reports, kCoverageStr) == 0) { 2347 } else if (strcmp(*reports, kCoverageStr) == 0) {
2347 report_set |= SourceReport::kCoverage; 2348 report_set |= SourceReport::kCoverage;
2348 } 2349 }
2349 reports++; 2350 reports++;
2350 } 2351 }
2351 2352
2353 SourceReport::CompileMode compile_mode = SourceReport::kNoCompile;
2354 if (BoolParameter::Parse(js->LookupParam("forceCompile"), false)) {
2355 compile_mode = SourceReport::kForceCompile;
2356 }
2357
2352 Script& script = Script::Handle(); 2358 Script& script = Script::Handle();
2353 intptr_t start_pos = UIntParameter::Parse(js->LookupParam("tokenPos")); 2359 intptr_t start_pos = UIntParameter::Parse(js->LookupParam("tokenPos"));
2354 intptr_t end_pos = UIntParameter::Parse(js->LookupParam("endTokenPos")); 2360 intptr_t end_pos = UIntParameter::Parse(js->LookupParam("endTokenPos"));
2355 2361
2356 if (js->HasParam("scriptId")) { 2362 if (js->HasParam("scriptId")) {
2357 // Get the target script. 2363 // Get the target script.
2358 const char* script_id_param = js->LookupParam("scriptId"); 2364 const char* script_id_param = js->LookupParam("scriptId");
2359 const Object& obj = 2365 const Object& obj =
2360 Object::Handle(LookupHeapObject(thread, script_id_param, NULL)); 2366 Object::Handle(LookupHeapObject(thread, script_id_param, NULL));
2361 if (obj.raw() == Object::sentinel().raw() || !obj.IsScript()) { 2367 if (obj.raw() == Object::sentinel().raw() || !obj.IsScript()) {
(...skipping 10 matching lines...) Expand all
2372 return true; 2378 return true;
2373 } 2379 }
2374 if (js->HasParam("endTokenPos")) { 2380 if (js->HasParam("endTokenPos")) {
2375 js->PrintError( 2381 js->PrintError(
2376 kInvalidParams, 2382 kInvalidParams,
2377 "%s: the 'endTokenPos' parameter requires the 'scriptId' parameter", 2383 "%s: the 'endTokenPos' parameter requires the 'scriptId' parameter",
2378 js->method()); 2384 js->method());
2379 return true; 2385 return true;
2380 } 2386 }
2381 } 2387 }
2382 SourceReport report(report_set); 2388 SourceReport report(report_set, compile_mode);
2383 report.PrintJSON(js, script, start_pos, end_pos); 2389 report.PrintJSON(js, script, start_pos, end_pos);
2384 return true; 2390 return true;
2385 } 2391 }
2386 2392
2387 2393
2388 static const MethodParameter* get_call_site_data_params[] = { 2394 static const MethodParameter* get_call_site_data_params[] = {
2389 ISOLATE_PARAMETER, 2395 ISOLATE_PARAMETER,
2390 new IdParameter("targetId", false), 2396 new IdParameter("targetId", false),
2391 NULL, 2397 NULL,
2392 }; 2398 };
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after
3856 const ServiceMethodDescriptor& method = service_methods_[i]; 3862 const ServiceMethodDescriptor& method = service_methods_[i];
3857 if (strcmp(method_name, method.name) == 0) { 3863 if (strcmp(method_name, method.name) == 0) {
3858 return &method; 3864 return &method;
3859 } 3865 }
3860 } 3866 }
3861 return NULL; 3867 return NULL;
3862 } 3868 }
3863 3869
3864 3870
3865 } // namespace dart 3871 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/get_source_report_test.dart ('k') | runtime/vm/source_report.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698