Fixed bug that caused function literals to not be optimized as much as other functions.

Improved profiler support.

Fixed a crash bug in connection with debugger unloading.

Fixed a crash bug in the code generator caused by losing the information that a frame element was copied.

Fixed an exception propagation bug that could cause non-null return values when exceptions were thrown.



git-svn-id: http://v8.googlecode.com/svn/trunk@1664 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/global-handles.cc b/src/global-handles.cc
index a92f0df..c2194fc 100644
--- a/src/global-handles.cc
+++ b/src/global-handles.cc
@@ -1,4 +1,4 @@
-// Copyright 2007-2008 the V8 project authors. All rights reserved.
+// Copyright 2009 the V8 project authors. All rights reserved.
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // met:
@@ -153,7 +153,12 @@
     // behavior.
     WeakReferenceCallback func = callback();
     if (func != NULL) {
-      func(v8::Persistent<v8::Object>(ToApi<v8::Object>(handle())), par);
+      v8::Persistent<v8::Object> object = ToApi<v8::Object>(handle());
+      {
+        // Leaving V8.
+        VMState state(EXTERNAL);
+        func(object, par);
+      }
     }
   }