| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 GenerateCode(&masm); | 131 GenerateCode(&masm); |
| 132 | 132 |
| 133 // Create the code object. | 133 // Create the code object. |
| 134 CodeDesc desc; | 134 CodeDesc desc; |
| 135 masm.GetCode(&desc); | 135 masm.GetCode(&desc); |
| 136 | 136 |
| 137 // Try to copy the generated code into a heap object. | 137 // Try to copy the generated code into a heap object. |
| 138 Code::Flags flags = Code::ComputeFlags( | 138 Code::Flags flags = Code::ComputeFlags( |
| 139 static_cast<Code::Kind>(GetCodeKind()), | 139 static_cast<Code::Kind>(GetCodeKind()), |
| 140 InLoop(), | 140 InLoop(), |
| 141 Object* new_object; |
| 142 { TryAllocation t = Heap::CreateCode(desc, flags, masm.CodeObject()); |
| 143 if (!t->ToObject(&new_object)) return t; |
| 144 } |
| 141 GetICState()); | 145 GetICState()); |
| 142 Object* new_object = Heap::CreateCode(desc, flags, masm.CodeObject()); | |
| 143 if (new_object->IsFailure()) return new_object; | |
| 144 code = Code::cast(new_object); | 146 code = Code::cast(new_object); |
| 145 RecordCodeGeneration(code, &masm); | 147 RecordCodeGeneration(code, &masm); |
| 146 | 148 |
| 147 if (has_custom_cache()) { | 149 if (has_custom_cache()) { |
| 148 SetCustomCache(code); | 150 SetCustomCache(code); |
| 149 } else { | 151 } else { |
| 150 // Try to update the code cache but do not fail if unable. | 152 // Try to update the code cache but do not fail if unable. |
| 151 new_object = Heap::code_stubs()->AtNumberPut(GetKey(), code); | 153 new_object = Heap::code_stubs()->AtNumberPut(GetKey(), code); |
| 152 if (!new_object->IsFailure()) { | 154 if (!new_object->IsFailure()) { |
| 153 Heap::public_set_code_stubs(NumberDictionary::cast(new_object)); | 155 Heap::public_set_code_stubs(NumberDictionary::cast(new_object)); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 168 default: | 170 default: |
| 169 if (!allow_unknown_keys) { | 171 if (!allow_unknown_keys) { |
| 170 UNREACHABLE(); | 172 UNREACHABLE(); |
| 171 } | 173 } |
| 172 return NULL; | 174 return NULL; |
| 173 } | 175 } |
| 174 } | 176 } |
| 175 | 177 |
| 176 | 178 |
| 177 } } // namespace v8::internal | 179 } } // namespace v8::internal |
| OLD | NEW |