Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index 7b94a59a29f806ede93ec2b174a5a54825d7016e..90245319928d068756e92b3106ee9961e123031b 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -1084,6 +1084,7 @@ class String : public Primitive { |
* A zero length string. |
*/ |
V8EXPORT static v8::Local<v8::String> Empty(); |
+ inline static v8::Local<v8::String> Empty(Isolate* isolate); |
/** |
* Returns true if the string is external |
@@ -3903,6 +3904,7 @@ class Internals { |
static const int kNullValueRootIndex = 7; |
static const int kTrueValueRootIndex = 8; |
static const int kFalseValueRootIndex = 9; |
+ static const int kEmptySymbolRootIndex = 128; |
static const int kJSObjectType = 0xaa; |
static const int kFirstNonstringType = 0x80; |
@@ -4221,6 +4223,15 @@ 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(); |
+ S* slot = I::GetRoot(isolate, I::kEmptySymbolRootIndex); |
+ return Local<String>(reinterpret_cast<String*>(slot)); |
+} |
+ |
+ |
String::ExternalStringResource* String::GetExternalStringResource() const { |
typedef internal::Object O; |
typedef internal::Internals I; |