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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 222 |
223 // Accessors for the different compilation modes. | 223 // Accessors for the different compilation modes. |
224 bool IsOptimizing() const { return mode_ == OPTIMIZE; } | 224 bool IsOptimizing() const { return mode_ == OPTIMIZE; } |
225 bool IsOptimizable() const { return mode_ == BASE; } | 225 bool IsOptimizable() const { return mode_ == BASE; } |
226 bool IsStub() const { return mode_ == STUB; } | 226 bool IsStub() const { return mode_ == STUB; } |
227 void SetOptimizing(BailoutId osr_ast_id, Handle<Code> unoptimized) { | 227 void SetOptimizing(BailoutId osr_ast_id, Handle<Code> unoptimized) { |
228 ASSERT(!shared_info_.is_null()); | 228 ASSERT(!shared_info_.is_null()); |
229 SetMode(OPTIMIZE); | 229 SetMode(OPTIMIZE); |
230 osr_ast_id_ = osr_ast_id; | 230 osr_ast_id_ = osr_ast_id; |
231 unoptimized_code_ = unoptimized; | 231 unoptimized_code_ = unoptimized; |
| 232 optimization_id_ = isolate()->NextOptimizationId(); |
232 } | 233 } |
233 void DisableOptimization(); | 234 void DisableOptimization(); |
234 | 235 |
235 // Deoptimization support. | 236 // Deoptimization support. |
236 bool HasDeoptimizationSupport() const { | 237 bool HasDeoptimizationSupport() const { |
237 return SupportsDeoptimization::decode(flags_); | 238 return SupportsDeoptimization::decode(flags_); |
238 } | 239 } |
239 void EnableDeoptimizationSupport() { | 240 void EnableDeoptimizationSupport() { |
240 ASSERT(IsOptimizable()); | 241 ASSERT(IsOptimizable()); |
241 flags_ |= SupportsDeoptimization::encode(true); | 242 flags_ |= SupportsDeoptimization::encode(true); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 311 |
311 bool HasAbortedDueToDependencyChange() { | 312 bool HasAbortedDueToDependencyChange() { |
312 ASSERT(!OptimizingCompilerThread::IsOptimizerThread(isolate())); | 313 ASSERT(!OptimizingCompilerThread::IsOptimizerThread(isolate())); |
313 return abort_due_to_dependency_; | 314 return abort_due_to_dependency_; |
314 } | 315 } |
315 | 316 |
316 bool HasSameOsrEntry(Handle<JSFunction> function, BailoutId osr_ast_id) { | 317 bool HasSameOsrEntry(Handle<JSFunction> function, BailoutId osr_ast_id) { |
317 return osr_ast_id_ == osr_ast_id && function.is_identical_to(closure_); | 318 return osr_ast_id_ == osr_ast_id && function.is_identical_to(closure_); |
318 } | 319 } |
319 | 320 |
| 321 int optimization_id() const { return optimization_id_; } |
| 322 |
320 protected: | 323 protected: |
321 CompilationInfo(Handle<Script> script, | 324 CompilationInfo(Handle<Script> script, |
322 Zone* zone); | 325 Zone* zone); |
323 CompilationInfo(Handle<SharedFunctionInfo> shared_info, | 326 CompilationInfo(Handle<SharedFunctionInfo> shared_info, |
324 Zone* zone); | 327 Zone* zone); |
325 CompilationInfo(HydrogenCodeStub* stub, | 328 CompilationInfo(HydrogenCodeStub* stub, |
326 Isolate* isolate, | 329 Isolate* isolate, |
327 Zone* zone); | 330 Zone* zone); |
328 | 331 |
329 private: | 332 private: |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 // during graph optimization. | 448 // during graph optimization. |
446 int opt_count_; | 449 int opt_count_; |
447 | 450 |
448 // Number of parameters used for compilation of stubs that require arguments. | 451 // Number of parameters used for compilation of stubs that require arguments. |
449 int parameter_count_; | 452 int parameter_count_; |
450 | 453 |
451 bool this_has_uses_; | 454 bool this_has_uses_; |
452 | 455 |
453 Handle<Foreign> object_wrapper_; | 456 Handle<Foreign> object_wrapper_; |
454 | 457 |
| 458 int optimization_id_; |
| 459 |
455 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); | 460 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); |
456 }; | 461 }; |
457 | 462 |
458 | 463 |
459 // Exactly like a CompilationInfo, except also creates and enters a | 464 // Exactly like a CompilationInfo, except also creates and enters a |
460 // Zone on construction and deallocates it on exit. | 465 // Zone on construction and deallocates it on exit. |
461 class CompilationInfoWithZone: public CompilationInfo { | 466 class CompilationInfoWithZone: public CompilationInfo { |
462 public: | 467 public: |
463 explicit CompilationInfoWithZone(Handle<Script> script) | 468 explicit CompilationInfoWithZone(Handle<Script> script) |
464 : CompilationInfo(script, &zone_), | 469 : CompilationInfo(script, &zone_), |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 unsigned info_zone_start_allocation_size_; | 681 unsigned info_zone_start_allocation_size_; |
677 ElapsedTimer timer_; | 682 ElapsedTimer timer_; |
678 | 683 |
679 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 684 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
680 }; | 685 }; |
681 | 686 |
682 | 687 |
683 } } // namespace v8::internal | 688 } } // namespace v8::internal |
684 | 689 |
685 #endif // V8_COMPILER_H_ | 690 #endif // V8_COMPILER_H_ |
OLD | NEW |