| 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 5409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5420 ASSERT(!GetHeap()->InNewSpace(value)); | 5420 ASSERT(!GetHeap()->InNewSpace(value)); |
| 5421 Address entry = value->entry(); | 5421 Address entry = value->entry(); |
| 5422 WRITE_INTPTR_FIELD(this, kCodeEntryOffset, reinterpret_cast<intptr_t>(entry)); | 5422 WRITE_INTPTR_FIELD(this, kCodeEntryOffset, reinterpret_cast<intptr_t>(entry)); |
| 5423 } | 5423 } |
| 5424 | 5424 |
| 5425 | 5425 |
| 5426 void JSFunction::ReplaceCode(Code* code) { | 5426 void JSFunction::ReplaceCode(Code* code) { |
| 5427 bool was_optimized = IsOptimized(); | 5427 bool was_optimized = IsOptimized(); |
| 5428 bool is_optimized = code->kind() == Code::OPTIMIZED_FUNCTION; | 5428 bool is_optimized = code->kind() == Code::OPTIMIZED_FUNCTION; |
| 5429 | 5429 |
| 5430 if (was_optimized && is_optimized) { | 5430 if (!is_optimized) { |
| 5431 shared()->EvictFromOptimizedCodeMap( | 5431 shared()->EvictFromOptimizedCodeMap(context()->native_context(), |
| 5432 this->code(), "Replacing with another optimized code"); | 5432 "Removing optimized code"); |
| 5433 } | 5433 } |
| 5434 | 5434 |
| 5435 set_code(code); | 5435 set_code(code); |
| 5436 | 5436 |
| 5437 // Add/remove the function from the list of optimized functions for this | 5437 // Add/remove the function from the list of optimized functions for this |
| 5438 // context based on the state change. | 5438 // context based on the state change. |
| 5439 if (!was_optimized && is_optimized) { | 5439 if (!was_optimized && is_optimized) { |
| 5440 context()->native_context()->AddOptimizedFunction(this); | 5440 context()->native_context()->AddOptimizedFunction(this); |
| 5441 } | 5441 } |
| 5442 if (was_optimized && !is_optimized) { | 5442 if (was_optimized && !is_optimized) { |
| (...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6753 #undef READ_UINT32_FIELD | 6753 #undef READ_UINT32_FIELD |
| 6754 #undef WRITE_UINT32_FIELD | 6754 #undef WRITE_UINT32_FIELD |
| 6755 #undef READ_SHORT_FIELD | 6755 #undef READ_SHORT_FIELD |
| 6756 #undef WRITE_SHORT_FIELD | 6756 #undef WRITE_SHORT_FIELD |
| 6757 #undef READ_BYTE_FIELD | 6757 #undef READ_BYTE_FIELD |
| 6758 #undef WRITE_BYTE_FIELD | 6758 #undef WRITE_BYTE_FIELD |
| 6759 | 6759 |
| 6760 } } // namespace v8::internal | 6760 } } // namespace v8::internal |
| 6761 | 6761 |
| 6762 #endif // V8_OBJECTS_INL_H_ | 6762 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |