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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 has_been_setup_ = true; | 44 has_been_setup_ = true; |
45 #ifdef DEBUG | 45 #ifdef DEBUG |
46 // The initialization process does not handle memory exhaustion. | 46 // The initialization process does not handle memory exhaustion. |
47 DisallowAllocationFailure disallow_allocation_failure; | 47 DisallowAllocationFailure disallow_allocation_failure; |
48 #endif | 48 #endif |
49 | 49 |
50 // Enable logging before setting up the heap | 50 // Enable logging before setting up the heap |
51 Logger::Setup(); | 51 Logger::Setup(); |
52 if (des) des->GetLog(); | 52 if (des) des->GetLog(); |
53 | 53 |
54 // Setup the CPU support. | |
55 CPU::Setup(); | |
56 | |
57 // Setup the platform OS support. | 54 // Setup the platform OS support. |
58 OS::Setup(); | 55 OS::Setup(); |
59 | 56 |
60 // Setup the object heap | 57 // Setup the object heap |
61 ASSERT(!Heap::HasBeenSetup()); | 58 ASSERT(!Heap::HasBeenSetup()); |
62 if (!Heap::Setup(create_heap_objects)) { | 59 if (!Heap::Setup(create_heap_objects)) { |
63 has_been_setup_ = false; | 60 has_been_setup_ = false; |
64 return false; | 61 return false; |
65 } | 62 } |
66 | 63 |
67 // Initialize other runtime facilities | 64 // Initialize other runtime facilities |
68 Bootstrapper::Initialize(create_heap_objects); | 65 Bootstrapper::Initialize(create_heap_objects); |
69 Builtins::Setup(create_heap_objects); | 66 Builtins::Setup(create_heap_objects); |
70 Top::Initialize(); | 67 Top::Initialize(); |
71 | 68 |
72 if (FLAG_preemption) { | 69 if (FLAG_preemption) { |
73 v8::Locker locker; | 70 v8::Locker locker; |
74 v8::Locker::StartPreemption(100); | 71 v8::Locker::StartPreemption(100); |
75 } | 72 } |
76 | 73 |
77 Debug::Setup(create_heap_objects); | 74 Debug::Setup(create_heap_objects); |
78 StubCache::Initialize(create_heap_objects); | 75 StubCache::Initialize(create_heap_objects); |
79 | 76 |
80 // If we are deserializing, read the state into the now-empty heap. | 77 // If we are deserializing, read the state into the now-empty heap. |
81 if (des != NULL) { | 78 if (des != NULL) { |
82 des->Deserialize(); | 79 des->Deserialize(); |
83 StubCache::Clear(); | 80 StubCache::Clear(); |
84 } | 81 } |
85 | 82 |
83 // Setup the CPU support. Must be done after heap setup and after | |
84 // any deserialization because we have to have the initial heap | |
85 // objects in place for creating the code object used for probin. | |
Mads Ager (chromium)
2009/02/25 14:34:05
probin -> probing.
| |
86 CPU::Setup(); | |
87 | |
86 return true; | 88 return true; |
87 } | 89 } |
88 | 90 |
89 | 91 |
90 void V8::TearDown() { | 92 void V8::TearDown() { |
91 if (HasBeenDisposed()) return; | 93 if (HasBeenDisposed()) return; |
92 if (!HasBeenSetup()) return; | 94 if (!HasBeenSetup()) return; |
93 | 95 |
94 if (FLAG_preemption) { | 96 if (FLAG_preemption) { |
95 v8::Locker locker; | 97 v8::Locker locker; |
96 v8::Locker::StopPreemption(); | 98 v8::Locker::StopPreemption(); |
97 } | 99 } |
98 | 100 |
99 Builtins::TearDown(); | 101 Builtins::TearDown(); |
100 Bootstrapper::TearDown(); | 102 Bootstrapper::TearDown(); |
101 | 103 |
102 Top::TearDown(); | 104 Top::TearDown(); |
103 | 105 |
104 Heap::TearDown(); | 106 Heap::TearDown(); |
105 Logger::TearDown(); | 107 Logger::TearDown(); |
106 | 108 |
107 has_been_setup_ = false; | 109 has_been_setup_ = false; |
108 has_been_disposed_ = true; | 110 has_been_disposed_ = true; |
109 } | 111 } |
110 | 112 |
111 } } // namespace v8::internal | 113 } } // namespace v8::internal |
OLD | NEW |