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 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1269 Isolate* isolate = info->isolate(); | 1269 Isolate* isolate = info->isolate(); |
1270 DCHECK(AllowCompilation::IsAllowed(isolate)); | 1270 DCHECK(AllowCompilation::IsAllowed(isolate)); |
1271 VMState<COMPILER> state(isolate); | 1271 VMState<COMPILER> state(isolate); |
1272 DCHECK(!isolate->has_pending_exception()); | 1272 DCHECK(!isolate->has_pending_exception()); |
1273 PostponeInterruptsScope postpone(isolate); | 1273 PostponeInterruptsScope postpone(isolate); |
1274 | 1274 |
1275 Handle<SharedFunctionInfo> shared = info->shared_info(); | 1275 Handle<SharedFunctionInfo> shared = info->shared_info(); |
1276 if (shared->code()->kind() != Code::FUNCTION || | 1276 if (shared->code()->kind() != Code::FUNCTION || |
1277 ScopeInfo::Empty(isolate) == shared->scope_info()) { | 1277 ScopeInfo::Empty(isolate) == shared->scope_info()) { |
1278 // The function was never compiled. Compile it unoptimized first. | 1278 // The function was never compiled. Compile it unoptimized first. |
1279 CompilationInfoWithZone nested(function); | 1279 // TODO(titzer): reuse the AST and scope info from this compile. |
| 1280 CompilationInfoWithZone nested(shared); |
1280 nested.EnableDeoptimizationSupport(); | 1281 nested.EnableDeoptimizationSupport(); |
1281 if (!GetUnoptimizedCodeCommon(&nested).ToHandle(¤t_code)) { | 1282 if (!GetUnoptimizedCodeCommon(&nested).ToHandle(¤t_code)) { |
1282 return MaybeHandle<Code>(); | 1283 return MaybeHandle<Code>(); |
1283 } | 1284 } |
1284 shared->ReplaceCode(*current_code); | 1285 shared->ReplaceCode(*current_code); |
1285 } | 1286 } |
1286 int compiled_size = shared->end_position() - shared->start_position(); | |
1287 isolate->counters()->total_compile_size()->Increment(compiled_size); | |
1288 current_code->set_profiler_ticks(0); | 1287 current_code->set_profiler_ticks(0); |
1289 | 1288 |
1290 info->SetOptimizing(osr_ast_id, current_code); | 1289 info->SetOptimizing(osr_ast_id, current_code); |
1291 | 1290 |
1292 if (mode == CONCURRENT) { | 1291 if (mode == CONCURRENT) { |
1293 if (GetOptimizedCodeLater(info.get())) { | 1292 if (GetOptimizedCodeLater(info.get())) { |
1294 info.Detach(); // The background recompile job owns this now. | 1293 info.Detach(); // The background recompile job owns this now. |
1295 return isolate->builtins()->InOptimizationQueue(); | 1294 return isolate->builtins()->InOptimizationQueue(); |
1296 } | 1295 } |
1297 } else { | 1296 } else { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1421 AllowHandleDereference allow_deref; | 1420 AllowHandleDereference allow_deref; |
1422 bool tracing_on = info()->IsStub() | 1421 bool tracing_on = info()->IsStub() |
1423 ? FLAG_trace_hydrogen_stubs | 1422 ? FLAG_trace_hydrogen_stubs |
1424 : (FLAG_trace_hydrogen && | 1423 : (FLAG_trace_hydrogen && |
1425 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1424 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
1426 return (tracing_on && | 1425 return (tracing_on && |
1427 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1426 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
1428 } | 1427 } |
1429 | 1428 |
1430 } } // namespace v8::internal | 1429 } } // namespace v8::internal |
OLD | NEW |