aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Target/JSBackend/CallHandlers.h1
-rw-r--r--lib/Target/JSBackend/JSBackend.cpp2
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/Target/JSBackend/CallHandlers.h b/lib/Target/JSBackend/CallHandlers.h
index 585ad339a5..451c3dcd50 100644
--- a/lib/Target/JSBackend/CallHandlers.h
+++ b/lib/Target/JSBackend/CallHandlers.h
@@ -39,6 +39,7 @@ const Value *getActuallyCalledValue(const Instruction *I) {
std::string CH_##Ident(const Instruction *CI, std::string Name, int NumArgs=-1) { Code }
DEF_CALL_HANDLER(__default__, {
+ if (!CI) return ""; // we are just called from a handler that was called from getFunctionIndex, only to ensure the handler was run at least once
const Value *CV = getActuallyCalledValue(CI);
bool NeedCasts;
FunctionType *FT;
diff --git a/lib/Target/JSBackend/JSBackend.cpp b/lib/Target/JSBackend/JSBackend.cpp
index ca1d132351..f5b6c56c6f 100644
--- a/lib/Target/JSBackend/JSBackend.cpp
+++ b/lib/Target/JSBackend/JSBackend.cpp
@@ -207,7 +207,7 @@ namespace {
Table.push_back(Name);
IndexedFunctions[Name] = Index;
- // invoke the callHandler for this, if there is one. the function may only be indexed but never called directly, we need to catch it in the handler
+ // invoke the callHandler for this, if there is one. the function may only be indexed but never called directly, and we may need to do things in the handler
CallHandlerMap::iterator CH = CallHandlers->find(Name);
if (CH != CallHandlers->end()) {
(this->*(CH->second))(NULL, Name, -1);