| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Tests of logging functions from log.h | 3 // Tests of logging functions from log.h |
| 4 | 4 |
| 5 #ifdef ENABLE_LOGGING_AND_PROFILING | 5 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 6 | 6 |
| 7 #ifdef __linux__ | 7 #ifdef __linux__ |
| 8 #include <math.h> | 8 #include <math.h> |
| 9 #include <pthread.h> | 9 #include <pthread.h> |
| 10 #include <signal.h> | 10 #include <signal.h> |
| (...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 // Built-in objects have problems too. | 1073 // Built-in objects have problems too. |
| 1074 const char* built_ins[] = { | 1074 const char* built_ins[] = { |
| 1075 "\"Boolean\"", "\"Function\"", "\"Number\"", | 1075 "\"Boolean\"", "\"Function\"", "\"Number\"", |
| 1076 "\"Object\"", "\"Script\"", "\"String\"" | 1076 "\"Object\"", "\"Script\"", "\"String\"" |
| 1077 }; | 1077 }; |
| 1078 for (size_t i = 0; i < sizeof(built_ins) / sizeof(*built_ins); ++i) { | 1078 for (size_t i = 0; i < sizeof(built_ins) / sizeof(*built_ins); ++i) { |
| 1079 if (IsStringEqualTo(built_ins[i], new_s)) { | 1079 if (IsStringEqualTo(built_ins[i], new_s)) { |
| 1080 return true; | 1080 return true; |
| 1081 } | 1081 } |
| 1082 } | 1082 } |
| 1083 // Code objects can change their optimizability: code object may start |
| 1084 // as optimizable, but later be discovered to be actually not optimizable. |
| 1085 // Alas, we don't record this info as of now, so we allow cases when |
| 1086 // ref is thought to be optimizable while traverse finds it to be |
| 1087 // not optimizable. |
| 1088 if (ref_s[1] == '~') { // Code object used to be optimizable |
| 1089 if (new_s[1] == ' ') { // ...but later was set unoptimizable. |
| 1090 CHECK_EQ('"', ref_s[0]); |
| 1091 CHECK_EQ('"', new_s[0]); |
| 1092 ref_s += 2; // Cut the leading quote and the marker |
| 1093 ref_len -= 2; |
| 1094 new_s += 1; // Cut the leading quote only. |
| 1095 new_len -= 1; |
| 1096 } |
| 1097 } |
| 1083 return ref_len == new_len && strncmp(ref_s, new_s, ref_len) == 0; | 1098 return ref_len == new_len && strncmp(ref_s, new_s, ref_len) == 0; |
| 1084 } | 1099 } |
| 1085 | 1100 |
| 1086 | 1101 |
| 1087 static bool AreEntitiesEqual(CodeEntityInfo ref_e, CodeEntityInfo new_e) { | 1102 static bool AreEntitiesEqual(CodeEntityInfo ref_e, CodeEntityInfo new_e) { |
| 1088 if (ref_e == NULL && new_e != NULL) return true; | 1103 if (ref_e == NULL && new_e != NULL) return true; |
| 1089 if (ref_e != NULL && new_e != NULL) { | 1104 if (ref_e != NULL && new_e != NULL) { |
| 1090 return AreFuncSizesEqual(ref_e, new_e) && AreFuncNamesEqual(ref_e, new_e); | 1105 return AreFuncSizesEqual(ref_e, new_e) && AreFuncNamesEqual(ref_e, new_e); |
| 1091 } | 1106 } |
| 1092 if (ref_e != NULL && new_e == NULL) { | 1107 if (ref_e != NULL && new_e == NULL) { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 // Make sure that all log data is written prior crash due to CHECK failure. | 1203 // Make sure that all log data is written prior crash due to CHECK failure. |
| 1189 fflush(stdout); | 1204 fflush(stdout); |
| 1190 CHECK(results_equal); | 1205 CHECK(results_equal); |
| 1191 | 1206 |
| 1192 env->Exit(); | 1207 env->Exit(); |
| 1193 LOGGER->TearDown(); | 1208 LOGGER->TearDown(); |
| 1194 i::FLAG_always_compact = saved_always_compact; | 1209 i::FLAG_always_compact = saved_always_compact; |
| 1195 } | 1210 } |
| 1196 | 1211 |
| 1197 #endif // ENABLE_LOGGING_AND_PROFILING | 1212 #endif // ENABLE_LOGGING_AND_PROFILING |
| OLD | NEW |