Revision: 5203
Author: [email protected]
Date: Fri Aug  6 16:10:53 2010
Log: [Isolates] Replace ISOLATE_FROM_HEAP with Heap::isolate()

Review URL: http://codereview.chromium.org/3043060
http://code.google.com/p/v8/source/detail?r=5203

Modified:
 /branches/experimental/isolates/src/builtins.cc
 /branches/experimental/isolates/src/isolate.h
 /branches/experimental/isolates/src/runtime.cc

=======================================
--- /branches/experimental/isolates/src/builtins.cc     Fri Aug  6 15:56:35 2010
+++ /branches/experimental/isolates/src/builtins.cc     Fri Aug  6 16:10:53 2010
@@ -245,7 +245,7 @@

 static Object* AllocateJSArray(Heap* heap) {
   JSFunction* array_function =
- ISOLATE_FROM_HEAP(heap)->context()->global_context()->array_function();
+      heap->isolate()->context()->global_context()->array_function();
   Object* result = heap->AllocateJSObject(array_function);
   if (result->IsFailure()) return result;
   return result;
@@ -378,7 +378,7 @@
   if (!IsJSArrayWithFastElements(heap, receiver, elements)) return false;

   Context* global_context =
-      ISOLATE_FROM_HEAP(heap)->context()->global_context();
+      heap->isolate()->context()->global_context();
   JSObject* array_proto =
       JSObject::cast(global_context->array_function()->prototype());
   if (JSArray::cast(receiver)->GetPrototype() != array_proto) return false;
=======================================
--- /branches/experimental/isolates/src/isolate.h       Fri Aug  6 15:56:35 2010
+++ /branches/experimental/isolates/src/isolate.h       Fri Aug  6 16:10:53 2010
@@ -1035,12 +1035,6 @@
 };


-#define ISOLATE_FROM_HEAP(heap_pointer) ((Isolate*)(  \
-  (uint8_t*)(heap_pointer) -                          \
-  (size_t)((Isolate*)sizeof(Isolate))->heap() +       \
-  sizeof(Isolate)))
-
-
 // If the GCC version is 4.1.x or 4.2.x an additional field is added to the
 // class as a work around for a bug in the generated code found with these
 // versions of GCC. See V8 issue 122 for details.
=======================================
--- /branches/experimental/isolates/src/runtime.cc      Fri Aug  6 15:56:35 2010
+++ /branches/experimental/isolates/src/runtime.cc      Fri Aug  6 16:10:53 2010
@@ -103,7 +103,7 @@

 static Object* DeepCopyBoilerplate(Heap* heap, JSObject* boilerplate) {
   StackLimitCheck check;
- if (check.HasOverflowed()) return ISOLATE_FROM_HEAP(heap)->StackOverflow();
+  if (check.HasOverflowed()) return heap->isolate()->StackOverflow();

   Object* result = heap->CopyJSObject(boilerplate);
   if (result->IsFailure()) return result;
@@ -3937,7 +3937,7 @@
     Handle<Object> error =
         Factory::NewTypeError("non_object_property_load",
                               HandleVector(args, 2));
-    return ISOLATE_FROM_HEAP(heap)->Throw(*error);
+    return heap->isolate()->Throw(*error);
   }

   // Check if the given key is an array index.
@@ -4147,7 +4147,7 @@
     Handle<Object> error =
         Factory::NewTypeError("non_object_property_store",
                               HandleVector(args, 2));
-    return ISOLATE_FROM_HEAP(heap)->Throw(*error);
+    return heap->isolate()->Throw(*error);
   }

   // If the object isn't a JavaScript object, we ignore the store.
@@ -5201,7 +5201,7 @@
         if (char_length == 0) char_length = 1;
         current_length += char_length;
         if (current_length > Smi::kMaxValue) {
-          ISOLATE_FROM_HEAP(heap)->context()->mark_out_of_memory();
+          heap->isolate()->context()->mark_out_of_memory();
           return Failure::OutOfMemoryException();
         }
       }
@@ -7090,18 +7090,18 @@
       Handle<Object> handle(object);
       Handle<Object> result =
Factory::NewTypeError("with_expression", HandleVector(&handle, 1));
-      return ISOLATE_FROM_HEAP(heap)->Throw(*result);
+      return heap->isolate()->Throw(*result);
     }
   }

   Object* result =
-      heap->AllocateWithContext(ISOLATE_FROM_HEAP(heap)->context(),
+      heap->AllocateWithContext(heap->isolate()->context(),
                                 JSObject::cast(js_object),
                                 is_catch_context);
   if (result->IsFailure()) return result;

   Context* context = Context::cast(result);
-  ISOLATE_FROM_HEAP(heap)->set_context(context);
+  heap->isolate()->set_context(context);

   return result;
 }
@@ -8442,8 +8442,8 @@
         value = receiver->GetPropertyWithCallback(
             receiver, structure, name, result->holder());
         if (value->IsException()) {
-          value = ISOLATE_FROM_HEAP(heap)->pending_exception();
-          ISOLATE_FROM_HEAP(heap)->clear_pending_exception();
+          value = heap->isolate()->pending_exception();
+          heap->isolate()->clear_pending_exception();
           if (caught_exception != NULL) {
             *caught_exception = true;
           }
@@ -8969,7 +8969,7 @@
// Allocate and initialize a JSObject with all the arguments, stack locals
   // heap locals and extension properties of the debugged function.
   Handle<JSObject> local_scope =
-      Factory::NewJSObject(ISOLATE_FROM_HEAP(heap)->object_function());
+      Factory::NewJSObject(heap->isolate()->object_function());

   // First fill all parameters.
   for (int i = 0; i < scope_info.number_of_parameters(); ++i) {
@@ -9023,7 +9023,7 @@
// Allocate and initialize a JSObject with all the content of theis function
   // closure.
   Handle<JSObject> closure_scope =
-      Factory::NewJSObject(ISOLATE_FROM_HEAP(heap)->object_function());
+      Factory::NewJSObject(heap->isolate()->object_function());

   // Check whether the arguments shadow object exists.
   int arguments_shadow_index =

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to