| Index: src/api.cc
|
| diff --git a/src/api.cc b/src/api.cc
|
| index f28082344cc34f20f78be91f3619cff64530ea34..6b01d5544242b52c42fb6c5167b7f8592d5fa119 100644
|
| --- a/src/api.cc
|
| +++ b/src/api.cc
|
| @@ -268,8 +268,8 @@ static bool InitializeHelper() {
|
| }
|
|
|
|
|
| -static inline bool EnsureInitialized(const char* location) {
|
| - i::Isolate* isolate = i::Isolate::UncheckedCurrent();
|
| +static inline bool EnsureInitializedForIsolate(i::Isolate* isolate,
|
| + const char* location) {
|
| if (isolate != NULL) {
|
| if (isolate->IsDefaultIsolate()) {
|
| if (i::V8::IsRunning()) {
|
| @@ -287,6 +287,10 @@ static inline bool EnsureInitialized(const char* location) {
|
| return ApiCheck(InitializeHelper(), location, "Error initializing V8");
|
| }
|
|
|
| +static inline bool EnsureInitialized(const char* location) {
|
| + i::Isolate* isolate = i::Isolate::UncheckedCurrent();
|
| + return EnsureInitializedForIsolate(isolate, location);
|
| +}
|
|
|
| #ifdef DEBUG
|
| void ImplementationUtilities::ZapHandleRange(i::Object** begin,
|
| @@ -303,8 +307,11 @@ v8::Handle<v8::Primitive> ImplementationUtilities::Undefined() {
|
|
|
|
|
| v8::Handle<v8::Primitive> ImplementationUtilities::Null() {
|
| - if (!EnsureInitialized("v8::Null()")) return v8::Handle<v8::Primitive>();
|
| - return v8::Handle<Primitive>(ToApi<Primitive>(FACTORY->null_value()));
|
| + i::Isolate* isolate = i::Isolate::UncheckedCurrent();
|
| + if (!EnsureInitializedForIsolate(isolate, "v8::Null()"))
|
| + return v8::Handle<v8::Primitive>();
|
| + return v8::Handle<Primitive>(
|
| + ToApi<Primitive>(isolate->factory()->null_value()));
|
| }
|
|
|
|
|
| @@ -512,11 +519,18 @@ int HandleScope::NumberOfHandles() {
|
| }
|
|
|
|
|
| -i::Object** v8::HandleScope::CreateHandle(i::Object* value) {
|
| +i::Object** HandleScope::CreateHandle(i::Object* value) {
|
| return i::HandleScope::CreateHandle(value, i::Isolate::Current());
|
| }
|
|
|
|
|
| +i::Object** HandleScope::CreateHandle(i::HeapObject* value) {
|
| + ASSERT(value->IsHeapObject());
|
| + return reinterpret_cast<i::Object**>(
|
| + i::HandleScope::CreateHandle(value, value->GetIsolate()));
|
| +}
|
| +
|
| +
|
| void Context::Enter() {
|
| if (IsDeadCheck("v8::Context::Enter()")) return;
|
| ENTER_V8;
|
| @@ -3857,12 +3871,14 @@ Local<Number> v8::Number::New(double value) {
|
|
|
|
|
| Local<Integer> v8::Integer::New(int32_t value) {
|
| - EnsureInitialized("v8::Integer::New()");
|
| + i::Isolate* isolate = i::Isolate::UncheckedCurrent();
|
| + EnsureInitializedForIsolate(isolate, "v8::Integer::New()");
|
| if (i::Smi::IsValid(value)) {
|
| - return Utils::IntegerToLocal(i::Handle<i::Object>(i::Smi::FromInt(value)));
|
| + return Utils::IntegerToLocal(i::Handle<i::Object>(i::Smi::FromInt(value),
|
| + isolate));
|
| }
|
| ENTER_V8;
|
| - i::Handle<i::Object> result = FACTORY->NewNumber(value);
|
| + i::Handle<i::Object> result = isolate->factory()->NewNumber(value);
|
| return Utils::IntegerToLocal(result);
|
| }
|
|
|
|
|