OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/arm64/instrument-arm64.h" | 5 #include "src/arm64/instrument-arm64.h" |
6 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 | 9 |
10 Counter::Counter(const char* name, CounterType type) | 10 Counter::Counter(const char* name, CounterType type) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 CounterType Counter::type() { | 54 CounterType Counter::type() { |
55 return type_; | 55 return type_; |
56 } | 56 } |
57 | 57 |
58 | 58 |
59 typedef struct { | 59 typedef struct { |
60 const char* name; | 60 const char* name; |
61 CounterType type; | 61 CounterType type; |
62 } CounterDescriptor; | 62 } CounterDescriptor; |
63 | 63 |
| 64 static const CounterDescriptor kCounterList[] = { |
| 65 {"Instruction", Cumulative}, |
64 | 66 |
65 static const CounterDescriptor kCounterList[] = { | 67 {"Move Immediate", Gauge}, |
66 {"Instruction", Cumulative}, | 68 {"Add/Sub DP", Gauge}, |
| 69 {"Logical DP", Gauge}, |
| 70 {"Other Int DP", Gauge}, |
| 71 {"FP DP", Gauge}, |
67 | 72 |
68 {"Move Immediate", Gauge}, | 73 {"Conditional Select", Gauge}, |
69 {"Add/Sub DP", Gauge}, | 74 {"Conditional Compare", Gauge}, |
70 {"Logical DP", Gauge}, | |
71 {"Other Int DP", Gauge}, | |
72 {"FP DP", Gauge}, | |
73 | 75 |
74 {"Conditional Select", Gauge}, | 76 {"Unconditional Branch", Gauge}, |
75 {"Conditional Compare", Gauge}, | 77 {"Compare and Branch", Gauge}, |
| 78 {"Test and Branch", Gauge}, |
| 79 {"Conditional Branch", Gauge}, |
76 | 80 |
77 {"Unconditional Branch", Gauge}, | 81 {"Load Integer", Gauge}, |
78 {"Compare and Branch", Gauge}, | 82 {"Load FP", Gauge}, |
79 {"Test and Branch", Gauge}, | 83 {"Load Pair", Gauge}, |
80 {"Conditional Branch", Gauge}, | 84 {"Load Literal", Gauge}, |
| 85 {"Load Exclusive", Gauge}, |
| 86 {"Load Acquire", Gauge}, |
81 | 87 |
82 {"Load Integer", Gauge}, | 88 {"Store Integer", Gauge}, |
83 {"Load FP", Gauge}, | 89 {"Store FP", Gauge}, |
84 {"Load Pair", Gauge}, | 90 {"Store Pair", Gauge}, |
85 {"Load Literal", Gauge}, | 91 {"Store Exclusive", Gauge}, |
| 92 {"Store Release", Gauge}, |
86 | 93 |
87 {"Store Integer", Gauge}, | 94 {"PC Addressing", Gauge}, |
88 {"Store FP", Gauge}, | 95 {"Other", Gauge}, |
89 {"Store Pair", Gauge}, | 96 {"SP Adjust", Gauge}, |
90 | |
91 {"PC Addressing", Gauge}, | |
92 {"Other", Gauge}, | |
93 {"SP Adjust", Gauge}, | |
94 }; | 97 }; |
95 | 98 |
96 | |
97 Instrument::Instrument(const char* datafile, uint64_t sample_period) | 99 Instrument::Instrument(const char* datafile, uint64_t sample_period) |
98 : output_stream_(stderr), sample_period_(sample_period) { | 100 : output_stream_(stderr), sample_period_(sample_period) { |
99 | 101 |
100 // Set up the output stream. If datafile is non-NULL, use that file. If it | 102 // Set up the output stream. If datafile is non-NULL, use that file. If it |
101 // can't be opened, or datafile is NULL, use stderr. | 103 // can't be opened, or datafile is NULL, use stderr. |
102 if (datafile != NULL) { | 104 if (datafile != NULL) { |
103 output_stream_ = fopen(datafile, "w"); | 105 output_stream_ = fopen(datafile, "w"); |
104 if (output_stream_ == NULL) { | 106 if (output_stream_ == NULL) { |
105 fprintf(stderr, "Can't open output file %s. Using stderr.\n", datafile); | 107 fprintf(stderr, "Can't open output file %s. Using stderr.\n", datafile); |
106 output_stream_ = stderr; | 108 output_stream_ = stderr; |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 Update(); | 424 Update(); |
423 InstrumentLoadStore(instr); | 425 InstrumentLoadStore(instr); |
424 } | 426 } |
425 | 427 |
426 | 428 |
427 void Instrument::VisitLoadStoreUnsignedOffset(Instruction* instr) { | 429 void Instrument::VisitLoadStoreUnsignedOffset(Instruction* instr) { |
428 Update(); | 430 Update(); |
429 InstrumentLoadStore(instr); | 431 InstrumentLoadStore(instr); |
430 } | 432 } |
431 | 433 |
| 434 void Instrument::VisitLoadStoreExclusive(Instruction* instr) { |
| 435 Update(); |
| 436 static Counter* load_counter = GetCounter("Load Exclusive"); |
| 437 static Counter* store_counter = GetCounter("Store Exclusive"); |
| 438 |
| 439 switch (instr->Mask(LoadStoreAcquireReleaseMask)) { |
| 440 case LDXRB: // Fall-through. |
| 441 case LDXRH: // Fall-through. |
| 442 case LDXR_w: // Fall-through. |
| 443 case LDXR_x: |
| 444 load_counter->Increment(); |
| 445 break; |
| 446 case STXRB: // Fall-through. |
| 447 case STXRH: // Fall-through. |
| 448 case STXR_w: // Fall-through. |
| 449 case STXR_x: |
| 450 store_counter->Increment(); |
| 451 break; |
| 452 default: |
| 453 UNREACHABLE(); |
| 454 } |
| 455 } |
| 456 |
432 void Instrument::VisitLoadStoreAcquireRelease(Instruction* instr) { | 457 void Instrument::VisitLoadStoreAcquireRelease(Instruction* instr) { |
433 Update(); | 458 Update(); |
434 static Counter* load_counter = GetCounter("Load Acquire"); | 459 static Counter* load_counter = GetCounter("Load Acquire"); |
435 static Counter* store_counter = GetCounter("Store Release"); | 460 static Counter* store_counter = GetCounter("Store Release"); |
436 | 461 |
437 switch (instr->Mask(LoadStoreAcquireReleaseMask)) { | 462 switch (instr->Mask(LoadStoreAcquireReleaseMask)) { |
438 case LDAR_b: // Fall-through. | 463 case LDAR_b: // Fall-through. |
439 case LDAR_h: // Fall-through. | 464 case LDAR_h: // Fall-through. |
440 case LDAR_w: // Fall-through. | 465 case LDAR_w: // Fall-through. |
441 case LDAR_x: // Fall-through. | 466 case LDAR_x: // Fall-through. |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 | 630 |
606 void Instrument::VisitUnimplemented(Instruction* instr) { | 631 void Instrument::VisitUnimplemented(Instruction* instr) { |
607 Update(); | 632 Update(); |
608 static Counter* counter = GetCounter("Other"); | 633 static Counter* counter = GetCounter("Other"); |
609 counter->Increment(); | 634 counter->Increment(); |
610 } | 635 } |
611 | 636 |
612 | 637 |
613 } // namespace internal | 638 } // namespace internal |
614 } // namespace v8 | 639 } // namespace v8 |
OLD | NEW |