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

Unified Diff: src/api.cc

Issue 5107003: [Isolates] Cleanup of codepaths slowing down Dromaeo in browser. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/isolates
Patch Set: Created 10 years, 1 month 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/builtins.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index f28082344cc34f20f78be91f3619cff64530ea34..6726cdffa5d864d89bc759d31a184e20d4f6c6d0 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,
@@ -513,7 +517,9 @@ int HandleScope::NumberOfHandles() {
i::Object** v8::HandleScope::CreateHandle(i::Object* value) {
- return i::HandleScope::CreateHandle(value, i::Isolate::Current());
+ ASSERT(value->IsHeapObject());
Vitaly Repeshko 2010/11/25 23:04:09 This will break if someone tries to create handle
+ return reinterpret_cast<i::Object**>(i::HandleScope::CreateHandle(
+ value, static_cast<i::JSObject*>(value)->GetIsolate()));
Vitaly Repeshko 2010/11/25 23:04:09 JSObject -> HeapObject.
}
@@ -3857,12 +3863,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);
}
« no previous file with comments | « no previous file | src/builtins.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698