| OLD | NEW |
| 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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 Factory* factory = object->GetIsolate()->factory(); | 320 Factory* factory = object->GetIsolate()->factory(); |
| 321 Handle<Map> old_to_map = Handle<Map>(object->map()); | 321 Handle<Map> old_to_map = Handle<Map>(object->map()); |
| 322 Handle<Map> new_to_map = factory->CopyMap(old_to_map); | 322 Handle<Map> new_to_map = factory->CopyMap(old_to_map); |
| 323 new_to_map->set_prototype(*proto); | 323 new_to_map->set_prototype(*proto); |
| 324 object->set_map(*new_to_map); | 324 object->set_map(*new_to_map); |
| 325 } | 325 } |
| 326 | 326 |
| 327 | 327 |
| 328 void Bootstrapper::DetachGlobal(Handle<Context> env) { | 328 void Bootstrapper::DetachGlobal(Handle<Context> env) { |
| 329 Factory* factory = env->GetIsolate()->factory(); | 329 Factory* factory = env->GetIsolate()->factory(); |
| 330 JSGlobalProxy::cast(env->global_proxy())-> | 330 JSGlobalProxy::cast(env->global_proxy())->set_context(*factory->null_value()); |
| 331 set_native_context(*factory->null_value()); | |
| 332 SetObjectPrototype(Handle<JSObject>(env->global_proxy()), | 331 SetObjectPrototype(Handle<JSObject>(env->global_proxy()), |
| 333 factory->null_value()); | 332 factory->null_value()); |
| 334 env->set_global_proxy(env->global_object()); | 333 env->set_global_proxy(env->global_object()); |
| 335 env->global_object()->set_global_receiver(env->global_object()); | 334 env->global_object()->set_global_receiver(env->global_object()); |
| 336 } | 335 } |
| 337 | 336 |
| 338 | 337 |
| 339 void Bootstrapper::ReattachGlobal(Handle<Context> env, | 338 void Bootstrapper::ReattachGlobal(Handle<Context> env, |
| 340 Handle<Object> global_object) { | 339 Handle<Object> global_object) { |
| 341 ASSERT(global_object->IsJSGlobalProxy()); | 340 ASSERT(global_object->IsJSGlobalProxy()); |
| 342 Handle<JSGlobalProxy> global = Handle<JSGlobalProxy>::cast(global_object); | 341 Handle<JSGlobalProxy> global = Handle<JSGlobalProxy>::cast(global_object); |
| 343 env->global_object()->set_global_receiver(*global); | 342 env->global_object()->set_global_receiver(*global); |
| 344 env->set_global_proxy(*global); | 343 env->set_global_proxy(*global); |
| 345 SetObjectPrototype(global, Handle<JSObject>(env->global_object())); | 344 SetObjectPrototype(global, Handle<JSObject>(env->global_object())); |
| 346 global->set_native_context(*env); | 345 global->set_context(*env); |
| 347 } | 346 } |
| 348 | 347 |
| 349 | 348 |
| 350 static Handle<JSFunction> InstallFunction(Handle<JSObject> target, | 349 static Handle<JSFunction> InstallFunction(Handle<JSObject> target, |
| 351 const char* name, | 350 const char* name, |
| 352 InstanceType type, | 351 InstanceType type, |
| 353 int instance_size, | 352 int instance_size, |
| 354 Handle<JSObject> prototype, | 353 Handle<JSObject> prototype, |
| 355 Builtins::Name call, | 354 Builtins::Name call, |
| 356 bool is_ecma_native) { | 355 bool is_ecma_native) { |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 factory()->NewJSObject(global_proxy_function, TENURED)); | 790 factory()->NewJSObject(global_proxy_function, TENURED)); |
| 792 } | 791 } |
| 793 } | 792 } |
| 794 | 793 |
| 795 | 794 |
| 796 void Genesis::HookUpGlobalProxy(Handle<GlobalObject> inner_global, | 795 void Genesis::HookUpGlobalProxy(Handle<GlobalObject> inner_global, |
| 797 Handle<JSGlobalProxy> global_proxy) { | 796 Handle<JSGlobalProxy> global_proxy) { |
| 798 // Set the native context for the global object. | 797 // Set the native context for the global object. |
| 799 inner_global->set_native_context(*native_context()); | 798 inner_global->set_native_context(*native_context()); |
| 800 inner_global->set_global_receiver(*global_proxy); | 799 inner_global->set_global_receiver(*global_proxy); |
| 801 global_proxy->set_native_context(*native_context()); | 800 global_proxy->set_context(*native_context()); |
| 802 native_context()->set_global_proxy(*global_proxy); | 801 native_context()->set_global_proxy(*global_proxy); |
| 803 } | 802 } |
| 804 | 803 |
| 805 | 804 |
| 806 void Genesis::HookUpInnerGlobal(Handle<GlobalObject> inner_global) { | 805 void Genesis::HookUpInnerGlobal(Handle<GlobalObject> inner_global) { |
| 807 Handle<GlobalObject> inner_global_from_snapshot( | 806 Handle<GlobalObject> inner_global_from_snapshot( |
| 808 GlobalObject::cast(native_context_->extension())); | 807 GlobalObject::cast(native_context_->extension())); |
| 809 Handle<JSBuiltinsObject> builtins_global(native_context_->builtins()); | 808 Handle<JSBuiltinsObject> builtins_global(native_context_->builtins()); |
| 810 native_context_->set_extension(*inner_global); | 809 native_context_->set_extension(*inner_global); |
| 811 native_context_->set_global_object(*inner_global); | 810 native_context_->set_global_object(*inner_global); |
| (...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2394 return from + sizeof(NestingCounterType); | 2393 return from + sizeof(NestingCounterType); |
| 2395 } | 2394 } |
| 2396 | 2395 |
| 2397 | 2396 |
| 2398 // Called when the top-level V8 mutex is destroyed. | 2397 // Called when the top-level V8 mutex is destroyed. |
| 2399 void Bootstrapper::FreeThreadResources() { | 2398 void Bootstrapper::FreeThreadResources() { |
| 2400 ASSERT(!IsActive()); | 2399 ASSERT(!IsActive()); |
| 2401 } | 2400 } |
| 2402 | 2401 |
| 2403 } } // namespace v8::internal | 2402 } } // namespace v8::internal |
| OLD | NEW |