| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/code_generator.h" | 5 #include "vm/code_generator.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
| (...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1421 | 1421 |
| 1422 // This is called from function that needs to be optimized. | 1422 // This is called from function that needs to be optimized. |
| 1423 // The requesting function can be already optimized (reoptimization). | 1423 // The requesting function can be already optimized (reoptimization). |
| 1424 // Returns the Code object where to continue execution. | 1424 // Returns the Code object where to continue execution. |
| 1425 DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) { | 1425 DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) { |
| 1426 const Function& function = Function::CheckedHandle(arguments.ArgAt(0)); | 1426 const Function& function = Function::CheckedHandle(arguments.ArgAt(0)); |
| 1427 ASSERT(!function.IsNull()); | 1427 ASSERT(!function.IsNull()); |
| 1428 ASSERT(function.HasCode()); | 1428 ASSERT(function.HasCode()); |
| 1429 | 1429 |
| 1430 if (CanOptimizeFunction(function, isolate)) { | 1430 if (CanOptimizeFunction(function, isolate)) { |
| 1431 // Reset usage counter for reoptimization before calling optimizer to |
| 1432 // prevent recursive triggering of function optimization. |
| 1433 function.set_usage_counter(0); |
| 1431 const Error& error = | 1434 const Error& error = |
| 1432 Error::Handle(Compiler::CompileOptimizedFunction(function)); | 1435 Error::Handle(Compiler::CompileOptimizedFunction(function)); |
| 1433 if (!error.IsNull()) { | 1436 if (!error.IsNull()) { |
| 1434 Exceptions::PropagateError(error); | 1437 Exceptions::PropagateError(error); |
| 1435 } | 1438 } |
| 1436 const Code& optimized_code = Code::Handle(function.CurrentCode()); | 1439 const Code& optimized_code = Code::Handle(function.CurrentCode()); |
| 1437 ASSERT(!optimized_code.IsNull()); | 1440 ASSERT(!optimized_code.IsNull()); |
| 1438 // Reset usage counter for reoptimization. | |
| 1439 function.set_usage_counter(0); | |
| 1440 } | 1441 } |
| 1441 arguments.SetReturn(Code::Handle(function.CurrentCode())); | 1442 arguments.SetReturn(Code::Handle(function.CurrentCode())); |
| 1442 } | 1443 } |
| 1443 | 1444 |
| 1444 | 1445 |
| 1445 // The caller must be a static call in a Dart frame, or an entry frame. | 1446 // The caller must be a static call in a Dart frame, or an entry frame. |
| 1446 // Patch static call to point to valid code's entry point. | 1447 // Patch static call to point to valid code's entry point. |
| 1447 DEFINE_RUNTIME_ENTRY(FixCallersTarget, 0) { | 1448 DEFINE_RUNTIME_ENTRY(FixCallersTarget, 0) { |
| 1448 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames); | 1449 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames); |
| 1449 StackFrame* frame = iterator.NextFrame(); | 1450 StackFrame* frame = iterator.NextFrame(); |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1731 // of the given value. | 1732 // of the given value. |
| 1732 // Arg0: Field object; | 1733 // Arg0: Field object; |
| 1733 // Arg1: Value that is being stored. | 1734 // Arg1: Value that is being stored. |
| 1734 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { | 1735 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { |
| 1735 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); | 1736 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); |
| 1736 const Object& value = Object::Handle(arguments.ArgAt(1)); | 1737 const Object& value = Object::Handle(arguments.ArgAt(1)); |
| 1737 field.UpdateGuardedCidAndLength(value); | 1738 field.UpdateGuardedCidAndLength(value); |
| 1738 } | 1739 } |
| 1739 | 1740 |
| 1740 } // namespace dart | 1741 } // namespace dart |
| OLD | NEW |