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

Unified Diff: include/v8.h

Issue 17642011: Reland "Remove IsInitialized checks from inlined API functions." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 de3a40ff3388e2bd2dcbf50c15b36123c2d16286..7074cc0464c0ddbf61c0ccec301815596ff4d7e5 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -5347,7 +5347,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;
@@ -5372,6 +5371,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);
@@ -5405,11 +5410,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);
@@ -5985,7 +5985,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));
}
@@ -6354,7 +6354,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));
}
@@ -6363,7 +6363,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));
}
@@ -6372,7 +6372,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));
}
@@ -6381,7 +6381,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