| Index: src/mark-compact.h
|
| diff --git a/src/mark-compact.h b/src/mark-compact.h
|
| index 1d175825df4e0ca4aca4437fe3cd6a2d004443cc..7ab83c41e56a0f392ca68bf5b8ea1ec4507ec652 100644
|
| --- a/src/mark-compact.h
|
| +++ b/src/mark-compact.h
|
| @@ -420,16 +420,22 @@ class CodeFlusher {
|
| shared_function_info_candidates_head_(NULL) {}
|
|
|
| void AddCandidate(SharedFunctionInfo* shared_info) {
|
| - SetNextCandidate(shared_info, shared_function_info_candidates_head_);
|
| - shared_function_info_candidates_head_ = shared_info;
|
| + if (GetNextCandidate(shared_info) == NULL) {
|
| + SetNextCandidate(shared_info, shared_function_info_candidates_head_);
|
| + shared_function_info_candidates_head_ = shared_info;
|
| + }
|
| }
|
|
|
| void AddCandidate(JSFunction* function) {
|
| ASSERT(function->code() == function->shared()->code());
|
| - SetNextCandidate(function, jsfunction_candidates_head_);
|
| - jsfunction_candidates_head_ = function;
|
| + if (GetNextCandidate(function)->IsUndefined()) {
|
| + SetNextCandidate(function, jsfunction_candidates_head_);
|
| + jsfunction_candidates_head_ = function;
|
| + }
|
| }
|
|
|
| + void EvictCandidate(JSFunction* function);
|
| +
|
| void ProcessCandidates() {
|
| ProcessSharedFunctionInfoCandidates();
|
| ProcessJSFunctionCandidates();
|
| @@ -439,30 +445,24 @@ class CodeFlusher {
|
| void ProcessJSFunctionCandidates();
|
| void ProcessSharedFunctionInfoCandidates();
|
|
|
| - static JSFunction** GetNextCandidateField(JSFunction* candidate) {
|
| - return reinterpret_cast<JSFunction**>(
|
| - candidate->address() + JSFunction::kCodeEntryOffset);
|
| - }
|
| -
|
| static JSFunction* GetNextCandidate(JSFunction* candidate) {
|
| - return *GetNextCandidateField(candidate);
|
| + Object* next_candidate = candidate->next_function_link();
|
| + return reinterpret_cast<JSFunction*>(next_candidate);
|
| }
|
|
|
| static void SetNextCandidate(JSFunction* candidate,
|
| JSFunction* next_candidate) {
|
| - *GetNextCandidateField(candidate) = next_candidate;
|
| + candidate->set_next_function_link(next_candidate);
|
| }
|
|
|
| - static SharedFunctionInfo** GetNextCandidateField(
|
| - SharedFunctionInfo* candidate) {
|
| - Code* code = candidate->code();
|
| - return reinterpret_cast<SharedFunctionInfo**>(
|
| - code->address() + Code::kGCMetadataOffset);
|
| + static void ClearNextCandidate(JSFunction* candidate, Object* undefined) {
|
| + ASSERT(undefined->IsUndefined());
|
| + candidate->set_next_function_link(undefined, SKIP_WRITE_BARRIER);
|
| }
|
|
|
| static SharedFunctionInfo* GetNextCandidate(SharedFunctionInfo* candidate) {
|
| - return reinterpret_cast<SharedFunctionInfo*>(
|
| - candidate->code()->gc_metadata());
|
| + Object* next_candidate = candidate->code()->gc_metadata();
|
| + return reinterpret_cast<SharedFunctionInfo*>(next_candidate);
|
| }
|
|
|
| static void SetNextCandidate(SharedFunctionInfo* candidate,
|
| @@ -470,6 +470,10 @@ class CodeFlusher {
|
| candidate->code()->set_gc_metadata(next_candidate);
|
| }
|
|
|
| + static void ClearNextCandidate(SharedFunctionInfo* candidate) {
|
| + candidate->code()->set_gc_metadata(NULL, SKIP_WRITE_BARRIER);
|
| + }
|
| +
|
| Isolate* isolate_;
|
| JSFunction* jsfunction_candidates_head_;
|
| SharedFunctionInfo* shared_function_info_candidates_head_;
|
|
|