| OLD | NEW |
| 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 "platform/utils.h" | 5 #include "platform/utils.h" |
| 6 | 6 |
| 7 #include "vm/allocation.h" | 7 #include "vm/allocation.h" |
| 8 #include "vm/atomic.h" | 8 #include "vm/atomic.h" |
| 9 #include "vm/code_patcher.h" | 9 #include "vm/code_patcher.h" |
| 10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 void AddCallee(intptr_t index, intptr_t count) { | 460 void AddCallee(intptr_t index, intptr_t count) { |
| 461 AddCallEntry(callees_table_, index, count); | 461 AddCallEntry(callees_table_, index, count); |
| 462 } | 462 } |
| 463 | 463 |
| 464 void PrintNativeCode(JSONObject* profile_code_obj) { | 464 void PrintNativeCode(JSONObject* profile_code_obj) { |
| 465 ASSERT(kind() == kNativeCode); | 465 ASSERT(kind() == kNativeCode); |
| 466 JSONObject obj(profile_code_obj, "code"); | 466 JSONObject obj(profile_code_obj, "code"); |
| 467 obj.AddProperty("type", "@Code"); | 467 obj.AddProperty("type", "@Code"); |
| 468 obj.AddProperty("kind", "Native"); | 468 obj.AddProperty("kind", "Native"); |
| 469 obj.AddProperty("name", name()); | 469 obj.AddProperty("name", name()); |
| 470 obj.AddProperty("user_name", name()); | |
| 471 obj.AddPropertyF("start", "%" Px "", start()); | 470 obj.AddPropertyF("start", "%" Px "", start()); |
| 472 obj.AddPropertyF("end", "%" Px "", end()); | 471 obj.AddPropertyF("end", "%" Px "", end()); |
| 473 obj.AddPropertyF("id", "code/native-%" Px "", start()); | 472 obj.AddPropertyF("id", "code/native-%" Px "", start()); |
| 474 { | 473 { |
| 475 // Generate a fake function entry. | 474 // Generate a fake function entry. |
| 476 JSONObject func(&obj, "function"); | 475 JSONObject func(&obj, "function"); |
| 477 func.AddProperty("type", "@Function"); | 476 func.AddProperty("type", "@Function"); |
| 478 func.AddPropertyF("id", "functions/native-%" Px "", start()); | 477 func.AddPropertyF("id", "functions/native-%" Px "", start()); |
| 479 func.AddProperty("name", name()); | 478 func.AddProperty("name", name()); |
| 480 func.AddProperty("user_name", name()); | |
| 481 func.AddProperty("kind", "Native"); | 479 func.AddProperty("kind", "Native"); |
| 482 } | 480 } |
| 483 } | 481 } |
| 484 | 482 |
| 485 void PrintCollectedCode(JSONObject* profile_code_obj) { | 483 void PrintCollectedCode(JSONObject* profile_code_obj) { |
| 486 ASSERT(kind() == kCollectedCode); | 484 ASSERT(kind() == kCollectedCode); |
| 487 JSONObject obj(profile_code_obj, "code"); | 485 JSONObject obj(profile_code_obj, "code"); |
| 488 obj.AddProperty("type", "@Code"); | 486 obj.AddProperty("type", "@Code"); |
| 489 obj.AddProperty("kind", "Collected"); | 487 obj.AddProperty("kind", "Collected"); |
| 490 obj.AddProperty("name", name()); | 488 obj.AddProperty("name", name()); |
| 491 obj.AddProperty("user_name", name()); | |
| 492 obj.AddPropertyF("start", "%" Px "", start()); | 489 obj.AddPropertyF("start", "%" Px "", start()); |
| 493 obj.AddPropertyF("end", "%" Px "", end()); | 490 obj.AddPropertyF("end", "%" Px "", end()); |
| 494 obj.AddPropertyF("id", "code/collected-%" Px "", start()); | 491 obj.AddPropertyF("id", "code/collected-%" Px "", start()); |
| 495 { | 492 { |
| 496 // Generate a fake function entry. | 493 // Generate a fake function entry. |
| 497 JSONObject func(&obj, "function"); | 494 JSONObject func(&obj, "function"); |
| 498 func.AddProperty("type", "@Function"); | 495 func.AddProperty("type", "@Function"); |
| 499 obj.AddPropertyF("id", "functions/collected-%" Px "", start()); | 496 obj.AddPropertyF("id", "functions/collected-%" Px "", start()); |
| 500 func.AddProperty("name", name()); | 497 func.AddProperty("name", name()); |
| 501 func.AddProperty("user_name", name()); | |
| 502 func.AddProperty("kind", "Collected"); | 498 func.AddProperty("kind", "Collected"); |
| 503 } | 499 } |
| 504 } | 500 } |
| 505 | 501 |
| 506 void PrintOverwrittenCode(JSONObject* profile_code_obj) { | 502 void PrintOverwrittenCode(JSONObject* profile_code_obj) { |
| 507 ASSERT(kind() == kReusedCode); | 503 ASSERT(kind() == kReusedCode); |
| 508 JSONObject obj(profile_code_obj, "code"); | 504 JSONObject obj(profile_code_obj, "code"); |
| 509 obj.AddProperty("type", "@Code"); | 505 obj.AddProperty("type", "@Code"); |
| 510 obj.AddProperty("kind", "Reused"); | 506 obj.AddProperty("kind", "Reused"); |
| 511 obj.AddProperty("name", name()); | 507 obj.AddProperty("name", name()); |
| 512 obj.AddProperty("user_name", name()); | |
| 513 obj.AddPropertyF("start", "%" Px "", start()); | 508 obj.AddPropertyF("start", "%" Px "", start()); |
| 514 obj.AddPropertyF("end", "%" Px "", end()); | 509 obj.AddPropertyF("end", "%" Px "", end()); |
| 515 obj.AddPropertyF("id", "code/reused-%" Px "", start()); | 510 obj.AddPropertyF("id", "code/reused-%" Px "", start()); |
| 516 { | 511 { |
| 517 // Generate a fake function entry. | 512 // Generate a fake function entry. |
| 518 JSONObject func(&obj, "function"); | 513 JSONObject func(&obj, "function"); |
| 519 func.AddProperty("type", "@Function"); | 514 func.AddProperty("type", "@Function"); |
| 520 obj.AddPropertyF("id", "functions/reused-%" Px "", start()); | 515 obj.AddPropertyF("id", "functions/reused-%" Px "", start()); |
| 521 func.AddProperty("name", name()); | 516 func.AddProperty("name", name()); |
| 522 func.AddProperty("user_name", name()); | |
| 523 func.AddProperty("kind", "Reused"); | 517 func.AddProperty("kind", "Reused"); |
| 524 } | 518 } |
| 525 } | 519 } |
| 526 | 520 |
| 527 void PrintTagCode(JSONObject* profile_code_obj) { | 521 void PrintTagCode(JSONObject* profile_code_obj) { |
| 528 ASSERT(kind() == kTagCode); | 522 ASSERT(kind() == kTagCode); |
| 529 JSONObject obj(profile_code_obj, "code"); | 523 JSONObject obj(profile_code_obj, "code"); |
| 530 obj.AddProperty("type", "@Code"); | 524 obj.AddProperty("type", "@Code"); |
| 531 obj.AddProperty("kind", "Tag"); | 525 obj.AddProperty("kind", "Tag"); |
| 532 obj.AddPropertyF("id", "code/tag-%" Px "", start()); | 526 obj.AddPropertyF("id", "code/tag-%" Px "", start()); |
| 533 obj.AddProperty("name", name()); | 527 obj.AddProperty("name", name()); |
| 534 obj.AddProperty("user_name", name()); | |
| 535 obj.AddPropertyF("start", "%" Px "", start()); | 528 obj.AddPropertyF("start", "%" Px "", start()); |
| 536 obj.AddPropertyF("end", "%" Px "", end()); | 529 obj.AddPropertyF("end", "%" Px "", end()); |
| 537 { | 530 { |
| 538 // Generate a fake function entry. | 531 // Generate a fake function entry. |
| 539 JSONObject func(&obj, "function"); | 532 JSONObject func(&obj, "function"); |
| 540 func.AddProperty("type", "@Function"); | 533 func.AddProperty("type", "@Function"); |
| 541 func.AddProperty("kind", "Tag"); | 534 func.AddProperty("kind", "Tag"); |
| 542 obj.AddPropertyF("id", "functions/tag-%" Px "", start()); | 535 obj.AddPropertyF("id", "functions/tag-%" Px "", start()); |
| 543 func.AddProperty("name", name()); | 536 func.AddProperty("name", name()); |
| 544 func.AddProperty("user_name", name()); | |
| 545 } | 537 } |
| 546 } | 538 } |
| 547 | 539 |
| 548 void PrintToJSONArray(Isolate* isolate, JSONArray* events, bool full) { | 540 void PrintToJSONArray(Isolate* isolate, JSONArray* events, bool full) { |
| 549 JSONObject obj(events); | 541 JSONObject obj(events); |
| 550 obj.AddProperty("type", "CodeRegion"); | 542 obj.AddProperty("type", "CodeRegion"); |
| 551 obj.AddProperty("kind", KindToCString(kind())); | 543 obj.AddProperty("kind", KindToCString(kind())); |
| 552 obj.AddPropertyF("inclusive_ticks", "%" Pd "", inclusive_ticks()); | 544 obj.AddPropertyF("inclusive_ticks", "%" Pd "", inclusive_ticks()); |
| 553 obj.AddPropertyF("exclusive_ticks", "%" Pd "", exclusive_ticks()); | 545 obj.AddPropertyF("exclusive_ticks", "%" Pd "", exclusive_ticks()); |
| 554 if (kind() == kDartCode) { | 546 if (kind() == kDartCode) { |
| (...skipping 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2099 state.pc, | 2091 state.pc, |
| 2100 state.fp, | 2092 state.fp, |
| 2101 state.sp); | 2093 state.sp); |
| 2102 stackWalker.walk(); | 2094 stackWalker.walk(); |
| 2103 #endif | 2095 #endif |
| 2104 } | 2096 } |
| 2105 } | 2097 } |
| 2106 } | 2098 } |
| 2107 | 2099 |
| 2108 } // namespace dart | 2100 } // namespace dart |
| OLD | NEW |