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 2557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2568 // Before creating the roots we must save the context and restore it | 2568 // Before creating the roots we must save the context and restore it |
2569 // on all function exits. | 2569 // on all function exits. |
2570 SaveContext saved_context(isolate); | 2570 SaveContext saved_context(isolate); |
2571 | 2571 |
2572 // During genesis, the boilerplate for stack overflow won't work until the | 2572 // During genesis, the boilerplate for stack overflow won't work until the |
2573 // environment has been at least partially initialized. Add a stack check | 2573 // environment has been at least partially initialized. Add a stack check |
2574 // before entering JS code to catch overflow early. | 2574 // before entering JS code to catch overflow early. |
2575 StackLimitCheck check(isolate); | 2575 StackLimitCheck check(isolate); |
2576 if (check.HasOverflowed()) return; | 2576 if (check.HasOverflowed()) return; |
2577 | 2577 |
2578 native_context_ = Snapshot::NewContextFromSnapshot(); | 2578 // We can only de-serialize a context if the isolate was initialized from |
| 2579 // a snapshot. Otherwise we have to build the context from scratch. |
| 2580 if (isolate->initialized_from_snapshot()) { |
| 2581 native_context_ = Snapshot::NewContextFromSnapshot(); |
| 2582 } else { |
| 2583 native_context_ = Handle<Context>(); |
| 2584 } |
| 2585 |
2579 if (!native_context().is_null()) { | 2586 if (!native_context().is_null()) { |
2580 AddToWeakNativeContextList(*native_context()); | 2587 AddToWeakNativeContextList(*native_context()); |
2581 isolate->set_context(*native_context()); | 2588 isolate->set_context(*native_context()); |
2582 isolate->counters()->contexts_created_by_snapshot()->Increment(); | 2589 isolate->counters()->contexts_created_by_snapshot()->Increment(); |
2583 Handle<GlobalObject> inner_global; | 2590 Handle<GlobalObject> inner_global; |
2584 Handle<JSGlobalProxy> global_proxy = | 2591 Handle<JSGlobalProxy> global_proxy = |
2585 CreateNewGlobals(global_template, | 2592 CreateNewGlobals(global_template, |
2586 global_object, | 2593 global_object, |
2587 &inner_global); | 2594 &inner_global); |
2588 | 2595 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2640 return from + sizeof(NestingCounterType); | 2647 return from + sizeof(NestingCounterType); |
2641 } | 2648 } |
2642 | 2649 |
2643 | 2650 |
2644 // Called when the top-level V8 mutex is destroyed. | 2651 // Called when the top-level V8 mutex is destroyed. |
2645 void Bootstrapper::FreeThreadResources() { | 2652 void Bootstrapper::FreeThreadResources() { |
2646 ASSERT(!IsActive()); | 2653 ASSERT(!IsActive()); |
2647 } | 2654 } |
2648 | 2655 |
2649 } } // namespace v8::internal | 2656 } } // namespace v8::internal |
OLD | NEW |