| 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/compiler.h" | 5 #include "src/compiler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "src/asmjs/asm-js.h" | 10 #include "src/asmjs/asm-js.h" |
| (...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1385 // free as much as possible, since some code expects the old shared function | 1385 // free as much as possible, since some code expects the old shared function |
| 1386 // infos to stick around. | 1386 // infos to stick around. |
| 1387 script->set_shared_function_infos(*old_function_infos); | 1387 script->set_shared_function_infos(*old_function_infos); |
| 1388 | 1388 |
| 1389 return infos; | 1389 return infos; |
| 1390 } | 1390 } |
| 1391 | 1391 |
| 1392 bool Compiler::EnsureBytecode(CompilationInfo* info) { | 1392 bool Compiler::EnsureBytecode(CompilationInfo* info) { |
| 1393 DCHECK(ShouldUseIgnition(info)); | 1393 DCHECK(ShouldUseIgnition(info)); |
| 1394 if (!info->shared_info()->HasBytecodeArray()) { | 1394 if (!info->shared_info()->HasBytecodeArray()) { |
| 1395 DCHECK(!info->shared_info()->is_compiled()); | 1395 Handle<Code> original_code(info->shared_info()->code()); |
| 1396 if (GetUnoptimizedCode(info).is_null()) return false; | 1396 if (GetUnoptimizedCode(info).is_null()) return false; |
| 1397 DCHECK(info->shared_info()->is_compiled()); |
| 1398 if (original_code->kind() == Code::FUNCTION) { |
| 1399 // Generating bytecode will install the {InterpreterEntryTrampoline} as |
| 1400 // shared code on the function. To avoid an implicit tier down we restore |
| 1401 // original baseline code in case it existed beforehand. |
| 1402 info->shared_info()->ReplaceCode(*original_code); |
| 1403 } |
| 1397 } | 1404 } |
| 1398 DCHECK(info->shared_info()->HasBytecodeArray()); | 1405 DCHECK(info->shared_info()->HasBytecodeArray()); |
| 1399 return true; | 1406 return true; |
| 1400 } | 1407 } |
| 1401 | 1408 |
| 1402 // TODO(turbofan): In the future, unoptimized code with deopt support could | 1409 // TODO(turbofan): In the future, unoptimized code with deopt support could |
| 1403 // be generated lazily once deopt is triggered. | 1410 // be generated lazily once deopt is triggered. |
| 1404 bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) { | 1411 bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) { |
| 1405 DCHECK_NOT_NULL(info->literal()); | 1412 DCHECK_NOT_NULL(info->literal()); |
| 1406 DCHECK_NOT_NULL(info->scope()); | 1413 DCHECK_NOT_NULL(info->scope()); |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1970 DCHECK(shared->is_compiled()); | 1977 DCHECK(shared->is_compiled()); |
| 1971 function->set_literals(cached.literals); | 1978 function->set_literals(cached.literals); |
| 1972 } else if (shared->is_compiled()) { | 1979 } else if (shared->is_compiled()) { |
| 1973 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1980 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
| 1974 JSFunction::EnsureLiterals(function); | 1981 JSFunction::EnsureLiterals(function); |
| 1975 } | 1982 } |
| 1976 } | 1983 } |
| 1977 | 1984 |
| 1978 } // namespace internal | 1985 } // namespace internal |
| 1979 } // namespace v8 | 1986 } // namespace v8 |
| OLD | NEW |