Commit c5c57d72 authored by dslomov@chromium.org's avatar dslomov@chromium.org

Put 7942 "Per-isolate embedder-specific data" back

TBR=

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7947 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 3d5d1692
...@@ -2670,6 +2670,17 @@ class V8EXPORT Isolate { ...@@ -2670,6 +2670,17 @@ class V8EXPORT Isolate {
*/ */
void Dispose(); void Dispose();
/**
* Associate embedder-specific data with the isolate
*/
void SetData(void* data);
/**
* Retrive embedder-specific data from the isolate.
* Returns NULL if SetData has never been called.
*/
void* GetData();
private: private:
Isolate(); Isolate();
......
...@@ -4870,6 +4870,17 @@ void Isolate::Exit() { ...@@ -4870,6 +4870,17 @@ void Isolate::Exit() {
} }
void Isolate::SetData(void* data) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
isolate->SetData(data);
}
void* Isolate::GetData() {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
return isolate->GetData();
}
String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj)
: str_(NULL), length_(0) { : str_(NULL), length_(0) {
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
......
...@@ -1397,7 +1397,8 @@ Isolate::Isolate() ...@@ -1397,7 +1397,8 @@ Isolate::Isolate()
string_tracker_(NULL), string_tracker_(NULL),
regexp_stack_(NULL), regexp_stack_(NULL),
frame_element_constant_list_(0), frame_element_constant_list_(0),
result_constant_list_(0) { result_constant_list_(0),
embedder_data_(NULL) {
TRACE_ISOLATE(constructor); TRACE_ISOLATE(constructor);
memset(isolate_addresses_, 0, memset(isolate_addresses_, 0,
......
...@@ -994,6 +994,9 @@ class Isolate { ...@@ -994,6 +994,9 @@ class Isolate {
void ResetEagerOptimizingData(); void ResetEagerOptimizingData();
void SetData(void* data) { embedder_data_ = data; }
void* GetData() { return embedder_data_; }
private: private:
Isolate(); Isolate();
...@@ -1156,6 +1159,7 @@ class Isolate { ...@@ -1156,6 +1159,7 @@ class Isolate {
unibrow::Mapping<unibrow::Ecma262Canonicalize> interp_canonicalize_mapping_; unibrow::Mapping<unibrow::Ecma262Canonicalize> interp_canonicalize_mapping_;
ZoneObjectList frame_element_constant_list_; ZoneObjectList frame_element_constant_list_;
ZoneObjectList result_constant_list_; ZoneObjectList result_constant_list_;
void* embedder_data_;
#if defined(V8_TARGET_ARCH_ARM) && !defined(__arm__) || \ #if defined(V8_TARGET_ARCH_ARM) && !defined(__arm__) || \
defined(V8_TARGET_ARCH_MIPS) && !defined(__mips__) defined(V8_TARGET_ARCH_MIPS) && !defined(__mips__)
......
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