Chromium Code Reviews

Unified Diff: src/objects.cc

Issue 20843012: Extract hardcoded error strings into a single place and replace them with enum. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: enum was converted into standard v8 macro Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« src/objects.h ('K') | « src/objects.h ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 2e9badbb2aa073a3eb684b201fab60cec913ec68..3e71fc8ccfb39d1f638dd389f4183b61b2c3b6d8 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -9804,7 +9804,7 @@ void SharedFunctionInfo::EnableDeoptimizationSupport(Code* recompiled) {
}
-void SharedFunctionInfo::DisableOptimization(const char* reason) {
+void SharedFunctionInfo::DisableOptimization(BailoutReason reason) {
// Disable optimization for the shared function info and mark the
// code as non-optimizable. The marker on the shared function info
// is there because we flush non-optimized code thereby loosing the
@@ -9822,7 +9822,7 @@ void SharedFunctionInfo::DisableOptimization(const char* reason) {
if (FLAG_trace_opt) {
PrintF("[disabled optimization for ");
ShortPrint();
- PrintF(", reason: %s]\n", reason);
+ PrintF(", reason: %s]\n", GetBailoutReason(reason));
}
}
@@ -15964,4 +15964,13 @@ void PropertyCell::AddDependentCode(Handle<Code> code) {
}
+const char* GetBailoutReason(BailoutReason reason) {
+ ASSERT(reason >= kLastErrorMessage);
alph 2013/08/01 10:35:50 <
loislo 2013/08/01 13:15:30 Done.
+#define ERROR_MESSAGES_TEXTS(C, T) T,
+ static const char* error_messages_[] = {ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)};
Jakob Kummerow 2013/08/01 12:02:13 nit: 80col
loislo 2013/08/01 13:15:30 Done.
+#undef ERROR_MESSAGES_TEXTS
+ return error_messages_[reason];
+}
+
+
} } // namespace v8::internal
« src/objects.h ('K') | « src/objects.h ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine