| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/globals.h" // Needed here to get TARGET_ARCH_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| 11 #include "vm/ast_printer.h" | 11 #include "vm/ast_printer.h" |
| 12 #include "vm/il_printer.h" | 12 #include "vm/il_printer.h" |
| 13 #include "vm/locations.h" | 13 #include "vm/locations.h" |
| 14 #include "vm/object_store.h" | 14 #include "vm/object_store.h" |
| 15 #include "vm/parser.h" | 15 #include "vm/parser.h" |
| 16 #include "vm/stub_code.h" | 16 #include "vm/stub_code.h" |
| 17 #include "vm/symbols.h" | 17 #include "vm/symbols.h" |
| 18 | 18 |
| 19 namespace dart { | 19 namespace dart { |
| 20 | 20 |
| 21 DECLARE_FLAG(bool, print_ast); | 21 DECLARE_FLAG(bool, print_ast); |
| 22 DECLARE_FLAG(bool, print_scopes); | 22 DECLARE_FLAG(bool, print_scopes); |
| 23 DECLARE_FLAG(bool, trace_functions); | |
| 24 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); | 23 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); |
| 25 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); | 24 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); |
| 26 | 25 |
| 27 | 26 |
| 28 FieldAddress FlowGraphCompiler::ElementAddressForRegIndex(intptr_t cid, | 27 FieldAddress FlowGraphCompiler::ElementAddressForRegIndex(intptr_t cid, |
| 29 Register array, | 28 Register array, |
| 30 Register index) { | 29 Register index) { |
| 31 // Note that index is Smi, i.e, times 2. | 30 // Note that index is Smi, i.e, times 2. |
| 32 ASSERT(kSmiTagShift == 1); | 31 ASSERT(kSmiTagShift == 1); |
| 33 switch (cid) { | 32 switch (cid) { |
| (...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 // ECX : ic-data. | 825 // ECX : ic-data. |
| 827 // EDX : arguments descriptor array. | 826 // EDX : arguments descriptor array. |
| 828 __ call(&StubCode::CallNoSuchMethodFunctionLabel()); | 827 __ call(&StubCode::CallNoSuchMethodFunctionLabel()); |
| 829 } | 828 } |
| 830 if (is_optimizing()) { | 829 if (is_optimizing()) { |
| 831 stackmap_table_builder_->AddEntry(assembler()->CodeSize(), | 830 stackmap_table_builder_->AddEntry(assembler()->CodeSize(), |
| 832 empty_stack_bitmap, | 831 empty_stack_bitmap, |
| 833 0); // No registers. | 832 0); // No registers. |
| 834 } | 833 } |
| 835 | 834 |
| 836 if (FLAG_trace_functions) { | |
| 837 __ pushl(EAX); // Preserve result. | |
| 838 __ PushObject(Function::ZoneHandle(function.raw())); | |
| 839 // We do not use GenerateCallRuntime because of the non-standard (empty) | |
| 840 // stackmap used here. | |
| 841 __ CallRuntime(kTraceFunctionExitRuntimeEntry); | |
| 842 AddCurrentDescriptor(PcDescriptors::kOther, | |
| 843 Isolate::kNoDeoptId, | |
| 844 0); // No token position. | |
| 845 if (is_optimizing()) { | |
| 846 stackmap_table_builder_->AddEntry(assembler()->CodeSize(), | |
| 847 empty_stack_bitmap, | |
| 848 0); // No registers. | |
| 849 } | |
| 850 __ popl(EAX); // Remove argument. | |
| 851 __ popl(EAX); // Restore result. | |
| 852 } | |
| 853 __ LeaveFrame(); | 835 __ LeaveFrame(); |
| 854 __ ret(); | 836 __ ret(); |
| 855 | 837 |
| 856 __ Bind(&all_arguments_processed); | 838 __ Bind(&all_arguments_processed); |
| 857 // Nullify originally passed arguments only after they have been copied and | 839 // Nullify originally passed arguments only after they have been copied and |
| 858 // checked, otherwise noSuchMethod would not see their original values. | 840 // checked, otherwise noSuchMethod would not see their original values. |
| 859 // This step can be skipped in case we decide that formal parameters are | 841 // This step can be skipped in case we decide that formal parameters are |
| 860 // implicitly final, since garbage collecting the unmodified value is not | 842 // implicitly final, since garbage collecting the unmodified value is not |
| 861 // an issue anymore. | 843 // an issue anymore. |
| 862 | 844 |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1377 __ popl(ECX); | 1359 __ popl(ECX); |
| 1378 __ popl(EAX); | 1360 __ popl(EAX); |
| 1379 } | 1361 } |
| 1380 | 1362 |
| 1381 | 1363 |
| 1382 #undef __ | 1364 #undef __ |
| 1383 | 1365 |
| 1384 } // namespace dart | 1366 } // namespace dart |
| 1385 | 1367 |
| 1386 #endif // defined TARGET_ARCH_IA32 | 1368 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |