| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/code_generator.h" | 8 #include "vm/code_generator.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/class_finalizer.h" | 12 #include "vm/class_finalizer.h" |
| 13 #include "vm/dart_entry.h" | 13 #include "vm/dart_entry.h" |
| 14 #include "vm/debugger.h" | 14 #include "vm/debugger.h" |
| 15 #include "vm/ic_data.h" | 15 #include "vm/ic_data.h" |
| 16 #include "vm/longjump.h" | 16 #include "vm/longjump.h" |
| 17 #include "vm/object.h" | 17 #include "vm/object.h" |
| 18 #include "vm/object_store.h" | 18 #include "vm/object_store.h" |
| 19 #include "vm/parser.h" | 19 #include "vm/parser.h" |
| 20 #include "vm/resolver.h" | 20 #include "vm/resolver.h" |
| 21 #include "vm/stub_code.h" | 21 #include "vm/stub_code.h" |
| 22 | 22 |
| 23 namespace dart { | 23 namespace dart { |
| 24 | 24 |
| 25 DEFINE_FLAG(bool, print_ast, false, "Print abstract syntax tree."); | 25 DEFINE_FLAG(bool, print_ast, false, "Print abstract syntax tree."); |
| 26 DEFINE_FLAG(bool, print_scopes, false, "Print scopes of local variables."); | 26 DEFINE_FLAG(bool, print_scopes, false, "Print scopes of local variables."); |
| 27 DEFINE_FLAG(bool, trace_functions, false, "Trace entry of each function."); | 27 DEFINE_FLAG(bool, trace_functions, false, "Trace entry of each function."); |
| 28 DEFINE_FLAG(bool, print_ic_in_optimized, false, |
| 29 "Debugging helper to identify potential performance pitfalls."); |
| 28 DEFINE_FLAG(int, optimization_invocation_threshold, 1000, | 30 DEFINE_FLAG(int, optimization_invocation_threshold, 1000, |
| 29 "number of invocations before a function is optimized, -1 means never."); | 31 "number of invocations before a function is optimized, -1 means never."); |
| 30 DECLARE_FLAG(bool, enable_type_checks); | 32 DECLARE_FLAG(bool, enable_type_checks); |
| 31 DECLARE_FLAG(bool, report_invocation_count); | 33 DECLARE_FLAG(bool, report_invocation_count); |
| 32 DECLARE_FLAG(bool, trace_compiler); | 34 DECLARE_FLAG(bool, trace_compiler); |
| 33 | 35 |
| 34 #define __ assembler_-> | 36 #define __ assembler_-> |
| 35 | 37 |
| 36 | 38 |
| 37 CodeGeneratorState::CodeGeneratorState(CodeGenerator* codegen) | 39 CodeGeneratorState::CodeGeneratorState(CodeGenerator* codegen) |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 } | 423 } |
| 422 | 424 |
| 423 | 425 |
| 424 void CodeGenerator::GenerateInstanceCall( | 426 void CodeGenerator::GenerateInstanceCall( |
| 425 intptr_t node_id, | 427 intptr_t node_id, |
| 426 intptr_t token_index, | 428 intptr_t token_index, |
| 427 const String& function_name, | 429 const String& function_name, |
| 428 int num_arguments, | 430 int num_arguments, |
| 429 const Array& optional_arguments_names, | 431 const Array& optional_arguments_names, |
| 430 intptr_t num_args_checked) { | 432 intptr_t num_args_checked) { |
| 433 if (FLAG_print_ic_in_optimized && IsOptimizing()) { |
| 434 OS::Print("Generate IC in optimized code: id %d name: '%s'\n", |
| 435 node_id, function_name.ToCString()); |
| 436 } |
| 431 ASSERT(num_args_checked > 0); // At least receiver check is necessary. | 437 ASSERT(num_args_checked > 0); // At least receiver check is necessary. |
| 432 // Set up the function name and number of arguments (including the receiver) | 438 // Set up the function name and number of arguments (including the receiver) |
| 433 // to the InstanceCall stub which will resolve the correct entrypoint for | 439 // to the InstanceCall stub which will resolve the correct entrypoint for |
| 434 // the operator and call it. | 440 // the operator and call it. |
| 435 ICData ic_data(function_name, num_args_checked); | 441 ICData ic_data(function_name, num_args_checked); |
| 436 ASSERT(ic_data.NumberOfArgumentsChecked() == num_args_checked); | 442 ASSERT(ic_data.NumberOfArgumentsChecked() == num_args_checked); |
| 437 __ LoadObject(ECX, Array::ZoneHandle(ic_data.data())); | 443 __ LoadObject(ECX, Array::ZoneHandle(ic_data.data())); |
| 438 __ LoadObject(EDX, ArgumentsDescriptor(num_arguments, | 444 __ LoadObject(EDX, ArgumentsDescriptor(num_arguments, |
| 439 optional_arguments_names)); | 445 optional_arguments_names)); |
| 440 uword label_address = 0; | 446 uword label_address = 0; |
| (...skipping 2343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2784 message_buffer, kMessageBufferSize, | 2790 message_buffer, kMessageBufferSize, |
| 2785 format, args); | 2791 format, args); |
| 2786 va_end(args); | 2792 va_end(args); |
| 2787 Isolate::Current()->long_jump_base()->Jump(1, message_buffer); | 2793 Isolate::Current()->long_jump_base()->Jump(1, message_buffer); |
| 2788 UNREACHABLE(); | 2794 UNREACHABLE(); |
| 2789 } | 2795 } |
| 2790 | 2796 |
| 2791 } // namespace dart | 2797 } // namespace dart |
| 2792 | 2798 |
| 2793 #endif // defined TARGET_ARCH_IA32 | 2799 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |