Commit 9b32bb22 authored by jochen@chromium.org's avatar jochen@chromium.org

Add a getter for the address and size of the code range to the pulic API

Since the x64 backend currently doesn't emit ABI compliant code, it is
not possible to unwind the stack. During Win64 SEH this will cause the
exception handling to abort, and not even call the unhandled exception
handler. Embedders are advised to install a custom unwind callback using
RtlInstallFunctionTableCallback for the entire code range to catch
unwind attempts for exception handling.

BUG=v8:3598
R=svenpanne@chromium.org
LOG=y

Review URL: https://codereview.chromium.org/612043002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24283 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b2aaac94
......@@ -4847,6 +4847,18 @@ class V8_EXPORT Isolate {
*/
void SetStackLimit(uintptr_t stack_limit);
/**
* Returns a memory range that can potentially contain jitted code.
*
* On Win64, embedders are advised to install function table callbacks for
* these ranges, as default SEH won't be able to unwind through jitted code.
*
* Might be empty on other platforms.
*
* https://code.google.com/p/v8/issues/detail?id=3598
*/
void GetCodeRange(void** start, size_t* length_in_bytes);
private:
template<class K, class V, class Traits> friend class PersistentValueMap;
......
......@@ -6826,6 +6826,18 @@ void v8::Isolate::SetStackLimit(uintptr_t stack_limit) {
}
void v8::Isolate::GetCodeRange(void** start, size_t* length_in_bytes) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
if (isolate->code_range()->valid()) {
*start = isolate->code_range()->start();
*length_in_bytes = isolate->code_range()->size();
} else {
*start = NULL;
*length_in_bytes = 0;
}
}
String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj)
: str_(NULL), length_(0) {
i::Isolate* isolate = i::Isolate::Current();
......
......@@ -880,6 +880,10 @@ class CodeRange {
DCHECK(valid());
return static_cast<Address>(code_range_->address());
}
size_t size() {
DCHECK(valid());
return code_range_->size();
}
bool contains(Address address) {
if (!valid()) return false;
Address start = static_cast<Address>(code_range_->address());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment