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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 return SetLastStatus(GenerateCodeImpl()); | 277 return SetLastStatus(GenerateCodeImpl()); |
278 } | 278 } |
279 | 279 |
280 | 280 |
281 namespace { | 281 namespace { |
282 | 282 |
283 void AddWeakObjectToCodeDependency(Isolate* isolate, Handle<HeapObject> object, | 283 void AddWeakObjectToCodeDependency(Isolate* isolate, Handle<HeapObject> object, |
284 Handle<Code> code) { | 284 Handle<Code> code) { |
285 Handle<WeakCell> cell = Code::WeakCellFor(code); | 285 Handle<WeakCell> cell = Code::WeakCellFor(code); |
286 Heap* heap = isolate->heap(); | 286 Heap* heap = isolate->heap(); |
287 if (heap->InNewSpace(*object)) { | 287 Handle<DependentCode> dep(heap->LookupWeakObjectToCodeDependency(object)); |
288 heap->AddWeakNewSpaceObjectToCodeDependency(object, cell); | 288 dep = DependentCode::InsertWeakCode(dep, DependentCode::kWeakCodeGroup, cell); |
289 } else { | 289 heap->AddWeakObjectToCodeDependency(object, dep); |
290 Handle<DependentCode> dep(heap->LookupWeakObjectToCodeDependency(object)); | |
291 dep = | |
292 DependentCode::InsertWeakCode(dep, DependentCode::kWeakCodeGroup, cell); | |
293 heap->AddWeakObjectToCodeDependency(object, dep); | |
294 } | |
295 } | 290 } |
296 | 291 |
297 } // namespace | 292 } // namespace |
298 | 293 |
299 void CompilationJob::RegisterWeakObjectsInOptimizedCode(Handle<Code> code) { | 294 void CompilationJob::RegisterWeakObjectsInOptimizedCode(Handle<Code> code) { |
300 // TODO(turbofan): Move this to pipeline.cc once Crankshaft dies. | 295 // TODO(turbofan): Move this to pipeline.cc once Crankshaft dies. |
301 Isolate* const isolate = code->GetIsolate(); | 296 Isolate* const isolate = code->GetIsolate(); |
302 DCHECK(code->is_optimized_code()); | 297 DCHECK(code->is_optimized_code()); |
303 std::vector<Handle<Map>> maps; | 298 std::vector<Handle<Map>> maps; |
304 std::vector<Handle<HeapObject>> objects; | 299 std::vector<Handle<HeapObject>> objects; |
(...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1825 DCHECK(shared->is_compiled()); | 1820 DCHECK(shared->is_compiled()); |
1826 function->set_literals(cached.literals); | 1821 function->set_literals(cached.literals); |
1827 } else if (shared->is_compiled()) { | 1822 } else if (shared->is_compiled()) { |
1828 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1823 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
1829 JSFunction::EnsureLiterals(function); | 1824 JSFunction::EnsureLiterals(function); |
1830 } | 1825 } |
1831 } | 1826 } |
1832 | 1827 |
1833 } // namespace internal | 1828 } // namespace internal |
1834 } // namespace v8 | 1829 } // namespace v8 |
OLD | NEW |