Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(896)

Unified Diff: include/v8.h

Issue 11961014: Inline SetWrapperClassId() and WrapperClassId() (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: patch Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index 3d12193408255e8443ed7f3b0d485ec9a018156a..ff3d96b2b3e3a48999121c99c9a16d335c55c5c6 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -4152,6 +4152,7 @@ class Internals {
static const int kIsolateStateOffset = 0;
static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize;
static const int kIsolateRootsOffset = 3 * kApiPointerSize;
+ static const int kNodeClassIdOffset = 1 * kApiPointerSize;
static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3;
static const int kUndefinedValueRootIndex = 5;
static const int kNullValueRootIndex = 7;
@@ -4404,12 +4405,18 @@ void Persistent<T>::MarkPartiallyDependent(Isolate* isolate) {
template <class T>
void Persistent<T>::SetWrapperClassId(uint16_t class_id) {
- V8::SetWrapperClassId(reinterpret_cast<internal::Object**>(**this), class_id);
+ typedef internal::Internals I;
+ internal::Object** obj = reinterpret_cast<internal::Object**>(**this);
+ uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset;
+ *reinterpret_cast<uint16_t*>(addr) = class_id;
}
template <class T>
uint16_t Persistent<T>::WrapperClassId() const {
- return V8::GetWrapperClassId(reinterpret_cast<internal::Object**>(**this));
+ typedef internal::Internals I;
+ internal::Object** obj = reinterpret_cast<internal::Object**>(**this);
+ uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset;
+ return *reinterpret_cast<uint16_t*>(addr);
}
Arguments::Arguments(internal::Object** implicit_args,
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698