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

Unified Diff: include/v8.h

Issue 17068006: Remove IsInitialized checks from inlined API functions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Sven Panne. Created 7 years, 6 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 9ddde5294b168900f3c8fbf318673b978e04a4a9..fdeccf9f32488ba049a402230d900d720b5e2fd0 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -5301,7 +5301,6 @@ class Internals {
static const int kExternalTwoByteRepresentationTag = 0x02;
static const int kExternalAsciiRepresentationTag = 0x06;
- static const int kIsolateStateOffset = 0;
static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize;
static const int kIsolateRootsOffset = 3 * kApiPointerSize;
static const int kUndefinedValueRootIndex = 5;
@@ -5326,6 +5325,12 @@ class Internals {
static const int kUndefinedOddballKind = 5;
static const int kNullOddballKind = 3;
+#ifdef V8_ENABLE_CHECKS
+ static void CheckInitialized(v8::Isolate* isolate);
+#else
+ static void CheckInitialized(v8::Isolate* isolate) { }
+#endif
+
V8_INLINE(static bool HasHeapObjectTag(internal::Object* value)) {
return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) ==
kHeapObjectTag);
@@ -5359,11 +5364,6 @@ class Internals {
return representation == kExternalTwoByteRepresentationTag;
}
- V8_INLINE(static bool IsInitialized(v8::Isolate* isolate)) {
- uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateStateOffset;
- return *reinterpret_cast<int*>(addr) == 1;
- }
-
V8_INLINE(static uint8_t GetNodeFlag(internal::Object** obj, int shift)) {
uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
return *addr & (1 << shift);
@@ -5939,7 +5939,7 @@ String* String::Cast(v8::Value* value) {
Local<String> String::Empty(Isolate* isolate) {
typedef internal::Object* S;
typedef internal::Internals I;
- if (!I::IsInitialized(isolate)) return Empty();
+ I::CheckInitialized(isolate);
S* slot = I::GetRoot(isolate, I::kEmptyStringRootIndex);
return Local<String>(reinterpret_cast<String*>(slot));
}
@@ -6292,7 +6292,7 @@ ReturnValue<T> PropertyCallbackInfo<T>::GetReturnValue() const {
Handle<Primitive> Undefined(Isolate* isolate) {
typedef internal::Object* S;
typedef internal::Internals I;
- if (!I::IsInitialized(isolate)) return Undefined();
+ I::CheckInitialized(isolate);
S* slot = I::GetRoot(isolate, I::kUndefinedValueRootIndex);
return Handle<Primitive>(reinterpret_cast<Primitive*>(slot));
}
@@ -6301,7 +6301,7 @@ Handle<Primitive> Undefined(Isolate* isolate) {
Handle<Primitive> Null(Isolate* isolate) {
typedef internal::Object* S;
typedef internal::Internals I;
- if (!I::IsInitialized(isolate)) return Null();
+ I::CheckInitialized(isolate);
S* slot = I::GetRoot(isolate, I::kNullValueRootIndex);
return Handle<Primitive>(reinterpret_cast<Primitive*>(slot));
}
@@ -6310,7 +6310,7 @@ Handle<Primitive> Null(Isolate* isolate) {
Handle<Boolean> True(Isolate* isolate) {
typedef internal::Object* S;
typedef internal::Internals I;
- if (!I::IsInitialized(isolate)) return True();
+ I::CheckInitialized(isolate);
S* slot = I::GetRoot(isolate, I::kTrueValueRootIndex);
return Handle<Boolean>(reinterpret_cast<Boolean*>(slot));
}
@@ -6319,7 +6319,7 @@ Handle<Boolean> True(Isolate* isolate) {
Handle<Boolean> False(Isolate* isolate) {
typedef internal::Object* S;
typedef internal::Internals I;
- if (!I::IsInitialized(isolate)) return False();
+ I::CheckInitialized(isolate);
S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex);
return Handle<Boolean>(reinterpret_cast<Boolean*>(slot));
}
« 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