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 4358 matching lines...) Loading... |
4369 return reinterpret_cast<Code*>(READ_FIELD(this, kCodeOffset)); | 4369 return reinterpret_cast<Code*>(READ_FIELD(this, kCodeOffset)); |
4370 } | 4370 } |
4371 | 4371 |
4372 | 4372 |
4373 void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) { | 4373 void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) { |
4374 WRITE_FIELD(this, kCodeOffset, value); | 4374 WRITE_FIELD(this, kCodeOffset, value); |
4375 CONDITIONAL_WRITE_BARRIER(value->GetHeap(), this, kCodeOffset, value, mode); | 4375 CONDITIONAL_WRITE_BARRIER(value->GetHeap(), this, kCodeOffset, value, mode); |
4376 } | 4376 } |
4377 | 4377 |
4378 | 4378 |
| 4379 void SharedFunctionInfo::ReplaceCode(Code* value) { |
| 4380 // If the GC metadata field is already used then the function was |
| 4381 // enqueued as a code flushing candidate and we remove it now. |
| 4382 if (code()->gc_metadata() != NULL) { |
| 4383 CodeFlusher* flusher = GetHeap()->mark_compact_collector()->code_flusher(); |
| 4384 flusher->EvictCandidate(this); |
| 4385 } |
| 4386 |
| 4387 ASSERT(code()->gc_metadata() == NULL && value->gc_metadata() == NULL); |
| 4388 set_code(value); |
| 4389 } |
| 4390 |
| 4391 |
4379 ScopeInfo* SharedFunctionInfo::scope_info() { | 4392 ScopeInfo* SharedFunctionInfo::scope_info() { |
4380 return reinterpret_cast<ScopeInfo*>(READ_FIELD(this, kScopeInfoOffset)); | 4393 return reinterpret_cast<ScopeInfo*>(READ_FIELD(this, kScopeInfoOffset)); |
4381 } | 4394 } |
4382 | 4395 |
4383 | 4396 |
4384 void SharedFunctionInfo::set_scope_info(ScopeInfo* value, | 4397 void SharedFunctionInfo::set_scope_info(ScopeInfo* value, |
4385 WriteBarrierMode mode) { | 4398 WriteBarrierMode mode) { |
4386 WRITE_FIELD(this, kScopeInfoOffset, reinterpret_cast<Object*>(value)); | 4399 WRITE_FIELD(this, kScopeInfoOffset, reinterpret_cast<Object*>(value)); |
4387 CONDITIONAL_WRITE_BARRIER(GetHeap(), | 4400 CONDITIONAL_WRITE_BARRIER(GetHeap(), |
4388 this, | 4401 this, |
(...skipping 1394 matching lines...) Loading... |
5783 #undef WRITE_UINT32_FIELD | 5796 #undef WRITE_UINT32_FIELD |
5784 #undef READ_SHORT_FIELD | 5797 #undef READ_SHORT_FIELD |
5785 #undef WRITE_SHORT_FIELD | 5798 #undef WRITE_SHORT_FIELD |
5786 #undef READ_BYTE_FIELD | 5799 #undef READ_BYTE_FIELD |
5787 #undef WRITE_BYTE_FIELD | 5800 #undef WRITE_BYTE_FIELD |
5788 | 5801 |
5789 | 5802 |
5790 } } // namespace v8::internal | 5803 } } // namespace v8::internal |
5791 | 5804 |
5792 #endif // V8_OBJECTS_INL_H_ | 5805 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |