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 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 // Built-in objects have problems too. | 1067 // Built-in objects have problems too. |
1068 const char* built_ins[] = { | 1068 const char* built_ins[] = { |
1069 "\"Boolean\"", "\"Function\"", "\"Number\"", | 1069 "\"Boolean\"", "\"Function\"", "\"Number\"", |
1070 "\"Object\"", "\"Script\"", "\"String\"" | 1070 "\"Object\"", "\"Script\"", "\"String\"" |
1071 }; | 1071 }; |
1072 for (size_t i = 0; i < sizeof(built_ins) / sizeof(*built_ins); ++i) { | 1072 for (size_t i = 0; i < sizeof(built_ins) / sizeof(*built_ins); ++i) { |
1073 if (IsStringEqualTo(built_ins[i], new_s)) { | 1073 if (IsStringEqualTo(built_ins[i], new_s)) { |
1074 return true; | 1074 return true; |
1075 } | 1075 } |
1076 } | 1076 } |
| 1077 // Code objects can change their optimizability: code object may start |
| 1078 // as optimizable, but later be discovered to be actually not optimizable. |
| 1079 // Alas, we don't record this info as of now, so we allow cases when |
| 1080 // ref is thought to be optimizable while traverse finds it to be |
| 1081 // not optimizable. |
| 1082 if (ref_s[1] == '~') { // Code object used to be optimizable |
| 1083 if (new_s[1] == ' ') { // ...but later was set unoptimizable. |
| 1084 CHECK_EQ('"', ref_s[0]); |
| 1085 CHECK_EQ('"', new_s[0]); |
| 1086 ref_s += 2; // Cut the leading quote and the marker |
| 1087 ref_len -= 2; |
| 1088 new_s += 1; // Cut the leading quote only. |
| 1089 new_len -= 1; |
| 1090 } |
| 1091 } |
1077 return ref_len == new_len && strncmp(ref_s, new_s, ref_len) == 0; | 1092 return ref_len == new_len && strncmp(ref_s, new_s, ref_len) == 0; |
1078 } | 1093 } |
1079 | 1094 |
1080 | 1095 |
1081 static bool AreEntitiesEqual(CodeEntityInfo ref_e, CodeEntityInfo new_e) { | 1096 static bool AreEntitiesEqual(CodeEntityInfo ref_e, CodeEntityInfo new_e) { |
1082 if (ref_e == NULL && new_e != NULL) return true; | 1097 if (ref_e == NULL && new_e != NULL) return true; |
1083 if (ref_e != NULL && new_e != NULL) { | 1098 if (ref_e != NULL && new_e != NULL) { |
1084 return AreFuncSizesEqual(ref_e, new_e) && AreFuncNamesEqual(ref_e, new_e); | 1099 return AreFuncSizesEqual(ref_e, new_e) && AreFuncNamesEqual(ref_e, new_e); |
1085 } | 1100 } |
1086 if (ref_e != NULL && new_e == NULL) { | 1101 if (ref_e != NULL && new_e == NULL) { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1182 // Make sure that all log data is written prior crash due to CHECK failure. | 1197 // Make sure that all log data is written prior crash due to CHECK failure. |
1183 fflush(stdout); | 1198 fflush(stdout); |
1184 CHECK(results_equal); | 1199 CHECK(results_equal); |
1185 | 1200 |
1186 env->Exit(); | 1201 env->Exit(); |
1187 Logger::TearDown(); | 1202 Logger::TearDown(); |
1188 i::FLAG_always_compact = saved_always_compact; | 1203 i::FLAG_always_compact = saved_always_compact; |
1189 } | 1204 } |
1190 | 1205 |
1191 #endif // ENABLE_LOGGING_AND_PROFILING | 1206 #endif // ENABLE_LOGGING_AND_PROFILING |
OLD | NEW |