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

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: 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 (js->HasParam("forceCompile") &&
Cutch 2016/01/06 21:43:45 if (BoolParameter::Parse(js->LookupParam("forceCom
turnidge 2016/01/07 19:25:17 Done.
2355 strcmp(js->LookupParam("forceCompile"), "true") == 0) {
2356 compile_mode = SourceReport::kForceCompile;
2357 }
2358
2352 Script& script = Script::Handle(); 2359 Script& script = Script::Handle();
2353 intptr_t start_pos = UIntParameter::Parse(js->LookupParam("tokenPos")); 2360 intptr_t start_pos = UIntParameter::Parse(js->LookupParam("tokenPos"));
2354 intptr_t end_pos = UIntParameter::Parse(js->LookupParam("endTokenPos")); 2361 intptr_t end_pos = UIntParameter::Parse(js->LookupParam("endTokenPos"));
2355 2362
2356 if (js->HasParam("scriptId")) { 2363 if (js->HasParam("scriptId")) {
2357 // Get the target script. 2364 // Get the target script.
2358 const char* script_id_param = js->LookupParam("scriptId"); 2365 const char* script_id_param = js->LookupParam("scriptId");
2359 const Object& obj = 2366 const Object& obj =
2360 Object::Handle(LookupHeapObject(thread, script_id_param, NULL)); 2367 Object::Handle(LookupHeapObject(thread, script_id_param, NULL));
2361 if (obj.raw() == Object::sentinel().raw() || !obj.IsScript()) { 2368 if (obj.raw() == Object::sentinel().raw() || !obj.IsScript()) {
(...skipping 10 matching lines...) Expand all
2372 return true; 2379 return true;
2373 } 2380 }
2374 if (js->HasParam("endTokenPos")) { 2381 if (js->HasParam("endTokenPos")) {
2375 js->PrintError( 2382 js->PrintError(
2376 kInvalidParams, 2383 kInvalidParams,
2377 "%s: the 'endTokenPos' parameter requires the 'scriptId' parameter", 2384 "%s: the 'endTokenPos' parameter requires the 'scriptId' parameter",
2378 js->method()); 2385 js->method());
2379 return true; 2386 return true;
2380 } 2387 }
2381 } 2388 }
2382 SourceReport report(report_set); 2389 SourceReport report(report_set, compile_mode);
2383 report.PrintJSON(js, script, start_pos, end_pos); 2390 report.PrintJSON(js, script, start_pos, end_pos);
2384 return true; 2391 return true;
2385 } 2392 }
2386 2393
2387 2394
2388 static const MethodParameter* get_call_site_data_params[] = { 2395 static const MethodParameter* get_call_site_data_params[] = {
2389 ISOLATE_PARAMETER, 2396 ISOLATE_PARAMETER,
2390 new IdParameter("targetId", false), 2397 new IdParameter("targetId", false),
2391 NULL, 2398 NULL,
2392 }; 2399 };
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after
3856 const ServiceMethodDescriptor& method = service_methods_[i]; 3863 const ServiceMethodDescriptor& method = service_methods_[i];
3857 if (strcmp(method_name, method.name) == 0) { 3864 if (strcmp(method_name, method.name) == 0) {
3858 return &method; 3865 return &method;
3859 } 3866 }
3860 } 3867 }
3861 return NULL; 3868 return NULL;
3862 } 3869 }
3863 3870
3864 3871
3865 } // namespace dart 3872 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698