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

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: styles fixed Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« src/compiler.cc ('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..f5fa2997348e1d662120c352cdecd455bd34a053 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,15 @@ void PropertyCell::AddDependentCode(Handle<Code> code) {
}
+const char* GetBailoutReason(BailoutReason reason) {
+ ASSERT(reason < kLastErrorMessage);
+#define ERROR_MESSAGES_TEXTS(C, T) T,
+ static const char* error_messages_[] = {
+ ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
+ };
+#undef ERROR_MESSAGES_TEXTS
+ return error_messages_[reason];
+}
+
+
} } // namespace v8::internal
« src/compiler.cc ('K') | « src/objects.h ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698