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

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: spacing 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 new_to_map->set_prototype(*proto); 334 new_to_map->set_prototype(*proto);
335 object->set_map(*new_to_map); 335 object->set_map(*new_to_map);
336 } 336 }
337 337
338 338
339 void Bootstrapper::DetachGlobal(Handle<Context> env) { 339 void Bootstrapper::DetachGlobal(Handle<Context> env) {
340 Factory* factory = env->GetIsolate()->factory(); 340 Factory* factory = env->GetIsolate()->factory();
341 Handle<JSGlobalProxy> global_proxy(JSGlobalProxy::cast(env->global_proxy())); 341 Handle<JSGlobalProxy> global_proxy(JSGlobalProxy::cast(env->global_proxy()));
342 global_proxy->set_native_context(*factory->null_value()); 342 global_proxy->set_native_context(*factory->null_value());
343 SetObjectPrototype(global_proxy, factory->null_value()); 343 SetObjectPrototype(global_proxy, factory->null_value());
344 env->set_global_proxy(env->global_object());
345 env->global_object()->set_global_receiver(env->global_object());
346 } 344 }
347 345
348 346
349 void Bootstrapper::ReattachGlobal(Handle<Context> env,
350 Handle<JSGlobalProxy> global_proxy) {
351 env->global_object()->set_global_receiver(*global_proxy);
352 env->set_global_proxy(*global_proxy);
353 SetObjectPrototype(global_proxy, Handle<JSObject>(env->global_object()));
354 global_proxy->set_native_context(*env);
355 }
356
357
358 static Handle<JSFunction> InstallFunction(Handle<JSObject> target, 347 static Handle<JSFunction> InstallFunction(Handle<JSObject> target,
359 const char* name, 348 const char* name,
360 InstanceType type, 349 InstanceType type,
361 int instance_size, 350 int instance_size,
362 Handle<JSObject> prototype, 351 Handle<JSObject> prototype,
363 Builtins::Name call, 352 Builtins::Name call,
364 bool install_initial_map, 353 bool install_initial_map,
365 bool set_instance_class_name) { 354 bool set_instance_class_name) {
366 Isolate* isolate = target->GetIsolate(); 355 Isolate* isolate = target->GetIsolate();
367 Factory* factory = isolate->factory(); 356 Factory* factory = isolate->factory();
(...skipping 2338 matching lines...) Expand 10 before | Expand all | Expand 10 after
2706 return from + sizeof(NestingCounterType); 2695 return from + sizeof(NestingCounterType);
2707 } 2696 }
2708 2697
2709 2698
2710 // Called when the top-level V8 mutex is destroyed. 2699 // Called when the top-level V8 mutex is destroyed.
2711 void Bootstrapper::FreeThreadResources() { 2700 void Bootstrapper::FreeThreadResources() {
2712 ASSERT(!IsActive()); 2701 ASSERT(!IsActive());
2713 } 2702 }
2714 2703
2715 } } // namespace v8::internal 2704 } } // namespace v8::internal
OLDNEW
« src/api.cc ('K') | « src/bootstrapper.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698