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

Side by Side Diff: src/bootstrapper.cc

Issue 101733002: Fixed global object leak (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: ASSERT that Global is not called after detaching the global object Created 7 years 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 new_to_map->set_prototype(*proto); 332 new_to_map->set_prototype(*proto);
333 object->set_map(*new_to_map); 333 object->set_map(*new_to_map);
334 } 334 }
335 335
336 336
337 void Bootstrapper::DetachGlobal(Handle<Context> env) { 337 void Bootstrapper::DetachGlobal(Handle<Context> env) {
338 Factory* factory = env->GetIsolate()->factory(); 338 Factory* factory = env->GetIsolate()->factory();
339 Handle<JSGlobalProxy> global_proxy(JSGlobalProxy::cast(env->global_proxy())); 339 Handle<JSGlobalProxy> global_proxy(JSGlobalProxy::cast(env->global_proxy()));
340 global_proxy->set_native_context(*factory->null_value()); 340 global_proxy->set_native_context(*factory->null_value());
341 SetObjectPrototype(global_proxy, factory->null_value()); 341 SetObjectPrototype(global_proxy, factory->null_value());
342 env->set_global_proxy(env->global_object());
343 env->global_object()->set_global_receiver(env->global_object());
344 } 342 }
345 343
346 344
347 void Bootstrapper::ReattachGlobal(Handle<Context> env,
348 Handle<JSGlobalProxy> global_proxy) {
349 env->global_object()->set_global_receiver(*global_proxy);
350 env->set_global_proxy(*global_proxy);
351 SetObjectPrototype(global_proxy, Handle<JSObject>(env->global_object()));
352 global_proxy->set_native_context(*env);
353 }
354
355
356 static Handle<JSFunction> InstallFunction(Handle<JSObject> target, 345 static Handle<JSFunction> InstallFunction(Handle<JSObject> target,
357 const char* name, 346 const char* name,
358 InstanceType type, 347 InstanceType type,
359 int instance_size, 348 int instance_size,
360 Handle<JSObject> prototype, 349 Handle<JSObject> prototype,
361 Builtins::Name call, 350 Builtins::Name call,
362 bool install_initial_map, 351 bool install_initial_map,
363 bool set_instance_class_name) { 352 bool set_instance_class_name) {
364 Isolate* isolate = target->GetIsolate(); 353 Isolate* isolate = target->GetIsolate();
365 Factory* factory = isolate->factory(); 354 Factory* factory = isolate->factory();
(...skipping 2335 matching lines...) Expand 10 before | Expand all | Expand 10 after
2701 return from + sizeof(NestingCounterType); 2690 return from + sizeof(NestingCounterType);
2702 } 2691 }
2703 2692
2704 2693
2705 // Called when the top-level V8 mutex is destroyed. 2694 // Called when the top-level V8 mutex is destroyed.
2706 void Bootstrapper::FreeThreadResources() { 2695 void Bootstrapper::FreeThreadResources() {
2707 ASSERT(!IsActive()); 2696 ASSERT(!IsActive());
2708 } 2697 }
2709 2698
2710 } } // namespace v8::internal 2699 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/bootstrapper.h ('k') | src/objects.h » ('j') | test/cctest/test-object-observe.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698