OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 || Script::cast(sfi->script())->HasValidSource())) { | 1113 || Script::cast(sfi->script())->HasValidSource())) { |
1114 if (sfis != NULL) | 1114 if (sfis != NULL) |
1115 sfis[compiled_funcs_count] = Handle<SharedFunctionInfo>(sfi); | 1115 sfis[compiled_funcs_count] = Handle<SharedFunctionInfo>(sfi); |
1116 ++compiled_funcs_count; | 1116 ++compiled_funcs_count; |
1117 } | 1117 } |
1118 } | 1118 } |
1119 return compiled_funcs_count; | 1119 return compiled_funcs_count; |
1120 } | 1120 } |
1121 | 1121 |
1122 | 1122 |
| 1123 void Logger::LogCodeObject(Object* object) { |
| 1124 if (FLAG_log_code) { |
| 1125 Code* code_object = Code::cast(object); |
| 1126 LogEventsAndTags tag = Logger::STUB_TAG; |
| 1127 const char* description = "Unknown code from the snapshot"; |
| 1128 switch (code_object->kind()) { |
| 1129 case Code::FUNCTION: |
| 1130 return; // We log this later using LogCompiledFunctions. |
| 1131 case Code::STUB: |
| 1132 description = CodeStub::MajorName(code_object->major_key()); |
| 1133 tag = Logger::STUB_TAG; |
| 1134 break; |
| 1135 case Code::BUILTIN: |
| 1136 description = "A builtin from the snapshot"; |
| 1137 tag = Logger::BUILTIN_TAG; |
| 1138 break; |
| 1139 case Code::KEYED_LOAD_IC: |
| 1140 description = "A keyed load IC from the snapshot"; |
| 1141 tag = Logger::KEYED_LOAD_IC_TAG; |
| 1142 break; |
| 1143 case Code::LOAD_IC: |
| 1144 description = "A load IC from the snapshot"; |
| 1145 tag = Logger::LOAD_IC_TAG; |
| 1146 break; |
| 1147 case Code::STORE_IC: |
| 1148 description = "A store IC from the snapshot"; |
| 1149 tag = Logger::STORE_IC_TAG; |
| 1150 break; |
| 1151 case Code::KEYED_STORE_IC: |
| 1152 description = "A keyed store IC from the snapshot"; |
| 1153 tag = Logger::KEYED_STORE_IC_TAG; |
| 1154 break; |
| 1155 case Code::CALL_IC: |
| 1156 description = "A call IC from the snapshot"; |
| 1157 tag = Logger::CALL_IC_TAG; |
| 1158 break; |
| 1159 } |
| 1160 LOG(CodeCreateEvent(tag, code_object, description)); |
| 1161 } |
| 1162 } |
| 1163 |
| 1164 |
1123 void Logger::LogCompiledFunctions() { | 1165 void Logger::LogCompiledFunctions() { |
1124 HandleScope scope; | 1166 HandleScope scope; |
1125 const int compiled_funcs_count = EnumerateCompiledFunctions(NULL); | 1167 const int compiled_funcs_count = EnumerateCompiledFunctions(NULL); |
1126 Handle<SharedFunctionInfo>* sfis = | 1168 Handle<SharedFunctionInfo>* sfis = |
1127 NewArray< Handle<SharedFunctionInfo> >(compiled_funcs_count); | 1169 NewArray< Handle<SharedFunctionInfo> >(compiled_funcs_count); |
1128 EnumerateCompiledFunctions(sfis); | 1170 EnumerateCompiledFunctions(sfis); |
1129 | 1171 |
1130 // During iteration, there can be heap allocation due to | 1172 // During iteration, there can be heap allocation due to |
1131 // GetScriptLineNumber call. | 1173 // GetScriptLineNumber call. |
1132 for (int i = 0; i < compiled_funcs_count; ++i) { | 1174 for (int i = 0; i < compiled_funcs_count; ++i) { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1312 // Otherwise, if the sliding state window computation has not been | 1354 // Otherwise, if the sliding state window computation has not been |
1313 // started we do it now. | 1355 // started we do it now. |
1314 if (sliding_state_window_ == NULL) { | 1356 if (sliding_state_window_ == NULL) { |
1315 sliding_state_window_ = new SlidingStateWindow(); | 1357 sliding_state_window_ = new SlidingStateWindow(); |
1316 } | 1358 } |
1317 #endif | 1359 #endif |
1318 } | 1360 } |
1319 | 1361 |
1320 | 1362 |
1321 } } // namespace v8::internal | 1363 } } // namespace v8::internal |
OLD | NEW |