| 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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 // optimized or inlined into optimized code, because we might bailout | 413 // optimized or inlined into optimized code, because we might bailout |
| 414 // into the unoptimized code again during deoptimization. | 414 // into the unoptimized code again during deoptimization. |
| 415 class CodeFlusher { | 415 class CodeFlusher { |
| 416 public: | 416 public: |
| 417 explicit CodeFlusher(Isolate* isolate) | 417 explicit CodeFlusher(Isolate* isolate) |
| 418 : isolate_(isolate), | 418 : isolate_(isolate), |
| 419 jsfunction_candidates_head_(NULL), | 419 jsfunction_candidates_head_(NULL), |
| 420 shared_function_info_candidates_head_(NULL) {} | 420 shared_function_info_candidates_head_(NULL) {} |
| 421 | 421 |
| 422 void AddCandidate(SharedFunctionInfo* shared_info) { | 422 void AddCandidate(SharedFunctionInfo* shared_info) { |
| 423 if (GetNextCandidate(shared_info) == NULL) { | 423 SetNextCandidate(shared_info, shared_function_info_candidates_head_); |
| 424 SetNextCandidate(shared_info, shared_function_info_candidates_head_); | 424 shared_function_info_candidates_head_ = shared_info; |
| 425 shared_function_info_candidates_head_ = shared_info; | |
| 426 } | |
| 427 } | 425 } |
| 428 | 426 |
| 429 void AddCandidate(JSFunction* function) { | 427 void AddCandidate(JSFunction* function) { |
| 430 ASSERT(function->code() == function->shared()->code()); | 428 ASSERT(function->code() == function->shared()->code()); |
| 431 if (GetNextCandidate(function)->IsUndefined()) { | 429 ASSERT(function->next_function_link()->IsUndefined()); |
| 432 SetNextCandidate(function, jsfunction_candidates_head_); | 430 SetNextCandidate(function, jsfunction_candidates_head_); |
| 433 jsfunction_candidates_head_ = function; | 431 jsfunction_candidates_head_ = function; |
| 434 } | |
| 435 } | 432 } |
| 436 | 433 |
| 437 void EvictCandidate(JSFunction* function); | |
| 438 | |
| 439 void ProcessCandidates() { | 434 void ProcessCandidates() { |
| 440 ProcessSharedFunctionInfoCandidates(); | 435 ProcessSharedFunctionInfoCandidates(); |
| 441 ProcessJSFunctionCandidates(); | 436 ProcessJSFunctionCandidates(); |
| 442 } | 437 } |
| 443 | 438 |
| 444 void IteratePointersToFromSpace(ObjectVisitor* v); | |
| 445 | |
| 446 private: | 439 private: |
| 447 void ProcessJSFunctionCandidates(); | 440 void ProcessJSFunctionCandidates(); |
| 448 void ProcessSharedFunctionInfoCandidates(); | 441 void ProcessSharedFunctionInfoCandidates(); |
| 449 | 442 |
| 450 static JSFunction** GetNextCandidateSlot(JSFunction* candidate) { | |
| 451 return reinterpret_cast<JSFunction**>( | |
| 452 HeapObject::RawField(candidate, JSFunction::kNextFunctionLinkOffset)); | |
| 453 } | |
| 454 | |
| 455 static JSFunction* GetNextCandidate(JSFunction* candidate) { | 443 static JSFunction* GetNextCandidate(JSFunction* candidate) { |
| 456 Object* next_candidate = candidate->next_function_link(); | 444 Object* next_candidate = candidate->next_function_link(); |
| 457 return reinterpret_cast<JSFunction*>(next_candidate); | 445 return reinterpret_cast<JSFunction*>(next_candidate); |
| 458 } | 446 } |
| 459 | 447 |
| 460 static void SetNextCandidate(JSFunction* candidate, | 448 static void SetNextCandidate(JSFunction* candidate, |
| 461 JSFunction* next_candidate) { | 449 JSFunction* next_candidate) { |
| 462 candidate->set_next_function_link(next_candidate); | 450 candidate->set_next_function_link(next_candidate); |
| 463 } | 451 } |
| 464 | 452 |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 | 832 |
| 845 friend class Heap; | 833 friend class Heap; |
| 846 }; | 834 }; |
| 847 | 835 |
| 848 | 836 |
| 849 const char* AllocationSpaceName(AllocationSpace space); | 837 const char* AllocationSpaceName(AllocationSpace space); |
| 850 | 838 |
| 851 } } // namespace v8::internal | 839 } } // namespace v8::internal |
| 852 | 840 |
| 853 #endif // V8_MARK_COMPACT_H_ | 841 #endif // V8_MARK_COMPACT_H_ |
| OLD | NEW |