Exceptions are broken in eval code. This leads to assertion failures of the following form when running JavaScriptCore tests: ASSERTION FAILED: it != end (./VM/Machine.cpp:431 bool KJS::Machine::unwindCallFrame(KJS::Register**, const KJS::Instruction*&, KJS::CodeBlock*&, KJS::JSValue**&, KJS::ScopeChainNode*&, KJS::Register*&)) ASSERTION FAILED: addressOffset < instructions.size() (/Users/Cameron/sf/JavaScriptCore/VM/CodeBlock.cpp:541 bool KJS::CodeBlock::getHandlerForVPC(const KJS::Instruction*, KJS::Instruction*&, int&))
The it != end assertion failure is hit when throwing an exception from eval in a global context. Global code is a special case at the beginning, because no unwind is necessary, and the rest of the function deals with the case of function code. If the eval is in a global context, then the end of the scope chain is also the top, hitting the assertion. The addressOffset < instructions.size() assertion failure is hit when throwing an exception from eval in a function context. The top of the scope chain is an activation object, so Machine::unwindCallFrame() thinks it has succeeded when it really hasn't, passing the buck onto CodeBlock::getHandlerForVPC().
Partial fix Committed r32331
Created attachment 20743 [details] Make eval setup a "native" callframe
Comment on attachment 20743 [details] Make eval setup a "native" callframe Need to fix the other eval case. Otherwise, code looks good. Clearing review flag.
Comment on attachment 20743 [details] Make eval setup a "native" callframe Sorry, the second version just calls the first, so this looks good.
Committed r32361