Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/compiler.h" | 5 #include "src/compiler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "src/ast/ast-numbering.h" | 9 #include "src/ast/ast-numbering.h" |
| 10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 return SetLastStatus(GenerateCodeImpl()); | 279 return SetLastStatus(GenerateCodeImpl()); |
| 280 } | 280 } |
| 281 | 281 |
| 282 | 282 |
| 283 namespace { | 283 namespace { |
| 284 | 284 |
| 285 void AddWeakObjectToCodeDependency(Isolate* isolate, Handle<HeapObject> object, | 285 void AddWeakObjectToCodeDependency(Isolate* isolate, Handle<HeapObject> object, |
| 286 Handle<Code> code) { | 286 Handle<Code> code) { |
| 287 Handle<WeakCell> cell = Code::WeakCellFor(code); | 287 Handle<WeakCell> cell = Code::WeakCellFor(code); |
| 288 Heap* heap = isolate->heap(); | 288 Heap* heap = isolate->heap(); |
| 289 Handle<DependentCode> dep(heap->LookupWeakObjectToCodeDependency(object)); | 289 if (heap->InNewSpace(*object)) { |
| 290 dep = DependentCode::InsertWeakCode(dep, DependentCode::kWeakCodeGroup, cell); | 290 heap->RecordWeakCodeToNewSpaceReference(object, cell); |
|
ulan
2016/06/08 14:37:00
Could you rename it to AddWeakNewSpaceObjectToCode
ahaas
2016/06/09 10:34:32
Done. I named it differently because no DependentC
| |
| 291 heap->AddWeakObjectToCodeDependency(object, dep); | 291 } else { |
| 292 Handle<DependentCode> dep(heap->LookupWeakObjectToCodeDependency(object)); | |
| 293 dep = | |
| 294 DependentCode::InsertWeakCode(dep, DependentCode::kWeakCodeGroup, cell); | |
| 295 heap->AddWeakObjectToCodeDependency(object, dep); | |
| 296 } | |
| 292 } | 297 } |
| 293 | 298 |
| 294 } // namespace | 299 } // namespace |
| 295 | 300 |
| 296 void CompilationJob::RegisterWeakObjectsInOptimizedCode(Handle<Code> code) { | 301 void CompilationJob::RegisterWeakObjectsInOptimizedCode(Handle<Code> code) { |
| 297 // TODO(turbofan): Move this to pipeline.cc once Crankshaft dies. | 302 // TODO(turbofan): Move this to pipeline.cc once Crankshaft dies. |
| 298 Isolate* const isolate = code->GetIsolate(); | 303 Isolate* const isolate = code->GetIsolate(); |
| 299 DCHECK(code->is_optimized_code()); | 304 DCHECK(code->is_optimized_code()); |
| 300 std::vector<Handle<Map>> maps; | 305 std::vector<Handle<Map>> maps; |
| 301 std::vector<Handle<HeapObject>> objects; | 306 std::vector<Handle<HeapObject>> objects; |
| (...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1805 DCHECK(shared->is_compiled()); | 1810 DCHECK(shared->is_compiled()); |
| 1806 function->set_literals(cached.literals); | 1811 function->set_literals(cached.literals); |
| 1807 } else if (shared->is_compiled()) { | 1812 } else if (shared->is_compiled()) { |
| 1808 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1813 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
| 1809 JSFunction::EnsureLiterals(function); | 1814 JSFunction::EnsureLiterals(function); |
| 1810 } | 1815 } |
| 1811 } | 1816 } |
| 1812 | 1817 |
| 1813 } // namespace internal | 1818 } // namespace internal |
| 1814 } // namespace v8 | 1819 } // namespace v8 |
| OLD | NEW |