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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 // Create the code object. | 96 // Create the code object. |
97 CodeDesc desc; | 97 CodeDesc desc; |
98 masm.GetCode(&desc); | 98 masm.GetCode(&desc); |
99 | 99 |
100 // Copy the generated code into a heap object. | 100 // Copy the generated code into a heap object. |
101 Code::Flags flags = Code::ComputeFlags( | 101 Code::Flags flags = Code::ComputeFlags( |
102 static_cast<Code::Kind>(GetCodeKind()), | 102 static_cast<Code::Kind>(GetCodeKind()), |
103 InLoop(), | 103 InLoop(), |
104 GetICState()); | 104 GetICState()); |
105 Handle<Code> new_object = | 105 Handle<Code> new_object = Factory::NewCode(desc, flags, masm.CodeObject()); |
106 Factory::NewCode(desc, NULL, flags, masm.CodeObject()); | |
107 RecordCodeGeneration(*new_object, &masm); | 106 RecordCodeGeneration(*new_object, &masm); |
108 | 107 |
109 if (has_custom_cache()) { | 108 if (has_custom_cache()) { |
110 SetCustomCache(*new_object); | 109 SetCustomCache(*new_object); |
111 } else { | 110 } else { |
112 // Update the dictionary and the root in Heap. | 111 // Update the dictionary and the root in Heap. |
113 Handle<NumberDictionary> dict = | 112 Handle<NumberDictionary> dict = |
114 Factory::DictionaryAtNumberPut( | 113 Factory::DictionaryAtNumberPut( |
115 Handle<NumberDictionary>(Heap::code_stubs()), | 114 Handle<NumberDictionary>(Heap::code_stubs()), |
116 GetKey(), | 115 GetKey(), |
(...skipping 16 matching lines...) Expand all Loading... |
133 | 132 |
134 // Create the code object. | 133 // Create the code object. |
135 CodeDesc desc; | 134 CodeDesc desc; |
136 masm.GetCode(&desc); | 135 masm.GetCode(&desc); |
137 | 136 |
138 // Try to copy the generated code into a heap object. | 137 // Try to copy the generated code into a heap object. |
139 Code::Flags flags = Code::ComputeFlags( | 138 Code::Flags flags = Code::ComputeFlags( |
140 static_cast<Code::Kind>(GetCodeKind()), | 139 static_cast<Code::Kind>(GetCodeKind()), |
141 InLoop(), | 140 InLoop(), |
142 GetICState()); | 141 GetICState()); |
143 Object* new_object = | 142 Object* new_object = Heap::CreateCode(desc, flags, masm.CodeObject()); |
144 Heap::CreateCode(desc, NULL, flags, masm.CodeObject()); | |
145 if (new_object->IsFailure()) return new_object; | 143 if (new_object->IsFailure()) return new_object; |
146 code = Code::cast(new_object); | 144 code = Code::cast(new_object); |
147 RecordCodeGeneration(code, &masm); | 145 RecordCodeGeneration(code, &masm); |
148 | 146 |
149 if (has_custom_cache()) { | 147 if (has_custom_cache()) { |
150 SetCustomCache(code); | 148 SetCustomCache(code); |
151 } else { | 149 } else { |
152 // Try to update the code cache but do not fail if unable. | 150 // Try to update the code cache but do not fail if unable. |
153 new_object = Heap::code_stubs()->AtNumberPut(GetKey(), code); | 151 new_object = Heap::code_stubs()->AtNumberPut(GetKey(), code); |
154 if (!new_object->IsFailure()) { | 152 if (!new_object->IsFailure()) { |
(...skipping 15 matching lines...) Expand all Loading... |
170 default: | 168 default: |
171 if (!allow_unknown_keys) { | 169 if (!allow_unknown_keys) { |
172 UNREACHABLE(); | 170 UNREACHABLE(); |
173 } | 171 } |
174 return NULL; | 172 return NULL; |
175 } | 173 } |
176 } | 174 } |
177 | 175 |
178 | 176 |
179 } } // namespace v8::internal | 177 } } // namespace v8::internal |
OLD | NEW |