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

Unified Diff: src/objects.cc

Issue 410883003: Fix debugger-related issues in the code serializer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 months 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 | « src/objects.h ('k') | src/serialize.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 0f9ea21d378b541e211b3939028ffeac31b49f37..b61175c98fdad763ac4f2ecf2bc44357c89e7ce0 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -10284,16 +10284,21 @@ Handle<Object> Script::GetNameOrSourceURL(Handle<Script> script) {
// collector will call the weak callback on the global handle
// associated with the wrapper and get rid of both the wrapper and the
// handle.
-static void ClearWrapperCache(
+static void ClearWrapperCacheWeakCallback(
const v8::WeakCallbackData<v8::Value, void>& data) {
Object** location = reinterpret_cast<Object**>(data.GetParameter());
JSValue* wrapper = JSValue::cast(*location);
- Foreign* foreign = Script::cast(wrapper->value())->wrapper();
+ Script::cast(wrapper->value())->ClearWrapperCache();
+}
+
+
+void Script::ClearWrapperCache() {
+ Foreign* foreign = wrapper();
+ Object** location = reinterpret_cast<Object**>(foreign->foreign_address());
ASSERT_EQ(foreign->foreign_address(), reinterpret_cast<Address>(location));
foreign->set_foreign_address(0);
GlobalHandles::Destroy(location);
- Isolate* isolate = reinterpret_cast<Isolate*>(data.GetIsolate());
- isolate->counters()->script_wrappers()->Decrement();
+ GetIsolate()->counters()->script_wrappers()->Decrement();
}
@@ -10318,7 +10323,7 @@ Handle<JSObject> Script::GetWrapper(Handle<Script> script) {
Handle<Object> handle = isolate->global_handles()->Create(*result);
GlobalHandles::MakeWeak(handle.location(),
reinterpret_cast<void*>(handle.location()),
- &ClearWrapperCache);
+ &ClearWrapperCacheWeakCallback);
script->wrapper()->set_foreign_address(
reinterpret_cast<Address>(handle.location()));
return result;
« no previous file with comments | « src/objects.h ('k') | src/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698