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

Side by Side Diff: src/compiler.h

Issue 142813003: A64: Synchronize with r15358. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/codegen.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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 232
233 // Disable all optimization attempts of this info for the rest of the 233 // Disable all optimization attempts of this info for the rest of the
234 // current compilation pipeline. 234 // current compilation pipeline.
235 void AbortOptimization(); 235 void AbortOptimization();
236 236
237 void set_deferred_handles(DeferredHandles* deferred_handles) { 237 void set_deferred_handles(DeferredHandles* deferred_handles) {
238 ASSERT(deferred_handles_ == NULL); 238 ASSERT(deferred_handles_ == NULL);
239 deferred_handles_ = deferred_handles; 239 deferred_handles_ = deferred_handles;
240 } 240 }
241 241
242 ZoneList<Handle<Map> >* dependent_maps(DependentCode::DependencyGroup group) { 242 ZoneList<Handle<HeapObject> >* dependencies(
243 if (dependent_maps_[group] == NULL) { 243 DependentCode::DependencyGroup group) {
244 dependent_maps_[group] = new(zone_) ZoneList<Handle<Map> >(2, zone_); 244 if (dependencies_[group] == NULL) {
245 dependencies_[group] = new(zone_) ZoneList<Handle<HeapObject> >(2, zone_);
245 } 246 }
246 return dependent_maps_[group]; 247 return dependencies_[group];
247 } 248 }
248 249
249 void CommitDependentMaps(Handle<Code> code); 250 void CommitDependencies(Handle<Code> code);
250 251
251 void RollbackDependentMaps(); 252 void RollbackDependencies();
252 253
253 void SaveHandles() { 254 void SaveHandles() {
254 SaveHandle(&closure_); 255 SaveHandle(&closure_);
255 SaveHandle(&shared_info_); 256 SaveHandle(&shared_info_);
256 SaveHandle(&context_); 257 SaveHandle(&context_);
257 SaveHandle(&script_); 258 SaveHandle(&script_);
258 } 259 }
259 260
260 const char* bailout_reason() const { return bailout_reason_; } 261 const char* bailout_reason() const { return bailout_reason_; }
261 void set_bailout_reason(const char* reason) { bailout_reason_ = reason; } 262 void set_bailout_reason(const char* reason) { bailout_reason_ = reason; }
(...skipping 22 matching lines...) Expand all
284 } 285 }
285 286
286 Handle<Foreign> object_wrapper() { 287 Handle<Foreign> object_wrapper() {
287 if (object_wrapper_.is_null()) { 288 if (object_wrapper_.is_null()) {
288 object_wrapper_ = 289 object_wrapper_ =
289 isolate()->factory()->NewForeign(reinterpret_cast<Address>(this)); 290 isolate()->factory()->NewForeign(reinterpret_cast<Address>(this));
290 } 291 }
291 return object_wrapper_; 292 return object_wrapper_;
292 } 293 }
293 294
294 void AbortDueToDependentMap() { 295 void AbortDueToDependencyChange() {
295 mode_ = DEPENDENT_MAP_ABORT; 296 mode_ = DEPENDENCY_CHANGE_ABORT;
296 } 297 }
297 298
298 bool HasAbortedDueToDependentMap() { 299 bool HasAbortedDueToDependencyChange() {
299 return mode_ == DEPENDENT_MAP_ABORT; 300 return mode_ == DEPENDENCY_CHANGE_ABORT;
300 } 301 }
301 302
302 protected: 303 protected:
303 CompilationInfo(Handle<Script> script, Zone* zone); 304 CompilationInfo(Handle<Script> script,
304 CompilationInfo(Handle<SharedFunctionInfo> shared_info, Zone* zone); 305 Zone* zone);
305 CompilationInfo(HydrogenCodeStub* stub, Isolate* isolate, Zone* zone); 306 CompilationInfo(Handle<SharedFunctionInfo> shared_info,
307 Zone* zone);
308 CompilationInfo(HydrogenCodeStub* stub,
309 Isolate* isolate,
310 Zone* zone);
306 311
307 private: 312 private:
308 Isolate* isolate_; 313 Isolate* isolate_;
309 314
310 // Compilation mode. 315 // Compilation mode.
311 // BASE is generated by the full codegen, optionally prepared for bailouts. 316 // BASE is generated by the full codegen, optionally prepared for bailouts.
312 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. 317 // OPTIMIZE is optimized code generated by the Hydrogen-based backend.
313 // NONOPT is generated by the full codegen and is not prepared for 318 // NONOPT is generated by the full codegen and is not prepared for
314 // recompilation/bailouts. These functions are never recompiled. 319 // recompilation/bailouts. These functions are never recompiled.
315 enum Mode { 320 enum Mode {
316 BASE, 321 BASE,
317 OPTIMIZE, 322 OPTIMIZE,
318 NONOPT, 323 NONOPT,
319 STUB, 324 STUB,
320 DEPENDENT_MAP_ABORT 325 DEPENDENCY_CHANGE_ABORT
321 }; 326 };
322 327
323 void Initialize(Isolate* isolate, Mode mode, Zone* zone); 328 void Initialize(Isolate* isolate, Mode mode, Zone* zone);
324 329
325 void SetMode(Mode mode) { 330 void SetMode(Mode mode) {
326 ASSERT(V8::UseCrankshaft()); 331 ASSERT(V8::UseCrankshaft());
327 mode_ = mode; 332 mode_ = mode;
328 } 333 }
329 334
330 // Flags using template class BitField<type, start, length>. All are 335 // Flags using template class BitField<type, start, length>. All are
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 // Compilation mode flag and whether deoptimization is allowed. 395 // Compilation mode flag and whether deoptimization is allowed.
391 Mode mode_; 396 Mode mode_;
392 BailoutId osr_ast_id_; 397 BailoutId osr_ast_id_;
393 398
394 // The zone from which the compilation pipeline working on this 399 // The zone from which the compilation pipeline working on this
395 // CompilationInfo allocates. 400 // CompilationInfo allocates.
396 Zone* zone_; 401 Zone* zone_;
397 402
398 DeferredHandles* deferred_handles_; 403 DeferredHandles* deferred_handles_;
399 404
400 ZoneList<Handle<Map> >* dependent_maps_[DependentCode::kGroupCount]; 405 ZoneList<Handle<HeapObject> >* dependencies_[DependentCode::kGroupCount];
401 406
402 template<typename T> 407 template<typename T>
403 void SaveHandle(Handle<T> *object) { 408 void SaveHandle(Handle<T> *object) {
404 if (!object->is_null()) { 409 if (!object->is_null()) {
405 Handle<T> handle(*(*object)); 410 Handle<T> handle(*(*object));
406 *object = handle; 411 *object = handle;
407 } 412 }
408 } 413 }
409 414
410 const char* bailout_reason_; 415 const char* bailout_reason_;
(...skipping 11 matching lines...) Expand all
422 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); 427 DISALLOW_COPY_AND_ASSIGN(CompilationInfo);
423 }; 428 };
424 429
425 430
426 // Exactly like a CompilationInfo, except also creates and enters a 431 // Exactly like a CompilationInfo, except also creates and enters a
427 // Zone on construction and deallocates it on exit. 432 // Zone on construction and deallocates it on exit.
428 class CompilationInfoWithZone: public CompilationInfo { 433 class CompilationInfoWithZone: public CompilationInfo {
429 public: 434 public:
430 explicit CompilationInfoWithZone(Handle<Script> script) 435 explicit CompilationInfoWithZone(Handle<Script> script)
431 : CompilationInfo(script, &zone_), 436 : CompilationInfo(script, &zone_),
432 zone_(script->GetIsolate()), 437 zone_(script->GetIsolate()) {}
433 zone_scope_(&zone_, DELETE_ON_EXIT) {}
434 explicit CompilationInfoWithZone(Handle<SharedFunctionInfo> shared_info) 438 explicit CompilationInfoWithZone(Handle<SharedFunctionInfo> shared_info)
435 : CompilationInfo(shared_info, &zone_), 439 : CompilationInfo(shared_info, &zone_),
436 zone_(shared_info->GetIsolate()), 440 zone_(shared_info->GetIsolate()) {}
437 zone_scope_(&zone_, DELETE_ON_EXIT) {}
438 explicit CompilationInfoWithZone(Handle<JSFunction> closure) 441 explicit CompilationInfoWithZone(Handle<JSFunction> closure)
439 : CompilationInfo(closure, &zone_), 442 : CompilationInfo(closure, &zone_),
440 zone_(closure->GetIsolate()), 443 zone_(closure->GetIsolate()) {}
441 zone_scope_(&zone_, DELETE_ON_EXIT) {}
442 CompilationInfoWithZone(HydrogenCodeStub* stub, Isolate* isolate) 444 CompilationInfoWithZone(HydrogenCodeStub* stub, Isolate* isolate)
443 : CompilationInfo(stub, isolate, &zone_), 445 : CompilationInfo(stub, isolate, &zone_),
444 zone_(isolate), 446 zone_(isolate) {}
445 zone_scope_(&zone_, DELETE_ON_EXIT) {}
446 447
447 // Virtual destructor because a CompilationInfoWithZone has to exit the 448 // Virtual destructor because a CompilationInfoWithZone has to exit the
448 // zone scope and get rid of dependent maps even when the destructor is 449 // zone scope and get rid of dependent maps even when the destructor is
449 // called when cast as a CompilationInfo. 450 // called when cast as a CompilationInfo.
450 virtual ~CompilationInfoWithZone() { 451 virtual ~CompilationInfoWithZone() {
451 RollbackDependentMaps(); 452 RollbackDependencies();
452 } 453 }
453 454
454 private: 455 private:
455 Zone zone_; 456 Zone zone_;
456 ZoneScope zone_scope_;
457 }; 457 };
458 458
459 459
460 // A wrapper around a CompilationInfo that detaches the Handles from 460 // A wrapper around a CompilationInfo that detaches the Handles from
461 // the underlying DeferredHandleScope and stores them in info_ on 461 // the underlying DeferredHandleScope and stores them in info_ on
462 // destruction. 462 // destruction.
463 class CompilationHandleScope BASE_EMBEDDED { 463 class CompilationHandleScope BASE_EMBEDDED {
464 public: 464 public:
465 explicit CompilationHandleScope(CompilationInfo* info) 465 explicit CompilationHandleScope(CompilationInfo* info)
466 : deferred_(info->isolate()), info_(info) {} 466 : deferred_(info->isolate()), info_(info) {}
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 #ifdef ENABLE_DEBUGGER_SUPPORT 610 #ifdef ENABLE_DEBUGGER_SUPPORT
611 static bool MakeCodeForLiveEdit(CompilationInfo* info); 611 static bool MakeCodeForLiveEdit(CompilationInfo* info);
612 #endif 612 #endif
613 613
614 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, 614 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag,
615 CompilationInfo* info, 615 CompilationInfo* info,
616 Handle<SharedFunctionInfo> shared); 616 Handle<SharedFunctionInfo> shared);
617 }; 617 };
618 618
619 619
620 class CompilationPhase BASE_EMBEDDED {
621 public:
622 CompilationPhase(const char* name, CompilationInfo* info);
623 ~CompilationPhase();
624
625 protected:
626 bool ShouldProduceTraceOutput() const;
627
628 const char* name() const { return name_; }
629 CompilationInfo* info() const { return info_; }
630 Isolate* isolate() const { return info()->isolate(); }
631 Zone* zone() { return &zone_; }
632
633 private:
634 const char* name_;
635 CompilationInfo* info_;
636 Zone zone_;
637 unsigned info_zone_start_allocation_size_;
638 int64_t start_ticks_;
639
640 DISALLOW_COPY_AND_ASSIGN(CompilationPhase);
641 };
642
643
620 } } // namespace v8::internal 644 } } // namespace v8::internal
621 645
622 #endif // V8_COMPILER_H_ 646 #endif // V8_COMPILER_H_
OLDNEW
« no previous file with comments | « src/codegen.cc ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698