Closed
Bug 397680
Opened 17 years ago
Closed 17 years ago
Need to support Context.observeInstructionCount for compiled mode
Categories
(Rhino Graveyard :: Compiler, enhancement)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: norrisboyd, Unassigned)
Details
Attachments
(4 files)
158.87 KB,
patch
|
Details | Diff | Splinter Review | |
122.25 KB,
patch
|
Details | Diff | Splinter Review | |
6.24 KB,
patch
|
Details | Diff | Splinter Review | |
90.49 KB,
application/octet-stream
|
Details |
from mozilla.dev.tech.js-engine:
> 3. stopping the script in higher optimized code is impossible under
> the current rhino conditions. I can use the Thread.stop() method but
> am reluctant to do so as it is unsafe. Is it possible to have a stop()
> or interrupt() function to stop execution of a malicious script thats
> running in highly optimized context ?
You're right that this is a feature request and a good one. The right
way to do this is to implement Context.observeInstructionCount for
compiled mode. There would need to be some way to indicate to the
compiler that you'd like to observe the count, and then compile in
callbacks from the generated Java classes at key points (backwards
jumps, function returns) that increment a counter by some value that
approximates the count of executed Java instructions. The runtime
could then monitor these like is already done for interpreted scripts.
http://groups.google.com/group/mozilla.dev.tech.js-engine/browse_thread/thread/3211633206991a7e
Severity: normal → enhancement
OS: Linux → All
Comment 2•17 years ago
|
||
the function addInstructionCount adds a call in the compiled call to ScriptRuntime to append the number of instructions that is appropriate
Comment 3•17 years ago
|
||
Added the function that is being called by the compiled class - and adds the instruction count that is given by the argument.
Comment 4•17 years ago
|
||
Comment 5•17 years ago
|
||
Reporter | ||
Comment 6•17 years ago
|
||
I changed the approach a bit and added some additional supporting code. Committed: Checking in src/org/mozilla/javascript/CompilerEnvirons.java; /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/CompilerEnvirons.java,v <-- CompilerEnvirons.java new revision: 1.17; previous revision: 1.16 done Checking in src/org/mozilla/javascript/Context.java; /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/Context.java,v <-- Context.java new revision: 1.261; previous revision: 1.260 done Checking in src/org/mozilla/javascript/ScriptRuntime.java; /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/ScriptRuntime.java,v <-- ScriptRuntime.java new revision: 1.278; previous revision: 1.277 done Checking in src/org/mozilla/javascript/optimizer/Codegen.java; /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/optimizer/Codegen.java,v <-- Codegen.java new revision: 1.256; previous revision: 1.255 done Checking in toolsrc/org/mozilla/javascript/tools/jsc/Main.java; /cvsroot/mozilla/js/rhino/toolsrc/org/mozilla/javascript/tools/jsc/Main.java,v <-- Main.java new revision: 1.14; previous revision: 1.13 done Checking in toolsrc/org/mozilla/javascript/tools/resources/Messages.properties; /cvsroot/mozilla/js/rhino/toolsrc/org/mozilla/javascript/tools/resources/Messages.properties,v <-- Messages.properties new revision: 1.32; previous revision: 1.31 done
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•