 Chromium Code Reviews
 Chromium Code Reviews Issue 543643002:
  Fix %OptimizeFunctionOnNextCall to actually work when the function has not yet been compiled.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
    
  
    Issue 543643002:
  Fix %OptimizeFunctionOnNextCall to actually work when the function has not yet been compiled.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge| 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 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1239 } | 1239 } | 
| 1240 | 1240 | 
| 1241 SmartPointer<CompilationInfo> info(new CompilationInfoWithZone(function)); | 1241 SmartPointer<CompilationInfo> info(new CompilationInfoWithZone(function)); | 
| 1242 Isolate* isolate = info->isolate(); | 1242 Isolate* isolate = info->isolate(); | 
| 1243 DCHECK(AllowCompilation::IsAllowed(isolate)); | 1243 DCHECK(AllowCompilation::IsAllowed(isolate)); | 
| 1244 VMState<COMPILER> state(isolate); | 1244 VMState<COMPILER> state(isolate); | 
| 1245 DCHECK(!isolate->has_pending_exception()); | 1245 DCHECK(!isolate->has_pending_exception()); | 
| 1246 PostponeInterruptsScope postpone(isolate); | 1246 PostponeInterruptsScope postpone(isolate); | 
| 1247 | 1247 | 
| 1248 Handle<SharedFunctionInfo> shared = info->shared_info(); | 1248 Handle<SharedFunctionInfo> shared = info->shared_info(); | 
| 1249 DCHECK_NE(ScopeInfo::Empty(isolate), shared->scope_info()); | 1249 if (ScopeInfo::Empty(isolate) == shared->scope_info()) { | 
| 1250 // The function was never compiled. Compile it unoptimized first. | |
| 1251 CompilationInfoWithZone nested(function); | |
| 
Yang
2014/09/04 09:07:18
at this point, if deopt support is not enabled, we
 | |
| 1252 if (!GetUnoptimizedCodeCommon(&nested).ToHandle(¤t_code)) { | |
| 1253 return MaybeHandle<Code>(); | |
| 1254 } | |
| 1255 } | |
| 1250 int compiled_size = shared->end_position() - shared->start_position(); | 1256 int compiled_size = shared->end_position() - shared->start_position(); | 
| 1251 isolate->counters()->total_compile_size()->Increment(compiled_size); | 1257 isolate->counters()->total_compile_size()->Increment(compiled_size); | 
| 1252 current_code->set_profiler_ticks(0); | 1258 current_code->set_profiler_ticks(0); | 
| 1253 | 1259 | 
| 1254 info->SetOptimizing(osr_ast_id, current_code); | 1260 info->SetOptimizing(osr_ast_id, current_code); | 
| 1255 | 1261 | 
| 1256 if (mode == CONCURRENT) { | 1262 if (mode == CONCURRENT) { | 
| 1257 if (GetOptimizedCodeLater(info.get())) { | 1263 if (GetOptimizedCodeLater(info.get())) { | 
| 1258 info.Detach(); // The background recompile job owns this now. | 1264 info.Detach(); // The background recompile job owns this now. | 
| 1259 return isolate->builtins()->InOptimizationQueue(); | 1265 return isolate->builtins()->InOptimizationQueue(); | 
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1379 AllowHandleDereference allow_deref; | 1385 AllowHandleDereference allow_deref; | 
| 1380 bool tracing_on = info()->IsStub() | 1386 bool tracing_on = info()->IsStub() | 
| 1381 ? FLAG_trace_hydrogen_stubs | 1387 ? FLAG_trace_hydrogen_stubs | 
| 1382 : (FLAG_trace_hydrogen && | 1388 : (FLAG_trace_hydrogen && | 
| 1383 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1389 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 
| 1384 return (tracing_on && | 1390 return (tracing_on && | 
| 1385 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1391 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 
| 1386 } | 1392 } | 
| 1387 | 1393 | 
| 1388 } } // namespace v8::internal | 1394 } } // namespace v8::internal | 
| OLD | NEW |