OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/log.h" | 5 #include "src/log.h" |
6 | 6 |
7 #include <cstdarg> | 7 #include <cstdarg> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 | 910 |
911 | 911 |
912 namespace { | 912 namespace { |
913 // Emits the source code of a regexp. Used by regexp events. | 913 // Emits the source code of a regexp. Used by regexp events. |
914 void LogRegExpSource(Handle<JSRegExp> regexp, Isolate* isolate, | 914 void LogRegExpSource(Handle<JSRegExp> regexp, Isolate* isolate, |
915 Log::MessageBuilder* msg) { | 915 Log::MessageBuilder* msg) { |
916 // Prints "/" + re.source + "/" + | 916 // Prints "/" + re.source + "/" + |
917 // (re.global?"g":"") + (re.ignorecase?"i":"") + (re.multiline?"m":"") | 917 // (re.global?"g":"") + (re.ignorecase?"i":"") + (re.multiline?"m":"") |
918 | 918 |
919 Handle<Object> source = | 919 Handle<Object> source = |
920 Object::GetProperty(isolate, regexp, "source").ToHandleChecked(); | 920 JSReceiver::GetProperty(isolate, regexp, "source").ToHandleChecked(); |
921 if (!source->IsString()) { | 921 if (!source->IsString()) { |
922 msg->Append("no source"); | 922 msg->Append("no source"); |
923 return; | 923 return; |
924 } | 924 } |
925 | 925 |
926 switch (regexp->TypeTag()) { | 926 switch (regexp->TypeTag()) { |
927 case JSRegExp::ATOM: | 927 case JSRegExp::ATOM: |
928 msg->Append('a'); | 928 msg->Append('a'); |
929 break; | 929 break; |
930 default: | 930 default: |
931 break; | 931 break; |
932 } | 932 } |
933 msg->Append('/'); | 933 msg->Append('/'); |
934 msg->AppendDetailed(*Handle<String>::cast(source), false); | 934 msg->AppendDetailed(*Handle<String>::cast(source), false); |
935 msg->Append('/'); | 935 msg->Append('/'); |
936 | 936 |
937 // global flag | 937 // global flag |
938 Handle<Object> global = | 938 Handle<Object> global = |
939 Object::GetProperty(isolate, regexp, "global").ToHandleChecked(); | 939 JSReceiver::GetProperty(isolate, regexp, "global").ToHandleChecked(); |
940 if (global->IsTrue()) { | 940 if (global->IsTrue()) { |
941 msg->Append('g'); | 941 msg->Append('g'); |
942 } | 942 } |
943 // ignorecase flag | 943 // ignorecase flag |
944 Handle<Object> ignorecase = | 944 Handle<Object> ignorecase = |
945 Object::GetProperty(isolate, regexp, "ignoreCase").ToHandleChecked(); | 945 JSReceiver::GetProperty(isolate, regexp, "ignoreCase").ToHandleChecked(); |
946 if (ignorecase->IsTrue()) { | 946 if (ignorecase->IsTrue()) { |
947 msg->Append('i'); | 947 msg->Append('i'); |
948 } | 948 } |
949 // multiline flag | 949 // multiline flag |
950 Handle<Object> multiline = | 950 Handle<Object> multiline = |
951 Object::GetProperty(isolate, regexp, "multiline").ToHandleChecked(); | 951 JSReceiver::GetProperty(isolate, regexp, "multiline").ToHandleChecked(); |
952 if (multiline->IsTrue()) { | 952 if (multiline->IsTrue()) { |
953 msg->Append('m'); | 953 msg->Append('m'); |
954 } | 954 } |
955 } | 955 } |
956 } // namespace | 956 } // namespace |
957 | 957 |
958 | 958 |
959 void Logger::RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache) { | 959 void Logger::RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache) { |
960 if (!log_->IsEnabled() || !FLAG_log_regexp) return; | 960 if (!log_->IsEnabled() || !FLAG_log_regexp) return; |
961 Log::MessageBuilder msg(log_); | 961 Log::MessageBuilder msg(log_); |
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1846 removeCodeEventListener(jit_logger_); | 1846 removeCodeEventListener(jit_logger_); |
1847 delete jit_logger_; | 1847 delete jit_logger_; |
1848 jit_logger_ = NULL; | 1848 jit_logger_ = NULL; |
1849 } | 1849 } |
1850 | 1850 |
1851 return log_->Close(); | 1851 return log_->Close(); |
1852 } | 1852 } |
1853 | 1853 |
1854 } // namespace internal | 1854 } // namespace internal |
1855 } // namespace v8 | 1855 } // namespace v8 |
OLD | NEW |