Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 <sstream> | 5 #include <sstream> |
| 6 | 6 |
| 7 #include "src/v8.h" | 7 #include "src/v8.h" |
| 8 | 8 |
| 9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
| 10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
| (...skipping 11015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11026 #define CASE(name) case name: return #name; | 11026 #define CASE(name) case name: return #name; |
| 11027 CODE_KIND_LIST(CASE) | 11027 CODE_KIND_LIST(CASE) |
| 11028 #undef CASE | 11028 #undef CASE |
| 11029 case NUMBER_OF_KINDS: break; | 11029 case NUMBER_OF_KINDS: break; |
| 11030 } | 11030 } |
| 11031 UNREACHABLE(); | 11031 UNREACHABLE(); |
| 11032 return NULL; | 11032 return NULL; |
| 11033 } | 11033 } |
| 11034 | 11034 |
| 11035 | 11035 |
| 11036 Handle<WeakCell> Code::WeakCellFor(Handle<Code> code) { | |
| 11037 DCHECK(code->kind() == OPTIMIZED_FUNCTION); | |
| 11038 WeakCell* raw_cell = code->CachedWeakCell(); | |
| 11039 if (raw_cell != NULL) return Handle<WeakCell>(raw_cell); | |
|
Yang
2015/01/26 14:55:23
Suggestion: add an assertion that the cached code
ulan
2015/01/26 15:00:07
Done. Added check in Code::CachedWeakCell
| |
| 11040 Handle<WeakCell> cell = code->GetIsolate()->factory()->NewWeakCell(code); | |
| 11041 DeoptimizationInputData::cast(code->deoptimization_data()) | |
| 11042 ->SetWeakCellCache(*cell); | |
| 11043 return cell; | |
| 11044 } | |
| 11045 | |
| 11046 | |
| 11047 WeakCell* Code::CachedWeakCell() { | |
| 11048 DCHECK(kind() == OPTIMIZED_FUNCTION); | |
| 11049 Object* weak_cell_cache = | |
| 11050 DeoptimizationInputData::cast(deoptimization_data())->WeakCellCache(); | |
| 11051 if (weak_cell_cache->IsWeakCell()) return WeakCell::cast(weak_cell_cache); | |
| 11052 return NULL; | |
| 11053 } | |
| 11054 | |
| 11055 | |
| 11036 #ifdef ENABLE_DISASSEMBLER | 11056 #ifdef ENABLE_DISASSEMBLER |
| 11037 | 11057 |
| 11038 void DeoptimizationInputData::DeoptimizationInputDataPrint( | 11058 void DeoptimizationInputData::DeoptimizationInputDataPrint( |
| 11039 std::ostream& os) { // NOLINT | 11059 std::ostream& os) { // NOLINT |
| 11040 disasm::NameConverter converter; | 11060 disasm::NameConverter converter; |
| 11041 int deopt_count = DeoptCount(); | 11061 int deopt_count = DeoptCount(); |
| 11042 os << "Deoptimization Input Data (deopt points = " << deopt_count << ")\n"; | 11062 os << "Deoptimization Input Data (deopt points = " << deopt_count << ")\n"; |
| 11043 if (0 != deopt_count) { | 11063 if (0 != deopt_count) { |
| 11044 os << " index ast id argc pc"; | 11064 os << " index ast id argc pc"; |
| 11045 if (FLAG_print_code_verbose) os << " commands"; | 11065 if (FLAG_print_code_verbose) os << " commands"; |
| (...skipping 5792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16838 Handle<DependentCode> codes = | 16858 Handle<DependentCode> codes = |
| 16839 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), | 16859 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), |
| 16840 DependentCode::kPropertyCellChangedGroup, | 16860 DependentCode::kPropertyCellChangedGroup, |
| 16841 info->object_wrapper()); | 16861 info->object_wrapper()); |
| 16842 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 16862 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
| 16843 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 16863 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
| 16844 cell, info->zone()); | 16864 cell, info->zone()); |
| 16845 } | 16865 } |
| 16846 | 16866 |
| 16847 } } // namespace v8::internal | 16867 } } // namespace v8::internal |
| OLD | NEW |