Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(509)

Side by Side Diff: src/mark-compact.h

Issue 11140025: Enable incremental code flushing. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Prevent recording a flushing candidate twice. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap.cc ('k') | src/mark-compact.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 SetNextCandidate(shared_info, shared_function_info_candidates_head_); 423 if (GetNextCandidate(shared_info) == NULL) {
424 shared_function_info_candidates_head_ = shared_info; 424 SetNextCandidate(shared_info, shared_function_info_candidates_head_);
425 shared_function_info_candidates_head_ = shared_info;
426 }
425 } 427 }
426 428
427 void AddCandidate(JSFunction* function) { 429 void AddCandidate(JSFunction* function) {
428 ASSERT(function->code() == function->shared()->code()); 430 ASSERT(function->code() == function->shared()->code());
429 SetNextCandidate(function, jsfunction_candidates_head_); 431 if (GetNextCandidate(function)->IsUndefined()) {
430 jsfunction_candidates_head_ = function; 432 SetNextCandidate(function, jsfunction_candidates_head_);
433 jsfunction_candidates_head_ = function;
434 }
431 } 435 }
432 436
437 void EvictCandidate(JSFunction* function);
438
433 void ProcessCandidates() { 439 void ProcessCandidates() {
434 ProcessSharedFunctionInfoCandidates(); 440 ProcessSharedFunctionInfoCandidates();
435 ProcessJSFunctionCandidates(); 441 ProcessJSFunctionCandidates();
436 } 442 }
437 443
438 private: 444 private:
439 void ProcessJSFunctionCandidates(); 445 void ProcessJSFunctionCandidates();
440 void ProcessSharedFunctionInfoCandidates(); 446 void ProcessSharedFunctionInfoCandidates();
441 447
442 static JSFunction** GetNextCandidateField(JSFunction* candidate) {
443 return reinterpret_cast<JSFunction**>(
444 candidate->address() + JSFunction::kCodeEntryOffset);
445 }
446
447 static JSFunction* GetNextCandidate(JSFunction* candidate) { 448 static JSFunction* GetNextCandidate(JSFunction* candidate) {
448 return *GetNextCandidateField(candidate); 449 Object* next_candidate = candidate->next_function_link();
450 return reinterpret_cast<JSFunction*>(next_candidate);
449 } 451 }
450 452
451 static void SetNextCandidate(JSFunction* candidate, 453 static void SetNextCandidate(JSFunction* candidate,
452 JSFunction* next_candidate) { 454 JSFunction* next_candidate) {
453 *GetNextCandidateField(candidate) = next_candidate; 455 candidate->set_next_function_link(next_candidate);
454 } 456 }
455 457
456 static SharedFunctionInfo** GetNextCandidateField( 458 static void ClearNextCandidate(JSFunction* candidate, Object* undefined) {
457 SharedFunctionInfo* candidate) { 459 ASSERT(undefined->IsUndefined());
458 Code* code = candidate->code(); 460 candidate->set_next_function_link(undefined, SKIP_WRITE_BARRIER);
459 return reinterpret_cast<SharedFunctionInfo**>(
460 code->address() + Code::kGCMetadataOffset);
461 } 461 }
462 462
463 static SharedFunctionInfo* GetNextCandidate(SharedFunctionInfo* candidate) { 463 static SharedFunctionInfo* GetNextCandidate(SharedFunctionInfo* candidate) {
464 return reinterpret_cast<SharedFunctionInfo*>( 464 Object* next_candidate = candidate->code()->gc_metadata();
465 candidate->code()->gc_metadata()); 465 return reinterpret_cast<SharedFunctionInfo*>(next_candidate);
466 } 466 }
467 467
468 static void SetNextCandidate(SharedFunctionInfo* candidate, 468 static void SetNextCandidate(SharedFunctionInfo* candidate,
469 SharedFunctionInfo* next_candidate) { 469 SharedFunctionInfo* next_candidate) {
470 candidate->code()->set_gc_metadata(next_candidate); 470 candidate->code()->set_gc_metadata(next_candidate);
471 } 471 }
472 472
473 static void ClearNextCandidate(SharedFunctionInfo* candidate) {
474 candidate->code()->set_gc_metadata(NULL, SKIP_WRITE_BARRIER);
475 }
476
473 Isolate* isolate_; 477 Isolate* isolate_;
474 JSFunction* jsfunction_candidates_head_; 478 JSFunction* jsfunction_candidates_head_;
475 SharedFunctionInfo* shared_function_info_candidates_head_; 479 SharedFunctionInfo* shared_function_info_candidates_head_;
476 480
477 DISALLOW_COPY_AND_ASSIGN(CodeFlusher); 481 DISALLOW_COPY_AND_ASSIGN(CodeFlusher);
478 }; 482 };
479 483
480 484
481 // Defined in isolate.h. 485 // Defined in isolate.h.
482 class ThreadLocalTop; 486 class ThreadLocalTop;
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 837
834 friend class Heap; 838 friend class Heap;
835 }; 839 };
836 840
837 841
838 const char* AllocationSpaceName(AllocationSpace space); 842 const char* AllocationSpaceName(AllocationSpace space);
839 843
840 } } // namespace v8::internal 844 } } // namespace v8::internal
841 845
842 #endif // V8_MARK_COMPACT_H_ 846 #endif // V8_MARK_COMPACT_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698