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

Side by Side Diff: src/heap-inl.h

Issue 14796014: Parallel compilation fix: the optimizer thread shouldn't change the allow allocation state on Asser… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added TODO for Yang Created 7 years, 7 months 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 | « no previous file | no next file » | 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 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 HEAP->disallow_allocation_failure_ = old_state_; 865 HEAP->disallow_allocation_failure_ = old_state_;
866 #endif 866 #endif
867 } 867 }
868 868
869 869
870 #ifdef DEBUG 870 #ifdef DEBUG
871 bool EnterAllocationScope(Isolate* isolate, bool allow_allocation) { 871 bool EnterAllocationScope(Isolate* isolate, bool allow_allocation) {
872 bool active = !isolate->optimizing_compiler_thread()->IsOptimizerThread(); 872 bool active = !isolate->optimizing_compiler_thread()->IsOptimizerThread();
873 bool last_state = isolate->heap()->IsAllocationAllowed(); 873 bool last_state = isolate->heap()->IsAllocationAllowed();
874 if (active) { 874 if (active) {
875 // TODO(yangguo): Make HandleDereferenceGuard avoid isolate mutation in the
876 // same way if running on the optimizer thread.
875 isolate->heap()->set_allow_allocation(allow_allocation); 877 isolate->heap()->set_allow_allocation(allow_allocation);
876 } 878 }
877 return last_state; 879 return last_state;
878 } 880 }
879 881
880 882
881 void ExitAllocationScope(Isolate* isolate, bool last_state) { 883 void ExitAllocationScope(Isolate* isolate, bool last_state) {
882 isolate->heap()->set_allow_allocation(last_state); 884 bool active = !isolate->optimizing_compiler_thread()->IsOptimizerThread();
885 if (active) {
886 isolate->heap()->set_allow_allocation(last_state);
887 }
883 } 888 }
884 889
885 890
886 AssertNoAllocation::AssertNoAllocation() 891 AssertNoAllocation::AssertNoAllocation()
887 : last_state_(EnterAllocationScope(ISOLATE, false)) { 892 : last_state_(EnterAllocationScope(ISOLATE, false)) {
888 } 893 }
889 894
890 AssertNoAllocation::~AssertNoAllocation() { 895 AssertNoAllocation::~AssertNoAllocation() {
891 ExitAllocationScope(ISOLATE, last_state_); 896 ExitAllocationScope(ISOLATE, last_state_);
892 } 897 }
(...skipping 11 matching lines...) Expand all
904 AssertNoAllocation::~AssertNoAllocation() { } 909 AssertNoAllocation::~AssertNoAllocation() { }
905 DisableAssertNoAllocation::DisableAssertNoAllocation() { } 910 DisableAssertNoAllocation::DisableAssertNoAllocation() { }
906 DisableAssertNoAllocation::~DisableAssertNoAllocation() { } 911 DisableAssertNoAllocation::~DisableAssertNoAllocation() { }
907 912
908 #endif 913 #endif
909 914
910 915
911 } } // namespace v8::internal 916 } } // namespace v8::internal
912 917
913 #endif // V8_HEAP_INL_H_ 918 #endif // V8_HEAP_INL_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698