Bug 18649 - SQUIRRELFISH: correctly handle exceptions in eval code
Summary: SQUIRRELFISH: correctly handle exceptions in eval code
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Oliver Hunt
URL:
Keywords:
Depends on:
Blocks: 18624
  Show dependency treegraph
 
Reported: 2008-04-20 18:27 PDT by Cameron Zwarich (cpst)
Modified: 2008-04-21 17:45 PDT (History)
1 user (show)

See Also:


Attachments
Make eval setup a "native" callframe (1.71 KB, patch)
2008-04-21 17:16 PDT, Oliver Hunt
ggaren: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Cameron Zwarich (cpst) 2008-04-20 18:27:10 PDT
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&))
Comment 1 Cameron Zwarich (cpst) 2008-04-20 19:13:59 PDT
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().
Comment 2 Oliver Hunt 2008-04-21 11:55:32 PDT
Partial fix Committed r32331
Comment 3 Oliver Hunt 2008-04-21 17:16:48 PDT
Created attachment 20743 [details]
Make eval setup a "native" callframe
Comment 4 Geoffrey Garen 2008-04-21 17:23:44 PDT
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 5 Geoffrey Garen 2008-04-21 17:26:47 PDT
Comment on attachment 20743 [details]
Make eval setup a "native" callframe

Sorry, the second version just calls the first, so this looks good.
Comment 6 Oliver Hunt 2008-04-21 17:45:33 PDT
Committed r32361