Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: test/cctest/test-log.cc

Issue 6551011: Fix CPU profiling for Crankshaft. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 int ref_len = StrChrLen(ref_s, ','); 1046 int ref_len = StrChrLen(ref_s, ',');
1047 int new_len = StrChrLen(new_s, ','); 1047 int new_len = StrChrLen(new_s, ',');
1048 return ref_len == new_len && strncmp(ref_s, new_s, ref_len) == 0; 1048 return ref_len == new_len && strncmp(ref_s, new_s, ref_len) == 0;
1049 } 1049 }
1050 1050
1051 1051
1052 static bool AreFuncNamesEqual(CodeEntityInfo ref_s, CodeEntityInfo new_s) { 1052 static bool AreFuncNamesEqual(CodeEntityInfo ref_s, CodeEntityInfo new_s) {
1053 // Skip size. 1053 // Skip size.
1054 ref_s = strchr(ref_s, ',') + 1; 1054 ref_s = strchr(ref_s, ',') + 1;
1055 new_s = strchr(new_s, ',') + 1; 1055 new_s = strchr(new_s, ',') + 1;
1056 int ref_len = StrChrLen(ref_s, '\n'); 1056 CHECK_EQ('"', ref_s[0]);
1057 int new_len = StrChrLen(new_s, '\n'); 1057 CHECK_EQ('"', new_s[0]);
1058 // If reference is anonymous (""), it's OK to have anything in new. 1058 int ref_len = StrChrLen(ref_s + 1, '\"');
1059 if (ref_len == 2) return true; 1059 int new_len = StrChrLen(new_s + 1, '\"');
1060 // A special case for ErrorPrototype. Haven't yet figured out why they 1060 // A special case for ErrorPrototype. Haven't yet figured out why they
1061 // are different. 1061 // are different.
1062 const char* error_prototype = "\"ErrorPrototype"; 1062 const char* error_prototype = "\"ErrorPrototype";
1063 if (IsStringEqualTo(error_prototype, ref_s) 1063 if (IsStringEqualTo(error_prototype, ref_s)
1064 && IsStringEqualTo(error_prototype, new_s)) { 1064 && IsStringEqualTo(error_prototype, new_s)) {
1065 return true; 1065 return true;
1066 } 1066 }
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 }
1092 return ref_len == new_len && strncmp(ref_s, new_s, ref_len) == 0; 1077 return ref_len == new_len && strncmp(ref_s, new_s, ref_len) == 0;
1093 } 1078 }
1094 1079
1095 1080
1096 static bool AreEntitiesEqual(CodeEntityInfo ref_e, CodeEntityInfo new_e) { 1081 static bool AreEntitiesEqual(CodeEntityInfo ref_e, CodeEntityInfo new_e) {
1097 if (ref_e == NULL && new_e != NULL) return true; 1082 if (ref_e == NULL && new_e != NULL) return true;
1098 if (ref_e != NULL && new_e != NULL) { 1083 if (ref_e != NULL && new_e != NULL) {
1099 return AreFuncSizesEqual(ref_e, new_e) && AreFuncNamesEqual(ref_e, new_e); 1084 return AreFuncSizesEqual(ref_e, new_e) && AreFuncNamesEqual(ref_e, new_e);
1100 } 1085 }
1101 if (ref_e != NULL && new_e == NULL) { 1086 if (ref_e != NULL && new_e == NULL) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 // Make sure that all log data is written prior crash due to CHECK failure. 1182 // Make sure that all log data is written prior crash due to CHECK failure.
1198 fflush(stdout); 1183 fflush(stdout);
1199 CHECK(results_equal); 1184 CHECK(results_equal);
1200 1185
1201 env->Exit(); 1186 env->Exit();
1202 Logger::TearDown(); 1187 Logger::TearDown();
1203 i::FLAG_always_compact = saved_always_compact; 1188 i::FLAG_always_compact = saved_always_compact;
1204 } 1189 }
1205 1190
1206 #endif // ENABLE_LOGGING_AND_PROFILING 1191 #endif // ENABLE_LOGGING_AND_PROFILING
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698