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

Unified Diff: src/handles.cc

Issue 67273004: Fix invalid reuse of weak global handle in GetScriptWrapper. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | test/mjsunit/regress/regress-2988.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/handles.cc
diff --git a/src/handles.cc b/src/handles.cc
index 6fd047b0ab25562b5013c3daee4860847458ff8d..b86f19a498cdfc5fa1e0dfe942f9524db858f28f 100644
--- a/src/handles.cc
+++ b/src/handles.cc
@@ -242,9 +242,9 @@ static void ClearWrapperCache(v8::Isolate* v8_isolate,
Handle<JSValue> GetScriptWrapper(Handle<Script> script) {
if (script->wrapper()->foreign_address() != NULL) {
- // Return the script wrapper directly from the cache.
+ // Return a handle for the existing script wrapper from the cache.
return Handle<JSValue>(
- reinterpret_cast<JSValue**>(script->wrapper()->foreign_address()));
+ *reinterpret_cast<JSValue**>(script->wrapper()->foreign_address()));
}
Isolate* isolate = script->GetIsolate();
// Construct a new script wrapper.
@@ -255,10 +255,10 @@ Handle<JSValue> GetScriptWrapper(Handle<Script> script) {
// The allocation might have triggered a GC, which could have called this
// function recursively, and a wrapper has already been created and cached.
- // In that case, simply return the cached wrapper.
+ // In that case, simply return a handle for the cached wrapper.
if (script->wrapper()->foreign_address() != NULL) {
return Handle<JSValue>(
- reinterpret_cast<JSValue**>(script->wrapper()->foreign_address()));
+ *reinterpret_cast<JSValue**>(script->wrapper()->foreign_address()));
}
result->set_value(*script);
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-2988.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698