| 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 5094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5105 ASSERT(!GetHeap()->InNewSpace(value)); | 5105 ASSERT(!GetHeap()->InNewSpace(value)); |
| 5106 Address entry = value->entry(); | 5106 Address entry = value->entry(); |
| 5107 WRITE_INTPTR_FIELD(this, kCodeEntryOffset, reinterpret_cast<intptr_t>(entry)); | 5107 WRITE_INTPTR_FIELD(this, kCodeEntryOffset, reinterpret_cast<intptr_t>(entry)); |
| 5108 } | 5108 } |
| 5109 | 5109 |
| 5110 | 5110 |
| 5111 void JSFunction::ReplaceCode(Code* code) { | 5111 void JSFunction::ReplaceCode(Code* code) { |
| 5112 bool was_optimized = IsOptimized(); | 5112 bool was_optimized = IsOptimized(); |
| 5113 bool is_optimized = code->kind() == Code::OPTIMIZED_FUNCTION; | 5113 bool is_optimized = code->kind() == Code::OPTIMIZED_FUNCTION; |
| 5114 | 5114 |
| 5115 if (was_optimized && is_optimized) { |
| 5116 shared()->EvictFromOptimizedCodeMap( |
| 5117 this->code(), "Replacing with another optimized code"); |
| 5118 } |
| 5119 |
| 5115 set_code(code); | 5120 set_code(code); |
| 5116 | 5121 |
| 5117 // Add/remove the function from the list of optimized functions for this | 5122 // Add/remove the function from the list of optimized functions for this |
| 5118 // context based on the state change. | 5123 // context based on the state change. |
| 5119 if (!was_optimized && is_optimized) { | 5124 if (!was_optimized && is_optimized) { |
| 5120 context()->native_context()->AddOptimizedFunction(this); | 5125 context()->native_context()->AddOptimizedFunction(this); |
| 5121 } | 5126 } |
| 5122 if (was_optimized && !is_optimized) { | 5127 if (was_optimized && !is_optimized) { |
| 5123 // TODO(titzer): linear in the number of optimized functions; fix! | 5128 // TODO(titzer): linear in the number of optimized functions; fix! |
| 5124 context()->native_context()->RemoveOptimizedFunction(this); | 5129 context()->native_context()->RemoveOptimizedFunction(this); |
| (...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6458 #undef WRITE_UINT32_FIELD | 6463 #undef WRITE_UINT32_FIELD |
| 6459 #undef READ_SHORT_FIELD | 6464 #undef READ_SHORT_FIELD |
| 6460 #undef WRITE_SHORT_FIELD | 6465 #undef WRITE_SHORT_FIELD |
| 6461 #undef READ_BYTE_FIELD | 6466 #undef READ_BYTE_FIELD |
| 6462 #undef WRITE_BYTE_FIELD | 6467 #undef WRITE_BYTE_FIELD |
| 6463 | 6468 |
| 6464 | 6469 |
| 6465 } } // namespace v8::internal | 6470 } } // namespace v8::internal |
| 6466 | 6471 |
| 6467 #endif // V8_OBJECTS_INL_H_ | 6472 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |