| OLD | NEW |
| 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 // A helper class that calls the three compilation phases in | 420 // A helper class that calls the three compilation phases in |
| 421 // Crankshaft and keeps track of its state. The three phases | 421 // Crankshaft and keeps track of its state. The three phases |
| 422 // CreateGraph, OptimizeGraph and GenerateAndInstallCode can either | 422 // CreateGraph, OptimizeGraph and GenerateAndInstallCode can either |
| 423 // fail, bail-out to the full code generator or succeed. Apart from | 423 // fail, bail-out to the full code generator or succeed. Apart from |
| 424 // their return value, the status of the phase last run can be checked | 424 // their return value, the status of the phase last run can be checked |
| 425 // using last_status(). | 425 // using last_status(). |
| 426 class OptimizingCompiler: public ZoneObject { | 426 class OptimizingCompiler: public ZoneObject { |
| 427 public: | 427 public: |
| 428 explicit OptimizingCompiler(CompilationInfo* info) | 428 explicit OptimizingCompiler(CompilationInfo* info) |
| 429 : info_(info), | 429 : info_(info), |
| 430 oracle_(NULL), | |
| 431 graph_builder_(NULL), | 430 graph_builder_(NULL), |
| 432 graph_(NULL), | 431 graph_(NULL), |
| 433 chunk_(NULL), | 432 chunk_(NULL), |
| 434 time_taken_to_create_graph_(0), | 433 time_taken_to_create_graph_(0), |
| 435 time_taken_to_optimize_(0), | 434 time_taken_to_optimize_(0), |
| 436 time_taken_to_codegen_(0), | 435 time_taken_to_codegen_(0), |
| 437 last_status_(FAILED) { } | 436 last_status_(FAILED) { } |
| 438 | 437 |
| 439 enum Status { | 438 enum Status { |
| 440 FAILED, BAILED_OUT, SUCCEEDED | 439 FAILED, BAILED_OUT, SUCCEEDED |
| 441 }; | 440 }; |
| 442 | 441 |
| 443 MUST_USE_RESULT Status CreateGraph(); | 442 MUST_USE_RESULT Status CreateGraph(); |
| 444 MUST_USE_RESULT Status OptimizeGraph(); | 443 MUST_USE_RESULT Status OptimizeGraph(); |
| 445 MUST_USE_RESULT Status GenerateAndInstallCode(); | 444 MUST_USE_RESULT Status GenerateAndInstallCode(); |
| 446 | 445 |
| 447 Status last_status() const { return last_status_; } | 446 Status last_status() const { return last_status_; } |
| 448 CompilationInfo* info() const { return info_; } | 447 CompilationInfo* info() const { return info_; } |
| 449 Isolate* isolate() const { return info()->isolate(); } | 448 Isolate* isolate() const { return info()->isolate(); } |
| 450 | 449 |
| 451 MUST_USE_RESULT Status AbortOptimization() { | 450 MUST_USE_RESULT Status AbortOptimization() { |
| 452 info_->AbortOptimization(); | 451 info_->AbortOptimization(); |
| 453 info_->shared_info()->DisableOptimization(info_->bailout_reason()); | 452 info_->shared_info()->DisableOptimization(info_->bailout_reason()); |
| 454 return SetLastStatus(BAILED_OUT); | 453 return SetLastStatus(BAILED_OUT); |
| 455 } | 454 } |
| 456 | 455 |
| 457 private: | 456 private: |
| 458 CompilationInfo* info_; | 457 CompilationInfo* info_; |
| 459 TypeFeedbackOracle* oracle_; | |
| 460 HOptimizedGraphBuilder* graph_builder_; | 458 HOptimizedGraphBuilder* graph_builder_; |
| 461 HGraph* graph_; | 459 HGraph* graph_; |
| 462 LChunk* chunk_; | 460 LChunk* chunk_; |
| 463 int64_t time_taken_to_create_graph_; | 461 int64_t time_taken_to_create_graph_; |
| 464 int64_t time_taken_to_optimize_; | 462 int64_t time_taken_to_optimize_; |
| 465 int64_t time_taken_to_codegen_; | 463 int64_t time_taken_to_codegen_; |
| 466 Status last_status_; | 464 Status last_status_; |
| 467 | 465 |
| 468 MUST_USE_RESULT Status SetLastStatus(Status status) { | 466 MUST_USE_RESULT Status SetLastStatus(Status status) { |
| 469 last_status_ = status; | 467 last_status_ = status; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 | 552 |
| 555 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, | 553 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, |
| 556 CompilationInfo* info, | 554 CompilationInfo* info, |
| 557 Handle<SharedFunctionInfo> shared); | 555 Handle<SharedFunctionInfo> shared); |
| 558 }; | 556 }; |
| 559 | 557 |
| 560 | 558 |
| 561 } } // namespace v8::internal | 559 } } // namespace v8::internal |
| 562 | 560 |
| 563 #endif // V8_COMPILER_H_ | 561 #endif // V8_COMPILER_H_ |
| OLD | NEW |