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

Side by Side Diff: src/liveedit.cc

Issue 12217106: Don't use TLS for space iterators. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed feedback. Created 7 years, 10 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 | « src/heap-profiler.cc ('k') | src/log.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 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 1040
1041 1041
1042 // Finds all references to original and replaces them with substitution. 1042 // Finds all references to original and replaces them with substitution.
1043 static void ReplaceCodeObject(Handle<Code> original, 1043 static void ReplaceCodeObject(Handle<Code> original,
1044 Handle<Code> substitution) { 1044 Handle<Code> substitution) {
1045 // Perform a full GC in order to ensure that we are not in the middle of an 1045 // Perform a full GC in order to ensure that we are not in the middle of an
1046 // incremental marking phase when we are replacing the code object. 1046 // incremental marking phase when we are replacing the code object.
1047 // Since we are not in an incremental marking phase we can write pointers 1047 // Since we are not in an incremental marking phase we can write pointers
1048 // to code objects (that are never in new space) without worrying about 1048 // to code objects (that are never in new space) without worrying about
1049 // write barriers. 1049 // write barriers.
1050 HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask, 1050 Heap* heap = original->GetHeap();
1051 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask,
1051 "liveedit.cc ReplaceCodeObject"); 1052 "liveedit.cc ReplaceCodeObject");
1052 1053
1053 ASSERT(!HEAP->InNewSpace(*substitution)); 1054 ASSERT(!heap->InNewSpace(*substitution));
1054 1055
1055 AssertNoAllocation no_allocations_please; 1056 AssertNoAllocation no_allocations_please;
1056 1057
1057 ReplacingVisitor visitor(*original, *substitution); 1058 ReplacingVisitor visitor(*original, *substitution);
1058 1059
1059 // Iterate over all roots. Stack frames may have pointer into original code, 1060 // Iterate over all roots. Stack frames may have pointer into original code,
1060 // so temporary replace the pointers with offset numbers 1061 // so temporary replace the pointers with offset numbers
1061 // in prologue/epilogue. 1062 // in prologue/epilogue.
1062 HEAP->IterateRoots(&visitor, VISIT_ALL); 1063 heap->IterateRoots(&visitor, VISIT_ALL);
1063 1064
1064 // Now iterate over all pointers of all objects, including code_target 1065 // Now iterate over all pointers of all objects, including code_target
1065 // implicit pointers. 1066 // implicit pointers.
1066 HeapIterator iterator; 1067 HeapIterator iterator(heap);
1067 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { 1068 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
1068 obj->Iterate(&visitor); 1069 obj->Iterate(&visitor);
1069 } 1070 }
1070 } 1071 }
1071 1072
1072 1073
1073 // Patch function literals. 1074 // Patch function literals.
1074 // Name 'literals' is a misnomer. Rather it's a cache for complex object 1075 // Name 'literals' is a misnomer. Rather it's a cache for complex object
1075 // boilerplates and for a native context. We must clean cached values. 1076 // boilerplates and for a native context. We must clean cached values.
1076 // Additionally we may need to allocate a new array if number of literals 1077 // Additionally we may need to allocate a new array if number of literals
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 } 1123 }
1123 1124
1124 private: 1125 private:
1125 // Iterates all function instances in the HEAP that refers to the 1126 // Iterates all function instances in the HEAP that refers to the
1126 // provided shared_info. 1127 // provided shared_info.
1127 template<typename Visitor> 1128 template<typename Visitor>
1128 static void IterateJSFunctions(SharedFunctionInfo* shared_info, 1129 static void IterateJSFunctions(SharedFunctionInfo* shared_info,
1129 Visitor* visitor) { 1130 Visitor* visitor) {
1130 AssertNoAllocation no_allocations_please; 1131 AssertNoAllocation no_allocations_please;
1131 1132
1132 HeapIterator iterator; 1133 HeapIterator iterator(shared_info->GetHeap());
1133 for (HeapObject* obj = iterator.next(); obj != NULL; 1134 for (HeapObject* obj = iterator.next(); obj != NULL;
1134 obj = iterator.next()) { 1135 obj = iterator.next()) {
1135 if (obj->IsJSFunction()) { 1136 if (obj->IsJSFunction()) {
1136 JSFunction* function = JSFunction::cast(obj); 1137 JSFunction* function = JSFunction::cast(obj);
1137 if (function->shared() == shared_info) { 1138 if (function->shared() == shared_info) {
1138 visitor->visit(function); 1139 visitor->visit(function);
1139 } 1140 }
1140 } 1141 }
1141 } 1142 }
1142 } 1143 }
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
2097 2098
2098 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { 2099 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) {
2099 return false; 2100 return false;
2100 } 2101 }
2101 2102
2102 #endif // ENABLE_DEBUGGER_SUPPORT 2103 #endif // ENABLE_DEBUGGER_SUPPORT
2103 2104
2104 2105
2105 2106
2106 } } // namespace v8::internal 2107 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap-profiler.cc ('k') | src/log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698