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

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

Issue 120723003: Refactors CPU feature detection. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Cleanup Created 6 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 | Annotate | Revision Log
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 "vm/cpu.h" 7 #include "vm/cpu.h"
8 #include "vm/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/debugger.h" 9 #include "vm/debugger.h"
10 #include "vm/heap_histogram.h" 10 #include "vm/heap_histogram.h"
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 } 510 }
511 } else { 511 } else {
512 PrintError(js, "Unrecognized subcommand '%s'", js->GetArgument(1)); 512 PrintError(js, "Unrecognized subcommand '%s'", js->GetArgument(1));
513 } 513 }
514 } 514 }
515 515
516 516
517 static void HandleCpu(Isolate* isolate, JSONStream* js) { 517 static void HandleCpu(Isolate* isolate, JSONStream* js) {
518 JSONObject jsobj(js); 518 JSONObject jsobj(js);
519 jsobj.AddProperty("type", "CPU"); 519 jsobj.AddProperty("type", "CPU");
520 jsobj.AddProperty("architecture", CPU::Id()); 520 jsobj.AddProperty("built-for", CPU::Id());
Cutch 2014/01/02 19:39:19 please use "fooBar" or "foo_bar" for property name
zra 2014/01/13 21:57:19 Done.
521 jsobj.AddProperty("running-on", CPUFeatures::hardware());
521 } 522 }
522 523
523 524
524 static ServiceMessageHandlerEntry __message_handlers[] = { 525 static ServiceMessageHandlerEntry __message_handlers[] = {
525 { "_echo", HandleEcho }, 526 { "_echo", HandleEcho },
526 { "classes", HandleClasses }, 527 { "classes", HandleClasses },
527 { "cpu", HandleCpu }, 528 { "cpu", HandleCpu },
528 { "debug", HandleDebug }, 529 { "debug", HandleDebug },
529 { "libraries", HandleLibraries }, 530 { "libraries", HandleLibraries },
530 { "library", HandleLibrary }, 531 { "library", HandleLibrary },
(...skipping 19 matching lines...) Expand all
550 for (intptr_t i = 0; i < num_message_handlers; i++) { 551 for (intptr_t i = 0; i < num_message_handlers; i++) {
551 const ServiceMessageHandlerEntry& entry = __message_handlers[i]; 552 const ServiceMessageHandlerEntry& entry = __message_handlers[i];
552 if (!strcmp(command, entry.command)) { 553 if (!strcmp(command, entry.command)) {
553 return entry.handler; 554 return entry.handler;
554 } 555 }
555 } 556 }
556 return HandleFallthrough; 557 return HandleFallthrough;
557 } 558 }
558 559
559 } // namespace dart 560 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698