| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 | 52 |
| 53 CompilationInfo::CompilationInfo(Handle<Script> script) | 53 CompilationInfo::CompilationInfo(Handle<Script> script) |
| 54 : isolate_(script->GetIsolate()), | 54 : isolate_(script->GetIsolate()), |
| 55 flags_(0), | 55 flags_(0), |
| 56 function_(NULL), | 56 function_(NULL), |
| 57 scope_(NULL), | 57 scope_(NULL), |
| 58 script_(script), | 58 script_(script), |
| 59 extension_(NULL), | 59 extension_(NULL), |
| 60 pre_parse_data_(NULL), | 60 pre_parse_data_(NULL), |
| 61 supports_deoptimization_(false), |
| 61 osr_ast_id_(AstNode::kNoNumber) { | 62 osr_ast_id_(AstNode::kNoNumber) { |
| 62 Initialize(NONOPT); | 63 Initialize(NONOPT); |
| 63 } | 64 } |
| 64 | 65 |
| 65 | 66 |
| 66 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info) | 67 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info) |
| 67 : isolate_(shared_info->GetIsolate()), | 68 : isolate_(shared_info->GetIsolate()), |
| 68 flags_(IsLazy::encode(true)), | 69 flags_(IsLazy::encode(true)), |
| 69 function_(NULL), | 70 function_(NULL), |
| 70 scope_(NULL), | 71 scope_(NULL), |
| 71 shared_info_(shared_info), | 72 shared_info_(shared_info), |
| 72 script_(Handle<Script>(Script::cast(shared_info->script()))), | 73 script_(Handle<Script>(Script::cast(shared_info->script()))), |
| 73 extension_(NULL), | 74 extension_(NULL), |
| 74 pre_parse_data_(NULL), | 75 pre_parse_data_(NULL), |
| 76 supports_deoptimization_(false), |
| 75 osr_ast_id_(AstNode::kNoNumber) { | 77 osr_ast_id_(AstNode::kNoNumber) { |
| 76 Initialize(BASE); | 78 Initialize(BASE); |
| 77 } | 79 } |
| 78 | 80 |
| 79 | 81 |
| 80 CompilationInfo::CompilationInfo(Handle<JSFunction> closure) | 82 CompilationInfo::CompilationInfo(Handle<JSFunction> closure) |
| 81 : isolate_(closure->GetIsolate()), | 83 : isolate_(closure->GetIsolate()), |
| 82 flags_(IsLazy::encode(true)), | 84 flags_(IsLazy::encode(true)), |
| 83 function_(NULL), | 85 function_(NULL), |
| 84 scope_(NULL), | 86 scope_(NULL), |
| 85 closure_(closure), | 87 closure_(closure), |
| 86 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), | 88 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), |
| 87 script_(Handle<Script>(Script::cast(shared_info_->script()))), | 89 script_(Handle<Script>(Script::cast(shared_info_->script()))), |
| 88 extension_(NULL), | 90 extension_(NULL), |
| 89 pre_parse_data_(NULL), | 91 pre_parse_data_(NULL), |
| 92 supports_deoptimization_(false), |
| 90 osr_ast_id_(AstNode::kNoNumber) { | 93 osr_ast_id_(AstNode::kNoNumber) { |
| 91 Initialize(BASE); | 94 Initialize(BASE); |
| 92 } | 95 } |
| 93 | 96 |
| 94 | 97 |
| 95 // Disable optimization for the rest of the compilation pipeline. | 98 // Disable optimization for the rest of the compilation pipeline. |
| 96 void CompilationInfo::DisableOptimization() { | 99 void CompilationInfo::DisableOptimization() { |
| 97 bool is_optimizable_closure = | 100 bool is_optimizable_closure = |
| 98 FLAG_optimize_closures && | 101 FLAG_optimize_closures && |
| 99 closure_.is_null() && | 102 closure_.is_null() && |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 Handle<JSFunction> closure = info->closure(); | 301 Handle<JSFunction> closure = info->closure(); |
| 299 info->shared_info()->DisableOptimization(*closure); | 302 info->shared_info()->DisableOptimization(*closure); |
| 300 } | 303 } |
| 301 // True indicates the compilation pipeline is still going, not necessarily | 304 // True indicates the compilation pipeline is still going, not necessarily |
| 302 // that we optimized the code. | 305 // that we optimized the code. |
| 303 return true; | 306 return true; |
| 304 } | 307 } |
| 305 | 308 |
| 306 | 309 |
| 307 static bool GenerateCode(CompilationInfo* info) { | 310 static bool GenerateCode(CompilationInfo* info) { |
| 308 return info->IsCompilingForDebugging() || !V8::UseCrankshaft() ? | 311 return V8::UseCrankshaft() ? |
| 309 FullCodeGenerator::MakeCode(info) : | 312 MakeCrankshaftCode(info) : |
| 310 MakeCrankshaftCode(info); | 313 FullCodeGenerator::MakeCode(info); |
| 311 } | 314 } |
| 312 | 315 |
| 313 | 316 |
| 314 static bool MakeCode(CompilationInfo* info) { | 317 static bool MakeCode(CompilationInfo* info) { |
| 315 // Precondition: code has been parsed. Postcondition: the code field in | 318 // Precondition: code has been parsed. Postcondition: the code field in |
| 316 // the compilation info is set if compilation succeeded. | 319 // the compilation info is set if compilation succeeded. |
| 317 ASSERT(info->function() != NULL); | 320 ASSERT(info->function() != NULL); |
| 318 return Rewriter::Rewrite(info) && Scope::Analyze(info) && GenerateCode(info); | 321 return Rewriter::Rewrite(info) && Scope::Analyze(info) && GenerateCode(info); |
| 319 } | 322 } |
| 320 | 323 |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 } | 789 } |
| 787 } | 790 } |
| 788 | 791 |
| 789 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 792 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
| 790 Handle<Script>(info->script()), | 793 Handle<Script>(info->script()), |
| 791 Handle<Code>(info->code()), | 794 Handle<Code>(info->code()), |
| 792 info)); | 795 info)); |
| 793 } | 796 } |
| 794 | 797 |
| 795 } } // namespace v8::internal | 798 } } // namespace v8::internal |
| OLD | NEW |