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

Side by Side Diff: src/compiler.cc

Issue 17895004: Add DependentCode to PropertyCells (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Moar review feedback Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler.h ('k') | src/heap.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 pre_parse_data_ = NULL; 111 pre_parse_data_ = NULL;
112 zone_ = zone; 112 zone_ = zone;
113 phase_zone_ = phase_zone; 113 phase_zone_ = phase_zone;
114 deferred_handles_ = NULL; 114 deferred_handles_ = NULL;
115 code_stub_ = NULL; 115 code_stub_ = NULL;
116 prologue_offset_ = kPrologueOffsetNotSet; 116 prologue_offset_ = kPrologueOffsetNotSet;
117 opt_count_ = shared_info().is_null() ? 0 : shared_info()->opt_count(); 117 opt_count_ = shared_info().is_null() ? 0 : shared_info()->opt_count();
118 no_frame_ranges_ = isolate->cpu_profiler()->is_profiling() 118 no_frame_ranges_ = isolate->cpu_profiler()->is_profiling()
119 ? new List<OffsetRange>(2) : NULL; 119 ? new List<OffsetRange>(2) : NULL;
120 for (int i = 0; i < DependentCode::kGroupCount; i++) { 120 for (int i = 0; i < DependentCode::kGroupCount; i++) {
121 dependent_maps_[i] = NULL; 121 dependencies_[i] = NULL;
122 } 122 }
123 if (mode == STUB) { 123 if (mode == STUB) {
124 mode_ = STUB; 124 mode_ = STUB;
125 return; 125 return;
126 } 126 }
127 mode_ = V8::UseCrankshaft() ? mode : NONOPT; 127 mode_ = V8::UseCrankshaft() ? mode : NONOPT;
128 if (script_->type()->value() == Script::TYPE_NATIVE) { 128 if (script_->type()->value() == Script::TYPE_NATIVE) {
129 MarkAsNative(); 129 MarkAsNative();
130 } 130 }
131 if (!shared_info_.is_null()) { 131 if (!shared_info_.is_null()) {
132 ASSERT(language_mode() == CLASSIC_MODE); 132 ASSERT(language_mode() == CLASSIC_MODE);
133 SetLanguageMode(shared_info_->language_mode()); 133 SetLanguageMode(shared_info_->language_mode());
134 } 134 }
135 set_bailout_reason("unknown"); 135 set_bailout_reason("unknown");
136 } 136 }
137 137
138 138
139 CompilationInfo::~CompilationInfo() { 139 CompilationInfo::~CompilationInfo() {
140 delete deferred_handles_; 140 delete deferred_handles_;
141 delete no_frame_ranges_; 141 delete no_frame_ranges_;
142 #ifdef DEBUG 142 #ifdef DEBUG
143 // Check that no dependent maps have been added or added dependent maps have 143 // Check that no dependent maps have been added or added dependent maps have
144 // been rolled back or committed. 144 // been rolled back or committed.
145 for (int i = 0; i < DependentCode::kGroupCount; i++) { 145 for (int i = 0; i < DependentCode::kGroupCount; i++) {
146 ASSERT_EQ(NULL, dependent_maps_[i]); 146 ASSERT_EQ(NULL, dependencies_[i]);
147 } 147 }
148 #endif // DEBUG 148 #endif // DEBUG
149 } 149 }
150 150
151 151
152 void CompilationInfo::CommitDependentMaps(Handle<Code> code) { 152 void CompilationInfo::CommitDependencies(Handle<Code> code) {
153 for (int i = 0; i < DependentCode::kGroupCount; i++) { 153 for (int i = 0; i < DependentCode::kGroupCount; i++) {
154 ZoneList<Handle<Map> >* group_maps = dependent_maps_[i]; 154 ZoneList<Handle<HeapObject> >* group_objects = dependencies_[i];
155 if (group_maps == NULL) continue; 155 if (group_objects == NULL) continue;
156 ASSERT(!object_wrapper_.is_null()); 156 ASSERT(!object_wrapper_.is_null());
157 for (int j = 0; j < group_maps->length(); j++) { 157 for (int j = 0; j < group_objects->length(); j++) {
158 group_maps->at(j)->dependent_code()->UpdateToFinishedCode( 158 DependentCode::DependencyGroup group =
159 static_cast<DependentCode::DependencyGroup>(i), this, *code); 159 static_cast<DependentCode::DependencyGroup>(i);
160 DependentCode* dependent_code =
161 DependentCode::ForObject(group_objects->at(j), group);
162 dependent_code->UpdateToFinishedCode(group, this, *code);
160 } 163 }
161 dependent_maps_[i] = NULL; // Zone-allocated, no need to delete. 164 dependencies_[i] = NULL; // Zone-allocated, no need to delete.
162 } 165 }
163 } 166 }
164 167
165 168
166 void CompilationInfo::RollbackDependentMaps() { 169 void CompilationInfo::RollbackDependencies() {
167 // Unregister from all dependent maps if not yet committed. 170 // Unregister from all dependent maps if not yet committed.
168 for (int i = 0; i < DependentCode::kGroupCount; i++) { 171 for (int i = 0; i < DependentCode::kGroupCount; i++) {
169 ZoneList<Handle<Map> >* group_maps = dependent_maps_[i]; 172 ZoneList<Handle<HeapObject> >* group_objects = dependencies_[i];
170 if (group_maps == NULL) continue; 173 if (group_objects == NULL) continue;
171 for (int j = 0; j < group_maps->length(); j++) { 174 for (int j = 0; j < group_objects->length(); j++) {
172 group_maps->at(j)->dependent_code()->RemoveCompilationInfo( 175 DependentCode::DependencyGroup group =
173 static_cast<DependentCode::DependencyGroup>(i), this); 176 static_cast<DependentCode::DependencyGroup>(i);
177 DependentCode* dependent_code =
178 DependentCode::ForObject(group_objects->at(j), group);
179 dependent_code->RemoveCompilationInfo(group, this);
174 } 180 }
175 dependent_maps_[i] = NULL; // Zone-allocated, no need to delete. 181 dependencies_[i] = NULL; // Zone-allocated, no need to delete.
176 } 182 }
177 } 183 }
178 184
179 185
180 int CompilationInfo::num_parameters() const { 186 int CompilationInfo::num_parameters() const {
181 ASSERT(!IsStub()); 187 ASSERT(!IsStub());
182 return scope()->num_parameters(); 188 return scope()->num_parameters();
183 } 189 }
184 190
185 191
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 return; 1054 return;
1049 } 1055 }
1050 1056
1051 Isolate* isolate = info->isolate(); 1057 Isolate* isolate = info->isolate();
1052 VMState<COMPILER> state(isolate); 1058 VMState<COMPILER> state(isolate);
1053 Logger::TimerEventScope timer( 1059 Logger::TimerEventScope timer(
1054 isolate, Logger::TimerEventScope::v8_recompile_synchronous); 1060 isolate, Logger::TimerEventScope::v8_recompile_synchronous);
1055 // If crankshaft succeeded, install the optimized code else install 1061 // If crankshaft succeeded, install the optimized code else install
1056 // the unoptimized code. 1062 // the unoptimized code.
1057 OptimizingCompiler::Status status = optimizing_compiler->last_status(); 1063 OptimizingCompiler::Status status = optimizing_compiler->last_status();
1058 if (info->HasAbortedDueToDependentMap()) { 1064 if (info->HasAbortedDueToDependencyChange()) {
1059 info->set_bailout_reason("bailed out due to dependent map"); 1065 info->set_bailout_reason("bailed out due to dependent map");
1060 status = optimizing_compiler->AbortOptimization(); 1066 status = optimizing_compiler->AbortOptimization();
1061 } else if (status != OptimizingCompiler::SUCCEEDED) { 1067 } else if (status != OptimizingCompiler::SUCCEEDED) {
1062 info->set_bailout_reason("failed/bailed out last time"); 1068 info->set_bailout_reason("failed/bailed out last time");
1063 status = optimizing_compiler->AbortOptimization(); 1069 status = optimizing_compiler->AbortOptimization();
1064 } else { 1070 } else {
1065 status = optimizing_compiler->GenerateAndInstallCode(); 1071 status = optimizing_compiler->GenerateAndInstallCode();
1066 ASSERT(status == OptimizingCompiler::SUCCEEDED || 1072 ASSERT(status == OptimizingCompiler::SUCCEEDED ||
1067 status == OptimizingCompiler::BAILED_OUT); 1073 status == OptimizingCompiler::BAILED_OUT);
1068 } 1074 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 } 1224 }
1219 } 1225 }
1220 1226
1221 GDBJIT(AddCode(Handle<String>(shared->DebugName()), 1227 GDBJIT(AddCode(Handle<String>(shared->DebugName()),
1222 Handle<Script>(info->script()), 1228 Handle<Script>(info->script()),
1223 Handle<Code>(info->code()), 1229 Handle<Code>(info->code()),
1224 info)); 1230 info));
1225 } 1231 }
1226 1232
1227 } } // namespace v8::internal 1233 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698