| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 va_start(ap, format); | 610 va_start(ap, format); |
| 611 msg.AppendVA(format, ap); | 611 msg.AppendVA(format, ap); |
| 612 va_end(ap); | 612 va_end(ap); |
| 613 msg.WriteToLogFile(); | 613 msg.WriteToLogFile(); |
| 614 } | 614 } |
| 615 | 615 |
| 616 | 616 |
| 617 void Logger::ApiNamedSecurityCheck(Object* key) { | 617 void Logger::ApiNamedSecurityCheck(Object* key) { |
| 618 if (!log_->IsEnabled() || !FLAG_log_api) return; | 618 if (!log_->IsEnabled() || !FLAG_log_api) return; |
| 619 if (key->IsString()) { | 619 if (key->IsString()) { |
| 620 SmartPointer<char> str = | 620 SmartArrayPointer<char> str = |
| 621 String::cast(key)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 621 String::cast(key)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 622 ApiEvent("api,check-security,\"%s\"\n", *str); | 622 ApiEvent("api,check-security,\"%s\"\n", *str); |
| 623 } else if (key->IsUndefined()) { | 623 } else if (key->IsUndefined()) { |
| 624 ApiEvent("api,check-security,undefined\n"); | 624 ApiEvent("api,check-security,undefined\n"); |
| 625 } else { | 625 } else { |
| 626 ApiEvent("api,check-security,['no-name']\n"); | 626 ApiEvent("api,check-security,['no-name']\n"); |
| 627 } | 627 } |
| 628 } | 628 } |
| 629 | 629 |
| 630 | 630 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 ApiEvent("api,check-security,%u\n", index); | 755 ApiEvent("api,check-security,%u\n", index); |
| 756 } | 756 } |
| 757 | 757 |
| 758 | 758 |
| 759 void Logger::ApiNamedPropertyAccess(const char* tag, | 759 void Logger::ApiNamedPropertyAccess(const char* tag, |
| 760 JSObject* holder, | 760 JSObject* holder, |
| 761 Object* name) { | 761 Object* name) { |
| 762 ASSERT(name->IsString()); | 762 ASSERT(name->IsString()); |
| 763 if (!log_->IsEnabled() || !FLAG_log_api) return; | 763 if (!log_->IsEnabled() || !FLAG_log_api) return; |
| 764 String* class_name_obj = holder->class_name(); | 764 String* class_name_obj = holder->class_name(); |
| 765 SmartPointer<char> class_name = | 765 SmartArrayPointer<char> class_name = |
| 766 class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 766 class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 767 SmartPointer<char> property_name = | 767 SmartArrayPointer<char> property_name = |
| 768 String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 768 String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 769 ApiEvent("api,%s,\"%s\",\"%s\"\n", tag, *class_name, *property_name); | 769 ApiEvent("api,%s,\"%s\",\"%s\"\n", tag, *class_name, *property_name); |
| 770 } | 770 } |
| 771 | 771 |
| 772 void Logger::ApiIndexedPropertyAccess(const char* tag, | 772 void Logger::ApiIndexedPropertyAccess(const char* tag, |
| 773 JSObject* holder, | 773 JSObject* holder, |
| 774 uint32_t index) { | 774 uint32_t index) { |
| 775 if (!log_->IsEnabled() || !FLAG_log_api) return; | 775 if (!log_->IsEnabled() || !FLAG_log_api) return; |
| 776 String* class_name_obj = holder->class_name(); | 776 String* class_name_obj = holder->class_name(); |
| 777 SmartPointer<char> class_name = | 777 SmartArrayPointer<char> class_name = |
| 778 class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 778 class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 779 ApiEvent("api,%s,\"%s\",%u\n", tag, *class_name, index); | 779 ApiEvent("api,%s,\"%s\",%u\n", tag, *class_name, index); |
| 780 } | 780 } |
| 781 | 781 |
| 782 void Logger::ApiObjectAccess(const char* tag, JSObject* object) { | 782 void Logger::ApiObjectAccess(const char* tag, JSObject* object) { |
| 783 if (!log_->IsEnabled() || !FLAG_log_api) return; | 783 if (!log_->IsEnabled() || !FLAG_log_api) return; |
| 784 String* class_name_obj = object->class_name(); | 784 String* class_name_obj = object->class_name(); |
| 785 SmartPointer<char> class_name = | 785 SmartArrayPointer<char> class_name = |
| 786 class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 786 class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 787 ApiEvent("api,%s,\"%s\"\n", tag, *class_name); | 787 ApiEvent("api,%s,\"%s\"\n", tag, *class_name); |
| 788 } | 788 } |
| 789 | 789 |
| 790 | 790 |
| 791 void Logger::ApiEntryCall(const char* name) { | 791 void Logger::ApiEntryCall(const char* name) { |
| 792 if (!log_->IsEnabled() || !FLAG_log_api) return; | 792 if (!log_->IsEnabled() || !FLAG_log_api) return; |
| 793 ApiEvent("api,%s\n", name); | 793 ApiEvent("api,%s\n", name); |
| 794 } | 794 } |
| 795 | 795 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 kLogEventsNames[CALLBACK_TAG]); | 829 kLogEventsNames[CALLBACK_TAG]); |
| 830 msg.AppendAddress(entry_point); | 830 msg.AppendAddress(entry_point); |
| 831 msg.Append(",1,\"%s%s\"", prefix, name); | 831 msg.Append(",1,\"%s%s\"", prefix, name); |
| 832 msg.Append('\n'); | 832 msg.Append('\n'); |
| 833 msg.WriteToLogFile(); | 833 msg.WriteToLogFile(); |
| 834 } | 834 } |
| 835 | 835 |
| 836 | 836 |
| 837 void Logger::CallbackEvent(String* name, Address entry_point) { | 837 void Logger::CallbackEvent(String* name, Address entry_point) { |
| 838 if (!log_->IsEnabled() || !FLAG_log_code) return; | 838 if (!log_->IsEnabled() || !FLAG_log_code) return; |
| 839 SmartPointer<char> str = | 839 SmartArrayPointer<char> str = |
| 840 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 840 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 841 CallbackEventInternal("", *str, entry_point); | 841 CallbackEventInternal("", *str, entry_point); |
| 842 } | 842 } |
| 843 | 843 |
| 844 | 844 |
| 845 void Logger::GetterCallbackEvent(String* name, Address entry_point) { | 845 void Logger::GetterCallbackEvent(String* name, Address entry_point) { |
| 846 if (!log_->IsEnabled() || !FLAG_log_code) return; | 846 if (!log_->IsEnabled() || !FLAG_log_code) return; |
| 847 SmartPointer<char> str = | 847 SmartArrayPointer<char> str = |
| 848 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 848 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 849 CallbackEventInternal("get ", *str, entry_point); | 849 CallbackEventInternal("get ", *str, entry_point); |
| 850 } | 850 } |
| 851 | 851 |
| 852 | 852 |
| 853 void Logger::SetterCallbackEvent(String* name, Address entry_point) { | 853 void Logger::SetterCallbackEvent(String* name, Address entry_point) { |
| 854 if (!log_->IsEnabled() || !FLAG_log_code) return; | 854 if (!log_->IsEnabled() || !FLAG_log_code) return; |
| 855 SmartPointer<char> str = | 855 SmartArrayPointer<char> str = |
| 856 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 856 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 857 CallbackEventInternal("set ", *str, entry_point); | 857 CallbackEventInternal("set ", *str, entry_point); |
| 858 } | 858 } |
| 859 | 859 |
| 860 | 860 |
| 861 void Logger::CodeCreateEvent(LogEventsAndTags tag, | 861 void Logger::CodeCreateEvent(LogEventsAndTags tag, |
| 862 Code* code, | 862 Code* code, |
| 863 const char* comment) { | 863 const char* comment) { |
| 864 if (!log_->IsEnabled()) return; | 864 if (!log_->IsEnabled()) return; |
| 865 if (FLAG_ll_prof || Serializer::enabled()) { | 865 if (FLAG_ll_prof || Serializer::enabled()) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 } | 950 } |
| 951 if (Serializer::enabled()) { | 951 if (Serializer::enabled()) { |
| 952 RegisterSnapshotCodeName(code, name_buffer_->get(), name_buffer_->size()); | 952 RegisterSnapshotCodeName(code, name_buffer_->get(), name_buffer_->size()); |
| 953 } | 953 } |
| 954 if (!FLAG_log_code) return; | 954 if (!FLAG_log_code) return; |
| 955 if (code == Isolate::Current()->builtins()->builtin( | 955 if (code == Isolate::Current()->builtins()->builtin( |
| 956 Builtins::kLazyCompile)) | 956 Builtins::kLazyCompile)) |
| 957 return; | 957 return; |
| 958 | 958 |
| 959 LogMessageBuilder msg(this); | 959 LogMessageBuilder msg(this); |
| 960 SmartPointer<char> str = | 960 SmartArrayPointer<char> str = |
| 961 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 961 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 962 msg.Append("%s,%s,", | 962 msg.Append("%s,%s,", |
| 963 kLogEventsNames[CODE_CREATION_EVENT], | 963 kLogEventsNames[CODE_CREATION_EVENT], |
| 964 kLogEventsNames[tag]); | 964 kLogEventsNames[tag]); |
| 965 msg.AppendAddress(code->address()); | 965 msg.AppendAddress(code->address()); |
| 966 msg.Append(",%d,\"%s\",", code->ExecutableSize(), *str); | 966 msg.Append(",%d,\"%s\",", code->ExecutableSize(), *str); |
| 967 msg.AppendAddress(shared->address()); | 967 msg.AppendAddress(shared->address()); |
| 968 msg.Append(",%s", ComputeMarker(code)); | 968 msg.Append(",%s", ComputeMarker(code)); |
| 969 msg.Append('\n'); | 969 msg.Append('\n'); |
| 970 msg.WriteToLogFile(); | 970 msg.WriteToLogFile(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 991 name_buffer_->AppendInt(line); | 991 name_buffer_->AppendInt(line); |
| 992 } | 992 } |
| 993 if (FLAG_ll_prof) { | 993 if (FLAG_ll_prof) { |
| 994 LowLevelCodeCreateEvent(code, name_buffer_->get(), name_buffer_->size()); | 994 LowLevelCodeCreateEvent(code, name_buffer_->get(), name_buffer_->size()); |
| 995 } | 995 } |
| 996 if (Serializer::enabled()) { | 996 if (Serializer::enabled()) { |
| 997 RegisterSnapshotCodeName(code, name_buffer_->get(), name_buffer_->size()); | 997 RegisterSnapshotCodeName(code, name_buffer_->get(), name_buffer_->size()); |
| 998 } | 998 } |
| 999 if (!FLAG_log_code) return; | 999 if (!FLAG_log_code) return; |
| 1000 LogMessageBuilder msg(this); | 1000 LogMessageBuilder msg(this); |
| 1001 SmartPointer<char> name = | 1001 SmartArrayPointer<char> name = |
| 1002 shared->DebugName()->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 1002 shared->DebugName()->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 1003 SmartPointer<char> sourcestr = | 1003 SmartArrayPointer<char> sourcestr = |
| 1004 source->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 1004 source->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 1005 msg.Append("%s,%s,", | 1005 msg.Append("%s,%s,", |
| 1006 kLogEventsNames[CODE_CREATION_EVENT], | 1006 kLogEventsNames[CODE_CREATION_EVENT], |
| 1007 kLogEventsNames[tag]); | 1007 kLogEventsNames[tag]); |
| 1008 msg.AppendAddress(code->address()); | 1008 msg.AppendAddress(code->address()); |
| 1009 msg.Append(",%d,\"%s %s:%d\",", | 1009 msg.Append(",%d,\"%s %s:%d\",", |
| 1010 code->ExecutableSize(), | 1010 code->ExecutableSize(), |
| 1011 *name, | 1011 *name, |
| 1012 *sourcestr, | 1012 *sourcestr, |
| 1013 line); | 1013 line); |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1761 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { | 1761 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { |
| 1762 ASSERT(sampler->IsActive()); | 1762 ASSERT(sampler->IsActive()); |
| 1763 ScopedLock lock(mutex_); | 1763 ScopedLock lock(mutex_); |
| 1764 ASSERT(active_samplers_ != NULL); | 1764 ASSERT(active_samplers_ != NULL); |
| 1765 bool removed = active_samplers_->RemoveElement(sampler); | 1765 bool removed = active_samplers_->RemoveElement(sampler); |
| 1766 ASSERT(removed); | 1766 ASSERT(removed); |
| 1767 USE(removed); | 1767 USE(removed); |
| 1768 } | 1768 } |
| 1769 | 1769 |
| 1770 } } // namespace v8::internal | 1770 } } // namespace v8::internal |
| OLD | NEW |