Revision: 17915
Author: [email protected]
Date: Wed Nov 20 12:05:44 2013 UTC
Log: Revert r17907 - Make it possible to add more than one piece of
embedder data to isolates
This will allow for using gin and blink bindings in the same process
BUG=317398
[email protected], [email protected]
LOG=y
Review URL: https://codereview.chromium.org/77913003
BUG=none
[email protected]
[email protected]
LOG=n
Review URL: https://codereview.chromium.org/78093005
http://code.google.com/p/v8/source/detail?r=17915
Modified:
/branches/bleeding_edge/include/v8.h
/branches/bleeding_edge/src/d8.cc
/branches/bleeding_edge/src/isolate.cc
/branches/bleeding_edge/src/isolate.h
/branches/bleeding_edge/test/cctest/test-api.cc
=======================================
--- /branches/bleeding_edge/include/v8.h Wed Nov 20 11:21:51 2013 UTC
+++ /branches/bleeding_edge/include/v8.h Wed Nov 20 12:05:44 2013 UTC
@@ -4054,36 +4054,16 @@
void Dispose();
/**
- * Associate embedder-specific data with the isolate. This legacy method
- * puts the data in the 0th slot. It will be deprecated soon.
+ * Associate embedder-specific data with the isolate
*/
V8_INLINE void SetData(void* data);
/**
- * Associate embedder-specific data with the isolate. |slot| has to be
- * between 0 and GetNumberOfDataSlots() - 1.
- */
- V8_INLINE void SetData(uint32_t slot, void* data);
-
- /**
- * Retrieve embedder-specific data from the isolate. This legacy method
- * retrieves the data from slot 0. It will be deprecated soon.
+ * Retrieve embedder-specific data from the isolate.
* Returns NULL if SetData has never been called.
*/
V8_INLINE void* GetData();
- /**
- * Retrieve embedder-specific data from the isolate.
- * Returns NULL if SetData has never been called for the given |slot|.
- */
- V8_INLINE void* GetData(uint32_t slot);
-
- /**
- * Returns the maximum number of available embedder data slots. Valid
slots
- * are in the range of 0 - GetNumberOfDataSlots() - 1.
- */
- V8_INLINE static uint32_t GetNumberOfDataSlots();
-
/**
* Get statistics about the heap memory usage.
*/
@@ -5469,7 +5449,7 @@
static const int kExternalAsciiRepresentationTag = 0x06;
static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize;
- static const int kIsolateRootsOffset = 6 * kApiPointerSize;
+ static const int kIsolateRootsOffset = 3 * kApiPointerSize;
static const int kUndefinedValueRootIndex = 5;
static const int kNullValueRootIndex = 7;
static const int kTrueValueRootIndex = 8;
@@ -5493,8 +5473,6 @@
static const int kUndefinedOddballKind = 5;
static const int kNullOddballKind = 3;
- static const uint32_t kNumIsolateDataSlots = 4;
-
V8_EXPORT static void CheckInitializedImpl(v8::Isolate* isolate);
V8_INLINE static void CheckInitialized(v8::Isolate* isolate) {
#ifdef V8_ENABLE_CHECKS
@@ -5558,17 +5536,15 @@
*addr = static_cast<uint8_t>((*addr & ~kNodeStateMask) | value);
}
- V8_INLINE static void SetEmbedderData(v8::Isolate *isolate,
- uint32_t slot,
- void *data) {
- uint8_t *addr = reinterpret_cast<uint8_t *>(isolate) +
- kIsolateEmbedderDataOffset + slot * kApiPointerSize;
+ V8_INLINE static void SetEmbedderData(v8::Isolate* isolate, void* data) {
+ uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) +
+ kIsolateEmbedderDataOffset;
*reinterpret_cast<void**>(addr) = data;
}
- V8_INLINE static void* GetEmbedderData(v8::Isolate* isolate, uint32_t
slot) {
+ V8_INLINE static void* GetEmbedderData(v8::Isolate* isolate) {
uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) +
- kIsolateEmbedderDataOffset + slot * kApiPointerSize;
+ kIsolateEmbedderDataOffset;
return *reinterpret_cast<void**>(addr);
}
@@ -6494,31 +6470,13 @@
void Isolate::SetData(void* data) {
typedef internal::Internals I;
- I::SetEmbedderData(this, 0, data);
+ I::SetEmbedderData(this, data);
}
void* Isolate::GetData() {
typedef internal::Internals I;
- return I::GetEmbedderData(this, 0);
-}
-
-
-void Isolate::SetData(uint32_t slot, void* data) {
- typedef internal::Internals I;
- I::SetEmbedderData(this, slot, data);
-}
-
-
-void* Isolate::GetData(uint32_t slot) {
- typedef internal::Internals I;
- return I::GetEmbedderData(this, slot);
-}
-
-
-uint32_t Isolate::GetNumberOfDataSlots() {
- typedef internal::Internals I;
- return I::kNumIsolateDataSlots;
+ return I::GetEmbedderData(this);
}
=======================================
--- /branches/bleeding_edge/src/d8.cc Wed Nov 20 11:20:01 2013 UTC
+++ /branches/bleeding_edge/src/d8.cc Wed Nov 20 12:05:44 2013 UTC
@@ -90,15 +90,15 @@
public:
explicit PerIsolateData(Isolate* isolate) : isolate_(isolate),
realms_(NULL) {
HandleScope scope(isolate);
- isolate->SetData(0, this);
+ isolate->SetData(this);
}
~PerIsolateData() {
- isolate_->SetData(0, NULL); // Not really needed, just to be sure...
+ isolate_->SetData(NULL); // Not really needed, just to be sure...
}
inline static PerIsolateData* Get(Isolate* isolate) {
- return reinterpret_cast<PerIsolateData*>(isolate->GetData(0));
+ return reinterpret_cast<PerIsolateData*>(isolate->GetData());
}
class RealmScope {
=======================================
--- /branches/bleeding_edge/src/isolate.cc Wed Nov 20 10:59:13 2013 UTC
+++ /branches/bleeding_edge/src/isolate.cc Wed Nov 20 12:05:44 2013 UTC
@@ -1720,6 +1720,7 @@
Isolate::Isolate()
: state_(UNINITIALIZED),
+ embedder_data_(NULL),
entry_stack_(NULL),
stack_trace_nesting_level_(0),
incomplete_message_(NULL),
=======================================
--- /branches/bleeding_edge/src/isolate.h Wed Nov 20 10:59:13 2013 UTC
+++ /branches/bleeding_edge/src/isolate.h Wed Nov 20 12:05:44 2013 UTC
@@ -1050,14 +1050,8 @@
thread_local_top_.current_vm_state_ = state;
}
- void SetData(uint32_t slot, void* data) {
- ASSERT(slot < Internals::kNumIsolateDataSlots);
- embedder_data_[slot] = data;
- }
- void* GetData(uint32_t slot) {
- ASSERT(slot < Internals::kNumIsolateDataSlots);
- return embedder_data_[slot];
- }
+ void SetData(void* data) { embedder_data_ = data; }
+ void* GetData() { return embedder_data_; }
LookupResult* top_lookup_result() {
return thread_local_top_.top_lookup_result_;
@@ -1171,7 +1165,7 @@
// with v8::internal::Internals (in include/v8.h) constants. This is also
// verified in Isolate::Init() using runtime checks.
State state_; // Will be padded to kApiPointerSize.
- void* embedder_data_[Internals::kNumIsolateDataSlots];
+ void* embedder_data_;
Heap heap_;
// The per-process lock should be acquired before the ThreadDataTable is
=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Wed Nov 20 11:21:51
2013 UTC
+++ /branches/bleeding_edge/test/cctest/test-api.cc Wed Nov 20 12:05:44
2013 UTC
@@ -19937,28 +19937,16 @@
v8::Isolate* isolate = v8::Isolate::New();
isolate->Enter();
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
- for (uint32_t slot = 0; slot < v8::Isolate::GetNumberOfDataSlots();
++slot) {
- CHECK_EQ(NULL, isolate->GetData(slot));
- CHECK_EQ(NULL, i_isolate->GetData(slot));
- }
- for (uint32_t slot = 0; slot < v8::Isolate::GetNumberOfDataSlots();
++slot) {
- void* data = reinterpret_cast<void*>(0xacce55ed + slot);
- isolate->SetData(slot, data);
- }
- for (uint32_t slot = 0; slot < v8::Isolate::GetNumberOfDataSlots();
++slot) {
- void* data = reinterpret_cast<void*>(0xacce55ed + slot);
- CHECK_EQ(data, isolate->GetData(slot));
- CHECK_EQ(data, i_isolate->GetData(slot));
- }
- for (uint32_t slot = 0; slot < v8::Isolate::GetNumberOfDataSlots();
++slot) {
- void* data = reinterpret_cast<void*>(0xdecea5ed + slot);
- isolate->SetData(slot, data);
- }
- for (uint32_t slot = 0; slot < v8::Isolate::GetNumberOfDataSlots();
++slot) {
- void* data = reinterpret_cast<void*>(0xdecea5ed + slot);
- CHECK_EQ(data, isolate->GetData(slot));
- CHECK_EQ(data, i_isolate->GetData(slot));
- }
+ CHECK_EQ(NULL, isolate->GetData());
+ CHECK_EQ(NULL, i_isolate->GetData());
+ static void* data1 = reinterpret_cast<void*>(0xacce55ed);
+ isolate->SetData(data1);
+ CHECK_EQ(data1, isolate->GetData());
+ CHECK_EQ(data1, i_isolate->GetData());
+ static void* data2 = reinterpret_cast<void*>(0xdecea5ed);
+ i_isolate->SetData(data2);
+ CHECK_EQ(data2, isolate->GetData());
+ CHECK_EQ(data2, i_isolate->GetData());
isolate->Exit();
isolate->Dispose();
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.