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

Side by Side Diff: src/handles.cc

Issue 56060: Add just enough state changes from EXTERNAL (outside V8) to OTHER... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 } 301 }
302 302
303 303
304 // Wrappers for scripts are kept alive and cached in weak global 304 // Wrappers for scripts are kept alive and cached in weak global
305 // handles referred from proxy objects held by the scripts as long as 305 // handles referred from proxy objects held by the scripts as long as
306 // they are used. When they are not used anymore, the garbage 306 // they are used. When they are not used anymore, the garbage
307 // collector will call the weak callback on the global handle 307 // collector will call the weak callback on the global handle
308 // associated with the wrapper and get rid of both the wrapper and the 308 // associated with the wrapper and get rid of both the wrapper and the
309 // handle. 309 // handle.
310 static void ClearWrapperCache(Persistent<v8::Value> handle, void*) { 310 static void ClearWrapperCache(Persistent<v8::Value> handle, void*) {
311 #ifdef ENABLE_HEAP_PROTECTION
312 // Weak reference callbacks are called as if from outside V8. We
313 // need to reeenter to unprotect the heap.
314 VMState state(OTHER);
315 #endif
311 Handle<Object> cache = Utils::OpenHandle(*handle); 316 Handle<Object> cache = Utils::OpenHandle(*handle);
312 JSValue* wrapper = JSValue::cast(*cache); 317 JSValue* wrapper = JSValue::cast(*cache);
313 Proxy* proxy = Script::cast(wrapper->value())->wrapper(); 318 Proxy* proxy = Script::cast(wrapper->value())->wrapper();
314 ASSERT(proxy->proxy() == reinterpret_cast<Address>(cache.location())); 319 ASSERT(proxy->proxy() == reinterpret_cast<Address>(cache.location()));
315 proxy->set_proxy(0); 320 proxy->set_proxy(0);
316 GlobalHandles::Destroy(cache.location()); 321 GlobalHandles::Destroy(cache.location());
317 Counters::script_wrappers.Decrement(); 322 Counters::script_wrappers.Decrement();
318 } 323 }
319 324
320 325
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 Handle<Context> compile_context, 679 Handle<Context> compile_context,
675 Handle<Context> function_context) { 680 Handle<Context> function_context) {
676 Handle<FixedArray> arr = Factory::NewFixedArray(3); 681 Handle<FixedArray> arr = Factory::NewFixedArray(3);
677 arr->set(0, Smi::FromInt(index)); 682 arr->set(0, Smi::FromInt(index));
678 arr->set(1, *compile_context); // Compile in this context 683 arr->set(1, *compile_context); // Compile in this context
679 arr->set(2, *function_context); // Set function context to this 684 arr->set(2, *function_context); // Set function context to this
680 fun->shared()->set_lazy_load_data(*arr); 685 fun->shared()->set_lazy_load_data(*arr);
681 } 686 }
682 687
683 } } // namespace v8::internal 688 } } // namespace v8::internal
OLDNEW
« src/global-handles.cc ('K') | « src/global-handles.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698