| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/gc_marker.h" | 5 #include "vm/gc_marker.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 | 239 |
| 240 void DetachCode() { | 240 void DetachCode() { |
| 241 for (int i = 0; i < skipped_code_functions_.length(); i++) { | 241 for (int i = 0; i < skipped_code_functions_.length(); i++) { |
| 242 RawFunction* func = skipped_code_functions_[i]; | 242 RawFunction* func = skipped_code_functions_[i]; |
| 243 RawCode* code = func->ptr()->instructions_->ptr()->code_; | 243 RawCode* code = func->ptr()->instructions_->ptr()->code_; |
| 244 if (!code->IsMarked()) { | 244 if (!code->IsMarked()) { |
| 245 // If the code wasn't strongly visited through other references | 245 // If the code wasn't strongly visited through other references |
| 246 // after skipping the function's code pointer, then we disconnect the | 246 // after skipping the function's code pointer, then we disconnect the |
| 247 // code from the function. | 247 // code from the function. |
| 248 StubCode* stub_code = isolate()->stub_code(); | 248 StubCode* stub_code = isolate()->stub_code(); |
| 249 func->ptr()->instructions_ = | 249 func->StorePointer( |
| 250 stub_code->LazyCompile_entry()->code()->ptr()->instructions_; | 250 &(func->ptr()->instructions_), |
| 251 func->ptr()->unoptimized_code_ = Code::null(); | 251 stub_code->LazyCompile_entry()->code()->ptr()->instructions_); |
| 252 func->StorePointer(&(func->ptr()->unoptimized_code_), Code::null()); |
| 252 if (FLAG_log_code_drop) { | 253 if (FLAG_log_code_drop) { |
| 253 // NOTE: This code runs while GC is in progress and runs within | 254 // NOTE: This code runs while GC is in progress and runs within |
| 254 // a NoHandleScope block. Hence it is not okay to use a regular Zone | 255 // a NoHandleScope block. Hence it is not okay to use a regular Zone |
| 255 // or Scope handle. We use a direct stack handle so the raw pointer in | 256 // or Scope handle. We use a direct stack handle so the raw pointer in |
| 256 // this handle is not traversed. The use of a handle is mainly to | 257 // this handle is not traversed. The use of a handle is mainly to |
| 257 // be able to reuse the handle based code and avoid having to add | 258 // be able to reuse the handle based code and avoid having to add |
| 258 // helper functions to the raw object interface. | 259 // helper functions to the raw object interface. |
| 259 String name; | 260 String name; |
| 260 name = func->ptr()->name_; | 261 name = func->ptr()->name_; |
| 261 OS::Print("Detaching code: %s\n", name.ToCString()); | 262 OS::Print("Detaching code: %s\n", name.ToCString()); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 MarkingWeakVisitor mark_weak; | 510 MarkingWeakVisitor mark_weak; |
| 510 IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks); | 511 IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks); |
| 511 mark.Finalize(); | 512 mark.Finalize(); |
| 512 ProcessWeakTables(page_space); | 513 ProcessWeakTables(page_space); |
| 513 ProcessObjectIdTable(isolate); | 514 ProcessObjectIdTable(isolate); |
| 514 | 515 |
| 515 Epilogue(isolate, invoke_api_callbacks); | 516 Epilogue(isolate, invoke_api_callbacks); |
| 516 } | 517 } |
| 517 | 518 |
| 518 } // namespace dart | 519 } // namespace dart |
| OLD | NEW |