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

Side by Side Diff: src/objects.cc

Issue 873233002: Cache WeakCell for optimized code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add check Created 5 years, 11 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
« no previous file with comments | « src/objects.h ('k') | src/x64/lithium-codegen-x64.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 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
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);
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()) {
11052 DCHECK(this == WeakCell::cast(weak_cell_cache)->value());
11053 return WeakCell::cast(weak_cell_cache);
11054 }
11055 return NULL;
11056 }
11057
11058
11036 #ifdef ENABLE_DISASSEMBLER 11059 #ifdef ENABLE_DISASSEMBLER
11037 11060
11038 void DeoptimizationInputData::DeoptimizationInputDataPrint( 11061 void DeoptimizationInputData::DeoptimizationInputDataPrint(
11039 std::ostream& os) { // NOLINT 11062 std::ostream& os) { // NOLINT
11040 disasm::NameConverter converter; 11063 disasm::NameConverter converter;
11041 int deopt_count = DeoptCount(); 11064 int deopt_count = DeoptCount();
11042 os << "Deoptimization Input Data (deopt points = " << deopt_count << ")\n"; 11065 os << "Deoptimization Input Data (deopt points = " << deopt_count << ")\n";
11043 if (0 != deopt_count) { 11066 if (0 != deopt_count) {
11044 os << " index ast id argc pc"; 11067 os << " index ast id argc pc";
11045 if (FLAG_print_code_verbose) os << " commands"; 11068 if (FLAG_print_code_verbose) os << " commands";
(...skipping 5792 matching lines...) Expand 10 before | Expand all | Expand 10 after
16838 Handle<DependentCode> codes = 16861 Handle<DependentCode> codes =
16839 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), 16862 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()),
16840 DependentCode::kPropertyCellChangedGroup, 16863 DependentCode::kPropertyCellChangedGroup,
16841 info->object_wrapper()); 16864 info->object_wrapper());
16842 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); 16865 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
16843 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 16866 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
16844 cell, info->zone()); 16867 cell, info->zone());
16845 } 16868 }
16846 16869
16847 } } // namespace v8::internal 16870 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698