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