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