OLD | NEW |
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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 302 |
303 void Bootstrapper::DetachGlobal(Handle<Context> env) { | 303 void Bootstrapper::DetachGlobal(Handle<Context> env) { |
304 JSGlobalProxy::cast(env->global_proxy())->set_context(*Factory::null_value()); | 304 JSGlobalProxy::cast(env->global_proxy())->set_context(*Factory::null_value()); |
305 SetObjectPrototype(Handle<JSObject>(env->global_proxy()), | 305 SetObjectPrototype(Handle<JSObject>(env->global_proxy()), |
306 Factory::null_value()); | 306 Factory::null_value()); |
307 env->set_global_proxy(env->global()); | 307 env->set_global_proxy(env->global()); |
308 env->global()->set_global_receiver(env->global()); | 308 env->global()->set_global_receiver(env->global()); |
309 } | 309 } |
310 | 310 |
311 | 311 |
| 312 void Bootstrapper::ReattachGlobal(Handle<Context> env, |
| 313 Handle<Object> global_object) { |
| 314 ASSERT(global_object->IsJSGlobalProxy()); |
| 315 Handle<JSGlobalProxy> global = Handle<JSGlobalProxy>::cast(global_object); |
| 316 env->global()->set_global_receiver(*global); |
| 317 env->set_global_proxy(*global); |
| 318 SetObjectPrototype(global, Handle<JSObject>(env->global())); |
| 319 global->set_context(*env); |
| 320 } |
| 321 |
| 322 |
312 static Handle<JSFunction> InstallFunction(Handle<JSObject> target, | 323 static Handle<JSFunction> InstallFunction(Handle<JSObject> target, |
313 const char* name, | 324 const char* name, |
314 InstanceType type, | 325 InstanceType type, |
315 int instance_size, | 326 int instance_size, |
316 Handle<JSObject> prototype, | 327 Handle<JSObject> prototype, |
317 Builtins::Name call, | 328 Builtins::Name call, |
318 bool is_ecma_native) { | 329 bool is_ecma_native) { |
319 Handle<String> symbol = Factory::LookupAsciiSymbol(name); | 330 Handle<String> symbol = Factory::LookupAsciiSymbol(name); |
320 Handle<Code> call_code = Handle<Code>(Builtins::builtin(call)); | 331 Handle<Code> call_code = Handle<Code>(Builtins::builtin(call)); |
321 Handle<JSFunction> function = | 332 Handle<JSFunction> function = |
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 } | 1599 } |
1589 | 1600 |
1590 | 1601 |
1591 // Restore statics that are thread local. | 1602 // Restore statics that are thread local. |
1592 char* BootstrapperActive::RestoreState(char* from) { | 1603 char* BootstrapperActive::RestoreState(char* from) { |
1593 nesting_ = *reinterpret_cast<int*>(from); | 1604 nesting_ = *reinterpret_cast<int*>(from); |
1594 return from + sizeof(nesting_); | 1605 return from + sizeof(nesting_); |
1595 } | 1606 } |
1596 | 1607 |
1597 } } // namespace v8::internal | 1608 } } // namespace v8::internal |
OLD | NEW |