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

Side by Side Diff: src/compiler.h

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/arm/lithium-codegen-arm.cc ('k') | src/compiler.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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 233
234 // Disable all optimization attempts of this info for the rest of the 234 // Disable all optimization attempts of this info for the rest of the
235 // current compilation pipeline. 235 // current compilation pipeline.
236 void AbortOptimization(); 236 void AbortOptimization();
237 237
238 void set_deferred_handles(DeferredHandles* deferred_handles) { 238 void set_deferred_handles(DeferredHandles* deferred_handles) {
239 ASSERT(deferred_handles_ == NULL); 239 ASSERT(deferred_handles_ == NULL);
240 deferred_handles_ = deferred_handles; 240 deferred_handles_ = deferred_handles;
241 } 241 }
242 242
243 ZoneList<Handle<Map> >* dependent_maps(DependentCode::DependencyGroup group) { 243 ZoneList<Handle<HeapObject> >* dependencies(
244 if (dependent_maps_[group] == NULL) { 244 DependentCode::DependencyGroup group) {
245 dependent_maps_[group] = new(zone_) ZoneList<Handle<Map> >(2, zone_); 245 if (dependencies_[group] == NULL) {
246 dependencies_[group] = new(zone_) ZoneList<Handle<HeapObject> >(2, zone_);
246 } 247 }
247 return dependent_maps_[group]; 248 return dependencies_[group];
248 } 249 }
249 250
250 void CommitDependentMaps(Handle<Code> code); 251 void CommitDependencies(Handle<Code> code);
251 252
252 void RollbackDependentMaps(); 253 void RollbackDependencies();
253 254
254 void SaveHandles() { 255 void SaveHandles() {
255 SaveHandle(&closure_); 256 SaveHandle(&closure_);
256 SaveHandle(&shared_info_); 257 SaveHandle(&shared_info_);
257 SaveHandle(&context_); 258 SaveHandle(&context_);
258 SaveHandle(&script_); 259 SaveHandle(&script_);
259 } 260 }
260 261
261 const char* bailout_reason() const { return bailout_reason_; } 262 const char* bailout_reason() const { return bailout_reason_; }
262 void set_bailout_reason(const char* reason) { bailout_reason_ = reason; } 263 void set_bailout_reason(const char* reason) { bailout_reason_ = reason; }
(...skipping 22 matching lines...) Expand all
285 } 286 }
286 287
287 Handle<Foreign> object_wrapper() { 288 Handle<Foreign> object_wrapper() {
288 if (object_wrapper_.is_null()) { 289 if (object_wrapper_.is_null()) {
289 object_wrapper_ = 290 object_wrapper_ =
290 isolate()->factory()->NewForeign(reinterpret_cast<Address>(this)); 291 isolate()->factory()->NewForeign(reinterpret_cast<Address>(this));
291 } 292 }
292 return object_wrapper_; 293 return object_wrapper_;
293 } 294 }
294 295
295 void AbortDueToDependentMap() { 296 void AbortDueToDependencyChange() {
296 mode_ = DEPENDENT_MAP_ABORT; 297 mode_ = DEPENDENCY_CHANGE_ABORT;
297 } 298 }
298 299
299 bool HasAbortedDueToDependentMap() { 300 bool HasAbortedDueToDependencyChange() {
300 return mode_ == DEPENDENT_MAP_ABORT; 301 return mode_ == DEPENDENCY_CHANGE_ABORT;
301 } 302 }
302 303
303 protected: 304 protected:
304 CompilationInfo(Handle<Script> script, 305 CompilationInfo(Handle<Script> script,
305 Zone* zone, 306 Zone* zone,
306 Zone* phase_zone); 307 Zone* phase_zone);
307 CompilationInfo(Handle<SharedFunctionInfo> shared_info, 308 CompilationInfo(Handle<SharedFunctionInfo> shared_info,
308 Zone* zone, 309 Zone* zone,
309 Zone* phase_zone); 310 Zone* phase_zone);
310 CompilationInfo(HydrogenCodeStub* stub, 311 CompilationInfo(HydrogenCodeStub* stub,
311 Isolate* isolate, 312 Isolate* isolate,
312 Zone* zone, 313 Zone* zone,
313 Zone* phase_zone); 314 Zone* phase_zone);
314 315
315 private: 316 private:
316 Isolate* isolate_; 317 Isolate* isolate_;
317 318
318 // Compilation mode. 319 // Compilation mode.
319 // BASE is generated by the full codegen, optionally prepared for bailouts. 320 // BASE is generated by the full codegen, optionally prepared for bailouts.
320 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. 321 // OPTIMIZE is optimized code generated by the Hydrogen-based backend.
321 // NONOPT is generated by the full codegen and is not prepared for 322 // NONOPT is generated by the full codegen and is not prepared for
322 // recompilation/bailouts. These functions are never recompiled. 323 // recompilation/bailouts. These functions are never recompiled.
323 enum Mode { 324 enum Mode {
324 BASE, 325 BASE,
325 OPTIMIZE, 326 OPTIMIZE,
326 NONOPT, 327 NONOPT,
327 STUB, 328 STUB,
328 DEPENDENT_MAP_ABORT 329 DEPENDENCY_CHANGE_ABORT
329 }; 330 };
330 331
331 void Initialize(Isolate* isolate, Mode mode, Zone* zone, Zone* phase_zone); 332 void Initialize(Isolate* isolate, Mode mode, Zone* zone, Zone* phase_zone);
332 333
333 void SetMode(Mode mode) { 334 void SetMode(Mode mode) {
334 ASSERT(V8::UseCrankshaft()); 335 ASSERT(V8::UseCrankshaft());
335 mode_ = mode; 336 mode_ = mode;
336 } 337 }
337 338
338 // Flags using template class BitField<type, start, length>. All are 339 // Flags using template class BitField<type, start, length>. All are
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 402
402 // The zone from which the compilation pipeline working on this 403 // The zone from which the compilation pipeline working on this
403 // CompilationInfo allocates. 404 // CompilationInfo allocates.
404 Zone* zone_; 405 Zone* zone_;
405 // The phase zone where allocations local to a specific phase are 406 // The phase zone where allocations local to a specific phase are
406 // performed; be aware that this zone is cleared after each phase 407 // performed; be aware that this zone is cleared after each phase
407 Zone* phase_zone_; 408 Zone* phase_zone_;
408 409
409 DeferredHandles* deferred_handles_; 410 DeferredHandles* deferred_handles_;
410 411
411 ZoneList<Handle<Map> >* dependent_maps_[DependentCode::kGroupCount]; 412 ZoneList<Handle<HeapObject> >* dependencies_[DependentCode::kGroupCount];
412 413
413 template<typename T> 414 template<typename T>
414 void SaveHandle(Handle<T> *object) { 415 void SaveHandle(Handle<T> *object) {
415 if (!object->is_null()) { 416 if (!object->is_null()) {
416 Handle<T> handle(*(*object)); 417 Handle<T> handle(*(*object));
417 *object = handle; 418 *object = handle;
418 } 419 }
419 } 420 }
420 421
421 const char* bailout_reason_; 422 const char* bailout_reason_;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 CompilationInfoWithZone(HydrogenCodeStub* stub, Isolate* isolate) 457 CompilationInfoWithZone(HydrogenCodeStub* stub, Isolate* isolate)
457 : CompilationInfo(stub, isolate, &zone_, &phase_zone_), 458 : CompilationInfo(stub, isolate, &zone_, &phase_zone_),
458 zone_(isolate), 459 zone_(isolate),
459 zone_scope_(&zone_, DELETE_ON_EXIT), 460 zone_scope_(&zone_, DELETE_ON_EXIT),
460 phase_zone_(isolate) {} 461 phase_zone_(isolate) {}
461 462
462 // Virtual destructor because a CompilationInfoWithZone has to exit the 463 // Virtual destructor because a CompilationInfoWithZone has to exit the
463 // zone scope and get rid of dependent maps even when the destructor is 464 // zone scope and get rid of dependent maps even when the destructor is
464 // called when cast as a CompilationInfo. 465 // called when cast as a CompilationInfo.
465 virtual ~CompilationInfoWithZone() { 466 virtual ~CompilationInfoWithZone() {
466 RollbackDependentMaps(); 467 RollbackDependencies();
467 } 468 }
468 469
469 private: 470 private:
470 Zone zone_; 471 Zone zone_;
471 ZoneScope zone_scope_; 472 ZoneScope zone_scope_;
472 Zone phase_zone_; 473 Zone phase_zone_;
473 }; 474 };
474 475
475 476
476 // A wrapper around a CompilationInfo that detaches the Handles from 477 // A wrapper around a CompilationInfo that detaches the Handles from
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 630
630 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, 631 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag,
631 CompilationInfo* info, 632 CompilationInfo* info,
632 Handle<SharedFunctionInfo> shared); 633 Handle<SharedFunctionInfo> shared);
633 }; 634 };
634 635
635 636
636 } } // namespace v8::internal 637 } } // namespace v8::internal
637 638
638 #endif // V8_COMPILER_H_ 639 #endif // V8_COMPILER_H_
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698