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