OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef V8_COUNTERS_H_ | 5 #ifndef V8_COUNTERS_H_ |
6 #define V8_COUNTERS_H_ | 6 #define V8_COUNTERS_H_ |
7 | 7 |
8 #include "include/v8.h" | 8 #include "include/v8.h" |
9 #include "src/allocation.h" | 9 #include "src/allocation.h" |
10 #include "src/base/platform/elapsed-timer.h" | 10 #include "src/base/platform/elapsed-timer.h" |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 parent_->counter_->time -= delta; | 513 parent_->counter_->time -= delta; |
514 } | 514 } |
515 return parent_; | 515 return parent_; |
516 } | 516 } |
517 | 517 |
518 RuntimeCallCounter* counter_ = nullptr; | 518 RuntimeCallCounter* counter_ = nullptr; |
519 RuntimeCallTimer* parent_ = nullptr; | 519 RuntimeCallTimer* parent_ = nullptr; |
520 base::ElapsedTimer timer_; | 520 base::ElapsedTimer timer_; |
521 }; | 521 }; |
522 | 522 |
523 #define FOR_EACH_MANUAL_COUNTER(V) \ | 523 #define FOR_EACH_API_COUNTER(V) \ |
524 /* Counter for runtime callbacks into JavaScript. */ \ | 524 V(ArrayBuffer_Cast) \ |
525 V(ExternalCallback) \ | 525 V(ArrayBuffer_Neuter) \ |
526 V(GC) \ | 526 V(ArrayBuffer_New) \ |
527 /* Dummy counter for the unexpected stub miss. */ \ | 527 V(Array_CloneElementAt) \ |
528 V(UnexpectedStubMiss) \ | 528 V(Array_New) \ |
529 V(PrototypeMap_TransitionToAccessorProperty) \ | 529 V(BooleanObject_BooleanValue) \ |
530 V(PrototypeMap_TransitionToDataProperty) \ | 530 V(BooleanObject_New) \ |
531 V(Map_TransitionToAccessorProperty) \ | 531 V(Context_New) \ |
532 V(Map_TransitionToDataProperty) \ | 532 V(DataView_New) \ |
533 V(Map_SetPrototype) \ | 533 V(Date_DateTimeConfigurationChangeNotification) \ |
534 V(PrototypeObject_DeleteProperty) \ | 534 V(Date_New) \ |
535 V(Object_DeleteProperty) | 535 V(Date_NumberValue) \ |
| 536 V(Debug_Call) \ |
| 537 V(Debug_GetMirror) \ |
| 538 V(Error_New) \ |
| 539 V(External_New) \ |
| 540 V(Float32Array_New) \ |
| 541 V(Float64Array_New) \ |
| 542 V(Function_Call) \ |
| 543 V(Function_New) \ |
| 544 V(Function_NewInstance) \ |
| 545 V(FunctionTemplate_GetFunction) \ |
| 546 V(FunctionTemplate_New) \ |
| 547 V(FunctionTemplate_NewWithFastHandler) \ |
| 548 V(Int16Array_New) \ |
| 549 V(Int32Array_New) \ |
| 550 V(Int8Array_New) \ |
| 551 V(JSON_Parse) \ |
| 552 V(JSON_Stringify) \ |
| 553 V(Map_AsArray) \ |
| 554 V(Map_Clear) \ |
| 555 V(Map_Delete) \ |
| 556 V(Map_Get) \ |
| 557 V(Map_Has) \ |
| 558 V(Map_New) \ |
| 559 V(Map_Set) \ |
| 560 V(Message_GetEndColumn) \ |
| 561 V(Message_GetLineNumber) \ |
| 562 V(Message_GetSourceLine) \ |
| 563 V(Message_GetStartColumn) \ |
| 564 V(NumberObject_New) \ |
| 565 V(NumberObject_NumberValue) \ |
| 566 V(Object_CallAsConstructor) \ |
| 567 V(Object_CallAsFunction) \ |
| 568 V(Object_CreateDataProperty) \ |
| 569 V(Object_DefineOwnProperty) \ |
| 570 V(Object_Delete) \ |
| 571 V(Object_DeleteProperty) \ |
| 572 V(Object_ForceSet) \ |
| 573 V(Object_Get) \ |
| 574 V(Object_GetOwnPropertyDescriptor) \ |
| 575 V(Object_GetOwnPropertyNames) \ |
| 576 V(Object_GetPropertyAttributes) \ |
| 577 V(Object_GetPropertyNames) \ |
| 578 V(Object_GetRealNamedProperty) \ |
| 579 V(Object_GetRealNamedPropertyAttributes) \ |
| 580 V(Object_GetRealNamedPropertyAttributesInPrototypeChain) \ |
| 581 V(Object_GetRealNamedPropertyInPrototypeChain) \ |
| 582 V(Object_HasOwnProperty) \ |
| 583 V(Object_HasRealIndexedProperty) \ |
| 584 V(Object_HasRealNamedCallbackProperty) \ |
| 585 V(Object_HasRealNamedProperty) \ |
| 586 V(Object_Int32Value) \ |
| 587 V(Object_IntegerValue) \ |
| 588 V(Object_New) \ |
| 589 V(Object_NumberValue) \ |
| 590 V(Object_ObjectProtoToString) \ |
| 591 V(Object_Set) \ |
| 592 V(Object_SetAccessor) \ |
| 593 V(Object_SetIntegrityLevel) \ |
| 594 V(Object_SetPrivate) \ |
| 595 V(Object_SetPrototype) \ |
| 596 V(ObjectTemplate_New) \ |
| 597 V(ObjectTemplate_NewInstance) \ |
| 598 V(Object_ToArrayIndex) \ |
| 599 V(Object_ToDetailString) \ |
| 600 V(Object_ToInt32) \ |
| 601 V(Object_ToInteger) \ |
| 602 V(Object_ToNumber) \ |
| 603 V(Object_ToObject) \ |
| 604 V(Object_ToString) \ |
| 605 V(Object_ToUint32) \ |
| 606 V(Object_Uint32Value) \ |
| 607 V(Persistent_New) \ |
| 608 V(Private_New) \ |
| 609 V(Promise_Catch) \ |
| 610 V(Promise_Chain) \ |
| 611 V(Promise_HasRejectHandler) \ |
| 612 V(Promise_Resolver_New) \ |
| 613 V(Promise_Resolver_Resolve) \ |
| 614 V(Promise_Then) \ |
| 615 V(Proxy_New) \ |
| 616 V(RangeError_New) \ |
| 617 V(ReferenceError_New) \ |
| 618 V(RegExp_New) \ |
| 619 V(ScriptCompiler_Compile) \ |
| 620 V(ScriptCompiler_CompileFunctionInContext) \ |
| 621 V(ScriptCompiler_CompileUnbound) \ |
| 622 V(Script_Run) \ |
| 623 V(Set_Add) \ |
| 624 V(Set_AsArray) \ |
| 625 V(Set_Clear) \ |
| 626 V(Set_Delete) \ |
| 627 V(Set_Has) \ |
| 628 V(Set_New) \ |
| 629 V(SharedArrayBuffer_New) \ |
| 630 V(String_Concat) \ |
| 631 V(String_NewExternalOneByte) \ |
| 632 V(String_NewExternalTwoByte) \ |
| 633 V(String_NewFromOneByte) \ |
| 634 V(String_NewFromTwoByte) \ |
| 635 V(String_NewFromUtf8) \ |
| 636 V(StringObject_New) \ |
| 637 V(StringObject_StringValue) \ |
| 638 V(String_Write) \ |
| 639 V(String_WriteUtf8) \ |
| 640 V(Symbol_New) \ |
| 641 V(SymbolObject_New) \ |
| 642 V(SymbolObject_SymbolValue) \ |
| 643 V(SyntaxError_New) \ |
| 644 V(TryCatch_StackTrace) \ |
| 645 V(TypeError_New) \ |
| 646 V(Uint16Array_New) \ |
| 647 V(Uint32Array_New) \ |
| 648 V(Uint8Array_New) \ |
| 649 V(Uint8ClampedArray_New) \ |
| 650 V(UnboundScript_GetId) \ |
| 651 V(UnboundScript_GetLineNumber) \ |
| 652 V(UnboundScript_GetName) \ |
| 653 V(UnboundScript_GetSourceMappingURL) \ |
| 654 V(UnboundScript_GetSourceURL) \ |
| 655 V(Value_TypeOf) |
| 656 |
| 657 #define FOR_EACH_MANUAL_COUNTER(V) \ |
| 658 V(AccessorGetterCallback) \ |
| 659 V(AccessorNameGetterCallback) \ |
| 660 V(AccessorNameSetterCallback) \ |
| 661 V(Compile) \ |
| 662 V(CompileCode) \ |
| 663 V(CompileDeserialize) \ |
| 664 V(CompileEval) \ |
| 665 V(CompileFullCode) \ |
| 666 V(CompileIgnition) \ |
| 667 V(CompileSerialize) \ |
| 668 V(DeoptimizeCode) \ |
| 669 V(FunctionCallback) \ |
| 670 V(GC) \ |
| 671 V(GenericNamedPropertyDeleterCallback) \ |
| 672 V(GenericNamedPropertyQueryCallback) \ |
| 673 V(GenericNamedPropertySetterCallback) \ |
| 674 V(IndexedPropertyDeleterCallback) \ |
| 675 V(IndexedPropertyGetterCallback) \ |
| 676 V(IndexedPropertyQueryCallback) \ |
| 677 V(IndexedPropertySetterCallback) \ |
| 678 V(InvokeFunctionCallback) \ |
| 679 V(JS_Execution) \ |
| 680 V(Map_SetPrototype) \ |
| 681 V(Map_TransitionToAccessorProperty) \ |
| 682 V(Map_TransitionToDataProperty) \ |
| 683 V(Object_DeleteProperty) \ |
| 684 V(OptimizeCode) \ |
| 685 V(Parse) \ |
| 686 V(ParseLazy) \ |
| 687 V(PropertyCallback) \ |
| 688 V(PrototypeMap_TransitionToAccessorProperty) \ |
| 689 V(PrototypeMap_TransitionToDataProperty) \ |
| 690 V(PrototypeObject_DeleteProperty) \ |
| 691 V(RecompileConcurrent) \ |
| 692 V(RecompileSynchronous) \ |
| 693 /* Dummy counter for the unexpected stub miss. */ \ |
| 694 V(UnexpectedStubMiss) |
536 | 695 |
537 #define FOR_EACH_HANDLER_COUNTER(V) \ | 696 #define FOR_EACH_HANDLER_COUNTER(V) \ |
538 V(IC_HandlerCacheHit) \ | 697 V(IC_HandlerCacheHit) \ |
539 V(KeyedLoadIC_LoadIndexedStringStub) \ | 698 V(KeyedLoadIC_LoadIndexedStringStub) \ |
540 V(KeyedLoadIC_LoadIndexedInterceptorStub) \ | 699 V(KeyedLoadIC_LoadIndexedInterceptorStub) \ |
541 V(KeyedLoadIC_KeyedLoadSloppyArgumentsStub) \ | 700 V(KeyedLoadIC_KeyedLoadSloppyArgumentsStub) \ |
542 V(KeyedLoadIC_LoadFastElementStub) \ | 701 V(KeyedLoadIC_LoadFastElementStub) \ |
543 V(KeyedLoadIC_LoadDictionaryElementStub) \ | 702 V(KeyedLoadIC_LoadDictionaryElementStub) \ |
544 V(KeyedLoadIC_PolymorphicElement) \ | 703 V(KeyedLoadIC_PolymorphicElement) \ |
545 V(KeyedStoreIC_KeyedStoreSloppyArgumentsStub) \ | 704 V(KeyedStoreIC_KeyedStoreSloppyArgumentsStub) \ |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 #undef CALL_RUNTIME_COUNTER | 743 #undef CALL_RUNTIME_COUNTER |
585 #define CALL_RUNTIME_COUNTER(name, nargs, ressize) \ | 744 #define CALL_RUNTIME_COUNTER(name, nargs, ressize) \ |
586 RuntimeCallCounter Runtime_##name = RuntimeCallCounter(#name); | 745 RuntimeCallCounter Runtime_##name = RuntimeCallCounter(#name); |
587 FOR_EACH_INTRINSIC(CALL_RUNTIME_COUNTER) | 746 FOR_EACH_INTRINSIC(CALL_RUNTIME_COUNTER) |
588 #undef CALL_RUNTIME_COUNTER | 747 #undef CALL_RUNTIME_COUNTER |
589 #define CALL_BUILTIN_COUNTER(name, type) \ | 748 #define CALL_BUILTIN_COUNTER(name, type) \ |
590 RuntimeCallCounter Builtin_##name = RuntimeCallCounter(#name); | 749 RuntimeCallCounter Builtin_##name = RuntimeCallCounter(#name); |
591 BUILTIN_LIST_C(CALL_BUILTIN_COUNTER) | 750 BUILTIN_LIST_C(CALL_BUILTIN_COUNTER) |
592 #undef CALL_BUILTIN_COUNTER | 751 #undef CALL_BUILTIN_COUNTER |
593 #define CALL_BUILTIN_COUNTER(name) \ | 752 #define CALL_BUILTIN_COUNTER(name) \ |
| 753 RuntimeCallCounter API_##name = RuntimeCallCounter("API_" #name); |
| 754 FOR_EACH_API_COUNTER(CALL_BUILTIN_COUNTER) |
| 755 #undef CALL_BUILTIN_COUNTER |
| 756 #define CALL_BUILTIN_COUNTER(name) \ |
594 RuntimeCallCounter Handler_##name = RuntimeCallCounter(#name); | 757 RuntimeCallCounter Handler_##name = RuntimeCallCounter(#name); |
595 FOR_EACH_HANDLER_COUNTER(CALL_BUILTIN_COUNTER) | 758 FOR_EACH_HANDLER_COUNTER(CALL_BUILTIN_COUNTER) |
596 #undef CALL_BUILTIN_COUNTER | 759 #undef CALL_BUILTIN_COUNTER |
597 | 760 |
598 // Starting measuring the time for a function. This will establish the | 761 // Starting measuring the time for a function. This will establish the |
599 // connection to the parent counter for properly calculating the own times. | 762 // connection to the parent counter for properly calculating the own times. |
600 static void Enter(Isolate* isolate, RuntimeCallTimer* timer, | 763 static void Enter(Isolate* isolate, RuntimeCallTimer* timer, |
601 CounterId counter_id); | 764 CounterId counter_id); |
602 | 765 |
603 // Leave a scope for a measured runtime function. This will properly add | 766 // Leave a scope for a measured runtime function. This will properly add |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 | 1230 |
1068 explicit Counters(Isolate* isolate); | 1231 explicit Counters(Isolate* isolate); |
1069 | 1232 |
1070 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); | 1233 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); |
1071 }; | 1234 }; |
1072 | 1235 |
1073 } // namespace internal | 1236 } // namespace internal |
1074 } // namespace v8 | 1237 } // namespace v8 |
1075 | 1238 |
1076 #endif // V8_COUNTERS_H_ | 1239 #endif // V8_COUNTERS_H_ |
OLD | NEW |