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

Side by Side Diff: src/compiler.h

Issue 153953005: A64: Synchronize with r16993. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/builtins.h ('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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 Scope* global_scope() const { return global_scope_; } 79 Scope* global_scope() const { return global_scope_; }
80 Handle<Code> code() const { return code_; } 80 Handle<Code> code() const { return code_; }
81 Handle<JSFunction> closure() const { return closure_; } 81 Handle<JSFunction> closure() const { return closure_; }
82 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } 82 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
83 Handle<Script> script() const { return script_; } 83 Handle<Script> script() const { return script_; }
84 HydrogenCodeStub* code_stub() const {return code_stub_; } 84 HydrogenCodeStub* code_stub() const {return code_stub_; }
85 v8::Extension* extension() const { return extension_; } 85 v8::Extension* extension() const { return extension_; }
86 ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; } 86 ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; }
87 Handle<Context> context() const { return context_; } 87 Handle<Context> context() const { return context_; }
88 BailoutId osr_ast_id() const { return osr_ast_id_; } 88 BailoutId osr_ast_id() const { return osr_ast_id_; }
89 uint32_t osr_pc_offset() const { return osr_pc_offset_; }
89 int opt_count() const { return opt_count_; } 90 int opt_count() const { return opt_count_; }
90 int num_parameters() const; 91 int num_parameters() const;
91 int num_heap_slots() const; 92 int num_heap_slots() const;
92 Code::Flags flags() const; 93 Code::Flags flags() const;
93 94
94 void MarkAsEval() { 95 void MarkAsEval() {
95 ASSERT(!is_lazy()); 96 ASSERT(!is_lazy());
96 flags_ |= IsEval::encode(true); 97 flags_ |= IsEval::encode(true);
97 } 98 }
98 void MarkAsGlobal() { 99 void MarkAsGlobal() {
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 class HGraph; 499 class HGraph;
499 class HOptimizedGraphBuilder; 500 class HOptimizedGraphBuilder;
500 class LChunk; 501 class LChunk;
501 502
502 // A helper class that calls the three compilation phases in 503 // A helper class that calls the three compilation phases in
503 // Crankshaft and keeps track of its state. The three phases 504 // Crankshaft and keeps track of its state. The three phases
504 // CreateGraph, OptimizeGraph and GenerateAndInstallCode can either 505 // CreateGraph, OptimizeGraph and GenerateAndInstallCode can either
505 // fail, bail-out to the full code generator or succeed. Apart from 506 // fail, bail-out to the full code generator or succeed. Apart from
506 // their return value, the status of the phase last run can be checked 507 // their return value, the status of the phase last run can be checked
507 // using last_status(). 508 // using last_status().
508 class OptimizingCompiler: public ZoneObject { 509 class RecompileJob: public ZoneObject {
509 public: 510 public:
510 explicit OptimizingCompiler(CompilationInfo* info) 511 explicit RecompileJob(CompilationInfo* info)
511 : info_(info), 512 : info_(info),
512 graph_builder_(NULL), 513 graph_builder_(NULL),
513 graph_(NULL), 514 graph_(NULL),
514 chunk_(NULL), 515 chunk_(NULL),
515 last_status_(FAILED) { } 516 last_status_(FAILED) { }
516 517
517 enum Status { 518 enum Status {
518 FAILED, BAILED_OUT, SUCCEEDED 519 FAILED, BAILED_OUT, SUCCEEDED
519 }; 520 };
520 521
521 MUST_USE_RESULT Status CreateGraph(); 522 MUST_USE_RESULT Status CreateGraph();
522 MUST_USE_RESULT Status OptimizeGraph(); 523 MUST_USE_RESULT Status OptimizeGraph();
523 MUST_USE_RESULT Status GenerateAndInstallCode(); 524 MUST_USE_RESULT Status GenerateAndInstallCode();
524 525
525 Status last_status() const { return last_status_; } 526 Status last_status() const { return last_status_; }
526 CompilationInfo* info() const { return info_; } 527 CompilationInfo* info() const { return info_; }
527 Isolate* isolate() const { return info()->isolate(); } 528 Isolate* isolate() const { return info()->isolate(); }
528 529
529 MUST_USE_RESULT Status AbortOptimization() { 530 MUST_USE_RESULT Status AbortOptimization() {
530 info_->AbortOptimization(); 531 info_->AbortOptimization();
531 info_->shared_info()->DisableOptimization(info_->bailout_reason()); 532 info_->shared_info()->DisableOptimization(info_->bailout_reason());
532 return SetLastStatus(BAILED_OUT); 533 return SetLastStatus(BAILED_OUT);
533 } 534 }
534 535
536 void WaitForInstall() {
537 ASSERT(info_->is_osr());
538 awaiting_install_ = true;
539 }
540
541 bool IsWaitingForInstall() { return awaiting_install_; }
542
535 private: 543 private:
536 CompilationInfo* info_; 544 CompilationInfo* info_;
537 HOptimizedGraphBuilder* graph_builder_; 545 HOptimizedGraphBuilder* graph_builder_;
538 HGraph* graph_; 546 HGraph* graph_;
539 LChunk* chunk_; 547 LChunk* chunk_;
540 TimeDelta time_taken_to_create_graph_; 548 TimeDelta time_taken_to_create_graph_;
541 TimeDelta time_taken_to_optimize_; 549 TimeDelta time_taken_to_optimize_;
542 TimeDelta time_taken_to_codegen_; 550 TimeDelta time_taken_to_codegen_;
543 Status last_status_; 551 Status last_status_;
552 bool awaiting_install_;
544 553
545 MUST_USE_RESULT Status SetLastStatus(Status status) { 554 MUST_USE_RESULT Status SetLastStatus(Status status) {
546 last_status_ = status; 555 last_status_ = status;
547 return last_status_; 556 return last_status_;
548 } 557 }
549 void RecordOptimizationStats(); 558 void RecordOptimizationStats();
550 559
551 struct Timer { 560 struct Timer {
552 Timer(OptimizingCompiler* compiler, TimeDelta* location) 561 Timer(RecompileJob* job, TimeDelta* location)
553 : compiler_(compiler), 562 : job_(job), location_(location) {
554 location_(location) {
555 ASSERT(location_ != NULL); 563 ASSERT(location_ != NULL);
556 timer_.Start(); 564 timer_.Start();
557 } 565 }
558 566
559 ~Timer() { 567 ~Timer() {
560 *location_ += timer_.Elapsed(); 568 *location_ += timer_.Elapsed();
561 } 569 }
562 570
563 OptimizingCompiler* compiler_; 571 RecompileJob* job_;
564 ElapsedTimer timer_; 572 ElapsedTimer timer_;
565 TimeDelta* location_; 573 TimeDelta* location_;
566 }; 574 };
567 }; 575 };
568 576
569 577
570 // The V8 compiler 578 // The V8 compiler
571 // 579 //
572 // General strategy: Source code is translated into an anonymous function w/o 580 // General strategy: Source code is translated into an anonymous function w/o
573 // parameters which then can be executed. If the source code contains other 581 // parameters which then can be executed. If the source code contains other
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 // compiled). 626 // compiled).
619 static Handle<SharedFunctionInfo> BuildFunctionInfo(FunctionLiteral* node, 627 static Handle<SharedFunctionInfo> BuildFunctionInfo(FunctionLiteral* node,
620 Handle<Script> script); 628 Handle<Script> script);
621 629
622 // Set the function info for a newly compiled function. 630 // Set the function info for a newly compiled function.
623 static void SetFunctionInfo(Handle<SharedFunctionInfo> function_info, 631 static void SetFunctionInfo(Handle<SharedFunctionInfo> function_info,
624 FunctionLiteral* lit, 632 FunctionLiteral* lit,
625 bool is_toplevel, 633 bool is_toplevel,
626 Handle<Script> script); 634 Handle<Script> script);
627 635
628 static Handle<Code> InstallOptimizedCode(OptimizingCompiler* info); 636 static Handle<Code> InstallOptimizedCode(RecompileJob* job);
629 637
630 #ifdef ENABLE_DEBUGGER_SUPPORT 638 #ifdef ENABLE_DEBUGGER_SUPPORT
631 static bool MakeCodeForLiveEdit(CompilationInfo* info); 639 static bool MakeCodeForLiveEdit(CompilationInfo* info);
632 #endif 640 #endif
633 641
634 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, 642 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag,
635 CompilationInfo* info, 643 CompilationInfo* info,
636 Handle<SharedFunctionInfo> shared); 644 Handle<SharedFunctionInfo> shared);
637 }; 645 };
638 646
(...skipping 18 matching lines...) Expand all
657 unsigned info_zone_start_allocation_size_; 665 unsigned info_zone_start_allocation_size_;
658 ElapsedTimer timer_; 666 ElapsedTimer timer_;
659 667
660 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); 668 DISALLOW_COPY_AND_ASSIGN(CompilationPhase);
661 }; 669 };
662 670
663 671
664 } } // namespace v8::internal 672 } } // namespace v8::internal
665 673
666 #endif // V8_COMPILER_H_ 674 #endif // V8_COMPILER_H_
OLDNEW
« no previous file with comments | « src/builtins.h ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698