| 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 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1376 function.ToFullyQualifiedCString()); | 1376 function.ToFullyQualifiedCString()); |
| 1377 } | 1377 } |
| 1378 | 1378 |
| 1379 | 1379 |
| 1380 // This is called from function that needs to be optimized. | 1380 // This is called from function that needs to be optimized. |
| 1381 // The requesting function can be already optimized (reoptimization). | 1381 // The requesting function can be already optimized (reoptimization). |
| 1382 // Returns the Code object where to continue execution. | 1382 // Returns the Code object where to continue execution. |
| 1383 DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) { | 1383 DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) { |
| 1384 const Function& function = Function::CheckedHandle(arguments.ArgAt(0)); | 1384 const Function& function = Function::CheckedHandle(arguments.ArgAt(0)); |
| 1385 ASSERT(!function.IsNull()); | 1385 ASSERT(!function.IsNull()); |
| 1386 ASSERT(function.HasCode()); |
| 1386 | 1387 |
| 1387 if (CanOptimizeFunction(function, isolate)) { | 1388 if (CanOptimizeFunction(function, isolate)) { |
| 1388 const Error& error = | 1389 const Error& error = |
| 1389 Error::Handle(Compiler::CompileOptimizedFunction(function)); | 1390 Error::Handle(Compiler::CompileOptimizedFunction(function)); |
| 1390 if (!error.IsNull()) { | 1391 if (!error.IsNull()) { |
| 1391 Exceptions::PropagateError(error); | 1392 Exceptions::PropagateError(error); |
| 1392 } | 1393 } |
| 1393 const Code& optimized_code = Code::Handle(function.CurrentCode()); | 1394 const Code& optimized_code = Code::Handle(function.CurrentCode()); |
| 1394 ASSERT(!optimized_code.IsNull()); | 1395 ASSERT(!optimized_code.IsNull()); |
| 1395 // Reset usage counter for reoptimization. | 1396 // Reset usage counter for reoptimization. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1434 ASSERT(!target_code.is_optimized()); | 1435 ASSERT(!target_code.is_optimized()); |
| 1435 target_function.ReattachCode(target_code); | 1436 target_function.ReattachCode(target_code); |
| 1436 } | 1437 } |
| 1437 if (FLAG_trace_patching) { | 1438 if (FLAG_trace_patching) { |
| 1438 OS::PrintErr("FixCallersTarget: patching from %#" Px " to '%s' %#" Px "\n", | 1439 OS::PrintErr("FixCallersTarget: patching from %#" Px " to '%s' %#" Px "\n", |
| 1439 frame->pc(), | 1440 frame->pc(), |
| 1440 Function::Handle(target_code.function()).ToFullyQualifiedCString(), | 1441 Function::Handle(target_code.function()).ToFullyQualifiedCString(), |
| 1441 target_code.EntryPoint()); | 1442 target_code.EntryPoint()); |
| 1442 } | 1443 } |
| 1443 arguments.SetReturn(target_code); | 1444 arguments.SetReturn(target_code); |
| 1445 ASSERT(target_function.HasCode()); |
| 1444 } | 1446 } |
| 1445 | 1447 |
| 1446 | 1448 |
| 1447 const char* DeoptReasonToText(intptr_t deopt_id) { | 1449 const char* DeoptReasonToText(intptr_t deopt_id) { |
| 1448 switch (deopt_id) { | 1450 switch (deopt_id) { |
| 1449 #define DEOPT_REASON_ID_TO_TEXT(name) case kDeopt##name: return #name; | 1451 #define DEOPT_REASON_ID_TO_TEXT(name) case kDeopt##name: return #name; |
| 1450 DEOPT_REASONS(DEOPT_REASON_ID_TO_TEXT) | 1452 DEOPT_REASONS(DEOPT_REASON_ID_TO_TEXT) |
| 1451 #undef DEOPT_REASON_ID_TO_TEXT | 1453 #undef DEOPT_REASON_ID_TO_TEXT |
| 1452 default: | 1454 default: |
| 1453 UNREACHABLE(); | 1455 UNREACHABLE(); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1715 field.UpdateCid(cid); | 1717 field.UpdateCid(cid); |
| 1716 intptr_t list_length = Field::kNoFixedLength; | 1718 intptr_t list_length = Field::kNoFixedLength; |
| 1717 if ((field.guarded_cid() != kDynamicCid) && | 1719 if ((field.guarded_cid() != kDynamicCid) && |
| 1718 field.is_final() && RawObject::IsBuiltinListClassId(cid)) { | 1720 field.is_final() && RawObject::IsBuiltinListClassId(cid)) { |
| 1719 list_length = GetListLength(value); | 1721 list_length = GetListLength(value); |
| 1720 } | 1722 } |
| 1721 field.UpdateLength(list_length); | 1723 field.UpdateLength(list_length); |
| 1722 } | 1724 } |
| 1723 | 1725 |
| 1724 } // namespace dart | 1726 } // namespace dart |
| OLD | NEW |