OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); | 624 function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); |
625 function_info->set_ast_node_count(lit->ast_node_count()); | 625 function_info->set_ast_node_count(lit->ast_node_count()); |
626 function_info->set_is_function(lit->is_function()); | 626 function_info->set_is_function(lit->is_function()); |
627 function_info->set_bailout_reason(lit->dont_optimize_reason()); | 627 function_info->set_bailout_reason(lit->dont_optimize_reason()); |
628 function_info->set_dont_cache(lit->flags()->Contains(kDontCache)); | 628 function_info->set_dont_cache(lit->flags()->Contains(kDontCache)); |
629 function_info->set_is_generator(lit->is_generator()); | 629 function_info->set_is_generator(lit->is_generator()); |
630 } | 630 } |
631 | 631 |
632 | 632 |
633 static bool CompileUnoptimizedCode(CompilationInfo* info) { | 633 static bool CompileUnoptimizedCode(CompilationInfo* info) { |
| 634 ASSERT(AllowCompilation::IsAllowed(info->isolate())); |
634 ASSERT(info->function() != NULL); | 635 ASSERT(info->function() != NULL); |
635 if (!Rewriter::Rewrite(info)) return false; | 636 if (!Rewriter::Rewrite(info)) return false; |
636 if (!Scope::Analyze(info)) return false; | 637 if (!Scope::Analyze(info)) return false; |
637 ASSERT(info->scope() != NULL); | 638 ASSERT(info->scope() != NULL); |
638 | 639 |
639 if (!FullCodeGenerator::MakeCode(info)) { | 640 if (!FullCodeGenerator::MakeCode(info)) { |
640 Isolate* isolate = info->isolate(); | 641 Isolate* isolate = info->isolate(); |
641 if (!isolate->has_pending_exception()) isolate->StackOverflow(); | 642 if (!isolate->has_pending_exception()) isolate->StackOverflow(); |
642 return false; | 643 return false; |
643 } | 644 } |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 ConcurrencyMode mode, | 1190 ConcurrencyMode mode, |
1190 BailoutId osr_ast_id) { | 1191 BailoutId osr_ast_id) { |
1191 Handle<Code> cached_code; | 1192 Handle<Code> cached_code; |
1192 if (GetCodeFromOptimizedCodeMap( | 1193 if (GetCodeFromOptimizedCodeMap( |
1193 function, osr_ast_id).ToHandle(&cached_code)) { | 1194 function, osr_ast_id).ToHandle(&cached_code)) { |
1194 return cached_code; | 1195 return cached_code; |
1195 } | 1196 } |
1196 | 1197 |
1197 SmartPointer<CompilationInfo> info(new CompilationInfoWithZone(function)); | 1198 SmartPointer<CompilationInfo> info(new CompilationInfoWithZone(function)); |
1198 Isolate* isolate = info->isolate(); | 1199 Isolate* isolate = info->isolate(); |
| 1200 ASSERT(AllowCompilation::IsAllowed(isolate)); |
1199 VMState<COMPILER> state(isolate); | 1201 VMState<COMPILER> state(isolate); |
1200 ASSERT(!isolate->has_pending_exception()); | 1202 ASSERT(!isolate->has_pending_exception()); |
1201 PostponeInterruptsScope postpone(isolate); | 1203 PostponeInterruptsScope postpone(isolate); |
1202 | 1204 |
1203 Handle<SharedFunctionInfo> shared = info->shared_info(); | 1205 Handle<SharedFunctionInfo> shared = info->shared_info(); |
1204 ASSERT_NE(ScopeInfo::Empty(isolate), shared->scope_info()); | 1206 ASSERT_NE(ScopeInfo::Empty(isolate), shared->scope_info()); |
1205 int compiled_size = shared->end_position() - shared->start_position(); | 1207 int compiled_size = shared->end_position() - shared->start_position(); |
1206 isolate->counters()->total_compile_size()->Increment(compiled_size); | 1208 isolate->counters()->total_compile_size()->Increment(compiled_size); |
1207 current_code->set_profiler_ticks(0); | 1209 current_code->set_profiler_ticks(0); |
1208 | 1210 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1335 AllowHandleDereference allow_deref; | 1337 AllowHandleDereference allow_deref; |
1336 bool tracing_on = info()->IsStub() | 1338 bool tracing_on = info()->IsStub() |
1337 ? FLAG_trace_hydrogen_stubs | 1339 ? FLAG_trace_hydrogen_stubs |
1338 : (FLAG_trace_hydrogen && | 1340 : (FLAG_trace_hydrogen && |
1339 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1341 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
1340 return (tracing_on && | 1342 return (tracing_on && |
1341 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1343 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
1342 } | 1344 } |
1343 | 1345 |
1344 } } // namespace v8::internal | 1346 } } // namespace v8::internal |
OLD | NEW |