From 6cd8a79078c8d89b4f421c20e0a17e89ebe04a1f Mon Sep 17 00:00:00 2001 From: Zachary Anderson Date: Thu, 13 Jul 2017 08:08:33 -0700 Subject: [PATCH] VM: Re-format to use at most one newline between functions R=asiva@google.com Review-Url: https://codereview.chromium.org/2974233002 . --- .clang-format | 3 - runtime/bin/builtin.cc | 7 - runtime/bin/builtin.h | 1 - runtime/bin/builtin_gen_snapshot.cc | 5 +- runtime/bin/builtin_natives.cc | 7 +- runtime/bin/builtin_nolib.cc | 7 - runtime/bin/dartutils.cc | 90 -- runtime/bin/dartutils.h | 20 - runtime/bin/dfe.cc | 10 - runtime/bin/directory.cc | 34 - runtime/bin/directory.h | 3 - runtime/bin/directory_android.cc | 24 - runtime/bin/directory_fuchsia.cc | 36 +- runtime/bin/directory_linux.cc | 24 - runtime/bin/directory_macos.cc | 24 - runtime/bin/directory_test.cc | 8 - runtime/bin/directory_unsupported.cc | 10 - runtime/bin/directory_win.cc | 27 - runtime/bin/embedded_dart_io.cc | 5 +- runtime/bin/error_exit.cc | 2 +- runtime/bin/eventhandler.cc | 8 - runtime/bin/eventhandler.h | 6 - runtime/bin/eventhandler_android.cc | 22 +- runtime/bin/eventhandler_android.h | 3 - runtime/bin/eventhandler_fuchsia.cc | 27 - runtime/bin/eventhandler_linux.cc | 20 +- runtime/bin/eventhandler_linux.h | 4 - runtime/bin/eventhandler_macos.cc | 21 - runtime/bin/eventhandler_macos.h | 4 - runtime/bin/eventhandler_test.cc | 8 - runtime/bin/eventhandler_unsupported.cc | 3 - runtime/bin/eventhandler_win.cc | 95 -- runtime/bin/eventhandler_win.h | 8 - runtime/bin/extensions.cc | 5 - runtime/bin/extensions_android.cc | 5 +- runtime/bin/extensions_fuchsia.cc | 3 - runtime/bin/extensions_linux.cc | 5 +- runtime/bin/extensions_macos.cc | 5 +- runtime/bin/extensions_win.cc | 3 - runtime/bin/fdutils_android.cc | 8 - runtime/bin/fdutils_fuchsia.cc | 8 - runtime/bin/fdutils_linux.cc | 8 - runtime/bin/fdutils_macos.cc | 8 - runtime/bin/file.cc | 71 - runtime/bin/file_android.cc | 42 - runtime/bin/file_fuchsia.cc | 42 - runtime/bin/file_linux.cc | 42 - runtime/bin/file_macos.cc | 42 - runtime/bin/file_support.cc | 6 - runtime/bin/file_system_watcher.cc | 6 - runtime/bin/file_system_watcher_android.cc | 14 +- runtime/bin/file_system_watcher_fuchsia.cc | 6 - runtime/bin/file_system_watcher_linux.cc | 14 +- runtime/bin/file_system_watcher_macos.cc | 17 +- .../bin/file_system_watcher_unsupported.cc | 6 - runtime/bin/file_system_watcher_win.cc | 13 +- runtime/bin/file_test.cc | 3 - runtime/bin/file_unsupported.cc | 35 - runtime/bin/file_win.cc | 45 +- runtime/bin/filter.cc | 15 - runtime/bin/filter_unsupported.cc | 3 - runtime/bin/gen_snapshot.cc | 64 +- runtime/bin/hashmap_test.cc | 7 +- runtime/bin/io_buffer.cc | 1 - runtime/bin/io_natives.cc | 2 - runtime/bin/io_service.cc | 2 - runtime/bin/io_service_no_ssl.cc | 2 - runtime/bin/isolate_data.cc | 2 - runtime/bin/loader.cc | 61 +- runtime/bin/loader.h | 2 +- runtime/bin/lockers.h | 1 - runtime/bin/main.cc | 75 +- runtime/bin/platform.cc | 9 - runtime/bin/platform_android.cc | 10 - runtime/bin/platform_fuchsia.cc | 10 - runtime/bin/platform_linux.cc | 11 - runtime/bin/platform_macos.cc | 13 - runtime/bin/platform_unsupported.cc | 9 - runtime/bin/platform_win.cc | 10 - runtime/bin/process.cc | 17 - runtime/bin/process.h | 5 - runtime/bin/process_android.cc | 36 - runtime/bin/process_fuchsia.cc | 9 - runtime/bin/process_linux.cc | 52 +- runtime/bin/process_macos.cc | 53 +- runtime/bin/process_unsupported.cc | 13 - runtime/bin/process_win.cc | 35 +- runtime/bin/run_vm_tests.cc | 7 - runtime/bin/secure_socket_filter.cc | 32 - runtime/bin/secure_socket_unsupported.cc | 25 - runtime/bin/secure_socket_utils.cc | 3 - runtime/bin/secure_socket_utils.h | 2 - runtime/bin/security_context.cc | 41 - runtime/bin/security_context.h | 1 - runtime/bin/security_context_android.cc | 1 - runtime/bin/security_context_fuchsia.cc | 1 - runtime/bin/security_context_linux.cc | 1 - runtime/bin/security_context_macos.cc | 3 - runtime/bin/security_context_win.cc | 1 - runtime/bin/snapshot_utils.cc | 11 - runtime/bin/socket.cc | 42 - runtime/bin/socket.h | 3 - runtime/bin/socket_android.cc | 12 +- runtime/bin/socket_base.cc | 12 - runtime/bin/socket_base_android.cc | 28 - runtime/bin/socket_base_fuchsia.cc | 30 - runtime/bin/socket_base_linux.cc | 30 - runtime/bin/socket_base_macos.cc | 30 - runtime/bin/socket_base_unsupported.cc | 2 - runtime/bin/socket_base_win.cc | 29 - runtime/bin/socket_fuchsia.cc | 12 +- runtime/bin/socket_linux.cc | 12 +- runtime/bin/socket_macos.cc | 11 +- runtime/bin/socket_unsupported.cc | 21 - runtime/bin/socket_win.cc | 10 - runtime/bin/stdio.cc | 7 - runtime/bin/stdio.h | 1 - runtime/bin/stdio_android.cc | 8 - runtime/bin/stdio_fuchsia.cc | 7 - runtime/bin/stdio_linux.cc | 8 - runtime/bin/stdio_macos.cc | 8 - runtime/bin/stdio_unsupported.cc | 7 - runtime/bin/stdio_win.cc | 7 - runtime/bin/sync_socket.cc | 13 - runtime/bin/sync_socket_android.cc | 11 - runtime/bin/sync_socket_fuchsia.cc | 11 - runtime/bin/sync_socket_linux.cc | 11 - runtime/bin/sync_socket_macos.cc | 11 - runtime/bin/sync_socket_unsupported.cc | 11 - runtime/bin/sync_socket_win.cc | 11 - runtime/bin/thread.h | 7 +- runtime/bin/thread_android.cc | 26 - runtime/bin/thread_android.h | 2 - runtime/bin/thread_fuchsia.cc | 26 - runtime/bin/thread_fuchsia.h | 2 - runtime/bin/thread_linux.cc | 26 - runtime/bin/thread_linux.h | 2 - runtime/bin/thread_macos.cc | 25 - runtime/bin/thread_macos.h | 2 - runtime/bin/thread_win.cc | 29 - runtime/bin/thread_win.h | 4 - runtime/bin/utils.h | 3 - runtime/bin/utils_android.cc | 11 - runtime/bin/utils_fuchsia.cc | 11 - runtime/bin/utils_linux.cc | 11 - runtime/bin/utils_macos.cc | 13 - runtime/bin/utils_win.cc | 18 - runtime/bin/vmservice_dartium.cc | 13 +- runtime/bin/vmservice_impl.cc | 16 - runtime/include/dart_api.h | 53 - runtime/include/dart_mirrors_api.h | 2 - runtime/include/dart_native_api.h | 1 - runtime/include/dart_tools_api.h | 55 - runtime/lib/array.cc | 7 +- runtime/lib/bool.cc | 2 +- runtime/lib/date.cc | 3 - runtime/lib/developer.cc | 11 - runtime/lib/double.cc | 24 - runtime/lib/errors.cc | 4 - runtime/lib/function.cc | 4 - runtime/lib/growable_array.cc | 8 - runtime/lib/integers.cc | 28 +- runtime/lib/isolate.cc | 19 - runtime/lib/linked_hash_map.cc | 9 - runtime/lib/math.cc | 7 - runtime/lib/mirrors.cc | 67 - runtime/lib/object.cc | 22 +- runtime/lib/profiler.cc | 5 - runtime/lib/regexp.cc | 12 +- runtime/lib/simd128.cc | 84 - runtime/lib/stacktrace.cc | 8 - runtime/lib/stopwatch.cc | 1 - runtime/lib/string.cc | 22 +- runtime/lib/timeline.cc | 45 +- runtime/lib/typed_data.cc | 18 - runtime/lib/vmservice.cc | 17 +- runtime/lib/weak_property.cc | 3 - runtime/platform/address_sanitizer.h | 2 +- runtime/platform/allocation.h | 1 - runtime/platform/assert.h | 17 - runtime/platform/c99_support_win.h | 2 - runtime/platform/globals.h | 20 +- runtime/platform/growable_array.h | 6 - runtime/platform/hashmap.cc | 9 - runtime/platform/signal_blocker.h | 4 +- runtime/platform/text_buffer.cc | 11 - runtime/platform/text_buffer.h | 1 - runtime/platform/utils.cc | 5 - runtime/platform/utils.h | 5 - runtime/platform/utils_android.h | 7 - runtime/platform/utils_fuchsia.h | 8 - runtime/platform/utils_linux.h | 8 - runtime/platform/utils_macos.h | 7 - runtime/platform/utils_win.h | 7 - runtime/vm/allocation.cc | 8 - runtime/vm/allocation.h | 2 - runtime/vm/allocation_test.cc | 14 +- runtime/vm/aot_optimizer.cc | 81 +- runtime/vm/aot_optimizer.h | 3 +- runtime/vm/assembler.cc | 25 - runtime/vm/assembler.h | 9 - runtime/vm/assembler_arm.cc | 297 ---- runtime/vm/assembler_arm.h | 9 - runtime/vm/assembler_arm64.cc | 90 -- runtime/vm/assembler_arm64.h | 5 - runtime/vm/assembler_arm64_test.cc | 383 ----- runtime/vm/assembler_arm_test.cc | 274 ---- runtime/vm/assembler_dbc.cc | 14 - runtime/vm/assembler_dbc.h | 5 - runtime/vm/assembler_dbc_test.cc | 311 ---- runtime/vm/assembler_ia32.cc | 317 ---- runtime/vm/assembler_ia32.h | 12 - runtime/vm/assembler_ia32_test.cc | 271 ---- runtime/vm/assembler_x64.cc | 343 ---- runtime/vm/assembler_x64.h | 16 - runtime/vm/assembler_x64_test.cc | 260 --- runtime/vm/assert_test.cc | 5 - runtime/vm/ast.cc | 48 - runtime/vm/ast.h | 55 +- runtime/vm/ast_printer.cc | 60 - runtime/vm/ast_printer_test.cc | 2 +- runtime/vm/ast_test.cc | 2 +- runtime/vm/ast_transformer.cc | 41 +- runtime/vm/atomic.h | 1 - runtime/vm/atomic_android.h | 9 - runtime/vm/atomic_fuchsia.h | 8 - runtime/vm/atomic_linux.h | 9 - runtime/vm/atomic_macos.h | 9 - runtime/vm/atomic_simulator.h | 1 - runtime/vm/atomic_test.cc | 10 +- runtime/vm/atomic_win.h | 7 - runtime/vm/become.cc | 12 - runtime/vm/benchmark_test.cc | 33 - runtime/vm/benchmark_test.h | 4 +- runtime/vm/bigint_test.cc | 8 - runtime/vm/bit_set_test.cc | 3 +- runtime/vm/bit_vector.cc | 6 - runtime/vm/bit_vector_test.cc | 2 +- runtime/vm/bitfield.h | 2 + runtime/vm/bitfield_test.cc | 3 +- runtime/vm/bitmap.cc | 6 - runtime/vm/bitmap.h | 1 - runtime/vm/bitmap_test.cc | 2 +- runtime/vm/block_scheduler.cc | 8 - runtime/vm/boolfield.h | 1 + runtime/vm/boolfield_test.cc | 1 + runtime/vm/bootstrap.cc | 14 - runtime/vm/bootstrap_natives.cc | 5 - runtime/vm/bootstrap_nocore.cc | 7 - runtime/vm/branch_optimizer.cc | 8 - runtime/vm/branch_optimizer.h | 1 - runtime/vm/cha.cc | 10 - runtime/vm/cha_test.cc | 3 +- runtime/vm/class_finalizer.cc | 62 +- runtime/vm/class_finalizer_test.cc | 7 +- runtime/vm/class_table.cc | 42 - runtime/vm/clustered_snapshot.cc | 121 -- runtime/vm/clustered_snapshot.h | 8 - runtime/vm/code_descriptors.cc | 31 - runtime/vm/code_descriptors.h | 8 - runtime/vm/code_descriptors_test.cc | 7 +- runtime/vm/code_generator_test.cc | 33 +- runtime/vm/code_observers.cc | 7 - runtime/vm/code_observers.h | 3 +- runtime/vm/code_patcher.cc | 2 - runtime/vm/code_patcher.h | 2 - runtime/vm/code_patcher_arm.cc | 10 - runtime/vm/code_patcher_arm64.cc | 12 - runtime/vm/code_patcher_arm64_test.cc | 1 - runtime/vm/code_patcher_arm_test.cc | 1 - runtime/vm/code_patcher_dbc.cc | 10 - runtime/vm/code_patcher_ia32.cc | 15 - runtime/vm/code_patcher_ia32_test.cc | 1 - runtime/vm/code_patcher_x64.cc | 21 - runtime/vm/code_patcher_x64_test.cc | 1 - runtime/vm/compilation_trace.cc | 7 - runtime/vm/compiler.cc | 71 - runtime/vm/compiler.h | 4 - runtime/vm/compiler_stats.cc | 12 - runtime/vm/compiler_stats.h | 5 - runtime/vm/compiler_test.cc | 8 +- runtime/vm/constant_propagator.cc | 157 -- runtime/vm/constant_propagator.h | 3 +- runtime/vm/constants_arm.h | 18 +- runtime/vm/constants_arm64.h | 5 - runtime/vm/constants_dbc.h | 3 +- runtime/vm/constants_ia32.h | 9 - runtime/vm/constants_x64.h | 9 - runtime/vm/cpu.h | 3 +- runtime/vm/cpu_arm.cc | 4 - runtime/vm/cpu_arm64.cc | 7 +- runtime/vm/cpu_dbc.cc | 3 - runtime/vm/cpu_ia32.cc | 3 - runtime/vm/cpu_test.cc | 2 +- runtime/vm/cpu_x64.cc | 4 - runtime/vm/cpuid.cc | 5 - runtime/vm/cpuinfo_android.cc | 4 - runtime/vm/cpuinfo_fuchsia.cc | 4 - runtime/vm/cpuinfo_linux.cc | 6 +- runtime/vm/cpuinfo_macos.cc | 6 +- runtime/vm/cpuinfo_test.cc | 2 +- runtime/vm/cpuinfo_win.cc | 6 +- runtime/vm/custom_isolate_test.cc | 12 - runtime/vm/dart.cc | 22 +- runtime/vm/dart_api_impl.cc | 305 ---- runtime/vm/dart_api_impl.h | 3 - runtime/vm/dart_api_impl_test.cc | 291 +--- runtime/vm/dart_api_message.cc | 58 +- runtime/vm/dart_api_message.h | 3 - runtime/vm/dart_api_state.h | 17 +- runtime/vm/dart_entry.cc | 29 - runtime/vm/dart_entry.h | 2 - runtime/vm/dart_entry_test.cc | 2 - runtime/vm/datastream.h | 1 - runtime/vm/debugger.cc | 198 --- runtime/vm/debugger.h | 8 - runtime/vm/debugger_api_impl.cc | 53 - runtime/vm/debugger_api_impl_test.cc | 72 - runtime/vm/debugger_arm.cc | 2 - runtime/vm/debugger_arm64.cc | 2 - runtime/vm/debugger_dbc.cc | 4 - runtime/vm/debugger_ia32.cc | 2 - runtime/vm/debugger_test.cc | 11 +- runtime/vm/debugger_x64.cc | 2 - runtime/vm/deferred_objects.cc | 13 - runtime/vm/deferred_objects.h | 10 - runtime/vm/deopt_instructions.cc | 54 - runtime/vm/deopt_instructions.h | 6 - runtime/vm/disassembler.cc | 10 +- runtime/vm/disassembler.h | 3 - runtime/vm/disassembler_arm.cc | 31 - runtime/vm/disassembler_arm64.cc | 56 - runtime/vm/disassembler_dbc.cc | 20 - runtime/vm/disassembler_ia32.cc | 51 - runtime/vm/disassembler_test.cc | 2 +- runtime/vm/disassembler_x64.cc | 41 - runtime/vm/double_conversion.cc | 4 - runtime/vm/dwarf.cc | 14 - runtime/vm/exceptions.cc | 31 - runtime/vm/exceptions.h | 1 - runtime/vm/exceptions_test.cc | 8 - runtime/vm/fixed_cache.h | 4 +- runtime/vm/fixed_cache_test.cc | 4 +- runtime/vm/flags.cc | 20 - runtime/vm/flags.h | 1 - runtime/vm/flags_test.cc | 3 +- runtime/vm/flow_graph.cc | 78 +- runtime/vm/flow_graph.h | 6 - runtime/vm/flow_graph_allocator.cc | 98 +- runtime/vm/flow_graph_allocator.h | 13 - runtime/vm/flow_graph_builder.cc | 168 +- runtime/vm/flow_graph_builder.h | 4 - runtime/vm/flow_graph_builder_test.cc | 17 +- runtime/vm/flow_graph_compiler.cc | 81 - runtime/vm/flow_graph_compiler.h | 7 - runtime/vm/flow_graph_compiler_arm.cc | 88 +- runtime/vm/flow_graph_compiler_arm64.cc | 67 +- runtime/vm/flow_graph_compiler_dbc.cc | 36 - runtime/vm/flow_graph_compiler_ia32.cc | 83 +- runtime/vm/flow_graph_compiler_x64.cc | 85 +- runtime/vm/flow_graph_inliner.cc | 70 +- runtime/vm/flow_graph_range_analysis.cc | 117 -- runtime/vm/flow_graph_range_analysis.h | 8 - runtime/vm/flow_graph_range_analysis_test.cc | 9 - runtime/vm/flow_graph_type_propagator.cc | 141 +- runtime/vm/freelist.cc | 22 - runtime/vm/freelist.h | 3 +- runtime/vm/freelist_test.cc | 7 +- runtime/vm/gc_marker.cc | 18 +- runtime/vm/gc_sweeper.cc | 3 - runtime/vm/gdb_helpers.cc | 5 - runtime/vm/globals.h | 5 - runtime/vm/growable_array.h | 4 - runtime/vm/growable_array_test.cc | 6 +- runtime/vm/guard_field_test.cc | 5 - runtime/vm/handles.cc | 13 - runtime/vm/handles.h | 5 - runtime/vm/handles_impl.h | 22 - runtime/vm/handles_test.cc | 5 +- runtime/vm/hash_map.h | 13 - runtime/vm/hash_map_test.cc | 7 +- runtime/vm/hash_table.h | 7 - runtime/vm/hash_table_test.cc | 11 +- runtime/vm/heap.cc | 67 - runtime/vm/heap.h | 4 - runtime/vm/heap_test.cc | 23 - runtime/vm/il_printer.cc | 124 -- runtime/vm/il_printer.h | 2 - runtime/vm/instructions_arm.cc | 20 - runtime/vm/instructions_arm.h | 4 - runtime/vm/instructions_arm64.cc | 21 - runtime/vm/instructions_arm64.h | 4 - runtime/vm/instructions_arm64_test.cc | 2 - runtime/vm/instructions_arm_test.cc | 1 - runtime/vm/instructions_dbc.cc | 22 - runtime/vm/instructions_dbc.h | 4 - runtime/vm/instructions_ia32.h | 5 - runtime/vm/instructions_ia32_test.cc | 2 - runtime/vm/instructions_x64.cc | 2 +- runtime/vm/instructions_x64.h | 5 - runtime/vm/instructions_x64_test.cc | 3 - runtime/vm/intermediate_language.cc | 260 --- runtime/vm/intermediate_language.h | 190 --- runtime/vm/intermediate_language_arm.cc | 303 +--- runtime/vm/intermediate_language_arm64.cc | 290 +--- runtime/vm/intermediate_language_dbc.cc | 100 +- runtime/vm/intermediate_language_ia32.cc | 308 +--- runtime/vm/intermediate_language_test.cc | 2 - runtime/vm/intermediate_language_x64.cc | 303 +--- runtime/vm/intrinsifier.cc | 62 +- runtime/vm/intrinsifier_arm.cc | 106 +- runtime/vm/intrinsifier_arm64.cc | 104 +- runtime/vm/intrinsifier_dbc.cc | 2 +- runtime/vm/intrinsifier_ia32.cc | 104 +- runtime/vm/intrinsifier_x64.cc | 110 +- runtime/vm/isolate.cc | 127 +- runtime/vm/isolate.h | 17 +- runtime/vm/isolate_reload.cc | 87 +- runtime/vm/isolate_reload.h | 4 - runtime/vm/isolate_reload_test.cc | 99 -- runtime/vm/isolate_test.cc | 8 +- runtime/vm/jit_optimizer.cc | 90 +- runtime/vm/jit_optimizer.h | 4 +- runtime/vm/json_parser.h | 2 +- runtime/vm/json_stream.cc | 91 -- runtime/vm/json_stream.h | 4 - runtime/vm/json_test.cc | 14 +- runtime/vm/kernel.cc | 5 +- runtime/vm/kernel.h | 12 - runtime/vm/kernel_binary.cc | 5 - runtime/vm/kernel_binary.h | 5 - runtime/vm/kernel_binary_flowgraph.cc | 65 +- runtime/vm/kernel_binary_flowgraph.h | 7 +- runtime/vm/kernel_isolate.cc | 12 - runtime/vm/kernel_reader.cc | 16 - runtime/vm/kernel_to_il.cc | 150 +- runtime/vm/kernel_to_il.h | 23 +- runtime/vm/locations.cc | 21 - runtime/vm/locations.h | 9 - runtime/vm/lockers.cc | 7 +- runtime/vm/lockers.h | 1 - runtime/vm/log.cc | 14 - runtime/vm/log.h | 1 - runtime/vm/log_test.cc | 3 - runtime/vm/longjump.cc | 2 - runtime/vm/longjump_test.cc | 1 - runtime/vm/malloc_hooks_jemalloc.cc | 10 - runtime/vm/malloc_hooks_tcmalloc.cc | 19 - runtime/vm/malloc_hooks_test.cc | 7 - runtime/vm/malloc_hooks_unsupported.cc | 10 - runtime/vm/megamorphic_cache_table.cc | 3 - runtime/vm/memory_region_test.cc | 7 +- runtime/vm/message.cc | 11 - runtime/vm/message_handler.cc | 31 - runtime/vm/message_handler_test.cc | 14 - runtime/vm/message_test.cc | 5 +- runtime/vm/method_recognizer.cc | 7 - runtime/vm/method_recognizer.h | 2 - runtime/vm/metrics.cc | 31 +- runtime/vm/metrics.h | 11 - runtime/vm/mirrors_api_impl.cc | 14 - runtime/vm/native_api_impl.cc | 10 - runtime/vm/native_entry.cc | 17 - runtime/vm/native_entry.h | 3 - runtime/vm/native_entry_test.cc | 3 - runtime/vm/native_message_handler.cc | 3 - runtime/vm/native_symbol.h | 1 - runtime/vm/native_symbol_android.cc | 4 - runtime/vm/native_symbol_fuchsia.cc | 4 - runtime/vm/native_symbol_linux.cc | 4 - runtime/vm/native_symbol_macos.cc | 4 - runtime/vm/native_symbol_win.cc | 4 - runtime/vm/object.cc | 1387 +---------------- runtime/vm/object.h | 127 +- runtime/vm/object_arm64_test.cc | 2 - runtime/vm/object_arm_test.cc | 3 - runtime/vm/object_dbc_test.cc | 2 - runtime/vm/object_graph.cc | 28 - runtime/vm/object_graph_test.cc | 3 +- runtime/vm/object_ia32_test.cc | 3 - runtime/vm/object_id_ring.cc | 17 +- runtime/vm/object_id_ring.h | 2 + runtime/vm/object_id_ring_test.cc | 10 +- runtime/vm/object_reload.cc | 26 - runtime/vm/object_service.cc | 84 +- runtime/vm/object_store.cc | 10 +- runtime/vm/object_test.cc | 114 +- runtime/vm/object_x64_test.cc | 3 - runtime/vm/optimizer.cc | 3 - runtime/vm/os_android.cc | 43 +- runtime/vm/os_fuchsia.cc | 34 - runtime/vm/os_linux.cc | 44 +- runtime/vm/os_macos.cc | 39 +- runtime/vm/os_test.cc | 5 +- runtime/vm/os_thread.cc | 22 - runtime/vm/os_thread.h | 6 - runtime/vm/os_thread_android.cc | 35 - runtime/vm/os_thread_android.h | 4 - runtime/vm/os_thread_fuchsia.cc | 33 - runtime/vm/os_thread_fuchsia.h | 4 - runtime/vm/os_thread_linux.cc | 34 - runtime/vm/os_thread_linux.h | 4 - runtime/vm/os_thread_macos.cc | 42 +- runtime/vm/os_thread_macos.h | 4 - runtime/vm/os_thread_win.cc | 43 - runtime/vm/os_thread_win.h | 11 - runtime/vm/os_win.cc | 38 +- runtime/vm/pages.cc | 55 - runtime/vm/pages.h | 3 - runtime/vm/pages_test.cc | 2 +- runtime/vm/parser.cc | 369 +---- runtime/vm/parser.h | 8 +- runtime/vm/parser_test.cc | 18 +- runtime/vm/port.cc | 18 +- runtime/vm/port_test.cc | 12 +- runtime/vm/precompiler.cc | 68 - runtime/vm/precompiler.h | 14 - runtime/vm/proccpuinfo.cc | 7 - runtime/vm/profiler.cc | 60 - runtime/vm/profiler.h | 12 - runtime/vm/profiler_service.cc | 77 - runtime/vm/profiler_service.h | 9 - runtime/vm/profiler_test.cc | 40 +- runtime/vm/program_visitor.cc | 17 +- runtime/vm/random.cc | 4 - runtime/vm/random.h | 2 +- runtime/vm/raw_object.cc | 79 - runtime/vm/raw_object.h | 89 -- runtime/vm/raw_object_snapshot.cc | 143 -- runtime/vm/redundancy_elimination.cc | 50 - runtime/vm/redundancy_elimination.h | 7 +- runtime/vm/regexp.cc | 201 +-- runtime/vm/regexp.h | 37 +- runtime/vm/regexp_assembler.cc | 2 - runtime/vm/regexp_assembler.h | 2 - runtime/vm/regexp_assembler_bytecode.cc | 56 +- runtime/vm/regexp_assembler_bytecode.h | 1 - runtime/vm/regexp_assembler_bytecode_inl.h | 3 - runtime/vm/regexp_assembler_ir.cc | 100 -- runtime/vm/regexp_assembler_ir.h | 1 - runtime/vm/regexp_ast.cc | 31 - runtime/vm/regexp_ast.h | 14 - runtime/vm/regexp_interpreter.cc | 15 +- runtime/vm/regexp_parser.cc | 33 +- runtime/vm/regexp_parser.h | 2 +- runtime/vm/report.cc | 9 +- runtime/vm/resolver.cc | 5 - runtime/vm/resolver.h | 1 - runtime/vm/resolver_test.cc | 6 +- runtime/vm/reusable_handles.h | 1 - runtime/vm/ring_buffer_test.cc | 2 +- runtime/vm/runtime_entry.cc | 56 +- runtime/vm/runtime_entry.h | 3 - runtime/vm/runtime_entry_arm.cc | 2 - runtime/vm/runtime_entry_arm64.cc | 2 - runtime/vm/runtime_entry_dbc.cc | 3 - runtime/vm/runtime_entry_ia32.cc | 2 - runtime/vm/runtime_entry_x64.cc | 2 - runtime/vm/safepoint.cc | 8 - runtime/vm/safepoint.h | 10 - runtime/vm/scanner.cc | 36 - runtime/vm/scanner.h | 1 - runtime/vm/scanner_test.cc | 26 +- runtime/vm/scavenger.cc | 46 +- runtime/vm/scavenger.h | 2 - runtime/vm/scavenger_test.cc | 2 +- runtime/vm/scopes.cc | 30 - runtime/vm/scopes.h | 4 - runtime/vm/scopes_test.cc | 2 +- runtime/vm/service.cc | 216 --- runtime/vm/service.h | 2 - runtime/vm/service_event.cc | 6 - runtime/vm/service_isolate.cc | 32 +- runtime/vm/service_test.cc | 20 - runtime/vm/signal_handler.h | 4 - runtime/vm/signal_handler_android.cc | 9 +- runtime/vm/signal_handler_fuchsia.cc | 6 - runtime/vm/signal_handler_linux.cc | 9 +- runtime/vm/signal_handler_macos.cc | 9 +- runtime/vm/signal_handler_win.cc | 7 - runtime/vm/simulator_arm.cc | 95 +- runtime/vm/simulator_arm64.cc | 135 +- runtime/vm/simulator_dbc.cc | 37 - runtime/vm/simulator_dbc.h | 1 - runtime/vm/snapshot.cc | 95 +- runtime/vm/snapshot.h | 23 - runtime/vm/snapshot_ids.h | 2 +- runtime/vm/snapshot_test.cc | 63 - runtime/vm/source_report.cc | 17 - runtime/vm/source_report_test.cc | 13 - runtime/vm/stack_frame.cc | 26 - runtime/vm/stack_frame.h | 12 - runtime/vm/stack_frame_dbc.h | 2 - runtime/vm/stack_frame_test.cc | 13 +- runtime/vm/stack_trace.cc | 4 +- runtime/vm/store_buffer.cc | 19 - runtime/vm/store_buffer.h | 5 - runtime/vm/stub_code.cc | 16 +- runtime/vm/stub_code.h | 2 - runtime/vm/stub_code_arm.cc | 70 +- runtime/vm/stub_code_arm64.cc | 59 - runtime/vm/stub_code_arm64_test.cc | 6 +- runtime/vm/stub_code_arm_test.cc | 6 +- runtime/vm/stub_code_dbc.cc | 12 - runtime/vm/stub_code_ia32.cc | 65 +- runtime/vm/stub_code_ia32_test.cc | 6 +- runtime/vm/stub_code_x64.cc | 60 - runtime/vm/stub_code_x64_test.cc | 6 +- runtime/vm/symbols.cc | 40 - runtime/vm/symbols.h | 1 - runtime/vm/tags.cc | 18 +- runtime/vm/tags.h | 4 - runtime/vm/thread.cc | 66 - runtime/vm/thread.h | 5 +- runtime/vm/thread_barrier.h | 2 +- runtime/vm/thread_barrier_test.cc | 3 +- runtime/vm/thread_interrupter.cc | 6 - runtime/vm/thread_interrupter.h | 3 +- runtime/vm/thread_interrupter_android.cc | 6 +- runtime/vm/thread_interrupter_fuchsia.cc | 4 - runtime/vm/thread_interrupter_linux.cc | 4 - runtime/vm/thread_interrupter_macos.cc | 7 +- runtime/vm/thread_interrupter_win.cc | 5 - runtime/vm/thread_pool.cc | 23 - runtime/vm/thread_pool_test.cc | 13 +- runtime/vm/thread_registry.cc | 11 - runtime/vm/thread_test.cc | 23 +- runtime/vm/timeline.cc | 135 -- runtime/vm/timeline.h | 18 - runtime/vm/timeline_analysis.cc | 47 - runtime/vm/timeline_analysis.h | 5 - runtime/vm/timeline_test.cc | 15 - runtime/vm/timer.cc | 2 +- runtime/vm/timer.h | 3 - runtime/vm/token.cc | 5 - runtime/vm/token.h | 1 - runtime/vm/token_position.cc | 5 - runtime/vm/type_table.h | 3 - runtime/vm/unibrow.cc | 7 +- runtime/vm/unicode.cc | 13 - runtime/vm/unicode.h | 3 - runtime/vm/unicode_test.cc | 2 +- runtime/vm/unit_test.cc | 31 - runtime/vm/unit_test.h | 21 +- runtime/vm/uri.cc | 15 - runtime/vm/uri_test.cc | 49 - runtime/vm/utils_test.cc | 17 +- runtime/vm/verified_memory_test.cc | 9 +- runtime/vm/verifier.cc | 5 - runtime/vm/verifier.h | 3 - runtime/vm/version_in.cc | 2 - runtime/vm/virtual_memory.cc | 2 - runtime/vm/virtual_memory_android.cc | 7 - runtime/vm/virtual_memory_fuchsia.cc | 10 - runtime/vm/virtual_memory_linux.cc | 8 - runtime/vm/virtual_memory_macos.cc | 7 - runtime/vm/virtual_memory_test.cc | 5 +- runtime/vm/virtual_memory_win.cc | 6 - runtime/vm/visitor.h | 2 - runtime/vm/weak_code.cc | 3 - runtime/vm/weak_table.cc | 3 - runtime/vm/zone.cc | 20 - runtime/vm/zone.h | 6 +- runtime/vm/zone_test.cc | 7 +- runtime/vm/zone_text_buffer.cc | 3 - 665 files changed, 518 insertions(+), 19090 deletions(-) diff --git a/.clang-format b/.clang-format index 96325aea288..f3288a6f3ef 100644 --- a/.clang-format +++ b/.clang-format @@ -2,9 +2,6 @@ # http://clang.llvm.org/docs/ClangFormatStyleOptions.html BasedOnStyle: Chromium -# Keep up to 2 blank lines. More blank lines are removed. -MaxEmptyLinesToKeep: 2 - # clang-format doesn't seem to do a good job of this for longer comments. ReflowComments: 'false' diff --git a/runtime/bin/builtin.cc b/runtime/bin/builtin.cc index 942fb19c4d3..16b5424a14f 100644 --- a/runtime/bin/builtin.cc +++ b/runtime/bin/builtin.cc @@ -63,7 +63,6 @@ static void LoadPatchFiles(Dart_Handle library, } } - Dart_Handle Builtin::Source(BuiltinLibraryId id) { ASSERT(static_cast(id) >= 0); ASSERT(static_cast(id) < num_libs_); @@ -74,7 +73,6 @@ Dart_Handle Builtin::Source(BuiltinLibraryId id) { return GetSource(source_paths, uri); } - Dart_Handle Builtin::PartSource(BuiltinLibraryId id, const char* part_uri) { ASSERT(static_cast(id) >= 0); ASSERT(static_cast(id) < num_libs_); @@ -84,7 +82,6 @@ Dart_Handle Builtin::PartSource(BuiltinLibraryId id, const char* part_uri) { return GetSource(source_paths, part_uri); } - Dart_Handle Builtin::GetSource(const char** source_paths, const char* uri) { if (source_paths == NULL) { return Dart_Null(); // No path mapping information exists for library. @@ -100,7 +97,6 @@ Dart_Handle Builtin::GetSource(const char** source_paths, const char* uri) { return Dart_Null(); // Uri does not exist in path mapping information. } - void Builtin::SetNativeResolver(BuiltinLibraryId id) { ASSERT(static_cast(id) >= 0); ASSERT(static_cast(id) < num_libs_); @@ -115,7 +111,6 @@ void Builtin::SetNativeResolver(BuiltinLibraryId id) { } } - Dart_Handle Builtin::LoadLibrary(Dart_Handle url, BuiltinLibraryId id) { ASSERT(static_cast(id) >= 0); ASSERT(static_cast(id) < num_libs_); @@ -134,7 +129,6 @@ Dart_Handle Builtin::LoadLibrary(Dart_Handle url, BuiltinLibraryId id) { return library; } - Builtin::BuiltinLibraryId Builtin::FindId(const char* url_string) { int id = 0; while (true) { @@ -148,7 +142,6 @@ Builtin::BuiltinLibraryId Builtin::FindId(const char* url_string) { } } - Dart_Handle Builtin::LoadAndCheckLibrary(BuiltinLibraryId id) { ASSERT(static_cast(id) >= 0); ASSERT(static_cast(id) < num_libs_); diff --git a/runtime/bin/builtin.h b/runtime/bin/builtin.h index f42f2cff99d..21d7d0b11c3 100644 --- a/runtime/bin/builtin.h +++ b/runtime/bin/builtin.h @@ -21,7 +21,6 @@ namespace bin { #define DECLARE_FUNCTION(name, count) \ extern void FUNCTION_NAME(name)(Dart_NativeArguments args); - class Builtin { public: // Note: Changes to this enum should be accompanied with changes to diff --git a/runtime/bin/builtin_gen_snapshot.cc b/runtime/bin/builtin_gen_snapshot.cc index 8cf1d236eb7..070e1408dea 100644 --- a/runtime/bin/builtin_gen_snapshot.cc +++ b/runtime/bin/builtin_gen_snapshot.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include #include +#include #include #include "include/dart_api.h" @@ -25,7 +25,6 @@ static struct NativeEntries { int argument_count_; } BuiltinEntries[] = {BUILTIN_NATIVE_LIST(REGISTER_FUNCTION)}; - Dart_NativeFunction Builtin::NativeLookup(Dart_Handle name, int argument_count, bool* auto_setup_scope) { @@ -46,7 +45,6 @@ Dart_NativeFunction Builtin::NativeLookup(Dart_Handle name, return IONativeLookup(name, argument_count, auto_setup_scope); } - const uint8_t* Builtin::NativeSymbol(Dart_NativeFunction nf) { int num_entries = sizeof(BuiltinEntries) / sizeof(struct NativeEntries); for (int i = 0; i < num_entries; i++) { @@ -58,7 +56,6 @@ const uint8_t* Builtin::NativeSymbol(Dart_NativeFunction nf) { return IONativeSymbol(nf); } - // Implementation of native functions which are used for some // test/debug functionality in standalone dart mode. void FUNCTION_NAME(Builtin_PrintString)(Dart_NativeArguments args) { diff --git a/runtime/bin/builtin_natives.cc b/runtime/bin/builtin_natives.cc index 394beb3d112..02c7db173bb 100644 --- a/runtime/bin/builtin_natives.cc +++ b/runtime/bin/builtin_natives.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include #include +#include #include #include "include/dart_api.h" @@ -29,7 +29,6 @@ namespace bin { V(Builtin_PrintString, 1) \ V(Builtin_GetCurrentDirectory, 0) - BUILTIN_NATIVE_LIST(DECLARE_FUNCTION); static struct NativeEntries { @@ -38,12 +37,10 @@ static struct NativeEntries { int argument_count_; } BuiltinEntries[] = {BUILTIN_NATIVE_LIST(REGISTER_FUNCTION)}; - void Builtin_DummyNative(Dart_NativeArguments args) { UNREACHABLE(); } - /** * Looks up native functions in both libdart_builtin and libdart_io. */ @@ -72,7 +69,6 @@ Dart_NativeFunction Builtin::NativeLookup(Dart_Handle name, return result; } - const uint8_t* Builtin::NativeSymbol(Dart_NativeFunction nf) { int num_entries = sizeof(BuiltinEntries) / sizeof(struct NativeEntries); for (int i = 0; i < num_entries; i++) { @@ -84,7 +80,6 @@ const uint8_t* Builtin::NativeSymbol(Dart_NativeFunction nf) { return IONativeSymbol(nf); } - // Implementation of native functions which are used for some // test/debug functionality in standalone dart mode. void FUNCTION_NAME(Builtin_PrintString)(Dart_NativeArguments args) { diff --git a/runtime/bin/builtin_nolib.cc b/runtime/bin/builtin_nolib.cc index a61d915111c..573cd159928 100644 --- a/runtime/bin/builtin_nolib.cc +++ b/runtime/bin/builtin_nolib.cc @@ -25,24 +25,20 @@ Dart_Port Builtin::load_port_ = ILLEGAL_PORT; const int Builtin::num_libs_ = sizeof(Builtin::builtin_libraries_) / sizeof(Builtin::builtin_lib_props); - Dart_Handle Builtin::Source(BuiltinLibraryId id) { return DartUtils::NewError("Unreachable code in Builtin::Source (%d).", id); } - Dart_Handle Builtin::PartSource(BuiltinLibraryId id, const char* uri) { return DartUtils::NewError("Unreachable code in Builtin::PartSource (%d).", id); } - Dart_Handle Builtin::GetSource(const char** source_paths, const char* uri) { return DartUtils::NewError("Unreachable code in Builtin::GetSource (%s).", uri); } - void Builtin::SetNativeResolver(BuiltinLibraryId id) { ASSERT(static_cast(id) >= 0); ASSERT(static_cast(id) < num_libs_); @@ -57,18 +53,15 @@ void Builtin::SetNativeResolver(BuiltinLibraryId id) { } } - Dart_Handle Builtin::LoadLibrary(Dart_Handle url, BuiltinLibraryId id) { return DartUtils::NewError("Unreachable code in Builtin::LoadLibrary (%d).", id); } - Builtin::BuiltinLibraryId Builtin::FindId(const char* url_string) { return kInvalidLibrary; } - Dart_Handle Builtin::LoadAndCheckLibrary(BuiltinLibraryId id) { ASSERT(static_cast(id) >= 0); ASSERT(static_cast(id) < num_libs_); diff --git a/runtime/bin/dartutils.cc b/runtime/bin/dartutils.cc index a07306dadec..b8f49b18932 100644 --- a/runtime/bin/dartutils.cc +++ b/runtime/bin/dartutils.cc @@ -47,7 +47,6 @@ const char* const DartUtils::kUriLibURL = "dart:uri"; const char* const DartUtils::kHttpScheme = "http:"; const char* const DartUtils::kVMServiceLibURL = "dart:vmservice"; - struct MagicNumberData { static const intptr_t kLength = 4; @@ -55,11 +54,9 @@ struct MagicNumberData { bool should_skip; }; - MagicNumberData snapshot_magic_number = {{0xf5, 0xf5, 0xdc, 0xdc}, true}; MagicNumberData kernel_magic_number = {{0x90, 0xab, 0xcd, 0xef}, false}; - static bool IsWindowsHost() { #if defined(HOST_OS_WINDOWS) return true; @@ -68,7 +65,6 @@ static bool IsWindowsHost() { #endif // defined(HOST_OS_WINDOWS) } - const char* DartUtils::MapLibraryUrl(const char* url_string) { ASSERT(url_mapping != NULL); // We need to check if the passed in url is found in the url_mapping array, @@ -86,7 +82,6 @@ const char* DartUtils::MapLibraryUrl(const char* url_string) { return NULL; // Did not find a mapping for this URL. } - int64_t DartUtils::GetIntegerValue(Dart_Handle value_obj) { int64_t value = 0; Dart_Handle result = Dart_IntegerToInt64(value_obj, &value); @@ -94,7 +89,6 @@ int64_t DartUtils::GetIntegerValue(Dart_Handle value_obj) { return value; } - int64_t DartUtils::GetInt64ValueCheckRange(Dart_Handle value_obj, int64_t lower, int64_t upper) { @@ -105,7 +99,6 @@ int64_t DartUtils::GetInt64ValueCheckRange(Dart_Handle value_obj, return value; } - intptr_t DartUtils::GetIntptrValue(Dart_Handle value_obj) { int64_t value = 0; Dart_Handle result = Dart_IntegerToInt64(value_obj, &value); @@ -116,7 +109,6 @@ intptr_t DartUtils::GetIntptrValue(Dart_Handle value_obj) { return static_cast(value); } - bool DartUtils::GetInt64Value(Dart_Handle value_obj, int64_t* value) { bool valid = Dart_IsInteger(value_obj); if (valid) { @@ -129,7 +121,6 @@ bool DartUtils::GetInt64Value(Dart_Handle value_obj, int64_t* value) { return true; } - const char* DartUtils::GetStringValue(Dart_Handle str_obj) { const char* cstring = NULL; Dart_Handle result = Dart_StringToCString(str_obj, &cstring); @@ -137,7 +128,6 @@ const char* DartUtils::GetStringValue(Dart_Handle str_obj) { return cstring; } - bool DartUtils::GetBooleanValue(Dart_Handle bool_obj) { bool value = false; Dart_Handle result = Dart_BooleanValue(bool_obj, &value); @@ -145,21 +135,18 @@ bool DartUtils::GetBooleanValue(Dart_Handle bool_obj) { return value; } - Dart_Handle DartUtils::SetIntegerField(Dart_Handle handle, const char* name, int64_t val) { return Dart_SetField(handle, NewString(name), Dart_NewInteger(val)); } - Dart_Handle DartUtils::SetStringField(Dart_Handle handle, const char* name, const char* val) { return Dart_SetField(handle, NewString(name), NewString(val)); } - bool DartUtils::IsDartSchemeURL(const char* url_name) { static const intptr_t kDartSchemeLen = strlen(kDartScheme); // If the URL starts with "dart:" then it is considered as a special @@ -167,13 +154,11 @@ bool DartUtils::IsDartSchemeURL(const char* url_name) { return (strncmp(url_name, kDartScheme, kDartSchemeLen) == 0); } - bool DartUtils::IsHttpSchemeURL(const char* url_name) { static const intptr_t kHttpSchemeLen = strlen(kHttpScheme); return (strncmp(url_name, kHttpScheme, kHttpSchemeLen) == 0); } - bool DartUtils::IsDartExtensionSchemeURL(const char* url_name) { static const intptr_t kDartExtensionSchemeLen = strlen(kDartExtensionScheme); // If the URL starts with "dartext:" then it is considered as a special @@ -182,17 +167,14 @@ bool DartUtils::IsDartExtensionSchemeURL(const char* url_name) { 0); } - bool DartUtils::IsDartIOLibURL(const char* url_name) { return (strcmp(url_name, kIOLibURL) == 0); } - bool DartUtils::IsDartBuiltinLibURL(const char* url_name) { return (strcmp(url_name, kBuiltinLibURL) == 0); } - const char* DartUtils::RemoveScheme(const char* url) { const char* colon = strchr(url, ':'); if (colon == NULL) { @@ -202,7 +184,6 @@ const char* DartUtils::RemoveScheme(const char* url) { } } - char* DartUtils::DirName(const char* url) { const char* slash = strrchr(url, File::PathSeparator()[0]); if (slash == NULL) { @@ -212,13 +193,11 @@ char* DartUtils::DirName(const char* url) { } } - void* DartUtils::OpenFile(const char* name, bool write) { File* file = File::Open(name, write ? File::kWriteTruncate : File::kRead); return reinterpret_cast(file); } - void DartUtils::ReadFile(const uint8_t** data, intptr_t* len, void* stream) { ASSERT(data != NULL); ASSERT(len != NULL); @@ -241,7 +220,6 @@ void DartUtils::ReadFile(const uint8_t** data, intptr_t* len, void* stream) { *data = text_buffer; } - void DartUtils::WriteFile(const void* buffer, intptr_t num_bytes, void* stream) { @@ -251,18 +229,15 @@ void DartUtils::WriteFile(const void* buffer, ASSERT(bytes_written); } - void DartUtils::CloseFile(void* stream) { File* file = reinterpret_cast(stream); file->Release(); } - bool DartUtils::EntropySource(uint8_t* buffer, intptr_t length) { return Crypto::GetRandomBytes(length, buffer); } - static Dart_Handle SingleArgDart_Invoke(Dart_Handle lib, const char* method, Dart_Handle arg) { @@ -272,7 +247,6 @@ static Dart_Handle SingleArgDart_Invoke(Dart_Handle lib, return Dart_Invoke(lib, DartUtils::NewString(method), kNumArgs, dart_args); } - // TODO(iposva): Allocate from the zone instead of leaking error string // here. On the other hand the binary is about to exit anyway. #define SET_ERROR_MSG(error_msg, format, ...) \ @@ -281,7 +255,6 @@ static Dart_Handle SingleArgDart_Invoke(Dart_Handle lib, snprintf(msg, len + 1, format, __VA_ARGS__); \ *error_msg = msg - static const uint8_t* ReadFileFully(const char* filename, intptr_t* file_len, const char** error_msg) { @@ -301,7 +274,6 @@ static const uint8_t* ReadFileFully(const char* filename, return text_buffer; } - Dart_Handle DartUtils::ReadStringFromFile(const char* filename) { const char* error_msg = NULL; intptr_t len; @@ -314,7 +286,6 @@ Dart_Handle DartUtils::ReadStringFromFile(const char* filename) { return str; } - Dart_Handle DartUtils::MakeUint8Array(const uint8_t* buffer, intptr_t len) { Dart_Handle array = Dart_NewTypedData(Dart_TypedData_kUint8, len); RETURN_IF_ERROR(array); @@ -335,7 +306,6 @@ Dart_Handle DartUtils::MakeUint8Array(const uint8_t* buffer, intptr_t len) { return array; } - Dart_Handle DartUtils::SetWorkingDirectory() { IsolateData* isolate_data = reinterpret_cast(Dart_CurrentIsolateData()); @@ -344,7 +314,6 @@ Dart_Handle DartUtils::SetWorkingDirectory() { return SingleArgDart_Invoke(builtin_lib, "_setWorkingDirectory", directory); } - Dart_Handle DartUtils::ResolveUriInWorkingDirectory(Dart_Handle script_uri) { const int kNumArgs = 1; Dart_Handle dart_args[kNumArgs]; @@ -354,7 +323,6 @@ Dart_Handle DartUtils::ResolveUriInWorkingDirectory(Dart_Handle script_uri) { dart_args); } - Dart_Handle DartUtils::LibraryFilePath(Dart_Handle library_uri) { const int kNumArgs = 1; Dart_Handle dart_args[kNumArgs]; @@ -363,7 +331,6 @@ Dart_Handle DartUtils::LibraryFilePath(Dart_Handle library_uri) { kNumArgs, dart_args); } - Dart_Handle DartUtils::ResolveScript(Dart_Handle url) { const int kNumArgs = 1; Dart_Handle dart_args[kNumArgs]; @@ -372,7 +339,6 @@ Dart_Handle DartUtils::ResolveScript(Dart_Handle url) { kNumArgs, dart_args); } - static Dart_Handle LoadDataAsync_Invoke(Dart_Handle tag, Dart_Handle url, Dart_Handle library_url) { @@ -386,7 +352,6 @@ static Dart_Handle LoadDataAsync_Invoke(Dart_Handle tag, dart_args); } - Dart_Handle DartUtils::LibraryTagHandler(Dart_LibraryTag tag, Dart_Handle library, Dart_Handle url) { @@ -471,7 +436,6 @@ Dart_Handle DartUtils::LibraryTagHandler(Dart_LibraryTag tag, return LoadDataAsync_Invoke(Dart_NewInteger(tag), url, library_url); } - static bool CheckMagicNumber(const uint8_t** buf, intptr_t* len, const MagicNumberData& magic_number) { @@ -486,7 +450,6 @@ static bool CheckMagicNumber(const uint8_t** buf, return false; } - DartUtils::MagicNumber DartUtils::SniffForMagicNumber(const uint8_t** buf, intptr_t* len) { if (CheckMagicNumber(buf, len, snapshot_magic_number)) { @@ -500,7 +463,6 @@ DartUtils::MagicNumber DartUtils::SniffForMagicNumber(const uint8_t** buf, return kUnknownMagicNumber; } - void DartUtils::WriteMagicNumber(File* file) { // Write a magic number and version information into the snapshot file. bool bytes_written = @@ -508,7 +470,6 @@ void DartUtils::WriteMagicNumber(File* file) { ASSERT(bytes_written); } - Dart_Handle DartUtils::LoadScript(const char* script_uri) { Dart_TimelineEvent("LoadScript", Dart_TimelineGetMicros(), Dart_GetMainPortId(), Dart_Timeline_Event_Async_Begin, 0, @@ -517,7 +478,6 @@ Dart_Handle DartUtils::LoadScript(const char* script_uri) { return LoadDataAsync_Invoke(Dart_Null(), uri, Dart_Null()); } - void FUNCTION_NAME(Builtin_GetCurrentDirectory)(Dart_NativeArguments args) { const char* current = Directory::Current(); if (current != NULL) { @@ -528,7 +488,6 @@ void FUNCTION_NAME(Builtin_GetCurrentDirectory)(Dart_NativeArguments args) { } } - Dart_Handle DartUtils::PrepareBuiltinLibrary(Dart_Handle builtin_lib, Dart_Handle internal_lib, bool is_service_isolate, @@ -558,7 +517,6 @@ Dart_Handle DartUtils::PrepareBuiltinLibrary(Dart_Handle builtin_lib, return Dart_True(); } - Dart_Handle DartUtils::PrepareCoreLibrary(Dart_Handle core_lib, Dart_Handle builtin_lib, bool is_service_isolate) { @@ -574,7 +532,6 @@ Dart_Handle DartUtils::PrepareCoreLibrary(Dart_Handle core_lib, return Dart_True(); } - Dart_Handle DartUtils::PrepareAsyncLibrary(Dart_Handle async_lib, Dart_Handle isolate_lib) { Dart_Handle schedule_immediate_closure = Dart_Invoke( @@ -586,17 +543,14 @@ Dart_Handle DartUtils::PrepareAsyncLibrary(Dart_Handle async_lib, args); } - Dart_Handle DartUtils::PrepareIOLibrary(Dart_Handle io_lib) { return Dart_Invoke(io_lib, NewString("_setupHooks"), 0, NULL); } - Dart_Handle DartUtils::PrepareIsolateLibrary(Dart_Handle isolate_lib) { return Dart_Invoke(isolate_lib, NewString("_setupHooks"), 0, NULL); } - Dart_Handle DartUtils::SetupServiceLoadPort() { // Wait for the service isolate to initialize the load port. Dart_Port load_port = Dart_ServiceWaitForLoadPort(); @@ -607,7 +561,6 @@ Dart_Handle DartUtils::SetupServiceLoadPort() { return Builtin::SetLoadPort(load_port); } - Dart_Handle DartUtils::SetupPackageRoot(const char* package_root, const char* packages_config) { // Set up package root if specified. @@ -634,7 +587,6 @@ Dart_Handle DartUtils::SetupPackageRoot(const char* package_root, return Dart_True(); } - Dart_Handle DartUtils::PrepareForScriptLoading(bool is_service_isolate, bool trace_loading) { // First ensure all required libraries are available. @@ -686,7 +638,6 @@ Dart_Handle DartUtils::PrepareForScriptLoading(bool is_service_isolate, return result; } - Dart_Handle DartUtils::SetupIOLibrary(const char* script_uri) { Dart_Handle io_lib_url = NewString(kIOLibURL); RETURN_IF_ERROR(io_lib_url); @@ -704,13 +655,11 @@ Dart_Handle DartUtils::SetupIOLibrary(const char* script_uri) { return Dart_Null(); } - bool DartUtils::PostNull(Dart_Port port_id) { // Post a message with just the null object. return Dart_PostCObject(port_id, CObject::Null()->AsApiCObject()); } - bool DartUtils::PostInt32(Dart_Port port_id, int32_t value) { // Post a message with the integer value. int32_t min = 0xc0000000; // -1073741824 @@ -722,7 +671,6 @@ bool DartUtils::PostInt32(Dart_Port port_id, int32_t value) { return Dart_PostCObject(port_id, &object); } - bool DartUtils::PostInt64(Dart_Port port_id, int64_t value) { // Post a message with the integer value. Dart_CObject object; @@ -731,21 +679,18 @@ bool DartUtils::PostInt64(Dart_Port port_id, int64_t value) { return Dart_PostCObject(port_id, &object); } - Dart_Handle DartUtils::GetDartType(const char* library_url, const char* class_name) { return Dart_GetType(Dart_LookupLibrary(NewString(library_url)), NewString(class_name), 0, NULL); } - Dart_Handle DartUtils::NewDartOSError() { // Extract the current OS error. OSError os_error; return NewDartOSError(&os_error); } - Dart_Handle DartUtils::NewDartOSError(OSError* os_error) { // Create a dart:io OSError object with the information retrieved from the OS. Dart_Handle type = GetDartType(kIOLibURL, "OSError"); @@ -756,7 +701,6 @@ Dart_Handle DartUtils::NewDartOSError(OSError* os_error) { return Dart_New(type, Dart_Null(), 2, args); } - Dart_Handle DartUtils::NewDartExceptionWithOSError(const char* library_url, const char* exception_name, const char* message, @@ -770,7 +714,6 @@ Dart_Handle DartUtils::NewDartExceptionWithOSError(const char* library_url, return Dart_New(type, Dart_Null(), 2, args); } - Dart_Handle DartUtils::NewDartExceptionWithMessage(const char* library_url, const char* exception_name, const char* message) { @@ -786,17 +729,14 @@ Dart_Handle DartUtils::NewDartExceptionWithMessage(const char* library_url, } } - Dart_Handle DartUtils::NewDartArgumentError(const char* message) { return NewDartExceptionWithMessage(kCoreLibURL, "ArgumentError", message); } - Dart_Handle DartUtils::NewDartUnsupportedError(const char* message) { return NewDartExceptionWithMessage(kCoreLibURL, "UnsupportedError", message); } - Dart_Handle DartUtils::NewDartIOException(const char* exception_name, const char* message, Dart_Handle os_error) { @@ -805,7 +745,6 @@ Dart_Handle DartUtils::NewDartIOException(const char* exception_name, os_error); } - Dart_Handle DartUtils::NewError(const char* format, ...) { va_list args; va_start(args, format); @@ -822,18 +761,15 @@ Dart_Handle DartUtils::NewError(const char* format, ...) { return Dart_NewApiError(buffer); } - Dart_Handle DartUtils::NewInternalError(const char* message) { return NewDartExceptionWithMessage(kCoreLibURL, "_InternalError", message); } - bool DartUtils::SetOriginalWorkingDirectory() { original_working_directory = Directory::CurrentNoScope(); return original_working_directory != NULL; } - Dart_Handle DartUtils::GetCanonicalizableWorkingDirectory() { const char* str = DartUtils::original_working_directory; intptr_t len = strlen(str); @@ -845,7 +781,6 @@ Dart_Handle DartUtils::GetCanonicalizableWorkingDirectory() { return Dart_NewStringFromCString(new_str); } - // Statically allocated Dart_CObject instances for immutable // objects. As these will be used by different threads the use of // these depends on the fact that the marking internally in the @@ -857,27 +792,22 @@ CObject CObject::null_ = CObject(&api_null_); CObject CObject::true_ = CObject(&api_true_); CObject CObject::false_ = CObject(&api_false_); - CObject* CObject::Null() { return &null_; } - CObject* CObject::True() { return &true_; } - CObject* CObject::False() { return &false_; } - CObject* CObject::Bool(bool value) { return value ? &true_ : &false_; } - Dart_CObject* CObject::New(Dart_CObject_Type type, int additional_bytes) { Dart_CObject* cobject = reinterpret_cast( Dart_ScopeAllocate(sizeof(Dart_CObject) + additional_bytes)); @@ -885,21 +815,18 @@ Dart_CObject* CObject::New(Dart_CObject_Type type, int additional_bytes) { return cobject; } - Dart_CObject* CObject::NewInt32(int32_t value) { Dart_CObject* cobject = New(Dart_CObject_kInt32); cobject->value.as_int32 = value; return cobject; } - Dart_CObject* CObject::NewInt64(int64_t value) { Dart_CObject* cobject = New(Dart_CObject_kInt64); cobject->value.as_int64 = value; return cobject; } - Dart_CObject* CObject::NewIntptr(intptr_t value) { // Pointer values passed as intptr_t are always send as int64_t. Dart_CObject* cobject = New(Dart_CObject_kInt64); @@ -907,20 +834,17 @@ Dart_CObject* CObject::NewIntptr(intptr_t value) { return cobject; } - static bool IsHexDigit(char c) { return (('0' <= c) && (c <= '9')) || (('A' <= c) && (c <= 'F')) || (('a' <= c) && (c <= 'f')); } - static int HexDigitToInt(char c) { if (('0' <= c) && (c <= '9')) return c - '0'; if (('A' <= c) && (c <= 'F')) return 10 + (c - 'A'); return 10 + (c - 'a'); } - Dart_CObject* CObject::NewBigint(const char* hex_value) { if (hex_value == NULL) { return NULL; @@ -976,14 +900,12 @@ Dart_CObject* CObject::NewBigint(const char* hex_value) { return cobject; } - static char IntToHexDigit(int i) { ASSERT(0 <= i && i < 16); if (i < 10) return static_cast('0' + i); return static_cast('A' + (i - 10)); } - char* CObject::BigintToHexValue(Dart_CObject* bigint) { ASSERT(bigint->type == Dart_CObject_kBigint); const intptr_t used = bigint->value.as_bigint.used; @@ -1037,21 +959,18 @@ char* CObject::BigintToHexValue(Dart_CObject* bigint) { return hex_value; } - Dart_CObject* CObject::NewDouble(double value) { Dart_CObject* cobject = New(Dart_CObject_kDouble); cobject->value.as_double = value; return cobject; } - Dart_CObject* CObject::NewString(intptr_t length) { Dart_CObject* cobject = New(Dart_CObject_kString, length + 1); cobject->value.as_string = reinterpret_cast(cobject + 1); return cobject; } - Dart_CObject* CObject::NewString(const char* str) { intptr_t length = strlen(str); Dart_CObject* cobject = NewString(length); @@ -1059,7 +978,6 @@ Dart_CObject* CObject::NewString(const char* str) { return cobject; } - Dart_CObject* CObject::NewArray(intptr_t length) { Dart_CObject* cobject = New(Dart_CObject_kArray, length * sizeof(Dart_CObject*)); // NOLINT @@ -1069,7 +987,6 @@ Dart_CObject* CObject::NewArray(intptr_t length) { return cobject; } - Dart_CObject* CObject::NewUint8Array(intptr_t length) { Dart_CObject* cobject = New(Dart_CObject_kTypedData, length); cobject->value.as_typed_data.type = Dart_TypedData_kUint8; @@ -1078,7 +995,6 @@ Dart_CObject* CObject::NewUint8Array(intptr_t length) { return cobject; } - Dart_CObject* CObject::NewUint32Array(intptr_t length) { Dart_CObject* cobject = New(Dart_CObject_kTypedData, 4 * length); cobject->value.as_typed_data.type = Dart_TypedData_kUint32; @@ -1087,7 +1003,6 @@ Dart_CObject* CObject::NewUint32Array(intptr_t length) { return cobject; } - Dart_CObject* CObject::NewExternalUint8Array( intptr_t length, uint8_t* data, @@ -1102,7 +1017,6 @@ Dart_CObject* CObject::NewExternalUint8Array( return cobject; } - Dart_CObject* CObject::NewIOBuffer(int64_t length) { // Make sure that we do not have an integer overflow here. Actual check // against max elements will be done at the time of writing, as the constant @@ -1116,7 +1030,6 @@ Dart_CObject* CObject::NewIOBuffer(int64_t length) { IOBuffer::Finalizer); } - void CObject::FreeIOBufferData(Dart_CObject* cobject) { ASSERT(cobject->type == Dart_CObject_kExternalTypedData); cobject->value.as_external_typed_data.callback( @@ -1124,21 +1037,18 @@ void CObject::FreeIOBufferData(Dart_CObject* cobject) { cobject->value.as_external_typed_data.data = NULL; } - CObject* CObject::IllegalArgumentError() { CObjectArray* result = new CObjectArray(CObject::NewArray(1)); result->SetAt(0, new CObjectInt32(CObject::NewInt32(kArgumentError))); return result; } - CObject* CObject::FileClosedError() { CObjectArray* result = new CObjectArray(CObject::NewArray(1)); result->SetAt(0, new CObjectInt32(CObject::NewInt32(kFileClosedError))); return result; } - CObject* CObject::NewOSError() { OSError os_error; return NewOSError(&os_error); diff --git a/runtime/bin/dartutils.h b/runtime/bin/dartutils.h index b98b3a153c1..b35ee863c32 100644 --- a/runtime/bin/dartutils.h +++ b/runtime/bin/dartutils.h @@ -33,7 +33,6 @@ static inline Dart_Handle ThrowIfError(Dart_Handle handle) { return handle; } - class CommandLineOptions { public: explicit CommandLineOptions(int max_count) @@ -78,7 +77,6 @@ class CommandLineOptions { DISALLOW_COPY_AND_ASSIGN(CommandLineOptions); }; - class DartUtils { public: // Returns the integer value of a Dart object. If the object is not @@ -261,7 +259,6 @@ class DartUtils { DISALLOW_IMPLICIT_CONSTRUCTORS(DartUtils); }; - class CObject { public: // These match the constants in sdk/lib/io/common.dart. @@ -358,7 +355,6 @@ class CObject { DISALLOW_COPY_AND_ASSIGN(CObject); }; - #define DECLARE_COBJECT_CONSTRUCTORS(t) \ explicit CObject##t(Dart_CObject* cobject) : CObject(cobject) { \ ASSERT(type() == Dart_CObject_k##t); \ @@ -370,7 +366,6 @@ class CObject { cobject_ = cobject->AsApiCObject(); \ } - #define DECLARE_COBJECT_TYPED_DATA_CONSTRUCTORS(t) \ explicit CObject##t##Array(Dart_CObject* cobject) : CObject(cobject) { \ ASSERT(type() == Dart_CObject_kTypedData); \ @@ -384,7 +379,6 @@ class CObject { cobject_ = cobject->AsApiCObject(); \ } - #define DECLARE_COBJECT_EXTERNAL_TYPED_DATA_CONSTRUCTORS(t) \ explicit CObjectExternal##t##Array(Dart_CObject* cobject) \ : CObject(cobject) { \ @@ -399,7 +393,6 @@ class CObject { cobject_ = cobject->AsApiCObject(); \ } - class CObjectBool : public CObject { public: DECLARE_COBJECT_CONSTRUCTORS(Bool) @@ -410,7 +403,6 @@ class CObjectBool : public CObject { DISALLOW_COPY_AND_ASSIGN(CObjectBool); }; - class CObjectInt32 : public CObject { public: DECLARE_COBJECT_CONSTRUCTORS(Int32) @@ -421,7 +413,6 @@ class CObjectInt32 : public CObject { DISALLOW_COPY_AND_ASSIGN(CObjectInt32); }; - class CObjectInt64 : public CObject { public: DECLARE_COBJECT_CONSTRUCTORS(Int64) @@ -432,7 +423,6 @@ class CObjectInt64 : public CObject { DISALLOW_COPY_AND_ASSIGN(CObjectInt64); }; - class CObjectIntptr : public CObject { public: explicit CObjectIntptr(Dart_CObject* cobject) : CObject(cobject) { @@ -461,7 +451,6 @@ class CObjectIntptr : public CObject { DISALLOW_COPY_AND_ASSIGN(CObjectIntptr); }; - class CObjectBigint : public CObject { public: // DECLARE_COBJECT_CONSTRUCTORS(Bigint) would miss hex_value_ initialization. @@ -492,7 +481,6 @@ class CObjectBigint : public CObject { DISALLOW_COPY_AND_ASSIGN(CObjectBigint); }; - class CObjectDouble : public CObject { public: DECLARE_COBJECT_CONSTRUCTORS(Double) @@ -503,7 +491,6 @@ class CObjectDouble : public CObject { DISALLOW_COPY_AND_ASSIGN(CObjectDouble); }; - class CObjectString : public CObject { public: DECLARE_COBJECT_CONSTRUCTORS(String) @@ -515,7 +502,6 @@ class CObjectString : public CObject { DISALLOW_COPY_AND_ASSIGN(CObjectString); }; - class CObjectArray : public CObject { public: DECLARE_COBJECT_CONSTRUCTORS(Array) @@ -532,7 +518,6 @@ class CObjectArray : public CObject { DISALLOW_COPY_AND_ASSIGN(CObjectArray); }; - class CObjectSendPort : public CObject { public: DECLARE_COBJECT_CONSTRUCTORS(SendPort) @@ -544,7 +529,6 @@ class CObjectSendPort : public CObject { DISALLOW_COPY_AND_ASSIGN(CObjectSendPort); }; - class CObjectTypedData : public CObject { public: explicit CObjectTypedData(Dart_CObject* cobject) : CObject(cobject) { @@ -567,7 +551,6 @@ class CObjectTypedData : public CObject { DISALLOW_COPY_AND_ASSIGN(CObjectTypedData); }; - class CObjectUint8Array : public CObject { public: DECLARE_COBJECT_TYPED_DATA_CONSTRUCTORS(Uint8) @@ -579,7 +562,6 @@ class CObjectUint8Array : public CObject { DISALLOW_COPY_AND_ASSIGN(CObjectUint8Array); }; - class CObjectExternalUint8Array : public CObject { public: DECLARE_COBJECT_EXTERNAL_TYPED_DATA_CONSTRUCTORS(Uint8) @@ -600,7 +582,6 @@ class CObjectExternalUint8Array : public CObject { DISALLOW_COPY_AND_ASSIGN(CObjectExternalUint8Array); }; - class ScopedBlockingCall { public: ScopedBlockingCall() { Dart_ThreadDisableProfiling(); } @@ -612,7 +593,6 @@ class ScopedBlockingCall { DISALLOW_COPY_AND_ASSIGN(ScopedBlockingCall); }; - // Where the argument to the constructor is the handle for an object // implementing List, this class creates a scope in which the memory // backing the list can be accessed. diff --git a/runtime/bin/dfe.cc b/runtime/bin/dfe.cc index 8ad055df505..a5fb69012a6 100644 --- a/runtime/bin/dfe.cc +++ b/runtime/bin/dfe.cc @@ -15,7 +15,6 @@ namespace bin { const char kPlatformBinaryName[] = "platform.dill"; const char kVMServiceIOBinaryName[] = "vmservice_io.dill"; - DFE::DFE() : frontend_filename_(NULL), platform_binary_filename_(NULL), @@ -23,7 +22,6 @@ DFE::DFE() kernel_platform_(NULL), kernel_vmservice_io_(NULL) {} - DFE::~DFE() { frontend_filename_ = NULL; @@ -43,7 +41,6 @@ DFE::~DFE() { } } - void DFE::SetKernelBinaries(const char* name) { intptr_t len = snprintf(NULL, 0, "%s%s%s", name, File::PathSeparator(), kPlatformBinaryName) + @@ -60,7 +57,6 @@ void DFE::SetKernelBinaries(const char* name) { File::PathSeparator(), kVMServiceIOBinaryName); } - Dart_Handle DFE::ReloadScript(Dart_Isolate isolate, const char* url_string) { ASSERT(!Dart_IsServiceIsolate(isolate) && !Dart_IsKernelIsolate(isolate)); // First check if the URL points to a Kernel IR file in which case we @@ -94,7 +90,6 @@ Dart_Handle DFE::ReloadScript(Dart_Isolate isolate, const char* url_string) { return Dart_Null(); } - void* DFE::CompileAndReadScript(const char* script_uri, char** error, int* exit_code) { @@ -118,17 +113,14 @@ void* DFE::CompileAndReadScript(const char* script_uri, return NULL; } - void* DFE::ReadPlatform() { return kernel_platform_ = ReadScript(platform_binary_filename_); } - void* DFE::ReadVMServiceIO() { return kernel_vmservice_io_ = ReadScript(vmservice_io_binary_filename_); } - void* DFE::ReadScript(const char* script_uri) { const uint8_t* buffer = NULL; intptr_t buffer_length = -1; @@ -139,7 +131,6 @@ void* DFE::ReadScript(const char* script_uri) { return NULL; } - bool DFE::TryReadKernelFile(const char* script_uri, const uint8_t** kernel_ir, intptr_t* kernel_ir_size) { @@ -173,6 +164,5 @@ bool DFE::TryReadKernelFile(const char* script_uri, return false; } - } // namespace bin } // namespace dart diff --git a/runtime/bin/directory.cc b/runtime/bin/directory.cc index f99a5d1c5eb..18d2629f5dc 100644 --- a/runtime/bin/directory.cc +++ b/runtime/bin/directory.cc @@ -25,7 +25,6 @@ void FUNCTION_NAME(Directory_Current)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Directory_SetCurrent)(Dart_NativeArguments args) { int argc = Dart_GetNativeArgumentCount(args); Dart_Handle path; @@ -43,7 +42,6 @@ void FUNCTION_NAME(Directory_SetCurrent)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Directory_Exists)(Dart_NativeArguments args) { static const int kExists = 1; static const int kDoesNotExist = 0; @@ -59,7 +57,6 @@ void FUNCTION_NAME(Directory_Exists)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Directory_Create)(Dart_NativeArguments args) { Dart_Handle path = Dart_GetNativeArgument(args, 0); if (Directory::Create(DartUtils::GetStringValue(path))) { @@ -69,13 +66,11 @@ void FUNCTION_NAME(Directory_Create)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Directory_SystemTemp)(Dart_NativeArguments args) { const char* result = Directory::SystemTemp(); Dart_SetReturnValue(args, DartUtils::NewString(result)); } - void FUNCTION_NAME(Directory_CreateTemp)(Dart_NativeArguments args) { Dart_Handle path = Dart_GetNativeArgument(args, 0); if (!Dart_IsString(path)) { @@ -92,7 +87,6 @@ void FUNCTION_NAME(Directory_CreateTemp)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Directory_Delete)(Dart_NativeArguments args) { Dart_Handle path = Dart_GetNativeArgument(args, 0); Dart_Handle recursive = Dart_GetNativeArgument(args, 1); @@ -104,7 +98,6 @@ void FUNCTION_NAME(Directory_Delete)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Directory_Rename)(Dart_NativeArguments args) { Dart_Handle path = Dart_GetNativeArgument(args, 0); Dart_Handle newPath = Dart_GetNativeArgument(args, 1); @@ -116,7 +109,6 @@ void FUNCTION_NAME(Directory_Rename)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Directory_FillWithDirectoryListing)( Dart_NativeArguments args) { // The list that we should fill. @@ -142,10 +134,8 @@ void FUNCTION_NAME(Directory_FillWithDirectoryListing)( } } - static const int kAsyncDirectoryListerFieldIndex = 0; - void FUNCTION_NAME(Directory_GetAsyncDirectoryListerPointer)( Dart_NativeArguments args) { AsyncDirectoryListing* listing; @@ -164,7 +154,6 @@ void FUNCTION_NAME(Directory_GetAsyncDirectoryListerPointer)( } } - static void ReleaseListing(void* isolate_callback_data, Dart_WeakPersistentHandle handle, void* peer) { @@ -173,7 +162,6 @@ static void ReleaseListing(void* isolate_callback_data, listing->Release(); } - void FUNCTION_NAME(Directory_SetAsyncDirectoryListerPointer)( Dart_NativeArguments args) { Dart_Handle dart_this = ThrowIfError(Dart_GetNativeArgument(args, 0)); @@ -191,7 +179,6 @@ void FUNCTION_NAME(Directory_SetAsyncDirectoryListerPointer)( } } - void Directory::SetSystemTemp(const char* path) { if (system_temp_path_override_ != NULL) { free(system_temp_path_override_); @@ -202,7 +189,6 @@ void Directory::SetSystemTemp(const char* path) { } } - CObject* Directory::CreateRequest(const CObjectArray& request) { if ((request.Length() == 1) && request[0]->IsString()) { CObjectString path(request[0]); @@ -215,7 +201,6 @@ CObject* Directory::CreateRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* Directory::DeleteRequest(const CObjectArray& request) { if ((request.Length() == 2) && request[0]->IsString() && request[1]->IsBool()) { @@ -230,7 +215,6 @@ CObject* Directory::DeleteRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* Directory::ExistsRequest(const CObjectArray& request) { static const int kExists = 1; static const int kDoesNotExist = 0; @@ -248,7 +232,6 @@ CObject* Directory::ExistsRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* Directory::CreateTempRequest(const CObjectArray& request) { if ((request.Length() == 1) && request[0]->IsString()) { CObjectString path(request[0]); @@ -263,7 +246,6 @@ CObject* Directory::CreateTempRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - static CObject* CreateIllegalArgumentError() { // Respond with an illegal argument list error message. CObjectArray* error = new CObjectArray(CObject::NewArray(3)); @@ -274,7 +256,6 @@ static CObject* CreateIllegalArgumentError() { return error; } - CObject* Directory::ListStartRequest(const CObjectArray& request) { if ((request.Length() == 3) && request[0]->IsString() && request[1]->IsBool() && request[2]->IsBool()) { @@ -301,7 +282,6 @@ CObject* Directory::ListStartRequest(const CObjectArray& request) { return CreateIllegalArgumentError(); } - CObject* Directory::ListNextRequest(const CObjectArray& request) { if ((request.Length() == 1) && request[0]->IsIntptr()) { CObjectIntptr ptr(request[0]); @@ -323,7 +303,6 @@ CObject* Directory::ListNextRequest(const CObjectArray& request) { return CreateIllegalArgumentError(); } - CObject* Directory::ListStopRequest(const CObjectArray& request) { if ((request.Length() == 1) && request[0]->IsIntptr()) { CObjectIntptr ptr(request[0]); @@ -343,7 +322,6 @@ CObject* Directory::ListStopRequest(const CObjectArray& request) { return CreateIllegalArgumentError(); } - CObject* Directory::RenameRequest(const CObjectArray& request) { if ((request.Length() == 2) && request[0]->IsString() && request[1]->IsString()) { @@ -358,7 +336,6 @@ CObject* Directory::RenameRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - bool AsyncDirectoryListing::AddFileSystemEntityToResponse(Response type, const char* arg) { array_->SetAt(index_++, new CObjectInt32(CObject::NewInt32(type))); @@ -370,27 +347,22 @@ bool AsyncDirectoryListing::AddFileSystemEntityToResponse(Response type, return index_ < length_; } - bool AsyncDirectoryListing::HandleDirectory(const char* dir_name) { return AddFileSystemEntityToResponse(kListDirectory, dir_name); } - bool AsyncDirectoryListing::HandleFile(const char* file_name) { return AddFileSystemEntityToResponse(kListFile, file_name); } - bool AsyncDirectoryListing::HandleLink(const char* link_name) { return AddFileSystemEntityToResponse(kListLink, link_name); } - void AsyncDirectoryListing::HandleDone() { AddFileSystemEntityToResponse(kListDone, NULL); } - bool AsyncDirectoryListing::HandleError() { CObject* err = CObject::NewOSError(); array_->SetAt(index_++, new CObjectInt32(CObject::NewInt32(kListError))); @@ -405,7 +377,6 @@ bool AsyncDirectoryListing::HandleError() { return index_ < length_; } - bool SyncDirectoryListing::HandleDirectory(const char* dir_name) { Dart_Handle dir_name_dart = DartUtils::NewString(dir_name); Dart_Handle dir = Dart_New(directory_type_, Dart_Null(), 1, &dir_name_dart); @@ -417,7 +388,6 @@ bool SyncDirectoryListing::HandleDirectory(const char* dir_name) { return true; } - bool SyncDirectoryListing::HandleLink(const char* link_name) { Dart_Handle link_name_dart = DartUtils::NewString(link_name); Dart_Handle link = Dart_New(link_type_, Dart_Null(), 1, &link_name_dart); @@ -429,7 +399,6 @@ bool SyncDirectoryListing::HandleLink(const char* link_name) { return true; } - bool SyncDirectoryListing::HandleFile(const char* file_name) { Dart_Handle file_name_dart = DartUtils::NewString(file_name); Dart_Handle file = Dart_New(file_type_, Dart_Null(), 1, &file_name_dart); @@ -441,7 +410,6 @@ bool SyncDirectoryListing::HandleFile(const char* file_name) { return true; } - bool SyncDirectoryListing::HandleError() { Dart_Handle dart_os_error = DartUtils::NewDartOSError(); Dart_Handle args[3]; @@ -455,7 +423,6 @@ bool SyncDirectoryListing::HandleError() { return false; } - static bool ListNext(DirectoryListing* listing) { switch (listing->top()->Next(listing)) { case kListFile: @@ -488,7 +455,6 @@ static bool ListNext(DirectoryListing* listing) { return false; } - void Directory::List(DirectoryListing* listing) { if (listing->error()) { listing->HandleError(); diff --git a/runtime/bin/directory.h b/runtime/bin/directory.h index 433a6cca59f..835a3059dc5 100644 --- a/runtime/bin/directory.h +++ b/runtime/bin/directory.h @@ -144,7 +144,6 @@ class DirectoryListing { bool follow_links_; }; - class AsyncDirectoryListing : public ReferenceCounted, public DirectoryListing { public: @@ -189,7 +188,6 @@ class AsyncDirectoryListing : public ReferenceCounted, DISALLOW_IMPLICIT_CONSTRUCTORS(AsyncDirectoryListing); }; - class SyncDirectoryListing : public DirectoryListing { public: SyncDirectoryListing(Dart_Handle results, @@ -224,7 +222,6 @@ class SyncDirectoryListing : public DirectoryListing { DISALLOW_IMPLICIT_CONSTRUCTORS(SyncDirectoryListing); }; - class Directory { public: enum ExistsResult { UNKNOWN, EXISTS, DOES_NOT_EXIST }; diff --git a/runtime/bin/directory_android.cc b/runtime/bin/directory_android.cc index 43ad142bbd5..61addabc367 100644 --- a/runtime/bin/directory_android.cc +++ b/runtime/bin/directory_android.cc @@ -26,34 +26,28 @@ PathBuffer::PathBuffer() : length_(0) { data_ = calloc(PATH_MAX + 1, sizeof(char)); // NOLINT } - PathBuffer::~PathBuffer() { free(data_); } - bool PathBuffer::AddW(const wchar_t* name) { UNREACHABLE(); return false; } - char* PathBuffer::AsString() const { return reinterpret_cast(data_); } - wchar_t* PathBuffer::AsStringW() const { UNREACHABLE(); return NULL; } - const char* PathBuffer::AsScopedString() const { return DartUtils::ScopedCopyCString(AsString()); } - bool PathBuffer::Add(const char* name) { char* data = AsString(); int written = snprintf(data + length_, PATH_MAX - length_, "%s", name); @@ -68,13 +62,11 @@ bool PathBuffer::Add(const char* name) { } } - void PathBuffer::Reset(intptr_t new_length) { length_ = new_length; AsString()[length_] = '\0'; } - // A linked list of symbolic links, with their unique file system identifiers. // These are scanned to detect loops while doing a recursive directory listing. struct LinkList { @@ -83,7 +75,6 @@ struct LinkList { LinkList* next; }; - ListType DirectoryListingEntry::Next(DirectoryListing* listing) { if (done_) { return kListDone; @@ -217,7 +208,6 @@ ListType DirectoryListingEntry::Next(DirectoryListing* listing) { return kListDone; } - DirectoryListingEntry::~DirectoryListingEntry() { ResetLink(); if (lister_ != 0) { @@ -225,7 +215,6 @@ DirectoryListingEntry::~DirectoryListingEntry() { } } - void DirectoryListingEntry::ResetLink() { if ((link_ != NULL) && ((parent_ == NULL) || (parent_->link_ != link_))) { delete link_; @@ -236,15 +225,12 @@ void DirectoryListingEntry::ResetLink() { } } - static bool DeleteRecursively(PathBuffer* path); - static bool DeleteFile(char* file_name, PathBuffer* path) { return path->Add(file_name) && (unlink(path->AsString()) == 0); } - static bool DeleteDir(char* dir_name, PathBuffer* path) { if ((strcmp(dir_name, ".") == 0) || (strcmp(dir_name, "..") == 0)) { return true; @@ -252,7 +238,6 @@ static bool DeleteDir(char* dir_name, PathBuffer* path) { return path->Add(dir_name) && DeleteRecursively(path); } - static bool DeleteRecursively(PathBuffer* path) { // Do not recurse into links for deletion. Instead delete the link. // If it's a file, delete it. @@ -343,7 +328,6 @@ static bool DeleteRecursively(PathBuffer* path) { return false; } - Directory::ExistsResult Directory::Exists(const char* dir_name) { struct stat entry_info; int success = NO_RETRY_EXPECTED(stat(dir_name, &entry_info)); @@ -370,7 +354,6 @@ Directory::ExistsResult Directory::Exists(const char* dir_name) { } } - char* Directory::CurrentNoScope() { // Android's getcwd adheres closely to the POSIX standard. It won't // allocate memory. We need to make our own copy. @@ -382,7 +365,6 @@ char* Directory::CurrentNoScope() { return strdup(buffer); } - const char* Directory::Current() { char buffer[PATH_MAX]; if (getcwd(buffer, PATH_MAX) == NULL) { @@ -391,13 +373,11 @@ const char* Directory::Current() { return DartUtils::ScopedCopyCString(buffer); } - bool Directory::SetCurrent(const char* path) { int result = NO_RETRY_EXPECTED(chdir(path)); return (result == 0); } - bool Directory::Create(const char* dir_name) { // Create the directory with the permissions specified by the // process umask. @@ -409,7 +389,6 @@ bool Directory::Create(const char* dir_name) { return (result == 0); } - const char* Directory::SystemTemp() { if (Directory::system_temp_path_override_ != NULL) { return DartUtils::ScopedCopyCString(Directory::system_temp_path_override_); @@ -429,7 +408,6 @@ const char* Directory::SystemTemp() { return ANDROID_TEMP_DIR; } - const char* Directory::CreateTemp(const char* prefix) { // Returns a new, unused directory name, adding characters to the end // of prefix. Creates the directory with the permissions specified @@ -453,7 +431,6 @@ const char* Directory::CreateTemp(const char* prefix) { return path.AsScopedString(); } - bool Directory::Delete(const char* dir_name, bool recursive) { if (!recursive) { if ((File::GetType(dir_name, false) == File::kIsLink) && @@ -470,7 +447,6 @@ bool Directory::Delete(const char* dir_name, bool recursive) { } } - bool Directory::Rename(const char* path, const char* new_path) { ExistsResult exists = Exists(path); if (exists != EXISTS) { diff --git a/runtime/bin/directory_fuchsia.cc b/runtime/bin/directory_fuchsia.cc index c2139104c7e..6b7fc5bd501 100644 --- a/runtime/bin/directory_fuchsia.cc +++ b/runtime/bin/directory_fuchsia.cc @@ -7,13 +7,13 @@ #include "bin/directory.h" -#include // NOLINT -#include // NOLINT -#include // NOLINT -#include // NOLINT +#include // NOLINT +#include // NOLINT +#include // NOLINT +#include // NOLINT #include // NOLINT -#include // NOLINT -#include // NOLINT +#include // NOLINT +#include // NOLINT #include "bin/dartutils.h" #include "bin/file.h" @@ -27,34 +27,28 @@ PathBuffer::PathBuffer() : length_(0) { data_ = calloc(PATH_MAX + 1, sizeof(char)); // NOLINT } - PathBuffer::~PathBuffer() { free(data_); } - bool PathBuffer::AddW(const wchar_t* name) { UNREACHABLE(); return false; } - char* PathBuffer::AsString() const { return reinterpret_cast(data_); } - wchar_t* PathBuffer::AsStringW() const { UNREACHABLE(); return NULL; } - const char* PathBuffer::AsScopedString() const { return DartUtils::ScopedCopyCString(AsString()); } - bool PathBuffer::Add(const char* name) { const intptr_t name_length = strnlen(name, PATH_MAX + 1); if (name_length == 0) { @@ -74,13 +68,11 @@ bool PathBuffer::Add(const char* name) { } } - void PathBuffer::Reset(intptr_t new_length) { length_ = new_length; AsString()[length_] = '\0'; } - // A linked list of symbolic links, with their unique file system identifiers. // These are scanned to detect loops while doing a recursive directory listing. struct LinkList { @@ -89,7 +81,6 @@ struct LinkList { LinkList* next; }; - ListType DirectoryListingEntry::Next(DirectoryListing* listing) { if (done_) { return kListDone; @@ -189,7 +180,6 @@ ListType DirectoryListingEntry::Next(DirectoryListing* listing) { return kListDone; } - DirectoryListingEntry::~DirectoryListingEntry() { ResetLink(); if (lister_ != 0) { @@ -197,7 +187,6 @@ DirectoryListingEntry::~DirectoryListingEntry() { } } - void DirectoryListingEntry::ResetLink() { if ((link_ != NULL) && ((parent_ == NULL) || (parent_->link_ != link_))) { delete link_; @@ -208,7 +197,6 @@ void DirectoryListingEntry::ResetLink() { } } - Directory::ExistsResult Directory::Exists(const char* dir_name) { struct stat entry_info; int success = NO_RETRY_EXPECTED(stat(dir_name, &entry_info)); @@ -235,12 +223,10 @@ Directory::ExistsResult Directory::Exists(const char* dir_name) { } } - char* Directory::CurrentNoScope() { return getcwd(NULL, 0); } - const char* Directory::Current() { char buffer[PATH_MAX]; if (getcwd(buffer, PATH_MAX) == NULL) { @@ -249,12 +235,10 @@ const char* Directory::Current() { return DartUtils::ScopedCopyCString(buffer); } - bool Directory::SetCurrent(const char* path) { return (NO_RETRY_EXPECTED(chdir(path)) == 0); } - bool Directory::Create(const char* dir_name) { // Create the directory with the permissions specified by the // process umask. @@ -266,7 +250,6 @@ bool Directory::Create(const char* dir_name) { return (result == 0); } - const char* Directory::SystemTemp() { PathBuffer path; const char* temp_dir = getenv("TMPDIR"); @@ -289,7 +272,6 @@ const char* Directory::SystemTemp() { return path.AsScopedString(); } - const char* Directory::CreateTemp(const char* prefix) { // Returns a new, unused directory name, adding characters to the end // of prefix. Creates the directory with the permissions specified @@ -310,16 +292,13 @@ const char* Directory::CreateTemp(const char* prefix) { return path.AsScopedString(); } - static bool DeleteRecursively(PathBuffer* path); - static bool DeleteFile(char* file_name, PathBuffer* path) { return path->Add(file_name) && (NO_RETRY_EXPECTED(unlink(path->AsString())) == 0); } - static bool DeleteDir(char* dir_name, PathBuffer* path) { if ((strcmp(dir_name, ".") == 0) || (strcmp(dir_name, "..") == 0)) { return true; @@ -327,7 +306,6 @@ static bool DeleteDir(char* dir_name, PathBuffer* path) { return path->Add(dir_name) && DeleteRecursively(path); } - static bool DeleteRecursively(PathBuffer* path) { // Do not recurse into links for deletion. Instead delete the link. // If it's a file, delete it. @@ -402,7 +380,6 @@ static bool DeleteRecursively(PathBuffer* path) { return false; } - bool Directory::Delete(const char* dir_name, bool recursive) { if (!recursive) { if ((File::GetType(dir_name, false) == File::kIsLink) && @@ -419,7 +396,6 @@ bool Directory::Delete(const char* dir_name, bool recursive) { } } - bool Directory::Rename(const char* path, const char* new_path) { ExistsResult exists = Exists(path); if (exists != EXISTS) { diff --git a/runtime/bin/directory_linux.cc b/runtime/bin/directory_linux.cc index b3acd6ff119..6e50322f564 100644 --- a/runtime/bin/directory_linux.cc +++ b/runtime/bin/directory_linux.cc @@ -27,34 +27,28 @@ PathBuffer::PathBuffer() : length_(0) { data_ = calloc(PATH_MAX + 1, sizeof(char)); // NOLINT } - PathBuffer::~PathBuffer() { free(data_); } - bool PathBuffer::AddW(const wchar_t* name) { UNREACHABLE(); return false; } - char* PathBuffer::AsString() const { return reinterpret_cast(data_); } - wchar_t* PathBuffer::AsStringW() const { UNREACHABLE(); return NULL; } - const char* PathBuffer::AsScopedString() const { return DartUtils::ScopedCopyCString(AsString()); } - bool PathBuffer::Add(const char* name) { char* data = AsString(); int written = snprintf(data + length_, PATH_MAX - length_, "%s", name); @@ -69,13 +63,11 @@ bool PathBuffer::Add(const char* name) { } } - void PathBuffer::Reset(intptr_t new_length) { length_ = new_length; AsString()[length_] = '\0'; } - // A linked list of symbolic links, with their unique file system identifiers. // These are scanned to detect loops while doing a recursive directory listing. struct LinkList { @@ -84,7 +76,6 @@ struct LinkList { LinkList* next; }; - ListType DirectoryListingEntry::Next(DirectoryListing* listing) { if (done_) { return kListDone; @@ -214,7 +205,6 @@ ListType DirectoryListingEntry::Next(DirectoryListing* listing) { return kListDone; } - DirectoryListingEntry::~DirectoryListingEntry() { ResetLink(); if (lister_ != 0) { @@ -222,7 +212,6 @@ DirectoryListingEntry::~DirectoryListingEntry() { } } - void DirectoryListingEntry::ResetLink() { if ((link_ != NULL) && ((parent_ == NULL) || (parent_->link_ != link_))) { delete link_; @@ -233,16 +222,13 @@ void DirectoryListingEntry::ResetLink() { } } - static bool DeleteRecursively(PathBuffer* path); - static bool DeleteFile(char* file_name, PathBuffer* path) { return path->Add(file_name) && (NO_RETRY_EXPECTED(unlink(path->AsString())) == 0); } - static bool DeleteDir(char* dir_name, PathBuffer* path) { if ((strcmp(dir_name, ".") == 0) || (strcmp(dir_name, "..") == 0)) { return true; @@ -250,7 +236,6 @@ static bool DeleteDir(char* dir_name, PathBuffer* path) { return path->Add(dir_name) && DeleteRecursively(path); } - static bool DeleteRecursively(PathBuffer* path) { // Do not recurse into links for deletion. Instead delete the link. // If it's a file, delete it. @@ -352,7 +337,6 @@ static bool DeleteRecursively(PathBuffer* path) { return false; } - Directory::ExistsResult Directory::Exists(const char* dir_name) { struct stat64 entry_info; int success = TEMP_FAILURE_RETRY(stat64(dir_name, &entry_info)); @@ -379,12 +363,10 @@ Directory::ExistsResult Directory::Exists(const char* dir_name) { } } - char* Directory::CurrentNoScope() { return getcwd(NULL, 0); } - const char* Directory::Current() { char buffer[PATH_MAX]; if (getcwd(buffer, PATH_MAX) == NULL) { @@ -393,12 +375,10 @@ const char* Directory::Current() { return DartUtils::ScopedCopyCString(buffer); } - bool Directory::SetCurrent(const char* path) { return (NO_RETRY_EXPECTED(chdir(path)) == 0); } - bool Directory::Create(const char* dir_name) { // Create the directory with the permissions specified by the // process umask. @@ -410,7 +390,6 @@ bool Directory::Create(const char* dir_name) { return (result == 0); } - const char* Directory::SystemTemp() { PathBuffer path; const char* temp_dir = getenv("TMPDIR"); @@ -433,7 +412,6 @@ const char* Directory::SystemTemp() { return path.AsScopedString(); } - const char* Directory::CreateTemp(const char* prefix) { // Returns a new, unused directory name, adding characters to the end // of prefix. Creates the directory with the permissions specified @@ -457,7 +435,6 @@ const char* Directory::CreateTemp(const char* prefix) { return path.AsScopedString(); } - bool Directory::Delete(const char* dir_name, bool recursive) { if (!recursive) { if ((File::GetType(dir_name, false) == File::kIsLink) && @@ -474,7 +451,6 @@ bool Directory::Delete(const char* dir_name, bool recursive) { } } - bool Directory::Rename(const char* path, const char* new_path) { ExistsResult exists = Exists(path); if (exists != EXISTS) { diff --git a/runtime/bin/directory_macos.cc b/runtime/bin/directory_macos.cc index 48a7088dc97..8fe39782773 100644 --- a/runtime/bin/directory_macos.cc +++ b/runtime/bin/directory_macos.cc @@ -26,34 +26,28 @@ PathBuffer::PathBuffer() : length_(0) { data_ = calloc(PATH_MAX + 1, sizeof(char)); // NOLINT } - PathBuffer::~PathBuffer() { free(data_); } - bool PathBuffer::AddW(const wchar_t* name) { UNREACHABLE(); return false; } - char* PathBuffer::AsString() const { return reinterpret_cast(data_); } - wchar_t* PathBuffer::AsStringW() const { UNREACHABLE(); return NULL; } - const char* PathBuffer::AsScopedString() const { return DartUtils::ScopedCopyCString(AsString()); } - bool PathBuffer::Add(const char* name) { char* data = AsString(); int written = snprintf(data + length_, PATH_MAX - length_, "%s", name); @@ -68,13 +62,11 @@ bool PathBuffer::Add(const char* name) { } } - void PathBuffer::Reset(intptr_t new_length) { length_ = new_length; AsString()[length_] = '\0'; } - // A linked list of symbolic links, with their unique file system identifiers. // These are scanned to detect loops while doing a recursive directory listing. struct LinkList { @@ -83,7 +75,6 @@ struct LinkList { LinkList* next; }; - ListType DirectoryListingEntry::Next(DirectoryListing* listing) { if (done_) { return kListDone; @@ -217,7 +208,6 @@ ListType DirectoryListingEntry::Next(DirectoryListing* listing) { return kListDone; } - DirectoryListingEntry::~DirectoryListingEntry() { ResetLink(); if (lister_ != 0) { @@ -225,7 +215,6 @@ DirectoryListingEntry::~DirectoryListingEntry() { } } - void DirectoryListingEntry::ResetLink() { if ((link_ != NULL) && ((parent_ == NULL) || (parent_->link_ != link_))) { delete link_; @@ -236,15 +225,12 @@ void DirectoryListingEntry::ResetLink() { } } - static bool DeleteRecursively(PathBuffer* path); - static bool DeleteFile(char* file_name, PathBuffer* path) { return path->Add(file_name) && (unlink(path->AsString()) == 0); } - static bool DeleteDir(char* dir_name, PathBuffer* path) { if ((strcmp(dir_name, ".") == 0) || (strcmp(dir_name, "..") == 0)) { return true; @@ -252,7 +238,6 @@ static bool DeleteDir(char* dir_name, PathBuffer* path) { return path->Add(dir_name) && DeleteRecursively(path); } - static bool DeleteRecursively(PathBuffer* path) { // Do not recurse into links for deletion. Instead delete the link. // If it's a file, delete it. @@ -343,7 +328,6 @@ static bool DeleteRecursively(PathBuffer* path) { return false; } - Directory::ExistsResult Directory::Exists(const char* dir_name) { struct stat entry_info; int success = NO_RETRY_EXPECTED(stat(dir_name, &entry_info)); @@ -370,12 +354,10 @@ Directory::ExistsResult Directory::Exists(const char* dir_name) { } } - char* Directory::CurrentNoScope() { return getcwd(NULL, 0); } - const char* Directory::Current() { char buffer[PATH_MAX]; if (getcwd(buffer, PATH_MAX) == NULL) { @@ -384,13 +366,11 @@ const char* Directory::Current() { return DartUtils::ScopedCopyCString(buffer); } - bool Directory::SetCurrent(const char* path) { int result = NO_RETRY_EXPECTED(chdir(path)); return (result == 0); } - bool Directory::Create(const char* dir_name) { // Create the directory with the permissions specified by the // process umask. @@ -402,7 +382,6 @@ bool Directory::Create(const char* dir_name) { return (result == 0); } - const char* Directory::SystemTemp() { PathBuffer path; const char* temp_dir = getenv("TMPDIR"); @@ -424,7 +403,6 @@ const char* Directory::SystemTemp() { return path.AsScopedString(); } - const char* Directory::CreateTemp(const char* prefix) { // Returns a new, unused directory name, adding characters to the end // of prefix. Creates the directory with the permissions specified @@ -448,7 +426,6 @@ const char* Directory::CreateTemp(const char* prefix) { return path.AsScopedString(); } - bool Directory::Delete(const char* dir_name, bool recursive) { if (!recursive) { if ((File::GetType(dir_name, false) == File::kIsLink) && @@ -465,7 +442,6 @@ bool Directory::Delete(const char* dir_name, bool recursive) { } } - bool Directory::Rename(const char* path, const char* new_path) { ExistsResult exists = Exists(path); if (exists != EXISTS) { diff --git a/runtime/bin/directory_test.cc b/runtime/bin/directory_test.cc index de9970e498c..40a91f0eca0 100644 --- a/runtime/bin/directory_test.cc +++ b/runtime/bin/directory_test.cc @@ -17,13 +17,11 @@ VM_UNIT_TEST_CASE(DirectoryCurrentNoScope) { free(current_dir); } - TEST_CASE(DirectoryCurrent) { const char* current = dart::bin::Directory::Current(); EXPECT_NOTNULL(current); } - TEST_CASE(DirectoryExists) { const char* current = dart::bin::Directory::Current(); EXPECT_NOTNULL(current); @@ -32,13 +30,11 @@ TEST_CASE(DirectoryExists) { EXPECT_EQ(dart::bin::Directory::EXISTS, r); } - TEST_CASE(DirectorySystemTemp) { const char* system_temp = dart::bin::Directory::SystemTemp(); EXPECT_NOTNULL(system_temp); } - TEST_CASE(DirectorySystemTempExists) { const char* system_temp = dart::bin::Directory::SystemTemp(); EXPECT_NOTNULL(system_temp); @@ -48,7 +44,6 @@ TEST_CASE(DirectorySystemTempExists) { EXPECT_EQ(dart::bin::Directory::EXISTS, r); } - TEST_CASE(DirectoryCreateTemp) { const char* kTempPrefix = "test_prefix"; const char* system_temp = dart::bin::Directory::SystemTemp(); @@ -64,7 +59,6 @@ TEST_CASE(DirectoryCreateTemp) { EXPECT(dart::bin::Directory::Delete(temp_dir, false)); } - TEST_CASE(DirectorySetCurrent) { const char* current = dart::bin::Directory::Current(); EXPECT_NOTNULL(current); @@ -82,7 +76,6 @@ TEST_CASE(DirectorySetCurrent) { EXPECT(dart::bin::Directory::SetCurrent(current)); } - TEST_CASE(DirectoryCreateDelete) { const char* kTempDirName = "create_delete_test_name"; @@ -107,7 +100,6 @@ TEST_CASE(DirectoryCreateDelete) { delete[] name; } - TEST_CASE(DirectoryRename) { const char* kTempDirName = "rename_test_name"; diff --git a/runtime/bin/directory_unsupported.cc b/runtime/bin/directory_unsupported.cc index d3a51522747..1bcd827bfa8 100644 --- a/runtime/bin/directory_unsupported.cc +++ b/runtime/bin/directory_unsupported.cc @@ -16,63 +16,53 @@ void FUNCTION_NAME(Directory_Current)(Dart_NativeArguments args) { "Directory is not supported on this platform")); } - void FUNCTION_NAME(Directory_SetCurrent)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "Directory is not supported on this platform")); } - void FUNCTION_NAME(Directory_Exists)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "Directory is not supported on this platform")); } - void FUNCTION_NAME(Directory_Create)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "Directory is not supported on this platform")); } - void FUNCTION_NAME(Directory_SystemTemp)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "Directory is not supported on this platform")); } - void FUNCTION_NAME(Directory_CreateTemp)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "Directory is not supported on this platform")); } - void FUNCTION_NAME(Directory_Delete)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "Directory is not supported on this platform")); } - void FUNCTION_NAME(Directory_Rename)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "Directory is not supported on this platform")); } - void FUNCTION_NAME(Directory_FillWithDirectoryListing)( Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "Directory is not supported on this platform")); } - void FUNCTION_NAME(Directory_GetAsyncDirectoryListerPointer)( Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "Directory is not supported on this platform")); } - void FUNCTION_NAME(Directory_SetAsyncDirectoryListerPointer)( Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( diff --git a/runtime/bin/directory_win.cc b/runtime/bin/directory_win.cc index a8050b9fc0e..094c4bfd2be 100644 --- a/runtime/bin/directory_win.cc +++ b/runtime/bin/directory_win.cc @@ -27,34 +27,28 @@ PathBuffer::PathBuffer() : length_(0) { data_ = calloc(MAX_LONG_PATH + 1, sizeof(wchar_t)); // NOLINT } - PathBuffer::~PathBuffer() { free(data_); } - char* PathBuffer::AsString() const { UNREACHABLE(); return NULL; } - wchar_t* PathBuffer::AsStringW() const { return reinterpret_cast(data_); } - const char* PathBuffer::AsScopedString() const { return StringUtilsWin::WideToUtf8(AsStringW()); } - bool PathBuffer::Add(const char* name) { Utf8ToWideScope wide_name(name); return AddW(wide_name.wide()); } - bool PathBuffer::AddW(const wchar_t* name) { wchar_t* data = AsStringW(); int written = @@ -70,13 +64,11 @@ bool PathBuffer::AddW(const wchar_t* name) { } } - void PathBuffer::Reset(intptr_t new_length) { length_ = new_length; AsStringW()[length_] = L'\0'; } - // If link_name points to a link, IsBrokenLink will return true if link_name // points to an invalid target. static bool IsBrokenLink(const wchar_t* link_name) { @@ -91,7 +83,6 @@ static bool IsBrokenLink(const wchar_t* link_name) { } } - // A linked list structure holding a link target's unique file system ID. // Used to detect loops in the file system when listing recursively. struct LinkList { @@ -104,7 +95,6 @@ struct LinkList { // Forward declarations. static bool DeleteRecursively(PathBuffer* path); - static ListType HandleFindFile(DirectoryListing* listing, DirectoryListingEntry* entry, const WIN32_FIND_DATAW& find_file_data) { @@ -170,7 +160,6 @@ static ListType HandleFindFile(DirectoryListing* listing, } } - ListType DirectoryListingEntry::Next(DirectoryListing* listing) { if (done_) { return kListDone; @@ -219,7 +208,6 @@ ListType DirectoryListingEntry::Next(DirectoryListing* listing) { return kListDone; } - DirectoryListingEntry::~DirectoryListingEntry() { ResetLink(); if (lister_ != 0) { @@ -227,7 +215,6 @@ DirectoryListingEntry::~DirectoryListingEntry() { } } - void DirectoryListingEntry::ResetLink() { if ((link_ != NULL) && ((parent_ == NULL) || (parent_->link_ != link_))) { delete link_; @@ -238,7 +225,6 @@ void DirectoryListingEntry::ResetLink() { } } - static bool DeleteFile(wchar_t* file_name, PathBuffer* path) { if (!path->AddW(file_name)) { return false; @@ -271,7 +257,6 @@ static bool DeleteFile(wchar_t* file_name, PathBuffer* path) { return false; } - static bool DeleteDir(wchar_t* dir_name, PathBuffer* path) { if ((wcscmp(dir_name, L".") == 0) || (wcscmp(dir_name, L"..") == 0)) { return true; @@ -279,7 +264,6 @@ static bool DeleteDir(wchar_t* dir_name, PathBuffer* path) { return path->AddW(dir_name) && DeleteRecursively(path); } - static bool DeleteEntry(LPWIN32_FIND_DATAW find_file_data, PathBuffer* path) { DWORD attributes = find_file_data->dwFileAttributes; @@ -290,7 +274,6 @@ static bool DeleteEntry(LPWIN32_FIND_DATAW find_file_data, PathBuffer* path) { } } - static bool DeleteRecursively(PathBuffer* path) { DWORD attributes = GetFileAttributesW(path->AsStringW()); if (attributes == INVALID_FILE_ATTRIBUTES) { @@ -342,7 +325,6 @@ static bool DeleteRecursively(PathBuffer* path) { return RemoveDirectoryW(path->AsStringW()) != 0; } - static Directory::ExistsResult ExistsHelper(const wchar_t* dir_name) { DWORD attributes = GetFileAttributesW(dir_name); if (attributes == INVALID_FILE_ATTRIBUTES) { @@ -362,13 +344,11 @@ static Directory::ExistsResult ExistsHelper(const wchar_t* dir_name) { return exists ? Directory::EXISTS : Directory::DOES_NOT_EXIST; } - Directory::ExistsResult Directory::Exists(const char* dir_name) { Utf8ToWideScope system_name(dir_name); return ExistsHelper(system_name.wide()); } - char* Directory::CurrentNoScope() { int length = GetCurrentDirectoryW(0, NULL); if (length == 0) { @@ -384,7 +364,6 @@ char* Directory::CurrentNoScope() { return result; } - const char* Directory::Current() { int length = GetCurrentDirectoryW(0, NULL); if (length == 0) { @@ -397,14 +376,12 @@ const char* Directory::Current() { return StringUtilsWin::WideToUtf8(current); } - bool Directory::SetCurrent(const char* path) { Utf8ToWideScope system_path(path); bool result = SetCurrentDirectoryW(system_path.wide()) != 0; return result; } - bool Directory::Create(const char* dir_name) { Utf8ToWideScope system_name(dir_name); int create_status = CreateDirectoryW(system_name.wide(), NULL); @@ -416,7 +393,6 @@ bool Directory::Create(const char* dir_name) { return (create_status != 0); } - const char* Directory::SystemTemp() { PathBuffer path; // Remove \ at end. @@ -424,7 +400,6 @@ const char* Directory::SystemTemp() { return path.AsScopedString(); } - const char* Directory::CreateTemp(const char* prefix) { // Returns a new, unused directory name, adding characters to the // end of prefix. @@ -464,7 +439,6 @@ const char* Directory::CreateTemp(const char* prefix) { return path.AsScopedString(); } - bool Directory::Delete(const char* dir_name, bool recursive) { bool result = false; Utf8ToWideScope system_dir_name(dir_name); @@ -483,7 +457,6 @@ bool Directory::Delete(const char* dir_name, bool recursive) { return result; } - bool Directory::Rename(const char* path, const char* new_path) { Utf8ToWideScope system_path(path); Utf8ToWideScope system_new_path(new_path); diff --git a/runtime/bin/embedded_dart_io.cc b/runtime/bin/embedded_dart_io.cc index 6dfbd867012..c0a912e455d 100644 --- a/runtime/bin/embedded_dart_io.cc +++ b/runtime/bin/embedded_dart_io.cc @@ -7,8 +7,8 @@ #include "bin/directory.h" #include "bin/eventhandler.h" #include "bin/platform.h" -#include "bin/utils.h" #include "bin/thread.h" +#include "bin/utils.h" namespace dart { namespace bin { @@ -20,17 +20,14 @@ void BootstrapDartIo() { EventHandler::Start(); } - void SetSystemTempDirectory(const char* system_temp) { Directory::SetSystemTemp(system_temp); } - void SetExecutableName(const char* executable_name) { Platform::SetExecutableName(executable_name); } - void SetExecutableArguments(int script_index, char** argv) { Platform::SetExecutableArguments(script_index, argv); } diff --git a/runtime/bin/error_exit.cc b/runtime/bin/error_exit.cc index ebe7d349021..a93a97248da 100644 --- a/runtime/bin/error_exit.cc +++ b/runtime/bin/error_exit.cc @@ -4,10 +4,10 @@ #include "bin/error_exit.h" +#include "bin/eventhandler.h" #include "bin/log.h" #include "bin/platform.h" #include "bin/process.h" -#include "bin/eventhandler.h" #include "include/dart_api.h" #include "platform/assert.h" #include "platform/globals.h" diff --git a/runtime/bin/eventhandler.cc b/runtime/bin/eventhandler.cc index d73ed879693..7b7cb0d2033 100644 --- a/runtime/bin/eventhandler.cc +++ b/runtime/bin/eventhandler.cc @@ -57,11 +57,9 @@ void TimeoutQueue::UpdateTimeout(Dart_Port port, int64_t timeout) { } } - static EventHandler* event_handler = NULL; static Monitor* shutdown_monitor = NULL; - void EventHandler::Start() { // Initialize global socket registry. ListeningSocketRegistry::Initialize(); @@ -72,13 +70,11 @@ void EventHandler::Start() { event_handler->delegate_.Start(event_handler); } - void EventHandler::NotifyShutdownDone() { MonitorLocker ml(shutdown_monitor); ml.Notify(); } - void EventHandler::Stop() { if (event_handler == NULL) { return; @@ -103,7 +99,6 @@ void EventHandler::Stop() { ListeningSocketRegistry::Cleanup(); } - EventHandlerImplementation* EventHandler::delegate() { if (event_handler == NULL) { return NULL; @@ -111,12 +106,10 @@ EventHandlerImplementation* EventHandler::delegate() { return &event_handler->delegate_; } - void EventHandler::SendFromNative(intptr_t id, Dart_Port port, int64_t data) { event_handler->SendData(id, port, data); } - /* * Send data to the EventHandler thread to register for a given instance * args[0] a ReceivePort args[1] with a notification event args[2]. @@ -146,7 +139,6 @@ void FUNCTION_NAME(EventHandler_SendData)(Dart_NativeArguments args) { event_handler->SendData(id, dart_port, data); } - void FUNCTION_NAME(EventHandler_TimerMillisecondClock)( Dart_NativeArguments args) { int64_t now = TimerUtils::GetCurrentMonotonicMillis(); diff --git a/runtime/bin/eventhandler.h b/runtime/bin/eventhandler.h index dd0be38e0b7..bfd5c0e9f0f 100644 --- a/runtime/bin/eventhandler.h +++ b/runtime/bin/eventhandler.h @@ -111,7 +111,6 @@ class TimeoutQueue { DISALLOW_COPY_AND_ASSIGN(TimeoutQueue); }; - class InterruptMessage { public: intptr_t id; @@ -119,13 +118,11 @@ class InterruptMessage { int64_t data; }; - static const int kInterruptMessageSize = sizeof(InterruptMessage); static const int kInfinityTimeout = -1; static const int kTimerId = -1; static const int kShutdownId = -2; - template class CircularLinkedList { public: @@ -229,7 +226,6 @@ class CircularLinkedList { DISALLOW_COPY_AND_ASSIGN(CircularLinkedList); }; - class DescriptorInfoBase { public: explicit DescriptorInfoBase(intptr_t fd) : fd_(fd) { ASSERT(fd_ != -1); } @@ -277,7 +273,6 @@ class DescriptorInfoBase { DISALLOW_COPY_AND_ASSIGN(DescriptorInfoBase); }; - // Describes a OS descriptor (e.g. file descriptor on linux or HANDLE on // windows) which is connected to a single Dart_Port. // @@ -367,7 +362,6 @@ class DescriptorInfoSingleMixin : public DI { DISALLOW_COPY_AND_ASSIGN(DescriptorInfoSingleMixin); }; - // Describes a OS descriptor (e.g. file descriptor on linux or HANDLE on // windows) which is connected to multiple Dart_Port's. // diff --git a/runtime/bin/eventhandler_android.cc b/runtime/bin/eventhandler_android.cc index b1a424f2f93..29eb1b28946 100644 --- a/runtime/bin/eventhandler_android.cc +++ b/runtime/bin/eventhandler_android.cc @@ -21,8 +21,8 @@ #include "bin/dartutils.h" #include "bin/fdutils.h" -#include "bin/log.h" #include "bin/lockers.h" +#include "bin/log.h" #include "bin/socket.h" #include "bin/thread.h" #include "bin/utils.h" @@ -50,14 +50,12 @@ intptr_t DescriptorInfo::GetPollEvents() { return events; } - // Unregister the file descriptor for a DescriptorInfo structure with // epoll. static void RemoveFromEpollInstance(intptr_t epoll_fd_, DescriptorInfo* di) { VOID_NO_RETRY_EXPECTED(epoll_ctl(epoll_fd_, EPOLL_CTL_DEL, di->fd(), NULL)); } - static void AddToEpollInstance(intptr_t epoll_fd_, DescriptorInfo* di) { struct epoll_event event; event.events = EPOLLRDHUP | di->GetPollEvents(); @@ -78,7 +76,6 @@ static void AddToEpollInstance(intptr_t epoll_fd_, DescriptorInfo* di) { } } - EventHandlerImplementation::EventHandlerImplementation() : socket_map_(&HashMap::SamePointerValue, 16) { intptr_t result; @@ -117,14 +114,12 @@ EventHandlerImplementation::EventHandlerImplementation() } } - static void DeleteDescriptorInfo(void* info) { DescriptorInfo* di = reinterpret_cast(info); di->Close(); delete di; } - EventHandlerImplementation::~EventHandlerImplementation() { socket_map_.Clear(DeleteDescriptorInfo); VOID_TEMP_FAILURE_RETRY(close(epoll_fd_)); @@ -132,7 +127,6 @@ EventHandlerImplementation::~EventHandlerImplementation() { VOID_TEMP_FAILURE_RETRY(close(interrupt_fds_[1])); } - void EventHandlerImplementation::UpdateEpollInstance(intptr_t old_mask, DescriptorInfo* di) { intptr_t new_mask = di->Mask(); @@ -147,7 +141,6 @@ void EventHandlerImplementation::UpdateEpollInstance(intptr_t old_mask, } } - DescriptorInfo* EventHandlerImplementation::GetDescriptorInfo( intptr_t fd, bool is_listening) { @@ -170,7 +163,6 @@ DescriptorInfo* EventHandlerImplementation::GetDescriptorInfo( return di; } - void EventHandlerImplementation::WakeupHandler(intptr_t id, Dart_Port dart_port, int64_t data) { @@ -192,7 +184,6 @@ void EventHandlerImplementation::WakeupHandler(intptr_t id, } } - void EventHandlerImplementation::HandleInterruptFd() { const intptr_t MAX_MESSAGES = kInterruptMessageSize; InterruptMessage msg[MAX_MESSAGES]; @@ -276,7 +267,6 @@ void EventHandlerImplementation::HandleInterruptFd() { } } - #ifdef DEBUG_POLL static void PrintEventMask(intptr_t fd, intptr_t events) { Log::Print("%d ", fd); @@ -309,7 +299,6 @@ static void PrintEventMask(intptr_t fd, intptr_t events) { } #endif - intptr_t EventHandlerImplementation::GetPollEvents(intptr_t events, DescriptorInfo* di) { #ifdef DEBUG_POLL @@ -332,7 +321,6 @@ intptr_t EventHandlerImplementation::GetPollEvents(intptr_t events, return event_mask; } - void EventHandlerImplementation::HandleEvents(struct epoll_event* events, int size) { bool interrupt_seen = false; @@ -362,7 +350,6 @@ void EventHandlerImplementation::HandleEvents(struct epoll_event* events, } } - int64_t EventHandlerImplementation::GetTimeout() { if (!timeout_queue_.HasTimeout()) { return kInfinityTimeout; @@ -372,7 +359,6 @@ int64_t EventHandlerImplementation::GetTimeout() { return (millis < 0) ? 0 : millis; } - void EventHandlerImplementation::HandleTimeout() { if (timeout_queue_.HasTimeout()) { int64_t millis = timeout_queue_.CurrentTimeout() - @@ -384,7 +370,6 @@ void EventHandlerImplementation::HandleTimeout() { } } - void EventHandlerImplementation::Poll(uword args) { ThreadSignalBlocker signal_blocker(SIGPROF); static const intptr_t kMaxEvents = 16; @@ -415,7 +400,6 @@ void EventHandlerImplementation::Poll(uword args) { handler->NotifyShutdownDone(); } - void EventHandlerImplementation::Start(EventHandler* handler) { int result = Thread::Start(&EventHandlerImplementation::Poll, reinterpret_cast(handler)); @@ -424,25 +408,21 @@ void EventHandlerImplementation::Start(EventHandler* handler) { } } - void EventHandlerImplementation::Shutdown() { SendData(kShutdownId, 0, 0); } - void EventHandlerImplementation::SendData(intptr_t id, Dart_Port dart_port, int64_t data) { WakeupHandler(id, dart_port, data); } - void* EventHandlerImplementation::GetHashmapKeyFromFd(intptr_t fd) { // The hashmap does not support keys with value 0. return reinterpret_cast(fd + 1); } - uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { // The hashmap does not support keys with value 0. return dart::Utils::WordHash(fd + 1); diff --git a/runtime/bin/eventhandler_android.h b/runtime/bin/eventhandler_android.h index 156ba4f24f8..c934549a918 100644 --- a/runtime/bin/eventhandler_android.h +++ b/runtime/bin/eventhandler_android.h @@ -38,7 +38,6 @@ class DescriptorInfo : public DescriptorInfoBase { DISALLOW_COPY_AND_ASSIGN(DescriptorInfo); }; - class DescriptorInfoSingle : public DescriptorInfoSingleMixin { public: explicit DescriptorInfoSingle(intptr_t fd) @@ -49,7 +48,6 @@ class DescriptorInfoSingle : public DescriptorInfoSingleMixin { DISALLOW_COPY_AND_ASSIGN(DescriptorInfoSingle); }; - class DescriptorInfoMultiple : public DescriptorInfoMultipleMixin { public: @@ -61,7 +59,6 @@ class DescriptorInfoMultiple DISALLOW_COPY_AND_ASSIGN(DescriptorInfoMultiple); }; - class EventHandlerImplementation { public: EventHandlerImplementation(); diff --git a/runtime/bin/eventhandler_fuchsia.cc b/runtime/bin/eventhandler_fuchsia.cc index 41feb5d03ba..41aa9cc908c 100644 --- a/runtime/bin/eventhandler_fuchsia.cc +++ b/runtime/bin/eventhandler_fuchsia.cc @@ -97,7 +97,6 @@ intptr_t IOHandle::Read(void* buffer, intptr_t num_bytes) { return read_bytes; } - intptr_t IOHandle::Write(const void* buffer, intptr_t num_bytes) { MutexLocker ml(mutex_); const ssize_t written_bytes = @@ -115,7 +114,6 @@ intptr_t IOHandle::Write(const void* buffer, intptr_t num_bytes) { return written_bytes; } - intptr_t IOHandle::Accept(struct sockaddr* addr, socklen_t* addrlen) { MutexLocker ml(mutex_); const intptr_t socket = NO_RETRY_EXPECTED(accept(fd_, addr, addrlen)); @@ -132,13 +130,11 @@ intptr_t IOHandle::Accept(struct sockaddr* addr, socklen_t* addrlen) { return socket; } - void IOHandle::Close() { MutexLocker ml(mutex_); VOID_NO_RETRY_EXPECTED(close(fd_)); } - uint32_t IOHandle::MaskToEpollEvents(intptr_t mask) { MutexLocker ml(mutex_); // Do not ask for POLLERR and POLLHUP explicitly as they are @@ -153,7 +149,6 @@ uint32_t IOHandle::MaskToEpollEvents(intptr_t mask) { return events; } - intptr_t IOHandle::EpollEventsToMask(intptr_t events) { if ((events & POLLERR) != 0) { // Return error only if POLLIN is present. @@ -172,7 +167,6 @@ intptr_t IOHandle::EpollEventsToMask(intptr_t events) { return event_mask; } - bool IOHandle::AsyncWaitLocked(mx_handle_t port, uint32_t events, uint64_t key) { @@ -212,13 +206,11 @@ bool IOHandle::AsyncWaitLocked(mx_handle_t port, return true; } - bool IOHandle::AsyncWait(mx_handle_t port, uint32_t events, uint64_t key) { MutexLocker ml(mutex_); return AsyncWaitLocked(port, events, key); } - void IOHandle::CancelWait(mx_handle_t port, uint64_t key) { MutexLocker ml(mutex_); LOG_INFO("IOHandle::CancelWait: fd = %ld\n", fd_); @@ -230,7 +222,6 @@ void IOHandle::CancelWait(mx_handle_t port, uint64_t key) { } } - uint32_t IOHandle::WaitEnd(mx_signals_t observed) { MutexLocker ml(mutex_); uint32_t events = 0; @@ -238,7 +229,6 @@ uint32_t IOHandle::WaitEnd(mx_signals_t observed) { return events; } - intptr_t IOHandle::ToggleEvents(intptr_t event_mask) { MutexLocker ml(mutex_); if (!write_events_enabled_) { @@ -262,7 +252,6 @@ intptr_t IOHandle::ToggleEvents(intptr_t event_mask) { return event_mask; } - void EventHandlerImplementation::AddToPort(mx_handle_t port_handle, DescriptorInfo* di) { const uint32_t events = di->io_handle()->MaskToEpollEvents(di->Mask()); @@ -272,14 +261,12 @@ void EventHandlerImplementation::AddToPort(mx_handle_t port_handle, } } - void EventHandlerImplementation::RemoveFromPort(mx_handle_t port_handle, DescriptorInfo* di) { const uint64_t key = reinterpret_cast(di); di->io_handle()->CancelWait(port_handle, key); } - EventHandlerImplementation::EventHandlerImplementation() : socket_map_(&HashMap::SamePointerValue, 16) { shutdown_ = false; @@ -294,7 +281,6 @@ EventHandlerImplementation::EventHandlerImplementation() ASSERT(port_handle_ != MX_HANDLE_INVALID); } - static void DeleteDescriptorInfo(void* info) { DescriptorInfo* di = reinterpret_cast(info); LOG_INFO("Closed %ld\n", di->io_handle()->fd()); @@ -302,14 +288,12 @@ static void DeleteDescriptorInfo(void* info) { delete di; } - EventHandlerImplementation::~EventHandlerImplementation() { socket_map_.Clear(DeleteDescriptorInfo); mx_handle_close(port_handle_); port_handle_ = MX_HANDLE_INVALID; } - void EventHandlerImplementation::UpdatePort(intptr_t old_mask, DescriptorInfo* di) { const intptr_t new_mask = di->Mask(); @@ -324,7 +308,6 @@ void EventHandlerImplementation::UpdatePort(intptr_t old_mask, } } - DescriptorInfo* EventHandlerImplementation::GetDescriptorInfo( intptr_t fd, bool is_listening) { @@ -349,7 +332,6 @@ DescriptorInfo* EventHandlerImplementation::GetDescriptorInfo( return di; } - void EventHandlerImplementation::WakeupHandler(intptr_t id, Dart_Port dart_port, int64_t data) { @@ -369,7 +351,6 @@ void EventHandlerImplementation::WakeupHandler(intptr_t id, } } - void EventHandlerImplementation::HandleInterrupt(InterruptMessage* msg) { if (msg->id == kTimerId) { LOG_INFO("HandleInterrupt read timer update\n"); @@ -461,7 +442,6 @@ void EventHandlerImplementation::HandleInterrupt(InterruptMessage* msg) { } } - void EventHandlerImplementation::HandlePacket(mx_port_packet_t* pkt) { LOG_INFO("HandlePacket: Got event packet: key=%lx\n", pkt->key); LOG_INFO("HandlePacket: Got event packet: type=%lx\n", pkt->type); @@ -499,7 +479,6 @@ void EventHandlerImplementation::HandlePacket(mx_port_packet_t* pkt) { UpdatePort(old_mask, di); } - int64_t EventHandlerImplementation::GetTimeout() const { if (!timeout_queue_.HasTimeout()) { return kInfinityTimeout; @@ -509,7 +488,6 @@ int64_t EventHandlerImplementation::GetTimeout() const { return (millis < 0) ? 0 : millis; } - void EventHandlerImplementation::HandleTimeout() { if (timeout_queue_.HasTimeout()) { int64_t millis = timeout_queue_.CurrentTimeout() - @@ -521,7 +499,6 @@ void EventHandlerImplementation::HandleTimeout() { } } - void EventHandlerImplementation::Poll(uword args) { EventHandler* handler = reinterpret_cast(args); EventHandlerImplementation* handler_impl = &handler->delegate_; @@ -551,7 +528,6 @@ void EventHandlerImplementation::Poll(uword args) { handler->NotifyShutdownDone(); } - void EventHandlerImplementation::Start(EventHandler* handler) { int result = Thread::Start(&EventHandlerImplementation::Poll, reinterpret_cast(handler)); @@ -560,12 +536,10 @@ void EventHandlerImplementation::Start(EventHandler* handler) { } } - void EventHandlerImplementation::Shutdown() { SendData(kShutdownId, 0, 0); } - void EventHandlerImplementation::SendData(intptr_t id, Dart_Port dart_port, int64_t data) { @@ -577,7 +551,6 @@ void* EventHandlerImplementation::GetHashmapKeyFromFd(intptr_t fd) { return reinterpret_cast(fd + 1); } - uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { // The hashmap does not support keys with value 0. return dart::Utils::WordHash(fd + 1); diff --git a/runtime/bin/eventhandler_linux.cc b/runtime/bin/eventhandler_linux.cc index 4ff0865b815..7217da1b86b 100644 --- a/runtime/bin/eventhandler_linux.cc +++ b/runtime/bin/eventhandler_linux.cc @@ -22,8 +22,8 @@ #include "bin/dartutils.h" #include "bin/fdutils.h" -#include "bin/log.h" #include "bin/lockers.h" +#include "bin/log.h" #include "bin/socket.h" #include "bin/thread.h" #include "platform/utils.h" @@ -44,14 +44,12 @@ intptr_t DescriptorInfo::GetPollEvents() { return events; } - // Unregister the file descriptor for a DescriptorInfo structure with // epoll. static void RemoveFromEpollInstance(intptr_t epoll_fd_, DescriptorInfo* di) { VOID_NO_RETRY_EXPECTED(epoll_ctl(epoll_fd_, EPOLL_CTL_DEL, di->fd(), NULL)); } - static void AddToEpollInstance(intptr_t epoll_fd_, DescriptorInfo* di) { struct epoll_event event; event.events = EPOLLRDHUP | di->GetPollEvents(); @@ -72,7 +70,6 @@ static void AddToEpollInstance(intptr_t epoll_fd_, DescriptorInfo* di) { } } - EventHandlerImplementation::EventHandlerImplementation() : socket_map_(&HashMap::SamePointerValue, 16) { intptr_t result; @@ -124,14 +121,12 @@ EventHandlerImplementation::EventHandlerImplementation() } } - static void DeleteDescriptorInfo(void* info) { DescriptorInfo* di = reinterpret_cast(info); di->Close(); delete di; } - EventHandlerImplementation::~EventHandlerImplementation() { socket_map_.Clear(DeleteDescriptorInfo); VOID_TEMP_FAILURE_RETRY(close(epoll_fd_)); @@ -140,7 +135,6 @@ EventHandlerImplementation::~EventHandlerImplementation() { VOID_TEMP_FAILURE_RETRY(close(interrupt_fds_[1])); } - void EventHandlerImplementation::UpdateEpollInstance(intptr_t old_mask, DescriptorInfo* di) { intptr_t new_mask = di->Mask(); @@ -155,7 +149,6 @@ void EventHandlerImplementation::UpdateEpollInstance(intptr_t old_mask, } } - DescriptorInfo* EventHandlerImplementation::GetDescriptorInfo( intptr_t fd, bool is_listening) { @@ -178,7 +171,6 @@ DescriptorInfo* EventHandlerImplementation::GetDescriptorInfo( return di; } - void EventHandlerImplementation::WakeupHandler(intptr_t id, Dart_Port dart_port, int64_t data) { @@ -200,7 +192,6 @@ void EventHandlerImplementation::WakeupHandler(intptr_t id, } } - void EventHandlerImplementation::HandleInterruptFd() { const intptr_t MAX_MESSAGES = kInterruptMessageSize; InterruptMessage msg[MAX_MESSAGES]; @@ -292,7 +283,6 @@ void EventHandlerImplementation::HandleInterruptFd() { } } - #ifdef DEBUG_POLL static void PrintEventMask(intptr_t fd, intptr_t events) { Log::Print("%d ", fd); @@ -325,7 +315,6 @@ static void PrintEventMask(intptr_t fd, intptr_t events) { } #endif - intptr_t EventHandlerImplementation::GetPollEvents(intptr_t events, DescriptorInfo* di) { #ifdef DEBUG_POLL @@ -348,7 +337,6 @@ intptr_t EventHandlerImplementation::GetPollEvents(intptr_t events, return event_mask; } - void EventHandlerImplementation::HandleEvents(struct epoll_event* events, int size) { bool interrupt_seen = false; @@ -386,7 +374,6 @@ void EventHandlerImplementation::HandleEvents(struct epoll_event* events, } } - void EventHandlerImplementation::Poll(uword args) { ThreadSignalBlocker signal_blocker(SIGPROF); static const intptr_t kMaxEvents = 16; @@ -411,7 +398,6 @@ void EventHandlerImplementation::Poll(uword args) { handler->NotifyShutdownDone(); } - void EventHandlerImplementation::Start(EventHandler* handler) { int result = Thread::Start(&EventHandlerImplementation::Poll, reinterpret_cast(handler)); @@ -420,25 +406,21 @@ void EventHandlerImplementation::Start(EventHandler* handler) { } } - void EventHandlerImplementation::Shutdown() { SendData(kShutdownId, 0, 0); } - void EventHandlerImplementation::SendData(intptr_t id, Dart_Port dart_port, int64_t data) { WakeupHandler(id, dart_port, data); } - void* EventHandlerImplementation::GetHashmapKeyFromFd(intptr_t fd) { // The hashmap does not support keys with value 0. return reinterpret_cast(fd + 1); } - uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { // The hashmap does not support keys with value 0. return dart::Utils::WordHash(fd + 1); diff --git a/runtime/bin/eventhandler_linux.h b/runtime/bin/eventhandler_linux.h index 5386eb61b17..5c3f70046d1 100644 --- a/runtime/bin/eventhandler_linux.h +++ b/runtime/bin/eventhandler_linux.h @@ -17,7 +17,6 @@ #include "platform/hashmap.h" #include "platform/signal_blocker.h" - namespace dart { namespace bin { @@ -38,7 +37,6 @@ class DescriptorInfo : public DescriptorInfoBase { DISALLOW_COPY_AND_ASSIGN(DescriptorInfo); }; - class DescriptorInfoSingle : public DescriptorInfoSingleMixin { public: explicit DescriptorInfoSingle(intptr_t fd) @@ -49,7 +47,6 @@ class DescriptorInfoSingle : public DescriptorInfoSingleMixin { DISALLOW_COPY_AND_ASSIGN(DescriptorInfoSingle); }; - class DescriptorInfoMultiple : public DescriptorInfoMultipleMixin { public: @@ -61,7 +58,6 @@ class DescriptorInfoMultiple DISALLOW_COPY_AND_ASSIGN(DescriptorInfoMultiple); }; - class EventHandlerImplementation { public: EventHandlerImplementation(); diff --git a/runtime/bin/eventhandler_macos.cc b/runtime/bin/eventhandler_macos.cc index 6e5e89510a1..eb9a1f2ca9d 100644 --- a/runtime/bin/eventhandler_macos.cc +++ b/runtime/bin/eventhandler_macos.cc @@ -35,12 +35,10 @@ bool DescriptorInfo::HasReadEvent() { return (Mask() & (1 << kInEvent)) != 0; } - bool DescriptorInfo::HasWriteEvent() { return (Mask() & (1 << kOutEvent)) != 0; } - // Unregister the file descriptor for a SocketData structure with kqueue. static void RemoveFromKqueue(intptr_t kqueue_fd_, DescriptorInfo* di) { if (!di->tracked_by_kqueue()) { @@ -55,7 +53,6 @@ static void RemoveFromKqueue(intptr_t kqueue_fd_, DescriptorInfo* di) { di->set_tracked_by_kqueue(false); } - // Update the kqueue registration for SocketData structure to reflect // the events currently of interest. static void AddToKqueue(intptr_t kqueue_fd_, DescriptorInfo* di) { @@ -97,7 +94,6 @@ static void AddToKqueue(intptr_t kqueue_fd_, DescriptorInfo* di) { } } - EventHandlerImplementation::EventHandlerImplementation() : socket_map_(&HashMap::SamePointerValue, 16) { intptr_t result; @@ -135,14 +131,12 @@ EventHandlerImplementation::EventHandlerImplementation() } } - static void DeleteDescriptorInfo(void* info) { DescriptorInfo* di = reinterpret_cast(info); di->Close(); delete di; } - EventHandlerImplementation::~EventHandlerImplementation() { socket_map_.Clear(DeleteDescriptorInfo); VOID_TEMP_FAILURE_RETRY(close(kqueue_fd_)); @@ -150,7 +144,6 @@ EventHandlerImplementation::~EventHandlerImplementation() { VOID_TEMP_FAILURE_RETRY(close(interrupt_fds_[1])); } - void EventHandlerImplementation::UpdateKQueueInstance(intptr_t old_mask, DescriptorInfo* di) { intptr_t new_mask = di->Mask(); @@ -165,7 +158,6 @@ void EventHandlerImplementation::UpdateKQueueInstance(intptr_t old_mask, } } - DescriptorInfo* EventHandlerImplementation::GetDescriptorInfo( intptr_t fd, bool is_listening) { @@ -188,7 +180,6 @@ DescriptorInfo* EventHandlerImplementation::GetDescriptorInfo( return di; } - void EventHandlerImplementation::WakeupHandler(intptr_t id, Dart_Port dart_port, int64_t data) { @@ -209,7 +200,6 @@ void EventHandlerImplementation::WakeupHandler(intptr_t id, } } - void EventHandlerImplementation::HandleInterruptFd() { const intptr_t MAX_MESSAGES = kInterruptMessageSize; InterruptMessage msg[MAX_MESSAGES]; @@ -292,7 +282,6 @@ void EventHandlerImplementation::HandleInterruptFd() { } } - #ifdef DEBUG_KQUEUE static void PrintEventMask(intptr_t fd, struct kevent* event) { Log::Print("%d ", static_cast(fd)); @@ -329,7 +318,6 @@ static void PrintEventMask(intptr_t fd, struct kevent* event) { } #endif - intptr_t EventHandlerImplementation::GetEvents(struct kevent* event, DescriptorInfo* di) { #ifdef DEBUG_KQUEUE @@ -379,7 +367,6 @@ intptr_t EventHandlerImplementation::GetEvents(struct kevent* event, return event_mask; } - void EventHandlerImplementation::HandleEvents(struct kevent* events, int size) { bool interrupt_seen = false; for (int i = 0; i < size; i++) { @@ -414,7 +401,6 @@ void EventHandlerImplementation::HandleEvents(struct kevent* events, int size) { } } - int64_t EventHandlerImplementation::GetTimeout() { if (!timeout_queue_.HasTimeout()) { return kInfinityTimeout; @@ -424,7 +410,6 @@ int64_t EventHandlerImplementation::GetTimeout() { return (millis < 0) ? 0 : millis; } - void EventHandlerImplementation::HandleTimeout() { if (timeout_queue_.HasTimeout()) { int64_t millis = timeout_queue_.CurrentTimeout() - @@ -436,7 +421,6 @@ void EventHandlerImplementation::HandleTimeout() { } } - void EventHandlerImplementation::EventHandlerEntry(uword args) { static const intptr_t kMaxEvents = 16; struct kevent events[kMaxEvents]; @@ -479,7 +463,6 @@ void EventHandlerImplementation::EventHandlerEntry(uword args) { handler->NotifyShutdownDone(); } - void EventHandlerImplementation::Start(EventHandler* handler) { int result = Thread::Start(&EventHandlerImplementation::EventHandlerEntry, reinterpret_cast(handler)); @@ -488,25 +471,21 @@ void EventHandlerImplementation::Start(EventHandler* handler) { } } - void EventHandlerImplementation::Shutdown() { SendData(kShutdownId, 0, 0); } - void EventHandlerImplementation::SendData(intptr_t id, Dart_Port dart_port, int64_t data) { WakeupHandler(id, dart_port, data); } - void* EventHandlerImplementation::GetHashmapKeyFromFd(intptr_t fd) { // The hashmap does not support keys with value 0. return reinterpret_cast(fd + 1); } - uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { // The hashmap does not support keys with value 0. return dart::Utils::WordHash(fd + 1); diff --git a/runtime/bin/eventhandler_macos.h b/runtime/bin/eventhandler_macos.h index 414dfbef277..c8ed3ba6adf 100644 --- a/runtime/bin/eventhandler_macos.h +++ b/runtime/bin/eventhandler_macos.h @@ -17,7 +17,6 @@ #include "platform/hashmap.h" #include "platform/signal_blocker.h" - namespace dart { namespace bin { @@ -50,7 +49,6 @@ class DescriptorInfo : public DescriptorInfoBase { DISALLOW_COPY_AND_ASSIGN(DescriptorInfo); }; - class DescriptorInfoSingle : public DescriptorInfoSingleMixin { public: explicit DescriptorInfoSingle(intptr_t fd) @@ -61,7 +59,6 @@ class DescriptorInfoSingle : public DescriptorInfoSingleMixin { DISALLOW_COPY_AND_ASSIGN(DescriptorInfoSingle); }; - class DescriptorInfoMultiple : public DescriptorInfoMultipleMixin { public: @@ -73,7 +70,6 @@ class DescriptorInfoMultiple DISALLOW_COPY_AND_ASSIGN(DescriptorInfoMultiple); }; - class EventHandlerImplementation { public: EventHandlerImplementation(); diff --git a/runtime/bin/eventhandler_test.cc b/runtime/bin/eventhandler_test.cc index cef2b94b9fa..76880634e6e 100644 --- a/runtime/bin/eventhandler_test.cc +++ b/runtime/bin/eventhandler_test.cc @@ -18,14 +18,12 @@ VM_UNIT_TEST_CASE(CircularLinkedList) { EXPECT(list.HasHead()); EXPECT(list.head() == 1); - // Test: Inserts don't move head. for (int i = 2; i <= 100; i++) { list.Add(i); EXPECT(list.head() == 1); } - // Test: Rotate cycle through all elements in insertion order. for (int i = 1; i <= 100; i++) { EXPECT(list.HasHead()); @@ -33,7 +31,6 @@ VM_UNIT_TEST_CASE(CircularLinkedList) { list.Rotate(); } - // Test: Removing head results in next element to be head. for (int i = 1; i <= 100; i++) { list.RemoveHead(); @@ -47,7 +44,6 @@ VM_UNIT_TEST_CASE(CircularLinkedList) { // Test: Removing all items individually make list empty. EXPECT(!list.HasHead()); - // Test: Removing all items at once makes list empty. for (int i = 1; i <= 100; i++) { list.Add(i); @@ -55,7 +51,6 @@ VM_UNIT_TEST_CASE(CircularLinkedList) { list.RemoveAll(); EXPECT(!list.HasHead()); - // Test: Remove individual items just deletes them without modifying head. for (int i = 1; i <= 10; i++) { list.Add(i); @@ -69,12 +64,10 @@ VM_UNIT_TEST_CASE(CircularLinkedList) { list.Rotate(); EXPECT(list.head() == 1); - // Test: Remove non-existent element leaves list un-changed. list.Remove(4242); EXPECT(list.head() == 1); - // Test: Remove head element individually moves head to next element. list.Remove(1); EXPECT(list.HasHead()); @@ -82,7 +75,6 @@ VM_UNIT_TEST_CASE(CircularLinkedList) { list.Remove(10); EXPECT(!list.HasHead()); - // Test: Remove non-existent element from empty list works. list.Remove(4242); } diff --git a/runtime/bin/eventhandler_unsupported.cc b/runtime/bin/eventhandler_unsupported.cc index e93605564cc..78fb42e038d 100644 --- a/runtime/bin/eventhandler_unsupported.cc +++ b/runtime/bin/eventhandler_unsupported.cc @@ -15,16 +15,13 @@ namespace bin { void EventHandler::Start() {} - void EventHandler::Stop() {} - void FUNCTION_NAME(EventHandler_SendData)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "EventHandler is not supported on this platform")); } - void FUNCTION_NAME(EventHandler_TimerMillisecondClock)( Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( diff --git a/runtime/bin/eventhandler_win.cc b/runtime/bin/eventhandler_win.cc index 43a686d8536..9aeda580a30 100644 --- a/runtime/bin/eventhandler_win.cc +++ b/runtime/bin/eventhandler_win.cc @@ -40,18 +40,15 @@ OverlappedBuffer* OverlappedBuffer::AllocateBuffer(int buffer_size, return buffer; } - OverlappedBuffer* OverlappedBuffer::AllocateAcceptBuffer(int buffer_size) { OverlappedBuffer* buffer = AllocateBuffer(buffer_size, kAccept); return buffer; } - OverlappedBuffer* OverlappedBuffer::AllocateReadBuffer(int buffer_size) { return AllocateBuffer(buffer_size, kRead); } - OverlappedBuffer* OverlappedBuffer::AllocateRecvFromBuffer(int buffer_size) { // For calling recvfrom additional buffer space is needed for the source // address information. @@ -59,39 +56,32 @@ OverlappedBuffer* OverlappedBuffer::AllocateRecvFromBuffer(int buffer_size) { return AllocateBuffer(buffer_size, kRecvFrom); } - OverlappedBuffer* OverlappedBuffer::AllocateWriteBuffer(int buffer_size) { return AllocateBuffer(buffer_size, kWrite); } - OverlappedBuffer* OverlappedBuffer::AllocateSendToBuffer(int buffer_size) { return AllocateBuffer(buffer_size, kSendTo); } - OverlappedBuffer* OverlappedBuffer::AllocateDisconnectBuffer() { return AllocateBuffer(0, kDisconnect); } - OverlappedBuffer* OverlappedBuffer::AllocateConnectBuffer() { return AllocateBuffer(0, kConnect); } - void OverlappedBuffer::DisposeBuffer(OverlappedBuffer* buffer) { delete buffer; } - OverlappedBuffer* OverlappedBuffer::GetFromOverlapped(OVERLAPPED* overlapped) { OverlappedBuffer* buffer = CONTAINING_RECORD(overlapped, OverlappedBuffer, overlapped_); return buffer; } - int OverlappedBuffer::Read(void* buffer, int num_bytes) { if (num_bytes > GetRemainingLength()) { num_bytes = GetRemainingLength(); @@ -101,7 +91,6 @@ int OverlappedBuffer::Read(void* buffer, int num_bytes) { return num_bytes; } - int OverlappedBuffer::Write(const void* buffer, int num_bytes) { ASSERT(num_bytes == buflen_); memmove(GetBufferStart(), buffer, num_bytes); @@ -109,13 +98,11 @@ int OverlappedBuffer::Write(const void* buffer, int num_bytes) { return num_bytes; } - int OverlappedBuffer::GetRemainingLength() { ASSERT(operation_ == kRead || operation_ == kRecvFrom); return data_length_ - index_; } - Handle::Handle(intptr_t handle) : ReferenceCounted(), DescriptorInfoBase(handle), @@ -133,12 +120,10 @@ Handle::Handle(intptr_t handle) read_thread_finished_(false), monitor_(new Monitor()) {} - Handle::~Handle() { delete monitor_; } - bool Handle::CreateCompletionPort(HANDLE completion_port) { ASSERT(completion_port_ == INVALID_HANDLE_VALUE); // A reference to the Handle is Retained by the IO completion port. @@ -149,7 +134,6 @@ bool Handle::CreateCompletionPort(HANDLE completion_port) { return (completion_port_ != NULL); } - void Handle::Close() { MonitorLocker ml(monitor_); if (!SupportsOverlappedIO()) { @@ -176,7 +160,6 @@ void Handle::Close() { ASSERT(IsHandleClosed()); } - void Handle::DoClose() { if (!IsHandleClosed()) { CloseHandle(handle_); @@ -184,19 +167,16 @@ void Handle::DoClose() { } } - bool Handle::HasPendingRead() { MonitorLocker ml(monitor_); return pending_read_ != NULL; } - bool Handle::HasPendingWrite() { MonitorLocker ml(monitor_); return pending_write_ != NULL; } - void Handle::WaitForReadThreadStarted() { MonitorLocker ml(monitor_); while (read_thread_starting_) { @@ -204,7 +184,6 @@ void Handle::WaitForReadThreadStarted() { } } - void Handle::WaitForReadThreadFinished() { HANDLE to_join = NULL; { @@ -227,7 +206,6 @@ void Handle::WaitForReadThreadFinished() { } } - void Handle::ReadComplete(OverlappedBuffer* buffer) { WaitForReadThreadStarted(); { @@ -245,12 +223,10 @@ void Handle::ReadComplete(OverlappedBuffer* buffer) { WaitForReadThreadFinished(); } - void Handle::RecvFromComplete(OverlappedBuffer* buffer) { ReadComplete(buffer); } - void Handle::WriteComplete(OverlappedBuffer* buffer) { MonitorLocker ml(monitor_); // Currently only one outstanding write at the time. @@ -259,13 +235,11 @@ void Handle::WriteComplete(OverlappedBuffer* buffer) { pending_write_ = NULL; } - static void ReadFileThread(uword args) { Handle* handle = reinterpret_cast(args); handle->ReadSyncCompleteAsync(); } - void Handle::NotifyReadThreadStarted() { MonitorLocker ml(monitor_); ASSERT(read_thread_starting_); @@ -276,7 +250,6 @@ void Handle::NotifyReadThreadStarted() { ml.Notify(); } - void Handle::NotifyReadThreadFinished() { MonitorLocker ml(monitor_); ASSERT(!read_thread_finished_); @@ -285,7 +258,6 @@ void Handle::NotifyReadThreadFinished() { ml.Notify(); } - void Handle::ReadSyncCompleteAsync() { NotifyReadThreadStarted(); ASSERT(pending_read_ != NULL); @@ -311,7 +283,6 @@ void Handle::ReadSyncCompleteAsync() { NotifyReadThreadFinished(); } - bool Handle::IssueRead() { ASSERT(type_ != kListenSocket); ASSERT(pending_read_ == NULL); @@ -342,12 +313,10 @@ bool Handle::IssueRead() { } } - bool Handle::IssueRecvFrom() { return false; } - bool Handle::IssueWrite() { MonitorLocker ml(monitor_); ASSERT(type_ != kListenSocket); @@ -369,12 +338,10 @@ bool Handle::IssueWrite() { return false; } - bool Handle::IssueSendTo(struct sockaddr* sa, socklen_t sa_len) { return false; } - static void HandleClosed(Handle* handle) { if (!handle->IsClosing()) { int event_mask = 1 << kCloseEvent; @@ -382,7 +349,6 @@ static void HandleClosed(Handle* handle) { } } - static void HandleError(Handle* handle) { handle->set_last_error(WSAGetLastError()); handle->MarkError(); @@ -391,7 +357,6 @@ static void HandleError(Handle* handle) { } } - void Handle::HandleIssueError() { DWORD error = GetLastError(); if (error == ERROR_BROKEN_PIPE) { @@ -402,7 +367,6 @@ void Handle::HandleIssueError() { SetLastError(error); } - void FileHandle::EnsureInitialized(EventHandlerImplementation* event_handler) { MonitorLocker ml(monitor_); event_handler_ = event_handler; @@ -419,12 +383,10 @@ void FileHandle::EnsureInitialized(EventHandlerImplementation* event_handler) { } } - bool FileHandle::IsClosed() { return IsClosing() && !HasPendingRead() && !HasPendingWrite(); } - void DirectoryWatchHandle::EnsureInitialized( EventHandlerImplementation* event_handler) { MonitorLocker ml(monitor_); @@ -434,12 +396,10 @@ void DirectoryWatchHandle::EnsureInitialized( } } - bool DirectoryWatchHandle::IsClosed() { return IsClosing() && (pending_read_ == NULL); } - bool DirectoryWatchHandle::IssueRead() { // It may have been started before, as we start the directory-handler when // we create it. @@ -460,7 +420,6 @@ bool DirectoryWatchHandle::IssueRead() { return false; } - void DirectoryWatchHandle::Stop() { MonitorLocker ml(monitor_); // Stop the outstanding read, so we can close the handle. @@ -473,7 +432,6 @@ void DirectoryWatchHandle::Stop() { DoClose(); } - void SocketHandle::HandleIssueError() { int error = WSAGetLastError(); if (error == WSAECONNRESET) { @@ -484,7 +442,6 @@ void SocketHandle::HandleIssueError() { WSASetLastError(error); } - bool ListenSocket::LoadAcceptEx() { // Load the AcceptEx function into memory using WSAIoctl. GUID guid_accept_ex = WSAID_ACCEPTEX; @@ -495,7 +452,6 @@ bool ListenSocket::LoadAcceptEx() { return (status != SOCKET_ERROR); } - bool ListenSocket::IssueAccept() { MonitorLocker ml(monitor_); @@ -530,7 +486,6 @@ bool ListenSocket::IssueAccept() { return true; } - void ListenSocket::AcceptComplete(OverlappedBuffer* buffer, HANDLE completion_port) { MonitorLocker ml(monitor_); @@ -565,7 +520,6 @@ void ListenSocket::AcceptComplete(OverlappedBuffer* buffer, OverlappedBuffer::DisposeBuffer(buffer); } - static void DeleteIfClosed(Handle* handle) { if (handle->IsClosed()) { handle->set_completion_port(INVALID_HANDLE_VALUE); @@ -578,7 +532,6 @@ static void DeleteIfClosed(Handle* handle) { } } - void ListenSocket::DoClose() { closesocket(socket()); handle_ = INVALID_HANDLE_VALUE; @@ -605,13 +558,11 @@ void ListenSocket::DoClose() { AcceptEx_ = NULL; } - bool ListenSocket::CanAccept() { MonitorLocker ml(monitor_); return accepted_head_ != NULL; } - ClientSocket* ListenSocket::Accept() { MonitorLocker ml(monitor_); @@ -639,7 +590,6 @@ ClientSocket* ListenSocket::Accept() { return result; } - void ListenSocket::EnsureInitialized( EventHandlerImplementation* event_handler) { MonitorLocker ml(monitor_); @@ -652,12 +602,10 @@ void ListenSocket::EnsureInitialized( } } - bool ListenSocket::IsClosed() { return IsClosing() && !HasPendingAccept(); } - intptr_t Handle::Available() { MonitorLocker ml(monitor_); if (data_ready_ == NULL) { @@ -667,7 +615,6 @@ intptr_t Handle::Available() { return data_ready_->GetRemainingLength(); } - intptr_t Handle::Read(void* buffer, intptr_t num_bytes) { MonitorLocker ml(monitor_); if (data_ready_ == NULL) { @@ -685,7 +632,6 @@ intptr_t Handle::Read(void* buffer, intptr_t num_bytes) { return num_bytes; } - intptr_t Handle::RecvFrom(void* buffer, intptr_t num_bytes, struct sockaddr* sa, @@ -714,7 +660,6 @@ intptr_t Handle::RecvFrom(void* buffer, return num_bytes; } - intptr_t Handle::Write(const void* buffer, intptr_t num_bytes) { MonitorLocker ml(monitor_); if (pending_write_ != NULL) { @@ -736,7 +681,6 @@ intptr_t Handle::Write(const void* buffer, intptr_t num_bytes) { return truncated_bytes; } - intptr_t Handle::SendTo(const void* buffer, intptr_t num_bytes, struct sockaddr* sa, @@ -760,7 +704,6 @@ intptr_t Handle::SendTo(const void* buffer, return num_bytes; } - Mutex* StdHandle::stdin_mutex_ = new Mutex(); StdHandle* StdHandle::stdin_ = NULL; @@ -772,13 +715,11 @@ StdHandle* StdHandle::Stdin(HANDLE handle) { return stdin_; } - static void WriteFileThread(uword args) { StdHandle* handle = reinterpret_cast(args); handle->RunWriteLoop(); } - void StdHandle::RunWriteLoop() { MonitorLocker ml(monitor_); write_thread_running_ = true; @@ -799,7 +740,6 @@ void StdHandle::RunWriteLoop() { ml.Notify(); } - void StdHandle::WriteSyncCompleteAsync() { ASSERT(pending_write_ != NULL); @@ -863,7 +803,6 @@ intptr_t StdHandle::Write(const void* buffer, intptr_t num_bytes) { return 0; } - void StdHandle::DoClose() { { MonitorLocker ml(monitor_); @@ -885,12 +824,10 @@ void StdHandle::DoClose() { StdHandle::stdin_ = NULL; } - #if defined(DEBUG) intptr_t ClientSocket::disconnecting_ = 0; #endif - bool ClientSocket::LoadDisconnectEx() { // Load the DisconnectEx function into memory using WSAIoctl. GUID guid_disconnect_ex = WSAID_DISCONNECTEX; @@ -902,7 +839,6 @@ bool ClientSocket::LoadDisconnectEx() { return (status != SOCKET_ERROR); } - void ClientSocket::Shutdown(int how) { int rc = shutdown(socket(), how); if (how == SD_RECEIVE) { @@ -917,7 +853,6 @@ void ClientSocket::Shutdown(int how) { } } - void ClientSocket::DoClose() { // Always do a shutdown before initiating a disconnect. shutdown(socket(), SD_BOTH); @@ -925,7 +860,6 @@ void ClientSocket::DoClose() { handle_ = INVALID_HANDLE_VALUE; } - bool ClientSocket::IssueRead() { MonitorLocker ml(monitor_); ASSERT(completion_port_ != INVALID_HANDLE_VALUE); @@ -949,7 +883,6 @@ bool ClientSocket::IssueRead() { return false; } - bool ClientSocket::IssueWrite() { MonitorLocker ml(monitor_); ASSERT(completion_port_ != INVALID_HANDLE_VALUE); @@ -967,7 +900,6 @@ bool ClientSocket::IssueWrite() { return false; } - void ClientSocket::IssueDisconnect() { OverlappedBuffer* buffer = OverlappedBuffer::AllocateDisconnectBuffer(); BOOL ok = @@ -991,7 +923,6 @@ void ClientSocket::IssueDisconnect() { #endif } - void ClientSocket::DisconnectComplete(OverlappedBuffer* buffer) { OverlappedBuffer::DisposeBuffer(buffer); closesocket(socket()); @@ -1004,7 +935,6 @@ void ClientSocket::DisconnectComplete(OverlappedBuffer* buffer) { #endif } - void ClientSocket::ConnectComplete(OverlappedBuffer* buffer) { OverlappedBuffer::DisposeBuffer(buffer); // Update socket to support full socket API, after ConnectEx completed. @@ -1020,7 +950,6 @@ void ClientSocket::ConnectComplete(OverlappedBuffer* buffer) { } } - void ClientSocket::EnsureInitialized( EventHandlerImplementation* event_handler) { MonitorLocker ml(monitor_); @@ -1031,12 +960,10 @@ void ClientSocket::EnsureInitialized( } } - bool ClientSocket::IsClosed() { return connected_ && closed_; } - bool DatagramSocket::IssueSendTo(struct sockaddr* sa, socklen_t sa_len) { MonitorLocker ml(monitor_); ASSERT(completion_port_ != INVALID_HANDLE_VALUE); @@ -1054,7 +981,6 @@ bool DatagramSocket::IssueSendTo(struct sockaddr* sa, socklen_t sa_len) { return false; } - bool DatagramSocket::IssueRecvFrom() { MonitorLocker ml(monitor_); ASSERT(completion_port_ != INVALID_HANDLE_VALUE); @@ -1078,7 +1004,6 @@ bool DatagramSocket::IssueRecvFrom() { return false; } - void DatagramSocket::EnsureInitialized( EventHandlerImplementation* event_handler) { MonitorLocker ml(monitor_); @@ -1089,12 +1014,10 @@ void DatagramSocket::EnsureInitialized( } } - bool DatagramSocket::IsClosed() { return IsClosing() && !HasPendingRead() && !HasPendingWrite(); } - void DatagramSocket::DoClose() { // Just close the socket. This will cause any queued requests to be aborted. closesocket(socket()); @@ -1103,7 +1026,6 @@ void DatagramSocket::DoClose() { handle_ = INVALID_HANDLE_VALUE; } - void EventHandlerImplementation::HandleInterrupt(InterruptMessage* msg) { ASSERT(this != NULL); if (msg->id == kTimerId) { @@ -1224,7 +1146,6 @@ void EventHandlerImplementation::HandleInterrupt(InterruptMessage* msg) { } } - void EventHandlerImplementation::HandleAccept(ListenSocket* listen_socket, OverlappedBuffer* buffer) { listen_socket->AcceptComplete(buffer, completion_port_); @@ -1237,7 +1158,6 @@ void EventHandlerImplementation::HandleAccept(ListenSocket* listen_socket, DeleteIfClosed(listen_socket); } - void EventHandlerImplementation::TryDispatchingPendingAccepts( ListenSocket* listen_socket) { if (!listen_socket->IsClosing() && listen_socket->CanAccept()) { @@ -1251,7 +1171,6 @@ void EventHandlerImplementation::TryDispatchingPendingAccepts( } } - void EventHandlerImplementation::HandleRead(Handle* handle, int bytes, OverlappedBuffer* buffer) { @@ -1277,7 +1196,6 @@ void EventHandlerImplementation::HandleRead(Handle* handle, DeleteIfClosed(handle); } - void EventHandlerImplementation::HandleRecvFrom(Handle* handle, int bytes, OverlappedBuffer* buffer) { @@ -1299,7 +1217,6 @@ void EventHandlerImplementation::HandleRecvFrom(Handle* handle, DeleteIfClosed(handle); } - void EventHandlerImplementation::HandleWrite(Handle* handle, int bytes, OverlappedBuffer* buffer) { @@ -1322,7 +1239,6 @@ void EventHandlerImplementation::HandleWrite(Handle* handle, DeleteIfClosed(handle); } - void EventHandlerImplementation::HandleDisconnect(ClientSocket* client_socket, int bytes, OverlappedBuffer* buffer) { @@ -1330,7 +1246,6 @@ void EventHandlerImplementation::HandleDisconnect(ClientSocket* client_socket, DeleteIfClosed(client_socket); } - void EventHandlerImplementation::HandleConnect(ClientSocket* client_socket, int bytes, OverlappedBuffer* buffer) { @@ -1344,7 +1259,6 @@ void EventHandlerImplementation::HandleConnect(ClientSocket* client_socket, DeleteIfClosed(client_socket); } - void EventHandlerImplementation::HandleTimeout() { if (!timeout_queue_.HasTimeout()) { return; @@ -1353,7 +1267,6 @@ void EventHandlerImplementation::HandleTimeout() { timeout_queue_.RemoveCurrent(); } - void EventHandlerImplementation::HandleIOCompletion(DWORD bytes, ULONG_PTR key, OVERLAPPED* overlapped) { @@ -1395,7 +1308,6 @@ void EventHandlerImplementation::HandleIOCompletion(DWORD bytes, } } - void EventHandlerImplementation::HandleCompletionOrInterrupt( BOOL ok, DWORD bytes, @@ -1433,7 +1345,6 @@ void EventHandlerImplementation::HandleCompletionOrInterrupt( } } - EventHandlerImplementation::EventHandlerImplementation() { startup_monitor_ = new Monitor(); handler_thread_id_ = Thread::kInvalidThreadId; @@ -1446,7 +1357,6 @@ EventHandlerImplementation::EventHandlerImplementation() { shutdown_ = false; } - EventHandlerImplementation::~EventHandlerImplementation() { // Join the handler thread. DWORD res = WaitForSingleObject(handler_thread_handle_, INFINITE); @@ -1456,7 +1366,6 @@ EventHandlerImplementation::~EventHandlerImplementation() { CloseHandle(completion_port_); } - int64_t EventHandlerImplementation::GetTimeout() { if (!timeout_queue_.HasTimeout()) { return kInfinityTimeout; @@ -1466,7 +1375,6 @@ int64_t EventHandlerImplementation::GetTimeout() { return (millis < 0) ? 0 : millis; } - void EventHandlerImplementation::SendData(intptr_t id, Dart_Port dart_port, int64_t data) { @@ -1481,7 +1389,6 @@ void EventHandlerImplementation::SendData(intptr_t id, } } - void EventHandlerImplementation::EventHandlerEntry(uword args) { EventHandler* handler = reinterpret_cast(args); EventHandlerImplementation* handler_impl = &handler->delegate_; @@ -1554,7 +1461,6 @@ void EventHandlerImplementation::EventHandlerEntry(uword args) { handler->NotifyShutdownDone(); } - void EventHandlerImplementation::Start(EventHandler* handler) { int result = Thread::Start(EventHandlerEntry, reinterpret_cast(handler)); @@ -1575,7 +1481,6 @@ void EventHandlerImplementation::Start(EventHandler* handler) { } } - void EventHandlerImplementation::Shutdown() { SendData(kShutdownId, 0, 0); } diff --git a/runtime/bin/eventhandler_win.h b/runtime/bin/eventhandler_win.h index bcb2556ab96..2833f13f54c 100644 --- a/runtime/bin/eventhandler_win.h +++ b/runtime/bin/eventhandler_win.h @@ -291,7 +291,6 @@ class Handle : public ReferenceCounted, public DescriptorInfoBase { DISALLOW_COPY_AND_ASSIGN(Handle); }; - class FileHandle : public DescriptorInfoSingleMixin { public: explicit FileHandle(HANDLE handle) @@ -306,7 +305,6 @@ class FileHandle : public DescriptorInfoSingleMixin { DISALLOW_COPY_AND_ASSIGN(FileHandle); }; - class StdHandle : public FileHandle { public: static StdHandle* Stdin(HANDLE handle); @@ -344,7 +342,6 @@ class StdHandle : public FileHandle { DISALLOW_COPY_AND_ASSIGN(StdHandle); }; - class DirectoryWatchHandle : public DescriptorInfoSingleMixin { public: DirectoryWatchHandle(HANDLE handle, int events, bool recursive) @@ -368,7 +365,6 @@ class DirectoryWatchHandle : public DescriptorInfoSingleMixin { DISALLOW_COPY_AND_ASSIGN(DirectoryWatchHandle); }; - class SocketHandle : public Handle { public: SOCKET socket() const { return socket_; } @@ -384,7 +380,6 @@ class SocketHandle : public Handle { DISALLOW_COPY_AND_ASSIGN(SocketHandle); }; - // Information on listen sockets. class ListenSocket : public DescriptorInfoMultipleMixin { public: @@ -441,7 +436,6 @@ class ListenSocket : public DescriptorInfoMultipleMixin { DISALLOW_COPY_AND_ASSIGN(ListenSocket); }; - // Information on connected sockets. class ClientSocket : public DescriptorInfoSingleMixin { public: @@ -504,7 +498,6 @@ class ClientSocket : public DescriptorInfoSingleMixin { DISALLOW_COPY_AND_ASSIGN(ClientSocket); }; - class DatagramSocket : public DescriptorInfoSingleMixin { public: explicit DatagramSocket(intptr_t s) : DescriptorInfoSingleMixin(s, true) { @@ -529,7 +522,6 @@ class DatagramSocket : public DescriptorInfoSingleMixin { DISALLOW_COPY_AND_ASSIGN(DatagramSocket); }; - // Event handler. class EventHandlerImplementation { public: diff --git a/runtime/bin/extensions.cc b/runtime/bin/extensions.cc index 9a537830f99..9f8edfec2f9 100644 --- a/runtime/bin/extensions.cc +++ b/runtime/bin/extensions.cc @@ -23,7 +23,6 @@ static char PathSeparator() { return sep[0]; } - void* Extensions::MakePathAndResolve(const char* dir, const char* name) { // First try to find the library with a suffix specifying the architecture. { @@ -59,7 +58,6 @@ void* Extensions::MakePathAndResolve(const char* dir, const char* name) { } } - // IMPORTANT: In the absolute path case, do not extract the filename and search // for that by passing it to LoadLibrary. That can lead to confusion in // which the absolute path is wrong, and a different version of the library is @@ -74,7 +72,6 @@ void* Extensions::ResolveAbsPathExtension(const char* extension_path) { return library_handle; } - void* Extensions::ResolveExtension(const char* extension_directory, const char* extension_name) { // If the path following dart-ext is an absolute path, then only look for the @@ -96,7 +93,6 @@ void* Extensions::ResolveExtension(const char* extension_directory, return MakePathAndResolve("", extension_name); } - Dart_Handle Extensions::LoadExtension(const char* extension_directory, const char* extension_name, Dart_Handle parent_library) { @@ -123,7 +119,6 @@ Dart_Handle Extensions::LoadExtension(const char* extension_directory, return (*fn)(parent_library); } - // Concatenates a NULL terminated array of strings. // The returned string is scope allocated. const char* Extensions::Concatenate(const char** strings) { diff --git a/runtime/bin/extensions_android.cc b/runtime/bin/extensions_android.cc index 944d57e5967..1b2f36385e1 100644 --- a/runtime/bin/extensions_android.cc +++ b/runtime/bin/extensions_android.cc @@ -5,8 +5,8 @@ #include "platform/globals.h" #if defined(HOST_OS_ANDROID) -#include "bin/extensions.h" #include // NOLINT +#include "bin/extensions.h" #include "platform/assert.h" @@ -23,20 +23,17 @@ void* Extensions::LoadExtensionLibrary(const char* library_file) { return dlopen(library_file, RTLD_LAZY); } - void* Extensions::ResolveSymbol(void* lib_handle, const char* symbol) { dlerror(); return dlsym(lib_handle, symbol); } - void Extensions::UnloadLibrary(void* lib_handle) { dlerror(); int result = dlclose(lib_handle); ASSERT(result == 0); } - Dart_Handle Extensions::GetError() { const char* err_str = dlerror(); if (err_str != NULL) { diff --git a/runtime/bin/extensions_fuchsia.cc b/runtime/bin/extensions_fuchsia.cc index 09c7484eeb5..cc80a5804fd 100644 --- a/runtime/bin/extensions_fuchsia.cc +++ b/runtime/bin/extensions_fuchsia.cc @@ -30,20 +30,17 @@ void* Extensions::LoadExtensionLibrary(const char* library_file) { return dlopen_vmo(vmo, RTLD_LAZY); } - void* Extensions::ResolveSymbol(void* lib_handle, const char* symbol) { dlerror(); return dlsym(lib_handle, symbol); } - void Extensions::UnloadLibrary(void* lib_handle) { dlerror(); int result = dlclose(lib_handle); ASSERT(result == 0); } - Dart_Handle Extensions::GetError() { const char* err_str = dlerror(); if (err_str != NULL) { diff --git a/runtime/bin/extensions_linux.cc b/runtime/bin/extensions_linux.cc index 70eb6482c29..d8972a768f9 100644 --- a/runtime/bin/extensions_linux.cc +++ b/runtime/bin/extensions_linux.cc @@ -5,8 +5,8 @@ #include "platform/globals.h" #if defined(HOST_OS_LINUX) -#include "bin/extensions.h" #include // NOLINT +#include "bin/extensions.h" #include "platform/assert.h" @@ -23,20 +23,17 @@ void* Extensions::LoadExtensionLibrary(const char* library_file) { return dlopen(library_file, RTLD_LAZY); } - void* Extensions::ResolveSymbol(void* lib_handle, const char* symbol) { dlerror(); return dlsym(lib_handle, symbol); } - void Extensions::UnloadLibrary(void* lib_handle) { dlerror(); int result = dlclose(lib_handle); ASSERT(result == 0); } - Dart_Handle Extensions::GetError() { const char* err_str = dlerror(); if (err_str != NULL) { diff --git a/runtime/bin/extensions_macos.cc b/runtime/bin/extensions_macos.cc index 3269e4f06fc..7007f4a8f1f 100644 --- a/runtime/bin/extensions_macos.cc +++ b/runtime/bin/extensions_macos.cc @@ -5,8 +5,8 @@ #include "platform/globals.h" #if defined(HOST_OS_MACOS) -#include "bin/extensions.h" #include // NOLINT +#include "bin/extensions.h" #include "platform/assert.h" @@ -23,20 +23,17 @@ void* Extensions::LoadExtensionLibrary(const char* library_file) { return dlopen(library_file, RTLD_LAZY); } - void* Extensions::ResolveSymbol(void* lib_handle, const char* symbol) { dlerror(); return dlsym(lib_handle, symbol); } - void Extensions::UnloadLibrary(void* lib_handle) { dlerror(); int result = dlclose(lib_handle); ASSERT(result == 0); } - Dart_Handle Extensions::GetError() { const char* err_str = dlerror(); if (err_str != NULL) { diff --git a/runtime/bin/extensions_win.cc b/runtime/bin/extensions_win.cc index dcc82d0beb6..8baf714f5b8 100644 --- a/runtime/bin/extensions_win.cc +++ b/runtime/bin/extensions_win.cc @@ -33,20 +33,17 @@ void* Extensions::LoadExtensionLibrary(const char* library_file) { return ext; } - void* Extensions::ResolveSymbol(void* lib_handle, const char* symbol) { SetLastError(0); return GetProcAddress(reinterpret_cast(lib_handle), symbol); } - void Extensions::UnloadLibrary(void* lib_handle) { SetLastError(0); BOOL result = FreeLibrary(reinterpret_cast(lib_handle)); ASSERT(result); } - Dart_Handle Extensions::GetError() { int last_error = GetLastError(); if (last_error != 0) { diff --git a/runtime/bin/fdutils_android.cc b/runtime/bin/fdutils_android.cc index 71627b6ae2a..86e501b9092 100644 --- a/runtime/bin/fdutils_android.cc +++ b/runtime/bin/fdutils_android.cc @@ -32,7 +32,6 @@ bool FDUtils::SetCloseOnExec(intptr_t fd) { return true; } - static bool SetBlockingHelper(intptr_t fd, bool blocking) { intptr_t status; status = NO_RETRY_EXPECTED(fcntl(fd, F_GETFL)); @@ -48,17 +47,14 @@ static bool SetBlockingHelper(intptr_t fd, bool blocking) { return true; } - bool FDUtils::SetNonBlocking(intptr_t fd) { return SetBlockingHelper(fd, false); } - bool FDUtils::SetBlocking(intptr_t fd) { return SetBlockingHelper(fd, true); } - bool FDUtils::IsBlocking(intptr_t fd, bool* is_blocking) { intptr_t status; status = NO_RETRY_EXPECTED(fcntl(fd, F_GETFL)); @@ -69,7 +65,6 @@ bool FDUtils::IsBlocking(intptr_t fd, bool* is_blocking) { return true; } - intptr_t FDUtils::AvailableBytes(intptr_t fd) { int available; // ioctl for FIONREAD expects an 'int*' argument. int result = NO_RETRY_EXPECTED(ioctl(fd, FIONREAD, &available)); @@ -80,7 +75,6 @@ intptr_t FDUtils::AvailableBytes(intptr_t fd) { return static_cast(available); } - ssize_t FDUtils::ReadFromBlocking(int fd, void* buffer, size_t count) { #ifdef DEBUG bool is_blocking = false; @@ -108,7 +102,6 @@ ssize_t FDUtils::ReadFromBlocking(int fd, void* buffer, size_t count) { return count; } - ssize_t FDUtils::WriteToBlocking(int fd, const void* buffer, size_t count) { #ifdef DEBUG bool is_blocking = false; @@ -137,7 +130,6 @@ ssize_t FDUtils::WriteToBlocking(int fd, const void* buffer, size_t count) { return count; } - void FDUtils::SaveErrorAndClose(intptr_t fd) { int err = errno; VOID_TEMP_FAILURE_RETRY(close(fd)); diff --git a/runtime/bin/fdutils_fuchsia.cc b/runtime/bin/fdutils_fuchsia.cc index 6c3eae91a42..6cd03e60fdc 100644 --- a/runtime/bin/fdutils_fuchsia.cc +++ b/runtime/bin/fdutils_fuchsia.cc @@ -32,7 +32,6 @@ bool FDUtils::SetCloseOnExec(intptr_t fd) { return true; } - static bool SetBlockingHelper(intptr_t fd, bool blocking) { intptr_t status; status = NO_RETRY_EXPECTED(fcntl(fd, F_GETFL)); @@ -48,17 +47,14 @@ static bool SetBlockingHelper(intptr_t fd, bool blocking) { return true; } - bool FDUtils::SetNonBlocking(intptr_t fd) { return SetBlockingHelper(fd, false); } - bool FDUtils::SetBlocking(intptr_t fd) { return SetBlockingHelper(fd, true); } - bool FDUtils::IsBlocking(intptr_t fd, bool* is_blocking) { intptr_t status; status = NO_RETRY_EXPECTED(fcntl(fd, F_GETFL)); @@ -69,7 +65,6 @@ bool FDUtils::IsBlocking(intptr_t fd, bool* is_blocking) { return true; } - intptr_t FDUtils::AvailableBytes(intptr_t fd) { int available; // ioctl for FIONREAD expects an 'int*' argument. int result = NO_RETRY_EXPECTED(ioctl(fd, FIONREAD, &available)); @@ -81,7 +76,6 @@ intptr_t FDUtils::AvailableBytes(intptr_t fd) { return static_cast(available); } - ssize_t FDUtils::ReadFromBlocking(int fd, void* buffer, size_t count) { #ifdef DEBUG bool is_blocking = false; @@ -109,7 +103,6 @@ ssize_t FDUtils::ReadFromBlocking(int fd, void* buffer, size_t count) { return count; } - ssize_t FDUtils::WriteToBlocking(int fd, const void* buffer, size_t count) { #ifdef DEBUG bool is_blocking = false; @@ -137,7 +130,6 @@ ssize_t FDUtils::WriteToBlocking(int fd, const void* buffer, size_t count) { return count; } - void FDUtils::SaveErrorAndClose(intptr_t fd) { int err = errno; NO_RETRY_EXPECTED(close(fd)); diff --git a/runtime/bin/fdutils_linux.cc b/runtime/bin/fdutils_linux.cc index 4bf9897fcdd..2cc20c56565 100644 --- a/runtime/bin/fdutils_linux.cc +++ b/runtime/bin/fdutils_linux.cc @@ -32,7 +32,6 @@ bool FDUtils::SetCloseOnExec(intptr_t fd) { return true; } - static bool SetBlockingHelper(intptr_t fd, bool blocking) { intptr_t status; status = NO_RETRY_EXPECTED(fcntl(fd, F_GETFL)); @@ -48,17 +47,14 @@ static bool SetBlockingHelper(intptr_t fd, bool blocking) { return true; } - bool FDUtils::SetNonBlocking(intptr_t fd) { return SetBlockingHelper(fd, false); } - bool FDUtils::SetBlocking(intptr_t fd) { return SetBlockingHelper(fd, true); } - bool FDUtils::IsBlocking(intptr_t fd, bool* is_blocking) { intptr_t status; status = NO_RETRY_EXPECTED(fcntl(fd, F_GETFL)); @@ -69,7 +65,6 @@ bool FDUtils::IsBlocking(intptr_t fd, bool* is_blocking) { return true; } - intptr_t FDUtils::AvailableBytes(intptr_t fd) { int available; // ioctl for FIONREAD expects an 'int*' argument. int result = NO_RETRY_EXPECTED(ioctl(fd, FIONREAD, &available)); @@ -80,7 +75,6 @@ intptr_t FDUtils::AvailableBytes(intptr_t fd) { return static_cast(available); } - ssize_t FDUtils::ReadFromBlocking(int fd, void* buffer, size_t count) { #ifdef DEBUG bool is_blocking = false; @@ -108,7 +102,6 @@ ssize_t FDUtils::ReadFromBlocking(int fd, void* buffer, size_t count) { return count; } - ssize_t FDUtils::WriteToBlocking(int fd, const void* buffer, size_t count) { #ifdef DEBUG bool is_blocking = false; @@ -137,7 +130,6 @@ ssize_t FDUtils::WriteToBlocking(int fd, const void* buffer, size_t count) { return count; } - void FDUtils::SaveErrorAndClose(intptr_t fd) { int err = errno; VOID_TEMP_FAILURE_RETRY(close(fd)); diff --git a/runtime/bin/fdutils_macos.cc b/runtime/bin/fdutils_macos.cc index 9da95a89e83..e6915061273 100644 --- a/runtime/bin/fdutils_macos.cc +++ b/runtime/bin/fdutils_macos.cc @@ -32,7 +32,6 @@ bool FDUtils::SetCloseOnExec(intptr_t fd) { return true; } - static bool SetBlockingHelper(intptr_t fd, bool blocking) { intptr_t status; status = NO_RETRY_EXPECTED(fcntl(fd, F_GETFL)); @@ -48,17 +47,14 @@ static bool SetBlockingHelper(intptr_t fd, bool blocking) { return true; } - bool FDUtils::SetNonBlocking(intptr_t fd) { return SetBlockingHelper(fd, false); } - bool FDUtils::SetBlocking(intptr_t fd) { return SetBlockingHelper(fd, true); } - bool FDUtils::IsBlocking(intptr_t fd, bool* is_blocking) { intptr_t status; status = NO_RETRY_EXPECTED(fcntl(fd, F_GETFL)); @@ -69,7 +65,6 @@ bool FDUtils::IsBlocking(intptr_t fd, bool* is_blocking) { return true; } - intptr_t FDUtils::AvailableBytes(intptr_t fd) { int available; // ioctl for FIONREAD expects an 'int*' argument. int result = NO_RETRY_EXPECTED(ioctl(fd, FIONREAD, &available)); @@ -80,7 +75,6 @@ intptr_t FDUtils::AvailableBytes(intptr_t fd) { return static_cast(available); } - ssize_t FDUtils::ReadFromBlocking(int fd, void* buffer, size_t count) { #ifdef DEBUG bool is_blocking = false; @@ -108,7 +102,6 @@ ssize_t FDUtils::ReadFromBlocking(int fd, void* buffer, size_t count) { return count; } - ssize_t FDUtils::WriteToBlocking(int fd, const void* buffer, size_t count) { #ifdef DEBUG bool is_blocking = false; @@ -137,7 +130,6 @@ ssize_t FDUtils::WriteToBlocking(int fd, const void* buffer, size_t count) { return count; } - void FDUtils::SaveErrorAndClose(intptr_t fd) { int err = errno; VOID_TEMP_FAILURE_RETRY(close(fd)); diff --git a/runtime/bin/file.cc b/runtime/bin/file.cc index feeb130fec5..d512671c227 100644 --- a/runtime/bin/file.cc +++ b/runtime/bin/file.cc @@ -32,7 +32,6 @@ static File* GetFile(Dart_NativeArguments args) { return file; } - static void SetFile(Dart_Handle dart_this, intptr_t file_pointer) { Dart_Handle result = Dart_SetNativeInstanceField( dart_this, kFileNativeFieldIndex, file_pointer); @@ -42,7 +41,6 @@ static void SetFile(Dart_Handle dart_this, intptr_t file_pointer) { } } - void FUNCTION_NAME(File_GetPointer)(Dart_NativeArguments args) { File* file = GetFile(args); // If the file is already closed, GetFile() will return NULL. @@ -55,7 +53,6 @@ void FUNCTION_NAME(File_GetPointer)(Dart_NativeArguments args) { Dart_SetReturnValue(args, Dart_NewInteger(file_pointer)); } - static void ReleaseFile(void* isolate_callback_data, Dart_WeakPersistentHandle handle, void* peer) { @@ -63,7 +60,6 @@ static void ReleaseFile(void* isolate_callback_data, file->Release(); } - void FUNCTION_NAME(File_SetPointer)(Dart_NativeArguments args) { Dart_Handle dart_this = ThrowIfError(Dart_GetNativeArgument(args, 0)); intptr_t file_pointer = @@ -75,7 +71,6 @@ void FUNCTION_NAME(File_SetPointer)(Dart_NativeArguments args) { SetFile(dart_this, file_pointer); } - void FUNCTION_NAME(File_Open)(Dart_NativeArguments args) { const char* filename = DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); @@ -96,7 +91,6 @@ void FUNCTION_NAME(File_Open)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_Exists)(Dart_NativeArguments args) { const char* filename = DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); @@ -104,7 +98,6 @@ void FUNCTION_NAME(File_Exists)(Dart_NativeArguments args) { Dart_SetReturnValue(args, Dart_NewBoolean(exists)); } - void FUNCTION_NAME(File_Close)(Dart_NativeArguments args) { File* file = GetFile(args); ASSERT(file != NULL); @@ -118,7 +111,6 @@ void FUNCTION_NAME(File_Close)(Dart_NativeArguments args) { Dart_SetReturnValue(args, Dart_NewInteger(0)); } - void FUNCTION_NAME(File_ReadByte)(Dart_NativeArguments args) { File* file = GetFile(args); ASSERT(file != NULL); @@ -133,7 +125,6 @@ void FUNCTION_NAME(File_ReadByte)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_WriteByte)(Dart_NativeArguments args) { File* file = GetFile(args); ASSERT(file != NULL); @@ -152,7 +143,6 @@ void FUNCTION_NAME(File_WriteByte)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_Read)(Dart_NativeArguments args) { File* file = GetFile(args); ASSERT(file != NULL); @@ -191,7 +181,6 @@ void FUNCTION_NAME(File_Read)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_ReadInto)(Dart_NativeArguments args) { File* file = GetFile(args); ASSERT(file != NULL); @@ -224,7 +213,6 @@ void FUNCTION_NAME(File_ReadInto)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_WriteFrom)(Dart_NativeArguments args) { File* file = GetFile(args); ASSERT(file != NULL); @@ -271,7 +259,6 @@ void FUNCTION_NAME(File_WriteFrom)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_Position)(Dart_NativeArguments args) { File* file = GetFile(args); ASSERT(file != NULL); @@ -283,7 +270,6 @@ void FUNCTION_NAME(File_Position)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_SetPosition)(Dart_NativeArguments args) { File* file = GetFile(args); ASSERT(file != NULL); @@ -300,7 +286,6 @@ void FUNCTION_NAME(File_SetPosition)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_Truncate)(Dart_NativeArguments args) { File* file = GetFile(args); ASSERT(file != NULL); @@ -317,7 +302,6 @@ void FUNCTION_NAME(File_Truncate)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_Length)(Dart_NativeArguments args) { File* file = GetFile(args); ASSERT(file != NULL); @@ -329,7 +313,6 @@ void FUNCTION_NAME(File_Length)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_LengthFromPath)(Dart_NativeArguments args) { const char* path = DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); int64_t return_value = File::LengthFromPath(path); @@ -340,7 +323,6 @@ void FUNCTION_NAME(File_LengthFromPath)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_LastModified)(Dart_NativeArguments args) { const char* name = DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); int64_t return_value = File::LastModified(name); @@ -352,7 +334,6 @@ void FUNCTION_NAME(File_LastModified)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_SetLastModified)(Dart_NativeArguments args) { const char* name = DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); int64_t millis; @@ -365,7 +346,6 @@ void FUNCTION_NAME(File_SetLastModified)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_LastAccessed)(Dart_NativeArguments args) { const char* name = DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); int64_t return_value = File::LastAccessed(name); @@ -377,7 +357,6 @@ void FUNCTION_NAME(File_LastAccessed)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_SetLastAccessed)(Dart_NativeArguments args) { const char* name = DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); int64_t millis; @@ -390,7 +369,6 @@ void FUNCTION_NAME(File_SetLastAccessed)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_Flush)(Dart_NativeArguments args) { File* file = GetFile(args); ASSERT(file != NULL); @@ -401,7 +379,6 @@ void FUNCTION_NAME(File_Flush)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_Lock)(Dart_NativeArguments args) { File* file = GetFile(args); ASSERT(file != NULL); @@ -425,7 +402,6 @@ void FUNCTION_NAME(File_Lock)(Dart_NativeArguments args) { Dart_SetReturnValue(args, DartUtils::NewDartOSError(&os_error)); } - void FUNCTION_NAME(File_Create)(Dart_NativeArguments args) { const char* str = DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); bool result = File::Create(str); @@ -436,7 +412,6 @@ void FUNCTION_NAME(File_Create)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_CreateLink)(Dart_NativeArguments args) { if (Dart_IsString(Dart_GetNativeArgument(args, 0)) && Dart_IsString(Dart_GetNativeArgument(args, 1))) { @@ -454,7 +429,6 @@ void FUNCTION_NAME(File_CreateLink)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_LinkTarget)(Dart_NativeArguments args) { if (Dart_IsString(Dart_GetNativeArgument(args, 0))) { const char* name = @@ -472,7 +446,6 @@ void FUNCTION_NAME(File_LinkTarget)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_Delete)(Dart_NativeArguments args) { const char* str = DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); bool result = File::Delete(str); @@ -483,7 +456,6 @@ void FUNCTION_NAME(File_Delete)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_DeleteLink)(Dart_NativeArguments args) { const char* str = DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); bool result = File::DeleteLink(str); @@ -494,7 +466,6 @@ void FUNCTION_NAME(File_DeleteLink)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_Rename)(Dart_NativeArguments args) { const char* old_path = DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); @@ -508,7 +479,6 @@ void FUNCTION_NAME(File_Rename)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_RenameLink)(Dart_NativeArguments args) { const char* old_path = DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); @@ -522,7 +492,6 @@ void FUNCTION_NAME(File_RenameLink)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_Copy)(Dart_NativeArguments args) { const char* old_path = DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); @@ -536,7 +505,6 @@ void FUNCTION_NAME(File_Copy)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_ResolveSymbolicLinks)(Dart_NativeArguments args) { const char* str = DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); const char* path = File::GetCanonicalPath(str); @@ -547,7 +515,6 @@ void FUNCTION_NAME(File_ResolveSymbolicLinks)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_OpenStdio)(Dart_NativeArguments args) { int64_t fd = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); ASSERT((fd == STDIN_FILENO) || (fd == STDOUT_FILENO) || @@ -556,7 +523,6 @@ void FUNCTION_NAME(File_OpenStdio)(Dart_NativeArguments args) { Dart_SetReturnValue(args, Dart_NewInteger(reinterpret_cast(file))); } - void FUNCTION_NAME(File_GetStdioHandleType)(Dart_NativeArguments args) { int64_t fd = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); ASSERT((fd == STDIN_FILENO) || (fd == STDOUT_FILENO) || @@ -565,7 +531,6 @@ void FUNCTION_NAME(File_GetStdioHandleType)(Dart_NativeArguments args) { Dart_SetReturnValue(args, Dart_NewInteger(type)); } - void FUNCTION_NAME(File_GetType)(Dart_NativeArguments args) { if (Dart_IsString(Dart_GetNativeArgument(args, 0)) && Dart_IsBoolean(Dart_GetNativeArgument(args, 1))) { @@ -582,7 +547,6 @@ void FUNCTION_NAME(File_GetType)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_Stat)(Dart_NativeArguments args) { if (Dart_IsString(Dart_GetNativeArgument(args, 0))) { const char* path = @@ -621,7 +585,6 @@ void FUNCTION_NAME(File_Stat)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(File_AreIdentical)(Dart_NativeArguments args) { if (Dart_IsString(Dart_GetNativeArgument(args, 0)) && Dart_IsString(Dart_GetNativeArgument(args, 1))) { @@ -642,7 +605,6 @@ void FUNCTION_NAME(File_AreIdentical)(Dart_NativeArguments args) { } } - static int64_t CObjectInt32OrInt64ToInt64(CObject* cobject) { ASSERT(cobject->IsInt32OrInt64()); int64_t result; @@ -656,13 +618,11 @@ static int64_t CObjectInt32OrInt64ToInt64(CObject* cobject) { return result; } - File* CObjectToFilePointer(CObject* cobject) { CObjectIntptr value(cobject); return reinterpret_cast(value.Value()); } - CObject* File::ExistsRequest(const CObjectArray& request) { if ((request.Length() == 1) && request[0]->IsString()) { CObjectString filename(request[0]); @@ -672,7 +632,6 @@ CObject* File::ExistsRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::CreateRequest(const CObjectArray& request) { if ((request.Length() == 1) && request[0]->IsString()) { CObjectString filename(request[0]); @@ -686,7 +645,6 @@ CObject* File::CreateRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::OpenRequest(const CObjectArray& request) { File* file = NULL; if ((request.Length() == 2) && request[0]->IsString() && @@ -707,7 +665,6 @@ CObject* File::OpenRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::DeleteRequest(const CObjectArray& request) { if ((request.Length() == 1) && request[0]->IsString()) { CObjectString filename(request[0]); @@ -721,7 +678,6 @@ CObject* File::DeleteRequest(const CObjectArray& request) { return CObject::False(); } - CObject* File::RenameRequest(const CObjectArray& request) { if ((request.Length() == 2) && request[0]->IsString() && request[1]->IsString()) { @@ -736,7 +692,6 @@ CObject* File::RenameRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::CopyRequest(const CObjectArray& request) { if ((request.Length() == 2) && request[0]->IsString() && request[1]->IsString()) { @@ -751,7 +706,6 @@ CObject* File::CopyRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::ResolveSymbolicLinksRequest(const CObjectArray& request) { if ((request.Length() == 1) && request[0]->IsString()) { CObjectString filename(request[0]); @@ -766,7 +720,6 @@ CObject* File::ResolveSymbolicLinksRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::CloseRequest(const CObjectArray& request) { intptr_t return_value = -1; if ((request.Length() == 1) && request[0]->IsIntptr()) { @@ -785,7 +738,6 @@ CObject* File::CloseRequest(const CObjectArray& request) { return new CObjectIntptr(CObject::NewIntptr(return_value)); } - CObject* File::PositionRequest(const CObjectArray& request) { if ((request.Length() == 1) && request[0]->IsIntptr()) { File* file = CObjectToFilePointer(request[0]); @@ -804,7 +756,6 @@ CObject* File::PositionRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::SetPositionRequest(const CObjectArray& request) { if ((request.Length() >= 1) && request[0]->IsIntptr()) { File* file = CObjectToFilePointer(request[0]); @@ -827,7 +778,6 @@ CObject* File::SetPositionRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::TruncateRequest(const CObjectArray& request) { if ((request.Length() >= 1) && request[0]->IsIntptr()) { File* file = CObjectToFilePointer(request[0]); @@ -850,7 +800,6 @@ CObject* File::TruncateRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::LengthRequest(const CObjectArray& request) { if ((request.Length() == 1) && request[0]->IsIntptr()) { File* file = CObjectToFilePointer(request[0]); @@ -869,7 +818,6 @@ CObject* File::LengthRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::LengthFromPathRequest(const CObjectArray& request) { if ((request.Length() == 1) && request[0]->IsString()) { CObjectString filepath(request[0]); @@ -883,7 +831,6 @@ CObject* File::LengthFromPathRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::LastAccessedRequest(const CObjectArray& request) { if ((request.Length() == 1) && request[0]->IsString()) { CObjectString filepath(request[0]); @@ -898,7 +845,6 @@ CObject* File::LastAccessedRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::SetLastAccessedRequest(const CObjectArray& request) { if ((request.Length() == 2) && request[0]->IsString() && request[1]->IsInt32OrInt64()) { @@ -913,7 +859,6 @@ CObject* File::SetLastAccessedRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::LastModifiedRequest(const CObjectArray& request) { if ((request.Length() == 1) && request[0]->IsString()) { CObjectString filepath(request[0]); @@ -928,7 +873,6 @@ CObject* File::LastModifiedRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::SetLastModifiedRequest(const CObjectArray& request) { if ((request.Length() == 2) && request[0]->IsString() && request[1]->IsInt32OrInt64()) { @@ -943,7 +887,6 @@ CObject* File::SetLastModifiedRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::FlushRequest(const CObjectArray& request) { if ((request.Length() == 1) && request[0]->IsIntptr()) { File* file = CObjectToFilePointer(request[0]); @@ -961,7 +904,6 @@ CObject* File::FlushRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::ReadByteRequest(const CObjectArray& request) { if ((request.Length() == 1) && request[0]->IsIntptr()) { File* file = CObjectToFilePointer(request[0]); @@ -983,7 +925,6 @@ CObject* File::ReadByteRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::WriteByteRequest(const CObjectArray& request) { if ((request.Length() >= 1) && request[0]->IsIntptr()) { File* file = CObjectToFilePointer(request[0]); @@ -1008,7 +949,6 @@ CObject* File::WriteByteRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::ReadRequest(const CObjectArray& request) { if ((request.Length() >= 1) && request[0]->IsIntptr()) { File* file = CObjectToFilePointer(request[0]); @@ -1042,7 +982,6 @@ CObject* File::ReadRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::ReadIntoRequest(const CObjectArray& request) { if ((request.Length() >= 1) && request[0]->IsIntptr()) { File* file = CObjectToFilePointer(request[0]); @@ -1077,7 +1016,6 @@ CObject* File::ReadIntoRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - static int SizeInBytes(Dart_TypedData_Type type) { switch (type) { case Dart_TypedData_kInt8: @@ -1102,7 +1040,6 @@ static int SizeInBytes(Dart_TypedData_Type type) { return -1; } - CObject* File::WriteFromRequest(const CObjectArray& request) { if ((request.Length() >= 1) && request[0]->IsIntptr()) { File* file = CObjectToFilePointer(request[0]); @@ -1151,7 +1088,6 @@ CObject* File::WriteFromRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::CreateLinkRequest(const CObjectArray& request) { if ((request.Length() != 2) || !request[0]->IsString() || !request[1]->IsString()) { @@ -1166,7 +1102,6 @@ CObject* File::CreateLinkRequest(const CObjectArray& request) { } } - CObject* File::DeleteLinkRequest(const CObjectArray& request) { if ((request.Length() == 1) && request[0]->IsString()) { CObjectString link_path(request[0]); @@ -1180,7 +1115,6 @@ CObject* File::DeleteLinkRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::RenameLinkRequest(const CObjectArray& request) { if ((request.Length() == 2) && request[0]->IsString() && request[1]->IsString()) { @@ -1195,7 +1129,6 @@ CObject* File::RenameLinkRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::LinkTargetRequest(const CObjectArray& request) { if ((request.Length() == 1) && request[0]->IsString()) { CObjectString link_path(request[0]); @@ -1210,7 +1143,6 @@ CObject* File::LinkTargetRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::TypeRequest(const CObjectArray& request) { if ((request.Length() == 2) && request[0]->IsString() && request[1]->IsBool()) { @@ -1222,7 +1154,6 @@ CObject* File::TypeRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::IdenticalRequest(const CObjectArray& request) { if ((request.Length() == 2) && request[0]->IsString() && request[1]->IsString()) { @@ -1241,7 +1172,6 @@ CObject* File::IdenticalRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::StatRequest(const CObjectArray& request) { if ((request.Length() == 1) && request[0]->IsString()) { int64_t data[File::kStatSize]; @@ -1262,7 +1192,6 @@ CObject* File::StatRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* File::LockRequest(const CObjectArray& request) { if ((request.Length() >= 1) && request[0]->IsIntptr()) { File* file = CObjectToFilePointer(request[0]); diff --git a/runtime/bin/file_android.cc b/runtime/bin/file_android.cc index a636c3edcaa..139ac7ff6fe 100644 --- a/runtime/bin/file_android.cc +++ b/runtime/bin/file_android.cc @@ -39,7 +39,6 @@ class FileHandle { DISALLOW_COPY_AND_ASSIGN(FileHandle); }; - File::~File() { if (!IsClosed()) { Close(); @@ -47,7 +46,6 @@ File::~File() { delete handle_; } - void File::Close() { ASSERT(handle_->fd() >= 0); if (handle_->fd() == STDOUT_FILENO) { @@ -68,17 +66,14 @@ void File::Close() { handle_->set_fd(kClosedFd); } - intptr_t File::GetFD() { return handle_->fd(); } - bool File::IsClosed() { return handle_->fd() == kClosedFd; } - MappedMemory* File::Map(MapType type, int64_t position, int64_t length) { ASSERT(handle_->fd() >= 0); ASSERT(length > 0); @@ -100,7 +95,6 @@ MappedMemory* File::Map(MapType type, int64_t position, int64_t length) { return new MappedMemory(addr, length); } - void MappedMemory::Unmap() { int result = munmap(address_, size_); ASSERT(result == 0); @@ -108,19 +102,16 @@ void MappedMemory::Unmap() { size_ = 0; } - int64_t File::Read(void* buffer, int64_t num_bytes) { ASSERT(handle_->fd() >= 0); return TEMP_FAILURE_RETRY(read(handle_->fd(), buffer, num_bytes)); } - int64_t File::Write(const void* buffer, int64_t num_bytes) { ASSERT(handle_->fd() >= 0); return TEMP_FAILURE_RETRY(write(handle_->fd(), buffer, num_bytes)); } - bool File::VPrint(const char* format, va_list args) { // Measure. va_list measure_args; @@ -141,31 +132,26 @@ bool File::VPrint(const char* format, va_list args) { return result; } - int64_t File::Position() { ASSERT(handle_->fd() >= 0); return NO_RETRY_EXPECTED(lseek64(handle_->fd(), 0, SEEK_CUR)); } - bool File::SetPosition(int64_t position) { ASSERT(handle_->fd() >= 0); return NO_RETRY_EXPECTED(lseek64(handle_->fd(), position, SEEK_SET)) >= 0; } - bool File::Truncate(int64_t length) { ASSERT(handle_->fd() >= 0); return TEMP_FAILURE_RETRY(ftruncate(handle_->fd(), length) != -1); } - bool File::Flush() { ASSERT(handle_->fd() >= 0); return NO_RETRY_EXPECTED(fsync(handle_->fd()) != -1); } - bool File::Lock(File::LockType lock, int64_t start, int64_t end) { ASSERT(handle_->fd() >= 0); ASSERT((end == -1) || (end > start)); @@ -196,7 +182,6 @@ bool File::Lock(File::LockType lock, int64_t start, int64_t end) { return TEMP_FAILURE_RETRY(fcntl(handle_->fd(), cmd, &fl)) != -1; } - int64_t File::Length() { ASSERT(handle_->fd() >= 0); struct stat st; @@ -206,13 +191,11 @@ int64_t File::Length() { return -1; } - File* File::FileOpenW(const wchar_t* system_name, FileOpenMode mode) { UNREACHABLE(); return NULL; } - File* File::Open(const char* name, FileOpenMode mode) { // Report errors for non-regular files. struct stat st; @@ -249,12 +232,10 @@ File* File::Open(const char* name, FileOpenMode mode) { return new File(new FileHandle(fd)); } - File* File::OpenStdio(int fd) { return ((fd < 0) || (2 < fd)) ? NULL : new File(new FileHandle(fd)); } - bool File::Exists(const char* name) { struct stat st; if (NO_RETRY_EXPECTED(stat(name, &st)) == 0) { @@ -265,7 +246,6 @@ bool File::Exists(const char* name) { } } - bool File::Create(const char* name) { int fd = TEMP_FAILURE_RETRY(open(name, O_RDONLY | O_CREAT | O_CLOEXEC, 0666)); if (fd < 0) { @@ -289,13 +269,11 @@ bool File::Create(const char* name) { return is_file; } - bool File::CreateLink(const char* name, const char* target) { int status = NO_RETRY_EXPECTED(symlink(target, name)); return (status == 0); } - File::Type File::GetType(const char* pathname, bool follow_links) { struct stat entry_info; int stat_success; @@ -319,7 +297,6 @@ File::Type File::GetType(const char* pathname, bool follow_links) { return File::kDoesNotExist; } - static bool CheckTypeAndSetErrno(const char* name, File::Type expected, bool follow_links) { @@ -341,31 +318,26 @@ static bool CheckTypeAndSetErrno(const char* name, return false; } - bool File::Delete(const char* name) { return CheckTypeAndSetErrno(name, kIsFile, true) && (NO_RETRY_EXPECTED(unlink(name)) == 0); } - bool File::DeleteLink(const char* name) { return CheckTypeAndSetErrno(name, kIsLink, false) && (NO_RETRY_EXPECTED(unlink(name)) == 0); } - bool File::Rename(const char* old_path, const char* new_path) { return CheckTypeAndSetErrno(old_path, kIsFile, true) && (NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0); } - bool File::RenameLink(const char* old_path, const char* new_path) { return CheckTypeAndSetErrno(old_path, kIsLink, false) && (NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0); } - bool File::Copy(const char* old_path, const char* new_path) { if (!CheckTypeAndSetErrno(old_path, kIsFile, true)) { return false; @@ -416,7 +388,6 @@ bool File::Copy(const char* old_path, const char* new_path) { return true; } - static bool StatHelper(const char* name, struct stat* st) { if (NO_RETRY_EXPECTED(stat(name, st)) != 0) { return false; @@ -430,7 +401,6 @@ static bool StatHelper(const char* name, struct stat* st) { return true; } - int64_t File::LengthFromPath(const char* name) { struct stat st; if (!StatHelper(name, &st)) { @@ -439,7 +409,6 @@ int64_t File::LengthFromPath(const char* name) { return st.st_size; } - void File::Stat(const char* name, int64_t* data) { struct stat st; if (NO_RETRY_EXPECTED(stat(name, &st)) == 0) { @@ -462,7 +431,6 @@ void File::Stat(const char* name, int64_t* data) { } } - time_t File::LastModified(const char* name) { struct stat st; if (!StatHelper(name, &st)) { @@ -471,7 +439,6 @@ time_t File::LastModified(const char* name) { return st.st_mtime; } - time_t File::LastAccessed(const char* name) { struct stat st; if (!StatHelper(name, &st)) { @@ -480,7 +447,6 @@ time_t File::LastAccessed(const char* name) { return st.st_atime; } - bool File::SetLastAccessed(const char* name, int64_t millis) { // First get the current times. struct stat st; @@ -495,7 +461,6 @@ bool File::SetLastAccessed(const char* name, int64_t millis) { return utime(name, ×) == 0; } - bool File::SetLastModified(const char* name, int64_t millis) { // First get the current times. struct stat st; @@ -510,7 +475,6 @@ bool File::SetLastModified(const char* name, int64_t millis) { return utime(name, ×) == 0; } - const char* File::LinkTarget(const char* pathname) { struct stat link_stats; if (lstat(pathname, &link_stats) != 0) { @@ -531,12 +495,10 @@ const char* File::LinkTarget(const char* pathname) { return target_name; } - bool File::IsAbsolutePath(const char* pathname) { return ((pathname != NULL) && (pathname[0] == '/')); } - const char* File::GetCanonicalPath(const char* pathname) { char* abs_path = NULL; if (pathname != NULL) { @@ -551,17 +513,14 @@ const char* File::GetCanonicalPath(const char* pathname) { return abs_path; } - const char* File::PathSeparator() { return "/"; } - const char* File::StringEscapedPathSeparator() { return "/"; } - File::StdioHandleType File::GetStdioHandleType(int fd) { ASSERT((0 <= fd) && (fd <= 2)); struct stat buf; @@ -584,7 +543,6 @@ File::StdioHandleType File::GetStdioHandleType(int fd) { return kOther; } - File::Identical File::AreIdentical(const char* file_1, const char* file_2) { struct stat file_1_info; struct stat file_2_info; diff --git a/runtime/bin/file_fuchsia.cc b/runtime/bin/file_fuchsia.cc index ad5cb45d674..cc36ea9f7da 100644 --- a/runtime/bin/file_fuchsia.cc +++ b/runtime/bin/file_fuchsia.cc @@ -38,7 +38,6 @@ class FileHandle { DISALLOW_COPY_AND_ASSIGN(FileHandle); }; - File::~File() { if (!IsClosed()) { Close(); @@ -46,7 +45,6 @@ File::~File() { delete handle_; } - void File::Close() { ASSERT(handle_->fd() >= 0); if (handle_->fd() == STDOUT_FILENO) { @@ -66,40 +64,33 @@ void File::Close() { handle_->set_fd(kClosedFd); } - intptr_t File::GetFD() { return handle_->fd(); } - bool File::IsClosed() { return handle_->fd() == kClosedFd; } - MappedMemory* File::Map(MapType type, int64_t position, int64_t length) { UNIMPLEMENTED(); return NULL; } - void MappedMemory::Unmap() { UNIMPLEMENTED(); } - int64_t File::Read(void* buffer, int64_t num_bytes) { ASSERT(handle_->fd() >= 0); return NO_RETRY_EXPECTED(read(handle_->fd(), buffer, num_bytes)); } - int64_t File::Write(const void* buffer, int64_t num_bytes) { ASSERT(handle_->fd() >= 0); return NO_RETRY_EXPECTED(write(handle_->fd(), buffer, num_bytes)); } - bool File::VPrint(const char* format, va_list args) { // Measure. va_list measure_args; @@ -120,31 +111,26 @@ bool File::VPrint(const char* format, va_list args) { return result; } - int64_t File::Position() { ASSERT(handle_->fd() >= 0); return NO_RETRY_EXPECTED(lseek(handle_->fd(), 0, SEEK_CUR)); } - bool File::SetPosition(int64_t position) { ASSERT(handle_->fd() >= 0); return NO_RETRY_EXPECTED(lseek(handle_->fd(), position, SEEK_SET)) >= 0; } - bool File::Truncate(int64_t length) { ASSERT(handle_->fd() >= 0); return NO_RETRY_EXPECTED(ftruncate(handle_->fd(), length) != -1); } - bool File::Flush() { ASSERT(handle_->fd() >= 0); return NO_RETRY_EXPECTED(fsync(handle_->fd())) != -1; } - bool File::Lock(File::LockType lock, int64_t start, int64_t end) { ASSERT(handle_->fd() >= 0); ASSERT((end == -1) || (end > start)); @@ -175,7 +161,6 @@ bool File::Lock(File::LockType lock, int64_t start, int64_t end) { return NO_RETRY_EXPECTED(fcntl(handle_->fd(), cmd, &fl)) != -1; } - int64_t File::Length() { ASSERT(handle_->fd() >= 0); struct stat st; @@ -185,13 +170,11 @@ int64_t File::Length() { return -1; } - File* File::FileOpenW(const wchar_t* system_name, FileOpenMode mode) { UNREACHABLE(); return NULL; } - File* File::Open(const char* name, FileOpenMode mode) { // Report errors for non-regular files. struct stat st; @@ -228,12 +211,10 @@ File* File::Open(const char* name, FileOpenMode mode) { return new File(new FileHandle(fd)); } - File* File::OpenStdio(int fd) { return ((fd < 0) || (2 < fd)) ? NULL : new File(new FileHandle(fd)); } - bool File::Exists(const char* name) { struct stat64 st; if (NO_RETRY_EXPECTED(stat64(name, &st)) == 0) { @@ -244,7 +225,6 @@ bool File::Exists(const char* name) { } } - bool File::Create(const char* name) { int fd = NO_RETRY_EXPECTED(open64(name, O_RDONLY | O_CREAT | O_CLOEXEC, 0666)); @@ -269,12 +249,10 @@ bool File::Create(const char* name) { return is_file; } - bool File::CreateLink(const char* name, const char* target) { return NO_RETRY_EXPECTED(symlink(target, name)) == 0; } - File::Type File::GetType(const char* pathname, bool follow_links) { struct stat entry_info; int stat_success; @@ -298,7 +276,6 @@ File::Type File::GetType(const char* pathname, bool follow_links) { return File::kDoesNotExist; } - static bool CheckTypeAndSetErrno(const char* name, File::Type expected, bool follow_links) { @@ -320,31 +297,26 @@ static bool CheckTypeAndSetErrno(const char* name, return false; } - bool File::Delete(const char* name) { return CheckTypeAndSetErrno(name, kIsFile, true) && (NO_RETRY_EXPECTED(unlink(name)) == 0); } - bool File::DeleteLink(const char* name) { return CheckTypeAndSetErrno(name, kIsLink, false) && (NO_RETRY_EXPECTED(unlink(name)) == 0); } - bool File::Rename(const char* old_path, const char* new_path) { return CheckTypeAndSetErrno(old_path, kIsFile, true) && (NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0); } - bool File::RenameLink(const char* old_path, const char* new_path) { return CheckTypeAndSetErrno(old_path, kIsLink, false) && (NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0); } - bool File::Copy(const char* old_path, const char* new_path) { if (!CheckTypeAndSetErrno(old_path, kIsFile, true)) { return false; @@ -385,7 +357,6 @@ bool File::Copy(const char* old_path, const char* new_path) { return true; } - static bool StatHelper(const char* name, struct stat64* st) { if (NO_RETRY_EXPECTED(stat64(name, st)) != 0) { return false; @@ -399,7 +370,6 @@ static bool StatHelper(const char* name, struct stat64* st) { return true; } - int64_t File::LengthFromPath(const char* name) { struct stat64 st; if (!StatHelper(name, &st)) { @@ -408,7 +378,6 @@ int64_t File::LengthFromPath(const char* name) { return st.st_size; } - void File::Stat(const char* name, int64_t* data) { struct stat st; if (NO_RETRY_EXPECTED(stat(name, &st)) == 0) { @@ -431,7 +400,6 @@ void File::Stat(const char* name, int64_t* data) { } } - time_t File::LastModified(const char* name) { struct stat st; if (!StatHelper(name, &st)) { @@ -440,7 +408,6 @@ time_t File::LastModified(const char* name) { return st.st_mtime; } - time_t File::LastAccessed(const char* name) { struct stat st; if (!StatHelper(name, &st)) { @@ -449,7 +416,6 @@ time_t File::LastAccessed(const char* name) { return st.st_atime; } - bool File::SetLastAccessed(const char* name, int64_t millis) { // First get the current times. struct stat st; @@ -464,7 +430,6 @@ bool File::SetLastAccessed(const char* name, int64_t millis) { return utime(name, ×) == 0; } - bool File::SetLastModified(const char* name, int64_t millis) { // First get the current times. struct stat st; @@ -479,7 +444,6 @@ bool File::SetLastModified(const char* name, int64_t millis) { return utime(name, ×) == 0; } - const char* File::LinkTarget(const char* pathname) { struct stat link_stats; if (lstat(pathname, &link_stats) != 0) { @@ -500,12 +464,10 @@ const char* File::LinkTarget(const char* pathname) { return target_name; } - bool File::IsAbsolutePath(const char* pathname) { return ((pathname != NULL) && (pathname[0] == '/')); } - const char* File::GetCanonicalPath(const char* pathname) { char* abs_path = NULL; if (pathname != NULL) { @@ -518,17 +480,14 @@ const char* File::GetCanonicalPath(const char* pathname) { return abs_path; } - const char* File::PathSeparator() { return "/"; } - const char* File::StringEscapedPathSeparator() { return "/"; } - File::StdioHandleType File::GetStdioHandleType(int fd) { ASSERT((0 <= fd) && (fd <= 2)); struct stat buf; @@ -551,7 +510,6 @@ File::StdioHandleType File::GetStdioHandleType(int fd) { return kOther; } - File::Identical File::AreIdentical(const char* file_1, const char* file_2) { struct stat file_1_info; struct stat file_2_info; diff --git a/runtime/bin/file_linux.cc b/runtime/bin/file_linux.cc index ee676573110..7e966ce2640 100644 --- a/runtime/bin/file_linux.cc +++ b/runtime/bin/file_linux.cc @@ -39,7 +39,6 @@ class FileHandle { DISALLOW_COPY_AND_ASSIGN(FileHandle); }; - File::~File() { if (!IsClosed() && handle_->fd() != STDOUT_FILENO && handle_->fd() != STDERR_FILENO) { @@ -48,7 +47,6 @@ File::~File() { delete handle_; } - void File::Close() { ASSERT(handle_->fd() >= 0); if (handle_->fd() == STDOUT_FILENO) { @@ -68,17 +66,14 @@ void File::Close() { handle_->set_fd(kClosedFd); } - intptr_t File::GetFD() { return handle_->fd(); } - bool File::IsClosed() { return handle_->fd() == kClosedFd; } - MappedMemory* File::Map(MapType type, int64_t position, int64_t length) { ASSERT(handle_->fd() >= 0); ASSERT(length > 0); @@ -100,7 +95,6 @@ MappedMemory* File::Map(MapType type, int64_t position, int64_t length) { return new MappedMemory(addr, length); } - void MappedMemory::Unmap() { int result = munmap(address_, size_); ASSERT(result == 0); @@ -108,19 +102,16 @@ void MappedMemory::Unmap() { size_ = 0; } - int64_t File::Read(void* buffer, int64_t num_bytes) { ASSERT(handle_->fd() >= 0); return TEMP_FAILURE_RETRY(read(handle_->fd(), buffer, num_bytes)); } - int64_t File::Write(const void* buffer, int64_t num_bytes) { ASSERT(handle_->fd() >= 0); return TEMP_FAILURE_RETRY(write(handle_->fd(), buffer, num_bytes)); } - bool File::VPrint(const char* format, va_list args) { // Measure. va_list measure_args; @@ -146,25 +137,21 @@ int64_t File::Position() { return NO_RETRY_EXPECTED(lseek64(handle_->fd(), 0, SEEK_CUR)); } - bool File::SetPosition(int64_t position) { ASSERT(handle_->fd() >= 0); return NO_RETRY_EXPECTED(lseek64(handle_->fd(), position, SEEK_SET)) >= 0; } - bool File::Truncate(int64_t length) { ASSERT(handle_->fd() >= 0); return TEMP_FAILURE_RETRY(ftruncate64(handle_->fd(), length) != -1); } - bool File::Flush() { ASSERT(handle_->fd() >= 0); return NO_RETRY_EXPECTED(fsync(handle_->fd())) != -1; } - bool File::Lock(File::LockType lock, int64_t start, int64_t end) { ASSERT(handle_->fd() >= 0); ASSERT((end == -1) || (end > start)); @@ -195,7 +182,6 @@ bool File::Lock(File::LockType lock, int64_t start, int64_t end) { return TEMP_FAILURE_RETRY(fcntl(handle_->fd(), cmd, &fl)) != -1; } - int64_t File::Length() { ASSERT(handle_->fd() >= 0); struct stat64 st; @@ -205,13 +191,11 @@ int64_t File::Length() { return -1; } - File* File::FileOpenW(const wchar_t* system_name, FileOpenMode mode) { UNREACHABLE(); return NULL; } - File* File::Open(const char* name, FileOpenMode mode) { // Report errors for non-regular files. struct stat64 st; @@ -249,12 +233,10 @@ File* File::Open(const char* name, FileOpenMode mode) { return new File(new FileHandle(fd)); } - File* File::OpenStdio(int fd) { return ((fd < 0) || (2 < fd)) ? NULL : new File(new FileHandle(fd)); } - bool File::Exists(const char* name) { struct stat64 st; if (TEMP_FAILURE_RETRY(stat64(name, &st)) == 0) { @@ -265,7 +247,6 @@ bool File::Exists(const char* name) { } } - bool File::Create(const char* name) { int fd = TEMP_FAILURE_RETRY(open64(name, O_RDONLY | O_CREAT | O_CLOEXEC, 0666)); @@ -290,12 +271,10 @@ bool File::Create(const char* name) { return is_file; } - bool File::CreateLink(const char* name, const char* target) { return NO_RETRY_EXPECTED(symlink(target, name)) == 0; } - File::Type File::GetType(const char* pathname, bool follow_links) { struct stat64 entry_info; int stat_success; @@ -319,7 +298,6 @@ File::Type File::GetType(const char* pathname, bool follow_links) { return File::kDoesNotExist; } - static bool CheckTypeAndSetErrno(const char* name, File::Type expected, bool follow_links) { @@ -341,31 +319,26 @@ static bool CheckTypeAndSetErrno(const char* name, return false; } - bool File::Delete(const char* name) { return CheckTypeAndSetErrno(name, kIsFile, true) && (NO_RETRY_EXPECTED(unlink(name)) == 0); } - bool File::DeleteLink(const char* name) { return CheckTypeAndSetErrno(name, kIsLink, false) && (NO_RETRY_EXPECTED(unlink(name)) == 0); } - bool File::Rename(const char* old_path, const char* new_path) { return CheckTypeAndSetErrno(old_path, kIsFile, true) && (NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0); } - bool File::RenameLink(const char* old_path, const char* new_path) { return CheckTypeAndSetErrno(old_path, kIsLink, false) && (NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0); } - bool File::Copy(const char* old_path, const char* new_path) { if (!CheckTypeAndSetErrno(old_path, kIsFile, true)) { return false; @@ -416,7 +389,6 @@ bool File::Copy(const char* old_path, const char* new_path) { return true; } - static bool StatHelper(const char* name, struct stat64* st) { if (TEMP_FAILURE_RETRY(stat64(name, st)) != 0) { return false; @@ -430,7 +402,6 @@ static bool StatHelper(const char* name, struct stat64* st) { return true; } - int64_t File::LengthFromPath(const char* name) { struct stat64 st; if (!StatHelper(name, &st)) { @@ -439,13 +410,11 @@ int64_t File::LengthFromPath(const char* name) { return st.st_size; } - static int64_t TimespecToMilliseconds(const struct timespec& t) { return static_cast(t.tv_sec) * 1000L + static_cast(t.tv_nsec) / 1000000L; } - void File::Stat(const char* name, int64_t* data) { struct stat64 st; if (TEMP_FAILURE_RETRY(stat64(name, &st)) == 0) { @@ -468,7 +437,6 @@ void File::Stat(const char* name, int64_t* data) { } } - time_t File::LastModified(const char* name) { struct stat64 st; if (!StatHelper(name, &st)) { @@ -477,7 +445,6 @@ time_t File::LastModified(const char* name) { return st.st_mtime; } - time_t File::LastAccessed(const char* name) { struct stat64 st; if (!StatHelper(name, &st)) { @@ -486,7 +453,6 @@ time_t File::LastAccessed(const char* name) { return st.st_atime; } - bool File::SetLastAccessed(const char* name, int64_t millis) { // First get the current times. struct stat64 st; @@ -501,7 +467,6 @@ bool File::SetLastAccessed(const char* name, int64_t millis) { return utime(name, ×) == 0; } - bool File::SetLastModified(const char* name, int64_t millis) { // First get the current times. struct stat64 st; @@ -516,7 +481,6 @@ bool File::SetLastModified(const char* name, int64_t millis) { return utime(name, ×) == 0; } - const char* File::LinkTarget(const char* pathname) { struct stat64 link_stats; if (TEMP_FAILURE_RETRY(lstat64(pathname, &link_stats)) != 0) { @@ -543,12 +507,10 @@ const char* File::LinkTarget(const char* pathname) { return target_name; } - bool File::IsAbsolutePath(const char* pathname) { return (pathname != NULL && pathname[0] == '/'); } - const char* File::GetCanonicalPath(const char* pathname) { char* abs_path = NULL; if (pathname != NULL) { @@ -563,17 +525,14 @@ const char* File::GetCanonicalPath(const char* pathname) { return abs_path; } - const char* File::PathSeparator() { return "/"; } - const char* File::StringEscapedPathSeparator() { return "/"; } - File::StdioHandleType File::GetStdioHandleType(int fd) { ASSERT((0 <= fd) && (fd <= 2)); struct stat64 buf; @@ -596,7 +555,6 @@ File::StdioHandleType File::GetStdioHandleType(int fd) { return kOther; } - File::Identical File::AreIdentical(const char* file_1, const char* file_2) { struct stat64 file_1_info; struct stat64 file_2_info; diff --git a/runtime/bin/file_macos.cc b/runtime/bin/file_macos.cc index c2015126e22..1b53cb2c1cf 100644 --- a/runtime/bin/file_macos.cc +++ b/runtime/bin/file_macos.cc @@ -40,7 +40,6 @@ class FileHandle { DISALLOW_COPY_AND_ASSIGN(FileHandle); }; - File::~File() { if (!IsClosed() && handle_->fd() != STDOUT_FILENO && handle_->fd() != STDERR_FILENO) { @@ -49,7 +48,6 @@ File::~File() { delete handle_; } - void File::Close() { ASSERT(handle_->fd() >= 0); if (handle_->fd() == STDOUT_FILENO) { @@ -70,17 +68,14 @@ void File::Close() { handle_->set_fd(kClosedFd); } - intptr_t File::GetFD() { return handle_->fd(); } - bool File::IsClosed() { return handle_->fd() == kClosedFd; } - MappedMemory* File::Map(MapType type, int64_t position, int64_t length) { ASSERT(handle_->fd() >= 0); ASSERT(length > 0); @@ -102,7 +97,6 @@ MappedMemory* File::Map(MapType type, int64_t position, int64_t length) { return new MappedMemory(addr, length); } - void MappedMemory::Unmap() { int result = munmap(address_, size_); ASSERT(result == 0); @@ -110,19 +104,16 @@ void MappedMemory::Unmap() { size_ = 0; } - int64_t File::Read(void* buffer, int64_t num_bytes) { ASSERT(handle_->fd() >= 0); return TEMP_FAILURE_RETRY(read(handle_->fd(), buffer, num_bytes)); } - int64_t File::Write(const void* buffer, int64_t num_bytes) { ASSERT(handle_->fd() >= 0); return TEMP_FAILURE_RETRY(write(handle_->fd(), buffer, num_bytes)); } - bool File::VPrint(const char* format, va_list args) { // Measure. va_list measure_args; @@ -148,25 +139,21 @@ int64_t File::Position() { return lseek(handle_->fd(), 0, SEEK_CUR); } - bool File::SetPosition(int64_t position) { ASSERT(handle_->fd() >= 0); return lseek(handle_->fd(), position, SEEK_SET) >= 0; } - bool File::Truncate(int64_t length) { ASSERT(handle_->fd() >= 0); return TEMP_FAILURE_RETRY(ftruncate(handle_->fd(), length)) != -1; } - bool File::Flush() { ASSERT(handle_->fd() >= 0); return NO_RETRY_EXPECTED(fsync(handle_->fd())) != -1; } - bool File::Lock(File::LockType lock, int64_t start, int64_t end) { ASSERT(handle_->fd() >= 0); ASSERT((end == -1) || (end > start)); @@ -197,7 +184,6 @@ bool File::Lock(File::LockType lock, int64_t start, int64_t end) { return TEMP_FAILURE_RETRY(fcntl(handle_->fd(), cmd, &fl)) != -1; } - int64_t File::Length() { ASSERT(handle_->fd() >= 0); struct stat st; @@ -207,13 +193,11 @@ int64_t File::Length() { return -1; } - File* File::FileOpenW(const wchar_t* system_name, FileOpenMode mode) { UNREACHABLE(); return NULL; } - File* File::Open(const char* name, FileOpenMode mode) { // Report errors for non-regular files. struct stat st; @@ -251,12 +235,10 @@ File* File::Open(const char* name, FileOpenMode mode) { return new File(new FileHandle(fd)); } - File* File::OpenStdio(int fd) { return ((fd < 0) || (2 < fd)) ? NULL : new File(new FileHandle(fd)); } - bool File::Exists(const char* name) { struct stat st; if (NO_RETRY_EXPECTED(stat(name, &st)) == 0) { @@ -267,7 +249,6 @@ bool File::Exists(const char* name) { } } - bool File::Create(const char* name) { int fd = TEMP_FAILURE_RETRY(open(name, O_RDONLY | O_CREAT, 0666)); if (fd < 0) { @@ -291,13 +272,11 @@ bool File::Create(const char* name) { return is_file; } - bool File::CreateLink(const char* name, const char* target) { int status = NO_RETRY_EXPECTED(symlink(target, name)); return (status == 0); } - File::Type File::GetType(const char* pathname, bool follow_links) { struct stat entry_info; int stat_success; @@ -321,7 +300,6 @@ File::Type File::GetType(const char* pathname, bool follow_links) { return File::kDoesNotExist; } - static bool CheckTypeAndSetErrno(const char* name, File::Type expected, bool follow_links) { @@ -343,37 +321,31 @@ static bool CheckTypeAndSetErrno(const char* name, return false; } - bool File::Delete(const char* name) { return CheckTypeAndSetErrno(name, kIsFile, true) && (NO_RETRY_EXPECTED(unlink(name)) == 0); } - bool File::DeleteLink(const char* name) { return CheckTypeAndSetErrno(name, kIsLink, false) && (NO_RETRY_EXPECTED(unlink(name)) == 0); } - bool File::Rename(const char* old_path, const char* new_path) { return CheckTypeAndSetErrno(old_path, kIsFile, true) && (NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0); } - bool File::RenameLink(const char* old_path, const char* new_path) { return CheckTypeAndSetErrno(old_path, kIsLink, false) && (NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0); } - bool File::Copy(const char* old_path, const char* new_path) { return CheckTypeAndSetErrno(old_path, kIsFile, true) && (copyfile(old_path, new_path, NULL, COPYFILE_ALL) == 0); } - static bool StatHelper(const char* name, struct stat* st) { if (NO_RETRY_EXPECTED(stat(name, st)) != 0) { return false; @@ -387,7 +359,6 @@ static bool StatHelper(const char* name, struct stat* st) { return true; } - int64_t File::LengthFromPath(const char* name) { struct stat st; if (!StatHelper(name, &st)) { @@ -396,13 +367,11 @@ int64_t File::LengthFromPath(const char* name) { return st.st_size; } - static int64_t TimespecToMilliseconds(const struct timespec& t) { return static_cast(t.tv_sec) * 1000L + static_cast(t.tv_nsec) / 1000000L; } - void File::Stat(const char* name, int64_t* data) { struct stat st; if (NO_RETRY_EXPECTED(stat(name, &st)) == 0) { @@ -428,7 +397,6 @@ void File::Stat(const char* name, int64_t* data) { } } - time_t File::LastModified(const char* name) { struct stat st; if (!StatHelper(name, &st)) { @@ -437,7 +405,6 @@ time_t File::LastModified(const char* name) { return st.st_mtime; } - time_t File::LastAccessed(const char* name) { struct stat st; if (!StatHelper(name, &st)) { @@ -446,7 +413,6 @@ time_t File::LastAccessed(const char* name) { return st.st_atime; } - bool File::SetLastAccessed(const char* name, int64_t millis) { // First get the current times. struct stat st; @@ -461,7 +427,6 @@ bool File::SetLastAccessed(const char* name, int64_t millis) { return utime(name, ×) == 0; } - bool File::SetLastModified(const char* name, int64_t millis) { // First get the current times. struct stat st; @@ -476,7 +441,6 @@ bool File::SetLastModified(const char* name, int64_t millis) { return utime(name, ×) == 0; } - const char* File::LinkTarget(const char* pathname) { struct stat link_stats; if (lstat(pathname, &link_stats) != 0) { @@ -502,12 +466,10 @@ const char* File::LinkTarget(const char* pathname) { return target_name; } - bool File::IsAbsolutePath(const char* pathname) { return (pathname != NULL && pathname[0] == '/'); } - const char* File::GetCanonicalPath(const char* pathname) { char* abs_path = NULL; if (pathname != NULL) { @@ -525,17 +487,14 @@ const char* File::GetCanonicalPath(const char* pathname) { return abs_path; } - const char* File::PathSeparator() { return "/"; } - const char* File::StringEscapedPathSeparator() { return "/"; } - File::StdioHandleType File::GetStdioHandleType(int fd) { ASSERT((0 <= fd) && (fd <= 2)); struct stat buf; @@ -558,7 +517,6 @@ File::StdioHandleType File::GetStdioHandleType(int fd) { return kOther; } - File::Identical File::AreIdentical(const char* file_1, const char* file_2) { struct stat file_1_info; struct stat file_2_info; diff --git a/runtime/bin/file_support.cc b/runtime/bin/file_support.cc index 41de7026057..fe66cd9b4d2 100644 --- a/runtime/bin/file_support.cc +++ b/runtime/bin/file_support.cc @@ -26,22 +26,18 @@ void SetCaptureStdout(bool value) { capture_stdout = value; } - void SetCaptureStderr(bool value) { capture_stderr = value; } - bool ShouldCaptureStdout() { return capture_stdout; } - bool ShouldCaptureStderr() { return capture_stderr; } - bool File::ReadFully(void* buffer, int64_t num_bytes) { int64_t remaining = num_bytes; char* current_buffer = reinterpret_cast(buffer); @@ -56,7 +52,6 @@ bool File::ReadFully(void* buffer, int64_t num_bytes) { return true; } - bool File::WriteFully(const void* buffer, int64_t num_bytes) { int64_t remaining = num_bytes; const char* current_buffer = reinterpret_cast(buffer); @@ -83,7 +78,6 @@ bool File::WriteFully(const void* buffer, int64_t num_bytes) { return true; } - File::FileOpenMode File::DartModeToFileMode(DartFileOpenMode mode) { ASSERT((mode == File::kDartRead) || (mode == File::kDartWrite) || (mode == File::kDartAppend) || (mode == File::kDartWriteOnly) || diff --git a/runtime/bin/file_system_watcher.cc b/runtime/bin/file_system_watcher.cc index 317f59f2d76..96643614601 100644 --- a/runtime/bin/file_system_watcher.cc +++ b/runtime/bin/file_system_watcher.cc @@ -19,7 +19,6 @@ void FUNCTION_NAME(FileSystemWatcher_IsSupported)(Dart_NativeArguments args) { Dart_SetReturnValue(args, Dart_NewBoolean(FileSystemWatcher::IsSupported())); } - void FUNCTION_NAME(FileSystemWatcher_InitWatcher)(Dart_NativeArguments args) { intptr_t id = FileSystemWatcher::Init(); if (id >= 0) { @@ -30,13 +29,11 @@ void FUNCTION_NAME(FileSystemWatcher_InitWatcher)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(FileSystemWatcher_CloseWatcher)(Dart_NativeArguments args) { intptr_t id = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 0)); FileSystemWatcher::Close(id); } - void FUNCTION_NAME(FileSystemWatcher_WatchPath)(Dart_NativeArguments args) { intptr_t id = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 0)); const char* path = DartUtils::GetStringValue(Dart_GetNativeArgument(args, 1)); @@ -49,14 +46,12 @@ void FUNCTION_NAME(FileSystemWatcher_WatchPath)(Dart_NativeArguments args) { Dart_SetReturnValue(args, Dart_NewInteger(path_id)); } - void FUNCTION_NAME(FileSystemWatcher_UnwatchPath)(Dart_NativeArguments args) { intptr_t id = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 0)); intptr_t path_id = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1)); FileSystemWatcher::UnwatchPath(id, path_id); } - void FUNCTION_NAME(FileSystemWatcher_ReadEvents)(Dart_NativeArguments args) { intptr_t id = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 0)); intptr_t path_id = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1)); @@ -65,7 +60,6 @@ void FUNCTION_NAME(FileSystemWatcher_ReadEvents)(Dart_NativeArguments args) { Dart_SetReturnValue(args, handle); } - void FUNCTION_NAME(FileSystemWatcher_GetSocketId)(Dart_NativeArguments args) { intptr_t id = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 0)); intptr_t path_id = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1)); diff --git a/runtime/bin/file_system_watcher_android.cc b/runtime/bin/file_system_watcher_android.cc index abece4c0a75..561c0d42e86 100644 --- a/runtime/bin/file_system_watcher_android.cc +++ b/runtime/bin/file_system_watcher_android.cc @@ -22,7 +22,6 @@ bool FileSystemWatcher::IsSupported() { return true; } - intptr_t FileSystemWatcher::Init() { int id = NO_RETRY_EXPECTED(inotify_init()); if (id < 0 || !FDUtils::SetCloseOnExec(id)) { @@ -35,12 +34,10 @@ intptr_t FileSystemWatcher::Init() { return id; } - void FileSystemWatcher::Close(intptr_t id) { USE(id); } - intptr_t FileSystemWatcher::WatchPath(intptr_t id, const char* path, int events, @@ -65,18 +62,15 @@ intptr_t FileSystemWatcher::WatchPath(intptr_t id, return path_id; } - void FileSystemWatcher::UnwatchPath(intptr_t id, intptr_t path_id) { VOID_NO_RETRY_EXPECTED(inotify_rm_watch(id, path_id)); } - intptr_t FileSystemWatcher::GetSocketId(intptr_t id, intptr_t path_id) { USE(path_id); return id; } - static int InotifyEventToMask(struct inotify_event* e) { int mask = 0; if ((e->mask & IN_CLOSE_WRITE) != 0) { @@ -103,7 +97,6 @@ static int InotifyEventToMask(struct inotify_event* e) { return mask; } - Dart_Handle FileSystemWatcher::ReadEvents(intptr_t id, intptr_t path_id) { USE(path_id); const intptr_t kEventSize = sizeof(struct inotify_event); @@ -126,9 +119,10 @@ Dart_Handle FileSystemWatcher::ReadEvents(intptr_t id, intptr_t path_id) { Dart_ListSetAt(event, 0, Dart_NewInteger(mask)); Dart_ListSetAt(event, 1, Dart_NewInteger(e->cookie)); if (e->len > 0) { - Dart_ListSetAt(event, 2, Dart_NewStringFromUTF8( - reinterpret_cast(e->name), - strlen(e->name))); + Dart_ListSetAt( + event, 2, + Dart_NewStringFromUTF8(reinterpret_cast(e->name), + strlen(e->name))); } else { Dart_ListSetAt(event, 2, Dart_Null()); } diff --git a/runtime/bin/file_system_watcher_fuchsia.cc b/runtime/bin/file_system_watcher_fuchsia.cc index 3b4fdf329fa..67ddfc85410 100644 --- a/runtime/bin/file_system_watcher_fuchsia.cc +++ b/runtime/bin/file_system_watcher_fuchsia.cc @@ -17,33 +17,27 @@ Dart_Handle FileSystemWatcher::ReadEvents(intptr_t id, intptr_t path_id) { return DartUtils::NewDartOSError(); } - intptr_t FileSystemWatcher::GetSocketId(intptr_t id, intptr_t path_id) { UNIMPLEMENTED(); return -1; } - bool FileSystemWatcher::IsSupported() { return false; } - void FileSystemWatcher::UnwatchPath(intptr_t id, intptr_t path_id) { UNIMPLEMENTED(); } - intptr_t FileSystemWatcher::Init() { return 0; } - void FileSystemWatcher::Close(intptr_t id) { UNIMPLEMENTED(); } - intptr_t FileSystemWatcher::WatchPath(intptr_t id, const char* path, int events, diff --git a/runtime/bin/file_system_watcher_linux.cc b/runtime/bin/file_system_watcher_linux.cc index bfdc941d044..cc1d43fd8e9 100644 --- a/runtime/bin/file_system_watcher_linux.cc +++ b/runtime/bin/file_system_watcher_linux.cc @@ -23,7 +23,6 @@ bool FileSystemWatcher::IsSupported() { return true; } - intptr_t FileSystemWatcher::Init() { int id = NO_RETRY_EXPECTED(inotify_init1(IN_CLOEXEC)); if (id < 0) { @@ -36,12 +35,10 @@ intptr_t FileSystemWatcher::Init() { return id; } - void FileSystemWatcher::Close(intptr_t id) { USE(id); } - intptr_t FileSystemWatcher::WatchPath(intptr_t id, const char* path, int events, @@ -66,18 +63,15 @@ intptr_t FileSystemWatcher::WatchPath(intptr_t id, return path_id; } - void FileSystemWatcher::UnwatchPath(intptr_t id, intptr_t path_id) { VOID_NO_RETRY_EXPECTED(inotify_rm_watch(id, path_id)); } - intptr_t FileSystemWatcher::GetSocketId(intptr_t id, intptr_t path_id) { USE(path_id); return id; } - static int InotifyEventToMask(struct inotify_event* e) { int mask = 0; if ((e->mask & IN_CLOSE_WRITE) != 0) { @@ -104,7 +98,6 @@ static int InotifyEventToMask(struct inotify_event* e) { return mask; } - Dart_Handle FileSystemWatcher::ReadEvents(intptr_t id, intptr_t path_id) { USE(path_id); const intptr_t kEventSize = sizeof(struct inotify_event); @@ -128,9 +121,10 @@ Dart_Handle FileSystemWatcher::ReadEvents(intptr_t id, intptr_t path_id) { Dart_ListSetAt(event, 0, Dart_NewInteger(mask)); Dart_ListSetAt(event, 1, Dart_NewInteger(e->cookie)); if (e->len > 0) { - Dart_ListSetAt(event, 2, Dart_NewStringFromUTF8( - reinterpret_cast(e->name), - strlen(e->name))); + Dart_ListSetAt( + event, 2, + Dart_NewStringFromUTF8(reinterpret_cast(e->name), + strlen(e->name))); } else { Dart_ListSetAt(event, 2, Dart_Null()); } diff --git a/runtime/bin/file_system_watcher_macos.cc b/runtime/bin/file_system_watcher_macos.cc index f9da101c095..bb524c0797e 100644 --- a/runtime/bin/file_system_watcher_macos.cc +++ b/runtime/bin/file_system_watcher_macos.cc @@ -11,10 +11,10 @@ #if !HOST_OS_IOS +#include // NOLINT #include // NOLINT #include // NOLINT #include // NOLINT -#include // NOLINT #include "bin/eventhandler.h" #include "bin/fdutils.h" @@ -52,7 +52,6 @@ union FSEvent { uint8_t bytes[PATH_MAX + 8]; }; - class FSEventsWatcher { public: class Node { @@ -177,7 +176,6 @@ class FSEventsWatcher { DISALLOW_COPY_AND_ASSIGN(Node); }; - FSEventsWatcher() : run_loop_(0) { Start(); } void Start() { @@ -299,23 +297,19 @@ class FSEventsWatcher { DISALLOW_COPY_AND_ASSIGN(FSEventsWatcher); }; - #define kCFCoreFoundationVersionNumber10_7 635.00 bool FileSystemWatcher::IsSupported() { return kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_7; } - intptr_t FileSystemWatcher::Init() { return reinterpret_cast(new FSEventsWatcher()); } - void FileSystemWatcher::Close(intptr_t id) { delete reinterpret_cast(id); } - intptr_t FileSystemWatcher::WatchPath(intptr_t id, const char* path, int events, @@ -324,18 +318,15 @@ intptr_t FileSystemWatcher::WatchPath(intptr_t id, return reinterpret_cast(watcher->AddPath(path, events, recursive)); } - void FileSystemWatcher::UnwatchPath(intptr_t id, intptr_t path_id) { USE(id); delete reinterpret_cast(path_id); } - intptr_t FileSystemWatcher::GetSocketId(intptr_t id, intptr_t path_id) { return reinterpret_cast(path_id)->read_fd(); } - Dart_Handle FileSystemWatcher::ReadEvents(intptr_t id, intptr_t path_id) { intptr_t fd = GetSocketId(id, path_id); intptr_t avail = FDUtils::AvailableBytes(fd); @@ -407,28 +398,22 @@ Dart_Handle FileSystemWatcher::ReadEvents(intptr_t id, intptr_t path_id) { return DartUtils::NewDartOSError(); } - intptr_t FileSystemWatcher::GetSocketId(intptr_t id, intptr_t path_id) { return -1; } - bool FileSystemWatcher::IsSupported() { return false; } - void FileSystemWatcher::UnwatchPath(intptr_t id, intptr_t path_id) {} - intptr_t FileSystemWatcher::Init() { return -1; } - void FileSystemWatcher::Close(intptr_t id) {} - intptr_t FileSystemWatcher::WatchPath(intptr_t id, const char* path, int events, diff --git a/runtime/bin/file_system_watcher_unsupported.cc b/runtime/bin/file_system_watcher_unsupported.cc index 82c6c70054f..e14b9710c8d 100644 --- a/runtime/bin/file_system_watcher_unsupported.cc +++ b/runtime/bin/file_system_watcher_unsupported.cc @@ -16,37 +16,31 @@ void FUNCTION_NAME(FileSystemWatcher_IsSupported)(Dart_NativeArguments args) { "FileSystemWatcher is not supported on this platform")); } - void FUNCTION_NAME(FileSystemWatcher_InitWatcher)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "FileSystemWatcher is not supported on this platform")); } - void FUNCTION_NAME(FileSystemWatcher_CloseWatcher)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "FileSystemWatcher is not supported on this platform")); } - void FUNCTION_NAME(FileSystemWatcher_WatchPath)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "FileSystemWatcher is not supported on this platform")); } - void FUNCTION_NAME(FileSystemWatcher_UnwatchPath)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "FileSystemWatcher is not supported on this platform")); } - void FUNCTION_NAME(FileSystemWatcher_ReadEvents)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "FileSystemWatcher is not supported on this platform")); } - void FUNCTION_NAME(FileSystemWatcher_GetSocketId)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "FileSystemWatcher is not supported on this platform")); diff --git a/runtime/bin/file_system_watcher_win.cc b/runtime/bin/file_system_watcher_win.cc index ebbb207808c..dad55c60e7a 100644 --- a/runtime/bin/file_system_watcher_win.cc +++ b/runtime/bin/file_system_watcher_win.cc @@ -24,17 +24,14 @@ bool FileSystemWatcher::IsSupported() { return true; } - intptr_t FileSystemWatcher::Init() { return 0; } - void FileSystemWatcher::Close(intptr_t id) { USE(id); } - intptr_t FileSystemWatcher::WatchPath(intptr_t id, const char* path, int events, @@ -67,7 +64,6 @@ intptr_t FileSystemWatcher::WatchPath(intptr_t id, return reinterpret_cast(handle); } - void FileSystemWatcher::UnwatchPath(intptr_t id, intptr_t path_id) { USE(id); DirectoryWatchHandle* handle = @@ -75,13 +71,11 @@ void FileSystemWatcher::UnwatchPath(intptr_t id, intptr_t path_id) { handle->Stop(); } - intptr_t FileSystemWatcher::GetSocketId(intptr_t id, intptr_t path_id) { USE(id); return path_id; } - Dart_Handle FileSystemWatcher::ReadEvents(intptr_t id, intptr_t path_id) { USE(id); const intptr_t kEventSize = sizeof(FILE_NOTIFY_INFORMATION); @@ -117,9 +111,10 @@ Dart_Handle FileSystemWatcher::ReadEvents(intptr_t id, intptr_t path_id) { Dart_ListSetAt(event, 0, Dart_NewInteger(mask)); // Move events come in pairs. Just 'enable' by default. Dart_ListSetAt(event, 1, Dart_NewInteger(1)); - Dart_ListSetAt(event, 2, Dart_NewStringFromUTF16( - reinterpret_cast(e->FileName), - e->FileNameLength / 2)); + Dart_ListSetAt( + event, 2, + Dart_NewStringFromUTF16(reinterpret_cast(e->FileName), + e->FileNameLength / 2)); Dart_ListSetAt(event, 3, Dart_NewBoolean(true)); Dart_ListSetAt(event, 4, Dart_NewInteger(path_id)); Dart_ListSetAt(events, i, event); diff --git a/runtime/bin/file_test.cc b/runtime/bin/file_test.cc index 4c2c0d169fe..d5dda5e6367 100644 --- a/runtime/bin/file_test.cc +++ b/runtime/bin/file_test.cc @@ -21,7 +21,6 @@ static const char* GetFileName(const char* name) { } } - TEST_CASE(Read) { const char* kFilename = GetFileName("runtime/bin/file_test.cc"); File* file = File::Open(kFilename, File::kRead); @@ -35,7 +34,6 @@ TEST_CASE(Read) { file->Release(); } - TEST_CASE(FileLength) { const char* kFilename = GetFileName("runtime/tests/vm/data/fixed_length_file"); @@ -45,7 +43,6 @@ TEST_CASE(FileLength) { file->Release(); } - TEST_CASE(FilePosition) { char buf[42]; const char* kFilename = diff --git a/runtime/bin/file_unsupported.cc b/runtime/bin/file_unsupported.cc index 9196c22b071..5556e8114c6 100644 --- a/runtime/bin/file_unsupported.cc +++ b/runtime/bin/file_unsupported.cc @@ -11,211 +11,176 @@ namespace dart { namespace bin { - void FUNCTION_NAME(File_GetPointer)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_SetPointer)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_Open)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_Exists)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_Close)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_ReadByte)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_WriteByte)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_Read)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_ReadInto)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_WriteFrom)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_Position)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_SetPosition)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_Truncate)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_Length)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_LengthFromPath)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_LastModified)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_LastAccessed)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_SetLastModified)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_SetLastAccessed)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_Flush)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_Lock)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_Create)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_CreateLink)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_LinkTarget)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_Delete)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_DeleteLink)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_Rename)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_RenameLink)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_Copy)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_ResolveSymbolicLinks)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_OpenStdio)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_GetStdioHandleType)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_GetType)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_Stat)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); } - void FUNCTION_NAME(File_AreIdentical)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("File is not supported on this platform")); diff --git a/runtime/bin/file_win.cc b/runtime/bin/file_win.cc index 87734a9e203..766cbd176f9 100644 --- a/runtime/bin/file_win.cc +++ b/runtime/bin/file_win.cc @@ -7,13 +7,13 @@ #include "bin/file.h" +#include // NOLINT #include // NOLINT #include // NOLINT #include // NOLINT #include // NOLINT #include // NOLINT #include // NOLINT -#include // NOLINT #include "bin/builtin.h" #include "bin/log.h" @@ -37,7 +37,6 @@ class FileHandle { DISALLOW_COPY_AND_ASSIGN(FileHandle); }; - File::~File() { if (!IsClosed() && handle_->fd() != _fileno(stdout) && handle_->fd() != _fileno(stderr)) { @@ -46,7 +45,6 @@ File::~File() { delete handle_; } - void File::Close() { ASSERT(handle_->fd() >= 0); int closing_fd = handle_->fd(); @@ -64,17 +62,14 @@ void File::Close() { handle_->set_fd(kClosedFd); } - intptr_t File::GetFD() { return handle_->fd(); } - bool File::IsClosed() { return handle_->fd() == kClosedFd; } - MappedMemory* File::Map(File::MapType type, int64_t position, int64_t length) { DWORD prot_alloc; DWORD prot_final; @@ -114,7 +109,6 @@ MappedMemory* File::Map(File::MapType type, int64_t position, int64_t length) { return new MappedMemory(addr, length); } - void MappedMemory::Unmap() { BOOL result = VirtualFree(address_, 0, MEM_RELEASE); ASSERT(result); @@ -122,13 +116,11 @@ void MappedMemory::Unmap() { size_ = 0; } - int64_t File::Read(void* buffer, int64_t num_bytes) { ASSERT(handle_->fd() >= 0); return read(handle_->fd(), buffer, num_bytes); } - int64_t File::Write(const void* buffer, int64_t num_bytes) { int fd = handle_->fd(); ASSERT(fd >= 0); @@ -161,7 +153,6 @@ int64_t File::Write(const void* buffer, int64_t num_bytes) { return bytes_written; } - bool File::VPrint(const char* format, va_list args) { // Measure. va_list measure_args; @@ -182,31 +173,26 @@ bool File::VPrint(const char* format, va_list args) { return result; } - int64_t File::Position() { ASSERT(handle_->fd() >= 0); return _lseeki64(handle_->fd(), 0, SEEK_CUR); } - bool File::SetPosition(int64_t position) { ASSERT(handle_->fd() >= 0); return _lseeki64(handle_->fd(), position, SEEK_SET) >= 0; } - bool File::Truncate(int64_t length) { ASSERT(handle_->fd() >= 0); return _chsize_s(handle_->fd(), length) == 0; } - bool File::Flush() { ASSERT(handle_->fd()); return _commit(handle_->fd()) != -1; } - bool File::Lock(File::LockType lock, int64_t start, int64_t end) { ASSERT(handle_->fd() >= 0); ASSERT((end == -1) || (end > start)); @@ -250,7 +236,6 @@ bool File::Lock(File::LockType lock, int64_t start, int64_t end) { return rc; } - int64_t File::Length() { ASSERT(handle_->fd() >= 0); struct __stat64 st; @@ -260,7 +245,6 @@ int64_t File::Length() { return -1; } - File* File::FileOpenW(const wchar_t* system_name, FileOpenMode mode) { int flags = O_RDONLY | O_BINARY | O_NOINHERIT; if ((mode & kWrite) != 0) { @@ -288,14 +272,12 @@ File* File::FileOpenW(const wchar_t* system_name, FileOpenMode mode) { return new File(new FileHandle(fd)); } - File* File::Open(const char* path, FileOpenMode mode) { Utf8ToWideScope system_name(path); File* file = FileOpenW(system_name.wide(), mode); return file; } - File* File::OpenStdio(int fd) { int stdio_fd = -1; switch (fd) { @@ -312,7 +294,6 @@ File* File::OpenStdio(int fd) { return new File(new FileHandle(stdio_fd)); } - static bool StatHelper(wchar_t* path, struct __stat64* st) { int stat_status = _wstat64(path, st); if (stat_status != 0) { @@ -325,14 +306,12 @@ static bool StatHelper(wchar_t* path, struct __stat64* st) { return true; } - bool File::Exists(const char* name) { struct __stat64 st; Utf8ToWideScope system_name(name); return StatHelper(system_name.wide(), &st); } - bool File::Create(const char* name) { Utf8ToWideScope system_name(name); int fd = _wopen(system_name.wide(), O_RDONLY | O_CREAT, 0666); @@ -342,7 +321,6 @@ bool File::Create(const char* name) { return (close(fd) == 0); } - // This structure is needed for creating and reading Junctions. typedef struct _REPARSE_DATA_BUFFER { ULONG ReparseTag; @@ -373,11 +351,9 @@ typedef struct _REPARSE_DATA_BUFFER { }; } REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; - static const int kReparseDataHeaderSize = sizeof ULONG + 2 * sizeof USHORT; static const int kMountPointHeaderSize = 4 * sizeof USHORT; - bool File::CreateLink(const char* utf8_name, const char* utf8_target) { Utf8ToWideScope name(utf8_name); int create_status = CreateDirectoryW(name.wide(), NULL); @@ -435,14 +411,12 @@ bool File::CreateLink(const char* utf8_name, const char* utf8_target) { return (result != 0); } - bool File::Delete(const char* name) { Utf8ToWideScope system_name(name); int status = _wremove(system_name.wide()); return status != -1; } - bool File::DeleteLink(const char* name) { Utf8ToWideScope system_name(name); bool result = false; @@ -457,7 +431,6 @@ bool File::DeleteLink(const char* name) { return result; } - bool File::Rename(const char* old_path, const char* new_path) { File::Type type = GetType(old_path, false); if (type == kIsFile) { @@ -473,7 +446,6 @@ bool File::Rename(const char* old_path, const char* new_path) { return false; } - bool File::RenameLink(const char* old_path, const char* new_path) { File::Type type = GetType(old_path, false); if (type == kIsLink) { @@ -489,7 +461,6 @@ bool File::RenameLink(const char* old_path, const char* new_path) { return false; } - bool File::Copy(const char* old_path, const char* new_path) { File::Type type = GetType(old_path, false); if (type == kIsFile) { @@ -504,7 +475,6 @@ bool File::Copy(const char* old_path, const char* new_path) { return false; } - int64_t File::LengthFromPath(const char* name) { struct __stat64 st; Utf8ToWideScope system_name(name); @@ -514,7 +484,6 @@ int64_t File::LengthFromPath(const char* name) { return st.st_size; } - const char* File::LinkTarget(const char* pathname) { const wchar_t* name = StringUtilsWin::Utf8ToWide(pathname); HANDLE dir_handle = CreateFileW( @@ -578,7 +547,6 @@ const char* File::LinkTarget(const char* pathname) { return utf8_target; } - void File::Stat(const char* name, int64_t* data) { File::Type type = GetType(name, false); data[kType] = type; @@ -598,7 +566,6 @@ void File::Stat(const char* name, int64_t* data) { } } - time_t File::LastAccessed(const char* name) { struct __stat64 st; Utf8ToWideScope system_name(name); @@ -608,7 +575,6 @@ time_t File::LastAccessed(const char* name) { return st.st_atime; } - time_t File::LastModified(const char* name) { struct __stat64 st; Utf8ToWideScope system_name(name); @@ -618,7 +584,6 @@ time_t File::LastModified(const char* name) { return st.st_mtime; } - bool File::SetLastAccessed(const char* name, int64_t millis) { // First get the current times. struct __stat64 st; @@ -634,7 +599,6 @@ bool File::SetLastAccessed(const char* name, int64_t millis) { return _wutime64(system_name.wide(), ×) == 0; } - bool File::SetLastModified(const char* name, int64_t millis) { // First get the current times. struct __stat64 st; @@ -650,7 +614,6 @@ bool File::SetLastModified(const char* name, int64_t millis) { return _wutime64(system_name.wide(), ×) == 0; } - bool File::IsAbsolutePath(const char* pathname) { // Should we consider network paths? if (pathname == NULL) { @@ -660,7 +623,6 @@ bool File::IsAbsolutePath(const char* pathname) { ((pathname[2] == '\\') || (pathname[2] == '/'))); } - const char* File::GetCanonicalPath(const char* pathname) { Utf8ToWideScope system_name(pathname); HANDLE file_handle = @@ -697,26 +659,22 @@ const char* File::GetCanonicalPath(const char* pathname) { return result; } - const char* File::PathSeparator() { // This is already UTF-8 encoded. return "\\"; } - const char* File::StringEscapedPathSeparator() { // This is already UTF-8 encoded. return "\\\\"; } - File::StdioHandleType File::GetStdioHandleType(int fd) { // Treat all stdio handles as pipes. The Windows event handler and // socket code will handle the different handle types. return kPipe; } - File::Type File::GetType(const char* pathname, bool follow_links) { // Convert to wchar_t string. Utf8ToWideScope name(pathname); @@ -745,7 +703,6 @@ File::Type File::GetType(const char* pathname, bool follow_links) { return result; } - File::Identical File::AreIdentical(const char* file_1, const char* file_2) { BY_HANDLE_FILE_INFORMATION file_info[2]; const char* file_names[2] = {file_1, file_2}; diff --git a/runtime/bin/filter.cc b/runtime/bin/filter.cc index 666597975d3..3604153efa7 100644 --- a/runtime/bin/filter.cc +++ b/runtime/bin/filter.cc @@ -34,7 +34,6 @@ static Dart_Handle GetFilter(Dart_Handle filter_obj, Filter** filter) { return Dart_Null(); } - static Dart_Handle CopyDictionary(Dart_Handle dictionary_obj, uint8_t** dictionary) { ASSERT(dictionary != NULL); @@ -69,7 +68,6 @@ static Dart_Handle CopyDictionary(Dart_Handle dictionary_obj, return Dart_Null(); } - void FUNCTION_NAME(Filter_CreateZLibInflate)(Dart_NativeArguments args) { Dart_Handle filter_obj = Dart_GetNativeArgument(args, 0); Dart_Handle window_bits_obj = Dart_GetNativeArgument(args, 1); @@ -115,7 +113,6 @@ void FUNCTION_NAME(Filter_CreateZLibInflate)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Filter_CreateZLibDeflate)(Dart_NativeArguments args) { Dart_Handle filter_obj = Dart_GetNativeArgument(args, 0); Dart_Handle gzip_obj = Dart_GetNativeArgument(args, 1); @@ -172,7 +169,6 @@ void FUNCTION_NAME(Filter_CreateZLibDeflate)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Filter_Process)(Dart_NativeArguments args) { Dart_Handle filter_obj = Dart_GetNativeArgument(args, 0); Dart_Handle data_obj = Dart_GetNativeArgument(args, 1); @@ -230,7 +226,6 @@ void FUNCTION_NAME(Filter_Process)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Filter_Processed)(Dart_NativeArguments args) { Dart_Handle filter_obj = Dart_GetNativeArgument(args, 0); Dart_Handle flush_obj = Dart_GetNativeArgument(args, 1); @@ -258,7 +253,6 @@ void FUNCTION_NAME(Filter_Processed)(Dart_NativeArguments args) { } } - static void DeleteFilter(void* isolate_data, Dart_WeakPersistentHandle handle, void* filter_pointer) { @@ -266,7 +260,6 @@ static void DeleteFilter(void* isolate_data, delete filter; } - Dart_Handle Filter::SetFilterAndCreateFinalizer(Dart_Handle filter, Filter* filter_pointer, intptr_t size) { @@ -281,7 +274,6 @@ Dart_Handle Filter::SetFilterAndCreateFinalizer(Dart_Handle filter, return err; } - Dart_Handle Filter::GetFilterNativeField(Dart_Handle filter, Filter** filter_pointer) { return Dart_GetNativeInstanceField( @@ -289,7 +281,6 @@ Dart_Handle Filter::GetFilterNativeField(Dart_Handle filter, reinterpret_cast(filter_pointer)); } - ZLibDeflateFilter::~ZLibDeflateFilter() { delete[] dictionary_; delete[] current_buffer_; @@ -298,7 +289,6 @@ ZLibDeflateFilter::~ZLibDeflateFilter() { } } - bool ZLibDeflateFilter::Init() { int window_bits = window_bits_; if (raw_) { @@ -327,7 +317,6 @@ bool ZLibDeflateFilter::Init() { return true; } - bool ZLibDeflateFilter::Process(uint8_t* data, intptr_t length) { if (current_buffer_ != NULL) { return false; @@ -367,7 +356,6 @@ intptr_t ZLibDeflateFilter::Processed(uint8_t* buffer, return error ? -1 : 0; } - ZLibInflateFilter::~ZLibInflateFilter() { delete[] dictionary_; delete[] current_buffer_; @@ -376,7 +364,6 @@ ZLibInflateFilter::~ZLibInflateFilter() { } } - bool ZLibInflateFilter::Init() { int window_bits = raw_ ? -window_bits_ : window_bits_ | kZLibFlagAcceptAnyHeader; @@ -394,7 +381,6 @@ bool ZLibInflateFilter::Init() { return true; } - bool ZLibInflateFilter::Process(uint8_t* data, intptr_t length) { if (current_buffer_ != NULL) { return false; @@ -404,7 +390,6 @@ bool ZLibInflateFilter::Process(uint8_t* data, intptr_t length) { return true; } - intptr_t ZLibInflateFilter::Processed(uint8_t* buffer, intptr_t length, bool flush, diff --git a/runtime/bin/filter_unsupported.cc b/runtime/bin/filter_unsupported.cc index d3303935c3b..d33a9530a03 100644 --- a/runtime/bin/filter_unsupported.cc +++ b/runtime/bin/filter_unsupported.cc @@ -16,19 +16,16 @@ void FUNCTION_NAME(Filter_CreateZLibInflate)(Dart_NativeArguments args) { "ZLibInflater and Deflater not supported on this platform")); } - void FUNCTION_NAME(Filter_CreateZLibDeflate)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "ZLibInflater and Deflater not supported on this platform")); } - void FUNCTION_NAME(Filter_Process)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "ZLibInflater and Deflater not supported on this platform")); } - void FUNCTION_NAME(Filter_Processed)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "ZLibInflater and Deflater not supported on this platform")); diff --git a/runtime/bin/gen_snapshot.cc b/runtime/bin/gen_snapshot.cc index e815265deb6..2a7d3247eb7 100644 --- a/runtime/bin/gen_snapshot.cc +++ b/runtime/bin/gen_snapshot.cc @@ -25,9 +25,9 @@ #include "include/dart_api.h" #include "include/dart_tools_api.h" -#include "platform/hashmap.h" #include "platform/globals.h" #include "platform/growable_array.h" +#include "platform/hashmap.h" namespace dart { namespace bin { @@ -57,13 +57,11 @@ static const int kErrorExitCode = 255; exit(exit_code); \ } - // The core snapshot to use when creating isolates. Normally NULL, but loaded // from a file when creating script snapshots. const uint8_t* isolate_snapshot_data = NULL; const uint8_t* isolate_snapshot_instructions = NULL; - // Global state that indicates whether a snapshot is to be created and // if so which file to write the snapshot into. enum SnapshotKind { @@ -84,7 +82,6 @@ static bool dependencies_only = false; static bool print_dependencies = false; static const char* dependencies_filename = NULL; - // Value of the --load-compilation-trace flag. // (This pointer points into an argv buffer and does not need to be // free'd.) @@ -100,7 +97,6 @@ static const char* commandline_package_root = NULL; // free'd.) static const char* commandline_packages_file = NULL; - // Global state which contains a pointer to the script name for which // a snapshot needs to be created (NULL would result in the creation // of a generic snapshot that contains only the corelibs). @@ -118,7 +114,6 @@ static bool IsValidFlag(const char* name, (strncmp(name, prefix, prefix_length) == 0)); } - // The environment provided through the command line using -D options. static dart::HashMap* environment = NULL; @@ -171,7 +166,6 @@ static bool ProcessEnvironmentOption(const char* arg) { return true; } - static Dart_Handle EnvironmentCallback(Dart_Handle name) { uint8_t* utf8_array; intptr_t utf8_len; @@ -202,7 +196,6 @@ static Dart_Handle EnvironmentCallback(Dart_Handle name) { return result; } - static const char* ProcessOption(const char* option, const char* name) { const intptr_t length = strlen(name); if (strncmp(option, name, length) == 0) { @@ -211,7 +204,6 @@ static const char* ProcessOption(const char* option, const char* name) { return NULL; } - static bool ProcessSnapshotKindOption(const char* option) { const char* kind = ProcessOption(option, "--snapshot_kind="); if (kind == NULL) { @@ -243,7 +235,6 @@ static bool ProcessSnapshotKindOption(const char* option) { return false; } - static bool ProcessVmSnapshotDataOption(const char* option) { const char* name = ProcessOption(option, "--vm_snapshot_data="); if (name == NULL) { @@ -256,7 +247,6 @@ static bool ProcessVmSnapshotDataOption(const char* option) { return false; } - static bool ProcessVmSnapshotInstructionsOption(const char* option) { const char* name = ProcessOption(option, "--vm_snapshot_instructions="); if (name == NULL) { @@ -269,7 +259,6 @@ static bool ProcessVmSnapshotInstructionsOption(const char* option) { return false; } - static bool ProcessIsolateSnapshotDataOption(const char* option) { const char* name = ProcessOption(option, "--isolate_snapshot_data="); if (name == NULL) { @@ -282,7 +271,6 @@ static bool ProcessIsolateSnapshotDataOption(const char* option) { return false; } - static bool ProcessIsolateSnapshotInstructionsOption(const char* option) { const char* name = ProcessOption(option, "--isolate_snapshot_instructions="); if (name == NULL) { @@ -295,7 +283,6 @@ static bool ProcessIsolateSnapshotInstructionsOption(const char* option) { return false; } - static bool ProcessAssemblyOption(const char* option) { const char* name = ProcessOption(option, "--assembly="); if (name != NULL) { @@ -305,7 +292,6 @@ static bool ProcessAssemblyOption(const char* option) { return false; } - static bool ProcessScriptSnapshotOption(const char* option) { const char* name = ProcessOption(option, "--script_snapshot="); if (name == NULL) { @@ -318,7 +304,6 @@ static bool ProcessScriptSnapshotOption(const char* option) { return false; } - static bool ProcessDependenciesOption(const char* option) { const char* name = ProcessOption(option, "--dependencies="); if (name != NULL) { @@ -328,7 +313,6 @@ static bool ProcessDependenciesOption(const char* option) { return false; } - static bool ProcessDependenciesOnlyOption(const char* option) { const char* name = ProcessOption(option, "--dependencies_only"); if (name == NULL) { @@ -365,7 +349,6 @@ static bool ProcessEmbedderEntryPointsManifestOption(const char* option) { return false; } - static bool ProcessLoadCompilationTraceOption(const char* option) { const char* name = ProcessOption(option, "--load_compilation_trace="); if (name == NULL) { @@ -378,7 +361,6 @@ static bool ProcessLoadCompilationTraceOption(const char* option) { return false; } - static bool ProcessPackageRootOption(const char* option) { const char* name = ProcessOption(option, "--package_root="); if (name == NULL) { @@ -391,7 +373,6 @@ static bool ProcessPackageRootOption(const char* option) { return false; } - static bool ProcessPackagesOption(const char* option) { const char* name = ProcessOption(option, "--packages="); if (name != NULL) { @@ -401,7 +382,6 @@ static bool ProcessPackagesOption(const char* option) { return false; } - static bool ProcessURLmappingOption(const char* option) { const char* mapping = ProcessOption(option, "--url_mapping="); if (mapping == NULL) { @@ -414,12 +394,10 @@ static bool ProcessURLmappingOption(const char* option) { return false; } - static bool IsSnapshottingForPrecompilation() { return (snapshot_kind == kAppAOTBlobs) || (snapshot_kind == kAppAOTAssembly); } - // Parse out the command line arguments. Returns -1 if the arguments // are incorrect, 0 otherwise. static int ParseArguments(int argc, @@ -545,7 +523,6 @@ static int ParseArguments(int argc, return 0; } - static void WriteFile(const char* filename, const uint8_t* buffer, const intptr_t size) { @@ -565,7 +542,6 @@ static void WriteFile(const char* filename, file->Release(); } - static void ReadFile(const char* filename, uint8_t** buffer, intptr_t* size) { File* file = File::Open(filename, File::kRead); if (file == NULL) { @@ -585,7 +561,6 @@ static void ReadFile(const char* filename, uint8_t** buffer, intptr_t* size) { file->Release(); } - class UriResolverIsolateScope { public: UriResolverIsolateScope() { @@ -611,10 +586,8 @@ class UriResolverIsolateScope { DISALLOW_COPY_AND_ASSIGN(UriResolverIsolateScope); }; - Dart_Isolate UriResolverIsolateScope::isolate = NULL; - static void AddDependency(const char* uri_string) { IsolateData* isolate_data = reinterpret_cast(Dart_CurrentIsolateData()); @@ -624,7 +597,6 @@ static void AddDependency(const char* uri_string) { } } - static Dart_Handle LoadUrlContents(const char* uri_string) { bool failed = false; char* error_string = NULL; @@ -656,7 +628,6 @@ static Dart_Handle LoadUrlContents(const char* uri_string) { return result; } - static Dart_Handle ResolveUriInWorkingDirectory(const char* script_uri) { bool failed = false; char* result_string = NULL; @@ -682,7 +653,6 @@ static Dart_Handle ResolveUriInWorkingDirectory(const char* script_uri) { return result; } - static Dart_Handle LoadSnapshotCreationScript(const char* script_name) { // First resolve the specified script uri with respect to the original // working directory. @@ -704,7 +674,6 @@ static Dart_Handle LoadSnapshotCreationScript(const char* script_name) { } } - static Builtin::BuiltinLibraryId BuiltinId(const char* url) { if (DartUtils::IsDartBuiltinLibURL(url)) { return Builtin::kBuiltinLibrary; @@ -715,7 +684,6 @@ static Builtin::BuiltinLibraryId BuiltinId(const char* url) { return Builtin::kInvalidLibrary; } - // Generates a depfile like gcc -M -MF. Must be consumable by Ninja. class DependenciesFileWriter : public ValueObject { public: @@ -816,7 +784,6 @@ class DependenciesFileWriter : public ValueObject { bool success_; }; - static void CreateAndWriteDependenciesFile() { IsolateData* isolate_data = reinterpret_cast(Dart_CurrentIsolateData()); @@ -861,7 +828,6 @@ static void CreateAndWriteDependenciesFile() { isolate_data->set_dependencies(NULL); } - static Dart_Handle CreateSnapshotLibraryTagHandler(Dart_LibraryTag tag, Dart_Handle library, Dart_Handle url) { @@ -940,7 +906,6 @@ static Dart_Handle CreateSnapshotLibraryTagHandler(Dart_LibraryTag tag, } } - static Dart_Handle LoadGenericSnapshotCreationScript( Builtin::BuiltinLibraryId id) { Dart_Handle source = Builtin::Source(id); @@ -955,7 +920,6 @@ static Dart_Handle LoadGenericSnapshotCreationScript( return lib; } - // clang-format off static void PrintUsage() { Log::PrintErr( @@ -1030,29 +994,24 @@ static void PrintUsage() { } // clang-format on - static const char StubNativeFunctionName[] = "StubNativeFunction"; - void StubNativeFunction(Dart_NativeArguments arguments) { // This is a stub function for the resolver Dart_SetReturnValue( arguments, Dart_NewApiError("")); } - static Dart_NativeFunction StubNativeLookup(Dart_Handle name, int argument_count, bool* auto_setup_scope) { return &StubNativeFunction; } - static const uint8_t* StubNativeSymbol(Dart_NativeFunction nf) { return reinterpret_cast(StubNativeFunctionName); } - static void SetupStubNativeResolver(size_t lib_index, const Dart_QualifiedFunctionName* entry) { // TODO(24686): Remove this. @@ -1087,7 +1046,6 @@ static void SetupStubNativeResolver(size_t lib_index, DART_CHECK_VALID(result); } - // Iterate over all libraries and setup the stub native lookup. This must be // run after |SetupStubNativeResolversForPrecompilation| because the former // loads some libraries. @@ -1108,7 +1066,6 @@ static void SetupStubNativeResolvers() { } } - static void ImportNativeEntryPointLibrariesIntoRoot( const Dart_QualifiedFunctionName* entries) { if (entries == NULL) { @@ -1131,7 +1088,6 @@ static void ImportNativeEntryPointLibrariesIntoRoot( } } - static void SetupStubNativeResolversForPrecompilation( const Dart_QualifiedFunctionName* entries) { if (entries == NULL) { @@ -1151,7 +1107,6 @@ static void SetupStubNativeResolversForPrecompilation( } } - static void CleanupEntryPointItem(const Dart_QualifiedFunctionName* entry) { if (entry == NULL) { return; @@ -1164,7 +1119,6 @@ static void CleanupEntryPointItem(const Dart_QualifiedFunctionName* entry) { free(const_cast(entry->function_name)); } - static void CleanupEntryPointsCollection(Dart_QualifiedFunctionName* entries) { if (entries == NULL) { return; @@ -1181,7 +1135,6 @@ static void CleanupEntryPointsCollection(Dart_QualifiedFunctionName* entries) { free(entries); } - char* ParserErrorStringCreate(const char* format, ...) { static const size_t kErrorBufferSize = 256; @@ -1196,7 +1149,6 @@ char* ParserErrorStringCreate(const char* format, ...) { return error_buffer; } - const char* ParseEntryNameForIndex(uint8_t index) { switch (index) { case 0: @@ -1211,7 +1163,6 @@ const char* ParseEntryNameForIndex(uint8_t index) { return NULL; } - static bool ParseEntryPointsManifestSingleLine( const char* line, Dart_QualifiedFunctionName* entry, @@ -1267,7 +1218,6 @@ static bool ParseEntryPointsManifestSingleLine( return success; } - int64_t ParseEntryPointsManifestLines(FILE* file, Dart_QualifiedFunctionName* collection) { int64_t entries = 0; @@ -1311,7 +1261,6 @@ int64_t ParseEntryPointsManifestLines(FILE* file, return entries; } - static Dart_QualifiedFunctionName* ParseEntryPointsManifestFiles() { // Total number of entries across all manifest files. int64_t entry_count = 0; @@ -1363,7 +1312,6 @@ static Dart_QualifiedFunctionName* ParseEntryPointsManifestFiles() { return entries; } - static Dart_QualifiedFunctionName* ParseEntryPointsManifestIfPresent() { Dart_QualifiedFunctionName* entries = ParseEntryPointsManifestFiles(); if ((entries == NULL) && IsSnapshottingForPrecompilation()) { @@ -1374,7 +1322,6 @@ static Dart_QualifiedFunctionName* ParseEntryPointsManifestIfPresent() { return entries; } - static void LoadCompilationTrace() { if ((load_compilation_trace_filename != NULL) && (snapshot_kind == kCoreJIT)) { @@ -1386,7 +1333,6 @@ static void LoadCompilationTrace() { } } - static void CreateAndWriteCoreSnapshot() { ASSERT(snapshot_kind == kCore); ASSERT(vm_snapshot_data_filename != NULL); @@ -1418,7 +1364,6 @@ static void CreateAndWriteCoreSnapshot() { } } - static void CreateAndWriteCoreJITSnapshot() { ASSERT(snapshot_kind == kCoreJIT); ASSERT(vm_snapshot_data_filename != NULL); @@ -1458,7 +1403,6 @@ static void CreateAndWriteCoreJITSnapshot() { isolate_snapshot_instructions_size); } - static void CreateAndWriteScriptSnapshot() { ASSERT(snapshot_kind == kScript); ASSERT(script_snapshot_filename != NULL); @@ -1473,7 +1417,6 @@ static void CreateAndWriteScriptSnapshot() { WriteFile(script_snapshot_filename, buffer, size); } - static void CreateAndWritePrecompiledSnapshot( Dart_QualifiedFunctionName* standalone_entry_points) { ASSERT(IsSnapshottingForPrecompilation()); @@ -1526,7 +1469,6 @@ static void CreateAndWritePrecompiledSnapshot( } } - static void SetupForUriResolution() { // Set up the library tag handler for this isolate. Dart_Handle result = Dart_SetLibraryTagHandler(Loader::LibraryTagHandler); @@ -1542,7 +1484,6 @@ static void SetupForUriResolution() { CHECK_RESULT(library); } - static void SetupForGenericSnapshotCreation() { SetupForUriResolution(); @@ -1558,7 +1499,6 @@ static void SetupForGenericSnapshotCreation() { } } - static Dart_Isolate CreateServiceIsolate(const char* script_uri, const char* main, const char* package_root, @@ -1605,7 +1545,6 @@ static Dart_Isolate CreateServiceIsolate(const char* script_uri, return isolate; } - static MappedMemory* MapFile(const char* filename, File::MapType type, const uint8_t** buffer) { @@ -1630,7 +1569,6 @@ static MappedMemory* MapFile(const char* filename, return mapping; } - int main(int argc, char** argv) { const int EXTRA_VM_ARGUMENTS = 2; CommandLineOptions vm_options(argc + EXTRA_VM_ARGUMENTS); diff --git a/runtime/bin/hashmap_test.cc b/runtime/bin/hashmap_test.cc index a0ca5b95751..7234f4121d0 100644 --- a/runtime/bin/hashmap_test.cc +++ b/runtime/bin/hashmap_test.cc @@ -2,9 +2,9 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +#include "platform/hashmap.h" #include "platform/assert.h" #include "platform/globals.h" -#include "platform/hashmap.h" #include "vm/unit_test.h" namespace dart { @@ -12,10 +12,8 @@ namespace dart { // Default initial size of hashmaps used in these tests. static intptr_t kInitialSize = 8; - typedef uint32_t (*IntKeyHash)(uint32_t key); - class IntSet { public: explicit IntSet(IntKeyHash hash) @@ -59,7 +57,6 @@ class IntSet { HashMap map_; }; - static uint32_t WordHash(uint32_t key) { return dart::Utils::WordHash(key); } @@ -79,7 +76,6 @@ static uint32_t CollisionHash4(uint32_t key) { return kInitialSize - 2; } - void TestSet(IntKeyHash hash, int size) { IntSet set(hash); EXPECT_EQ(0u, set.occupancy()); @@ -170,7 +166,6 @@ void TestSet(IntKeyHash hash, int size) { EXPECT_EQ(0u, set.occupancy()); } - VM_UNIT_TEST_CASE(HashMap_Basic) { TestSet(WordHash, 100); TestSet(Hash, 100); diff --git a/runtime/bin/io_buffer.cc b/runtime/bin/io_buffer.cc index 3d671e0030c..57f9c3a1f23 100644 --- a/runtime/bin/io_buffer.cc +++ b/runtime/bin/io_buffer.cc @@ -23,7 +23,6 @@ Dart_Handle IOBuffer::Allocate(intptr_t size, uint8_t** buffer) { return result; } - uint8_t* IOBuffer::Allocate(intptr_t size) { return new uint8_t[size]; } diff --git a/runtime/bin/io_natives.cc b/runtime/bin/io_natives.cc index fa3e16847b0..1bdb3079eb1 100644 --- a/runtime/bin/io_natives.cc +++ b/runtime/bin/io_natives.cc @@ -177,7 +177,6 @@ static struct NativeEntries { int argument_count_; } IOEntries[] = {IO_NATIVE_LIST(REGISTER_FUNCTION)}; - Dart_NativeFunction IONativeLookup(Dart_Handle name, int argument_count, bool* auto_setup_scope) { @@ -198,7 +197,6 @@ Dart_NativeFunction IONativeLookup(Dart_Handle name, return NULL; } - const uint8_t* IONativeSymbol(Dart_NativeFunction nf) { int num_entries = sizeof(IOEntries) / sizeof(struct NativeEntries); for (int i = 0; i < num_entries; i++) { diff --git a/runtime/bin/io_service.cc b/runtime/bin/io_service.cc index c5e56287f2c..d77e81d35e6 100644 --- a/runtime/bin/io_service.cc +++ b/runtime/bin/io_service.cc @@ -54,12 +54,10 @@ void IOServiceCallback(Dart_Port dest_port_id, Dart_CObject* message) { Dart_PostCObject(reply_port_id, result.AsApiCObject()); } - Dart_Port IOService::GetServicePort() { return Dart_NewNativePort("IOService", IOServiceCallback, true); } - void FUNCTION_NAME(IOService_NewServicePort)(Dart_NativeArguments args) { Dart_SetReturnValue(args, Dart_Null()); Dart_Port service_port = IOService::GetServicePort(); diff --git a/runtime/bin/io_service_no_ssl.cc b/runtime/bin/io_service_no_ssl.cc index 189eb0369fe..895f01be522 100644 --- a/runtime/bin/io_service_no_ssl.cc +++ b/runtime/bin/io_service_no_ssl.cc @@ -52,12 +52,10 @@ void IOServiceCallback(Dart_Port dest_port_id, Dart_CObject* message) { Dart_PostCObject(reply_port_id, result.AsApiCObject()); } - Dart_Port IOService::GetServicePort() { return Dart_NewNativePort("IOService", IOServiceCallback, true); } - void FUNCTION_NAME(IOService_NewServicePort)(Dart_NativeArguments args) { Dart_SetReturnValue(args, Dart_Null()); Dart_Port service_port = IOService::GetServicePort(); diff --git a/runtime/bin/isolate_data.cc b/runtime/bin/isolate_data.cc index f3eafa02bf5..52b2e48c3f9 100644 --- a/runtime/bin/isolate_data.cc +++ b/runtime/bin/isolate_data.cc @@ -31,7 +31,6 @@ IsolateData::IsolateData(const char* url, } } - void IsolateData::OnIsolateShutdown() { if (builtin_lib_ != NULL) { Dart_DeletePersistentHandle(builtin_lib_); @@ -39,7 +38,6 @@ void IsolateData::OnIsolateShutdown() { } } - IsolateData::~IsolateData() { free(script_url); script_url = NULL; diff --git a/runtime/bin/loader.cc b/runtime/bin/loader.cc index b25f3c86f6f..f67c7245686 100644 --- a/runtime/bin/loader.cc +++ b/runtime/bin/loader.cc @@ -2,7 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. - #include "bin/loader.h" #include "bin/builtin.h" @@ -46,7 +45,6 @@ Loader::Loader(IsolateData* isolate_data) AddLoader(port_, isolate_data_); } - Loader::~Loader() { ASSERT(port_ != ILLEGAL_PORT); // Enter the monitor while we close the Dart port. After the Dart port is @@ -69,7 +67,6 @@ Loader::~Loader() { payload_length_ = 0; } - // Copy the contents of |message| into an |IOResult|. void Loader::IOResult::Setup(Dart_CObject* message) { ASSERT(message->type == Dart_CObject_kArray); @@ -122,7 +119,6 @@ void Loader::IOResult::Setup(Dart_CObject* message) { } } - void Loader::IOResult::Cleanup() { free(uri); free(resolved_uri); @@ -130,7 +126,6 @@ void Loader::IOResult::Cleanup() { free(payload); } - // Send the Loader Initialization message to the service isolate. This // message is sent the first time a loader is constructed for an isolate and // seeds the service isolate with some initial state about this isolate. @@ -150,31 +145,31 @@ void Loader::Init(const char* package_root, Dart_ListSetAt(request, 1, Dart_NewInteger(Dart_GetMainPortId())); Dart_ListSetAt(request, 2, Dart_NewInteger(_Dart_kInitLoader)); Dart_ListSetAt(request, 3, Dart_NewSendPort(port_)); - Dart_ListSetAt(request, 4, (package_root == NULL) - ? Dart_Null() - : Dart_NewStringFromCString(package_root)); - Dart_ListSetAt(request, 5, (packages_file == NULL) - ? Dart_Null() - : Dart_NewStringFromCString(packages_file)); + Dart_ListSetAt(request, 4, + (package_root == NULL) + ? Dart_Null() + : Dart_NewStringFromCString(package_root)); + Dart_ListSetAt(request, 5, + (packages_file == NULL) + ? Dart_Null() + : Dart_NewStringFromCString(packages_file)); Dart_ListSetAt(request, 6, Dart_NewStringFromCString(working_directory)); - Dart_ListSetAt(request, 7, (root_script_uri == NULL) - ? Dart_Null() - : Dart_NewStringFromCString(root_script_uri)); + Dart_ListSetAt(request, 7, + (root_script_uri == NULL) + ? Dart_Null() + : Dart_NewStringFromCString(root_script_uri)); Dart_ListSetAt(request, 8, Dart_NewBoolean(Dart_IsReloading())); - bool success = Dart_Post(loader_port, request); ASSERT(success); } - void Loader::SendImportExtensionRequest(Dart_Handle url, Dart_Handle library_url) { // This port delivers loading messages to the service isolate. Dart_Port loader_port = Builtin::LoadPort(); ASSERT(loader_port != ILLEGAL_PORT); - Dart_Handle request = Dart_NewList(6); Dart_ListSetAt(request, 0, trace_loader ? Dart_True() : Dart_False()); Dart_ListSetAt(request, 1, Dart_NewInteger(Dart_GetMainPortId())); @@ -190,7 +185,6 @@ void Loader::SendImportExtensionRequest(Dart_Handle url, } } - // Forward a request from the tag handler to the service isolate. void Loader::SendRequest(intptr_t tag, Dart_Handle url, @@ -214,7 +208,6 @@ void Loader::SendRequest(intptr_t tag, } } - // Forward a request from the tag handler to the kernel isolate. // [ tag, send port, url ] void Loader::SendKernelRequest(Dart_LibraryTag tag, Dart_Handle url) { @@ -232,7 +225,6 @@ void Loader::SendKernelRequest(Dart_LibraryTag tag, Dart_Handle url) { } } - void Loader::QueueMessage(Dart_CObject* message) { MonitorLocker ml(monitor_); if (results_length_ == results_capacity_) { @@ -249,7 +241,6 @@ void Loader::QueueMessage(Dart_CObject* message) { ml.Notify(); } - void Loader::BlockUntilComplete(ProcessResult process_result) { MonitorLocker ml(monitor_); @@ -270,7 +261,6 @@ void Loader::BlockUntilComplete(ProcessResult process_result) { } } - static bool LibraryHandleError(Dart_Handle library, Dart_Handle error) { if (!Dart_IsNull(library) && !Dart_IsError(library)) { ASSERT(Dart_IsLibrary(library)); @@ -283,14 +273,12 @@ static bool LibraryHandleError(Dart_Handle library, Dart_Handle error) { return false; } - static bool PathContainsSeparator(const char* path) { return (strchr(path, '/') != NULL) || ((strncmp(File::PathSeparator(), "/", 1) != 0) && (strstr(path, File::PathSeparator()) != NULL)); } - void Loader::AddDependencyLocked(Loader* loader, const char* resolved_uri) { MallocGrowableArray* dependencies = loader->isolate_data_->dependencies(); @@ -300,7 +288,6 @@ void Loader::AddDependencyLocked(Loader* loader, const char* resolved_uri) { dependencies->Add(strdup(resolved_uri)); } - void Loader::ResolveDependenciesAsFilePaths() { IsolateData* isolate_data = reinterpret_cast(Dart_CurrentIsolateData()); @@ -331,7 +318,6 @@ void Loader::ResolveDependenciesAsFilePaths() { } } - bool Loader::ProcessResultLocked(Loader* loader, Loader::IOResult* result) { // We have to copy everything we care about out of |result| because after // dropping the lock below |result| may no longer valid. @@ -475,7 +461,6 @@ bool Loader::ProcessResultLocked(Loader* loader, Loader::IOResult* result) { return true; } - bool Loader::ProcessPayloadResultLocked(Loader* loader, Loader::IOResult* result) { // A negative result tag indicates a loading error occurred in the service @@ -493,7 +478,6 @@ bool Loader::ProcessPayloadResultLocked(Loader* loader, return true; } - bool Loader::ProcessQueueLocked(ProcessResult process_result) { bool hit_error = false; for (intptr_t i = 0; i < results_length(); i++) { @@ -508,7 +492,6 @@ bool Loader::ProcessQueueLocked(ProcessResult process_result) { return !hit_error; } - void Loader::InitForSnapshot(const char* snapshot_uri) { IsolateData* isolate_data = reinterpret_cast(Dart_CurrentIsolateData()); @@ -523,7 +506,6 @@ void Loader::InitForSnapshot(const char* snapshot_uri) { delete loader; } - #define RETURN_ERROR(result) \ if (Dart_IsError(result)) return result; @@ -568,7 +550,6 @@ Dart_Handle Loader::ReloadNativeExtensions() { return Dart_True(); } - Dart_Handle Loader::SendAndProcessReply(intptr_t tag, Dart_Handle url, uint8_t** payload, @@ -609,14 +590,12 @@ Dart_Handle Loader::SendAndProcessReply(intptr_t tag, return Dart_Null(); } - Dart_Handle Loader::LoadUrlContents(Dart_Handle url, uint8_t** payload, intptr_t* payload_length) { return SendAndProcessReply(Dart_kScriptTag, url, payload, payload_length); } - Dart_Handle Loader::ResolveAsFilePath(Dart_Handle url, uint8_t** payload, intptr_t* payload_length) { @@ -631,7 +610,6 @@ Dart_Handle Loader::LibraryTagHandler(Dart_LibraryTag tag, return Dart_Null(); } - Dart_Handle Loader::DartColonLibraryTagHandler(Dart_LibraryTag tag, Dart_Handle library, Dart_Handle url, @@ -749,9 +727,9 @@ Dart_Handle Loader::LibraryTagHandler(Dart_LibraryTag tag, if (Dart_KernelIsolateIsRunning()) { loader->SendKernelRequest(tag, url); } else { - loader->SendRequest(tag, url, (library != Dart_Null()) - ? Dart_LibraryUrl(library) - : Dart_Null()); + loader->SendRequest( + tag, url, + (library != Dart_Null()) ? Dart_LibraryUrl(library) : Dart_Null()); } } @@ -795,7 +773,6 @@ Dart_Handle Loader::LibraryTagHandler(Dart_LibraryTag tag, return Dart_Null(); } - Dart_Handle Loader::DartColonLibraryTagHandler(Dart_LibraryTag tag, Dart_Handle library, Dart_Handle url, @@ -839,18 +816,15 @@ Dart_Handle Loader::DartColonLibraryTagHandler(Dart_LibraryTag tag, } #endif // !defined(DART_PRECOMPILED_RUNTIME) - void Loader::InitOnce() { loader_infos_lock_ = new Mutex(); } - Mutex* Loader::loader_infos_lock_; Loader::LoaderInfo* Loader::loader_infos_ = NULL; intptr_t Loader::loader_infos_length_ = 0; intptr_t Loader::loader_infos_capacity_ = 0; - // Add a mapping from |port| to |isolate_data| (really the loader). When a // native message arrives, we use this map to report the I/O result to the // correct loader. @@ -878,7 +852,6 @@ void Loader::AddLoader(Dart_Port port, IsolateData* isolate_data) { ASSERT(LoaderForLocked(port) != NULL); } - // Remove |port| from the map. // This happens once an isolate has finished loading. void Loader::RemoveLoader(Dart_Port port) { @@ -894,7 +867,6 @@ void Loader::RemoveLoader(Dart_Port port) { loader_infos_length_--; } - intptr_t Loader::LoaderIndexFor(Dart_Port port) { for (intptr_t i = 0; i < loader_infos_length_; i++) { if (loader_infos_[i].port == port) { @@ -904,7 +876,6 @@ intptr_t Loader::LoaderIndexFor(Dart_Port port) { return -1; } - Loader* Loader::LoaderForLocked(Dart_Port port) { intptr_t index = LoaderIndexFor(port); if (index < 0) { @@ -913,13 +884,11 @@ Loader* Loader::LoaderForLocked(Dart_Port port) { return loader_infos_[index].isolate_data->loader(); } - Loader* Loader::LoaderFor(Dart_Port port) { MutexLocker ml(loader_infos_lock_); return LoaderForLocked(port); } - void Loader::NativeMessageHandler(Dart_Port dest_port_id, Dart_CObject* message) { MutexLocker ml(loader_infos_lock_); diff --git a/runtime/bin/loader.h b/runtime/bin/loader.h index f69c4bf0c5e..808524fb09a 100644 --- a/runtime/bin/loader.h +++ b/runtime/bin/loader.h @@ -6,11 +6,11 @@ #define RUNTIME_BIN_LOADER_H_ #include "bin/isolate_data.h" +#include "bin/thread.h" #include "include/dart_api.h" #include "include/dart_native_api.h" #include "platform/assert.h" #include "platform/globals.h" -#include "bin/thread.h" namespace dart { namespace bin { diff --git a/runtime/bin/lockers.h b/runtime/bin/lockers.h index 83dd0bdee45..3e3f5122260 100644 --- a/runtime/bin/lockers.h +++ b/runtime/bin/lockers.h @@ -26,7 +26,6 @@ class MutexLocker { DISALLOW_COPY_AND_ASSIGN(MutexLocker); }; - class MonitorLocker { public: explicit MonitorLocker(Monitor* monitor) : monitor_(monitor) { diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc index cbe38ef74c8..7337d579693 100644 --- a/runtime/bin/main.cc +++ b/runtime/bin/main.cc @@ -2,9 +2,9 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +#include #include #include -#include #include "include/dart_api.h" #include "include/dart_tools_api.h" @@ -114,31 +114,25 @@ static const char* commandline_package_root = NULL; // free'd.) static const char* commandline_packages_file = NULL; - // Global flag that is used to indicate that we want to compile all the // dart functions and not run anything. static bool compile_all = false; static bool parse_all = false; - // Global flag that is used to indicate that we want to use blobs/mmap instead // of assembly/shared libraries for precompilation. static bool use_blobs = false; - // Global flag that is used to indicate that we want to trace resolution of // URIs and the loading of libraries, parts and scripts. static bool trace_loading = false; - static char* app_script_uri = NULL; static const uint8_t* app_isolate_snapshot_data = NULL; static const uint8_t* app_isolate_snapshot_instructions = NULL; - static Dart_Isolate main_isolate = NULL; - static const char* DEFAULT_VM_SERVICE_SERVER_IP = "localhost"; static const int DEFAULT_VM_SERVICE_SERVER_PORT = 8181; // VM Service options. @@ -150,7 +144,6 @@ static int vm_service_server_port = -1; // checks are disabled. static bool vm_service_dev_mode = false; - // The environment provided through the command line using -D options. static dart::HashMap* environment = NULL; @@ -162,7 +155,6 @@ static bool IsValidFlag(const char* name, (strncmp(name, prefix, prefix_length) == 0)); } - static bool version_option = false; static bool ProcessVersionOption(const char* arg, CommandLineOptions* vm_options) { @@ -173,7 +165,6 @@ static bool ProcessVersionOption(const char* arg, return true; } - static bool help_option = false; static bool ProcessHelpOption(const char* arg, CommandLineOptions* vm_options) { if (*arg != '\0') { @@ -183,7 +174,6 @@ static bool ProcessHelpOption(const char* arg, CommandLineOptions* vm_options) { return true; } - static bool verbose_option = false; static bool ProcessVerboseOption(const char* arg, CommandLineOptions* vm_options) { @@ -194,7 +184,6 @@ static bool ProcessVerboseOption(const char* arg, return true; } - static bool ProcessPackageRootOption(const char* arg, CommandLineOptions* vm_options) { ASSERT(arg != NULL); @@ -205,7 +194,6 @@ static bool ProcessPackageRootOption(const char* arg, return true; } - static bool ProcessPackagesOption(const char* arg, CommandLineOptions* vm_options) { ASSERT(arg != NULL); @@ -216,7 +204,6 @@ static bool ProcessPackagesOption(const char* arg, return true; } - static bool ProcessSaveCompilationTraceOption(const char* arg, CommandLineOptions* vm_options) { ASSERT(arg != NULL); @@ -227,7 +214,6 @@ static bool ProcessSaveCompilationTraceOption(const char* arg, return true; } - static bool ProcessLoadCompilationTraceOption(const char* arg, CommandLineOptions* vm_options) { ASSERT(arg != NULL); @@ -238,7 +224,6 @@ static bool ProcessLoadCompilationTraceOption(const char* arg, return true; } - static bool ProcessSaveFeedbackOption(const char* arg, CommandLineOptions* vm_options) { ASSERT(arg != NULL); @@ -249,7 +234,6 @@ static bool ProcessSaveFeedbackOption(const char* arg, return true; } - static bool ProcessLoadFeedbackOption(const char* arg, CommandLineOptions* vm_options) { ASSERT(arg != NULL); @@ -260,12 +244,10 @@ static bool ProcessLoadFeedbackOption(const char* arg, return true; } - static void* GetHashmapKeyFromString(char* key) { return reinterpret_cast(key); } - static bool ExtractPortAndAddress(const char* option_value, int* out_port, const char** out_ip, @@ -302,7 +284,6 @@ static bool ExtractPortAndAddress(const char* option_value, return true; } - static bool ProcessEnvironmentOption(const char* arg, CommandLineOptions* vm_options) { ASSERT(arg != NULL); @@ -345,7 +326,6 @@ static bool ProcessEnvironmentOption(const char* arg, return true; } - static bool ProcessCompileAllOption(const char* arg, CommandLineOptions* vm_options) { ASSERT(arg != NULL); @@ -356,7 +336,6 @@ static bool ProcessCompileAllOption(const char* arg, return true; } - static bool ProcessParseAllOption(const char* arg, CommandLineOptions* vm_options) { ASSERT(arg != NULL); @@ -367,7 +346,6 @@ static bool ProcessParseAllOption(const char* arg, return true; } - #if !defined(DART_PRECOMPILED_RUNTIME) static bool ProcessFrontendOption(const char* filename, CommandLineOptions* vm_options) { @@ -380,7 +358,6 @@ static bool ProcessFrontendOption(const char* filename, return true; } - static bool ProcessKernelBinariesOption(const char* dirname, CommandLineOptions* vm_options) { ASSERT(dirname != NULL); @@ -392,7 +369,6 @@ static bool ProcessKernelBinariesOption(const char* dirname, } #endif - static bool ProcessUseBlobsOption(const char* arg, CommandLineOptions* vm_options) { ASSERT(arg != NULL); @@ -403,7 +379,6 @@ static bool ProcessUseBlobsOption(const char* arg, return true; } - static bool ProcessSnapshotFilenameOption(const char* filename, CommandLineOptions* vm_options) { snapshot_filename = filename; @@ -413,7 +388,6 @@ static bool ProcessSnapshotFilenameOption(const char* filename, return true; } - static bool ProcessSnapshotKindOption(const char* kind, CommandLineOptions* vm_options) { if (strcmp(kind, "script") == 0) { @@ -433,14 +407,12 @@ static bool ProcessSnapshotKindOption(const char* kind, return false; } - static bool ProcessSnapshotDepsFilenameOption(const char* filename, CommandLineOptions* vm_options) { snapshot_deps_filename = filename; return true; } - static bool ProcessEnableVmServiceOption(const char* option_value, CommandLineOptions* vm_options) { ASSERT(option_value != NULL); @@ -457,7 +429,6 @@ static bool ProcessEnableVmServiceOption(const char* option_value, return true; } - static bool ProcessDisableServiceOriginCheckOption( const char* option_value, CommandLineOptions* vm_options) { @@ -469,7 +440,6 @@ static bool ProcessDisableServiceOriginCheckOption( return true; } - static bool ProcessObserveOption(const char* option_value, CommandLineOptions* vm_options) { ASSERT(option_value != NULL); @@ -490,7 +460,6 @@ static bool ProcessObserveOption(const char* option_value, return true; } - static bool ProcessTraceLoadingOption(const char* arg, CommandLineOptions* vm_options) { if (*arg != '\0') { @@ -500,7 +469,6 @@ static bool ProcessTraceLoadingOption(const char* arg, return true; } - static bool ProcessHotReloadTestModeOption(const char* arg, CommandLineOptions* vm_options) { if (*arg != '\0') { @@ -521,7 +489,6 @@ static bool ProcessHotReloadTestModeOption(const char* arg, return true; } - static bool ProcessHotReloadRollbackTestModeOption( const char* arg, CommandLineOptions* vm_options) { @@ -541,7 +508,6 @@ static bool ProcessHotReloadRollbackTestModeOption( return true; } - extern bool short_socket_read; extern bool short_socket_write; @@ -552,14 +518,12 @@ static bool ProcessShortSocketReadOption(const char* arg, return true; } - static bool ProcessShortSocketWriteOption(const char* arg, CommandLineOptions* vm_options) { short_socket_write = true; return true; } - extern const char* commandline_root_certs_file; extern const char* commandline_root_certs_cache; @@ -579,7 +543,6 @@ static bool ProcessRootCertsFileOption(const char* arg, return true; } - static bool ProcessRootCertsCacheOption(const char* arg, CommandLineOptions* vm_options) { ASSERT(arg != NULL); @@ -596,7 +559,6 @@ static bool ProcessRootCertsCacheOption(const char* arg, return true; } - static struct { const char* option_name; bool (*process)(const char* option, CommandLineOptions* vm_options); @@ -638,7 +600,6 @@ static struct { {"--root-certs-cache=", ProcessRootCertsCacheOption}, {NULL, NULL}}; - static bool ProcessMainOptions(const char* option, CommandLineOptions* vm_options) { int i = 0; @@ -657,7 +618,6 @@ static bool ProcessMainOptions(const char* option, return false; } - // Parse out the command line arguments. Returns -1 if the arguments // are incorrect, 0 otherwise. static int ParseArguments(int argc, @@ -774,7 +734,6 @@ static int ParseArguments(int argc, return 0; } - static Dart_Handle CreateRuntimeOptions(CommandLineOptions* options) { int options_count = options->count(); Dart_Handle dart_arguments = Dart_NewList(options_count); @@ -794,7 +753,6 @@ static Dart_Handle CreateRuntimeOptions(CommandLineOptions* options) { return dart_arguments; } - static Dart_Handle EnvironmentCallback(Dart_Handle name) { uint8_t* utf8_array; intptr_t utf8_len; @@ -825,7 +783,6 @@ static Dart_Handle EnvironmentCallback(Dart_Handle name) { return result; } - #define SAVE_ERROR_AND_EXIT(result) \ *error = strdup(Dart_GetError(result)); \ if (Dart_IsCompilationError(result)) { \ @@ -839,20 +796,17 @@ static Dart_Handle EnvironmentCallback(Dart_Handle name) { Dart_ShutdownIsolate(); \ return NULL; - #define CHECK_RESULT(result) \ if (Dart_IsError(result)) { \ SAVE_ERROR_AND_EXIT(result); \ } - #define CHECK_RESULT_CLEANUP(result, cleanup) \ if (Dart_IsError(result)) { \ delete (cleanup); \ SAVE_ERROR_AND_EXIT(result); \ } - static void SnapshotOnExitHook(int64_t exit_code) { if (Dart_CurrentIsolate() != main_isolate) { Log::PrintErr( @@ -866,7 +820,6 @@ static void SnapshotOnExitHook(int64_t exit_code) { } } - static Dart_Isolate IsolateSetupHelper(Dart_Isolate isolate, bool is_main_isolate, const char* script_uri, @@ -972,7 +925,6 @@ static Dart_Isolate IsolateSetupHelper(Dart_Isolate isolate, return isolate; } - #if !defined(DART_PRECOMPILED_RUNTIME) // Returns newly created Kernel Isolate on success, NULL on failure. // For now we only support the kernel isolate coming up from an @@ -1024,7 +976,6 @@ static Dart_Isolate CreateAndSetupKernelIsolate(const char* main, } #endif // !defined(DART_PRECOMPILED_RUNTIME) - // Returns newly created Service Isolate on success, NULL on failure. // For now we only support the service isolate coming up from sources // which are compiled by the VM parser. @@ -1104,7 +1055,6 @@ static Dart_Isolate CreateAndSetupServiceIsolate(const char* script_uri, return isolate; } - // Returns newly created Isolate on success, NULL on failure. static Dart_Isolate CreateIsolateAndSetupHelper(bool is_main_isolate, const char* script_uri, @@ -1193,7 +1143,6 @@ static Dart_Isolate CreateIsolateAndSetupHelper(bool is_main_isolate, #undef CHECK_RESULT - static Dart_Isolate CreateIsolateAndSetup(const char* script_uri, const char* main, const char* package_root, @@ -1229,12 +1178,10 @@ static Dart_Isolate CreateIsolateAndSetup(const char* script_uri, &exit_code); } - static void PrintVersion() { Log::PrintErr("Dart VM version: %s\n", Dart_VersionString()); } - // clang-format off static void PrintUsage() { Log::PrintErr( @@ -1329,7 +1276,6 @@ static void PrintUsage() { } // clang-format on - char* BuildIsolateName(const char* script_name, const char* func_name) { // Skip past any slashes in the script name. const char* last_slash = strrchr(script_name, '/'); @@ -1345,23 +1291,19 @@ char* BuildIsolateName(const char* script_name, const char* func_name) { return buffer; } - static void OnIsolateShutdown(void* callback_data) { IsolateData* isolate_data = reinterpret_cast(callback_data); isolate_data->OnIsolateShutdown(); } - static void DeleteIsolateData(void* callback_data) { IsolateData* isolate_data = reinterpret_cast(callback_data); delete isolate_data; } - static const char* kStdoutStreamId = "Stdout"; static const char* kStderrStreamId = "Stderr"; - static bool ServiceStreamListenCallback(const char* stream_id) { if (strcmp(stream_id, kStdoutStreamId) == 0) { SetCaptureStdout(true); @@ -1373,7 +1315,6 @@ static bool ServiceStreamListenCallback(const char* stream_id) { return false; } - static void ServiceStreamCancelCallback(const char* stream_id) { if (strcmp(stream_id, kStdoutStreamId) == 0) { SetCaptureStdout(false); @@ -1382,7 +1323,6 @@ static void ServiceStreamCancelCallback(const char* stream_id) { } } - static bool FileModifiedCallback(const char* url, int64_t since) { if (strncmp(url, "file:///", 8) == 0) { // If it isn't a file on local disk, we don't know if it has been @@ -1398,7 +1338,6 @@ static bool FileModifiedCallback(const char* url, int64_t since) { return modified; } - static void GenerateAppAOTSnapshot() { if (use_blobs) { Snapshot::GenerateAppAOTAsBlobs(snapshot_filename); @@ -1407,7 +1346,6 @@ static void GenerateAppAOTSnapshot() { } } - #define CHECK_RESULT(result) \ if (Dart_IsError(result)) { \ const int exit_code = Dart_IsCompilationError(result) \ @@ -1416,7 +1354,6 @@ static void GenerateAppAOTSnapshot() { ErrorExit(exit_code, "%s\n", Dart_GetError(result)); \ } - static void WriteFile(const char* filename, const uint8_t* buffer, const intptr_t size) { @@ -1430,7 +1367,6 @@ static void WriteFile(const char* filename, file->Release(); } - static void ReadFile(const char* filename, uint8_t** buffer, intptr_t* size) { File* file = File::Open(filename, File::kRead); if (file == NULL) { @@ -1444,7 +1380,6 @@ static void ReadFile(const char* filename, uint8_t** buffer, intptr_t* size) { file->Release(); } - bool RunMainIsolate(const char* script_name, CommandLineOptions* dart_options) { // Call CreateIsolateAndSetup which creates an isolate and loads up // the specified application script. @@ -1492,8 +1427,8 @@ bool RunMainIsolate(const char* script_name, CommandLineOptions* dart_options) { result = Dart_LibraryImportLibrary(isolate_data->builtin_lib(), root_lib, Dart_Null()); if ((gen_snapshot_kind == kAppAOT) || (gen_snapshot_kind == kAppJIT)) { - // Load the embedder's portion of the VM service's Dart code so it will - // be included in the app snapshot. +// Load the embedder's portion of the VM service's Dart code so it will +// be included in the app snapshot. #if defined(DART_PRECOMPILED_RUNTIME) if (!VmService::LoadForGenPrecompiled(NULL)) { #else @@ -1699,13 +1634,11 @@ bool RunMainIsolate(const char* script_name, CommandLineOptions* dart_options) { #undef CHECK_RESULT - // Observatory assets are only needed in the regular dart binary. #if !defined(DART_PRECOMPILER) && !defined(NO_OBSERVATORY) extern unsigned int observatory_assets_archive_len; extern const uint8_t* observatory_assets_archive; - // |input| is assumed to be a gzipped stream. // This function allocates the output buffer in the C heap and the caller // is responsible for freeing it. @@ -1771,7 +1704,6 @@ void Decompress(const uint8_t* input, inflateEnd(&strm); } - Dart_Handle GetVMServiceAssetsArchiveCallback() { uint8_t* decompressed = NULL; unsigned int decompressed_len = 0; @@ -1787,7 +1719,6 @@ Dart_Handle GetVMServiceAssetsArchiveCallback() { static Dart_GetVMServiceAssetsArchive GetVMServiceAssetsArchiveCallback = NULL; #endif // !defined(DART_PRECOMPILER) - void main(int argc, char** argv) { char* script_name; const int EXTRA_VM_ARGUMENTS = 8; diff --git a/runtime/bin/platform.cc b/runtime/bin/platform.cc index bfe107fc1a6..7aa597cc9eb 100644 --- a/runtime/bin/platform.cc +++ b/runtime/bin/platform.cc @@ -17,17 +17,14 @@ void FUNCTION_NAME(Platform_NumberOfProcessors)(Dart_NativeArguments args) { Dart_SetReturnValue(args, Dart_NewInteger(Platform::NumberOfProcessors())); } - void FUNCTION_NAME(Platform_OperatingSystem)(Dart_NativeArguments args) { Dart_SetReturnValue(args, DartUtils::NewString(Platform::OperatingSystem())); } - void FUNCTION_NAME(Platform_PathSeparator)(Dart_NativeArguments args) { Dart_SetReturnValue(args, DartUtils::NewString(File::PathSeparator())); } - void FUNCTION_NAME(Platform_LocalHostname)(Dart_NativeArguments args) { const intptr_t HOSTNAME_LENGTH = 256; char hostname[HOSTNAME_LENGTH]; @@ -38,7 +35,6 @@ void FUNCTION_NAME(Platform_LocalHostname)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Platform_ExecutableName)(Dart_NativeArguments args) { if (Platform::GetExecutableName() != NULL) { Dart_SetReturnValue( @@ -48,7 +44,6 @@ void FUNCTION_NAME(Platform_ExecutableName)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Platform_ResolvedExecutableName)(Dart_NativeArguments args) { if (Platform::GetResolvedExecutableName() != NULL) { Dart_SetReturnValue( @@ -58,7 +53,6 @@ void FUNCTION_NAME(Platform_ResolvedExecutableName)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Platform_ExecutableArguments)(Dart_NativeArguments args) { int end = Platform::GetScriptIndex(); char** argv = Platform::GetArgv(); @@ -73,7 +67,6 @@ void FUNCTION_NAME(Platform_ExecutableArguments)(Dart_NativeArguments args) { Dart_SetReturnValue(args, result); } - void FUNCTION_NAME(Platform_Environment)(Dart_NativeArguments args) { intptr_t count = 0; char** env = Platform::Environment(&count); @@ -104,12 +97,10 @@ void FUNCTION_NAME(Platform_Environment)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Platform_GetVersion)(Dart_NativeArguments args) { Dart_SetReturnValue(args, Dart_NewStringFromCString(Dart_VersionString())); } - void FUNCTION_NAME(Platform_LocaleName)(Dart_NativeArguments args) { const char* locale = Platform::LocaleName(); if (locale == NULL) { diff --git a/runtime/bin/platform_android.cc b/runtime/bin/platform_android.cc index cc21f19b43d..87ee9aa715f 100644 --- a/runtime/bin/platform_android.cc +++ b/runtime/bin/platform_android.cc @@ -36,27 +36,22 @@ bool Platform::Initialize() { return true; } - int Platform::NumberOfProcessors() { return sysconf(_SC_NPROCESSORS_ONLN); } - const char* Platform::OperatingSystem() { return "android"; } - const char* Platform::LibraryPrefix() { return "lib"; } - const char* Platform::LibraryExtension() { return "so"; } - const char* Platform::LocaleName() { char* lang = getenv("LANG"); if (lang == NULL) { @@ -65,12 +60,10 @@ const char* Platform::LocaleName() { return lang; } - bool Platform::LocalHostname(char* buffer, intptr_t buffer_length) { return gethostname(buffer, buffer_length) == 0; } - char** Platform::Environment(intptr_t* count) { // Using environ directly is only safe as long as we do not // provide access to modifying environment variables. @@ -88,17 +81,14 @@ char** Platform::Environment(intptr_t* count) { return result; } - const char* Platform::GetExecutableName() { return executable_name_; } - const char* Platform::ResolveExecutablePath() { return NULL; } - void Platform::Exit(int exit_code) { exit(exit_code); } diff --git a/runtime/bin/platform_fuchsia.cc b/runtime/bin/platform_fuchsia.cc index cf6e52377b4..0a14909a621 100644 --- a/runtime/bin/platform_fuchsia.cc +++ b/runtime/bin/platform_fuchsia.cc @@ -29,27 +29,22 @@ bool Platform::Initialize() { return true; } - int Platform::NumberOfProcessors() { return sysconf(_SC_NPROCESSORS_CONF); } - const char* Platform::OperatingSystem() { return "fuchsia"; } - const char* Platform::LibraryPrefix() { return "lib"; } - const char* Platform::LibraryExtension() { return "so"; } - const char* Platform::LocaleName() { char* lang = getenv("LANG"); if (lang == NULL) { @@ -58,12 +53,10 @@ const char* Platform::LocaleName() { return lang; } - bool Platform::LocalHostname(char* buffer, intptr_t buffer_length) { return gethostname(buffer, buffer_length) == 0; } - char** Platform::Environment(intptr_t* count) { // Using environ directly is only safe as long as we do not // provide access to modifying environment variables. @@ -81,7 +74,6 @@ char** Platform::Environment(intptr_t* count) { return result; } - const char* Platform::GetExecutableName() { if (executable_name_ != NULL) { return executable_name_; @@ -95,7 +87,6 @@ const char* Platform::GetExecutableName() { return name; } - const char* Platform::ResolveExecutablePath() { const char* executable_name = Platform::GetExecutableName(); if (executable_name == NULL) { @@ -132,7 +123,6 @@ const char* Platform::ResolveExecutablePath() { return NULL; } - void Platform::Exit(int exit_code) { exit(exit_code); } diff --git a/runtime/bin/platform_linux.cc b/runtime/bin/platform_linux.cc index 97a9437724d..ce89c19688c 100644 --- a/runtime/bin/platform_linux.cc +++ b/runtime/bin/platform_linux.cc @@ -27,7 +27,6 @@ static void segv_handler(int signal, siginfo_t* siginfo, void* context) { abort(); } - bool Platform::Initialize() { // Turn off the signal handler for SIGPIPE as it causes the process // to terminate on writing to a closed pipe. Without the signal @@ -61,27 +60,22 @@ bool Platform::Initialize() { return true; } - int Platform::NumberOfProcessors() { return sysconf(_SC_NPROCESSORS_ONLN); } - const char* Platform::OperatingSystem() { return "linux"; } - const char* Platform::LibraryPrefix() { return "lib"; } - const char* Platform::LibraryExtension() { return "so"; } - const char* Platform::LocaleName() { char* lang = getenv("LANG"); if (lang == NULL) { @@ -90,12 +84,10 @@ const char* Platform::LocaleName() { return lang; } - bool Platform::LocalHostname(char* buffer, intptr_t buffer_length) { return gethostname(buffer, buffer_length) == 0; } - char** Platform::Environment(intptr_t* count) { // Using environ directly is only safe as long as we do not // provide access to modifying environment variables. @@ -113,17 +105,14 @@ char** Platform::Environment(intptr_t* count) { return result; } - const char* Platform::GetExecutableName() { return executable_name_; } - const char* Platform::ResolveExecutablePath() { return File::LinkTarget("/proc/self/exe"); } - void Platform::Exit(int exit_code) { exit(exit_code); } diff --git a/runtime/bin/platform_macos.cc b/runtime/bin/platform_macos.cc index 4dbdc7ce2a9..2745df6490e 100644 --- a/runtime/bin/platform_macos.cc +++ b/runtime/bin/platform_macos.cc @@ -35,7 +35,6 @@ static void segv_handler(int signal, siginfo_t* siginfo, void* context) { abort(); } - bool Platform::Initialize() { // Turn off the signal handler for SIGPIPE as it causes the process // to terminate on writing to a closed pipe. Without the signal @@ -68,7 +67,6 @@ bool Platform::Initialize() { return true; } - int Platform::NumberOfProcessors() { int32_t cpus = -1; size_t cpus_length = sizeof(cpus); @@ -80,7 +78,6 @@ int Platform::NumberOfProcessors() { } } - const char* Platform::OperatingSystem() { #if HOST_OS_IOS return "ios"; @@ -89,17 +86,14 @@ const char* Platform::OperatingSystem() { #endif } - const char* Platform::LibraryPrefix() { return "lib"; } - const char* Platform::LibraryExtension() { return "dylib"; } - static const char* GetLocaleName() { CFLocaleRef locale = CFLocaleCopyCurrent(); CFStringRef locale_string = CFLocaleGetIdentifier(locale); @@ -117,7 +111,6 @@ static const char* GetLocaleName() { return result; } - static const char* GetPreferredLanguageName() { CFArrayRef languages = CFLocaleCopyPreferredLanguages(); CFIndex languages_length = CFArrayGetCount(languages); @@ -144,7 +137,6 @@ static const char* GetPreferredLanguageName() { return result; } - const char* Platform::LocaleName() { // First see if there is a preferred language. If not, return the // current locale name. @@ -152,12 +144,10 @@ const char* Platform::LocaleName() { return (preferred_language != NULL) ? preferred_language : GetLocaleName(); } - bool Platform::LocalHostname(char* buffer, intptr_t buffer_length) { return gethostname(buffer, buffer_length) == 0; } - char** Platform::Environment(intptr_t* count) { #if HOST_OS_IOS // TODO(zra,chinmaygarde): On iOS, environment variables are seldom used. Wire @@ -191,12 +181,10 @@ char** Platform::Environment(intptr_t* count) { #endif } - const char* Platform::GetExecutableName() { return executable_name_; } - const char* Platform::ResolveExecutablePath() { // Get the required length of the buffer. uint32_t path_size = 0; @@ -213,7 +201,6 @@ const char* Platform::ResolveExecutablePath() { return canon_path; } - void Platform::Exit(int exit_code) { exit(exit_code); } diff --git a/runtime/bin/platform_unsupported.cc b/runtime/bin/platform_unsupported.cc index 51d4fa9cd62..e1fcea45bd5 100644 --- a/runtime/bin/platform_unsupported.cc +++ b/runtime/bin/platform_unsupported.cc @@ -16,55 +16,46 @@ void FUNCTION_NAME(Platform_NumberOfProcessors)(Dart_NativeArguments args) { "Platform is not supported on this platform")); } - void FUNCTION_NAME(Platform_OperatingSystem)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "Platform is not supported on this platform")); } - void FUNCTION_NAME(Platform_PathSeparator)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "Platform is not supported on this platform")); } - void FUNCTION_NAME(Platform_LocalHostname)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "Platform is not supported on this platform")); } - void FUNCTION_NAME(Platform_ExecutableName)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "Platform is not supported on this platform")); } - void FUNCTION_NAME(Platform_ResolvedExecutableName)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "Platform is not supported on this platform")); } - void FUNCTION_NAME(Platform_ExecutableArguments)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "Platform is not supported on this platform")); } - void FUNCTION_NAME(Platform_Environment)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "Platform is not supported on this platform")); } - void FUNCTION_NAME(Platform_GetVersion)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "Platform is not supported on this platform")); } - void FUNCTION_NAME(Platform_LocaleName)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewInternalError( "Platform is not supported on this platform")); diff --git a/runtime/bin/platform_win.cc b/runtime/bin/platform_win.cc index b0e8eabb1e7..0c35910e9ca 100644 --- a/runtime/bin/platform_win.cc +++ b/runtime/bin/platform_win.cc @@ -181,29 +181,24 @@ bool Platform::Initialize() { return true; } - int Platform::NumberOfProcessors() { SYSTEM_INFO info; GetSystemInfo(&info); return info.dwNumberOfProcessors; } - const char* Platform::OperatingSystem() { return "windows"; } - const char* Platform::LibraryPrefix() { return ""; } - const char* Platform::LibraryExtension() { return "dll"; } - const char* Platform::LocaleName() { wchar_t locale_name[LOCALE_NAME_MAX_LENGTH]; int result = GetUserDefaultLocaleName(locale_name, LOCALE_NAME_MAX_LENGTH); @@ -213,7 +208,6 @@ const char* Platform::LocaleName() { return StringUtilsWin::WideToUtf8(locale_name); } - bool Platform::LocalHostname(char* buffer, intptr_t buffer_length) { #if defined(DART_IO_DISABLED) || defined(PLATFORM_DISABLE_SOCKET) return false; @@ -225,7 +219,6 @@ bool Platform::LocalHostname(char* buffer, intptr_t buffer_length) { #endif } - char** Platform::Environment(intptr_t* count) { wchar_t* strings = GetEnvironmentStringsW(); if (strings == NULL) { @@ -258,12 +251,10 @@ char** Platform::Environment(intptr_t* count) { return result; } - const char* Platform::GetExecutableName() { return executable_name_; } - const char* Platform::ResolveExecutablePath() { // GetModuleFileNameW cannot directly provide information on the // required buffer size, so start out with a buffer large enough to @@ -284,7 +275,6 @@ const char* Platform::ResolveExecutablePath() { return canon_path; } - void Platform::Exit(int exit_code) { // TODO(zra): Remove once VM shuts down cleanly. ::dart::private_flag_windows_run_tls_destructors = false; diff --git a/runtime/bin/process.cc b/runtime/bin/process.cc index ce8c82247f8..6c5171c1145 100644 --- a/runtime/bin/process.cc +++ b/runtime/bin/process.cc @@ -72,14 +72,12 @@ static char** ExtractCStringList(Dart_Handle strings, return string_args; } - void Process::ClearAllSignalHandlers() { for (intptr_t i = 1; i <= kLastSignal; i++) { ClearSignalHandler(i, ILLEGAL_PORT); } } - void FUNCTION_NAME(Process_Start)(Dart_NativeArguments args) { Dart_Handle process = Dart_GetNativeArgument(args, 0); intptr_t process_stdin; @@ -190,7 +188,6 @@ void FUNCTION_NAME(Process_Start)(Dart_NativeArguments args) { Dart_SetReturnValue(args, Dart_NewBoolean(error_code == 0)); } - void FUNCTION_NAME(Process_Wait)(Dart_NativeArguments args) { Dart_Handle process = Dart_GetNativeArgument(args, 0); Socket* process_stdin = @@ -234,7 +231,6 @@ void FUNCTION_NAME(Process_Wait)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Process_KillPid)(Dart_NativeArguments args) { intptr_t pid = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 0)); intptr_t signal = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1)); @@ -242,7 +238,6 @@ void FUNCTION_NAME(Process_KillPid)(Dart_NativeArguments args) { Dart_SetReturnValue(args, Dart_NewBoolean(success)); } - void FUNCTION_NAME(Process_Exit)(Dart_NativeArguments args) { int64_t status = 0; // Ignore result if passing invalid argument and just exit 0. @@ -252,7 +247,6 @@ void FUNCTION_NAME(Process_Exit)(Dart_NativeArguments args) { Platform::Exit(static_cast(status)); } - void FUNCTION_NAME(Process_SetExitCode)(Dart_NativeArguments args) { int64_t status = 0; // Ignore result if passing invalid argument and just set exit code to 0. @@ -260,12 +254,10 @@ void FUNCTION_NAME(Process_SetExitCode)(Dart_NativeArguments args) { Process::SetGlobalExitCode(status); } - void FUNCTION_NAME(Process_GetExitCode)(Dart_NativeArguments args) { Dart_SetReturnValue(args, Dart_NewInteger(Process::GlobalExitCode())); } - void FUNCTION_NAME(Process_Sleep)(Dart_NativeArguments args) { ScopedBlockingCall blocker; int64_t milliseconds = 0; @@ -274,7 +266,6 @@ void FUNCTION_NAME(Process_Sleep)(Dart_NativeArguments args) { TimerUtils::Sleep(milliseconds); } - void FUNCTION_NAME(Process_Pid)(Dart_NativeArguments args) { // Ignore result if passing invalid argument and just set exit code to 0. intptr_t pid = -1; @@ -287,7 +278,6 @@ void FUNCTION_NAME(Process_Pid)(Dart_NativeArguments args) { Dart_SetReturnValue(args, Dart_NewInteger(pid)); } - void FUNCTION_NAME(Process_SetSignalHandler)(Dart_NativeArguments args) { intptr_t signal = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 0)); intptr_t id = Process::SetSignalHandler(signal); @@ -298,25 +288,21 @@ void FUNCTION_NAME(Process_SetSignalHandler)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Process_ClearSignalHandler)(Dart_NativeArguments args) { intptr_t signal = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 0)); Process::ClearSignalHandler(signal, Dart_GetMainPortId()); } - Dart_Handle Process::GetProcessIdNativeField(Dart_Handle process, intptr_t* pid) { return Dart_GetNativeInstanceField(process, kProcessIdNativeField, pid); } - Dart_Handle Process::SetProcessIdNativeField(Dart_Handle process, intptr_t pid) { return Dart_SetNativeInstanceField(process, kProcessIdNativeField, pid); } - void FUNCTION_NAME(SystemEncodingToString)(Dart_NativeArguments args) { Dart_Handle bytes = Dart_GetNativeArgument(args, 0); intptr_t bytes_length = 0; @@ -341,7 +327,6 @@ void FUNCTION_NAME(SystemEncodingToString)(Dart_NativeArguments args) { Dart_SetReturnValue(args, result); } - void FUNCTION_NAME(StringToSystemEncoding)(Dart_NativeArguments args) { Dart_Handle str = Dart_GetNativeArgument(args, 0); char* utf8; @@ -366,7 +351,6 @@ void FUNCTION_NAME(StringToSystemEncoding)(Dart_NativeArguments args) { Dart_SetReturnValue(args, external_array); } - void FUNCTION_NAME(ProcessInfo_CurrentRSS)(Dart_NativeArguments args) { int64_t current_rss = Process::CurrentRSS(); if (current_rss < 0) { @@ -376,7 +360,6 @@ void FUNCTION_NAME(ProcessInfo_CurrentRSS)(Dart_NativeArguments args) { Dart_SetIntegerReturnValue(args, current_rss); } - void FUNCTION_NAME(ProcessInfo_MaxRSS)(Dart_NativeArguments args) { int64_t max_rss = Process::MaxRSS(); if (max_rss < 0) { diff --git a/runtime/bin/process.h b/runtime/bin/process.h index 6b68466ea21..aa79ac77521 100644 --- a/runtime/bin/process.h +++ b/runtime/bin/process.h @@ -41,7 +41,6 @@ class ProcessResult { DISALLOW_ALLOCATION(); }; - // To be kept in sync with ProcessSignal consts in sdk/lib/io/process.dart // Note that this map is as on Linux. enum ProcessSignals { @@ -77,7 +76,6 @@ enum ProcessSignals { kLastSignal = kSigsys, }; - // To be kept in sync with ProcessStartMode consts in sdk/lib/io/process.dart. enum ProcessStartMode { kNormal = 0, @@ -85,7 +83,6 @@ enum ProcessStartMode { kDetachedWithStdio = 2, }; - class Process { public: // Start a new process providing access to stdin, stdout, stderr and @@ -162,7 +159,6 @@ class Process { DISALLOW_IMPLICIT_CONSTRUCTORS(Process); }; - class SignalInfo { public: SignalInfo(intptr_t fd, intptr_t signal, SignalInfo* next) @@ -204,7 +200,6 @@ class SignalInfo { DISALLOW_COPY_AND_ASSIGN(SignalInfo); }; - // Utility class for collecting the output when running a process // synchronously by using Process::Wait. This class is sub-classed in // the platform specific files to implement reading into the buffers diff --git a/runtime/bin/process_android.cc b/runtime/bin/process_android.cc index 41230452edd..66fc2805230 100644 --- a/runtime/bin/process_android.cc +++ b/runtime/bin/process_android.cc @@ -64,7 +64,6 @@ class ProcessInfo { DISALLOW_COPY_AND_ASSIGN(ProcessInfo); }; - // Singly-linked list of ProcessInfo objects for all active processes // started from Dart. class ProcessInfoList { @@ -76,7 +75,6 @@ class ProcessInfoList { active_processes_ = info; } - static intptr_t LookupProcessExitFd(pid_t pid) { MutexLocker locker(mutex_); ProcessInfo* current = active_processes_; @@ -89,7 +87,6 @@ class ProcessInfoList { return 0; } - static void RemoveProcess(pid_t pid) { MutexLocker locker(mutex_); ProcessInfo* prev = NULL; @@ -121,11 +118,9 @@ class ProcessInfoList { DISALLOW_IMPLICIT_CONSTRUCTORS(ProcessInfoList); }; - ProcessInfo* ProcessInfoList::active_processes_ = NULL; Mutex* ProcessInfoList::mutex_ = new Mutex(); - // The exit code handler sets up a separate thread which waits for child // processes to terminate. That separate thread can then get the exit code from // processes that have exited and communicate it to Dart through the @@ -242,13 +237,11 @@ class ExitCodeHandler { DISALLOW_IMPLICIT_CONSTRUCTORS(ExitCodeHandler); }; - bool ExitCodeHandler::running_ = false; int ExitCodeHandler::process_count_ = 0; bool ExitCodeHandler::terminate_done_ = false; Monitor* ExitCodeHandler::monitor_ = new Monitor(); - class ProcessStarter { public: ProcessStarter(const char* path, @@ -301,7 +294,6 @@ class ProcessStarter { } } - int Start() { // Create pipes required. int err = CreatePipes(); @@ -426,7 +418,6 @@ class ProcessStarter { return 0; } - void NewProcess() { // Wait for parent process before setting up the child process. char msg; @@ -442,7 +433,6 @@ class ProcessStarter { } } - void ExecProcess() { if (TEMP_FAILURE_RETRY(dup2(write_out_[0], STDIN_FILENO)) == -1) { ReportChildError(); @@ -471,7 +461,6 @@ class ProcessStarter { ReportChildError(); } - void ExecDetachedProcess() { if (mode_ == kDetached) { ASSERT(write_out_[0] == -1); @@ -529,7 +518,6 @@ class ProcessStarter { } } - int RegisterProcess(pid_t pid) { int result; int event_fds[2]; @@ -544,7 +532,6 @@ class ProcessStarter { return 0; } - int ReadExecResult() { int child_errno; int bytes_read = -1; @@ -562,7 +549,6 @@ class ProcessStarter { return 0; } - int ReadDetachedExecResult(pid_t* pid) { int child_errno; int bytes_read = -1; @@ -585,7 +571,6 @@ class ProcessStarter { return 0; } - void SetupDetached() { ASSERT(mode_ == kDetached); @@ -648,7 +633,6 @@ class ProcessStarter { VOID_TEMP_FAILURE_RETRY(close(read_err_[1])); } - int CleanupAndReturnError() { int actual_errno = errno; // If CleanupAndReturnError is called without an actual errno make @@ -661,7 +645,6 @@ class ProcessStarter { return actual_errno; } - void SetChildOsErrorMessage() { const int kBufferSize = 1024; char* error_message = DartUtils::ScopedCString(kBufferSize); @@ -669,7 +652,6 @@ class ProcessStarter { *os_error_message_ = error_message; } - void ReportChildError() { // In the case of failure in the child process write the errno and // the OS error message to the exec control pipe and exit. @@ -690,7 +672,6 @@ class ProcessStarter { _exit(1); } - void ReportPid(int pid) { // In the case of starting a detached process the actual pid of that process // is communicated using the exec control pipe. @@ -700,7 +681,6 @@ class ProcessStarter { USE(bytes_written); } - void ReadChildError() { const int kMaxMessageSize = 256; char* message = DartUtils::ScopedCString(kMaxMessageSize); @@ -714,7 +694,6 @@ class ProcessStarter { } } - void ClosePipe(int* fds) { for (int i = 0; i < 2; i++) { if (fds[i] != -1) { @@ -724,7 +703,6 @@ class ProcessStarter { } } - void CloseAllPipes() { ClosePipe(exec_control_); ClosePipe(read_in_); @@ -732,7 +710,6 @@ class ProcessStarter { ClosePipe(write_out_); } - int read_in_[2]; // Pipe for stdout to child process. int read_err_[2]; // Pipe for stderr to child process. int write_out_[2]; // Pipe for stdin to child process. @@ -755,7 +732,6 @@ class ProcessStarter { DISALLOW_IMPLICIT_CONSTRUCTORS(ProcessStarter); }; - int Process::Start(const char* path, char* arguments[], intptr_t arguments_length, @@ -775,7 +751,6 @@ int Process::Start(const char* path, return starter.Start(); } - static bool CloseProcessBuffers(struct pollfd fds[3]) { int e = errno; VOID_TEMP_FAILURE_RETRY(close(fds[0].fd)); @@ -785,7 +760,6 @@ static bool CloseProcessBuffers(struct pollfd fds[3]) { return false; } - bool Process::Wait(intptr_t pid, intptr_t in, intptr_t out, @@ -873,22 +847,18 @@ bool Process::Wait(intptr_t pid, return true; } - bool Process::Kill(intptr_t id, int signal) { return (TEMP_FAILURE_RETRY(kill(id, signal)) != -1); } - void Process::TerminateExitCodeHandler() { ExitCodeHandler::TerminateExitCodeThread(); } - intptr_t Process::CurrentProcessId() { return static_cast(getpid()); } - int64_t Process::CurrentRSS() { // The second value in /proc/self/statm is the current RSS in pages. File* statm = File::Open("/proc/self/statm", File::kRead); @@ -911,7 +881,6 @@ int64_t Process::CurrentRSS() { return current_rss_pages * getpagesize(); } - int64_t Process::MaxRSS() { struct rusage usage; usage.ru_maxrss = 0; @@ -922,7 +891,6 @@ int64_t Process::MaxRSS() { return usage.ru_maxrss * KB; } - static Mutex* signal_mutex = new Mutex(); static SignalInfo* signal_handlers = NULL; static const int kSignalsCount = 7; @@ -931,12 +899,10 @@ static const int kSignals[kSignalsCount] = { SIGQUIT // Allow VMService to listen on SIGQUIT. }; - SignalInfo::~SignalInfo() { VOID_TEMP_FAILURE_RETRY(close(fd_)); } - static void SignalHandler(int signal) { MutexLocker lock(signal_mutex); const SignalInfo* handler = signal_handlers; @@ -949,7 +915,6 @@ static void SignalHandler(int signal) { } } - intptr_t Process::SetSignalHandler(intptr_t signal) { bool found = false; for (int i = 0; i < kSignalsCount; i++) { @@ -1000,7 +965,6 @@ intptr_t Process::SetSignalHandler(intptr_t signal) { return fds[0]; } - void Process::ClearSignalHandler(intptr_t signal, Dart_Port port) { // Either the port is illegal or there is no current isolate, but not both. ASSERT((port != ILLEGAL_PORT) || (Dart_CurrentIsolate() == NULL)); diff --git a/runtime/bin/process_fuchsia.cc b/runtime/bin/process_fuchsia.cc index b2adc710dbf..77557845e52 100644 --- a/runtime/bin/process_fuchsia.cc +++ b/runtime/bin/process_fuchsia.cc @@ -80,7 +80,6 @@ class ProcessInfo { DISALLOW_COPY_AND_ASSIGN(ProcessInfo); }; - // Singly-linked list of ProcessInfo objects for all active processes // started from Dart. class ProcessInfoList { @@ -428,12 +427,10 @@ void Process::TerminateExitCodeHandler() { ExitCodeHandler::Terminate(); } - intptr_t Process::CurrentProcessId() { return static_cast(getpid()); } - int64_t Process::CurrentRSS() { mx_info_task_stats_t task_stats; mx_handle_t process = mx_process_self(); @@ -447,14 +444,12 @@ int64_t Process::CurrentRSS() { return task_stats.mem_private_bytes + task_stats.mem_shared_bytes; } - int64_t Process::MaxRSS() { // There is currently no way to get the high watermark value on Fuchsia, so // just return the current RSS value. return CurrentRSS(); } - class IOHandleScope { public: explicit IOHandleScope(IOHandle* io_handle) : io_handle_(io_handle) {} @@ -470,7 +465,6 @@ class IOHandleScope { DISALLOW_COPY_AND_ASSIGN(IOHandleScope); }; - bool Process::Wait(intptr_t pid, intptr_t in, intptr_t out, @@ -613,7 +607,6 @@ bool Process::Wait(intptr_t pid, return true; } - bool Process::Kill(intptr_t id, int signal) { LOG_INFO("Sending signal %d to process with id %ld\n", signal, id); // mx_task_kill is definitely going to kill the process. @@ -640,7 +633,6 @@ bool Process::Kill(intptr_t id, int signal) { return true; } - class ProcessStarter { public: ProcessStarter(const char* path, @@ -837,7 +829,6 @@ class ProcessStarter { DISALLOW_IMPLICIT_CONSTRUCTORS(ProcessStarter); }; - int Process::Start(const char* path, char* arguments[], intptr_t arguments_length, diff --git a/runtime/bin/process_linux.cc b/runtime/bin/process_linux.cc index 342d600e498..1ab9a130ae7 100644 --- a/runtime/bin/process_linux.cc +++ b/runtime/bin/process_linux.cc @@ -9,15 +9,15 @@ #include "bin/process.h" -#include // NOLINT -#include // NOLINT -#include // NOLINT -#include // NOLINT -#include // NOLINT -#include // NOLINT +#include // NOLINT +#include // NOLINT +#include // NOLINT +#include // NOLINT +#include // NOLINT +#include // NOLINT #include // NOLINT -#include // NOLINT -#include // NOLINT +#include // NOLINT +#include // NOLINT #include "bin/dartutils.h" #include "bin/fdutils.h" @@ -65,7 +65,6 @@ class ProcessInfo { DISALLOW_COPY_AND_ASSIGN(ProcessInfo); }; - // Singly-linked list of ProcessInfo objects for all active processes // started from Dart. class ProcessInfoList { @@ -77,7 +76,6 @@ class ProcessInfoList { active_processes_ = info; } - static intptr_t LookupProcessExitFd(pid_t pid) { MutexLocker locker(mutex_); ProcessInfo* current = active_processes_; @@ -90,7 +88,6 @@ class ProcessInfoList { return 0; } - static void RemoveProcess(pid_t pid) { MutexLocker locker(mutex_); ProcessInfo* prev = NULL; @@ -122,11 +119,9 @@ class ProcessInfoList { DISALLOW_IMPLICIT_CONSTRUCTORS(ProcessInfoList); }; - ProcessInfo* ProcessInfoList::active_processes_ = NULL; Mutex* ProcessInfoList::mutex_ = new Mutex(); - // The exit code handler sets up a separate thread which waits for child // processes to terminate. That separate thread can then get the exit code from // processes that have exited and communicate it to Dart through the @@ -243,13 +238,11 @@ class ExitCodeHandler { DISALLOW_IMPLICIT_CONSTRUCTORS(ExitCodeHandler); }; - bool ExitCodeHandler::running_ = false; int ExitCodeHandler::process_count_ = 0; bool ExitCodeHandler::terminate_done_ = false; Monitor* ExitCodeHandler::monitor_ = new Monitor(); - class ProcessStarter { public: ProcessStarter(const char* path, @@ -302,7 +295,6 @@ class ProcessStarter { } } - int Start() { // Create pipes required. int err = CreatePipes(); @@ -427,7 +419,6 @@ class ProcessStarter { return 0; } - void NewProcess() { // Wait for parent process before setting up the child process. char msg; @@ -443,7 +434,6 @@ class ProcessStarter { } } - void ExecProcess() { if (TEMP_FAILURE_RETRY(dup2(write_out_[0], STDIN_FILENO)) == -1) { ReportChildError(); @@ -472,7 +462,6 @@ class ProcessStarter { ReportChildError(); } - void ExecDetachedProcess() { if (mode_ == kDetached) { ASSERT(write_out_[0] == -1); @@ -530,7 +519,6 @@ class ProcessStarter { } } - int RegisterProcess(pid_t pid) { int result; int event_fds[2]; @@ -545,7 +533,6 @@ class ProcessStarter { return 0; } - int ReadExecResult() { int child_errno; int bytes_read = -1; @@ -563,7 +550,6 @@ class ProcessStarter { return 0; } - int ReadDetachedExecResult(pid_t* pid) { int child_errno; int bytes_read = -1; @@ -586,7 +572,6 @@ class ProcessStarter { return 0; } - void SetupDetached() { ASSERT(mode_ == kDetached); @@ -649,7 +634,6 @@ class ProcessStarter { VOID_TEMP_FAILURE_RETRY(close(read_err_[1])); } - int CleanupAndReturnError() { int actual_errno = errno; // If CleanupAndReturnError is called without an actual errno make @@ -662,7 +646,6 @@ class ProcessStarter { return actual_errno; } - void SetChildOsErrorMessage() { const int kBufferSize = 1024; char* error_message = DartUtils::ScopedCString(kBufferSize); @@ -670,7 +653,6 @@ class ProcessStarter { *os_error_message_ = error_message; } - void ReportChildError() { // In the case of failure in the child process write the errno and // the OS error message to the exec control pipe and exit. @@ -691,7 +673,6 @@ class ProcessStarter { _exit(1); } - void ReportPid(int pid) { // In the case of starting a detached process the actual pid of that process // is communicated using the exec control pipe. @@ -701,7 +682,6 @@ class ProcessStarter { USE(bytes_written); } - void ReadChildError() { const int kMaxMessageSize = 256; char* message = DartUtils::ScopedCString(kMaxMessageSize); @@ -715,7 +695,6 @@ class ProcessStarter { } } - void ClosePipe(int* fds) { for (int i = 0; i < 2; i++) { if (fds[i] != -1) { @@ -725,7 +704,6 @@ class ProcessStarter { } } - void CloseAllPipes() { ClosePipe(exec_control_); ClosePipe(read_in_); @@ -733,7 +711,6 @@ class ProcessStarter { ClosePipe(write_out_); } - int read_in_[2]; // Pipe for stdout to child process. int read_err_[2]; // Pipe for stderr to child process. int write_out_[2]; // Pipe for stdin to child process. @@ -756,7 +733,6 @@ class ProcessStarter { DISALLOW_IMPLICIT_CONSTRUCTORS(ProcessStarter); }; - int Process::Start(const char* path, char* arguments[], intptr_t arguments_length, @@ -776,7 +752,6 @@ int Process::Start(const char* path, return starter.Start(); } - static bool CloseProcessBuffers(struct pollfd fds[3]) { int e = errno; VOID_TEMP_FAILURE_RETRY(close(fds[0].fd)); @@ -786,7 +761,6 @@ static bool CloseProcessBuffers(struct pollfd fds[3]) { return false; } - bool Process::Wait(intptr_t pid, intptr_t in, intptr_t out, @@ -874,22 +848,18 @@ bool Process::Wait(intptr_t pid, return true; } - bool Process::Kill(intptr_t id, int signal) { return (TEMP_FAILURE_RETRY(kill(id, signal)) != -1); } - void Process::TerminateExitCodeHandler() { ExitCodeHandler::TerminateExitCodeThread(); } - intptr_t Process::CurrentProcessId() { return static_cast(getpid()); } - int64_t Process::CurrentRSS() { // The second value in /proc/self/statm is the current RSS in pages. File* statm = File::Open("/proc/self/statm", File::kRead); @@ -912,7 +882,6 @@ int64_t Process::CurrentRSS() { return current_rss_pages * getpagesize(); } - int64_t Process::MaxRSS() { struct rusage usage; usage.ru_maxrss = 0; @@ -923,7 +892,6 @@ int64_t Process::MaxRSS() { return usage.ru_maxrss * KB; } - static Mutex* signal_mutex = new Mutex(); static SignalInfo* signal_handlers = NULL; static const int kSignalsCount = 7; @@ -932,12 +900,10 @@ static const int kSignals[kSignalsCount] = { SIGQUIT // Allow VMService to listen on SIGQUIT. }; - SignalInfo::~SignalInfo() { VOID_TEMP_FAILURE_RETRY(close(fd_)); } - static void SignalHandler(int signal) { MutexLocker lock(signal_mutex); const SignalInfo* handler = signal_handlers; @@ -950,7 +916,6 @@ static void SignalHandler(int signal) { } } - intptr_t Process::SetSignalHandler(intptr_t signal) { bool found = false; for (int i = 0; i < kSignalsCount; i++) { @@ -998,7 +963,6 @@ intptr_t Process::SetSignalHandler(intptr_t signal) { return fds[0]; } - void Process::ClearSignalHandler(intptr_t signal, Dart_Port port) { // Either the port is illegal or there is no current isolate, but not both. ASSERT((port != ILLEGAL_PORT) || (Dart_CurrentIsolate() == NULL)); diff --git a/runtime/bin/process_macos.cc b/runtime/bin/process_macos.cc index 582a8eae1ad..b59a0f094d0 100644 --- a/runtime/bin/process_macos.cc +++ b/runtime/bin/process_macos.cc @@ -12,15 +12,15 @@ #if !HOST_OS_IOS #include // NOLINT #endif -#include // NOLINT -#include // NOLINT +#include // NOLINT +#include // NOLINT #include // NOLINT -#include // NOLINT -#include // NOLINT -#include // NOLINT -#include // NOLINT -#include // NOLINT -#include // NOLINT +#include // NOLINT +#include // NOLINT +#include // NOLINT +#include // NOLINT +#include // NOLINT +#include // NOLINT #include "bin/dartutils.h" #include "bin/fdutils.h" @@ -64,7 +64,6 @@ class ProcessInfo { DISALLOW_COPY_AND_ASSIGN(ProcessInfo); }; - // Singly-linked list of ProcessInfo objects for all active processes // started from Dart. class ProcessInfoList { @@ -76,7 +75,6 @@ class ProcessInfoList { active_processes_ = info; } - static intptr_t LookupProcessExitFd(pid_t pid) { MutexLocker locker(mutex_); ProcessInfo* current = active_processes_; @@ -89,7 +87,6 @@ class ProcessInfoList { return 0; } - static void RemoveProcess(pid_t pid) { MutexLocker locker(mutex_); ProcessInfo* prev = NULL; @@ -121,11 +118,9 @@ class ProcessInfoList { DISALLOW_IMPLICIT_CONSTRUCTORS(ProcessInfoList); }; - ProcessInfo* ProcessInfoList::active_processes_ = NULL; Mutex* ProcessInfoList::mutex_ = new Mutex(); - // The exit code handler sets up a separate thread which waits for child // processes to terminate. That separate thread can then get the exit code from // processes that have exited and communicate it to Dart through the @@ -239,13 +234,11 @@ class ExitCodeHandler { DISALLOW_IMPLICIT_CONSTRUCTORS(ExitCodeHandler); }; - bool ExitCodeHandler::running_ = false; int ExitCodeHandler::process_count_ = 0; bool ExitCodeHandler::terminate_done_ = false; Monitor* ExitCodeHandler::monitor_ = new Monitor(); - class ProcessStarter { public: ProcessStarter(const char* path, @@ -298,7 +291,6 @@ class ProcessStarter { } } - int Start() { // Create pipes required. int err = CreatePipes(); @@ -431,7 +423,6 @@ class ProcessStarter { return 0; } - void NewProcess() { // Wait for parent process before setting up the child process. char msg; @@ -447,7 +438,6 @@ class ProcessStarter { } } - void ExecProcess() { if (TEMP_FAILURE_RETRY(dup2(write_out_[0], STDIN_FILENO)) == -1) { ReportChildError(); @@ -481,7 +471,6 @@ class ProcessStarter { ReportChildError(); } - void ExecDetachedProcess() { if (mode_ == kDetached) { ASSERT(write_out_[0] == -1); @@ -539,7 +528,6 @@ class ProcessStarter { } } - int RegisterProcess(pid_t pid) { int result; int event_fds[2]; @@ -556,7 +544,6 @@ class ProcessStarter { return 0; } - int ReadExecResult() { int child_errno; int bytes_read = -1; @@ -574,7 +561,6 @@ class ProcessStarter { return 0; } - int ReadDetachedExecResult(pid_t* pid) { int child_errno; int bytes_read = -1; @@ -597,7 +583,6 @@ class ProcessStarter { return 0; } - void SetupDetached() { ASSERT(mode_ == kDetached); @@ -660,7 +645,6 @@ class ProcessStarter { VOID_TEMP_FAILURE_RETRY(close(read_err_[1])); } - int CleanupAndReturnError() { int actual_errno = errno; // If CleanupAndReturnError is called without an actual errno make @@ -673,7 +657,6 @@ class ProcessStarter { return actual_errno; } - void SetChildOsErrorMessage() { const int kBufferSize = 1024; char* error_message = DartUtils::ScopedCString(kBufferSize); @@ -681,7 +664,6 @@ class ProcessStarter { *os_error_message_ = error_message; } - void ReportChildError() { // In the case of failure in the child process write the errno and // the OS error message to the exec control pipe and exit. @@ -699,7 +681,6 @@ class ProcessStarter { exit(1); } - void ReportPid(int pid) { // In the case of starting a detached process the actual pid of that process // is communicated using the exec control pipe. @@ -709,7 +690,6 @@ class ProcessStarter { USE(bytes_written); } - void ReadChildError() { const int kMaxMessageSize = 256; char* message = DartUtils::ScopedCString(kMaxMessageSize); @@ -723,7 +703,6 @@ class ProcessStarter { } } - void ClosePipe(int* fds) { for (int i = 0; i < 2; i++) { if (fds[i] != -1) { @@ -733,7 +712,6 @@ class ProcessStarter { } } - void CloseAllPipes() { ClosePipe(exec_control_); ClosePipe(read_in_); @@ -741,7 +719,6 @@ class ProcessStarter { ClosePipe(write_out_); } - int read_in_[2]; // Pipe for stdout to child process. int read_err_[2]; // Pipe for stderr to child process. int write_out_[2]; // Pipe for stdin to child process. @@ -764,7 +741,6 @@ class ProcessStarter { DISALLOW_IMPLICIT_CONSTRUCTORS(ProcessStarter); }; - int Process::Start(const char* path, char* arguments[], intptr_t arguments_length, @@ -784,7 +760,6 @@ int Process::Start(const char* path, return starter.Start(); } - static bool CloseProcessBuffers(struct pollfd fds[3]) { int e = errno; VOID_TEMP_FAILURE_RETRY(close(fds[0].fd)); @@ -794,7 +769,6 @@ static bool CloseProcessBuffers(struct pollfd fds[3]) { return false; } - bool Process::Wait(intptr_t pid, intptr_t in, intptr_t out, @@ -888,7 +862,6 @@ bool Process::Wait(intptr_t pid, return true; } - static int SignalMap(intptr_t id) { switch (static_cast(id)) { case kSighup: @@ -953,22 +926,18 @@ static int SignalMap(intptr_t id) { return -1; } - bool Process::Kill(intptr_t id, int signal) { return (TEMP_FAILURE_RETRY(kill(id, SignalMap(signal))) != -1); } - void Process::TerminateExitCodeHandler() { ExitCodeHandler::TerminateExitCodeThread(); } - intptr_t Process::CurrentProcessId() { return static_cast(getpid()); } - int64_t Process::CurrentRSS() { struct mach_task_basic_info info; mach_msg_type_number_t infoCount = MACH_TASK_BASIC_INFO_COUNT; @@ -981,7 +950,6 @@ int64_t Process::CurrentRSS() { return info.resident_size; } - int64_t Process::MaxRSS() { struct rusage usage; usage.ru_maxrss = 0; @@ -992,7 +960,6 @@ int64_t Process::MaxRSS() { return usage.ru_maxrss; } - static Mutex* signal_mutex = new Mutex(); static SignalInfo* signal_handlers = NULL; static const int kSignalsCount = 7; @@ -1001,12 +968,10 @@ static const int kSignals[kSignalsCount] = { SIGQUIT // Allow VMService to listen on SIGQUIT. }; - SignalInfo::~SignalInfo() { VOID_TEMP_FAILURE_RETRY(close(fd_)); } - static void SignalHandler(int signal) { MutexLocker lock(signal_mutex); const SignalInfo* handler = signal_handlers; @@ -1019,7 +984,6 @@ static void SignalHandler(int signal) { } } - intptr_t Process::SetSignalHandler(intptr_t signal) { signal = SignalMap(signal); if (signal == -1) { @@ -1075,7 +1039,6 @@ intptr_t Process::SetSignalHandler(intptr_t signal) { return fds[0]; } - void Process::ClearSignalHandler(intptr_t signal, Dart_Port port) { // Either the port is illegal or there is no current isolate, but not both. ASSERT((port != ILLEGAL_PORT) || (Dart_CurrentIsolate() == NULL)); diff --git a/runtime/bin/process_unsupported.cc b/runtime/bin/process_unsupported.cc index f73f82d210e..fd199919c72 100644 --- a/runtime/bin/process_unsupported.cc +++ b/runtime/bin/process_unsupported.cc @@ -26,79 +26,66 @@ void FUNCTION_NAME(Process_Start)(Dart_NativeArguments args) { DartUtils::NewInternalError("Process is not supported on this platform")); } - void FUNCTION_NAME(Process_Wait)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("Process is not supported on this platform")); } - void FUNCTION_NAME(Process_KillPid)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("Process is not supported on this platform")); } - void FUNCTION_NAME(Process_Exit)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("Process is not supported on this platform")); } - void FUNCTION_NAME(Process_SetExitCode)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("Process is not supported on this platform")); } - void FUNCTION_NAME(Process_GetExitCode)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("Process is not supported on this platform")); } - void FUNCTION_NAME(Process_Sleep)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("Process is not supported on this platform")); } - void FUNCTION_NAME(Process_Pid)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("Process is not supported on this platform")); } - void FUNCTION_NAME(Process_SetSignalHandler)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("Process is not supported on this platform")); } - void FUNCTION_NAME(Process_ClearSignalHandler)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("Process is not supported on this platform")); } - void FUNCTION_NAME(SystemEncodingToString)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("Process is not supported on this platform")); } - void FUNCTION_NAME(StringToSystemEncoding)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("Process is not supported on this platform")); } - void FUNCTION_NAME(ProcessInfo_CurrentRSS)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("Process is not supported on this platform")); } - void FUNCTION_NAME(ProcessInfo_MaxRSS)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewInternalError("Process is not supported on this platform")); diff --git a/runtime/bin/process_win.cc b/runtime/bin/process_win.cc index bcf0c79dc80..19378fa7e98 100644 --- a/runtime/bin/process_win.cc +++ b/runtime/bin/process_win.cc @@ -9,8 +9,8 @@ #include "bin/process.h" -#include // NOLINT #include // NOLINT +#include // NOLINT #include "bin/builtin.h" #include "bin/dartutils.h" @@ -82,7 +82,6 @@ class ProcessInfo { DISALLOW_COPY_AND_ASSIGN(ProcessInfo); }; - // Singly-linked list of ProcessInfo objects for all active processes // started from Dart. class ProcessInfoList { @@ -201,15 +200,12 @@ class ProcessInfoList { DISALLOW_IMPLICIT_CONSTRUCTORS(ProcessInfoList); }; - ProcessInfo* ProcessInfoList::active_processes_ = NULL; Mutex* ProcessInfoList::mutex_ = new Mutex(); - // Types of pipes to create. enum NamedPipeType { kInheritRead, kInheritWrite, kInheritNone }; - // Create a pipe for communicating with a new process. The handles array // will contain the read and write ends of the pipe. Based on the type // one of the handles will be inheritable. @@ -274,7 +270,6 @@ static bool CreateProcessPipe(HANDLE handles[2], return true; } - static void CloseProcessPipe(HANDLE handles[2]) { for (int i = kReadHandle; i < kWriteHandle; i++) { if (handles[i] != INVALID_HANDLE_VALUE) { @@ -286,7 +281,6 @@ static void CloseProcessPipe(HANDLE handles[2]) { } } - static void CloseProcessPipes(HANDLE handles1[2], HANDLE handles2[2], HANDLE handles3[2], @@ -297,7 +291,6 @@ static void CloseProcessPipes(HANDLE handles1[2], CloseProcessPipe(handles4); } - static int SetOsErrorMessage(char** os_error_message) { int error_code = GetLastError(); const int kMaxMessageLength = 256; @@ -307,7 +300,6 @@ static int SetOsErrorMessage(char** os_error_message) { return error_code; } - // Open an inheritable handle to NUL. static HANDLE OpenNul() { SECURITY_ATTRIBUTES inherit_handle; @@ -322,7 +314,6 @@ static HANDLE OpenNul() { return nul; } - typedef BOOL(WINAPI* InitProcThreadAttrListFn)(LPPROC_THREAD_ATTRIBUTE_LIST, DWORD, DWORD, @@ -338,12 +329,10 @@ typedef BOOL(WINAPI* UpdateProcThreadAttrFn)(LPPROC_THREAD_ATTRIBUTE_LIST, typedef VOID(WINAPI* DeleteProcThreadAttrListFn)(LPPROC_THREAD_ATTRIBUTE_LIST); - static InitProcThreadAttrListFn init_proc_thread_attr_list = NULL; static UpdateProcThreadAttrFn update_proc_thread_attr = NULL; static DeleteProcThreadAttrListFn delete_proc_thread_attr_list = NULL; - static bool EnsureInitialized() { static bool load_attempted = false; static Mutex* mutex = new Mutex(); @@ -365,7 +354,6 @@ static bool EnsureInitialized() { return (delete_proc_thread_attr_list != NULL); } - const int kMaxPipeNameSize = 80; template static int GenerateNames(wchar_t pipe_names[Count][kMaxPipeNameSize]) { @@ -391,7 +379,6 @@ static int GenerateNames(wchar_t pipe_names[Count][kMaxPipeNameSize]) { return 0; } - class ProcessStarter { public: ProcessStarter(const char* path, @@ -502,14 +489,12 @@ class ProcessStarter { attribute_list_ = NULL; } - ~ProcessStarter() { if (attribute_list_ != NULL) { delete_proc_thread_attr_list(attribute_list_); } } - int Start() { // Create pipes required. int err = CreatePipes(); @@ -607,7 +592,6 @@ class ProcessStarter { return 0; } - int CreatePipes() { // Generate unique pipe names for the four named pipes needed. wchar_t pipe_names[4][kMaxPipeNameSize]; @@ -652,7 +636,6 @@ class ProcessStarter { return 0; } - int CleanupAndReturnError() { int error_code = SetOsErrorMessage(os_error_message_); CloseProcessPipes(stdin_handles_, stdout_handles_, stderr_handles_, @@ -660,7 +643,6 @@ class ProcessStarter { return error_code; } - HANDLE stdin_handles_[2]; HANDLE stdout_handles_[2]; HANDLE stderr_handles_[2]; @@ -686,7 +668,6 @@ class ProcessStarter { DISALLOW_IMPLICIT_CONSTRUCTORS(ProcessStarter); }; - int Process::Start(const char* path, char* arguments[], intptr_t arguments_length, @@ -706,7 +687,6 @@ int Process::Start(const char* path, return starter.Start(); } - class BufferList : public BufferListBase { public: BufferList() : read_pending_(true) {} @@ -754,7 +734,6 @@ class BufferList : public BufferListBase { DISALLOW_COPY_AND_ASSIGN(BufferList); }; - class OverlappedHandle { public: OverlappedHandle() {} @@ -825,7 +804,6 @@ class OverlappedHandle { DISALLOW_COPY_AND_ASSIGN(OverlappedHandle); }; - bool Process::Wait(intptr_t pid, intptr_t in, intptr_t out, @@ -909,7 +887,6 @@ bool Process::Wait(intptr_t pid, return true; } - bool Process::Kill(intptr_t id, int signal) { USE(signal); // signal is not used on Windows. HANDLE process_handle; @@ -931,17 +908,14 @@ bool Process::Kill(intptr_t id, int signal) { return result ? true : false; } - void Process::TerminateExitCodeHandler() { // Nothing needs to be done on Windows. } - intptr_t Process::CurrentProcessId() { return static_cast(GetCurrentProcessId()); } - int64_t Process::CurrentRSS() { PROCESS_MEMORY_COUNTERS pmc; if (!GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) { @@ -950,7 +924,6 @@ int64_t Process::CurrentRSS() { return pmc.WorkingSetSize; } - int64_t Process::MaxRSS() { PROCESS_MEMORY_COUNTERS pmc; if (!GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) { @@ -959,18 +932,15 @@ int64_t Process::MaxRSS() { return pmc.PeakWorkingSetSize; } - static SignalInfo* signal_handlers = NULL; static Mutex* signal_mutex = new Mutex(); - SignalInfo::~SignalInfo() { FileHandle* file_handle = reinterpret_cast(fd_); file_handle->Close(); file_handle->Release(); } - BOOL WINAPI SignalHandler(DWORD signal) { MutexLocker lock(signal_mutex); const SignalInfo* handler = signal_handlers; @@ -986,7 +956,6 @@ BOOL WINAPI SignalHandler(DWORD signal) { return handled; } - intptr_t GetWinSignal(intptr_t signal) { switch (signal) { case kSighup: @@ -998,7 +967,6 @@ intptr_t GetWinSignal(intptr_t signal) { } } - intptr_t Process::SetSignalHandler(intptr_t signal) { signal = GetWinSignal(signal); if (signal == -1) { @@ -1042,7 +1010,6 @@ intptr_t Process::SetSignalHandler(intptr_t signal) { return reinterpret_cast(new FileHandle(fds[kReadHandle])); } - void Process::ClearSignalHandler(intptr_t signal, Dart_Port port) { signal = GetWinSignal(signal); if (signal == -1) { diff --git a/runtime/bin/run_vm_tests.cc b/runtime/bin/run_vm_tests.cc index a2472dce56f..00d2f8da3c8 100644 --- a/runtime/bin/run_vm_tests.cc +++ b/runtime/bin/run_vm_tests.cc @@ -53,21 +53,18 @@ static const char* kernel_snapshot = NULL; static int run_matches = 0; - void TestCase::Run() { OS::Print("Running test: %s\n", name()); (*run_)(); OS::Print("Done: %s\n", name()); } - void RawTestCase::Run() { OS::Print("Running test: %s\n", name()); (*run_)(); OS::Print("Done: %s\n", name()); } - void TestCaseBase::RunTest() { if (strcmp(run_filter, this->name()) == 0) { this->Run(); @@ -78,7 +75,6 @@ void TestCaseBase::RunTest() { } } - void Benchmark::RunBenchmark() { if ((run_filter == kAllBenchmarks) || (strcmp(run_filter, this->name()) == 0)) { @@ -92,7 +88,6 @@ void Benchmark::RunBenchmark() { } } - static void PrintUsage() { OS::PrintErr( "Usage: one of the following\n" @@ -111,7 +106,6 @@ static void PrintUsage() { return NULL; \ } - static Dart_Isolate CreateIsolateAndSetup(const char* script_uri, const char* main, const char* package_root, @@ -275,7 +269,6 @@ static int Main(int argc, const char** argv) { } // namespace dart - int main(int argc, const char** argv) { dart::bin::Platform::Exit(dart::Main(argc, argv)); } diff --git a/runtime/bin/secure_socket_filter.cc b/runtime/bin/secure_socket_filter.cc index c07eaad404f..868d06614b7 100644 --- a/runtime/bin/secure_socket_filter.cc +++ b/runtime/bin/secure_socket_filter.cc @@ -16,7 +16,6 @@ #include "bin/security_context.h" #include "platform/text_buffer.h" - // Return the error from the containing function if handle is an error handle. #define RETURN_IF_ERROR(handle) \ { \ @@ -48,7 +47,6 @@ static SSLFilter* GetFilter(Dart_NativeArguments args) { return filter; } - static void DeleteFilter(void* isolate_data, Dart_WeakPersistentHandle handle, void* context_pointer) { @@ -56,7 +54,6 @@ static void DeleteFilter(void* isolate_data, filter->Release(); } - static Dart_Handle SetFilter(Dart_NativeArguments args, SSLFilter* filter) { ASSERT(filter != NULL); Dart_Handle dart_this = Dart_GetNativeArgument(args, 0); @@ -71,7 +68,6 @@ static Dart_Handle SetFilter(Dart_NativeArguments args, SSLFilter* filter) { return Dart_Null(); } - void FUNCTION_NAME(SecureSocket_Init)(Dart_NativeArguments args) { Dart_Handle dart_this = ThrowIfError(Dart_GetNativeArgument(args, 0)); SSLFilter* filter = new SSLFilter(); @@ -89,7 +85,6 @@ void FUNCTION_NAME(SecureSocket_Init)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(SecureSocket_Connect)(Dart_NativeArguments args) { Dart_Handle host_name_object = ThrowIfError(Dart_GetNativeArgument(args, 1)); Dart_Handle context_object = ThrowIfError(Dart_GetNativeArgument(args, 2)); @@ -119,7 +114,6 @@ void FUNCTION_NAME(SecureSocket_Connect)(Dart_NativeArguments args) { require_client_certificate, protocols_handle); } - void FUNCTION_NAME(SecureSocket_Destroy)(Dart_NativeArguments args) { SSLFilter* filter = GetFilter(args); // There are two paths that can clean up an SSLFilter object. First, @@ -135,18 +129,15 @@ void FUNCTION_NAME(SecureSocket_Destroy)(Dart_NativeArguments args) { filter->Destroy(); } - void FUNCTION_NAME(SecureSocket_Handshake)(Dart_NativeArguments args) { GetFilter(args)->Handshake(); } - void FUNCTION_NAME(SecureSocket_GetSelectedProtocol)( Dart_NativeArguments args) { GetFilter(args)->GetSelectedProtocol(args); } - void FUNCTION_NAME(SecureSocket_Renegotiate)(Dart_NativeArguments args) { bool use_session_cache = DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 1)); @@ -158,7 +149,6 @@ void FUNCTION_NAME(SecureSocket_Renegotiate)(Dart_NativeArguments args) { require_client_certificate); } - void FUNCTION_NAME(SecureSocket_RegisterHandshakeCompleteCallback)( Dart_NativeArguments args) { Dart_Handle handshake_complete = @@ -170,7 +160,6 @@ void FUNCTION_NAME(SecureSocket_RegisterHandshakeCompleteCallback)( GetFilter(args)->RegisterHandshakeCompleteCallback(handshake_complete); } - void FUNCTION_NAME(SecureSocket_RegisterBadCertificateCallback)( Dart_NativeArguments args) { Dart_Handle callback = ThrowIfError(Dart_GetNativeArgument(args, 1)); @@ -181,13 +170,11 @@ void FUNCTION_NAME(SecureSocket_RegisterBadCertificateCallback)( GetFilter(args)->RegisterBadCertificateCallback(callback); } - void FUNCTION_NAME(SecureSocket_PeerCertificate)(Dart_NativeArguments args) { Dart_Handle cert = ThrowIfError(GetFilter(args)->PeerCertificate()); Dart_SetReturnValue(args, cert); } - void FUNCTION_NAME(SecureSocket_FilterPointer)(Dart_NativeArguments args) { SSLFilter* filter = GetFilter(args); // This filter pointer is passed to the IO Service thread. The IO Service @@ -197,7 +184,6 @@ void FUNCTION_NAME(SecureSocket_FilterPointer)(Dart_NativeArguments args) { Dart_SetReturnValue(args, Dart_NewInteger(filter_pointer)); } - /** * Pushes data through the SSL filter, reading and writing from circular * buffers shared with Dart. @@ -251,7 +237,6 @@ CObject* SSLFilter::ProcessFilterRequest(const CObjectArray& request) { } } - bool SSLFilter::ProcessAllBuffers(int starts[kNumBuffers], int ends[kNumBuffers], bool in_handshake) { @@ -324,7 +309,6 @@ bool SSLFilter::ProcessAllBuffers(int starts[kNumBuffers], return true; } - Dart_Handle SSLFilter::Init(Dart_Handle dart_this) { if (!library_initialized_) { InitializeLibrary(); @@ -342,7 +326,6 @@ Dart_Handle SSLFilter::Init(Dart_Handle dart_this) { return InitializeBuffers(dart_this); } - Dart_Handle SSLFilter::InitializeBuffers(Dart_Handle dart_this) { // Create SSLFilter buffers as ExternalUint8Array objects. Dart_Handle buffers_string = DartUtils::NewString("buffers"); @@ -421,7 +404,6 @@ Dart_Handle SSLFilter::InitializeBuffers(Dart_Handle dart_this) { return result; } - void SSLFilter::RegisterHandshakeCompleteCallback(Dart_Handle complete) { ASSERT(NULL == handshake_complete_); handshake_complete_ = Dart_NewPersistentHandle(complete); @@ -429,7 +411,6 @@ void SSLFilter::RegisterHandshakeCompleteCallback(Dart_Handle complete) { ASSERT(handshake_complete_ != NULL); } - void SSLFilter::RegisterBadCertificateCallback(Dart_Handle callback) { ASSERT(bad_certificate_callback_ != NULL); Dart_DeletePersistentHandle(bad_certificate_callback_); @@ -437,7 +418,6 @@ void SSLFilter::RegisterBadCertificateCallback(Dart_Handle callback) { ASSERT(bad_certificate_callback_ != NULL); } - Dart_Handle SSLFilter::PeerCertificate() { X509* ca = SSL_get_peer_certificate(ssl_); if (ca == NULL) { @@ -446,7 +426,6 @@ Dart_Handle SSLFilter::PeerCertificate() { return X509Helper::WrappedX509Certificate(ca); } - void SSLFilter::InitializeLibrary() { MutexLocker locker(mutex_); if (!library_initialized_) { @@ -457,7 +436,6 @@ void SSLFilter::InitializeLibrary() { } } - void SSLFilter::Connect(const char* hostname, SSLCertContext* context, bool is_server, @@ -539,7 +517,6 @@ void SSLFilter::Connect(const char* hostname, Handshake(); } - void SSLFilter::Handshake() { // Try and push handshake along. int status; @@ -582,7 +559,6 @@ void SSLFilter::Handshake() { } } - void SSLFilter::GetSelectedProtocol(Dart_NativeArguments args) { const uint8_t* protocol; unsigned length; @@ -594,7 +570,6 @@ void SSLFilter::GetSelectedProtocol(Dart_NativeArguments args) { } } - void SSLFilter::Renegotiate(bool use_session_cache, bool request_client_certificate, bool require_client_certificate) { @@ -606,7 +581,6 @@ void SSLFilter::Renegotiate(bool use_session_cache, // and triggering rehandshake. } - void SSLFilter::FreeResources() { if (ssl_ != NULL) { SSL_free(ssl_); @@ -628,12 +602,10 @@ void SSLFilter::FreeResources() { } } - SSLFilter::~SSLFilter() { FreeResources(); } - void SSLFilter::Destroy() { for (int i = 0; i < kNumBuffers; ++i) { if (dart_buffer_objects_[i] != NULL) { @@ -660,7 +632,6 @@ void SSLFilter::Destroy() { FreeResources(); } - /* Read decrypted data from the filter to the circular buffer */ int SSLFilter::ProcessReadPlaintextBuffer(int start, int end) { int length = end - start; @@ -678,7 +649,6 @@ int SSLFilter::ProcessReadPlaintextBuffer(int start, int end) { return bytes_processed; } - int SSLFilter::ProcessWritePlaintextBuffer(int start, int end) { int length = end - start; int bytes_processed = @@ -692,7 +662,6 @@ int SSLFilter::ProcessWritePlaintextBuffer(int start, int end) { return bytes_processed; } - /* Read encrypted data from the circular buffer to the filter */ int SSLFilter::ProcessReadEncryptedBuffer(int start, int end) { int length = end - start; @@ -717,7 +686,6 @@ int SSLFilter::ProcessReadEncryptedBuffer(int start, int end) { return bytes_processed; } - int SSLFilter::ProcessWriteEncryptedBuffer(int start, int end) { int length = end - start; int bytes_processed = 0; diff --git a/runtime/bin/secure_socket_unsupported.cc b/runtime/bin/secure_socket_unsupported.cc index e07ea5e4833..96b84e63154 100644 --- a/runtime/bin/secure_socket_unsupported.cc +++ b/runtime/bin/secure_socket_unsupported.cc @@ -19,160 +19,135 @@ void FUNCTION_NAME(SecureSocket_Init)(Dart_NativeArguments args) { "Secure Sockets unsupported on this platform")); } - void FUNCTION_NAME(SecureSocket_Connect)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewDartArgumentError( "Secure Sockets unsupported on this platform")); } - void FUNCTION_NAME(SecureSocket_AddCertificate)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewDartArgumentError( "Secure Sockets unsupported on this platform")); } - void FUNCTION_NAME(SecureSocket_Destroy)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewDartArgumentError( "Secure Sockets unsupported on this platform")); } - void FUNCTION_NAME(SecureSocket_Handshake)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewDartArgumentError( "Secure Sockets unsupported on this platform")); } - void FUNCTION_NAME(SecureSocket_GetSelectedProtocol)( Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewDartArgumentError( "Secure Sockets unsupported on this platform")); } - void FUNCTION_NAME(SecureSocket_RegisterHandshakeCompleteCallback)( Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewDartArgumentError( "Secure Sockets unsupported on this platform")); } - void FUNCTION_NAME(SecureSocket_RegisterBadCertificateCallback)( Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewDartArgumentError( "Secure Sockets unsupported on this platform")); } - void FUNCTION_NAME(SecureSocket_ProcessBuffer)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewDartArgumentError( "Secure Sockets unsupported on this platform")); } - void FUNCTION_NAME(SecureSocket_InitializeLibrary)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewDartArgumentError( "Secure Sockets unsupported on this platform")); } - void FUNCTION_NAME(SecureSocket_PeerCertificate)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewDartArgumentError( "Secure Sockets unsupported on this platform")); } - void FUNCTION_NAME(SecureSocket_FilterPointer)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewDartArgumentError( "Secure Sockets unsupported on this platform")); } - void FUNCTION_NAME(SecureSocket_Renegotiate)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewDartArgumentError( "Secure Sockets unsupported on this platform")); } - void FUNCTION_NAME(SecureSocket_NewServicePort)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewDartArgumentError( "Secure Sockets unsupported on this platform")); } - void FUNCTION_NAME(SecurityContext_Allocate)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewDartArgumentError( "Secure Sockets unsupported on this platform")); } - void FUNCTION_NAME(SecurityContext_UsePrivateKeyBytes)( Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewDartArgumentError( "Secure Sockets unsupported on this platform")); } - void FUNCTION_NAME(SecurityContext_SetAlpnProtocols)( Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewDartArgumentError( "Secure Sockets unsupported on this platform")); } - void FUNCTION_NAME(SecurityContext_SetClientAuthoritiesBytes)( Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewDartArgumentError( "Secure Sockets unsupported on this platform")); } - void FUNCTION_NAME(SecurityContext_SetTrustedCertificatesBytes)( Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewDartArgumentError( "Secure Sockets unsupported on this platform")); } - void FUNCTION_NAME(SecurityContext_TrustBuiltinRoots)( Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewDartArgumentError( "Secure Sockets unsupported on this platform")); } - void FUNCTION_NAME(SecurityContext_UseCertificateChainBytes)( Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewDartArgumentError( "Secure Sockets unsupported on this platform")); } - void FUNCTION_NAME(X509_Subject)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewDartArgumentError( "Secure Sockets unsupported on this platform")); } - void FUNCTION_NAME(X509_Issuer)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewDartArgumentError( "Secure Sockets unsupported on this platform")); } - void FUNCTION_NAME(X509_StartValidity)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewDartArgumentError( "Secure Sockets unsupported on this platform")); } - void FUNCTION_NAME(X509_EndValidity)(Dart_NativeArguments args) { Dart_ThrowException(DartUtils::NewDartArgumentError( "Secure Sockets unsupported on this platform")); } - class SSLFilter { public: static CObject* ProcessFilterRequest(const CObjectArray& request); diff --git a/runtime/bin/secure_socket_utils.cc b/runtime/bin/secure_socket_utils.cc index 4ed1a676c6e..23079a6a900 100644 --- a/runtime/bin/secure_socket_utils.cc +++ b/runtime/bin/secure_socket_utils.cc @@ -45,7 +45,6 @@ void SecureSocketUtils::FetchErrorString(const SSL* ssl, } } - // Handle an error reported from the BoringSSL library. void SecureSocketUtils::ThrowIOException(int status, const char* exception_type, @@ -65,7 +64,6 @@ void SecureSocketUtils::ThrowIOException(int status, UNREACHABLE(); } - void SecureSocketUtils::CheckStatusSSL(int status, const char* type, const char* message, @@ -85,7 +83,6 @@ void SecureSocketUtils::CheckStatusSSL(int status, SecureSocketUtils::ThrowIOException(status, type, message, ssl); } - void SecureSocketUtils::CheckStatus(int status, const char* type, const char* message) { diff --git a/runtime/bin/secure_socket_utils.h b/runtime/bin/secure_socket_utils.h index 50a8ad5a1c0..43ba93a6b73 100644 --- a/runtime/bin/secure_socket_utils.h +++ b/runtime/bin/secure_socket_utils.h @@ -48,7 +48,6 @@ class SecureSocketUtils : public AllStatic { static void FetchErrorString(const SSL* ssl, TextBuffer* text_buffer); }; - // Where the argument to the constructor is the handle for an object // implementing List, this class creates a scope in which a memory-backed // BIO is allocated. Leaving the scope cleans up the BIO and the buffer that @@ -169,7 +168,6 @@ class ScopedSSLStackType { DISALLOW_COPY_AND_ASSIGN(ScopedSSLStackType); }; - typedef ScopedSSLType ScopedPKCS12; typedef ScopedSSLType ScopedX509; typedef ScopedSSLStackType ScopedX509Stack; diff --git a/runtime/bin/security_context.cc b/runtime/bin/security_context.cc index 57040d5bdaf..d147740a6c3 100644 --- a/runtime/bin/security_context.cc +++ b/runtime/bin/security_context.cc @@ -76,7 +76,6 @@ int SSLCertContext::CertificateCallback(int preverify_ok, return DartUtils::GetBooleanValue(result); } - SSLCertContext* SSLCertContext::GetSecurityContext(Dart_NativeArguments args) { SSLCertContext* context; Dart_Handle dart_this = ThrowIfError(Dart_GetNativeArgument(args, 0)); @@ -87,7 +86,6 @@ SSLCertContext* SSLCertContext::GetSecurityContext(Dart_NativeArguments args) { return context; } - static void DeleteSecurityContext(void* isolate_data, Dart_WeakPersistentHandle handle, void* context_pointer) { @@ -95,7 +93,6 @@ static void DeleteSecurityContext(void* isolate_data, context->Release(); } - static Dart_Handle SetSecurityContext(Dart_NativeArguments args, SSLCertContext* context) { Dart_Handle dart_this = Dart_GetNativeArgument(args, 0); @@ -111,7 +108,6 @@ static Dart_Handle SetSecurityContext(Dart_NativeArguments args, return Dart_Null(); } - static void ReleaseCertificate(void* isolate_data, Dart_WeakPersistentHandle handle, void* context_pointer) { @@ -119,13 +115,11 @@ static void ReleaseCertificate(void* isolate_data, X509_free(cert); } - static intptr_t EstimateX509Size(X509* certificate) { intptr_t length = i2d_X509(certificate, NULL); return length > 0 ? length : 0; } - // Returns the handle for a Dart object wrapping the X509 certificate object. // The caller should own a reference to the X509 object whose reference count // won't drop to zero before the ReleaseCertificate finalizer runs. @@ -163,7 +157,6 @@ Dart_Handle X509Helper::WrappedX509Certificate(X509* certificate) { return result; } - static int SetTrustedCertificatesBytesPKCS12(SSL_CTX* context, BIO* bio, const char* password) { @@ -202,7 +195,6 @@ static int SetTrustedCertificatesBytesPKCS12(SSL_CTX* context, return status; } - static int SetTrustedCertificatesBytesPEM(SSL_CTX* context, BIO* bio) { X509_STORE* store = SSL_CTX_get_cert_store(context); @@ -225,7 +217,6 @@ static int SetTrustedCertificatesBytesPEM(SSL_CTX* context, BIO* bio) { return SecureSocketUtils::NoPEMStartLine() ? status : 0; } - void SSLCertContext::SetTrustedCertificatesBytes(Dart_Handle cert_bytes, const char* password) { int status = 0; @@ -248,7 +239,6 @@ void SSLCertContext::SetTrustedCertificatesBytes(Dart_Handle cert_bytes, "Failure trusting builtin roots"); } - static int SetClientAuthoritiesPKCS12(SSL_CTX* context, BIO* bio, const char* password) { @@ -286,7 +276,6 @@ static int SetClientAuthoritiesPKCS12(SSL_CTX* context, return status; } - static int SetClientAuthoritiesPEM(SSL_CTX* context, BIO* bio) { int status = 0; X509* cert = NULL; @@ -300,7 +289,6 @@ static int SetClientAuthoritiesPEM(SSL_CTX* context, BIO* bio) { return SecureSocketUtils::NoPEMStartLine() ? status : 0; } - static int SetClientAuthorities(SSL_CTX* context, BIO* bio, const char* password) { @@ -318,7 +306,6 @@ static int SetClientAuthorities(SSL_CTX* context, return status; } - void SSLCertContext::SetClientAuthoritiesBytes( Dart_Handle client_authorities_bytes, const char* password) { @@ -348,7 +335,6 @@ void SSLCertContext::LoadRootCertFile(const char* file) { } } - void SSLCertContext::AddCompiledInCerts() { if (root_certificates_pem == NULL) { if (SSL_LOG_STATUS) { @@ -379,7 +365,6 @@ void SSLCertContext::AddCompiledInCerts() { ERR_clear_error(); } - void SSLCertContext::LoadRootCertCache(const char* cache) { if (SSL_LOG_STATUS) { Log::Print("Looking for trusted roots in %s\n", cache); @@ -396,7 +381,6 @@ void SSLCertContext::LoadRootCertCache(const char* cache) { } } - int PasswordCallback(char* buf, int size, int rwflag, void* userdata) { char* password = static_cast(userdata); ASSERT(size == PEM_BUFSIZE); @@ -404,7 +388,6 @@ int PasswordCallback(char* buf, int size, int rwflag, void* userdata) { return strlen(password); } - static EVP_PKEY* GetPrivateKeyPKCS12(BIO* bio, const char* password) { ScopedPKCS12 p12(d2i_PKCS12_bio(bio, NULL)); if (p12.get() == NULL) { @@ -425,7 +408,6 @@ static EVP_PKEY* GetPrivateKeyPKCS12(BIO* bio, const char* password) { return key; } - static EVP_PKEY* GetPrivateKey(BIO* bio, const char* password) { EVP_PKEY* key = PEM_read_bio_PrivateKey(bio, NULL, PasswordCallback, const_cast(password)); @@ -446,7 +428,6 @@ static EVP_PKEY* GetPrivateKey(BIO* bio, const char* password) { return key; } - const char* SSLCertContext::GetPasswordArgument(Dart_NativeArguments args, intptr_t index) { Dart_Handle password_object = @@ -467,7 +448,6 @@ const char* SSLCertContext::GetPasswordArgument(Dart_NativeArguments args, return password; } - int AlpnCallback(SSL* ssl, const uint8_t** out, uint8_t* outlen, @@ -497,7 +477,6 @@ int AlpnCallback(SSL* ssl, return SSL_TLSEXT_ERR_NOACK; } - // Sets the protocol list for ALPN on a SSL object or a context. void SSLCertContext::SetAlpnProtocolList(Dart_Handle protocols_handle, SSL* ssl, @@ -556,7 +535,6 @@ void SSLCertContext::SetAlpnProtocolList(Dart_Handle protocols_handle, Dart_TypedDataReleaseData(protocols_handle); } - static int UseChainBytesPKCS12(SSL_CTX* context, BIO* bio, const char* password) { @@ -600,7 +578,6 @@ static int UseChainBytesPKCS12(SSL_CTX* context, return status; } - static int UseChainBytesPEM(SSL_CTX* context, BIO* bio) { int status = 0; ScopedX509 x509(PEM_read_bio_X509_AUX(bio, NULL, NULL, NULL)); @@ -636,7 +613,6 @@ static int UseChainBytesPEM(SSL_CTX* context, BIO* bio) { return SecureSocketUtils::NoPEMStartLine() ? status : 0; } - static int UseChainBytes(SSL_CTX* context, BIO* bio, const char* password) { int status = UseChainBytesPEM(context, bio); if (status == 0) { @@ -652,14 +628,12 @@ static int UseChainBytes(SSL_CTX* context, BIO* bio, const char* password) { return status; } - int SSLCertContext::UseCertificateChainBytes(Dart_Handle cert_chain_bytes, const char* password) { ScopedMemBIO bio(cert_chain_bytes); return UseChainBytes(context(), bio.bio(), password); } - static X509* GetX509Certificate(Dart_NativeArguments args) { X509* certificate = NULL; Dart_Handle dart_this = ThrowIfError(Dart_GetNativeArgument(args, 0)); @@ -670,7 +644,6 @@ static X509* GetX509Certificate(Dart_NativeArguments args) { return certificate; } - Dart_Handle X509Helper::GetSubject(Dart_NativeArguments args) { X509* certificate = GetX509Certificate(args); X509_NAME* subject = X509_get_subject_name(certificate); @@ -684,7 +657,6 @@ Dart_Handle X509Helper::GetSubject(Dart_NativeArguments args) { return subject_handle; } - Dart_Handle X509Helper::GetIssuer(Dart_NativeArguments args) { fprintf(stdout, "Getting issuer!\n"); X509* certificate = GetX509Certificate(args); @@ -699,7 +671,6 @@ Dart_Handle X509Helper::GetIssuer(Dart_NativeArguments args) { return issuer_handle; } - static Dart_Handle ASN1TimeToMilliseconds(ASN1_TIME* aTime) { ASN1_UTCTIME* epoch_start = M_ASN1_UTCTIME_new(); ASN1_UTCTIME_set_string(epoch_start, "700101000000Z"); @@ -714,14 +685,12 @@ static Dart_Handle ASN1TimeToMilliseconds(ASN1_TIME* aTime) { return Dart_NewInteger((86400LL * days + seconds) * 1000LL); } - Dart_Handle X509Helper::GetStartValidity(Dart_NativeArguments args) { X509* certificate = GetX509Certificate(args); ASN1_TIME* not_before = X509_get_notBefore(certificate); return ASN1TimeToMilliseconds(not_before); } - Dart_Handle X509Helper::GetEndValidity(Dart_NativeArguments args) { X509* certificate = GetX509Certificate(args); ASN1_TIME* not_after = X509_get_notAfter(certificate); @@ -751,7 +720,6 @@ void FUNCTION_NAME(SecurityContext_UsePrivateKeyBytes)( "Failure in usePrivateKeyBytes"); } - void FUNCTION_NAME(SecurityContext_Allocate)(Dart_NativeArguments args) { SSLFilter::InitializeLibrary(); SSL_CTX* ctx = SSL_CTX_new(TLS_method()); @@ -766,7 +734,6 @@ void FUNCTION_NAME(SecurityContext_Allocate)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(SecurityContext_SetTrustedCertificatesBytes)( Dart_NativeArguments args) { SSLCertContext* context = SSLCertContext::GetSecurityContext(args); @@ -778,7 +745,6 @@ void FUNCTION_NAME(SecurityContext_SetTrustedCertificatesBytes)( context->SetTrustedCertificatesBytes(cert_bytes, password); } - void FUNCTION_NAME(SecurityContext_SetClientAuthoritiesBytes)( Dart_NativeArguments args) { SSLCertContext* context = SSLCertContext::GetSecurityContext(args); @@ -792,7 +758,6 @@ void FUNCTION_NAME(SecurityContext_SetClientAuthoritiesBytes)( context->SetClientAuthoritiesBytes(client_authorities_bytes, password); } - void FUNCTION_NAME(SecurityContext_UseCertificateChainBytes)( Dart_NativeArguments args) { SSLCertContext* context = SSLCertContext::GetSecurityContext(args); @@ -808,7 +773,6 @@ void FUNCTION_NAME(SecurityContext_UseCertificateChainBytes)( "Failure in useCertificateChainBytes"); } - void FUNCTION_NAME(SecurityContext_TrustBuiltinRoots)( Dart_NativeArguments args) { SSLCertContext* context = SSLCertContext::GetSecurityContext(args); @@ -818,27 +782,22 @@ void FUNCTION_NAME(SecurityContext_TrustBuiltinRoots)( context->TrustBuiltinRoots(); } - void FUNCTION_NAME(X509_Subject)(Dart_NativeArguments args) { Dart_SetReturnValue(args, X509Helper::GetSubject(args)); } - void FUNCTION_NAME(X509_Issuer)(Dart_NativeArguments args) { Dart_SetReturnValue(args, X509Helper::GetIssuer(args)); } - void FUNCTION_NAME(X509_StartValidity)(Dart_NativeArguments args) { Dart_SetReturnValue(args, X509Helper::GetStartValidity(args)); } - void FUNCTION_NAME(X509_EndValidity)(Dart_NativeArguments args) { Dart_SetReturnValue(args, X509Helper::GetEndValidity(args)); } - void FUNCTION_NAME(SecurityContext_SetAlpnProtocols)( Dart_NativeArguments args) { SSLCertContext* context = SSLCertContext::GetSecurityContext(args); diff --git a/runtime/bin/security_context.h b/runtime/bin/security_context.h index eaba5a5d071..3d568cbc36f 100644 --- a/runtime/bin/security_context.h +++ b/runtime/bin/security_context.h @@ -88,7 +88,6 @@ class SSLCertContext : public ReferenceCounted { DISALLOW_COPY_AND_ASSIGN(SSLCertContext); }; - class X509Helper : public AllStatic { public: static Dart_Handle GetSubject(Dart_NativeArguments args); diff --git a/runtime/bin/security_context_android.cc b/runtime/bin/security_context_android.cc index dc4eaf8da5b..a0e95fcff2f 100644 --- a/runtime/bin/security_context_android.cc +++ b/runtime/bin/security_context_android.cc @@ -56,7 +56,6 @@ void SSLCertContext::TrustBuiltinRoots() { return; } - void SSLCertContext::RegisterCallbacks(SSL* ssl) { // No callbacks to register for implementations using BoringSSL's built-in // verification mechanism. diff --git a/runtime/bin/security_context_fuchsia.cc b/runtime/bin/security_context_fuchsia.cc index 386ad5e7df6..155dfa0994b 100644 --- a/runtime/bin/security_context_fuchsia.cc +++ b/runtime/bin/security_context_fuchsia.cc @@ -52,7 +52,6 @@ void SSLCertContext::TrustBuiltinRoots() { LoadRootCertFile(bundle); } - void SSLCertContext::RegisterCallbacks(SSL* ssl) { // No callbacks to register for implementations using BoringSSL's built-in // verification mechanism. diff --git a/runtime/bin/security_context_linux.cc b/runtime/bin/security_context_linux.cc index 2985fff4808..e1168bb0f92 100644 --- a/runtime/bin/security_context_linux.cc +++ b/runtime/bin/security_context_linux.cc @@ -69,7 +69,6 @@ void SSLCertContext::TrustBuiltinRoots() { AddCompiledInCerts(); } - void SSLCertContext::RegisterCallbacks(SSL* ssl) { // No callbacks to register for implementations using BoringSSL's built-in // verification mechanism. diff --git a/runtime/bin/security_context_macos.cc b/runtime/bin/security_context_macos.cc index 9a63738a0c5..35013ca515a 100644 --- a/runtime/bin/security_context_macos.cc +++ b/runtime/bin/security_context_macos.cc @@ -72,7 +72,6 @@ static SecCertificateRef CreateSecCertificateFromX509(X509* cert) { return auth_cert; } - static int CertificateVerificationCallback(X509_STORE_CTX* ctx, void* arg) { SSLCertContext* context = static_cast(arg); @@ -163,13 +162,11 @@ static int CertificateVerificationCallback(X509_STORE_CTX* ctx, void* arg) { return ctx->verify_cb(0, ctx); } - void SSLCertContext::RegisterCallbacks(SSL* ssl) { SSL_CTX* ctx = SSL_get_SSL_CTX(ssl); SSL_CTX_set_cert_verify_callback(ctx, CertificateVerificationCallback, this); } - void SSLCertContext::TrustBuiltinRoots() { // First, try to use locations specified on the command line. if (commandline_root_certs_file != NULL) { diff --git a/runtime/bin/security_context_win.cc b/runtime/bin/security_context_win.cc index 2c228c30106..1aed6d5f08c 100644 --- a/runtime/bin/security_context_win.cc +++ b/runtime/bin/security_context_win.cc @@ -52,7 +52,6 @@ void SSLCertContext::TrustBuiltinRoots() { AddCompiledInCerts(); } - void SSLCertContext::RegisterCallbacks(SSL* ssl) { // No callbacks to register for implementations using BoringSSL's built-in // verification mechanism. diff --git a/runtime/bin/snapshot_utils.cc b/runtime/bin/snapshot_utils.cc index e6776ef662e..e6ea9c7ceb9 100644 --- a/runtime/bin/snapshot_utils.cc +++ b/runtime/bin/snapshot_utils.cc @@ -71,7 +71,6 @@ class MappedAppSnapshot : public AppSnapshot { MappedMemory* isolate_instructions_mapping_; }; - static AppSnapshot* TryReadAppSnapshotBlobs(const char* script_name) { File* file = File::Open(script_name, File::kRead); if (file == NULL) { @@ -154,7 +153,6 @@ static AppSnapshot* TryReadAppSnapshotBlobs(const char* script_name) { isolate_data_mapping, isolate_instr_mapping); } - #if defined(DART_PRECOMPILED_RUNTIME) class DylibAppSnapshot : public AppSnapshot { public: @@ -189,7 +187,6 @@ class DylibAppSnapshot : public AppSnapshot { const uint8_t* isolate_snapshot_instructions_; }; - static AppSnapshot* TryReadAppSnapshotDynamicLibrary(const char* script_name) { void* library = Extensions::LoadExtensionLibrary(script_name); if (library == NULL) { @@ -228,7 +225,6 @@ static AppSnapshot* TryReadAppSnapshotDynamicLibrary(const char* script_name) { } #endif // defined(DART_PRECOMPILED_RUNTIME) - AppSnapshot* Snapshot::TryReadAppSnapshot(const char* script_name) { if (File::GetType(script_name, true) != File::kIsFile) { // If 'script_name' refers to a pipe, don't read to check for an app @@ -251,7 +247,6 @@ AppSnapshot* Snapshot::TryReadAppSnapshot(const char* script_name) { return NULL; } - static void WriteSnapshotFile(const char* filename, bool write_magic_number, const uint8_t* buffer, @@ -274,12 +269,10 @@ static void WriteSnapshotFile(const char* filename, file->Release(); } - static bool WriteInt64(File* file, int64_t size) { return file->WriteFully(&size, sizeof(size)); } - static void WriteAppSnapshot(const char* filename, uint8_t* vm_data_buffer, intptr_t vm_data_size, @@ -332,7 +325,6 @@ static void WriteAppSnapshot(const char* filename, file->Release(); } - void Snapshot::GenerateScript(const char* snapshot_filename) { // First create a snapshot. uint8_t* buffer = NULL; @@ -345,7 +337,6 @@ void Snapshot::GenerateScript(const char* snapshot_filename) { WriteSnapshotFile(snapshot_filename, true, buffer, size); } - void Snapshot::GenerateAppJIT(const char* snapshot_filename) { #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_DBC) // Snapshots with code are not supported on IA32 or DBC. @@ -377,7 +368,6 @@ void Snapshot::GenerateAppJIT(const char* snapshot_filename) { #endif } - void Snapshot::GenerateAppAOTAsBlobs(const char* snapshot_filename) { uint8_t* vm_data_buffer = NULL; intptr_t vm_data_size = 0; @@ -400,7 +390,6 @@ void Snapshot::GenerateAppAOTAsBlobs(const char* snapshot_filename) { isolate_instructions_buffer, isolate_instructions_size); } - void Snapshot::GenerateAppAOTAsAssembly(const char* snapshot_filename) { uint8_t* assembly_buffer = NULL; intptr_t assembly_size = 0; diff --git a/runtime/bin/socket.cc b/runtime/bin/socket.cc index 89d5459db32..3f4ac033222 100644 --- a/runtime/bin/socket.cc +++ b/runtime/bin/socket.cc @@ -35,18 +35,15 @@ void ListeningSocketRegistry::Initialize() { globalTcpListeningSocketRegistry = new ListeningSocketRegistry(); } - ListeningSocketRegistry* ListeningSocketRegistry::Instance() { return globalTcpListeningSocketRegistry; } - void ListeningSocketRegistry::Cleanup() { delete globalTcpListeningSocketRegistry; globalTcpListeningSocketRegistry = NULL; } - ListeningSocketRegistry::OSSocket* ListeningSocketRegistry::LookupByPort( intptr_t port) { HashMap::Entry* entry = sockets_by_port_.Lookup( @@ -57,7 +54,6 @@ ListeningSocketRegistry::OSSocket* ListeningSocketRegistry::LookupByPort( return reinterpret_cast(entry->value); } - void ListeningSocketRegistry::InsertByPort(intptr_t port, OSSocket* socket) { HashMap::Entry* entry = sockets_by_port_.Lookup( GetHashmapKeyFromIntptr(port), GetHashmapHashFromIntptr(port), true); @@ -65,13 +61,11 @@ void ListeningSocketRegistry::InsertByPort(intptr_t port, OSSocket* socket) { entry->value = reinterpret_cast(socket); } - void ListeningSocketRegistry::RemoveByPort(intptr_t port) { sockets_by_port_.Remove(GetHashmapKeyFromIntptr(port), GetHashmapHashFromIntptr(port)); } - ListeningSocketRegistry::OSSocket* ListeningSocketRegistry::LookupByFd( Socket* fd) { HashMap::Entry* entry = sockets_by_fd_.Lookup( @@ -83,7 +77,6 @@ ListeningSocketRegistry::OSSocket* ListeningSocketRegistry::LookupByFd( return reinterpret_cast(entry->value); } - void ListeningSocketRegistry::InsertByFd(Socket* fd, OSSocket* socket) { HashMap::Entry* entry = sockets_by_fd_.Lookup( GetHashmapKeyFromIntptr(reinterpret_cast(fd)), @@ -92,14 +85,12 @@ void ListeningSocketRegistry::InsertByFd(Socket* fd, OSSocket* socket) { entry->value = reinterpret_cast(socket); } - void ListeningSocketRegistry::RemoveByFd(Socket* fd) { sockets_by_fd_.Remove( GetHashmapKeyFromIntptr(reinterpret_cast(fd)), GetHashmapHashFromIntptr(reinterpret_cast(fd))); } - Dart_Handle ListeningSocketRegistry::CreateBindListen(Dart_Handle socket_object, RawAddr addr, intptr_t backlog, @@ -204,7 +195,6 @@ Dart_Handle ListeningSocketRegistry::CreateBindListen(Dart_Handle socket_object, return Dart_True(); } - bool ListeningSocketRegistry::CloseOneSafe(OSSocket* os_socket, bool update_hash_maps) { ASSERT(!mutex_->TryLock()); @@ -243,7 +233,6 @@ bool ListeningSocketRegistry::CloseOneSafe(OSSocket* os_socket, return true; } - void ListeningSocketRegistry::CloseAllSafe() { MutexLocker ml(mutex_); @@ -253,7 +242,6 @@ void ListeningSocketRegistry::CloseAllSafe() { } } - bool ListeningSocketRegistry::CloseSafe(Socket* socketfd) { ASSERT(!mutex_->TryLock()); OSSocket* os_socket = LookupByFd(socketfd); @@ -267,7 +255,6 @@ bool ListeningSocketRegistry::CloseSafe(Socket* socketfd) { } } - void FUNCTION_NAME(Socket_CreateConnect)(Dart_NativeArguments args) { RawAddr addr; SocketAddress::GetSockAddr(Dart_GetNativeArgument(args, 1), &addr); @@ -285,7 +272,6 @@ void FUNCTION_NAME(Socket_CreateConnect)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Socket_CreateBindConnect)(Dart_NativeArguments args) { RawAddr addr; SocketAddress::GetSockAddr(Dart_GetNativeArgument(args, 1), &addr); @@ -305,7 +291,6 @@ void FUNCTION_NAME(Socket_CreateBindConnect)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Socket_CreateBindDatagram)(Dart_NativeArguments args) { RawAddr addr; SocketAddress::GetSockAddr(Dart_GetNativeArgument(args, 1), &addr); @@ -324,7 +309,6 @@ void FUNCTION_NAME(Socket_CreateBindDatagram)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Socket_Available)(Dart_NativeArguments args) { Socket* socket = Socket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0)); @@ -338,7 +322,6 @@ void FUNCTION_NAME(Socket_Available)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Socket_Read)(Dart_NativeArguments args) { Socket* socket = Socket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0)); @@ -380,7 +363,6 @@ void FUNCTION_NAME(Socket_Read)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Socket_RecvFrom)(Dart_NativeArguments args) { Socket* socket = Socket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0)); @@ -451,7 +433,6 @@ void FUNCTION_NAME(Socket_RecvFrom)(Dart_NativeArguments args) { Dart_SetReturnValue(args, result); } - void FUNCTION_NAME(Socket_WriteList)(Dart_NativeArguments args) { Socket* socket = Socket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0)); @@ -495,7 +476,6 @@ void FUNCTION_NAME(Socket_WriteList)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Socket_SendTo)(Dart_NativeArguments args) { Socket* socket = Socket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0)); @@ -532,7 +512,6 @@ void FUNCTION_NAME(Socket_SendTo)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Socket_GetPort)(Dart_NativeArguments args) { Socket* socket = Socket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0)); @@ -545,7 +524,6 @@ void FUNCTION_NAME(Socket_GetPort)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Socket_GetRemotePeer)(Dart_NativeArguments args) { Socket* socket = Socket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0)); @@ -571,7 +549,6 @@ void FUNCTION_NAME(Socket_GetRemotePeer)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Socket_GetError)(Dart_NativeArguments args) { Socket* socket = Socket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0)); @@ -580,7 +557,6 @@ void FUNCTION_NAME(Socket_GetError)(Dart_NativeArguments args) { Dart_SetReturnValue(args, DartUtils::NewDartOSError(&os_error)); } - void FUNCTION_NAME(Socket_GetType)(Dart_NativeArguments args) { Socket* socket = Socket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0)); @@ -593,7 +569,6 @@ void FUNCTION_NAME(Socket_GetType)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Socket_GetStdioHandle)(Dart_NativeArguments args) { int64_t num = DartUtils::GetInt64ValueCheckRange(Dart_GetNativeArgument(args, 1), 0, 2); @@ -603,7 +578,6 @@ void FUNCTION_NAME(Socket_GetStdioHandle)(Dart_NativeArguments args) { Dart_SetReturnValue(args, Dart_NewBoolean(socket >= 0)); } - void FUNCTION_NAME(Socket_GetSocketId)(Dart_NativeArguments args) { Socket* socket = Socket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0)); @@ -611,14 +585,12 @@ void FUNCTION_NAME(Socket_GetSocketId)(Dart_NativeArguments args) { Dart_SetReturnValue(args, Dart_NewInteger(id)); } - void FUNCTION_NAME(Socket_SetSocketId)(Dart_NativeArguments args) { intptr_t id = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1)); Socket::SetSocketIdNativeField(Dart_GetNativeArgument(args, 0), id, Socket::kFinalizerNormal); } - void FUNCTION_NAME(ServerSocket_CreateBindListen)(Dart_NativeArguments args) { RawAddr addr; SocketAddress::GetSockAddr(Dart_GetNativeArgument(args, 1), &addr); @@ -636,7 +608,6 @@ void FUNCTION_NAME(ServerSocket_CreateBindListen)(Dart_NativeArguments args) { Dart_SetReturnValue(args, result); } - void FUNCTION_NAME(ServerSocket_Accept)(Dart_NativeArguments args) { Socket* socket = Socket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0)); @@ -652,7 +623,6 @@ void FUNCTION_NAME(ServerSocket_Accept)(Dart_NativeArguments args) { } } - CObject* Socket::LookupRequest(const CObjectArray& request) { if ((request.Length() == 2) && request[0]->IsString() && request[1]->IsInt32()) { @@ -695,7 +665,6 @@ CObject* Socket::LookupRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* Socket::ReverseLookupRequest(const CObjectArray& request) { if ((request.Length() == 1) && request[0]->IsTypedData()) { CObjectUint8Array addr_object(request[0]); @@ -727,7 +696,6 @@ CObject* Socket::ReverseLookupRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - CObject* Socket::ListInterfacesRequest(const CObjectArray& request) { if ((request.Length() == 1) && request[0]->IsInt32()) { CObjectInt32 type(request[0]); @@ -777,7 +745,6 @@ CObject* Socket::ListInterfacesRequest(const CObjectArray& request) { return CObject::IllegalArgumentError(); } - void FUNCTION_NAME(Socket_GetOption)(Dart_NativeArguments args) { Socket* socket = Socket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0)); @@ -832,7 +799,6 @@ void FUNCTION_NAME(Socket_GetOption)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Socket_SetOption)(Dart_NativeArguments args) { bool result = false; Socket* socket = @@ -877,7 +843,6 @@ void FUNCTION_NAME(Socket_SetOption)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Socket_JoinMulticast)(Dart_NativeArguments args) { Socket* socket = Socket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0)); @@ -897,7 +862,6 @@ void FUNCTION_NAME(Socket_JoinMulticast)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Socket_LeaveMulticast)(Dart_NativeArguments args) { Socket* socket = Socket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0)); @@ -917,7 +881,6 @@ void FUNCTION_NAME(Socket_LeaveMulticast)(Dart_NativeArguments args) { } } - static void NormalSocketFinalizer(void* isolate_data, Dart_WeakPersistentHandle handle, void* data) { @@ -931,7 +894,6 @@ static void NormalSocketFinalizer(void* isolate_data, socket->Release(); } - static void ListeningSocketFinalizer(void* isolate_data, Dart_WeakPersistentHandle handle, void* data) { @@ -945,7 +907,6 @@ static void ListeningSocketFinalizer(void* isolate_data, socket->Release(); } - static void StdioSocketFinalizer(void* isolate_data, Dart_WeakPersistentHandle handle, void* data) { @@ -956,7 +917,6 @@ static void StdioSocketFinalizer(void* isolate_data, socket->Release(); } - void Socket::ReuseSocketIdNativeField(Dart_Handle handle, Socket* socket, SocketFinalizer finalizer) { @@ -987,7 +947,6 @@ void Socket::ReuseSocketIdNativeField(Dart_Handle handle, } } - void Socket::SetSocketIdNativeField(Dart_Handle handle, intptr_t id, SocketFinalizer finalizer) { @@ -995,7 +954,6 @@ void Socket::SetSocketIdNativeField(Dart_Handle handle, ReuseSocketIdNativeField(handle, socket, finalizer); } - Socket* Socket::GetSocketIdNativeField(Dart_Handle socket_obj) { intptr_t id; Dart_Handle err = diff --git a/runtime/bin/socket.h b/runtime/bin/socket.h index 29edee90052..8049acd71fc 100644 --- a/runtime/bin/socket.h +++ b/runtime/bin/socket.h @@ -88,7 +88,6 @@ class Socket : public ReferenceCounted { DISALLOW_COPY_AND_ASSIGN(Socket); }; - class ServerSocket { public: static const intptr_t kTemporaryFailure = -2; @@ -116,7 +115,6 @@ class ServerSocket { DISALLOW_IMPLICIT_CONSTRUCTORS(ServerSocket); }; - class ListeningSocketRegistry { public: ListeningSocketRegistry() @@ -203,7 +201,6 @@ class ListeningSocketRegistry { return static_cast((i + 1) & 0xFFFFFFFF); } - static void* GetHashmapKeyFromIntptr(intptr_t i) { return reinterpret_cast(i + 1); } diff --git a/runtime/bin/socket_android.cc b/runtime/bin/socket_android.cc index d4b54002b3d..d8fe8654352 100644 --- a/runtime/bin/socket_android.cc +++ b/runtime/bin/socket_android.cc @@ -9,7 +9,7 @@ #include "bin/socket.h" -#include // NOLINT +#include // NOLINT #include "bin/fdutils.h" #include "platform/signal_blocker.h" @@ -20,12 +20,10 @@ namespace bin { Socket::Socket(intptr_t fd) : ReferenceCounted(), fd_(fd), port_(ILLEGAL_PORT) {} - void Socket::SetClosedFd() { fd_ = kClosedFd; } - static intptr_t Create(const RawAddr& addr) { intptr_t fd; fd = NO_RETRY_EXPECTED(socket(addr.ss.ss_family, SOCK_STREAM, 0)); @@ -39,7 +37,6 @@ static intptr_t Create(const RawAddr& addr) { return fd; } - static intptr_t Connect(intptr_t fd, const RawAddr& addr) { intptr_t result = TEMP_FAILURE_RETRY( connect(fd, &addr.addr, SocketAddress::GetAddrLength(addr))); @@ -50,7 +47,6 @@ static intptr_t Connect(intptr_t fd, const RawAddr& addr) { return -1; } - intptr_t Socket::CreateConnect(const RawAddr& addr) { intptr_t fd = Create(addr); if (fd < 0) { @@ -64,7 +60,6 @@ intptr_t Socket::CreateConnect(const RawAddr& addr) { return Connect(fd, addr); } - intptr_t Socket::CreateBindConnect(const RawAddr& addr, const RawAddr& source_addr) { intptr_t fd = Create(addr); @@ -82,7 +77,6 @@ intptr_t Socket::CreateBindConnect(const RawAddr& addr, return Connect(fd, addr); } - intptr_t Socket::CreateBindDatagram(const RawAddr& addr, bool reuseAddress) { intptr_t fd; @@ -115,7 +109,6 @@ intptr_t Socket::CreateBindDatagram(const RawAddr& addr, bool reuseAddress) { return fd; } - intptr_t ServerSocket::CreateBindListen(const RawAddr& addr, intptr_t backlog, bool v6_only) { @@ -169,13 +162,11 @@ intptr_t ServerSocket::CreateBindListen(const RawAddr& addr, return fd; } - bool ServerSocket::StartAccept(intptr_t fd) { USE(fd); return true; } - static bool IsTemporaryAcceptError(int error) { // On Android a number of protocol errors should be treated as EAGAIN. // These are the ones for TCP/IP. @@ -185,7 +176,6 @@ static bool IsTemporaryAcceptError(int error) { (error == ENETUNREACH); } - intptr_t ServerSocket::Accept(intptr_t fd) { intptr_t socket; struct sockaddr clientaddr; diff --git a/runtime/bin/socket_base.cc b/runtime/bin/socket_base.cc index 4cab885ed48..879f5b90f74 100644 --- a/runtime/bin/socket_base.cc +++ b/runtime/bin/socket_base.cc @@ -28,21 +28,18 @@ int SocketAddress::GetType() { return TYPE_IPV4; } - intptr_t SocketAddress::GetAddrLength(const RawAddr& addr) { ASSERT((addr.ss.ss_family == AF_INET) || (addr.ss.ss_family == AF_INET6)); return (addr.ss.ss_family == AF_INET6) ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in); } - intptr_t SocketAddress::GetInAddrLength(const RawAddr& addr) { ASSERT((addr.ss.ss_family == AF_INET) || (addr.ss.ss_family == AF_INET6)); return (addr.ss.ss_family == AF_INET6) ? sizeof(struct in6_addr) : sizeof(struct in_addr); } - bool SocketAddress::AreAddressesEqual(const RawAddr& a, const RawAddr& b) { if (a.ss.ss_family == AF_INET) { if (b.ss.ss_family != AF_INET) { @@ -61,7 +58,6 @@ bool SocketAddress::AreAddressesEqual(const RawAddr& a, const RawAddr& b) { } } - void SocketAddress::GetSockAddr(Dart_Handle obj, RawAddr* addr) { Dart_TypedData_Type data_type; uint8_t* data = NULL; @@ -87,7 +83,6 @@ void SocketAddress::GetSockAddr(Dart_Handle obj, RawAddr* addr) { Dart_TypedDataReleaseData(obj); } - int16_t SocketAddress::FromType(int type) { if (type == TYPE_ANY) { return AF_UNSPEC; @@ -99,7 +94,6 @@ int16_t SocketAddress::FromType(int type) { return AF_INET6; } - void SocketAddress::SetAddrPort(RawAddr* addr, intptr_t port) { if (addr->ss.ss_family == AF_INET) { addr->in.sin_port = htons(port); @@ -108,7 +102,6 @@ void SocketAddress::SetAddrPort(RawAddr* addr, intptr_t port) { } } - intptr_t SocketAddress::GetAddrPort(const RawAddr& addr) { if (addr.ss.ss_family == AF_INET) { return ntohs(addr.in.sin_port); @@ -117,7 +110,6 @@ intptr_t SocketAddress::GetAddrPort(const RawAddr& addr) { } } - Dart_Handle SocketAddress::ToTypedData(const RawAddr& addr) { int len = GetInAddrLength(addr); Dart_Handle result = Dart_NewTypedData(Dart_TypedData_kUint8, len); @@ -138,7 +130,6 @@ Dart_Handle SocketAddress::ToTypedData(const RawAddr& addr) { return result; } - CObjectUint8Array* SocketAddress::ToCObject(const RawAddr& addr) { int in_addr_len = SocketAddress::GetInAddrLength(addr); const void* in_addr; @@ -153,7 +144,6 @@ CObjectUint8Array* SocketAddress::ToCObject(const RawAddr& addr) { return data; } - void FUNCTION_NAME(InternetAddress_Parse)(Dart_NativeArguments args) { const char* address = DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); @@ -175,13 +165,11 @@ void FUNCTION_NAME(InternetAddress_Parse)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(NetworkInterface_ListSupported)(Dart_NativeArguments args) { Dart_SetReturnValue(args, Dart_NewBoolean(SocketBase::ListInterfacesSupported())); } - void FUNCTION_NAME(SocketBase_IsBindError)(Dart_NativeArguments args) { intptr_t error_number = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1)); diff --git a/runtime/bin/socket_base_android.cc b/runtime/bin/socket_base_android.cc index 0663a2936f4..c54e84c39a3 100644 --- a/runtime/bin/socket_base_android.cc +++ b/runtime/bin/socket_base_android.cc @@ -35,13 +35,11 @@ SocketAddress::SocketAddress(struct sockaddr* sa) { memmove(reinterpret_cast(&addr_), sa, salen); } - bool SocketBase::Initialize() { // Nothing to do on Android. return true; } - bool SocketBase::FormatNumericAddress(const RawAddr& addr, char* address, int len) { @@ -50,18 +48,15 @@ bool SocketBase::FormatNumericAddress(const RawAddr& addr, 0, NI_NUMERICHOST)) == 0); } - bool SocketBase::IsBindError(intptr_t error_number) { return error_number == EADDRINUSE || error_number == EADDRNOTAVAIL || error_number == EINVAL; } - intptr_t SocketBase::Available(intptr_t fd) { return FDUtils::AvailableBytes(fd); } - intptr_t SocketBase::Read(intptr_t fd, void* buffer, intptr_t num_bytes, @@ -77,7 +72,6 @@ intptr_t SocketBase::Read(intptr_t fd, return read_bytes; } - intptr_t SocketBase::RecvFrom(intptr_t fd, void* buffer, intptr_t num_bytes, @@ -95,7 +89,6 @@ intptr_t SocketBase::RecvFrom(intptr_t fd, return read_bytes; } - intptr_t SocketBase::Write(intptr_t fd, const void* buffer, intptr_t num_bytes, @@ -111,7 +104,6 @@ intptr_t SocketBase::Write(intptr_t fd, return written_bytes; } - intptr_t SocketBase::SendTo(intptr_t fd, const void* buffer, intptr_t num_bytes, @@ -130,7 +122,6 @@ intptr_t SocketBase::SendTo(intptr_t fd, return written_bytes; } - intptr_t SocketBase::GetPort(intptr_t fd) { ASSERT(fd >= 0); RawAddr raw; @@ -141,7 +132,6 @@ intptr_t SocketBase::GetPort(intptr_t fd) { return SocketAddress::GetAddrPort(raw); } - SocketAddress* SocketBase::GetRemotePeer(intptr_t fd, intptr_t* port) { ASSERT(fd >= 0); RawAddr raw; @@ -153,7 +143,6 @@ SocketAddress* SocketBase::GetRemotePeer(intptr_t fd, intptr_t* port) { return new SocketAddress(&raw.addr); } - void SocketBase::GetError(intptr_t fd, OSError* os_error) { int errorNumber; socklen_t len = sizeof(errorNumber); @@ -162,7 +151,6 @@ void SocketBase::GetError(intptr_t fd, OSError* os_error) { os_error->SetCodeAndMessage(OSError::kSystem, errorNumber); } - int SocketBase::GetType(intptr_t fd) { struct stat buf; int result = fstat(fd, &buf); @@ -181,12 +169,10 @@ int SocketBase::GetType(intptr_t fd) { return File::kOther; } - intptr_t SocketBase::GetStdioHandle(intptr_t num) { return num; } - AddressList* SocketBase::LookupAddress(const char* host, int type, OSError** os_error) { @@ -229,7 +215,6 @@ AddressList* SocketBase::LookupAddress(const char* host, return addresses; } - bool SocketBase::ReverseLookup(const RawAddr& addr, char* host, intptr_t host_len, @@ -247,7 +232,6 @@ bool SocketBase::ReverseLookup(const RawAddr& addr, return true; } - bool SocketBase::ParseAddress(int type, const char* address, RawAddr* addr) { int result; if (type == SocketAddress::TYPE_IPV4) { @@ -259,12 +243,10 @@ bool SocketBase::ParseAddress(int type, const char* address, RawAddr* addr) { return (result == 1); } - bool SocketBase::ListInterfacesSupported() { return false; } - AddressList* SocketBase::ListInterfaces( int type, OSError** os_error) { @@ -278,13 +260,11 @@ AddressList* SocketBase::ListInterfaces( return NULL; } - void SocketBase::Close(intptr_t fd) { ASSERT(fd >= 0); VOID_TEMP_FAILURE_RETRY(close(fd)); } - bool SocketBase::GetNoDelay(intptr_t fd, bool* enabled) { int on; socklen_t len = sizeof(on); @@ -296,7 +276,6 @@ bool SocketBase::GetNoDelay(intptr_t fd, bool* enabled) { return (err == 0); } - bool SocketBase::SetNoDelay(intptr_t fd, bool enabled) { int on = enabled ? 1 : 0; return NO_RETRY_EXPECTED(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, @@ -304,7 +283,6 @@ bool SocketBase::SetNoDelay(intptr_t fd, bool enabled) { sizeof(on))) == 0; } - bool SocketBase::GetMulticastLoop(intptr_t fd, intptr_t protocol, bool* enabled) { @@ -321,7 +299,6 @@ bool SocketBase::GetMulticastLoop(intptr_t fd, return false; } - bool SocketBase::SetMulticastLoop(intptr_t fd, intptr_t protocol, bool enabled) { @@ -348,7 +325,6 @@ bool SocketBase::GetMulticastHops(intptr_t fd, intptr_t protocol, int* value) { return false; } - bool SocketBase::SetMulticastHops(intptr_t fd, intptr_t protocol, int value) { int v = value; int level = protocol == SocketAddress::TYPE_IPV4 ? IPPROTO_IP : IPPROTO_IPV6; @@ -358,7 +334,6 @@ bool SocketBase::SetMulticastHops(intptr_t fd, intptr_t protocol, int value) { fd, level, optname, reinterpret_cast(&v), sizeof(v))) == 0; } - bool SocketBase::GetBroadcast(intptr_t fd, bool* enabled) { int on; socklen_t len = sizeof(on); @@ -370,7 +345,6 @@ bool SocketBase::GetBroadcast(intptr_t fd, bool* enabled) { return (err == 0); } - bool SocketBase::SetBroadcast(intptr_t fd, bool enabled) { int on = enabled ? 1 : 0; return NO_RETRY_EXPECTED(setsockopt(fd, SOL_SOCKET, SO_BROADCAST, @@ -378,7 +352,6 @@ bool SocketBase::SetBroadcast(intptr_t fd, bool enabled) { sizeof(on))) == 0; } - bool SocketBase::JoinMulticast(intptr_t fd, const RawAddr& addr, const RawAddr&, @@ -391,7 +364,6 @@ bool SocketBase::JoinMulticast(intptr_t fd, setsockopt(fd, proto, MCAST_JOIN_GROUP, &mreq, sizeof(mreq))) == 0; } - bool SocketBase::LeaveMulticast(intptr_t fd, const RawAddr& addr, const RawAddr&, diff --git a/runtime/bin/socket_base_fuchsia.cc b/runtime/bin/socket_base_fuchsia.cc index f927f4281ed..6c204a08654 100644 --- a/runtime/bin/socket_base_fuchsia.cc +++ b/runtime/bin/socket_base_fuchsia.cc @@ -67,13 +67,11 @@ SocketAddress::SocketAddress(struct sockaddr* sa) { memmove(reinterpret_cast(&addr_), sa, salen); } - bool SocketBase::Initialize() { // Nothing to do on Fuchsia. return true; } - bool SocketBase::FormatNumericAddress(const RawAddr& addr, char* address, int len) { @@ -83,13 +81,11 @@ bool SocketBase::FormatNumericAddress(const RawAddr& addr, 0, NI_NUMERICHOST) == 0)); } - bool SocketBase::IsBindError(intptr_t error_number) { return error_number == EADDRINUSE || error_number == EADDRNOTAVAIL || error_number == EINVAL; } - intptr_t SocketBase::Available(intptr_t fd) { IOHandle* handle = reinterpret_cast(fd); ASSERT(handle->fd() >= 0); @@ -98,7 +94,6 @@ intptr_t SocketBase::Available(intptr_t fd) { return available; } - intptr_t SocketBase::Read(intptr_t fd, void* buffer, intptr_t num_bytes, @@ -123,7 +118,6 @@ intptr_t SocketBase::Read(intptr_t fd, return read_bytes; } - intptr_t SocketBase::RecvFrom(intptr_t fd, void* buffer, intptr_t num_bytes, @@ -134,7 +128,6 @@ intptr_t SocketBase::RecvFrom(intptr_t fd, return -1; } - intptr_t SocketBase::Write(intptr_t fd, const void* buffer, intptr_t num_bytes, @@ -159,7 +152,6 @@ intptr_t SocketBase::Write(intptr_t fd, return written_bytes; } - intptr_t SocketBase::SendTo(intptr_t fd, const void* buffer, intptr_t num_bytes, @@ -170,7 +162,6 @@ intptr_t SocketBase::SendTo(intptr_t fd, return -1; } - intptr_t SocketBase::GetPort(intptr_t fd) { IOHandle* handle = reinterpret_cast(fd); ASSERT(handle->fd() >= 0); @@ -183,7 +174,6 @@ intptr_t SocketBase::GetPort(intptr_t fd) { return SocketAddress::GetAddrPort(raw); } - SocketAddress* SocketBase::GetRemotePeer(intptr_t fd, intptr_t* port) { IOHandle* handle = reinterpret_cast(fd); ASSERT(handle->fd() >= 0); @@ -196,27 +186,23 @@ SocketAddress* SocketBase::GetRemotePeer(intptr_t fd, intptr_t* port) { return new SocketAddress(&raw.addr); } - void SocketBase::GetError(intptr_t fd, OSError* os_error) { LOG_ERR("SocketBase::GetError is unimplemented\n"); UNIMPLEMENTED(); } - int SocketBase::GetType(intptr_t fd) { LOG_ERR("SocketBase::GetType is unimplemented\n"); UNIMPLEMENTED(); return File::kOther; } - intptr_t SocketBase::GetStdioHandle(intptr_t num) { LOG_ERR("SocketBase::GetStdioHandle is unimplemented\n"); UNIMPLEMENTED(); return num; } - AddressList* SocketBase::LookupAddress(const char* host, int type, OSError** os_error) { @@ -261,7 +247,6 @@ AddressList* SocketBase::LookupAddress(const char* host, return addresses; } - bool SocketBase::ReverseLookup(const RawAddr& addr, char* host, intptr_t host_len, @@ -271,7 +256,6 @@ bool SocketBase::ReverseLookup(const RawAddr& addr, return false; } - bool SocketBase::ParseAddress(int type, const char* address, RawAddr* addr) { int result; if (type == SocketAddress::TYPE_IPV4) { @@ -284,7 +268,6 @@ bool SocketBase::ParseAddress(int type, const char* address, RawAddr* addr) { return (result == 1); } - static bool ShouldIncludeIfaAddrs(netc_if_info_t* if_info, int lookup_family) { const int family = if_info->addr.ss_family; return ((lookup_family == family) || @@ -292,12 +275,10 @@ static bool ShouldIncludeIfaAddrs(netc_if_info_t* if_info, int lookup_family) { ((family == AF_INET) || (family == AF_INET6))))); } - bool SocketBase::ListInterfacesSupported() { return true; } - AddressList* SocketBase::ListInterfaces( int type, OSError** os_error) { @@ -343,21 +324,18 @@ AddressList* SocketBase::ListInterfaces( return addresses; } - void SocketBase::Close(intptr_t fd) { IOHandle* handle = reinterpret_cast(fd); ASSERT(handle->fd() >= 0); NO_RETRY_EXPECTED(close(handle->fd())); } - bool SocketBase::GetNoDelay(intptr_t fd, bool* enabled) { LOG_ERR("SocketBase::GetNoDelay is unimplemented\n"); UNIMPLEMENTED(); return false; } - bool SocketBase::SetNoDelay(intptr_t fd, bool enabled) { IOHandle* handle = reinterpret_cast(fd); int on = enabled ? 1 : 0; @@ -366,7 +344,6 @@ bool SocketBase::SetNoDelay(intptr_t fd, bool enabled) { sizeof(on))) == 0; } - bool SocketBase::GetMulticastLoop(intptr_t fd, intptr_t protocol, bool* enabled) { @@ -375,7 +352,6 @@ bool SocketBase::GetMulticastLoop(intptr_t fd, return false; } - bool SocketBase::SetMulticastLoop(intptr_t fd, intptr_t protocol, bool enabled) { @@ -384,35 +360,30 @@ bool SocketBase::SetMulticastLoop(intptr_t fd, return false; } - bool SocketBase::GetMulticastHops(intptr_t fd, intptr_t protocol, int* value) { LOG_ERR("SocketBase::GetMulticastHops is unimplemented\n"); UNIMPLEMENTED(); return false; } - bool SocketBase::SetMulticastHops(intptr_t fd, intptr_t protocol, int value) { LOG_ERR("SocketBase::SetMulticastHops is unimplemented\n"); UNIMPLEMENTED(); return false; } - bool SocketBase::GetBroadcast(intptr_t fd, bool* enabled) { LOG_ERR("SocketBase::GetBroadcast is unimplemented\n"); UNIMPLEMENTED(); return false; } - bool SocketBase::SetBroadcast(intptr_t fd, bool enabled) { LOG_ERR("SocketBase::SetBroadcast is unimplemented\n"); UNIMPLEMENTED(); return false; } - bool SocketBase::JoinMulticast(intptr_t fd, const RawAddr& addr, const RawAddr&, @@ -422,7 +393,6 @@ bool SocketBase::JoinMulticast(intptr_t fd, return false; } - bool SocketBase::LeaveMulticast(intptr_t fd, const RawAddr& addr, const RawAddr&, diff --git a/runtime/bin/socket_base_linux.cc b/runtime/bin/socket_base_linux.cc index 7e60cf338f8..d10f8f42351 100644 --- a/runtime/bin/socket_base_linux.cc +++ b/runtime/bin/socket_base_linux.cc @@ -38,13 +38,11 @@ SocketAddress::SocketAddress(struct sockaddr* sa) { memmove(reinterpret_cast(&addr_), sa, salen); } - bool SocketBase::Initialize() { // Nothing to do on Linux. return true; } - bool SocketBase::FormatNumericAddress(const RawAddr& addr, char* address, int len) { @@ -53,18 +51,15 @@ bool SocketBase::FormatNumericAddress(const RawAddr& addr, 0, NI_NUMERICHOST) == 0)); } - bool SocketBase::IsBindError(intptr_t error_number) { return error_number == EADDRINUSE || error_number == EADDRNOTAVAIL || error_number == EINVAL; } - intptr_t SocketBase::Available(intptr_t fd) { return FDUtils::AvailableBytes(fd); } - intptr_t SocketBase::Read(intptr_t fd, void* buffer, intptr_t num_bytes, @@ -80,7 +75,6 @@ intptr_t SocketBase::Read(intptr_t fd, return read_bytes; } - intptr_t SocketBase::RecvFrom(intptr_t fd, void* buffer, intptr_t num_bytes, @@ -98,7 +92,6 @@ intptr_t SocketBase::RecvFrom(intptr_t fd, return read_bytes; } - intptr_t SocketBase::Write(intptr_t fd, const void* buffer, intptr_t num_bytes, @@ -114,7 +107,6 @@ intptr_t SocketBase::Write(intptr_t fd, return written_bytes; } - intptr_t SocketBase::SendTo(intptr_t fd, const void* buffer, intptr_t num_bytes, @@ -133,7 +125,6 @@ intptr_t SocketBase::SendTo(intptr_t fd, return written_bytes; } - intptr_t SocketBase::GetPort(intptr_t fd) { ASSERT(fd >= 0); RawAddr raw; @@ -144,7 +135,6 @@ intptr_t SocketBase::GetPort(intptr_t fd) { return SocketAddress::GetAddrPort(raw); } - SocketAddress* SocketBase::GetRemotePeer(intptr_t fd, intptr_t* port) { ASSERT(fd >= 0); RawAddr raw; @@ -156,7 +146,6 @@ SocketAddress* SocketBase::GetRemotePeer(intptr_t fd, intptr_t* port) { return new SocketAddress(&raw.addr); } - void SocketBase::GetError(intptr_t fd, OSError* os_error) { int len = sizeof(errno); int err = 0; @@ -166,7 +155,6 @@ void SocketBase::GetError(intptr_t fd, OSError* os_error) { os_error->SetCodeAndMessage(OSError::kSystem, errno); } - int SocketBase::GetType(intptr_t fd) { struct stat64 buf; int result = TEMP_FAILURE_RETRY(fstat64(fd, &buf)); @@ -185,12 +173,10 @@ int SocketBase::GetType(intptr_t fd) { return File::kOther; } - intptr_t SocketBase::GetStdioHandle(intptr_t num) { return num; } - AddressList* SocketBase::LookupAddress(const char* host, int type, OSError** os_error) { @@ -233,7 +219,6 @@ AddressList* SocketBase::LookupAddress(const char* host, return addresses; } - bool SocketBase::ReverseLookup(const RawAddr& addr, char* host, intptr_t host_len, @@ -251,7 +236,6 @@ bool SocketBase::ReverseLookup(const RawAddr& addr, return true; } - bool SocketBase::ParseAddress(int type, const char* address, RawAddr* addr) { int result; if (type == SocketAddress::TYPE_IPV4) { @@ -264,7 +248,6 @@ bool SocketBase::ParseAddress(int type, const char* address, RawAddr* addr) { return (result == 1); } - static bool ShouldIncludeIfaAddrs(struct ifaddrs* ifa, int lookup_family) { if (ifa->ifa_addr == NULL) { // OpenVPN's virtual device tun0. @@ -276,12 +259,10 @@ static bool ShouldIncludeIfaAddrs(struct ifaddrs* ifa, int lookup_family) { ((family == AF_INET) || (family == AF_INET6))))); } - bool SocketBase::ListInterfacesSupported() { return true; } - AddressList* SocketBase::ListInterfaces( int type, OSError** os_error) { @@ -320,13 +301,11 @@ AddressList* SocketBase::ListInterfaces( return addresses; } - void SocketBase::Close(intptr_t fd) { ASSERT(fd >= 0); VOID_TEMP_FAILURE_RETRY(close(fd)); } - bool SocketBase::GetNoDelay(intptr_t fd, bool* enabled) { int on; socklen_t len = sizeof(on); @@ -338,7 +317,6 @@ bool SocketBase::GetNoDelay(intptr_t fd, bool* enabled) { return (err == 0); } - bool SocketBase::SetNoDelay(intptr_t fd, bool enabled) { int on = enabled ? 1 : 0; return NO_RETRY_EXPECTED(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, @@ -346,7 +324,6 @@ bool SocketBase::SetNoDelay(intptr_t fd, bool enabled) { sizeof(on))) == 0; } - bool SocketBase::GetMulticastLoop(intptr_t fd, intptr_t protocol, bool* enabled) { @@ -363,7 +340,6 @@ bool SocketBase::GetMulticastLoop(intptr_t fd, return false; } - bool SocketBase::SetMulticastLoop(intptr_t fd, intptr_t protocol, bool enabled) { @@ -376,7 +352,6 @@ bool SocketBase::SetMulticastLoop(intptr_t fd, 0; } - bool SocketBase::GetMulticastHops(intptr_t fd, intptr_t protocol, int* value) { uint8_t v; socklen_t len = sizeof(v); @@ -391,7 +366,6 @@ bool SocketBase::GetMulticastHops(intptr_t fd, intptr_t protocol, int* value) { return false; } - bool SocketBase::SetMulticastHops(intptr_t fd, intptr_t protocol, int value) { int v = value; int level = protocol == SocketAddress::TYPE_IPV4 ? IPPROTO_IP : IPPROTO_IPV6; @@ -401,7 +375,6 @@ bool SocketBase::SetMulticastHops(intptr_t fd, intptr_t protocol, int value) { fd, level, optname, reinterpret_cast(&v), sizeof(v))) == 0; } - bool SocketBase::GetBroadcast(intptr_t fd, bool* enabled) { int on; socklen_t len = sizeof(on); @@ -413,7 +386,6 @@ bool SocketBase::GetBroadcast(intptr_t fd, bool* enabled) { return (err == 0); } - bool SocketBase::SetBroadcast(intptr_t fd, bool enabled) { int on = enabled ? 1 : 0; return NO_RETRY_EXPECTED(setsockopt(fd, SOL_SOCKET, SO_BROADCAST, @@ -421,7 +393,6 @@ bool SocketBase::SetBroadcast(intptr_t fd, bool enabled) { sizeof(on))) == 0; } - bool SocketBase::JoinMulticast(intptr_t fd, const RawAddr& addr, const RawAddr&, @@ -434,7 +405,6 @@ bool SocketBase::JoinMulticast(intptr_t fd, setsockopt(fd, proto, MCAST_JOIN_GROUP, &mreq, sizeof(mreq))) == 0; } - bool SocketBase::LeaveMulticast(intptr_t fd, const RawAddr& addr, const RawAddr&, diff --git a/runtime/bin/socket_base_macos.cc b/runtime/bin/socket_base_macos.cc index d8e423b408f..473e651cae5 100644 --- a/runtime/bin/socket_base_macos.cc +++ b/runtime/bin/socket_base_macos.cc @@ -37,13 +37,11 @@ SocketAddress::SocketAddress(struct sockaddr* sa) { memmove(reinterpret_cast(&addr_), sa, salen); } - bool SocketBase::Initialize() { // Nothing to do on Mac OS. return true; } - bool SocketBase::FormatNumericAddress(const RawAddr& addr, char* address, int len) { @@ -52,18 +50,15 @@ bool SocketBase::FormatNumericAddress(const RawAddr& addr, 0, NI_NUMERICHOST)) == 0); } - bool SocketBase::IsBindError(intptr_t error_number) { return error_number == EADDRINUSE || error_number == EADDRNOTAVAIL || error_number == EINVAL; } - intptr_t SocketBase::Available(intptr_t fd) { return FDUtils::AvailableBytes(fd); } - intptr_t SocketBase::Read(intptr_t fd, void* buffer, intptr_t num_bytes, @@ -79,7 +74,6 @@ intptr_t SocketBase::Read(intptr_t fd, return read_bytes; } - intptr_t SocketBase::RecvFrom(intptr_t fd, void* buffer, intptr_t num_bytes, @@ -97,7 +91,6 @@ intptr_t SocketBase::RecvFrom(intptr_t fd, return read_bytes; } - intptr_t SocketBase::Write(intptr_t fd, const void* buffer, intptr_t num_bytes, @@ -113,7 +106,6 @@ intptr_t SocketBase::Write(intptr_t fd, return written_bytes; } - intptr_t SocketBase::SendTo(intptr_t fd, const void* buffer, intptr_t num_bytes, @@ -132,7 +124,6 @@ intptr_t SocketBase::SendTo(intptr_t fd, return written_bytes; } - intptr_t SocketBase::GetPort(intptr_t fd) { ASSERT(fd >= 0); RawAddr raw; @@ -143,7 +134,6 @@ intptr_t SocketBase::GetPort(intptr_t fd) { return SocketAddress::GetAddrPort(raw); } - SocketAddress* SocketBase::GetRemotePeer(intptr_t fd, intptr_t* port) { ASSERT(fd >= 0); RawAddr raw; @@ -155,7 +145,6 @@ SocketAddress* SocketBase::GetRemotePeer(intptr_t fd, intptr_t* port) { return new SocketAddress(&raw.addr); } - void SocketBase::GetError(intptr_t fd, OSError* os_error) { int len = sizeof(errno); getsockopt(fd, SOL_SOCKET, SO_ERROR, &errno, @@ -163,7 +152,6 @@ void SocketBase::GetError(intptr_t fd, OSError* os_error) { os_error->SetCodeAndMessage(OSError::kSystem, errno); } - int SocketBase::GetType(intptr_t fd) { struct stat buf; int result = fstat(fd, &buf); @@ -182,12 +170,10 @@ int SocketBase::GetType(intptr_t fd) { return File::kOther; } - intptr_t SocketBase::GetStdioHandle(intptr_t num) { return num; } - AddressList* SocketBase::LookupAddress(const char* host, int type, OSError** os_error) { @@ -224,7 +210,6 @@ AddressList* SocketBase::LookupAddress(const char* host, return addresses; } - bool SocketBase::ReverseLookup(const RawAddr& addr, char* host, intptr_t host_len, @@ -242,7 +227,6 @@ bool SocketBase::ReverseLookup(const RawAddr& addr, return true; } - bool SocketBase::ParseAddress(int type, const char* address, RawAddr* addr) { int result; if (type == SocketAddress::TYPE_IPV4) { @@ -254,7 +238,6 @@ bool SocketBase::ParseAddress(int type, const char* address, RawAddr* addr) { return (result == 1); } - static bool ShouldIncludeIfaAddrs(struct ifaddrs* ifa, int lookup_family) { if (ifa->ifa_addr == NULL) { // OpenVPN's virtual device tun0. @@ -266,12 +249,10 @@ static bool ShouldIncludeIfaAddrs(struct ifaddrs* ifa, int lookup_family) { ((family == AF_INET) || (family == AF_INET6)))); } - bool SocketBase::ListInterfacesSupported() { return true; } - AddressList* SocketBase::ListInterfaces( int type, OSError** os_error) { @@ -310,13 +291,11 @@ AddressList* SocketBase::ListInterfaces( return addresses; } - void SocketBase::Close(intptr_t fd) { ASSERT(fd >= 0); VOID_TEMP_FAILURE_RETRY(close(fd)); } - bool SocketBase::GetNoDelay(intptr_t fd, bool* enabled) { int on; socklen_t len = sizeof(on); @@ -328,7 +307,6 @@ bool SocketBase::GetNoDelay(intptr_t fd, bool* enabled) { return (err == 0); } - bool SocketBase::SetNoDelay(intptr_t fd, bool enabled) { int on = enabled ? 1 : 0; return NO_RETRY_EXPECTED(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, @@ -336,7 +314,6 @@ bool SocketBase::SetNoDelay(intptr_t fd, bool enabled) { sizeof(on))) == 0; } - bool SocketBase::GetMulticastLoop(intptr_t fd, intptr_t protocol, bool* enabled) { @@ -353,7 +330,6 @@ bool SocketBase::GetMulticastLoop(intptr_t fd, return false; } - bool SocketBase::SetMulticastLoop(intptr_t fd, intptr_t protocol, bool enabled) { @@ -366,7 +342,6 @@ bool SocketBase::SetMulticastLoop(intptr_t fd, 0; } - bool SocketBase::GetMulticastHops(intptr_t fd, intptr_t protocol, int* value) { uint8_t v; socklen_t len = sizeof(v); @@ -381,7 +356,6 @@ bool SocketBase::GetMulticastHops(intptr_t fd, intptr_t protocol, int* value) { return false; } - bool SocketBase::SetMulticastHops(intptr_t fd, intptr_t protocol, int value) { int v = value; int level = protocol == SocketAddress::TYPE_IPV4 ? IPPROTO_IP : IPPROTO_IPV6; @@ -391,7 +365,6 @@ bool SocketBase::SetMulticastHops(intptr_t fd, intptr_t protocol, int value) { fd, level, optname, reinterpret_cast(&v), sizeof(v))) == 0; } - bool SocketBase::GetBroadcast(intptr_t fd, bool* enabled) { int on; socklen_t len = sizeof(on); @@ -403,7 +376,6 @@ bool SocketBase::GetBroadcast(intptr_t fd, bool* enabled) { return (err == 0); } - bool SocketBase::SetBroadcast(intptr_t fd, bool enabled) { int on = enabled ? 1 : 0; return NO_RETRY_EXPECTED(setsockopt(fd, SOL_SOCKET, SO_BROADCAST, @@ -411,7 +383,6 @@ bool SocketBase::SetBroadcast(intptr_t fd, bool enabled) { sizeof(on))) == 0; } - static bool JoinOrLeaveMulticast(intptr_t fd, const RawAddr& addr, const RawAddr& interface, @@ -454,7 +425,6 @@ bool SocketBase::JoinMulticast(intptr_t fd, return JoinOrLeaveMulticast(fd, addr, interface, interfaceIndex, true); } - bool SocketBase::LeaveMulticast(intptr_t fd, const RawAddr& addr, const RawAddr& interface, diff --git a/runtime/bin/socket_base_unsupported.cc b/runtime/bin/socket_base_unsupported.cc index e8c51f94aba..2426e3e1288 100644 --- a/runtime/bin/socket_base_unsupported.cc +++ b/runtime/bin/socket_base_unsupported.cc @@ -20,13 +20,11 @@ void FUNCTION_NAME(InternetAddress_Parse)(Dart_NativeArguments args) { DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(NetworkInterface_ListSupported)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(SocketBase_IsBindError)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); diff --git a/runtime/bin/socket_base_win.cc b/runtime/bin/socket_base_win.cc index 5283f4f57e9..975cebade49 100644 --- a/runtime/bin/socket_base_win.cc +++ b/runtime/bin/socket_base_win.cc @@ -38,7 +38,6 @@ SocketAddress::SocketAddress(struct sockaddr* sockaddr) { SocketAddress::GetAddrLength(*raw)); } - static Mutex* init_mutex = new Mutex(); static bool socket_initialized = false; @@ -59,7 +58,6 @@ bool SocketBase::Initialize() { return (err == 0); } - bool SocketBase::FormatNumericAddress(const RawAddr& addr, char* address, int len) { @@ -69,13 +67,11 @@ bool SocketBase::FormatNumericAddress(const RawAddr& addr, return WSAAddressToStringA(&raw.addr, salen, NULL, address, &l) != 0; } - intptr_t SocketBase::Available(intptr_t fd) { ClientSocket* client_socket = reinterpret_cast(fd); return client_socket->Available(); } - intptr_t SocketBase::Read(intptr_t fd, void* buffer, intptr_t num_bytes, @@ -84,7 +80,6 @@ intptr_t SocketBase::Read(intptr_t fd, return handle->Read(buffer, num_bytes); } - intptr_t SocketBase::RecvFrom(intptr_t fd, void* buffer, intptr_t num_bytes, @@ -95,7 +90,6 @@ intptr_t SocketBase::RecvFrom(intptr_t fd, return handle->RecvFrom(buffer, num_bytes, &addr->addr, addr_len); } - intptr_t SocketBase::Write(intptr_t fd, const void* buffer, intptr_t num_bytes, @@ -104,7 +98,6 @@ intptr_t SocketBase::Write(intptr_t fd, return handle->Write(buffer, num_bytes); } - intptr_t SocketBase::SendTo(intptr_t fd, const void* buffer, intptr_t num_bytes, @@ -116,7 +109,6 @@ intptr_t SocketBase::SendTo(intptr_t fd, SocketAddress::GetAddrLength(addr)); } - intptr_t SocketBase::GetPort(intptr_t fd) { ASSERT(reinterpret_cast(fd)->is_socket()); SocketHandle* socket_handle = reinterpret_cast(fd); @@ -128,7 +120,6 @@ intptr_t SocketBase::GetPort(intptr_t fd) { return SocketAddress::GetAddrPort(raw); } - SocketAddress* SocketBase::GetRemotePeer(intptr_t fd, intptr_t* port) { ASSERT(reinterpret_cast(fd)->is_socket()); SocketHandle* socket_handle = reinterpret_cast(fd); @@ -144,19 +135,16 @@ SocketAddress* SocketBase::GetRemotePeer(intptr_t fd, intptr_t* port) { return new SocketAddress(&raw.addr); } - bool SocketBase::IsBindError(intptr_t error_number) { return error_number == WSAEADDRINUSE || error_number == WSAEADDRNOTAVAIL || error_number == WSAEINVAL; } - void SocketBase::GetError(intptr_t fd, OSError* os_error) { Handle* handle = reinterpret_cast(fd); os_error->SetCodeAndMessage(OSError::kSystem, handle->last_error()); } - int SocketBase::GetType(intptr_t fd) { Handle* handle = reinterpret_cast(fd); switch (GetFileType(handle->handle())) { @@ -171,7 +159,6 @@ int SocketBase::GetType(intptr_t fd) { } } - intptr_t SocketBase::GetStdioHandle(intptr_t num) { if (num != 0) { return -1; @@ -187,7 +174,6 @@ intptr_t SocketBase::GetStdioHandle(intptr_t num) { return reinterpret_cast(std_handle); } - AddressList* SocketBase::LookupAddress(const char* host, int type, OSError** os_error) { @@ -233,7 +219,6 @@ AddressList* SocketBase::LookupAddress(const char* host, return addresses; } - bool SocketBase::ReverseLookup(const RawAddr& addr, char* host, intptr_t host_len, @@ -251,7 +236,6 @@ bool SocketBase::ReverseLookup(const RawAddr& addr, return true; } - bool SocketBase::ParseAddress(int type, const char* address, RawAddr* addr) { int result; Utf8ToWideScope system_address(address); @@ -264,12 +248,10 @@ bool SocketBase::ParseAddress(int type, const char* address, RawAddr* addr) { return result == 1; } - bool SocketBase::ListInterfacesSupported() { return true; } - AddressList* SocketBase::ListInterfaces( int type, OSError** os_error) { @@ -319,13 +301,11 @@ AddressList* SocketBase::ListInterfaces( return addresses; } - void SocketBase::Close(intptr_t fd) { ClientSocket* client_socket = reinterpret_cast(fd); client_socket->Close(); } - bool SocketBase::GetNoDelay(intptr_t fd, bool* enabled) { SocketHandle* handle = reinterpret_cast(fd); int on; @@ -338,7 +318,6 @@ bool SocketBase::GetNoDelay(intptr_t fd, bool* enabled) { return (err == 0); } - bool SocketBase::SetNoDelay(intptr_t fd, bool enabled) { SocketHandle* handle = reinterpret_cast(fd); int on = enabled ? 1 : 0; @@ -346,7 +325,6 @@ bool SocketBase::SetNoDelay(intptr_t fd, bool enabled) { reinterpret_cast(&on), sizeof(on)) == 0; } - bool SocketBase::GetMulticastLoop(intptr_t fd, intptr_t protocol, bool* enabled) { @@ -364,7 +342,6 @@ bool SocketBase::GetMulticastLoop(intptr_t fd, return false; } - bool SocketBase::SetMulticastLoop(intptr_t fd, intptr_t protocol, bool enabled) { @@ -377,7 +354,6 @@ bool SocketBase::SetMulticastLoop(intptr_t fd, reinterpret_cast(&on), sizeof(on)) == 0; } - bool SocketBase::GetMulticastHops(intptr_t fd, intptr_t protocol, int* value) { SocketHandle* handle = reinterpret_cast(fd); uint8_t v; @@ -393,7 +369,6 @@ bool SocketBase::GetMulticastHops(intptr_t fd, intptr_t protocol, int* value) { return false; } - bool SocketBase::SetMulticastHops(intptr_t fd, intptr_t protocol, int value) { SocketHandle* handle = reinterpret_cast(fd); int v = value; @@ -404,7 +379,6 @@ bool SocketBase::SetMulticastHops(intptr_t fd, intptr_t protocol, int value) { reinterpret_cast(&v), sizeof(v)) == 0; } - bool SocketBase::GetBroadcast(intptr_t fd, bool* enabled) { SocketHandle* handle = reinterpret_cast(fd); int on; @@ -417,7 +391,6 @@ bool SocketBase::GetBroadcast(intptr_t fd, bool* enabled) { return (err == 0); } - bool SocketBase::SetBroadcast(intptr_t fd, bool enabled) { SocketHandle* handle = reinterpret_cast(fd); int on = enabled ? 1 : 0; @@ -425,7 +398,6 @@ bool SocketBase::SetBroadcast(intptr_t fd, bool enabled) { reinterpret_cast(&on), sizeof(on)) == 0; } - bool SocketBase::JoinMulticast(intptr_t fd, const RawAddr& addr, const RawAddr&, @@ -439,7 +411,6 @@ bool SocketBase::JoinMulticast(intptr_t fd, reinterpret_cast(&mreq), sizeof(mreq)) == 0; } - bool SocketBase::LeaveMulticast(intptr_t fd, const RawAddr& addr, const RawAddr&, diff --git a/runtime/bin/socket_fuchsia.cc b/runtime/bin/socket_fuchsia.cc index f8c138fd470..097e6bd9a87 100644 --- a/runtime/bin/socket_fuchsia.cc +++ b/runtime/bin/socket_fuchsia.cc @@ -9,7 +9,7 @@ #include "bin/socket.h" -#include // NOLINT +#include // NOLINT #include "bin/eventhandler.h" #include "bin/fdutils.h" @@ -45,7 +45,6 @@ namespace bin { Socket::Socket(intptr_t fd) : ReferenceCounted(), fd_(fd), port_(ILLEGAL_PORT) {} - void Socket::SetClosedFd() { ASSERT(fd_ != kClosedFd); IOHandle* handle = reinterpret_cast(fd_); @@ -54,7 +53,6 @@ void Socket::SetClosedFd() { fd_ = kClosedFd; } - static intptr_t Create(const RawAddr& addr) { LOG_INFO("Create: calling socket(SOCK_STREAM)\n"); intptr_t fd = NO_RETRY_EXPECTED(socket(addr.ss.ss_family, SOCK_STREAM, 0)); @@ -72,7 +70,6 @@ static intptr_t Create(const RawAddr& addr) { return reinterpret_cast(io_handle); } - static intptr_t Connect(intptr_t fd, const RawAddr& addr) { IOHandle* handle = reinterpret_cast(fd); LOG_INFO("Connect: calling connect(%ld)\n", handle->fd()); @@ -87,7 +84,6 @@ static intptr_t Connect(intptr_t fd, const RawAddr& addr) { return -1; } - intptr_t Socket::CreateConnect(const RawAddr& addr) { intptr_t fd = Create(addr); if (fd < 0) { @@ -104,7 +100,6 @@ intptr_t Socket::CreateConnect(const RawAddr& addr) { return Connect(fd, addr); } - intptr_t Socket::CreateBindConnect(const RawAddr& addr, const RawAddr& source_addr) { LOG_ERR("SocketBase::CreateBindConnect is unimplemented\n"); @@ -112,14 +107,12 @@ intptr_t Socket::CreateBindConnect(const RawAddr& addr, return -1; } - intptr_t Socket::CreateBindDatagram(const RawAddr& addr, bool reuseAddress) { LOG_ERR("SocketBase::CreateBindDatagram is unimplemented\n"); UNIMPLEMENTED(); return -1; } - intptr_t ServerSocket::CreateBindListen(const RawAddr& addr, intptr_t backlog, bool v6_only) { @@ -189,13 +182,11 @@ intptr_t ServerSocket::CreateBindListen(const RawAddr& addr, return reinterpret_cast(io_handle); } - bool ServerSocket::StartAccept(intptr_t fd) { USE(fd); return true; } - static bool IsTemporaryAcceptError(int error) { // On Linux a number of protocol errors should be treated as EAGAIN. // These are the ones for TCP/IP. @@ -205,7 +196,6 @@ static bool IsTemporaryAcceptError(int error) { (error == ENETUNREACH); } - intptr_t ServerSocket::Accept(intptr_t fd) { IOHandle* listen_handle = reinterpret_cast(fd); intptr_t socket; diff --git a/runtime/bin/socket_linux.cc b/runtime/bin/socket_linux.cc index 52221d5c996..c3bfe9b1da1 100644 --- a/runtime/bin/socket_linux.cc +++ b/runtime/bin/socket_linux.cc @@ -9,7 +9,7 @@ #include "bin/socket.h" -#include // NOLINT +#include // NOLINT #include "bin/fdutils.h" #include "platform/signal_blocker.h" @@ -20,12 +20,10 @@ namespace bin { Socket::Socket(intptr_t fd) : ReferenceCounted(), fd_(fd), port_(ILLEGAL_PORT) {} - void Socket::SetClosedFd() { fd_ = kClosedFd; } - static intptr_t Create(const RawAddr& addr) { intptr_t fd; intptr_t type = SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC; @@ -36,7 +34,6 @@ static intptr_t Create(const RawAddr& addr) { return fd; } - static intptr_t Connect(intptr_t fd, const RawAddr& addr) { intptr_t result = TEMP_FAILURE_RETRY( connect(fd, &addr.addr, SocketAddress::GetAddrLength(addr))); @@ -47,7 +44,6 @@ static intptr_t Connect(intptr_t fd, const RawAddr& addr) { return -1; } - intptr_t Socket::CreateConnect(const RawAddr& addr) { intptr_t fd = Create(addr); if (fd < 0) { @@ -56,7 +52,6 @@ intptr_t Socket::CreateConnect(const RawAddr& addr) { return Connect(fd, addr); } - intptr_t Socket::CreateBindConnect(const RawAddr& addr, const RawAddr& source_addr) { intptr_t fd = Create(addr); @@ -74,7 +69,6 @@ intptr_t Socket::CreateBindConnect(const RawAddr& addr, return Connect(fd, addr); } - intptr_t Socket::CreateBindDatagram(const RawAddr& addr, bool reuseAddress) { intptr_t fd; @@ -99,7 +93,6 @@ intptr_t Socket::CreateBindDatagram(const RawAddr& addr, bool reuseAddress) { return fd; } - intptr_t ServerSocket::CreateBindListen(const RawAddr& addr, intptr_t backlog, bool v6_only) { @@ -145,13 +138,11 @@ intptr_t ServerSocket::CreateBindListen(const RawAddr& addr, return fd; } - bool ServerSocket::StartAccept(intptr_t fd) { USE(fd); return true; } - static bool IsTemporaryAcceptError(int error) { // On Linux a number of protocol errors should be treated as EAGAIN. // These are the ones for TCP/IP. @@ -161,7 +152,6 @@ static bool IsTemporaryAcceptError(int error) { (error == ENETUNREACH); } - intptr_t ServerSocket::Accept(intptr_t fd) { intptr_t socket; struct sockaddr clientaddr; diff --git a/runtime/bin/socket_macos.cc b/runtime/bin/socket_macos.cc index 1f01ab315fc..29edf920084 100644 --- a/runtime/bin/socket_macos.cc +++ b/runtime/bin/socket_macos.cc @@ -9,7 +9,7 @@ #include "bin/socket.h" -#include // NOLINT +#include // NOLINT #include "bin/fdutils.h" #include "platform/signal_blocker.h" @@ -20,12 +20,10 @@ namespace bin { Socket::Socket(intptr_t fd) : ReferenceCounted(), fd_(fd), port_(ILLEGAL_PORT) {} - void Socket::SetClosedFd() { fd_ = kClosedFd; } - static intptr_t Create(const RawAddr& addr) { intptr_t fd; fd = NO_RETRY_EXPECTED(socket(addr.ss.ss_family, SOCK_STREAM, 0)); @@ -43,7 +41,6 @@ static intptr_t Create(const RawAddr& addr) { return fd; } - static intptr_t Connect(intptr_t fd, const RawAddr& addr) { intptr_t result = TEMP_FAILURE_RETRY( connect(fd, &addr.addr, SocketAddress::GetAddrLength(addr))); @@ -54,7 +51,6 @@ static intptr_t Connect(intptr_t fd, const RawAddr& addr) { return -1; } - intptr_t Socket::CreateConnect(const RawAddr& addr) { intptr_t fd = Create(addr); if (fd < 0) { @@ -64,7 +60,6 @@ intptr_t Socket::CreateConnect(const RawAddr& addr) { return Connect(fd, addr); } - intptr_t Socket::CreateBindConnect(const RawAddr& addr, const RawAddr& source_addr) { intptr_t fd = Create(addr); @@ -82,7 +77,6 @@ intptr_t Socket::CreateBindConnect(const RawAddr& addr, return Connect(fd, addr); } - intptr_t Socket::CreateBindDatagram(const RawAddr& addr, bool reuseAddress) { intptr_t fd; @@ -115,7 +109,6 @@ intptr_t Socket::CreateBindDatagram(const RawAddr& addr, bool reuseAddress) { return fd; } - intptr_t ServerSocket::CreateBindListen(const RawAddr& addr, intptr_t backlog, bool v6_only) { @@ -169,13 +162,11 @@ intptr_t ServerSocket::CreateBindListen(const RawAddr& addr, return fd; } - bool ServerSocket::StartAccept(intptr_t fd) { USE(fd); return true; } - intptr_t ServerSocket::Accept(intptr_t fd) { intptr_t socket; struct sockaddr clientaddr; diff --git a/runtime/bin/socket_unsupported.cc b/runtime/bin/socket_unsupported.cc index bf9ff200673..361a5380144 100644 --- a/runtime/bin/socket_unsupported.cc +++ b/runtime/bin/socket_unsupported.cc @@ -11,127 +11,106 @@ namespace dart { namespace bin { - void FUNCTION_NAME(Socket_CreateConnect)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(Socket_CreateBindConnect)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(Socket_CreateBindDatagram)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(Socket_Available)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(Socket_Read)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(Socket_RecvFrom)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(Socket_WriteList)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(Socket_SendTo)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(Socket_GetPort)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(Socket_GetRemotePeer)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(Socket_GetError)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(Socket_GetType)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(Socket_GetStdioHandle)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(Socket_GetSocketId)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(Socket_SetSocketId)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(ServerSocket_CreateBindListen)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(ServerSocket_Accept)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(Socket_GetOption)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(Socket_SetOption)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(Socket_JoinMulticast)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(Socket_LeaveMulticast)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); diff --git a/runtime/bin/socket_win.cc b/runtime/bin/socket_win.cc index 3e31350b95f..dcc94531e13 100644 --- a/runtime/bin/socket_win.cc +++ b/runtime/bin/socket_win.cc @@ -27,7 +27,6 @@ Socket::Socket(intptr_t fd) : ReferenceCounted(), fd_(fd), port_(ILLEGAL_PORT) { ASSERT(handle != NULL); } - void Socket::SetClosedFd() { ASSERT(fd_ != kClosedFd); Handle* handle = reinterpret_cast(fd_); @@ -36,7 +35,6 @@ void Socket::SetClosedFd() { fd_ = kClosedFd; } - static intptr_t Create(const RawAddr& addr) { SOCKET s = socket(addr.ss.ss_family, SOCK_STREAM, 0); if (s == INVALID_SOCKET) { @@ -56,7 +54,6 @@ static intptr_t Create(const RawAddr& addr) { return reinterpret_cast(client_socket); } - static intptr_t Connect(intptr_t fd, const RawAddr& addr, const RawAddr& bind_addr) { @@ -90,7 +87,6 @@ static intptr_t Connect(intptr_t fd, status = connectEx(s, &addr.addr, SocketAddress::GetAddrLength(addr), NULL, 0, NULL, overlapped->GetCleanOverlapped()); - if (status == TRUE) { handle->ConnectComplete(overlapped); return fd; @@ -110,7 +106,6 @@ static intptr_t Connect(intptr_t fd, return -1; } - intptr_t Socket::CreateConnect(const RawAddr& addr) { intptr_t fd = Create(addr); if (fd < 0) { @@ -129,7 +124,6 @@ intptr_t Socket::CreateConnect(const RawAddr& addr) { return Connect(fd, addr, bind_addr); } - intptr_t Socket::CreateBindConnect(const RawAddr& addr, const RawAddr& source_addr) { intptr_t fd = Create(addr); @@ -140,7 +134,6 @@ intptr_t Socket::CreateBindConnect(const RawAddr& addr, return Connect(fd, addr, source_addr); } - intptr_t ServerSocket::Accept(intptr_t fd) { ListenSocket* listen_socket = reinterpret_cast(fd); ClientSocket* client_socket = listen_socket->Accept(); @@ -151,7 +144,6 @@ intptr_t ServerSocket::Accept(intptr_t fd) { } } - intptr_t Socket::CreateBindDatagram(const RawAddr& addr, bool reuseAddress) { SOCKET s = socket(addr.ss.ss_family, SOCK_DGRAM, IPPROTO_UDP); if (s == INVALID_SOCKET) { @@ -184,7 +176,6 @@ intptr_t Socket::CreateBindDatagram(const RawAddr& addr, bool reuseAddress) { return reinterpret_cast(datagram_socket); } - intptr_t ServerSocket::CreateBindListen(const RawAddr& addr, intptr_t backlog, bool v6_only) { @@ -246,7 +237,6 @@ intptr_t ServerSocket::CreateBindListen(const RawAddr& addr, return reinterpret_cast(listen_socket); } - bool ServerSocket::StartAccept(intptr_t fd) { ListenSocket* listen_socket = reinterpret_cast(fd); listen_socket->EnsureInitialized(EventHandler::delegate()); diff --git a/runtime/bin/stdio.cc b/runtime/bin/stdio.cc index fec14b1c170..2ebea1e587c 100644 --- a/runtime/bin/stdio.cc +++ b/runtime/bin/stdio.cc @@ -28,7 +28,6 @@ void FUNCTION_NAME(Stdin_ReadByte)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Stdin_GetEchoMode)(Dart_NativeArguments args) { bool enabled = false; if (Stdin::GetEchoMode(&enabled)) { @@ -38,7 +37,6 @@ void FUNCTION_NAME(Stdin_GetEchoMode)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Stdin_SetEchoMode)(Dart_NativeArguments args) { bool enabled = DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 0)); if (Stdin::SetEchoMode(enabled)) { @@ -48,7 +46,6 @@ void FUNCTION_NAME(Stdin_SetEchoMode)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Stdin_GetLineMode)(Dart_NativeArguments args) { bool enabled = false; if (Stdin::GetLineMode(&enabled)) { @@ -58,7 +55,6 @@ void FUNCTION_NAME(Stdin_GetLineMode)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Stdin_SetLineMode)(Dart_NativeArguments args) { bool enabled = DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 0)); if (Stdin::SetLineMode(enabled)) { @@ -68,7 +64,6 @@ void FUNCTION_NAME(Stdin_SetLineMode)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Stdin_AnsiSupported)(Dart_NativeArguments args) { bool supported = false; if (Stdin::AnsiSupported(&supported)) { @@ -78,7 +73,6 @@ void FUNCTION_NAME(Stdin_AnsiSupported)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Stdout_GetTerminalSize)(Dart_NativeArguments args) { if (!Dart_IsInteger(Dart_GetNativeArgument(args, 0))) { OSError os_error(-1, "Invalid argument", OSError::kUnknown); @@ -102,7 +96,6 @@ void FUNCTION_NAME(Stdout_GetTerminalSize)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Stdout_AnsiSupported)(Dart_NativeArguments args) { if (!Dart_IsInteger(Dart_GetNativeArgument(args, 0))) { OSError os_error(-1, "Invalid argument", OSError::kUnknown); diff --git a/runtime/bin/stdio.h b/runtime/bin/stdio.h index e55c317aa1d..fcc424e36d8 100644 --- a/runtime/bin/stdio.h +++ b/runtime/bin/stdio.h @@ -34,7 +34,6 @@ class Stdin { DISALLOW_IMPLICIT_CONSTRUCTORS(Stdin); }; - class Stdout { public: static bool GetTerminalSize(intptr_t fd, int size[2]); diff --git a/runtime/bin/stdio_android.cc b/runtime/bin/stdio_android.cc index e6b62501dab..d4a48cb82ed 100644 --- a/runtime/bin/stdio_android.cc +++ b/runtime/bin/stdio_android.cc @@ -28,7 +28,6 @@ bool Stdin::ReadByte(int* byte) { return true; } - bool Stdin::GetEchoMode(bool* enabled) { struct termios term; int status = NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term)); @@ -39,7 +38,6 @@ bool Stdin::GetEchoMode(bool* enabled) { return true; } - bool Stdin::SetEchoMode(bool enabled) { struct termios term; int status = NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term)); @@ -55,7 +53,6 @@ bool Stdin::SetEchoMode(bool enabled) { return (status == 0); } - bool Stdin::GetLineMode(bool* enabled) { struct termios term; int status = NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term)); @@ -66,7 +63,6 @@ bool Stdin::GetLineMode(bool* enabled) { return true; } - bool Stdin::SetLineMode(bool enabled) { struct termios term; int status = NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term)); @@ -82,7 +78,6 @@ bool Stdin::SetLineMode(bool enabled) { return (status == 0); } - static bool TermHasXTerm() { const char* term = getenv("TERM"); if (term == NULL) { @@ -91,13 +86,11 @@ static bool TermHasXTerm() { return strstr(term, "xterm") != NULL; } - bool Stdin::AnsiSupported(bool* supported) { *supported = isatty(STDIN_FILENO) && TermHasXTerm(); return true; } - bool Stdout::GetTerminalSize(intptr_t fd, int size[2]) { struct winsize w; int status = NO_RETRY_EXPECTED(ioctl(fd, TIOCGWINSZ, &w)); @@ -109,7 +102,6 @@ bool Stdout::GetTerminalSize(intptr_t fd, int size[2]) { return false; } - bool Stdout::AnsiSupported(intptr_t fd, bool* supported) { *supported = isatty(fd) && TermHasXTerm(); return true; diff --git a/runtime/bin/stdio_fuchsia.cc b/runtime/bin/stdio_fuchsia.cc index c36e06f6927..9945f84d9c7 100644 --- a/runtime/bin/stdio_fuchsia.cc +++ b/runtime/bin/stdio_fuchsia.cc @@ -17,43 +17,36 @@ bool Stdin::ReadByte(int* byte) { return false; } - bool Stdin::GetEchoMode(bool* enabled) { UNIMPLEMENTED(); return false; } - bool Stdin::SetEchoMode(bool enabled) { UNIMPLEMENTED(); return false; } - bool Stdin::GetLineMode(bool* enabled) { UNIMPLEMENTED(); return false; } - bool Stdin::SetLineMode(bool enabled) { UNIMPLEMENTED(); return false; } - bool Stdin::AnsiSupported(bool* supported) { UNIMPLEMENTED(); return false; } - bool Stdout::GetTerminalSize(intptr_t fd, int size[2]) { UNIMPLEMENTED(); return false; } - bool Stdout::AnsiSupported(intptr_t fd, bool* supported) { UNIMPLEMENTED(); return false; diff --git a/runtime/bin/stdio_linux.cc b/runtime/bin/stdio_linux.cc index d3aab28ae31..5c37ccf5e6b 100644 --- a/runtime/bin/stdio_linux.cc +++ b/runtime/bin/stdio_linux.cc @@ -28,7 +28,6 @@ bool Stdin::ReadByte(int* byte) { return true; } - bool Stdin::GetEchoMode(bool* enabled) { struct termios term; int status = NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term)); @@ -39,7 +38,6 @@ bool Stdin::GetEchoMode(bool* enabled) { return true; } - bool Stdin::SetEchoMode(bool enabled) { struct termios term; int status = NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term)); @@ -55,7 +53,6 @@ bool Stdin::SetEchoMode(bool enabled) { return (status == 0); } - bool Stdin::GetLineMode(bool* enabled) { struct termios term; int status = NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term)); @@ -66,7 +63,6 @@ bool Stdin::GetLineMode(bool* enabled) { return true; } - bool Stdin::SetLineMode(bool enabled) { struct termios term; int status = NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term)); @@ -82,7 +78,6 @@ bool Stdin::SetLineMode(bool enabled) { return (status == 0); } - static bool TermHasXTerm() { const char* term = getenv("TERM"); if (term == NULL) { @@ -91,13 +86,11 @@ static bool TermHasXTerm() { return strstr(term, "xterm") != NULL; } - bool Stdin::AnsiSupported(bool* supported) { *supported = isatty(STDIN_FILENO) && TermHasXTerm(); return true; } - bool Stdout::GetTerminalSize(intptr_t fd, int size[2]) { struct winsize w; int status = NO_RETRY_EXPECTED(ioctl(fd, TIOCGWINSZ, &w)); @@ -109,7 +102,6 @@ bool Stdout::GetTerminalSize(intptr_t fd, int size[2]) { return false; } - bool Stdout::AnsiSupported(intptr_t fd, bool* supported) { *supported = isatty(fd) && TermHasXTerm(); return true; diff --git a/runtime/bin/stdio_macos.cc b/runtime/bin/stdio_macos.cc index 37ac894583d..3e3573f6bda 100644 --- a/runtime/bin/stdio_macos.cc +++ b/runtime/bin/stdio_macos.cc @@ -28,7 +28,6 @@ bool Stdin::ReadByte(int* byte) { return true; } - bool Stdin::GetEchoMode(bool* enabled) { struct termios term; int status = NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term)); @@ -39,7 +38,6 @@ bool Stdin::GetEchoMode(bool* enabled) { return true; } - bool Stdin::SetEchoMode(bool enabled) { struct termios term; int status = NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term)); @@ -55,7 +53,6 @@ bool Stdin::SetEchoMode(bool enabled) { return (status == 0); } - bool Stdin::GetLineMode(bool* enabled) { struct termios term; int status = NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term)); @@ -66,7 +63,6 @@ bool Stdin::GetLineMode(bool* enabled) { return true; } - bool Stdin::SetLineMode(bool enabled) { struct termios term; int status = NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term)); @@ -82,7 +78,6 @@ bool Stdin::SetLineMode(bool enabled) { return (status == 0); } - static bool TermHasXTerm() { const char* term = getenv("TERM"); if (term == NULL) { @@ -91,13 +86,11 @@ static bool TermHasXTerm() { return strstr(term, "xterm") != NULL; } - bool Stdin::AnsiSupported(bool* supported) { *supported = isatty(STDIN_FILENO) && TermHasXTerm(); return true; } - bool Stdout::GetTerminalSize(intptr_t fd, int size[2]) { struct winsize w; int status = NO_RETRY_EXPECTED(ioctl(fd, TIOCGWINSZ, &w)); @@ -109,7 +102,6 @@ bool Stdout::GetTerminalSize(intptr_t fd, int size[2]) { return false; } - bool Stdout::AnsiSupported(intptr_t fd, bool* supported) { *supported = isatty(fd) && TermHasXTerm(); return true; diff --git a/runtime/bin/stdio_unsupported.cc b/runtime/bin/stdio_unsupported.cc index d4c9d0693ca..a82cc82d7f9 100644 --- a/runtime/bin/stdio_unsupported.cc +++ b/runtime/bin/stdio_unsupported.cc @@ -16,43 +16,36 @@ void FUNCTION_NAME(Stdin_ReadByte)(Dart_NativeArguments args) { DartUtils::NewDartArgumentError("Stdin unsupported on this platform")); } - void FUNCTION_NAME(Stdin_GetEchoMode)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Stdin unsupported on this platform")); } - void FUNCTION_NAME(Stdin_SetEchoMode)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Stdin unsupported on this platform")); } - void FUNCTION_NAME(Stdin_GetLineMode)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Stdin unsupported on this platform")); } - void FUNCTION_NAME(Stdin_SetLineMode)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Stdin unsupported on this platform")); } - void FUNCTION_NAME(Stdin_AnsiSupported)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Stdin unsupported on this platform")); } - void FUNCTION_NAME(Stdout_GetTerminalSize)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Stdout unsupported on this platform")); } - void FUNCTION_NAME(Stdout_AnsiSupported)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Stdout unsupported on this platform")); diff --git a/runtime/bin/stdio_win.cc b/runtime/bin/stdio_win.cc index 7e7690247f4..a5f293d3b43 100644 --- a/runtime/bin/stdio_win.cc +++ b/runtime/bin/stdio_win.cc @@ -34,7 +34,6 @@ bool Stdin::ReadByte(int* byte) { return true; } - bool Stdin::GetEchoMode(bool* enabled) { HANDLE h = GetStdHandle(STD_INPUT_HANDLE); DWORD mode; @@ -45,7 +44,6 @@ bool Stdin::GetEchoMode(bool* enabled) { return true; } - bool Stdin::SetEchoMode(bool enabled) { HANDLE h = GetStdHandle(STD_INPUT_HANDLE); DWORD mode; @@ -60,7 +58,6 @@ bool Stdin::SetEchoMode(bool enabled) { return SetConsoleMode(h, mode); } - bool Stdin::GetLineMode(bool* enabled) { HANDLE h = GetStdHandle(STD_INPUT_HANDLE); DWORD mode; @@ -71,7 +68,6 @@ bool Stdin::GetLineMode(bool* enabled) { return true; } - bool Stdin::SetLineMode(bool enabled) { HANDLE h = GetStdHandle(STD_INPUT_HANDLE); DWORD mode; @@ -86,7 +82,6 @@ bool Stdin::SetLineMode(bool enabled) { return SetConsoleMode(h, mode); } - bool Stdin::AnsiSupported(bool* supported) { ASSERT(supported != NULL); HANDLE h = GetStdHandle(STD_INPUT_HANDLE); @@ -103,7 +98,6 @@ bool Stdin::AnsiSupported(bool* supported) { return true; } - bool Stdout::GetTerminalSize(intptr_t fd, int size[2]) { HANDLE h; if (fd == 1) { @@ -120,7 +114,6 @@ bool Stdout::GetTerminalSize(intptr_t fd, int size[2]) { return true; } - bool Stdout::AnsiSupported(intptr_t fd, bool* supported) { ASSERT(supported != NULL); HANDLE h; diff --git a/runtime/bin/sync_socket.cc b/runtime/bin/sync_socket.cc index c391a12cf14..1a4ac82b449 100644 --- a/runtime/bin/sync_socket.cc +++ b/runtime/bin/sync_socket.cc @@ -100,7 +100,6 @@ void FUNCTION_NAME(SynchronousSocket_LookupRequest)(Dart_NativeArguments args) { return; } - void FUNCTION_NAME(SynchronousSocket_CreateConnectSync)( Dart_NativeArguments args) { RawAddr addr; @@ -120,7 +119,6 @@ void FUNCTION_NAME(SynchronousSocket_CreateConnectSync)( } } - void FUNCTION_NAME(SynchronousSocket_WriteList)(Dart_NativeArguments args) { SynchronousSocket* socket = NULL; Dart_Handle result = SynchronousSocket::GetSocketIdNativeField( @@ -154,7 +152,6 @@ void FUNCTION_NAME(SynchronousSocket_WriteList)(Dart_NativeArguments args) { Dart_TypedDataReleaseData(buffer_obj); } - void FUNCTION_NAME(SynchronousSocket_ReadList)(Dart_NativeArguments args) { SynchronousSocket* socket = NULL; Dart_Handle result = SynchronousSocket::GetSocketIdNativeField( @@ -187,7 +184,6 @@ void FUNCTION_NAME(SynchronousSocket_ReadList)(Dart_NativeArguments args) { Dart_SetIntegerReturnValue(args, bytes_read); } - void FUNCTION_NAME(SynchronousSocket_Available)(Dart_NativeArguments args) { SynchronousSocket* socket = NULL; Dart_Handle result = SynchronousSocket::GetSocketIdNativeField( @@ -202,7 +198,6 @@ void FUNCTION_NAME(SynchronousSocket_Available)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(SynchronousSocket_CloseSync)(Dart_NativeArguments args) { SynchronousSocket* socket = NULL; Dart_Handle result = SynchronousSocket::GetSocketIdNativeField( @@ -213,7 +208,6 @@ void FUNCTION_NAME(SynchronousSocket_CloseSync)(Dart_NativeArguments args) { socket->SetClosedFd(); } - void FUNCTION_NAME(SynchronousSocket_Read)(Dart_NativeArguments args) { SynchronousSocket* socket = NULL; Dart_Handle result = SynchronousSocket::GetSocketIdNativeField( @@ -243,7 +237,6 @@ void FUNCTION_NAME(SynchronousSocket_Read)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(SynchronousSocket_ShutdownRead)(Dart_NativeArguments args) { SynchronousSocket* socket = NULL; Dart_Handle result = SynchronousSocket::GetSocketIdNativeField( @@ -253,7 +246,6 @@ void FUNCTION_NAME(SynchronousSocket_ShutdownRead)(Dart_NativeArguments args) { SynchronousSocket::ShutdownRead(socket->fd()); } - void FUNCTION_NAME(SynchronousSocket_ShutdownWrite)(Dart_NativeArguments args) { SynchronousSocket* socket = NULL; Dart_Handle result = SynchronousSocket::GetSocketIdNativeField( @@ -263,7 +255,6 @@ void FUNCTION_NAME(SynchronousSocket_ShutdownWrite)(Dart_NativeArguments args) { SynchronousSocket::ShutdownWrite(socket->fd()); } - void FUNCTION_NAME(SynchronousSocket_GetPort)(Dart_NativeArguments args) { SynchronousSocket* socket = NULL; Dart_Handle result = SynchronousSocket::GetSocketIdNativeField( @@ -278,7 +269,6 @@ void FUNCTION_NAME(SynchronousSocket_GetPort)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(SynchronousSocket_GetRemotePeer)(Dart_NativeArguments args) { SynchronousSocket* socket = NULL; Dart_Handle result = SynchronousSocket::GetSocketIdNativeField( @@ -316,7 +306,6 @@ void FUNCTION_NAME(SynchronousSocket_GetRemotePeer)(Dart_NativeArguments args) { delete addr; } - static void SynchronousSocketFinalizer(void* isolate_data, Dart_WeakPersistentHandle handle, void* data) { @@ -328,7 +317,6 @@ static void SynchronousSocketFinalizer(void* isolate_data, delete socket; } - Dart_Handle SynchronousSocket::SetSocketIdNativeField( Dart_Handle handle, SynchronousSocket* socket) { @@ -345,7 +333,6 @@ Dart_Handle SynchronousSocket::SetSocketIdNativeField( return error; } - Dart_Handle SynchronousSocket::GetSocketIdNativeField( Dart_Handle socket_obj, SynchronousSocket** socket) { diff --git a/runtime/bin/sync_socket_android.cc b/runtime/bin/sync_socket_android.cc index e87fb8ad02f..ade1616bda3 100644 --- a/runtime/bin/sync_socket_android.cc +++ b/runtime/bin/sync_socket_android.cc @@ -23,7 +23,6 @@ bool SynchronousSocket::Initialize() { return true; } - static intptr_t Create(const RawAddr& addr) { intptr_t fd; intptr_t type = SOCK_STREAM; @@ -34,7 +33,6 @@ static intptr_t Create(const RawAddr& addr) { return fd; } - static intptr_t Connect(intptr_t fd, const RawAddr& addr) { intptr_t result = TEMP_FAILURE_RETRY( connect(fd, &addr.addr, SocketAddress::GetAddrLength(addr))); @@ -46,7 +44,6 @@ static intptr_t Connect(intptr_t fd, const RawAddr& addr) { return -1; } - intptr_t SynchronousSocket::CreateConnect(const RawAddr& addr) { intptr_t fd = Create(addr); if (fd < 0) { @@ -55,46 +52,38 @@ intptr_t SynchronousSocket::CreateConnect(const RawAddr& addr) { return Connect(fd, addr); } - intptr_t SynchronousSocket::Available(intptr_t fd) { return SocketBase::Available(fd); } - intptr_t SynchronousSocket::GetPort(intptr_t fd) { return SocketBase::GetPort(fd); } - SocketAddress* SynchronousSocket::GetRemotePeer(intptr_t fd, intptr_t* port) { return SocketBase::GetRemotePeer(fd, port); } - intptr_t SynchronousSocket::Read(intptr_t fd, void* buffer, intptr_t num_bytes) { return SocketBase::Read(fd, buffer, num_bytes, SocketBase::kSync); } - intptr_t SynchronousSocket::Write(intptr_t fd, const void* buffer, intptr_t num_bytes) { return SocketBase::Write(fd, buffer, num_bytes, SocketBase::kSync); } - void SynchronousSocket::ShutdownRead(intptr_t fd) { VOID_NO_RETRY_EXPECTED(shutdown(fd, SHUT_RD)); } - void SynchronousSocket::ShutdownWrite(intptr_t fd) { VOID_NO_RETRY_EXPECTED(shutdown(fd, SHUT_WR)); } - void SynchronousSocket::Close(intptr_t fd) { return SocketBase::Close(fd); } diff --git a/runtime/bin/sync_socket_fuchsia.cc b/runtime/bin/sync_socket_fuchsia.cc index eef77595290..8148b8a7e6f 100644 --- a/runtime/bin/sync_socket_fuchsia.cc +++ b/runtime/bin/sync_socket_fuchsia.cc @@ -23,7 +23,6 @@ bool SynchronousSocket::Initialize() { return true; } - static intptr_t Create(const RawAddr& addr) { intptr_t fd; intptr_t type = SOCK_STREAM | SOCK_CLOEXEC; @@ -34,7 +33,6 @@ static intptr_t Create(const RawAddr& addr) { return fd; } - static intptr_t Connect(intptr_t fd, const RawAddr& addr) { intptr_t result = TEMP_FAILURE_RETRY( connect(fd, &addr.addr, SocketAddress::GetAddrLength(addr))); @@ -46,7 +44,6 @@ static intptr_t Connect(intptr_t fd, const RawAddr& addr) { return -1; } - intptr_t SynchronousSocket::CreateConnect(const RawAddr& addr) { intptr_t fd = Create(addr); if (fd < 0) { @@ -55,46 +52,38 @@ intptr_t SynchronousSocket::CreateConnect(const RawAddr& addr) { return Connect(fd, addr); } - intptr_t SynchronousSocket::Available(intptr_t fd) { return SocketBase::Available(fd); } - intptr_t SynchronousSocket::GetPort(intptr_t fd) { return SocketBase::GetPort(fd); } - SocketAddress* SynchronousSocket::GetRemotePeer(intptr_t fd, intptr_t* port) { return SocketBase::GetRemotePeer(fd, port); } - intptr_t SynchronousSocket::Read(intptr_t fd, void* buffer, intptr_t num_bytes) { return SocketBase::Read(fd, buffer, num_bytes, SocketBase::kSync); } - intptr_t SynchronousSocket::Write(intptr_t fd, const void* buffer, intptr_t num_bytes) { return SocketBase::Write(fd, buffer, num_bytes, SocketBase::kSync); } - void SynchronousSocket::ShutdownRead(intptr_t fd) { VOID_NO_RETRY_EXPECTED(shutdown(fd, SHUT_RD)); } - void SynchronousSocket::ShutdownWrite(intptr_t fd) { VOID_NO_RETRY_EXPECTED(shutdown(fd, SHUT_WR)); } - void SynchronousSocket::Close(intptr_t fd) { return SocketBase::Close(fd); } diff --git a/runtime/bin/sync_socket_linux.cc b/runtime/bin/sync_socket_linux.cc index f683f23a6be..99abcffa36a 100644 --- a/runtime/bin/sync_socket_linux.cc +++ b/runtime/bin/sync_socket_linux.cc @@ -23,7 +23,6 @@ bool SynchronousSocket::Initialize() { return true; } - static intptr_t Create(const RawAddr& addr) { intptr_t fd; intptr_t type = SOCK_STREAM | SOCK_CLOEXEC; @@ -34,7 +33,6 @@ static intptr_t Create(const RawAddr& addr) { return fd; } - static intptr_t Connect(intptr_t fd, const RawAddr& addr) { intptr_t result = TEMP_FAILURE_RETRY( connect(fd, &addr.addr, SocketAddress::GetAddrLength(addr))); @@ -46,7 +44,6 @@ static intptr_t Connect(intptr_t fd, const RawAddr& addr) { return -1; } - intptr_t SynchronousSocket::CreateConnect(const RawAddr& addr) { intptr_t fd = Create(addr); if (fd < 0) { @@ -55,46 +52,38 @@ intptr_t SynchronousSocket::CreateConnect(const RawAddr& addr) { return Connect(fd, addr); } - intptr_t SynchronousSocket::Available(intptr_t fd) { return SocketBase::Available(fd); } - intptr_t SynchronousSocket::GetPort(intptr_t fd) { return SocketBase::GetPort(fd); } - SocketAddress* SynchronousSocket::GetRemotePeer(intptr_t fd, intptr_t* port) { return SocketBase::GetRemotePeer(fd, port); } - intptr_t SynchronousSocket::Read(intptr_t fd, void* buffer, intptr_t num_bytes) { return SocketBase::Read(fd, buffer, num_bytes, SocketBase::kSync); } - intptr_t SynchronousSocket::Write(intptr_t fd, const void* buffer, intptr_t num_bytes) { return SocketBase::Write(fd, buffer, num_bytes, SocketBase::kSync); } - void SynchronousSocket::ShutdownRead(intptr_t fd) { VOID_NO_RETRY_EXPECTED(shutdown(fd, SHUT_RD)); } - void SynchronousSocket::ShutdownWrite(intptr_t fd) { VOID_NO_RETRY_EXPECTED(shutdown(fd, SHUT_WR)); } - void SynchronousSocket::Close(intptr_t fd) { return SocketBase::Close(fd); } diff --git a/runtime/bin/sync_socket_macos.cc b/runtime/bin/sync_socket_macos.cc index 3e0be2a0366..61df267250e 100644 --- a/runtime/bin/sync_socket_macos.cc +++ b/runtime/bin/sync_socket_macos.cc @@ -23,7 +23,6 @@ bool SynchronousSocket::Initialize() { return true; } - static intptr_t Create(const RawAddr& addr) { intptr_t fd; fd = NO_RETRY_EXPECTED(socket(addr.ss.ss_family, SOCK_STREAM, 0)); @@ -37,7 +36,6 @@ static intptr_t Create(const RawAddr& addr) { return fd; } - static intptr_t Connect(intptr_t fd, const RawAddr& addr) { intptr_t result = TEMP_FAILURE_RETRY( connect(fd, &addr.addr, SocketAddress::GetAddrLength(addr))); @@ -49,7 +47,6 @@ static intptr_t Connect(intptr_t fd, const RawAddr& addr) { return -1; } - intptr_t SynchronousSocket::CreateConnect(const RawAddr& addr) { intptr_t fd = Create(addr); if (fd < 0) { @@ -58,46 +55,38 @@ intptr_t SynchronousSocket::CreateConnect(const RawAddr& addr) { return Connect(fd, addr); } - intptr_t SynchronousSocket::Available(intptr_t fd) { return SocketBase::Available(fd); } - intptr_t SynchronousSocket::GetPort(intptr_t fd) { return SocketBase::GetPort(fd); } - SocketAddress* SynchronousSocket::GetRemotePeer(intptr_t fd, intptr_t* port) { return SocketBase::GetRemotePeer(fd, port); } - intptr_t SynchronousSocket::Read(intptr_t fd, void* buffer, intptr_t num_bytes) { return SocketBase::Read(fd, buffer, num_bytes, SocketBase::kSync); } - intptr_t SynchronousSocket::Write(intptr_t fd, const void* buffer, intptr_t num_bytes) { return SocketBase::Write(fd, buffer, num_bytes, SocketBase::kSync); } - void SynchronousSocket::ShutdownRead(intptr_t fd) { VOID_NO_RETRY_EXPECTED(shutdown(fd, SHUT_RD)); } - void SynchronousSocket::ShutdownWrite(intptr_t fd) { VOID_NO_RETRY_EXPECTED(shutdown(fd, SHUT_WR)); } - void SynchronousSocket::Close(intptr_t fd) { return SocketBase::Close(fd); } diff --git a/runtime/bin/sync_socket_unsupported.cc b/runtime/bin/sync_socket_unsupported.cc index 98a755c32c2..bf64fa2d4ba 100644 --- a/runtime/bin/sync_socket_unsupported.cc +++ b/runtime/bin/sync_socket_unsupported.cc @@ -11,68 +11,57 @@ namespace dart { namespace bin { - void FUNCTION_NAME(SynchronousSocket_CreateConnectSync)( Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(SynchronousSocket_LookupRequest)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(SynchronousSocket_CloseSync)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(SynchronousSocket_Available)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(SynchronousSocket_Read)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(SynchronousSocket_ReadList)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(SynchronousSocket_WriteList)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(SynchronousSocket_ShutdownRead)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(SynchronousSocket_ShutdownWrite)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(SynchronousSocket_GetPort)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); } - void FUNCTION_NAME(SynchronousSocket_GetRemotePeer)(Dart_NativeArguments args) { Dart_ThrowException( DartUtils::NewDartArgumentError("Sockets unsupported on this platform")); diff --git a/runtime/bin/sync_socket_win.cc b/runtime/bin/sync_socket_win.cc index cea14f9c0a2..2ba64635d3a 100644 --- a/runtime/bin/sync_socket_win.cc +++ b/runtime/bin/sync_socket_win.cc @@ -17,14 +17,12 @@ bool SynchronousSocket::Initialize() { return SocketBase::Initialize(); } - static intptr_t Create(const RawAddr& addr) { const intptr_t type = SOCK_STREAM; SOCKET s = WSASocket(addr.ss.ss_family, type, 0, NULL, 0, 0); return (s == INVALID_SOCKET) ? -1 : s; } - static intptr_t Connect(intptr_t fd, const RawAddr& addr) { SOCKET socket = static_cast(fd); intptr_t result = @@ -32,13 +30,11 @@ static intptr_t Connect(intptr_t fd, const RawAddr& addr) { return (result == SOCKET_ERROR) ? -1 : socket; } - intptr_t SynchronousSocket::CreateConnect(const RawAddr& addr) { intptr_t fd = Create(addr); return (fd < 0) ? fd : Connect(fd, addr); } - intptr_t SynchronousSocket::Available(intptr_t fd) { SOCKET socket = static_cast(fd); DWORD available; @@ -46,7 +42,6 @@ intptr_t SynchronousSocket::Available(intptr_t fd) { return (result == SOCKET_ERROR) ? -1 : static_cast(available); } - intptr_t SynchronousSocket::GetPort(intptr_t fd) { SOCKET socket = static_cast(fd); RawAddr raw; @@ -57,7 +52,6 @@ intptr_t SynchronousSocket::GetPort(intptr_t fd) { return SocketAddress::GetAddrPort(raw); } - SocketAddress* SynchronousSocket::GetRemotePeer(intptr_t fd, intptr_t* port) { SOCKET socket = static_cast(fd); RawAddr raw; @@ -72,7 +66,6 @@ SocketAddress* SynchronousSocket::GetRemotePeer(intptr_t fd, intptr_t* port) { return new SocketAddress(&raw.addr); } - intptr_t SynchronousSocket::Read(intptr_t fd, void* buffer, intptr_t num_bytes) { @@ -80,7 +73,6 @@ intptr_t SynchronousSocket::Read(intptr_t fd, return recv(socket, reinterpret_cast(buffer), num_bytes, 0); } - intptr_t SynchronousSocket::Write(intptr_t fd, const void* buffer, intptr_t num_bytes) { @@ -88,19 +80,16 @@ intptr_t SynchronousSocket::Write(intptr_t fd, return send(socket, reinterpret_cast(buffer), num_bytes, 0); } - void SynchronousSocket::ShutdownRead(intptr_t fd) { SOCKET socket = static_cast(fd); shutdown(socket, SD_RECEIVE); } - void SynchronousSocket::ShutdownWrite(intptr_t fd) { SOCKET socket = static_cast(fd); shutdown(socket, SD_SEND); } - void SynchronousSocket::Close(intptr_t fd) { SOCKET socket = static_cast(fd); closesocket(socket); diff --git a/runtime/bin/thread.h b/runtime/bin/thread.h index 6b804441abb..8e31cb60aaf 100644 --- a/runtime/bin/thread.h +++ b/runtime/bin/thread.h @@ -12,8 +12,8 @@ namespace bin { class Thread; class Mutex; class Monitor; -} -} +} // namespace bin +} // namespace dart // Declare the OS-specific types ahead of defining the generic classes. #if defined(HOST_OS_ANDROID) @@ -63,7 +63,6 @@ class Thread { DISALLOW_IMPLICIT_CONSTRUCTORS(Thread); }; - class Mutex { public: Mutex(); @@ -79,7 +78,6 @@ class Mutex { DISALLOW_COPY_AND_ASSIGN(Mutex); }; - class Monitor { public: enum WaitResult { kNotified, kTimedOut }; @@ -109,5 +107,4 @@ class Monitor { } // namespace bin } // namespace dart - #endif // RUNTIME_BIN_THREAD_H_ diff --git a/runtime/bin/thread_android.cc b/runtime/bin/thread_android.cc index d6035ad4301..ab0d7a27b1e 100644 --- a/runtime/bin/thread_android.cc +++ b/runtime/bin/thread_android.cc @@ -25,7 +25,6 @@ namespace bin { FATAL2("pthread error: %d (%s)", result, error_message); \ } - #ifdef DEBUG #define RETURN_ON_PTHREAD_FAILURE(result) \ if (result != 0) { \ @@ -43,7 +42,6 @@ namespace bin { } #endif - static void ComputeTimeSpecMicros(struct timespec* ts, int64_t micros) { struct timeval tv; int64_t secs = micros / kMicrosecondsPerSecond; @@ -58,7 +56,6 @@ static void ComputeTimeSpecMicros(struct timespec* ts, int64_t micros) { } } - class ThreadStartData { public: ThreadStartData(Thread::ThreadStartFunction function, uword parameter) @@ -74,7 +71,6 @@ class ThreadStartData { DISALLOW_COPY_AND_ASSIGN(ThreadStartData); }; - // Dispatch to the thread start function provided by the caller. This trampoline // is used to ensure that the thread is properly destroyed if the thread just // exits. @@ -91,7 +87,6 @@ static void* ThreadStart(void* data_ptr) { return NULL; } - int Thread::Start(ThreadStartFunction function, uword parameter) { pthread_attr_t attr; int result = pthread_attr_init(&attr); @@ -115,7 +110,6 @@ int Thread::Start(ThreadStartFunction function, uword parameter) { return 0; } - const ThreadLocalKey Thread::kUnsetThreadLocalKey = static_cast(-1); const ThreadId Thread::kInvalidThreadId = static_cast(0); @@ -128,48 +122,40 @@ ThreadLocalKey Thread::CreateThreadLocal() { return key; } - void Thread::DeleteThreadLocal(ThreadLocalKey key) { ASSERT(key != kUnsetThreadLocalKey); int result = pthread_key_delete(key); VALIDATE_PTHREAD_RESULT(result); } - void Thread::SetThreadLocal(ThreadLocalKey key, uword value) { ASSERT(key != kUnsetThreadLocalKey); int result = pthread_setspecific(key, reinterpret_cast(value)); VALIDATE_PTHREAD_RESULT(result); } - intptr_t Thread::GetMaxStackSize() { const int kStackSize = (128 * kWordSize * KB); return kStackSize; } - ThreadId Thread::GetCurrentThreadId() { return gettid(); } - intptr_t Thread::ThreadIdToIntPtr(ThreadId id) { ASSERT(sizeof(id) == sizeof(intptr_t)); return static_cast(id); } - bool Thread::Compare(ThreadId a, ThreadId b) { return (a == b); } - void Thread::InitOnce() { // Nothing to be done. } - Mutex::Mutex() { pthread_mutexattr_t attr; int result = pthread_mutexattr_init(&attr); @@ -188,14 +174,12 @@ Mutex::Mutex() { VALIDATE_PTHREAD_RESULT(result); } - Mutex::~Mutex() { int result = pthread_mutex_destroy(data_.mutex()); // Verify that the pthread_mutex was destroyed. VALIDATE_PTHREAD_RESULT(result); } - void Mutex::Lock() { int result = pthread_mutex_lock(data_.mutex()); // Specifically check for dead lock to help debugging. @@ -204,7 +188,6 @@ void Mutex::Lock() { // TODO(iposva): Do we need to track lock owners? } - bool Mutex::TryLock() { int result = pthread_mutex_trylock(data_.mutex()); // Return false if the lock is busy and locking failed. @@ -216,7 +199,6 @@ bool Mutex::TryLock() { return true; } - void Mutex::Unlock() { // TODO(iposva): Do we need to track lock owners? int result = pthread_mutex_unlock(data_.mutex()); @@ -225,7 +207,6 @@ void Mutex::Unlock() { ASSERT(result == 0); // Verify no other errors. } - Monitor::Monitor() { pthread_mutexattr_t mutex_attr; int result = pthread_mutexattr_init(&mutex_attr); @@ -253,7 +234,6 @@ Monitor::Monitor() { VALIDATE_PTHREAD_RESULT(result); } - Monitor::~Monitor() { int result = pthread_mutex_destroy(data_.mutex()); VALIDATE_PTHREAD_RESULT(result); @@ -262,26 +242,22 @@ Monitor::~Monitor() { VALIDATE_PTHREAD_RESULT(result); } - void Monitor::Enter() { int result = pthread_mutex_lock(data_.mutex()); VALIDATE_PTHREAD_RESULT(result); // TODO(iposva): Do we need to track lock owners? } - void Monitor::Exit() { // TODO(iposva): Do we need to track lock owners? int result = pthread_mutex_unlock(data_.mutex()); VALIDATE_PTHREAD_RESULT(result); } - Monitor::WaitResult Monitor::Wait(int64_t millis) { return WaitMicros(millis * kMicrosecondsPerMillisecond); } - Monitor::WaitResult Monitor::WaitMicros(int64_t micros) { // TODO(iposva): Do we need to track lock owners? Monitor::WaitResult retval = kNotified; @@ -301,14 +277,12 @@ Monitor::WaitResult Monitor::WaitMicros(int64_t micros) { return retval; } - void Monitor::Notify() { // TODO(iposva): Do we need to track lock owners? int result = pthread_cond_signal(data_.cond()); VALIDATE_PTHREAD_RESULT(result); } - void Monitor::NotifyAll() { // TODO(iposva): Do we need to track lock owners? int result = pthread_cond_broadcast(data_.cond()); diff --git a/runtime/bin/thread_android.h b/runtime/bin/thread_android.h index 154339c6200..7ece84b293f 100644 --- a/runtime/bin/thread_android.h +++ b/runtime/bin/thread_android.h @@ -37,7 +37,6 @@ class ThreadInlineImpl { DISALLOW_COPY_AND_ASSIGN(ThreadInlineImpl); }; - class MutexData { private: MutexData() {} @@ -53,7 +52,6 @@ class MutexData { DISALLOW_COPY_AND_ASSIGN(MutexData); }; - class MonitorData { private: MonitorData() {} diff --git a/runtime/bin/thread_fuchsia.cc b/runtime/bin/thread_fuchsia.cc index 5a9b35103af..f424ebbae19 100644 --- a/runtime/bin/thread_fuchsia.cc +++ b/runtime/bin/thread_fuchsia.cc @@ -26,7 +26,6 @@ namespace bin { Utils::StrError(result, error_buf, kBufferSize)); \ } - #ifdef DEBUG #define RETURN_ON_PTHREAD_FAILURE(result) \ if (result != 0) { \ @@ -43,7 +42,6 @@ namespace bin { } #endif - static void ComputeTimeSpecMicros(struct timespec* ts, int64_t micros) { int64_t secs = micros / kMicrosecondsPerSecond; int64_t nanos = @@ -58,7 +56,6 @@ static void ComputeTimeSpecMicros(struct timespec* ts, int64_t micros) { } } - class ThreadStartData { public: ThreadStartData(Thread::ThreadStartFunction function, uword parameter) @@ -74,7 +71,6 @@ class ThreadStartData { DISALLOW_COPY_AND_ASSIGN(ThreadStartData); }; - // Dispatch to the thread start function provided by the caller. This trampoline // is used to ensure that the thread is properly destroyed if the thread just // exits. @@ -91,7 +87,6 @@ static void* ThreadStart(void* data_ptr) { return NULL; } - int Thread::Start(ThreadStartFunction function, uword parameter) { pthread_attr_t attr; int result = pthread_attr_init(&attr); @@ -115,7 +110,6 @@ int Thread::Start(ThreadStartFunction function, uword parameter) { return 0; } - const ThreadLocalKey Thread::kUnsetThreadLocalKey = static_cast(-1); const ThreadId Thread::kInvalidThreadId = static_cast(0); @@ -128,48 +122,40 @@ ThreadLocalKey Thread::CreateThreadLocal() { return key; } - void Thread::DeleteThreadLocal(ThreadLocalKey key) { ASSERT(key != kUnsetThreadLocalKey); int result = pthread_key_delete(key); VALIDATE_PTHREAD_RESULT(result); } - void Thread::SetThreadLocal(ThreadLocalKey key, uword value) { ASSERT(key != kUnsetThreadLocalKey); int result = pthread_setspecific(key, reinterpret_cast(value)); VALIDATE_PTHREAD_RESULT(result); } - intptr_t Thread::GetMaxStackSize() { const int kStackSize = (128 * kWordSize * KB); return kStackSize; } - ThreadId Thread::GetCurrentThreadId() { return pthread_self(); } - intptr_t Thread::ThreadIdToIntPtr(ThreadId id) { ASSERT(sizeof(id) == sizeof(intptr_t)); return static_cast(id); } - bool Thread::Compare(ThreadId a, ThreadId b) { return (pthread_equal(a, b) != 0); } - void Thread::InitOnce() { // Nothing to be done. } - Mutex::Mutex() { pthread_mutexattr_t attr; int result = pthread_mutexattr_init(&attr); @@ -188,14 +174,12 @@ Mutex::Mutex() { VALIDATE_PTHREAD_RESULT(result); } - Mutex::~Mutex() { int result = pthread_mutex_destroy(data_.mutex()); // Verify that the pthread_mutex was destroyed. VALIDATE_PTHREAD_RESULT(result); } - void Mutex::Lock() { int result = pthread_mutex_lock(data_.mutex()); // Specifically check for dead lock to help debugging. @@ -204,7 +188,6 @@ void Mutex::Lock() { // TODO(iposva): Do we need to track lock owners? } - bool Mutex::TryLock() { int result = pthread_mutex_trylock(data_.mutex()); // Return false if the lock is busy and locking failed. @@ -216,7 +199,6 @@ bool Mutex::TryLock() { return true; } - void Mutex::Unlock() { // TODO(iposva): Do we need to track lock owners? int result = pthread_mutex_unlock(data_.mutex()); @@ -225,7 +207,6 @@ void Mutex::Unlock() { ASSERT(result == 0); // Verify no other errors. } - Monitor::Monitor() { pthread_mutexattr_t mutex_attr; int result = pthread_mutexattr_init(&mutex_attr); @@ -256,7 +237,6 @@ Monitor::Monitor() { VALIDATE_PTHREAD_RESULT(result); } - Monitor::~Monitor() { int result = pthread_mutex_destroy(data_.mutex()); VALIDATE_PTHREAD_RESULT(result); @@ -265,26 +245,22 @@ Monitor::~Monitor() { VALIDATE_PTHREAD_RESULT(result); } - void Monitor::Enter() { int result = pthread_mutex_lock(data_.mutex()); VALIDATE_PTHREAD_RESULT(result); // TODO(iposva): Do we need to track lock owners? } - void Monitor::Exit() { // TODO(iposva): Do we need to track lock owners? int result = pthread_mutex_unlock(data_.mutex()); VALIDATE_PTHREAD_RESULT(result); } - Monitor::WaitResult Monitor::Wait(int64_t millis) { return WaitMicros(millis * kMicrosecondsPerMillisecond); } - Monitor::WaitResult Monitor::WaitMicros(int64_t micros) { // TODO(iposva): Do we need to track lock owners? Monitor::WaitResult retval = kNotified; @@ -304,14 +280,12 @@ Monitor::WaitResult Monitor::WaitMicros(int64_t micros) { return retval; } - void Monitor::Notify() { // TODO(iposva): Do we need to track lock owners? int result = pthread_cond_signal(data_.cond()); VALIDATE_PTHREAD_RESULT(result); } - void Monitor::NotifyAll() { // TODO(iposva): Do we need to track lock owners? int result = pthread_cond_broadcast(data_.cond()); diff --git a/runtime/bin/thread_fuchsia.h b/runtime/bin/thread_fuchsia.h index 2923a514bb5..c987468e472 100644 --- a/runtime/bin/thread_fuchsia.h +++ b/runtime/bin/thread_fuchsia.h @@ -37,7 +37,6 @@ class ThreadInlineImpl { DISALLOW_COPY_AND_ASSIGN(ThreadInlineImpl); }; - class MutexData { private: MutexData() {} @@ -53,7 +52,6 @@ class MutexData { DISALLOW_COPY_AND_ASSIGN(MutexData); }; - class MonitorData { private: MonitorData() {} diff --git a/runtime/bin/thread_linux.cc b/runtime/bin/thread_linux.cc index ba34d5400b9..b30bbf0e994 100644 --- a/runtime/bin/thread_linux.cc +++ b/runtime/bin/thread_linux.cc @@ -26,7 +26,6 @@ namespace bin { Utils::StrError(result, error_buf, kBufferSize)); \ } - #ifdef DEBUG #define RETURN_ON_PTHREAD_FAILURE(result) \ if (result != 0) { \ @@ -43,7 +42,6 @@ namespace bin { } #endif - static void ComputeTimeSpecMicros(struct timespec* ts, int64_t micros) { int64_t secs = micros / kMicrosecondsPerSecond; int64_t nanos = @@ -58,7 +56,6 @@ static void ComputeTimeSpecMicros(struct timespec* ts, int64_t micros) { } } - class ThreadStartData { public: ThreadStartData(Thread::ThreadStartFunction function, uword parameter) @@ -74,7 +71,6 @@ class ThreadStartData { DISALLOW_COPY_AND_ASSIGN(ThreadStartData); }; - // Dispatch to the thread start function provided by the caller. This trampoline // is used to ensure that the thread is properly destroyed if the thread just // exits. @@ -91,7 +87,6 @@ static void* ThreadStart(void* data_ptr) { return NULL; } - int Thread::Start(ThreadStartFunction function, uword parameter) { pthread_attr_t attr; int result = pthread_attr_init(&attr); @@ -115,7 +110,6 @@ int Thread::Start(ThreadStartFunction function, uword parameter) { return 0; } - const ThreadLocalKey Thread::kUnsetThreadLocalKey = static_cast(-1); const ThreadId Thread::kInvalidThreadId = static_cast(0); @@ -128,48 +122,40 @@ ThreadLocalKey Thread::CreateThreadLocal() { return key; } - void Thread::DeleteThreadLocal(ThreadLocalKey key) { ASSERT(key != kUnsetThreadLocalKey); int result = pthread_key_delete(key); VALIDATE_PTHREAD_RESULT(result); } - void Thread::SetThreadLocal(ThreadLocalKey key, uword value) { ASSERT(key != kUnsetThreadLocalKey); int result = pthread_setspecific(key, reinterpret_cast(value)); VALIDATE_PTHREAD_RESULT(result); } - intptr_t Thread::GetMaxStackSize() { const int kStackSize = (128 * kWordSize * KB); return kStackSize; } - ThreadId Thread::GetCurrentThreadId() { return pthread_self(); } - intptr_t Thread::ThreadIdToIntPtr(ThreadId id) { ASSERT(sizeof(id) == sizeof(intptr_t)); return static_cast(id); } - bool Thread::Compare(ThreadId a, ThreadId b) { return (pthread_equal(a, b) != 0); } - void Thread::InitOnce() { // Nothing to be done. } - Mutex::Mutex() { pthread_mutexattr_t attr; int result = pthread_mutexattr_init(&attr); @@ -188,14 +174,12 @@ Mutex::Mutex() { VALIDATE_PTHREAD_RESULT(result); } - Mutex::~Mutex() { int result = pthread_mutex_destroy(data_.mutex()); // Verify that the pthread_mutex was destroyed. VALIDATE_PTHREAD_RESULT(result); } - void Mutex::Lock() { int result = pthread_mutex_lock(data_.mutex()); // Specifically check for dead lock to help debugging. @@ -204,7 +188,6 @@ void Mutex::Lock() { // TODO(iposva): Do we need to track lock owners? } - bool Mutex::TryLock() { int result = pthread_mutex_trylock(data_.mutex()); // Return false if the lock is busy and locking failed. @@ -216,7 +199,6 @@ bool Mutex::TryLock() { return true; } - void Mutex::Unlock() { // TODO(iposva): Do we need to track lock owners? int result = pthread_mutex_unlock(data_.mutex()); @@ -225,7 +207,6 @@ void Mutex::Unlock() { ASSERT(result == 0); // Verify no other errors. } - Monitor::Monitor() { pthread_mutexattr_t mutex_attr; int result = pthread_mutexattr_init(&mutex_attr); @@ -256,7 +237,6 @@ Monitor::Monitor() { VALIDATE_PTHREAD_RESULT(result); } - Monitor::~Monitor() { int result = pthread_mutex_destroy(data_.mutex()); VALIDATE_PTHREAD_RESULT(result); @@ -265,26 +245,22 @@ Monitor::~Monitor() { VALIDATE_PTHREAD_RESULT(result); } - void Monitor::Enter() { int result = pthread_mutex_lock(data_.mutex()); VALIDATE_PTHREAD_RESULT(result); // TODO(iposva): Do we need to track lock owners? } - void Monitor::Exit() { // TODO(iposva): Do we need to track lock owners? int result = pthread_mutex_unlock(data_.mutex()); VALIDATE_PTHREAD_RESULT(result); } - Monitor::WaitResult Monitor::Wait(int64_t millis) { return WaitMicros(millis * kMicrosecondsPerMillisecond); } - Monitor::WaitResult Monitor::WaitMicros(int64_t micros) { // TODO(iposva): Do we need to track lock owners? Monitor::WaitResult retval = kNotified; @@ -304,14 +280,12 @@ Monitor::WaitResult Monitor::WaitMicros(int64_t micros) { return retval; } - void Monitor::Notify() { // TODO(iposva): Do we need to track lock owners? int result = pthread_cond_signal(data_.cond()); VALIDATE_PTHREAD_RESULT(result); } - void Monitor::NotifyAll() { // TODO(iposva): Do we need to track lock owners? int result = pthread_cond_broadcast(data_.cond()); diff --git a/runtime/bin/thread_linux.h b/runtime/bin/thread_linux.h index 403c353794e..4601efe21ec 100644 --- a/runtime/bin/thread_linux.h +++ b/runtime/bin/thread_linux.h @@ -37,7 +37,6 @@ class ThreadInlineImpl { DISALLOW_COPY_AND_ASSIGN(ThreadInlineImpl); }; - class MutexData { private: MutexData() {} @@ -53,7 +52,6 @@ class MutexData { DISALLOW_COPY_AND_ASSIGN(MutexData); }; - class MonitorData { private: MonitorData() {} diff --git a/runtime/bin/thread_macos.cc b/runtime/bin/thread_macos.cc index d8df64a3e0c..249a4760378 100644 --- a/runtime/bin/thread_macos.cc +++ b/runtime/bin/thread_macos.cc @@ -33,7 +33,6 @@ namespace bin { FATAL2("pthread error: %d (%s)", result, error_message); \ } - #ifdef DEBUG #define RETURN_ON_PTHREAD_FAILURE(result) \ if (result != 0) { \ @@ -51,7 +50,6 @@ namespace bin { } #endif - class ThreadStartData { public: ThreadStartData(Thread::ThreadStartFunction function, uword parameter) @@ -67,7 +65,6 @@ class ThreadStartData { DISALLOW_COPY_AND_ASSIGN(ThreadStartData); }; - // Dispatch to the thread start function provided by the caller. This trampoline // is used to ensure that the thread is properly destroyed if the thread just // exits. @@ -84,7 +81,6 @@ static void* ThreadStart(void* data_ptr) { return NULL; } - int Thread::Start(ThreadStartFunction function, uword parameter) { pthread_attr_t attr; int result = pthread_attr_init(&attr); @@ -108,7 +104,6 @@ int Thread::Start(ThreadStartFunction function, uword parameter) { return 0; } - const ThreadLocalKey Thread::kUnsetThreadLocalKey = static_cast(-1); const ThreadId Thread::kInvalidThreadId = reinterpret_cast(NULL); @@ -121,48 +116,40 @@ ThreadLocalKey Thread::CreateThreadLocal() { return key; } - void Thread::DeleteThreadLocal(ThreadLocalKey key) { ASSERT(key != kUnsetThreadLocalKey); int result = pthread_key_delete(key); VALIDATE_PTHREAD_RESULT(result); } - void Thread::SetThreadLocal(ThreadLocalKey key, uword value) { ASSERT(key != kUnsetThreadLocalKey); int result = pthread_setspecific(key, reinterpret_cast(value)); VALIDATE_PTHREAD_RESULT(result); } - intptr_t Thread::GetMaxStackSize() { const int kStackSize = (128 * kWordSize * KB); return kStackSize; } - ThreadId Thread::GetCurrentThreadId() { return pthread_self(); } - intptr_t Thread::ThreadIdToIntPtr(ThreadId id) { ASSERT(sizeof(id) == sizeof(intptr_t)); return reinterpret_cast(id); } - bool Thread::Compare(ThreadId a, ThreadId b) { return (pthread_equal(a, b) != 0); } - void Thread::InitOnce() { // Nothing to be done. } - Mutex::Mutex() { pthread_mutexattr_t attr; int result = pthread_mutexattr_init(&attr); @@ -181,14 +168,12 @@ Mutex::Mutex() { VALIDATE_PTHREAD_RESULT(result); } - Mutex::~Mutex() { int result = pthread_mutex_destroy(data_.mutex()); // Verify that the pthread_mutex was destroyed. VALIDATE_PTHREAD_RESULT(result); } - void Mutex::Lock() { int result = pthread_mutex_lock(data_.mutex()); // Specifically check for dead lock to help debugging. @@ -197,7 +182,6 @@ void Mutex::Lock() { // TODO(iposva): Do we need to track lock owners? } - bool Mutex::TryLock() { int result = pthread_mutex_trylock(data_.mutex()); // Return false if the lock is busy and locking failed. @@ -209,7 +193,6 @@ bool Mutex::TryLock() { return true; } - void Mutex::Unlock() { // TODO(iposva): Do we need to track lock owners? int result = pthread_mutex_unlock(data_.mutex()); @@ -218,7 +201,6 @@ void Mutex::Unlock() { ASSERT(result == 0); // Verify no other errors. } - Monitor::Monitor() { pthread_mutexattr_t attr; int result = pthread_mutexattr_init(&attr); @@ -239,7 +221,6 @@ Monitor::Monitor() { VALIDATE_PTHREAD_RESULT(result); } - Monitor::~Monitor() { int result = pthread_mutex_destroy(data_.mutex()); VALIDATE_PTHREAD_RESULT(result); @@ -248,26 +229,22 @@ Monitor::~Monitor() { VALIDATE_PTHREAD_RESULT(result); } - void Monitor::Enter() { int result = pthread_mutex_lock(data_.mutex()); VALIDATE_PTHREAD_RESULT(result); // TODO(iposva): Do we need to track lock owners? } - void Monitor::Exit() { // TODO(iposva): Do we need to track lock owners? int result = pthread_mutex_unlock(data_.mutex()); VALIDATE_PTHREAD_RESULT(result); } - Monitor::WaitResult Monitor::Wait(int64_t millis) { return WaitMicros(millis * kMicrosecondsPerMillisecond); } - Monitor::WaitResult Monitor::WaitMicros(int64_t micros) { // TODO(iposva): Do we need to track lock owners? Monitor::WaitResult retval = kNotified; @@ -296,14 +273,12 @@ Monitor::WaitResult Monitor::WaitMicros(int64_t micros) { return retval; } - void Monitor::Notify() { // TODO(iposva): Do we need to track lock owners? int result = pthread_cond_signal(data_.cond()); VALIDATE_PTHREAD_RESULT(result); } - void Monitor::NotifyAll() { // TODO(iposva): Do we need to track lock owners? int result = pthread_cond_broadcast(data_.cond()); diff --git a/runtime/bin/thread_macos.h b/runtime/bin/thread_macos.h index 419bc8b76b6..f6df1974096 100644 --- a/runtime/bin/thread_macos.h +++ b/runtime/bin/thread_macos.h @@ -37,7 +37,6 @@ class ThreadInlineImpl { DISALLOW_COPY_AND_ASSIGN(ThreadInlineImpl); }; - class MutexData { private: MutexData() {} @@ -53,7 +52,6 @@ class MutexData { DISALLOW_COPY_AND_ASSIGN(MutexData); }; - class MonitorData { private: MonitorData() {} diff --git a/runtime/bin/thread_win.cc b/runtime/bin/thread_win.cc index 94d144a21a5..38e6729d939 100644 --- a/runtime/bin/thread_win.cc +++ b/runtime/bin/thread_win.cc @@ -30,7 +30,6 @@ class ThreadStartData { DISALLOW_COPY_AND_ASSIGN(ThreadStartData); }; - // Dispatch to the thread start function provided by the caller. This trampoline // is used to ensure that the thread is properly destroyed if the thread just // exits. @@ -52,7 +51,6 @@ static unsigned int __stdcall ThreadEntry(void* data_ptr) { return 0; } - int Thread::Start(ThreadStartFunction function, uword parameter) { ThreadStartData* start_data = new ThreadStartData(function, parameter); uint32_t tid; @@ -82,7 +80,6 @@ ThreadLocalKey Thread::CreateThreadLocal() { return key; } - void Thread::DeleteThreadLocal(ThreadLocalKey key) { ASSERT(key != kUnsetThreadLocalKey); BOOL result = TlsFree(key); @@ -91,29 +88,24 @@ void Thread::DeleteThreadLocal(ThreadLocalKey key) { } } - intptr_t Thread::GetMaxStackSize() { const int kStackSize = (128 * kWordSize * KB); return kStackSize; } - ThreadId Thread::GetCurrentThreadId() { return ::GetCurrentThreadId(); } - intptr_t Thread::ThreadIdToIntPtr(ThreadId id) { ASSERT(sizeof(id) <= sizeof(intptr_t)); return static_cast(id); } - bool Thread::Compare(ThreadId a, ThreadId b) { return (a == b); } - void Thread::SetThreadLocal(ThreadLocalKey key, uword value) { ASSERT(key != kUnsetThreadLocalKey); BOOL result = TlsSetValue(key, reinterpret_cast(value)); @@ -122,13 +114,11 @@ void Thread::SetThreadLocal(ThreadLocalKey key, uword value) { } } - void Thread::InitOnce() { MonitorWaitData::monitor_wait_data_key_ = Thread::CreateThreadLocal(); MonitorData::GetMonitorWaitDataForThread(); } - Mutex::Mutex() { // Allocate unnamed semaphore with initial count 1 and max count 1. data_.semaphore_ = CreateSemaphore(NULL, 1, 1, NULL); @@ -137,12 +127,10 @@ Mutex::Mutex() { } } - Mutex::~Mutex() { CloseHandle(data_.semaphore_); } - void Mutex::Lock() { DWORD result = WaitForSingleObject(data_.semaphore_, INFINITE); if (result != WAIT_OBJECT_0) { @@ -150,7 +138,6 @@ void Mutex::Lock() { } } - bool Mutex::TryLock() { // Attempt to pass the semaphore but return immediately. DWORD result = WaitForSingleObject(data_.semaphore_, 0); @@ -164,7 +151,6 @@ bool Mutex::TryLock() { return false; } - void Mutex::Unlock() { BOOL result = ReleaseSemaphore(data_.semaphore_, 1, NULL); if (result == 0) { @@ -172,11 +158,9 @@ void Mutex::Unlock() { } } - ThreadLocalKey MonitorWaitData::monitor_wait_data_key_ = Thread::kUnsetThreadLocalKey; - Monitor::Monitor() { InitializeCriticalSection(&data_.cs_); InitializeCriticalSection(&data_.waiters_cs_); @@ -184,23 +168,19 @@ Monitor::Monitor() { data_.waiters_tail_ = NULL; } - Monitor::~Monitor() { DeleteCriticalSection(&data_.cs_); DeleteCriticalSection(&data_.waiters_cs_); } - void Monitor::Enter() { EnterCriticalSection(&data_.cs_); } - void Monitor::Exit() { LeaveCriticalSection(&data_.cs_); } - void MonitorWaitData::ThreadExit() { if (MonitorWaitData::monitor_wait_data_key_ != Thread::kUnsetThreadLocalKey) { uword raw_wait_data = @@ -213,7 +193,6 @@ void MonitorWaitData::ThreadExit() { } } - void MonitorData::AddWaiter(MonitorWaitData* wait_data) { // Add the MonitorWaitData object to the list of objects waiting for // this monitor. @@ -229,7 +208,6 @@ void MonitorData::AddWaiter(MonitorWaitData* wait_data) { LeaveCriticalSection(&waiters_cs_); } - void MonitorData::RemoveWaiter(MonitorWaitData* wait_data) { // Remove the MonitorWaitData object from the list of objects // waiting for this monitor. @@ -261,7 +239,6 @@ void MonitorData::RemoveWaiter(MonitorWaitData* wait_data) { LeaveCriticalSection(&waiters_cs_); } - void MonitorData::SignalAndRemoveFirstWaiter() { EnterCriticalSection(&waiters_cs_); MonitorWaitData* first = waiters_head_; @@ -284,7 +261,6 @@ void MonitorData::SignalAndRemoveFirstWaiter() { LeaveCriticalSection(&waiters_cs_); } - void MonitorData::SignalAndRemoveAllWaiters() { EnterCriticalSection(&waiters_cs_); // Extract list to signal. @@ -308,7 +284,6 @@ void MonitorData::SignalAndRemoveAllWaiters() { LeaveCriticalSection(&waiters_cs_); } - MonitorWaitData* MonitorData::GetMonitorWaitDataForThread() { // Ensure that the thread local key for monitor wait data objects is // initialized. @@ -332,7 +307,6 @@ MonitorWaitData* MonitorData::GetMonitorWaitDataForThread() { return wait_data; } - Monitor::WaitResult Monitor::Wait(int64_t millis) { Monitor::WaitResult retval = kNotified; @@ -374,7 +348,6 @@ Monitor::WaitResult Monitor::Wait(int64_t millis) { return retval; } - Monitor::WaitResult Monitor::WaitMicros(int64_t micros) { // TODO(johnmccutchan): Investigate sub-millisecond sleep times on Windows. int64_t millis = micros / kMicrosecondsPerMillisecond; @@ -387,12 +360,10 @@ Monitor::WaitResult Monitor::WaitMicros(int64_t micros) { return Wait(millis); } - void Monitor::Notify() { data_.SignalAndRemoveFirstWaiter(); } - void Monitor::NotifyAll() { // If one of the objects in the list of waiters wakes because of a // timeout before we signal it, that object will get an extra diff --git a/runtime/bin/thread_win.h b/runtime/bin/thread_win.h index 85ab38f1a51..cd14e441925 100644 --- a/runtime/bin/thread_win.h +++ b/runtime/bin/thread_win.h @@ -36,7 +36,6 @@ class ThreadInlineImpl { DISALLOW_COPY_AND_ASSIGN(ThreadInlineImpl); }; - class MutexData { private: MutexData() {} @@ -50,7 +49,6 @@ class MutexData { DISALLOW_COPY_AND_ASSIGN(MutexData); }; - class MonitorWaitData { public: static void ThreadExit(); @@ -75,11 +73,9 @@ class MonitorWaitData { friend class MonitorData; friend class Thread; - DISALLOW_COPY_AND_ASSIGN(MonitorWaitData); }; - class MonitorData { private: MonitorData() {} diff --git a/runtime/bin/utils.h b/runtime/bin/utils.h index 03c1578b021..b313ff1dd1e 100644 --- a/runtime/bin/utils.h +++ b/runtime/bin/utils.h @@ -51,7 +51,6 @@ class OSError { DISALLOW_COPY_AND_ASSIGN(OSError); }; - class StringUtils { public: // The following methods convert the argument if needed. The @@ -87,7 +86,6 @@ class StringUtils { DISALLOW_IMPLICIT_CONSTRUCTORS(StringUtils); }; - class ShellUtils { public: // Convert all the arguments to UTF8. On Windows, the arguments are @@ -102,7 +100,6 @@ class ShellUtils { DISALLOW_IMPLICIT_CONSTRUCTORS(ShellUtils); }; - class TimerUtils { public: static void InitOnce(); diff --git a/runtime/bin/utils_android.cc b/runtime/bin/utils_android.cc index adb65842c62..83bfcc77c40 100644 --- a/runtime/bin/utils_android.cc +++ b/runtime/bin/utils_android.cc @@ -26,7 +26,6 @@ OSError::OSError() : sub_system_(kSystem), code_(0), message_(NULL) { SetMessage(error_message); } - void OSError::SetCodeAndMessage(SubSystem sub_system, int code) { set_sub_system(sub_system); set_code(code); @@ -42,7 +41,6 @@ void OSError::SetCodeAndMessage(SubSystem sub_system, int code) { } } - const char* StringUtils::ConsoleStringToUtf8(const char* str, intptr_t len, intptr_t* result_len) { @@ -50,7 +48,6 @@ const char* StringUtils::ConsoleStringToUtf8(const char* str, return NULL; } - const char* StringUtils::Utf8ToConsoleString(const char* utf8, intptr_t len, intptr_t* result_len) { @@ -58,7 +55,6 @@ const char* StringUtils::Utf8ToConsoleString(const char* utf8, return NULL; } - char* StringUtils::ConsoleStringToUtf8(char* str, intptr_t len, intptr_t* result_len) { @@ -66,7 +62,6 @@ char* StringUtils::ConsoleStringToUtf8(char* str, return NULL; } - char* StringUtils::Utf8ToConsoleString(char* utf8, intptr_t len, intptr_t* result_len) { @@ -74,25 +69,20 @@ char* StringUtils::Utf8ToConsoleString(char* utf8, return NULL; } - char* StringUtils::StrNDup(const char* s, intptr_t n) { return strndup(s, n); } - bool ShellUtils::GetUtf8Argv(int argc, char** argv) { return false; } - void TimerUtils::InitOnce() {} - int64_t TimerUtils::GetCurrentMonotonicMillis() { return GetCurrentMonotonicMicros() / 1000; } - int64_t TimerUtils::GetCurrentMonotonicMicros() { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) { @@ -106,7 +96,6 @@ int64_t TimerUtils::GetCurrentMonotonicMicros() { return result; } - void TimerUtils::Sleep(int64_t millis) { struct timespec req; // requested. struct timespec rem; // remainder. diff --git a/runtime/bin/utils_fuchsia.cc b/runtime/bin/utils_fuchsia.cc index 09824d21b3d..bdde6b7dad1 100644 --- a/runtime/bin/utils_fuchsia.cc +++ b/runtime/bin/utils_fuchsia.cc @@ -24,7 +24,6 @@ OSError::OSError() : sub_system_(kSystem), code_(0), message_(NULL) { SetMessage(Utils::StrError(errno, error_buf, kBufferSize)); } - void OSError::SetCodeAndMessage(SubSystem sub_system, int code) { set_sub_system(sub_system); set_code(code); @@ -39,7 +38,6 @@ void OSError::SetCodeAndMessage(SubSystem sub_system, int code) { } } - const char* StringUtils::ConsoleStringToUtf8(const char* str, intptr_t len, intptr_t* result_len) { @@ -47,7 +45,6 @@ const char* StringUtils::ConsoleStringToUtf8(const char* str, return NULL; } - const char* StringUtils::Utf8ToConsoleString(const char* utf8, intptr_t len, intptr_t* result_len) { @@ -55,7 +52,6 @@ const char* StringUtils::Utf8ToConsoleString(const char* utf8, return NULL; } - char* StringUtils::ConsoleStringToUtf8(char* str, intptr_t len, intptr_t* result_len) { @@ -63,7 +59,6 @@ char* StringUtils::ConsoleStringToUtf8(char* str, return NULL; } - char* StringUtils::Utf8ToConsoleString(char* utf8, intptr_t len, intptr_t* result_len) { @@ -71,31 +66,25 @@ char* StringUtils::Utf8ToConsoleString(char* utf8, return NULL; } - char* StringUtils::StrNDup(const char* s, intptr_t n) { return strndup(s, n); } - bool ShellUtils::GetUtf8Argv(int argc, char** argv) { return false; } - void TimerUtils::InitOnce() {} - int64_t TimerUtils::GetCurrentMonotonicMillis() { return GetCurrentMonotonicMicros() / 1000; } - int64_t TimerUtils::GetCurrentMonotonicMicros() { int64_t ticks = mx_time_get(MX_CLOCK_MONOTONIC); return ticks / kNanosecondsPerMicrosecond; } - void TimerUtils::Sleep(int64_t millis) { mx_nanosleep(mx_deadline_after(millis * kMicrosecondsPerMillisecond * kNanosecondsPerMicrosecond)); diff --git a/runtime/bin/utils_linux.cc b/runtime/bin/utils_linux.cc index 09b852f31d6..766ccdbc03c 100644 --- a/runtime/bin/utils_linux.cc +++ b/runtime/bin/utils_linux.cc @@ -25,7 +25,6 @@ OSError::OSError() : sub_system_(kSystem), code_(0), message_(NULL) { SetMessage(Utils::StrError(errno, error_buf, kBufferSize)); } - void OSError::SetCodeAndMessage(SubSystem sub_system, int code) { set_sub_system(sub_system); set_code(code); @@ -40,7 +39,6 @@ void OSError::SetCodeAndMessage(SubSystem sub_system, int code) { } } - const char* StringUtils::ConsoleStringToUtf8(const char* str, intptr_t len, intptr_t* result_len) { @@ -48,7 +46,6 @@ const char* StringUtils::ConsoleStringToUtf8(const char* str, return NULL; } - const char* StringUtils::Utf8ToConsoleString(const char* utf8, intptr_t len, intptr_t* result_len) { @@ -56,7 +53,6 @@ const char* StringUtils::Utf8ToConsoleString(const char* utf8, return NULL; } - char* StringUtils::ConsoleStringToUtf8(char* str, intptr_t len, intptr_t* result_len) { @@ -64,7 +60,6 @@ char* StringUtils::ConsoleStringToUtf8(char* str, return NULL; } - char* StringUtils::Utf8ToConsoleString(char* utf8, intptr_t len, intptr_t* result_len) { @@ -72,25 +67,20 @@ char* StringUtils::Utf8ToConsoleString(char* utf8, return NULL; } - char* StringUtils::StrNDup(const char* s, intptr_t n) { return strndup(s, n); } - bool ShellUtils::GetUtf8Argv(int argc, char** argv) { return false; } - void TimerUtils::InitOnce() {} - int64_t TimerUtils::GetCurrentMonotonicMillis() { return GetCurrentMonotonicMicros() / 1000; } - int64_t TimerUtils::GetCurrentMonotonicMicros() { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) { @@ -104,7 +94,6 @@ int64_t TimerUtils::GetCurrentMonotonicMicros() { return result; } - void TimerUtils::Sleep(int64_t millis) { struct timespec req; // requested. struct timespec rem; // remainder. diff --git a/runtime/bin/utils_macos.cc b/runtime/bin/utils_macos.cc index 2f55dbf524e..60157ca8370 100644 --- a/runtime/bin/utils_macos.cc +++ b/runtime/bin/utils_macos.cc @@ -32,7 +32,6 @@ OSError::OSError() : sub_system_(kSystem), code_(0), message_(NULL) { SetMessage(error_message); } - void OSError::SetCodeAndMessage(SubSystem sub_system, int code) { set_sub_system(sub_system); set_code(code); @@ -48,7 +47,6 @@ void OSError::SetCodeAndMessage(SubSystem sub_system, int code) { } } - const char* StringUtils::ConsoleStringToUtf8(const char* str, intptr_t len, intptr_t* result_len) { @@ -56,7 +54,6 @@ const char* StringUtils::ConsoleStringToUtf8(const char* str, return NULL; } - const char* StringUtils::Utf8ToConsoleString(const char* utf8, intptr_t len, intptr_t* result_len) { @@ -64,7 +61,6 @@ const char* StringUtils::Utf8ToConsoleString(const char* utf8, return NULL; } - char* StringUtils::ConsoleStringToUtf8(char* str, intptr_t len, intptr_t* result_len) { @@ -72,7 +68,6 @@ char* StringUtils::ConsoleStringToUtf8(char* str, return NULL; } - char* StringUtils::Utf8ToConsoleString(char* utf8, intptr_t len, intptr_t* result_len) { @@ -80,7 +75,6 @@ char* StringUtils::Utf8ToConsoleString(char* utf8, return NULL; } - char* StringUtils::StrNDup(const char* s, intptr_t n) { // strndup has only been added to Mac OS X in 10.7. We are supplying // our own copy here if needed. @@ -104,26 +98,21 @@ char* StringUtils::StrNDup(const char* s, intptr_t n) { #endif // !defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || ... } - bool ShellUtils::GetUtf8Argv(int argc, char** argv) { return false; } - static mach_timebase_info_data_t timebase_info; - void TimerUtils::InitOnce() { kern_return_t kr = mach_timebase_info(&timebase_info); ASSERT(KERN_SUCCESS == kr); } - int64_t TimerUtils::GetCurrentMonotonicMillis() { return GetCurrentMonotonicMicros() / 1000; } - #if HOST_OS_IOS static int64_t GetCurrentTimeMicros() { // gettimeofday has microsecond resolution. @@ -136,7 +125,6 @@ static int64_t GetCurrentTimeMicros() { } #endif // HOST_OS_IOS - int64_t TimerUtils::GetCurrentMonotonicMicros() { #if HOST_OS_IOS // On iOS mach_absolute_time stops while the device is sleeping. Instead use @@ -163,7 +151,6 @@ int64_t TimerUtils::GetCurrentMonotonicMicros() { #endif // HOST_OS_IOS } - void TimerUtils::Sleep(int64_t millis) { struct timespec req; // requested. struct timespec rem; // remainder. diff --git a/runtime/bin/utils_win.cc b/runtime/bin/utils_win.cc index ef4851a6fa3..e06cb9bb4d9 100644 --- a/runtime/bin/utils_win.cc +++ b/runtime/bin/utils_win.cc @@ -31,7 +31,6 @@ void FormatMessageIntoBuffer(DWORD code, wchar_t* buffer, int buffer_length) { buffer[buffer_length - 1] = 0; } - OSError::OSError() : sub_system_(kSystem), code_(0), message_(NULL) { set_code(GetLastError()); @@ -42,7 +41,6 @@ OSError::OSError() : sub_system_(kSystem), code_(0), message_(NULL) { SetMessage(utf8); } - void OSError::SetCodeAndMessage(SubSystem sub_system, int code) { set_sub_system(sub_system); set_code(code); @@ -54,7 +52,6 @@ void OSError::SetCodeAndMessage(SubSystem sub_system, int code) { SetMessage(utf8); } - char* StringUtils::ConsoleStringToUtf8(char* str, intptr_t len, intptr_t* result_len) { @@ -67,7 +64,6 @@ char* StringUtils::ConsoleStringToUtf8(char* str, return utf8; } - char* StringUtils::Utf8ToConsoleString(char* utf8, intptr_t len, intptr_t* result_len) { @@ -88,7 +84,6 @@ char* StringUtils::Utf8ToConsoleString(char* utf8, return ansi; } - char* StringUtilsWin::WideToUtf8(wchar_t* wide, intptr_t len, intptr_t* result_len) { @@ -105,7 +100,6 @@ char* StringUtilsWin::WideToUtf8(wchar_t* wide, return utf8; } - wchar_t* StringUtilsWin::Utf8ToWide(char* utf8, intptr_t len, intptr_t* result_len) { @@ -122,7 +116,6 @@ wchar_t* StringUtilsWin::Utf8ToWide(char* utf8, return wide; } - const char* StringUtils::Utf8ToConsoleString(const char* utf8, intptr_t len, intptr_t* result_len) { @@ -130,7 +123,6 @@ const char* StringUtils::Utf8ToConsoleString(const char* utf8, const_cast(utf8), len, result_len)); } - const char* StringUtils::ConsoleStringToUtf8(const char* str, intptr_t len, intptr_t* result_len) { @@ -138,7 +130,6 @@ const char* StringUtils::ConsoleStringToUtf8(const char* str, const_cast(str), len, result_len)); } - const char* StringUtilsWin::WideToUtf8(const wchar_t* wide, intptr_t len, intptr_t* result_len) { @@ -146,7 +137,6 @@ const char* StringUtilsWin::WideToUtf8(const wchar_t* wide, StringUtilsWin::WideToUtf8(const_cast(wide), len, result_len)); } - const wchar_t* StringUtilsWin::Utf8ToWide(const char* utf8, intptr_t len, intptr_t* result_len) { @@ -154,7 +144,6 @@ const wchar_t* StringUtilsWin::Utf8ToWide(const char* utf8, StringUtilsWin::Utf8ToWide(const_cast(utf8), len, result_len)); } - char* StringUtils::StrNDup(const char* s, intptr_t n) { intptr_t len = strlen(s); if ((n < 0) || (len < 0)) { @@ -171,7 +160,6 @@ char* StringUtils::StrNDup(const char* s, intptr_t n) { return reinterpret_cast(memmove(result, s, len)); } - bool ShellUtils::GetUtf8Argv(int argc, char** argv) { wchar_t* command_line = GetCommandLineW(); int unicode_argc; @@ -195,7 +183,6 @@ bool ShellUtils::GetUtf8Argv(int argc, char** argv) { return true; } - // Although win32 uses 64-bit integers for representing timestamps, // these are packed into a FILETIME structure. The FILETIME // structure is just a struct representing a 64-bit integer. The @@ -207,7 +194,6 @@ union TimeStamp { int64_t t_; }; - static int64_t GetCurrentTimeMicros() { static const int64_t kTimeEpoc = 116444736000000000LL; static const int64_t kTimeScaler = 10; // 100 ns to us. @@ -217,7 +203,6 @@ static int64_t GetCurrentTimeMicros() { return (time.t_ - kTimeEpoc) / kTimeScaler; } - static int64_t qpc_ticks_per_second = 0; void TimerUtils::InitOnce() { @@ -229,12 +214,10 @@ void TimerUtils::InitOnce() { } } - int64_t TimerUtils::GetCurrentMonotonicMillis() { return GetCurrentMonotonicMicros() / 1000; } - int64_t TimerUtils::GetCurrentMonotonicMicros() { if (qpc_ticks_per_second == 0) { // QueryPerformanceCounter not supported, fallback. @@ -252,7 +235,6 @@ int64_t TimerUtils::GetCurrentMonotonicMicros() { return result; } - void TimerUtils::Sleep(int64_t millis) { ::Sleep(millis); } diff --git a/runtime/bin/vmservice_dartium.cc b/runtime/bin/vmservice_dartium.cc index 2b674d2193a..7c84daa3634 100644 --- a/runtime/bin/vmservice_dartium.cc +++ b/runtime/bin/vmservice_dartium.cc @@ -45,7 +45,6 @@ void VmServiceServer::Bootstrap() { EventHandler::Start(); } - Dart_Isolate VmServiceServer::CreateIsolate(const uint8_t* snapshot_buffer) { ASSERT(snapshot_buffer != NULL); // Create the isolate. @@ -66,11 +65,10 @@ Dart_Isolate VmServiceServer::CreateIsolate(const uint8_t* snapshot_buffer) { ASSERT(Dart_IsServiceIsolate(isolate)); if (!VmService::Setup( - IsIpv6Only() ? DEFAULT_VM_SERVICE_SERVER_IP_V6 : - DEFAULT_VM_SERVICE_SERVER_IP_V4, - DEFAULT_VM_SERVICE_SERVER_PORT, - false /* running_precompiled */, false /* disable origin checks */, - false /* trace_loading */)) { + IsIpv6Only() ? DEFAULT_VM_SERVICE_SERVER_IP_V6 + : DEFAULT_VM_SERVICE_SERVER_IP_V4, + DEFAULT_VM_SERVICE_SERVER_PORT, false /* running_precompiled */, + false /* disable origin checks */, false /* trace_loading */)) { fprintf(stderr, "Vmservice::Setup failed: %s\n", VmService::GetErrorMessage()); isolate = NULL; @@ -80,12 +78,10 @@ Dart_Isolate VmServiceServer::CreateIsolate(const uint8_t* snapshot_buffer) { return isolate; } - const char* VmServiceServer::GetServerAddress() { return VmService::GetServerAddress(); } - void VmServiceServer::DecompressAssets(const uint8_t* input, unsigned int input_len, uint8_t** output, @@ -148,7 +144,6 @@ void VmServiceServer::DecompressAssets(const uint8_t* input, inflateEnd(&strm); } - /* DISALLOW_ALLOCATION */ void VmServiceServer::operator delete(void* pointer) { fprintf(stderr, "unreachable code\n"); diff --git a/runtime/bin/vmservice_impl.cc b/runtime/bin/vmservice_impl.cc index 82968c3ae45..c0512f8408e 100644 --- a/runtime/bin/vmservice_impl.cc +++ b/runtime/bin/vmservice_impl.cc @@ -92,7 +92,6 @@ class Resources { DISALLOW_IMPLICIT_CONSTRUCTORS(Resources); }; - void NotifyServerState(Dart_NativeArguments args) { Dart_EnterScope(); const char* uri_chars; @@ -112,25 +111,21 @@ void NotifyServerState(Dart_NativeArguments args) { Dart_ExitScope(); } - static void Shutdown(Dart_NativeArguments args) { // NO-OP. } - struct VmServiceIONativeEntry { const char* name; int num_arguments; Dart_NativeFunction function; }; - static VmServiceIONativeEntry _VmServiceIONativeEntries[] = { {"VMServiceIO_NotifyServerState", 1, NotifyServerState}, {"VMServiceIO_Shutdown", 0, Shutdown}, }; - static Dart_NativeFunction VmServiceIONativeResolver(Dart_Handle name, int num_arguments, bool* auto_setup_scope) { @@ -151,11 +146,9 @@ static Dart_NativeFunction VmServiceIONativeResolver(Dart_Handle name, return NULL; } - const char* VmService::error_msg_ = NULL; char VmService::server_uri_[kServerUriStringBufferSize]; - bool VmService::LoadForGenPrecompiled(void* vmservice_kernel) { Dart_Handle result; Dart_SetLibraryTagHandler(LibraryTagHandler); @@ -176,7 +169,6 @@ bool VmService::LoadForGenPrecompiled(void* vmservice_kernel) { return true; } - bool VmService::Setup(const char* server_ip, intptr_t server_port, bool running_precompiled, @@ -291,12 +283,10 @@ bool VmService::Setup(const char* server_ip, return true; } - const char* VmService::GetErrorMessage() { return (error_msg_ == NULL) ? "No error." : error_msg_; } - void VmService::SetServerAddress(const char* server_uri) { if (server_uri == NULL) { server_uri = ""; @@ -309,7 +299,6 @@ void VmService::SetServerAddress(const char* server_uri) { server_uri_[kServerUriStringBufferSize - 1] = '\0'; } - Dart_Handle VmService::GetSource(const char* name) { const intptr_t kBufferSize = 512; char buffer[kBufferSize]; @@ -324,14 +313,12 @@ Dart_Handle VmService::GetSource(const char* name) { return Dart_NewStringFromCString(vmservice_source); } - Dart_Handle VmService::LoadScript(const char* name) { Dart_Handle uri = Dart_NewStringFromCString(kVMServiceIOLibraryUri); Dart_Handle source = GetSource(name); return Dart_LoadScript(uri, Dart_Null(), source, 0, 0); } - Dart_Handle VmService::LookupOrLoadLibrary(const char* name) { Dart_Handle uri = Dart_NewStringFromCString(kVMServiceIOLibraryUri); Dart_Handle library = Dart_LookupLibrary(uri); @@ -342,14 +329,12 @@ Dart_Handle VmService::LookupOrLoadLibrary(const char* name) { return library; } - Dart_Handle VmService::LoadSource(Dart_Handle library, const char* name) { Dart_Handle uri = Dart_NewStringFromCString(name); Dart_Handle source = GetSource(name); return Dart_LoadSource(library, uri, Dart_Null(), source, 0, 0); } - Dart_Handle VmService::LibraryTagHandler(Dart_LibraryTag tag, Dart_Handle library, Dart_Handle url) { @@ -386,6 +371,5 @@ Dart_Handle VmService::LibraryTagHandler(Dart_LibraryTag tag, return Dart_LoadSource(library, url, Dart_Null(), source, 0, 0); } - } // namespace bin } // namespace dart diff --git a/runtime/include/dart_api.h b/runtime/include/dart_api.h index ab57de43b4a..6cbebeba35c 100644 --- a/runtime/include/dart_api.h +++ b/runtime/include/dart_api.h @@ -528,7 +528,6 @@ DART_EXPORT void Dart_DeleteWeakPersistentHandle( Dart_Isolate isolate, Dart_WeakPersistentHandle object); - /* * ============================ * Garbage Collection Callbacks @@ -572,7 +571,6 @@ DART_EXPORT Dart_Handle Dart_SetGcCallbacks(Dart_GcPrologueCallback prologue_callback, Dart_GcEpilogueCallback epilogue_callback); - /* * ========================== * Initialization and Globals @@ -588,7 +586,6 @@ Dart_SetGcCallbacks(Dart_GcPrologueCallback prologue_callback, */ DART_EXPORT const char* Dart_VersionString(); - /** * Isolate specific flags are set when creating a new isolate using the * Dart_IsolateFlags structure. @@ -848,7 +845,6 @@ DART_EXPORT bool Dart_SetVMFlags(int argc, const char** argv); */ DART_EXPORT bool Dart_IsVMFlagSet(const char* flag_name); - /* * ======== * Isolates @@ -1066,7 +1062,6 @@ DART_EXPORT void Dart_InterruptIsolate(Dart_Isolate isolate); */ DART_EXPORT bool Dart_IsolateMakeRunnable(Dart_Isolate isolate); - /* * ================== * Messages and Ports @@ -1195,7 +1190,6 @@ DART_EXPORT bool Dart_IsPausedOnExit(); */ DART_EXPORT void Dart_SetPausedOnExit(bool paused); - /** * Called when the embedder has caught a top level unhandled exception error * in the current isolate. @@ -1207,13 +1201,11 @@ DART_EXPORT void Dart_SetPausedOnExit(bool paused); */ DART_EXPORT void Dart_SetStickyError(Dart_Handle error); - /** * Does the current isolate have a sticky error? */ DART_EXPORT bool Dart_HasStickyError(); - /** * Gets the sticky error for the current isolate. * @@ -1221,7 +1213,6 @@ DART_EXPORT bool Dart_HasStickyError(); */ DART_EXPORT Dart_Handle Dart_GetStickyError(); - /** * Handles the next pending message for the current isolate. * @@ -1326,7 +1317,6 @@ DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id); DART_EXPORT Dart_Handle Dart_SendPortGetId(Dart_Handle port, Dart_Port* port_id); - /* * ====== * Scopes @@ -1377,7 +1367,6 @@ DART_EXPORT void Dart_ExitScope(); */ DART_EXPORT uint8_t* Dart_ScopeAllocate(intptr_t size); - /* * ======= * Objects @@ -1438,7 +1427,6 @@ DART_EXPORT Dart_Handle Dart_ObjectIsType(Dart_Handle object, Dart_Handle type, bool* instanceof); - /** * Query object type. * @@ -1466,7 +1454,6 @@ DART_EXPORT bool Dart_IsTypedData(Dart_Handle object); DART_EXPORT bool Dart_IsByteBuffer(Dart_Handle object); DART_EXPORT bool Dart_IsFuture(Dart_Handle object); - /* * ========= * Instances @@ -1491,7 +1478,6 @@ DART_EXPORT bool Dart_IsFuture(Dart_Handle object); */ DART_EXPORT Dart_Handle Dart_InstanceGetType(Dart_Handle instance); - /* * ============================= * Numbers, Integers and Doubles @@ -1625,7 +1611,6 @@ DART_EXPORT Dart_Handle Dart_DoubleValue(Dart_Handle double_obj, double* value); DART_EXPORT Dart_Handle Dart_GetClosure(Dart_Handle library, Dart_Handle function_name); - /* * ======== * Booleans @@ -1670,7 +1655,6 @@ DART_EXPORT Dart_Handle Dart_NewBoolean(bool value); */ DART_EXPORT Dart_Handle Dart_BooleanValue(Dart_Handle boolean_obj, bool* value); - /* * ======= * Strings @@ -1993,7 +1977,6 @@ DART_EXPORT Dart_Handle Dart_ListSetAsBytes(Dart_Handle list, const uint8_t* native_array, intptr_t length); - /* * ==== * Maps @@ -2037,7 +2020,6 @@ DART_EXPORT Dart_Handle Dart_MapContainsKey(Dart_Handle map, Dart_Handle key); */ DART_EXPORT Dart_Handle Dart_MapKeys(Dart_Handle map); - /* * ========== * Typed Data @@ -2164,7 +2146,6 @@ DART_EXPORT Dart_Handle Dart_TypedDataReleaseData(Dart_Handle object); */ DART_EXPORT Dart_Handle Dart_GetDataFromByteBuffer(Dart_Handle byte_buffer); - /* * ============================================================ * Invoking Constructors, Methods, Closures and Field accessors @@ -2332,7 +2313,6 @@ DART_EXPORT Dart_Handle Dart_SetField(Dart_Handle container, Dart_Handle name, Dart_Handle value); - /* * ========== * Exceptions @@ -2378,7 +2358,6 @@ DART_EXPORT Dart_Handle Dart_ThrowException(Dart_Handle exception); DART_EXPORT Dart_Handle Dart_RethrowException(Dart_Handle exception, Dart_Handle stacktrace); - /* * =========================== * Native fields and functions @@ -2507,7 +2486,6 @@ Dart_GetNativeArguments(Dart_NativeArguments args, const Dart_NativeArgument_Descriptor* arg_descriptors, Dart_NativeArgument_Value* arg_values); - /** * Gets the native argument at some index. */ @@ -2665,7 +2643,6 @@ typedef Dart_NativeFunction (*Dart_NativeEntryResolver)(Dart_Handle name, */ typedef const uint8_t* (*Dart_NativeEntrySymbol)(Dart_NativeFunction nf); - /* * =========== * Environment @@ -2706,7 +2683,6 @@ Dart_SetNativeResolver(Dart_Handle library, Dart_NativeEntrySymbol symbol); /* TODO(turnidge): Rename to Dart_LibrarySetNativeResolver? */ - /** * Returns the callback used to resolve native functions for a library. * @@ -2718,7 +2694,6 @@ Dart_SetNativeResolver(Dart_Handle library, DART_EXPORT Dart_Handle Dart_GetNativeResolver(Dart_Handle library, Dart_NativeEntryResolver* resolver); - /** * Returns the callback used to resolve native function symbols for a library. * @@ -2730,7 +2705,6 @@ Dart_GetNativeResolver(Dart_Handle library, Dart_NativeEntryResolver* resolver); DART_EXPORT Dart_Handle Dart_GetNativeSymbol(Dart_Handle library, Dart_NativeEntrySymbol* resolver); - /* * ===================== * Scripts and Libraries @@ -2880,7 +2854,6 @@ Dart_LoadScriptFromSnapshot(const uint8_t* script_snapshot_buffer, */ DART_EXPORT Dart_Handle Dart_LoadKernel(void* kernel_program); - /** * Constructs an in-memory kernel program form a binary. * @@ -2903,7 +2876,6 @@ DART_EXPORT void* Dart_ReadKernelBinary(const uint8_t* buffer, */ DART_EXPORT Dart_Handle Dart_RootLibrary(); - /** * Sets the root library for the current isolate. * @@ -2911,7 +2883,6 @@ DART_EXPORT Dart_Handle Dart_RootLibrary(); */ DART_EXPORT Dart_Handle Dart_SetRootLibrary(Dart_Handle library); - /** * Lookup or instantiate a type by name and type arguments from a Library. * @@ -2949,18 +2920,15 @@ DART_EXPORT Dart_Handle Dart_GetClass(Dart_Handle library, */ DART_EXPORT Dart_Handle Dart_LibraryUrl(Dart_Handle library); - /** * \return An array of libraries. */ DART_EXPORT Dart_Handle Dart_GetLoadedLibraries(); - DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url); /* TODO(turnidge): Consider returning Dart_Null() when the library is * not found to distinguish that from a true error case. */ - /** * Report an loading error for the library. * @@ -2974,7 +2942,6 @@ DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url); DART_EXPORT Dart_Handle Dart_LibraryHandleError(Dart_Handle library, Dart_Handle error); - /** * Called by the embedder to provide the source for an "import" * directive. This function should be called in response to a @@ -3021,7 +2988,6 @@ DART_EXPORT Dart_Handle Dart_LibraryImportLibrary(Dart_Handle library, Dart_Handle import, Dart_Handle prefix); - /** * Returns a flattened list of pairs. The first element in each pair is the * importing library and and the second element is the imported library for each @@ -3033,7 +2999,6 @@ DART_EXPORT Dart_Handle Dart_LibraryImportLibrary(Dart_Handle library, */ DART_EXPORT Dart_Handle Dart_GetImportsOfScheme(Dart_Handle scheme); - /** * Called by the embedder to provide the source for a "part of" * directive. This function should be called in response to a @@ -3067,7 +3032,6 @@ DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library, intptr_t column_offset); /* TODO(turnidge): Rename to Dart_LibraryLoadSource? */ - /** * Loads a patch source string into a library. * @@ -3079,7 +3043,6 @@ DART_EXPORT Dart_Handle Dart_LibraryLoadPatch(Dart_Handle library, Dart_Handle url, Dart_Handle patch_source); - /** * Indicates that all outstanding load requests have been satisfied. * This finalizes all the new classes loaded and optionally completes @@ -3095,7 +3058,6 @@ DART_EXPORT Dart_Handle Dart_LibraryLoadPatch(Dart_Handle library, */ DART_EXPORT Dart_Handle Dart_FinalizeLoading(bool complete_futures); - /* * ===== * Peers @@ -3133,14 +3095,12 @@ DART_EXPORT Dart_Handle Dart_GetPeer(Dart_Handle object, void** peer); */ DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); - /* * ====== * Kernel * ====== */ - /** * Experimental support for Dart to Kernel parser isolate. * @@ -3186,7 +3146,6 @@ Dart_CompileSourcesToKernel(const char* script_uri, * ======= */ - #define DART_VM_SERVICE_ISOLATE_NAME "vm-service" /** @@ -3198,7 +3157,6 @@ Dart_CompileSourcesToKernel(const char* script_uri, */ DART_EXPORT bool Dart_IsServiceIsolate(Dart_Isolate isolate); - /** * Returns the port that script load requests should be sent on. * @@ -3207,7 +3165,6 @@ DART_EXPORT bool Dart_IsServiceIsolate(Dart_Isolate isolate); */ DART_EXPORT Dart_Port Dart_ServiceWaitForLoadPort(); - /** * Record all functions which have been compiled in the current isolate. * @@ -3220,7 +3177,6 @@ DART_EXPORT Dart_Port Dart_ServiceWaitForLoadPort(); DART_EXPORT Dart_Handle Dart_SaveCompilationTrace(uint8_t** buffer, intptr_t* buffer_length); - /** * Compile all functions from data from Dart_SaveCompilationTrace. Unlike JIT * feedback, this data is fuzzy: loading does not need to happen in the exact @@ -3232,7 +3188,6 @@ DART_EXPORT Dart_Handle Dart_SaveCompilationTrace(uint8_t** buffer, DART_EXPORT Dart_Handle Dart_LoadCompilationTrace(uint8_t* buffer, intptr_t buffer_length); - /* * ============== * Precompilation @@ -3255,14 +3210,12 @@ DART_EXPORT Dart_Handle Dart_LoadCompilationTrace(uint8_t* buffer, DART_EXPORT Dart_Handle Dart_SaveJITFeedback(uint8_t** buffer, intptr_t* buffer_length); - typedef struct { const char* library_uri; const char* class_name; const char* function_name; } Dart_QualifiedFunctionName; - /** * Compiles all functions reachable from the provided entry points and marks * the isolate to disallow future compilation. @@ -3287,7 +3240,6 @@ Dart_Precompile(Dart_QualifiedFunctionName entry_points[], uint8_t* jit_feedback, intptr_t jit_feedback_length); - /** * Creates a precompiled snapshot. * - A root library must have been loaded. @@ -3315,7 +3267,6 @@ DART_EXPORT Dart_Handle Dart_CreateAppAOTSnapshotAsAssembly(uint8_t** assembly_buffer, intptr_t* assembly_size); - /** * Same as Dart_CreateAppAOTSnapshotAsAssembly, except all the pieces are * provided directly as bytes that the embedder can load with mmap. The @@ -3341,7 +3292,6 @@ Dart_CreateAppAOTSnapshotAsBlobs(uint8_t** vm_snapshot_data_buffer, */ DART_EXPORT Dart_Handle Dart_SortClasses(); - /** * Creates a snapshot that caches compiled code and type feedback for faster * startup and quicker warmup in a subsequent process. @@ -3370,7 +3320,6 @@ Dart_CreateAppJITSnapshotAsBlobs(uint8_t** isolate_snapshot_data_buffer, uint8_t** isolate_snapshot_instructions_buffer, intptr_t* isolate_snapshot_instructions_size); - /** * Like Dart_CreateAppJITSnapshotAsBlobs, but also creates a new VM snapshot. */ @@ -3384,7 +3333,6 @@ DART_EXPORT Dart_Handle Dart_CreateCoreJITSnapshotAsBlobs( uint8_t** isolate_snapshot_instructions_buffer, intptr_t* isolate_snapshot_instructions_size); - /** * Returns whether the VM only supports running from precompiled snapshots and * not from any other kind of snapshot or from source (that is, the VM was @@ -3392,7 +3340,6 @@ DART_EXPORT Dart_Handle Dart_CreateCoreJITSnapshotAsBlobs( */ DART_EXPORT bool Dart_IsPrecompiledRuntime(); - /** * Print a native stack trace. Used for crash handling. */ diff --git a/runtime/include/dart_mirrors_api.h b/runtime/include/dart_mirrors_api.h index 42aceaf1c34..6352f92ffdf 100644 --- a/runtime/include/dart_mirrors_api.h +++ b/runtime/include/dart_mirrors_api.h @@ -9,7 +9,6 @@ #include "dart_api.h" - /** * Returns the simple name for the provided type. */ @@ -138,5 +137,4 @@ DART_EXPORT Dart_Handle Dart_LibraryGetClassNames(Dart_Handle library); */ DART_EXPORT Dart_Handle Dart_ClosureFunction(Dart_Handle closure); - #endif /* INCLUDE_DART_MIRRORS_API_H_ */ /* NOLINT */ diff --git a/runtime/include/dart_native_api.h b/runtime/include/dart_native_api.h index 181a7392171..10fde6e02af 100644 --- a/runtime/include/dart_native_api.h +++ b/runtime/include/dart_native_api.h @@ -155,7 +155,6 @@ DART_EXPORT Dart_Port Dart_NewNativePort(const char* name, */ DART_EXPORT bool Dart_CloseNativePort(Dart_Port native_port_id); - /* * ================== * Verification Tools diff --git a/runtime/include/dart_tools_api.h b/runtime/include/dart_tools_api.h index 29f86a9a2c5..e7440f8f9e9 100644 --- a/runtime/include/dart_tools_api.h +++ b/runtime/include/dart_tools_api.h @@ -17,7 +17,6 @@ * This reference is generated from the header include/dart_tools_api.h. */ - /* * ======== * Debugger @@ -41,14 +40,12 @@ typedef Dart_Port Dart_IsolateId; */ #define ILLEGAL_ISOLATE_ID ILLEGAL_PORT - /** * Null value for breakpoint id. Guaranteed never to be associated * with a valid breakpoint. */ #define ILLEGAL_BREAKPOINT_ID 0 - typedef void Dart_ExceptionThrownHandler(Dart_IsolateId isolate_id, Dart_Handle exception_object, Dart_StackTrace stack_trace); @@ -59,7 +56,6 @@ typedef enum { kShutdown, } Dart_IsolateEvent; - /** * Represents a location in Dart code. */ @@ -69,7 +65,6 @@ typedef struct { int32_t token_pos; // Code address. } Dart_CodeLocation; - typedef void Dart_IsolateEventHandler(Dart_IsolateId isolate_id, Dart_IsolateEvent kind); @@ -81,7 +76,6 @@ typedef void Dart_BreakpointResolvedHandler(Dart_IsolateId isolate_id, intptr_t bp_id, const Dart_CodeLocation& location); - /** * Caches a given \object and returns an object id. The object id is only * valid while the VM is paused. The cache is invalidated when the VM @@ -93,7 +87,6 @@ typedef void Dart_BreakpointResolvedHandler(Dart_IsolateId isolate_id, */ DART_EXPORT intptr_t Dart_CacheObject(Dart_Handle object_in); - /** * Returns a cached object given the \obj_id. * @@ -101,7 +94,6 @@ DART_EXPORT intptr_t Dart_CacheObject(Dart_Handle object_in); */ DART_EXPORT Dart_Handle Dart_GetCachedObject(intptr_t obj_id); - /** * Returns a list of ids (integers) of all the libraries loaded in the * current isolate. @@ -112,7 +104,6 @@ DART_EXPORT Dart_Handle Dart_GetCachedObject(intptr_t obj_id); */ DART_EXPORT Dart_Handle Dart_GetLibraryIds(); - /** * Returns true if the debugger can step into code of the given library. * @@ -123,7 +114,6 @@ DART_EXPORT Dart_Handle Dart_GetLibraryIds(); DART_EXPORT Dart_Handle Dart_GetLibraryDebuggable(intptr_t library_id, bool* is_debuggable); - /** * Requets that debugging be enabled for the given library. * @@ -134,7 +124,6 @@ DART_EXPORT Dart_Handle Dart_GetLibraryDebuggable(intptr_t library_id, DART_EXPORT Dart_Handle Dart_SetLibraryDebuggable(intptr_t library_id, bool is_debuggable); - /** * Returns a list of urls (strings) of all the scripts loaded in the * given library. @@ -145,7 +134,6 @@ DART_EXPORT Dart_Handle Dart_SetLibraryDebuggable(intptr_t library_id, */ DART_EXPORT Dart_Handle Dart_GetScriptURLs(Dart_Handle library_url); - /** * Returns a string containing the source code of the given script * in the given library. @@ -158,7 +146,6 @@ DART_EXPORT Dart_Handle Dart_GetScriptURLs(Dart_Handle library_url); DART_EXPORT Dart_Handle Dart_ScriptGetSource(intptr_t library_id, Dart_Handle script_url_in); - /** * Returns an array containing line number and token offset info * for the given script. @@ -179,7 +166,6 @@ DART_EXPORT Dart_Handle Dart_ScriptGetSource(intptr_t library_id, DART_EXPORT Dart_Handle Dart_ScriptGetTokenInfo(intptr_t library_id, Dart_Handle script_url_in); - /** * Returns a string containing a generated source code of the given script * in the given library. This is essentially used to pretty print dart code @@ -193,7 +179,6 @@ DART_EXPORT Dart_Handle Dart_ScriptGetTokenInfo(intptr_t library_id, DART_EXPORT Dart_Handle Dart_GenerateScriptSource(Dart_Handle library_url_in, Dart_Handle script_url_in); - /** * Sets a breakpoint at line \line_number in \script_url, or the closest * following line (within the same function) where a breakpoint can be set. @@ -215,7 +200,6 @@ DART_EXPORT Dart_Handle Dart_SetBreakpoint(Dart_Handle script_url, */ DART_EXPORT Dart_Handle Dart_RemoveBreakpoint(intptr_t bp_id); - /** * Get the script URL of the breakpoint with the given id \pb_id. * @@ -226,7 +210,6 @@ DART_EXPORT Dart_Handle Dart_RemoveBreakpoint(intptr_t bp_id); */ DART_EXPORT Dart_Handle Dart_GetBreakpointURL(intptr_t bp_id); - /** * Get the line number of the breakpoint with the given id \pb_id. * @@ -237,7 +220,6 @@ DART_EXPORT Dart_Handle Dart_GetBreakpointURL(intptr_t bp_id); */ DART_EXPORT Dart_Handle Dart_GetBreakpointLine(intptr_t bp_id); - /** * Sets a one-time breakpoint at the entry of the given function. * If class_name is the empty string, looks for a library function @@ -252,7 +234,6 @@ DART_EXPORT Dart_Handle Dart_SetBreakpointAtEntry(Dart_Handle library, Dart_Handle class_name, Dart_Handle function_name); - /** * Sets a breakpoint at the entry of the given function. If class_name * is the empty string, looks for a library function with the given @@ -266,7 +247,6 @@ DART_EXPORT Dart_Handle Dart_OneTimeBreakAtEntry(Dart_Handle library, Dart_Handle class_name, Dart_Handle function_name); - /** * Can be called from the breakpoint handler. Sets the debugger to * single step mode. @@ -275,7 +255,6 @@ DART_EXPORT Dart_Handle Dart_OneTimeBreakAtEntry(Dart_Handle library, */ DART_EXPORT Dart_Handle Dart_SetStepOver(); - /** * Can be called from the breakpoint handler. Causes the debugger to * break after at the beginning of the next function call. @@ -284,7 +263,6 @@ DART_EXPORT Dart_Handle Dart_SetStepOver(); */ DART_EXPORT Dart_Handle Dart_SetStepInto(); - /** * Can be called from the breakpoint handler. Causes the debugger to * break after returning from the current Dart function. @@ -293,7 +271,6 @@ DART_EXPORT Dart_Handle Dart_SetStepInto(); */ DART_EXPORT Dart_Handle Dart_SetStepOut(); - /** * Installs a handler callback function that gets called by the VM * when a breakpoint location has been reached or when stepping. @@ -302,7 +279,6 @@ DART_EXPORT Dart_Handle Dart_SetStepOut(); */ DART_EXPORT void Dart_SetPausedEventHandler(Dart_PausedEventHandler handler); - /** * Installs a callback function that gets called by the VM when * a breakpoint has been resolved to an actual url and line number. @@ -346,7 +322,6 @@ typedef enum { DART_EXPORT Dart_Handle Dart_SetExceptionPauseInfo(Dart_ExceptionPauseInfo pause_info); - /** * Returns on which exceptions the debugger pauses. * @@ -364,7 +339,6 @@ DART_EXPORT Dart_ExceptionPauseInfo Dart_GetExceptionPauseInfo(); */ DART_EXPORT Dart_Handle Dart_GetStackTrace(Dart_StackTrace* trace); - /** * Returns in \trace the stack trace associated with the error given in \handle. * @@ -375,7 +349,6 @@ DART_EXPORT Dart_Handle Dart_GetStackTrace(Dart_StackTrace* trace); DART_EXPORT Dart_Handle Dart_GetStackTraceFromError(Dart_Handle error, Dart_StackTrace* trace); - /** * Returns in \length the number of activation frames in the given * stack trace. @@ -387,7 +360,6 @@ DART_EXPORT Dart_Handle Dart_GetStackTraceFromError(Dart_Handle error, DART_EXPORT Dart_Handle Dart_StackTraceLength(Dart_StackTrace trace, intptr_t* length); - /** * Returns in \frame the activation frame with index \frame_index. * The activation frame at the top of stack has index 0. @@ -400,7 +372,6 @@ DART_EXPORT Dart_Handle Dart_GetActivationFrame(Dart_StackTrace trace, int frame_index, Dart_ActivationFrame* frame); - /** * Returns information about the given activation frame. * \function_name receives a string handle with the qualified @@ -424,7 +395,6 @@ Dart_ActivationFrameInfo(Dart_ActivationFrame activation_frame, intptr_t* line_number, intptr_t* column_number); - /** * Returns code location of the given activation frame. * @@ -481,7 +451,6 @@ Dart_ActivationFrameGetFramePointer(Dart_ActivationFrame activation_frame, DART_EXPORT Dart_Handle Dart_GetLocalVariables(Dart_ActivationFrame activation_frame); - /** * Returns origin class of a function. * @@ -493,7 +462,6 @@ Dart_GetLocalVariables(Dart_ActivationFrame activation_frame); */ DART_EXPORT Dart_Handle Dart_GetFunctionOrigin(Dart_Handle function); - /** * Returns an array containing all the global variable names and values of * the library with given \library_id. @@ -506,7 +474,6 @@ DART_EXPORT Dart_Handle Dart_GetFunctionOrigin(Dart_Handle function); */ DART_EXPORT Dart_Handle Dart_GetGlobalVariables(intptr_t library_id); - /** * Execute the expression given in string \expr in the context * of stack frame \activation_frame. @@ -515,7 +482,6 @@ DART_EXPORT Dart_Handle Dart_ActivationFrameEvaluate(Dart_ActivationFrame activation_frame, Dart_Handle expr_in); - /** * Execute the expression given in string \expr in the context * of \target. @@ -536,7 +502,6 @@ Dart_ActivationFrameEvaluate(Dart_ActivationFrame activation_frame, */ DART_EXPORT Dart_Handle Dart_EvaluateExpr(Dart_Handle target, Dart_Handle expr); - /** * Returns the class of the given \object. * @@ -546,7 +511,6 @@ DART_EXPORT Dart_Handle Dart_EvaluateExpr(Dart_Handle target, Dart_Handle expr); */ DART_EXPORT Dart_Handle Dart_GetObjClass(Dart_Handle object); - /** * Returns in \class_id the class id of the given \object. The id is valid * for the lifetime of the isolate. @@ -558,7 +522,6 @@ DART_EXPORT Dart_Handle Dart_GetObjClass(Dart_Handle object); DART_EXPORT Dart_Handle Dart_GetObjClassId(Dart_Handle object, intptr_t* class_id); - /** * Returns the supertype of the given instantiated type \cls. * @@ -568,7 +531,6 @@ DART_EXPORT Dart_Handle Dart_GetObjClassId(Dart_Handle object, */ DART_EXPORT Dart_Handle Dart_GetSupertype(Dart_Handle type); - /** * Returns handle to class with class id \class_id. * @@ -578,7 +540,6 @@ DART_EXPORT Dart_Handle Dart_GetSupertype(Dart_Handle type); */ DART_EXPORT Dart_Handle Dart_GetClassFromId(intptr_t class_id); - /** * Returns info about the given class \cls_id. * @@ -601,7 +562,6 @@ DART_EXPORT Dart_Handle Dart_GetClassInfo(intptr_t class_id, intptr_t* super_class_id, Dart_Handle* static_fields); - /** Returns info about the given closure \closure. * * \param name receives handle to closure name (string). @@ -622,7 +582,6 @@ DART_EXPORT Dart_Handle Dart_GetClosureInfo(Dart_Handle closure, Dart_Handle* signature, Dart_CodeLocation* location); - /** * Returns an array containing all instance field names and values of * the given \object. @@ -637,7 +596,6 @@ DART_EXPORT Dart_Handle Dart_GetClosureInfo(Dart_Handle closure, */ DART_EXPORT Dart_Handle Dart_GetInstanceFields(Dart_Handle object); - /** * Returns an array containing all static field names and values of * the given type \target. @@ -652,7 +610,6 @@ DART_EXPORT Dart_Handle Dart_GetInstanceFields(Dart_Handle object); */ DART_EXPORT Dart_Handle Dart_GetStaticFields(Dart_Handle target); - /** * Returns a handle to the library \library_id. * @@ -662,7 +619,6 @@ DART_EXPORT Dart_Handle Dart_GetStaticFields(Dart_Handle target); */ DART_EXPORT Dart_Handle Dart_GetLibraryFromId(intptr_t library_id); - /** * Returns in \library_id the library id of the given \library. * @@ -671,7 +627,6 @@ DART_EXPORT Dart_Handle Dart_GetLibraryFromId(intptr_t library_id); DART_EXPORT Dart_Handle Dart_LibraryId(Dart_Handle library, intptr_t* library_id); - /** * Returns an array containing all variable names and values of * the given library \library_id. @@ -686,7 +641,6 @@ DART_EXPORT Dart_Handle Dart_LibraryId(Dart_Handle library, */ DART_EXPORT Dart_Handle Dart_GetLibraryFields(intptr_t library_id); - /** * Returns an array containing all imported libraries of * the given library \library_id. @@ -702,7 +656,6 @@ DART_EXPORT Dart_Handle Dart_GetLibraryFields(intptr_t library_id); */ DART_EXPORT Dart_Handle Dart_GetLibraryImports(intptr_t library_id); - /** * Returns the url of the library \library_id. * @@ -712,7 +665,6 @@ DART_EXPORT Dart_Handle Dart_GetLibraryImports(intptr_t library_id); */ DART_EXPORT Dart_Handle Dart_GetLibraryURL(intptr_t library_id); - /** * Returns the isolate object corresponding to the isolate id. * @@ -721,7 +673,6 @@ DART_EXPORT Dart_Handle Dart_GetLibraryURL(intptr_t library_id); */ DART_EXPORT Dart_Isolate Dart_GetIsolate(Dart_IsolateId isolate_id); - /** * Returns the isolate id for an isolate. * @@ -729,7 +680,6 @@ DART_EXPORT Dart_Isolate Dart_GetIsolate(Dart_IsolateId isolate_id); */ DART_EXPORT Dart_IsolateId Dart_GetIsolateId(Dart_Isolate isolate); - /* * ======= * Service @@ -781,7 +731,6 @@ typedef bool (*Dart_ServiceRequestCallback)(const char* method, void* user_data, const char** json_object); - /** * Register a Dart_ServiceRequestCallback to be called to handle * requests for the named rpc on a specific isolate. The callback will @@ -799,7 +748,6 @@ DART_EXPORT void Dart_RegisterIsolateServiceRequestCallback( Dart_ServiceRequestCallback callback, void* user_data); - /** * Register a Dart_ServiceRequestCallback to be called to handle * requests for the named rpc. The callback will be invoked without a @@ -817,7 +765,6 @@ DART_EXPORT void Dart_RegisterRootServiceRequestCallback( Dart_ServiceRequestCallback callback, void* user_data); - /* * ======== * Event Streams @@ -952,7 +899,6 @@ DART_EXPORT int64_t Dart_TimelineGetMicros(); /** Disable all timeline stream recording */ #define DART_TIMELINE_STREAM_DISABLE 0 - /** * Start recording timeline events for the entire VM (including all isolates). * @@ -962,7 +908,6 @@ DART_EXPORT int64_t Dart_TimelineGetMicros(); */ DART_EXPORT void Dart_GlobalTimelineSetRecordedStreams(int64_t stream_mask); - typedef enum { /** Indicates a new stream is being output */ Dart_StreamConsumer_kStart = 0, diff --git a/runtime/lib/array.cc b/runtime/lib/array.cc index 9d43816ae50..1a9217b2c69 100644 --- a/runtime/lib/array.cc +++ b/runtime/lib/array.cc @@ -3,8 +3,8 @@ // BSD-style license that can be found in the LICENSE file. #include "platform/assert.h" -#include "vm/bootstrap_natives.h" #include "vm/assembler.h" +#include "vm/bootstrap_natives.h" #include "vm/exceptions.h" #include "vm/native_entry.h" #include "vm/object.h" @@ -17,7 +17,6 @@ DEFINE_NATIVE_ENTRY(List_allocate, 2) { return Object::null(); } - DEFINE_NATIVE_ENTRY(List_getIndexed, 2) { const Array& array = Array::CheckedHandle(arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Smi, index, arguments->NativeArgAt(1)); @@ -27,7 +26,6 @@ DEFINE_NATIVE_ENTRY(List_getIndexed, 2) { return array.At(index.Value()); } - DEFINE_NATIVE_ENTRY(List_setIndexed, 3) { const Array& array = Array::CheckedHandle(arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Smi, index, arguments->NativeArgAt(1)); @@ -39,13 +37,11 @@ DEFINE_NATIVE_ENTRY(List_setIndexed, 3) { return Object::null(); } - DEFINE_NATIVE_ENTRY(List_getLength, 1) { const Array& array = Array::CheckedHandle(arguments->NativeArgAt(0)); return Smi::New(array.Length()); } - // ObjectArray src, int start, int count, bool needTypeArgument. DEFINE_NATIVE_ENTRY(List_slice, 4) { const Array& src = Array::CheckedHandle(arguments->NativeArgAt(0)); @@ -67,7 +63,6 @@ DEFINE_NATIVE_ENTRY(List_slice, 4) { return src.Slice(istart, icount, needs_type_arg.value()); } - // Private factory, expects correct arguments. DEFINE_NATIVE_ENTRY(ImmutableList_from, 4) { // Ignore first argument of a thsi factory (type argument). diff --git a/runtime/lib/bool.cc b/runtime/lib/bool.cc index dcb19525ef9..dc2b00f7800 100644 --- a/runtime/lib/bool.cc +++ b/runtime/lib/bool.cc @@ -5,8 +5,8 @@ #include "vm/bootstrap_natives.h" #include "include/dart_api.h" -#include "vm/dart_entry.h" #include "vm/dart_api_impl.h" +#include "vm/dart_entry.h" #include "vm/exceptions.h" #include "vm/isolate.h" #include "vm/native_entry.h" diff --git a/runtime/lib/date.cc b/runtime/lib/date.cc index 137652b8bd8..3f694d35616 100644 --- a/runtime/lib/date.cc +++ b/runtime/lib/date.cc @@ -25,7 +25,6 @@ DEFINE_NATIVE_ENTRY(DateTime_timeZoneName, 1) { return String::New(name); } - DEFINE_NATIVE_ENTRY(DateTime_timeZoneOffsetInSeconds, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Integer, dart_seconds, arguments->NativeArgAt(0)); @@ -37,13 +36,11 @@ DEFINE_NATIVE_ENTRY(DateTime_timeZoneOffsetInSeconds, 1) { return Integer::New(offset); } - DEFINE_NATIVE_ENTRY(DateTime_localTimeZoneAdjustmentInSeconds, 0) { int adjustment = OS::GetLocalTimeZoneAdjustmentInSeconds(); return Integer::New(adjustment); } - DEFINE_NATIVE_ENTRY(DateTime_currentTimeMicros, 0) { return Integer::New(OS::GetCurrentTimeMicros()); } diff --git a/runtime/lib/developer.cc b/runtime/lib/developer.cc index e2f5a1ba12e..c314aaa1d12 100644 --- a/runtime/lib/developer.cc +++ b/runtime/lib/developer.cc @@ -32,7 +32,6 @@ DEFINE_NATIVE_ENTRY(Developer_debugger, 2) { return when.raw(); } - DEFINE_NATIVE_ENTRY(Developer_inspect, 1) { GET_NATIVE_ARGUMENT(Instance, inspectee, arguments->NativeArgAt(0)); #ifndef PRODUCT @@ -43,7 +42,6 @@ DEFINE_NATIVE_ENTRY(Developer_inspect, 1) { return inspectee.raw(); } - DEFINE_NATIVE_ENTRY(Developer_log, 8) { #if defined(PRODUCT) return Object::null(); @@ -66,7 +64,6 @@ DEFINE_NATIVE_ENTRY(Developer_log, 8) { #endif // PRODUCT } - DEFINE_NATIVE_ENTRY(Developer_postEvent, 2) { #if defined(PRODUCT) return Object::null(); @@ -81,7 +78,6 @@ DEFINE_NATIVE_ENTRY(Developer_postEvent, 2) { #endif // PRODUCT } - DEFINE_NATIVE_ENTRY(Developer_lookupExtension, 1) { #if defined(PRODUCT) return Object::null(); @@ -94,7 +90,6 @@ DEFINE_NATIVE_ENTRY(Developer_lookupExtension, 1) { #endif // PRODUCT } - DEFINE_NATIVE_ENTRY(Developer_registerExtension, 2) { #if defined(PRODUCT) return Object::null(); @@ -123,7 +118,6 @@ DEFINE_NATIVE_ENTRY(Developer_getServiceMajorVersion, 0) { #endif } - DEFINE_NATIVE_ENTRY(Developer_getServiceMinorVersion, 0) { #if defined(PRODUCT) return Smi::New(0); @@ -132,14 +126,12 @@ DEFINE_NATIVE_ENTRY(Developer_getServiceMinorVersion, 0) { #endif } - static void SendNull(const SendPort& port) { const Dart_Port destination_port_id = port.Id(); PortMap::PostMessage(new Message(destination_port_id, Object::null(), Message::kNormalPriority)); } - DEFINE_NATIVE_ENTRY(Developer_getServerInfo, 1) { GET_NON_NULL_NATIVE_ARGUMENT(SendPort, port, arguments->NativeArgAt(0)); #if defined(PRODUCT) @@ -155,7 +147,6 @@ DEFINE_NATIVE_ENTRY(Developer_getServerInfo, 1) { #endif } - DEFINE_NATIVE_ENTRY(Developer_webServerControl, 2) { GET_NON_NULL_NATIVE_ARGUMENT(SendPort, port, arguments->NativeArgAt(0)); #if defined(PRODUCT) @@ -172,7 +163,6 @@ DEFINE_NATIVE_ENTRY(Developer_webServerControl, 2) { #endif } - DEFINE_NATIVE_ENTRY(Developer_getIsolateIDFromSendPort, 1) { #if defined(PRODUCT) return Object::null(); @@ -183,5 +173,4 @@ DEFINE_NATIVE_ENTRY(Developer_getIsolateIDFromSendPort, 1) { #endif } - } // namespace dart diff --git a/runtime/lib/double.cc b/runtime/lib/double.cc index 1d3927c5db1..f38288cefc2 100644 --- a/runtime/lib/double.cc +++ b/runtime/lib/double.cc @@ -28,7 +28,6 @@ DEFINE_NATIVE_ENTRY(Double_doubleFromInteger, 2) { return Double::New(value.AsDoubleValue()); } - DEFINE_NATIVE_ENTRY(Double_add, 2) { double left = Double::CheckedHandle(arguments->NativeArgAt(0)).value(); GET_NON_NULL_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1)); @@ -39,7 +38,6 @@ DEFINE_NATIVE_ENTRY(Double_add, 2) { return Double::New(left + right); } - DEFINE_NATIVE_ENTRY(Double_sub, 2) { double left = Double::CheckedHandle(arguments->NativeArgAt(0)).value(); GET_NON_NULL_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1)); @@ -50,7 +48,6 @@ DEFINE_NATIVE_ENTRY(Double_sub, 2) { return Double::New(left - right); } - DEFINE_NATIVE_ENTRY(Double_mul, 2) { double left = Double::CheckedHandle(arguments->NativeArgAt(0)).value(); GET_NON_NULL_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1)); @@ -61,7 +58,6 @@ DEFINE_NATIVE_ENTRY(Double_mul, 2) { return Double::New(left * right); } - DEFINE_NATIVE_ENTRY(Double_div, 2) { double left = Double::CheckedHandle(arguments->NativeArgAt(0)).value(); GET_NON_NULL_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1)); @@ -72,7 +68,6 @@ DEFINE_NATIVE_ENTRY(Double_div, 2) { return Double::New(left / right); } - static RawInteger* DoubleToInteger(double val, const char* error_msg) { if (isinf(val) || isnan(val)) { const Array& args = Array::Handle(Array::New(1)); @@ -123,7 +118,6 @@ static RawInteger* DoubleToInteger(double val, const char* error_msg) { return result.AsValidInteger(); } - DEFINE_NATIVE_ENTRY(Double_trunc_div, 2) { double left = Double::CheckedHandle(arguments->NativeArgAt(0)).value(); GET_NON_NULL_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1)); @@ -135,7 +129,6 @@ DEFINE_NATIVE_ENTRY(Double_trunc_div, 2) { "Result of truncating division is Infinity or NaN"); } - DEFINE_NATIVE_ENTRY(Double_modulo, 2) { double left = Double::CheckedHandle(arguments->NativeArgAt(0)).value(); GET_NON_NULL_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1)); @@ -143,7 +136,6 @@ DEFINE_NATIVE_ENTRY(Double_modulo, 2) { return Double::New(DartModulo(left, right)); } - DEFINE_NATIVE_ENTRY(Double_remainder, 2) { double left = Double::CheckedHandle(arguments->NativeArgAt(0)).value(); GET_NON_NULL_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1)); @@ -151,7 +143,6 @@ DEFINE_NATIVE_ENTRY(Double_remainder, 2) { return Double::New(fmod_ieee(left, right)); } - DEFINE_NATIVE_ENTRY(Double_greaterThan, 2) { const Double& left = Double::CheckedHandle(arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Double, right, arguments->NativeArgAt(1)); @@ -163,14 +154,12 @@ DEFINE_NATIVE_ENTRY(Double_greaterThan, 2) { return Bool::Get(result).raw(); } - DEFINE_NATIVE_ENTRY(Double_greaterThanFromInteger, 2) { const Double& right = Double::CheckedHandle(arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Integer, left, arguments->NativeArgAt(1)); return Bool::Get(left.AsDoubleValue() > right.value()).raw(); } - DEFINE_NATIVE_ENTRY(Double_equal, 2) { const Double& left = Double::CheckedHandle(arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Double, right, arguments->NativeArgAt(1)); @@ -181,14 +170,12 @@ DEFINE_NATIVE_ENTRY(Double_equal, 2) { return Bool::Get(result).raw(); } - DEFINE_NATIVE_ENTRY(Double_equalToInteger, 2) { const Double& left = Double::CheckedHandle(arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Integer, right, arguments->NativeArgAt(1)); return Bool::Get(left.value() == right.AsDoubleValue()).raw(); } - DEFINE_NATIVE_ENTRY(Double_round, 1) { const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); return Double::New(round(arg.value())); @@ -204,13 +191,11 @@ DEFINE_NATIVE_ENTRY(Double_ceil, 1) { return Double::New(ceil(arg.value())); } - DEFINE_NATIVE_ENTRY(Double_truncate, 1) { const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); return Double::New(trunc(arg.value())); } - #if defined(HOST_OS_MACOS) // MAC OSX math library produces old style cast warning. #pragma GCC diagnostic ignored "-Wold-style-cast" @@ -221,7 +206,6 @@ DEFINE_NATIVE_ENTRY(Double_toInt, 1) { return DoubleToInteger(arg.value(), "Infinity or NaN toInt"); } - DEFINE_NATIVE_ENTRY(Double_parse, 3) { GET_NON_NULL_NATIVE_ARGUMENT(String, value, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Integer, startValue, arguments->NativeArgAt(1)); @@ -241,13 +225,11 @@ DEFINE_NATIVE_ENTRY(Double_parse, 3) { return Object::null(); } - DEFINE_NATIVE_ENTRY(Double_toString, 1) { const Number& number = Number::CheckedHandle(arguments->NativeArgAt(0)); return number.ToString(Heap::kNew); } - DEFINE_NATIVE_ENTRY(Double_toStringAsFixed, 2) { // The boundaries are exclusive. static const double kLowerBoundary = -1e21; @@ -267,7 +249,6 @@ DEFINE_NATIVE_ENTRY(Double_toStringAsFixed, 2) { } } - DEFINE_NATIVE_ENTRY(Double_toStringAsExponential, 2) { const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Smi, fraction_digits, arguments->NativeArgAt(1)); @@ -283,7 +264,6 @@ DEFINE_NATIVE_ENTRY(Double_toStringAsExponential, 2) { } } - DEFINE_NATIVE_ENTRY(Double_toStringAsPrecision, 2) { const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Smi, precision, arguments->NativeArgAt(1)); @@ -298,19 +278,16 @@ DEFINE_NATIVE_ENTRY(Double_toStringAsPrecision, 2) { } } - DEFINE_NATIVE_ENTRY(Double_getIsInfinite, 1) { const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); return Bool::Get(isinf(arg.value())).raw(); } - DEFINE_NATIVE_ENTRY(Double_getIsNaN, 1) { const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); return Bool::Get(isnan(arg.value())).raw(); } - DEFINE_NATIVE_ENTRY(Double_getIsNegative, 1) { const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); // Include negative zero, infinity. @@ -318,7 +295,6 @@ DEFINE_NATIVE_ENTRY(Double_getIsNegative, 1) { return Bool::Get(signbit(dval) && !isnan(dval)).raw(); } - DEFINE_NATIVE_ENTRY(Double_flipSignBit, 1) { const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); const double in_val = arg.value(); diff --git a/runtime/lib/errors.cc b/runtime/lib/errors.cc index a4a738bd986..4783d4d5759 100644 --- a/runtime/lib/errors.cc +++ b/runtime/lib/errors.cc @@ -58,7 +58,6 @@ static RawScript* FindScript(DartFrameIterator* iterator) { return Script::null(); } - // Allocate and throw a new AssertionError. // Arg0: index of the first token of the failed assertion. // Arg1: index of the first token after the failed assertion. @@ -102,7 +101,6 @@ DEFINE_NATIVE_ENTRY(AssertionError_throwNew, 3) { return Object::null(); } - // Allocate and throw a new TypeError or CastError. // Arg0: index of the token of the failed type check. // Arg1: src value. @@ -129,7 +127,6 @@ DEFINE_NATIVE_ENTRY(TypeError_throwNew, 5) { return Object::null(); } - // Allocate and throw a new FallThroughError. // Arg0: index of the case clause token into which we fall through. // Return value: none, throws an exception. @@ -154,7 +151,6 @@ DEFINE_NATIVE_ENTRY(FallThroughError_throwNew, 1) { return Object::null(); } - // Allocate and throw a new AbstractClassInstantiationError. // Arg0: Token position of allocation statement. // Arg1: class name of the abstract class that cannot be instantiated. diff --git a/runtime/lib/function.cc b/runtime/lib/function.cc index c1c141c5c4e..cf6e29813f2 100644 --- a/runtime/lib/function.cc +++ b/runtime/lib/function.cc @@ -30,7 +30,6 @@ DEFINE_NATIVE_ENTRY(Function_apply, 2) { return result.raw(); } - DEFINE_NATIVE_ENTRY(Closure_equals, 2) { const Closure& receiver = Closure::CheckedHandle(zone, arguments->NativeArgAt(0)); @@ -69,7 +68,6 @@ DEFINE_NATIVE_ENTRY(Closure_equals, 2) { return Bool::False().raw(); } - DEFINE_NATIVE_ENTRY(Closure_hashCode, 1) { const Closure& receiver = Closure::CheckedHandle(zone, arguments->NativeArgAt(0)); @@ -77,7 +75,6 @@ DEFINE_NATIVE_ENTRY(Closure_hashCode, 1) { return func.GetClosureHashCode(); } - DEFINE_NATIVE_ENTRY(Closure_clone, 1) { const Closure& receiver = Closure::CheckedHandle(zone, arguments->NativeArgAt(0)); @@ -99,5 +96,4 @@ DEFINE_NATIVE_ENTRY(Closure_clone, 1) { function, cloned_context); } - } // namespace dart diff --git a/runtime/lib/growable_array.cc b/runtime/lib/growable_array.cc index 48f7343f8d3..d533f0d6adb 100644 --- a/runtime/lib/growable_array.cc +++ b/runtime/lib/growable_array.cc @@ -28,7 +28,6 @@ DEFINE_NATIVE_ENTRY(GrowableList_allocate, 2) { return new_array.raw(); } - DEFINE_NATIVE_ENTRY(GrowableList_getIndexed, 2) { const GrowableObjectArray& array = GrowableObjectArray::CheckedHandle(arguments->NativeArgAt(0)); @@ -40,7 +39,6 @@ DEFINE_NATIVE_ENTRY(GrowableList_getIndexed, 2) { return obj.raw(); } - DEFINE_NATIVE_ENTRY(GrowableList_setIndexed, 3) { const GrowableObjectArray& array = GrowableObjectArray::CheckedHandle(arguments->NativeArgAt(0)); @@ -53,21 +51,18 @@ DEFINE_NATIVE_ENTRY(GrowableList_setIndexed, 3) { return Object::null(); } - DEFINE_NATIVE_ENTRY(GrowableList_getLength, 1) { const GrowableObjectArray& array = GrowableObjectArray::CheckedHandle(arguments->NativeArgAt(0)); return Smi::New(array.Length()); } - DEFINE_NATIVE_ENTRY(GrowableList_getCapacity, 1) { const GrowableObjectArray& array = GrowableObjectArray::CheckedHandle(arguments->NativeArgAt(0)); return Smi::New(array.Capacity()); } - DEFINE_NATIVE_ENTRY(GrowableList_setLength, 2) { const GrowableObjectArray& array = GrowableObjectArray::CheckedHandle(arguments->NativeArgAt(0)); @@ -77,7 +72,6 @@ DEFINE_NATIVE_ENTRY(GrowableList_setLength, 2) { return Object::null(); } - DEFINE_NATIVE_ENTRY(GrowableList_setData, 2) { const GrowableObjectArray& array = GrowableObjectArray::CheckedHandle(arguments->NativeArgAt(0)); @@ -87,14 +81,12 @@ DEFINE_NATIVE_ENTRY(GrowableList_setData, 2) { return Object::null(); } - DEFINE_NATIVE_ENTRY(Internal_makeListFixedLength, 1) { GET_NON_NULL_NATIVE_ARGUMENT(GrowableObjectArray, array, arguments->NativeArgAt(0)); return Array::MakeFixedLength(array, /* unique = */ true); } - DEFINE_NATIVE_ENTRY(Internal_makeFixedListUnmodifiable, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Array, array, arguments->NativeArgAt(0)); array.MakeImmutable(); diff --git a/runtime/lib/integers.cc b/runtime/lib/integers.cc index f0a6563374d..a8d093956ac 100644 --- a/runtime/lib/integers.cc +++ b/runtime/lib/integers.cc @@ -5,8 +5,8 @@ #include "vm/bootstrap_natives.h" #include "include/dart_api.h" -#include "vm/dart_entry.h" #include "vm/dart_api_impl.h" +#include "vm/dart_entry.h" #include "vm/exceptions.h" #include "vm/isolate.h" #include "vm/native_entry.h" @@ -38,7 +38,6 @@ static bool CheckInteger(const Integer& i) { return true; } - DEFINE_NATIVE_ENTRY(Integer_bitAndFromInteger, 2) { const Integer& right = Integer::CheckedHandle(arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Integer, left, arguments->NativeArgAt(1)); @@ -53,7 +52,6 @@ DEFINE_NATIVE_ENTRY(Integer_bitAndFromInteger, 2) { return result.IsNull() ? result.raw() : result.AsValidInteger(); } - DEFINE_NATIVE_ENTRY(Integer_bitOrFromInteger, 2) { const Integer& right = Integer::CheckedHandle(arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Integer, left, arguments->NativeArgAt(1)); @@ -68,7 +66,6 @@ DEFINE_NATIVE_ENTRY(Integer_bitOrFromInteger, 2) { return result.IsNull() ? result.raw() : result.AsValidInteger(); } - DEFINE_NATIVE_ENTRY(Integer_bitXorFromInteger, 2) { const Integer& right = Integer::CheckedHandle(arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Integer, left, arguments->NativeArgAt(1)); @@ -83,7 +80,6 @@ DEFINE_NATIVE_ENTRY(Integer_bitXorFromInteger, 2) { return result.IsNull() ? result.raw() : result.AsValidInteger(); } - DEFINE_NATIVE_ENTRY(Integer_addFromInteger, 2) { const Integer& right_int = Integer::CheckedHandle(arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Integer, left_int, arguments->NativeArgAt(1)); @@ -99,7 +95,6 @@ DEFINE_NATIVE_ENTRY(Integer_addFromInteger, 2) { return result.IsNull() ? result.raw() : result.AsValidInteger(); } - DEFINE_NATIVE_ENTRY(Integer_subFromInteger, 2) { const Integer& right_int = Integer::CheckedHandle(arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Integer, left_int, arguments->NativeArgAt(1)); @@ -115,7 +110,6 @@ DEFINE_NATIVE_ENTRY(Integer_subFromInteger, 2) { return result.IsNull() ? result.raw() : result.AsValidInteger(); } - DEFINE_NATIVE_ENTRY(Integer_mulFromInteger, 2) { const Integer& right_int = Integer::CheckedHandle(arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Integer, left_int, arguments->NativeArgAt(1)); @@ -131,7 +125,6 @@ DEFINE_NATIVE_ENTRY(Integer_mulFromInteger, 2) { return result.IsNull() ? result.raw() : result.AsValidInteger(); } - DEFINE_NATIVE_ENTRY(Integer_truncDivFromInteger, 2) { const Integer& right_int = Integer::CheckedHandle(arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Integer, left_int, arguments->NativeArgAt(1)); @@ -144,7 +137,6 @@ DEFINE_NATIVE_ENTRY(Integer_truncDivFromInteger, 2) { return result.IsNull() ? result.raw() : result.AsValidInteger(); } - DEFINE_NATIVE_ENTRY(Integer_moduloFromInteger, 2) { const Integer& right_int = Integer::CheckedHandle(arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Integer, left_int, arguments->NativeArgAt(1)); @@ -164,7 +156,6 @@ DEFINE_NATIVE_ENTRY(Integer_moduloFromInteger, 2) { return result.IsNull() ? result.raw() : result.AsValidInteger(); } - DEFINE_NATIVE_ENTRY(Integer_greaterThanFromInteger, 2) { const Integer& right = Integer::CheckedHandle(arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Integer, left, arguments->NativeArgAt(1)); @@ -177,7 +168,6 @@ DEFINE_NATIVE_ENTRY(Integer_greaterThanFromInteger, 2) { return Bool::Get(left.CompareWith(right) == 1).raw(); } - DEFINE_NATIVE_ENTRY(Integer_equalToInteger, 2) { const Integer& left = Integer::CheckedHandle(arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Integer, right, arguments->NativeArgAt(1)); @@ -190,7 +180,6 @@ DEFINE_NATIVE_ENTRY(Integer_equalToInteger, 2) { return Bool::Get(left.CompareWith(right) == 0).raw(); } - static RawInteger* ParseInteger(const String& value) { // Used by both Integer_parse and Integer_fromEnvironment. if (value.IsOneByteString()) { @@ -223,13 +212,11 @@ static RawInteger* ParseInteger(const String& value) { return Integer::null(); } - DEFINE_NATIVE_ENTRY(Integer_parse, 1) { GET_NON_NULL_NATIVE_ARGUMENT(String, value, arguments->NativeArgAt(0)); return ParseInteger(value); } - DEFINE_NATIVE_ENTRY(Integer_fromEnvironment, 3) { GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(1)); GET_NATIVE_ARGUMENT(Integer, default_value, arguments->NativeArgAt(2)); @@ -248,7 +235,6 @@ DEFINE_NATIVE_ENTRY(Integer_fromEnvironment, 3) { return default_value.raw(); } - static RawInteger* ShiftOperationHelper(Token::Kind kind, const Integer& value, const Smi& amount) { @@ -290,7 +276,6 @@ static RawInteger* ShiftOperationHelper(Token::Kind kind, return Integer::null(); } - DEFINE_NATIVE_ENTRY(Smi_bitAndFromSmi, 2) { const Smi& left = Smi::CheckedHandle(arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Smi, right, arguments->NativeArgAt(1)); @@ -303,7 +288,6 @@ DEFINE_NATIVE_ENTRY(Smi_bitAndFromSmi, 2) { return Smi::New(left_value.Value() & right_value.Value()); } - DEFINE_NATIVE_ENTRY(Smi_shrFromInt, 2) { const Smi& amount = Smi::CheckedHandle(arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Integer, value, arguments->NativeArgAt(1)); @@ -315,7 +299,6 @@ DEFINE_NATIVE_ENTRY(Smi_shrFromInt, 2) { return result.IsNull() ? result.raw() : result.AsValidInteger(); } - DEFINE_NATIVE_ENTRY(Smi_shlFromInt, 2) { const Smi& amount = Smi::CheckedHandle(arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Integer, value, arguments->NativeArgAt(1)); @@ -331,7 +314,6 @@ DEFINE_NATIVE_ENTRY(Smi_shlFromInt, 2) { return result.IsNull() ? result.raw() : result.AsValidInteger(); } - DEFINE_NATIVE_ENTRY(Smi_bitNegate, 1) { const Smi& operand = Smi::CheckedHandle(arguments->NativeArgAt(0)); if (FLAG_trace_intrinsified_natives) { @@ -342,7 +324,6 @@ DEFINE_NATIVE_ENTRY(Smi_bitNegate, 1) { return Smi::New(result); } - DEFINE_NATIVE_ENTRY(Smi_bitLength, 1) { const Smi& operand = Smi::CheckedHandle(arguments->NativeArgAt(0)); if (FLAG_trace_intrinsified_natives) { @@ -354,7 +335,6 @@ DEFINE_NATIVE_ENTRY(Smi_bitLength, 1) { return Smi::New(result); } - // Mint natives. DEFINE_NATIVE_ENTRY(Mint_bitNegate, 1) { @@ -367,7 +347,6 @@ DEFINE_NATIVE_ENTRY(Mint_bitNegate, 1) { return Integer::New(result); } - DEFINE_NATIVE_ENTRY(Mint_bitLength, 1) { const Mint& operand = Mint::CheckedHandle(arguments->NativeArgAt(0)); ASSERT(CheckInteger(operand)); @@ -380,7 +359,6 @@ DEFINE_NATIVE_ENTRY(Mint_bitLength, 1) { return Smi::New(result); } - DEFINE_NATIVE_ENTRY(Mint_shlFromInt, 2) { // Use the preallocated out of memory exception to avoid calling // into dart code or allocating any code. @@ -391,7 +369,6 @@ DEFINE_NATIVE_ENTRY(Mint_shlFromInt, 2) { return 0; } - // Bigint natives. DEFINE_NATIVE_ENTRY(Bigint_getNeg, 1) { @@ -399,19 +376,16 @@ DEFINE_NATIVE_ENTRY(Bigint_getNeg, 1) { return bigint.neg(); } - DEFINE_NATIVE_ENTRY(Bigint_getUsed, 1) { const Bigint& bigint = Bigint::CheckedHandle(arguments->NativeArgAt(0)); return bigint.used(); } - DEFINE_NATIVE_ENTRY(Bigint_getDigits, 1) { const Bigint& bigint = Bigint::CheckedHandle(arguments->NativeArgAt(0)); return bigint.digits(); } - DEFINE_NATIVE_ENTRY(Bigint_allocate, 4) { // TODO(alexmarkov): Revise this assertion if this native method can be used // to explicitly allocate Bigint objects in --limit-ints-to-64-bits mode. diff --git a/runtime/lib/isolate.cc b/runtime/lib/isolate.cc index e9bc612f9a0..d9ea131e942 100644 --- a/runtime/lib/isolate.cc +++ b/runtime/lib/isolate.cc @@ -41,21 +41,18 @@ static void malloc_deallocator(uint8_t* ptr) { free(reinterpret_cast(ptr)); } - DEFINE_NATIVE_ENTRY(CapabilityImpl_factory, 1) { ASSERT(TypeArguments::CheckedHandle(arguments->NativeArgAt(0)).IsNull()); uint64_t id = isolate->random()->NextUInt64(); return Capability::New(id); } - DEFINE_NATIVE_ENTRY(CapabilityImpl_equals, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Capability, recv, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Capability, other, arguments->NativeArgAt(1)); return (recv.Id() == other.Id()) ? Bool::True().raw() : Bool::False().raw(); } - DEFINE_NATIVE_ENTRY(CapabilityImpl_get_hashcode, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Capability, cap, arguments->NativeArgAt(0)); int64_t id = cap.Id(); @@ -65,26 +62,22 @@ DEFINE_NATIVE_ENTRY(CapabilityImpl_get_hashcode, 1) { return Smi::New(hash); } - DEFINE_NATIVE_ENTRY(RawReceivePortImpl_factory, 1) { ASSERT(TypeArguments::CheckedHandle(arguments->NativeArgAt(0)).IsNull()); Dart_Port port_id = PortMap::CreatePort(isolate->message_handler()); return ReceivePort::New(port_id, false /* not control port */); } - DEFINE_NATIVE_ENTRY(RawReceivePortImpl_get_id, 1) { GET_NON_NULL_NATIVE_ARGUMENT(ReceivePort, port, arguments->NativeArgAt(0)); return Integer::NewFromUint64(port.Id()); } - DEFINE_NATIVE_ENTRY(RawReceivePortImpl_get_sendport, 1) { GET_NON_NULL_NATIVE_ARGUMENT(ReceivePort, port, arguments->NativeArgAt(0)); return port.send_port(); } - DEFINE_NATIVE_ENTRY(RawReceivePortImpl_closeInternal, 1) { GET_NON_NULL_NATIVE_ARGUMENT(ReceivePort, port, arguments->NativeArgAt(0)); Dart_Port id = port.Id(); @@ -92,13 +85,11 @@ DEFINE_NATIVE_ENTRY(RawReceivePortImpl_closeInternal, 1) { return Integer::NewFromUint64(id); } - DEFINE_NATIVE_ENTRY(SendPortImpl_get_id, 1) { GET_NON_NULL_NATIVE_ARGUMENT(SendPort, port, arguments->NativeArgAt(0)); return Integer::NewFromUint64(port.Id()); } - DEFINE_NATIVE_ENTRY(SendPortImpl_get_hashcode, 1) { GET_NON_NULL_NATIVE_ARGUMENT(SendPort, port, arguments->NativeArgAt(0)); int64_t id = port.Id(); @@ -108,7 +99,6 @@ DEFINE_NATIVE_ENTRY(SendPortImpl_get_hashcode, 1) { return Smi::New(hash); } - DEFINE_NATIVE_ENTRY(SendPortImpl_sendInternal_, 2) { GET_NON_NULL_NATIVE_ARGUMENT(SendPort, port, arguments->NativeArgAt(0)); // TODO(iposva): Allow for arbitrary messages to be sent. @@ -134,14 +124,12 @@ DEFINE_NATIVE_ENTRY(SendPortImpl_sendInternal_, 2) { return Object::null(); } - static void ThrowIsolateSpawnException(const String& message) { const Array& args = Array::Handle(Array::New(1)); args.SetAt(0, message); Exceptions::ThrowByType(Exceptions::kIsolateSpawn, args); } - class SpawnIsolateTask : public ThreadPool::Task { public: explicit SpawnIsolateTask(IsolateSpawnState* state) : state_(state) {} @@ -204,7 +192,6 @@ class SpawnIsolateTask : public ThreadPool::Task { DISALLOW_COPY_AND_ASSIGN(SpawnIsolateTask); }; - static const char* String2UTF8(const String& str) { intptr_t len = Utf8::Length(str); char* result = new char[len + 1]; @@ -214,7 +201,6 @@ static const char* String2UTF8(const String& str) { return result; } - DEFINE_NATIVE_ENTRY(Isolate_spawnFunction, 10) { GET_NON_NULL_NATIVE_ARGUMENT(SendPort, port, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(String, script_uri, arguments->NativeArgAt(1)); @@ -293,7 +279,6 @@ DEFINE_NATIVE_ENTRY(Isolate_spawnFunction, 10) { return Object::null(); } - static const char* CanonicalizeUri(Thread* thread, const Library& library, const String& uri, @@ -331,7 +316,6 @@ static const char* CanonicalizeUri(Thread* thread, return result; } - DEFINE_NATIVE_ENTRY(Isolate_spawnUri, 12) { GET_NON_NULL_NATIVE_ARGUMENT(SendPort, port, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(String, uri, arguments->NativeArgAt(1)); @@ -434,7 +418,6 @@ DEFINE_NATIVE_ENTRY(Isolate_spawnUri, 12) { return Object::null(); } - DEFINE_NATIVE_ENTRY(Isolate_getPortAndCapabilitiesOfCurrentIsolate, 0) { const Array& result = Array::Handle(Array::New(3)); result.SetAt(0, SendPort::Handle(SendPort::New(isolate->main_port()))); @@ -445,14 +428,12 @@ DEFINE_NATIVE_ENTRY(Isolate_getPortAndCapabilitiesOfCurrentIsolate, 0) { return result.raw(); } - DEFINE_NATIVE_ENTRY(Isolate_getCurrentRootUriStr, 0) { const Library& root_lib = Library::Handle(zone, isolate->object_store()->root_library()); return root_lib.url(); } - DEFINE_NATIVE_ENTRY(Isolate_sendOOB, 2) { GET_NON_NULL_NATIVE_ARGUMENT(SendPort, port, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Array, msg, arguments->NativeArgAt(1)); diff --git a/runtime/lib/linked_hash_map.cc b/runtime/lib/linked_hash_map.cc index 7c96ed43fa4..8f7fefa5a19 100644 --- a/runtime/lib/linked_hash_map.cc +++ b/runtime/lib/linked_hash_map.cc @@ -19,7 +19,6 @@ DEFINE_NATIVE_ENTRY(LinkedHashMap_getIndex, 1) { return map.index(); } - DEFINE_NATIVE_ENTRY(LinkedHashMap_setIndex, 2) { const LinkedHashMap& map = LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); @@ -28,14 +27,12 @@ DEFINE_NATIVE_ENTRY(LinkedHashMap_setIndex, 2) { return Object::null(); } - DEFINE_NATIVE_ENTRY(LinkedHashMap_getData, 1) { const LinkedHashMap& map = LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); return map.data(); } - DEFINE_NATIVE_ENTRY(LinkedHashMap_setData, 2) { const LinkedHashMap& map = LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); @@ -44,14 +41,12 @@ DEFINE_NATIVE_ENTRY(LinkedHashMap_setData, 2) { return Object::null(); } - DEFINE_NATIVE_ENTRY(LinkedHashMap_getHashMask, 1) { const LinkedHashMap& map = LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); return map.hash_mask(); } - DEFINE_NATIVE_ENTRY(LinkedHashMap_setHashMask, 2) { const LinkedHashMap& map = LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); @@ -60,14 +55,12 @@ DEFINE_NATIVE_ENTRY(LinkedHashMap_setHashMask, 2) { return Object::null(); } - DEFINE_NATIVE_ENTRY(LinkedHashMap_getDeletedKeys, 1) { const LinkedHashMap& map = LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); return map.deleted_keys(); } - DEFINE_NATIVE_ENTRY(LinkedHashMap_setDeletedKeys, 2) { const LinkedHashMap& map = LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); @@ -76,14 +69,12 @@ DEFINE_NATIVE_ENTRY(LinkedHashMap_setDeletedKeys, 2) { return Object::null(); } - DEFINE_NATIVE_ENTRY(LinkedHashMap_getUsedData, 1) { const LinkedHashMap& map = LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); return map.used_data(); } - DEFINE_NATIVE_ENTRY(LinkedHashMap_setUsedData, 2) { const LinkedHashMap& map = LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); diff --git a/runtime/lib/math.cc b/runtime/lib/math.cc index d95e32ff8eb..6ca979391b8 100644 --- a/runtime/lib/math.cc +++ b/runtime/lib/math.cc @@ -74,7 +74,6 @@ DEFINE_NATIVE_ENTRY(Math_doublePow, 2) { return Double::New(pow(operand, exponent)); } - // Returns the typed-data array store in '_Random._state' field. static RawTypedData* GetRandomStateArray(const Instance& receiver) { const Class& random_class = Class::Handle(receiver.clazz()); @@ -91,7 +90,6 @@ static RawTypedData* GetRandomStateArray(const Instance& receiver) { return array.raw(); } - // Implements: // var state = // ((_A * (_state[_kSTATE_LO])) + _state[_kSTATE_HI]) & (1 << 64) - 1); @@ -110,7 +108,6 @@ DEFINE_NATIVE_ENTRY(Random_nextState, 1) { return Object::null(); } - RawTypedData* CreateRandomState(Zone* zone, uint64_t seed) { const TypedData& result = TypedData::Handle(zone, TypedData::New(kTypedDataUint32ArrayCid, 2)); @@ -120,7 +117,6 @@ RawTypedData* CreateRandomState(Zone* zone, uint64_t seed) { return result.raw(); } - uint64_t mix64(uint64_t n) { // Thomas Wang 64-bit mix. // http://www.concentric.net/~Ttwang/tech/inthash.htm @@ -135,7 +131,6 @@ uint64_t mix64(uint64_t n) { return n; } - // Implements: // uint64_t hash = 0; // do { @@ -191,7 +186,6 @@ DEFINE_NATIVE_ENTRY(Random_setupSeed, 1) { return CreateRandomState(zone, seed); } - DEFINE_NATIVE_ENTRY(Random_initialSeed, 0) { Random* rnd = isolate->random(); uint64_t seed = rnd->NextUInt32(); @@ -199,7 +193,6 @@ DEFINE_NATIVE_ENTRY(Random_initialSeed, 0) { return CreateRandomState(zone, seed); } - DEFINE_NATIVE_ENTRY(SecureRandom_getBytes, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Smi, count, arguments->NativeArgAt(0)); const intptr_t n = count.Value(); diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc index b0199f6e969..04a4797f4e3 100644 --- a/runtime/lib/mirrors.cc +++ b/runtime/lib/mirrors.cc @@ -38,7 +38,6 @@ static RawInstance* CreateMirror(const String& mirror_class_name, return Instance::Cast(result).raw(); } - // Conventions: // * For throwing a NSM in a class klass we use its runtime type as receiver, // i.e., klass.RareType(). @@ -82,7 +81,6 @@ static void ThrowNoSuchMethod(const Instance& receiver, UNREACHABLE(); } - static void EnsureConstructorsAreCompiled(const Function& func) { // Only generative constructors can have initializing formals. if (!func.IsGenerativeConstructor()) return; @@ -197,7 +195,6 @@ static RawInstance* CreateParameterMirrorList(const Function& func, return results.raw(); } - static RawInstance* CreateTypeVariableMirror(const TypeParameter& param, const Instance& owner_mirror) { const Array& args = Array::Handle(Array::New(3)); @@ -207,7 +204,6 @@ static RawInstance* CreateTypeVariableMirror(const TypeParameter& param, return CreateMirror(Symbols::_LocalTypeVariableMirror(), args); } - // We create a list in native code and let Dart code create the type mirror // object and the ordered map. static RawInstance* CreateTypeVariableList(const Class& cls) { @@ -230,7 +226,6 @@ static RawInstance* CreateTypeVariableList(const Class& cls) { return result.raw(); } - static RawInstance* CreateTypedefMirror(const Class& cls, const AbstractType& type, const Bool& is_declaration, @@ -245,7 +240,6 @@ static RawInstance* CreateTypedefMirror(const Class& cls, return CreateMirror(Symbols::_LocalTypedefMirror(), args); } - static RawInstance* CreateFunctionTypeMirror(const AbstractType& type) { ASSERT(type.IsFunctionType()); const Class& cls = Class::Handle(Type::Cast(type).type_class()); @@ -257,7 +251,6 @@ static RawInstance* CreateFunctionTypeMirror(const AbstractType& type) { return CreateMirror(Symbols::_LocalFunctionTypeMirror(), args); } - static RawInstance* CreateMethodMirror(const Function& func, const Instance& owner_mirror, const AbstractType& instantiator) { @@ -289,7 +282,6 @@ static RawInstance* CreateMethodMirror(const Function& func, return CreateMirror(Symbols::_LocalMethodMirror(), args); } - static RawInstance* CreateVariableMirror(const Field& field, const Instance& owner_mirror) { const MirrorReference& field_ref = @@ -309,7 +301,6 @@ static RawInstance* CreateVariableMirror(const Field& field, return CreateMirror(Symbols::_LocalVariableMirror(), args); } - static RawInstance* CreateClassMirror(const Class& cls, const AbstractType& type, const Bool& is_declaration, @@ -348,7 +339,6 @@ static RawInstance* CreateClassMirror(const Class& cls, return CreateMirror(Symbols::_LocalClassMirror(), args); } - static RawInstance* CreateLibraryMirror(Thread* thread, const Library& lib) { Zone* zone = thread->zone(); ASSERT(!lib.IsNull()); @@ -386,7 +376,6 @@ static RawInstance* CreateLibraryMirror(Thread* thread, const Library& lib) { return CreateMirror(Symbols::_LocalLibraryMirror(), args); } - static RawInstance* CreateCombinatorMirror(const Object& identifiers, bool is_show) { const Array& args = Array::Handle(Array::New(2)); @@ -395,7 +384,6 @@ static RawInstance* CreateCombinatorMirror(const Object& identifiers, return CreateMirror(Symbols::_LocalCombinatorMirror(), args); } - static RawInstance* CreateLibraryDependencyMirror(Thread* thread, const Instance& importer, const Namespace& ns, @@ -453,7 +441,6 @@ static RawInstance* CreateLibraryDependencyMirror(Thread* thread, return CreateMirror(Symbols::_LocalLibraryDependencyMirror(), args); } - DEFINE_NATIVE_ENTRY(LibraryMirror_fromPrefix, 1) { GET_NON_NULL_NATIVE_ARGUMENT(LibraryPrefix, prefix, arguments->NativeArgAt(0)); @@ -464,7 +451,6 @@ DEFINE_NATIVE_ENTRY(LibraryMirror_fromPrefix, 1) { return CreateLibraryMirror(thread, deferred_lib); } - DEFINE_NATIVE_ENTRY(LibraryMirror_libraryDependencies, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Instance, lib_mirror, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1)); @@ -525,7 +511,6 @@ DEFINE_NATIVE_ENTRY(LibraryMirror_libraryDependencies, 2) { return deps.raw(); } - static RawInstance* CreateTypeMirror(const AbstractType& type) { if (type.IsTypeRef()) { AbstractType& ref_type = AbstractType::Handle(TypeRef::Cast(type).type()); @@ -571,7 +556,6 @@ static RawInstance* CreateTypeMirror(const AbstractType& type) { return Instance::null(); } - static RawInstance* CreateIsolateMirror() { Thread* thread = Thread::Current(); Isolate* isolate = thread->isolate(); @@ -587,7 +571,6 @@ static RawInstance* CreateIsolateMirror() { return CreateMirror(Symbols::_LocalIsolateMirror(), args); } - static void VerifyMethodKindShifts() { #ifdef DEBUG Thread* thread = Thread::Current(); @@ -611,7 +594,6 @@ static void VerifyMethodKindShifts() { #endif } - static RawInstance* ReturnResult(const Object& result) { if (result.IsError()) { Exceptions::PropagateError(Error::Cast(result)); @@ -624,7 +606,6 @@ static RawInstance* ReturnResult(const Object& result) { return Instance::null(); } - // Invoke the function, or noSuchMethod if it is null. Propagate any unhandled // exceptions. Wrap and propagate any compilation errors. static RawInstance* InvokeDynamicFunction(const Instance& receiver, @@ -646,7 +627,6 @@ static RawInstance* InvokeDynamicFunction(const Instance& receiver, return ReturnResult(result); } - static RawInstance* InvokeLibraryGetter(const Library& library, const String& getter_name, const bool throw_nsm_if_absent) { @@ -702,7 +682,6 @@ static RawInstance* InvokeLibraryGetter(const Library& library, return Object::sentinel().raw(); } - static RawInstance* InvokeClassGetter(const Class& klass, const String& getter_name, const bool throw_nsm_if_absent) { @@ -744,7 +723,6 @@ static RawInstance* InvokeClassGetter(const Class& klass, return field.StaticValue(); } - static RawAbstractType* InstantiateType(const AbstractType& type, const AbstractType& instantiator) { ASSERT(type.IsFinalized()); @@ -779,7 +757,6 @@ static RawAbstractType* InstantiateType(const AbstractType& type, return result.Canonicalize(); } - DEFINE_NATIVE_ENTRY(MirrorSystem_libraries, 0) { const GrowableObjectArray& libraries = GrowableObjectArray::Handle(zone, isolate->object_store()->libraries()); @@ -800,14 +777,12 @@ DEFINE_NATIVE_ENTRY(MirrorSystem_libraries, 0) { return library_mirrors.raw(); } - DEFINE_NATIVE_ENTRY(MirrorSystem_isolate, 0) { VerifyMethodKindShifts(); return CreateIsolateMirror(); } - DEFINE_NATIVE_ENTRY(Mirrors_makeLocalClassMirror, 1) { GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0)); PROPAGATE_IF_MALFORMED(type); @@ -824,13 +799,11 @@ DEFINE_NATIVE_ENTRY(Mirrors_makeLocalClassMirror, 1) { Object::null_instance()); } - DEFINE_NATIVE_ENTRY(Mirrors_makeLocalTypeMirror, 1) { GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0)); return CreateTypeMirror(type); } - DEFINE_NATIVE_ENTRY(Mirrors_instantiateGenericType, 2) { GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Array, args, arguments->NativeArgAt(1)); @@ -893,7 +866,6 @@ DEFINE_NATIVE_ENTRY(Mirrors_instantiateGenericType, 2) { return instantiated_type.raw(); } - DEFINE_NATIVE_ENTRY(Mirrors_mangleName, 2) { GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1)); @@ -901,14 +873,12 @@ DEFINE_NATIVE_ENTRY(Mirrors_mangleName, 2) { return lib.IsPrivate(name) ? lib.PrivateName(name) : name.raw(); } - DEFINE_NATIVE_ENTRY(MirrorReference_equals, 2) { GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, a, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, b, arguments->NativeArgAt(1)); return Bool::Get(a.referent() == b.referent()).raw(); } - DEFINE_NATIVE_ENTRY(DeclarationMirror_metadata, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Instance, reflectee, arguments->NativeArgAt(0)); Object& decl = Object::Handle(); @@ -949,7 +919,6 @@ DEFINE_NATIVE_ENTRY(DeclarationMirror_metadata, 1) { return metadata.raw(); } - DEFINE_NATIVE_ENTRY(FunctionTypeMirror_call_method, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Instance, owner_mirror, arguments->NativeArgAt(0)); @@ -961,7 +930,6 @@ DEFINE_NATIVE_ENTRY(FunctionTypeMirror_call_method, 2) { return CreateMethodMirror(func, owner_mirror, AbstractType::Handle()); } - DEFINE_NATIVE_ENTRY(FunctionTypeMirror_parameters, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Instance, owner, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1)); @@ -969,7 +937,6 @@ DEFINE_NATIVE_ENTRY(FunctionTypeMirror_parameters, 2) { return CreateParameterMirrorList(func, owner); } - DEFINE_NATIVE_ENTRY(FunctionTypeMirror_return_type, 1) { GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); const Function& func = Function::Handle(ref.GetFunctionReferent()); @@ -979,7 +946,6 @@ DEFINE_NATIVE_ENTRY(FunctionTypeMirror_return_type, 1) { return type.Canonicalize(); } - DEFINE_NATIVE_ENTRY(ClassMirror_libraryUri, 1) { GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); const Class& klass = Class::Handle(ref.GetClassReferent()); @@ -988,7 +954,6 @@ DEFINE_NATIVE_ENTRY(ClassMirror_libraryUri, 1) { return library.url(); } - DEFINE_NATIVE_ENTRY(ClassMirror_supertype, 1) { GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0)); PROPAGATE_IF_MALFORMED(type); @@ -999,7 +964,6 @@ DEFINE_NATIVE_ENTRY(ClassMirror_supertype, 1) { return super_type.raw(); } - DEFINE_NATIVE_ENTRY(ClassMirror_supertype_instantiated, 1) { GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0)); PROPAGATE_IF_MALFORMED(type); @@ -1009,7 +973,6 @@ DEFINE_NATIVE_ENTRY(ClassMirror_supertype_instantiated, 1) { return InstantiateType(super_type, type); } - DEFINE_NATIVE_ENTRY(ClassMirror_interfaces, 1) { GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0)); PROPAGATE_IF_MALFORMED(type); @@ -1046,7 +1009,6 @@ DEFINE_NATIVE_ENTRY(ClassMirror_interfaces_instantiated, 1) { return interfaces_inst.raw(); } - DEFINE_NATIVE_ENTRY(ClassMirror_mixin, 1) { GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0)); PROPAGATE_IF_MALFORMED(type); @@ -1057,7 +1019,6 @@ DEFINE_NATIVE_ENTRY(ClassMirror_mixin, 1) { return mixin_type.raw(); } - DEFINE_NATIVE_ENTRY(ClassMirror_mixin_instantiated, 2) { GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, instantiator, @@ -1073,7 +1034,6 @@ DEFINE_NATIVE_ENTRY(ClassMirror_mixin_instantiated, 2) { return InstantiateType(mixin_type, instantiator); } - DEFINE_NATIVE_ENTRY(ClassMirror_members, 3) { GET_NON_NULL_NATIVE_ARGUMENT(Instance, owner_mirror, arguments->NativeArgAt(0)); @@ -1122,7 +1082,6 @@ DEFINE_NATIVE_ENTRY(ClassMirror_members, 3) { return member_mirrors.raw(); } - DEFINE_NATIVE_ENTRY(ClassMirror_constructors, 3) { GET_NON_NULL_NATIVE_ARGUMENT(Instance, owner_mirror, arguments->NativeArgAt(0)); @@ -1156,7 +1115,6 @@ DEFINE_NATIVE_ENTRY(ClassMirror_constructors, 3) { return constructor_mirrors.raw(); } - DEFINE_NATIVE_ENTRY(LibraryMirror_members, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Instance, owner_mirror, arguments->NativeArgAt(0)); @@ -1209,7 +1167,6 @@ DEFINE_NATIVE_ENTRY(LibraryMirror_members, 2) { return member_mirrors.raw(); } - DEFINE_NATIVE_ENTRY(ClassMirror_type_variables, 1) { GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); const Class& klass = Class::Handle(ref.GetClassReferent()); @@ -1221,7 +1178,6 @@ DEFINE_NATIVE_ENTRY(ClassMirror_type_variables, 1) { return CreateTypeVariableList(klass); } - DEFINE_NATIVE_ENTRY(ClassMirror_type_arguments, 1) { GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0)); @@ -1259,7 +1215,6 @@ DEFINE_NATIVE_ENTRY(ClassMirror_type_arguments, 1) { return result.raw(); } - DEFINE_NATIVE_ENTRY(TypeVariableMirror_owner, 1) { GET_NON_NULL_NATIVE_ARGUMENT(TypeParameter, param, arguments->NativeArgAt(0)); const Class& owner = Class::Handle(param.parameterized_class()); @@ -1269,13 +1224,11 @@ DEFINE_NATIVE_ENTRY(TypeVariableMirror_owner, 1) { Instance::null_instance()); } - DEFINE_NATIVE_ENTRY(TypeVariableMirror_upper_bound, 1) { GET_NON_NULL_NATIVE_ARGUMENT(TypeParameter, param, arguments->NativeArgAt(0)); return param.bound(); } - DEFINE_NATIVE_ENTRY(Mirrors_evalInLibraryWithPrivateKey, 2) { GET_NON_NULL_NATIVE_ARGUMENT(String, expression, arguments->NativeArgAt(0)); GET_NATIVE_ARGUMENT(String, private_key, arguments->NativeArgAt(1)); @@ -1382,7 +1335,6 @@ DEFINE_NATIVE_ENTRY(InstanceMirror_invoke, 5) { args_descriptor); } - DEFINE_NATIVE_ENTRY(InstanceMirror_invokeGetter, 3) { // Argument 0 is the mirror, which is unused by the native. It exists // because this native is an instance method in order to be polymorphic @@ -1418,7 +1370,6 @@ DEFINE_NATIVE_ENTRY(InstanceMirror_invokeGetter, 3) { args_descriptor); } - DEFINE_NATIVE_ENTRY(InstanceMirror_invokeSetter, 4) { // Argument 0 is the mirror, which is unused by the native. It exists // because this native is an instance method in order to be polymorphic @@ -1445,7 +1396,6 @@ DEFINE_NATIVE_ENTRY(InstanceMirror_invokeSetter, 4) { args_descriptor); } - DEFINE_NATIVE_ENTRY(InstanceMirror_computeType, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Instance, instance, arguments->NativeArgAt(0)); const AbstractType& type = AbstractType::Handle(instance.GetType(Heap::kNew)); @@ -1454,7 +1404,6 @@ DEFINE_NATIVE_ENTRY(InstanceMirror_computeType, 1) { return type.Canonicalize(); } - DEFINE_NATIVE_ENTRY(ClosureMirror_function, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Instance, closure, arguments->NativeArgAt(0)); ASSERT(!closure.IsNull()); @@ -1489,7 +1438,6 @@ DEFINE_NATIVE_ENTRY(ClosureMirror_function, 1) { return Instance::null(); } - DEFINE_NATIVE_ENTRY(ClassMirror_invoke, 5) { // Argument 0 is the mirror, which is unused by the native. It exists // because this native is an instance method in order to be polymorphic @@ -1570,7 +1518,6 @@ DEFINE_NATIVE_ENTRY(ClassMirror_invoke, 5) { return result.raw(); } - DEFINE_NATIVE_ENTRY(ClassMirror_invokeGetter, 3) { // Argument 0 is the mirror, which is unused by the native. It exists // because this native is an instance method in order to be polymorphic @@ -1586,7 +1533,6 @@ DEFINE_NATIVE_ENTRY(ClassMirror_invokeGetter, 3) { return InvokeClassGetter(klass, getter_name, true); } - DEFINE_NATIVE_ENTRY(ClassMirror_invokeSetter, 4) { // Argument 0 is the mirror, which is unused by the native. It exists // because this native is an instance method in order to be polymorphic @@ -1647,7 +1593,6 @@ DEFINE_NATIVE_ENTRY(ClassMirror_invokeSetter, 4) { return value.raw(); } - DEFINE_NATIVE_ENTRY(ClassMirror_invokeConstructor, 5) { GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); const Class& klass = Class::Handle(ref.GetClassReferent()); @@ -1800,7 +1745,6 @@ DEFINE_NATIVE_ENTRY(ClassMirror_invokeConstructor, 5) { } } - DEFINE_NATIVE_ENTRY(LibraryMirror_invoke, 5) { // Argument 0 is the mirror, which is unused by the native. It exists // because this native is an instance method in order to be polymorphic @@ -1866,7 +1810,6 @@ DEFINE_NATIVE_ENTRY(LibraryMirror_invoke, 5) { return result.raw(); } - DEFINE_NATIVE_ENTRY(LibraryMirror_invokeGetter, 3) { // Argument 0 is the mirror, which is unused by the native. It exists // because this native is an instance method in order to be polymorphic @@ -1877,7 +1820,6 @@ DEFINE_NATIVE_ENTRY(LibraryMirror_invokeGetter, 3) { return InvokeLibraryGetter(library, getter_name, true); } - DEFINE_NATIVE_ENTRY(LibraryMirror_invokeSetter, 4) { // Argument 0 is the mirror, which is unused by the native. It exists // because this native is an instance method in order to be polymorphic @@ -1934,7 +1876,6 @@ DEFINE_NATIVE_ENTRY(LibraryMirror_invokeSetter, 4) { return value.raw(); } - DEFINE_NATIVE_ENTRY(MethodMirror_owner, 2) { GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1)); @@ -1952,7 +1893,6 @@ DEFINE_NATIVE_ENTRY(MethodMirror_owner, 2) { return CreateClassMirror(owner, type, Bool::True(), Object::null_instance()); } - DEFINE_NATIVE_ENTRY(MethodMirror_parameters, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Instance, owner, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1)); @@ -1960,7 +1900,6 @@ DEFINE_NATIVE_ENTRY(MethodMirror_parameters, 2) { return CreateParameterMirrorList(func, owner); } - DEFINE_NATIVE_ENTRY(MethodMirror_return_type, 2) { GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); const Function& func = Function::Handle(ref.GetFunctionReferent()); @@ -1972,14 +1911,12 @@ DEFINE_NATIVE_ENTRY(MethodMirror_return_type, 2) { return InstantiateType(type, instantiator); } - DEFINE_NATIVE_ENTRY(MethodMirror_source, 1) { GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); const Function& func = Function::Handle(ref.GetFunctionReferent()); return func.GetSource(); } - static RawInstance* CreateSourceLocation(const String& uri, intptr_t line, intptr_t column) { @@ -1990,7 +1927,6 @@ static RawInstance* CreateSourceLocation(const String& uri, return CreateMirror(Symbols::_SourceLocation(), args); } - DEFINE_NATIVE_ENTRY(DeclarationMirror_location, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Instance, reflectee, arguments->NativeArgAt(0)); Object& decl = Object::Handle(zone); @@ -2073,7 +2009,6 @@ DEFINE_NATIVE_ENTRY(DeclarationMirror_location, 1) { return CreateSourceLocation(uri, from_line, from_col); } - DEFINE_NATIVE_ENTRY(TypedefMirror_referent, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Type, type, arguments->NativeArgAt(0)); ASSERT(type.IsFunctionType()); @@ -2086,7 +2021,6 @@ DEFINE_NATIVE_ENTRY(TypedefMirror_referent, 1) { return CreateFunctionTypeMirror(referent_type); } - DEFINE_NATIVE_ENTRY(ParameterMirror_type, 3) { GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Smi, pos, arguments->NativeArgAt(1)); @@ -2098,7 +2032,6 @@ DEFINE_NATIVE_ENTRY(ParameterMirror_type, 3) { return InstantiateType(type, instantiator); } - DEFINE_NATIVE_ENTRY(VariableMirror_type, 2) { GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); const Field& field = Field::Handle(ref.GetFieldReferent()); diff --git a/runtime/lib/object.cc b/runtime/lib/object.cc index d433de3361b..78fb700f675 100644 --- a/runtime/lib/object.cc +++ b/runtime/lib/object.cc @@ -26,18 +26,16 @@ DEFINE_NATIVE_ENTRY(DartAsync_fatal, 1) { return Object::null(); } - DEFINE_NATIVE_ENTRY(Object_equals, 1) { // Implemented in the flow graph builder. UNREACHABLE(); return Object::null(); } - DEFINE_NATIVE_ENTRY(Object_getHash, 1) { - // Please note that no handle is created for the argument. - // This is safe since the argument is only used in a tail call. - // The performance benefit is more than 5% when using hashCode. +// Please note that no handle is created for the argument. +// This is safe since the argument is only used in a tail call. +// The performance benefit is more than 5% when using hashCode. #if defined(HASH_IN_OBJECT_HEADER) return Smi::New(Object::GetCachedHash(arguments->NativeArgAt(0))); #else @@ -47,7 +45,6 @@ DEFINE_NATIVE_ENTRY(Object_getHash, 1) { #endif } - DEFINE_NATIVE_ENTRY(Object_setHash, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Smi, hash, arguments->NativeArgAt(1)); #if defined(HASH_IN_OBJECT_HEADER) @@ -60,7 +57,6 @@ DEFINE_NATIVE_ENTRY(Object_setHash, 2) { return Object::null(); } - DEFINE_NATIVE_ENTRY(Object_toString, 1) { const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); if (instance.IsString()) { @@ -70,7 +66,6 @@ DEFINE_NATIVE_ENTRY(Object_toString, 1) { return String::New(c_str); } - DEFINE_NATIVE_ENTRY(Object_noSuchMethod, 6) { const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Bool, is_method, arguments->NativeArgAt(1)); @@ -120,7 +115,6 @@ DEFINE_NATIVE_ENTRY(Object_noSuchMethod, 6) { return Object::null(); } - DEFINE_NATIVE_ENTRY(Object_runtimeType, 1) { const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); if (instance.IsString()) { @@ -133,7 +127,6 @@ DEFINE_NATIVE_ENTRY(Object_runtimeType, 1) { return instance.GetType(Heap::kNew); } - DEFINE_NATIVE_ENTRY(Object_haveSameRuntimeType, 2) { const Instance& left = Instance::CheckedHandle(arguments->NativeArgAt(0)); const Instance& right = Instance::CheckedHandle(arguments->NativeArgAt(1)); @@ -172,7 +165,6 @@ DEFINE_NATIVE_ENTRY(Object_haveSameRuntimeType, 2) { return Bool::Get(left_type_arguments.Equals(right_type_arguments)).raw(); } - DEFINE_NATIVE_ENTRY(Object_instanceOf, 4) { const Instance& instance = Instance::CheckedHandle(zone, arguments->NativeArgAt(0)); @@ -250,7 +242,6 @@ DEFINE_NATIVE_ENTRY(Object_simpleInstanceOf, 2) { return Bool::Get(is_instance_of).raw(); } - DEFINE_NATIVE_ENTRY(Object_as, 4) { const Instance& instance = Instance::CheckedHandle(zone, arguments->NativeArgAt(0)); @@ -313,14 +304,12 @@ DEFINE_NATIVE_ENTRY(Object_as, 4) { return instance.raw(); } - DEFINE_NATIVE_ENTRY(AbstractType_toString, 1) { const AbstractType& type = AbstractType::CheckedHandle(zone, arguments->NativeArgAt(0)); return type.UserVisibleName(); } - DEFINE_NATIVE_ENTRY(LibraryPrefix_invalidateDependentCode, 1) { const LibraryPrefix& prefix = LibraryPrefix::CheckedHandle(zone, arguments->NativeArgAt(0)); @@ -328,7 +317,6 @@ DEFINE_NATIVE_ENTRY(LibraryPrefix_invalidateDependentCode, 1) { return Bool::Get(true).raw(); } - DEFINE_NATIVE_ENTRY(LibraryPrefix_load, 1) { const LibraryPrefix& prefix = LibraryPrefix::CheckedHandle(zone, arguments->NativeArgAt(0)); @@ -336,7 +324,6 @@ DEFINE_NATIVE_ENTRY(LibraryPrefix_load, 1) { return Bool::Get(hasCompleted).raw(); } - DEFINE_NATIVE_ENTRY(LibraryPrefix_loadError, 1) { const LibraryPrefix& prefix = LibraryPrefix::CheckedHandle(zone, arguments->NativeArgAt(0)); @@ -348,14 +335,12 @@ DEFINE_NATIVE_ENTRY(LibraryPrefix_loadError, 1) { return error.raw(); } - DEFINE_NATIVE_ENTRY(LibraryPrefix_isLoaded, 1) { const LibraryPrefix& prefix = LibraryPrefix::CheckedHandle(zone, arguments->NativeArgAt(0)); return Bool::Get(prefix.is_loaded()).raw(); } - DEFINE_NATIVE_ENTRY(Internal_inquireIs64Bit, 0) { #if defined(ARCH_IS_64_BIT) return Bool::True().raw(); @@ -364,7 +349,6 @@ DEFINE_NATIVE_ENTRY(Internal_inquireIs64Bit, 0) { #endif // defined(ARCH_IS_64_BIT) } - DEFINE_NATIVE_ENTRY(Internal_prependTypeArguments, 3) { const TypeArguments& function_type_arguments = TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(0)); diff --git a/runtime/lib/profiler.cc b/runtime/lib/profiler.cc index 7959360dec4..1ff14bae9ce 100644 --- a/runtime/lib/profiler.cc +++ b/runtime/lib/profiler.cc @@ -23,13 +23,11 @@ DEFINE_NATIVE_ENTRY(UserTag_new, 2) { return UserTag::New(tag_label); } - DEFINE_NATIVE_ENTRY(UserTag_label, 1) { const UserTag& self = UserTag::CheckedHandle(arguments->NativeArgAt(0)); return self.label(); } - DEFINE_NATIVE_ENTRY(UserTag_makeCurrent, 1) { const UserTag& self = UserTag::CheckedHandle(arguments->NativeArgAt(0)); if (FLAG_trace_intrinsified_natives) { @@ -40,7 +38,6 @@ DEFINE_NATIVE_ENTRY(UserTag_makeCurrent, 1) { return old.raw(); } - DEFINE_NATIVE_ENTRY(UserTag_defaultTag, 0) { if (FLAG_trace_intrinsified_natives) { OS::Print("UserTag_defaultTag\n"); @@ -48,7 +45,6 @@ DEFINE_NATIVE_ENTRY(UserTag_defaultTag, 0) { return isolate->default_tag(); } - DEFINE_NATIVE_ENTRY(Profiler_getCurrentTag, 0) { if (FLAG_trace_intrinsified_natives) { OS::Print("Profiler_getCurrentTag\n"); @@ -56,5 +52,4 @@ DEFINE_NATIVE_ENTRY(Profiler_getCurrentTag, 0) { return isolate->current_tag(); } - } // namespace dart diff --git a/runtime/lib/regexp.cc b/runtime/lib/regexp.cc index 1579374760a..92f411f941f 100644 --- a/runtime/lib/regexp.cc +++ b/runtime/lib/regexp.cc @@ -7,9 +7,9 @@ #include "vm/exceptions.h" #include "vm/native_entry.h" #include "vm/object.h" -#include "vm/regexp_parser.h" -#include "vm/regexp_assembler_ir.h" #include "vm/regexp_assembler_bytecode.h" +#include "vm/regexp_assembler_ir.h" +#include "vm/regexp_parser.h" #include "vm/thread.h" namespace dart { @@ -36,28 +36,24 @@ DEFINE_NATIVE_ENTRY(RegExp_factory, 4) { return RegExpEngine::CreateRegExp(thread, pattern, multi_line, ignore_case); } - DEFINE_NATIVE_ENTRY(RegExp_getPattern, 1) { const RegExp& regexp = RegExp::CheckedHandle(arguments->NativeArgAt(0)); ASSERT(!regexp.IsNull()); return regexp.pattern(); } - DEFINE_NATIVE_ENTRY(RegExp_getIsMultiLine, 1) { const RegExp& regexp = RegExp::CheckedHandle(arguments->NativeArgAt(0)); ASSERT(!regexp.IsNull()); return Bool::Get(regexp.is_multi_line()).raw(); } - DEFINE_NATIVE_ENTRY(RegExp_getIsCaseSensitive, 1) { const RegExp& regexp = RegExp::CheckedHandle(arguments->NativeArgAt(0)); ASSERT(!regexp.IsNull()); return Bool::Get(!regexp.is_ignore_case()).raw(); } - DEFINE_NATIVE_ENTRY(RegExp_getGroupCount, 1) { const RegExp& regexp = RegExp::CheckedHandle(arguments->NativeArgAt(0)); ASSERT(!regexp.IsNull()); @@ -74,7 +70,6 @@ DEFINE_NATIVE_ENTRY(RegExp_getGroupCount, 1) { return Object::null(); } - static RawObject* ExecuteMatch(Zone* zone, NativeArguments* arguments, bool sticky) { @@ -93,17 +88,14 @@ static RawObject* ExecuteMatch(Zone* zone, /*sticky=*/sticky, zone); } - DEFINE_NATIVE_ENTRY(RegExp_ExecuteMatch, 3) { // This function is intrinsified. See Intrinsifier::RegExp_ExecuteMatch. return ExecuteMatch(zone, arguments, /*sticky=*/false); } - DEFINE_NATIVE_ENTRY(RegExp_ExecuteMatchSticky, 3) { // This function is intrinsified. See Intrinsifier::RegExp_ExecuteMatchSticky. return ExecuteMatch(zone, arguments, /*sticky=*/true); } - } // namespace dart diff --git a/runtime/lib/simd128.cc b/runtime/lib/simd128.cc index f9520c3e95f..45c38624a5d 100644 --- a/runtime/lib/simd128.cc +++ b/runtime/lib/simd128.cc @@ -18,7 +18,6 @@ static void ThrowMaskRangeException(int64_t m) { } } - DEFINE_NATIVE_ENTRY(Float32x4_fromDoubles, 5) { ASSERT(TypeArguments::CheckedHandle(arguments->NativeArgAt(0)).IsNull()); GET_NON_NULL_NATIVE_ARGUMENT(Double, x, arguments->NativeArgAt(1)); @@ -32,7 +31,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_fromDoubles, 5) { return Float32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_splat, 2) { ASSERT(TypeArguments::CheckedHandle(arguments->NativeArgAt(0)).IsNull()); GET_NON_NULL_NATIVE_ARGUMENT(Double, v, arguments->NativeArgAt(1)); @@ -40,19 +38,16 @@ DEFINE_NATIVE_ENTRY(Float32x4_splat, 2) { return Float32x4::New(_v, _v, _v, _v); } - DEFINE_NATIVE_ENTRY(Float32x4_zero, 1) { ASSERT(TypeArguments::CheckedHandle(arguments->NativeArgAt(0)).IsNull()); return Float32x4::New(0.0f, 0.0f, 0.0f, 0.0f); } - DEFINE_NATIVE_ENTRY(Float32x4_fromInt32x4Bits, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, v, arguments->NativeArgAt(1)); return Float32x4::New(v.value()); } - DEFINE_NATIVE_ENTRY(Float32x4_fromFloat64x2, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, v, arguments->NativeArgAt(1)); float _x = static_cast(v.x()); @@ -60,7 +55,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_fromFloat64x2, 2) { return Float32x4::New(_x, _y, 0.0f, 0.0f); } - DEFINE_NATIVE_ENTRY(Float32x4_add, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, other, arguments->NativeArgAt(1)); @@ -71,7 +65,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_add, 2) { return Float32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_negate, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); float _x = -self.x(); @@ -81,7 +74,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_negate, 1) { return Float32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_sub, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, other, arguments->NativeArgAt(1)); @@ -92,7 +84,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_sub, 2) { return Float32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_mul, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, other, arguments->NativeArgAt(1)); @@ -103,7 +94,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_mul, 2) { return Float32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_div, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, other, arguments->NativeArgAt(1)); @@ -114,7 +104,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_div, 2) { return Float32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_cmplt, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, a, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, b, arguments->NativeArgAt(1)); @@ -125,7 +114,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_cmplt, 2) { return Int32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_cmplte, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, a, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, b, arguments->NativeArgAt(1)); @@ -136,7 +124,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_cmplte, 2) { return Int32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_cmpgt, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, a, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, b, arguments->NativeArgAt(1)); @@ -147,7 +134,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_cmpgt, 2) { return Int32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_cmpgte, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, a, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, b, arguments->NativeArgAt(1)); @@ -158,7 +144,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_cmpgte, 2) { return Int32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_cmpequal, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, a, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, b, arguments->NativeArgAt(1)); @@ -169,7 +154,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_cmpequal, 2) { return Int32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_cmpnequal, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, a, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, b, arguments->NativeArgAt(1)); @@ -180,7 +164,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_cmpnequal, 2) { return Int32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_scale, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Double, scale, arguments->NativeArgAt(1)); @@ -192,7 +175,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_scale, 2) { return Float32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_abs, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); float _x = fabsf(self.x()); @@ -202,7 +184,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_abs, 1) { return Float32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_clamp, 3) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, lo, arguments->NativeArgAt(1)); @@ -220,35 +201,30 @@ DEFINE_NATIVE_ENTRY(Float32x4_clamp, 3) { return Float32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_getX, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); double value = static_cast(self.x()); return Double::New(value); } - DEFINE_NATIVE_ENTRY(Float32x4_getY, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); double value = static_cast(self.y()); return Double::New(value); } - DEFINE_NATIVE_ENTRY(Float32x4_getZ, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); double value = static_cast(self.z()); return Double::New(value); } - DEFINE_NATIVE_ENTRY(Float32x4_getW, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); double value = static_cast(self.w()); return Double::New(value); } - DEFINE_NATIVE_ENTRY(Float32x4_getSignMask, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); uint32_t mx = (bit_cast(self.x()) & 0x80000000) >> 31; @@ -259,7 +235,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_getSignMask, 1) { return Integer::New(value); } - DEFINE_NATIVE_ENTRY(Int32x4_getSignMask, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); uint32_t mx = (self.x() & 0x80000000) >> 31; @@ -270,7 +245,6 @@ DEFINE_NATIVE_ENTRY(Int32x4_getSignMask, 1) { return Integer::New(value); } - DEFINE_NATIVE_ENTRY(Float32x4_shuffle, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Integer, mask, arguments->NativeArgAt(1)); @@ -284,7 +258,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_shuffle, 2) { return Float32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_shuffleMix, 3) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, other, arguments->NativeArgAt(1)); @@ -300,7 +273,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_shuffleMix, 3) { return Float32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_setX, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Double, x, arguments->NativeArgAt(1)); @@ -311,7 +283,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_setX, 2) { return Float32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_setY, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Double, y, arguments->NativeArgAt(1)); @@ -322,7 +293,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_setY, 2) { return Float32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_setZ, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Double, z, arguments->NativeArgAt(1)); @@ -333,7 +303,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_setZ, 2) { return Float32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_setW, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Double, w, arguments->NativeArgAt(1)); @@ -344,7 +313,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_setW, 2) { return Float32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_min, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, other, arguments->NativeArgAt(1)); @@ -355,7 +323,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_min, 2) { return Float32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_max, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, other, arguments->NativeArgAt(1)); @@ -366,7 +333,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_max, 2) { return Float32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_sqrt, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); float _x = sqrtf(self.x()); @@ -376,7 +342,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_sqrt, 1) { return Float32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_reciprocal, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); float _x = 1.0f / self.x(); @@ -386,7 +351,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_reciprocal, 1) { return Float32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Float32x4_reciprocalSqrt, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); float _x = sqrtf(1.0f / self.x()); @@ -396,7 +360,6 @@ DEFINE_NATIVE_ENTRY(Float32x4_reciprocalSqrt, 1) { return Float32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Int32x4_fromInts, 5) { ASSERT(TypeArguments::CheckedHandle(arguments->NativeArgAt(0)).IsNull()); GET_NON_NULL_NATIVE_ARGUMENT(Integer, x, arguments->NativeArgAt(1)); @@ -410,7 +373,6 @@ DEFINE_NATIVE_ENTRY(Int32x4_fromInts, 5) { return Int32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Int32x4_fromBools, 5) { ASSERT(TypeArguments::CheckedHandle(arguments->NativeArgAt(0)).IsNull()); GET_NON_NULL_NATIVE_ARGUMENT(Bool, x, arguments->NativeArgAt(1)); @@ -424,13 +386,11 @@ DEFINE_NATIVE_ENTRY(Int32x4_fromBools, 5) { return Int32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Int32x4_fromFloat32x4Bits, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, v, arguments->NativeArgAt(1)); return Int32x4::New(v.value()); } - DEFINE_NATIVE_ENTRY(Int32x4_or, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, other, arguments->NativeArgAt(1)); @@ -441,7 +401,6 @@ DEFINE_NATIVE_ENTRY(Int32x4_or, 2) { return Int32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Int32x4_and, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, other, arguments->NativeArgAt(1)); @@ -452,7 +411,6 @@ DEFINE_NATIVE_ENTRY(Int32x4_and, 2) { return Int32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Int32x4_xor, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, other, arguments->NativeArgAt(1)); @@ -463,7 +421,6 @@ DEFINE_NATIVE_ENTRY(Int32x4_xor, 2) { return Int32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Int32x4_add, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, other, arguments->NativeArgAt(1)); @@ -474,7 +431,6 @@ DEFINE_NATIVE_ENTRY(Int32x4_add, 2) { return Int32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Int32x4_sub, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, other, arguments->NativeArgAt(1)); @@ -485,35 +441,30 @@ DEFINE_NATIVE_ENTRY(Int32x4_sub, 2) { return Int32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Int32x4_getX, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); int32_t value = self.x(); return Integer::New(value); } - DEFINE_NATIVE_ENTRY(Int32x4_getY, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); int32_t value = self.y(); return Integer::New(value); } - DEFINE_NATIVE_ENTRY(Int32x4_getZ, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); int32_t value = self.z(); return Integer::New(value); } - DEFINE_NATIVE_ENTRY(Int32x4_getW, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); int32_t value = self.w(); return Integer::New(value); } - DEFINE_NATIVE_ENTRY(Int32x4_shuffle, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Integer, mask, arguments->NativeArgAt(1)); @@ -527,7 +478,6 @@ DEFINE_NATIVE_ENTRY(Int32x4_shuffle, 2) { return Int32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Int32x4_shuffleMix, 3) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, zw, arguments->NativeArgAt(1)); @@ -543,7 +493,6 @@ DEFINE_NATIVE_ENTRY(Int32x4_shuffleMix, 3) { return Int32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Int32x4_setX, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Integer, x, arguments->NativeArgAt(1)); @@ -554,7 +503,6 @@ DEFINE_NATIVE_ENTRY(Int32x4_setX, 2) { return Int32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Int32x4_setY, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Integer, y, arguments->NativeArgAt(1)); @@ -565,7 +513,6 @@ DEFINE_NATIVE_ENTRY(Int32x4_setY, 2) { return Int32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Int32x4_setZ, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Integer, z, arguments->NativeArgAt(1)); @@ -576,7 +523,6 @@ DEFINE_NATIVE_ENTRY(Int32x4_setZ, 2) { return Int32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Int32x4_setW, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Integer, w, arguments->NativeArgAt(1)); @@ -587,35 +533,30 @@ DEFINE_NATIVE_ENTRY(Int32x4_setW, 2) { return Int32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Int32x4_getFlagX, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); int32_t value = self.x(); return Bool::Get(value != 0).raw(); } - DEFINE_NATIVE_ENTRY(Int32x4_getFlagY, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); int32_t value = self.y(); return Bool::Get(value != 0).raw(); } - DEFINE_NATIVE_ENTRY(Int32x4_getFlagZ, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); int32_t value = self.z(); return Bool::Get(value != 0).raw(); } - DEFINE_NATIVE_ENTRY(Int32x4_getFlagW, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); int32_t value = self.w(); return Bool::Get(value != 0).raw(); } - DEFINE_NATIVE_ENTRY(Int32x4_setFlagX, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Bool, flagX, arguments->NativeArgAt(1)); @@ -627,7 +568,6 @@ DEFINE_NATIVE_ENTRY(Int32x4_setFlagX, 2) { return Int32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Int32x4_setFlagY, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Bool, flagY, arguments->NativeArgAt(1)); @@ -639,7 +579,6 @@ DEFINE_NATIVE_ENTRY(Int32x4_setFlagY, 2) { return Int32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Int32x4_setFlagZ, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Bool, flagZ, arguments->NativeArgAt(1)); @@ -651,7 +590,6 @@ DEFINE_NATIVE_ENTRY(Int32x4_setFlagZ, 2) { return Int32x4::New(_x, _y, _z, _w); } - DEFINE_NATIVE_ENTRY(Int32x4_setFlagW, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Bool, flagW, arguments->NativeArgAt(1)); @@ -663,7 +601,6 @@ DEFINE_NATIVE_ENTRY(Int32x4_setFlagW, 2) { return Int32x4::New(_x, _y, _z, _w); } - // Used to convert between int32_t and float32 without breaking strict // aliasing rules. union float32_int32 { @@ -673,7 +610,6 @@ union float32_int32 { float32_int32(int32_t v) { u = v; } }; - DEFINE_NATIVE_ENTRY(Int32x4_select, 3) { GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, tv, arguments->NativeArgAt(1)); @@ -699,7 +635,6 @@ DEFINE_NATIVE_ENTRY(Int32x4_select, 3) { return Float32x4::New(tempX.f, tempY.f, tempZ.f, tempW.f); } - DEFINE_NATIVE_ENTRY(Float64x2_fromDoubles, 3) { ASSERT(TypeArguments::CheckedHandle(arguments->NativeArgAt(0)).IsNull()); GET_NON_NULL_NATIVE_ARGUMENT(Double, x, arguments->NativeArgAt(1)); @@ -707,20 +642,17 @@ DEFINE_NATIVE_ENTRY(Float64x2_fromDoubles, 3) { return Float64x2::New(x.value(), y.value()); } - DEFINE_NATIVE_ENTRY(Float64x2_splat, 2) { ASSERT(TypeArguments::CheckedHandle(arguments->NativeArgAt(0)).IsNull()); GET_NON_NULL_NATIVE_ARGUMENT(Double, v, arguments->NativeArgAt(1)); return Float64x2::New(v.value(), v.value()); } - DEFINE_NATIVE_ENTRY(Float64x2_zero, 1) { ASSERT(TypeArguments::CheckedHandle(arguments->NativeArgAt(0)).IsNull()); return Float64x2::New(0.0, 0.0); } - DEFINE_NATIVE_ENTRY(Float64x2_fromFloat32x4, 2) { ASSERT(TypeArguments::CheckedHandle(arguments->NativeArgAt(0)).IsNull()); GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, v, arguments->NativeArgAt(1)); @@ -729,7 +661,6 @@ DEFINE_NATIVE_ENTRY(Float64x2_fromFloat32x4, 2) { return Float64x2::New(_x, _y); } - DEFINE_NATIVE_ENTRY(Float64x2_add, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, other, arguments->NativeArgAt(1)); @@ -738,7 +669,6 @@ DEFINE_NATIVE_ENTRY(Float64x2_add, 2) { return Float64x2::New(_x, _y); } - DEFINE_NATIVE_ENTRY(Float64x2_negate, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0)); double _x = -self.x(); @@ -746,7 +676,6 @@ DEFINE_NATIVE_ENTRY(Float64x2_negate, 1) { return Float64x2::New(_x, _y); } - DEFINE_NATIVE_ENTRY(Float64x2_sub, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, other, arguments->NativeArgAt(1)); @@ -755,7 +684,6 @@ DEFINE_NATIVE_ENTRY(Float64x2_sub, 2) { return Float64x2::New(_x, _y); } - DEFINE_NATIVE_ENTRY(Float64x2_mul, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, other, arguments->NativeArgAt(1)); @@ -764,7 +692,6 @@ DEFINE_NATIVE_ENTRY(Float64x2_mul, 2) { return Float64x2::New(_x, _y); } - DEFINE_NATIVE_ENTRY(Float64x2_div, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, other, arguments->NativeArgAt(1)); @@ -773,7 +700,6 @@ DEFINE_NATIVE_ENTRY(Float64x2_div, 2) { return Float64x2::New(_x, _y); } - DEFINE_NATIVE_ENTRY(Float64x2_scale, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Double, scale, arguments->NativeArgAt(1)); @@ -783,7 +709,6 @@ DEFINE_NATIVE_ENTRY(Float64x2_scale, 2) { return Float64x2::New(_x, _y); } - DEFINE_NATIVE_ENTRY(Float64x2_abs, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0)); double _x = fabs(self.x()); @@ -791,7 +716,6 @@ DEFINE_NATIVE_ENTRY(Float64x2_abs, 1) { return Float64x2::New(_x, _y); } - DEFINE_NATIVE_ENTRY(Float64x2_clamp, 3) { GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, lo, arguments->NativeArgAt(1)); @@ -805,19 +729,16 @@ DEFINE_NATIVE_ENTRY(Float64x2_clamp, 3) { return Float64x2::New(_x, _y); } - DEFINE_NATIVE_ENTRY(Float64x2_getX, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0)); return Double::New(self.x()); } - DEFINE_NATIVE_ENTRY(Float64x2_getY, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0)); return Double::New(self.y()); } - DEFINE_NATIVE_ENTRY(Float64x2_getSignMask, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0)); uint32_t mx = (bit_cast(self.x()) & 0x8000000000000000LL) >> 63; @@ -826,7 +747,6 @@ DEFINE_NATIVE_ENTRY(Float64x2_getSignMask, 1) { return Integer::New(value); } - DEFINE_NATIVE_ENTRY(Float64x2_setX, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Double, x, arguments->NativeArgAt(1)); @@ -835,7 +755,6 @@ DEFINE_NATIVE_ENTRY(Float64x2_setX, 2) { return Float64x2::New(_x, _y); } - DEFINE_NATIVE_ENTRY(Float64x2_setY, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Double, y, arguments->NativeArgAt(1)); @@ -844,7 +763,6 @@ DEFINE_NATIVE_ENTRY(Float64x2_setY, 2) { return Float64x2::New(_x, _y); } - DEFINE_NATIVE_ENTRY(Float64x2_min, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, other, arguments->NativeArgAt(1)); @@ -853,7 +771,6 @@ DEFINE_NATIVE_ENTRY(Float64x2_min, 2) { return Float64x2::New(_x, _y); } - DEFINE_NATIVE_ENTRY(Float64x2_max, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, other, arguments->NativeArgAt(1)); @@ -862,7 +779,6 @@ DEFINE_NATIVE_ENTRY(Float64x2_max, 2) { return Float64x2::New(_x, _y); } - DEFINE_NATIVE_ENTRY(Float64x2_sqrt, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0)); double _x = sqrt(self.x()); diff --git a/runtime/lib/stacktrace.cc b/runtime/lib/stacktrace.cc index 8be29793cf1..d8b8cab176a 100644 --- a/runtime/lib/stacktrace.cc +++ b/runtime/lib/stacktrace.cc @@ -40,7 +40,6 @@ static RawStackTrace* CurrentSyncStackTrace(Thread* thread, return StackTrace::New(code_array, pc_offset_array); } - static RawStackTrace* CurrentStackTrace( Thread* thread, bool for_async_function, @@ -98,18 +97,15 @@ static RawStackTrace* CurrentStackTrace( return StackTrace::New(code_array, pc_offset_array, async_stack_trace); } - RawStackTrace* GetStackTraceForException() { Thread* thread = Thread::Current(); return CurrentStackTrace(thread, false, 0); } - DEFINE_NATIVE_ENTRY(StackTrace_current, 0) { return CurrentStackTrace(thread, false); } - DEFINE_NATIVE_ENTRY(StackTrace_asyncStackTraceHelper, 1) { GET_NATIVE_ARGUMENT(Closure, async_op, arguments->NativeArgAt(0)); if (!async_op.IsNull()) { @@ -123,13 +119,11 @@ DEFINE_NATIVE_ENTRY(StackTrace_asyncStackTraceHelper, 1) { return CurrentStackTrace(thread, true); } - DEFINE_NATIVE_ENTRY(StackTrace_clearAsyncThreadStackTrace, 0) { thread->clear_async_stack_trace(); return Object::null(); } - DEFINE_NATIVE_ENTRY(StackTrace_setAsyncThreadStackTrace, 1) { GET_NON_NULL_NATIVE_ARGUMENT(StackTrace, stack_trace, arguments->NativeArgAt(0)); @@ -137,7 +131,6 @@ DEFINE_NATIVE_ENTRY(StackTrace_setAsyncThreadStackTrace, 1) { return Object::null(); } - static void AppendFrames(const GrowableObjectArray& code_list, const GrowableObjectArray& pc_offset_list, int skip_frames) { @@ -163,7 +156,6 @@ static void AppendFrames(const GrowableObjectArray& code_list, } } - // Creates a StackTrace object from the current stack. // // Skips the first skip_frames Dart frames. diff --git a/runtime/lib/stopwatch.cc b/runtime/lib/stopwatch.cc index 934aba568e6..8adb201649d 100644 --- a/runtime/lib/stopwatch.cc +++ b/runtime/lib/stopwatch.cc @@ -13,7 +13,6 @@ DEFINE_NATIVE_ENTRY(Stopwatch_now, 0) { return Integer::New(OS::GetCurrentMonotonicTicks()); } - DEFINE_NATIVE_ENTRY(Stopwatch_frequency, 0) { return Integer::New(OS::GetCurrentMonotonicFrequency()); } diff --git a/runtime/lib/string.cc b/runtime/lib/string.cc index 8affbbd6a78..0141a5c09fa 100644 --- a/runtime/lib/string.cc +++ b/runtime/lib/string.cc @@ -5,8 +5,8 @@ #include "vm/bootstrap_natives.h" #include "include/dart_api.h" -#include "vm/exceptions.h" #include "vm/dart_api_impl.h" +#include "vm/exceptions.h" #include "vm/isolate.h" #include "vm/native_entry.h" #include "vm/object.h" @@ -27,7 +27,6 @@ DEFINE_NATIVE_ENTRY(String_fromEnvironment, 3) { return default_value.raw(); } - DEFINE_NATIVE_ENTRY(StringBase_createFromCodePoints, 3) { GET_NON_NULL_NATIVE_ARGUMENT(Instance, list, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Smi, start_obj, arguments->NativeArgAt(1)); @@ -89,7 +88,6 @@ DEFINE_NATIVE_ENTRY(StringBase_createFromCodePoints, 3) { return TwoByteString::New(utf16_len, utf32_array, array_len, Heap::kNew); } - DEFINE_NATIVE_ENTRY(StringBase_substringUnchecked, 3) { const String& receiver = String::CheckedHandle(zone, arguments->NativeArgAt(0)); @@ -101,7 +99,6 @@ DEFINE_NATIVE_ENTRY(StringBase_substringUnchecked, 3) { return String::SubString(receiver, start, (end - start)); } - // Return the bitwise-or of all characters in the slice from start to end. static uint16_t CharacterLimit(const String& string, intptr_t start, @@ -162,7 +159,6 @@ static bool CheckSlicesOneByte(const String& base, return true; } - DEFINE_NATIVE_ENTRY(StringBase_joinReplaceAllResult, 4) { const String& base = String::CheckedHandle(zone, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(GrowableObjectArray, matches_growable, @@ -260,7 +256,6 @@ DEFINE_NATIVE_ENTRY(OneByteString_substringUnchecked, 3) { return OneByteString::New(receiver, start, end - start, Heap::kNew); } - // This is high-performance code. DEFINE_NATIVE_ENTRY(OneByteString_splitWithCharCode, 2) { const String& receiver = @@ -288,13 +283,11 @@ DEFINE_NATIVE_ENTRY(OneByteString_splitWithCharCode, 2) { return result.raw(); } - DEFINE_NATIVE_ENTRY(OneByteString_allocate, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Smi, length_obj, arguments->NativeArgAt(0)); return OneByteString::New(length_obj.Value(), Heap::kNew); } - DEFINE_NATIVE_ENTRY(OneByteString_allocateFromOneByteList, 3) { Instance& list = Instance::CheckedHandle(zone, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Smi, start_obj, arguments->NativeArgAt(1)); @@ -381,7 +374,6 @@ DEFINE_NATIVE_ENTRY(OneByteString_allocateFromOneByteList, 3) { return Object::null(); } - DEFINE_NATIVE_ENTRY(OneByteString_setAt, 3) { GET_NON_NULL_NATIVE_ARGUMENT(String, receiver, arguments->NativeArgAt(0)); ASSERT(receiver.IsOneByteString()); @@ -392,12 +384,10 @@ DEFINE_NATIVE_ENTRY(OneByteString_setAt, 3) { return Object::null(); } - DEFINE_NATIVE_ENTRY(ExternalOneByteString_getCid, 0) { return Smi::New(kExternalOneByteStringCid); } - DEFINE_NATIVE_ENTRY(TwoByteString_allocateFromTwoByteList, 3) { Instance& list = Instance::CheckedHandle(zone, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Smi, start_obj, arguments->NativeArgAt(1)); @@ -483,7 +473,6 @@ DEFINE_NATIVE_ENTRY(TwoByteString_allocateFromTwoByteList, 3) { return Object::null(); } - DEFINE_NATIVE_ENTRY(String_getHashCode, 1) { const String& receiver = String::CheckedHandle(zone, arguments->NativeArgAt(0)); @@ -493,14 +482,12 @@ DEFINE_NATIVE_ENTRY(String_getHashCode, 1) { return Smi::New(hash_val); } - DEFINE_NATIVE_ENTRY(String_getLength, 1) { const String& receiver = String::CheckedHandle(zone, arguments->NativeArgAt(0)); return Smi::New(receiver.Length()); } - static uint16_t StringValueAt(const String& str, const Integer& index) { if (index.IsSmi()) { const intptr_t index_value = Smi::Cast(index).Value(); @@ -514,7 +501,6 @@ static uint16_t StringValueAt(const String& str, const Integer& index) { return 0; } - DEFINE_NATIVE_ENTRY(String_charAt, 2) { const String& receiver = String::CheckedHandle(zone, arguments->NativeArgAt(0)); @@ -523,7 +509,6 @@ DEFINE_NATIVE_ENTRY(String_charAt, 2) { return Symbols::FromCharCode(thread, static_cast(value)); } - // Returns the 16-bit UTF-16 code unit at the given index. DEFINE_NATIVE_ENTRY(String_codeUnitAt, 2) { const String& receiver = @@ -533,7 +518,6 @@ DEFINE_NATIVE_ENTRY(String_codeUnitAt, 2) { return Smi::New(static_cast(value)); } - DEFINE_NATIVE_ENTRY(String_concat, 2) { const String& receiver = String::CheckedHandle(zone, arguments->NativeArgAt(0)); @@ -541,7 +525,6 @@ DEFINE_NATIVE_ENTRY(String_concat, 2) { return String::Concat(receiver, b); } - DEFINE_NATIVE_ENTRY(String_toLowerCase, 1) { const String& receiver = String::CheckedHandle(zone, arguments->NativeArgAt(0)); @@ -549,7 +532,6 @@ DEFINE_NATIVE_ENTRY(String_toLowerCase, 1) { return String::ToLowerCase(receiver); } - DEFINE_NATIVE_ENTRY(String_toUpperCase, 1) { const String& receiver = String::CheckedHandle(zone, arguments->NativeArgAt(0)); @@ -557,7 +539,6 @@ DEFINE_NATIVE_ENTRY(String_toUpperCase, 1) { return String::ToUpperCase(receiver); } - DEFINE_NATIVE_ENTRY(String_concatRange, 3) { GET_NON_NULL_NATIVE_ARGUMENT(Instance, argument, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Smi, start, arguments->NativeArgAt(1)); @@ -593,7 +574,6 @@ DEFINE_NATIVE_ENTRY(String_concatRange, 3) { return String::ConcatAllRange(strings, start_ix, end_ix, Heap::kNew); } - DEFINE_NATIVE_ENTRY(StringBuffer_createStringFromUint16Array, 3) { GET_NON_NULL_NATIVE_ARGUMENT(TypedData, codeUnits, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Smi, length, arguments->NativeArgAt(1)); diff --git a/runtime/lib/timeline.cc b/runtime/lib/timeline.cc index 18b89e925ad..ce4b43f6d24 100644 --- a/runtime/lib/timeline.cc +++ b/runtime/lib/timeline.cc @@ -27,12 +27,10 @@ DEFINE_NATIVE_ENTRY(Timeline_isDartStreamEnabled, 0) { return Bool::False().raw(); } - DEFINE_NATIVE_ENTRY(Timeline_getIsolateNum, 0) { return Integer::New(static_cast(isolate->main_port()), Heap::kOld); } - DEFINE_NATIVE_ENTRY(Timeline_getNextAsyncId, 0) { if (!FLAG_support_timeline) { return Integer::New(0); @@ -44,17 +42,14 @@ DEFINE_NATIVE_ENTRY(Timeline_getNextAsyncId, 0) { return Integer::New(recorder->GetNextAsyncId()); } - DEFINE_NATIVE_ENTRY(Timeline_getTraceClock, 0) { return Integer::New(OS::GetCurrentMonotonicMicros(), Heap::kNew); } - DEFINE_NATIVE_ENTRY(Timeline_getThreadCpuClock, 0) { return Integer::New(OS::GetCurrentThreadCPUMicros(), Heap::kNew); } - DEFINE_NATIVE_ENTRY(Timeline_reportTaskEvent, 6) { #ifndef PRODUCT if (!FLAG_support_timeline) { @@ -89,9 +84,10 @@ DEFINE_NATIVE_ENTRY(Timeline_reportTaskEvent, 6) { (phase_string[0] == 'e')); ASSERT(phase_string[1] == '\0'); char* json = OS::SCreate( - zone, "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64 - "," - "\"ts\":%" Pd64 ",\"ph\":\"%s\",\"id\":%" Pd64 ", \"args\":%s}", + zone, + "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64 + "," + "\"ts\":%" Pd64 ",\"ph\":\"%s\",\"id\":%" Pd64 ", \"args\":%s}", name.ToCString(), category.ToCString(), tid, pid, start.AsInt64Value(), phase_string, id.AsInt64Value(), args.ToCString()); @@ -115,7 +111,6 @@ DEFINE_NATIVE_ENTRY(Timeline_reportTaskEvent, 6) { return Object::null(); } - DEFINE_NATIVE_ENTRY(Timeline_reportCompleteEvent, 5) { #ifndef PRODUCT if (!FLAG_support_timeline) { @@ -151,18 +146,20 @@ DEFINE_NATIVE_ENTRY(Timeline_reportCompleteEvent, 5) { if ((start_cpu.AsInt64Value() != -1) && (end_cpu != -1)) { json = OS::SCreate( - zone, "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64 - "," - "\"ts\":%" Pd64 ",\"ph\":\"X\",\"dur\":%" Pd64 - "," - "\"tdur\":%" Pd64 ",\"args\":%s}", + zone, + "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64 + "," + "\"ts\":%" Pd64 ",\"ph\":\"X\",\"dur\":%" Pd64 + "," + "\"tdur\":%" Pd64 ",\"args\":%s}", name.ToCString(), category.ToCString(), tid, pid, start.AsInt64Value(), duration, duration_cpu, args.ToCString()); } else { json = OS::SCreate( - zone, "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64 - "," - "\"ts\":%" Pd64 ",\"ph\":\"X\",\"dur\":%" Pd64 ",\"args\":%s}", + zone, + "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64 + "," + "\"ts\":%" Pd64 ",\"ph\":\"X\",\"dur\":%" Pd64 ",\"args\":%s}", name.ToCString(), category.ToCString(), tid, pid, start.AsInt64Value(), duration, args.ToCString()); } @@ -176,7 +173,6 @@ DEFINE_NATIVE_ENTRY(Timeline_reportCompleteEvent, 5) { return Object::null(); } - DEFINE_NATIVE_ENTRY(Timeline_reportInstantEvent, 4) { #ifndef PRODUCT if (!FLAG_support_timeline) { @@ -203,12 +199,13 @@ DEFINE_NATIVE_ENTRY(Timeline_reportInstantEvent, 4) { ASSERT(os_thread != NULL); int64_t tid = OSThread::ThreadIdToIntPtr(os_thread->trace_id()); - char* json = OS::SCreate( - zone, "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64 - "," - "\"ts\":%" Pd64 ",\"ph\":\"I\",\"args\":%s}", - name.ToCString(), category.ToCString(), tid, pid, start.AsInt64Value(), - args.ToCString()); + char* json = OS::SCreate(zone, + "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 + ",\"pid\":%" Pd64 + "," + "\"ts\":%" Pd64 ",\"ph\":\"I\",\"args\":%s}", + name.ToCString(), category.ToCString(), tid, pid, + start.AsInt64Value(), args.ToCString()); event->Instant("", start.AsInt64Value()); // json was allocated in the zone and a copy will be stored in event. diff --git a/runtime/lib/typed_data.cc b/runtime/lib/typed_data.cc index 986c0357ae1..9eec929f347 100644 --- a/runtime/lib/typed_data.cc +++ b/runtime/lib/typed_data.cc @@ -28,7 +28,6 @@ static void RangeCheck(intptr_t offset_in_bytes, } } - // Checks to see if a length will not result in an OOM error. static void LengthCheck(intptr_t len, intptr_t max) { if (len < 0 || len > max) { @@ -38,7 +37,6 @@ static void LengthCheck(intptr_t len, intptr_t max) { } } - DEFINE_NATIVE_ENTRY(TypedData_length, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Instance, instance, arguments->NativeArgAt(0)); if (instance.IsTypedData()) { @@ -55,7 +53,6 @@ DEFINE_NATIVE_ENTRY(TypedData_length, 1) { return Integer::null(); } - template static RawBool* CopyData(const Instance& dst, const Instance& src, @@ -83,7 +80,6 @@ static RawBool* CopyData(const Instance& dst, return Bool::True().raw(); } - static bool IsClamped(intptr_t cid) { switch (cid) { case kTypedDataUint8ClampedArrayCid: @@ -95,7 +91,6 @@ static bool IsClamped(intptr_t cid) { } } - static bool IsUint8(intptr_t cid) { switch (cid) { case kTypedDataUint8ClampedArrayCid: @@ -110,7 +105,6 @@ static bool IsUint8(intptr_t cid) { } } - DEFINE_NATIVE_ENTRY(TypedData_setRange, 7) { const Instance& dst = Instance::CheckedHandle(arguments->NativeArgAt(0)); const Smi& dst_start = Smi::CheckedHandle(arguments->NativeArgAt(1)); @@ -150,7 +144,6 @@ DEFINE_NATIVE_ENTRY(TypedData_setRange, 7) { return Bool::False().raw(); } - // We check the length parameter against a possible maximum length for the // array based on available physical addressable memory on the system. The // maximum possible length is a scaled value of kSmiMax which is set up based @@ -166,10 +159,8 @@ DEFINE_NATIVE_ENTRY(TypedData_setRange, 7) { return TypedData::New(cid, len); \ } - #define TYPED_DATA_NEW_NATIVE(name) TYPED_DATA_NEW(name) - CLASS_LIST_TYPED_DATA(TYPED_DATA_NEW_NATIVE) #define TYPED_DATA_GETTER(getter, object, ctor, access_size) \ @@ -196,7 +187,6 @@ CLASS_LIST_TYPED_DATA(TYPED_DATA_NEW_NATIVE) return object::null(); \ } - #define TYPED_DATA_SETTER(setter, object, get_object_value, access_size, \ access_type) \ DEFINE_NATIVE_ENTRY(TypedData_##setter, 3) { \ @@ -250,7 +240,6 @@ TYPED_DATA_NATIVES(Float32x4, Float32x4, New, value, 16, simd128_value_t) TYPED_DATA_NATIVES(Int32x4, Int32x4, New, value, 16, simd128_value_t) TYPED_DATA_NATIVES(Float64x2, Float64x2, New, value, 16, simd128_value_t) - DEFINE_NATIVE_ENTRY(ByteData_ToEndianInt16, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Smi, host_value, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Bool, little_endian, arguments->NativeArgAt(1)); @@ -263,7 +252,6 @@ DEFINE_NATIVE_ENTRY(ByteData_ToEndianInt16, 2) { return Smi::New(value); } - DEFINE_NATIVE_ENTRY(ByteData_ToEndianUint16, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Smi, host_value, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Bool, little_endian, arguments->NativeArgAt(1)); @@ -274,7 +262,6 @@ DEFINE_NATIVE_ENTRY(ByteData_ToEndianUint16, 2) { return Smi::New(Utils::HostToBigEndian16(value)); } - DEFINE_NATIVE_ENTRY(ByteData_ToEndianInt32, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Integer, host_value, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Bool, little_endian, arguments->NativeArgAt(1)); @@ -289,7 +276,6 @@ DEFINE_NATIVE_ENTRY(ByteData_ToEndianInt32, 2) { return Integer::New(value); } - DEFINE_NATIVE_ENTRY(ByteData_ToEndianUint32, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Integer, host_value, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Bool, little_endian, arguments->NativeArgAt(1)); @@ -303,7 +289,6 @@ DEFINE_NATIVE_ENTRY(ByteData_ToEndianUint32, 2) { return Integer::New(value); } - DEFINE_NATIVE_ENTRY(ByteData_ToEndianInt64, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Integer, host_value, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Bool, little_endian, arguments->NativeArgAt(1)); @@ -316,7 +301,6 @@ DEFINE_NATIVE_ENTRY(ByteData_ToEndianInt64, 2) { return Integer::New(value); } - DEFINE_NATIVE_ENTRY(ByteData_ToEndianUint64, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Integer, host_value, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Bool, little_endian, arguments->NativeArgAt(1)); @@ -337,7 +321,6 @@ DEFINE_NATIVE_ENTRY(ByteData_ToEndianUint64, 2) { return Integer::NewFromUint64(value); } - DEFINE_NATIVE_ENTRY(ByteData_ToEndianFloat32, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Double, host_value, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Bool, little_endian, arguments->NativeArgAt(1)); @@ -352,7 +335,6 @@ DEFINE_NATIVE_ENTRY(ByteData_ToEndianFloat32, 2) { return Double::New(value); } - DEFINE_NATIVE_ENTRY(ByteData_ToEndianFloat64, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Double, host_value, arguments->NativeArgAt(0)); GET_NON_NULL_NATIVE_ARGUMENT(Bool, little_endian, arguments->NativeArgAt(1)); diff --git a/runtime/lib/vmservice.cc b/runtime/lib/vmservice.cc index 7753bc9cbcd..1f3afd079f5 100644 --- a/runtime/lib/vmservice.cc +++ b/runtime/lib/vmservice.cc @@ -8,6 +8,7 @@ #include "vm/exceptions.h" #include "vm/flags.h" #include "vm/growable_array.h" +#include "vm/kernel_isolate.h" #include "vm/message.h" #include "vm/message_handler.h" #include "vm/native_entry.h" @@ -16,7 +17,6 @@ #include "vm/service_event.h" #include "vm/service_isolate.h" #include "vm/symbols.h" -#include "vm/kernel_isolate.h" namespace dart { @@ -34,7 +34,6 @@ static void malloc_deallocator(uint8_t* ptr) { free(reinterpret_cast(ptr)); } - #ifndef PRODUCT class RegisterRunningIsolatesVisitor : public IsolateVisitor { public: @@ -118,7 +117,6 @@ DEFINE_NATIVE_ENTRY(VMService_SendIsolateServiceMessage, 2) { return Bool::Get(result).raw(); } - DEFINE_NATIVE_ENTRY(VMService_SendRootServiceMessage, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Array, message, arguments->NativeArgAt(0)); if (FLAG_support_service) { @@ -127,7 +125,6 @@ DEFINE_NATIVE_ENTRY(VMService_SendRootServiceMessage, 1) { return Object::null(); } - DEFINE_NATIVE_ENTRY(VMService_SendObjectRootServiceMessage, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Array, message, arguments->NativeArgAt(0)); if (FLAG_support_service) { @@ -136,7 +133,6 @@ DEFINE_NATIVE_ENTRY(VMService_SendObjectRootServiceMessage, 1) { return Object::null(); } - DEFINE_NATIVE_ENTRY(VMService_OnStart, 0) { if (FLAG_trace_service) { OS::Print("vm-service: Booting dart:vmservice library.\n"); @@ -157,7 +153,6 @@ DEFINE_NATIVE_ENTRY(VMService_OnStart, 0) { return Object::null(); } - DEFINE_NATIVE_ENTRY(VMService_OnExit, 0) { if (FLAG_trace_service) { OS::Print("vm-service: processed exit message.\n"); @@ -168,7 +163,6 @@ DEFINE_NATIVE_ENTRY(VMService_OnExit, 0) { return Object::null(); } - DEFINE_NATIVE_ENTRY(VMService_OnServerAddressChange, 1) { if (!FLAG_support_service) { return Object::null(); @@ -182,7 +176,6 @@ DEFINE_NATIVE_ENTRY(VMService_OnServerAddressChange, 1) { return Object::null(); } - DEFINE_NATIVE_ENTRY(VMService_ListenStream, 1) { GET_NON_NULL_NATIVE_ARGUMENT(String, stream_id, arguments->NativeArgAt(0)); bool result = false; @@ -192,7 +185,6 @@ DEFINE_NATIVE_ENTRY(VMService_ListenStream, 1) { return Bool::Get(result).raw(); } - DEFINE_NATIVE_ENTRY(VMService_CancelStream, 1) { GET_NON_NULL_NATIVE_ARGUMENT(String, stream_id, arguments->NativeArgAt(0)); if (FLAG_support_service) { @@ -201,7 +193,6 @@ DEFINE_NATIVE_ENTRY(VMService_CancelStream, 1) { return Object::null(); } - DEFINE_NATIVE_ENTRY(VMService_RequestAssets, 0) { if (!FLAG_support_service) { return Object::null(); @@ -209,7 +200,6 @@ DEFINE_NATIVE_ENTRY(VMService_RequestAssets, 0) { return Service::RequestAssets(); } - #ifndef PRODUCT // TODO(25041): When reading, this class copies out the filenames and contents // into new buffers. It does this because the lifetime of |bytes| is uncertain. @@ -373,7 +363,6 @@ class TarArchive { DISALLOW_COPY_AND_ASSIGN(TarArchive); }; - static void ContentsFinalizer(void* isolate_callback_data, Dart_WeakPersistentHandle handle, void* peer) { @@ -381,16 +370,13 @@ static void ContentsFinalizer(void* isolate_callback_data, delete[] data; } - static void FilenameFinalizer(void* peer) { char* filename = reinterpret_cast(peer); delete[] filename; } - #endif - DEFINE_NATIVE_ENTRY(VMService_DecodeAssets, 1) { #ifndef PRODUCT if (!FLAG_support_service) { @@ -447,7 +433,6 @@ DEFINE_NATIVE_ENTRY(VMService_DecodeAssets, 1) { #endif } - DEFINE_NATIVE_ENTRY(VMService_spawnUriNotify, 2) { #ifndef PRODUCT if (!FLAG_support_service) { diff --git a/runtime/lib/weak_property.cc b/runtime/lib/weak_property.cc index 88b9bf870d5..069f77d363f 100644 --- a/runtime/lib/weak_property.cc +++ b/runtime/lib/weak_property.cc @@ -19,21 +19,18 @@ DEFINE_NATIVE_ENTRY(WeakProperty_new, 2) { return weak_property.raw(); } - DEFINE_NATIVE_ENTRY(WeakProperty_getKey, 1) { GET_NON_NULL_NATIVE_ARGUMENT(WeakProperty, weak_property, arguments->NativeArgAt(0)); return weak_property.key(); } - DEFINE_NATIVE_ENTRY(WeakProperty_getValue, 1) { GET_NON_NULL_NATIVE_ARGUMENT(WeakProperty, weak_property, arguments->NativeArgAt(0)); return weak_property.value(); } - DEFINE_NATIVE_ENTRY(WeakProperty_setValue, 2) { GET_NON_NULL_NATIVE_ARGUMENT(WeakProperty, weak_property, arguments->NativeArgAt(0)); diff --git a/runtime/platform/address_sanitizer.h b/runtime/platform/address_sanitizer.h index bc7359dab31..e6a45e80548 100644 --- a/runtime/platform/address_sanitizer.h +++ b/runtime/platform/address_sanitizer.h @@ -32,7 +32,7 @@ extern "C" void __lsan_unregister_root_region(const void* p, size_t size); } while (false && (ptr) == 0 && (len) == 0) #endif // __has_feature(address_sanitizer) -#else // defined(__has_feature) +#else // defined(__has_feature) #define ASAN_UNPOISON(ptr, len) \ do { \ diff --git a/runtime/platform/allocation.h b/runtime/platform/allocation.h index 40f2fd13156..2e3b76b172e 100644 --- a/runtime/platform/allocation.h +++ b/runtime/platform/allocation.h @@ -23,7 +23,6 @@ class ValueObject { DISALLOW_COPY_AND_ASSIGN(ValueObject); }; - // Static allocated classes only contain static members and can never // be instantiated in the heap or on the stack. class AllStatic { diff --git a/runtime/platform/assert.h b/runtime/platform/assert.h index 02e0e8f3bc3..1b01b736b10 100644 --- a/runtime/platform/assert.h +++ b/runtime/platform/assert.h @@ -80,21 +80,18 @@ class DynamicAssertionHelper { DISALLOW_IMPLICIT_CONSTRUCTORS(DynamicAssertionHelper); }; - class Assert : public DynamicAssertionHelper { public: Assert(const char* file, int line) : DynamicAssertionHelper(file, line, ASSERT) {} }; - class Expect : public DynamicAssertionHelper { public: Expect(const char* file, int line) : DynamicAssertionHelper(file, line, EXPECT) {} }; - #if defined(TESTING) // Only allow the expensive (with respect to code size) assertions // in testing code. @@ -108,7 +105,6 @@ void DynamicAssertionHelper::Equals(const E& expected, const A& actual) { Fail("expected: <%s> but was: <%s>", es.c_str(), as.c_str()); } - template void DynamicAssertionHelper::NotEquals(const E& not_expected, const A& actual) { if (actual != not_expected) return; @@ -118,7 +114,6 @@ void DynamicAssertionHelper::NotEquals(const E& not_expected, const A& actual) { Fail("did not expect: <%s>", nes.c_str()); } - template void DynamicAssertionHelper::FloatEquals(const E& expected, const A& actual, @@ -135,7 +130,6 @@ void DynamicAssertionHelper::FloatEquals(const E& expected, tols.c_str()); } - template NO_SANITIZE_MEMORY void DynamicAssertionHelper::StringEquals(const E& expected, const A& actual) { @@ -147,7 +141,6 @@ NO_SANITIZE_MEMORY void DynamicAssertionHelper::StringEquals(const E& expected, Fail("expected:\n<\"%s\">\nbut was:\n<\"%s\">", es.c_str(), as.c_str()); } - template NO_SANITIZE_MEMORY void DynamicAssertionHelper::IsSubstring(const E& needle, const A& haystack) { @@ -160,7 +153,6 @@ NO_SANITIZE_MEMORY void DynamicAssertionHelper::IsSubstring(const E& needle, as.c_str()); } - template NO_SANITIZE_MEMORY void DynamicAssertionHelper::IsNotSubstring( const E& needle, @@ -174,7 +166,6 @@ NO_SANITIZE_MEMORY void DynamicAssertionHelper::IsNotSubstring( as.c_str()); } - template void DynamicAssertionHelper::LessThan(const E& left, const A& right) { if (left < right) return; @@ -185,7 +176,6 @@ void DynamicAssertionHelper::LessThan(const E& left, const A& right) { Fail("expected: %s < %s", es.c_str(), as.c_str()); } - template void DynamicAssertionHelper::LessEqual(const E& left, const A& right) { if (left <= right) return; @@ -196,7 +186,6 @@ void DynamicAssertionHelper::LessEqual(const E& left, const A& right) { Fail("expected: %s <= %s", es.c_str(), as.c_str()); } - template void DynamicAssertionHelper::GreaterThan(const E& left, const A& right) { if (left > right) return; @@ -207,7 +196,6 @@ void DynamicAssertionHelper::GreaterThan(const E& left, const A& right) { Fail("expected: %s > %s", es.c_str(), as.c_str()); } - template void DynamicAssertionHelper::GreaterEqual(const E& left, const A& right) { if (left >= right) return; @@ -219,7 +207,6 @@ void DynamicAssertionHelper::GreaterEqual(const E& left, const A& right) { } #endif - template T DynamicAssertionHelper::NotNull(const T p) { if (p != NULL) return p; @@ -229,7 +216,6 @@ T DynamicAssertionHelper::NotNull(const T p) { } // namespace dart - #define FATAL(error) dart::Assert(__FILE__, __LINE__).Fail("%s", error) #define FATAL1(format, p1) dart::Assert(__FILE__, __LINE__).Fail(format, (p1)) @@ -246,7 +232,6 @@ T DynamicAssertionHelper::NotNull(const T p) { #define OUT_OF_MEMORY() FATAL("Out of memory.") - #if defined(DEBUG) // DEBUG binaries use assertions in the code. // Note: We wrap the if statement in a do-while so that we get a compile @@ -281,13 +266,11 @@ T DynamicAssertionHelper::NotNull(const T p) { #endif // if defined(DEBUG) - #define RELEASE_ASSERT(cond) \ do { \ if (!(cond)) dart::Assert(__FILE__, __LINE__).Fail("expected: %s", #cond); \ } while (false) - // The COMPILE_ASSERT macro can be used to verify that a compile time // expression is true. For example, you could use it to verify the // size of a static array: diff --git a/runtime/platform/c99_support_win.h b/runtime/platform/c99_support_win.h index b7b625b0e87..5fd60167628 100644 --- a/runtime/platform/c99_support_win.h +++ b/runtime/platform/c99_support_win.h @@ -18,12 +18,10 @@ static const unsigned __int64 kQuietNaNMask = static_cast(0xfff) << 51; - #ifndef va_copy #define va_copy(dst, src) (memmove(&(dst), &(src), sizeof(dst))) #endif /* va_copy */ - #define NAN *reinterpret_cast(&kQuietNaNMask) namespace std { diff --git a/runtime/platform/globals.h b/runtime/platform/globals.h index 0b8899484a0..58cb7eda5d5 100644 --- a/runtime/platform/globals.h +++ b/runtime/platform/globals.h @@ -46,11 +46,11 @@ #define UNICODE #endif +#include +#include +#include #include #include -#include -#include -#include #endif // defined(_WIN32) #if !defined(_WIN32) @@ -71,8 +71,8 @@ #if defined(_WIN32) #include "platform/c99_support_win.h" -#include "platform/inttypes_support_win.h" #include "platform/floating_point_win.h" +#include "platform/inttypes_support_win.h" #endif // defined(_WIN32) #include "platform/math.h" @@ -118,7 +118,6 @@ #error Automatic target os detection failed. #endif - // Setup product, release or debug build related macros. #if defined(PRODUCT) && defined(DEBUG) #error Both PRODUCT and DEBUG defined. @@ -360,7 +359,6 @@ typedef simd128_value_t fpu_register_t; #define ARCH_IS_MULTI_CORE 1 #endif - #if !defined(TARGET_OS_ANDROID) && !defined(TARGET_OS_FUCHSIA) && \ !defined(TARGET_OS_MACOS_IOS) && !defined(TARGET_OS_LINUX) && \ !defined(TARGET_OS_MACOS) && !defined(TARGET_OS_WINDOWS) @@ -383,7 +381,6 @@ typedef simd128_value_t fpu_register_t; #endif #endif - // Short form printf format specifiers #define Pd PRIdPTR #define Pu PRIuPTR @@ -399,7 +396,6 @@ typedef simd128_value_t fpu_register_t; #define Pp "016" PRIxPTR #endif - // Suffixes for 64-bit integer literals. #ifdef _MSC_VER #define DART_INT64_C(x) x##I64 @@ -553,7 +549,6 @@ inline double MicrosecondsToMilliseconds(int64_t micros) { template static inline void USE(T) {} - // Use implicit_cast as a safe version of static_cast or const_cast // for upcasting in the type hierarchy (i.e. casting a pointer to Foo // to a pointer to SuperclassOfFoo or casting a pointer to Foo to @@ -576,7 +571,6 @@ inline To implicit_cast(From const& f) { return f; } - // Use like this: down_cast(foo); template // use like this: down_cast(foo); inline To down_cast(From* f) { // so we only accept pointers @@ -589,7 +583,6 @@ inline To down_cast(From* f) { // so we only accept pointers return static_cast(f); } - // The type-based aliasing rule allows the compiler to assume that // pointers of different types (for some definition of different) // never alias each other. Thus the following code does not work: @@ -627,7 +620,6 @@ inline D bit_cast(const S& source) { return destination; } - // Similar to bit_cast, but allows copying from types of unrelated // sizes. This method was introduced to enable the strict aliasing // optimizations of GCC 4.4. Basically, GCC mindlessly relies on @@ -642,7 +634,6 @@ inline D bit_copy(const S& source) { return destination; } - #if defined(HOST_ARCH_ARM) || defined(HOST_ARCH_ARM64) // Similar to bit_copy and bit_cast, but does take the type from the argument. template @@ -653,7 +644,6 @@ static inline T ReadUnaligned(const T* ptr) { return value; } - // Similar to bit_copy and bit_cast, but does take the type from the argument. template static inline void StoreUnaligned(T* ptr, T value) { @@ -667,7 +657,6 @@ static inline T ReadUnaligned(const T* ptr) { return *ptr; } - // Similar to bit_copy and bit_cast, but does take the type from the argument. template static inline void StoreUnaligned(T* ptr, T value) { @@ -675,7 +664,6 @@ static inline void StoreUnaligned(T* ptr, T value) { } #endif // !(HOST_ARCH_ARM || HOST_ARCH_ARM64) - // On Windows the reentrent version of strtok is called // strtok_s. Unify on the posix name strtok_r. #if defined(HOST_OS_WINDOWS) diff --git a/runtime/platform/growable_array.h b/runtime/platform/growable_array.h index 4a449e001fa..b399cd9c197 100644 --- a/runtime/platform/growable_array.h +++ b/runtime/platform/growable_array.h @@ -131,7 +131,6 @@ class BaseGrowableArray : public B { DISALLOW_COPY_AND_ASSIGN(BaseGrowableArray); }; - template inline void BaseGrowableArray::Sort(int compare(const T*, const T*)) { @@ -139,7 +138,6 @@ inline void BaseGrowableArray::Sort(int compare(const T*, qsort(data_, length_, sizeof(T), reinterpret_cast(compare)); } - template void BaseGrowableArray::Resize(intptr_t new_length) { if (new_length > capacity_) { @@ -153,7 +151,6 @@ void BaseGrowableArray::Resize(intptr_t new_length) { length_ = new_length; } - template void BaseGrowableArray::SetLength(intptr_t new_length) { if (new_length > capacity_) { @@ -165,7 +162,6 @@ void BaseGrowableArray::SetLength(intptr_t new_length) { length_ = new_length; } - class Malloc : public AllStatic { public: template @@ -184,10 +180,8 @@ class Malloc : public AllStatic { } }; - class EmptyBase {}; - template class MallocGrowableArray : public BaseGrowableArray { public: diff --git a/runtime/platform/hashmap.cc b/runtime/platform/hashmap.cc index 4a18cb211ca..d5dfba94ae7 100644 --- a/runtime/platform/hashmap.cc +++ b/runtime/platform/hashmap.cc @@ -13,12 +13,10 @@ HashMap::HashMap(MatchFun match, uint32_t initial_capacity) { Initialize(initial_capacity); } - HashMap::~HashMap() { delete[] map_; } - HashMap::Entry* HashMap::Lookup(void* key, uint32_t hash, bool insert) { // Find a matching entry. Entry* p = Probe(key, hash); @@ -46,7 +44,6 @@ HashMap::Entry* HashMap::Lookup(void* key, uint32_t hash, bool insert) { return NULL; } - void HashMap::Remove(void* key, uint32_t hash) { // Lookup the entry for the key to remove. Entry* candidate = Probe(key, hash); @@ -109,7 +106,6 @@ void HashMap::Remove(void* key, uint32_t hash) { occupancy_--; } - void HashMap::Clear(ClearFun clear) { // Mark all entries as empty. const Entry* end = map_end(); @@ -122,12 +118,10 @@ void HashMap::Clear(ClearFun clear) { occupancy_ = 0; } - HashMap::Entry* HashMap::Start() const { return Next(map_ - 1); } - HashMap::Entry* HashMap::Next(Entry* p) const { const Entry* end = map_end(); ASSERT(map_ - 1 <= p && p < end); @@ -139,7 +133,6 @@ HashMap::Entry* HashMap::Next(Entry* p) const { return NULL; } - HashMap::Entry* HashMap::Probe(void* key, uint32_t hash) { ASSERT(key != NULL); @@ -159,7 +152,6 @@ HashMap::Entry* HashMap::Probe(void* key, uint32_t hash) { return p; } - void HashMap::Initialize(uint32_t capacity) { ASSERT(dart::Utils::IsPowerOfTwo(capacity)); map_ = new Entry[capacity]; @@ -170,7 +162,6 @@ void HashMap::Initialize(uint32_t capacity) { occupancy_ = 0; } - void HashMap::Resize() { Entry* map = map_; uint32_t n = occupancy_; diff --git a/runtime/platform/signal_blocker.h b/runtime/platform/signal_blocker.h index a7566b8e4ef..c56c1da99c0 100644 --- a/runtime/platform/signal_blocker.h +++ b/runtime/platform/signal_blocker.h @@ -5,8 +5,8 @@ #ifndef RUNTIME_PLATFORM_SIGNAL_BLOCKER_H_ #define RUNTIME_PLATFORM_SIGNAL_BLOCKER_H_ -#include "platform/globals.h" #include "platform/assert.h" +#include "platform/globals.h" #if defined(HOST_OS_WINDOWS) #error Do not include this file on Windows. @@ -52,7 +52,6 @@ class ThreadSignalBlocker { sigset_t old; }; - // The definition below is copied from Linux and adapted to avoid lint // errors (type long int changed to intptr_t and do/while split on // separate lines with body in {}s) and to also block signals. @@ -95,7 +94,6 @@ class ThreadSignalBlocker { sigismember(&signal_mask, signal); \ }) - // Versions of the above, that does not enter a signal blocking scope. Use only // when a signal blocking scope is entered manually. #define TEMP_FAILURE_RETRY_NO_SIGNAL_BLOCKER(expression) \ diff --git a/runtime/platform/text_buffer.cc b/runtime/platform/text_buffer.cc index b44ed6941f0..c3636f1c387 100644 --- a/runtime/platform/text_buffer.cc +++ b/runtime/platform/text_buffer.cc @@ -22,19 +22,16 @@ TextBuffer::TextBuffer(intptr_t buf_size) { Clear(); } - TextBuffer::~TextBuffer() { free(buf_); buf_ = NULL; } - void TextBuffer::Clear() { msg_len_ = 0; buf_[0] = '\0'; } - char* TextBuffer::Steal() { char* r = buf_; buf_ = NULL; @@ -43,7 +40,6 @@ char* TextBuffer::Steal() { return r; } - void TextBuffer::AddChar(char ch) { EnsureCapacity(sizeof(ch)); buf_[msg_len_] = ch; @@ -51,7 +47,6 @@ void TextBuffer::AddChar(char ch) { buf_[msg_len_] = '\0'; } - void TextBuffer::AddRaw(const uint8_t* buffer, intptr_t buffer_length) { EnsureCapacity(buffer_length); memmove(&buf_[msg_len_], buffer, buffer_length); @@ -59,7 +54,6 @@ void TextBuffer::AddRaw(const uint8_t* buffer, intptr_t buffer_length) { buf_[msg_len_] = '\0'; } - intptr_t TextBuffer::Printf(const char* format, ...) { va_list args; va_start(args, format); @@ -82,7 +76,6 @@ intptr_t TextBuffer::Printf(const char* format, ...) { return len; } - // Write a UTF-32 code unit so it can be read by a JSON parser in a string // literal. Use official encoding from JSON specification. http://json.org/ void TextBuffer::EscapeAndAddCodeUnit(uint32_t codeunit) { @@ -123,19 +116,16 @@ void TextBuffer::EscapeAndAddCodeUnit(uint32_t codeunit) { } } - // Write an incomplete UTF-16 code unit so it can be read by a JSON parser in a // string literal. void TextBuffer::EscapeAndAddUTF16CodeUnit(uint16_t codeunit) { Printf("\\u%04X", codeunit); } - void TextBuffer::AddString(const char* s) { Printf("%s", s); } - void TextBuffer::AddEscapedString(const char* s) { intptr_t len = strlen(s); for (int i = 0; i < len; i++) { @@ -143,7 +133,6 @@ void TextBuffer::AddEscapedString(const char* s) { } } - void TextBuffer::EnsureCapacity(intptr_t len) { intptr_t remaining = buf_size_ - msg_len_; if (remaining <= len) { diff --git a/runtime/platform/text_buffer.h b/runtime/platform/text_buffer.h index a9b5326d688..ecff480fc8e 100644 --- a/runtime/platform/text_buffer.h +++ b/runtime/platform/text_buffer.h @@ -10,7 +10,6 @@ namespace dart { - // TextBuffer maintains a dynamic character buffer with a printf-style way to // append text. class TextBuffer : ValueObject { diff --git a/runtime/platform/utils.cc b/runtime/platform/utils.cc index 0dde3c70271..c103385441d 100644 --- a/runtime/platform/utils.cc +++ b/runtime/platform/utils.cc @@ -21,7 +21,6 @@ uintptr_t Utils::RoundUpToPowerOfTwo(uintptr_t x) { return x + 1; } - // Implementation is from "Hacker's Delight" by Henry S. Warren, Jr., // figure 5-2, page 66, where the function is called pop. int Utils::CountOneBits(uint32_t x) { @@ -33,7 +32,6 @@ int Utils::CountOneBits(uint32_t x) { return static_cast(x & 0x0000003F); } - // TODO(koda): Compare to flsll call/intrinsic. int Utils::HighestBit(int64_t v) { uint64_t x = static_cast((v > 0) ? v : -v); @@ -63,7 +61,6 @@ int Utils::HighestBit(int64_t v) { return r; } - uint32_t Utils::StringHash(const char* data, int length) { // This implementation is based on the public domain MurmurHash // version 2.0. It assumes that the underlying CPU can read from @@ -107,7 +104,6 @@ uint32_t Utils::StringHash(const char* data, int length) { return hash; } - uint32_t Utils::WordHash(intptr_t key) { // TODO(iposva): Need to check hash spreading. // This example is from http://www.concentric.net/~Ttwang/tech/inthash.htm @@ -121,5 +117,4 @@ uint32_t Utils::WordHash(intptr_t key) { return static_cast(a); } - } // namespace dart diff --git a/runtime/platform/utils.h b/runtime/platform/utils.h index beed22b5a55..8b81e97337e 100644 --- a/runtime/platform/utils.h +++ b/runtime/platform/utils.h @@ -183,7 +183,6 @@ class Utils { ((b < 0) && (a > (kMaxInt64 + b))); } - // Adds two int64_t values with wrapping around // (two's complement arithmetic). static inline int64_t AddWithWrapAround(int64_t a, int64_t b) { @@ -192,7 +191,6 @@ class Utils { static_cast(b)); } - // Subtracts two int64_t values with wrapping around // (two's complement arithmetic). static inline int64_t SubWithWrapAround(int64_t a, int64_t b) { @@ -201,7 +199,6 @@ class Utils { static_cast(b)); } - // Multiplies two int64_t values with wrapping around // (two's complement arithmetic). static inline int64_t MulWithWrapAround(int64_t a, int64_t b) { @@ -210,7 +207,6 @@ class Utils { static_cast(b)); } - // Shifts int64_t value left. Supports any non-negative number of bits and // silently discards shifted out bits. static inline int64_t ShiftLeftWithTruncation(int64_t a, int64_t b) { @@ -222,7 +218,6 @@ class Utils { return static_cast(static_cast(a) << b); } - // Utility functions for converting values from host endianness to // big or little endian values. static uint16_t HostToBigEndian16(uint16_t host_value); diff --git a/runtime/platform/utils_android.h b/runtime/platform/utils_android.h index 4bd2a386cf1..dc16a7396c0 100644 --- a/runtime/platform/utils_android.h +++ b/runtime/platform/utils_android.h @@ -19,7 +19,6 @@ inline int Utils::CountLeadingZeros(uword x) { #endif } - inline int Utils::CountTrailingZeros(uword x) { #if defined(ARCH_IS_32_BIT) return __builtin_ctzl(x); @@ -30,32 +29,26 @@ inline int Utils::CountTrailingZeros(uword x) { #endif } - inline uint16_t Utils::HostToBigEndian16(uint16_t value) { return htobe16(value); } - inline uint32_t Utils::HostToBigEndian32(uint32_t value) { return htobe32(value); } - inline uint64_t Utils::HostToBigEndian64(uint64_t value) { return htobe64(value); } - inline uint16_t Utils::HostToLittleEndian16(uint16_t value) { return htole16(value); } - inline uint32_t Utils::HostToLittleEndian32(uint32_t value) { return htole32(value); } - inline uint64_t Utils::HostToLittleEndian64(uint64_t value) { return htole64(value); } diff --git a/runtime/platform/utils_fuchsia.h b/runtime/platform/utils_fuchsia.h index 4143daff125..c82c797b0bb 100644 --- a/runtime/platform/utils_fuchsia.h +++ b/runtime/platform/utils_fuchsia.h @@ -19,7 +19,6 @@ inline int Utils::CountLeadingZeros(uword x) { #endif } - inline int Utils::CountTrailingZeros(uword x) { #if defined(ARCH_IS_32_BIT) return __builtin_ctzl(x); @@ -30,37 +29,30 @@ inline int Utils::CountTrailingZeros(uword x) { #endif } - inline uint16_t Utils::HostToBigEndian16(uint16_t value) { return htobe16(value); } - inline uint32_t Utils::HostToBigEndian32(uint32_t value) { return htobe32(value); } - inline uint64_t Utils::HostToBigEndian64(uint64_t value) { return htobe64(value); } - inline uint16_t Utils::HostToLittleEndian16(uint16_t value) { return htole16(value); } - inline uint32_t Utils::HostToLittleEndian32(uint32_t value) { return htole32(value); } - inline uint64_t Utils::HostToLittleEndian64(uint64_t value) { return htole64(value); } - inline char* Utils::StrError(int err, char* buffer, size_t bufsize) { if (strerror_r(err, buffer, bufsize) != 0) { snprintf(buffer, bufsize, "%s", "strerror_r failed"); diff --git a/runtime/platform/utils_linux.h b/runtime/platform/utils_linux.h index b5214fdce3c..a754ef41459 100644 --- a/runtime/platform/utils_linux.h +++ b/runtime/platform/utils_linux.h @@ -19,7 +19,6 @@ inline int Utils::CountLeadingZeros(uword x) { #endif } - inline int Utils::CountTrailingZeros(uword x) { #if defined(ARCH_IS_32_BIT) return __builtin_ctzl(x); @@ -30,37 +29,30 @@ inline int Utils::CountTrailingZeros(uword x) { #endif } - inline uint16_t Utils::HostToBigEndian16(uint16_t value) { return htobe16(value); } - inline uint32_t Utils::HostToBigEndian32(uint32_t value) { return htobe32(value); } - inline uint64_t Utils::HostToBigEndian64(uint64_t value) { return htobe64(value); } - inline uint16_t Utils::HostToLittleEndian16(uint16_t value) { return htole16(value); } - inline uint32_t Utils::HostToLittleEndian32(uint32_t value) { return htole32(value); } - inline uint64_t Utils::HostToLittleEndian64(uint64_t value) { return htole64(value); } - inline char* Utils::StrError(int err, char* buffer, size_t bufsize) { #if !defined(__GLIBC__) || \ ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE) diff --git a/runtime/platform/utils_macos.h b/runtime/platform/utils_macos.h index 2a8e39f6ee2..052352d81a4 100644 --- a/runtime/platform/utils_macos.h +++ b/runtime/platform/utils_macos.h @@ -19,7 +19,6 @@ inline int Utils::CountLeadingZeros(uword x) { #endif } - inline int Utils::CountTrailingZeros(uword x) { #if defined(ARCH_IS_32_BIT) return __builtin_ctzl(x); @@ -30,32 +29,26 @@ inline int Utils::CountTrailingZeros(uword x) { #endif } - inline uint16_t Utils::HostToBigEndian16(uint16_t value) { return OSSwapHostToBigInt16(value); } - inline uint32_t Utils::HostToBigEndian32(uint32_t value) { return OSSwapHostToBigInt32(value); } - inline uint64_t Utils::HostToBigEndian64(uint64_t value) { return OSSwapHostToBigInt64(value); } - inline uint16_t Utils::HostToLittleEndian16(uint16_t value) { return OSSwapHostToLittleInt16(value); } - inline uint32_t Utils::HostToLittleEndian32(uint32_t value) { return OSSwapHostToLittleInt32(value); } - inline uint64_t Utils::HostToLittleEndian64(uint64_t value) { return OSSwapHostToLittleInt64(value); } diff --git a/runtime/platform/utils_win.h b/runtime/platform/utils_win.h index 92b7f98a60e..c3a67e79fae 100644 --- a/runtime/platform/utils_win.h +++ b/runtime/platform/utils_win.h @@ -22,7 +22,6 @@ inline int Utils::CountLeadingZeros(uword x) { return kBitsPerWord - static_cast(position) - 1; } - inline int Utils::CountTrailingZeros(uword x) { unsigned long result; // NOLINT #if defined(ARCH_IS_32_BIT) @@ -35,32 +34,26 @@ inline int Utils::CountTrailingZeros(uword x) { return static_cast(result); } - inline uint16_t Utils::HostToBigEndian16(uint16_t value) { return _byteswap_ushort(value); } - inline uint32_t Utils::HostToBigEndian32(uint32_t value) { return _byteswap_ulong(value); } - inline uint64_t Utils::HostToBigEndian64(uint64_t value) { return _byteswap_uint64(value); } - inline uint16_t Utils::HostToLittleEndian16(uint16_t value) { return value; } - inline uint32_t Utils::HostToLittleEndian32(uint32_t value) { return value; } - inline uint64_t Utils::HostToLittleEndian64(uint64_t value) { return value; } diff --git a/runtime/vm/allocation.cc b/runtime/vm/allocation.cc index 6353cc8f5b8..93ee9d06519 100644 --- a/runtime/vm/allocation.cc +++ b/runtime/vm/allocation.cc @@ -19,18 +19,15 @@ static void* Allocate(uword size, Zone* zone) { return reinterpret_cast(zone->AllocUnsafe(size)); } - void* ZoneAllocated::operator new(uword size) { return Allocate(size, Thread::Current()->zone()); } - void* ZoneAllocated::operator new(uword size, Zone* zone) { ASSERT(Thread::Current()->ZoneIsOwnedByThread(zone)); return Allocate(size, zone); } - StackResource::~StackResource() { if (thread_ != NULL) { StackResource* top = thread_->top_resource(); @@ -45,12 +42,10 @@ StackResource::~StackResource() { #endif } - Isolate* StackResource::isolate() const { return thread_ == NULL ? NULL : thread_->isolate(); } - void StackResource::Init(Thread* thread) { // We can only have longjumps and exceptions when there is a current // thread and isolate. If there is no current thread, we don't need to @@ -65,7 +60,6 @@ void StackResource::Init(Thread* thread) { } } - void StackResource::UnwindAbove(Thread* thread, StackResource* new_top) { StackResource* current_resource = thread->top_resource(); while (current_resource != new_top) { @@ -74,13 +68,11 @@ void StackResource::UnwindAbove(Thread* thread, StackResource* new_top) { } } - #if defined(DEBUG) NoSafepointScope::NoSafepointScope() : StackResource(Thread::Current()) { thread()->IncrementNoSafepointScopeDepth(); } - NoSafepointScope::~NoSafepointScope() { thread()->DecrementNoSafepointScopeDepth(); } diff --git a/runtime/vm/allocation.h b/runtime/vm/allocation.h index baa99f1d524..3442acf9818 100644 --- a/runtime/vm/allocation.h +++ b/runtime/vm/allocation.h @@ -50,7 +50,6 @@ class StackResource { DISALLOW_IMPLICIT_CONSTRUCTORS(StackResource); }; - // Zone allocated objects cannot be individually deallocated, but have // to rely on the destructor of Zone which is called when the Zone // goes out of scope to reclaim memory. @@ -78,7 +77,6 @@ class ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(ZoneAllocated); }; - // Within a NoSafepointScope, the thread must not reach any safepoint. Used // around code that manipulates raw object pointers directly without handles. #if defined(DEBUG) diff --git a/runtime/vm/allocation_test.cc b/runtime/vm/allocation_test.cc index 18c37a3b294..e01a09f79a5 100644 --- a/runtime/vm/allocation_test.cc +++ b/runtime/vm/allocation_test.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "platform/assert.h" #include "vm/allocation.h" +#include "platform/assert.h" #include "vm/longjump.h" #include "vm/unit_test.h" @@ -28,7 +28,6 @@ class TestValueObject : public ValueObject { int* ptr_; }; - class TestStackResource : public StackResource { public: explicit TestStackResource(int* ptr) @@ -49,7 +48,6 @@ class TestStackResource : public StackResource { int* ptr_; }; - class TestStackedStackResource : public StackResource { public: explicit TestStackedStackResource(int* ptr) @@ -69,21 +67,18 @@ class TestStackedStackResource : public StackResource { int* ptr_; }; - static void StackAllocatedDestructionHelper(int* ptr) { TestValueObject stacked(ptr); EXPECT_EQ(2, *ptr); *ptr = 3; } - VM_UNIT_TEST_CASE(StackAllocatedDestruction) { int data = 1; StackAllocatedDestructionHelper(&data); EXPECT_EQ(4, data); } - static void StackAllocatedLongJumpHelper(int* ptr, LongJumpScope* jump) { TestValueObject stacked(ptr); EXPECT_EQ(2, *ptr); @@ -94,7 +89,6 @@ static void StackAllocatedLongJumpHelper(int* ptr, LongJumpScope* jump) { UNREACHABLE(); } - TEST_CASE(StackAllocatedLongJump) { LongJumpScope jump; int data = 1; @@ -105,14 +99,12 @@ TEST_CASE(StackAllocatedLongJump) { EXPECT_EQ(3, data); } - static void StackedStackResourceDestructionHelper(int* ptr) { TestStackedStackResource stacked(ptr); EXPECT_EQ(4, *ptr); *ptr = 5; } - static void StackResourceDestructionHelper(int* ptr) { TestStackResource stacked(ptr); EXPECT_EQ(2, *ptr); @@ -122,14 +114,12 @@ static void StackResourceDestructionHelper(int* ptr) { // Do not set data because the LongJump version does not return control here. } - TEST_CASE(StackResourceDestruction) { int data = 1; StackResourceDestructionHelper(&data); EXPECT_EQ(7, data); } - static void StackedStackResourceLongJumpHelper(int* ptr, LongJumpScope* jump) { TestStackedStackResource stacked(ptr); EXPECT_EQ(4, *ptr); @@ -140,7 +130,6 @@ static void StackedStackResourceLongJumpHelper(int* ptr, LongJumpScope* jump) { UNREACHABLE(); } - static void StackResourceLongJumpHelper(int* ptr, LongJumpScope* jump) { TestStackResource stacked(ptr); EXPECT_EQ(2, *ptr); @@ -149,7 +138,6 @@ static void StackResourceLongJumpHelper(int* ptr, LongJumpScope* jump) { UNREACHABLE(); } - TEST_CASE(StackResourceLongJump) { LongJumpScope* base = Thread::Current()->long_jump_base(); { diff --git a/runtime/vm/aot_optimizer.cc b/runtime/vm/aot_optimizer.cc index 73c94047a72..f12991544d9 100644 --- a/runtime/vm/aot_optimizer.cc +++ b/runtime/vm/aot_optimizer.cc @@ -47,17 +47,14 @@ static bool ShouldInlineSimd() { return FlowGraphCompiler::SupportsUnboxedSimd128(); } - static bool CanUnboxDouble() { return FlowGraphCompiler::SupportsUnboxedDoubles(); } - static bool CanConvertUnboxedMintToDouble() { return FlowGraphCompiler::CanConvertUnboxedMintToDouble(); } - // Returns named function that is a unique dynamic target, i.e., // - the target is identified by its name alone, since it occurs only once. // - target's class has no subclasses, and neither is subclassed, i.e., @@ -75,7 +72,6 @@ static void GetUniqueDynamicTarget(Isolate* isolate, isolate->object_store()->unique_dynamic_targets()); } - AotOptimizer::AotOptimizer(Precompiler* precompiler, FlowGraph* flow_graph, bool use_speculative_inlining, @@ -95,13 +91,11 @@ AotOptimizer::AotOptimizer(Precompiler* precompiler, } } - // Optimize instance calls using ICData. void AotOptimizer::ApplyICData() { VisitBlocks(); } - bool AotOptimizer::RecognizeRuntimeTypeGetter(InstanceCallInstr* call) { if ((precompiler_ == NULL) || !precompiler_->get_runtime_type_is_unique()) { return false; @@ -124,7 +118,6 @@ bool AotOptimizer::RecognizeRuntimeTypeGetter(InstanceCallInstr* call) { return true; } - // Optimize instance calls using cid. This is called after optimizer // converted instance calls to instructions. Any remaining // instance calls are either megamorphic calls, cannot be optimized or @@ -152,13 +145,11 @@ void AotOptimizer::ApplyClassIds() { } } - // TODO(srdjan): Test/support other number types as well. static bool IsNumberCid(intptr_t cid) { return (cid == kSmiCid) || (cid == kDoubleCid); } - bool AotOptimizer::TryCreateICData(InstanceCallInstr* call) { ASSERT(call->HasICData()); if (call->ic_data()->NumberOfUsedChecks() > 0) { @@ -281,7 +272,6 @@ bool AotOptimizer::TryCreateICData(InstanceCallInstr* call) { return false; } - static bool ClassIdIsOneOf(intptr_t class_id, const GrowableArray& class_ids) { for (intptr_t i = 0; i < class_ids.length(); i++) { @@ -293,7 +283,6 @@ static bool ClassIdIsOneOf(intptr_t class_id, return false; } - // Returns true if ICData tests two arguments and all ICData cids are in the // required sets 'receiver_class_ids' or 'argument_class_ids', respectively. static bool ICDataHasOnlyReceiverArgumentClassIds( @@ -318,7 +307,6 @@ static bool ICDataHasOnlyReceiverArgumentClassIds( return true; } - static bool ICDataHasReceiverArgumentClassIds(const ICData& ic_data, intptr_t receiver_class_id, intptr_t argument_class_id) { @@ -340,13 +328,11 @@ static bool ICDataHasReceiverArgumentClassIds(const ICData& ic_data, return false; } - static bool HasOnlyOneSmi(const ICData& ic_data) { return (ic_data.NumberOfUsedChecks() == 1) && ic_data.HasReceiverClassId(kSmiCid); } - static bool HasOnlySmiOrMint(const ICData& ic_data) { if (ic_data.NumberOfUsedChecks() == 1) { return ic_data.HasReceiverClassId(kSmiCid) || @@ -357,7 +343,6 @@ static bool HasOnlySmiOrMint(const ICData& ic_data) { ic_data.HasReceiverClassId(kMintCid); } - static bool HasOnlyTwoOf(const ICData& ic_data, intptr_t cid) { if (ic_data.NumberOfUsedChecks() != 1) { return false; @@ -385,7 +370,6 @@ static bool HasTwoMintOrSmi(const ICData& ic_data) { return true; } - // Returns false if the ICData contains anything other than the 4 combinations // of Double and Smi for the receiver and argument classes. static bool HasTwoDoubleOrSmi(const ICData& ic_data) { @@ -395,13 +379,11 @@ static bool HasTwoDoubleOrSmi(const ICData& ic_data) { return ICDataHasOnlyReceiverArgumentClassIds(ic_data, class_ids, class_ids); } - static bool HasOnlyOneDouble(const ICData& ic_data) { return (ic_data.NumberOfUsedChecks() == 1) && ic_data.HasReceiverClassId(kDoubleCid); } - static bool ShouldSpecializeForDouble(const ICData& ic_data) { // Don't specialize for double if we can't unbox them. if (!CanUnboxDouble()) { @@ -417,7 +399,6 @@ static bool ShouldSpecializeForDouble(const ICData& ic_data) { return HasTwoDoubleOrSmi(ic_data); } - void AotOptimizer::ReplaceCall(Definition* call, Definition* replacement) { // Remove the original push arguments. for (intptr_t i = 0; i < call->ArgumentCount(); ++i) { @@ -428,7 +409,6 @@ void AotOptimizer::ReplaceCall(Definition* call, Definition* replacement) { call->ReplaceWith(replacement, current_iterator()); } - void AotOptimizer::AddCheckSmi(Definition* to_check, intptr_t deopt_id, Environment* deopt_environment, @@ -441,7 +421,6 @@ void AotOptimizer::AddCheckSmi(Definition* to_check, } } - void AotOptimizer::AddCheckClass(Definition* to_check, const Cids& cids, intptr_t deopt_id, @@ -453,7 +432,6 @@ void AotOptimizer::AddCheckClass(Definition* to_check, InsertBefore(insert_before, check, deopt_environment, FlowGraph::kEffect); } - void AotOptimizer::AddChecksForArgNr(InstanceCallInstr* call, Definition* instr, int argument_number) { @@ -461,7 +439,6 @@ void AotOptimizer::AddChecksForArgNr(InstanceCallInstr* call, AddCheckClass(instr, *cids, call->deopt_id(), call->env(), call); } - static bool ArgIsAlways(intptr_t cid, const ICData& ic_data, intptr_t arg_number) { @@ -478,7 +455,6 @@ static bool ArgIsAlways(intptr_t cid, return true; } - bool AotOptimizer::TryReplaceWithIndexedOp(InstanceCallInstr* call, const ICData* unary_checks) { // Check for monomorphic IC data. @@ -490,7 +466,6 @@ bool AotOptimizer::TryReplaceWithIndexedOp(InstanceCallInstr* call, flow_graph_, current_iterator(), call); } - // Return true if d is a string of length one (a constant or result from // from string-from-char-code instruction. static bool IsLengthOneString(Definition* d) { @@ -506,7 +481,6 @@ static bool IsLengthOneString(Definition* d) { } } - // Returns true if the string comparison was converted into char-code // comparison. Conversion is only possible for strings of length one. // E.g., detect str[x] == "x"; and use an integer comparison of char-codes. @@ -587,19 +561,16 @@ bool AotOptimizer::TryStringLengthOneEquality(InstanceCallInstr* call, return false; } - static bool SmiFitsInDouble() { return kSmiBits < 53; } - static bool IsGetRuntimeType(Definition* defn) { StaticCallInstr* call = defn->AsStaticCall(); return (call != NULL) && (call->function().recognized_kind() == MethodRecognizer::kObjectRuntimeType); } - // Recognize a.runtimeType == b.runtimeType and fold it into // Object._haveSameRuntimeType(a, b). // Note: this optimization is not speculative. @@ -643,7 +614,6 @@ bool AotOptimizer::TryReplaceWithHaveSameRuntimeType(InstanceCallInstr* call) { return false; } - bool AotOptimizer::TryReplaceWithEqualityOp(InstanceCallInstr* call, Token::Kind op_kind) { const ICData& ic_data = *call->ic_data(); @@ -680,10 +650,11 @@ bool AotOptimizer::TryReplaceWithEqualityOp(InstanceCallInstr* call, // call. return false; } else { - InsertBefore(call, new (Z) CheckEitherNonSmiInstr(new (Z) Value(left), - new (Z) Value(right), - call->deopt_id()), - call->env(), FlowGraph::kEffect); + InsertBefore( + call, + new (Z) CheckEitherNonSmiInstr( + new (Z) Value(left), new (Z) Value(right), call->deopt_id()), + call->env(), FlowGraph::kEffect); cid = kDoubleCid; } } @@ -726,7 +697,6 @@ bool AotOptimizer::TryReplaceWithEqualityOp(InstanceCallInstr* call, return true; } - bool AotOptimizer::TryReplaceWithRelationalOp(InstanceCallInstr* call, Token::Kind op_kind) { const ICData& ic_data = *call->ic_data(); @@ -761,10 +731,11 @@ bool AotOptimizer::TryReplaceWithRelationalOp(InstanceCallInstr* call, // call. return false; } else { - InsertBefore(call, new (Z) CheckEitherNonSmiInstr(new (Z) Value(left), - new (Z) Value(right), - call->deopt_id()), - call->env(), FlowGraph::kEffect); + InsertBefore( + call, + new (Z) CheckEitherNonSmiInstr( + new (Z) Value(left), new (Z) Value(right), call->deopt_id()), + call->env(), FlowGraph::kEffect); cid = kDoubleCid; } } @@ -779,7 +750,6 @@ bool AotOptimizer::TryReplaceWithRelationalOp(InstanceCallInstr* call, return true; } - bool AotOptimizer::TryReplaceWithBinaryOp(InstanceCallInstr* call, Token::Kind op_kind) { intptr_t operands_type = kIllegalCid; @@ -894,10 +864,11 @@ bool AotOptimizer::TryReplaceWithBinaryOp(InstanceCallInstr* call, // binary operation with two smis is a smi not a double, except '/' which // returns a double for two smis. if (op_kind != Token::kDIV) { - InsertBefore(call, new (Z) CheckEitherNonSmiInstr(new (Z) Value(left), - new (Z) Value(right), - call->deopt_id()), - call->env(), FlowGraph::kEffect); + InsertBefore( + call, + new (Z) CheckEitherNonSmiInstr( + new (Z) Value(left), new (Z) Value(right), call->deopt_id()), + call->env(), FlowGraph::kEffect); } BinaryDoubleOpInstr* double_bin_op = new (Z) @@ -968,7 +939,6 @@ bool AotOptimizer::TryReplaceWithBinaryOp(InstanceCallInstr* call, return true; } - bool AotOptimizer::TryReplaceWithUnaryOp(InstanceCallInstr* call, Token::Kind op_kind) { ASSERT(call->type_args_len() == 0); @@ -1000,7 +970,6 @@ bool AotOptimizer::TryReplaceWithUnaryOp(InstanceCallInstr* call, return true; } - // Using field class RawField* AotOptimizer::GetField(intptr_t class_id, const String& field_name) { Class& cls = Class::Handle(Z, isolate()->class_table()->At(class_id)); @@ -1015,7 +984,6 @@ RawField* AotOptimizer::GetField(intptr_t class_id, const String& field_name) { return Field::null(); } - bool AotOptimizer::InlineImplicitInstanceGetter(InstanceCallInstr* call) { ASSERT(call->HasICData()); const ICData& ic_data = *call->ic_data(); @@ -1052,7 +1020,6 @@ bool AotOptimizer::InlineImplicitInstanceGetter(InstanceCallInstr* call) { return true; } - bool AotOptimizer::InlineFloat32x4BinaryOp(InstanceCallInstr* call, Token::Kind op_kind) { if (!ShouldInlineSimd()) { @@ -1073,7 +1040,6 @@ bool AotOptimizer::InlineFloat32x4BinaryOp(InstanceCallInstr* call, return true; } - bool AotOptimizer::InlineInt32x4BinaryOp(InstanceCallInstr* call, Token::Kind op_kind) { if (!ShouldInlineSimd()) { @@ -1093,7 +1059,6 @@ bool AotOptimizer::InlineInt32x4BinaryOp(InstanceCallInstr* call, return true; } - bool AotOptimizer::InlineFloat64x2BinaryOp(InstanceCallInstr* call, Token::Kind op_kind) { if (!ShouldInlineSimd()) { @@ -1113,7 +1078,6 @@ bool AotOptimizer::InlineFloat64x2BinaryOp(InstanceCallInstr* call, return true; } - // Only unique implicit instance getters can be currently handled. bool AotOptimizer::TryInlineInstanceGetter(InstanceCallInstr* call) { ASSERT(call->HasICData()); @@ -1138,7 +1102,6 @@ bool AotOptimizer::TryInlineInstanceGetter(InstanceCallInstr* call) { return InlineImplicitInstanceGetter(call); } - void AotOptimizer::ReplaceWithMathCFunction( InstanceCallInstr* call, MethodRecognizer::Kind recognized_kind) { @@ -1154,7 +1117,6 @@ void AotOptimizer::ReplaceWithMathCFunction( ReplaceCall(call, invoke); } - // Inline only simple, frequently called core library methods. bool AotOptimizer::TryInlineInstanceMethod(InstanceCallInstr* call) { ASSERT(call->HasICData()); @@ -1235,7 +1197,6 @@ bool AotOptimizer::TryInlineInstanceMethod(InstanceCallInstr* call) { flow_graph_, current_iterator(), call); } - // If type tests specified by 'ic_data' do not depend on type arguments, // return mapping cid->result in 'results' (i : cid; i + 1: result). // If all tests yield the same result, return it otherwise return Bool::null. @@ -1303,7 +1264,6 @@ RawBool* AotOptimizer::InstanceOfAsBool( return results_differ ? Bool::null() : prev.raw(); } - // Returns true if checking against this type is a direct class id comparison. bool AotOptimizer::TypeCheckAsClassEquality(const AbstractType& type) { ASSERT(type.IsFinalized() && !type.IsMalformedOrMalbounded()); @@ -1348,7 +1308,6 @@ bool AotOptimizer::TypeCheckAsClassEquality(const AbstractType& type) { return true; } - // TODO(srdjan): Use ICData to check if always true or false. void AotOptimizer::ReplaceWithInstanceOf(InstanceCallInstr* call) { ASSERT(Token::IsTypeTestOperator(call->token_kind())); @@ -1466,7 +1425,6 @@ void AotOptimizer::ReplaceWithInstanceOf(InstanceCallInstr* call) { ReplaceCall(call, instance_of); } - // TODO(srdjan): Apply optimizations as in ReplaceWithInstanceOf (TestCids). void AotOptimizer::ReplaceWithTypeCast(InstanceCallInstr* call) { ASSERT(Token::IsTypeCastOperator(call->token_kind())); @@ -1629,7 +1587,6 @@ void AotOptimizer::ReplaceWithTypeCast(InstanceCallInstr* call) { ReplaceCall(call, assert_as); } - bool AotOptimizer::IsAllowedForInlining(intptr_t call_deopt_id) { if (!use_speculative_inlining_) return false; for (intptr_t i = 0; i < inlining_black_list_->length(); ++i) { @@ -1638,7 +1595,6 @@ bool AotOptimizer::IsAllowedForInlining(intptr_t call_deopt_id) { return true; } - static bool HasLikelySmiOperand(InstanceCallInstr* instr) { ASSERT(instr->type_args_len() == 0); // Phis with at least one known smi are // guessed to be likely smi as well. @@ -1658,7 +1614,6 @@ static bool HasLikelySmiOperand(InstanceCallInstr* instr) { return true; } - bool AotOptimizer::TryInlineFieldAccess(InstanceCallInstr* call) { const Token::Kind op_kind = call->token_kind(); if ((op_kind == Token::kGET) && TryInlineInstanceGetter(call)) { @@ -1675,7 +1630,6 @@ bool AotOptimizer::TryInlineFieldAccess(InstanceCallInstr* call) { return false; } - // Tries to optimize instance call by replacing it with a faster instruction // (e.g, binary op, field load, ..). void AotOptimizer::VisitInstanceCall(InstanceCallInstr* instr) { @@ -1949,7 +1903,6 @@ void AotOptimizer::VisitInstanceCall(InstanceCallInstr* instr) { } } - void AotOptimizer::VisitPolymorphicInstanceCall( PolymorphicInstanceCallInstr* call) { const intptr_t receiver_cid = @@ -1967,7 +1920,6 @@ void AotOptimizer::VisitPolymorphicInstanceCall( } } - void AotOptimizer::VisitStaticCall(StaticCallInstr* call) { if (!IsAllowedForInlining(call->deopt_id())) { // Inlining disabled after a speculative inlining attempt. @@ -2053,7 +2005,6 @@ void AotOptimizer::VisitStaticCall(StaticCallInstr* call) { } } - void AotOptimizer::VisitLoadCodeUnits(LoadCodeUnitsInstr* instr) { // TODO(zerny): Use kUnboxedUint32 once it is fully supported/optimized. #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_ARM) @@ -2061,7 +2012,6 @@ void AotOptimizer::VisitLoadCodeUnits(LoadCodeUnitsInstr* instr) { #endif } - bool AotOptimizer::TryInlineInstanceSetter(InstanceCallInstr* instr, const ICData& unary_ic_data) { ASSERT((unary_ic_data.NumberOfChecks() > 0) && @@ -2116,7 +2066,6 @@ bool AotOptimizer::TryInlineInstanceSetter(InstanceCallInstr* instr, return true; } - void AotOptimizer::ReplaceArrayBoundChecks() { for (BlockIterator block_it = flow_graph_->reverse_postorder_iterator(); !block_it.Done(); block_it.Advance()) { diff --git a/runtime/vm/aot_optimizer.h b/runtime/vm/aot_optimizer.h index 4c785488145..50bd97ac026 100644 --- a/runtime/vm/aot_optimizer.h +++ b/runtime/vm/aot_optimizer.h @@ -5,8 +5,8 @@ #ifndef RUNTIME_VM_AOT_OPTIMIZER_H_ #define RUNTIME_VM_AOT_OPTIMIZER_H_ -#include "vm/intermediate_language.h" #include "vm/flow_graph.h" +#include "vm/intermediate_language.h" namespace dart { @@ -147,7 +147,6 @@ class AotOptimizer : public FlowGraphVisitor { DISALLOW_COPY_AND_ASSIGN(AotOptimizer); }; - } // namespace dart #endif // RUNTIME_VM_AOT_OPTIMIZER_H_ diff --git a/runtime/vm/assembler.cc b/runtime/vm/assembler.cc index 884326f397d..c4e8c2bd348 100644 --- a/runtime/vm/assembler.cc +++ b/runtime/vm/assembler.cc @@ -37,7 +37,6 @@ static uword NewContents(intptr_t capacity) { return result; } - #if defined(DEBUG) AssemblerBuffer::EnsureCapacity::EnsureCapacity(AssemblerBuffer* buffer) { if (buffer->cursor() >= buffer->limit()) buffer->ExtendCapacity(); @@ -55,7 +54,6 @@ AssemblerBuffer::EnsureCapacity::EnsureCapacity(AssemblerBuffer* buffer) { buffer->has_ensured_capacity_ = true; } - AssemblerBuffer::EnsureCapacity::~EnsureCapacity() { // Unmark the buffer, so we cannot emit after this. buffer_->has_ensured_capacity_ = false; @@ -66,7 +64,6 @@ AssemblerBuffer::EnsureCapacity::~EnsureCapacity() { } #endif - AssemblerBuffer::AssemblerBuffer() : pointer_offsets_(new ZoneGrowableArray(16)) { static const intptr_t kInitialBufferCapacity = 4 * KB; @@ -84,10 +81,8 @@ AssemblerBuffer::AssemblerBuffer() ASSERT(Size() == 0); } - AssemblerBuffer::~AssemblerBuffer() {} - void AssemblerBuffer::ProcessFixups(const MemoryRegion& region) { AssemblerFixup* fixup = fixup_; while (fixup != NULL) { @@ -96,7 +91,6 @@ void AssemblerBuffer::ProcessFixups(const MemoryRegion& region) { } } - void AssemblerBuffer::FinalizeInstructions(const MemoryRegion& instructions) { // Copy the instructions from the buffer. MemoryRegion from(reinterpret_cast(contents()), Size()); @@ -109,7 +103,6 @@ void AssemblerBuffer::FinalizeInstructions(const MemoryRegion& instructions) { #endif } - void AssemblerBuffer::ExtendCapacity() { intptr_t old_size = Size(); intptr_t old_capacity = Capacity(); @@ -137,7 +130,6 @@ void AssemblerBuffer::ExtendCapacity() { ASSERT(Size() == old_size); } - class PatchCodeWithHandle : public AssemblerFixup { public: PatchCodeWithHandle(ZoneGrowableArray* pointer_offsets, @@ -159,7 +151,6 @@ class PatchCodeWithHandle : public AssemblerFixup { const Object& object_; }; - intptr_t AssemblerBuffer::CountPointerOffsets() const { intptr_t count = 0; AssemblerFixup* current = fixup_; @@ -170,7 +161,6 @@ intptr_t AssemblerBuffer::CountPointerOffsets() const { return count; } - void AssemblerBuffer::EmitObject(const Object& object) { // Since we are going to store the handle as part of the fixup information // the handle needs to be a zone handle. @@ -180,7 +170,6 @@ void AssemblerBuffer::EmitObject(const Object& object) { cursor_ += kWordSize; // Reserve space for pointer. } - // Shared macros are implemented here. void Assembler::Unimplemented(const char* message) { const char* format = "Unimplemented: %s"; @@ -190,7 +179,6 @@ void Assembler::Unimplemented(const char* message) { Stop(buffer); } - void Assembler::Untested(const char* message) { const char* format = "Untested: %s"; const intptr_t len = OS::SNPrint(NULL, 0, format, message); @@ -199,7 +187,6 @@ void Assembler::Untested(const char* message) { Stop(buffer); } - void Assembler::Unreachable(const char* message) { const char* format = "Unreachable: %s"; const intptr_t len = OS::SNPrint(NULL, 0, format, message); @@ -208,7 +195,6 @@ void Assembler::Unreachable(const char* message) { Stop(buffer); } - void Assembler::Comment(const char* format, ...) { if (EmittingComments()) { char buffer[1024]; @@ -224,12 +210,10 @@ void Assembler::Comment(const char* format, ...) { } } - bool Assembler::EmittingComments() { return FLAG_code_comments || FLAG_disassemble || FLAG_disassemble_optimized; } - const Code::Comments& Assembler::GetCodeComments() const { Code::Comments& comments = Code::Comments::New(comments_.length()); @@ -241,14 +225,12 @@ const Code::Comments& Assembler::GetCodeComments() const { return comments; } - intptr_t ObjectPoolWrapper::AddObject(const Object& obj, Patchability patchable) { ASSERT(obj.IsNotTemporaryScopedHandle()); return AddObject(ObjectPoolWrapperEntry(&obj), patchable); } - intptr_t ObjectPoolWrapper::AddImmediate(uword imm) { return AddObject(ObjectPoolWrapperEntry(imm, ObjectPool::kImmediate), kNotPatchable); @@ -269,7 +251,6 @@ intptr_t ObjectPoolWrapper::AddObject(ObjectPoolWrapperEntry entry, return object_pool_.length() - 1; } - intptr_t ObjectPoolWrapper::FindObject(ObjectPoolWrapperEntry entry, Patchability patchable) { // If the object is not patchable, check if we've already got it in the @@ -283,25 +264,21 @@ intptr_t ObjectPoolWrapper::FindObject(ObjectPoolWrapperEntry entry, return AddObject(entry, patchable); } - intptr_t ObjectPoolWrapper::FindObject(const Object& obj, Patchability patchable) { return FindObject(ObjectPoolWrapperEntry(&obj), patchable); } - intptr_t ObjectPoolWrapper::FindObject(const Object& obj, const Object& equivalence) { return FindObject(ObjectPoolWrapperEntry(&obj, &equivalence), kNotPatchable); } - intptr_t ObjectPoolWrapper::FindImmediate(uword imm) { return FindObject(ObjectPoolWrapperEntry(imm, ObjectPool::kImmediate), kNotPatchable); } - intptr_t ObjectPoolWrapper::FindNativeEntry(const ExternalLabel* label, Patchability patchable) { return FindObject( @@ -309,7 +286,6 @@ intptr_t ObjectPoolWrapper::FindNativeEntry(const ExternalLabel* label, patchable); } - RawObjectPool* ObjectPoolWrapper::MakeObjectPool() { intptr_t len = object_pool_.length(); if (len == 0) { @@ -329,5 +305,4 @@ RawObjectPool* ObjectPoolWrapper::MakeObjectPool() { return result.raw(); } - } // namespace dart diff --git a/runtime/vm/assembler.h b/runtime/vm/assembler.h index 768297a2818..6beeb1eaa78 100644 --- a/runtime/vm/assembler.h +++ b/runtime/vm/assembler.h @@ -24,7 +24,6 @@ class AssemblerFixup; class AssemblerBuffer; class MemoryRegion; - // External labels keep a function pointer to allow them // to be called from code generated by the assembler. class ExternalLabel : public ValueObject { @@ -41,7 +40,6 @@ class ExternalLabel : public ValueObject { const uword address_; }; - // Assembler fixups are positions in generated code that hold relocation // information that needs to be processed before finalizing the code // into executable memory. @@ -68,7 +66,6 @@ class AssemblerFixup : public ZoneAllocated { friend class AssemblerBuffer; }; - // Assembler buffers are used to emit binary code. They grow on demand. class AssemblerBuffer : public ValueObject { public: @@ -213,7 +210,6 @@ class AssemblerBuffer : public ValueObject { friend class AssemblerFixup; }; - struct ObjectPoolWrapperEntry { ObjectPoolWrapperEntry() : raw_value_(), type_(), equivalence_() {} explicit ObjectPoolWrapperEntry(const Object* obj) @@ -231,7 +227,6 @@ struct ObjectPoolWrapperEntry { const Object* equivalence_; }; - // Pair type parameter for DirectChainedHashMap used for the constant pool. class ObjIndexPair { public: @@ -289,13 +284,11 @@ class ObjIndexPair { Value value_; }; - enum Patchability { kPatchable, kNotPatchable, }; - class ObjectPoolWrapper : public ValueObject { public: intptr_t AddObject(const Object& obj, Patchability patchable = kNotPatchable); @@ -320,12 +313,10 @@ class ObjectPoolWrapper : public ValueObject { DirectChainedHashMap object_pool_index_table_; }; - enum RestorePP { kRestoreCallerPP, kKeepCalleePP }; } // namespace dart - #if defined(TARGET_ARCH_IA32) #include "vm/assembler_ia32.h" #elif defined(TARGET_ARCH_X64) diff --git a/runtime/vm/assembler_arm.cc b/runtime/vm/assembler_arm.cc index c51cd60a14b..bacc77d4f06 100644 --- a/runtime/vm/assembler_arm.cc +++ b/runtime/vm/assembler_arm.cc @@ -35,7 +35,6 @@ uint32_t Address::encoding3() const { return encoding_; } - uint32_t Address::vencoding() const { ASSERT(kind_ == Immediate); uint32_t offset = encoding_ & kOffset12Mask; @@ -50,7 +49,6 @@ uint32_t Address::vencoding() const { return vencoding; } - void Assembler::InitializeMemoryWithBreakpoints(uword data, intptr_t length) { ASSERT(Utils::IsAligned(data, 4)); ASSERT(Utils::IsAligned(length, 4)); @@ -61,13 +59,11 @@ void Assembler::InitializeMemoryWithBreakpoints(uword data, intptr_t length) { } } - void Assembler::Emit(int32_t value) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); buffer_.Emit(value); } - void Assembler::EmitType01(Condition cond, int type, Opcode opcode, @@ -85,7 +81,6 @@ void Assembler::EmitType01(Condition cond, Emit(encoding); } - void Assembler::EmitType5(Condition cond, int32_t offset, bool link) { ASSERT(cond != kNoCondition); int32_t encoding = static_cast(cond) << kConditionShift | @@ -93,7 +88,6 @@ void Assembler::EmitType5(Condition cond, int32_t offset, bool link) { Emit(Assembler::EncodeBranchOffset(offset, encoding)); } - void Assembler::EmitMemOp(Condition cond, bool load, bool byte, @@ -110,7 +104,6 @@ void Assembler::EmitMemOp(Condition cond, Emit(encoding); } - void Assembler::EmitMemOpAddressMode3(Condition cond, int32_t mode, Register rd, @@ -122,7 +115,6 @@ void Assembler::EmitMemOpAddressMode3(Condition cond, Emit(encoding); } - void Assembler::EmitMultiMemOp(Condition cond, BlockAddressMode am, bool load, @@ -136,7 +128,6 @@ void Assembler::EmitMultiMemOp(Condition cond, Emit(encoding); } - void Assembler::EmitShiftImmediate(Condition cond, Shift opcode, Register rd, @@ -152,7 +143,6 @@ void Assembler::EmitShiftImmediate(Condition cond, Emit(encoding); } - void Assembler::EmitShiftRegister(Condition cond, Shift opcode, Register rd, @@ -169,17 +159,14 @@ void Assembler::EmitShiftRegister(Condition cond, Emit(encoding); } - void Assembler::and_(Register rd, Register rn, Operand o, Condition cond) { EmitType01(cond, o.type(), AND, 0, rn, rd, o); } - void Assembler::eor(Register rd, Register rn, Operand o, Condition cond) { EmitType01(cond, o.type(), EOR, 0, rn, rd, o); } - void Assembler::sub(Register rd, Register rn, Operand o, Condition cond) { EmitType01(cond, o.type(), SUB, 0, rn, rd, o); } @@ -192,107 +179,86 @@ void Assembler::rsbs(Register rd, Register rn, Operand o, Condition cond) { EmitType01(cond, o.type(), RSB, 1, rn, rd, o); } - void Assembler::add(Register rd, Register rn, Operand o, Condition cond) { EmitType01(cond, o.type(), ADD, 0, rn, rd, o); } - void Assembler::adds(Register rd, Register rn, Operand o, Condition cond) { EmitType01(cond, o.type(), ADD, 1, rn, rd, o); } - void Assembler::subs(Register rd, Register rn, Operand o, Condition cond) { EmitType01(cond, o.type(), SUB, 1, rn, rd, o); } - void Assembler::adc(Register rd, Register rn, Operand o, Condition cond) { EmitType01(cond, o.type(), ADC, 0, rn, rd, o); } - void Assembler::adcs(Register rd, Register rn, Operand o, Condition cond) { EmitType01(cond, o.type(), ADC, 1, rn, rd, o); } - void Assembler::sbc(Register rd, Register rn, Operand o, Condition cond) { EmitType01(cond, o.type(), SBC, 0, rn, rd, o); } - void Assembler::sbcs(Register rd, Register rn, Operand o, Condition cond) { EmitType01(cond, o.type(), SBC, 1, rn, rd, o); } - void Assembler::rsc(Register rd, Register rn, Operand o, Condition cond) { EmitType01(cond, o.type(), RSC, 0, rn, rd, o); } - void Assembler::tst(Register rn, Operand o, Condition cond) { EmitType01(cond, o.type(), TST, 1, rn, R0, o); } - void Assembler::teq(Register rn, Operand o, Condition cond) { EmitType01(cond, o.type(), TEQ, 1, rn, R0, o); } - void Assembler::cmp(Register rn, Operand o, Condition cond) { EmitType01(cond, o.type(), CMP, 1, rn, R0, o); } - void Assembler::cmn(Register rn, Operand o, Condition cond) { EmitType01(cond, o.type(), CMN, 1, rn, R0, o); } - void Assembler::orr(Register rd, Register rn, Operand o, Condition cond) { EmitType01(cond, o.type(), ORR, 0, rn, rd, o); } - void Assembler::orrs(Register rd, Register rn, Operand o, Condition cond) { EmitType01(cond, o.type(), ORR, 1, rn, rd, o); } - void Assembler::mov(Register rd, Operand o, Condition cond) { EmitType01(cond, o.type(), MOV, 0, R0, rd, o); } - void Assembler::movs(Register rd, Operand o, Condition cond) { EmitType01(cond, o.type(), MOV, 1, R0, rd, o); } - void Assembler::bic(Register rd, Register rn, Operand o, Condition cond) { EmitType01(cond, o.type(), BIC, 0, rn, rd, o); } - void Assembler::bics(Register rd, Register rn, Operand o, Condition cond) { EmitType01(cond, o.type(), BIC, 1, rn, rd, o); } - void Assembler::mvn(Register rd, Operand o, Condition cond) { EmitType01(cond, o.type(), MVN, 0, R0, rd, o); } - void Assembler::mvns(Register rd, Operand o, Condition cond) { EmitType01(cond, o.type(), MVN, 1, R0, rd, o); } - void Assembler::clz(Register rd, Register rm, Condition cond) { ASSERT(rd != kNoRegister); ASSERT(rm != kNoRegister); @@ -306,7 +272,6 @@ void Assembler::clz(Register rd, Register rm, Condition cond) { Emit(encoding); } - void Assembler::movw(Register rd, uint16_t imm16, Condition cond) { ASSERT(cond != kNoCondition); int32_t encoding = static_cast(cond) << kConditionShift | B25 | B24 | @@ -315,7 +280,6 @@ void Assembler::movw(Register rd, uint16_t imm16, Condition cond) { Emit(encoding); } - void Assembler::movt(Register rd, uint16_t imm16, Condition cond) { ASSERT(cond != kNoCondition); int32_t encoding = static_cast(cond) << kConditionShift | B25 | B24 | @@ -324,7 +288,6 @@ void Assembler::movt(Register rd, uint16_t imm16, Condition cond) { Emit(encoding); } - void Assembler::EmitMulOp(Condition cond, int32_t opcode, Register rd, @@ -344,19 +307,16 @@ void Assembler::EmitMulOp(Condition cond, Emit(encoding); } - void Assembler::mul(Register rd, Register rn, Register rm, Condition cond) { // Assembler registers rd, rn, rm are encoded as rn, rm, rs. EmitMulOp(cond, 0, R0, rd, rn, rm); } - // Like mul, but sets condition flags. void Assembler::muls(Register rd, Register rn, Register rm, Condition cond) { EmitMulOp(cond, B20, R0, rd, rn, rm); } - void Assembler::mla(Register rd, Register rn, Register rm, @@ -367,7 +327,6 @@ void Assembler::mla(Register rd, EmitMulOp(cond, B21, ra, rd, rn, rm); } - void Assembler::mls(Register rd, Register rn, Register rm, @@ -383,7 +342,6 @@ void Assembler::mls(Register rd, } } - void Assembler::smull(Register rd_lo, Register rd_hi, Register rn, @@ -393,7 +351,6 @@ void Assembler::smull(Register rd_lo, EmitMulOp(cond, B23 | B22, rd_lo, rd_hi, rn, rm); } - void Assembler::umull(Register rd_lo, Register rd_hi, Register rn, @@ -403,7 +360,6 @@ void Assembler::umull(Register rd_lo, EmitMulOp(cond, B23, rd_lo, rd_hi, rn, rm); } - void Assembler::umlal(Register rd_lo, Register rd_hi, Register rn, @@ -413,7 +369,6 @@ void Assembler::umlal(Register rd_lo, EmitMulOp(cond, B23 | B21, rd_lo, rd_hi, rn, rm); } - void Assembler::umaal(Register rd_lo, Register rd_hi, Register rn, @@ -433,7 +388,6 @@ void Assembler::umaal(Register rd_lo, } } - void Assembler::EmitDivOp(Condition cond, int32_t opcode, Register rd, @@ -451,57 +405,46 @@ void Assembler::EmitDivOp(Condition cond, Emit(encoding); } - void Assembler::sdiv(Register rd, Register rn, Register rm, Condition cond) { EmitDivOp(cond, 0, rd, rn, rm); } - void Assembler::udiv(Register rd, Register rn, Register rm, Condition cond) { EmitDivOp(cond, B21, rd, rn, rm); } - void Assembler::ldr(Register rd, Address ad, Condition cond) { EmitMemOp(cond, true, false, rd, ad); } - void Assembler::str(Register rd, Address ad, Condition cond) { EmitMemOp(cond, false, false, rd, ad); } - void Assembler::ldrb(Register rd, Address ad, Condition cond) { EmitMemOp(cond, true, true, rd, ad); } - void Assembler::strb(Register rd, Address ad, Condition cond) { EmitMemOp(cond, false, true, rd, ad); } - void Assembler::ldrh(Register rd, Address ad, Condition cond) { EmitMemOpAddressMode3(cond, L | B7 | H | B4, rd, ad); } - void Assembler::strh(Register rd, Address ad, Condition cond) { EmitMemOpAddressMode3(cond, B7 | H | B4, rd, ad); } - void Assembler::ldrsb(Register rd, Address ad, Condition cond) { EmitMemOpAddressMode3(cond, L | B7 | B6 | B4, rd, ad); } - void Assembler::ldrsh(Register rd, Address ad, Condition cond) { EmitMemOpAddressMode3(cond, L | B7 | B6 | H | B4, rd, ad); } - void Assembler::ldrd(Register rd, Register rd2, Register rn, @@ -517,7 +460,6 @@ void Assembler::ldrd(Register rd, } } - void Assembler::strd(Register rd, Register rd2, Register rn, @@ -533,7 +475,6 @@ void Assembler::strd(Register rd, } } - void Assembler::ldm(BlockAddressMode am, Register base, RegList regs, @@ -542,7 +483,6 @@ void Assembler::ldm(BlockAddressMode am, EmitMultiMemOp(cond, am, true, base, regs); } - void Assembler::stm(BlockAddressMode am, Register base, RegList regs, @@ -551,7 +491,6 @@ void Assembler::stm(BlockAddressMode am, EmitMultiMemOp(cond, am, false, base, regs); } - void Assembler::ldrex(Register rt, Register rn, Condition cond) { ASSERT(TargetCPUFeatures::arm_version() != ARMv5TE); ASSERT(rn != kNoRegister); @@ -564,7 +503,6 @@ void Assembler::ldrex(Register rt, Register rn, Condition cond) { Emit(encoding); } - void Assembler::strex(Register rd, Register rt, Register rn, Condition cond) { ASSERT(TargetCPUFeatures::arm_version() != ARMv5TE); ASSERT(rn != kNoRegister); @@ -579,7 +517,6 @@ void Assembler::strex(Register rd, Register rt, Register rn, Condition cond) { Emit(encoding); } - void Assembler::clrex() { ASSERT(TargetCPUFeatures::arm_version() != ARMv5TE); int32_t encoding = (kSpecialCondition << kConditionShift) | B26 | B24 | B22 | @@ -587,7 +524,6 @@ void Assembler::clrex() { Emit(encoding); } - void Assembler::nop(Condition cond) { ASSERT(cond != kNoCondition); int32_t encoding = (static_cast(cond) << kConditionShift) | B25 | @@ -595,7 +531,6 @@ void Assembler::nop(Condition cond) { Emit(encoding); } - void Assembler::vmovsr(SRegister sn, Register rt, Condition cond) { ASSERT(TargetCPUFeatures::vfp_supported()); ASSERT(sn != kNoSRegister); @@ -610,7 +545,6 @@ void Assembler::vmovsr(SRegister sn, Register rt, Condition cond) { Emit(encoding); } - void Assembler::vmovrs(Register rt, SRegister sn, Condition cond) { ASSERT(TargetCPUFeatures::vfp_supported()); ASSERT(sn != kNoSRegister); @@ -625,7 +559,6 @@ void Assembler::vmovrs(Register rt, SRegister sn, Condition cond) { Emit(encoding); } - void Assembler::vmovsrr(SRegister sm, Register rt, Register rt2, @@ -648,7 +581,6 @@ void Assembler::vmovsrr(SRegister sm, Emit(encoding); } - void Assembler::vmovrrs(Register rt, Register rt2, SRegister sm, @@ -672,7 +604,6 @@ void Assembler::vmovrrs(Register rt, Emit(encoding); } - void Assembler::vmovdr(DRegister dn, int i, Register rt, Condition cond) { ASSERT(TargetCPUFeatures::vfp_supported()); ASSERT((i == 0) || (i == 1)); @@ -688,7 +619,6 @@ void Assembler::vmovdr(DRegister dn, int i, Register rt, Condition cond) { Emit(encoding); } - void Assembler::vmovdrr(DRegister dm, Register rt, Register rt2, @@ -710,7 +640,6 @@ void Assembler::vmovdrr(DRegister dm, Emit(encoding); } - void Assembler::vmovrrd(Register rt, Register rt2, DRegister dm, @@ -733,7 +662,6 @@ void Assembler::vmovrrd(Register rt, Emit(encoding); } - void Assembler::vldrs(SRegister sd, Address ad, Condition cond) { ASSERT(TargetCPUFeatures::vfp_supported()); ASSERT(sd != kNoSRegister); @@ -745,7 +673,6 @@ void Assembler::vldrs(SRegister sd, Address ad, Condition cond) { Emit(encoding); } - void Assembler::vstrs(SRegister sd, Address ad, Condition cond) { ASSERT(TargetCPUFeatures::vfp_supported()); ASSERT(static_cast(ad.encoding_ & (0xf << kRnShift)) != PC); @@ -758,7 +685,6 @@ void Assembler::vstrs(SRegister sd, Address ad, Condition cond) { Emit(encoding); } - void Assembler::vldrd(DRegister dd, Address ad, Condition cond) { ASSERT(TargetCPUFeatures::vfp_supported()); ASSERT(dd != kNoDRegister); @@ -770,7 +696,6 @@ void Assembler::vldrd(DRegister dd, Address ad, Condition cond) { Emit(encoding); } - void Assembler::vstrd(DRegister dd, Address ad, Condition cond) { ASSERT(TargetCPUFeatures::vfp_supported()); ASSERT(static_cast(ad.encoding_ & (0xf << kRnShift)) != PC); @@ -803,7 +728,6 @@ void Assembler::EmitMultiVSMemOp(Condition cond, Emit(encoding); } - void Assembler::EmitMultiVDMemOp(Condition cond, BlockAddressMode am, bool load, @@ -825,7 +749,6 @@ void Assembler::EmitMultiVDMemOp(Condition cond, Emit(encoding); } - void Assembler::vldms(BlockAddressMode am, Register base, SRegister first, @@ -836,7 +759,6 @@ void Assembler::vldms(BlockAddressMode am, EmitMultiVSMemOp(cond, am, true, base, first, last - first + 1); } - void Assembler::vstms(BlockAddressMode am, Register base, SRegister first, @@ -847,7 +769,6 @@ void Assembler::vstms(BlockAddressMode am, EmitMultiVSMemOp(cond, am, false, base, first, last - first + 1); } - void Assembler::vldmd(BlockAddressMode am, Register base, DRegister first, @@ -859,7 +780,6 @@ void Assembler::vldmd(BlockAddressMode am, EmitMultiVDMemOp(cond, am, true, base, first, count); } - void Assembler::vstmd(BlockAddressMode am, Register base, DRegister first, @@ -871,7 +791,6 @@ void Assembler::vstmd(BlockAddressMode am, EmitMultiVDMemOp(cond, am, false, base, first, count); } - void Assembler::EmitVFPsss(Condition cond, int32_t opcode, SRegister sd, @@ -892,7 +811,6 @@ void Assembler::EmitVFPsss(Condition cond, Emit(encoding); } - void Assembler::EmitVFPddd(Condition cond, int32_t opcode, DRegister dd, @@ -913,17 +831,14 @@ void Assembler::EmitVFPddd(Condition cond, Emit(encoding); } - void Assembler::vmovs(SRegister sd, SRegister sm, Condition cond) { EmitVFPsss(cond, B23 | B21 | B20 | B6, sd, S0, sm); } - void Assembler::vmovd(DRegister dd, DRegister dm, Condition cond) { EmitVFPddd(cond, B23 | B21 | B20 | B6, dd, D0, dm); } - bool Assembler::vmovs(SRegister sd, float s_imm, Condition cond) { if (TargetCPUFeatures::arm_version() != ARMv7) { return false; @@ -941,7 +856,6 @@ bool Assembler::vmovs(SRegister sd, float s_imm, Condition cond) { return false; } - bool Assembler::vmovd(DRegister dd, double d_imm, Condition cond) { if (TargetCPUFeatures::arm_version() != ARMv7) { return false; @@ -959,7 +873,6 @@ bool Assembler::vmovd(DRegister dd, double d_imm, Condition cond) { return false; } - void Assembler::vadds(SRegister sd, SRegister sn, SRegister sm, @@ -967,7 +880,6 @@ void Assembler::vadds(SRegister sd, EmitVFPsss(cond, B21 | B20, sd, sn, sm); } - void Assembler::vaddd(DRegister dd, DRegister dn, DRegister dm, @@ -975,7 +887,6 @@ void Assembler::vaddd(DRegister dd, EmitVFPddd(cond, B21 | B20, dd, dn, dm); } - void Assembler::vsubs(SRegister sd, SRegister sn, SRegister sm, @@ -983,7 +894,6 @@ void Assembler::vsubs(SRegister sd, EmitVFPsss(cond, B21 | B20 | B6, sd, sn, sm); } - void Assembler::vsubd(DRegister dd, DRegister dn, DRegister dm, @@ -991,7 +901,6 @@ void Assembler::vsubd(DRegister dd, EmitVFPddd(cond, B21 | B20 | B6, dd, dn, dm); } - void Assembler::vmuls(SRegister sd, SRegister sn, SRegister sm, @@ -999,7 +908,6 @@ void Assembler::vmuls(SRegister sd, EmitVFPsss(cond, B21, sd, sn, sm); } - void Assembler::vmuld(DRegister dd, DRegister dn, DRegister dm, @@ -1007,7 +915,6 @@ void Assembler::vmuld(DRegister dd, EmitVFPddd(cond, B21, dd, dn, dm); } - void Assembler::vmlas(SRegister sd, SRegister sn, SRegister sm, @@ -1015,7 +922,6 @@ void Assembler::vmlas(SRegister sd, EmitVFPsss(cond, 0, sd, sn, sm); } - void Assembler::vmlad(DRegister dd, DRegister dn, DRegister dm, @@ -1023,7 +929,6 @@ void Assembler::vmlad(DRegister dd, EmitVFPddd(cond, 0, dd, dn, dm); } - void Assembler::vmlss(SRegister sd, SRegister sn, SRegister sm, @@ -1031,7 +936,6 @@ void Assembler::vmlss(SRegister sd, EmitVFPsss(cond, B6, sd, sn, sm); } - void Assembler::vmlsd(DRegister dd, DRegister dn, DRegister dm, @@ -1039,7 +943,6 @@ void Assembler::vmlsd(DRegister dd, EmitVFPddd(cond, B6, dd, dn, dm); } - void Assembler::vdivs(SRegister sd, SRegister sn, SRegister sm, @@ -1047,7 +950,6 @@ void Assembler::vdivs(SRegister sd, EmitVFPsss(cond, B23, sd, sn, sm); } - void Assembler::vdivd(DRegister dd, DRegister dn, DRegister dm, @@ -1055,27 +957,22 @@ void Assembler::vdivd(DRegister dd, EmitVFPddd(cond, B23, dd, dn, dm); } - void Assembler::vabss(SRegister sd, SRegister sm, Condition cond) { EmitVFPsss(cond, B23 | B21 | B20 | B7 | B6, sd, S0, sm); } - void Assembler::vabsd(DRegister dd, DRegister dm, Condition cond) { EmitVFPddd(cond, B23 | B21 | B20 | B7 | B6, dd, D0, dm); } - void Assembler::vnegs(SRegister sd, SRegister sm, Condition cond) { EmitVFPsss(cond, B23 | B21 | B20 | B16 | B6, sd, S0, sm); } - void Assembler::vnegd(DRegister dd, DRegister dm, Condition cond) { EmitVFPddd(cond, B23 | B21 | B20 | B16 | B6, dd, D0, dm); } - void Assembler::vsqrts(SRegister sd, SRegister sm, Condition cond) { EmitVFPsss(cond, B23 | B21 | B20 | B16 | B7 | B6, sd, S0, sm); } @@ -1084,7 +981,6 @@ void Assembler::vsqrtd(DRegister dd, DRegister dm, Condition cond) { EmitVFPddd(cond, B23 | B21 | B20 | B16 | B7 | B6, dd, D0, dm); } - void Assembler::EmitVFPsd(Condition cond, int32_t opcode, SRegister sd, @@ -1101,7 +997,6 @@ void Assembler::EmitVFPsd(Condition cond, Emit(encoding); } - void Assembler::EmitVFPds(Condition cond, int32_t opcode, DRegister dd, @@ -1118,77 +1013,62 @@ void Assembler::EmitVFPds(Condition cond, Emit(encoding); } - void Assembler::vcvtsd(SRegister sd, DRegister dm, Condition cond) { EmitVFPsd(cond, B23 | B21 | B20 | B18 | B17 | B16 | B8 | B7 | B6, sd, dm); } - void Assembler::vcvtds(DRegister dd, SRegister sm, Condition cond) { EmitVFPds(cond, B23 | B21 | B20 | B18 | B17 | B16 | B7 | B6, dd, sm); } - void Assembler::vcvtis(SRegister sd, SRegister sm, Condition cond) { EmitVFPsss(cond, B23 | B21 | B20 | B19 | B18 | B16 | B7 | B6, sd, S0, sm); } - void Assembler::vcvtid(SRegister sd, DRegister dm, Condition cond) { EmitVFPsd(cond, B23 | B21 | B20 | B19 | B18 | B16 | B8 | B7 | B6, sd, dm); } - void Assembler::vcvtsi(SRegister sd, SRegister sm, Condition cond) { EmitVFPsss(cond, B23 | B21 | B20 | B19 | B7 | B6, sd, S0, sm); } - void Assembler::vcvtdi(DRegister dd, SRegister sm, Condition cond) { EmitVFPds(cond, B23 | B21 | B20 | B19 | B8 | B7 | B6, dd, sm); } - void Assembler::vcvtus(SRegister sd, SRegister sm, Condition cond) { EmitVFPsss(cond, B23 | B21 | B20 | B19 | B18 | B7 | B6, sd, S0, sm); } - void Assembler::vcvtud(SRegister sd, DRegister dm, Condition cond) { EmitVFPsd(cond, B23 | B21 | B20 | B19 | B18 | B8 | B7 | B6, sd, dm); } - void Assembler::vcvtsu(SRegister sd, SRegister sm, Condition cond) { EmitVFPsss(cond, B23 | B21 | B20 | B19 | B6, sd, S0, sm); } - void Assembler::vcvtdu(DRegister dd, SRegister sm, Condition cond) { EmitVFPds(cond, B23 | B21 | B20 | B19 | B8 | B6, dd, sm); } - void Assembler::vcmps(SRegister sd, SRegister sm, Condition cond) { EmitVFPsss(cond, B23 | B21 | B20 | B18 | B6, sd, S0, sm); } - void Assembler::vcmpd(DRegister dd, DRegister dm, Condition cond) { EmitVFPddd(cond, B23 | B21 | B20 | B18 | B6, dd, D0, dm); } - void Assembler::vcmpsz(SRegister sd, Condition cond) { EmitVFPsss(cond, B23 | B21 | B20 | B18 | B16 | B6, sd, S0, S0); } - void Assembler::vcmpdz(DRegister dd, Condition cond) { EmitVFPddd(cond, B23 | B21 | B20 | B18 | B16 | B6, dd, D0, D0); } - void Assembler::vmrs(Register rd, Condition cond) { ASSERT(TargetCPUFeatures::vfp_supported()); ASSERT(cond != kNoCondition); @@ -1198,12 +1078,10 @@ void Assembler::vmrs(Register rd, Condition cond) { Emit(encoding); } - void Assembler::vmstat(Condition cond) { vmrs(APSR, cond); } - static inline int ShiftOfOperandSize(OperandSize size) { switch (size) { case kByte: @@ -1229,7 +1107,6 @@ static inline int ShiftOfOperandSize(OperandSize size) { return -1; } - void Assembler::EmitSIMDqqq(int32_t opcode, OperandSize size, QRegister qd, @@ -1249,7 +1126,6 @@ void Assembler::EmitSIMDqqq(int32_t opcode, Emit(encoding); } - void Assembler::EmitSIMDddd(int32_t opcode, OperandSize size, DRegister dd, @@ -1267,12 +1143,10 @@ void Assembler::EmitSIMDddd(int32_t opcode, Emit(encoding); } - void Assembler::vmovq(QRegister qd, QRegister qm) { EmitSIMDqqq(B21 | B8 | B4, kByte, qd, qm, qm); } - void Assembler::vaddqi(OperandSize sz, QRegister qd, QRegister qn, @@ -1280,12 +1154,10 @@ void Assembler::vaddqi(OperandSize sz, EmitSIMDqqq(B11, sz, qd, qn, qm); } - void Assembler::vaddqs(QRegister qd, QRegister qn, QRegister qm) { EmitSIMDqqq(B11 | B10 | B8, kSWord, qd, qn, qm); } - void Assembler::vsubqi(OperandSize sz, QRegister qd, QRegister qn, @@ -1293,12 +1165,10 @@ void Assembler::vsubqi(OperandSize sz, EmitSIMDqqq(B24 | B11, sz, qd, qn, qm); } - void Assembler::vsubqs(QRegister qd, QRegister qn, QRegister qm) { EmitSIMDqqq(B21 | B11 | B10 | B8, kSWord, qd, qn, qm); } - void Assembler::vmulqi(OperandSize sz, QRegister qd, QRegister qn, @@ -1306,12 +1176,10 @@ void Assembler::vmulqi(OperandSize sz, EmitSIMDqqq(B11 | B8 | B4, sz, qd, qn, qm); } - void Assembler::vmulqs(QRegister qd, QRegister qn, QRegister qm) { EmitSIMDqqq(B24 | B11 | B10 | B8 | B4, kSWord, qd, qn, qm); } - void Assembler::vshlqi(OperandSize sz, QRegister qd, QRegister qm, @@ -1319,7 +1187,6 @@ void Assembler::vshlqi(OperandSize sz, EmitSIMDqqq(B25 | B10, sz, qd, qn, qm); } - void Assembler::vshlqu(OperandSize sz, QRegister qd, QRegister qm, @@ -1327,76 +1194,62 @@ void Assembler::vshlqu(OperandSize sz, EmitSIMDqqq(B25 | B24 | B10, sz, qd, qn, qm); } - void Assembler::veorq(QRegister qd, QRegister qn, QRegister qm) { EmitSIMDqqq(B24 | B8 | B4, kByte, qd, qn, qm); } - void Assembler::vorrq(QRegister qd, QRegister qn, QRegister qm) { EmitSIMDqqq(B21 | B8 | B4, kByte, qd, qn, qm); } - void Assembler::vornq(QRegister qd, QRegister qn, QRegister qm) { EmitSIMDqqq(B21 | B20 | B8 | B4, kByte, qd, qn, qm); } - void Assembler::vandq(QRegister qd, QRegister qn, QRegister qm) { EmitSIMDqqq(B8 | B4, kByte, qd, qn, qm); } - void Assembler::vmvnq(QRegister qd, QRegister qm) { EmitSIMDqqq(B25 | B24 | B23 | B10 | B8 | B7, kWordPair, qd, Q0, qm); } - void Assembler::vminqs(QRegister qd, QRegister qn, QRegister qm) { EmitSIMDqqq(B21 | B11 | B10 | B9 | B8, kSWord, qd, qn, qm); } - void Assembler::vmaxqs(QRegister qd, QRegister qn, QRegister qm) { EmitSIMDqqq(B11 | B10 | B9 | B8, kSWord, qd, qn, qm); } - void Assembler::vabsqs(QRegister qd, QRegister qm) { EmitSIMDqqq(B24 | B23 | B21 | B20 | B19 | B16 | B10 | B9 | B8, kSWord, qd, Q0, qm); } - void Assembler::vnegqs(QRegister qd, QRegister qm) { EmitSIMDqqq(B24 | B23 | B21 | B20 | B19 | B16 | B10 | B9 | B8 | B7, kSWord, qd, Q0, qm); } - void Assembler::vrecpeqs(QRegister qd, QRegister qm) { EmitSIMDqqq(B24 | B23 | B21 | B20 | B19 | B17 | B16 | B10 | B8, kSWord, qd, Q0, qm); } - void Assembler::vrecpsqs(QRegister qd, QRegister qn, QRegister qm) { EmitSIMDqqq(B11 | B10 | B9 | B8 | B4, kSWord, qd, qn, qm); } - void Assembler::vrsqrteqs(QRegister qd, QRegister qm) { EmitSIMDqqq(B24 | B23 | B21 | B20 | B19 | B17 | B16 | B10 | B8 | B7, kSWord, qd, Q0, qm); } - void Assembler::vrsqrtsqs(QRegister qd, QRegister qn, QRegister qm) { EmitSIMDqqq(B21 | B11 | B10 | B9 | B8 | B4, kSWord, qd, qn, qm); } - void Assembler::vdup(OperandSize sz, QRegister qd, DRegister dm, int idx) { ASSERT((sz != kDWord) && (sz != kSWord) && (sz != kWordPair)); int code = 0; @@ -1428,18 +1281,15 @@ void Assembler::vdup(OperandSize sz, QRegister qd, DRegister dm, int idx) { static_cast(code & 0xf), dm); } - void Assembler::vtbl(DRegister dd, DRegister dn, int len, DRegister dm) { ASSERT((len >= 1) && (len <= 4)); EmitSIMDddd(B24 | B23 | B11 | ((len - 1) * B8), kWordPair, dd, dn, dm); } - void Assembler::vzipqw(QRegister qd, QRegister qm) { EmitSIMDqqq(B24 | B23 | B21 | B20 | B19 | B17 | B8 | B7, kByte, qd, Q0, qm); } - void Assembler::vceqqi(OperandSize sz, QRegister qd, QRegister qn, @@ -1447,12 +1297,10 @@ void Assembler::vceqqi(OperandSize sz, EmitSIMDqqq(B24 | B11 | B4, sz, qd, qn, qm); } - void Assembler::vceqqs(QRegister qd, QRegister qn, QRegister qm) { EmitSIMDqqq(B11 | B10 | B9, kSWord, qd, qn, qm); } - void Assembler::vcgeqi(OperandSize sz, QRegister qd, QRegister qn, @@ -1460,7 +1308,6 @@ void Assembler::vcgeqi(OperandSize sz, EmitSIMDqqq(B9 | B8 | B4, sz, qd, qn, qm); } - void Assembler::vcugeqi(OperandSize sz, QRegister qd, QRegister qn, @@ -1468,12 +1315,10 @@ void Assembler::vcugeqi(OperandSize sz, EmitSIMDqqq(B24 | B9 | B8 | B4, sz, qd, qn, qm); } - void Assembler::vcgeqs(QRegister qd, QRegister qn, QRegister qm) { EmitSIMDqqq(B24 | B11 | B10 | B9, kSWord, qd, qn, qm); } - void Assembler::vcgtqi(OperandSize sz, QRegister qd, QRegister qn, @@ -1481,7 +1326,6 @@ void Assembler::vcgtqi(OperandSize sz, EmitSIMDqqq(B9 | B8, sz, qd, qn, qm); } - void Assembler::vcugtqi(OperandSize sz, QRegister qd, QRegister qn, @@ -1489,27 +1333,22 @@ void Assembler::vcugtqi(OperandSize sz, EmitSIMDqqq(B24 | B9 | B8, sz, qd, qn, qm); } - void Assembler::vcgtqs(QRegister qd, QRegister qn, QRegister qm) { EmitSIMDqqq(B24 | B21 | B11 | B10 | B9, kSWord, qd, qn, qm); } - void Assembler::bkpt(uint16_t imm16) { Emit(BkptEncoding(imm16)); } - void Assembler::b(Label* label, Condition cond) { EmitBranch(cond, label, false); } - void Assembler::bl(Label* label, Condition cond) { EmitBranch(cond, label, true); } - void Assembler::bx(Register rm, Condition cond) { ASSERT(rm != kNoRegister); ASSERT(cond != kNoCondition); @@ -1519,7 +1358,6 @@ void Assembler::bx(Register rm, Condition cond) { Emit(encoding); } - void Assembler::blx(Register rm, Condition cond) { ASSERT(rm != kNoRegister); ASSERT(cond != kNoCondition); @@ -1529,7 +1367,6 @@ void Assembler::blx(Register rm, Condition cond) { Emit(encoding); } - void Assembler::MarkExceptionHandler(Label* label) { EmitType01(AL, 1, TST, 1, PC, R0, Operand(0)); Label l; @@ -1538,7 +1375,6 @@ void Assembler::MarkExceptionHandler(Label* label) { Bind(&l); } - void Assembler::Drop(intptr_t stack_elements) { ASSERT(stack_elements >= 0); if (stack_elements > 0) { @@ -1546,12 +1382,10 @@ void Assembler::Drop(intptr_t stack_elements) { } } - intptr_t Assembler::FindImmediate(int32_t imm) { return object_pool_wrapper_.FindImmediate(imm); } - // Uses a code sequence that can easily be decoded. void Assembler::LoadWordFromPoolOffset(Register rd, int32_t offset, @@ -1605,13 +1439,11 @@ void Assembler::CheckCodePointer() { #endif } - void Assembler::RestoreCodePointer() { ldr(CODE_REG, Address(FP, kPcMarkerSlotFromFp * kWordSize)); CheckCodePointer(); } - void Assembler::LoadPoolPointer(Register reg) { // Load new pool pointer. CheckCodePointer(); @@ -1619,12 +1451,10 @@ void Assembler::LoadPoolPointer(Register reg) { set_constant_pool_allowed(reg == PP); } - void Assembler::LoadIsolate(Register rd) { ldr(rd, Address(THR, Thread::isolate_offset())); } - bool Assembler::CanLoadFromObjectPool(const Object& object) const { ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); ASSERT(!object.IsField() || Field::Cast(object).IsOriginal()); @@ -1638,7 +1468,6 @@ bool Assembler::CanLoadFromObjectPool(const Object& object) const { return true; } - void Assembler::LoadObjectHelper(Register rd, const Object& object, Condition cond, @@ -1665,19 +1494,16 @@ void Assembler::LoadObjectHelper(Register rd, } } - void Assembler::LoadObject(Register rd, const Object& object, Condition cond) { LoadObjectHelper(rd, object, cond, /* is_unique = */ false, PP); } - void Assembler::LoadUniqueObject(Register rd, const Object& object, Condition cond) { LoadObjectHelper(rd, object, cond, /* is_unique = */ true, PP); } - void Assembler::LoadFunctionFromCalleePool(Register dst, const Function& function, Register new_pp) { @@ -1686,7 +1512,6 @@ void Assembler::LoadFunctionFromCalleePool(Register dst, LoadWordFromPoolOffset(dst, offset - kHeapObjectTag, new_pp, AL); } - void Assembler::LoadNativeEntry(Register rd, const ExternalLabel* label, Patchability patchable, @@ -1696,7 +1521,6 @@ void Assembler::LoadNativeEntry(Register rd, LoadWordFromPoolOffset(rd, offset - kHeapObjectTag, PP, cond); } - void Assembler::PushObject(const Object& object) { ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); ASSERT(!object.IsField() || Field::Cast(object).IsOriginal()); @@ -1704,7 +1528,6 @@ void Assembler::PushObject(const Object& object) { Push(IP); } - void Assembler::CompareObject(Register rn, const Object& object) { ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); ASSERT(!object.IsField() || Field::Cast(object).IsOriginal()); @@ -1717,7 +1540,6 @@ void Assembler::CompareObject(Register rn, const Object& object) { } } - // Preserves object and value registers. void Assembler::StoreIntoObjectFilterNoSmi(Register object, Register value, @@ -1734,7 +1556,6 @@ void Assembler::StoreIntoObjectFilterNoSmi(Register object, b(no_update, EQ); } - // Preserves object and value registers. void Assembler::StoreIntoObjectFilter(Register object, Register value, @@ -1748,7 +1569,6 @@ void Assembler::StoreIntoObjectFilter(Register object, b(no_update, EQ); } - Register UseRegister(Register reg, RegList* used) { ASSERT(reg != THR); ASSERT(reg != SP); @@ -1759,7 +1579,6 @@ Register UseRegister(Register reg, RegList* used) { return reg; } - Register AllocateRegister(RegList* used) { const RegList free = ~*used; return (free == 0) @@ -1769,7 +1588,6 @@ Register AllocateRegister(RegList* used) { used); } - void Assembler::StoreIntoObject(Register object, const Address& dest, Register value, @@ -1798,7 +1616,6 @@ void Assembler::StoreIntoObject(Register object, Bind(&done); } - void Assembler::StoreIntoObjectOffset(Register object, int32_t offset, Register value, @@ -1813,7 +1630,6 @@ void Assembler::StoreIntoObjectOffset(Register object, } } - void Assembler::StoreIntoObjectNoBarrier(Register object, const Address& dest, Register value) { @@ -1827,7 +1643,6 @@ void Assembler::StoreIntoObjectNoBarrier(Register object, // No store buffer update. } - void Assembler::StoreIntoObjectNoBarrier(Register object, const Address& dest, const Object& value) { @@ -1840,7 +1655,6 @@ void Assembler::StoreIntoObjectNoBarrier(Register object, str(IP, dest); } - void Assembler::StoreIntoObjectNoBarrierOffset(Register object, int32_t offset, Register value) { @@ -1856,7 +1670,6 @@ void Assembler::StoreIntoObjectNoBarrierOffset(Register object, } } - void Assembler::StoreIntoObjectNoBarrierOffset(Register object, int32_t offset, const Object& value) { @@ -1874,7 +1687,6 @@ void Assembler::StoreIntoObjectNoBarrierOffset(Register object, } } - void Assembler::InitializeFieldsNoBarrier(Register object, Register begin, Register end, @@ -1898,7 +1710,6 @@ void Assembler::InitializeFieldsNoBarrier(Register object, // No store buffer update. } - void Assembler::InitializeFieldsNoBarrierUnrolled(Register object, Register base, intptr_t begin_offset, @@ -1925,7 +1736,6 @@ void Assembler::InitializeFieldsNoBarrierUnrolled(Register object, // No store buffer update. } - void Assembler::StoreIntoSmiField(const Address& dest, Register value) { #if defined(DEBUG) Label done; @@ -1937,7 +1747,6 @@ void Assembler::StoreIntoSmiField(const Address& dest, Register value) { str(value, dest); } - void Assembler::LoadClassId(Register result, Register object, Condition cond) { ASSERT(RawObject::kClassIdTagPos == 16); ASSERT(RawObject::kClassIdTagSize == 16); @@ -1946,7 +1755,6 @@ void Assembler::LoadClassId(Register result, Register object, Condition cond) { ldrh(result, FieldAddress(object, class_id_offset), cond); } - void Assembler::LoadClassById(Register result, Register class_id) { ASSERT(result != class_id); LoadIsolate(result); @@ -1956,14 +1764,12 @@ void Assembler::LoadClassById(Register result, Register class_id) { ldr(result, Address(result, class_id, LSL, 2)); } - void Assembler::LoadClass(Register result, Register object, Register scratch) { ASSERT(scratch != result); LoadClassId(scratch, object); LoadClassById(result, scratch); } - void Assembler::CompareClassId(Register object, intptr_t class_id, Register scratch) { @@ -1971,26 +1777,22 @@ void Assembler::CompareClassId(Register object, CompareImmediate(scratch, class_id); } - void Assembler::LoadClassIdMayBeSmi(Register result, Register object) { tst(object, Operand(kSmiTagMask)); LoadClassId(result, object, NE); LoadImmediate(result, kSmiCid, EQ); } - void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { LoadClassIdMayBeSmi(result, object); SmiTag(result); } - static bool CanEncodeBranchOffset(int32_t offset) { ASSERT(Utils::IsAligned(offset, 4)); return Utils::IsInt(Utils::CountOneBits(kBranchOffsetMask), offset); } - int32_t Assembler::EncodeBranchOffset(int32_t offset, int32_t inst) { // The offset is off by 8 due to the way the ARM CPUs read PC. offset -= Instr::kPCReadOffset; @@ -2006,13 +1808,11 @@ int32_t Assembler::EncodeBranchOffset(int32_t offset, int32_t inst) { return (inst & ~kBranchOffsetMask) | offset; } - int Assembler::DecodeBranchOffset(int32_t inst) { // Sign-extend, left-shift by 2, then add 8. return ((((inst & kBranchOffsetMask) << 8) >> 6) + Instr::kPCReadOffset); } - static int32_t DecodeARMv7LoadImmediate(int32_t movt, int32_t movw) { int32_t offset = 0; offset |= (movt & 0xf0000) << 12; @@ -2022,7 +1822,6 @@ static int32_t DecodeARMv7LoadImmediate(int32_t movt, int32_t movw) { return offset; } - static int32_t DecodeARMv6LoadImmediate(int32_t mov, int32_t or1, int32_t or2, @@ -2035,7 +1834,6 @@ static int32_t DecodeARMv6LoadImmediate(int32_t mov, return offset; } - class PatchFarBranch : public AssemblerFixup { public: PatchFarBranch() {} @@ -2087,7 +1885,6 @@ class PatchFarBranch : public AssemblerFixup { (or3 == Instr::kNopInstruction) && (bx == Instr::kNopInstruction)); } - void ProcessARMv7(const MemoryRegion& region, intptr_t position) { const int32_t movw = region.Load(position); const int32_t movt = region.Load(position + Instr::kInstrSize); @@ -2118,7 +1915,6 @@ class PatchFarBranch : public AssemblerFixup { virtual bool IsPointerOffset() const { return false; } }; - void Assembler::EmitFarBranch(Condition cond, int32_t offset, bool link) { buffer_.EmitFixup(new PatchFarBranch()); LoadPatchableImmediate(IP, offset); @@ -2129,7 +1925,6 @@ void Assembler::EmitFarBranch(Condition cond, int32_t offset, bool link) { } } - void Assembler::EmitBranch(Condition cond, Label* label, bool link) { if (label->IsBound()) { const int32_t dest = label->Position() - buffer_.Size(); @@ -2151,7 +1946,6 @@ void Assembler::EmitBranch(Condition cond, Label* label, bool link) { } } - void Assembler::BindARMv6(Label* label) { ASSERT(!label->IsBound()); intptr_t bound_pc = buffer_.Size(); @@ -2230,7 +2024,6 @@ void Assembler::BindARMv6(Label* label) { label->BindTo(bound_pc); } - void Assembler::BindARMv7(Label* label) { ASSERT(!label->IsBound()); intptr_t bound_pc = buffer_.Size(); @@ -2297,7 +2090,6 @@ void Assembler::BindARMv7(Label* label) { label->BindTo(bound_pc); } - void Assembler::Bind(Label* label) { const ARMVersion version = TargetCPUFeatures::arm_version(); if ((version == ARMv5TE) || (version == ARMv6)) { @@ -2308,7 +2100,6 @@ void Assembler::Bind(Label* label) { } } - OperandSize Address::OperandSizeFor(intptr_t cid) { switch (cid) { case kArrayCid: @@ -2356,7 +2147,6 @@ OperandSize Address::OperandSizeFor(intptr_t cid) { } } - bool Address::CanHoldLoadOffset(OperandSize size, int32_t offset, int32_t* offset_mask) { @@ -2391,7 +2181,6 @@ bool Address::CanHoldLoadOffset(OperandSize size, } } - bool Address::CanHoldStoreOffset(OperandSize size, int32_t offset, int32_t* offset_mask) { @@ -2426,7 +2215,6 @@ bool Address::CanHoldStoreOffset(OperandSize size, } } - bool Address::CanHoldImmediateOffset(bool is_load, intptr_t cid, int64_t offset) { @@ -2438,34 +2226,28 @@ bool Address::CanHoldImmediateOffset(bool is_load, } } - void Assembler::Push(Register rd, Condition cond) { str(rd, Address(SP, -kWordSize, Address::PreIndex), cond); } - void Assembler::Pop(Register rd, Condition cond) { ldr(rd, Address(SP, kWordSize, Address::PostIndex), cond); } - void Assembler::PushList(RegList regs, Condition cond) { stm(DB_W, SP, regs, cond); } - void Assembler::PopList(RegList regs, Condition cond) { ldm(IA_W, SP, regs, cond); } - void Assembler::MoveRegister(Register rd, Register rm, Condition cond) { if (rd != rm) { mov(rd, Operand(rm), cond); } } - void Assembler::Lsl(Register rd, Register rm, const Operand& shift_imm, @@ -2475,12 +2257,10 @@ void Assembler::Lsl(Register rd, mov(rd, Operand(rm, LSL, shift_imm.encoding()), cond); } - void Assembler::Lsl(Register rd, Register rm, Register rs, Condition cond) { mov(rd, Operand(rm, LSL, rs), cond); } - void Assembler::Lsr(Register rd, Register rm, const Operand& shift_imm, @@ -2494,12 +2274,10 @@ void Assembler::Lsr(Register rd, mov(rd, Operand(rm, LSR, shift), cond); } - void Assembler::Lsr(Register rd, Register rm, Register rs, Condition cond) { mov(rd, Operand(rm, LSR, rs), cond); } - void Assembler::Asr(Register rd, Register rm, const Operand& shift_imm, @@ -2513,7 +2291,6 @@ void Assembler::Asr(Register rd, mov(rd, Operand(rm, ASR, shift), cond); } - void Assembler::Asrs(Register rd, Register rm, const Operand& shift_imm, @@ -2527,12 +2304,10 @@ void Assembler::Asrs(Register rd, movs(rd, Operand(rm, ASR, shift), cond); } - void Assembler::Asr(Register rd, Register rm, Register rs, Condition cond) { mov(rd, Operand(rm, ASR, rs), cond); } - void Assembler::Ror(Register rd, Register rm, const Operand& shift_imm, @@ -2542,22 +2317,18 @@ void Assembler::Ror(Register rd, mov(rd, Operand(rm, ROR, shift_imm.encoding()), cond); } - void Assembler::Ror(Register rd, Register rm, Register rs, Condition cond) { mov(rd, Operand(rm, ROR, rs), cond); } - void Assembler::Rrx(Register rd, Register rm, Condition cond) { mov(rd, Operand(rm, ROR, 0), cond); } - void Assembler::SignFill(Register rd, Register rm, Condition cond) { Asr(rd, rm, Operand(31), cond); } - void Assembler::Vreciprocalqs(QRegister qd, QRegister qm) { ASSERT(qm != QTMP); ASSERT(qd != QTMP); @@ -2571,7 +2342,6 @@ void Assembler::Vreciprocalqs(QRegister qd, QRegister qm) { vmulqs(qd, qd, QTMP); } - void Assembler::VreciprocalSqrtqs(QRegister qd, QRegister qm) { ASSERT(qm != QTMP); ASSERT(qd != QTMP); @@ -2589,7 +2359,6 @@ void Assembler::VreciprocalSqrtqs(QRegister qd, QRegister qm) { vmulqs(qd, qd, QTMP); } - void Assembler::Vsqrtqs(QRegister qd, QRegister qm, QRegister temp) { ASSERT(temp != QTMP); ASSERT(qm != QTMP); @@ -2605,7 +2374,6 @@ void Assembler::Vsqrtqs(QRegister qd, QRegister qm, QRegister temp) { Vreciprocalqs(qd, qm); } - void Assembler::Vdivqs(QRegister qd, QRegister qn, QRegister qm) { ASSERT(qd != QTMP); ASSERT(qn != QTMP); @@ -2615,7 +2383,6 @@ void Assembler::Vdivqs(QRegister qd, QRegister qn, QRegister qm) { vmulqs(qd, qn, qd); } - void Assembler::Branch(const StubEntry& stub_entry, Patchability patchable, Register pp, @@ -2628,7 +2395,6 @@ void Assembler::Branch(const StubEntry& stub_entry, bx(IP, cond); } - void Assembler::BranchLink(const Code& target, Patchability patchable) { // Make sure that class CallPattern is able to patch the label referred // to by this code sequence. @@ -2641,26 +2407,22 @@ void Assembler::BranchLink(const Code& target, Patchability patchable) { blx(LR); // Use blx instruction so that the return branch prediction works. } - void Assembler::BranchLink(const StubEntry& stub_entry, Patchability patchable) { const Code& code = Code::ZoneHandle(stub_entry.code()); BranchLink(code, patchable); } - void Assembler::BranchLinkPatchable(const Code& target) { BranchLink(target, kPatchable); } - void Assembler::BranchLinkToRuntime() { ldr(IP, Address(THR, Thread::call_to_runtime_entry_point_offset())); ldr(CODE_REG, Address(THR, Thread::call_to_runtime_stub_offset())); blx(IP); } - void Assembler::BranchLinkWithEquivalence(const StubEntry& stub_entry, const Object& equivalence) { const Code& target = Code::ZoneHandle(stub_entry.code()); @@ -2675,18 +2437,15 @@ void Assembler::BranchLinkWithEquivalence(const StubEntry& stub_entry, blx(LR); // Use blx instruction so that the return branch prediction works. } - void Assembler::BranchLink(const ExternalLabel* label) { LoadImmediate(LR, label->address()); // Target address is never patched. blx(LR); // Use blx instruction so that the return branch prediction works. } - void Assembler::BranchLinkPatchable(const StubEntry& stub_entry) { BranchLinkPatchable(Code::ZoneHandle(stub_entry.code())); } - void Assembler::BranchLinkOffset(Register base, int32_t offset) { ASSERT(base != PC); ASSERT(base != IP); @@ -2694,7 +2453,6 @@ void Assembler::BranchLinkOffset(Register base, int32_t offset) { blx(IP); // Use blx instruction so that the return branch prediction works. } - void Assembler::LoadPatchableImmediate(Register rd, int32_t value, Condition cond) { @@ -2718,7 +2476,6 @@ void Assembler::LoadPatchableImmediate(Register rd, } } - void Assembler::LoadDecodableImmediate(Register rd, int32_t value, Condition cond) { @@ -2740,7 +2497,6 @@ void Assembler::LoadDecodableImmediate(Register rd, } } - void Assembler::LoadImmediate(Register rd, int32_t value, Condition cond) { Operand o; if (Operand::CanHold(value, &o)) { @@ -2752,7 +2508,6 @@ void Assembler::LoadImmediate(Register rd, int32_t value, Condition cond) { } } - void Assembler::LoadSImmediate(SRegister sd, float value, Condition cond) { if (!vmovs(sd, value, cond)) { const DRegister dd = static_cast(sd >> 1); @@ -2762,7 +2517,6 @@ void Assembler::LoadSImmediate(SRegister sd, float value, Condition cond) { } } - void Assembler::LoadDImmediate(DRegister dd, double value, Register scratch, @@ -2779,7 +2533,6 @@ void Assembler::LoadDImmediate(DRegister dd, } } - void Assembler::LoadFromOffset(OperandSize size, Register reg, Register base, @@ -2814,7 +2567,6 @@ void Assembler::LoadFromOffset(OperandSize size, } } - void Assembler::StoreToOffset(OperandSize size, Register reg, Register base, @@ -2844,7 +2596,6 @@ void Assembler::StoreToOffset(OperandSize size, } } - void Assembler::LoadSFromOffset(SRegister reg, Register base, int32_t offset, @@ -2859,7 +2610,6 @@ void Assembler::LoadSFromOffset(SRegister reg, vldrs(reg, Address(base, offset), cond); } - void Assembler::StoreSToOffset(SRegister reg, Register base, int32_t offset, @@ -2874,7 +2624,6 @@ void Assembler::StoreSToOffset(SRegister reg, vstrs(reg, Address(base, offset), cond); } - void Assembler::LoadDFromOffset(DRegister reg, Register base, int32_t offset, @@ -2889,7 +2638,6 @@ void Assembler::LoadDFromOffset(DRegister reg, vldrd(reg, Address(base, offset), cond); } - void Assembler::StoreDToOffset(DRegister reg, Register base, int32_t offset, @@ -2904,7 +2652,6 @@ void Assembler::StoreDToOffset(DRegister reg, vstrd(reg, Address(base, offset), cond); } - void Assembler::LoadMultipleDFromOffset(DRegister first, intptr_t count, Register base, @@ -2914,7 +2661,6 @@ void Assembler::LoadMultipleDFromOffset(DRegister first, vldmd(IA, IP, first, count); } - void Assembler::StoreMultipleDToOffset(DRegister first, intptr_t count, Register base, @@ -2924,7 +2670,6 @@ void Assembler::StoreMultipleDToOffset(DRegister first, vstmd(IA, IP, first, count); } - void Assembler::CopyDoubleField(Register dst, Register src, Register tmp1, @@ -2943,7 +2688,6 @@ void Assembler::CopyDoubleField(Register dst, } } - void Assembler::CopyFloat32x4Field(Register dst, Register src, Register tmp1, @@ -2979,7 +2723,6 @@ void Assembler::CopyFloat32x4Field(Register dst, } } - void Assembler::CopyFloat64x2Field(Register dst, Register src, Register tmp1, @@ -3015,7 +2758,6 @@ void Assembler::CopyFloat64x2Field(Register dst, } } - void Assembler::AddImmediate(Register rd, Register rn, int32_t value, @@ -3052,7 +2794,6 @@ void Assembler::AddImmediate(Register rd, } } - void Assembler::AddImmediateSetFlags(Register rd, Register rn, int32_t value, @@ -3080,7 +2821,6 @@ void Assembler::AddImmediateSetFlags(Register rd, } } - void Assembler::SubImmediateSetFlags(Register rd, Register rn, int32_t value, @@ -3108,7 +2848,6 @@ void Assembler::SubImmediateSetFlags(Register rd, } } - void Assembler::AndImmediate(Register rd, Register rs, int32_t imm, @@ -3122,7 +2861,6 @@ void Assembler::AndImmediate(Register rd, } } - void Assembler::CompareImmediate(Register rn, int32_t value, Condition cond) { Operand o; if (Operand::CanHold(value, &o)) { @@ -3134,7 +2872,6 @@ void Assembler::CompareImmediate(Register rn, int32_t value, Condition cond) { } } - void Assembler::TestImmediate(Register rn, int32_t imm, Condition cond) { Operand o; if (Operand::CanHold(imm, &o)) { @@ -3167,7 +2904,6 @@ void Assembler::IntegerDivide(Register result, } } - static int NumRegsBelowFP(RegList regs) { int count = 0; for (int i = 0; i < FP; i++) { @@ -3178,7 +2914,6 @@ static int NumRegsBelowFP(RegList regs) { return count; } - void Assembler::EnterFrame(RegList regs, intptr_t frame_size) { if (prologue_offset_ == -1) { prologue_offset_ = CodeSize(); @@ -3193,7 +2928,6 @@ void Assembler::EnterFrame(RegList regs, intptr_t frame_size) { } } - void Assembler::LeaveFrame(RegList regs) { ASSERT((regs & (1 << PC)) == 0); // Must not pop PC. if ((regs & (1 << FP)) != 0) { @@ -3203,12 +2937,10 @@ void Assembler::LeaveFrame(RegList regs) { PopList(regs); } - void Assembler::Ret() { bx(LR); } - void Assembler::ReserveAlignedFrameSpace(intptr_t frame_space) { // Reserve space for arguments and align frame before entering // the C++ world. @@ -3218,7 +2950,6 @@ void Assembler::ReserveAlignedFrameSpace(intptr_t frame_space) { } } - void Assembler::EnterCallRuntimeFrame(intptr_t frame_space) { Comment("EnterCallRuntimeFrame"); // Preserve volatile CPU registers and PP. @@ -3243,7 +2974,6 @@ void Assembler::EnterCallRuntimeFrame(intptr_t frame_space) { ReserveAlignedFrameSpace(frame_space); } - void Assembler::LeaveCallRuntimeFrame() { // SP might have been modified to reserve space for arguments // and ensure proper alignment of the stack frame. @@ -3278,13 +3008,11 @@ void Assembler::LeaveCallRuntimeFrame() { LeaveFrame(kDartVolatileCpuRegs | (1 << PP) | (1 << FP)); } - void Assembler::CallRuntime(const RuntimeEntry& entry, intptr_t argument_count) { entry.Call(this, argument_count); } - void Assembler::EnterDartFrame(intptr_t frame_size) { ASSERT(!constant_pool_allowed()); @@ -3301,7 +3029,6 @@ void Assembler::EnterDartFrame(intptr_t frame_size) { AddImmediate(SP, -frame_size); } - // On entry to a function compiled for OSR, the caller's frame pointer, the // stack locals, and any copied parameters are already in place. The frame // pointer is already set up. The PC marker is not correct for the @@ -3316,7 +3043,6 @@ void Assembler::EnterOsrFrame(intptr_t extra_size) { AddImmediate(SP, -extra_size); } - void Assembler::LeaveDartFrame(RestorePP restore_pp) { if (restore_pp == kRestoreCallerPP) { ldr(PP, Address(FP, kSavedCallerPpSlotFromFp * kWordSize)); @@ -3328,17 +3054,14 @@ void Assembler::LeaveDartFrame(RestorePP restore_pp) { LeaveFrame((1 << FP) | (1 << LR)); } - void Assembler::EnterStubFrame() { EnterDartFrame(0); } - void Assembler::LeaveStubFrame() { LeaveDartFrame(); } - // R0 receiver, R9 guarded cid as Smi void Assembler::MonomorphicCheckedEntry() { ASSERT(has_single_entry_point_); @@ -3368,7 +3091,6 @@ void Assembler::MonomorphicCheckedEntry() { #endif } - #ifndef PRODUCT void Assembler::MaybeTraceAllocation(intptr_t cid, Register temp_reg, @@ -3380,7 +3102,6 @@ void Assembler::MaybeTraceAllocation(intptr_t cid, b(trace, NE); } - void Assembler::LoadAllocationStatsAddress(Register dest, intptr_t cid) { ASSERT(dest != kNoRegister); ASSERT(dest != TMP); @@ -3393,7 +3114,6 @@ void Assembler::LoadAllocationStatsAddress(Register dest, intptr_t cid) { AddImmediate(dest, class_offset); } - void Assembler::IncrementAllocationStats(Register stats_addr_reg, intptr_t cid, Heap::Space space) { @@ -3410,7 +3130,6 @@ void Assembler::IncrementAllocationStats(Register stats_addr_reg, str(TMP, count_address); } - void Assembler::IncrementAllocationStatsWithSize(Register stats_addr_reg, Register size_reg, Heap::Space space) { @@ -3435,7 +3154,6 @@ void Assembler::IncrementAllocationStatsWithSize(Register stats_addr_reg, } #endif // !PRODUCT - void Assembler::TryAllocate(const Class& cls, Label* failure, Register instance_reg, @@ -3484,7 +3202,6 @@ void Assembler::TryAllocate(const Class& cls, } } - void Assembler::TryAllocateArray(intptr_t cid, intptr_t instance_size, Label* failure, @@ -3533,7 +3250,6 @@ void Assembler::TryAllocateArray(intptr_t cid, } } - void Assembler::Stop(const char* message) { if (FLAG_print_stop_message) { PushList((1 << R0) | (1 << IP) | (1 << LR)); // Preserve R0, IP, LR. @@ -3552,7 +3268,6 @@ void Assembler::Stop(const char* message) { bkpt(Instr::kStopMessageCode); } - Address Assembler::ElementAddressForIntIndex(bool is_load, bool is_external, intptr_t cid, @@ -3575,7 +3290,6 @@ Address Assembler::ElementAddressForIntIndex(bool is_load, } } - void Assembler::LoadElementAddressForIntIndex(Register address, bool is_load, bool is_external, @@ -3591,7 +3305,6 @@ void Assembler::LoadElementAddressForIntIndex(Register address, AddImmediate(address, array, offset); } - Address Assembler::ElementAddressForRegIndex(bool is_load, bool is_external, intptr_t cid, @@ -3631,7 +3344,6 @@ Address Assembler::ElementAddressForRegIndex(bool is_load, return Address(base, offset); } - void Assembler::LoadElementAddressForRegIndex(Register address, bool is_load, bool is_external, @@ -3654,7 +3366,6 @@ void Assembler::LoadElementAddressForRegIndex(Register address, } } - void Assembler::LoadHalfWordUnaligned(Register dst, Register addr, Register tmp) { @@ -3664,7 +3375,6 @@ void Assembler::LoadHalfWordUnaligned(Register dst, orr(dst, dst, Operand(tmp, LSL, 8)); } - void Assembler::LoadHalfWordUnsignedUnaligned(Register dst, Register addr, Register tmp) { @@ -3674,7 +3384,6 @@ void Assembler::LoadHalfWordUnsignedUnaligned(Register dst, orr(dst, dst, Operand(tmp, LSL, 8)); } - void Assembler::StoreHalfWordUnaligned(Register src, Register addr, Register tmp) { @@ -3683,7 +3392,6 @@ void Assembler::StoreHalfWordUnaligned(Register src, strb(tmp, Address(addr, 1)); } - void Assembler::LoadWordUnaligned(Register dst, Register addr, Register tmp) { ASSERT(dst != addr); ldrb(dst, Address(addr, 0)); @@ -3695,7 +3403,6 @@ void Assembler::LoadWordUnaligned(Register dst, Register addr, Register tmp) { orr(dst, dst, Operand(tmp, LSL, 24)); } - void Assembler::StoreWordUnaligned(Register src, Register addr, Register tmp) { strb(src, Address(addr, 0)); Lsr(tmp, src, Operand(8)); @@ -3706,19 +3413,16 @@ void Assembler::StoreWordUnaligned(Register src, Register addr, Register tmp) { strb(tmp, Address(addr, 3)); } - static const char* cpu_reg_names[kNumberOfCpuRegisters] = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "ctx", "pp", "fp", "ip", "sp", "lr", "pc", }; - const char* Assembler::RegisterName(Register reg) { ASSERT((0 <= reg) && (reg < kNumberOfCpuRegisters)); return cpu_reg_names[reg]; } - static const char* fpu_reg_names[kNumberOfFpuRegisters] = { "q0", "q1", "q2", "q3", "q4", "q5", "q6", "q7", #if defined(VFPv3_D32) @@ -3726,7 +3430,6 @@ static const char* fpu_reg_names[kNumberOfFpuRegisters] = { #endif }; - const char* Assembler::FpuRegisterName(FpuRegister reg) { ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); return fpu_reg_names[reg]; diff --git a/runtime/vm/assembler_arm.h b/runtime/vm/assembler_arm.h index 6fac758c530..b09efd4e0b7 100644 --- a/runtime/vm/assembler_arm.h +++ b/runtime/vm/assembler_arm.h @@ -23,7 +23,6 @@ namespace dart { class RuntimeEntry; class StubEntry; - // Instruction encoding bits. enum { H = 1 << 5, // halfword (or byte) @@ -65,7 +64,6 @@ enum { B27 = 1 << 27, }; - class Label : public ValueObject { public: Label() : position_(0) {} @@ -107,7 +105,6 @@ class Label : public ValueObject { DISALLOW_COPY_AND_ASSIGN(Label); }; - // Encodes Addressing Mode 1 - Data-processing operands. class Operand : public ValueObject { public: @@ -201,7 +198,6 @@ class Operand : public ValueObject { friend class Address; }; - enum OperandSize { kByte, kUnsignedByte, @@ -215,7 +211,6 @@ enum OperandSize { kRegList, }; - // Load/store multiple addressing mode. enum BlockAddressMode { // bit encoding P U W @@ -229,7 +224,6 @@ enum BlockAddressMode { IB_W = (8 | 4 | 1) << 21 // increment before with writeback to base }; - class Address : public ValueObject { public: enum OffsetKind { @@ -343,7 +337,6 @@ class Address : public ValueObject { friend class Assembler; }; - class FieldAddress : public Address { public: FieldAddress(Register base, int32_t disp) @@ -360,7 +353,6 @@ class FieldAddress : public Address { } }; - class Assembler : public ValueObject { public: explicit Assembler(bool use_far_branches = false) @@ -753,7 +745,6 @@ class Assembler : public ValueObject { // Compare rn with signed immediate value. May clobber IP. void CompareImmediate(Register rn, int32_t value, Condition cond = AL); - // Signed integer division of left by right. Checks to see if integer // division is supported. If not, uses the FPU for division with // temporary registers tmpl and tmpr. tmpl and tmpr must be different diff --git a/runtime/vm/assembler_arm64.cc b/runtime/vm/assembler_arm64.cc index 1d12ee89d24..9b9b1b134ff 100644 --- a/runtime/vm/assembler_arm64.cc +++ b/runtime/vm/assembler_arm64.cc @@ -20,7 +20,6 @@ DECLARE_FLAG(bool, inline_alloc); DEFINE_FLAG(bool, use_far_branches, false, "Always use far branches"); - Assembler::Assembler(bool use_far_branches) : buffer_(), prologue_offset_(-1), @@ -29,7 +28,6 @@ Assembler::Assembler(bool use_far_branches) comments_(), constant_pool_allowed_(false) {} - void Assembler::InitializeMemoryWithBreakpoints(uword data, intptr_t length) { ASSERT(Utils::IsAligned(data, 4)); ASSERT(Utils::IsAligned(length, 4)); @@ -40,39 +38,33 @@ void Assembler::InitializeMemoryWithBreakpoints(uword data, intptr_t length) { } } - void Assembler::Emit(int32_t value) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); buffer_.Emit(value); } - static const char* cpu_reg_names[kNumberOfCpuRegisters] = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", "r24", "ip0", "ip1", "pp", "ctx", "fp", "lr", "r31", }; - const char* Assembler::RegisterName(Register reg) { ASSERT((0 <= reg) && (reg < kNumberOfCpuRegisters)); return cpu_reg_names[reg]; } - static const char* fpu_reg_names[kNumberOfFpuRegisters] = { "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", }; - const char* Assembler::FpuRegisterName(FpuRegister reg) { ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); return fpu_reg_names[reg]; } - void Assembler::Bind(Label* label) { ASSERT(!label->IsBound()); const intptr_t bound_pc = buffer_.Size(); @@ -152,7 +144,6 @@ void Assembler::Bind(Label* label) { label->BindTo(bound_pc); } - void Assembler::Stop(const char* message) { if (FLAG_print_stop_message) { UNIMPLEMENTED(); @@ -165,7 +156,6 @@ void Assembler::Stop(const char* message) { brk(Instr::kStopMessageCode); } - static int CountLeadingZeros(uint64_t value, int width) { ASSERT((width == 32) || (width == 64)); if (value == 0) { @@ -178,7 +168,6 @@ static int CountLeadingZeros(uint64_t value, int width) { return width - count; } - static int CountOneBits(uint64_t value, int width) { // Mask out unused bits to ensure that they are not counted. value &= (0xffffffffffffffffULL >> (64 - width)); @@ -193,7 +182,6 @@ static int CountOneBits(uint64_t value, int width) { return value; } - // Test if a given value can be encoded in the immediate field of a logical // instruction. // If it can be encoded, the function returns true, and values pointed to by n, @@ -295,7 +283,6 @@ bool Operand::IsImmLogical(uint64_t value, uint8_t width, Operand* imm_op) { } } - void Assembler::LoadPoolPointer(Register pp) { CheckCodePointer(); ldr(pp, FieldAddress(CODE_REG, Code::object_pool_offset())); @@ -310,7 +297,6 @@ void Assembler::LoadPoolPointer(Register pp) { set_constant_pool_allowed(pp == PP); } - void Assembler::LoadWordFromPoolOffset(Register dst, uint32_t offset, Register pp) { @@ -337,7 +323,6 @@ void Assembler::LoadWordFromPoolOffset(Register dst, } } - void Assembler::LoadWordFromPoolOffsetFixed(Register dst, uint32_t offset) { ASSERT(constant_pool_allowed()); ASSERT(dst != PP); @@ -352,12 +337,10 @@ void Assembler::LoadWordFromPoolOffsetFixed(Register dst, uint32_t offset) { ldr(dst, Address(dst, lower12)); } - intptr_t Assembler::FindImmediate(int64_t imm) { return object_pool_wrapper_.FindImmediate(imm); } - bool Assembler::CanLoadFromObjectPool(const Object& object) const { ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); ASSERT(!object.IsField() || Field::Cast(object).IsOriginal()); @@ -378,19 +361,16 @@ bool Assembler::CanLoadFromObjectPool(const Object& object) const { return true; } - void Assembler::LoadNativeEntry(Register dst, const ExternalLabel* label) { const int32_t offset = ObjectPool::element_offset( object_pool_wrapper_.FindNativeEntry(label, kNotPatchable)); LoadWordFromPoolOffset(dst, offset); } - void Assembler::LoadIsolate(Register dst) { ldr(dst, Address(THR, Thread::isolate_offset())); } - void Assembler::LoadObjectHelper(Register dst, const Object& object, bool is_unique) { @@ -409,7 +389,6 @@ void Assembler::LoadObjectHelper(Register dst, } } - void Assembler::LoadFunctionFromCalleePool(Register dst, const Function& function, Register new_pp) { @@ -421,17 +400,14 @@ void Assembler::LoadFunctionFromCalleePool(Register dst, ldr(dst, Address(new_pp, offset)); } - void Assembler::LoadObject(Register dst, const Object& object) { LoadObjectHelper(dst, object, false); } - void Assembler::LoadUniqueObject(Register dst, const Object& object) { LoadObjectHelper(dst, object, true); } - void Assembler::CompareObject(Register reg, const Object& object) { ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); ASSERT(!object.IsField() || Field::Cast(object).IsOriginal()); @@ -447,7 +423,6 @@ void Assembler::CompareObject(Register reg, const Object& object) { } } - void Assembler::LoadDecodableImmediate(Register reg, int64_t imm) { if (constant_pool_allowed()) { const int32_t offset = ObjectPool::element_offset(FindImmediate(imm)); @@ -459,7 +434,6 @@ void Assembler::LoadDecodableImmediate(Register reg, int64_t imm) { } } - void Assembler::LoadImmediateFixed(Register reg, int64_t imm) { const uint32_t w0 = Utils::Low32Bits(imm); const uint32_t w1 = Utils::High32Bits(imm); @@ -473,7 +447,6 @@ void Assembler::LoadImmediateFixed(Register reg, int64_t imm) { movk(reg, Immediate(h3), 3); } - void Assembler::LoadImmediate(Register reg, int64_t imm) { Comment("LoadImmediate"); // Is it 0? @@ -560,7 +533,6 @@ void Assembler::LoadImmediate(Register reg, int64_t imm) { } } - void Assembler::LoadDImmediate(VRegister vd, double immd) { if (!fmovdi(vd, immd)) { int64_t imm = bit_cast(immd); @@ -569,7 +541,6 @@ void Assembler::LoadDImmediate(VRegister vd, double immd) { } } - void Assembler::Branch(const StubEntry& stub_entry, Register pp, Patchability patchable) { @@ -585,7 +556,6 @@ void Assembler::BranchPatchable(const StubEntry& stub_entry) { Branch(stub_entry, PP, kPatchable); } - void Assembler::BranchLink(const StubEntry& stub_entry, Patchability patchable) { const Code& target = Code::ZoneHandle(stub_entry.code()); @@ -596,19 +566,16 @@ void Assembler::BranchLink(const StubEntry& stub_entry, blr(TMP); } - void Assembler::BranchLinkPatchable(const StubEntry& stub_entry) { BranchLink(stub_entry, kPatchable); } - void Assembler::BranchLinkToRuntime() { ldr(LR, Address(THR, Thread::call_to_runtime_entry_point_offset())); ldr(CODE_REG, Address(THR, Thread::call_to_runtime_stub_offset())); blr(LR); } - void Assembler::BranchLinkWithEquivalence(const StubEntry& stub_entry, const Object& equivalence) { const Code& target = Code::ZoneHandle(stub_entry.code()); @@ -619,7 +586,6 @@ void Assembler::BranchLinkWithEquivalence(const StubEntry& stub_entry, blr(TMP); } - void Assembler::AddImmediate(Register dest, Register rn, int64_t imm) { Operand op; if (imm == 0) { @@ -641,7 +607,6 @@ void Assembler::AddImmediate(Register dest, Register rn, int64_t imm) { } } - void Assembler::AddImmediateSetFlags(Register dest, Register rn, int64_t imm) { Operand op; if (Operand::CanHold(imm, kXRegSizeInBits, &op) == Operand::Immediate) { @@ -659,7 +624,6 @@ void Assembler::AddImmediateSetFlags(Register dest, Register rn, int64_t imm) { } } - void Assembler::SubImmediateSetFlags(Register dest, Register rn, int64_t imm) { Operand op; if (Operand::CanHold(imm, kXRegSizeInBits, &op) == Operand::Immediate) { @@ -677,7 +641,6 @@ void Assembler::SubImmediateSetFlags(Register dest, Register rn, int64_t imm) { } } - void Assembler::AndImmediate(Register rd, Register rn, int64_t imm) { Operand imm_op; if (Operand::IsImmLogical(imm, kXRegSizeInBits, &imm_op)) { @@ -688,7 +651,6 @@ void Assembler::AndImmediate(Register rd, Register rn, int64_t imm) { } } - void Assembler::OrImmediate(Register rd, Register rn, int64_t imm) { Operand imm_op; if (Operand::IsImmLogical(imm, kXRegSizeInBits, &imm_op)) { @@ -699,7 +661,6 @@ void Assembler::OrImmediate(Register rd, Register rn, int64_t imm) { } } - void Assembler::XorImmediate(Register rd, Register rn, int64_t imm) { Operand imm_op; if (Operand::IsImmLogical(imm, kXRegSizeInBits, &imm_op)) { @@ -710,7 +671,6 @@ void Assembler::XorImmediate(Register rd, Register rn, int64_t imm) { } } - void Assembler::TestImmediate(Register rn, int64_t imm) { Operand imm_op; if (Operand::IsImmLogical(imm, kXRegSizeInBits, &imm_op)) { @@ -721,7 +681,6 @@ void Assembler::TestImmediate(Register rn, int64_t imm) { } } - void Assembler::CompareImmediate(Register rn, int64_t imm) { Operand op; if (Operand::CanHold(imm, kXRegSizeInBits, &op) == Operand::Immediate) { @@ -736,7 +695,6 @@ void Assembler::CompareImmediate(Register rn, int64_t imm) { } } - void Assembler::LoadFromOffset(Register dest, Register base, int32_t offset, @@ -750,7 +708,6 @@ void Assembler::LoadFromOffset(Register dest, } } - void Assembler::LoadDFromOffset(VRegister dest, Register base, int32_t offset) { if (Address::CanHoldOffset(offset, Address::Offset, kDWord)) { fldrd(dest, Address(base, offset, Address::Offset, kDWord)); @@ -761,7 +718,6 @@ void Assembler::LoadDFromOffset(VRegister dest, Register base, int32_t offset) { } } - void Assembler::LoadQFromOffset(VRegister dest, Register base, int32_t offset) { if (Address::CanHoldOffset(offset, Address::Offset, kQWord)) { fldrq(dest, Address(base, offset, Address::Offset, kQWord)); @@ -772,7 +728,6 @@ void Assembler::LoadQFromOffset(VRegister dest, Register base, int32_t offset) { } } - void Assembler::StoreToOffset(Register src, Register base, int32_t offset, @@ -787,7 +742,6 @@ void Assembler::StoreToOffset(Register src, } } - void Assembler::StoreDToOffset(VRegister src, Register base, int32_t offset) { if (Address::CanHoldOffset(offset, Address::Offset, kDWord)) { fstrd(src, Address(base, offset, Address::Offset, kDWord)); @@ -798,7 +752,6 @@ void Assembler::StoreDToOffset(VRegister src, Register base, int32_t offset) { } } - void Assembler::StoreQToOffset(VRegister src, Register base, int32_t offset) { if (Address::CanHoldOffset(offset, Address::Offset, kQWord)) { fstrq(src, Address(base, offset, Address::Offset, kQWord)); @@ -809,7 +762,6 @@ void Assembler::StoreQToOffset(VRegister src, Register base, int32_t offset) { } } - void Assembler::VRecps(VRegister vd, VRegister vn) { ASSERT(vn != VTMP); ASSERT(vd != VTMP); @@ -823,7 +775,6 @@ void Assembler::VRecps(VRegister vd, VRegister vn) { vmuls(vd, vd, VTMP); } - void Assembler::VRSqrts(VRegister vd, VRegister vn) { ASSERT(vd != VTMP); ASSERT(vn != VTMP); @@ -841,7 +792,6 @@ void Assembler::VRSqrts(VRegister vd, VRegister vn) { vmuls(vd, vd, VTMP); } - // Store into object. // Preserves object and value registers. void Assembler::StoreIntoObjectFilterNoSmi(Register object, @@ -859,7 +809,6 @@ void Assembler::StoreIntoObjectFilterNoSmi(Register object, b(no_update, EQ); } - // Preserves object and value registers. void Assembler::StoreIntoObjectFilter(Register object, Register value, @@ -873,7 +822,6 @@ void Assembler::StoreIntoObjectFilter(Register object, b(no_update, EQ); } - void Assembler::StoreIntoObjectOffset(Register object, int32_t offset, Register value, @@ -887,7 +835,6 @@ void Assembler::StoreIntoObjectOffset(Register object, } } - void Assembler::StoreIntoObject(Register object, const Address& dest, Register value, @@ -920,7 +867,6 @@ void Assembler::StoreIntoObject(Register object, Bind(&done); } - void Assembler::StoreIntoObjectNoBarrier(Register object, const Address& dest, Register value) { @@ -934,7 +880,6 @@ void Assembler::StoreIntoObjectNoBarrier(Register object, // No store buffer update. } - void Assembler::StoreIntoObjectOffsetNoBarrier(Register object, int32_t offset, Register value) { @@ -946,7 +891,6 @@ void Assembler::StoreIntoObjectOffsetNoBarrier(Register object, } } - void Assembler::StoreIntoObjectNoBarrier(Register object, const Address& dest, const Object& value) { @@ -959,7 +903,6 @@ void Assembler::StoreIntoObjectNoBarrier(Register object, str(TMP2, dest); } - void Assembler::StoreIntoObjectOffsetNoBarrier(Register object, int32_t offset, const Object& value) { @@ -971,7 +914,6 @@ void Assembler::StoreIntoObjectOffsetNoBarrier(Register object, } } - void Assembler::LoadClassId(Register result, Register object) { ASSERT(RawObject::kClassIdTagPos == 16); ASSERT(RawObject::kClassIdTagSize == 16); @@ -981,7 +923,6 @@ void Assembler::LoadClassId(Register result, Register object) { kUnsignedHalfword); } - void Assembler::LoadClassById(Register result, Register class_id) { ASSERT(result != class_id); LoadIsolate(result); @@ -991,20 +932,17 @@ void Assembler::LoadClassById(Register result, Register class_id) { ldr(result, Address(result, class_id, UXTX, Address::Scaled)); } - void Assembler::LoadClass(Register result, Register object) { ASSERT(object != TMP); LoadClassId(TMP, object); LoadClassById(result, TMP); } - void Assembler::CompareClassId(Register object, intptr_t class_id) { LoadClassId(TMP, object); CompareImmediate(TMP, class_id); } - void Assembler::LoadClassIdMayBeSmi(Register result, Register object) { // Load up a null object. We only need it so we can use LoadClassId on it in // the case that object is a Smi.. @@ -1022,14 +960,12 @@ void Assembler::LoadClassIdMayBeSmi(Register result, Register object) { csel(result, TMP, result, EQ); } - void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { LoadClassIdMayBeSmi(result, object); // Finally, tag the result. SmiTag(result); } - // Frame entry and exit. void Assembler::ReserveAlignedFrameSpace(intptr_t frame_space) { // Reserve space for arguments and align frame before entering @@ -1042,13 +978,11 @@ void Assembler::ReserveAlignedFrameSpace(intptr_t frame_space) { } } - void Assembler::RestoreCodePointer() { ldr(CODE_REG, Address(FP, kPcMarkerSlotFromFp * kWordSize)); CheckCodePointer(); } - void Assembler::CheckCodePointer() { #ifdef DEBUG if (!FLAG_check_code_pointer) { @@ -1074,17 +1008,14 @@ void Assembler::CheckCodePointer() { #endif } - void Assembler::SetupDartSP() { mov(SP, CSP); } - void Assembler::RestoreCSP() { mov(CSP, SP); } - void Assembler::EnterFrame(intptr_t frame_size) { // The ARM64 ABI requires at all times // - stack limit < CSP <= stack base @@ -1110,13 +1041,11 @@ void Assembler::EnterFrame(intptr_t frame_size) { } } - void Assembler::LeaveFrame() { mov(SP, FP); PopPair(FP, LR); // low: FP, high: LR. } - void Assembler::EnterDartFrame(intptr_t frame_size, Register new_pp) { ASSERT(!constant_pool_allowed()); // Setup the frame. @@ -1137,7 +1066,6 @@ void Assembler::EnterDartFrame(intptr_t frame_size, Register new_pp) { } } - // On entry to a function compiled for OSR, the caller's frame pointer, the // stack locals, and any copied parameters are already in place. The frame // pointer is already set up. The PC marker is not correct for the @@ -1154,7 +1082,6 @@ void Assembler::EnterOsrFrame(intptr_t extra_size, Register new_pp) { } } - void Assembler::LeaveDartFrame(RestorePP restore_pp) { if (restore_pp == kRestoreCallerPP) { set_constant_pool_allowed(false); @@ -1165,7 +1092,6 @@ void Assembler::LeaveDartFrame(RestorePP restore_pp) { LeaveFrame(); } - void Assembler::EnterCallRuntimeFrame(intptr_t frame_size) { Comment("EnterCallRuntimeFrame"); EnterStubFrame(); @@ -1191,7 +1117,6 @@ void Assembler::EnterCallRuntimeFrame(intptr_t frame_size) { ReserveAlignedFrameSpace(frame_size); } - void Assembler::LeaveCallRuntimeFrame() { // SP might have been modified to reserve space for arguments // and ensure proper alignment of the stack frame. @@ -1220,23 +1145,19 @@ void Assembler::LeaveCallRuntimeFrame() { LeaveStubFrame(); } - void Assembler::CallRuntime(const RuntimeEntry& entry, intptr_t argument_count) { entry.Call(this, argument_count); } - void Assembler::EnterStubFrame() { EnterDartFrame(0); } - void Assembler::LeaveStubFrame() { LeaveDartFrame(); } - // R0 receiver, R5 guarded cid as Smi void Assembler::MonomorphicCheckedEntry() { ASSERT(has_single_entry_point_); @@ -1271,7 +1192,6 @@ void Assembler::MonomorphicCheckedEntry() { set_use_far_branches(saved_use_far_branches); } - #ifndef PRODUCT void Assembler::MaybeTraceAllocation(intptr_t cid, Register temp_reg, @@ -1288,7 +1208,6 @@ void Assembler::MaybeTraceAllocation(intptr_t cid, b(trace, NE); } - void Assembler::UpdateAllocationStats(intptr_t cid, Heap::Space space) { ASSERT(cid > 0); intptr_t counter_offset = @@ -1303,7 +1222,6 @@ void Assembler::UpdateAllocationStats(intptr_t cid, Heap::Space space) { str(TMP, Address(TMP2, 0)); } - void Assembler::UpdateAllocationStatsWithSize(intptr_t cid, Register size_reg, Heap::Space space) { @@ -1331,7 +1249,6 @@ void Assembler::UpdateAllocationStatsWithSize(intptr_t cid, } #endif // !PRODUCT - void Assembler::TryAllocate(const Class& cls, Label* failure, Register instance_reg, @@ -1376,7 +1293,6 @@ void Assembler::TryAllocate(const Class& cls, } } - void Assembler::TryAllocateArray(intptr_t cid, intptr_t instance_size, Label* failure, @@ -1424,7 +1340,6 @@ void Assembler::TryAllocateArray(intptr_t cid, } } - Address Assembler::ElementAddressForIntIndex(bool is_external, intptr_t cid, intptr_t index_scale, @@ -1439,7 +1354,6 @@ Address Assembler::ElementAddressForIntIndex(bool is_external, return Address(array, static_cast(offset), Address::Offset, size); } - void Assembler::LoadElementAddressForIntIndex(Register address, bool is_external, intptr_t cid, @@ -1452,7 +1366,6 @@ void Assembler::LoadElementAddressForIntIndex(Register address, AddImmediate(address, array, offset); } - Address Assembler::ElementAddressForRegIndex(bool is_load, bool is_external, intptr_t cid, @@ -1479,7 +1392,6 @@ Address Assembler::ElementAddressForRegIndex(bool is_load, return Address(base, offset, Address::Offset, size); } - void Assembler::LoadElementAddressForRegIndex(Register address, bool is_load, bool is_external, @@ -1504,7 +1416,6 @@ void Assembler::LoadElementAddressForRegIndex(Register address, } } - void Assembler::LoadUnaligned(Register dst, Register addr, Register tmp, @@ -1547,7 +1458,6 @@ void Assembler::LoadUnaligned(Register dst, UNIMPLEMENTED(); } - void Assembler::StoreUnaligned(Register src, Register addr, Register tmp, diff --git a/runtime/vm/assembler_arm64.h b/runtime/vm/assembler_arm64.h index 1b25c5bb0e8..921fc7a8742 100644 --- a/runtime/vm/assembler_arm64.h +++ b/runtime/vm/assembler_arm64.h @@ -41,7 +41,6 @@ class Immediate : public ValueObject { friend class Assembler; }; - class Label : public ValueObject { public: Label() : position_(0) {} @@ -83,7 +82,6 @@ class Label : public ValueObject { DISALLOW_COPY_AND_ASSIGN(Label); }; - class Address : public ValueObject { public: Address(const Address& other) @@ -299,7 +297,6 @@ class Address : public ValueObject { friend class Assembler; }; - class FieldAddress : public Address { public: FieldAddress(Register base, int32_t disp, OperandSize sz = kDoubleWord) @@ -316,7 +313,6 @@ class FieldAddress : public Address { } }; - class Operand : public ValueObject { public: enum OperandType { @@ -438,7 +434,6 @@ class Operand : public ValueObject { friend class Assembler; }; - class Assembler : public ValueObject { public: explicit Assembler(bool use_far_branches = false); diff --git a/runtime/vm/assembler_arm64_test.cc b/runtime/vm/assembler_arm64_test.cc index 624a950e717..086e1ad69fd 100644 --- a/runtime/vm/assembler_arm64_test.cc +++ b/runtime/vm/assembler_arm64_test.cc @@ -21,13 +21,11 @@ ASSEMBLER_TEST_GENERATE(Simple, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Simple, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - // Move wide immediate tests. // movz ASSEMBLER_TEST_GENERATE(Movz0, assembler) { @@ -35,93 +33,78 @@ ASSEMBLER_TEST_GENERATE(Movz0, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Movz0, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Movz1, assembler) { __ movz(R0, Immediate(42), 0); // Overwritten by next instruction. __ movz(R0, Immediate(42), 1); __ ret(); } - ASSEMBLER_TEST_RUN(Movz1, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42LL << 16, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Movz2, assembler) { __ movz(R0, Immediate(42), 2); __ ret(); } - ASSEMBLER_TEST_RUN(Movz2, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42LL << 32, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Movz3, assembler) { __ movz(R0, Immediate(42), 3); __ ret(); } - ASSEMBLER_TEST_RUN(Movz3, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42LL << 48, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - // movn ASSEMBLER_TEST_GENERATE(Movn0, assembler) { __ movn(R0, Immediate(42), 0); __ ret(); } - ASSEMBLER_TEST_RUN(Movn0, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(~42LL, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Movn1, assembler) { __ movn(R0, Immediate(42), 1); __ ret(); } - ASSEMBLER_TEST_RUN(Movn1, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(~(42LL << 16), EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Movn2, assembler) { __ movn(R0, Immediate(42), 2); __ ret(); } - ASSEMBLER_TEST_RUN(Movn2, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(~(42LL << 32), EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Movn3, assembler) { __ movn(R0, Immediate(42), 3); __ ret(); } - ASSEMBLER_TEST_RUN(Movn3, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(~(42LL << 48), EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); @@ -134,68 +117,58 @@ ASSEMBLER_TEST_GENERATE(Movk0, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Movk0, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42LL | (1LL << 48), EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Movk1, assembler) { __ movz(R0, Immediate(1), 0); __ movk(R0, Immediate(42), 1); __ ret(); } - ASSEMBLER_TEST_RUN(Movk1, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ((42LL << 16) | 1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Movk2, assembler) { __ movz(R0, Immediate(1), 0); __ movk(R0, Immediate(42), 2); __ ret(); } - ASSEMBLER_TEST_RUN(Movk2, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ((42LL << 32) | 1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Movk3, assembler) { __ movz(R0, Immediate(1), 0); __ movk(R0, Immediate(42), 3); __ ret(); } - ASSEMBLER_TEST_RUN(Movk3, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ((42LL << 48) | 1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(MovzBig, assembler) { __ movz(R0, Immediate(0x8000), 0); __ ret(); } - ASSEMBLER_TEST_RUN(MovzBig, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(0x8000, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - // add tests. ASSEMBLER_TEST_GENERATE(AddReg, assembler) { __ movz(R0, Immediate(20), 0); @@ -204,13 +177,11 @@ ASSEMBLER_TEST_GENERATE(AddReg, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(AddReg, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(AddLSLReg, assembler) { __ movz(R0, Immediate(20), 0); __ movz(R1, Immediate(11), 0); @@ -218,13 +189,11 @@ ASSEMBLER_TEST_GENERATE(AddLSLReg, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(AddLSLReg, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(AddLSRReg, assembler) { __ movz(R0, Immediate(20), 0); __ movz(R1, Immediate(44), 0); @@ -232,13 +201,11 @@ ASSEMBLER_TEST_GENERATE(AddLSRReg, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(AddLSRReg, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(AddASRReg, assembler) { __ movz(R0, Immediate(20), 0); __ movz(R1, Immediate(44), 0); @@ -246,13 +213,11 @@ ASSEMBLER_TEST_GENERATE(AddASRReg, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(AddASRReg, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(AddASRNegReg, assembler) { __ movz(R0, Immediate(43), 0); __ movn(R1, Immediate(0), 0); // R1 <- -1 @@ -261,13 +226,11 @@ ASSEMBLER_TEST_GENERATE(AddASRNegReg, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(AddASRNegReg, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - // TODO(zra): test other sign extension modes. ASSEMBLER_TEST_GENERATE(AddExtReg, assembler) { __ movz(R0, Immediate(43), 0); @@ -277,13 +240,11 @@ ASSEMBLER_TEST_GENERATE(AddExtReg, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(AddExtReg, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(AddCarryInOut, assembler) { __ LoadImmediate(R2, -1); __ LoadImmediate(R1, 1); @@ -294,13 +255,11 @@ ASSEMBLER_TEST_GENERATE(AddCarryInOut, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(AddCarryInOut, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(SubCarryInOut, assembler) { __ LoadImmediate(R1, 1); __ LoadImmediate(R0, 0); @@ -310,13 +269,11 @@ ASSEMBLER_TEST_GENERATE(SubCarryInOut, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SubCarryInOut, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Overflow, assembler) { __ LoadImmediate(R0, 0); __ LoadImmediate(R1, 1); @@ -328,13 +285,11 @@ ASSEMBLER_TEST_GENERATE(Overflow, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Overflow, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(0, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(WordAddCarryInOut, assembler) { __ LoadImmediate(R2, -1); __ LoadImmediate(R1, 1); @@ -345,13 +300,11 @@ ASSEMBLER_TEST_GENERATE(WordAddCarryInOut, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(WordAddCarryInOut, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(WordSubCarryInOut, assembler) { __ LoadImmediate(R1, 1); __ LoadImmediate(R0, 0); @@ -361,13 +314,11 @@ ASSEMBLER_TEST_GENERATE(WordSubCarryInOut, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(WordSubCarryInOut, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(0x0FFFFFFFF, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(WordOverflow, assembler) { __ LoadImmediate(R0, 0); __ LoadImmediate(R1, 1); @@ -379,13 +330,11 @@ ASSEMBLER_TEST_GENERATE(WordOverflow, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(WordOverflow, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(0, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - // Loads and Stores. ASSEMBLER_TEST_GENERATE(SimpleLoadStore, assembler) { __ SetupDartSP(); @@ -397,13 +346,11 @@ ASSEMBLER_TEST_GENERATE(SimpleLoadStore, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SimpleLoadStore, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(SimpleLoadStoreHeapTag, assembler) { __ SetupDartSP(); __ movz(R0, Immediate(43), 0); @@ -415,13 +362,11 @@ ASSEMBLER_TEST_GENERATE(SimpleLoadStoreHeapTag, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SimpleLoadStoreHeapTag, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(LoadStoreLargeIndex, assembler) { __ SetupDartSP(); __ movz(R0, Immediate(43), 0); @@ -436,13 +381,11 @@ ASSEMBLER_TEST_GENERATE(LoadStoreLargeIndex, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LoadStoreLargeIndex, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(LoadStoreLargeOffset, assembler) { __ SetupDartSP(); __ movz(R0, Immediate(43), 0); @@ -455,13 +398,11 @@ ASSEMBLER_TEST_GENERATE(LoadStoreLargeOffset, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LoadStoreLargeOffset, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(LoadStoreExtReg, assembler) { __ SetupDartSP(); __ movz(R0, Immediate(43), 0); @@ -478,13 +419,11 @@ ASSEMBLER_TEST_GENERATE(LoadStoreExtReg, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LoadStoreExtReg, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(LoadStoreScaledReg, assembler) { __ SetupDartSP(); __ movz(R0, Immediate(43), 0); @@ -499,13 +438,11 @@ ASSEMBLER_TEST_GENERATE(LoadStoreScaledReg, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LoadStoreScaledReg, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(LoadSigned32Bit, assembler) { __ SetupDartSP(); __ LoadImmediate(R1, 0xffffffff); @@ -516,13 +453,11 @@ ASSEMBLER_TEST_GENERATE(LoadSigned32Bit, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LoadSigned32Bit, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(SimpleLoadStorePair, assembler) { __ SetupDartSP(); __ LoadImmediate(R2, 43); @@ -534,13 +469,11 @@ ASSEMBLER_TEST_GENERATE(SimpleLoadStorePair, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SimpleLoadStorePair, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(LoadStorePairOffset, assembler) { __ SetupDartSP(); __ LoadImmediate(R2, 43); @@ -554,13 +487,11 @@ ASSEMBLER_TEST_GENERATE(LoadStorePairOffset, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LoadStorePairOffset, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Semaphore, assembler) { __ SetupDartSP(); __ movz(R0, Immediate(40), 0); @@ -577,14 +508,12 @@ ASSEMBLER_TEST_GENERATE(Semaphore, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Semaphore, test) { EXPECT(test != NULL); typedef intptr_t (*Semaphore)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Semaphore, test->entry())); } - ASSEMBLER_TEST_GENERATE(FailedSemaphore, assembler) { __ SetupDartSP(); __ movz(R0, Immediate(40), 0); @@ -599,14 +528,12 @@ ASSEMBLER_TEST_GENERATE(FailedSemaphore, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(FailedSemaphore, test) { EXPECT(test != NULL); typedef intptr_t (*FailedSemaphore)() DART_UNUSED; EXPECT_EQ(41, EXECUTE_TEST_CODE_INT64(FailedSemaphore, test->entry())); } - ASSEMBLER_TEST_GENERATE(Semaphore32, assembler) { __ SetupDartSP(); __ movz(R0, Immediate(40), 0); @@ -629,7 +556,6 @@ ASSEMBLER_TEST_GENERATE(Semaphore32, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Semaphore32, test) { EXPECT(test != NULL); typedef intptr_t (*Semaphore32)() DART_UNUSED; @@ -639,7 +565,6 @@ ASSEMBLER_TEST_RUN(Semaphore32, test) { EXECUTE_TEST_CODE_INT64(Semaphore32, test->entry())); } - ASSEMBLER_TEST_GENERATE(FailedSemaphore32, assembler) { __ SetupDartSP(); __ movz(R0, Immediate(40), 0); @@ -658,7 +583,6 @@ ASSEMBLER_TEST_GENERATE(FailedSemaphore32, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(FailedSemaphore32, test) { EXPECT(test != NULL); typedef intptr_t (*FailedSemaphore32)() DART_UNUSED; @@ -668,7 +592,6 @@ ASSEMBLER_TEST_RUN(FailedSemaphore32, test) { EXECUTE_TEST_CODE_INT64(FailedSemaphore32, test->entry())); } - // Logical register operations. ASSEMBLER_TEST_GENERATE(AndRegs, assembler) { __ movz(R1, Immediate(43), 0); @@ -677,13 +600,11 @@ ASSEMBLER_TEST_GENERATE(AndRegs, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(AndRegs, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(AndShiftRegs, assembler) { __ movz(R1, Immediate(42), 0); __ movz(R2, Immediate(21), 0); @@ -691,13 +612,11 @@ ASSEMBLER_TEST_GENERATE(AndShiftRegs, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(AndShiftRegs, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(BicRegs, assembler) { __ movz(R1, Immediate(42), 0); __ movz(R2, Immediate(5), 0); @@ -705,13 +624,11 @@ ASSEMBLER_TEST_GENERATE(BicRegs, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(BicRegs, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(OrrRegs, assembler) { __ movz(R1, Immediate(32), 0); __ movz(R2, Immediate(10), 0); @@ -719,13 +636,11 @@ ASSEMBLER_TEST_GENERATE(OrrRegs, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(OrrRegs, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(OrnRegs, assembler) { __ movz(R1, Immediate(32), 0); __ movn(R2, Immediate(0), 0); // R2 <- 0xffffffffffffffff. @@ -734,13 +649,11 @@ ASSEMBLER_TEST_GENERATE(OrnRegs, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(OrnRegs, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(EorRegs, assembler) { __ movz(R1, Immediate(0xffd5), 0); __ movz(R2, Immediate(0xffff), 0); @@ -748,13 +661,11 @@ ASSEMBLER_TEST_GENERATE(EorRegs, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(EorRegs, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(EonRegs, assembler) { __ movz(R1, Immediate(0xffd5), 0); __ movn(R2, Immediate(0xffff), 0); @@ -762,13 +673,11 @@ ASSEMBLER_TEST_GENERATE(EonRegs, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(EonRegs, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - // Logical immediate operations. ASSEMBLER_TEST_GENERATE(AndImm, assembler) { __ movz(R1, Immediate(42), 0); @@ -776,13 +685,11 @@ ASSEMBLER_TEST_GENERATE(AndImm, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(AndImm, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(AndImmCsp, assembler) { // Note we must maintain the ARM64 ABI invariants on CSP here. __ mov(TMP, CSP); @@ -794,26 +701,22 @@ ASSEMBLER_TEST_GENERATE(AndImmCsp, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(AndImmCsp, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(32, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(AndOneImm, assembler) { __ movz(R1, Immediate(43), 0); __ andi(R0, R1, Immediate(1)); __ ret(); } - ASSEMBLER_TEST_RUN(AndOneImm, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(OrrImm, assembler) { __ movz(R1, Immediate(0), 0); __ movz(R2, Immediate(0x3f), 0); @@ -824,13 +727,11 @@ ASSEMBLER_TEST_GENERATE(OrrImm, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(OrrImm, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(EorImm, assembler) { __ movn(R0, Immediate(0), 0); __ movk(R0, Immediate(0xffd5), 0); // R0 < 0xffffffffffffffd5. @@ -840,13 +741,11 @@ ASSEMBLER_TEST_GENERATE(EorImm, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(EorImm, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Clz, assembler) { Label error; @@ -872,13 +771,11 @@ ASSEMBLER_TEST_GENERATE(Clz, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Clz, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(0, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - // Comparisons, branching. ASSEMBLER_TEST_GENERATE(BranchALForward, assembler) { Label l; @@ -889,13 +786,11 @@ ASSEMBLER_TEST_GENERATE(BranchALForward, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(BranchALForward, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(BranchALBackwards, assembler) { Label l, leave; __ movz(R0, Immediate(42), 0); @@ -912,13 +807,11 @@ ASSEMBLER_TEST_GENERATE(BranchALBackwards, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(BranchALBackwards, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(CmpEqBranch, assembler) { Label l; @@ -933,13 +826,11 @@ ASSEMBLER_TEST_GENERATE(CmpEqBranch, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(CmpEqBranch, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(CmpEqBranchNotTaken, assembler) { Label l; @@ -954,13 +845,11 @@ ASSEMBLER_TEST_GENERATE(CmpEqBranchNotTaken, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(CmpEqBranchNotTaken, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(CmpEq1Branch, assembler) { Label l; @@ -974,13 +863,11 @@ ASSEMBLER_TEST_GENERATE(CmpEq1Branch, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(CmpEq1Branch, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(CmnEq1Branch, assembler) { Label l; @@ -994,13 +881,11 @@ ASSEMBLER_TEST_GENERATE(CmnEq1Branch, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(CmnEq1Branch, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(CmpLtBranch, assembler) { Label l; @@ -1015,13 +900,11 @@ ASSEMBLER_TEST_GENERATE(CmpLtBranch, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(CmpLtBranch, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(CmpLtBranchNotTaken, assembler) { Label l; @@ -1036,13 +919,11 @@ ASSEMBLER_TEST_GENERATE(CmpLtBranchNotTaken, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(CmpLtBranchNotTaken, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(CmpBranchIfZero, assembler) { Label l; @@ -1055,13 +936,11 @@ ASSEMBLER_TEST_GENERATE(CmpBranchIfZero, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(CmpBranchIfZero, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(CmpBranchIfZeroNotTaken, assembler) { Label l; @@ -1074,13 +953,11 @@ ASSEMBLER_TEST_GENERATE(CmpBranchIfZeroNotTaken, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(CmpBranchIfZeroNotTaken, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(CmpBranchIfNotZero, assembler) { Label l; @@ -1093,13 +970,11 @@ ASSEMBLER_TEST_GENERATE(CmpBranchIfNotZero, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(CmpBranchIfNotZero, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(CmpBranchIfNotZeroNotTaken, assembler) { Label l; @@ -1112,13 +987,11 @@ ASSEMBLER_TEST_GENERATE(CmpBranchIfNotZeroNotTaken, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(CmpBranchIfNotZeroNotTaken, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(FcmpEqBranch, assembler) { Label l; @@ -1133,13 +1006,11 @@ ASSEMBLER_TEST_GENERATE(FcmpEqBranch, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(FcmpEqBranch, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(FcmpEqBranchNotTaken, assembler) { Label l; @@ -1154,13 +1025,11 @@ ASSEMBLER_TEST_GENERATE(FcmpEqBranchNotTaken, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(FcmpEqBranchNotTaken, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(FcmpLtBranch, assembler) { Label l; @@ -1175,13 +1044,11 @@ ASSEMBLER_TEST_GENERATE(FcmpLtBranch, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(FcmpLtBranch, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(FcmpLtBranchNotTaken, assembler) { Label l; @@ -1196,13 +1063,11 @@ ASSEMBLER_TEST_GENERATE(FcmpLtBranchNotTaken, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(FcmpLtBranchNotTaken, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(FcmpzGtBranch, assembler) { Label l; @@ -1218,13 +1083,11 @@ ASSEMBLER_TEST_GENERATE(FcmpzGtBranch, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(FcmpzGtBranch, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(AndsBranch, assembler) { Label l; @@ -1239,13 +1102,11 @@ ASSEMBLER_TEST_GENERATE(AndsBranch, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(AndsBranch, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(AndsBranchNotTaken, assembler) { Label l; @@ -1260,13 +1121,11 @@ ASSEMBLER_TEST_GENERATE(AndsBranchNotTaken, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(AndsBranchNotTaken, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(BicsBranch, assembler) { Label l; @@ -1281,13 +1140,11 @@ ASSEMBLER_TEST_GENERATE(BicsBranch, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(BicsBranch, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(BicsBranchNotTaken, assembler) { Label l; @@ -1302,13 +1159,11 @@ ASSEMBLER_TEST_GENERATE(BicsBranchNotTaken, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(BicsBranchNotTaken, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(AndisBranch, assembler) { Label l; @@ -1322,13 +1177,11 @@ ASSEMBLER_TEST_GENERATE(AndisBranch, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(AndisBranch, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(AndisBranchNotTaken, assembler) { Label l; @@ -1342,13 +1195,11 @@ ASSEMBLER_TEST_GENERATE(AndisBranchNotTaken, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(AndisBranchNotTaken, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - // Address of PC-rel offset, br, blr. ASSEMBLER_TEST_GENERATE(AdrBr, assembler) { __ movz(R0, Immediate(123), 0); @@ -1362,13 +1213,11 @@ ASSEMBLER_TEST_GENERATE(AdrBr, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(AdrBr, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(AdrBlr, assembler) { __ movz(R0, Immediate(123), 0); __ add(R3, ZR, Operand(LR)); // Save LR. @@ -1383,13 +1232,11 @@ ASSEMBLER_TEST_GENERATE(AdrBlr, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(AdrBlr, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - // Misc. arithmetic. ASSEMBLER_TEST_GENERATE(Udiv, assembler) { __ movz(R0, Immediate(27), 0); @@ -1399,14 +1246,12 @@ ASSEMBLER_TEST_GENERATE(Udiv, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Udiv, test) { EXPECT(test != NULL); typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(3, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Sdiv, assembler) { __ movz(R0, Immediate(27), 0); __ movz(R1, Immediate(9), 0); @@ -1416,14 +1261,12 @@ ASSEMBLER_TEST_GENERATE(Sdiv, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Sdiv, test) { EXPECT(test != NULL); typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(-3, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Udiv_zero, assembler) { __ movz(R0, Immediate(27), 0); __ movz(R1, Immediate(0), 0); @@ -1432,14 +1275,12 @@ ASSEMBLER_TEST_GENERATE(Udiv_zero, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Udiv_zero, test) { EXPECT(test != NULL); typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(0, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Sdiv_zero, assembler) { __ movz(R0, Immediate(27), 0); __ movz(R1, Immediate(0), 0); @@ -1448,14 +1289,12 @@ ASSEMBLER_TEST_GENERATE(Sdiv_zero, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Sdiv_zero, test) { EXPECT(test != NULL); typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(0, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Udiv_corner, assembler) { __ movz(R0, Immediate(0x8000), 3); // R0 <- 0x8000000000000000 __ movn(R1, Immediate(0), 0); // R1 <- 0xffffffffffffffff @@ -1464,14 +1303,12 @@ ASSEMBLER_TEST_GENERATE(Udiv_corner, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Udiv_corner, test) { EXPECT(test != NULL); typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(0, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Sdiv_corner, assembler) { __ movz(R3, Immediate(0x8000), 3); // R0 <- 0x8000000000000000 __ movn(R1, Immediate(0), 0); // R1 <- 0xffffffffffffffff @@ -1480,7 +1317,6 @@ ASSEMBLER_TEST_GENERATE(Sdiv_corner, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Sdiv_corner, test) { EXPECT(test != NULL); typedef int64_t (*Int64Return)() DART_UNUSED; @@ -1488,7 +1324,6 @@ ASSEMBLER_TEST_RUN(Sdiv_corner, test) { EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Lslv, assembler) { __ movz(R1, Immediate(21), 0); __ movz(R2, Immediate(1), 0); @@ -1496,13 +1331,11 @@ ASSEMBLER_TEST_GENERATE(Lslv, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Lslv, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Lsrv, assembler) { __ movz(R1, Immediate(84), 0); __ movz(R2, Immediate(1), 0); @@ -1510,13 +1343,11 @@ ASSEMBLER_TEST_GENERATE(Lsrv, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Lsrv, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(LShiftingV, assembler) { __ movz(R1, Immediate(1), 0); __ movz(R2, Immediate(63), 0); @@ -1525,13 +1356,11 @@ ASSEMBLER_TEST_GENERATE(LShiftingV, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LShiftingV, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(RShiftingV, assembler) { __ movz(R1, Immediate(1), 0); __ movz(R2, Immediate(63), 0); @@ -1540,13 +1369,11 @@ ASSEMBLER_TEST_GENERATE(RShiftingV, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(RShiftingV, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Mult_pos, assembler) { __ movz(R1, Immediate(6), 0); __ movz(R2, Immediate(7), 0); @@ -1554,13 +1381,11 @@ ASSEMBLER_TEST_GENERATE(Mult_pos, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Mult_pos, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Mult_neg, assembler) { __ movz(R1, Immediate(6), 0); __ movz(R2, Immediate(7), 0); @@ -1569,13 +1394,11 @@ ASSEMBLER_TEST_GENERATE(Mult_neg, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Mult_neg, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(-42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Smulh_pos, assembler) { __ movz(R1, Immediate(6), 0); __ movz(R2, Immediate(7), 0); @@ -1583,13 +1406,11 @@ ASSEMBLER_TEST_GENERATE(Smulh_pos, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Smulh_pos, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(0, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Smulh_neg, assembler) { __ movz(R1, Immediate(6), 0); __ movz(R2, Immediate(7), 0); @@ -1598,13 +1419,11 @@ ASSEMBLER_TEST_GENERATE(Smulh_neg, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Smulh_neg, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Umulh, assembler) { __ movz(R1, Immediate(-1), 3); // 0xffff000000000000 __ movz(R2, Immediate(7), 3); // 0x0007000000000000 @@ -1612,14 +1431,12 @@ ASSEMBLER_TEST_GENERATE(Umulh, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Umulh, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(static_cast(0x6fff900000000), EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Umaddl, assembler) { __ movn(R1, Immediate(0), 0); // W1 = 0xffffffff. __ movz(R2, Immediate(7), 0); // W2 = 7. @@ -1628,131 +1445,110 @@ ASSEMBLER_TEST_GENERATE(Umaddl, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Umaddl, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(0x700000001, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - // Loading immediate values without the object pool. ASSEMBLER_TEST_GENERATE(LoadImmediateSmall, assembler) { __ LoadImmediate(R0, 42); __ ret(); } - ASSEMBLER_TEST_RUN(LoadImmediateSmall, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(LoadImmediateMed, assembler) { __ LoadImmediate(R0, 0xf1234123); __ ret(); } - ASSEMBLER_TEST_RUN(LoadImmediateMed, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(0xf1234123, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(LoadImmediateMed2, assembler) { __ LoadImmediate(R0, 0x4321f1234123); __ ret(); } - ASSEMBLER_TEST_RUN(LoadImmediateMed2, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(0x4321f1234123, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(LoadImmediateLarge, assembler) { __ LoadImmediate(R0, 0x9287436598237465); __ ret(); } - ASSEMBLER_TEST_RUN(LoadImmediateLarge, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(static_cast(0x9287436598237465), EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(LoadImmediateSmallNeg, assembler) { __ LoadImmediate(R0, -42); __ ret(); } - ASSEMBLER_TEST_RUN(LoadImmediateSmallNeg, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(-42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(LoadImmediateMedNeg, assembler) { __ LoadImmediate(R0, -0x1212341234); __ ret(); } - ASSEMBLER_TEST_RUN(LoadImmediateMedNeg, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(-0x1212341234, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(LoadImmediateMedNeg2, assembler) { __ LoadImmediate(R0, -0x1212340000); __ ret(); } - ASSEMBLER_TEST_RUN(LoadImmediateMedNeg2, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(-0x1212340000, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(LoadImmediateMedNeg3, assembler) { __ LoadImmediate(R0, -0x1200001234); __ ret(); } - ASSEMBLER_TEST_RUN(LoadImmediateMedNeg3, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(-0x1200001234, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(LoadImmediateMedNeg4, assembler) { __ LoadImmediate(R0, -0x12341234); __ ret(); } - ASSEMBLER_TEST_RUN(LoadImmediateMedNeg4, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(-0x12341234, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(LoadHalfWordUnaligned, assembler) { __ LoadUnaligned(R1, R0, TMP, kHalfword); __ mov(R0, R1); __ ret(); } - ASSEMBLER_TEST_RUN(LoadHalfWordUnaligned, test) { EXPECT(test != NULL); typedef intptr_t (*LoadHalfWordUnaligned)(intptr_t) DART_UNUSED; @@ -1770,14 +1566,12 @@ ASSEMBLER_TEST_RUN(LoadHalfWordUnaligned, test) { reinterpret_cast(&buffer[1]))); } - ASSEMBLER_TEST_GENERATE(LoadHalfWordUnsignedUnaligned, assembler) { __ LoadUnaligned(R1, R0, TMP, kUnsignedHalfword); __ mov(R0, R1); __ ret(); } - ASSEMBLER_TEST_RUN(LoadHalfWordUnsignedUnaligned, test) { EXPECT(test != NULL); typedef intptr_t (*LoadHalfWordUnsignedUnaligned)(intptr_t) DART_UNUSED; @@ -1793,7 +1587,6 @@ ASSEMBLER_TEST_RUN(LoadHalfWordUnsignedUnaligned, test) { reinterpret_cast(&buffer[1]))); } - ASSEMBLER_TEST_GENERATE(StoreHalfWordUnaligned, assembler) { __ LoadImmediate(R1, 0xABCD); __ StoreUnaligned(R1, R0, TMP, kHalfword); @@ -1801,7 +1594,6 @@ ASSEMBLER_TEST_GENERATE(StoreHalfWordUnaligned, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(StoreHalfWordUnaligned, test) { EXPECT(test != NULL); typedef intptr_t (*StoreHalfWordUnaligned)(intptr_t) DART_UNUSED; @@ -1824,14 +1616,12 @@ ASSEMBLER_TEST_RUN(StoreHalfWordUnaligned, test) { EXPECT_EQ(0, buffer[3]); } - ASSEMBLER_TEST_GENERATE(LoadWordUnaligned, assembler) { __ LoadUnaligned(R1, R0, TMP, kUnsignedWord); __ mov(R0, R1); __ ret(); } - ASSEMBLER_TEST_RUN(LoadWordUnaligned, test) { EXPECT(test != NULL); typedef int32_t (*LoadWordUnaligned)(intptr_t) DART_UNUSED; @@ -1855,7 +1645,6 @@ ASSEMBLER_TEST_RUN(LoadWordUnaligned, test) { reinterpret_cast(&buffer[3]))); } - ASSEMBLER_TEST_GENERATE(StoreWordUnaligned, assembler) { __ LoadImmediate(R1, 0x12345678); __ StoreUnaligned(R1, R0, TMP, kUnsignedWord); @@ -1863,7 +1652,6 @@ ASSEMBLER_TEST_GENERATE(StoreWordUnaligned, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(StoreWordUnaligned, test) { EXPECT(test != NULL); typedef intptr_t (*StoreWordUnaligned)(intptr_t) DART_UNUSED; @@ -1902,7 +1690,6 @@ ASSEMBLER_TEST_RUN(StoreWordUnaligned, test) { EXPECT_EQ(0x12, buffer[6]); } - static void EnterTestFrame(Assembler* assembler) { __ EnterFrame(0); __ Push(CODE_REG); @@ -1913,7 +1700,6 @@ static void EnterTestFrame(Assembler* assembler) { __ LoadPoolPointer(PP); } - static void LeaveTestFrame(Assembler* assembler) { __ PopAndUntagPP(); __ Pop(THR); @@ -1921,7 +1707,6 @@ static void LeaveTestFrame(Assembler* assembler) { __ LeaveFrame(); } - // Loading immediate values with the object pool. ASSEMBLER_TEST_GENERATE(LoadImmediatePPSmall, assembler) { __ SetupDartSP(); @@ -1932,12 +1717,10 @@ ASSEMBLER_TEST_GENERATE(LoadImmediatePPSmall, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LoadImmediatePPSmall, test) { EXPECT_EQ(42, test->InvokeWithCodeAndThread()); } - ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed, assembler) { __ SetupDartSP(); EnterTestFrame(assembler); @@ -1947,12 +1730,10 @@ ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LoadImmediatePPMed, test) { EXPECT_EQ(0xf1234123, test->InvokeWithCodeAndThread()); } - ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed2, assembler) { __ SetupDartSP(); EnterTestFrame(assembler); @@ -1962,12 +1743,10 @@ ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed2, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LoadImmediatePPMed2, test) { EXPECT_EQ(0x4321f1234124, test->InvokeWithCodeAndThread()); } - ASSEMBLER_TEST_GENERATE(LoadImmediatePPLarge, assembler) { __ SetupDartSP(); EnterTestFrame(assembler); @@ -1977,13 +1756,11 @@ ASSEMBLER_TEST_GENERATE(LoadImmediatePPLarge, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LoadImmediatePPLarge, test) { EXPECT_EQ(static_cast(0x9287436598237465), test->InvokeWithCodeAndThread()); } - // LoadObject null. ASSEMBLER_TEST_GENERATE(LoadObjectNull, assembler) { __ SetupDartSP(); @@ -1994,12 +1771,10 @@ ASSEMBLER_TEST_GENERATE(LoadObjectNull, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LoadObjectNull, test) { EXPECT_EQ(Object::null(), test->InvokeWithCodeAndThread()); } - ASSEMBLER_TEST_GENERATE(LoadObjectTrue, assembler) { __ SetupDartSP(); EnterTestFrame(assembler); @@ -2009,12 +1784,10 @@ ASSEMBLER_TEST_GENERATE(LoadObjectTrue, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LoadObjectTrue, test) { EXPECT_EQ(Bool::True().raw(), test->InvokeWithCodeAndThread()); } - ASSEMBLER_TEST_GENERATE(LoadObjectFalse, assembler) { __ SetupDartSP(); EnterTestFrame(assembler); @@ -2024,12 +1797,10 @@ ASSEMBLER_TEST_GENERATE(LoadObjectFalse, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LoadObjectFalse, test) { EXPECT_EQ(Bool::False().raw(), test->InvokeWithCodeAndThread()); } - ASSEMBLER_TEST_GENERATE(CSelTrue, assembler) { __ LoadImmediate(R1, 42); __ LoadImmediate(R2, 1234); @@ -2038,13 +1809,11 @@ ASSEMBLER_TEST_GENERATE(CSelTrue, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(CSelTrue, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(CSelFalse, assembler) { __ LoadImmediate(R1, 42); __ LoadImmediate(R2, 1234); @@ -2053,13 +1822,11 @@ ASSEMBLER_TEST_GENERATE(CSelFalse, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(CSelFalse, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(1234, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(CsincFalse, assembler) { __ LoadImmediate(R1, 42); __ LoadImmediate(R2, 1234); @@ -2068,13 +1835,11 @@ ASSEMBLER_TEST_GENERATE(CsincFalse, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(CsincFalse, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(43, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(CsincTrue, assembler) { __ LoadImmediate(R1, 42); __ LoadImmediate(R2, 1234); @@ -2083,13 +1848,11 @@ ASSEMBLER_TEST_GENERATE(CsincTrue, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(CsincTrue, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(1234, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(CsinvFalse, assembler) { __ LoadImmediate(R1, 42); __ LoadImmediate(R2, 1234); @@ -2098,13 +1861,11 @@ ASSEMBLER_TEST_GENERATE(CsinvFalse, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(CsinvFalse, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(~42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(CsinvTrue, assembler) { __ LoadImmediate(R1, 42); __ LoadImmediate(R2, 1234); @@ -2113,32 +1874,27 @@ ASSEMBLER_TEST_GENERATE(CsinvTrue, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(CsinvTrue, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(1234, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - // Floating point move immediate, to/from integer register. ASSEMBLER_TEST_GENERATE(Fmovdi, assembler) { __ LoadDImmediate(V0, 1.0); __ ret(); } - ASSEMBLER_TEST_RUN(Fmovdi, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(1.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Fmovdi2, assembler) { __ LoadDImmediate(V0, 123412983.1324524315); __ ret(); } - ASSEMBLER_TEST_RUN(Fmovdi2, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_FLOAT_EQ(123412983.1324524315, @@ -2146,21 +1902,18 @@ ASSEMBLER_TEST_RUN(Fmovdi2, test) { 0.0001f); } - ASSEMBLER_TEST_GENERATE(Fmovrd, assembler) { __ LoadDImmediate(V1, 1.0); __ fmovrd(R0, V1); __ ret(); } - ASSEMBLER_TEST_RUN(Fmovrd, test) { typedef int64_t (*Int64Return)() DART_UNUSED; const int64_t one = bit_cast(1.0); EXPECT_EQ(one, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Fmovdr, assembler) { __ LoadDImmediate(V1, 1.0); __ fmovrd(R1, V1); @@ -2168,13 +1921,11 @@ ASSEMBLER_TEST_GENERATE(Fmovdr, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Fmovdr, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(1.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Fmovrs, assembler) { __ LoadDImmediate(V2, 1.0); __ fcvtsd(V1, V2); @@ -2182,7 +1933,6 @@ ASSEMBLER_TEST_GENERATE(Fmovrs, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Fmovrs, test) { typedef int64_t (*Int64Return)() DART_UNUSED; int64_t result = EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()); @@ -2190,7 +1940,6 @@ ASSEMBLER_TEST_RUN(Fmovrs, test) { EXPECT_EQ(one, static_cast(result)); } - ASSEMBLER_TEST_GENERATE(Fmovsr, assembler) { __ LoadImmediate(R2, bit_cast(1.0f)); __ fmovsr(V1, R2); @@ -2198,7 +1947,6 @@ ASSEMBLER_TEST_GENERATE(Fmovsr, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Fmovsr, test) { typedef int64_t (*Int64Return)() DART_UNUSED; int64_t result = EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()); @@ -2206,7 +1954,6 @@ ASSEMBLER_TEST_RUN(Fmovsr, test) { EXPECT_EQ(one, static_cast(result)); } - ASSEMBLER_TEST_GENERATE(FldrdFstrdPrePostIndex, assembler) { __ SetupDartSP(); __ LoadDImmediate(V1, 42.0); @@ -2216,13 +1963,11 @@ ASSEMBLER_TEST_GENERATE(FldrdFstrdPrePostIndex, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(FldrdFstrdPrePostIndex, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(FldrsFstrsPrePostIndex, assembler) { __ SetupDartSP(); __ LoadDImmediate(V1, 42.0); @@ -2234,13 +1979,11 @@ ASSEMBLER_TEST_GENERATE(FldrsFstrsPrePostIndex, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(FldrsFstrsPrePostIndex, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(FldrqFstrqPrePostIndex, assembler) { __ SetupDartSP(); __ LoadDImmediate(V1, 21.0); @@ -2259,39 +2002,33 @@ ASSEMBLER_TEST_GENERATE(FldrqFstrqPrePostIndex, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(FldrqFstrqPrePostIndex, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Fcvtzds, assembler) { __ LoadDImmediate(V0, 42.0); __ fcvtzds(R0, V0); __ ret(); } - ASSEMBLER_TEST_RUN(Fcvtzds, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Scvtfdx, assembler) { __ LoadImmediate(R0, 42); __ scvtfdx(V0, R0); __ ret(); } - ASSEMBLER_TEST_RUN(Scvtfdx, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Scvtfdw, assembler) { // Fill upper 32-bits with garbage. __ LoadImmediate(R0, 0x111111110000002A); @@ -2299,78 +2036,66 @@ ASSEMBLER_TEST_GENERATE(Scvtfdw, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Scvtfdw, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(FabsdPos, assembler) { __ LoadDImmediate(V1, 42.0); __ fabsd(V0, V1); __ ret(); } - ASSEMBLER_TEST_RUN(FabsdPos, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(FabsdNeg, assembler) { __ LoadDImmediate(V1, -42.0); __ fabsd(V0, V1); __ ret(); } - ASSEMBLER_TEST_RUN(FabsdNeg, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(FnegdPos, assembler) { __ LoadDImmediate(V1, 42.0); __ fnegd(V0, V1); __ ret(); } - ASSEMBLER_TEST_RUN(FnegdPos, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(-42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(FnegdNeg, assembler) { __ LoadDImmediate(V1, -42.0); __ fnegd(V0, V1); __ ret(); } - ASSEMBLER_TEST_RUN(FnegdNeg, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Fsqrtd, assembler) { __ LoadDImmediate(V1, 64.0); __ fsqrtd(V0, V1); __ ret(); } - ASSEMBLER_TEST_RUN(Fsqrtd, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(8.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Fmuld, assembler) { __ LoadDImmediate(V1, 84.0); __ LoadDImmediate(V2, 0.5); @@ -2378,13 +2103,11 @@ ASSEMBLER_TEST_GENERATE(Fmuld, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Fmuld, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Fdivd, assembler) { __ LoadDImmediate(V1, 84.0); __ LoadDImmediate(V2, 2.0); @@ -2392,13 +2115,11 @@ ASSEMBLER_TEST_GENERATE(Fdivd, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Fdivd, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Faddd, assembler) { __ LoadDImmediate(V1, 41.5); __ LoadDImmediate(V2, 0.5); @@ -2406,13 +2127,11 @@ ASSEMBLER_TEST_GENERATE(Faddd, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Faddd, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Fsubd, assembler) { __ LoadDImmediate(V1, 42.5); __ LoadDImmediate(V2, 0.5); @@ -2420,13 +2139,11 @@ ASSEMBLER_TEST_GENERATE(Fsubd, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Fsubd, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(FldrdFstrdHeapTag, assembler) { __ SetupDartSP(); __ LoadDImmediate(V0, 43.0); @@ -2440,13 +2157,11 @@ ASSEMBLER_TEST_GENERATE(FldrdFstrdHeapTag, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(FldrdFstrdHeapTag, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(FldrdFstrdLargeIndex, assembler) { __ SetupDartSP(); __ LoadDImmediate(V0, 43.0); @@ -2461,13 +2176,11 @@ ASSEMBLER_TEST_GENERATE(FldrdFstrdLargeIndex, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(FldrdFstrdLargeIndex, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(FldrdFstrdLargeOffset, assembler) { __ SetupDartSP(); __ LoadDImmediate(V0, 43.0); @@ -2480,13 +2193,11 @@ ASSEMBLER_TEST_GENERATE(FldrdFstrdLargeOffset, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(FldrdFstrdLargeOffset, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(FldrdFstrdExtReg, assembler) { __ SetupDartSP(); __ LoadDImmediate(V0, 43.0); @@ -2503,13 +2214,11 @@ ASSEMBLER_TEST_GENERATE(FldrdFstrdExtReg, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(FldrdFstrdExtReg, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(FldrdFstrdScaledReg, assembler) { __ SetupDartSP(); __ LoadDImmediate(V0, 43.0); @@ -2524,13 +2233,11 @@ ASSEMBLER_TEST_GENERATE(FldrdFstrdScaledReg, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(FldrdFstrdScaledReg, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(VinswVmovrs, assembler) { __ LoadImmediate(R0, 42); __ LoadImmediate(R1, 43); @@ -2553,14 +2260,12 @@ ASSEMBLER_TEST_GENERATE(VinswVmovrs, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(VinswVmovrs, test) { EXPECT(test != NULL); typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(174, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(VinsxVmovrd, assembler) { __ LoadImmediate(R0, 42); __ LoadImmediate(R1, 43); @@ -2575,14 +2280,12 @@ ASSEMBLER_TEST_GENERATE(VinsxVmovrd, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(VinsxVmovrd, test) { EXPECT(test != NULL); typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(85, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vnot, assembler) { __ LoadImmediate(R0, 0xfffffffe); __ LoadImmediate(R1, 0xffffffff); @@ -2603,14 +2306,12 @@ ASSEMBLER_TEST_GENERATE(Vnot, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vnot, test) { EXPECT(test != NULL); typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(2, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vabss, assembler) { __ LoadDImmediate(V1, 21.0); __ LoadDImmediate(V2, -21.0); @@ -2634,13 +2335,11 @@ ASSEMBLER_TEST_GENERATE(Vabss, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vabss, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vabsd, assembler) { __ LoadDImmediate(V1, 21.0); __ LoadDImmediate(V2, -21.0); @@ -2657,13 +2356,11 @@ ASSEMBLER_TEST_GENERATE(Vabsd, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vabsd, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vnegs, assembler) { __ LoadDImmediate(V1, 42.0); __ LoadDImmediate(V2, -84.0); @@ -2686,13 +2383,11 @@ ASSEMBLER_TEST_GENERATE(Vnegs, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vnegs, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vnegd, assembler) { __ LoadDImmediate(V1, 42.0); __ LoadDImmediate(V2, -84.0); @@ -2709,13 +2404,11 @@ ASSEMBLER_TEST_GENERATE(Vnegd, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vnegd, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vadds, assembler) { __ LoadDImmediate(V0, 0.0); __ LoadDImmediate(V1, 1.0); @@ -2750,13 +2443,11 @@ ASSEMBLER_TEST_GENERATE(Vadds, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vadds, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(12.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vsubs, assembler) { __ LoadDImmediate(V0, 0.0); __ LoadDImmediate(V1, 1.0); @@ -2792,13 +2483,11 @@ ASSEMBLER_TEST_GENERATE(Vsubs, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vsubs, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(-6.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vmuls, assembler) { __ LoadDImmediate(V0, 0.0); __ LoadDImmediate(V1, 1.0); @@ -2833,13 +2522,11 @@ ASSEMBLER_TEST_GENERATE(Vmuls, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vmuls, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(14.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vdivs, assembler) { __ LoadDImmediate(V0, 0.0); __ LoadDImmediate(V1, 1.0); @@ -2874,13 +2561,11 @@ ASSEMBLER_TEST_GENERATE(Vdivs, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vdivs, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(4.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vaddd, assembler) { __ LoadDImmediate(V0, 2.0); __ LoadDImmediate(V1, 3.0); @@ -2897,13 +2582,11 @@ ASSEMBLER_TEST_GENERATE(Vaddd, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vaddd, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(10.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vsubd, assembler) { __ LoadDImmediate(V0, 2.0); __ LoadDImmediate(V1, 3.0); @@ -2921,13 +2604,11 @@ ASSEMBLER_TEST_GENERATE(Vsubd, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vsubd, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(-5.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vmuld, assembler) { __ LoadDImmediate(V0, 2.0); __ LoadDImmediate(V1, 3.0); @@ -2944,13 +2625,11 @@ ASSEMBLER_TEST_GENERATE(Vmuld, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vmuld, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(13.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vdivd, assembler) { __ LoadDImmediate(V0, 2.0); __ LoadDImmediate(V1, 3.0); @@ -2967,13 +2646,11 @@ ASSEMBLER_TEST_GENERATE(Vdivd, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vdivd, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(2.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vdupd, assembler) { __ SetupDartSP(); __ LoadDImmediate(V0, 21.0); @@ -2991,13 +2668,11 @@ ASSEMBLER_TEST_GENERATE(Vdupd, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vdupd, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vdups, assembler) { __ SetupDartSP(); __ LoadDImmediate(V0, 21.0); @@ -3025,13 +2700,11 @@ ASSEMBLER_TEST_GENERATE(Vdups, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vdups, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(84.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vinsd, assembler) { __ SetupDartSP(); __ LoadDImmediate(V5, 42.0); @@ -3049,13 +2722,11 @@ ASSEMBLER_TEST_GENERATE(Vinsd, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vinsd, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vinss, assembler) { __ SetupDartSP(); __ LoadDImmediate(V0, 21.0); @@ -3084,13 +2755,11 @@ ASSEMBLER_TEST_GENERATE(Vinss, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vinss, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vand, assembler) { __ LoadDImmediate(V1, 21.0); __ LoadImmediate(R0, 0xffffffff); @@ -3121,13 +2790,11 @@ ASSEMBLER_TEST_GENERATE(Vand, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vand, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vorr, assembler) { __ LoadDImmediate(V1, 10.5); __ fcvtsd(V1, V1); @@ -3159,13 +2826,11 @@ ASSEMBLER_TEST_GENERATE(Vorr, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vorr, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Veor, assembler) { __ LoadImmediate(R1, 0xffffffff); __ LoadImmediate(R2, ~21); @@ -3193,13 +2858,11 @@ ASSEMBLER_TEST_GENERATE(Veor, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Veor, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vaddw, assembler) { __ LoadImmediate(R4, 21); @@ -3218,13 +2881,11 @@ ASSEMBLER_TEST_GENERATE(Vaddw, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vaddw, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(168, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vsubw, assembler) { __ LoadImmediate(R4, 31); __ LoadImmediate(R5, 10); @@ -3244,13 +2905,11 @@ ASSEMBLER_TEST_GENERATE(Vsubw, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vsubw, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(84, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vaddx, assembler) { __ LoadImmediate(R4, 21); @@ -3265,13 +2924,11 @@ ASSEMBLER_TEST_GENERATE(Vaddx, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vaddx, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(84, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vsubx, assembler) { __ LoadImmediate(R4, 31); __ LoadImmediate(R5, 10); @@ -3287,13 +2944,11 @@ ASSEMBLER_TEST_GENERATE(Vsubx, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vsubx, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vceqs, assembler) { __ LoadDImmediate(V0, 42.0); __ LoadDImmediate(V1, -42.0); @@ -3320,13 +2975,11 @@ ASSEMBLER_TEST_GENERATE(Vceqs, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vceqs, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(0xfffffffe, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vceqd, assembler) { __ LoadDImmediate(V0, 42.0); __ LoadDImmediate(V1, -42.0); @@ -3344,13 +2997,11 @@ ASSEMBLER_TEST_GENERATE(Vceqd, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vceqd, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vcgts, assembler) { __ LoadDImmediate(V0, 42.0); __ LoadDImmediate(V1, -42.0); @@ -3377,13 +3028,11 @@ ASSEMBLER_TEST_GENERATE(Vcgts, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vcgts, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(0xfffffffe, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vcgtd, assembler) { __ LoadDImmediate(V0, 42.0); __ LoadDImmediate(V1, -42.0); @@ -3401,13 +3050,11 @@ ASSEMBLER_TEST_GENERATE(Vcgtd, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vcgtd, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vcges, assembler) { __ LoadDImmediate(V0, 42.0); __ LoadDImmediate(V1, 43.0); @@ -3434,13 +3081,11 @@ ASSEMBLER_TEST_GENERATE(Vcges, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vcges, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(0xfffffffe, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vcged, assembler) { __ LoadDImmediate(V0, 42.0); __ LoadDImmediate(V1, 43.0); @@ -3458,13 +3103,11 @@ ASSEMBLER_TEST_GENERATE(Vcged, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vcged, test) { typedef int64_t (*Int64Return)() DART_UNUSED; EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vmaxs, assembler) { __ LoadDImmediate(V0, 10.5); __ LoadDImmediate(V1, 10.0); @@ -3496,13 +3139,11 @@ ASSEMBLER_TEST_GENERATE(Vmaxs, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vmaxs, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vmaxd, assembler) { __ LoadDImmediate(V0, 21.0); __ LoadDImmediate(V1, 20.5); @@ -3520,13 +3161,11 @@ ASSEMBLER_TEST_GENERATE(Vmaxd, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vmaxd, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vmins, assembler) { __ LoadDImmediate(V0, 10.5); __ LoadDImmediate(V1, 11.0); @@ -3558,13 +3197,11 @@ ASSEMBLER_TEST_GENERATE(Vmins, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vmins, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vmind, assembler) { __ LoadDImmediate(V0, 21.0); __ LoadDImmediate(V1, 21.5); @@ -3582,13 +3219,11 @@ ASSEMBLER_TEST_GENERATE(Vmind, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vmind, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vsqrts, assembler) { __ LoadDImmediate(V0, 64.0); __ LoadDImmediate(V1, 49.0); @@ -3612,13 +3247,11 @@ ASSEMBLER_TEST_GENERATE(Vsqrts, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vsqrts, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(15.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vsqrtd, assembler) { __ LoadDImmediate(V0, 64.0); __ LoadDImmediate(V1, 49.0); @@ -3635,13 +3268,11 @@ ASSEMBLER_TEST_GENERATE(Vsqrtd, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vsqrtd, test) { typedef double (*DoubleReturn)() DART_UNUSED; EXPECT_EQ(15.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); } - // This is the same function as in the Simulator. static float arm_recip_estimate(float a) { // From the ARM Architecture Reference Manual A2-85. @@ -3679,7 +3310,6 @@ static float arm_recip_estimate(float a) { return bit_cast(result_bits); } - ASSEMBLER_TEST_GENERATE(Vrecpes, assembler) { __ LoadDImmediate(V1, 147.0); __ fcvtsd(V1, V1); @@ -3692,7 +3322,6 @@ ASSEMBLER_TEST_GENERATE(Vrecpes, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vrecpes, test) { EXPECT(test != NULL); typedef double (*DoubleReturn)() DART_UNUSED; @@ -3700,7 +3329,6 @@ ASSEMBLER_TEST_RUN(Vrecpes, test) { EXPECT_FLOAT_EQ(arm_recip_estimate(147.0), res, 0.0001); } - ASSEMBLER_TEST_GENERATE(Vrecpss, assembler) { __ LoadDImmediate(V1, 5.0); __ LoadDImmediate(V2, 10.0); @@ -3714,7 +3342,6 @@ ASSEMBLER_TEST_GENERATE(Vrecpss, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vrecpss, test) { EXPECT(test != NULL); typedef double (*DoubleReturn)() DART_UNUSED; @@ -3722,7 +3349,6 @@ ASSEMBLER_TEST_RUN(Vrecpss, test) { EXPECT_FLOAT_EQ(2.0 - 10.0 * 5.0, res, 0.0001); } - ASSEMBLER_TEST_GENERATE(VRecps, assembler) { __ LoadDImmediate(V0, 1.0 / 10.5); __ fcvtsd(V0, V0); @@ -3747,14 +3373,12 @@ ASSEMBLER_TEST_GENERATE(VRecps, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(VRecps, test) { typedef double (*DoubleReturn)() DART_UNUSED; double res = EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()); EXPECT_FLOAT_EQ(42.0, res, 0.0001); } - static float arm_reciprocal_sqrt_estimate(float a) { // From the ARM Architecture Reference Manual A2-87. if (isinf(a) || (fabs(a) >= exp2f(126))) @@ -3809,7 +3433,6 @@ static float arm_reciprocal_sqrt_estimate(float a) { return bit_cast(result_bits); } - ASSEMBLER_TEST_GENERATE(Vrsqrtes, assembler) { __ LoadDImmediate(V1, 147.0); __ fcvtsd(V1, V1); @@ -3820,7 +3443,6 @@ ASSEMBLER_TEST_GENERATE(Vrsqrtes, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vrsqrtes, test) { EXPECT(test != NULL); typedef double (*DoubleReturn)() DART_UNUSED; @@ -3828,7 +3450,6 @@ ASSEMBLER_TEST_RUN(Vrsqrtes, test) { EXPECT_FLOAT_EQ(arm_reciprocal_sqrt_estimate(147.0), res, 0.0001); } - ASSEMBLER_TEST_GENERATE(Vrsqrtss, assembler) { __ LoadDImmediate(V1, 5.0); __ LoadDImmediate(V2, 10.0); @@ -3842,7 +3463,6 @@ ASSEMBLER_TEST_GENERATE(Vrsqrtss, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Vrsqrtss, test) { EXPECT(test != NULL); typedef double (*DoubleReturn)() DART_UNUSED; @@ -3850,7 +3470,6 @@ ASSEMBLER_TEST_RUN(Vrsqrtss, test) { EXPECT_FLOAT_EQ((3.0 - 10.0 * 5.0) / 2.0, res, 0.0001); } - ASSEMBLER_TEST_GENERATE(ReciprocalSqrt, assembler) { __ LoadDImmediate(V1, 147000.0); __ fcvtsd(V1, V1); @@ -3861,7 +3480,6 @@ ASSEMBLER_TEST_GENERATE(ReciprocalSqrt, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(ReciprocalSqrt, test) { EXPECT(test != NULL); typedef double (*DoubleReturn)() DART_UNUSED; @@ -3869,7 +3487,6 @@ ASSEMBLER_TEST_RUN(ReciprocalSqrt, test) { EXPECT_FLOAT_EQ(1.0 / sqrt(147000.0), res, 0.0001); } - // Called from assembler_test.cc. // LR: return address. // R0: value. diff --git a/runtime/vm/assembler_arm_test.cc b/runtime/vm/assembler_arm_test.cc index e424b6a7168..001a016dac4 100644 --- a/runtime/vm/assembler_arm_test.cc +++ b/runtime/vm/assembler_arm_test.cc @@ -15,32 +15,27 @@ namespace dart { #define __ assembler-> - ASSEMBLER_TEST_GENERATE(Simple, assembler) { __ mov(R0, Operand(42)); __ bx(LR); } - ASSEMBLER_TEST_RUN(Simple, test) { typedef int (*SimpleCode)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(SimpleCode, test->entry())); } - ASSEMBLER_TEST_GENERATE(MoveNegated, assembler) { __ mvn(R0, Operand(42)); __ bx(LR); } - ASSEMBLER_TEST_RUN(MoveNegated, test) { EXPECT(test != NULL); typedef int (*MoveNegated)() DART_UNUSED; EXPECT_EQ(~42, EXECUTE_TEST_CODE_INT32(MoveNegated, test->entry())); } - ASSEMBLER_TEST_GENERATE(MoveRotImm, assembler) { Operand o; EXPECT(Operand::CanHold(0x00550000, &o)); @@ -50,14 +45,12 @@ ASSEMBLER_TEST_GENERATE(MoveRotImm, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(MoveRotImm, test) { EXPECT(test != NULL); typedef int (*MoveRotImm)() DART_UNUSED; EXPECT_EQ(0x30550003, EXECUTE_TEST_CODE_INT32(MoveRotImm, test->entry())); } - ASSEMBLER_TEST_GENERATE(MovImm16, assembler) { #if defined(USING_SIMULATOR) // ARMv7 is the default. @@ -73,14 +66,12 @@ ASSEMBLER_TEST_GENERATE(MovImm16, assembler) { #endif } - ASSEMBLER_TEST_RUN(MovImm16, test) { EXPECT(test != NULL); typedef int (*MovImm16)() DART_UNUSED; EXPECT_EQ(0x12345678, EXECUTE_TEST_CODE_INT32(MovImm16, test->entry())); } - ASSEMBLER_TEST_GENERATE(LoadImmediate, assembler) { __ mov(R0, Operand(0)); __ cmp(R0, Operand(0)); @@ -89,21 +80,18 @@ ASSEMBLER_TEST_GENERATE(LoadImmediate, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(LoadImmediate, test) { EXPECT(test != NULL); typedef int (*LoadImmediate)() DART_UNUSED; EXPECT_EQ(0x12345678, EXECUTE_TEST_CODE_INT32(LoadImmediate, test->entry())); } - ASSEMBLER_TEST_GENERATE(LoadHalfWordUnaligned, assembler) { __ LoadHalfWordUnaligned(R1, R0, TMP); __ mov(R0, Operand(R1)); __ bx(LR); } - ASSEMBLER_TEST_RUN(LoadHalfWordUnaligned, test) { EXPECT(test != NULL); typedef intptr_t (*LoadHalfWordUnaligned)(intptr_t) DART_UNUSED; @@ -121,14 +109,12 @@ ASSEMBLER_TEST_RUN(LoadHalfWordUnaligned, test) { reinterpret_cast(&buffer[1]))); } - ASSEMBLER_TEST_GENERATE(LoadHalfWordUnsignedUnaligned, assembler) { __ LoadHalfWordUnsignedUnaligned(R1, R0, TMP); __ mov(R0, Operand(R1)); __ bx(LR); } - ASSEMBLER_TEST_RUN(LoadHalfWordUnsignedUnaligned, test) { EXPECT(test != NULL); typedef intptr_t (*LoadHalfWordUnsignedUnaligned)(intptr_t) DART_UNUSED; @@ -144,7 +130,6 @@ ASSEMBLER_TEST_RUN(LoadHalfWordUnsignedUnaligned, test) { reinterpret_cast(&buffer[1]))); } - ASSEMBLER_TEST_GENERATE(StoreHalfWordUnaligned, assembler) { __ LoadImmediate(R1, 0xABCD); __ StoreWordUnaligned(R1, R0, TMP); @@ -152,7 +137,6 @@ ASSEMBLER_TEST_GENERATE(StoreHalfWordUnaligned, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(StoreHalfWordUnaligned, test) { EXPECT(test != NULL); typedef intptr_t (*StoreHalfWordUnaligned)(intptr_t) DART_UNUSED; @@ -175,14 +159,12 @@ ASSEMBLER_TEST_RUN(StoreHalfWordUnaligned, test) { EXPECT_EQ(0, buffer[3]); } - ASSEMBLER_TEST_GENERATE(LoadWordUnaligned, assembler) { __ LoadWordUnaligned(R1, R0, TMP); __ mov(R0, Operand(R1)); __ bx(LR); } - ASSEMBLER_TEST_RUN(LoadWordUnaligned, test) { EXPECT(test != NULL); typedef intptr_t (*LoadWordUnaligned)(intptr_t) DART_UNUSED; @@ -206,7 +188,6 @@ ASSEMBLER_TEST_RUN(LoadWordUnaligned, test) { reinterpret_cast(&buffer[3]))); } - ASSEMBLER_TEST_GENERATE(StoreWordUnaligned, assembler) { __ LoadImmediate(R1, 0x12345678); __ StoreWordUnaligned(R1, R0, TMP); @@ -214,7 +195,6 @@ ASSEMBLER_TEST_GENERATE(StoreWordUnaligned, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(StoreWordUnaligned, test) { EXPECT(test != NULL); typedef intptr_t (*StoreWordUnaligned)(intptr_t) DART_UNUSED; @@ -253,7 +233,6 @@ ASSEMBLER_TEST_RUN(StoreWordUnaligned, test) { EXPECT_EQ(0x12, buffer[6]); } - ASSEMBLER_TEST_GENERATE(Vmov, assembler) { if (TargetCPUFeatures::vfp_supported()) { __ mov(R3, Operand(43)); @@ -271,7 +250,6 @@ ASSEMBLER_TEST_GENERATE(Vmov, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vmov, test) { EXPECT(test != NULL); if (TargetCPUFeatures::vfp_supported()) { @@ -280,7 +258,6 @@ ASSEMBLER_TEST_RUN(Vmov, test) { } } - ASSEMBLER_TEST_GENERATE(SingleVLoadStore, assembler) { if (TargetCPUFeatures::vfp_supported()) { __ LoadImmediate(R0, bit_cast(12.3f)); @@ -294,7 +271,6 @@ ASSEMBLER_TEST_GENERATE(SingleVLoadStore, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(SingleVLoadStore, test) { EXPECT(test != NULL); if (TargetCPUFeatures::vfp_supported()) { @@ -304,7 +280,6 @@ ASSEMBLER_TEST_RUN(SingleVLoadStore, test) { } } - ASSEMBLER_TEST_GENERATE(SingleVShiftLoadStore, assembler) { if (TargetCPUFeatures::vfp_supported()) { __ LoadImmediate(R0, bit_cast(12.3f)); @@ -323,7 +298,6 @@ ASSEMBLER_TEST_GENERATE(SingleVShiftLoadStore, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(SingleVShiftLoadStore, test) { EXPECT(test != NULL); if (TargetCPUFeatures::vfp_supported()) { @@ -333,7 +307,6 @@ ASSEMBLER_TEST_RUN(SingleVShiftLoadStore, test) { } } - ASSEMBLER_TEST_GENERATE(DoubleVLoadStore, assembler) { if (TargetCPUFeatures::vfp_supported()) { int64_t value = bit_cast(12.3); @@ -351,7 +324,6 @@ ASSEMBLER_TEST_GENERATE(DoubleVLoadStore, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(DoubleVLoadStore, test) { EXPECT(test != NULL); if (TargetCPUFeatures::vfp_supported()) { @@ -361,7 +333,6 @@ ASSEMBLER_TEST_RUN(DoubleVLoadStore, test) { } } - ASSEMBLER_TEST_GENERATE(SingleFPOperations, assembler) { if (TargetCPUFeatures::vfp_supported()) { __ LoadSImmediate(S0, 12.3f); @@ -377,7 +348,6 @@ ASSEMBLER_TEST_GENERATE(SingleFPOperations, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(SingleFPOperations, test) { EXPECT(test != NULL); if (TargetCPUFeatures::vfp_supported()) { @@ -387,7 +357,6 @@ ASSEMBLER_TEST_RUN(SingleFPOperations, test) { } } - ASSEMBLER_TEST_GENERATE(DoubleFPOperations, assembler) { if (TargetCPUFeatures::vfp_supported()) { __ LoadDImmediate(D0, 12.3, R0); @@ -403,7 +372,6 @@ ASSEMBLER_TEST_GENERATE(DoubleFPOperations, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(DoubleFPOperations, test) { EXPECT(test != NULL); if (TargetCPUFeatures::vfp_supported()) { @@ -413,7 +381,6 @@ ASSEMBLER_TEST_RUN(DoubleFPOperations, test) { } } - ASSEMBLER_TEST_GENERATE(DoubleSqrtNeg, assembler) { if (TargetCPUFeatures::vfp_supported()) { // Check that sqrt of a negative double gives NaN. @@ -427,7 +394,6 @@ ASSEMBLER_TEST_GENERATE(DoubleSqrtNeg, assembler) { __ Ret(); } - ASSEMBLER_TEST_RUN(DoubleSqrtNeg, test) { EXPECT(test != NULL); if (TargetCPUFeatures::vfp_supported()) { @@ -436,7 +402,6 @@ ASSEMBLER_TEST_RUN(DoubleSqrtNeg, test) { } } - ASSEMBLER_TEST_GENERATE(IntToDoubleConversion, assembler) { if (TargetCPUFeatures::vfp_supported()) { __ mov(R3, Operand(6)); @@ -446,7 +411,6 @@ ASSEMBLER_TEST_GENERATE(IntToDoubleConversion, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(IntToDoubleConversion, test) { EXPECT(test != NULL); if (TargetCPUFeatures::vfp_supported()) { @@ -457,7 +421,6 @@ ASSEMBLER_TEST_RUN(IntToDoubleConversion, test) { } } - ASSEMBLER_TEST_GENERATE(LongToDoubleConversion, assembler) { if (TargetCPUFeatures::vfp_supported()) { int64_t value = 60000000000LL; @@ -473,7 +436,6 @@ ASSEMBLER_TEST_GENERATE(LongToDoubleConversion, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(LongToDoubleConversion, test) { EXPECT(test != NULL); if (TargetCPUFeatures::vfp_supported()) { @@ -484,7 +446,6 @@ ASSEMBLER_TEST_RUN(LongToDoubleConversion, test) { } } - ASSEMBLER_TEST_GENERATE(IntToFloatConversion, assembler) { if (TargetCPUFeatures::vfp_supported()) { __ mov(R3, Operand(6)); @@ -494,7 +455,6 @@ ASSEMBLER_TEST_GENERATE(IntToFloatConversion, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(IntToFloatConversion, test) { EXPECT(test != NULL); if (TargetCPUFeatures::vfp_supported()) { @@ -505,7 +465,6 @@ ASSEMBLER_TEST_RUN(IntToFloatConversion, test) { } } - ASSEMBLER_TEST_GENERATE(FloatToIntConversion, assembler) { if (TargetCPUFeatures::vfp_supported()) { __ vcvtis(S1, S0); @@ -514,7 +473,6 @@ ASSEMBLER_TEST_GENERATE(FloatToIntConversion, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(FloatToIntConversion, test) { EXPECT(test != NULL); if (TargetCPUFeatures::vfp_supported()) { @@ -528,7 +486,6 @@ ASSEMBLER_TEST_RUN(FloatToIntConversion, test) { } } - ASSEMBLER_TEST_GENERATE(DoubleToIntConversion, assembler) { if (TargetCPUFeatures::vfp_supported()) { __ vcvtid(S0, D0); @@ -537,7 +494,6 @@ ASSEMBLER_TEST_GENERATE(DoubleToIntConversion, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(DoubleToIntConversion, test) { if (TargetCPUFeatures::vfp_supported()) { typedef int (*DoubleToIntConversion)(double arg) DART_UNUSED; @@ -551,7 +507,6 @@ ASSEMBLER_TEST_RUN(DoubleToIntConversion, test) { } } - ASSEMBLER_TEST_GENERATE(FloatToDoubleConversion, assembler) { if (TargetCPUFeatures::vfp_supported()) { __ LoadSImmediate(S2, 12.8f); @@ -560,7 +515,6 @@ ASSEMBLER_TEST_GENERATE(FloatToDoubleConversion, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(FloatToDoubleConversion, test) { if (TargetCPUFeatures::vfp_supported()) { typedef double (*FloatToDoubleConversionCode)() DART_UNUSED; @@ -571,7 +525,6 @@ ASSEMBLER_TEST_RUN(FloatToDoubleConversion, test) { } } - ASSEMBLER_TEST_GENERATE(DoubleToFloatConversion, assembler) { if (TargetCPUFeatures::vfp_supported()) { __ LoadDImmediate(D1, 12.8, R0); @@ -580,7 +533,6 @@ ASSEMBLER_TEST_GENERATE(DoubleToFloatConversion, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(DoubleToFloatConversion, test) { EXPECT(test != NULL); if (TargetCPUFeatures::vfp_supported()) { @@ -591,7 +543,6 @@ ASSEMBLER_TEST_RUN(DoubleToFloatConversion, test) { } } - ASSEMBLER_TEST_GENERATE(FloatCompare, assembler) { if (TargetCPUFeatures::vfp_supported()) { // Test 12.3f vs 12.5f. @@ -620,7 +571,6 @@ ASSEMBLER_TEST_GENERATE(FloatCompare, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(FloatCompare, test) { EXPECT(test != NULL); if (TargetCPUFeatures::vfp_supported()) { @@ -629,7 +579,6 @@ ASSEMBLER_TEST_RUN(FloatCompare, test) { } } - ASSEMBLER_TEST_GENERATE(DoubleCompare, assembler) { if (TargetCPUFeatures::vfp_supported()) { // Test 12.3 vs 12.5. @@ -658,7 +607,6 @@ ASSEMBLER_TEST_GENERATE(DoubleCompare, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(DoubleCompare, test) { EXPECT(test != NULL); if (TargetCPUFeatures::vfp_supported()) { @@ -667,7 +615,6 @@ ASSEMBLER_TEST_RUN(DoubleCompare, test) { } } - ASSEMBLER_TEST_GENERATE(Loop, assembler) { Label loop_entry; __ mov(R0, Operand(1)); @@ -679,14 +626,12 @@ ASSEMBLER_TEST_GENERATE(Loop, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Loop, test) { EXPECT(test != NULL); typedef int (*Loop)() DART_UNUSED; EXPECT_EQ(4, EXECUTE_TEST_CODE_INT32(Loop, test->entry())); } - ASSEMBLER_TEST_GENERATE(ForwardBranch, assembler) { Label skip; __ mov(R0, Operand(42)); @@ -696,14 +641,12 @@ ASSEMBLER_TEST_GENERATE(ForwardBranch, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(ForwardBranch, test) { EXPECT(test != NULL); typedef int (*ForwardBranch)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(ForwardBranch, test->entry())); } - ASSEMBLER_TEST_GENERATE(Loop2, assembler) { Label loop_entry; __ set_use_far_branches(true); @@ -716,14 +659,12 @@ ASSEMBLER_TEST_GENERATE(Loop2, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Loop2, test) { EXPECT(test != NULL); typedef int (*Loop)() DART_UNUSED; EXPECT_EQ(4, EXECUTE_TEST_CODE_INT32(Loop, test->entry())); } - ASSEMBLER_TEST_GENERATE(Loop3, assembler) { Label loop_entry; __ set_use_far_branches(true); @@ -739,14 +680,12 @@ ASSEMBLER_TEST_GENERATE(Loop3, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Loop3, test) { EXPECT(test != NULL); typedef int (*Loop)() DART_UNUSED; EXPECT_EQ(4, EXECUTE_TEST_CODE_INT32(Loop, test->entry())); } - ASSEMBLER_TEST_GENERATE(LoadStore, assembler) { __ mov(R1, Operand(123)); __ Push(R1); @@ -754,14 +693,12 @@ ASSEMBLER_TEST_GENERATE(LoadStore, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(LoadStore, test) { EXPECT(test != NULL); typedef int (*LoadStore)() DART_UNUSED; EXPECT_EQ(123, EXECUTE_TEST_CODE_INT32(LoadStore, test->entry())); } - ASSEMBLER_TEST_GENERATE(Semaphore, assembler) { if (TargetCPUFeatures::arm_version() != ARMv5TE) { __ mov(R0, Operand(40)); @@ -778,7 +715,6 @@ ASSEMBLER_TEST_GENERATE(Semaphore, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Semaphore, test) { EXPECT(test != NULL); if (TargetCPUFeatures::arm_version() != ARMv5TE) { @@ -787,7 +723,6 @@ ASSEMBLER_TEST_RUN(Semaphore, test) { } } - ASSEMBLER_TEST_GENERATE(FailedSemaphore, assembler) { if (TargetCPUFeatures::arm_version() != ARMv5TE) { __ mov(R0, Operand(40)); @@ -802,7 +737,6 @@ ASSEMBLER_TEST_GENERATE(FailedSemaphore, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(FailedSemaphore, test) { EXPECT(test != NULL); if (TargetCPUFeatures::arm_version() != ARMv5TE) { @@ -811,7 +745,6 @@ ASSEMBLER_TEST_RUN(FailedSemaphore, test) { } } - ASSEMBLER_TEST_GENERATE(AddSub, assembler) { __ mov(R1, Operand(40)); __ sub(R1, R1, Operand(2)); @@ -821,14 +754,12 @@ ASSEMBLER_TEST_GENERATE(AddSub, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(AddSub, test) { EXPECT(test != NULL); typedef int (*AddSub)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(AddSub, test->entry())); } - ASSEMBLER_TEST_GENERATE(AddCarry, assembler) { __ LoadImmediate(R2, 0xFFFFFFFF); __ mov(R1, Operand(1)); @@ -838,14 +769,12 @@ ASSEMBLER_TEST_GENERATE(AddCarry, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(AddCarry, test) { EXPECT(test != NULL); typedef int (*AddCarry)() DART_UNUSED; EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(AddCarry, test->entry())); } - ASSEMBLER_TEST_GENERATE(AddCarryInOut, assembler) { __ LoadImmediate(R2, 0xFFFFFFFF); __ mov(R1, Operand(1)); @@ -856,14 +785,12 @@ ASSEMBLER_TEST_GENERATE(AddCarryInOut, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(AddCarryInOut, test) { EXPECT(test != NULL); typedef int (*AddCarryInOut)() DART_UNUSED; EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(AddCarryInOut, test->entry())); } - ASSEMBLER_TEST_GENERATE(SubCarry, assembler) { __ LoadImmediate(R2, 0x0); __ mov(R1, Operand(1)); @@ -873,14 +800,12 @@ ASSEMBLER_TEST_GENERATE(SubCarry, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(SubCarry, test) { EXPECT(test != NULL); typedef int (*SubCarry)() DART_UNUSED; EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT32(SubCarry, test->entry())); } - ASSEMBLER_TEST_GENERATE(SubCarryInOut, assembler) { __ mov(R1, Operand(1)); __ mov(R0, Operand(0)); @@ -890,14 +815,12 @@ ASSEMBLER_TEST_GENERATE(SubCarryInOut, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(SubCarryInOut, test) { EXPECT(test != NULL); typedef int (*SubCarryInOut)() DART_UNUSED; EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT32(SubCarryInOut, test->entry())); } - ASSEMBLER_TEST_GENERATE(Overflow, assembler) { __ LoadImmediate(R0, 0xFFFFFFFF); __ LoadImmediate(R1, 0x7FFFFFFF); @@ -907,14 +830,12 @@ ASSEMBLER_TEST_GENERATE(Overflow, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Overflow, test) { EXPECT(test != NULL); typedef int (*Overflow)() DART_UNUSED; EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(Overflow, test->entry())); } - ASSEMBLER_TEST_GENERATE(AndOrr, assembler) { __ mov(R1, Operand(40)); __ mov(R2, Operand(0)); @@ -924,14 +845,12 @@ ASSEMBLER_TEST_GENERATE(AndOrr, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(AndOrr, test) { EXPECT(test != NULL); typedef int (*AndOrr)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(AndOrr, test->entry())); } - ASSEMBLER_TEST_GENERATE(Orrs, assembler) { __ mov(R0, Operand(0)); __ tst(R0, Operand(R1)); // Set zero-flag. @@ -943,14 +862,12 @@ ASSEMBLER_TEST_GENERATE(Orrs, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Orrs, test) { EXPECT(test != NULL); typedef int (*Orrs)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Orrs, test->entry())); } - ASSEMBLER_TEST_GENERATE(Multiply, assembler) { __ mov(R1, Operand(20)); __ mov(R2, Operand(40)); @@ -959,14 +876,12 @@ ASSEMBLER_TEST_GENERATE(Multiply, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Multiply, test) { EXPECT(test != NULL); typedef int (*Multiply)() DART_UNUSED; EXPECT_EQ(800, EXECUTE_TEST_CODE_INT32(Multiply, test->entry())); } - ASSEMBLER_TEST_GENERATE(QuotientRemainder, assembler) { if (TargetCPUFeatures::vfp_supported()) { __ vmovsr(S2, R0); @@ -981,7 +896,6 @@ ASSEMBLER_TEST_GENERATE(QuotientRemainder, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(QuotientRemainder, test) { EXPECT(test != NULL); if (TargetCPUFeatures::vfp_supported()) { @@ -993,7 +907,6 @@ ASSEMBLER_TEST_RUN(QuotientRemainder, test) { } } - ASSEMBLER_TEST_GENERATE(Multiply64To64, assembler) { __ Push(R4); __ mov(IP, Operand(R0)); @@ -1005,7 +918,6 @@ ASSEMBLER_TEST_GENERATE(Multiply64To64, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Multiply64To64, test) { EXPECT(test != NULL); typedef int64_t (*Multiply64To64)(int64_t operand0, int64_t operand1) @@ -1014,13 +926,11 @@ ASSEMBLER_TEST_RUN(Multiply64To64, test) { EXECUTE_TEST_CODE_INT64_LL(Multiply64To64, test->entry(), -3, -2)); } - ASSEMBLER_TEST_GENERATE(Multiply32To64, assembler) { __ smull(R0, R1, R0, R2); __ bx(LR); } - ASSEMBLER_TEST_RUN(Multiply32To64, test) { EXPECT(test != NULL); typedef int64_t (*Multiply32To64)(int64_t operand0, int64_t operand1) @@ -1029,13 +939,11 @@ ASSEMBLER_TEST_RUN(Multiply32To64, test) { EXECUTE_TEST_CODE_INT64_LL(Multiply32To64, test->entry(), -3, -2)); } - ASSEMBLER_TEST_GENERATE(MultiplyAccumAccum32To64, assembler) { __ umaal(R0, R1, R2, R3); __ bx(LR); } - ASSEMBLER_TEST_RUN(MultiplyAccumAccum32To64, test) { EXPECT(test != NULL); typedef int64_t (*MultiplyAccumAccum32To64)(int64_t operand0, @@ -1045,7 +953,6 @@ ASSEMBLER_TEST_RUN(MultiplyAccumAccum32To64, test) { (3LL << 32) + 7, (5LL << 32) + 11)); } - ASSEMBLER_TEST_GENERATE(Clz, assembler) { Label error; @@ -1072,14 +979,12 @@ ASSEMBLER_TEST_GENERATE(Clz, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Clz, test) { EXPECT(test != NULL); typedef int (*Clz)() DART_UNUSED; EXPECT_EQ(0, EXECUTE_TEST_CODE_INT32(Clz, test->entry())); } - ASSEMBLER_TEST_GENERATE(Tst, assembler) { Label skip; @@ -1092,14 +997,12 @@ ASSEMBLER_TEST_GENERATE(Tst, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Tst, test) { EXPECT(test != NULL); typedef int (*Tst)() DART_UNUSED; EXPECT_EQ(0, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); } - ASSEMBLER_TEST_GENERATE(Lsl, assembler) { Label skip; @@ -1110,14 +1013,12 @@ ASSEMBLER_TEST_GENERATE(Lsl, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Lsl, test) { EXPECT(test != NULL); typedef int (*Tst)() DART_UNUSED; EXPECT_EQ(4, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); } - ASSEMBLER_TEST_GENERATE(Lsr, assembler) { Label skip; @@ -1128,14 +1029,12 @@ ASSEMBLER_TEST_GENERATE(Lsr, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Lsr, test) { EXPECT(test != NULL); typedef int (*Tst)() DART_UNUSED; EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); } - ASSEMBLER_TEST_GENERATE(Lsr1, assembler) { Label skip; @@ -1145,14 +1044,12 @@ ASSEMBLER_TEST_GENERATE(Lsr1, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Lsr1, test) { EXPECT(test != NULL); typedef int (*Tst)() DART_UNUSED; EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); } - ASSEMBLER_TEST_GENERATE(Asr1, assembler) { Label skip; @@ -1162,28 +1059,24 @@ ASSEMBLER_TEST_GENERATE(Asr1, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Asr1, test) { EXPECT(test != NULL); typedef int (*Tst)() DART_UNUSED; EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); } - ASSEMBLER_TEST_GENERATE(Rsb, assembler) { __ mov(R3, Operand(10)); __ rsb(R0, R3, Operand(42)); __ bx(LR); } - ASSEMBLER_TEST_RUN(Rsb, test) { EXPECT(test != NULL); typedef int (*Rsb)() DART_UNUSED; EXPECT_EQ(32, EXECUTE_TEST_CODE_INT32(Rsb, test->entry())); } - ASSEMBLER_TEST_GENERATE(Ldrh, assembler) { Label Test1, Test2, Test3, Done; @@ -1222,14 +1115,12 @@ ASSEMBLER_TEST_GENERATE(Ldrh, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Ldrh, test) { EXPECT(test != NULL); typedef int (*Tst)() DART_UNUSED; EXPECT_EQ(0, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); } - ASSEMBLER_TEST_GENERATE(Ldrsb, assembler) { __ mov(R1, Operand(0xFF)); __ mov(R2, Operand(SP)); @@ -1239,14 +1130,12 @@ ASSEMBLER_TEST_GENERATE(Ldrsb, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Ldrsb, test) { EXPECT(test != NULL); typedef int (*Tst)() DART_UNUSED; EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); } - ASSEMBLER_TEST_GENERATE(Ldrb, assembler) { __ mov(R1, Operand(0xFF)); __ mov(R2, Operand(SP)); @@ -1256,14 +1145,12 @@ ASSEMBLER_TEST_GENERATE(Ldrb, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Ldrb, test) { EXPECT(test != NULL); typedef int (*Tst)() DART_UNUSED; EXPECT_EQ(0xff, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); } - ASSEMBLER_TEST_GENERATE(Ldrsh, assembler) { __ mov(R1, Operand(0xFF)); __ mov(R2, Operand(SP)); @@ -1273,14 +1160,12 @@ ASSEMBLER_TEST_GENERATE(Ldrsh, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Ldrsh, test) { EXPECT(test != NULL); typedef int (*Tst)() DART_UNUSED; EXPECT_EQ(0xff, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); } - ASSEMBLER_TEST_GENERATE(Ldrh1, assembler) { __ mov(R1, Operand(0xFF)); __ mov(R2, Operand(SP)); @@ -1290,14 +1175,12 @@ ASSEMBLER_TEST_GENERATE(Ldrh1, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Ldrh1, test) { EXPECT(test != NULL); typedef int (*Tst)() DART_UNUSED; EXPECT_EQ(0xff, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); } - ASSEMBLER_TEST_GENERATE(Ldrd, assembler) { __ mov(IP, Operand(SP)); __ sub(SP, SP, Operand(kWordSize * 30)); @@ -1311,7 +1194,6 @@ ASSEMBLER_TEST_GENERATE(Ldrd, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Ldrd, test) { EXPECT(test != NULL); typedef int64_t (*Tst)(int64_t r0r1, int64_t r2r3) DART_UNUSED; @@ -1320,7 +1202,6 @@ ASSEMBLER_TEST_RUN(Ldrd, test) { 0x0000333300002222LL)); } - ASSEMBLER_TEST_GENERATE(Ldm_stm_da, assembler) { __ mov(R0, Operand(1)); __ mov(R1, Operand(7)); @@ -1356,14 +1237,12 @@ ASSEMBLER_TEST_GENERATE(Ldm_stm_da, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Ldm_stm_da, test) { EXPECT(test != NULL); typedef int (*Tst)() DART_UNUSED; EXPECT_EQ(-52, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); } - ASSEMBLER_TEST_GENERATE(AddressShiftStrLSL1NegOffset, assembler) { __ mov(R2, Operand(42)); __ mov(R1, Operand(kWordSize)); @@ -1372,14 +1251,12 @@ ASSEMBLER_TEST_GENERATE(AddressShiftStrLSL1NegOffset, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(AddressShiftStrLSL1NegOffset, test) { EXPECT(test != NULL); typedef int (*Tst)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); } - ASSEMBLER_TEST_GENERATE(AddressShiftLdrLSL5NegOffset, assembler) { __ mov(R2, Operand(42)); __ mov(R1, Operand(kWordSize)); @@ -1388,14 +1265,12 @@ ASSEMBLER_TEST_GENERATE(AddressShiftLdrLSL5NegOffset, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(AddressShiftLdrLSL5NegOffset, test) { EXPECT(test != NULL); typedef int (*Tst)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); } - ASSEMBLER_TEST_GENERATE(AddressShiftStrLRS1NegOffset, assembler) { __ mov(R2, Operand(42)); __ mov(R1, Operand(kWordSize * 2)); @@ -1404,14 +1279,12 @@ ASSEMBLER_TEST_GENERATE(AddressShiftStrLRS1NegOffset, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(AddressShiftStrLRS1NegOffset, test) { EXPECT(test != NULL); typedef int (*Tst)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); } - ASSEMBLER_TEST_GENERATE(AddressShiftLdrLRS1NegOffset, assembler) { __ mov(R2, Operand(42)); __ mov(R1, Operand(kWordSize * 2)); @@ -1420,14 +1293,12 @@ ASSEMBLER_TEST_GENERATE(AddressShiftLdrLRS1NegOffset, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(AddressShiftLdrLRS1NegOffset, test) { EXPECT(test != NULL); typedef int (*Tst)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); } - ASSEMBLER_TEST_GENERATE(AddressShiftStrLSLNegPreIndex, assembler) { __ mov(R2, Operand(42)); __ mov(R1, Operand(kWordSize)); @@ -1438,14 +1309,12 @@ ASSEMBLER_TEST_GENERATE(AddressShiftStrLSLNegPreIndex, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(AddressShiftStrLSLNegPreIndex, test) { EXPECT(test != NULL); typedef int (*Tst)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); } - ASSEMBLER_TEST_GENERATE(AddressShiftLdrLSLNegPreIndex, assembler) { __ mov(R2, Operand(42)); __ mov(R1, Operand(kWordSize)); @@ -1454,14 +1323,12 @@ ASSEMBLER_TEST_GENERATE(AddressShiftLdrLSLNegPreIndex, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(AddressShiftLdrLSLNegPreIndex, test) { EXPECT(test != NULL); typedef int (*Tst)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); } - // Make sure we can store and reload the D registers using vstmd and vldmd ASSEMBLER_TEST_GENERATE(VstmdVldmd, assembler) { if (TargetCPUFeatures::vfp_supported()) { @@ -1493,7 +1360,6 @@ ASSEMBLER_TEST_GENERATE(VstmdVldmd, assembler) { __ vmstat(); __ mov(R0, Operand(0), NE); // Put failure into R0 if NE - // Check that 2.0 is back in D2 __ LoadDImmediate(D5, 2.0, R1); __ vcmpd(D2, D5); @@ -1509,7 +1375,6 @@ ASSEMBLER_TEST_GENERATE(VstmdVldmd, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(VstmdVldmd, test) { EXPECT(test != NULL); if (TargetCPUFeatures::vfp_supported()) { @@ -1518,7 +1383,6 @@ ASSEMBLER_TEST_RUN(VstmdVldmd, test) { } } - // Make sure we can store and reload the S registers using vstms and vldms ASSEMBLER_TEST_GENERATE(VstmsVldms, assembler) { if (TargetCPUFeatures::vfp_supported()) { @@ -1565,7 +1429,6 @@ ASSEMBLER_TEST_GENERATE(VstmsVldms, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(VstmsVldms, test) { EXPECT(test != NULL); if (TargetCPUFeatures::vfp_supported()) { @@ -1574,7 +1437,6 @@ ASSEMBLER_TEST_RUN(VstmsVldms, test) { } } - // Make sure we can start somewhere other than D0 ASSEMBLER_TEST_GENERATE(VstmdVldmd1, assembler) { if (TargetCPUFeatures::vfp_supported()) { @@ -1604,7 +1466,6 @@ ASSEMBLER_TEST_GENERATE(VstmdVldmd1, assembler) { __ vmstat(); __ mov(R0, Operand(0), NE); // Put failure into R0 if NE - // Check that 2.0 is back in D2 __ LoadDImmediate(D5, 2.0, R1); __ vcmpd(D2, D5); @@ -1620,7 +1481,6 @@ ASSEMBLER_TEST_GENERATE(VstmdVldmd1, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(VstmdVldmd1, test) { EXPECT(test != NULL); if (TargetCPUFeatures::vfp_supported()) { @@ -1629,7 +1489,6 @@ ASSEMBLER_TEST_RUN(VstmdVldmd1, test) { } } - // Make sure we can start somewhere other than S0 ASSEMBLER_TEST_GENERATE(VstmsVldms1, assembler) { if (TargetCPUFeatures::vfp_supported()) { @@ -1674,7 +1533,6 @@ ASSEMBLER_TEST_GENERATE(VstmsVldms1, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(VstmsVldms1, test) { EXPECT(test != NULL); if (TargetCPUFeatures::vfp_supported()) { @@ -1683,7 +1541,6 @@ ASSEMBLER_TEST_RUN(VstmsVldms1, test) { } } - // Make sure we can store the D registers using vstmd and // load them into a different set using vldmd ASSEMBLER_TEST_GENERATE(VstmdVldmd_off, assembler) { @@ -1714,7 +1571,6 @@ ASSEMBLER_TEST_GENERATE(VstmdVldmd_off, assembler) { __ vmstat(); __ mov(R0, Operand(0), NE); // Put failure into R0 if NE - // Check that 2.0 is in D7 __ LoadDImmediate(D10, 2.0, R1); __ vcmpd(D7, D10); @@ -1739,7 +1595,6 @@ ASSEMBLER_TEST_GENERATE(VstmdVldmd_off, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(VstmdVldmd_off, test) { EXPECT(test != NULL); if (TargetCPUFeatures::vfp_supported()) { @@ -1748,7 +1603,6 @@ ASSEMBLER_TEST_RUN(VstmdVldmd_off, test) { } } - // Make sure we can start somewhere other than S0 ASSEMBLER_TEST_GENERATE(VstmsVldms_off, assembler) { if (TargetCPUFeatures::vfp_supported()) { @@ -1797,7 +1651,6 @@ ASSEMBLER_TEST_GENERATE(VstmsVldms_off, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(VstmsVldms_off, test) { EXPECT(test != NULL); if (TargetCPUFeatures::vfp_supported()) { @@ -1806,7 +1659,6 @@ ASSEMBLER_TEST_RUN(VstmsVldms_off, test) { } } - ASSEMBLER_TEST_GENERATE(Udiv, assembler) { if (TargetCPUFeatures::integer_division_supported()) { __ mov(R0, Operand(27)); @@ -1817,7 +1669,6 @@ ASSEMBLER_TEST_GENERATE(Udiv, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Udiv, test) { EXPECT(test != NULL); if (TargetCPUFeatures::integer_division_supported()) { @@ -1826,7 +1677,6 @@ ASSEMBLER_TEST_RUN(Udiv, test) { } } - ASSEMBLER_TEST_GENERATE(Sdiv, assembler) { if (TargetCPUFeatures::integer_division_supported()) { __ mov(R0, Operand(27)); @@ -1837,7 +1687,6 @@ ASSEMBLER_TEST_GENERATE(Sdiv, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Sdiv, test) { EXPECT(test != NULL); if (TargetCPUFeatures::integer_division_supported()) { @@ -1846,7 +1695,6 @@ ASSEMBLER_TEST_RUN(Sdiv, test) { } } - ASSEMBLER_TEST_GENERATE(Udiv_zero, assembler) { if (TargetCPUFeatures::integer_division_supported()) { __ mov(R0, Operand(27)); @@ -1857,7 +1705,6 @@ ASSEMBLER_TEST_GENERATE(Udiv_zero, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Udiv_zero, test) { EXPECT(test != NULL); if (TargetCPUFeatures::integer_division_supported()) { @@ -1866,7 +1713,6 @@ ASSEMBLER_TEST_RUN(Udiv_zero, test) { } } - ASSEMBLER_TEST_GENERATE(Sdiv_zero, assembler) { if (TargetCPUFeatures::integer_division_supported()) { __ mov(R0, Operand(27)); @@ -1877,7 +1723,6 @@ ASSEMBLER_TEST_GENERATE(Sdiv_zero, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Sdiv_zero, test) { EXPECT(test != NULL); if (TargetCPUFeatures::integer_division_supported()) { @@ -1886,7 +1731,6 @@ ASSEMBLER_TEST_RUN(Sdiv_zero, test) { } } - ASSEMBLER_TEST_GENERATE(Udiv_corner, assembler) { if (TargetCPUFeatures::integer_division_supported()) { __ LoadImmediate(R0, 0x80000000); @@ -1897,7 +1741,6 @@ ASSEMBLER_TEST_GENERATE(Udiv_corner, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Udiv_corner, test) { EXPECT(test != NULL); if (TargetCPUFeatures::integer_division_supported()) { @@ -1906,7 +1749,6 @@ ASSEMBLER_TEST_RUN(Udiv_corner, test) { } } - ASSEMBLER_TEST_GENERATE(Sdiv_corner, assembler) { if (TargetCPUFeatures::integer_division_supported()) { __ LoadImmediate(R0, 0x80000000); @@ -1917,7 +1759,6 @@ ASSEMBLER_TEST_GENERATE(Sdiv_corner, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Sdiv_corner, test) { EXPECT(test != NULL); if (TargetCPUFeatures::integer_division_supported()) { @@ -1927,7 +1768,6 @@ ASSEMBLER_TEST_RUN(Sdiv_corner, test) { } } - ASSEMBLER_TEST_GENERATE(IntDiv_supported, assembler) { #if defined(USING_SIMULATOR) bool orig = TargetCPUFeatures::integer_division_supported(); @@ -1947,7 +1787,6 @@ ASSEMBLER_TEST_GENERATE(IntDiv_supported, assembler) { #endif } - ASSEMBLER_TEST_RUN(IntDiv_supported, test) { EXPECT(test != NULL); #if defined(USING_SIMULATOR) @@ -1966,7 +1805,6 @@ ASSEMBLER_TEST_RUN(IntDiv_supported, test) { #endif } - ASSEMBLER_TEST_GENERATE(IntDiv_unsupported, assembler) { #if defined(USING_SIMULATOR) if (TargetCPUFeatures::can_divide()) { @@ -1988,7 +1826,6 @@ ASSEMBLER_TEST_GENERATE(IntDiv_unsupported, assembler) { #endif } - ASSEMBLER_TEST_RUN(IntDiv_unsupported, test) { EXPECT(test != NULL); #if defined(USING_SIMULATOR) @@ -2007,7 +1844,6 @@ ASSEMBLER_TEST_RUN(IntDiv_unsupported, test) { #endif } - ASSEMBLER_TEST_GENERATE(Muls, assembler) { __ mov(R0, Operand(3)); __ LoadImmediate(R1, -9); @@ -2016,14 +1852,12 @@ ASSEMBLER_TEST_GENERATE(Muls, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Muls, test) { EXPECT(test != NULL); typedef int (*Tst)() DART_UNUSED; EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); } - ASSEMBLER_TEST_GENERATE(Vaddqi8, assembler) { if (TargetCPUFeatures::neon_supported()) { __ mov(R0, Operand(1)); @@ -2057,7 +1891,6 @@ ASSEMBLER_TEST_GENERATE(Vaddqi8, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vaddqi8, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -2066,7 +1899,6 @@ ASSEMBLER_TEST_RUN(Vaddqi8, test) { } } - ASSEMBLER_TEST_GENERATE(Vaddqi16, assembler) { if (TargetCPUFeatures::neon_supported()) { __ mov(R0, Operand(1)); @@ -2100,7 +1932,6 @@ ASSEMBLER_TEST_GENERATE(Vaddqi16, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vaddqi16, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -2109,7 +1940,6 @@ ASSEMBLER_TEST_RUN(Vaddqi16, test) { } } - ASSEMBLER_TEST_GENERATE(Vaddqi32, assembler) { if (TargetCPUFeatures::neon_supported()) { __ mov(R0, Operand(1)); @@ -2143,7 +1973,6 @@ ASSEMBLER_TEST_GENERATE(Vaddqi32, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vaddqi32, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -2152,7 +1981,6 @@ ASSEMBLER_TEST_RUN(Vaddqi32, test) { } } - ASSEMBLER_TEST_GENERATE(Vaddqi64, assembler) { if (TargetCPUFeatures::neon_supported()) { __ mov(R0, Operand(1)); @@ -2174,7 +2002,6 @@ ASSEMBLER_TEST_GENERATE(Vaddqi64, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vaddqi64, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -2183,7 +2010,6 @@ ASSEMBLER_TEST_RUN(Vaddqi64, test) { } } - ASSEMBLER_TEST_GENERATE(Vshlqu64, assembler) { if (TargetCPUFeatures::neon_supported()) { Label fail; @@ -2211,7 +2037,6 @@ ASSEMBLER_TEST_GENERATE(Vshlqu64, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vshlqu64, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -2220,7 +2045,6 @@ ASSEMBLER_TEST_RUN(Vshlqu64, test) { } } - ASSEMBLER_TEST_GENERATE(Vshlqi64, assembler) { if (TargetCPUFeatures::neon_supported()) { Label fail; @@ -2248,7 +2072,6 @@ ASSEMBLER_TEST_GENERATE(Vshlqi64, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vshlqi64, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -2257,7 +2080,6 @@ ASSEMBLER_TEST_RUN(Vshlqi64, test) { } } - ASSEMBLER_TEST_GENERATE(Mint_shl_ok, assembler) { if (TargetCPUFeatures::neon_supported()) { const QRegister value = Q0; @@ -2305,7 +2127,6 @@ ASSEMBLER_TEST_GENERATE(Mint_shl_ok, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Mint_shl_ok, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -2314,7 +2135,6 @@ ASSEMBLER_TEST_RUN(Mint_shl_ok, test) { } } - ASSEMBLER_TEST_GENERATE(Mint_shl_overflow, assembler) { if (TargetCPUFeatures::neon_supported()) { const QRegister value = Q0; @@ -2362,7 +2182,6 @@ ASSEMBLER_TEST_GENERATE(Mint_shl_overflow, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Mint_shl_overflow, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -2371,7 +2190,6 @@ ASSEMBLER_TEST_RUN(Mint_shl_overflow, test) { } } - ASSEMBLER_TEST_GENERATE(Vsubqi8, assembler) { if (TargetCPUFeatures::neon_supported()) { __ mov(R0, Operand(1)); @@ -2405,7 +2223,6 @@ ASSEMBLER_TEST_GENERATE(Vsubqi8, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vsubqi8, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -2414,7 +2231,6 @@ ASSEMBLER_TEST_RUN(Vsubqi8, test) { } } - ASSEMBLER_TEST_GENERATE(Vsubqi16, assembler) { if (TargetCPUFeatures::neon_supported()) { __ mov(R0, Operand(1)); @@ -2448,7 +2264,6 @@ ASSEMBLER_TEST_GENERATE(Vsubqi16, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vsubqi16, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -2457,7 +2272,6 @@ ASSEMBLER_TEST_RUN(Vsubqi16, test) { } } - ASSEMBLER_TEST_GENERATE(Vsubqi32, assembler) { if (TargetCPUFeatures::neon_supported()) { __ mov(R0, Operand(1)); @@ -2491,7 +2305,6 @@ ASSEMBLER_TEST_GENERATE(Vsubqi32, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vsubqi32, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -2500,7 +2313,6 @@ ASSEMBLER_TEST_RUN(Vsubqi32, test) { } } - ASSEMBLER_TEST_GENERATE(Vsubqi64, assembler) { if (TargetCPUFeatures::neon_supported()) { __ mov(R0, Operand(1)); @@ -2522,7 +2334,6 @@ ASSEMBLER_TEST_GENERATE(Vsubqi64, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vsubqi64, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -2531,7 +2342,6 @@ ASSEMBLER_TEST_RUN(Vsubqi64, test) { } } - ASSEMBLER_TEST_GENERATE(Vmulqi8, assembler) { if (TargetCPUFeatures::neon_supported()) { __ mov(R0, Operand(1)); @@ -2565,7 +2375,6 @@ ASSEMBLER_TEST_GENERATE(Vmulqi8, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vmulqi8, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -2574,7 +2383,6 @@ ASSEMBLER_TEST_RUN(Vmulqi8, test) { } } - ASSEMBLER_TEST_GENERATE(Vmulqi16, assembler) { if (TargetCPUFeatures::neon_supported()) { __ mov(R0, Operand(1)); @@ -2608,7 +2416,6 @@ ASSEMBLER_TEST_GENERATE(Vmulqi16, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vmulqi16, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -2617,7 +2424,6 @@ ASSEMBLER_TEST_RUN(Vmulqi16, test) { } } - ASSEMBLER_TEST_GENERATE(Vmulqi32, assembler) { if (TargetCPUFeatures::neon_supported()) { __ mov(R0, Operand(1)); @@ -2651,7 +2457,6 @@ ASSEMBLER_TEST_GENERATE(Vmulqi32, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vmulqi32, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -2660,7 +2465,6 @@ ASSEMBLER_TEST_RUN(Vmulqi32, test) { } } - ASSEMBLER_TEST_GENERATE(Vaddqs, assembler) { if (TargetCPUFeatures::neon_supported()) { __ LoadSImmediate(S0, 1.0); @@ -2684,7 +2488,6 @@ ASSEMBLER_TEST_GENERATE(Vaddqs, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vaddqs, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -2693,7 +2496,6 @@ ASSEMBLER_TEST_RUN(Vaddqs, test) { } } - ASSEMBLER_TEST_GENERATE(Vsubqs, assembler) { if (TargetCPUFeatures::neon_supported()) { __ LoadSImmediate(S0, 1.0); @@ -2717,7 +2519,6 @@ ASSEMBLER_TEST_GENERATE(Vsubqs, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vsubqs, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -2726,7 +2527,6 @@ ASSEMBLER_TEST_RUN(Vsubqs, test) { } } - ASSEMBLER_TEST_GENERATE(Vmulqs, assembler) { if (TargetCPUFeatures::neon_supported()) { __ LoadSImmediate(S0, 1.0); @@ -2750,7 +2550,6 @@ ASSEMBLER_TEST_GENERATE(Vmulqs, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vmulqs, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -2759,7 +2558,6 @@ ASSEMBLER_TEST_RUN(Vmulqs, test) { } } - ASSEMBLER_TEST_GENERATE(VtblX, assembler) { if (TargetCPUFeatures::neon_supported()) { // Index. @@ -2792,7 +2590,6 @@ ASSEMBLER_TEST_GENERATE(VtblX, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(VtblX, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -2801,7 +2598,6 @@ ASSEMBLER_TEST_RUN(VtblX, test) { } } - ASSEMBLER_TEST_GENERATE(VtblY, assembler) { if (TargetCPUFeatures::neon_supported()) { // Index. @@ -2834,7 +2630,6 @@ ASSEMBLER_TEST_GENERATE(VtblY, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(VtblY, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -2843,7 +2638,6 @@ ASSEMBLER_TEST_RUN(VtblY, test) { } } - ASSEMBLER_TEST_GENERATE(VtblZ, assembler) { if (TargetCPUFeatures::neon_supported()) { // Index. @@ -2876,7 +2670,6 @@ ASSEMBLER_TEST_GENERATE(VtblZ, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(VtblZ, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -2885,7 +2678,6 @@ ASSEMBLER_TEST_RUN(VtblZ, test) { } } - ASSEMBLER_TEST_GENERATE(VtblW, assembler) { if (TargetCPUFeatures::neon_supported()) { // Index. @@ -2918,7 +2710,6 @@ ASSEMBLER_TEST_GENERATE(VtblW, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(VtblW, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -2927,7 +2718,6 @@ ASSEMBLER_TEST_RUN(VtblW, test) { } } - ASSEMBLER_TEST_GENERATE(Veorq, assembler) { if (TargetCPUFeatures::neon_supported()) { // Q0 @@ -2959,7 +2749,6 @@ ASSEMBLER_TEST_GENERATE(Veorq, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Veorq, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -2968,7 +2757,6 @@ ASSEMBLER_TEST_RUN(Veorq, test) { } } - ASSEMBLER_TEST_GENERATE(Vornq, assembler) { if (TargetCPUFeatures::neon_supported()) { // Q0 @@ -3000,7 +2788,6 @@ ASSEMBLER_TEST_GENERATE(Vornq, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vornq, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3009,7 +2796,6 @@ ASSEMBLER_TEST_RUN(Vornq, test) { } } - ASSEMBLER_TEST_GENERATE(Vorrq, assembler) { if (TargetCPUFeatures::neon_supported()) { // Q0 @@ -3041,7 +2827,6 @@ ASSEMBLER_TEST_GENERATE(Vorrq, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vorrq, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3050,7 +2835,6 @@ ASSEMBLER_TEST_RUN(Vorrq, test) { } } - ASSEMBLER_TEST_GENERATE(Vandq, assembler) { if (TargetCPUFeatures::neon_supported()) { // Q0 @@ -3082,7 +2866,6 @@ ASSEMBLER_TEST_GENERATE(Vandq, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vandq, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3091,7 +2874,6 @@ ASSEMBLER_TEST_RUN(Vandq, test) { } } - ASSEMBLER_TEST_GENERATE(Vmovq, assembler) { if (TargetCPUFeatures::neon_supported()) { // Q0 @@ -3118,7 +2900,6 @@ ASSEMBLER_TEST_GENERATE(Vmovq, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vmovq, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3127,7 +2908,6 @@ ASSEMBLER_TEST_RUN(Vmovq, test) { } } - ASSEMBLER_TEST_GENERATE(Vmvnq, assembler) { if (TargetCPUFeatures::neon_supported()) { __ LoadImmediate(R1, 42); // R1 <- 42. @@ -3139,7 +2919,6 @@ ASSEMBLER_TEST_GENERATE(Vmvnq, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vmvnq, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3148,7 +2927,6 @@ ASSEMBLER_TEST_RUN(Vmvnq, test) { } } - ASSEMBLER_TEST_GENERATE(Vdupb, assembler) { if (TargetCPUFeatures::neon_supported()) { __ LoadImmediate(R0, 0x00000000); @@ -3171,7 +2949,6 @@ ASSEMBLER_TEST_GENERATE(Vdupb, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vdupb, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3180,7 +2957,6 @@ ASSEMBLER_TEST_RUN(Vdupb, test) { } } - ASSEMBLER_TEST_GENERATE(Vduph, assembler) { if (TargetCPUFeatures::neon_supported()) { __ LoadImmediate(R0, 0xffff0000); @@ -3203,7 +2979,6 @@ ASSEMBLER_TEST_GENERATE(Vduph, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vduph, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3212,7 +2987,6 @@ ASSEMBLER_TEST_RUN(Vduph, test) { } } - ASSEMBLER_TEST_GENERATE(Vdupw, assembler) { if (TargetCPUFeatures::neon_supported()) { __ LoadImmediate(R0, 0x00000000); @@ -3235,7 +3009,6 @@ ASSEMBLER_TEST_GENERATE(Vdupw, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vdupw, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3244,7 +3017,6 @@ ASSEMBLER_TEST_RUN(Vdupw, test) { } } - ASSEMBLER_TEST_GENERATE(Vzipqw, assembler) { if (TargetCPUFeatures::neon_supported()) { __ LoadSImmediate(S0, 0.0); @@ -3267,7 +3039,6 @@ ASSEMBLER_TEST_GENERATE(Vzipqw, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vzipqw, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3277,7 +3048,6 @@ ASSEMBLER_TEST_RUN(Vzipqw, test) { } } - ASSEMBLER_TEST_GENERATE(Vceqqi32, assembler) { if (TargetCPUFeatures::neon_supported()) { __ mov(R0, Operand(1)); @@ -3311,7 +3081,6 @@ ASSEMBLER_TEST_GENERATE(Vceqqi32, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vceqqi32, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3320,7 +3089,6 @@ ASSEMBLER_TEST_RUN(Vceqqi32, test) { } } - ASSEMBLER_TEST_GENERATE(Vceqqs, assembler) { if (TargetCPUFeatures::neon_supported()) { __ LoadSImmediate(S0, 1.0); @@ -3346,7 +3114,6 @@ ASSEMBLER_TEST_GENERATE(Vceqqs, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vceqqs, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3355,7 +3122,6 @@ ASSEMBLER_TEST_RUN(Vceqqs, test) { } } - ASSEMBLER_TEST_GENERATE(Vcgeqi32, assembler) { if (TargetCPUFeatures::neon_supported()) { __ mov(R0, Operand(1)); @@ -3389,7 +3155,6 @@ ASSEMBLER_TEST_GENERATE(Vcgeqi32, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vcgeqi32, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3398,7 +3163,6 @@ ASSEMBLER_TEST_RUN(Vcgeqi32, test) { } } - ASSEMBLER_TEST_GENERATE(Vcugeqi32, assembler) { if (TargetCPUFeatures::neon_supported()) { __ mov(R0, Operand(1)); @@ -3432,7 +3196,6 @@ ASSEMBLER_TEST_GENERATE(Vcugeqi32, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vcugeqi32, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3441,7 +3204,6 @@ ASSEMBLER_TEST_RUN(Vcugeqi32, test) { } } - ASSEMBLER_TEST_GENERATE(Vcgeqs, assembler) { if (TargetCPUFeatures::neon_supported()) { __ LoadSImmediate(S0, 1.0); @@ -3467,7 +3229,6 @@ ASSEMBLER_TEST_GENERATE(Vcgeqs, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vcgeqs, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3476,7 +3237,6 @@ ASSEMBLER_TEST_RUN(Vcgeqs, test) { } } - ASSEMBLER_TEST_GENERATE(Vcgtqi32, assembler) { if (TargetCPUFeatures::neon_supported()) { __ mov(R0, Operand(1)); @@ -3510,7 +3270,6 @@ ASSEMBLER_TEST_GENERATE(Vcgtqi32, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vcgtqi32, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3519,7 +3278,6 @@ ASSEMBLER_TEST_RUN(Vcgtqi32, test) { } } - ASSEMBLER_TEST_GENERATE(Vcugtqi32, assembler) { if (TargetCPUFeatures::neon_supported()) { __ mov(R0, Operand(1)); @@ -3553,7 +3311,6 @@ ASSEMBLER_TEST_GENERATE(Vcugtqi32, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vcugtqi32, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3562,7 +3319,6 @@ ASSEMBLER_TEST_RUN(Vcugtqi32, test) { } } - ASSEMBLER_TEST_GENERATE(Vcgtqs, assembler) { if (TargetCPUFeatures::neon_supported()) { __ LoadSImmediate(S0, 1.0); @@ -3588,7 +3344,6 @@ ASSEMBLER_TEST_GENERATE(Vcgtqs, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vcgtqs, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3597,7 +3352,6 @@ ASSEMBLER_TEST_RUN(Vcgtqs, test) { } } - ASSEMBLER_TEST_GENERATE(Vminqs, assembler) { if (TargetCPUFeatures::neon_supported()) { __ LoadSImmediate(S0, 1.0); @@ -3622,7 +3376,6 @@ ASSEMBLER_TEST_GENERATE(Vminqs, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vminqs, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3631,7 +3384,6 @@ ASSEMBLER_TEST_RUN(Vminqs, test) { } } - ASSEMBLER_TEST_GENERATE(Vmaxqs, assembler) { if (TargetCPUFeatures::neon_supported()) { __ LoadSImmediate(S0, 1.0); @@ -3656,7 +3408,6 @@ ASSEMBLER_TEST_GENERATE(Vmaxqs, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vmaxqs, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3665,7 +3416,6 @@ ASSEMBLER_TEST_RUN(Vmaxqs, test) { } } - // This is the same function as in the Simulator. static float arm_recip_estimate(float a) { // From the ARM Architecture Reference Manual A2-85. @@ -3703,7 +3453,6 @@ static float arm_recip_estimate(float a) { return bit_cast(result_bits); } - ASSEMBLER_TEST_GENERATE(Vrecpeqs, assembler) { if (TargetCPUFeatures::neon_supported()) { __ LoadSImmediate(S4, 147.0); @@ -3715,7 +3464,6 @@ ASSEMBLER_TEST_GENERATE(Vrecpeqs, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vrecpeqs, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3725,7 +3473,6 @@ ASSEMBLER_TEST_RUN(Vrecpeqs, test) { } } - ASSEMBLER_TEST_GENERATE(Vrecpsqs, assembler) { if (TargetCPUFeatures::neon_supported()) { __ LoadSImmediate(S4, 5.0); @@ -3743,7 +3490,6 @@ ASSEMBLER_TEST_GENERATE(Vrecpsqs, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vrecpsqs, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3753,7 +3499,6 @@ ASSEMBLER_TEST_RUN(Vrecpsqs, test) { } } - ASSEMBLER_TEST_GENERATE(Reciprocal, assembler) { if (TargetCPUFeatures::neon_supported()) { __ LoadSImmediate(S4, 147000.0); @@ -3772,7 +3517,6 @@ ASSEMBLER_TEST_GENERATE(Reciprocal, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Reciprocal, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3782,7 +3526,6 @@ ASSEMBLER_TEST_RUN(Reciprocal, test) { } } - static float arm_reciprocal_sqrt_estimate(float a) { // From the ARM Architecture Reference Manual A2-87. if (isinf(a) || (fabs(a) >= exp2f(126))) @@ -3837,7 +3580,6 @@ static float arm_reciprocal_sqrt_estimate(float a) { return bit_cast(result_bits); } - ASSEMBLER_TEST_GENERATE(Vrsqrteqs, assembler) { if (TargetCPUFeatures::neon_supported()) { __ LoadSImmediate(S4, 147.0); @@ -3850,7 +3592,6 @@ ASSEMBLER_TEST_GENERATE(Vrsqrteqs, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vrsqrteqs, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3860,7 +3601,6 @@ ASSEMBLER_TEST_RUN(Vrsqrteqs, test) { } } - ASSEMBLER_TEST_GENERATE(Vrsqrtsqs, assembler) { if (TargetCPUFeatures::neon_supported()) { __ LoadSImmediate(S4, 5.0); @@ -3878,7 +3618,6 @@ ASSEMBLER_TEST_GENERATE(Vrsqrtsqs, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vrsqrtsqs, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3888,7 +3627,6 @@ ASSEMBLER_TEST_RUN(Vrsqrtsqs, test) { } } - ASSEMBLER_TEST_GENERATE(ReciprocalSqrt, assembler) { if (TargetCPUFeatures::neon_supported()) { __ LoadSImmediate(S4, 147000.0); @@ -3911,7 +3649,6 @@ ASSEMBLER_TEST_GENERATE(ReciprocalSqrt, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(ReciprocalSqrt, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3921,7 +3658,6 @@ ASSEMBLER_TEST_RUN(ReciprocalSqrt, test) { } } - ASSEMBLER_TEST_GENERATE(SIMDSqrt, assembler) { if (TargetCPUFeatures::neon_supported()) { __ LoadSImmediate(S4, 147000.0); @@ -3954,7 +3690,6 @@ ASSEMBLER_TEST_GENERATE(SIMDSqrt, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(SIMDSqrt, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -3964,7 +3699,6 @@ ASSEMBLER_TEST_RUN(SIMDSqrt, test) { } } - ASSEMBLER_TEST_GENERATE(SIMDSqrt2, assembler) { if (TargetCPUFeatures::neon_supported()) { __ LoadSImmediate(S4, 1.0); @@ -4001,7 +3735,6 @@ ASSEMBLER_TEST_GENERATE(SIMDSqrt2, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(SIMDSqrt2, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -4011,7 +3744,6 @@ ASSEMBLER_TEST_RUN(SIMDSqrt2, test) { } } - ASSEMBLER_TEST_GENERATE(SIMDDiv, assembler) { if (TargetCPUFeatures::neon_supported()) { __ LoadSImmediate(S4, 1.0); @@ -4040,7 +3772,6 @@ ASSEMBLER_TEST_GENERATE(SIMDDiv, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(SIMDDiv, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -4050,7 +3781,6 @@ ASSEMBLER_TEST_RUN(SIMDDiv, test) { } } - ASSEMBLER_TEST_GENERATE(Vabsqs, assembler) { if (TargetCPUFeatures::neon_supported()) { __ LoadSImmediate(S4, 1.0); @@ -4067,7 +3797,6 @@ ASSEMBLER_TEST_GENERATE(Vabsqs, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vabsqs, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -4077,7 +3806,6 @@ ASSEMBLER_TEST_RUN(Vabsqs, test) { } } - ASSEMBLER_TEST_GENERATE(Vnegqs, assembler) { if (TargetCPUFeatures::neon_supported()) { __ LoadSImmediate(S4, 1.0); @@ -4094,7 +3822,6 @@ ASSEMBLER_TEST_GENERATE(Vnegqs, assembler) { __ bx(LR); } - ASSEMBLER_TEST_RUN(Vnegqs, test) { EXPECT(test != NULL); if (TargetCPUFeatures::neon_supported()) { @@ -4104,7 +3831,6 @@ ASSEMBLER_TEST_RUN(Vnegqs, test) { } } - // Called from assembler_test.cc. // LR: return address. // R0: value. diff --git a/runtime/vm/assembler_dbc.cc b/runtime/vm/assembler_dbc.cc index 73beb06750f..96600005f6a 100644 --- a/runtime/vm/assembler_dbc.cc +++ b/runtime/vm/assembler_dbc.cc @@ -31,7 +31,6 @@ void Assembler::InitializeMemoryWithBreakpoints(uword data, intptr_t length) { Emit(Bytecode::FENCODE_##Signature(Bytecode::k##Name ENCODE_##Signature)); \ } - #define PARAMS_0 #define PARAMS_A_D uintptr_t ra, uintptr_t rd #define PARAMS_D uintptr_t rd @@ -59,34 +58,27 @@ void Assembler::InitializeMemoryWithBreakpoints(uword data, intptr_t length) { #define FENCODE_A_X EncodeSigned #define FENCODE_X EncodeSigned - BYTECODES_LIST(DEFINE_EMIT) - #undef DEFINE_EMIT - void Assembler::Emit(int32_t value) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); buffer_.Emit(value); } - const char* Assembler::RegisterName(Register reg) { return Thread::Current()->zone()->PrintToString("R%d", reg); } - static int32_t EncodeJump(int32_t relative_pc) { return Bytecode::kJump | (relative_pc << 8); } - static int32_t OffsetToPC(int32_t offset) { return offset >> 2; } - void Assembler::Jump(Label* label) { if (label->IsBound()) { Emit(EncodeJump(OffsetToPC(label->Position() - buffer_.Size()))); @@ -97,7 +89,6 @@ void Assembler::Jump(Label* label) { } } - void Assembler::Bind(Label* label) { ASSERT(!label->IsBound()); ASSERT(!label->IsBound()); @@ -112,28 +103,23 @@ void Assembler::Bind(Label* label) { label->BindTo(bound_pc); } - void Assembler::Stop(const char* message) { // TODO(vegorov) support passing a message to the bytecode. Emit(Bytecode::kTrap); } - void Assembler::PushConstant(const Object& obj) { PushConstant(AddConstant(obj)); } - void Assembler::LoadConstant(uintptr_t ra, const Object& obj) { LoadConstant(ra, AddConstant(obj)); } - intptr_t Assembler::AddConstant(const Object& obj) { return object_pool_wrapper().FindObject(Object::ZoneHandle(obj.raw())); } - } // namespace dart #endif // defined TARGET_ARCH_DBC diff --git a/runtime/vm/assembler_dbc.h b/runtime/vm/assembler_dbc.h index dbe821669f7..39c3d9a49d4 100644 --- a/runtime/vm/assembler_dbc.h +++ b/runtime/vm/assembler_dbc.h @@ -19,14 +19,12 @@ namespace dart { - // Dummy declaration to make things compile. class Address : public ValueObject { private: Address(); }; - class Label : public ValueObject { public: Label() : position_(0) {} @@ -68,7 +66,6 @@ class Label : public ValueObject { DISALLOW_COPY_AND_ASSIGN(Label); }; - class Assembler : public ValueObject { public: explicit Assembler(bool use_far_branches = false) : buffer_(), comments_() {} @@ -138,7 +135,6 @@ class Assembler : public ValueObject { #define PARAMS_T intptr_t x #define PARAMS_A_X uintptr_t ra, intptr_t x - BYTECODES_LIST(DECLARE_EMIT) #undef PARAMS_0 @@ -185,7 +181,6 @@ class Assembler : public ValueObject { DISALLOW_COPY_AND_ASSIGN(Assembler); }; - } // namespace dart #endif // RUNTIME_VM_ASSEMBLER_DBC_H_ diff --git a/runtime/vm/assembler_dbc_test.cc b/runtime/vm/assembler_dbc_test.cc index 8ae05185a37..2d545df1c1b 100644 --- a/runtime/vm/assembler_dbc_test.cc +++ b/runtime/vm/assembler_dbc_test.cc @@ -21,7 +21,6 @@ static RawObject* ExecuteTest(const Code& code) { Array::Handle(Array::New(0)), thread); } - #define EXECUTE_TEST_CODE_INTPTR(code) \ Smi::Value(Smi::RawCast(ExecuteTest(code))) #define EXECUTE_TEST_CODE_BOOL(code) \ @@ -32,7 +31,6 @@ static RawObject* ExecuteTest(const Code& code) { #define __ assembler-> - static RawClass* CreateDummyClass(const String& class_name, const Script& script) { const Class& cls = Class::Handle(Class::New( @@ -41,12 +39,10 @@ static RawClass* CreateDummyClass(const String& class_name, return cls.raw(); } - static RawLibrary* CreateDummyLibrary(const String& library_name) { return Library::New(library_name); } - static RawFunction* CreateFunction(const char* name) { Thread* thread = Thread::Current(); const String& class_name = String::Handle(Symbols::New(thread, "ownerClass")); @@ -62,13 +58,11 @@ static RawFunction* CreateFunction(const char* name) { TokenPosition::kMinSource); } - static void GenerateDummyCode(Assembler* assembler, const Object& result) { __ PushConstant(result); __ ReturnTOS(); } - static void MakeDummyInstanceCall(Assembler* assembler, const Object& result) { // Make a dummy function. Assembler _assembler_; @@ -106,18 +100,15 @@ static void MakeDummyInstanceCall(Assembler* assembler, const Object& result) { __ InstanceCall2(2, call_ic_data_kidx); } - ASSEMBLER_TEST_GENERATE(Simple, assembler) { __ PushConstant(Smi::Handle(Smi::New(42))); __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(Simple, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(Nop, assembler) { __ PushConstant(Smi::Handle(Smi::New(42))); __ Nop(0); @@ -128,12 +119,10 @@ ASSEMBLER_TEST_GENERATE(Nop, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(Nop, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - // Called from assembler_test.cc. // FP[-kParamEndSlotFromFp - 1]: growable array // FP[-kParamEndSlotFromFp - 2]: value @@ -145,7 +134,6 @@ ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { __ Return(0); } - // - OneByteStringFromCharCode rA, rX // // Load the one-character symbol with the char code given by the Smi @@ -157,13 +145,11 @@ ASSEMBLER_TEST_GENERATE(OneByteStringFromCharCode, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(OneByteStringFromCharCode, test) { EXPECT_EQ(Symbols::New(Thread::Current(), "A"), EXECUTE_TEST_CODE_OBJECT(test->code()).raw()); } - // - StringToCharCode rA, rX // // Load and smi-encode the single char code of the string in FP[rX] into @@ -176,12 +162,10 @@ ASSEMBLER_TEST_GENERATE(StringToCharCode, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(StringToCharCode, test) { EXPECT_EQ(65, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(StringToCharCodeIllegalLength, assembler) { __ Frame(2); __ LoadConstant(0, String::ZoneHandle(String::New("AAA", Heap::kOld))); @@ -189,12 +173,10 @@ ASSEMBLER_TEST_GENERATE(StringToCharCodeIllegalLength, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(StringToCharCodeIllegalLength, test) { EXPECT_EQ(-1, EXECUTE_TEST_CODE_INTPTR(test->code())); } - // - AddTOS; SubTOS; MulTOS; BitOrTOS; BitAndTOS; EqualTOS; LessThanTOS; // GreaterThanTOS; // @@ -211,12 +193,10 @@ ASSEMBLER_TEST_GENERATE(AddTOS, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(AddTOS, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(AddTOSOverflow, assembler) { __ PushConstant(Smi::Handle(Smi::New(Smi::kMaxValue))); __ PushConstant(Smi::Handle(Smi::New(1))); @@ -226,12 +206,10 @@ ASSEMBLER_TEST_GENERATE(AddTOSOverflow, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(AddTOSOverflow, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(AddTOSNonSmi, assembler) { const String& numstr = String::Handle(String::New("98765432198765432100", Heap::kOld)); @@ -243,12 +221,10 @@ ASSEMBLER_TEST_GENERATE(AddTOSNonSmi, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(AddTOSNonSmi, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(SubTOS, assembler) { __ PushConstant(Smi::Handle(Smi::New(30))); __ PushConstant(Smi::Handle(Smi::New(-12))); @@ -258,12 +234,10 @@ ASSEMBLER_TEST_GENERATE(SubTOS, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(SubTOS, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(SubTOSOverflow, assembler) { __ PushConstant(Smi::Handle(Smi::New(Smi::kMinValue))); __ PushConstant(Smi::Handle(Smi::New(1))); @@ -273,12 +247,10 @@ ASSEMBLER_TEST_GENERATE(SubTOSOverflow, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(SubTOSOverflow, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(SubTOSNonSmi, assembler) { const String& numstr = String::Handle(String::New("98765432198765432100", Heap::kOld)); @@ -290,12 +262,10 @@ ASSEMBLER_TEST_GENERATE(SubTOSNonSmi, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(SubTOSNonSmi, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(MulTOS, assembler) { __ PushConstant(Smi::Handle(Smi::New(-6))); __ PushConstant(Smi::Handle(Smi::New(-7))); @@ -305,12 +275,10 @@ ASSEMBLER_TEST_GENERATE(MulTOS, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(MulTOS, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(MulTOSOverflow, assembler) { __ PushConstant(Smi::Handle(Smi::New(Smi::kMaxValue))); __ PushConstant(Smi::Handle(Smi::New(-8))); @@ -320,12 +288,10 @@ ASSEMBLER_TEST_GENERATE(MulTOSOverflow, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(MulTOSOverflow, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(MulTOSNonSmi, assembler) { const String& numstr = String::Handle(String::New("98765432198765432100", Heap::kOld)); @@ -337,12 +303,10 @@ ASSEMBLER_TEST_GENERATE(MulTOSNonSmi, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(MulTOSNonSmi, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(BitOrTOS, assembler) { __ PushConstant(Smi::Handle(Smi::New(0x22))); __ PushConstant(Smi::Handle(Smi::New(0x08))); @@ -352,12 +316,10 @@ ASSEMBLER_TEST_GENERATE(BitOrTOS, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(BitOrTOS, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(BitOrTOSNonSmi, assembler) { const String& numstr = String::Handle(String::New("98765432198765432100", Heap::kOld)); @@ -369,12 +331,10 @@ ASSEMBLER_TEST_GENERATE(BitOrTOSNonSmi, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(BitOrTOSNonSmi, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(BitAndTOS, assembler) { __ PushConstant(Smi::Handle(Smi::New(0x2a))); __ PushConstant(Smi::Handle(Smi::New(0xaa))); @@ -384,12 +344,10 @@ ASSEMBLER_TEST_GENERATE(BitAndTOS, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(BitAndTOS, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(BitAndTOSNonSmi, assembler) { const String& numstr = String::Handle(String::New("98765432198765432100", Heap::kOld)); @@ -401,12 +359,10 @@ ASSEMBLER_TEST_GENERATE(BitAndTOSNonSmi, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(BitAndTOSNonSmi, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(EqualTOSTrue, assembler) { __ PushConstant(Smi::Handle(Smi::New(42))); __ PushConstant(Smi::Handle(Smi::New(42))); @@ -416,12 +372,10 @@ ASSEMBLER_TEST_GENERATE(EqualTOSTrue, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(EqualTOSTrue, test) { EXPECT(EXECUTE_TEST_CODE_BOOL(test->code())); } - ASSEMBLER_TEST_GENERATE(EqualTOSFalse, assembler) { __ PushConstant(Smi::Handle(Smi::New(42))); __ PushConstant(Smi::Handle(Smi::New(-42))); @@ -431,12 +385,10 @@ ASSEMBLER_TEST_GENERATE(EqualTOSFalse, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(EqualTOSFalse, test) { EXPECT(!EXECUTE_TEST_CODE_BOOL(test->code())); } - ASSEMBLER_TEST_GENERATE(EqualTOSNonSmi, assembler) { const String& numstr = String::Handle(String::New("98765432198765432100", Heap::kOld)); @@ -448,12 +400,10 @@ ASSEMBLER_TEST_GENERATE(EqualTOSNonSmi, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(EqualTOSNonSmi, test) { EXPECT(EXECUTE_TEST_CODE_BOOL(test->code())); } - ASSEMBLER_TEST_GENERATE(LessThanTOSTrue, assembler) { __ PushConstant(Smi::Handle(Smi::New(-42))); __ PushConstant(Smi::Handle(Smi::New(42))); @@ -463,12 +413,10 @@ ASSEMBLER_TEST_GENERATE(LessThanTOSTrue, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(LessThanTOSTrue, test) { EXPECT(EXECUTE_TEST_CODE_BOOL(test->code())); } - ASSEMBLER_TEST_GENERATE(LessThanTOSFalse, assembler) { __ PushConstant(Smi::Handle(Smi::New(42))); __ PushConstant(Smi::Handle(Smi::New(-42))); @@ -478,12 +426,10 @@ ASSEMBLER_TEST_GENERATE(LessThanTOSFalse, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(LessThanTOSFalse, test) { EXPECT(!EXECUTE_TEST_CODE_BOOL(test->code())); } - ASSEMBLER_TEST_GENERATE(LessThanTOSNonSmi, assembler) { const String& numstr = String::Handle(String::New("98765432198765432100", Heap::kOld)); @@ -495,12 +441,10 @@ ASSEMBLER_TEST_GENERATE(LessThanTOSNonSmi, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(LessThanTOSNonSmi, test) { EXPECT(EXECUTE_TEST_CODE_BOOL(test->code())); } - ASSEMBLER_TEST_GENERATE(GreaterThanTOSTrue, assembler) { __ PushConstant(Smi::Handle(Smi::New(42))); __ PushConstant(Smi::Handle(Smi::New(-42))); @@ -510,12 +454,10 @@ ASSEMBLER_TEST_GENERATE(GreaterThanTOSTrue, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(GreaterThanTOSTrue, test) { EXPECT(EXECUTE_TEST_CODE_BOOL(test->code())); } - ASSEMBLER_TEST_GENERATE(GreaterThanTOSFalse, assembler) { __ PushConstant(Smi::Handle(Smi::New(-42))); __ PushConstant(Smi::Handle(Smi::New(42))); @@ -525,12 +467,10 @@ ASSEMBLER_TEST_GENERATE(GreaterThanTOSFalse, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(GreaterThanTOSFalse, test) { EXPECT(!EXECUTE_TEST_CODE_BOOL(test->code())); } - ASSEMBLER_TEST_GENERATE(GreaterThanTOSNonSmi, assembler) { const String& numstr = String::Handle(String::New("98765432198765432100", Heap::kOld)); @@ -542,12 +482,10 @@ ASSEMBLER_TEST_GENERATE(GreaterThanTOSNonSmi, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(GreaterThanTOSNonSmi, test) { EXPECT(EXECUTE_TEST_CODE_BOOL(test->code())); } - // - Add, Sub, Mul, Div, Mod, Shl, Shr rA, rB, rC // // Arithmetic operations on Smis. FP[rA] <- FP[rB] op FP[rC]. @@ -564,12 +502,10 @@ ASSEMBLER_TEST_GENERATE(AddNoOverflow, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(AddNoOverflow, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(AddOverflow, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(Smi::kMaxValue))); @@ -580,12 +516,10 @@ ASSEMBLER_TEST_GENERATE(AddOverflow, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(AddOverflow, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(SubNoOverflow, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(64))); @@ -596,12 +530,10 @@ ASSEMBLER_TEST_GENERATE(SubNoOverflow, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(SubNoOverflow, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(SubOverflow, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(Smi::kMinValue))); @@ -612,12 +544,10 @@ ASSEMBLER_TEST_GENERATE(SubOverflow, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(SubOverflow, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(MulNoOverflow, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(-6))); @@ -628,12 +558,10 @@ ASSEMBLER_TEST_GENERATE(MulNoOverflow, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(MulNoOverflow, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(MulOverflow, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(Smi::kMaxValue))); @@ -644,12 +572,10 @@ ASSEMBLER_TEST_GENERATE(MulOverflow, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(MulOverflow, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(DivNoDeopt, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(27))); @@ -660,12 +586,10 @@ ASSEMBLER_TEST_GENERATE(DivNoDeopt, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(DivNoDeopt, test) { EXPECT_EQ(9, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(DivZero, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(3))); @@ -676,12 +600,10 @@ ASSEMBLER_TEST_GENERATE(DivZero, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(DivZero, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(DivCornerCase, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(Smi::kMinValue))); @@ -692,12 +614,10 @@ ASSEMBLER_TEST_GENERATE(DivCornerCase, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(DivCornerCase, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(ModPosPos, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(42))); @@ -708,12 +628,10 @@ ASSEMBLER_TEST_GENERATE(ModPosPos, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(ModPosPos, test) { EXPECT_EQ(2, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(ModNegPos, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(-42))); @@ -724,12 +642,10 @@ ASSEMBLER_TEST_GENERATE(ModNegPos, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(ModNegPos, test) { EXPECT_EQ(2, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(ModPosNeg, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(42))); @@ -740,12 +656,10 @@ ASSEMBLER_TEST_GENERATE(ModPosNeg, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(ModPosNeg, test) { EXPECT_EQ(2, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(ModZero, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(3))); @@ -756,12 +670,10 @@ ASSEMBLER_TEST_GENERATE(ModZero, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(ModZero, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(ShlNoDeopt, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(21))); @@ -772,12 +684,10 @@ ASSEMBLER_TEST_GENERATE(ShlNoDeopt, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(ShlNoDeopt, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(ShlOverflow, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(Smi::kMaxValue))); @@ -788,12 +698,10 @@ ASSEMBLER_TEST_GENERATE(ShlOverflow, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(ShlOverflow, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(ShlNegShift, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(21))); @@ -804,12 +712,10 @@ ASSEMBLER_TEST_GENERATE(ShlNegShift, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(ShlNegShift, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(ShrNoDeopt, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(84))); @@ -820,12 +726,10 @@ ASSEMBLER_TEST_GENERATE(ShrNoDeopt, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(ShrNoDeopt, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(ShrNegShift, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(21))); @@ -836,12 +740,10 @@ ASSEMBLER_TEST_GENERATE(ShrNegShift, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(ShrNegShift, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - // - Neg rA , rD // // FP[rA] <- -FP[rD]. Assumes FP[rD] is a Smi. If there is no overflow the @@ -855,12 +757,10 @@ ASSEMBLER_TEST_GENERATE(NegPos, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(NegPos, test) { EXPECT_EQ(-42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(NegNeg, assembler) { __ Frame(2); __ LoadConstant(0, Smi::Handle(Smi::New(-42))); @@ -870,12 +770,10 @@ ASSEMBLER_TEST_GENERATE(NegNeg, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(NegNeg, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(NegOverflow, assembler) { __ Frame(2); __ LoadConstant(0, Smi::Handle(Smi::New(Smi::kMinValue))); @@ -885,12 +783,10 @@ ASSEMBLER_TEST_GENERATE(NegOverflow, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(NegOverflow, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - // - BitOr, BitAnd, BitXor rA, rB, rC // // FP[rA] <- FP[rB] op FP[rC] @@ -903,12 +799,10 @@ ASSEMBLER_TEST_GENERATE(BitOr, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(BitOr, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(BitAnd, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(0x2b))); @@ -918,12 +812,10 @@ ASSEMBLER_TEST_GENERATE(BitAnd, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(BitAnd, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(BitXor, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(0x37))); @@ -933,12 +825,10 @@ ASSEMBLER_TEST_GENERATE(BitXor, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(BitXor, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - // - BitNot rA, rD // // FP[rA] <- ~FP[rD]. As above, assumes FP[rD] is a Smi. @@ -950,7 +840,6 @@ ASSEMBLER_TEST_GENERATE(BitNot, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(BitNot, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } @@ -980,12 +869,10 @@ ASSEMBLER_TEST_GENERATE(IfNeStrictTOSTaken, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(IfNeStrictTOSTaken, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfNeStrictTOSNotTaken, assembler) { Label branch_taken; const Array& array1 = Array::Handle(Array::New(1, Heap::kOld)); @@ -1004,7 +891,6 @@ ASSEMBLER_TEST_RUN(IfNeStrictTOSNotTaken, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - // TODO(zra): Also add tests that use Mint, Bignum. ASSEMBLER_TEST_GENERATE(IfNeStrictNumTOSTaken, assembler) { Label branch_taken; @@ -1019,12 +905,10 @@ ASSEMBLER_TEST_GENERATE(IfNeStrictNumTOSTaken, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(IfNeStrictNumTOSTaken, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfNeStrictNumTOSNotTaken, assembler) { Label branch_taken; __ PushConstant(Smi::Handle(Smi::New(1))); @@ -1042,7 +926,6 @@ ASSEMBLER_TEST_RUN(IfNeStrictNumTOSNotTaken, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfNeStrictNumTOSTakenDouble, assembler) { Label branch_taken; __ PushConstant(Double::Handle(Double::New(-1.0, Heap::kOld))); @@ -1056,12 +939,10 @@ ASSEMBLER_TEST_GENERATE(IfNeStrictNumTOSTakenDouble, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(IfNeStrictNumTOSTakenDouble, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfNeStrictNumTOSNotTakenDouble, assembler) { Label branch_taken; __ PushConstant(Double::Handle(Double::New(1.0, Heap::kOld))); @@ -1079,7 +960,6 @@ ASSEMBLER_TEST_RUN(IfNeStrictNumTOSNotTakenDouble, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfEqStrictTOSTaken, assembler) { Label branch_taken; const Array& array1 = Array::Handle(Array::New(1, Heap::kOld)); @@ -1094,12 +974,10 @@ ASSEMBLER_TEST_GENERATE(IfEqStrictTOSTaken, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(IfEqStrictTOSTaken, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfEqStrictTOSNotTaken, assembler) { Label branch_taken; const Array& array1 = Array::Handle(Array::New(1, Heap::kOld)); @@ -1119,7 +997,6 @@ ASSEMBLER_TEST_RUN(IfEqStrictTOSNotTaken, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - // TODO(zra): Also add tests that use Mint, Bignum. ASSEMBLER_TEST_GENERATE(IfEqStrictNumTOSTaken, assembler) { Label branch_taken; @@ -1134,12 +1011,10 @@ ASSEMBLER_TEST_GENERATE(IfEqStrictNumTOSTaken, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(IfEqStrictNumTOSTaken, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfEqStrictNumTOSNotTaken, assembler) { Label branch_taken; __ PushConstant(Smi::Handle(Smi::New(-1))); @@ -1153,12 +1028,10 @@ ASSEMBLER_TEST_GENERATE(IfEqStrictNumTOSNotTaken, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(IfEqStrictNumTOSNotTaken, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfEqStrictNumTOSTakenDouble, assembler) { Label branch_taken; __ PushConstant(Double::Handle(Double::New(1.0, Heap::kOld))); @@ -1172,12 +1045,10 @@ ASSEMBLER_TEST_GENERATE(IfEqStrictNumTOSTakenDouble, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(IfEqStrictNumTOSTakenDouble, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfEqStrictNumTOSNotTakenDouble, assembler) { Label branch_taken; __ PushConstant(Double::Handle(Double::New(-1.0, Heap::kOld))); @@ -1191,12 +1062,10 @@ ASSEMBLER_TEST_GENERATE(IfEqStrictNumTOSNotTakenDouble, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(IfEqStrictNumTOSNotTakenDouble, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - // - BooleanNegateTOS // // SP[0] = !SP[0] @@ -1206,24 +1075,20 @@ ASSEMBLER_TEST_GENERATE(BooleanNegateTOSTrue, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(BooleanNegateTOSTrue, test) { EXPECT(!EXECUTE_TEST_CODE_BOOL(test->code())); } - ASSEMBLER_TEST_GENERATE(BooleanNegateTOSFalse, assembler) { __ PushConstant(Bool::False()); __ BooleanNegateTOS(); __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(BooleanNegateTOSFalse, test) { EXPECT(EXECUTE_TEST_CODE_BOOL(test->code())); } - // - AssertBoolean A // // Assert that TOS is a boolean (A = 1) or that TOS is not null (A = 0). @@ -1233,60 +1098,50 @@ ASSEMBLER_TEST_GENERATE(AssertBooleanTrue, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(AssertBooleanTrue, test) { EXPECT(EXECUTE_TEST_CODE_BOOL(test->code())); } - ASSEMBLER_TEST_GENERATE(AssertBooleanFalse, assembler) { __ PushConstant(Bool::False()); __ AssertBoolean(1); __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(AssertBooleanFalse, test) { EXPECT(!EXECUTE_TEST_CODE_BOOL(test->code())); } - ASSEMBLER_TEST_GENERATE(AssertBooleanNotNull, assembler) { __ PushConstant(Bool::True()); __ AssertBoolean(0); __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(AssertBooleanNotNull, test) { EXPECT(EXECUTE_TEST_CODE_BOOL(test->code())); } - ASSEMBLER_TEST_GENERATE(AssertBooleanFail1, assembler) { __ PushConstant(Smi::Handle(Smi::New(37))); __ AssertBoolean(1); __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(AssertBooleanFail1, test) { EXPECT(EXECUTE_TEST_CODE_OBJECT(test->code()).IsError()); } - ASSEMBLER_TEST_GENERATE(AssertBooleanFail2, assembler) { __ PushConstant(Object::null_object()); __ AssertBoolean(0); __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(AssertBooleanFail2, test) { EXPECT(EXECUTE_TEST_CODE_OBJECT(test->code()).IsError()); } - // - Drop1; DropR n; Drop n // // Drop 1 or n values from the stack, if instruction is DropR push the first @@ -1299,12 +1154,10 @@ ASSEMBLER_TEST_GENERATE(Drop1, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(Drop1, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(Drop, assembler) { __ PushConstant(Smi::Handle(Smi::New(0))); __ PushConstant(Smi::Handle(Smi::New(42))); @@ -1323,12 +1176,10 @@ ASSEMBLER_TEST_GENERATE(Drop, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(Drop, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(DropR, assembler) { __ PushConstant(Smi::Handle(Smi::New(0))); __ PushConstant(Smi::Handle(Smi::New(1))); @@ -1350,12 +1201,10 @@ ASSEMBLER_TEST_GENERATE(DropR, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(DropR, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - // - Frame D // // Reserve and initialize with null space for D local variables. @@ -1364,12 +1213,10 @@ ASSEMBLER_TEST_GENERATE(FrameInitialized1, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(FrameInitialized1, test) { EXPECT(EXECUTE_TEST_CODE_OBJECT(test->code()).IsNull()); } - ASSEMBLER_TEST_GENERATE(FrameInitialized, assembler) { Label error; __ PushConstant(Smi::Handle(Smi::New(42))); @@ -1394,12 +1241,10 @@ ASSEMBLER_TEST_GENERATE(FrameInitialized, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(FrameInitialized, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - // - StoreLocal rX; PopLocal rX // // Store top of the stack into FP[rX] and pop it if needed. @@ -1419,12 +1264,10 @@ ASSEMBLER_TEST_GENERATE(StoreLocalPush, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(StoreLocalPush, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(PopLocalPush, assembler) { __ Frame(1); __ PushConstant(Smi::Handle(Smi::New(21))); @@ -1437,12 +1280,10 @@ ASSEMBLER_TEST_GENERATE(PopLocalPush, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(PopLocalPush, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(LoadConstantPush, assembler) { __ Frame(1); __ LoadConstant(0, Smi::Handle(Smi::New(21))); @@ -1454,12 +1295,10 @@ ASSEMBLER_TEST_GENERATE(LoadConstantPush, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(LoadConstantPush, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - // - Move rA, rX // // FP[rA] <- FP[rX] @@ -1478,12 +1317,10 @@ ASSEMBLER_TEST_GENERATE(MoveLocalLocal, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(MoveLocalLocal, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - // - Return R; ReturnTOS // // Return to the caller using either a value from the given register or a @@ -1495,12 +1332,10 @@ ASSEMBLER_TEST_GENERATE(Return1, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(Return1, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(Return2, assembler) { __ Frame(2); __ PushConstant(Smi::Handle(Smi::New(42))); @@ -1508,12 +1343,10 @@ ASSEMBLER_TEST_GENERATE(Return2, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(Return2, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(Loop, assembler) { __ Frame(2); __ LoadConstant(0, Smi::Handle(Smi::New(42))); @@ -1549,12 +1382,10 @@ ASSEMBLER_TEST_GENERATE(Loop, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(Loop, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - // - LoadClassIdTOS, LoadClassId rA, D // // LoadClassIdTOS loads the class id from the object at SP[0] and stores it @@ -1566,12 +1397,10 @@ ASSEMBLER_TEST_GENERATE(LoadClassIdTOS, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(LoadClassIdTOS, test) { EXPECT_EQ(kSmiCid, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(LoadClassId, assembler) { __ Frame(2); __ LoadConstant(0, Smi::Handle(Smi::New(42))); @@ -1579,12 +1408,10 @@ ASSEMBLER_TEST_GENERATE(LoadClassId, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(LoadClassId, test) { EXPECT_EQ(kSmiCid, EXECUTE_TEST_CODE_INTPTR(test->code())); } - // - CreateArrayTOS // // Allocate array of length SP[0] with type arguments SP[-1]. @@ -1595,7 +1422,6 @@ ASSEMBLER_TEST_GENERATE(CreateArrayTOS, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(CreateArrayTOS, test) { const Object& obj = EXECUTE_TEST_CODE_OBJECT(test->code()); EXPECT(obj.IsArray()); @@ -1604,7 +1430,6 @@ ASSEMBLER_TEST_RUN(CreateArrayTOS, test) { EXPECT_EQ(10, array.Length()); } - // - TestSmi rA, rD // // If FP[rA] & FP[rD] != 0, then skip the next instruction. FP[rA] and FP[rD] @@ -1623,12 +1448,10 @@ ASSEMBLER_TEST_GENERATE(TestSmiTrue, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(TestSmiTrue, test) { EXPECT(EXECUTE_TEST_CODE_BOOL(test->code())); } - ASSEMBLER_TEST_GENERATE(TestSmiFalse, assembler) { Label branch_taken; __ Frame(2); @@ -1643,12 +1466,10 @@ ASSEMBLER_TEST_GENERATE(TestSmiFalse, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(TestSmiFalse, test) { EXPECT(!EXECUTE_TEST_CODE_BOOL(test->code())); } - // - TestCids rA, D // // The next D instructions must be Nops whose D field encodes a class id. If @@ -1675,12 +1496,10 @@ ASSEMBLER_TEST_GENERATE(TestCidsTrue, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(TestCidsTrue, test) { EXPECT_EQ(1, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(TestCidsFalse, assembler) { Label true_branch, no_match_branch; __ Frame(2); @@ -1701,12 +1520,10 @@ ASSEMBLER_TEST_GENERATE(TestCidsFalse, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(TestCidsFalse, test) { EXPECT_EQ(0, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(TestCidsNoMatch, assembler) { Label true_branch, no_match_branch; __ Frame(2); @@ -1727,12 +1544,10 @@ ASSEMBLER_TEST_GENERATE(TestCidsNoMatch, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(TestCidsNoMatch, test) { EXPECT_EQ(2, EXECUTE_TEST_CODE_INTPTR(test->code())); } - // - CheckSmi rA // // If FP[rA] is a Smi, then skip the next instruction. @@ -1745,12 +1560,10 @@ ASSEMBLER_TEST_GENERATE(CheckSmiPass, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(CheckSmiPass, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(CheckSmiFail, assembler) { __ Frame(1); __ PushConstant(Smi::Handle(Smi::New(-1))); @@ -1760,12 +1573,10 @@ ASSEMBLER_TEST_GENERATE(CheckSmiFail, assembler) { __ ReturnTOS(); } - ASSEMBLER_TEST_RUN(CheckSmiFail, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - // - CheckClassId rA, D // // If the object at FP[rA]'s class id matches the class id in PP[D], then @@ -1779,12 +1590,10 @@ ASSEMBLER_TEST_GENERATE(CheckClassIdSmiPass, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(CheckClassIdSmiPass, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(CheckClassIdNonSmiPass, assembler) { __ Frame(2); __ LoadConstant(0, Bool::True()); @@ -1794,12 +1603,10 @@ ASSEMBLER_TEST_GENERATE(CheckClassIdNonSmiPass, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(CheckClassIdNonSmiPass, test) { EXPECT(EXECUTE_TEST_CODE_BOOL(test->code())); } - ASSEMBLER_TEST_GENERATE(CheckClassIdFail, assembler) { __ Frame(2); __ LoadConstant(0, Smi::Handle(Smi::New(-1))); @@ -1809,12 +1616,10 @@ ASSEMBLER_TEST_GENERATE(CheckClassIdFail, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(CheckClassIdFail, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - // - IfNull rA // // Cond is Eq or Ne. Skips the next instruction unless the given condition @@ -1828,12 +1633,10 @@ ASSEMBLER_TEST_GENERATE(IfEqNullNotNull, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(IfEqNullNotNull, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfEqNullIsNull, assembler) { __ Frame(2); __ LoadConstant(0, Object::null_object()); @@ -1843,12 +1646,10 @@ ASSEMBLER_TEST_GENERATE(IfEqNullIsNull, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(IfEqNullIsNull, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfNeNullIsNull, assembler) { __ Frame(2); __ LoadConstant(0, Object::null_object()); @@ -1858,12 +1659,10 @@ ASSEMBLER_TEST_GENERATE(IfNeNullIsNull, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(IfNeNullIsNull, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfNeNullNotNull, assembler) { __ Frame(2); __ LoadConstant(0, Smi::Handle(Smi::New(-1))); @@ -1873,7 +1672,6 @@ ASSEMBLER_TEST_GENERATE(IfNeNullNotNull, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(IfNeNullNotNull, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } @@ -1894,12 +1692,10 @@ ASSEMBLER_TEST_GENERATE(IfLeTrue, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfLeTrue, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfLeFalse, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(42))); @@ -1910,12 +1706,10 @@ ASSEMBLER_TEST_GENERATE(IfLeFalse, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfLeFalse, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfLtTrue, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(-1))); @@ -1926,12 +1720,10 @@ ASSEMBLER_TEST_GENERATE(IfLtTrue, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfLtTrue, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfLtFalse, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(42))); @@ -1942,12 +1734,10 @@ ASSEMBLER_TEST_GENERATE(IfLtFalse, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfLtFalse, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfGeTrue, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(-1))); @@ -1958,12 +1748,10 @@ ASSEMBLER_TEST_GENERATE(IfGeTrue, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfGeTrue, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfGeFalse, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(42))); @@ -1974,12 +1762,10 @@ ASSEMBLER_TEST_GENERATE(IfGeFalse, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfGeFalse, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfGtTrue, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(-1))); @@ -1990,12 +1776,10 @@ ASSEMBLER_TEST_GENERATE(IfGtTrue, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfGtTrue, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfGtFalse, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(42))); @@ -2006,12 +1790,10 @@ ASSEMBLER_TEST_GENERATE(IfGtFalse, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfGtFalse, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - #if defined(ARCH_IS_64_BIT) ASSEMBLER_TEST_GENERATE(IfDNeTrue, assembler) { __ Frame(3); @@ -2025,12 +1807,10 @@ ASSEMBLER_TEST_GENERATE(IfDNeTrue, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfDNeTrue, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfDNeFalse, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(42))); @@ -2043,12 +1823,10 @@ ASSEMBLER_TEST_GENERATE(IfDNeFalse, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfDNeFalse, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfDNeNan, assembler) { const double not_a_number = bit_cast(0x7FF8000000000000LL); __ Frame(3); @@ -2062,12 +1840,10 @@ ASSEMBLER_TEST_GENERATE(IfDNeNan, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfDNeNan, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfDEqTrue, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(-1))); @@ -2080,12 +1856,10 @@ ASSEMBLER_TEST_GENERATE(IfDEqTrue, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfDEqTrue, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfDEqFalse, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(42))); @@ -2098,12 +1872,10 @@ ASSEMBLER_TEST_GENERATE(IfDEqFalse, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfDEqFalse, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfDEqNan, assembler) { const double not_a_number = bit_cast(0x7FF8000000000000LL); __ Frame(3); @@ -2117,12 +1889,10 @@ ASSEMBLER_TEST_GENERATE(IfDEqNan, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfDEqNan, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfDLeTrue, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(-1))); @@ -2135,12 +1905,10 @@ ASSEMBLER_TEST_GENERATE(IfDLeTrue, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfDLeTrue, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfDLeFalse, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(42))); @@ -2153,12 +1921,10 @@ ASSEMBLER_TEST_GENERATE(IfDLeFalse, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfDLeFalse, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfDLeNan, assembler) { const double not_a_number = bit_cast(0x7FF8000000000000LL); __ Frame(3); @@ -2172,12 +1938,10 @@ ASSEMBLER_TEST_GENERATE(IfDLeNan, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfDLeNan, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfDLtTrue, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(-1))); @@ -2190,12 +1954,10 @@ ASSEMBLER_TEST_GENERATE(IfDLtTrue, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfDLtTrue, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfDLtFalse, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(42))); @@ -2208,12 +1970,10 @@ ASSEMBLER_TEST_GENERATE(IfDLtFalse, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfDLtFalse, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfDLtNan, assembler) { const double not_a_number = bit_cast(0x7FF8000000000000LL); __ Frame(3); @@ -2227,12 +1987,10 @@ ASSEMBLER_TEST_GENERATE(IfDLtNan, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfDLtNan, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfDGeTrue, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(-1))); @@ -2245,12 +2003,10 @@ ASSEMBLER_TEST_GENERATE(IfDGeTrue, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfDGeTrue, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfDGeFalse, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(42))); @@ -2263,12 +2019,10 @@ ASSEMBLER_TEST_GENERATE(IfDGeFalse, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfDGeFalse, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfDGeNan, assembler) { const double not_a_number = bit_cast(0x7FF8000000000000LL); __ Frame(3); @@ -2282,12 +2036,10 @@ ASSEMBLER_TEST_GENERATE(IfDGeNan, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfDGeNan, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfDGtTrue, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(-1))); @@ -2300,12 +2052,10 @@ ASSEMBLER_TEST_GENERATE(IfDGtTrue, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfDGtTrue, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfDGtFalse, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(42))); @@ -2318,12 +2068,10 @@ ASSEMBLER_TEST_GENERATE(IfDGtFalse, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfDGtFalse, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfDGtNan, assembler) { const double not_a_number = bit_cast(0x7FF8000000000000LL); __ Frame(3); @@ -2337,13 +2085,11 @@ ASSEMBLER_TEST_GENERATE(IfDGtNan, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfDGtNan, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } #endif // defined(ARCH_IS_64_BIT) - ASSEMBLER_TEST_GENERATE(IfULeTrue, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(-1))); @@ -2354,12 +2100,10 @@ ASSEMBLER_TEST_GENERATE(IfULeTrue, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfULeTrue, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfULeFalse, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(42))); @@ -2370,12 +2114,10 @@ ASSEMBLER_TEST_GENERATE(IfULeFalse, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfULeFalse, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfULeNegTrue, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(-1))); @@ -2386,12 +2128,10 @@ ASSEMBLER_TEST_GENERATE(IfULeNegTrue, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfULeNegTrue, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfULtTrue, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(-1))); @@ -2402,12 +2142,10 @@ ASSEMBLER_TEST_GENERATE(IfULtTrue, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfULtTrue, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfULtFalse, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(42))); @@ -2418,12 +2156,10 @@ ASSEMBLER_TEST_GENERATE(IfULtFalse, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfULtFalse, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfUGeTrue, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(-1))); @@ -2434,12 +2170,10 @@ ASSEMBLER_TEST_GENERATE(IfUGeTrue, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfUGeTrue, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfUGeFalse, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(42))); @@ -2450,12 +2184,10 @@ ASSEMBLER_TEST_GENERATE(IfUGeFalse, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfUGeFalse, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfUGtTrue, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(-1))); @@ -2466,12 +2198,10 @@ ASSEMBLER_TEST_GENERATE(IfUGtTrue, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfUGtTrue, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(IfUGtFalse, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(42))); @@ -2482,12 +2212,10 @@ ASSEMBLER_TEST_GENERATE(IfUGtFalse, assembler) { __ Return(0); } - ASSEMBLER_TEST_RUN(IfUGtFalse, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - // - Min, Max rA, rB, rC // // FP[rA] <- {min, max}(FP[rB], FP[rC]). Assumes that FP[rB], and FP[rC] are @@ -2500,12 +2228,10 @@ ASSEMBLER_TEST_GENERATE(Min, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(Min, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(Max, assembler) { __ Frame(3); __ LoadConstant(0, Smi::Handle(Smi::New(42))); @@ -2514,12 +2240,10 @@ ASSEMBLER_TEST_GENERATE(Max, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(Max, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - #if defined(ARCH_IS_64_BIT) // - UnboxDouble rA, rD // @@ -2537,12 +2261,10 @@ ASSEMBLER_TEST_GENERATE(Unbox, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(Unbox, test) { EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(test->code())); } - ASSEMBLER_TEST_GENERATE(CheckedUnboxDouble, assembler) { __ Frame(2); __ LoadConstant(0, Double::Handle(Double::New(42.0, Heap::kOld))); @@ -2551,12 +2273,10 @@ ASSEMBLER_TEST_GENERATE(CheckedUnboxDouble, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(CheckedUnboxDouble, test) { EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(test->code())); } - ASSEMBLER_TEST_GENERATE(CheckedUnboxSmi, assembler) { __ Frame(2); __ LoadConstant(0, Smi::Handle(Smi::New(42))); @@ -2565,12 +2285,10 @@ ASSEMBLER_TEST_GENERATE(CheckedUnboxSmi, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(CheckedUnboxSmi, test) { EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(test->code())); } - ASSEMBLER_TEST_GENERATE(CheckedUnboxFail, assembler) { __ Frame(2); __ LoadConstant(0, Bool::True()); @@ -2580,12 +2298,10 @@ ASSEMBLER_TEST_GENERATE(CheckedUnboxFail, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(CheckedUnboxFail, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - // - DAdd, DSub, DMul, DDiv rA, rB, rC // // Arithmetic operations on unboxed doubles. FP[rA] <- FP[rB] op FP[rC]. @@ -2599,12 +2315,10 @@ ASSEMBLER_TEST_GENERATE(DAdd, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(DAdd, test) { EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(test->code())); } - ASSEMBLER_TEST_GENERATE(DSub, assembler) { __ Frame(3); __ LoadConstant(0, Double::Handle(Double::New(1.0, Heap::kOld))); @@ -2615,12 +2329,10 @@ ASSEMBLER_TEST_GENERATE(DSub, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(DSub, test) { EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(test->code())); } - ASSEMBLER_TEST_GENERATE(DMul, assembler) { __ Frame(3); __ LoadConstant(0, Double::Handle(Double::New(6.0, Heap::kOld))); @@ -2631,12 +2343,10 @@ ASSEMBLER_TEST_GENERATE(DMul, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(DMul, test) { EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(test->code())); } - ASSEMBLER_TEST_GENERATE(DDiv, assembler) { __ Frame(3); __ LoadConstant(0, Double::Handle(Double::New(2.0, Heap::kOld))); @@ -2647,12 +2357,10 @@ ASSEMBLER_TEST_GENERATE(DDiv, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(DDiv, test) { EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(test->code())); } - ASSEMBLER_TEST_GENERATE(DNeg, assembler) { __ Frame(2); __ LoadConstant(0, Double::Handle(Double::New(-42.0, Heap::kOld))); @@ -2661,12 +2369,10 @@ ASSEMBLER_TEST_GENERATE(DNeg, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(DNeg, test) { EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(test->code())); } - ASSEMBLER_TEST_GENERATE(DSqrt, assembler) { __ Frame(2); __ LoadConstant(0, Double::Handle(Double::New(36.0, Heap::kOld))); @@ -2675,12 +2381,10 @@ ASSEMBLER_TEST_GENERATE(DSqrt, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(DSqrt, test) { EXPECT_EQ(6.0, EXECUTE_TEST_CODE_DOUBLE(test->code())); } - // - SmiToDouble rA, rD // // Convert the Smi in FP[rD] to an unboxed double in FP[rA]. @@ -2697,12 +2401,10 @@ ASSEMBLER_TEST_GENERATE(SmiToDouble, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(SmiToDouble, test) { EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(test->code())); } - ASSEMBLER_TEST_GENERATE(DoubleToSmi, assembler) { __ Frame(2); __ LoadConstant(0, Double::Handle(Double::New(42.0, Heap::kOld))); @@ -2713,12 +2415,10 @@ ASSEMBLER_TEST_GENERATE(DoubleToSmi, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(DoubleToSmi, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(DoubleToSmiNearMax, assembler) { const double m = static_cast(Smi::kMaxValue - 1000); __ Frame(2); @@ -2730,12 +2430,10 @@ ASSEMBLER_TEST_GENERATE(DoubleToSmiNearMax, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(DoubleToSmiNearMax, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(DoubleToSmiNearMin, assembler) { const double m = static_cast(Smi::kMinValue); __ Frame(2); @@ -2747,12 +2445,10 @@ ASSEMBLER_TEST_GENERATE(DoubleToSmiNearMin, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(DoubleToSmiNearMin, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(DoubleToSmiFailPos, assembler) { const double pos_overflow = static_cast(Smi::kMaxValue + 1); __ Frame(2); @@ -2764,12 +2460,10 @@ ASSEMBLER_TEST_GENERATE(DoubleToSmiFailPos, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(DoubleToSmiFailPos, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(DoubleToSmiFailNeg, assembler) { const double neg_overflow = static_cast(Smi::kMinValue - 1000); __ Frame(2); @@ -2781,12 +2475,10 @@ ASSEMBLER_TEST_GENERATE(DoubleToSmiFailNeg, assembler) { __ Return(1); } - ASSEMBLER_TEST_RUN(DoubleToSmiFailNeg, test) { EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); } - ASSEMBLER_TEST_GENERATE(DMin, assembler) { __ Frame(3); __ LoadConstant(0, Double::Handle(Double::New(42.0, Heap::kOld))); @@ -2797,12 +2489,10 @@ ASSEMBLER_TEST_GENERATE(DMin, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(DMin, test) { EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(test->code())); } - ASSEMBLER_TEST_GENERATE(DMax, assembler) { __ Frame(3); __ LoadConstant(0, Double::Handle(Double::New(42.0, Heap::kOld))); @@ -2813,7 +2503,6 @@ ASSEMBLER_TEST_GENERATE(DMax, assembler) { __ Return(2); } - ASSEMBLER_TEST_RUN(DMax, test) { EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(test->code())); } diff --git a/runtime/vm/assembler_ia32.cc b/runtime/vm/assembler_ia32.cc index a437c29cf82..d06a3be4666 100644 --- a/runtime/vm/assembler_ia32.cc +++ b/runtime/vm/assembler_ia32.cc @@ -18,7 +18,6 @@ namespace dart { DECLARE_FLAG(bool, inline_alloc); - class DirectCallRelocation : public AssemblerFixup { public: void Process(const MemoryRegion& region, intptr_t position) { @@ -31,7 +30,6 @@ class DirectCallRelocation : public AssemblerFixup { virtual bool IsPointerOffset() const { return false; } }; - int32_t Assembler::jit_cookie() { if (jit_cookie_ == 0) { jit_cookie_ = @@ -40,26 +38,22 @@ int32_t Assembler::jit_cookie() { return jit_cookie_; } - void Assembler::InitializeMemoryWithBreakpoints(uword data, intptr_t length) { memset(reinterpret_cast(data), Instr::kBreakPointInstruction, length); } - void Assembler::call(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xFF); EmitRegisterOperand(2, reg); } - void Assembler::call(const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xFF); EmitOperand(2, address); } - void Assembler::call(Label* label) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xE8); @@ -67,7 +61,6 @@ void Assembler::call(Label* label) { EmitLabel(label, kSize); } - void Assembler::call(const ExternalLabel* label) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); intptr_t call_start = buffer_.GetPosition(); @@ -77,20 +70,17 @@ void Assembler::call(const ExternalLabel* label) { ASSERT((buffer_.GetPosition() - call_start) == kCallExternalLabelSize); } - void Assembler::pushl(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x50 + reg); } - void Assembler::pushl(const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xFF); EmitOperand(6, address); } - void Assembler::pushl(const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); if (imm.is_int8()) { @@ -102,32 +92,27 @@ void Assembler::pushl(const Immediate& imm) { } } - void Assembler::popl(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x58 + reg); } - void Assembler::popl(const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x8F); EmitOperand(0, address); } - void Assembler::pushal() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x60); } - void Assembler::popal() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x61); } - void Assembler::setcc(Condition condition, ByteRegister dst) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -135,35 +120,30 @@ void Assembler::setcc(Condition condition, ByteRegister dst) { EmitUint8(0xC0 + dst); } - void Assembler::movl(Register dst, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xB8 + dst); EmitImmediate(imm); } - void Assembler::movl(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x89); EmitRegisterOperand(src, dst); } - void Assembler::movl(Register dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x8B); EmitOperand(dst, src); } - void Assembler::movl(const Address& dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x89); EmitOperand(src, dst); } - void Assembler::movl(const Address& dst, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xC7); @@ -171,7 +151,6 @@ void Assembler::movl(const Address& dst, const Immediate& imm) { EmitImmediate(imm); } - void Assembler::movzxb(Register dst, ByteRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -179,7 +158,6 @@ void Assembler::movzxb(Register dst, ByteRegister src) { EmitRegisterOperand(dst, src); } - void Assembler::movzxb(Register dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -187,7 +165,6 @@ void Assembler::movzxb(Register dst, const Address& src) { EmitOperand(dst, src); } - void Assembler::movsxb(Register dst, ByteRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -195,7 +172,6 @@ void Assembler::movsxb(Register dst, ByteRegister src) { EmitRegisterOperand(dst, src); } - void Assembler::movsxb(Register dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -203,19 +179,16 @@ void Assembler::movsxb(Register dst, const Address& src) { EmitOperand(dst, src); } - void Assembler::movb(Register dst, const Address& src) { FATAL("Use movzxb or movsxb instead."); } - void Assembler::movb(const Address& dst, ByteRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x88); EmitOperand(src, dst); } - void Assembler::movb(const Address& dst, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xC6); @@ -224,7 +197,6 @@ void Assembler::movb(const Address& dst, const Immediate& imm) { EmitUint8(imm.value() & 0xFF); } - void Assembler::movzxw(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -232,7 +204,6 @@ void Assembler::movzxw(Register dst, Register src) { EmitRegisterOperand(dst, src); } - void Assembler::movzxw(Register dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -240,7 +211,6 @@ void Assembler::movzxw(Register dst, const Address& src) { EmitOperand(dst, src); } - void Assembler::movsxw(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -248,7 +218,6 @@ void Assembler::movsxw(Register dst, Register src) { EmitRegisterOperand(dst, src); } - void Assembler::movsxw(Register dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -256,12 +225,10 @@ void Assembler::movsxw(Register dst, const Address& src) { EmitOperand(dst, src); } - void Assembler::movw(Register dst, const Address& src) { FATAL("Use movzxw or movsxw instead."); } - void Assembler::movw(const Address& dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandSizeOverride(); @@ -269,7 +236,6 @@ void Assembler::movw(const Address& dst, Register src) { EmitOperand(src, dst); } - void Assembler::movw(const Address& dst, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandSizeOverride(); @@ -279,14 +245,12 @@ void Assembler::movw(const Address& dst, const Immediate& imm) { EmitUint8((imm.value() >> 8) & 0xFF); } - void Assembler::leal(Register dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x8D); EmitOperand(dst, src); } - // Move if not overflow. void Assembler::cmovno(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -295,7 +259,6 @@ void Assembler::cmovno(Register dst, Register src) { EmitRegisterOperand(dst, src); } - void Assembler::cmove(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -303,7 +266,6 @@ void Assembler::cmove(Register dst, Register src) { EmitRegisterOperand(dst, src); } - void Assembler::cmovne(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -311,7 +273,6 @@ void Assembler::cmovne(Register dst, Register src) { EmitRegisterOperand(dst, src); } - void Assembler::cmovs(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -319,7 +280,6 @@ void Assembler::cmovs(Register dst, Register src) { EmitRegisterOperand(dst, src); } - void Assembler::cmovns(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -327,7 +287,6 @@ void Assembler::cmovns(Register dst, Register src) { EmitRegisterOperand(dst, src); } - void Assembler::cmovgel(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -335,7 +294,6 @@ void Assembler::cmovgel(Register dst, Register src) { EmitRegisterOperand(dst, src); } - void Assembler::cmovlessl(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -343,14 +301,12 @@ void Assembler::cmovlessl(Register dst, Register src) { EmitRegisterOperand(dst, src); } - void Assembler::rep_movsb() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF3); EmitUint8(0xA4); } - void Assembler::movss(XmmRegister dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF3); @@ -359,7 +315,6 @@ void Assembler::movss(XmmRegister dst, const Address& src) { EmitOperand(dst, src); } - void Assembler::movss(const Address& dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF3); @@ -368,7 +323,6 @@ void Assembler::movss(const Address& dst, XmmRegister src) { EmitOperand(src, dst); } - void Assembler::movss(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF3); @@ -377,7 +331,6 @@ void Assembler::movss(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(src, dst); } - void Assembler::movd(XmmRegister dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -386,7 +339,6 @@ void Assembler::movd(XmmRegister dst, Register src) { EmitOperand(dst, Operand(src)); } - void Assembler::movd(Register dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -395,7 +347,6 @@ void Assembler::movd(Register dst, XmmRegister src) { EmitOperand(src, Operand(dst)); } - void Assembler::movq(const Address& dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -404,7 +355,6 @@ void Assembler::movq(const Address& dst, XmmRegister src) { EmitOperand(src, Operand(dst)); } - void Assembler::movq(XmmRegister dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF3); @@ -413,7 +363,6 @@ void Assembler::movq(XmmRegister dst, const Address& src) { EmitOperand(dst, Operand(src)); } - void Assembler::addss(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF3); @@ -422,7 +371,6 @@ void Assembler::addss(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::addss(XmmRegister dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF3); @@ -431,7 +379,6 @@ void Assembler::addss(XmmRegister dst, const Address& src) { EmitOperand(dst, src); } - void Assembler::subss(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF3); @@ -440,7 +387,6 @@ void Assembler::subss(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::subss(XmmRegister dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF3); @@ -449,7 +395,6 @@ void Assembler::subss(XmmRegister dst, const Address& src) { EmitOperand(dst, src); } - void Assembler::mulss(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF3); @@ -458,7 +403,6 @@ void Assembler::mulss(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::mulss(XmmRegister dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF3); @@ -467,7 +411,6 @@ void Assembler::mulss(XmmRegister dst, const Address& src) { EmitOperand(dst, src); } - void Assembler::divss(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF3); @@ -476,7 +419,6 @@ void Assembler::divss(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::divss(XmmRegister dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF3); @@ -485,21 +427,18 @@ void Assembler::divss(XmmRegister dst, const Address& src) { EmitOperand(dst, src); } - void Assembler::flds(const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xD9); EmitOperand(0, src); } - void Assembler::fstps(const Address& dst) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xD9); EmitOperand(3, dst); } - void Assembler::movsd(XmmRegister dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF2); @@ -508,7 +447,6 @@ void Assembler::movsd(XmmRegister dst, const Address& src) { EmitOperand(dst, src); } - void Assembler::movsd(const Address& dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF2); @@ -517,7 +455,6 @@ void Assembler::movsd(const Address& dst, XmmRegister src) { EmitOperand(src, dst); } - void Assembler::movsd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF2); @@ -526,7 +463,6 @@ void Assembler::movsd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(src, dst); } - void Assembler::movaps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -534,7 +470,6 @@ void Assembler::movaps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::movups(XmmRegister dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -542,7 +477,6 @@ void Assembler::movups(XmmRegister dst, const Address& src) { EmitOperand(dst, src); } - void Assembler::movups(const Address& dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -550,7 +484,6 @@ void Assembler::movups(const Address& dst, XmmRegister src) { EmitOperand(src, dst); } - void Assembler::addsd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF2); @@ -559,7 +492,6 @@ void Assembler::addsd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::addsd(XmmRegister dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF2); @@ -568,7 +500,6 @@ void Assembler::addsd(XmmRegister dst, const Address& src) { EmitOperand(dst, src); } - void Assembler::addpl(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -577,7 +508,6 @@ void Assembler::addpl(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::subpl(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -586,7 +516,6 @@ void Assembler::subpl(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::addps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -594,7 +523,6 @@ void Assembler::addps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::subps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -602,7 +530,6 @@ void Assembler::subps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::divps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -610,7 +537,6 @@ void Assembler::divps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::mulps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -618,7 +544,6 @@ void Assembler::mulps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::minps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -626,7 +551,6 @@ void Assembler::minps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::maxps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -634,7 +558,6 @@ void Assembler::maxps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::andps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -642,7 +565,6 @@ void Assembler::andps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::andps(XmmRegister dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -650,7 +572,6 @@ void Assembler::andps(XmmRegister dst, const Address& src) { EmitOperand(dst, src); } - void Assembler::orps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -658,7 +579,6 @@ void Assembler::orps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::notps(XmmRegister dst) { static const struct ALIGN16 { uint32_t a; @@ -669,7 +589,6 @@ void Assembler::notps(XmmRegister dst) { xorps(dst, Address::Absolute(reinterpret_cast(&float_not_constant))); } - void Assembler::negateps(XmmRegister dst) { static const struct ALIGN16 { uint32_t a; @@ -681,7 +600,6 @@ void Assembler::negateps(XmmRegister dst) { Address::Absolute(reinterpret_cast(&float_negate_constant))); } - void Assembler::absps(XmmRegister dst) { static const struct ALIGN16 { uint32_t a; @@ -693,7 +611,6 @@ void Assembler::absps(XmmRegister dst) { Address::Absolute(reinterpret_cast(&float_absolute_constant))); } - void Assembler::zerowps(XmmRegister dst) { static const struct ALIGN16 { uint32_t a; @@ -704,7 +621,6 @@ void Assembler::zerowps(XmmRegister dst) { andps(dst, Address::Absolute(reinterpret_cast(&float_zerow_constant))); } - void Assembler::cmppseq(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -713,7 +629,6 @@ void Assembler::cmppseq(XmmRegister dst, XmmRegister src) { EmitUint8(0x0); } - void Assembler::cmppsneq(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -722,7 +637,6 @@ void Assembler::cmppsneq(XmmRegister dst, XmmRegister src) { EmitUint8(0x4); } - void Assembler::cmppslt(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -731,7 +645,6 @@ void Assembler::cmppslt(XmmRegister dst, XmmRegister src) { EmitUint8(0x1); } - void Assembler::cmppsle(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -740,7 +653,6 @@ void Assembler::cmppsle(XmmRegister dst, XmmRegister src) { EmitUint8(0x2); } - void Assembler::cmppsnlt(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -749,7 +661,6 @@ void Assembler::cmppsnlt(XmmRegister dst, XmmRegister src) { EmitUint8(0x5); } - void Assembler::cmppsnle(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -758,7 +669,6 @@ void Assembler::cmppsnle(XmmRegister dst, XmmRegister src) { EmitUint8(0x6); } - void Assembler::sqrtps(XmmRegister dst) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -766,7 +676,6 @@ void Assembler::sqrtps(XmmRegister dst) { EmitXmmRegisterOperand(dst, dst); } - void Assembler::rsqrtps(XmmRegister dst) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -774,7 +683,6 @@ void Assembler::rsqrtps(XmmRegister dst) { EmitXmmRegisterOperand(dst, dst); } - void Assembler::reciprocalps(XmmRegister dst) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -782,7 +690,6 @@ void Assembler::reciprocalps(XmmRegister dst) { EmitXmmRegisterOperand(dst, dst); } - void Assembler::movhlps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -790,7 +697,6 @@ void Assembler::movhlps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::movlhps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -798,7 +704,6 @@ void Assembler::movlhps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::unpcklps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -806,7 +711,6 @@ void Assembler::unpcklps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::unpckhps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -814,7 +718,6 @@ void Assembler::unpckhps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::unpcklpd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -823,7 +726,6 @@ void Assembler::unpcklpd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::unpckhpd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -832,7 +734,6 @@ void Assembler::unpckhpd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::set1ps(XmmRegister dst, Register tmp1, const Immediate& imm) { // Load 32-bit immediate value into tmp1. movl(tmp1, imm); @@ -842,7 +743,6 @@ void Assembler::set1ps(XmmRegister dst, Register tmp1, const Immediate& imm) { shufps(dst, dst, Immediate(0x0)); } - void Assembler::shufps(XmmRegister dst, XmmRegister src, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -852,7 +752,6 @@ void Assembler::shufps(XmmRegister dst, XmmRegister src, const Immediate& imm) { EmitUint8(imm.value()); } - void Assembler::addpd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -861,7 +760,6 @@ void Assembler::addpd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::negatepd(XmmRegister dst) { static const struct ALIGN16 { uint64_t a; @@ -871,7 +769,6 @@ void Assembler::negatepd(XmmRegister dst) { Address::Absolute(reinterpret_cast(&double_negate_constant))); } - void Assembler::subpd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -880,7 +777,6 @@ void Assembler::subpd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::mulpd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -889,7 +785,6 @@ void Assembler::mulpd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::divpd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -898,7 +793,6 @@ void Assembler::divpd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::abspd(XmmRegister dst) { static const struct ALIGN16 { uint64_t a; @@ -908,7 +802,6 @@ void Assembler::abspd(XmmRegister dst) { Address::Absolute(reinterpret_cast(&double_absolute_constant))); } - void Assembler::minpd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -917,7 +810,6 @@ void Assembler::minpd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::maxpd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -926,7 +818,6 @@ void Assembler::maxpd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::sqrtpd(XmmRegister dst) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -935,7 +826,6 @@ void Assembler::sqrtpd(XmmRegister dst) { EmitXmmRegisterOperand(dst, dst); } - void Assembler::cvtps2pd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -943,7 +833,6 @@ void Assembler::cvtps2pd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::cvtpd2ps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -952,7 +841,6 @@ void Assembler::cvtpd2ps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::shufpd(XmmRegister dst, XmmRegister src, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -963,7 +851,6 @@ void Assembler::shufpd(XmmRegister dst, XmmRegister src, const Immediate& imm) { EmitUint8(imm.value()); } - void Assembler::subsd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF2); @@ -972,7 +859,6 @@ void Assembler::subsd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::subsd(XmmRegister dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF2); @@ -981,7 +867,6 @@ void Assembler::subsd(XmmRegister dst, const Address& src) { EmitOperand(dst, src); } - void Assembler::mulsd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF2); @@ -990,7 +875,6 @@ void Assembler::mulsd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::mulsd(XmmRegister dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF2); @@ -999,7 +883,6 @@ void Assembler::mulsd(XmmRegister dst, const Address& src) { EmitOperand(dst, src); } - void Assembler::divsd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF2); @@ -1008,7 +891,6 @@ void Assembler::divsd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::divsd(XmmRegister dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF2); @@ -1017,7 +899,6 @@ void Assembler::divsd(XmmRegister dst, const Address& src) { EmitOperand(dst, src); } - void Assembler::cvtsi2ss(XmmRegister dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF3); @@ -1026,7 +907,6 @@ void Assembler::cvtsi2ss(XmmRegister dst, Register src) { EmitOperand(dst, Operand(src)); } - void Assembler::cvtsi2sd(XmmRegister dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF2); @@ -1035,7 +915,6 @@ void Assembler::cvtsi2sd(XmmRegister dst, Register src) { EmitOperand(dst, Operand(src)); } - void Assembler::cvtss2si(Register dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF3); @@ -1044,7 +923,6 @@ void Assembler::cvtss2si(Register dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::cvtss2sd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF3); @@ -1053,7 +931,6 @@ void Assembler::cvtss2sd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::cvtsd2si(Register dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF2); @@ -1062,7 +939,6 @@ void Assembler::cvtsd2si(Register dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::cvttss2si(Register dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF3); @@ -1071,7 +947,6 @@ void Assembler::cvttss2si(Register dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::cvttsd2si(Register dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF2); @@ -1080,7 +955,6 @@ void Assembler::cvttsd2si(Register dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::cvtsd2ss(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF2); @@ -1089,7 +963,6 @@ void Assembler::cvtsd2ss(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::cvtdq2pd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF3); @@ -1098,7 +971,6 @@ void Assembler::cvtdq2pd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::comiss(XmmRegister a, XmmRegister b) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -1106,7 +978,6 @@ void Assembler::comiss(XmmRegister a, XmmRegister b) { EmitXmmRegisterOperand(a, b); } - void Assembler::comisd(XmmRegister a, XmmRegister b) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -1115,7 +986,6 @@ void Assembler::comisd(XmmRegister a, XmmRegister b) { EmitXmmRegisterOperand(a, b); } - void Assembler::movmskpd(Register dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -1124,7 +994,6 @@ void Assembler::movmskpd(Register dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::movmskps(Register dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -1132,7 +1001,6 @@ void Assembler::movmskps(Register dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::sqrtsd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF2); @@ -1141,7 +1009,6 @@ void Assembler::sqrtsd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::sqrtss(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF3); @@ -1150,7 +1017,6 @@ void Assembler::sqrtss(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::xorpd(XmmRegister dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -1159,7 +1025,6 @@ void Assembler::xorpd(XmmRegister dst, const Address& src) { EmitOperand(dst, src); } - void Assembler::xorpd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -1168,7 +1033,6 @@ void Assembler::xorpd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::orpd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -1177,7 +1041,6 @@ void Assembler::orpd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::xorps(XmmRegister dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -1185,7 +1048,6 @@ void Assembler::xorps(XmmRegister dst, const Address& src) { EmitOperand(dst, src); } - void Assembler::xorps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -1193,7 +1055,6 @@ void Assembler::xorps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::andpd(XmmRegister dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -1202,7 +1063,6 @@ void Assembler::andpd(XmmRegister dst, const Address& src) { EmitOperand(dst, src); } - void Assembler::andpd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -1211,7 +1071,6 @@ void Assembler::andpd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::pextrd(Register dst, XmmRegister src, const Immediate& imm) { ASSERT(TargetCPUFeatures::sse4_1_supported()); AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -1224,7 +1083,6 @@ void Assembler::pextrd(Register dst, XmmRegister src, const Immediate& imm) { EmitUint8(imm.value()); } - void Assembler::pmovsxdq(XmmRegister dst, XmmRegister src) { ASSERT(TargetCPUFeatures::sse4_1_supported()); AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -1235,7 +1093,6 @@ void Assembler::pmovsxdq(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::pcmpeqq(XmmRegister dst, XmmRegister src) { ASSERT(TargetCPUFeatures::sse4_1_supported()); AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -1246,7 +1103,6 @@ void Assembler::pcmpeqq(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::pxor(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -1255,7 +1111,6 @@ void Assembler::pxor(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst, src); } - void Assembler::roundsd(XmmRegister dst, XmmRegister src, RoundingMode mode) { ASSERT(TargetCPUFeatures::sse4_1_supported()); AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -1268,70 +1123,60 @@ void Assembler::roundsd(XmmRegister dst, XmmRegister src, RoundingMode mode) { EmitUint8(static_cast(mode) | 0x8); } - void Assembler::fldl(const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xDD); EmitOperand(0, src); } - void Assembler::fstpl(const Address& dst) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xDD); EmitOperand(3, dst); } - void Assembler::fnstcw(const Address& dst) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xD9); EmitOperand(7, dst); } - void Assembler::fldcw(const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xD9); EmitOperand(5, src); } - void Assembler::fistpl(const Address& dst) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xDF); EmitOperand(7, dst); } - void Assembler::fistps(const Address& dst) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xDB); EmitOperand(3, dst); } - void Assembler::fildl(const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xDF); EmitOperand(5, src); } - void Assembler::filds(const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xDB); EmitOperand(0, src); } - void Assembler::fincstp() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xD9); EmitUint8(0xF7); } - void Assembler::ffree(intptr_t value) { ASSERT(value < 7); AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -1339,89 +1184,76 @@ void Assembler::ffree(intptr_t value) { EmitUint8(0xC0 + value); } - void Assembler::fsin() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xD9); EmitUint8(0xFE); } - void Assembler::fcos() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xD9); EmitUint8(0xFF); } - void Assembler::fsincos() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xD9); EmitUint8(0xFB); } - void Assembler::fptan() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xD9); EmitUint8(0xF2); } - void Assembler::xchgl(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x87); EmitRegisterOperand(dst, src); } - void Assembler::cmpl(Register reg, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitComplex(7, Operand(reg), imm); } - void Assembler::cmpl(Register reg0, Register reg1) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x3B); EmitOperand(reg0, Operand(reg1)); } - void Assembler::cmpl(Register reg, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x3B); EmitOperand(reg, address); } - void Assembler::addl(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x03); EmitRegisterOperand(dst, src); } - void Assembler::addl(Register reg, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x03); EmitOperand(reg, address); } - void Assembler::cmpl(const Address& address, Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x39); EmitOperand(reg, address); } - void Assembler::cmpl(const Address& address, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitComplex(7, address, imm); } - void Assembler::cmpw(Register reg, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandSizeOverride(); @@ -1429,7 +1261,6 @@ void Assembler::cmpw(Register reg, const Address& address) { EmitOperand(reg, address); } - void Assembler::cmpw(const Address& address, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandSizeOverride(); @@ -1439,7 +1270,6 @@ void Assembler::cmpw(const Address& address, const Immediate& imm) { EmitUint8((imm.value() >> 8) & 0xFF); } - void Assembler::cmpb(const Address& address, const Immediate& imm) { ASSERT(imm.is_int8()); AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -1448,14 +1278,12 @@ void Assembler::cmpb(const Address& address, const Immediate& imm) { EmitUint8(imm.value() & 0xFF); } - void Assembler::testl(Register reg1, Register reg2) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x85); EmitRegisterOperand(reg1, reg2); } - void Assembler::testl(Register reg, const Immediate& immediate) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); // For registers that have a byte variant (EAX, EBX, ECX, and EDX) @@ -1480,7 +1308,6 @@ void Assembler::testl(Register reg, const Immediate& immediate) { } } - void Assembler::testb(const Address& address, const Immediate& imm) { ASSERT(imm.is_int8()); AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -1489,167 +1316,142 @@ void Assembler::testb(const Address& address, const Immediate& imm) { EmitUint8(imm.value() & 0xFF); } - void Assembler::andl(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x23); EmitOperand(dst, Operand(src)); } - void Assembler::andl(Register dst, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitComplex(4, Operand(dst), imm); } - void Assembler::andl(Register dst, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x23); EmitOperand(dst, address); } - void Assembler::orl(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0B); EmitOperand(dst, Operand(src)); } - void Assembler::orl(Register dst, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitComplex(1, Operand(dst), imm); } - void Assembler::orl(Register dst, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0B); EmitOperand(dst, address); } - void Assembler::orl(const Address& address, Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x09); EmitOperand(reg, address); } - void Assembler::xorl(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x33); EmitOperand(dst, Operand(src)); } - void Assembler::xorl(Register dst, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitComplex(6, Operand(dst), imm); } - void Assembler::xorl(Register dst, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x33); EmitOperand(dst, address); } - void Assembler::addl(Register reg, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitComplex(0, Operand(reg), imm); } - void Assembler::addl(const Address& address, Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x01); EmitOperand(reg, address); } - void Assembler::addl(const Address& address, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitComplex(0, address, imm); } - void Assembler::adcl(Register reg, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitComplex(2, Operand(reg), imm); } - void Assembler::adcl(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x13); EmitOperand(dst, Operand(src)); } - void Assembler::adcl(Register dst, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x13); EmitOperand(dst, address); } - void Assembler::adcl(const Address& address, Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x11); EmitOperand(reg, address); } - void Assembler::subl(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x2B); EmitOperand(dst, Operand(src)); } - void Assembler::subl(Register reg, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitComplex(5, Operand(reg), imm); } - void Assembler::subl(Register reg, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x2B); EmitOperand(reg, address); } - void Assembler::subl(const Address& address, Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x29); EmitOperand(reg, address); } - void Assembler::cdq() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x99); } - void Assembler::idivl(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF7); EmitOperand(7, Operand(reg)); } - void Assembler::divl(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF7); EmitOperand(6, Operand(reg)); } - void Assembler::imull(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -1657,7 +1459,6 @@ void Assembler::imull(Register dst, Register src) { EmitOperand(dst, Operand(src)); } - void Assembler::imull(Register reg, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x69); @@ -1665,7 +1466,6 @@ void Assembler::imull(Register reg, const Immediate& imm) { EmitImmediate(imm); } - void Assembler::imull(Register reg, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -1673,128 +1473,107 @@ void Assembler::imull(Register reg, const Address& address) { EmitOperand(reg, address); } - void Assembler::imull(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF7); EmitOperand(5, Operand(reg)); } - void Assembler::imull(const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF7); EmitOperand(5, address); } - void Assembler::mull(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF7); EmitOperand(4, Operand(reg)); } - void Assembler::mull(const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF7); EmitOperand(4, address); } - void Assembler::sbbl(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x1B); EmitOperand(dst, Operand(src)); } - void Assembler::sbbl(Register reg, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitComplex(3, Operand(reg), imm); } - void Assembler::sbbl(Register dst, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x1B); EmitOperand(dst, address); } - void Assembler::sbbl(const Address& address, Register dst) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x19); EmitOperand(dst, address); } - void Assembler::incl(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x40 + reg); } - void Assembler::incl(const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xFF); EmitOperand(0, address); } - void Assembler::decl(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x48 + reg); } - void Assembler::decl(const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xFF); EmitOperand(1, address); } - void Assembler::shll(Register reg, const Immediate& imm) { EmitGenericShift(4, reg, imm); } - void Assembler::shll(Register operand, Register shifter) { EmitGenericShift(4, Operand(operand), shifter); } - void Assembler::shll(const Address& operand, Register shifter) { EmitGenericShift(4, Operand(operand), shifter); } - void Assembler::shrl(Register reg, const Immediate& imm) { EmitGenericShift(5, reg, imm); } - void Assembler::shrl(Register operand, Register shifter) { EmitGenericShift(5, Operand(operand), shifter); } - void Assembler::sarl(Register reg, const Immediate& imm) { EmitGenericShift(7, reg, imm); } - void Assembler::sarl(Register operand, Register shifter) { EmitGenericShift(7, Operand(operand), shifter); } - void Assembler::sarl(const Address& address, Register shifter) { EmitGenericShift(7, Operand(address), shifter); } - void Assembler::shldl(Register dst, Register src, Register shifter) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); ASSERT(shifter == ECX); @@ -1803,7 +1582,6 @@ void Assembler::shldl(Register dst, Register src, Register shifter) { EmitRegisterOperand(src, dst); } - void Assembler::shldl(Register dst, Register src, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); ASSERT(imm.is_int8()); @@ -1813,7 +1591,6 @@ void Assembler::shldl(Register dst, Register src, const Immediate& imm) { EmitUint8(imm.value() & 0xFF); } - void Assembler::shldl(const Address& operand, Register src, Register shifter) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); ASSERT(shifter == ECX); @@ -1822,7 +1599,6 @@ void Assembler::shldl(const Address& operand, Register src, Register shifter) { EmitOperand(src, Operand(operand)); } - void Assembler::shrdl(Register dst, Register src, Register shifter) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); ASSERT(shifter == ECX); @@ -1831,7 +1607,6 @@ void Assembler::shrdl(Register dst, Register src, Register shifter) { EmitRegisterOperand(src, dst); } - void Assembler::shrdl(Register dst, Register src, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); ASSERT(imm.is_int8()); @@ -1841,7 +1616,6 @@ void Assembler::shrdl(Register dst, Register src, const Immediate& imm) { EmitUint8(imm.value() & 0xFF); } - void Assembler::shrdl(const Address& dst, Register src, Register shifter) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); ASSERT(shifter == ECX); @@ -1850,21 +1624,18 @@ void Assembler::shrdl(const Address& dst, Register src, Register shifter) { EmitOperand(src, Operand(dst)); } - void Assembler::negl(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF7); EmitOperand(3, Operand(reg)); } - void Assembler::notl(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF7); EmitUint8(0xD0 | reg); } - void Assembler::bsrl(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -1872,7 +1643,6 @@ void Assembler::bsrl(Register dst, Register src) { EmitRegisterOperand(dst, src); } - void Assembler::bt(Register base, Register offset) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -1880,7 +1650,6 @@ void Assembler::bt(Register base, Register offset) { EmitRegisterOperand(offset, base); } - void Assembler::enter(const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xC8); @@ -1890,19 +1659,16 @@ void Assembler::enter(const Immediate& imm) { EmitUint8(0x00); } - void Assembler::leave() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xC9); } - void Assembler::ret() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xC3); } - void Assembler::ret(const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xC2); @@ -1911,7 +1677,6 @@ void Assembler::ret(const Immediate& imm) { EmitUint8((imm.value() >> 8) & 0xFF); } - void Assembler::nop(int size) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); // There are nops up to size 15, but for now just provide up to size 8. @@ -1974,19 +1739,16 @@ void Assembler::nop(int size) { } } - void Assembler::int3() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xCC); } - void Assembler::hlt() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF4); } - void Assembler::j(Condition condition, Label* label, bool near) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); if (label->IsBound()) { @@ -2012,7 +1774,6 @@ void Assembler::j(Condition condition, Label* label, bool near) { } } - void Assembler::j(Condition condition, const ExternalLabel* label) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -2021,14 +1782,12 @@ void Assembler::j(Condition condition, const ExternalLabel* label) { EmitInt32(label->address()); } - void Assembler::jmp(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xFF); EmitRegisterOperand(4, reg); } - void Assembler::jmp(Label* label, bool near) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); if (label->IsBound()) { @@ -2052,7 +1811,6 @@ void Assembler::jmp(Label* label, bool near) { } } - void Assembler::jmp(const ExternalLabel* label) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xE9); @@ -2060,13 +1818,11 @@ void Assembler::jmp(const ExternalLabel* label) { EmitInt32(label->address()); } - void Assembler::lock() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF0); } - void Assembler::cmpxchgl(const Address& address, Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -2074,31 +1830,26 @@ void Assembler::cmpxchgl(const Address& address, Register reg) { EmitOperand(reg, address); } - void Assembler::cpuid() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); EmitUint8(0xA2); } - void Assembler::CompareRegisters(Register a, Register b) { cmpl(a, b); } - void Assembler::MoveRegister(Register to, Register from) { if (to != from) { movl(to, from); } } - void Assembler::PopRegister(Register r) { popl(r); } - void Assembler::AddImmediate(Register reg, const Immediate& imm) { const intptr_t value = imm.value(); if (value == 0) { @@ -2115,7 +1866,6 @@ void Assembler::AddImmediate(Register reg, const Immediate& imm) { } } - void Assembler::SubImmediate(Register reg, const Immediate& imm) { const intptr_t value = imm.value(); if (value == 0) { @@ -2132,7 +1882,6 @@ void Assembler::SubImmediate(Register reg, const Immediate& imm) { } } - void Assembler::Drop(intptr_t stack_elements) { ASSERT(stack_elements >= 0); if (stack_elements > 0) { @@ -2140,12 +1889,10 @@ void Assembler::Drop(intptr_t stack_elements) { } } - void Assembler::LoadIsolate(Register dst) { movl(dst, Address(THR, Thread::isolate_offset())); } - void Assembler::LoadObject(Register dst, const Object& object) { ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); ASSERT(!object.IsField() || Field::Cast(object).IsOriginal()); @@ -2160,7 +1907,6 @@ void Assembler::LoadObject(Register dst, const Object& object) { } } - void Assembler::LoadObjectSafely(Register dst, const Object& object) { ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); ASSERT(!object.IsField() || Field::Cast(object).IsOriginal()); @@ -2173,7 +1919,6 @@ void Assembler::LoadObjectSafely(Register dst, const Object& object) { } } - void Assembler::PushObject(const Object& object) { ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); ASSERT(!object.IsField() || Field::Cast(object).IsOriginal()); @@ -2188,7 +1933,6 @@ void Assembler::PushObject(const Object& object) { } } - void Assembler::CompareObject(Register reg, const Object& object) { ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); ASSERT(!object.IsField() || Field::Cast(object).IsOriginal()); @@ -2209,7 +1953,6 @@ void Assembler::CompareObject(Register reg, const Object& object) { } } - // Destroys the value register. void Assembler::StoreIntoObjectFilterNoSmi(Register object, Register value, @@ -2229,7 +1972,6 @@ void Assembler::StoreIntoObjectFilterNoSmi(Register object, j(NOT_ZERO, no_update, Assembler::kNearJump); } - // Destroys the value register. void Assembler::StoreIntoObjectFilter(Register object, Register value, @@ -2249,7 +1991,6 @@ void Assembler::StoreIntoObjectFilter(Register object, j(NOT_ZERO, no_update, Assembler::kNearJump); } - // Destroys the value register. void Assembler::StoreIntoObject(Register object, const Address& dest, @@ -2277,7 +2018,6 @@ void Assembler::StoreIntoObject(Register object, Bind(&done); } - void Assembler::StoreIntoObjectNoBarrier(Register object, const Address& dest, Register value) { @@ -2293,7 +2033,6 @@ void Assembler::StoreIntoObjectNoBarrier(Register object, // No store buffer update. } - void Assembler::UnverifiedStoreOldObject(const Address& dest, const Object& value) { ASSERT(!value.IsICData() || ICData::Cast(value).IsOriginal()); @@ -2306,7 +2045,6 @@ void Assembler::UnverifiedStoreOldObject(const Address& dest, buffer_.EmitObject(value); } - void Assembler::StoreIntoObjectNoBarrier(Register object, const Address& dest, const Object& value) { @@ -2321,7 +2059,6 @@ void Assembler::StoreIntoObjectNoBarrier(Register object, // No store buffer update. } - void Assembler::StoreIntoSmiField(const Address& dest, Register value) { #if defined(DEBUG) Label done; @@ -2333,13 +2070,11 @@ void Assembler::StoreIntoSmiField(const Address& dest, Register value) { movl(dest, value); } - void Assembler::ZeroInitSmiField(const Address& dest) { Immediate zero(Smi::RawValue(0)); movl(dest, zero); } - void Assembler::IncrementSmiField(const Address& dest, int32_t increment) { // Note: FlowGraphCompiler::EdgeCounterIncrementSizeInBytes depends on // the length of this instruction sequence. @@ -2347,7 +2082,6 @@ void Assembler::IncrementSmiField(const Address& dest, int32_t increment) { addl(dest, inc_imm); } - void Assembler::LoadDoubleConstant(XmmRegister dst, double value) { // TODO(5410843): Need to have a code constants table. int64_t constant = bit_cast(value); @@ -2357,7 +2091,6 @@ void Assembler::LoadDoubleConstant(XmmRegister dst, double value) { addl(ESP, Immediate(2 * kWordSize)); } - void Assembler::FloatNegate(XmmRegister f) { static const struct ALIGN16 { uint32_t a; @@ -2368,7 +2101,6 @@ void Assembler::FloatNegate(XmmRegister f) { xorps(f, Address::Absolute(reinterpret_cast(&float_negate_constant))); } - void Assembler::DoubleNegate(XmmRegister d) { static const struct ALIGN16 { uint64_t a; @@ -2377,7 +2109,6 @@ void Assembler::DoubleNegate(XmmRegister d) { xorpd(d, Address::Absolute(reinterpret_cast(&double_negate_constant))); } - void Assembler::DoubleAbs(XmmRegister reg) { static const struct ALIGN16 { uint64_t a; @@ -2386,7 +2117,6 @@ void Assembler::DoubleAbs(XmmRegister reg) { andpd(reg, Address::Absolute(reinterpret_cast(&double_abs_constant))); } - void Assembler::EnterFrame(intptr_t frame_size) { if (prologue_offset_ == -1) { Comment("PrologueOffset = %" Pd "", CodeSize()); @@ -2407,13 +2137,11 @@ void Assembler::EnterFrame(intptr_t frame_size) { } } - void Assembler::LeaveFrame() { movl(ESP, EBP); popl(EBP); } - void Assembler::ReserveAlignedFrameSpace(intptr_t frame_space) { // Reserve space for arguments and align frame before entering // the C++ world. @@ -2423,17 +2151,14 @@ void Assembler::ReserveAlignedFrameSpace(intptr_t frame_space) { } } - static const intptr_t kNumberOfVolatileCpuRegisters = 3; static const Register volatile_cpu_registers[kNumberOfVolatileCpuRegisters] = { EAX, ECX, EDX}; - // XMM0 is used only as a scratch register in the optimized code. No need to // save it. static const intptr_t kNumberOfVolatileXmmRegisters = kNumberOfXmmRegisters - 1; - void Assembler::EnterCallRuntimeFrame(intptr_t frame_space) { Comment("EnterCallRuntimeFrame"); EnterFrame(0); @@ -2457,7 +2182,6 @@ void Assembler::EnterCallRuntimeFrame(intptr_t frame_space) { ReserveAlignedFrameSpace(frame_space); } - void Assembler::LeaveCallRuntimeFrame() { // ESP might have been modified to reserve space for arguments // and ensure proper alignment of the stack frame. @@ -2485,38 +2209,32 @@ void Assembler::LeaveCallRuntimeFrame() { leave(); } - void Assembler::CallRuntime(const RuntimeEntry& entry, intptr_t argument_count) { entry.Call(this, argument_count); } - void Assembler::Call(const StubEntry& stub_entry) { const Code& target = Code::ZoneHandle(stub_entry.code()); LoadObject(CODE_REG, target); call(FieldAddress(CODE_REG, Code::entry_point_offset())); } - void Assembler::CallToRuntime() { movl(CODE_REG, Address(THR, Thread::call_to_runtime_stub_offset())); call(Address(THR, Thread::call_to_runtime_entry_point_offset())); } - void Assembler::Jmp(const StubEntry& stub_entry) { const ExternalLabel label(stub_entry.EntryPoint()); jmp(&label); } - void Assembler::J(Condition condition, const StubEntry& stub_entry) { const ExternalLabel label(stub_entry.EntryPoint()); j(condition, &label); } - void Assembler::Align(intptr_t alignment, intptr_t offset) { ASSERT(Utils::IsPowerOfTwo(alignment)); intptr_t pos = offset + buffer_.GetPosition(); @@ -2535,7 +2253,6 @@ void Assembler::Align(intptr_t alignment, intptr_t offset) { ASSERT(((offset + buffer_.GetPosition()) & (alignment - 1)) == 0); } - void Assembler::Bind(Label* label) { intptr_t bound = buffer_.Size(); ASSERT(!label->IsBound()); // Labels can only be bound once. @@ -2554,7 +2271,6 @@ void Assembler::Bind(Label* label) { label->BindTo(bound); } - #ifndef PRODUCT void Assembler::MaybeTraceAllocation(intptr_t cid, Register temp_reg, @@ -2575,7 +2291,6 @@ void Assembler::MaybeTraceAllocation(intptr_t cid, j(NOT_ZERO, trace, near_jump); } - void Assembler::UpdateAllocationStats(intptr_t cid, Register temp_reg, Heap::Space space) { @@ -2590,7 +2305,6 @@ void Assembler::UpdateAllocationStats(intptr_t cid, incl(Address(temp_reg, counter_offset)); } - void Assembler::UpdateAllocationStatsWithSize(intptr_t cid, Register size_reg, Register temp_reg, @@ -2602,7 +2316,6 @@ void Assembler::UpdateAllocationStatsWithSize(intptr_t cid, addl(Address(temp_reg, size_offset), size_reg); } - void Assembler::UpdateAllocationStatsWithSize(intptr_t cid, intptr_t size_in_bytes, Register temp_reg, @@ -2615,7 +2328,6 @@ void Assembler::UpdateAllocationStatsWithSize(intptr_t cid, } #endif // !PRODUCT - void Assembler::TryAllocate(const Class& cls, Label* failure, bool near_jump, @@ -2653,7 +2365,6 @@ void Assembler::TryAllocate(const Class& cls, } } - void Assembler::TryAllocateArray(intptr_t cid, intptr_t instance_size, Label* failure, @@ -2699,7 +2410,6 @@ void Assembler::TryAllocateArray(intptr_t cid, } } - void Assembler::PushCodeObject() { ASSERT(code_.IsNotTemporaryScopedHandle()); AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -2707,7 +2417,6 @@ void Assembler::PushCodeObject() { buffer_.EmitObject(code_); } - void Assembler::EnterDartFrame(intptr_t frame_size) { EnterFrame(0); @@ -2718,7 +2427,6 @@ void Assembler::EnterDartFrame(intptr_t frame_size) { } } - // On entry to a function compiled for OSR, the caller's frame pointer, the // stack locals, and any copied parameters are already in place. The frame // pointer is already set up. There may be extra space for spill slots to @@ -2735,12 +2443,10 @@ void Assembler::EnterOsrFrame(intptr_t extra_size) { } } - void Assembler::EnterStubFrame() { EnterDartFrame(0); } - void Assembler::Stop(const char* message) { if (FLAG_print_stop_message) { pushl(EAX); // Preserve EAX. @@ -2755,7 +2461,6 @@ void Assembler::Stop(const char* message) { int3(); // Execution can be resumed with the 'cont' command in gdb. } - void Assembler::EmitOperand(int rm, const Operand& operand) { ASSERT(rm >= 0 && rm < 8); const intptr_t length = operand.length_; @@ -2769,12 +2474,10 @@ void Assembler::EmitOperand(int rm, const Operand& operand) { } } - void Assembler::EmitImmediate(const Immediate& imm) { EmitInt32(imm.value()); } - void Assembler::EmitComplex(int rm, const Operand& operand, const Immediate& immediate) { @@ -2795,7 +2498,6 @@ void Assembler::EmitComplex(int rm, } } - void Assembler::EmitLabel(Label* label, intptr_t instruction_size) { if (label->IsBound()) { intptr_t offset = label->Position() - buffer_.Size(); @@ -2806,7 +2508,6 @@ void Assembler::EmitLabel(Label* label, intptr_t instruction_size) { } } - void Assembler::EmitLabelLink(Label* label) { ASSERT(!label->IsBound()); intptr_t position = buffer_.Size(); @@ -2814,7 +2515,6 @@ void Assembler::EmitLabelLink(Label* label) { label->LinkTo(position); } - void Assembler::EmitNearLabelLink(Label* label) { ASSERT(!label->IsBound()); intptr_t position = buffer_.Size(); @@ -2822,7 +2522,6 @@ void Assembler::EmitNearLabelLink(Label* label) { label->NearLinkTo(position); } - void Assembler::EmitGenericShift(int rm, Register reg, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); ASSERT(imm.is_int8()); @@ -2836,7 +2535,6 @@ void Assembler::EmitGenericShift(int rm, Register reg, const Immediate& imm) { } } - void Assembler::EmitGenericShift(int rm, const Operand& operand, Register shifter) { @@ -2846,7 +2544,6 @@ void Assembler::EmitGenericShift(int rm, EmitOperand(rm, Operand(operand)); } - void Assembler::LoadClassId(Register result, Register object) { ASSERT(RawObject::kClassIdTagPos == 16); ASSERT(RawObject::kClassIdTagSize == 16); @@ -2855,7 +2552,6 @@ void Assembler::LoadClassId(Register result, Register object) { movzxw(result, FieldAddress(object, class_id_offset)); } - void Assembler::LoadClassById(Register result, Register class_id) { ASSERT(result != class_id); LoadIsolate(result); @@ -2865,14 +2561,12 @@ void Assembler::LoadClassById(Register result, Register class_id) { movl(result, Address(result, class_id, TIMES_4, 0)); } - void Assembler::LoadClass(Register result, Register object, Register scratch) { ASSERT(scratch != result); LoadClassId(scratch, object); LoadClassById(result, scratch); } - void Assembler::CompareClassId(Register object, intptr_t class_id, Register scratch) { @@ -2880,7 +2574,6 @@ void Assembler::CompareClassId(Register object, cmpl(scratch, Immediate(class_id)); } - void Assembler::SmiUntagOrCheckClass(Register object, intptr_t class_id, Register scratch, @@ -2900,7 +2593,6 @@ void Assembler::SmiUntagOrCheckClass(Register object, cmpl(scratch, Immediate(class_id)); } - void Assembler::LoadClassIdMayBeSmi(Register result, Register object) { if (result == object) { Label smi, join; @@ -2931,7 +2623,6 @@ void Assembler::LoadClassIdMayBeSmi(Register result, Register object) { } } - void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { if (result == object) { Label smi, join; @@ -2952,7 +2643,6 @@ void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { } } - Address Assembler::ElementAddressForIntIndex(bool is_external, intptr_t cid, intptr_t index_scale, @@ -2968,7 +2658,6 @@ Address Assembler::ElementAddressForIntIndex(bool is_external, } } - static ScaleFactor ToScaleFactor(intptr_t index_scale) { // Note that index is expected smi-tagged, (i.e, times 2) for all arrays with // index scale factor > 1. E.g., for Uint8Array and OneByteString the index is @@ -2991,7 +2680,6 @@ static ScaleFactor ToScaleFactor(intptr_t index_scale) { } } - Address Assembler::ElementAddressForRegIndex(bool is_external, intptr_t cid, intptr_t index_scale, @@ -3005,27 +2693,22 @@ Address Assembler::ElementAddressForRegIndex(bool is_external, } } - static const char* cpu_reg_names[kNumberOfCpuRegisters] = { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi"}; - const char* Assembler::RegisterName(Register reg) { ASSERT((0 <= reg) && (reg < kNumberOfCpuRegisters)); return cpu_reg_names[reg]; } - static const char* xmm_reg_names[kNumberOfXmmRegisters] = { "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7"}; - const char* Assembler::FpuRegisterName(FpuRegister reg) { ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); return xmm_reg_names[reg]; } - } // namespace dart #endif // defined TARGET_ARCH_IA32 diff --git a/runtime/vm/assembler_ia32.h b/runtime/vm/assembler_ia32.h index 993da0aa0b0..299ba2a7ffd 100644 --- a/runtime/vm/assembler_ia32.h +++ b/runtime/vm/assembler_ia32.h @@ -39,7 +39,6 @@ class Immediate : public ValueObject { // And remove the unnecessary copy constructor. }; - class Operand : public ValueObject { public: uint8_t mod() const { return (encoding_at(0) >> 6) & 3; } @@ -135,7 +134,6 @@ class Operand : public ValueObject { friend class Assembler; }; - class Address : public Operand { public: Address(Register base, int32_t disp) { @@ -200,7 +198,6 @@ class Address : public Operand { Address() {} // Needed by Address::Absolute. }; - class FieldAddress : public Address { public: FieldAddress(Register base, int32_t disp) @@ -223,7 +220,6 @@ class FieldAddress : public Address { } }; - class Label : public ValueObject { public: Label() : position_(0), unresolved_(0) { @@ -292,7 +288,6 @@ class Label : public ValueObject { DISALLOW_COPY_AND_ASSIGN(Label); }; - class Assembler : public ValueObject { public: explicit Assembler(bool use_far_branches = false) @@ -941,7 +936,6 @@ class Assembler : public ValueObject { DISALLOW_COPY_AND_ASSIGN(CodeComment); }; - inline void EmitUint8(uint8_t value); inline void EmitInt32(int32_t value); inline void EmitRegisterOperand(int rm, int reg); @@ -980,33 +974,27 @@ class Assembler : public ValueObject { DISALLOW_COPY_AND_ASSIGN(Assembler); }; - inline void Assembler::EmitUint8(uint8_t value) { buffer_.Emit(value); } - inline void Assembler::EmitInt32(int32_t value) { buffer_.Emit(value); } - inline void Assembler::EmitRegisterOperand(int rm, int reg) { ASSERT(rm >= 0 && rm < 8); buffer_.Emit(0xC0 + (rm << 3) + reg); } - inline void Assembler::EmitXmmRegisterOperand(int rm, XmmRegister reg) { EmitRegisterOperand(rm, static_cast(reg)); } - inline void Assembler::EmitFixup(AssemblerFixup* fixup) { buffer_.EmitFixup(fixup); } - inline void Assembler::EmitOperandSizeOverride() { EmitUint8(0x66); } diff --git a/runtime/vm/assembler_ia32_test.cc b/runtime/vm/assembler_ia32_test.cc index 4ea1c65053e..85c5e995d99 100644 --- a/runtime/vm/assembler_ia32_test.cc +++ b/runtime/vm/assembler_ia32_test.cc @@ -15,32 +15,27 @@ namespace dart { #define __ assembler-> - ASSEMBLER_TEST_GENERATE(Simple, assembler) { __ movl(EAX, Immediate(42)); __ ret(); } - ASSEMBLER_TEST_RUN(Simple, test) { typedef int (*SimpleCode)(); EXPECT_EQ(42, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(ReadArgument, assembler) { __ movl(EAX, Address(ESP, kWordSize)); __ ret(); } - ASSEMBLER_TEST_RUN(ReadArgument, test) { typedef int (*ReadArgumentCode)(int n); EXPECT_EQ(42, reinterpret_cast(test->entry())(42)); EXPECT_EQ(87, reinterpret_cast(test->entry())(87)); } - ASSEMBLER_TEST_GENERATE(AddressingModes, assembler) { __ movl(EAX, Address(ESP, 0)); __ movl(EAX, Address(EBP, 0)); @@ -98,12 +93,10 @@ ASSEMBLER_TEST_GENERATE(AddressingModes, assembler) { __ movl(EAX, Address(ESP, EAX, TIMES_2, 256 * kWordSize)); } - ASSEMBLER_TEST_RUN(AddressingModes, test) { // Avoid running the code since it is constructed to lead to crashes. } - ASSEMBLER_TEST_GENERATE(JumpAroundCrash, assembler) { Label done; // Make sure all the condition jumps work. @@ -123,7 +116,6 @@ ASSEMBLER_TEST_GENERATE(JumpAroundCrash, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(JumpAroundCrash, test) { Instr* instr = Instr::At(test->entry()); EXPECT(!instr->IsBreakPoint()); @@ -131,7 +123,6 @@ ASSEMBLER_TEST_RUN(JumpAroundCrash, test) { reinterpret_cast(test->entry())(); } - ASSEMBLER_TEST_GENERATE(NearJumpAroundCrash, assembler) { Label done; // Make sure all the condition jumps work. @@ -151,13 +142,11 @@ ASSEMBLER_TEST_GENERATE(NearJumpAroundCrash, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(NearJumpAroundCrash, test) { typedef void (*NearJumpAroundCrashCode)(); reinterpret_cast(test->entry())(); } - ASSEMBLER_TEST_GENERATE(SimpleLoop, assembler) { __ movl(EAX, Immediate(0)); __ movl(ECX, Immediate(0)); @@ -170,13 +159,11 @@ ASSEMBLER_TEST_GENERATE(SimpleLoop, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SimpleLoop, test) { typedef int (*SimpleLoopCode)(); EXPECT_EQ(2 * 87, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(Cmpb, assembler) { Label done; __ movl(EAX, Immediate(1)); @@ -189,13 +176,11 @@ ASSEMBLER_TEST_GENERATE(Cmpb, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Cmpb, test) { typedef int (*CmpbCode)(); EXPECT_EQ(1, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(Testb, assembler) { __ movl(EAX, Immediate(1)); __ movl(ECX, Immediate(0)); @@ -210,13 +195,11 @@ ASSEMBLER_TEST_GENERATE(Testb, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Testb, test) { typedef int (*TestbCode)(); EXPECT_EQ(1, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(Increment, assembler) { __ movl(EAX, Immediate(0)); __ pushl(EAX); @@ -228,13 +211,11 @@ ASSEMBLER_TEST_GENERATE(Increment, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Increment, test) { typedef int (*IncrementCode)(); EXPECT_EQ(2, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(Decrement, assembler) { __ movl(EAX, Immediate(2)); __ pushl(EAX); @@ -246,13 +227,11 @@ ASSEMBLER_TEST_GENERATE(Decrement, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Decrement, test) { typedef int (*DecrementCode)(); EXPECT_EQ(0, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(AddressBinOp, assembler) { __ movl(EAX, Address(ESP, kWordSize)); __ addl(EAX, Address(ESP, kWordSize)); @@ -262,14 +241,12 @@ ASSEMBLER_TEST_GENERATE(AddressBinOp, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(AddressBinOp, test) { typedef int (*AddressBinOpCode)(int a); EXPECT_EQ((2 + 2 + 1 - 2) * 2, reinterpret_cast(test->entry())(2)); } - ASSEMBLER_TEST_GENERATE(SignedMultiply, assembler) { __ movl(EAX, Immediate(2)); __ movl(ECX, Immediate(4)); @@ -278,13 +255,11 @@ ASSEMBLER_TEST_GENERATE(SignedMultiply, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SignedMultiply, test) { typedef int (*SignedMultiply)(); EXPECT_EQ(8000, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(OverflowSignedMultiply, assembler) { __ movl(EDX, Immediate(0)); __ movl(EAX, Immediate(0x0fffffff)); @@ -294,13 +269,11 @@ ASSEMBLER_TEST_GENERATE(OverflowSignedMultiply, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(OverflowSignedMultiply, test) { typedef int (*OverflowSignedMultiply)(); EXPECT_EQ(0, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(SignedMultiply1, assembler) { __ pushl(EBX); // preserve EBX. __ movl(EBX, Immediate(2)); @@ -312,13 +285,11 @@ ASSEMBLER_TEST_GENERATE(SignedMultiply1, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SignedMultiply1, test) { typedef int (*SignedMultiply1)(); EXPECT_EQ(8000, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(Negate, assembler) { __ movl(ECX, Immediate(42)); __ negl(ECX); @@ -326,13 +297,11 @@ ASSEMBLER_TEST_GENERATE(Negate, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Negate, test) { typedef int (*Negate)(); EXPECT_EQ(-42, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(BitScanReverse, assembler) { __ movl(ECX, Address(ESP, kWordSize)); __ movl(EAX, Immediate(666)); // Marker for conditional write. @@ -340,7 +309,6 @@ ASSEMBLER_TEST_GENERATE(BitScanReverse, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(BitScanReverse, test) { typedef int (*Bsr)(int input); Bsr call = reinterpret_cast(test->entry()); @@ -353,7 +321,6 @@ ASSEMBLER_TEST_RUN(BitScanReverse, test) { EXPECT_EQ(31, call(-1)); } - ASSEMBLER_TEST_GENERATE(MoveExtend, assembler) { __ pushl(EBX); // preserve EBX. __ movl(EDX, Immediate(0x1234ffff)); @@ -366,13 +333,11 @@ ASSEMBLER_TEST_GENERATE(MoveExtend, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(MoveExtend, test) { typedef int (*MoveExtend)(); EXPECT_EQ(0xff - 1 + 0xffff, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(MoveExtendMemory, assembler) { __ pushl(EBX); // preserve EBX. __ movl(EDX, Immediate(0x1234ffff)); @@ -389,14 +354,12 @@ ASSEMBLER_TEST_GENERATE(MoveExtendMemory, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(MoveExtendMemory, test) { typedef int (*MoveExtendMemory)(); EXPECT_EQ(0xff - 1 + 0xffff, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(Bitwise, assembler) { __ movl(ECX, Immediate(42)); __ xorl(ECX, ECX); @@ -424,7 +387,6 @@ ASSEMBLER_TEST_GENERATE(Bitwise, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Bitwise, test) { typedef int (*Bitwise)(int* value); int value = 0xA; @@ -433,7 +395,6 @@ ASSEMBLER_TEST_RUN(Bitwise, test) { EXPECT_EQ(0xBA, value); } - ASSEMBLER_TEST_GENERATE(LogicalOps, assembler) { Label donetest1; __ movl(EAX, Immediate(4)); @@ -622,13 +583,11 @@ ASSEMBLER_TEST_GENERATE(LogicalOps, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LogicalOps, test) { typedef int (*LogicalOpsCode)(); EXPECT_EQ(0, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(LogicalTest, assembler) { __ pushl(EBX); // save EBX. Label donetest1; @@ -683,13 +642,11 @@ ASSEMBLER_TEST_GENERATE(LogicalTest, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LogicalTest, test) { typedef int (*LogicalTestCode)(); EXPECT_EQ(0, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(CompareSwapEQ, assembler) { __ movl(EAX, Immediate(0)); __ pushl(EAX); @@ -701,13 +658,11 @@ ASSEMBLER_TEST_GENERATE(CompareSwapEQ, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(CompareSwapEQ, test) { typedef int (*CompareSwapEQCode)(); EXPECT_EQ(0, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(CompareSwapNEQ, assembler) { __ movl(EAX, Immediate(0)); __ pushl(EAX); @@ -719,13 +674,11 @@ ASSEMBLER_TEST_GENERATE(CompareSwapNEQ, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(CompareSwapNEQ, test) { typedef int (*CompareSwapNEQCode)(); EXPECT_EQ(4, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(SignedDivide, assembler) { __ movl(EAX, Immediate(-87)); __ movl(EDX, Immediate(123)); @@ -735,13 +688,11 @@ ASSEMBLER_TEST_GENERATE(SignedDivide, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SignedDivide, test) { typedef int (*SignedDivide)(); EXPECT_EQ(-87 / 42, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(UnsignedDivide, assembler) { __ movl(EAX, Immediate(0xffffffbe)); __ movl(EDX, Immediate(0x41)); @@ -750,13 +701,11 @@ ASSEMBLER_TEST_GENERATE(UnsignedDivide, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(UnsignedDivide, test) { typedef int (*UnsignedDivide)(); EXPECT_EQ(0x42, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(Exchange, assembler) { __ movl(EAX, Immediate(123456789)); __ movl(EDX, Immediate(987654321)); @@ -765,13 +714,11 @@ ASSEMBLER_TEST_GENERATE(Exchange, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Exchange, test) { typedef int (*Exchange)(); EXPECT_EQ(987654321 - 123456789, reinterpret_cast(test->entry())()); } - static int ComputeStackSpaceReservation(int needed, int fixed) { return (OS::ActivationFrameAlignment() > 1) ? Utils::RoundUp(needed + fixed, OS::ActivationFrameAlignment()) - @@ -779,17 +726,14 @@ static int ComputeStackSpaceReservation(int needed, int fixed) { : needed; } - static int LeafReturn42() { return 42; } - static int LeafReturnArgument(int x) { return x + 87; } - ASSEMBLER_TEST_GENERATE(CallSimpleLeaf, assembler) { ExternalLabel call1(reinterpret_cast(LeafReturn42)); ExternalLabel call2(reinterpret_cast(LeafReturnArgument)); @@ -805,13 +749,11 @@ ASSEMBLER_TEST_GENERATE(CallSimpleLeaf, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(CallSimpleLeaf, test) { typedef int (*CallSimpleLeafCode)(); EXPECT_EQ(42 + 87, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(JumpSimpleLeaf, assembler) { ExternalLabel call1(reinterpret_cast(LeafReturn42)); Label L; @@ -824,13 +766,11 @@ ASSEMBLER_TEST_GENERATE(JumpSimpleLeaf, assembler) { __ jmp(&call1); } - ASSEMBLER_TEST_RUN(JumpSimpleLeaf, test) { typedef int (*JumpSimpleLeafCode)(); EXPECT_EQ(42, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(JumpConditionalSimpleLeaf, assembler) { ExternalLabel call1(reinterpret_cast(LeafReturn42)); Label L; @@ -845,14 +785,12 @@ ASSEMBLER_TEST_GENERATE(JumpConditionalSimpleLeaf, assembler) { __ int3(); } - ASSEMBLER_TEST_RUN(JumpConditionalSimpleLeaf, test) { typedef int (*JumpConditionalSimpleLeafCode)(); EXPECT_EQ(42, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(SingleFPMoves, assembler) { __ movl(EAX, Immediate(bit_cast(234.0f))); __ movd(XMM0, EAX); @@ -871,14 +809,12 @@ ASSEMBLER_TEST_GENERATE(SingleFPMoves, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SingleFPMoves, test) { typedef float (*SingleFPMovesCode)(); float res = reinterpret_cast(test->entry())(); EXPECT_EQ(234.0f, res); } - ASSEMBLER_TEST_GENERATE(SingleFPMoves2, assembler) { __ pushl(EBX); // preserve EBX. __ pushl(ECX); // preserve ECX. @@ -894,14 +830,12 @@ ASSEMBLER_TEST_GENERATE(SingleFPMoves2, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SingleFPMoves2, test) { typedef float (*SingleFPMoves2Code)(); float res = reinterpret_cast(test->entry())(); EXPECT_EQ(234.0f, res); } - ASSEMBLER_TEST_GENERATE(SingleFPUStackMoves, assembler) { __ movl(EAX, Immediate(1131020288)); // 234.0f __ pushl(EAX); @@ -914,14 +848,12 @@ ASSEMBLER_TEST_GENERATE(SingleFPUStackMoves, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SingleFPUStackMoves, test) { typedef int (*SingleFPUStackMovesCode)(); int res = reinterpret_cast(test->entry())(); EXPECT_EQ(234.0f, (bit_cast(res))); } - ASSEMBLER_TEST_GENERATE(SingleFPOperations, assembler) { __ movl(EAX, Immediate(bit_cast(12.3f))); __ movd(XMM0, EAX); @@ -938,14 +870,12 @@ ASSEMBLER_TEST_GENERATE(SingleFPOperations, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SingleFPOperations, test) { typedef float (*SingleFPOperationsCode)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(14.7f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedFPOperations, assembler) { __ movl(EAX, Immediate(bit_cast(12.3f))); __ movd(XMM0, EAX); @@ -966,14 +896,12 @@ ASSEMBLER_TEST_GENERATE(PackedFPOperations, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedFPOperations, test) { typedef float (*PackedFPOperationsCode)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(14.7f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedIntOperations, assembler) { __ movl(EAX, Immediate(0x2)); __ movd(XMM0, EAX); @@ -991,14 +919,12 @@ ASSEMBLER_TEST_GENERATE(PackedIntOperations, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedIntOperations, test) { typedef uint32_t (*PackedIntOperationsCode)(); uint32_t res = reinterpret_cast(test->entry())(); EXPECT_EQ(static_cast(0x5), res); } - ASSEMBLER_TEST_GENERATE(PackedFPOperations2, assembler) { __ movl(EAX, Immediate(bit_cast(4.0f))); __ movd(XMM0, EAX); @@ -1018,14 +944,12 @@ ASSEMBLER_TEST_GENERATE(PackedFPOperations2, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedFPOperations2, test) { typedef float (*PackedFPOperations2Code)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(0.0f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedCompareEQ, assembler) { __ set1ps(XMM0, EAX, Immediate(bit_cast(2.0f))); __ set1ps(XMM1, EAX, Immediate(bit_cast(4.0f))); @@ -1038,14 +962,12 @@ ASSEMBLER_TEST_GENERATE(PackedCompareEQ, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedCompareEQ, test) { typedef uint32_t (*PackedCompareEQCode)(); uint32_t res = reinterpret_cast(test->entry())(); EXPECT_EQ(static_cast(0x0), res); } - ASSEMBLER_TEST_GENERATE(PackedCompareNEQ, assembler) { __ set1ps(XMM0, EAX, Immediate(bit_cast(2.0f))); __ set1ps(XMM1, EAX, Immediate(bit_cast(4.0f))); @@ -1058,14 +980,12 @@ ASSEMBLER_TEST_GENERATE(PackedCompareNEQ, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedCompareNEQ, test) { typedef uint32_t (*PackedCompareNEQCode)(); uint32_t res = reinterpret_cast(test->entry())(); EXPECT_EQ(static_cast(0xFFFFFFFF), res); } - ASSEMBLER_TEST_GENERATE(PackedCompareLT, assembler) { __ set1ps(XMM0, EAX, Immediate(bit_cast(2.0f))); __ set1ps(XMM1, EAX, Immediate(bit_cast(4.0f))); @@ -1078,14 +998,12 @@ ASSEMBLER_TEST_GENERATE(PackedCompareLT, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedCompareLT, test) { typedef uint32_t (*PackedCompareLTCode)(); uint32_t res = reinterpret_cast(test->entry())(); EXPECT_EQ(static_cast(0xFFFFFFFF), res); } - ASSEMBLER_TEST_GENERATE(PackedCompareLE, assembler) { __ set1ps(XMM0, EAX, Immediate(bit_cast(2.0f))); __ set1ps(XMM1, EAX, Immediate(bit_cast(4.0f))); @@ -1098,14 +1016,12 @@ ASSEMBLER_TEST_GENERATE(PackedCompareLE, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedCompareLE, test) { typedef uint32_t (*PackedCompareLECode)(); uint32_t res = reinterpret_cast(test->entry())(); EXPECT_EQ(static_cast(0xFFFFFFFF), res); } - ASSEMBLER_TEST_GENERATE(PackedCompareNLT, assembler) { __ set1ps(XMM0, EAX, Immediate(bit_cast(2.0f))); __ set1ps(XMM1, EAX, Immediate(bit_cast(4.0f))); @@ -1118,14 +1034,12 @@ ASSEMBLER_TEST_GENERATE(PackedCompareNLT, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedCompareNLT, test) { typedef uint32_t (*PackedCompareNLTCode)(); uint32_t res = reinterpret_cast(test->entry())(); EXPECT_EQ(static_cast(0x0), res); } - ASSEMBLER_TEST_GENERATE(PackedCompareNLE, assembler) { __ set1ps(XMM0, EAX, Immediate(bit_cast(2.0f))); __ set1ps(XMM1, EAX, Immediate(bit_cast(4.0f))); @@ -1138,14 +1052,12 @@ ASSEMBLER_TEST_GENERATE(PackedCompareNLE, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedCompareNLE, test) { typedef uint32_t (*PackedCompareNLECode)(); uint32_t res = reinterpret_cast(test->entry())(); EXPECT_EQ(static_cast(0x0), res); } - ASSEMBLER_TEST_GENERATE(PackedNegate, assembler) { __ movl(EAX, Immediate(bit_cast(12.3f))); __ movd(XMM0, EAX); @@ -1160,14 +1072,12 @@ ASSEMBLER_TEST_GENERATE(PackedNegate, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedNegate, test) { typedef float (*PackedNegateCode)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(-12.3f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedAbsolute, assembler) { __ movl(EAX, Immediate(bit_cast(-15.3f))); __ movd(XMM0, EAX); @@ -1182,14 +1092,12 @@ ASSEMBLER_TEST_GENERATE(PackedAbsolute, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedAbsolute, test) { typedef float (*PackedAbsoluteCode)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(15.3f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedSetWZero, assembler) { __ set1ps(XMM0, EAX, Immediate(bit_cast(12.3f))); __ zerowps(XMM0); @@ -1202,14 +1110,12 @@ ASSEMBLER_TEST_GENERATE(PackedSetWZero, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedSetWZero, test) { typedef float (*PackedSetWZeroCode)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(0.0f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedMin, assembler) { __ set1ps(XMM0, EAX, Immediate(bit_cast(2.0f))); __ set1ps(XMM1, EAX, Immediate(bit_cast(4.0f))); @@ -1222,14 +1128,12 @@ ASSEMBLER_TEST_GENERATE(PackedMin, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedMin, test) { typedef float (*PackedMinCode)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(2.0f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedMax, assembler) { __ set1ps(XMM0, EAX, Immediate(bit_cast(2.0f))); __ set1ps(XMM1, EAX, Immediate(bit_cast(4.0f))); @@ -1242,14 +1146,12 @@ ASSEMBLER_TEST_GENERATE(PackedMax, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedMax, test) { typedef float (*PackedMaxCode)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(4.0f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedLogicalOr, assembler) { static const struct ALIGN16 { uint32_t a; @@ -1274,14 +1176,12 @@ ASSEMBLER_TEST_GENERATE(PackedLogicalOr, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedLogicalOr, test) { typedef uint32_t (*PackedLogicalOrCode)(); uint32_t res = reinterpret_cast(test->entry())(); EXPECT_EQ(0xFFFFFFFF, res); } - ASSEMBLER_TEST_GENERATE(PackedLogicalAnd, assembler) { static const struct ALIGN16 { uint32_t a; @@ -1305,14 +1205,12 @@ ASSEMBLER_TEST_GENERATE(PackedLogicalAnd, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedLogicalAnd, test) { typedef uint32_t (*PackedLogicalAndCode)(); uint32_t res = reinterpret_cast(test->entry())(); EXPECT_EQ(static_cast(0x0000F000), res); } - ASSEMBLER_TEST_GENERATE(PackedLogicalNot, assembler) { static const struct ALIGN16 { uint32_t a; @@ -1330,14 +1228,12 @@ ASSEMBLER_TEST_GENERATE(PackedLogicalNot, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedLogicalNot, test) { typedef uint32_t (*PackedLogicalNotCode)(); uint32_t res = reinterpret_cast(test->entry())(); EXPECT_EQ(static_cast(0x0), res); } - ASSEMBLER_TEST_GENERATE(PackedMoveHighLow, assembler) { static const struct ALIGN16 { float a; @@ -1370,14 +1266,12 @@ ASSEMBLER_TEST_GENERATE(PackedMoveHighLow, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedMoveHighLow, test) { typedef float (*PackedMoveHighLow)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(15.0f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedMoveLowHigh, assembler) { static const struct ALIGN16 { float a; @@ -1410,14 +1304,12 @@ ASSEMBLER_TEST_GENERATE(PackedMoveLowHigh, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedMoveLowHigh, test) { typedef float (*PackedMoveLowHigh)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(11.0f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedUnpackLow, assembler) { static const struct ALIGN16 { float a; @@ -1449,14 +1341,12 @@ ASSEMBLER_TEST_GENERATE(PackedUnpackLow, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedUnpackLow, test) { typedef float (*PackedUnpackLow)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(11.0f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedUnpackHigh, assembler) { static const struct ALIGN16 { float a; @@ -1488,14 +1378,12 @@ ASSEMBLER_TEST_GENERATE(PackedUnpackHigh, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedUnpackHigh, test) { typedef float (*PackedUnpackHigh)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(7.0f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedUnpackLowPair, assembler) { static const struct ALIGN16 { float a; @@ -1527,14 +1415,12 @@ ASSEMBLER_TEST_GENERATE(PackedUnpackLowPair, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedUnpackLowPair, test) { typedef float (*PackedUnpackLowPair)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(6.0f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedUnpackHighPair, assembler) { static const struct ALIGN16 { float a; @@ -1566,14 +1452,12 @@ ASSEMBLER_TEST_GENERATE(PackedUnpackHighPair, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedUnpackHighPair, test) { typedef float (*PackedUnpackHighPair)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(12.0f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedDoubleAdd, assembler) { static const struct ALIGN16 { double a; @@ -1595,14 +1479,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleAdd, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedDoubleAdd, test) { typedef double (*PackedDoubleAdd)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(4.0, res, 0.000001f); } - ASSEMBLER_TEST_GENERATE(PackedDoubleSub, assembler) { static const struct ALIGN16 { double a; @@ -1624,14 +1506,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleSub, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedDoubleSub, test) { typedef double (*PackedDoubleSub)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(-2.0, res, 0.000001f); } - ASSEMBLER_TEST_GENERATE(PackedDoubleNegate, assembler) { static const struct ALIGN16 { double a; @@ -1648,14 +1528,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleNegate, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedDoubleNegate, test) { typedef double (*PackedDoubleNegate)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(-1.0, res, 0.000001f); } - ASSEMBLER_TEST_GENERATE(PackedDoubleAbsolute, assembler) { static const struct ALIGN16 { double a; @@ -1672,14 +1550,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleAbsolute, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedDoubleAbsolute, test) { typedef double (*PackedDoubleAbsolute)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(1.0, res, 0.000001f); } - ASSEMBLER_TEST_GENERATE(PackedDoubleMul, assembler) { static const struct ALIGN16 { double a; @@ -1701,14 +1577,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleMul, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedDoubleMul, test) { typedef double (*PackedDoubleMul)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(9.0, res, 0.000001f); } - ASSEMBLER_TEST_GENERATE(PackedDoubleDiv, assembler) { static const struct ALIGN16 { double a; @@ -1730,14 +1604,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleDiv, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedDoubleDiv, test) { typedef double (*PackedDoubleDiv)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(3.0, res, 0.000001f); } - ASSEMBLER_TEST_GENERATE(PackedDoubleSqrt, assembler) { static const struct ALIGN16 { double a; @@ -1754,14 +1626,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleSqrt, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedDoubleSqrt, test) { typedef double (*PackedDoubleSqrt)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(4.0, res, 0.000001f); } - ASSEMBLER_TEST_GENERATE(PackedDoubleMin, assembler) { static const struct ALIGN16 { double a; @@ -1783,14 +1653,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleMin, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedDoubleMin, test) { typedef double (*PackedDoubleMin)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(3.0, res, 0.000001f); } - ASSEMBLER_TEST_GENERATE(PackedDoubleMax, assembler) { static const struct ALIGN16 { double a; @@ -1812,14 +1680,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleMax, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedDoubleMax, test) { typedef double (*PackedDoubleMax)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(9.0, res, 0.000001f); } - ASSEMBLER_TEST_GENERATE(PackedDoubleShuffle, assembler) { static const struct ALIGN16 { double a; @@ -1840,14 +1706,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleShuffle, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedDoubleShuffle, test) { typedef double (*PackedDoubleShuffle)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(9.0, res, 0.000001f); } - ASSEMBLER_TEST_GENERATE(PackedDoubleToSingle, assembler) { static const struct ALIGN16 { double a; @@ -1862,14 +1726,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleToSingle, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedDoubleToSingle, test) { typedef float (*PackedDoubleToSingle)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(9.0f, res, 0.000001f); } - ASSEMBLER_TEST_GENERATE(PackedSingleToDouble, assembler) { static const struct ALIGN16 { float a; @@ -1888,14 +1750,12 @@ ASSEMBLER_TEST_GENERATE(PackedSingleToDouble, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedSingleToDouble, test) { typedef double (*PackedSingleToDouble)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(9.0f, res, 0.000001f); } - ASSEMBLER_TEST_GENERATE(SingleFPOperationsStack, assembler) { __ movl(EAX, Immediate(bit_cast(12.3f))); __ movd(XMM0, EAX); @@ -1910,14 +1770,12 @@ ASSEMBLER_TEST_GENERATE(SingleFPOperationsStack, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SingleFPOperationsStack, test) { typedef float (*SingleFPOperationsStackCode)(float f); float res = reinterpret_cast(test->entry())(3.4); EXPECT_FLOAT_EQ(14.7f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(DoubleFPMoves, assembler) { int64_t l = bit_cast(1024.67); __ movl(EAX, Immediate(Utils::High32Bits(l))); @@ -1953,7 +1811,6 @@ ASSEMBLER_TEST_GENERATE(DoubleFPMoves, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(DoubleFPMoves, test) { typedef double (*DoubleFPMovesCode)(); double res = reinterpret_cast(test->entry())(); @@ -1975,14 +1832,12 @@ ASSEMBLER_TEST_GENERATE(DoubleFPUStackMoves, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(DoubleFPUStackMoves, test) { typedef int64_t (*DoubleFPUStackMovesCode)(); int64_t res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(1024.67, (bit_cast(res)), 0.001); } - ASSEMBLER_TEST_GENERATE(DoubleFPOperations, assembler) { int64_t l = bit_cast(12.3); __ movl(EAX, Immediate(Utils::High32Bits(l))); @@ -2009,14 +1864,12 @@ ASSEMBLER_TEST_GENERATE(DoubleFPOperations, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(DoubleFPOperations, test) { typedef double (*DoubleFPOperationsCode)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(14.7, res, 0.001); } - ASSEMBLER_TEST_GENERATE(DoubleFPOperationsStack, assembler) { int64_t l = bit_cast(12.3); __ movl(EAX, Immediate(Utils::High32Bits(l))); @@ -2041,7 +1894,6 @@ ASSEMBLER_TEST_GENERATE(DoubleFPOperationsStack, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(DoubleFPOperationsStack, test) { typedef double (*DoubleFPOperationsStackCode)(double d); double res = @@ -2049,7 +1901,6 @@ ASSEMBLER_TEST_RUN(DoubleFPOperationsStack, test) { EXPECT_FLOAT_EQ(14.7, res, 0.001); } - ASSEMBLER_TEST_GENERATE(IntToDoubleConversion, assembler) { __ movl(EDX, Immediate(6)); __ cvtsi2sd(XMM1, EDX); @@ -2062,27 +1913,23 @@ ASSEMBLER_TEST_GENERATE(IntToDoubleConversion, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(IntToDoubleConversion, test) { typedef double (*IntToDoubleConversionCode)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(6.0, res, 0.001); } - ASSEMBLER_TEST_GENERATE(IntToDoubleConversion2, assembler) { __ filds(Address(ESP, kWordSize)); __ ret(); } - ASSEMBLER_TEST_RUN(IntToDoubleConversion2, test) { typedef double (*IntToDoubleConversion2Code)(int i); double res = reinterpret_cast(test->entry())(3); EXPECT_FLOAT_EQ(3.0, res, 0.001); } - ASSEMBLER_TEST_GENERATE(Int64ToDoubleConversion, assembler) { __ movl(EAX, Immediate(0)); __ movl(EDX, Immediate(6)); @@ -2094,14 +1941,12 @@ ASSEMBLER_TEST_GENERATE(Int64ToDoubleConversion, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Int64ToDoubleConversion, test) { typedef double (*Int64ToDoubleConversionCode)(); double res = reinterpret_cast(test->entry())(); EXPECT_EQ(6.0, res); } - ASSEMBLER_TEST_GENERATE(NegativeInt64ToDoubleConversion, assembler) { __ movl(EAX, Immediate(0xFFFFFFFF)); __ movl(EDX, Immediate(0xFFFFFFFA)); @@ -2113,7 +1958,6 @@ ASSEMBLER_TEST_GENERATE(NegativeInt64ToDoubleConversion, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(NegativeInt64ToDoubleConversion, test) { typedef double (*NegativeInt64ToDoubleConversionCode)(); double res = @@ -2121,7 +1965,6 @@ ASSEMBLER_TEST_RUN(NegativeInt64ToDoubleConversion, test) { EXPECT_EQ(-6.0, res); } - ASSEMBLER_TEST_GENERATE(IntToFloatConversion, assembler) { __ movl(EDX, Immediate(6)); __ cvtsi2ss(XMM1, EDX); @@ -2132,14 +1975,12 @@ ASSEMBLER_TEST_GENERATE(IntToFloatConversion, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(IntToFloatConversion, test) { typedef float (*IntToFloatConversionCode)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(6.0, res, 0.001); } - ASSEMBLER_TEST_GENERATE(FloatToIntConversionRound, assembler) { __ movsd(XMM1, Address(ESP, kWordSize)); __ cvtss2si(EDX, XMM1); @@ -2147,7 +1988,6 @@ ASSEMBLER_TEST_GENERATE(FloatToIntConversionRound, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(FloatToIntConversionRound, test) { typedef int (*FloatToIntConversionRoundCode)(float f); int res = @@ -2157,7 +1997,6 @@ ASSEMBLER_TEST_RUN(FloatToIntConversionRound, test) { EXPECT_EQ(13, res); } - ASSEMBLER_TEST_GENERATE(FloatToIntConversionTrunc, assembler) { __ movsd(XMM1, Address(ESP, kWordSize)); __ cvttss2si(EDX, XMM1); @@ -2165,7 +2004,6 @@ ASSEMBLER_TEST_GENERATE(FloatToIntConversionTrunc, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(FloatToIntConversionTrunc, test) { typedef int (*FloatToIntConversionTruncCode)(float f); int res = @@ -2175,7 +2013,6 @@ ASSEMBLER_TEST_RUN(FloatToIntConversionTrunc, test) { EXPECT_EQ(12, res); } - ASSEMBLER_TEST_GENERATE(FloatToDoubleConversion, assembler) { __ movl(EAX, Immediate(bit_cast(12.3f))); __ movd(XMM1, EAX); @@ -2190,14 +2027,12 @@ ASSEMBLER_TEST_GENERATE(FloatToDoubleConversion, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(FloatToDoubleConversion, test) { typedef double (*FloatToDoubleConversionCode)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(12.3, res, 0.001); } - ASSEMBLER_TEST_GENERATE(FloatCompare, assembler) { // Count errors in EAX. EAX is zero if no errors found. Label is_nan, is_above, is_ok, cont_1, cont_2; @@ -2239,14 +2074,12 @@ ASSEMBLER_TEST_GENERATE(FloatCompare, assembler) { __ jmp(&cont_2); } - ASSEMBLER_TEST_RUN(FloatCompare, test) { typedef int (*FloatCompareCode)(); int res = reinterpret_cast(test->entry())(); EXPECT_EQ(0, res); } - ASSEMBLER_TEST_GENERATE(DoubleCompare, assembler) { int64_t a = bit_cast(12.3); int64_t b = bit_cast(12.5); @@ -2310,14 +2143,12 @@ ASSEMBLER_TEST_GENERATE(DoubleCompare, assembler) { __ jmp(&cont_2); } - ASSEMBLER_TEST_RUN(DoubleCompare, test) { typedef int (*DoubleCompareCode)(); int res = reinterpret_cast(test->entry())(); EXPECT_EQ(0, res); } - ASSEMBLER_TEST_GENERATE(DoubleToFloatConversion, assembler) { int64_t l = bit_cast(12.3); __ movl(EAX, Immediate(Utils::High32Bits(l))); @@ -2333,21 +2164,18 @@ ASSEMBLER_TEST_GENERATE(DoubleToFloatConversion, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(DoubleToFloatConversion, test) { typedef float (*DoubleToFloatConversionCode)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(12.3f, res, 0.001); } - ASSEMBLER_TEST_GENERATE(DoubleToIntConversionRound, assembler) { __ movsd(XMM3, Address(ESP, kWordSize)); __ cvtsd2si(EAX, XMM3); __ ret(); } - ASSEMBLER_TEST_RUN(DoubleToIntConversionRound, test) { typedef int (*DoubleToIntConversionRoundCode)(double d); int res = @@ -2357,14 +2185,12 @@ ASSEMBLER_TEST_RUN(DoubleToIntConversionRound, test) { EXPECT_EQ(13, res); } - ASSEMBLER_TEST_GENERATE(DoubleToIntConversionTrunc, assembler) { __ movsd(XMM3, Address(ESP, kWordSize)); __ cvttsd2si(EAX, XMM3); __ ret(); } - ASSEMBLER_TEST_RUN(DoubleToIntConversionTrunc, test) { typedef int (*DoubleToIntConversionTruncCode)(double d); int res = @@ -2374,7 +2200,6 @@ ASSEMBLER_TEST_RUN(DoubleToIntConversionTrunc, test) { EXPECT_EQ(12, res); } - ASSEMBLER_TEST_GENERATE(DoubleToDoubleTrunc, assembler) { __ movsd(XMM3, Address(ESP, kWordSize)); __ roundsd(XMM2, XMM3, Assembler::kRoundToZero); @@ -2387,7 +2212,6 @@ ASSEMBLER_TEST_GENERATE(DoubleToDoubleTrunc, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(DoubleToDoubleTrunc, test) { typedef double (*DoubleToDoubleTruncCode)(double d); double res = reinterpret_cast(test->entry())(12.3); @@ -2400,7 +2224,6 @@ ASSEMBLER_TEST_RUN(DoubleToDoubleTrunc, test) { EXPECT_EQ(-12.0, res); } - static const double kDoubleConst = 3.226; ASSEMBLER_TEST_GENERATE(GlobalAddress, assembler) { @@ -2414,21 +2237,18 @@ ASSEMBLER_TEST_GENERATE(GlobalAddress, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(GlobalAddress, test) { typedef double (*GlobalAddressCode)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(kDoubleConst, res, 0.000001); } - ASSEMBLER_TEST_GENERATE(Sine, assembler) { __ flds(Address(ESP, kWordSize)); __ fsin(); __ ret(); } - ASSEMBLER_TEST_RUN(Sine, test) { typedef float (*SineCode)(float f); const float kFloatConst = 0.7; @@ -2436,14 +2256,12 @@ ASSEMBLER_TEST_RUN(Sine, test) { EXPECT_FLOAT_EQ(sin(kFloatConst), res, 0.0001); } - ASSEMBLER_TEST_GENERATE(Cosine, assembler) { __ flds(Address(ESP, kWordSize)); __ fcos(); __ ret(); } - ASSEMBLER_TEST_RUN(Cosine, test) { typedef float (*CosineCode)(float f); const float kFloatConst = 0.7; @@ -2451,7 +2269,6 @@ ASSEMBLER_TEST_RUN(Cosine, test) { EXPECT_FLOAT_EQ(cos(kFloatConst), res, 0.0001); } - ASSEMBLER_TEST_GENERATE(SinCos, assembler) { __ fldl(Address(ESP, kWordSize)); __ fsincos(); @@ -2467,7 +2284,6 @@ ASSEMBLER_TEST_GENERATE(SinCos, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SinCos, test) { typedef double (*SinCosCode)(double d); const double arg = 1.2345; @@ -2476,7 +2292,6 @@ ASSEMBLER_TEST_RUN(SinCos, test) { EXPECT_FLOAT_EQ(expected, res, 0.000001); } - ASSEMBLER_TEST_GENERATE(Tangent, assembler) { __ fldl(Address(ESP, kWordSize)); __ fptan(); @@ -2485,7 +2300,6 @@ ASSEMBLER_TEST_GENERATE(Tangent, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Tangent, test) { typedef double (*TangentCode)(double d); const double kDoubleConst = 0.6108652375000001; @@ -2493,7 +2307,6 @@ ASSEMBLER_TEST_RUN(Tangent, test) { EXPECT_FLOAT_EQ(tan(kDoubleConst), res, 0.0001); } - ASSEMBLER_TEST_GENERATE(SquareRootFloat, assembler) { __ movss(XMM0, Address(ESP, kWordSize)); __ sqrtss(XMM1, XMM0); @@ -2504,7 +2317,6 @@ ASSEMBLER_TEST_GENERATE(SquareRootFloat, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SquareRootFloat, test) { typedef float (*SquareRootFloatCode)(float f); const float kFloatConst = 0.7; @@ -2512,7 +2324,6 @@ ASSEMBLER_TEST_RUN(SquareRootFloat, test) { EXPECT_FLOAT_EQ(sqrt(kFloatConst), res, 0.0001); } - ASSEMBLER_TEST_GENERATE(SquareRootDouble, assembler) { __ movsd(XMM0, Address(ESP, kWordSize)); __ sqrtsd(XMM1, XMM0); @@ -2525,7 +2336,6 @@ ASSEMBLER_TEST_GENERATE(SquareRootDouble, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SquareRootDouble, test) { typedef double (*SquareRootDoubleCode)(double d); const double kDoubleConst = .7; @@ -2534,7 +2344,6 @@ ASSEMBLER_TEST_RUN(SquareRootDouble, test) { EXPECT_FLOAT_EQ(sqrt(kDoubleConst), res, 0.0001); } - ASSEMBLER_TEST_GENERATE(FloatNegate, assembler) { __ movss(XMM0, Address(ESP, kWordSize)); __ FloatNegate(XMM0); @@ -2545,7 +2354,6 @@ ASSEMBLER_TEST_GENERATE(FloatNegate, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(FloatNegate, test) { typedef float (*FloatNegateCode)(float f); const float kFloatConst = 12.345; @@ -2553,7 +2361,6 @@ ASSEMBLER_TEST_RUN(FloatNegate, test) { EXPECT_FLOAT_EQ(-kFloatConst, res, 0.0001); } - ASSEMBLER_TEST_GENERATE(DoubleNegate, assembler) { __ movsd(XMM0, Address(ESP, kWordSize)); __ DoubleNegate(XMM0); @@ -2566,7 +2373,6 @@ ASSEMBLER_TEST_GENERATE(DoubleNegate, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(DoubleNegate, test) { typedef double (*DoubleNegateCode)(double f); const double kDoubleConst = 12.345; @@ -2574,7 +2380,6 @@ ASSEMBLER_TEST_RUN(DoubleNegate, test) { EXPECT_FLOAT_EQ(-kDoubleConst, res, 0.0001); } - ASSEMBLER_TEST_GENERATE(LongMulReg, assembler) { __ movl(ECX, Address(ESP, kWordSize)); __ movl(EAX, Address(ESP, 2 * kWordSize)); @@ -2582,7 +2387,6 @@ ASSEMBLER_TEST_GENERATE(LongMulReg, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LongMulReg, test) { typedef int64_t (*LongMulRegCode)(int a, int b); const int a = -12; @@ -2592,14 +2396,12 @@ ASSEMBLER_TEST_RUN(LongMulReg, test) { EXPECT_EQ(mul_res, res); } - ASSEMBLER_TEST_GENERATE(LongMulAddress, assembler) { __ movl(EAX, Address(ESP, 2 * kWordSize)); __ imull(Address(ESP, kWordSize)); __ ret(); } - ASSEMBLER_TEST_RUN(LongMulAddress, test) { typedef int64_t (*LongMulAddressCode)(int a, int b); const int a = -12; @@ -2609,7 +2411,6 @@ ASSEMBLER_TEST_RUN(LongMulAddress, test) { EXPECT_EQ(mul_res, res); } - ASSEMBLER_TEST_GENERATE(LongUnsignedMulReg, assembler) { __ movl(ECX, Address(ESP, kWordSize)); __ movl(EAX, Address(ESP, 2 * kWordSize)); @@ -2617,7 +2418,6 @@ ASSEMBLER_TEST_GENERATE(LongUnsignedMulReg, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LongUnsignedMulReg, test) { typedef uint64_t (*LongUnsignedMulRegCode)(uint32_t a, uint32_t b); uint32_t a = 3; @@ -2632,14 +2432,12 @@ ASSEMBLER_TEST_RUN(LongUnsignedMulReg, test) { EXPECT_EQ(mul_res, res); } - ASSEMBLER_TEST_GENERATE(LongUnsignedMulAddress, assembler) { __ movl(EAX, Address(ESP, 2 * kWordSize)); __ mull(Address(ESP, kWordSize)); __ ret(); } - ASSEMBLER_TEST_RUN(LongUnsignedMulAddress, test) { typedef uint64_t (*LongUnsignedMulAddressCode)(uint32_t a, uint32_t b); uint32_t a = 12; @@ -2655,7 +2453,6 @@ ASSEMBLER_TEST_RUN(LongUnsignedMulAddress, test) { EXPECT_EQ(mul_res, res); } - ASSEMBLER_TEST_GENERATE(LongAddReg, assembler) { // Preserve clobbered callee-saved register (EBX). __ pushl(EBX); @@ -2670,7 +2467,6 @@ ASSEMBLER_TEST_GENERATE(LongAddReg, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LongAddReg, test) { typedef int64_t (*LongAddRegCode)(int64_t a, int64_t b); int64_t a = 12; @@ -2683,7 +2479,6 @@ ASSEMBLER_TEST_RUN(LongAddReg, test) { EXPECT_EQ((a + b), res); } - ASSEMBLER_TEST_GENERATE(LongAddAddress, assembler) { __ movl(EAX, Address(ESP, 1 * kWordSize)); // left low. __ movl(EDX, Address(ESP, 2 * kWordSize)); // left high. @@ -2693,7 +2488,6 @@ ASSEMBLER_TEST_GENERATE(LongAddAddress, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LongAddAddress, test) { typedef int64_t (*LongAddAddressCode)(int64_t a, int64_t b); int64_t a = 12; @@ -2706,7 +2500,6 @@ ASSEMBLER_TEST_RUN(LongAddAddress, test) { EXPECT_EQ((a + b), res); } - ASSEMBLER_TEST_GENERATE(LongSubReg, assembler) { // Preserve clobbered callee-saved register (EBX). __ pushl(EBX); @@ -2721,7 +2514,6 @@ ASSEMBLER_TEST_GENERATE(LongSubReg, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LongSubReg, test) { typedef int64_t (*LongSubRegCode)(int64_t a, int64_t b); int64_t a = 12; @@ -2734,7 +2526,6 @@ ASSEMBLER_TEST_RUN(LongSubReg, test) { EXPECT_EQ((a - b), res); } - ASSEMBLER_TEST_GENERATE(LongSubAddress, assembler) { __ movl(EAX, Address(ESP, 1 * kWordSize)); // left low. __ movl(EDX, Address(ESP, 2 * kWordSize)); // left high. @@ -2744,7 +2535,6 @@ ASSEMBLER_TEST_GENERATE(LongSubAddress, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LongSubAddress, test) { typedef int64_t (*LongSubAddressCode)(int64_t a, int64_t b); int64_t a = 12; @@ -2757,7 +2547,6 @@ ASSEMBLER_TEST_RUN(LongSubAddress, test) { EXPECT_EQ((a - b), res); } - ASSEMBLER_TEST_GENERATE(LongSubAddress2, assembler) { // Preserve clobbered callee-saved register (EBX). __ pushl(EBX); @@ -2778,7 +2567,6 @@ ASSEMBLER_TEST_GENERATE(LongSubAddress2, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LongSubAddress2, test) { typedef int64_t (*LongSubAddress2Code)(int64_t a, int64_t b); int64_t a = 12; @@ -2791,7 +2579,6 @@ ASSEMBLER_TEST_RUN(LongSubAddress2, test) { EXPECT_EQ((a - b), res); } - ASSEMBLER_TEST_GENERATE(LongAddAddress2, assembler) { // Preserve clobbered callee-saved register (EBX). __ pushl(EBX); @@ -2812,7 +2599,6 @@ ASSEMBLER_TEST_GENERATE(LongAddAddress2, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LongAddAddress2, test) { typedef int64_t (*LongAddAddress2Code)(int64_t a, int64_t b); int64_t a = 12; @@ -2825,7 +2611,6 @@ ASSEMBLER_TEST_RUN(LongAddAddress2, test) { EXPECT_EQ((a + b), res); } - // Testing only the lower 64-bit value of 'cvtdq2pd'. ASSEMBLER_TEST_GENERATE(IntegerToDoubleConversion, assembler) { __ movsd(XMM1, Address(ESP, kWordSize)); @@ -2839,7 +2624,6 @@ ASSEMBLER_TEST_GENERATE(IntegerToDoubleConversion, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(IntegerToDoubleConversion, test) { typedef double (*IntegerToDoubleConversionCode)(int32_t); const int32_t val = -12; @@ -2848,7 +2632,6 @@ ASSEMBLER_TEST_RUN(IntegerToDoubleConversion, test) { EXPECT_FLOAT_EQ(static_cast(val), res, 0.001); } - // Implement with truncation. ASSEMBLER_TEST_GENERATE(FPUStoreLong, assembler) { __ fldl(Address(ESP, kWordSize)); @@ -2869,7 +2652,6 @@ ASSEMBLER_TEST_GENERATE(FPUStoreLong, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(FPUStoreLong, test) { typedef int64_t (*FPUStoreLongCode)(double d); double val = 12.2; @@ -2886,7 +2668,6 @@ ASSEMBLER_TEST_RUN(FPUStoreLong, test) { EXPECT_EQ(static_cast(val), res); } - ASSEMBLER_TEST_GENERATE(XorpdZeroing, assembler) { __ movsd(XMM0, Address(ESP, kWordSize)); __ xorpd(XMM0, XMM0); @@ -2899,14 +2680,12 @@ ASSEMBLER_TEST_GENERATE(XorpdZeroing, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(XorpdZeroing, test) { typedef double (*XorpdZeroingCode)(double d); double res = reinterpret_cast(test->entry())(12.56e3); EXPECT_FLOAT_EQ(0.0, res, 0.0001); } - ASSEMBLER_TEST_GENERATE(Pxor, assembler) { __ movsd(XMM0, Address(ESP, kWordSize)); __ pxor(XMM0, XMM0); @@ -2919,14 +2698,12 @@ ASSEMBLER_TEST_GENERATE(Pxor, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Pxor, test) { typedef double (*PxorCode)(double d); double res = reinterpret_cast(test->entry())(12.3456e3); EXPECT_FLOAT_EQ(0.0, res, 0.0); } - ASSEMBLER_TEST_GENERATE(Orpd, assembler) { __ movsd(XMM0, Address(ESP, kWordSize)); __ xorpd(XMM1, XMM1); @@ -2941,14 +2718,12 @@ ASSEMBLER_TEST_GENERATE(Orpd, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Orpd, test) { typedef double (*OrpdCode)(double d); double res = reinterpret_cast(test->entry())(12.56e3); EXPECT_FLOAT_EQ(-12.56e3, res, 0.0); } - ASSEMBLER_TEST_GENERATE(Pextrd0, assembler) { if (TargetCPUFeatures::sse4_1_supported()) { __ movsd(XMM0, Address(ESP, kWordSize)); @@ -2957,7 +2732,6 @@ ASSEMBLER_TEST_GENERATE(Pextrd0, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Pextrd0, test) { if (TargetCPUFeatures::sse4_1_supported()) { typedef int32_t (*PextrdCode0)(double d); @@ -2966,7 +2740,6 @@ ASSEMBLER_TEST_RUN(Pextrd0, test) { } } - ASSEMBLER_TEST_GENERATE(Pextrd1, assembler) { if (TargetCPUFeatures::sse4_1_supported()) { __ movsd(XMM0, Address(ESP, kWordSize)); @@ -2975,7 +2748,6 @@ ASSEMBLER_TEST_GENERATE(Pextrd1, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Pextrd1, test) { if (TargetCPUFeatures::sse4_1_supported()) { typedef int32_t (*PextrdCode1)(double d); @@ -2984,7 +2756,6 @@ ASSEMBLER_TEST_RUN(Pextrd1, test) { } } - ASSEMBLER_TEST_GENERATE(Pmovsxdq, assembler) { if (TargetCPUFeatures::sse4_1_supported()) { __ movsd(XMM0, Address(ESP, kWordSize)); @@ -2994,7 +2765,6 @@ ASSEMBLER_TEST_GENERATE(Pmovsxdq, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Pmovsxdq, test) { if (TargetCPUFeatures::sse4_1_supported()) { typedef int32_t (*PmovsxdqCode)(double d); @@ -3003,7 +2773,6 @@ ASSEMBLER_TEST_RUN(Pmovsxdq, test) { } } - ASSEMBLER_TEST_GENERATE(Pcmpeqq, assembler) { if (TargetCPUFeatures::sse4_1_supported()) { __ movsd(XMM0, Address(ESP, kWordSize)); @@ -3014,7 +2783,6 @@ ASSEMBLER_TEST_GENERATE(Pcmpeqq, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Pcmpeqq, test) { if (TargetCPUFeatures::sse4_1_supported()) { typedef int32_t (*PcmpeqqCode)(double d); @@ -3023,7 +2791,6 @@ ASSEMBLER_TEST_RUN(Pcmpeqq, test) { } } - ASSEMBLER_TEST_GENERATE(AndPd, assembler) { __ movsd(XMM0, Address(ESP, kWordSize)); __ andpd(XMM0, XMM0); @@ -3036,14 +2803,12 @@ ASSEMBLER_TEST_GENERATE(AndPd, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(AndPd, test) { typedef double (*AndpdCode)(double d); double res = reinterpret_cast(test->entry())(12.56e3); EXPECT_FLOAT_EQ(12.56e3, res, 0.0); } - ASSEMBLER_TEST_GENERATE(Movq, assembler) { __ movq(XMM0, Address(ESP, kWordSize)); __ subl(ESP, Immediate(kDoubleSize)); @@ -3053,14 +2818,12 @@ ASSEMBLER_TEST_GENERATE(Movq, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Movq, test) { typedef double (*MovqCode)(double d); double res = reinterpret_cast(test->entry())(12.34e5); EXPECT_FLOAT_EQ(12.34e5, res, 0.0); } - ASSEMBLER_TEST_GENERATE(DoubleAbs, assembler) { __ movsd(XMM0, Address(ESP, kWordSize)); __ DoubleAbs(XMM0); @@ -3073,7 +2836,6 @@ ASSEMBLER_TEST_GENERATE(DoubleAbs, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(DoubleAbs, test) { typedef double (*DoubleAbsCode)(double d); double val = -12.45; @@ -3084,7 +2846,6 @@ ASSEMBLER_TEST_RUN(DoubleAbs, test) { EXPECT_FLOAT_EQ(val, res, 0.001); } - ASSEMBLER_TEST_GENERATE(ExtractSignBits, assembler) { __ movsd(XMM0, Address(ESP, kWordSize)); __ movmskpd(EAX, XMM0); @@ -3092,7 +2853,6 @@ ASSEMBLER_TEST_GENERATE(ExtractSignBits, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(ExtractSignBits, test) { typedef int (*ExtractSignBits)(double d); int res = reinterpret_cast(test->entry())(1.0); @@ -3103,7 +2863,6 @@ ASSEMBLER_TEST_RUN(ExtractSignBits, test) { EXPECT_EQ(1, res); } - // Return -1 if signed, 1 if not signed and 0 otherwise. ASSEMBLER_TEST_GENERATE(ConditionalMovesSign, assembler) { // Preserve clobbered callee-saved register (EBX). @@ -3123,7 +2882,6 @@ ASSEMBLER_TEST_GENERATE(ConditionalMovesSign, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(ConditionalMovesSign, test) { typedef int (*ConditionalMovesSignCode)(int i); int res = reinterpret_cast(test->entry())(785); @@ -3132,7 +2890,6 @@ ASSEMBLER_TEST_RUN(ConditionalMovesSign, test) { EXPECT_EQ(-1, res); } - // Return 1 if overflow, 0 if no overflow. ASSEMBLER_TEST_GENERATE(ConditionalMovesNoOverflow, assembler) { __ movl(EDX, Address(ESP, 1 * kWordSize)); @@ -3143,7 +2900,6 @@ ASSEMBLER_TEST_GENERATE(ConditionalMovesNoOverflow, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(ConditionalMovesNoOverflow, test) { typedef int (*ConditionalMovesNoOverflowCode)(int i, int j); int res = reinterpret_cast(test->entry())( @@ -3153,7 +2909,6 @@ ASSEMBLER_TEST_RUN(ConditionalMovesNoOverflow, test) { EXPECT_EQ(0, res); } - // Return 1 if equal, 0 if not equal. ASSEMBLER_TEST_GENERATE(ConditionalMovesEqual, assembler) { __ xorl(EAX, EAX); @@ -3164,7 +2919,6 @@ ASSEMBLER_TEST_GENERATE(ConditionalMovesEqual, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(ConditionalMovesEqual, test) { typedef int (*ConditionalMovesEqualCode)(int i); int res = reinterpret_cast(test->entry())(785); @@ -3173,7 +2927,6 @@ ASSEMBLER_TEST_RUN(ConditionalMovesEqual, test) { EXPECT_EQ(0, res); } - // Return 1 if not equal, 0 if equal. ASSEMBLER_TEST_GENERATE(ConditionalMovesNotEqual, assembler) { __ xorl(EAX, EAX); @@ -3184,7 +2937,6 @@ ASSEMBLER_TEST_GENERATE(ConditionalMovesNotEqual, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(ConditionalMovesNotEqual, test) { typedef int (*ConditionalMovesNotEqualCode)(int i); int res = reinterpret_cast(test->entry())(785); @@ -3193,7 +2945,6 @@ ASSEMBLER_TEST_RUN(ConditionalMovesNotEqual, test) { EXPECT_EQ(1, res); } - ASSEMBLER_TEST_GENERATE(ConditionalMovesCompare, assembler) { __ movl(EDX, Immediate(1)); // Greater equal. __ movl(ECX, Immediate(-1)); // Less @@ -3204,7 +2955,6 @@ ASSEMBLER_TEST_GENERATE(ConditionalMovesCompare, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(ConditionalMovesCompare, test) { typedef int (*ConditionalMovesCompareCode)(int i, int j); int res = reinterpret_cast(test->entry())(10, 5); @@ -3215,7 +2965,6 @@ ASSEMBLER_TEST_RUN(ConditionalMovesCompare, test) { EXPECT_EQ(-1, res); // Less. } - ASSEMBLER_TEST_GENERATE(TestLoadDoubleConstant, assembler) { __ LoadDoubleConstant(XMM3, -12.34); __ pushl(EAX); @@ -3227,14 +2976,12 @@ ASSEMBLER_TEST_GENERATE(TestLoadDoubleConstant, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(TestLoadDoubleConstant, test) { typedef double (*TestLoadDoubleConstantCode)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(-12.34, res, 0.0001); } - ASSEMBLER_TEST_GENERATE(TestObjectCompare, assembler) { ObjectStore* object_store = Isolate::Current()->object_store(); const Object& obj = Object::ZoneHandle(object_store->smi_class()); @@ -3252,14 +2999,12 @@ ASSEMBLER_TEST_GENERATE(TestObjectCompare, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(TestObjectCompare, test) { typedef bool (*TestObjectCompare)(); bool res = reinterpret_cast(test->entry())(); EXPECT_EQ(true, res); } - ASSEMBLER_TEST_GENERATE(TestSetCC, assembler) { __ movl(EAX, Immediate(0xFFFFFFFF)); __ cmpl(EAX, EAX); @@ -3267,14 +3012,12 @@ ASSEMBLER_TEST_GENERATE(TestSetCC, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(TestSetCC, test) { typedef uword (*TestSetCC)(); uword res = reinterpret_cast(test->entry())(); EXPECT_EQ(0xFFFFFF00, res); } - ASSEMBLER_TEST_GENERATE(TestNop, assembler) { __ nop(1); __ nop(2); @@ -3288,28 +3031,24 @@ ASSEMBLER_TEST_GENERATE(TestNop, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(TestNop, test) { typedef int (*TestNop)(); int res = reinterpret_cast(test->entry())(); EXPECT_EQ(36, res); // 36 nop bytes emitted. } - ASSEMBLER_TEST_GENERATE(TestAlign0, assembler) { __ Align(4, 0); __ movl(EAX, Immediate(assembler->CodeSize())); // Return code size. __ ret(); } - ASSEMBLER_TEST_RUN(TestAlign0, test) { typedef int (*TestAlign0)(); int res = reinterpret_cast(test->entry())(); EXPECT_EQ(0, res); // 0 bytes emitted. } - ASSEMBLER_TEST_GENERATE(TestAlign1, assembler) { __ nop(1); __ Align(4, 0); @@ -3317,14 +3056,12 @@ ASSEMBLER_TEST_GENERATE(TestAlign1, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(TestAlign1, test) { typedef int (*TestAlign1)(); int res = reinterpret_cast(test->entry())(); EXPECT_EQ(4, res); // 4 bytes emitted. } - ASSEMBLER_TEST_GENERATE(TestAlign1Offset1, assembler) { __ nop(1); __ Align(4, 1); @@ -3332,14 +3069,12 @@ ASSEMBLER_TEST_GENERATE(TestAlign1Offset1, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(TestAlign1Offset1, test) { typedef int (*TestAlign1Offset1)(); int res = reinterpret_cast(test->entry())(); EXPECT_EQ(3, res); // 3 bytes emitted. } - ASSEMBLER_TEST_GENERATE(TestAlignLarge, assembler) { __ nop(1); __ Align(16, 0); @@ -3347,14 +3082,12 @@ ASSEMBLER_TEST_GENERATE(TestAlignLarge, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(TestAlignLarge, test) { typedef int (*TestAlignLarge)(); int res = reinterpret_cast(test->entry())(); EXPECT_EQ(16, res); // 16 bytes emitted. } - ASSEMBLER_TEST_GENERATE(TestRepMovsBytes, assembler) { // Preserve registers. __ pushl(ESI); @@ -3370,7 +3103,6 @@ ASSEMBLER_TEST_GENERATE(TestRepMovsBytes, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(TestRepMovsBytes, test) { const char* from = "0123456789"; const char* to = new char[10]; @@ -3383,7 +3115,6 @@ ASSEMBLER_TEST_RUN(TestRepMovsBytes, test) { delete[] to; } - // Called from assembler_test.cc. ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { __ pushl(THR); @@ -3398,7 +3129,6 @@ ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { __ ret(); } - ASSEMBLER_TEST_GENERATE(BitTest, assembler) { __ movl(EAX, Immediate(4)); __ movl(ECX, Immediate(2)); @@ -3411,7 +3141,6 @@ ASSEMBLER_TEST_GENERATE(BitTest, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(BitTest, test) { typedef int (*BitTest)(); EXPECT_EQ(1, reinterpret_cast(test->entry())()); diff --git a/runtime/vm/assembler_x64.cc b/runtime/vm/assembler_x64.cc index 0a3f6dcfa91..00e65c0a588 100644 --- a/runtime/vm/assembler_x64.cc +++ b/runtime/vm/assembler_x64.cc @@ -20,7 +20,6 @@ namespace dart { DECLARE_FLAG(bool, check_code_pointer); DECLARE_FLAG(bool, inline_alloc); - Assembler::Assembler(bool use_far_branches) : buffer_(), prologue_offset_(-1), @@ -31,12 +30,10 @@ Assembler::Assembler(bool use_far_branches) ASSERT(!use_far_branches); } - void Assembler::InitializeMemoryWithBreakpoints(uword data, intptr_t length) { memset(reinterpret_cast(data), Instr::kBreakPointInstruction, length); } - void Assembler::call(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(reg); @@ -45,7 +42,6 @@ void Assembler::call(Register reg) { EmitOperand(2, operand); } - void Assembler::call(const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(2, address, REX_NONE); @@ -53,7 +49,6 @@ void Assembler::call(const Address& address) { EmitOperand(2, address); } - void Assembler::call(Label* label) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); static const int kSize = 5; @@ -61,7 +56,6 @@ void Assembler::call(Label* label) { EmitLabel(label, kSize); } - void Assembler::LoadNativeEntry(Register dst, const ExternalLabel* label, Patchability patchable) { @@ -70,7 +64,6 @@ void Assembler::LoadNativeEntry(Register dst, LoadWordFromPoolOffset(dst, offset - kHeapObjectTag); } - void Assembler::call(const ExternalLabel* label) { { // Encode movq(TMP, Immediate(label->address())), but always as imm64. AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -81,7 +74,6 @@ void Assembler::call(const ExternalLabel* label) { call(TMP); } - void Assembler::CallPatchable(const StubEntry& stub_entry) { ASSERT(constant_pool_allowed()); const Code& target = Code::ZoneHandle(stub_entry.code()); @@ -94,7 +86,6 @@ void Assembler::CallPatchable(const StubEntry& stub_entry) { ASSERT((buffer_.GetPosition() - call_start) == kCallExternalLabelSize); } - void Assembler::CallWithEquivalence(const StubEntry& stub_entry, const Object& equivalence) { ASSERT(constant_pool_allowed()); @@ -106,7 +97,6 @@ void Assembler::CallWithEquivalence(const StubEntry& stub_entry, call(TMP); } - void Assembler::Call(const StubEntry& stub_entry) { ASSERT(constant_pool_allowed()); const Code& target = Code::ZoneHandle(stub_entry.code()); @@ -117,21 +107,18 @@ void Assembler::Call(const StubEntry& stub_entry) { call(TMP); } - void Assembler::CallToRuntime() { movq(TMP, Address(THR, Thread::call_to_runtime_entry_point_offset())); movq(CODE_REG, Address(THR, Thread::call_to_runtime_stub_offset())); call(TMP); } - void Assembler::pushq(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitRegisterREX(reg, REX_NONE); EmitUint8(0x50 | (reg & 7)); } - void Assembler::pushq(const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(6, address, REX_NONE); @@ -139,7 +126,6 @@ void Assembler::pushq(const Address& address) { EmitOperand(6, address); } - void Assembler::pushq(const Immediate& imm) { if (imm.is_int8()) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -155,7 +141,6 @@ void Assembler::pushq(const Immediate& imm) { } } - void Assembler::PushImmediate(const Immediate& imm) { if (imm.is_int32()) { pushq(imm); @@ -165,14 +150,12 @@ void Assembler::PushImmediate(const Immediate& imm) { } } - void Assembler::popq(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitRegisterREX(reg, REX_NONE); EmitUint8(0x58 | (reg & 7)); } - void Assembler::popq(const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(0, address, REX_NONE); @@ -180,7 +163,6 @@ void Assembler::popq(const Address& address) { EmitOperand(0, address); } - void Assembler::setcc(Condition condition, ByteRegister dst) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); @@ -188,7 +170,6 @@ void Assembler::setcc(Condition condition, ByteRegister dst) { EmitUint8(0xC0 + dst); } - void Assembler::movl(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -197,7 +178,6 @@ void Assembler::movl(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::movl(Register dst, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(dst); @@ -208,7 +188,6 @@ void Assembler::movl(Register dst, const Immediate& imm) { EmitImmediate(imm); } - void Assembler::movl(Register dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(dst, src, REX_NONE); @@ -216,7 +195,6 @@ void Assembler::movl(Register dst, const Address& src) { EmitOperand(dst & 7, src); } - void Assembler::movl(const Address& dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(src, dst, REX_NONE); @@ -224,13 +202,11 @@ void Assembler::movl(const Address& dst, Register src) { EmitOperand(src & 7, dst); } - void Assembler::movl(const Address& dst, const Immediate& imm) { movl(TMP, imm); movl(dst, TMP); } - void Assembler::movzxb(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -240,7 +216,6 @@ void Assembler::movzxb(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::movzxb(Register dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(dst, src, REX_W); @@ -249,7 +224,6 @@ void Assembler::movzxb(Register dst, const Address& src) { EmitOperand(dst & 7, src); } - void Assembler::movsxb(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -259,7 +233,6 @@ void Assembler::movsxb(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::movsxb(Register dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(dst, src, REX_W); @@ -268,7 +241,6 @@ void Assembler::movsxb(Register dst, const Address& src) { EmitOperand(dst & 7, src); } - void Assembler::movb(Register dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(dst, src, REX_NONE); @@ -276,7 +248,6 @@ void Assembler::movb(Register dst, const Address& src) { EmitOperand(dst & 7, src); } - void Assembler::movb(const Address& dst, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(0, dst, REX_NONE); @@ -286,7 +257,6 @@ void Assembler::movb(const Address& dst, const Immediate& imm) { EmitUint8(imm.value() & 0xFF); } - void Assembler::movb(const Address& dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(src, dst, REX_NONE); @@ -294,7 +264,6 @@ void Assembler::movb(const Address& dst, Register src) { EmitOperand(src & 7, dst); } - void Assembler::movzxw(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -304,7 +273,6 @@ void Assembler::movzxw(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::movzxw(Register dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(dst, src, REX_W); @@ -313,7 +281,6 @@ void Assembler::movzxw(Register dst, const Address& src) { EmitOperand(dst & 7, src); } - void Assembler::movsxw(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -323,7 +290,6 @@ void Assembler::movsxw(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::movsxw(Register dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(dst, src, REX_W); @@ -332,12 +298,10 @@ void Assembler::movsxw(Register dst, const Address& src) { EmitOperand(dst & 7, src); } - void Assembler::movw(Register dst, const Address& src) { FATAL("Use movzxw or movsxw instead."); } - void Assembler::movw(const Address& dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandSizeOverride(); @@ -346,7 +310,6 @@ void Assembler::movw(const Address& dst, Register src) { EmitOperand(src & 7, dst); } - void Assembler::movw(const Address& dst, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandSizeOverride(); @@ -357,7 +320,6 @@ void Assembler::movw(const Address& dst, const Immediate& imm) { EmitUint8((imm.value() >> 8) & 0xFF); } - void Assembler::movq(Register dst, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); if (imm.is_int32()) { @@ -372,7 +334,6 @@ void Assembler::movq(Register dst, const Immediate& imm) { EmitImmediate(imm); } - // Use 0x89 encoding (instead of 0x8B encoding), which is expected by gdb64 // older than 7.3.1-gg5 when disassembling a function's prologue (movq rbp, rsp) // for proper unwinding of Dart frames (use --generate_gdb_symbols and -O0). @@ -384,7 +345,6 @@ void Assembler::movq(Register dst, Register src) { EmitOperand(src & 7, operand); } - void Assembler::movq(Register dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(dst, src, REX_W); @@ -392,7 +352,6 @@ void Assembler::movq(Register dst, const Address& src) { EmitOperand(dst & 7, src); } - void Assembler::movq(const Address& dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(src, dst, REX_W); @@ -400,7 +359,6 @@ void Assembler::movq(const Address& dst, Register src) { EmitOperand(src & 7, dst); } - void Assembler::movq(const Address& dst, const Immediate& imm) { if (imm.is_int32()) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -415,7 +373,6 @@ void Assembler::movq(const Address& dst, const Immediate& imm) { } } - void Assembler::movsxd(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -424,7 +381,6 @@ void Assembler::movsxd(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::movsxd(Register dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(dst, src, REX_W); @@ -432,14 +388,12 @@ void Assembler::movsxd(Register dst, const Address& src) { EmitOperand(dst & 7, src); } - void Assembler::rep_movsb() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF3); EmitUint8(0xA4); } - void Assembler::leaq(Register dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(dst, src, REX_W); @@ -447,7 +401,6 @@ void Assembler::leaq(Register dst, const Address& src) { EmitOperand(dst & 7, src); } - void Assembler::cmovnoq(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -457,7 +410,6 @@ void Assembler::cmovnoq(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::cmoveq(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -467,7 +419,6 @@ void Assembler::cmoveq(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::cmovgeq(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -477,7 +428,6 @@ void Assembler::cmovgeq(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::cmovlessq(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -487,7 +437,6 @@ void Assembler::cmovlessq(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::movss(XmmRegister dst, const Address& src) { ASSERT(dst <= XMM15); AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -498,7 +447,6 @@ void Assembler::movss(XmmRegister dst, const Address& src) { EmitOperand(dst & 7, src); } - void Assembler::movss(const Address& dst, XmmRegister src) { ASSERT(src <= XMM15); AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -509,7 +457,6 @@ void Assembler::movss(const Address& dst, XmmRegister src) { EmitOperand(src & 7, dst); } - void Assembler::movss(XmmRegister dst, XmmRegister src) { ASSERT(src <= XMM15); ASSERT(dst <= XMM15); @@ -521,7 +468,6 @@ void Assembler::movss(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(src & 7, dst); } - void Assembler::movd(XmmRegister dst, Register src) { ASSERT(dst <= XMM15); AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -532,7 +478,6 @@ void Assembler::movd(XmmRegister dst, Register src) { EmitOperand(dst & 7, Operand(src)); } - void Assembler::movd(Register dst, XmmRegister src) { ASSERT(src <= XMM15); AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -543,7 +488,6 @@ void Assembler::movd(Register dst, XmmRegister src) { EmitOperand(src & 7, Operand(dst)); } - void Assembler::addss(XmmRegister dst, XmmRegister src) { ASSERT(src <= XMM15); ASSERT(dst <= XMM15); @@ -555,7 +499,6 @@ void Assembler::addss(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::subss(XmmRegister dst, XmmRegister src) { ASSERT(src <= XMM15); ASSERT(dst <= XMM15); @@ -567,7 +510,6 @@ void Assembler::subss(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::mulss(XmmRegister dst, XmmRegister src) { ASSERT(src <= XMM15); ASSERT(dst <= XMM15); @@ -579,7 +521,6 @@ void Assembler::mulss(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::divss(XmmRegister dst, XmmRegister src) { ASSERT(src <= XMM15); ASSERT(dst <= XMM15); @@ -591,7 +532,6 @@ void Assembler::divss(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::movsd(XmmRegister dst, const Address& src) { ASSERT(dst <= XMM15); AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -602,7 +542,6 @@ void Assembler::movsd(XmmRegister dst, const Address& src) { EmitOperand(dst & 7, src); } - void Assembler::movsd(const Address& dst, XmmRegister src) { ASSERT(src <= XMM15); AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -613,7 +552,6 @@ void Assembler::movsd(const Address& dst, XmmRegister src) { EmitOperand(src & 7, dst); } - void Assembler::movsd(XmmRegister dst, XmmRegister src) { ASSERT(src <= XMM15); ASSERT(dst <= XMM15); @@ -625,7 +563,6 @@ void Assembler::movsd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(src & 7, dst); } - void Assembler::movaps(XmmRegister dst, XmmRegister src) { ASSERT(src <= XMM15); ASSERT(dst <= XMM15); @@ -636,7 +573,6 @@ void Assembler::movaps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::movups(XmmRegister dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, src); @@ -645,7 +581,6 @@ void Assembler::movups(XmmRegister dst, const Address& src) { EmitOperand(dst & 7, src); } - void Assembler::movups(const Address& dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(src, dst); @@ -654,7 +589,6 @@ void Assembler::movups(const Address& dst, XmmRegister src) { EmitOperand(src & 7, dst); } - void Assembler::addsd(XmmRegister dst, XmmRegister src) { ASSERT(src <= XMM15); ASSERT(dst <= XMM15); @@ -666,7 +600,6 @@ void Assembler::addsd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::subsd(XmmRegister dst, XmmRegister src) { ASSERT(src <= XMM15); ASSERT(dst <= XMM15); @@ -678,7 +611,6 @@ void Assembler::subsd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::mulsd(XmmRegister dst, XmmRegister src) { ASSERT(src <= XMM15); ASSERT(dst <= XMM15); @@ -690,7 +622,6 @@ void Assembler::mulsd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::divsd(XmmRegister dst, XmmRegister src) { ASSERT(src <= XMM15); ASSERT(dst <= XMM15); @@ -702,7 +633,6 @@ void Assembler::divsd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::addpl(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -712,7 +642,6 @@ void Assembler::addpl(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::subpl(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -722,7 +651,6 @@ void Assembler::subpl(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::addps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, src); @@ -731,7 +659,6 @@ void Assembler::addps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::subps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, src); @@ -740,7 +667,6 @@ void Assembler::subps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::divps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, src); @@ -749,7 +675,6 @@ void Assembler::divps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::mulps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, src); @@ -758,7 +683,6 @@ void Assembler::mulps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::minps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, src); @@ -767,7 +691,6 @@ void Assembler::minps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::maxps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, src); @@ -776,7 +699,6 @@ void Assembler::maxps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::andps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, src); @@ -785,7 +707,6 @@ void Assembler::andps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::andps(XmmRegister dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, src); @@ -794,7 +715,6 @@ void Assembler::andps(XmmRegister dst, const Address& src) { EmitOperand(dst & 7, src); } - void Assembler::orps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, src); @@ -809,28 +729,24 @@ void Assembler::notps(XmmRegister dst) { xorps(dst, Address(TMP, 0)); } - void Assembler::negateps(XmmRegister dst) { // { 0x80000000, 0x80000000, 0x80000000, 0x80000000 } movq(TMP, Address(THR, Thread::float_negate_address_offset())); xorps(dst, Address(TMP, 0)); } - void Assembler::absps(XmmRegister dst) { // { 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF } movq(TMP, Address(THR, Thread::float_absolute_address_offset())); andps(dst, Address(TMP, 0)); } - void Assembler::zerowps(XmmRegister dst) { // { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000 } movq(TMP, Address(THR, Thread::float_zerow_address_offset())); andps(dst, Address(TMP, 0)); } - void Assembler::cmppseq(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, src); @@ -840,7 +756,6 @@ void Assembler::cmppseq(XmmRegister dst, XmmRegister src) { EmitUint8(0x0); } - void Assembler::cmppsneq(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, src); @@ -850,7 +765,6 @@ void Assembler::cmppsneq(XmmRegister dst, XmmRegister src) { EmitUint8(0x4); } - void Assembler::cmppslt(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, src); @@ -860,7 +774,6 @@ void Assembler::cmppslt(XmmRegister dst, XmmRegister src) { EmitUint8(0x1); } - void Assembler::cmppsle(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, src); @@ -870,7 +783,6 @@ void Assembler::cmppsle(XmmRegister dst, XmmRegister src) { EmitUint8(0x2); } - void Assembler::cmppsnlt(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, src); @@ -880,7 +792,6 @@ void Assembler::cmppsnlt(XmmRegister dst, XmmRegister src) { EmitUint8(0x5); } - void Assembler::cmppsnle(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, src); @@ -890,7 +801,6 @@ void Assembler::cmppsnle(XmmRegister dst, XmmRegister src) { EmitUint8(0x6); } - void Assembler::sqrtps(XmmRegister dst) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, dst); @@ -899,7 +809,6 @@ void Assembler::sqrtps(XmmRegister dst) { EmitXmmRegisterOperand(dst & 7, dst); } - void Assembler::rsqrtps(XmmRegister dst) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, dst); @@ -908,7 +817,6 @@ void Assembler::rsqrtps(XmmRegister dst) { EmitXmmRegisterOperand(dst & 7, dst); } - void Assembler::reciprocalps(XmmRegister dst) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, dst); @@ -917,7 +825,6 @@ void Assembler::reciprocalps(XmmRegister dst) { EmitXmmRegisterOperand(dst & 7, dst); } - void Assembler::movhlps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, src); @@ -926,7 +833,6 @@ void Assembler::movhlps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::movlhps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, src); @@ -935,7 +841,6 @@ void Assembler::movlhps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::unpcklps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, src); @@ -944,7 +849,6 @@ void Assembler::unpcklps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::unpckhps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, src); @@ -953,7 +857,6 @@ void Assembler::unpckhps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::unpcklpd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -963,7 +866,6 @@ void Assembler::unpcklpd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::unpckhpd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -973,7 +875,6 @@ void Assembler::unpckhpd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::set1ps(XmmRegister dst, Register tmp1, const Immediate& imm) { // Load 32-bit immediate value into tmp1. movl(tmp1, imm); @@ -983,7 +884,6 @@ void Assembler::set1ps(XmmRegister dst, Register tmp1, const Immediate& imm) { shufps(dst, dst, Immediate(0x0)); } - void Assembler::shufps(XmmRegister dst, XmmRegister src, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, src); @@ -994,7 +894,6 @@ void Assembler::shufps(XmmRegister dst, XmmRegister src, const Immediate& imm) { EmitUint8(imm.value()); } - void Assembler::addpd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); ASSERT(src <= XMM15); @@ -1006,14 +905,12 @@ void Assembler::addpd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::negatepd(XmmRegister dst) { // { 0x8000000000000000LL, 0x8000000000000000LL } movq(TMP, Address(THR, Thread::double_negate_address_offset())); xorpd(dst, Address(TMP, 0)); } - void Assembler::subpd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); ASSERT(src <= XMM15); @@ -1025,7 +922,6 @@ void Assembler::subpd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::mulpd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); ASSERT(src <= XMM15); @@ -1037,7 +933,6 @@ void Assembler::mulpd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::divpd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); ASSERT(src <= XMM15); @@ -1049,14 +944,12 @@ void Assembler::divpd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::abspd(XmmRegister dst) { // { 0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFFLL } movq(TMP, Address(THR, Thread::double_abs_address_offset())); andpd(dst, Address(TMP, 0)); } - void Assembler::minpd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); ASSERT(src <= XMM15); @@ -1068,7 +961,6 @@ void Assembler::minpd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::maxpd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); ASSERT(src <= XMM15); @@ -1080,7 +972,6 @@ void Assembler::maxpd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::sqrtpd(XmmRegister dst) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); ASSERT(dst <= XMM15); @@ -1091,7 +982,6 @@ void Assembler::sqrtpd(XmmRegister dst) { EmitXmmRegisterOperand(dst & 7, dst); } - void Assembler::cvtps2pd(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); ASSERT(src <= XMM15); @@ -1102,7 +992,6 @@ void Assembler::cvtps2pd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::cvtpd2ps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); ASSERT(src <= XMM15); @@ -1114,7 +1003,6 @@ void Assembler::cvtpd2ps(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::shufpd(XmmRegister dst, XmmRegister src, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x66); @@ -1126,7 +1014,6 @@ void Assembler::shufpd(XmmRegister dst, XmmRegister src, const Immediate& imm) { EmitUint8(imm.value()); } - void Assembler::comisd(XmmRegister a, XmmRegister b) { ASSERT(a <= XMM15); ASSERT(b <= XMM15); @@ -1138,7 +1025,6 @@ void Assembler::comisd(XmmRegister a, XmmRegister b) { EmitXmmRegisterOperand(a & 7, b); } - void Assembler::movmskpd(Register dst, XmmRegister src) { ASSERT(src <= XMM15); AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -1149,7 +1035,6 @@ void Assembler::movmskpd(Register dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::movmskps(Register dst, XmmRegister src) { ASSERT(src <= XMM15); AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -1159,7 +1044,6 @@ void Assembler::movmskps(Register dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::sqrtsd(XmmRegister dst, XmmRegister src) { ASSERT(dst <= XMM15); ASSERT(src <= XMM15); @@ -1171,7 +1055,6 @@ void Assembler::sqrtsd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::xorpd(XmmRegister dst, const Address& src) { ASSERT(dst <= XMM15); AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -1182,7 +1065,6 @@ void Assembler::xorpd(XmmRegister dst, const Address& src) { EmitOperand(dst & 7, src); } - void Assembler::xorpd(XmmRegister dst, XmmRegister src) { ASSERT(dst <= XMM15); ASSERT(src <= XMM15); @@ -1194,7 +1076,6 @@ void Assembler::xorpd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::xorps(XmmRegister dst, const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, src); @@ -1203,7 +1084,6 @@ void Assembler::xorps(XmmRegister dst, const Address& src) { EmitOperand(dst & 7, src); } - void Assembler::xorps(XmmRegister dst, XmmRegister src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitREX_RB(dst, src); @@ -1222,7 +1102,6 @@ void Assembler::andpd(XmmRegister dst, const Address& src) { EmitOperand(dst & 7, src); } - void Assembler::cvtsi2sdq(XmmRegister dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); ASSERT(dst <= XMM15); @@ -1234,7 +1113,6 @@ void Assembler::cvtsi2sdq(XmmRegister dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::cvtsi2sdl(XmmRegister dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); ASSERT(dst <= XMM15); @@ -1246,7 +1124,6 @@ void Assembler::cvtsi2sdl(XmmRegister dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::cvttsd2siq(Register dst, XmmRegister src) { ASSERT(src <= XMM15); AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -1258,7 +1135,6 @@ void Assembler::cvttsd2siq(Register dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::cvtss2sd(XmmRegister dst, XmmRegister src) { ASSERT(src <= XMM15); ASSERT(dst <= XMM15); @@ -1270,7 +1146,6 @@ void Assembler::cvtss2sd(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::cvtsd2ss(XmmRegister dst, XmmRegister src) { ASSERT(src <= XMM15); ASSERT(dst <= XMM15); @@ -1282,7 +1157,6 @@ void Assembler::cvtsd2ss(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::pxor(XmmRegister dst, XmmRegister src) { ASSERT(src <= XMM15); ASSERT(dst <= XMM15); @@ -1294,7 +1168,6 @@ void Assembler::pxor(XmmRegister dst, XmmRegister src) { EmitXmmRegisterOperand(dst & 7, src); } - void Assembler::roundsd(XmmRegister dst, XmmRegister src, RoundingMode mode) { ASSERT(src <= XMM15); ASSERT(dst <= XMM15); @@ -1309,28 +1182,24 @@ void Assembler::roundsd(XmmRegister dst, XmmRegister src, RoundingMode mode) { EmitUint8(static_cast(mode) | 0x8); } - void Assembler::fldl(const Address& src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xDD); EmitOperand(0, src); } - void Assembler::fstpl(const Address& dst) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xDD); EmitOperand(3, dst); } - void Assembler::fincstp() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xD9); EmitUint8(0xF7); } - void Assembler::ffree(intptr_t value) { ASSERT(value < 7); AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -1338,21 +1207,18 @@ void Assembler::ffree(intptr_t value) { EmitUint8(0xC0 + value); } - void Assembler::fsin() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xD9); EmitUint8(0xFE); } - void Assembler::fcos() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xD9); EmitUint8(0xFF); } - void Assembler::xchgl(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -1361,7 +1227,6 @@ void Assembler::xchgl(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::xchgq(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -1370,7 +1235,6 @@ void Assembler::xchgq(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::cmpb(const Address& address, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(7, address, REX_NONE); @@ -1380,7 +1244,6 @@ void Assembler::cmpb(const Address& address, const Immediate& imm) { EmitUint8(imm.value() & 0xFF); } - void Assembler::cmpw(Register reg, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandSizeOverride(); @@ -1389,7 +1252,6 @@ void Assembler::cmpw(Register reg, const Address& address) { EmitOperand(reg & 7, address); } - void Assembler::cmpw(const Address& address, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandSizeOverride(); @@ -1400,14 +1262,12 @@ void Assembler::cmpw(const Address& address, const Immediate& imm) { EmitUint8((imm.value() >> 8) & 0xFF); } - void Assembler::cmpl(Register reg, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitRegisterREX(reg, REX_NONE); EmitComplex(7, Operand(reg), imm); } - void Assembler::cmpl(Register reg0, Register reg1) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(reg1); @@ -1416,7 +1276,6 @@ void Assembler::cmpl(Register reg0, Register reg1) { EmitOperand(reg0 & 7, operand); } - void Assembler::cmpl(Register reg, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(reg, address, REX_NONE); @@ -1424,7 +1283,6 @@ void Assembler::cmpl(Register reg, const Address& address) { EmitOperand(reg & 7, address); } - void Assembler::cmpl(const Address& address, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(address); @@ -1432,7 +1290,6 @@ void Assembler::cmpl(const Address& address, const Immediate& imm) { EmitComplex(7, operand, imm); } - void Assembler::cmpq(const Address& address, Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(reg, address, REX_W); @@ -1440,7 +1297,6 @@ void Assembler::cmpq(const Address& address, Register reg) { EmitOperand(reg & 7, address); } - void Assembler::cmpq(const Address& address, const Immediate& imm) { if (imm.is_int32()) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -1453,7 +1309,6 @@ void Assembler::cmpq(const Address& address, const Immediate& imm) { } } - void Assembler::cmpq(Register reg, const Immediate& imm) { if (imm.is_int32()) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -1466,7 +1321,6 @@ void Assembler::cmpq(Register reg, const Immediate& imm) { } } - void Assembler::cmpq(Register reg0, Register reg1) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(reg1); @@ -1475,7 +1329,6 @@ void Assembler::cmpq(Register reg0, Register reg1) { EmitOperand(reg0 & 7, operand); } - void Assembler::cmpq(Register reg, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(reg, address, REX_W); @@ -1483,7 +1336,6 @@ void Assembler::cmpq(Register reg, const Address& address) { EmitOperand(reg & 7, address); } - void Assembler::CompareImmediate(Register reg, const Immediate& imm) { if (imm.is_int32()) { cmpq(reg, imm); @@ -1494,7 +1346,6 @@ void Assembler::CompareImmediate(Register reg, const Immediate& imm) { } } - void Assembler::CompareImmediate(const Address& address, const Immediate& imm) { if (imm.is_int32()) { cmpq(address, imm); @@ -1504,7 +1355,6 @@ void Assembler::CompareImmediate(const Address& address, const Immediate& imm) { } } - void Assembler::testl(Register reg1, Register reg2) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(reg2); @@ -1513,7 +1363,6 @@ void Assembler::testl(Register reg1, Register reg2) { EmitOperand(reg1 & 7, operand); } - void Assembler::testl(Register reg, const Immediate& imm) { // TODO(kasperl): Deal with registers r8-r15 using the short // encoding form of the immediate? @@ -1545,7 +1394,6 @@ void Assembler::testl(Register reg, const Immediate& imm) { } } - void Assembler::testb(const Address& address, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(0, address, REX_NONE); @@ -1555,7 +1403,6 @@ void Assembler::testb(const Address& address, const Immediate& imm) { EmitUint8(imm.value() & 0xFF); } - void Assembler::testq(Register reg1, Register reg2) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(reg2); @@ -1564,7 +1411,6 @@ void Assembler::testq(Register reg1, Register reg2) { EmitOperand(reg1 & 7, operand); } - void Assembler::testq(Register reg, const Immediate& imm) { // TODO(kasperl): Deal with registers r8-r15 using the short // encoding form of the immediate? @@ -1594,7 +1440,6 @@ void Assembler::testq(Register reg, const Immediate& imm) { } } - void Assembler::TestImmediate(Register dst, const Immediate& imm) { if (imm.is_int32()) { testq(dst, imm); @@ -1605,7 +1450,6 @@ void Assembler::TestImmediate(Register dst, const Immediate& imm) { } } - void Assembler::andl(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -1614,14 +1458,12 @@ void Assembler::andl(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::andl(Register dst, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitRegisterREX(dst, REX_NONE); EmitComplex(4, Operand(dst), imm); } - void Assembler::orl(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -1630,14 +1472,12 @@ void Assembler::orl(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::orl(Register dst, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitRegisterREX(dst, REX_NONE); EmitComplex(1, Operand(dst), imm); } - void Assembler::orl(const Address& address, Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(reg, address, REX_NONE); @@ -1645,7 +1485,6 @@ void Assembler::orl(const Address& address, Register reg) { EmitOperand(reg & 7, address); } - void Assembler::xorl(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -1654,7 +1493,6 @@ void Assembler::xorl(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::andq(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -1663,7 +1501,6 @@ void Assembler::andq(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::andq(Register dst, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(dst, address, REX_W); @@ -1671,7 +1508,6 @@ void Assembler::andq(Register dst, const Address& address) { EmitOperand(dst & 7, address); } - void Assembler::andq(Register dst, const Immediate& imm) { if (imm.is_int32()) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -1684,7 +1520,6 @@ void Assembler::andq(Register dst, const Immediate& imm) { } } - void Assembler::AndImmediate(Register dst, const Immediate& imm) { if (imm.is_int32()) { andq(dst, imm); @@ -1695,7 +1530,6 @@ void Assembler::AndImmediate(Register dst, const Immediate& imm) { } } - void Assembler::orq(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -1704,7 +1538,6 @@ void Assembler::orq(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::orq(Register dst, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(dst, address, REX_W); @@ -1712,7 +1545,6 @@ void Assembler::orq(Register dst, const Address& address) { EmitOperand(dst & 7, address); } - void Assembler::orq(Register dst, const Immediate& imm) { if (imm.is_int32()) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -1725,7 +1557,6 @@ void Assembler::orq(Register dst, const Immediate& imm) { } } - void Assembler::OrImmediate(Register dst, const Immediate& imm) { if (imm.is_int32()) { orq(dst, imm); @@ -1736,7 +1567,6 @@ void Assembler::OrImmediate(Register dst, const Immediate& imm) { } } - void Assembler::xorq(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -1745,7 +1575,6 @@ void Assembler::xorq(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::xorq(Register dst, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(dst, address, REX_W); @@ -1753,7 +1582,6 @@ void Assembler::xorq(Register dst, const Address& address) { EmitOperand(dst & 7, address); } - void Assembler::xorq(const Address& dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(src, dst, REX_W); @@ -1761,7 +1589,6 @@ void Assembler::xorq(const Address& dst, Register src) { EmitOperand(src & 7, dst); } - void Assembler::xorq(Register dst, const Immediate& imm) { if (imm.is_int32()) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -1774,7 +1601,6 @@ void Assembler::xorq(Register dst, const Immediate& imm) { } } - void Assembler::XorImmediate(Register dst, const Immediate& imm) { if (imm.is_int32()) { xorq(dst, imm); @@ -1785,7 +1611,6 @@ void Assembler::XorImmediate(Register dst, const Immediate& imm) { } } - void Assembler::addl(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -1794,7 +1619,6 @@ void Assembler::addl(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::addl(Register dst, const Immediate& imm) { ASSERT(imm.is_int32()); AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -1802,7 +1626,6 @@ void Assembler::addl(Register dst, const Immediate& imm) { EmitComplex(0, Operand(dst), imm); } - void Assembler::addl(Register dst, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(dst, address, REX_NONE); @@ -1810,7 +1633,6 @@ void Assembler::addl(Register dst, const Address& address) { EmitOperand(dst & 7, address); } - void Assembler::addl(const Address& address, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(src, address, REX_NONE); @@ -1818,7 +1640,6 @@ void Assembler::addl(const Address& address, Register src) { EmitOperand(src & 7, address); } - void Assembler::adcl(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -1827,7 +1648,6 @@ void Assembler::adcl(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::adcl(Register dst, const Immediate& imm) { ASSERT(imm.is_int32()); AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -1835,7 +1655,6 @@ void Assembler::adcl(Register dst, const Immediate& imm) { EmitComplex(2, Operand(dst), imm); } - void Assembler::adcl(Register dst, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(dst, address, REX_NONE); @@ -1843,7 +1662,6 @@ void Assembler::adcl(Register dst, const Address& address) { EmitOperand(dst & 7, address); } - void Assembler::addq(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -1852,7 +1670,6 @@ void Assembler::addq(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::addq(Register dst, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(dst, address, REX_W); @@ -1860,7 +1677,6 @@ void Assembler::addq(Register dst, const Address& address) { EmitOperand(dst & 7, address); } - void Assembler::addq(Register dst, const Immediate& imm) { if (imm.is_int32()) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -1873,7 +1689,6 @@ void Assembler::addq(Register dst, const Immediate& imm) { } } - void Assembler::addq(const Address& address, const Immediate& imm) { if (imm.is_int32()) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -1885,7 +1700,6 @@ void Assembler::addq(const Address& address, const Immediate& imm) { } } - void Assembler::addq(const Address& address, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(src, address, REX_W); @@ -1893,7 +1707,6 @@ void Assembler::addq(const Address& address, Register src) { EmitOperand(src & 7, address); } - void Assembler::adcq(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -1902,7 +1715,6 @@ void Assembler::adcq(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::adcq(Register dst, const Immediate& imm) { if (imm.is_int32()) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -1915,7 +1727,6 @@ void Assembler::adcq(Register dst, const Immediate& imm) { } } - void Assembler::adcq(Register dst, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(dst, address, REX_W); @@ -1923,7 +1734,6 @@ void Assembler::adcq(Register dst, const Address& address) { EmitOperand(dst & 7, address); } - void Assembler::subl(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -1932,7 +1742,6 @@ void Assembler::subl(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::subl(Register dst, const Immediate& imm) { ASSERT(imm.is_int32()); AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -1940,7 +1749,6 @@ void Assembler::subl(Register dst, const Immediate& imm) { EmitComplex(3, Operand(dst), imm); } - void Assembler::subl(Register dst, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(dst, address, REX_NONE); @@ -1948,7 +1756,6 @@ void Assembler::subl(Register dst, const Address& address) { EmitOperand(dst & 7, address); } - void Assembler::sbbl(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -1957,7 +1764,6 @@ void Assembler::sbbl(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::sbbl(Register dst, const Immediate& imm) { ASSERT(imm.is_int32()); AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -1965,7 +1771,6 @@ void Assembler::sbbl(Register dst, const Immediate& imm) { EmitComplex(3, Operand(dst), imm); } - void Assembler::sbbl(Register dst, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(dst, address, REX_NONE); @@ -1973,20 +1778,17 @@ void Assembler::sbbl(Register dst, const Address& address) { EmitOperand(dst & 7, address); } - void Assembler::cdq() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x99); } - void Assembler::cqo() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitRegisterREX(RAX, REX_W); EmitUint8(0x99); } - void Assembler::idivl(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitRegisterREX(reg, REX_NONE); @@ -1994,7 +1796,6 @@ void Assembler::idivl(Register reg) { EmitOperand(7, Operand(reg)); } - void Assembler::divl(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitRegisterREX(reg, REX_NONE); @@ -2002,7 +1803,6 @@ void Assembler::divl(Register reg) { EmitOperand(6, Operand(reg)); } - void Assembler::idivq(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitRegisterREX(reg, REX_W); @@ -2010,7 +1810,6 @@ void Assembler::idivq(Register reg) { EmitOperand(7, Operand(reg)); } - void Assembler::divq(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitRegisterREX(reg, REX_W); @@ -2018,7 +1817,6 @@ void Assembler::divq(Register reg) { EmitOperand(6, Operand(reg)); } - void Assembler::imull(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -2028,7 +1826,6 @@ void Assembler::imull(Register dst, Register src) { EmitOperand(dst & 7, Operand(src)); } - void Assembler::imull(Register reg, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(reg); @@ -2038,7 +1835,6 @@ void Assembler::imull(Register reg, const Immediate& imm) { EmitImmediate(imm); } - void Assembler::mull(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitRegisterREX(reg, REX_NONE); @@ -2046,7 +1842,6 @@ void Assembler::mull(Register reg) { EmitOperand(4, Operand(reg)); } - void Assembler::imulq(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -2056,7 +1851,6 @@ void Assembler::imulq(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::imulq(Register reg, const Immediate& imm) { if (imm.is_int32()) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -2072,7 +1866,6 @@ void Assembler::imulq(Register reg, const Immediate& imm) { } } - void Assembler::MulImmediate(Register reg, const Immediate& imm) { if (imm.is_int32()) { imulq(reg, imm); @@ -2083,7 +1876,6 @@ void Assembler::MulImmediate(Register reg, const Immediate& imm) { } } - void Assembler::imulq(Register dst, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(dst, address, REX_W); @@ -2092,7 +1884,6 @@ void Assembler::imulq(Register dst, const Address& address) { EmitOperand(dst & 7, address); } - void Assembler::mulq(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitRegisterREX(reg, REX_W); @@ -2100,7 +1891,6 @@ void Assembler::mulq(Register reg) { EmitOperand(4, Operand(reg)); } - void Assembler::subq(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -2109,7 +1899,6 @@ void Assembler::subq(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::subq(Register reg, const Immediate& imm) { if (imm.is_int32()) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -2122,7 +1911,6 @@ void Assembler::subq(Register reg, const Immediate& imm) { } } - void Assembler::subq(Register reg, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(reg, address, REX_W); @@ -2130,7 +1918,6 @@ void Assembler::subq(Register reg, const Address& address) { EmitOperand(reg & 7, address); } - void Assembler::subq(const Address& address, Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(reg, address, REX_W); @@ -2138,7 +1925,6 @@ void Assembler::subq(const Address& address, Register reg) { EmitOperand(reg & 7, address); } - void Assembler::subq(const Address& address, const Immediate& imm) { if (imm.is_int32()) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -2150,7 +1936,6 @@ void Assembler::subq(const Address& address, const Immediate& imm) { } } - void Assembler::sbbq(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -2159,7 +1944,6 @@ void Assembler::sbbq(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::sbbq(Register dst, const Immediate& imm) { if (imm.is_int32()) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -2172,7 +1956,6 @@ void Assembler::sbbq(Register dst, const Immediate& imm) { } } - void Assembler::sbbq(Register dst, const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(dst, address, REX_W); @@ -2180,37 +1963,30 @@ void Assembler::sbbq(Register dst, const Address& address) { EmitOperand(dst & 7, address); } - void Assembler::shll(Register reg, const Immediate& imm) { EmitGenericShift(false, 4, reg, imm); } - void Assembler::shll(Register operand, Register shifter) { EmitGenericShift(false, 4, operand, shifter); } - void Assembler::shrl(Register reg, const Immediate& imm) { EmitGenericShift(false, 5, reg, imm); } - void Assembler::shrl(Register operand, Register shifter) { EmitGenericShift(false, 5, operand, shifter); } - void Assembler::sarl(Register reg, const Immediate& imm) { EmitGenericShift(false, 7, reg, imm); } - void Assembler::sarl(Register operand, Register shifter) { EmitGenericShift(false, 7, operand, shifter); } - void Assembler::shldl(Register dst, Register src, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); ASSERT(imm.is_int8()); @@ -2222,37 +1998,30 @@ void Assembler::shldl(Register dst, Register src, const Immediate& imm) { EmitUint8(imm.value() & 0xFF); } - void Assembler::shlq(Register reg, const Immediate& imm) { EmitGenericShift(true, 4, reg, imm); } - void Assembler::shlq(Register operand, Register shifter) { EmitGenericShift(true, 4, operand, shifter); } - void Assembler::shrq(Register reg, const Immediate& imm) { EmitGenericShift(true, 5, reg, imm); } - void Assembler::shrq(Register operand, Register shifter) { EmitGenericShift(true, 5, operand, shifter); } - void Assembler::sarq(Register reg, const Immediate& imm) { EmitGenericShift(true, 7, reg, imm); } - void Assembler::sarq(Register operand, Register shifter) { EmitGenericShift(true, 7, operand, shifter); } - void Assembler::shldq(Register dst, Register src, const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); ASSERT(imm.is_int8()); @@ -2264,7 +2033,6 @@ void Assembler::shldq(Register dst, Register src, const Immediate& imm) { EmitUint8(imm.value() & 0xFF); } - void Assembler::shldq(Register dst, Register src, Register shifter) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); ASSERT(shifter == RCX); @@ -2275,7 +2043,6 @@ void Assembler::shldq(Register dst, Register src, Register shifter) { EmitOperand(src & 7, operand); } - void Assembler::shrdq(Register dst, Register src, Register shifter) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); ASSERT(shifter == RCX); @@ -2286,7 +2053,6 @@ void Assembler::shrdq(Register dst, Register src, Register shifter) { EmitOperand(src & 7, operand); } - void Assembler::incl(const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(address); @@ -2295,7 +2061,6 @@ void Assembler::incl(const Address& address) { EmitOperand(0, operand); } - void Assembler::decl(const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(address); @@ -2304,7 +2069,6 @@ void Assembler::decl(const Address& address) { EmitOperand(1, operand); } - void Assembler::incq(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(reg); @@ -2313,7 +2077,6 @@ void Assembler::incq(Register reg) { EmitOperand(0, operand); } - void Assembler::incq(const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(address); @@ -2322,7 +2085,6 @@ void Assembler::incq(const Address& address) { EmitOperand(0, operand); } - void Assembler::decq(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(reg); @@ -2331,7 +2093,6 @@ void Assembler::decq(Register reg) { EmitOperand(1, operand); } - void Assembler::decq(const Address& address) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(address); @@ -2340,7 +2101,6 @@ void Assembler::decq(const Address& address) { EmitOperand(1, operand); } - void Assembler::negl(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitRegisterREX(reg, REX_NONE); @@ -2348,7 +2108,6 @@ void Assembler::negl(Register reg) { EmitOperand(3, Operand(reg)); } - void Assembler::negq(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitRegisterREX(reg, REX_W); @@ -2356,7 +2115,6 @@ void Assembler::negq(Register reg) { EmitOperand(3, Operand(reg)); } - void Assembler::notl(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitRegisterREX(reg, REX_NONE); @@ -2364,7 +2122,6 @@ void Assembler::notl(Register reg) { EmitUint8(0xD0 | (reg & 7)); } - void Assembler::notq(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitRegisterREX(reg, REX_W); @@ -2372,7 +2129,6 @@ void Assembler::notq(Register reg) { EmitUint8(0xD0 | (reg & 7)); } - void Assembler::bsrq(Register dst, Register src) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(src); @@ -2382,7 +2138,6 @@ void Assembler::bsrq(Register dst, Register src) { EmitOperand(dst & 7, operand); } - void Assembler::btq(Register base, Register offset) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(base); @@ -2392,7 +2147,6 @@ void Assembler::btq(Register base, Register offset) { EmitOperand(offset & 7, operand); } - void Assembler::enter(const Immediate& imm) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xC8); @@ -2402,19 +2156,16 @@ void Assembler::enter(const Immediate& imm) { EmitUint8(0x00); } - void Assembler::leave() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xC9); } - void Assembler::ret() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xC3); } - void Assembler::nop(int size) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); // There are nops up to size 15, but for now just provide up to size 8. @@ -2477,19 +2228,16 @@ void Assembler::nop(int size) { } } - void Assembler::int3() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xCC); } - void Assembler::hlt() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF4); } - void Assembler::j(Condition condition, Label* label, bool near) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); if (label->IsBound()) { @@ -2515,7 +2263,6 @@ void Assembler::j(Condition condition, Label* label, bool near) { } } - void Assembler::J(Condition condition, const StubEntry& stub_entry, Register pp) { @@ -2526,7 +2273,6 @@ void Assembler::J(Condition condition, Bind(&no_jump); } - void Assembler::jmp(Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); Operand operand(reg); @@ -2535,7 +2281,6 @@ void Assembler::jmp(Register reg) { EmitOperand(4, operand); } - void Assembler::jmp(const Address& dst) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(4, dst, REX_NONE); @@ -2543,7 +2288,6 @@ void Assembler::jmp(const Address& dst) { EmitOperand(4, dst); } - void Assembler::jmp(Label* label, bool near) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); if (label->IsBound()) { @@ -2567,7 +2311,6 @@ void Assembler::jmp(Label* label, bool near) { } } - void Assembler::jmp(const ExternalLabel* label) { { // Encode movq(TMP, Immediate(label->address())), but always as imm64. AssemblerBuffer::EnsureCapacity ensured(&buffer_); @@ -2578,7 +2321,6 @@ void Assembler::jmp(const ExternalLabel* label) { jmp(TMP); } - void Assembler::JmpPatchable(const StubEntry& stub_entry, Register pp) { ASSERT((pp != PP) || constant_pool_allowed()); const Code& target = Code::ZoneHandle(stub_entry.code()); @@ -2589,7 +2331,6 @@ void Assembler::JmpPatchable(const StubEntry& stub_entry, Register pp) { jmp(TMP); } - void Assembler::Jmp(const StubEntry& stub_entry, Register pp) { ASSERT((pp != PP) || constant_pool_allowed()); const Code& target = Code::ZoneHandle(stub_entry.code()); @@ -2600,13 +2341,11 @@ void Assembler::Jmp(const StubEntry& stub_entry, Register pp) { jmp(TMP); } - void Assembler::lock() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0xF0); } - void Assembler::cmpxchgl(const Address& address, Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(reg, address, REX_NONE); @@ -2615,7 +2354,6 @@ void Assembler::cmpxchgl(const Address& address, Register reg) { EmitOperand(reg & 7, address); } - void Assembler::cmpxchgq(const Address& address, Register reg) { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitOperandREX(reg, address, REX_W); @@ -2624,31 +2362,26 @@ void Assembler::cmpxchgq(const Address& address, Register reg) { EmitOperand(reg & 7, address); } - void Assembler::cpuid() { AssemblerBuffer::EnsureCapacity ensured(&buffer_); EmitUint8(0x0F); EmitUint8(0xA2); } - void Assembler::CompareRegisters(Register a, Register b) { cmpq(a, b); } - void Assembler::MoveRegister(Register to, Register from) { if (to != from) { movq(to, from); } } - void Assembler::PopRegister(Register r) { popq(r); } - void Assembler::AddImmediate(Register reg, const Immediate& imm) { const int64_t value = imm.value(); if (value == 0) { @@ -2671,7 +2404,6 @@ void Assembler::AddImmediate(Register reg, const Immediate& imm) { } } - void Assembler::AddImmediate(const Address& address, const Immediate& imm) { const int64_t value = imm.value(); if (value == 0) { @@ -2693,7 +2425,6 @@ void Assembler::AddImmediate(const Address& address, const Immediate& imm) { } } - void Assembler::SubImmediate(Register reg, const Immediate& imm) { const int64_t value = imm.value(); if (value == 0) { @@ -2716,7 +2447,6 @@ void Assembler::SubImmediate(Register reg, const Immediate& imm) { } } - void Assembler::SubImmediate(const Address& address, const Immediate& imm) { const int64_t value = imm.value(); if (value == 0) { @@ -2738,7 +2468,6 @@ void Assembler::SubImmediate(const Address& address, const Immediate& imm) { } } - void Assembler::Drop(intptr_t stack_elements, Register tmp) { ASSERT(stack_elements >= 0); if (stack_elements <= 4) { @@ -2750,7 +2479,6 @@ void Assembler::Drop(intptr_t stack_elements, Register tmp) { addq(RSP, Immediate(stack_elements * kWordSize)); } - bool Assembler::CanLoadFromObjectPool(const Object& object) const { ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); ASSERT(!object.IsField() || Field::Cast(object).IsOriginal()); @@ -2771,7 +2499,6 @@ bool Assembler::CanLoadFromObjectPool(const Object& object) const { return true; } - void Assembler::LoadWordFromPoolOffset(Register dst, int32_t offset) { ASSERT(constant_pool_allowed()); ASSERT(dst != PP); @@ -2780,12 +2507,10 @@ void Assembler::LoadWordFromPoolOffset(Register dst, int32_t offset) { movq(dst, Address::AddressBaseImm32(PP, offset)); } - void Assembler::LoadIsolate(Register dst) { movq(dst, Address(THR, Thread::isolate_offset())); } - void Assembler::LoadObjectHelper(Register dst, const Object& object, bool is_unique) { @@ -2804,7 +2529,6 @@ void Assembler::LoadObjectHelper(Register dst, } } - void Assembler::LoadFunctionFromCalleePool(Register dst, const Function& function, Register new_pp) { @@ -2815,17 +2539,14 @@ void Assembler::LoadFunctionFromCalleePool(Register dst, movq(dst, Address::AddressBaseImm32(new_pp, offset - kHeapObjectTag)); } - void Assembler::LoadObject(Register dst, const Object& object) { LoadObjectHelper(dst, object, false); } - void Assembler::LoadUniqueObject(Register dst, const Object& object) { LoadObjectHelper(dst, object, true); } - void Assembler::StoreObject(const Address& dst, const Object& object) { ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); ASSERT(!object.IsField() || Field::Cast(object).IsOriginal()); @@ -2841,7 +2562,6 @@ void Assembler::StoreObject(const Address& dst, const Object& object) { } } - void Assembler::PushObject(const Object& object) { ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); ASSERT(!object.IsField() || Field::Cast(object).IsOriginal()); @@ -2856,7 +2576,6 @@ void Assembler::PushObject(const Object& object) { } } - void Assembler::CompareObject(Register reg, const Object& object) { ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); ASSERT(!object.IsField() || Field::Cast(object).IsOriginal()); @@ -2872,12 +2591,10 @@ void Assembler::CompareObject(Register reg, const Object& object) { } } - intptr_t Assembler::FindImmediate(int64_t imm) { return object_pool_wrapper_.FindImmediate(imm); } - void Assembler::LoadImmediate(Register reg, const Immediate& imm) { if (imm.is_int32() || !constant_pool_allowed()) { movq(reg, imm); @@ -2887,7 +2604,6 @@ void Assembler::LoadImmediate(Register reg, const Immediate& imm) { } } - void Assembler::MoveImmediate(const Address& dst, const Immediate& imm) { if (imm.is_int32()) { movq(dst, imm); @@ -2897,7 +2613,6 @@ void Assembler::MoveImmediate(const Address& dst, const Immediate& imm) { } } - // Destroys the value register. void Assembler::StoreIntoObjectFilterNoSmi(Register object, Register value, @@ -2917,7 +2632,6 @@ void Assembler::StoreIntoObjectFilterNoSmi(Register object, j(NOT_ZERO, no_update, Assembler::kNearJump); } - // Destroys the value register. void Assembler::StoreIntoObjectFilter(Register object, Register value, @@ -2937,7 +2651,6 @@ void Assembler::StoreIntoObjectFilter(Register object, j(NOT_ZERO, no_update, Assembler::kNearJump); } - void Assembler::StoreIntoObject(Register object, const Address& dest, Register value, @@ -2965,7 +2678,6 @@ void Assembler::StoreIntoObject(Register object, Bind(&done); } - void Assembler::StoreIntoObjectNoBarrier(Register object, const Address& dest, Register value) { @@ -2981,7 +2693,6 @@ void Assembler::StoreIntoObjectNoBarrier(Register object, // No store buffer update. } - void Assembler::StoreIntoObjectNoBarrier(Register object, const Address& dest, const Object& value) { @@ -2990,7 +2701,6 @@ void Assembler::StoreIntoObjectNoBarrier(Register object, StoreObject(dest, value); } - void Assembler::StoreIntoSmiField(const Address& dest, Register value) { #if defined(DEBUG) Label done; @@ -3002,13 +2712,11 @@ void Assembler::StoreIntoSmiField(const Address& dest, Register value) { movq(dest, value); } - void Assembler::ZeroInitSmiField(const Address& dest) { Immediate zero(Smi::RawValue(0)); movq(dest, zero); } - void Assembler::IncrementSmiField(const Address& dest, int64_t increment) { // Note: FlowGraphCompiler::EdgeCounterIncrementSizeInBytes depends on // the length of this instruction sequence. @@ -3016,21 +2724,18 @@ void Assembler::IncrementSmiField(const Address& dest, int64_t increment) { addq(dest, inc_imm); } - void Assembler::DoubleNegate(XmmRegister d) { // {0x8000000000000000LL, 0x8000000000000000LL} movq(TMP, Address(THR, Thread::double_negate_address_offset())); xorpd(d, Address(TMP, 0)); } - void Assembler::DoubleAbs(XmmRegister reg) { // {0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFFLL} movq(TMP, Address(THR, Thread::double_abs_address_offset())); andpd(reg, Address(TMP, 0)); } - void Assembler::Stop(const char* message, bool fixed_length_encoding) { int64_t message_address = reinterpret_cast(message); if (FLAG_print_stop_message) { @@ -3057,7 +2762,6 @@ void Assembler::Stop(const char* message, bool fixed_length_encoding) { int3(); // Execution can be resumed with the 'cont' command in gdb. } - void Assembler::Bind(Label* label) { intptr_t bound = buffer_.Size(); ASSERT(!label->IsBound()); // Labels can only be bound once. @@ -3076,7 +2780,6 @@ void Assembler::Bind(Label* label) { label->BindTo(bound); } - void Assembler::EnterFrame(intptr_t frame_size) { if (prologue_offset_ == -1) { prologue_offset_ = CodeSize(); @@ -3097,13 +2800,11 @@ void Assembler::EnterFrame(intptr_t frame_size) { } } - void Assembler::LeaveFrame() { movq(RSP, RBP); popq(RBP); } - void Assembler::ReserveAlignedFrameSpace(intptr_t frame_space) { // Reserve space for arguments and align frame before entering // the C++ world. @@ -3115,7 +2816,6 @@ void Assembler::ReserveAlignedFrameSpace(intptr_t frame_space) { } } - void Assembler::PushRegisters(intptr_t cpu_register_set, intptr_t xmm_register_set) { const intptr_t xmm_regs_count = RegisterSet::RegisterCount(xmm_register_set); @@ -3144,7 +2844,6 @@ void Assembler::PushRegisters(intptr_t cpu_register_set, } } - void Assembler::PopRegisters(intptr_t cpu_register_set, intptr_t xmm_register_set) { for (intptr_t i = 0; i < kNumberOfCpuRegisters; ++i) { @@ -3170,7 +2869,6 @@ void Assembler::PopRegisters(intptr_t cpu_register_set, } } - void Assembler::EnterCallRuntimeFrame(intptr_t frame_space) { Comment("EnterCallRuntimeFrame"); EnterStubFrame(); @@ -3182,7 +2880,6 @@ void Assembler::EnterCallRuntimeFrame(intptr_t frame_space) { ReserveAlignedFrameSpace(frame_space); } - void Assembler::LeaveCallRuntimeFrame() { // RSP might have been modified to reserve space for arguments // and ensure proper alignment of the stack frame. @@ -3204,7 +2901,6 @@ void Assembler::LeaveCallRuntimeFrame() { LeaveStubFrame(); } - void Assembler::CallCFunction(Register reg) { // Reserve shadow space for outgoing arguments. if (CallingConventions::kShadowSpaceBytes != 0) { @@ -3213,18 +2909,15 @@ void Assembler::CallCFunction(Register reg) { call(reg); } - void Assembler::CallRuntime(const RuntimeEntry& entry, intptr_t argument_count) { entry.Call(this, argument_count); } - void Assembler::RestoreCodePointer() { movq(CODE_REG, Address(RBP, kPcMarkerSlotFromFp * kWordSize)); } - void Assembler::LoadPoolPointer(Register pp) { // Load new pool pointer. CheckCodePointer(); @@ -3232,7 +2925,6 @@ void Assembler::LoadPoolPointer(Register pp) { set_constant_pool_allowed(pp == PP); } - void Assembler::EnterDartFrame(intptr_t frame_size, Register new_pp) { ASSERT(!constant_pool_allowed()); EnterFrame(0); @@ -3249,7 +2941,6 @@ void Assembler::EnterDartFrame(intptr_t frame_size, Register new_pp) { } } - void Assembler::LeaveDartFrame(RestorePP restore_pp) { // Restore caller's PP register that was pushed in EnterDartFrame. if (restore_pp == kRestoreCallerPP) { @@ -3259,7 +2950,6 @@ void Assembler::LeaveDartFrame(RestorePP restore_pp) { LeaveFrame(); } - void Assembler::CheckCodePointer() { #ifdef DEBUG if (!FLAG_check_code_pointer) { @@ -3290,7 +2980,6 @@ void Assembler::CheckCodePointer() { #endif } - // On entry to a function compiled for OSR, the caller's frame pointer, the // stack locals, and any copied parameters are already in place. The frame // pointer is already set up. The PC marker is not correct for the @@ -3310,17 +2999,14 @@ void Assembler::EnterOsrFrame(intptr_t extra_size) { } } - void Assembler::EnterStubFrame() { EnterDartFrame(0, kNoRegister); } - void Assembler::LeaveStubFrame() { LeaveDartFrame(); } - // RDI receiver, RBX guarded cid as Smi void Assembler::MonomorphicCheckedEntry() { ASSERT(has_single_entry_point_); @@ -3350,7 +3036,6 @@ void Assembler::MonomorphicCheckedEntry() { ASSERT((CodeSize() & kSmiTagMask) == kSmiTag); } - #ifndef PRODUCT void Assembler::MaybeTraceAllocation(intptr_t cid, Label* trace, @@ -3369,7 +3054,6 @@ void Assembler::MaybeTraceAllocation(intptr_t cid, j(NOT_ZERO, trace, near_jump); } - void Assembler::UpdateAllocationStats(intptr_t cid, Heap::Space space) { ASSERT(cid > 0); intptr_t counter_offset = @@ -3382,7 +3066,6 @@ void Assembler::UpdateAllocationStats(intptr_t cid, Heap::Space space) { incq(Address(temp_reg, counter_offset)); } - void Assembler::UpdateAllocationStatsWithSize(intptr_t cid, Register size_reg, Heap::Space space) { @@ -3394,7 +3077,6 @@ void Assembler::UpdateAllocationStatsWithSize(intptr_t cid, addq(Address(temp_reg, size_offset), size_reg); } - void Assembler::UpdateAllocationStatsWithSize(intptr_t cid, intptr_t size_in_bytes, Heap::Space space) { @@ -3407,7 +3089,6 @@ void Assembler::UpdateAllocationStatsWithSize(intptr_t cid, } #endif // !PRODUCT - void Assembler::TryAllocate(const Class& cls, Label* failure, bool near_jump, @@ -3446,7 +3127,6 @@ void Assembler::TryAllocate(const Class& cls, } } - void Assembler::TryAllocateArray(intptr_t cid, intptr_t instance_size, Label* failure, @@ -3511,7 +3191,6 @@ void Assembler::Align(int alignment, intptr_t offset) { ASSERT(((offset + buffer_.GetPosition()) & (alignment - 1)) == 0); } - void Assembler::EmitOperand(int rm, const Operand& operand) { ASSERT(rm >= 0 && rm < 8); const intptr_t length = operand.length_; @@ -3525,14 +3204,12 @@ void Assembler::EmitOperand(int rm, const Operand& operand) { } } - void Assembler::EmitXmmRegisterOperand(int rm, XmmRegister xmm_reg) { Operand operand; operand.SetModRM(3, static_cast(xmm_reg)); EmitOperand(rm, operand); } - void Assembler::EmitImmediate(const Immediate& imm) { if (imm.is_int32()) { EmitInt32(static_cast(imm.value())); @@ -3541,7 +3218,6 @@ void Assembler::EmitImmediate(const Immediate& imm) { } } - void Assembler::EmitComplex(int rm, const Operand& operand, const Immediate& immediate) { @@ -3563,7 +3239,6 @@ void Assembler::EmitComplex(int rm, } } - void Assembler::EmitLabel(Label* label, intptr_t instruction_size) { if (label->IsBound()) { intptr_t offset = label->Position() - buffer_.Size(); @@ -3574,7 +3249,6 @@ void Assembler::EmitLabel(Label* label, intptr_t instruction_size) { } } - void Assembler::EmitLabelLink(Label* label) { ASSERT(!label->IsBound()); intptr_t position = buffer_.Size(); @@ -3582,7 +3256,6 @@ void Assembler::EmitLabelLink(Label* label) { label->LinkTo(position); } - void Assembler::EmitNearLabelLink(Label* label) { ASSERT(!label->IsBound()); intptr_t position = buffer_.Size(); @@ -3590,7 +3263,6 @@ void Assembler::EmitNearLabelLink(Label* label) { label->NearLinkTo(position); } - void Assembler::EmitGenericShift(bool wide, int rm, Register reg, @@ -3612,7 +3284,6 @@ void Assembler::EmitGenericShift(bool wide, } } - void Assembler::EmitGenericShift(bool wide, int rm, Register operand, @@ -3628,7 +3299,6 @@ void Assembler::EmitGenericShift(bool wide, EmitOperand(rm, Operand(operand)); } - void Assembler::LoadClassId(Register result, Register object) { ASSERT(RawObject::kClassIdTagPos == 16); ASSERT(RawObject::kClassIdTagSize == 16); @@ -3638,7 +3308,6 @@ void Assembler::LoadClassId(Register result, Register object) { movzxw(result, FieldAddress(object, class_id_offset)); } - void Assembler::LoadClassById(Register result, Register class_id) { ASSERT(result != class_id); LoadIsolate(result); @@ -3648,19 +3317,16 @@ void Assembler::LoadClassById(Register result, Register class_id) { movq(result, Address(result, class_id, TIMES_8, 0)); } - void Assembler::LoadClass(Register result, Register object) { LoadClassId(TMP, object); LoadClassById(result, TMP); } - void Assembler::CompareClassId(Register object, intptr_t class_id) { LoadClassId(TMP, object); cmpl(TMP, Immediate(class_id)); } - void Assembler::SmiUntagOrCheckClass(Register object, intptr_t class_id, Label* is_smi) { @@ -3680,7 +3346,6 @@ void Assembler::SmiUntagOrCheckClass(Register object, cmpl(TMP, Immediate(class_id)); } - void Assembler::LoadClassIdMayBeSmi(Register result, Register object) { Label smi; @@ -3706,7 +3371,6 @@ void Assembler::LoadClassIdMayBeSmi(Register result, Register object) { } } - void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { Label smi; @@ -3734,7 +3398,6 @@ void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { } } - Address Assembler::ElementAddressForIntIndex(bool is_external, intptr_t cid, intptr_t index_scale, @@ -3750,7 +3413,6 @@ Address Assembler::ElementAddressForIntIndex(bool is_external, } } - static ScaleFactor ToScaleFactor(intptr_t index_scale) { // Note that index is expected smi-tagged, (i.e, times 2) for all arrays with // index scale factor > 1. E.g., for Uint8Array and OneByteString the index is @@ -3773,7 +3435,6 @@ static ScaleFactor ToScaleFactor(intptr_t index_scale) { } } - Address Assembler::ElementAddressForRegIndex(bool is_external, intptr_t cid, intptr_t index_scale, @@ -3787,23 +3448,19 @@ Address Assembler::ElementAddressForRegIndex(bool is_external, } } - static const char* cpu_reg_names[kNumberOfCpuRegisters] = { "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi", "r8", "r9", "r10", "r11", "r12", "r13", "thr", "pp"}; - const char* Assembler::RegisterName(Register reg) { ASSERT((0 <= reg) && (reg < kNumberOfCpuRegisters)); return cpu_reg_names[reg]; } - static const char* xmm_reg_names[kNumberOfXmmRegisters] = { "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7", "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15"}; - const char* Assembler::FpuRegisterName(FpuRegister reg) { ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); return xmm_reg_names[reg]; diff --git a/runtime/vm/assembler_x64.h b/runtime/vm/assembler_x64.h index ad19e6dc699..01ce51aa152 100644 --- a/runtime/vm/assembler_x64.h +++ b/runtime/vm/assembler_x64.h @@ -42,7 +42,6 @@ class Immediate : public ValueObject { // And remove the unnecessary copy constructor. }; - class Operand : public ValueObject { public: uint8_t rex() const { return rex_; } @@ -158,7 +157,6 @@ class Operand : public ValueObject { friend class Assembler; }; - class Address : public Operand { public: Address(Register base, int32_t disp) { @@ -252,7 +250,6 @@ class Address : public Operand { } }; - class FieldAddress : public Address { public: FieldAddress(Register base, int32_t disp) @@ -275,7 +272,6 @@ class FieldAddress : public Address { } }; - class Label : public ValueObject { public: Label() : position_(0), unresolved_(0) { @@ -344,7 +340,6 @@ class Label : public ValueObject { DISALLOW_COPY_AND_ASSIGN(Label); }; - class Assembler : public ValueObject { public: explicit Assembler(bool use_far_branches = false); @@ -1078,29 +1073,24 @@ class Assembler : public ValueObject { DISALLOW_COPY_AND_ASSIGN(Assembler); }; - inline void Assembler::EmitUint8(uint8_t value) { buffer_.Emit(value); } - inline void Assembler::EmitInt32(int32_t value) { buffer_.Emit(value); } - inline void Assembler::EmitInt64(int64_t value) { buffer_.Emit(value); } - inline void Assembler::EmitRegisterREX(Register reg, uint8_t rex) { ASSERT(reg != kNoRegister); rex |= (reg > 7 ? REX_B : REX_NONE); if (rex != REX_NONE) EmitUint8(REX_PREFIX | rex); } - inline void Assembler::EmitOperandREX(int rm, const Operand& operand, uint8_t rex) { @@ -1108,7 +1098,6 @@ inline void Assembler::EmitOperandREX(int rm, if (rex != REX_NONE) EmitUint8(REX_PREFIX | rex); } - inline void Assembler::EmitREX_RB(XmmRegister reg, XmmRegister base, uint8_t rex) { @@ -1117,7 +1106,6 @@ inline void Assembler::EmitREX_RB(XmmRegister reg, if (rex != REX_NONE) EmitUint8(REX_PREFIX | rex); } - inline void Assembler::EmitREX_RB(XmmRegister reg, const Operand& operand, uint8_t rex) { @@ -1126,26 +1114,22 @@ inline void Assembler::EmitREX_RB(XmmRegister reg, if (rex != REX_NONE) EmitUint8(REX_PREFIX | rex); } - inline void Assembler::EmitREX_RB(XmmRegister reg, Register base, uint8_t rex) { if (reg > 7) rex |= REX_R; if (base > 7) rex |= REX_B; if (rex != REX_NONE) EmitUint8(REX_PREFIX | rex); } - inline void Assembler::EmitREX_RB(Register reg, XmmRegister base, uint8_t rex) { if (reg > 7) rex |= REX_R; if (base > 7) rex |= REX_B; if (rex != REX_NONE) EmitUint8(REX_PREFIX | rex); } - inline void Assembler::EmitFixup(AssemblerFixup* fixup) { buffer_.EmitFixup(fixup); } - inline void Assembler::EmitOperandSizeOverride() { EmitUint8(0x66); } diff --git a/runtime/vm/assembler_x64_test.cc b/runtime/vm/assembler_x64_test.cc index 8c04d7d4f9a..0058cbfadc1 100644 --- a/runtime/vm/assembler_x64_test.cc +++ b/runtime/vm/assembler_x64_test.cc @@ -14,7 +14,6 @@ namespace dart { #define __ assembler-> - ASSEMBLER_TEST_GENERATE(ReadArgument, assembler) { __ pushq(CallingConventions::kArg1Reg); __ movq(RAX, Address(RSP, 0)); @@ -22,7 +21,6 @@ ASSEMBLER_TEST_GENERATE(ReadArgument, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(ReadArgument, test) { typedef int64_t (*ReadArgumentCode)(int64_t n); ReadArgumentCode id = reinterpret_cast(test->entry()); @@ -32,7 +30,6 @@ ASSEMBLER_TEST_RUN(ReadArgument, test) { EXPECT_EQ(kLargeConstant, id(kLargeConstant)); } - ASSEMBLER_TEST_GENERATE(AddressingModes, assembler) { __ movq(RAX, Address(RSP, 0)); __ movq(RAX, Address(RBP, 0)); @@ -224,12 +221,10 @@ ASSEMBLER_TEST_GENERATE(AddressingModes, assembler) { __ movq(RAX, Address::AddressBaseImm32(R13, -kWordSize)); } - ASSEMBLER_TEST_RUN(AddressingModes, test) { // Avoid running the code since it is constructed to lead to crashes. } - ASSEMBLER_TEST_GENERATE(JumpAroundCrash, assembler) { Label done; // Make sure all the condition jumps work. @@ -249,7 +244,6 @@ ASSEMBLER_TEST_GENERATE(JumpAroundCrash, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(JumpAroundCrash, test) { Instr* instr = Instr::At(test->entry()); EXPECT(!instr->IsBreakPoint()); @@ -257,7 +251,6 @@ ASSEMBLER_TEST_RUN(JumpAroundCrash, test) { reinterpret_cast(test->entry())(); } - ASSEMBLER_TEST_GENERATE(SimpleLoop, assembler) { __ movq(RAX, Immediate(0)); __ movq(RCX, Immediate(0)); @@ -270,13 +263,11 @@ ASSEMBLER_TEST_GENERATE(SimpleLoop, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SimpleLoop, test) { typedef int (*SimpleLoopCode)(); EXPECT_EQ(2 * 87, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(Cmpb, assembler) { Label done; __ movq(RAX, Immediate(1)); @@ -289,13 +280,11 @@ ASSEMBLER_TEST_GENERATE(Cmpb, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Cmpb, test) { typedef int (*CmpbCode)(); EXPECT_EQ(1, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(Testb, assembler) { Label done; __ movq(RAX, Immediate(1)); @@ -313,13 +302,11 @@ ASSEMBLER_TEST_GENERATE(Testb, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Testb, test) { typedef int (*TestbCode)(); EXPECT_EQ(1, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(Increment, assembler) { __ movq(RAX, Immediate(0)); __ pushq(RAX); @@ -332,13 +319,11 @@ ASSEMBLER_TEST_GENERATE(Increment, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Increment, test) { typedef int (*IncrementCode)(); EXPECT_EQ(3, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(IncrementLong, assembler) { __ movq(RAX, Immediate(0xffffffff)); __ pushq(RAX); @@ -350,13 +335,11 @@ ASSEMBLER_TEST_GENERATE(IncrementLong, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(IncrementLong, test) { typedef int64_t (*IncrementCodeLong)(); EXPECT_EQ(0x100000001, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(Decrement, assembler) { __ movq(RAX, Immediate(3)); __ pushq(RAX); @@ -369,13 +352,11 @@ ASSEMBLER_TEST_GENERATE(Decrement, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Decrement, test) { typedef int (*DecrementCode)(); EXPECT_EQ(0, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(DecrementLong, assembler) { __ movq(RAX, Immediate(0x100000001)); __ pushq(RAX); @@ -387,13 +368,11 @@ ASSEMBLER_TEST_GENERATE(DecrementLong, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(DecrementLong, test) { typedef int64_t (*DecrementCodeLong)(); EXPECT_EQ(0xffffffff, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(SignedMultiply, assembler) { __ movl(RAX, Immediate(2)); __ movl(RCX, Immediate(4)); @@ -402,13 +381,11 @@ ASSEMBLER_TEST_GENERATE(SignedMultiply, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SignedMultiply, test) { typedef int (*SignedMultiply)(); EXPECT_EQ(8000, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(UnsignedMultiply, assembler) { __ movl(RAX, Immediate(-1)); // RAX = 0xFFFFFFFF __ movl(RCX, Immediate(16)); // RCX = 0x10 @@ -417,13 +394,11 @@ ASSEMBLER_TEST_GENERATE(UnsignedMultiply, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(UnsignedMultiply, test) { typedef int (*UnsignedMultiply)(); EXPECT_EQ(15, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(SignedMultiply64, assembler) { __ pushq(R15); // Callee saved. __ movq(RAX, Immediate(2)); @@ -449,18 +424,15 @@ ASSEMBLER_TEST_GENERATE(SignedMultiply64, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SignedMultiply64, test) { typedef int64_t (*SignedMultiply64)(); EXPECT_EQ(32, reinterpret_cast(test->entry())()); } - static const int64_t kLargeConstant = 0x1234567887654321; static const int64_t kAnotherLargeConstant = 987654321987654321LL; static const int64_t kProductLargeConstants = 0x5bbb29a7f52fbbd1; - ASSEMBLER_TEST_GENERATE(SignedMultiplyLong, assembler) { Label done; __ movq(RAX, Immediate(kLargeConstant)); @@ -474,14 +446,12 @@ ASSEMBLER_TEST_GENERATE(SignedMultiplyLong, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SignedMultiplyLong, test) { typedef int64_t (*SignedMultiplyLong)(); EXPECT_EQ(kProductLargeConstants, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(OverflowSignedMultiply, assembler) { __ movl(RDX, Immediate(0)); __ movl(RAX, Immediate(0x0fffffff)); @@ -491,13 +461,11 @@ ASSEMBLER_TEST_GENERATE(OverflowSignedMultiply, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(OverflowSignedMultiply, test) { typedef int (*OverflowSignedMultiply)(); EXPECT_EQ(0, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(SignedMultiply1, assembler) { __ movl(RDX, Immediate(2)); __ movl(RCX, Immediate(4)); @@ -507,13 +475,11 @@ ASSEMBLER_TEST_GENERATE(SignedMultiply1, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SignedMultiply1, test) { typedef int (*SignedMultiply1)(); EXPECT_EQ(8000, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(SignedMultiply2, assembler) { __ pushq(R15); // Callee saved. __ movl(R15, Immediate(2)); @@ -523,13 +489,11 @@ ASSEMBLER_TEST_GENERATE(SignedMultiply2, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SignedMultiply2, test) { typedef int (*SignedMultiply2)(); EXPECT_EQ(2000, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(UnsignedMultiplyLong, assembler) { __ movq(RAX, Immediate(-1)); // RAX = 0xFFFFFFFFFFFFFFFF __ movq(RCX, Immediate(16)); // RCX = 0x10 @@ -538,13 +502,11 @@ ASSEMBLER_TEST_GENERATE(UnsignedMultiplyLong, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(UnsignedMultiplyLong, test) { typedef int64_t (*UnsignedMultiplyLong)(); EXPECT_EQ(15, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(SignedDivide, assembler) { __ movl(RAX, Immediate(-87)); __ movl(RDX, Immediate(123)); @@ -554,13 +516,11 @@ ASSEMBLER_TEST_GENERATE(SignedDivide, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SignedDivide, test) { typedef int32_t (*SignedDivide)(); EXPECT_EQ(-87 / 42, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(UnsignedDivide, assembler) { const int32_t low = 0; const int32_t high = 0xf0000000; @@ -573,13 +533,11 @@ ASSEMBLER_TEST_GENERATE(UnsignedDivide, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(UnsignedDivide, test) { typedef uint32_t (*UnsignedDivide)(); EXPECT_EQ(0xf0000000, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(SignedDivideLong, assembler) { __ movq(RAX, Immediate(kLargeConstant)); __ movq(RDX, Immediate(123)); @@ -589,14 +547,12 @@ ASSEMBLER_TEST_GENERATE(SignedDivideLong, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SignedDivideLong, test) { typedef int64_t (*SignedDivideLong)(); EXPECT_EQ(kLargeConstant / 42, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(UnsignedDivideLong, assembler) { const int64_t low = 0; const int64_t high = 0xf000000000000000; @@ -610,14 +566,12 @@ ASSEMBLER_TEST_GENERATE(UnsignedDivideLong, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(UnsignedDivideLong, test) { typedef uint64_t (*UnsignedDivideLong)(); EXPECT_EQ(0xf000000000000000, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(Negate, assembler) { __ movq(RCX, Immediate(42)); __ negq(RCX); @@ -625,13 +579,11 @@ ASSEMBLER_TEST_GENERATE(Negate, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Negate, test) { typedef int (*Negate)(); EXPECT_EQ(-42, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(BitScanReverse, assembler) { __ pushq(CallingConventions::kArg1Reg); __ movq(RCX, Address(RSP, 0)); @@ -641,7 +593,6 @@ ASSEMBLER_TEST_GENERATE(BitScanReverse, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(BitScanReverse, test) { typedef int (*Bsr)(int input); Bsr call = reinterpret_cast(test->entry()); @@ -654,7 +605,6 @@ ASSEMBLER_TEST_RUN(BitScanReverse, test) { EXPECT_EQ(31, call(-1)); } - ASSEMBLER_TEST_GENERATE(MoveExtend, assembler) { __ movq(RDX, Immediate(0xffff)); __ movzxb(RAX, RDX); // RAX = 0xff @@ -665,13 +615,11 @@ ASSEMBLER_TEST_GENERATE(MoveExtend, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(MoveExtend, test) { typedef int (*MoveExtend)(); EXPECT_EQ(0xff - 1 + 0xffff, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(MoveExtend32, assembler) { __ movq(RDX, Immediate(0xffffffff)); __ movsxd(RDX, RDX); @@ -681,13 +629,11 @@ ASSEMBLER_TEST_GENERATE(MoveExtend32, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(MoveExtend32, test) { typedef intptr_t (*MoveExtend)(); EXPECT_EQ(0x7ffffffe, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(MoveExtendMemory, assembler) { __ movq(RDX, Immediate(0x123456781234ffff)); @@ -702,14 +648,12 @@ ASSEMBLER_TEST_GENERATE(MoveExtendMemory, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(MoveExtendMemory, test) { typedef int (*MoveExtendMemory)(); EXPECT_EQ(0xff - 1 + 0xffff, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(MoveExtend32Memory, assembler) { __ pushq(Immediate(0xffffffff)); __ pushq(Immediate(0x7fffffff)); @@ -721,13 +665,11 @@ ASSEMBLER_TEST_GENERATE(MoveExtend32Memory, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(MoveExtend32Memory, test) { typedef intptr_t (*MoveExtend)(); EXPECT_EQ(0x7ffffffe, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(MoveWord, assembler) { __ xorq(RAX, RAX); __ pushq(Immediate(0)); @@ -739,13 +681,11 @@ ASSEMBLER_TEST_GENERATE(MoveWord, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(MoveWord, test) { typedef int (*MoveWord)(); EXPECT_EQ(0xffff, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(MoveWordRex, assembler) { __ pushq(Immediate(0)); __ movq(R8, RSP); @@ -758,13 +698,11 @@ ASSEMBLER_TEST_GENERATE(MoveWordRex, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(MoveWordRex, test) { typedef int (*MoveWordRex)(); EXPECT_EQ(0xffff, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(LongAddReg, assembler) { __ pushq(CallingConventions::kArg2Reg); __ pushq(CallingConventions::kArg1Reg); @@ -782,7 +720,6 @@ ASSEMBLER_TEST_GENERATE(LongAddReg, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LongAddReg, test) { typedef int64_t (*LongAddRegCode)(int64_t a, int64_t b); int64_t a = 12; @@ -795,7 +732,6 @@ ASSEMBLER_TEST_RUN(LongAddReg, test) { EXPECT_EQ((a + b), res); } - ASSEMBLER_TEST_GENERATE(LongAddImmediate, assembler) { __ pushq(CallingConventions::kArg1Reg); __ movl(RAX, Address(RSP, 0)); // left low. @@ -809,7 +745,6 @@ ASSEMBLER_TEST_GENERATE(LongAddImmediate, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LongAddImmediate, test) { typedef int64_t (*LongAddImmediateCode)(int64_t a); int64_t a = (13LL << 32) + 14; @@ -821,7 +756,6 @@ ASSEMBLER_TEST_RUN(LongAddImmediate, test) { EXPECT_EQ((a + b), res); } - ASSEMBLER_TEST_GENERATE(LongAddAddress, assembler) { __ pushq(CallingConventions::kArg2Reg); __ pushq(CallingConventions::kArg1Reg); @@ -837,7 +771,6 @@ ASSEMBLER_TEST_GENERATE(LongAddAddress, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LongAddAddress, test) { typedef int64_t (*LongAddAddressCode)(int64_t a, int64_t b); int64_t a = 12; @@ -850,7 +783,6 @@ ASSEMBLER_TEST_RUN(LongAddAddress, test) { EXPECT_EQ((a + b), res); } - ASSEMBLER_TEST_GENERATE(LongSubReg, assembler) { __ pushq(CallingConventions::kArg2Reg); __ pushq(CallingConventions::kArg1Reg); @@ -868,7 +800,6 @@ ASSEMBLER_TEST_GENERATE(LongSubReg, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LongSubReg, test) { typedef int64_t (*LongSubRegCode)(int64_t a, int64_t b); int64_t a = 12; @@ -881,7 +812,6 @@ ASSEMBLER_TEST_RUN(LongSubReg, test) { EXPECT_EQ((a - b), res); } - ASSEMBLER_TEST_GENERATE(LongSubImmediate, assembler) { __ pushq(CallingConventions::kArg1Reg); __ movl(RAX, Address(RSP, 0)); // left low. @@ -895,7 +825,6 @@ ASSEMBLER_TEST_GENERATE(LongSubImmediate, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LongSubImmediate, test) { typedef int64_t (*LongSubImmediateCode)(int64_t a); int64_t a = (13LL << 32) + 14; @@ -907,7 +836,6 @@ ASSEMBLER_TEST_RUN(LongSubImmediate, test) { EXPECT_EQ((a - b), res); } - ASSEMBLER_TEST_GENERATE(LongSubAddress, assembler) { __ pushq(CallingConventions::kArg2Reg); __ pushq(CallingConventions::kArg1Reg); @@ -923,7 +851,6 @@ ASSEMBLER_TEST_GENERATE(LongSubAddress, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LongSubAddress, test) { typedef int64_t (*LongSubAddressCode)(int64_t a, int64_t b); int64_t a = 12; @@ -936,7 +863,6 @@ ASSEMBLER_TEST_RUN(LongSubAddress, test) { EXPECT_EQ((a - b), res); } - ASSEMBLER_TEST_GENERATE(AddReg, assembler) { __ movq(R10, CallingConventions::kArg1Reg); // al. __ addq(R10, CallingConventions::kArg3Reg); // bl. @@ -946,7 +872,6 @@ ASSEMBLER_TEST_GENERATE(AddReg, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(AddReg, test) { typedef int64_t (*AddRegCode)(int64_t al, int64_t ah, int64_t bl, int64_t bh); int64_t al = 11; @@ -960,7 +885,6 @@ ASSEMBLER_TEST_RUN(AddReg, test) { EXPECT_EQ((ah + bh + 1), res); } - ASSEMBLER_TEST_GENERATE(AddImmediate, assembler) { __ movq(R10, CallingConventions::kArg1Reg); // al. __ addq(R10, Immediate(13)); // bl. @@ -970,7 +894,6 @@ ASSEMBLER_TEST_GENERATE(AddImmediate, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(AddImmediate, test) { typedef int64_t (*AddImmediateCode)(int64_t al, int64_t ah); int64_t al = 11; @@ -983,7 +906,6 @@ ASSEMBLER_TEST_RUN(AddImmediate, test) { EXPECT_EQ((ah + bh + 1), res); } - ASSEMBLER_TEST_GENERATE(AddAddress, assembler) { __ pushq(CallingConventions::kArg4Reg); __ pushq(CallingConventions::kArg3Reg); @@ -998,7 +920,6 @@ ASSEMBLER_TEST_GENERATE(AddAddress, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(AddAddress, test) { typedef int64_t (*AddCode)(int64_t al, int64_t ah, int64_t bl, int64_t bh); int64_t al = 11; @@ -1012,7 +933,6 @@ ASSEMBLER_TEST_RUN(AddAddress, test) { EXPECT_EQ((ah + bh + 1), res); } - ASSEMBLER_TEST_GENERATE(SubReg, assembler) { __ movq(R10, CallingConventions::kArg1Reg); // al. __ subq(R10, CallingConventions::kArg3Reg); // bl. @@ -1022,7 +942,6 @@ ASSEMBLER_TEST_GENERATE(SubReg, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SubReg, test) { typedef int64_t (*SubRegCode)(int64_t al, int64_t ah, int64_t bl, int64_t bh); int64_t al = 14; @@ -1036,7 +955,6 @@ ASSEMBLER_TEST_RUN(SubReg, test) { EXPECT_EQ((ah - bh - 1), res); } - ASSEMBLER_TEST_GENERATE(SubImmediate, assembler) { __ movq(R10, CallingConventions::kArg1Reg); // al. __ subq(R10, Immediate(12)); // bl. @@ -1046,7 +964,6 @@ ASSEMBLER_TEST_GENERATE(SubImmediate, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SubImmediate, test) { typedef int64_t (*SubImmediateCode)(int64_t al, int64_t ah); int64_t al = 14; @@ -1059,7 +976,6 @@ ASSEMBLER_TEST_RUN(SubImmediate, test) { EXPECT_EQ((ah - bh - 1), res); } - ASSEMBLER_TEST_GENERATE(SubAddress, assembler) { __ pushq(CallingConventions::kArg4Reg); __ pushq(CallingConventions::kArg3Reg); @@ -1074,7 +990,6 @@ ASSEMBLER_TEST_GENERATE(SubAddress, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SubAddress, test) { typedef int64_t (*SubCode)(int64_t al, int64_t ah, int64_t bl, int64_t bh); int64_t al = 14; @@ -1088,7 +1003,6 @@ ASSEMBLER_TEST_RUN(SubAddress, test) { EXPECT_EQ((ah - bh - 1), res); } - ASSEMBLER_TEST_GENERATE(Bitwise, assembler) { __ movq(R10, Immediate(-1)); __ orl(Address(CallingConventions::kArg1Reg, 0), R10); @@ -1106,7 +1020,6 @@ ASSEMBLER_TEST_GENERATE(Bitwise, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Bitwise, test) { uint64_t f1 = 0; uint64_t f2 = 0; @@ -1117,7 +1030,6 @@ ASSEMBLER_TEST_RUN(Bitwise, test) { EXPECT_EQ(kMaxUint32, f2); } - ASSEMBLER_TEST_GENERATE(Bitwise64, assembler) { Label error; __ movq(RAX, Immediate(42)); @@ -1155,13 +1067,11 @@ ASSEMBLER_TEST_GENERATE(Bitwise64, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Bitwise64, test) { typedef int (*Bitwise64)(); EXPECT_EQ(256 + 1, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(LogicalOps, assembler) { Label donetest1; __ movl(RAX, Immediate(4)); @@ -1428,13 +1338,11 @@ ASSEMBLER_TEST_GENERATE(LogicalOps, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LogicalOps, test) { typedef int (*LogicalOpsCode)(); EXPECT_EQ(0, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(LogicalOps64, assembler) { Label donetest1; __ movq(RAX, Immediate(4)); @@ -1618,13 +1526,11 @@ ASSEMBLER_TEST_GENERATE(LogicalOps64, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LogicalOps64, test) { typedef int (*LogicalOpsCode)(); EXPECT_EQ(0, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(LogicalTestL, assembler) { Label donetest1; __ movl(RAX, Immediate(4)); @@ -1668,13 +1574,11 @@ ASSEMBLER_TEST_GENERATE(LogicalTestL, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LogicalTestL, test) { typedef int (*LogicalTestCode)(); EXPECT_EQ(0, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(LogicalTestQ, assembler) { Label donetest1; __ movq(RAX, Immediate(4)); @@ -1736,13 +1640,11 @@ ASSEMBLER_TEST_GENERATE(LogicalTestQ, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(LogicalTestQ, test) { typedef int (*LogicalTestCode)(); EXPECT_EQ(0, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(CompareSwapEQ, assembler) { __ movq(RAX, Immediate(0)); __ pushq(RAX); @@ -1754,13 +1656,11 @@ ASSEMBLER_TEST_GENERATE(CompareSwapEQ, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(CompareSwapEQ, test) { typedef int (*CompareSwapEQCode)(); EXPECT_EQ(0, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(CompareSwapNEQ, assembler) { __ movq(RAX, Immediate(0)); __ pushq(RAX); @@ -1772,13 +1672,11 @@ ASSEMBLER_TEST_GENERATE(CompareSwapNEQ, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(CompareSwapNEQ, test) { typedef int (*CompareSwapNEQCode)(); EXPECT_EQ(4, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(CompareSwapEQ32, assembler) { __ movq(RAX, Immediate(0x100000000)); __ pushq(RAX); @@ -1793,14 +1691,12 @@ ASSEMBLER_TEST_GENERATE(CompareSwapEQ32, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(CompareSwapEQ32, test) { typedef intptr_t (*CompareSwapEQ32Code)(); EXPECT_EQ(0x100000000, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(CompareSwapNEQ32, assembler) { __ movq(RAX, Immediate(0x100000000)); __ pushq(RAX); @@ -1812,14 +1708,12 @@ ASSEMBLER_TEST_GENERATE(CompareSwapNEQ32, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(CompareSwapNEQ32, test) { typedef intptr_t (*CompareSwapNEQ32Code)(); EXPECT_EQ(0x100000004l, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(Exchange, assembler) { __ movq(RAX, Immediate(kLargeConstant)); __ movq(RDX, Immediate(kAnotherLargeConstant)); @@ -1828,27 +1722,23 @@ ASSEMBLER_TEST_GENERATE(Exchange, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Exchange, test) { typedef int64_t (*Exchange)(); EXPECT_EQ(kAnotherLargeConstant - kLargeConstant, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(LargeConstant, assembler) { __ movq(RAX, Immediate(kLargeConstant)); __ ret(); } - ASSEMBLER_TEST_RUN(LargeConstant, test) { typedef int64_t (*LargeConstantCode)(); EXPECT_EQ(kLargeConstant, reinterpret_cast(test->entry())()); } - static int ComputeStackSpaceReservation(int needed, int fixed) { return (OS::ActivationFrameAlignment() > 1) ? Utils::RoundUp(needed + fixed, OS::ActivationFrameAlignment()) - @@ -1856,17 +1746,14 @@ static int ComputeStackSpaceReservation(int needed, int fixed) { : needed; } - static int LeafReturn42() { return 42; } - static int LeafReturnArgument(int x) { return x + 87; } - ASSEMBLER_TEST_GENERATE(CallSimpleLeaf, assembler) { ExternalLabel call1(reinterpret_cast(LeafReturn42)); ExternalLabel call2(reinterpret_cast(LeafReturnArgument)); @@ -1882,13 +1769,11 @@ ASSEMBLER_TEST_GENERATE(CallSimpleLeaf, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(CallSimpleLeaf, test) { typedef int (*CallSimpleLeafCode)(); EXPECT_EQ(42 + 87, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(JumpSimpleLeaf, assembler) { ExternalLabel call1(reinterpret_cast(LeafReturn42)); Label L; @@ -1901,27 +1786,23 @@ ASSEMBLER_TEST_GENERATE(JumpSimpleLeaf, assembler) { __ jmp(&call1); } - ASSEMBLER_TEST_RUN(JumpSimpleLeaf, test) { typedef int (*JumpSimpleLeafCode)(); EXPECT_EQ(42, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(JumpIndirect, assembler) { ExternalLabel call1(reinterpret_cast(LeafReturn42)); __ movq(Address(CallingConventions::kArg1Reg, 0), Immediate(call1.address())); __ jmp(Address(CallingConventions::kArg1Reg, 0)); } - ASSEMBLER_TEST_RUN(JumpIndirect, test) { uword temp = 0; typedef int (*JumpIndirect)(uword*); EXPECT_EQ(42, reinterpret_cast(test->entry())(&temp)); } - ASSEMBLER_TEST_GENERATE(SingleFPMoves, assembler) { __ movq(RAX, Immediate(bit_cast(234.0f))); __ movd(XMM0, RAX); @@ -1976,13 +1857,11 @@ ASSEMBLER_TEST_GENERATE(SingleFPMoves, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SingleFPMoves, test) { typedef float (*SingleFPMovesCode)(); EXPECT_EQ(234, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(SingleFPMoves2, assembler) { __ movq(RAX, Immediate(bit_cast(234.0f))); __ movd(XMM0, RAX); @@ -2002,13 +1881,11 @@ ASSEMBLER_TEST_GENERATE(SingleFPMoves2, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SingleFPMoves2, test) { typedef float (*SingleFPMoves2Code)(); EXPECT_EQ(234, reinterpret_cast(test->entry())()); } - ASSEMBLER_TEST_GENERATE(PackedDoubleAdd, assembler) { static const struct ALIGN16 { double a; @@ -2027,14 +1904,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleAdd, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedDoubleAdd, test) { typedef double (*PackedDoubleAdd)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(4.0, res, 0.000001f); } - ASSEMBLER_TEST_GENERATE(PackedDoubleSub, assembler) { static const struct ALIGN16 { double a; @@ -2053,14 +1928,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleSub, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedDoubleSub, test) { typedef double (*PackedDoubleSub)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(-2.0, res, 0.000001f); } - static void EnterTestFrame(Assembler* assembler) { COMPILE_ASSERT(THR != CallingConventions::kArg1Reg); COMPILE_ASSERT(CODE_REG != CallingConventions::kArg2Reg); @@ -2074,7 +1947,6 @@ static void EnterTestFrame(Assembler* assembler) { __ LoadPoolPointer(PP); } - static void LeaveTestFrame(Assembler* assembler) { __ popq(THR); __ popq(PP); @@ -2082,7 +1954,6 @@ static void LeaveTestFrame(Assembler* assembler) { __ LeaveFrame(); } - ASSEMBLER_TEST_GENERATE(PackedDoubleNegate, assembler) { static const struct ALIGN16 { double a; @@ -2097,13 +1968,11 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleNegate, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedDoubleNegate, test) { double res = test->InvokeWithCodeAndThread(); EXPECT_FLOAT_EQ(-1.0, res, 0.000001f); } - ASSEMBLER_TEST_GENERATE(PackedDoubleAbsolute, assembler) { static const struct ALIGN16 { double a; @@ -2118,13 +1987,11 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleAbsolute, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedDoubleAbsolute, test) { double res = test->InvokeWithCodeAndThread(); EXPECT_FLOAT_EQ(1.0, res, 0.000001f); } - ASSEMBLER_TEST_GENERATE(PackedDoubleMul, assembler) { static const struct ALIGN16 { double a; @@ -2143,14 +2010,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleMul, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedDoubleMul, test) { typedef double (*PackedDoubleMul)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(9.0, res, 0.000001f); } - ASSEMBLER_TEST_GENERATE(PackedDoubleDiv, assembler) { static const struct ALIGN16 { double a; @@ -2169,14 +2034,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleDiv, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedDoubleDiv, test) { typedef double (*PackedDoubleDiv)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(3.0, res, 0.000001f); } - ASSEMBLER_TEST_GENERATE(PackedDoubleSqrt, assembler) { static const struct ALIGN16 { double a; @@ -2189,14 +2052,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleSqrt, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedDoubleSqrt, test) { typedef double (*PackedDoubleSqrt)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(4.0, res, 0.000001f); } - ASSEMBLER_TEST_GENERATE(PackedDoubleMin, assembler) { static const struct ALIGN16 { double a; @@ -2215,14 +2076,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleMin, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedDoubleMin, test) { typedef double (*PackedDoubleMin)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(3.0, res, 0.000001f); } - ASSEMBLER_TEST_GENERATE(PackedDoubleMax, assembler) { static const struct ALIGN16 { double a; @@ -2241,14 +2100,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleMax, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedDoubleMax, test) { typedef double (*PackedDoubleMax)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(9.0, res, 0.000001f); } - ASSEMBLER_TEST_GENERATE(PackedDoubleShuffle, assembler) { static const struct ALIGN16 { double a; @@ -2265,14 +2122,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleShuffle, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedDoubleShuffle, test) { typedef double (*PackedDoubleShuffle)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(9.0, res, 0.000001f); } - ASSEMBLER_TEST_GENERATE(PackedDoubleToSingle, assembler) { static const struct ALIGN16 { double a; @@ -2285,14 +2140,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleToSingle, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedDoubleToSingle, test) { typedef float (*PackedDoubleToSingle)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(9.0f, res, 0.000001f); } - ASSEMBLER_TEST_GENERATE(PackedSingleToDouble, assembler) { static const struct ALIGN16 { float a; @@ -2307,14 +2160,12 @@ ASSEMBLER_TEST_GENERATE(PackedSingleToDouble, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedSingleToDouble, test) { typedef double (*PackedSingleToDouble)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(9.0f, res, 0.000001f); } - ASSEMBLER_TEST_GENERATE(SingleFPOperations, assembler) { __ pushq(RBX); __ pushq(RCX); @@ -2338,7 +2189,6 @@ ASSEMBLER_TEST_GENERATE(SingleFPOperations, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(SingleFPOperations, test) { typedef float (*SingleFPOperationsCode)(); float res = reinterpret_cast(test->entry())(); @@ -2361,14 +2211,12 @@ ASSEMBLER_TEST_GENERATE(PackedFPOperations, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedFPOperations, test) { typedef float (*PackedFPOperationsCode)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(14.7f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedIntOperations, assembler) { __ movl(RAX, Immediate(0x2)); __ movd(XMM0, RAX); @@ -2385,14 +2233,12 @@ ASSEMBLER_TEST_GENERATE(PackedIntOperations, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedIntOperations, test) { typedef uint32_t (*PackedIntOperationsCode)(); uint32_t res = reinterpret_cast(test->entry())(); EXPECT_EQ(static_cast(0x5), res); } - ASSEMBLER_TEST_GENERATE(PackedIntOperations2, assembler) { // Note: on Windows 64 XMM6-XMM15 are callee save. const intptr_t cpu_register_set = 0; @@ -2415,14 +2261,12 @@ ASSEMBLER_TEST_GENERATE(PackedIntOperations2, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedIntOperations2, test) { typedef uint32_t (*PackedIntOperationsCode)(); uint32_t res = reinterpret_cast(test->entry())(); EXPECT_EQ(static_cast(0x5), res); } - ASSEMBLER_TEST_GENERATE(PackedFPOperations2, assembler) { __ movq(RAX, Immediate(bit_cast(4.0f))); __ movd(XMM0, RAX); @@ -2437,14 +2281,12 @@ ASSEMBLER_TEST_GENERATE(PackedFPOperations2, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedFPOperations2, test) { typedef float (*PackedFPOperations2Code)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(0.0f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedCompareEQ, assembler) { __ set1ps(XMM0, RAX, Immediate(bit_cast(2.0f))); __ set1ps(XMM1, RAX, Immediate(bit_cast(4.0f))); @@ -2455,14 +2297,12 @@ ASSEMBLER_TEST_GENERATE(PackedCompareEQ, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedCompareEQ, test) { typedef uint32_t (*PackedCompareEQCode)(); uint32_t res = reinterpret_cast(test->entry())(); EXPECT_EQ(static_cast(0x0), res); } - ASSEMBLER_TEST_GENERATE(PackedCompareNEQ, assembler) { __ set1ps(XMM0, RAX, Immediate(bit_cast(2.0f))); __ set1ps(XMM1, RAX, Immediate(bit_cast(4.0f))); @@ -2473,14 +2313,12 @@ ASSEMBLER_TEST_GENERATE(PackedCompareNEQ, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedCompareNEQ, test) { typedef uint32_t (*PackedCompareNEQCode)(); uint32_t res = reinterpret_cast(test->entry())(); EXPECT_EQ(static_cast(0xFFFFFFFF), res); } - ASSEMBLER_TEST_GENERATE(PackedCompareLT, assembler) { __ set1ps(XMM0, RAX, Immediate(bit_cast(2.0f))); __ set1ps(XMM1, RAX, Immediate(bit_cast(4.0f))); @@ -2491,14 +2329,12 @@ ASSEMBLER_TEST_GENERATE(PackedCompareLT, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedCompareLT, test) { typedef uint32_t (*PackedCompareLTCode)(); uint32_t res = reinterpret_cast(test->entry())(); EXPECT_EQ(static_cast(0xFFFFFFFF), res); } - ASSEMBLER_TEST_GENERATE(PackedCompareLE, assembler) { __ set1ps(XMM0, RAX, Immediate(bit_cast(2.0f))); __ set1ps(XMM1, RAX, Immediate(bit_cast(4.0f))); @@ -2509,14 +2345,12 @@ ASSEMBLER_TEST_GENERATE(PackedCompareLE, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedCompareLE, test) { typedef uint32_t (*PackedCompareLECode)(); uint32_t res = reinterpret_cast(test->entry())(); EXPECT_EQ(static_cast(0xFFFFFFFF), res); } - ASSEMBLER_TEST_GENERATE(PackedCompareNLT, assembler) { __ set1ps(XMM0, RAX, Immediate(bit_cast(2.0f))); __ set1ps(XMM1, RAX, Immediate(bit_cast(4.0f))); @@ -2527,14 +2361,12 @@ ASSEMBLER_TEST_GENERATE(PackedCompareNLT, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedCompareNLT, test) { typedef uint32_t (*PackedCompareNLTCode)(); uint32_t res = reinterpret_cast(test->entry())(); EXPECT_EQ(static_cast(0x0), res); } - ASSEMBLER_TEST_GENERATE(PackedCompareNLE, assembler) { __ set1ps(XMM0, RAX, Immediate(bit_cast(2.0f))); __ set1ps(XMM1, RAX, Immediate(bit_cast(4.0f))); @@ -2545,14 +2377,12 @@ ASSEMBLER_TEST_GENERATE(PackedCompareNLE, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedCompareNLE, test) { typedef uint32_t (*PackedCompareNLECode)(); uint32_t res = reinterpret_cast(test->entry())(); EXPECT_EQ(static_cast(0x0), res); } - ASSEMBLER_TEST_GENERATE(PackedNegate, assembler) { EnterTestFrame(assembler); __ movl(RAX, Immediate(bit_cast(12.3f))); @@ -2564,13 +2394,11 @@ ASSEMBLER_TEST_GENERATE(PackedNegate, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedNegate, test) { float res = test->InvokeWithCodeAndThread(); EXPECT_FLOAT_EQ(-12.3f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedAbsolute, assembler) { EnterTestFrame(assembler); __ movl(RAX, Immediate(bit_cast(-15.3f))); @@ -2582,13 +2410,11 @@ ASSEMBLER_TEST_GENERATE(PackedAbsolute, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedAbsolute, test) { float res = test->InvokeWithCodeAndThread(); EXPECT_FLOAT_EQ(15.3f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedSetWZero, assembler) { EnterTestFrame(assembler); __ set1ps(XMM0, RAX, Immediate(bit_cast(12.3f))); @@ -2598,13 +2424,11 @@ ASSEMBLER_TEST_GENERATE(PackedSetWZero, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedSetWZero, test) { float res = test->InvokeWithCodeAndThread(); EXPECT_FLOAT_EQ(0.0f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedMin, assembler) { __ set1ps(XMM0, RAX, Immediate(bit_cast(2.0f))); __ set1ps(XMM1, RAX, Immediate(bit_cast(4.0f))); @@ -2612,14 +2436,12 @@ ASSEMBLER_TEST_GENERATE(PackedMin, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedMin, test) { typedef float (*PackedMinCode)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(2.0f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedMax, assembler) { __ set1ps(XMM0, RAX, Immediate(bit_cast(2.0f))); __ set1ps(XMM1, RAX, Immediate(bit_cast(4.0f))); @@ -2627,14 +2449,12 @@ ASSEMBLER_TEST_GENERATE(PackedMax, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedMax, test) { typedef float (*PackedMaxCode)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(4.0f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedLogicalOr, assembler) { static const struct ALIGN16 { uint32_t a; @@ -2659,14 +2479,12 @@ ASSEMBLER_TEST_GENERATE(PackedLogicalOr, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedLogicalOr, test) { typedef uint32_t (*PackedLogicalOrCode)(); uint32_t res = reinterpret_cast(test->entry())(); EXPECT_EQ(0xFFFFFFFF, res); } - ASSEMBLER_TEST_GENERATE(PackedLogicalAnd, assembler) { static const struct ALIGN16 { uint32_t a; @@ -2690,14 +2508,12 @@ ASSEMBLER_TEST_GENERATE(PackedLogicalAnd, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedLogicalAnd, test) { typedef uint32_t (*PackedLogicalAndCode)(); uint32_t res = reinterpret_cast(test->entry())(); EXPECT_EQ(static_cast(0x0000F000), res); } - ASSEMBLER_TEST_GENERATE(PackedLogicalNot, assembler) { static const struct ALIGN16 { uint32_t a; @@ -2717,13 +2533,11 @@ ASSEMBLER_TEST_GENERATE(PackedLogicalNot, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedLogicalNot, test) { uint32_t res = test->InvokeWithCodeAndThread(); EXPECT_EQ(static_cast(0x0), res); } - ASSEMBLER_TEST_GENERATE(PackedMoveHighLow, assembler) { static const struct ALIGN16 { float a; @@ -2755,14 +2569,12 @@ ASSEMBLER_TEST_GENERATE(PackedMoveHighLow, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedMoveHighLow, test) { typedef float (*PackedMoveHighLow)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(15.0f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedMoveLowHigh, assembler) { static const struct ALIGN16 { float a; @@ -2794,14 +2606,12 @@ ASSEMBLER_TEST_GENERATE(PackedMoveLowHigh, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedMoveLowHigh, test) { typedef float (*PackedMoveLowHigh)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(11.0f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedUnpackLow, assembler) { static const struct ALIGN16 { float a; @@ -2832,14 +2642,12 @@ ASSEMBLER_TEST_GENERATE(PackedUnpackLow, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedUnpackLow, test) { typedef float (*PackedUnpackLow)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(11.0f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedUnpackHigh, assembler) { static const struct ALIGN16 { float a; @@ -2870,14 +2678,12 @@ ASSEMBLER_TEST_GENERATE(PackedUnpackHigh, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedUnpackHigh, test) { typedef float (*PackedUnpackHigh)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(7.0f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedUnpackLowPair, assembler) { static const struct ALIGN16 { float a; @@ -2908,14 +2714,12 @@ ASSEMBLER_TEST_GENERATE(PackedUnpackLowPair, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedUnpackLowPair, test) { typedef float (*PackedUnpackLowPair)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(6.0f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(PackedUnpackHighPair, assembler) { static const struct ALIGN16 { float a; @@ -2946,14 +2750,12 @@ ASSEMBLER_TEST_GENERATE(PackedUnpackHighPair, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(PackedUnpackHighPair, test) { typedef float (*PackedUnpackHighPair)(); float res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(12.0f, res, 0.001f); } - ASSEMBLER_TEST_GENERATE(DoubleFPMoves, assembler) { __ movq(RAX, Immediate(bit_cast(1024.67))); __ pushq(R15); // Callee saved. @@ -3008,14 +2810,12 @@ ASSEMBLER_TEST_GENERATE(DoubleFPMoves, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(DoubleFPMoves, test) { typedef double (*DoubleFPMovesCode)(); EXPECT_FLOAT_EQ(1024.67, reinterpret_cast(test->entry())(), 0.001); } - ASSEMBLER_TEST_GENERATE(DoubleFPOperations, assembler) { __ movq(RAX, Immediate(bit_cast(12.3))); __ pushq(RAX); @@ -3040,14 +2840,12 @@ ASSEMBLER_TEST_GENERATE(DoubleFPOperations, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(DoubleFPOperations, test) { typedef double (*SingleFPOperationsCode)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(7.668, res, 0.001); } - ASSEMBLER_TEST_GENERATE(Int32ToDoubleConversion, assembler) { // Fill upper bits with garbage. __ movq(R11, Immediate(0x1111111100000006)); @@ -3059,14 +2857,12 @@ ASSEMBLER_TEST_GENERATE(Int32ToDoubleConversion, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Int32ToDoubleConversion, test) { typedef double (*Int32ToDoubleConversion)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(-2.0, res, 0.001); } - ASSEMBLER_TEST_GENERATE(Int64ToDoubleConversion, assembler) { __ movq(RDX, Immediate(12LL << 32)); __ cvtsi2sdq(XMM0, RDX); @@ -3076,14 +2872,12 @@ ASSEMBLER_TEST_GENERATE(Int64ToDoubleConversion, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Int64ToDoubleConversion, test) { typedef double (*Int64ToDoubleConversionCode)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(static_cast(12LL << 32), res, 0.001); } - ASSEMBLER_TEST_GENERATE(DoubleToInt64Conversion, assembler) { __ movq(RAX, Immediate(bit_cast(12.3))); __ pushq(RAX); @@ -3099,14 +2893,12 @@ ASSEMBLER_TEST_GENERATE(DoubleToInt64Conversion, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(DoubleToInt64Conversion, test) { typedef int64_t (*DoubleToInt64ConversionCode)(); int64_t res = reinterpret_cast(test->entry())(); EXPECT_EQ(0, res); } - ASSEMBLER_TEST_GENERATE(TestObjectCompare, assembler) { ObjectStore* object_store = Isolate::Current()->object_store(); const Object& obj = Object::ZoneHandle(object_store->smi_class()); @@ -3141,13 +2933,11 @@ ASSEMBLER_TEST_GENERATE(TestObjectCompare, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(TestObjectCompare, test) { bool res = test->InvokeWithCodeAndThread(); EXPECT_EQ(true, res); } - ASSEMBLER_TEST_GENERATE(TestNop, assembler) { __ nop(1); __ nop(2); @@ -3161,28 +2951,24 @@ ASSEMBLER_TEST_GENERATE(TestNop, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(TestNop, test) { typedef int (*TestNop)(); int res = reinterpret_cast(test->payload_start())(); EXPECT_EQ(36, res); // 36 nop bytes emitted. } - ASSEMBLER_TEST_GENERATE(TestAlign0, assembler) { __ Align(4, 0); __ movq(RAX, Immediate(assembler->CodeSize())); // Return code size. __ ret(); } - ASSEMBLER_TEST_RUN(TestAlign0, test) { typedef int (*TestAlign0)(); int res = reinterpret_cast(test->payload_start())(); EXPECT_EQ(0, res); // 0 bytes emitted. } - ASSEMBLER_TEST_GENERATE(TestAlign1, assembler) { __ nop(1); __ Align(4, 0); @@ -3190,14 +2976,12 @@ ASSEMBLER_TEST_GENERATE(TestAlign1, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(TestAlign1, test) { typedef int (*TestAlign1)(); int res = reinterpret_cast(test->payload_start())(); EXPECT_EQ(4, res); // 4 bytes emitted. } - ASSEMBLER_TEST_GENERATE(TestAlign1Offset1, assembler) { __ nop(1); __ Align(4, 1); @@ -3205,14 +2989,12 @@ ASSEMBLER_TEST_GENERATE(TestAlign1Offset1, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(TestAlign1Offset1, test) { typedef int (*TestAlign1Offset1)(); int res = reinterpret_cast(test->payload_start())(); EXPECT_EQ(3, res); // 3 bytes emitted. } - ASSEMBLER_TEST_GENERATE(TestAlignLarge, assembler) { __ nop(1); __ Align(16, 0); @@ -3220,14 +3002,12 @@ ASSEMBLER_TEST_GENERATE(TestAlignLarge, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(TestAlignLarge, test) { typedef int (*TestAlignLarge)(); int res = reinterpret_cast(test->payload_start())(); EXPECT_EQ(16, res); // 16 bytes emitted. } - ASSEMBLER_TEST_GENERATE(TestAdds, assembler) { __ movq(RAX, Immediate(4)); __ pushq(RAX); @@ -3245,42 +3025,36 @@ ASSEMBLER_TEST_GENERATE(TestAdds, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(TestAdds, test) { typedef int (*TestAdds)(); int res = reinterpret_cast(test->entry())(); EXPECT_EQ(20, res); } - ASSEMBLER_TEST_GENERATE(TestNot, assembler) { __ movq(RAX, Immediate(0xFFFFFFFF00000000)); __ notq(RAX); __ ret(); } - ASSEMBLER_TEST_RUN(TestNot, test) { typedef int (*TestNot)(); unsigned int res = reinterpret_cast(test->entry())(); EXPECT_EQ(0xFFFFFFFF, res); } - ASSEMBLER_TEST_GENERATE(TestNotInt32, assembler) { __ movq(RAX, Immediate(0x0)); __ notl(RAX); __ ret(); } - ASSEMBLER_TEST_RUN(TestNotInt32, test) { typedef int (*TestNot)(); unsigned int res = reinterpret_cast(test->entry())(); EXPECT_EQ(0xFFFFFFFF, res); } - ASSEMBLER_TEST_GENERATE(XorpdZeroing, assembler) { __ pushq(RAX); __ movsd(Address(RSP, 0), XMM0); @@ -3289,14 +3063,12 @@ ASSEMBLER_TEST_GENERATE(XorpdZeroing, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(XorpdZeroing, test) { typedef double (*XorpdZeroingCode)(double d); double res = reinterpret_cast(test->entry())(12.56e3); EXPECT_FLOAT_EQ(0.0, res, 0.0001); } - ASSEMBLER_TEST_GENERATE(XorpdZeroing2, assembler) { Label done; __ xorpd(XMM15, XMM15); @@ -3309,33 +3081,28 @@ ASSEMBLER_TEST_GENERATE(XorpdZeroing2, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(XorpdZeroing2, test) { typedef double (*XorpdZeroing2Code)(double d); double res = reinterpret_cast(test->entry())(12.56e3); EXPECT_FLOAT_EQ(0.0, res, 0.0001); } - ASSEMBLER_TEST_GENERATE(Pxor, assembler) { __ pxor(XMM0, XMM0); __ ret(); } - ASSEMBLER_TEST_RUN(Pxor, test) { typedef double (*PxorCode)(double d); double res = reinterpret_cast(test->entry())(12.3456e3); EXPECT_FLOAT_EQ(0.0, res, 0.0); } - ASSEMBLER_TEST_GENERATE(SquareRootDouble, assembler) { __ sqrtsd(XMM0, XMM0); __ ret(); } - ASSEMBLER_TEST_RUN(SquareRootDouble, test) { typedef double (*SquareRootDoubleCode)(double d); const double kDoubleConst = .7; @@ -3344,7 +3111,6 @@ ASSEMBLER_TEST_RUN(SquareRootDouble, test) { EXPECT_FLOAT_EQ(sqrt(kDoubleConst), res, 0.0001); } - // Called from assembler_test.cc. ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { __ pushq(CODE_REG); @@ -3359,7 +3125,6 @@ ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { __ ret(); } - ASSEMBLER_TEST_GENERATE(DoubleFPUStackMoves, assembler) { int64_t l = bit_cast(1024.67); __ movq(RAX, Immediate(l)); @@ -3371,14 +3136,12 @@ ASSEMBLER_TEST_GENERATE(DoubleFPUStackMoves, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(DoubleFPUStackMoves, test) { typedef int64_t (*DoubleFPUStackMovesCode)(); int64_t res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(1024.67, (bit_cast(res)), 0.001); } - ASSEMBLER_TEST_GENERATE(Sine, assembler) { __ pushq(RAX); __ movsd(Address(RSP, 0), XMM0); @@ -3390,7 +3153,6 @@ ASSEMBLER_TEST_GENERATE(Sine, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Sine, test) { typedef double (*SineCode)(double d); const double kDoubleConst = 0.7; @@ -3398,7 +3160,6 @@ ASSEMBLER_TEST_RUN(Sine, test) { EXPECT_FLOAT_EQ(sin(kDoubleConst), res, 0.0001); } - ASSEMBLER_TEST_GENERATE(Cosine, assembler) { __ pushq(RAX); __ movsd(Address(RSP, 0), XMM0); @@ -3410,7 +3171,6 @@ ASSEMBLER_TEST_GENERATE(Cosine, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Cosine, test) { typedef double (*CosineCode)(double f); const double kDoubleConst = 0.7; @@ -3418,27 +3178,23 @@ ASSEMBLER_TEST_RUN(Cosine, test) { EXPECT_FLOAT_EQ(cos(kDoubleConst), res, 0.0001); } - ASSEMBLER_TEST_GENERATE(IntToDoubleConversion, assembler) { __ movq(RDX, Immediate(6)); __ cvtsi2sdq(XMM0, RDX); __ ret(); } - ASSEMBLER_TEST_RUN(IntToDoubleConversion, test) { typedef double (*IntToDoubleConversionCode)(); double res = reinterpret_cast(test->entry())(); EXPECT_FLOAT_EQ(6.0, res, 0.001); } - ASSEMBLER_TEST_GENERATE(DoubleToDoubleTrunc, assembler) { __ roundsd(XMM0, XMM0, Assembler::kRoundToZero); __ ret(); } - ASSEMBLER_TEST_RUN(DoubleToDoubleTrunc, test) { typedef double (*DoubleToDoubleTruncCode)(double d); double res = reinterpret_cast(test->entry())(12.3); @@ -3451,7 +3207,6 @@ ASSEMBLER_TEST_RUN(DoubleToDoubleTrunc, test) { EXPECT_EQ(-12.0, res); } - ASSEMBLER_TEST_GENERATE(DoubleAbs, assembler) { EnterTestFrame(assembler); #if defined(HOST_OS_WINDOWS) @@ -3468,7 +3223,6 @@ ASSEMBLER_TEST_GENERATE(DoubleAbs, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(DoubleAbs, test) { double val = -12.45; double res = test->InvokeWithCodeAndThread(val); @@ -3478,14 +3232,12 @@ ASSEMBLER_TEST_RUN(DoubleAbs, test) { EXPECT_FLOAT_EQ(val, res, 0.001); } - ASSEMBLER_TEST_GENERATE(ExtractSignBits, assembler) { __ movmskpd(RAX, XMM0); __ andq(RAX, Immediate(0x1)); __ ret(); } - ASSEMBLER_TEST_RUN(ExtractSignBits, test) { typedef int (*ExtractSignBits)(double d); int res = reinterpret_cast(test->entry())(1.0); @@ -3496,7 +3248,6 @@ ASSEMBLER_TEST_RUN(ExtractSignBits, test) { EXPECT_EQ(1, res); } - ASSEMBLER_TEST_GENERATE(TestSetCC, assembler) { __ movq(RAX, Immediate(0xFFFFFFFF)); __ cmpq(RAX, RAX); @@ -3504,14 +3255,12 @@ ASSEMBLER_TEST_GENERATE(TestSetCC, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(TestSetCC, test) { typedef uword (*TestSetCC)(); uword res = reinterpret_cast(test->entry())(); EXPECT_EQ(0xFFFFFF00, res); } - ASSEMBLER_TEST_GENERATE(TestRepMovsBytes, assembler) { __ pushq(RSI); __ pushq(RDI); @@ -3531,7 +3280,6 @@ ASSEMBLER_TEST_GENERATE(TestRepMovsBytes, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(TestRepMovsBytes, test) { const char* from = "0123456789"; const char* to = new char[10]; @@ -3544,7 +3292,6 @@ ASSEMBLER_TEST_RUN(TestRepMovsBytes, test) { delete[] to; } - ASSEMBLER_TEST_GENERATE(ConditionalMovesCompare, assembler) { __ cmpq(CallingConventions::kArg1Reg, CallingConventions::kArg2Reg); __ movq(RDX, Immediate(1)); // Greater equal. @@ -3554,7 +3301,6 @@ ASSEMBLER_TEST_GENERATE(ConditionalMovesCompare, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(ConditionalMovesCompare, test) { typedef int (*ConditionalMovesCompareCode)(int i, int j); int res = reinterpret_cast(test->entry())(10, 5); @@ -3565,7 +3311,6 @@ ASSEMBLER_TEST_RUN(ConditionalMovesCompare, test) { EXPECT_EQ(-1, res); // Less. } - ASSEMBLER_TEST_GENERATE(BitTest, assembler) { __ movq(RAX, Immediate(4)); __ movq(R11, Immediate(2)); @@ -3578,13 +3323,11 @@ ASSEMBLER_TEST_GENERATE(BitTest, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(BitTest, test) { typedef int (*BitTest)(); EXPECT_EQ(1, reinterpret_cast(test->entry())()); } - // Return 1 if equal, 0 if not equal. ASSEMBLER_TEST_GENERATE(ConditionalMovesEqual, assembler) { __ movq(RDX, CallingConventions::kArg1Reg); @@ -3595,7 +3338,6 @@ ASSEMBLER_TEST_GENERATE(ConditionalMovesEqual, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(ConditionalMovesEqual, test) { typedef int (*ConditionalMovesEqualCode)(int i); int res = reinterpret_cast(test->entry())(785); @@ -3604,7 +3346,6 @@ ASSEMBLER_TEST_RUN(ConditionalMovesEqual, test) { EXPECT_EQ(0, res); } - // Return 1 if overflow, 0 if no overflow. ASSEMBLER_TEST_GENERATE(ConditionalMovesNoOverflow, assembler) { __ movq(RDX, CallingConventions::kArg1Reg); @@ -3615,7 +3356,6 @@ ASSEMBLER_TEST_GENERATE(ConditionalMovesNoOverflow, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(ConditionalMovesNoOverflow, test) { typedef int (*ConditionalMovesNoOverflowCode)(int64_t i, int64_t j); int res = reinterpret_cast(test->entry())( diff --git a/runtime/vm/assert_test.cc b/runtime/vm/assert_test.cc index d74b940edb2..45c24c8d65b 100644 --- a/runtime/vm/assert_test.cc +++ b/runtime/vm/assert_test.cc @@ -5,14 +5,12 @@ #include "platform/assert.h" #include "vm/unit_test.h" - VM_UNIT_TEST_CASE(Assert) { ASSERT(true); ASSERT(87 == 87); ASSERT(42 != 87); } - VM_UNIT_TEST_CASE(Expect) { EXPECT(true); EXPECT(87 == 87); @@ -47,17 +45,14 @@ VM_UNIT_TEST_CASE(Expect) { EXPECT_FLOAT_EQ(1.43, 1.43, 0.00); } - VM_UNIT_TEST_CASE(Fail0) { FAIL("This test fails"); } - VM_UNIT_TEST_CASE(Fail1) { FAIL1("This test fails with one argument: %d", 4); } - VM_UNIT_TEST_CASE(Fail2) { FAIL2("This test fails with two arguments: %d, %d", -100, 42); } diff --git a/runtime/vm/ast.cc b/runtime/vm/ast.cc index 69fb0d39ef3..f97964be069 100644 --- a/runtime/vm/ast.cc +++ b/runtime/vm/ast.cc @@ -10,7 +10,6 @@ #include "vm/object_store.h" #include "vm/resolver.h" - namespace dart { #define DEFINE_VISIT_FUNCTION(BaseName) \ @@ -21,14 +20,12 @@ namespace dart { FOR_EACH_NODE(DEFINE_VISIT_FUNCTION) #undef DEFINE_VISIT_FUNCTION - #define DEFINE_NAME_FUNCTION(BaseName) \ const char* BaseName##Node::Name() const { return #BaseName; } FOR_EACH_NODE(DEFINE_NAME_FUNCTION) #undef DEFINE_NAME_FUNCTION - const Field* AstNode::MayCloneField(const Field& value) { if (Compiler::IsBackgroundCompilation() || FLAG_force_clone_compiler_objects) { @@ -39,7 +36,6 @@ const Field* AstNode::MayCloneField(const Field& value) { } } - // A visitor class to collect all the nodes (including children) into an // array. class AstNodeCollector : public AstNodeVisitor { @@ -60,20 +56,17 @@ class AstNodeCollector : public AstNodeVisitor { DISALLOW_COPY_AND_ASSIGN(AstNodeCollector); }; - void SequenceNode::CollectAllNodes(GrowableArray* nodes) { AstNodeCollector node_collector(nodes); this->Visit(&node_collector); } - void SequenceNode::VisitChildren(AstNodeVisitor* visitor) const { for (intptr_t i = 0; i < this->length(); i++) { NodeAt(i)->Visit(visitor); } } - void SequenceNode::Add(AstNode* node) { if (node->IsReturnNode()) { node->AsReturnNode()->set_scope(scope()); @@ -81,21 +74,17 @@ void SequenceNode::Add(AstNode* node) { nodes_.Add(node); } - void PrimaryNode::VisitChildren(AstNodeVisitor* visitor) const {} - void ArgumentListNode::VisitChildren(AstNodeVisitor* visitor) const { for (intptr_t i = 0; i < this->length(); i++) { NodeAt(i)->Visit(visitor); } } - LetNode::LetNode(TokenPosition token_pos) : AstNode(token_pos), vars_(1), initializers_(1), nodes_(1) {} - LocalVariable* LetNode::AddInitializer(AstNode* node) { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -111,7 +100,6 @@ LocalVariable* LetNode::AddInitializer(AstNode* node) { return temp_var; } - void LetNode::VisitChildren(AstNodeVisitor* visitor) const { for (intptr_t i = 0; i < num_temps(); ++i) { initializers_[i]->Visit(visitor); @@ -151,14 +139,12 @@ const Instance* LetNode::EvalConstExpr() const { return last; } - void ArrayNode::VisitChildren(AstNodeVisitor* visitor) const { for (intptr_t i = 0; i < this->length(); i++) { ElementAt(i)->Visit(visitor); } } - bool StringInterpolateNode::IsPotentiallyConst() const { for (int i = 0; i < value_->length(); i++) { if (!value_->ElementAt(i)->IsPotentiallyConst()) { @@ -168,12 +154,10 @@ bool StringInterpolateNode::IsPotentiallyConst() const { return true; } - bool LiteralNode::IsPotentiallyConst() const { return true; } - AstNode* LiteralNode::ApplyUnaryOp(Token::Kind unary_op_kind) { if (unary_op_kind == Token::kNEGATE) { if (literal().IsSmi()) { @@ -218,24 +202,20 @@ AstNode* LiteralNode::ApplyUnaryOp(Token::Kind unary_op_kind) { return NULL; } - const char* TypeNode::TypeName() const { return String::Handle(type().UserVisibleName()).ToCString(); } - bool ComparisonNode::IsKindValid() const { return Token::IsRelationalOperator(kind_) || Token::IsEqualityOperator(kind_) || Token::IsTypeTestOperator(kind_) || Token::IsTypeCastOperator(kind_); } - const char* ComparisonNode::TokenName() const { return (kind_ == Token::kAS) ? "as" : Token::Str(kind_); } - bool ComparisonNode::IsPotentiallyConst() const { switch (kind_) { case Token::kLT: @@ -253,7 +233,6 @@ bool ComparisonNode::IsPotentiallyConst() const { } } - const Instance* ComparisonNode::EvalConstExpr() const { const Instance* left_val = this->left()->EvalConstExpr(); if (left_val == NULL) { @@ -295,7 +274,6 @@ const Instance* ComparisonNode::EvalConstExpr() const { return NULL; } - bool BinaryOpNode::IsKindValid() const { switch (kind_) { case Token::kADD: @@ -318,12 +296,10 @@ bool BinaryOpNode::IsKindValid() const { } } - const char* BinaryOpNode::TokenName() const { return Token::Str(kind_); } - bool BinaryOpNode::IsPotentiallyConst() const { switch (kind_) { case Token::kOR: @@ -357,7 +333,6 @@ bool BinaryOpNode::IsPotentiallyConst() const { } } - const Instance* BinaryOpNode::EvalConstExpr() const { const Instance* left_val = this->left()->EvalConstExpr(); if (left_val == NULL) { @@ -419,7 +394,6 @@ const Instance* BinaryOpNode::EvalConstExpr() const { return NULL; } - AstNode* UnaryOpNode::UnaryOpOrLiteral(TokenPosition token_pos, Token::Kind kind, AstNode* operand) { @@ -430,7 +404,6 @@ AstNode* UnaryOpNode::UnaryOpOrLiteral(TokenPosition token_pos, return new UnaryOpNode(token_pos, kind, operand); } - bool UnaryOpNode::IsKindValid() const { switch (kind_) { case Token::kNEGATE: @@ -442,7 +415,6 @@ bool UnaryOpNode::IsKindValid() const { } } - bool UnaryOpNode::IsPotentiallyConst() const { if (this->operand()->IsLiteralNode() && this->operand()->AsLiteralNode()->literal().IsNull()) { @@ -451,7 +423,6 @@ bool UnaryOpNode::IsPotentiallyConst() const { return this->operand()->IsPotentiallyConst(); } - const Instance* UnaryOpNode::EvalConstExpr() const { const Instance* val = this->operand()->EvalConstExpr(); if (val == NULL) { @@ -469,14 +440,12 @@ const Instance* UnaryOpNode::EvalConstExpr() const { } } - bool ConditionalExprNode::IsPotentiallyConst() const { return this->condition()->IsPotentiallyConst() && this->true_expr()->IsPotentiallyConst() && this->false_expr()->IsPotentiallyConst(); } - const Instance* ConditionalExprNode::EvalConstExpr() const { const Instance* cond = this->condition()->EvalConstExpr(); if ((cond != NULL) && cond->IsBool() && @@ -487,7 +456,6 @@ const Instance* ConditionalExprNode::EvalConstExpr() const { return NULL; } - bool ClosureNode::IsPotentiallyConst() const { if (function().IsImplicitStaticClosureFunction()) { return true; @@ -495,7 +463,6 @@ bool ClosureNode::IsPotentiallyConst() const { return false; } - const Instance* ClosureNode::EvalConstExpr() const { if (!is_deferred_reference_ && function().IsImplicitStaticClosureFunction()) { // Return a value that represents an instance. Only the type is relevant. @@ -504,7 +471,6 @@ const Instance* ClosureNode::EvalConstExpr() const { return NULL; } - AstNode* ClosureNode::MakeAssignmentNode(AstNode* rhs) { if (scope() == NULL) { // This is an implicit closure node created because a static getter was not @@ -517,17 +483,14 @@ AstNode* ClosureNode::MakeAssignmentNode(AstNode* rhs) { return NULL; } - const char* UnaryOpNode::TokenName() const { return Token::Str(kind_); } - const char* JumpNode::TokenName() const { return Token::Str(kind_); } - bool LoadLocalNode::IsPotentiallyConst() const { // Parameters of const constructors are implicitly final and can be // used in initializer expressions. @@ -537,7 +500,6 @@ bool LoadLocalNode::IsPotentiallyConst() const { return local().is_final(); } - const Instance* LoadLocalNode::EvalConstExpr() const { if (local().IsConst()) { return local().ConstValue(); @@ -545,7 +507,6 @@ const Instance* LoadLocalNode::EvalConstExpr() const { return NULL; } - AstNode* LoadLocalNode::MakeAssignmentNode(AstNode* rhs) { if (local().is_final()) { return NULL; @@ -553,7 +514,6 @@ AstNode* LoadLocalNode::MakeAssignmentNode(AstNode* rhs) { return new StoreLocalNode(token_pos(), &local(), rhs); } - AstNode* LoadStaticFieldNode::MakeAssignmentNode(AstNode* rhs) { if (field().is_final()) { return NULL; @@ -567,19 +527,16 @@ AstNode* LoadStaticFieldNode::MakeAssignmentNode(AstNode* rhs) { Field::ZoneHandle(field().Original()), rhs); } - AstNode* InstanceGetterNode::MakeAssignmentNode(AstNode* rhs) { return new InstanceSetterNode(token_pos(), receiver(), field_name(), rhs, is_conditional()); } - bool InstanceGetterNode::IsPotentiallyConst() const { return field_name().Equals(Symbols::Length()) && !is_conditional() && receiver()->IsPotentiallyConst(); } - const Instance* InstanceGetterNode::EvalConstExpr() const { if (field_name().Equals(Symbols::Length()) && !is_conditional()) { const Instance* receiver_val = receiver()->EvalConstExpr(); @@ -590,13 +547,11 @@ const Instance* InstanceGetterNode::EvalConstExpr() const { return NULL; } - AstNode* LoadIndexedNode::MakeAssignmentNode(AstNode* rhs) { return new StoreIndexedNode(token_pos(), array(), index_expr(), rhs, super_class()); } - AstNode* StaticGetterNode::MakeAssignmentNode(AstNode* rhs) { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -736,7 +691,6 @@ AstNode* StaticGetterNode::MakeAssignmentNode(AstNode* rhs) { return new StaticSetterNode(token_pos(), NULL, cls(), field_name_, rhs); } - AstNode* StaticCallNode::MakeAssignmentNode(AstNode* rhs) { // Return this node if it represents a 'throw NoSuchMethodError' indicating // that a getter was not found, otherwise return null. @@ -750,7 +704,6 @@ AstNode* StaticCallNode::MakeAssignmentNode(AstNode* rhs) { return NULL; } - bool StaticGetterNode::IsPotentiallyConst() const { if (is_deferred_reference_) { return false; @@ -765,7 +718,6 @@ bool StaticGetterNode::IsPotentiallyConst() const { return true; } - const Instance* StaticGetterNode::EvalConstExpr() const { if (is_deferred_reference_) { return NULL; diff --git a/runtime/vm/ast.h b/runtime/vm/ast.h index c27b61a25c2..c7b42d0e909 100644 --- a/runtime/vm/ast.h +++ b/runtime/vm/ast.h @@ -8,9 +8,9 @@ #include "platform/assert.h" #include "vm/allocation.h" #include "vm/growable_array.h" -#include "vm/scopes.h" -#include "vm/object.h" #include "vm/native_entry.h" +#include "vm/object.h" +#include "vm/scopes.h" #include "vm/token.h" #include "vm/token_position.h" @@ -66,12 +66,10 @@ namespace dart { V(InlinedFinally) \ V(StringInterpolate) - #define FORWARD_DECLARATION(BaseName) class BaseName##Node; FOR_EACH_NODE(FORWARD_DECLARATION) #undef FORWARD_DECLARATION - // Abstract class to implement an AST node visitor. An example is AstPrinter. class AstNodeVisitor : public ValueObject { public: @@ -88,13 +86,11 @@ class AstNodeVisitor : public ValueObject { DISALLOW_COPY_AND_ASSIGN(AstNodeVisitor); }; - #define DECLARE_COMMON_NODE_FUNCTIONS(type) \ virtual void Visit(AstNodeVisitor* visitor); \ virtual const char* Name() const; \ virtual type* As##type() { return this; } - class AstNode : public ZoneAllocated { public: explicit AstNode(TokenPosition token_pos) : token_pos_(token_pos) { @@ -158,7 +154,6 @@ class AstNode : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(AstNode); }; - class AwaitNode : public AstNode { public: AwaitNode(TokenPosition token_pos, @@ -200,7 +195,6 @@ class AwaitNode : public AstNode { DISALLOW_COPY_AND_ASSIGN(AwaitNode); }; - // AwaitMarker nodes are used to generate markers that the FlowGraphBuilder // relies on. A marker indicates that a new await state needs to be // added to a function preamble. This type also triggers storing of the @@ -237,7 +231,6 @@ class AwaitMarkerNode : public AstNode { DISALLOW_COPY_AND_ASSIGN(AwaitMarkerNode); }; - class SequenceNode : public AstNode { public: SequenceNode(TokenPosition token_pos, LocalScope* scope) @@ -268,7 +261,6 @@ class SequenceNode : public AstNode { DISALLOW_COPY_AND_ASSIGN(SequenceNode); }; - class CloneContextNode : public AstNode { public: explicit CloneContextNode(TokenPosition token_pos) : AstNode(token_pos) {} @@ -281,7 +273,6 @@ class CloneContextNode : public AstNode { DISALLOW_COPY_AND_ASSIGN(CloneContextNode); }; - class ArgumentListNode : public AstNode { public: explicit ArgumentListNode(TokenPosition token_pos) @@ -344,7 +335,6 @@ class ArgumentListNode : public AstNode { DISALLOW_COPY_AND_ASSIGN(ArgumentListNode); }; - class LetNode : public AstNode { public: explicit LetNode(TokenPosition token_pos); @@ -375,7 +365,6 @@ class LetNode : public AstNode { DISALLOW_COPY_AND_ASSIGN(LetNode); }; - class ArrayNode : public AstNode { public: ArrayNode(TokenPosition token_pos, const AbstractType& type) @@ -422,7 +411,6 @@ class ArrayNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayNode); }; - class StringInterpolateNode : public AstNode { public: StringInterpolateNode(TokenPosition token_pos, ArrayNode* value) @@ -444,7 +432,6 @@ class StringInterpolateNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(StringInterpolateNode); }; - class LiteralNode : public AstNode { public: LiteralNode(TokenPosition token_pos, const Instance& literal) @@ -478,7 +465,6 @@ class LiteralNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(LiteralNode); }; - class TypeNode : public AstNode { public: TypeNode(TokenPosition token_pos, @@ -520,7 +506,6 @@ class TypeNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(TypeNode); }; - class AssignableNode : public AstNode { public: AssignableNode(TokenPosition token_pos, @@ -553,7 +538,6 @@ class AssignableNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(AssignableNode); }; - class ClosureNode : public AstNode { public: ClosureNode(TokenPosition token_pos, @@ -602,7 +586,6 @@ class ClosureNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(ClosureNode); }; - // Primary nodes hold identifiers or values (library, class or function) // resolved from an identifier. Primary nodes should not ever make it to the // code generation phase as they will be transformed into the correct call or @@ -702,7 +685,6 @@ class ReturnNode : public AstNode { DISALLOW_COPY_AND_ASSIGN(ReturnNode); }; - class ComparisonNode : public AstNode { public: ComparisonNode(TokenPosition token_pos, @@ -740,7 +722,6 @@ class ComparisonNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(ComparisonNode); }; - class BinaryOpNode : public AstNode { public: BinaryOpNode(TokenPosition token_pos, @@ -784,7 +765,6 @@ class BinaryOpNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(BinaryOpNode); }; - class UnaryOpNode : public AstNode { public: // Returns optimized version, e.g., for ('-' '1') ('-1') literal is returned. @@ -819,7 +799,6 @@ class UnaryOpNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(UnaryOpNode); }; - class ConditionalExprNode : public AstNode { public: ConditionalExprNode(TokenPosition token_pos, @@ -867,7 +846,6 @@ class ConditionalExprNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(ConditionalExprNode); }; - class IfNode : public AstNode { public: IfNode(TokenPosition token_pos, @@ -903,7 +881,6 @@ class IfNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(IfNode); }; - class CaseNode : public AstNode { public: CaseNode(TokenPosition token_pos, @@ -947,7 +924,6 @@ class CaseNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(CaseNode); }; - class SwitchNode : public AstNode { public: SwitchNode(TokenPosition token_pos, SourceLabel* label, SequenceNode* body) @@ -972,7 +948,6 @@ class SwitchNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(SwitchNode); }; - class WhileNode : public AstNode { public: WhileNode(TokenPosition token_pos, @@ -1014,7 +989,6 @@ class WhileNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(WhileNode); }; - class DoWhileNode : public AstNode { public: DoWhileNode(TokenPosition token_pos, @@ -1046,7 +1020,6 @@ class DoWhileNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(DoWhileNode); }; - // The condition can be NULL. class ForNode : public AstNode { public: @@ -1103,7 +1076,6 @@ class ForNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(ForNode); }; - class JumpNode : public AstNode { public: JumpNode(TokenPosition token_pos, Token::Kind kind, SourceLabel* label) @@ -1142,7 +1114,6 @@ class JumpNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(JumpNode); }; - class StopNode : public AstNode { public: StopNode(TokenPosition token_pos, const char* message) @@ -1162,7 +1133,6 @@ class StopNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(StopNode); }; - class LoadLocalNode : public AstNode { public: LoadLocalNode(TokenPosition token_pos, const LocalVariable* local) @@ -1186,7 +1156,6 @@ class LoadLocalNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(LoadLocalNode); }; - class StoreLocalNode : public AstNode { public: StoreLocalNode(TokenPosition token_pos, @@ -1213,7 +1182,6 @@ class StoreLocalNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(StoreLocalNode); }; - class LoadInstanceFieldNode : public AstNode { public: LoadInstanceFieldNode(TokenPosition token_pos, @@ -1240,7 +1208,6 @@ class LoadInstanceFieldNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(LoadInstanceFieldNode); }; - class StoreInstanceFieldNode : public AstNode { public: StoreInstanceFieldNode(TokenPosition token_pos, @@ -1279,7 +1246,6 @@ class StoreInstanceFieldNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(StoreInstanceFieldNode); }; - class LoadStaticFieldNode : public AstNode { public: LoadStaticFieldNode(TokenPosition token_pos, const Field& field) @@ -1315,7 +1281,6 @@ class LoadStaticFieldNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(LoadStaticFieldNode); }; - class StoreStaticFieldNode : public AstNode { public: StoreStaticFieldNode(TokenPosition token_pos, @@ -1342,7 +1307,6 @@ class StoreStaticFieldNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(StoreStaticFieldNode); }; - class LoadIndexedNode : public AstNode { public: LoadIndexedNode(TokenPosition token_pos, @@ -1379,7 +1343,6 @@ class LoadIndexedNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(LoadIndexedNode); }; - class StoreIndexedNode : public AstNode { public: StoreIndexedNode(TokenPosition token_pos, @@ -1420,7 +1383,6 @@ class StoreIndexedNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(StoreIndexedNode); }; - class InstanceCallNode : public AstNode { public: InstanceCallNode(TokenPosition token_pos, @@ -1460,7 +1422,6 @@ class InstanceCallNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceCallNode); }; - class InstanceGetterNode : public AstNode { public: InstanceGetterNode(TokenPosition token_pos, @@ -1499,7 +1460,6 @@ class InstanceGetterNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceGetterNode); }; - class InstanceSetterNode : public AstNode { public: InstanceSetterNode(TokenPosition token_pos, @@ -1539,7 +1499,6 @@ class InstanceSetterNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceSetterNode); }; - class InitStaticFieldNode : public AstNode { public: InitStaticFieldNode(TokenPosition token_pos, const Field& field) @@ -1559,7 +1518,6 @@ class InitStaticFieldNode : public AstNode { DISALLOW_COPY_AND_ASSIGN(InitStaticFieldNode); }; - class StaticGetterNode : public AstNode { public: StaticGetterNode(TokenPosition token_pos, @@ -1615,7 +1573,6 @@ class StaticGetterNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(StaticGetterNode); }; - class StaticSetterNode : public AstNode { public: // Static setter with resolved setter function. @@ -1678,7 +1635,6 @@ class StaticSetterNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(StaticSetterNode); }; - class StaticCallNode : public AstNode { public: StaticCallNode(TokenPosition token_pos, @@ -1707,7 +1663,6 @@ class StaticCallNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(StaticCallNode); }; - class ClosureCallNode : public AstNode { public: ClosureCallNode(TokenPosition token_pos, @@ -1735,7 +1690,6 @@ class ClosureCallNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(ClosureCallNode); }; - // There are two kinds of constructor calls: factory calls and constructor // calls, distinguishable by constructor.IsFactory(). // @@ -1795,7 +1749,6 @@ class ConstructorCallNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(ConstructorCallNode); }; - // The body of a Dart function marked as 'native' consists of this node. class NativeBodyNode : public AstNode { public: @@ -1835,7 +1788,6 @@ class NativeBodyNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(NativeBodyNode); }; - class CatchClauseNode : public AstNode { public: static const intptr_t kInvalidTryIndex = -1; @@ -1902,7 +1854,6 @@ class CatchClauseNode : public AstNode { DISALLOW_COPY_AND_ASSIGN(CatchClauseNode); }; - class TryCatchNode : public AstNode { public: TryCatchNode(TokenPosition token_pos, @@ -1955,7 +1906,6 @@ class TryCatchNode : public AstNode { DISALLOW_COPY_AND_ASSIGN(TryCatchNode); }; - class ThrowNode : public AstNode { public: ThrowNode(TokenPosition token_pos, AstNode* exception, AstNode* stacktrace) @@ -1982,7 +1932,6 @@ class ThrowNode : public AstNode { DISALLOW_IMPLICIT_CONSTRUCTORS(ThrowNode); }; - class InlinedFinallyNode : public AstNode { public: InlinedFinallyNode(TokenPosition token_pos, diff --git a/runtime/vm/ast_printer.cc b/runtime/vm/ast_printer.cc index de639406de0..54be6d7a17c 100644 --- a/runtime/vm/ast_printer.cc +++ b/runtime/vm/ast_printer.cc @@ -17,17 +17,14 @@ namespace dart { AstPrinter::AstPrinter(bool log) : indent_(0), logger_(log ? Log::Current() : Log::NoOpLog()) {} - AstPrinter::~AstPrinter() {} - void AstPrinter::VisitGenericAstNode(AstNode* node) { logger_->Print("(%s ", node->Name()); node->VisitChildren(this); logger_->Print(")"); } - void AstPrinter::VisitSequenceNode(SequenceNode* node) { indent_++; LocalScope* scope = node->scope(); @@ -51,17 +48,14 @@ void AstPrinter::VisitSequenceNode(SequenceNode* node) { indent_--; } - void AstPrinter::VisitCloneContextNode(CloneContextNode* node) { VisitGenericAstNode(node); } - void AstPrinter::VisitArgumentListNode(ArgumentListNode* arguments) { VisitGenericAstNode(arguments); } - void AstPrinter::VisitReturnNode(ReturnNode* node) { const char* kind; switch (node->return_type()) { @@ -83,7 +77,6 @@ void AstPrinter::VisitReturnNode(ReturnNode* node) { logger_->Print(")"); } - void AstPrinter::VisitGenericLocalNode(AstNode* node, const LocalVariable& variable) { logger_->Print("(%s ", node->Name()); @@ -93,17 +86,14 @@ void AstPrinter::VisitGenericLocalNode(AstNode* node, logger_->Print(")"); } - void AstPrinter::VisitLoadLocalNode(LoadLocalNode* node) { VisitGenericLocalNode(node, node->local()); } - void AstPrinter::VisitStoreLocalNode(StoreLocalNode* node) { VisitGenericLocalNode(node, node->local()); } - void AstPrinter::VisitGenericFieldNode(AstNode* node, const Field& field) { logger_->Print( "(%s %s%s \"%s\" ", node->Name(), field.is_final() ? "final " : "", @@ -113,27 +103,22 @@ void AstPrinter::VisitGenericFieldNode(AstNode* node, const Field& field) { logger_->Print(")"); } - void AstPrinter::VisitLoadInstanceFieldNode(LoadInstanceFieldNode* node) { VisitGenericFieldNode(node, node->field()); } - void AstPrinter::VisitStoreInstanceFieldNode(StoreInstanceFieldNode* node) { VisitGenericFieldNode(node, Field::ZoneHandle(node->field().Original())); } - void AstPrinter::VisitLoadStaticFieldNode(LoadStaticFieldNode* node) { VisitGenericFieldNode(node, node->field()); } - void AstPrinter::VisitStoreStaticFieldNode(StoreStaticFieldNode* node) { VisitGenericFieldNode(node, node->field()); } - void AstPrinter::PrintLocalVariable(const LocalVariable* variable) { logger_->Print("%s%s \"%s\"", variable->is_final() ? "final " : "", String::Handle(variable->type().Name()).ToCString(), @@ -148,7 +133,6 @@ void AstPrinter::PrintLocalVariable(const LocalVariable* variable) { } } - void AstPrinter::PrintNewlineAndIndent() { logger_->Print("\n"); for (intptr_t p = 0; p < indent_; ++p) { @@ -156,7 +140,6 @@ void AstPrinter::PrintNewlineAndIndent() { } } - void AstPrinter::VisitLetNode(LetNode* node) { logger_->Print("(Let ("); // Indent the variables and initializers by two. @@ -181,30 +164,25 @@ void AstPrinter::VisitLetNode(LetNode* node) { --indent_; } - void AstPrinter::VisitArrayNode(ArrayNode* node) { VisitGenericAstNode(node); } - void AstPrinter::VisitStringInterpolateNode(StringInterpolateNode* node) { VisitGenericAstNode(node); } - void AstPrinter::VisitLiteralNode(LiteralNode* node) { const Instance& literal = node->literal(); logger_->Print("(%s \"%s\")", node->Name(), literal.ToCString()); } - void AstPrinter::VisitTypeNode(TypeNode* node) { const AbstractType& type = node->type(); logger_->Print("(%s \"%s\")", node->Name(), String::Handle(type.Name()).ToCString()); } - void AstPrinter::VisitAssignableNode(AssignableNode* node) { const AbstractType& type = node->type(); const String& dst_name = node->dst_name(); @@ -214,57 +192,48 @@ void AstPrinter::VisitAssignableNode(AssignableNode* node) { logger_->Print(")"); } - void AstPrinter::VisitAwaitNode(AwaitNode* node) { logger_->Print("(*****%s***** (scope \"%p\") ", node->Name(), node->scope()); node->VisitChildren(this); logger_->Print(")"); } - void AstPrinter::VisitAwaitMarkerNode(AwaitMarkerNode* node) { logger_->Print("(%s (async_scope \"%p\" await_scope \"%p\"))", node->Name(), node->async_scope(), node->await_scope()); } - void AstPrinter::VisitPrimaryNode(PrimaryNode* node) { logger_->Print("(*****%s***** \"%s\")", node->Name(), node->primary().ToCString()); } - void AstPrinter::VisitComparisonNode(ComparisonNode* node) { logger_->Print("(%s %s ", node->Name(), node->TokenName()); node->VisitChildren(this); logger_->Print(")"); } - void AstPrinter::VisitBinaryOpNode(BinaryOpNode* node) { logger_->Print("(%s %s ", node->Name(), node->TokenName()); node->VisitChildren(this); logger_->Print(")"); } - void AstPrinter::VisitUnaryOpNode(UnaryOpNode* node) { logger_->Print("(%s %s ", node->Name(), node->TokenName()); node->VisitChildren(this); logger_->Print(")"); } - void AstPrinter::VisitConditionalExprNode(ConditionalExprNode* node) { VisitGenericAstNode(node); } - void AstPrinter::VisitIfNode(IfNode* node) { VisitGenericAstNode(node); } - void AstPrinter::VisitCaseNode(CaseNode* node) { logger_->Print("(%s (", node->Name()); for (int i = 0; i < node->case_expressions()->length(); i++) { @@ -278,17 +247,14 @@ void AstPrinter::VisitCaseNode(CaseNode* node) { logger_->Print(")"); } - void AstPrinter::VisitSwitchNode(SwitchNode* node) { VisitGenericAstNode(node); } - void AstPrinter::VisitWhileNode(WhileNode* node) { VisitGenericAstNode(node); } - void AstPrinter::VisitForNode(ForNode* node) { // Complicated because the condition is optional and so we clearly want to // indicate the subparts. @@ -305,18 +271,15 @@ void AstPrinter::VisitForNode(ForNode* node) { logger_->Print(")"); } - void AstPrinter::VisitDoWhileNode(DoWhileNode* node) { VisitGenericAstNode(node); } - void AstPrinter::VisitJumpNode(JumpNode* node) { logger_->Print("(%s %s %s (scope \"%p\"))", node->Name(), node->TokenName(), node->label()->name().ToCString(), node->label()->owner()); } - void AstPrinter::VisitInstanceCallNode(InstanceCallNode* node) { logger_->Print("(%s \"%s\" ", node->Name(), node->function_name().ToCString()); @@ -324,7 +287,6 @@ void AstPrinter::VisitInstanceCallNode(InstanceCallNode* node) { logger_->Print(")"); } - void AstPrinter::VisitStaticCallNode(StaticCallNode* node) { const char* function_fullname = node->function().ToFullyQualifiedCString(); logger_->Print("(%s \"%s\" ", node->Name(), function_fullname); @@ -332,18 +294,15 @@ void AstPrinter::VisitStaticCallNode(StaticCallNode* node) { logger_->Print(")"); } - void AstPrinter::VisitClosureNode(ClosureNode* node) { const char* function_fullname = node->function().ToFullyQualifiedCString(); logger_->Print("(%s \"%s\")", node->Name(), function_fullname); } - void AstPrinter::VisitClosureCallNode(ClosureCallNode* node) { VisitGenericAstNode(node); } - void AstPrinter::VisitConstructorCallNode(ConstructorCallNode* node) { const char* kind = node->constructor().IsFactory() ? "factory " : ""; const char* constructor_name = node->constructor().ToFullyQualifiedCString(); @@ -352,34 +311,29 @@ void AstPrinter::VisitConstructorCallNode(ConstructorCallNode* node) { logger_->Print(")"); } - void AstPrinter::VisitInstanceGetterNode(InstanceGetterNode* node) { logger_->Print("(%s \"%s\" ", node->Name(), node->field_name().ToCString()); node->VisitChildren(this); logger_->Print(")"); } - void AstPrinter::VisitInstanceSetterNode(InstanceSetterNode* node) { logger_->Print("(%s \"%s\" ", node->Name(), node->field_name().ToCString()); node->VisitChildren(this); logger_->Print(")"); } - void AstPrinter::VisitInitStaticFieldNode(InitStaticFieldNode* node) { logger_->Print("(%s \"%s\")", node->Name(), String::Handle(node->field().name()).ToCString()); } - void AstPrinter::VisitStaticGetterNode(StaticGetterNode* node) { String& class_name = String::Handle(node->cls().Name()); logger_->Print("(%s \"%s.%s\")", node->Name(), class_name.ToCString(), node->field_name().ToCString()); } - void AstPrinter::VisitStaticSetterNode(StaticSetterNode* node) { String& class_name = String::Handle(node->cls().Name()); logger_->Print("(%s \"%s.%s\" ", node->Name(), class_name.ToCString(), @@ -388,21 +342,18 @@ void AstPrinter::VisitStaticSetterNode(StaticSetterNode* node) { logger_->Print(")"); } - void AstPrinter::VisitLoadIndexedNode(LoadIndexedNode* node) { logger_->Print("(%s%s ", node->Name(), node->IsSuperLoad() ? " super" : ""); node->VisitChildren(this); logger_->Print(")"); } - void AstPrinter::VisitStoreIndexedNode(StoreIndexedNode* node) { logger_->Print("(%s%s ", node->Name(), node->IsSuperStore() ? " super" : ""); node->VisitChildren(this); logger_->Print(")"); } - void AstPrinter::VisitNativeBodyNode(NativeBodyNode* node) { logger_->Print( "(%s \"%s\" (%" Pd " args))", node->Name(), @@ -410,12 +361,10 @@ void AstPrinter::VisitNativeBodyNode(NativeBodyNode* node) { NativeArguments::ParameterCountForResolution(node->function())); } - void AstPrinter::VisitCatchClauseNode(CatchClauseNode* node) { VisitGenericAstNode(node); } - void AstPrinter::VisitTryCatchNode(TryCatchNode* node) { logger_->Print("(%s ", node->Name()); node->try_block()->Visit(this); @@ -428,22 +377,18 @@ void AstPrinter::VisitTryCatchNode(TryCatchNode* node) { logger_->Print(")"); } - void AstPrinter::VisitThrowNode(ThrowNode* node) { VisitGenericAstNode(node); } - void AstPrinter::VisitStopNode(StopNode* node) { logger_->Print("(%s %s)", node->Name(), node->message()); } - void AstPrinter::VisitInlinedFinallyNode(InlinedFinallyNode* node) { VisitGenericAstNode(node); } - void AstPrinter::PrintNode(AstNode* node) { ASSERT(node != NULL); AstPrinter ast_printer; @@ -451,14 +396,12 @@ void AstPrinter::PrintNode(AstNode* node) { logger_->Print("\n"); } - void AstPrinter::IndentN(int count) { for (int i = 0; i < count; i++) { logger_->Print(" "); } } - void AstPrinter::PrintLocalScopeVariable(const LocalScope* scope, LocalVariable* var, int indent) { @@ -483,7 +426,6 @@ void AstPrinter::PrintLocalScopeVariable(const LocalScope* scope, scope->end_token_pos().ToCString()); } - void AstPrinter::PrintLocalScope(const LocalScope* scope, int start_index, int indent) { @@ -508,7 +450,6 @@ void AstPrinter::PrintLocalScope(const LocalScope* scope, } } - void AstPrinter::PrintFunctionScope(const ParsedFunction& parsed_function) { HANDLESCOPE(parsed_function.thread()); const Function& function = parsed_function.function(); @@ -557,7 +498,6 @@ void AstPrinter::PrintFunctionScope(const ParsedFunction& parsed_function) { logger_->Print("}\n"); } - void AstPrinter::PrintFunctionNodes(const ParsedFunction& parsed_function) { HANDLESCOPE(parsed_function.thread()); SequenceNode* node_sequence = parsed_function.node_sequence(); diff --git a/runtime/vm/ast_printer_test.cc b/runtime/vm/ast_printer_test.cc index 5ea05a40fdc..128317adfc6 100644 --- a/runtime/vm/ast_printer_test.cc +++ b/runtime/vm/ast_printer_test.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "platform/assert.h" #include "vm/ast_printer.h" +#include "platform/assert.h" #include "vm/heap.h" #include "vm/isolate.h" #include "vm/object.h" diff --git a/runtime/vm/ast_test.cc b/runtime/vm/ast_test.cc index 0de9984cc87..2ade4e75435 100644 --- a/runtime/vm/ast_test.cc +++ b/runtime/vm/ast_test.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "platform/assert.h" #include "vm/ast.h" +#include "platform/assert.h" #include "vm/heap.h" #include "vm/isolate.h" #include "vm/object.h" diff --git a/runtime/vm/ast_transformer.cc b/runtime/vm/ast_transformer.cc index 7ce398c8652..81304f606bd 100644 --- a/runtime/vm/ast_transformer.cc +++ b/runtime/vm/ast_transformer.cc @@ -60,13 +60,11 @@ AwaitTransformer::AwaitTransformer(SequenceNode* preamble, ASSERT(async_temp_scope_ != NULL); } - AstNode* AwaitTransformer::Transform(AstNode* expr) { expr->Visit(this); return result_; } - LocalVariable* AwaitTransformer::EnsureCurrentTempVar() { String& symbol = String::ZoneHandle(Z, Symbols::NewFormatted(T, "%d", temp_cnt_)); @@ -87,7 +85,6 @@ LocalVariable* AwaitTransformer::EnsureCurrentTempVar() { return await_tmp; } - LocalVariable* AwaitTransformer::GetVariableInScope(LocalScope* scope, const String& symbol) { LocalVariable* var = scope->LookupVariable(symbol, false); @@ -95,7 +92,6 @@ LocalVariable* AwaitTransformer::GetVariableInScope(LocalScope* scope, return var; } - LocalVariable* AwaitTransformer::AddNewTempVarToPreamble( AstNode* node, TokenPosition token_pos) { @@ -106,18 +102,15 @@ LocalVariable* AwaitTransformer::AddNewTempVarToPreamble( return tmp_var; } - LoadLocalNode* AwaitTransformer::MakeName(AstNode* node) { LocalVariable* temp = AddNewTempVarToPreamble(node, ST(node->token_pos())); return new (Z) LoadLocalNode(ST(node->token_pos()), temp); } - void AwaitTransformer::VisitLiteralNode(LiteralNode* node) { result_ = node; } - void AwaitTransformer::VisitTypeNode(TypeNode* node) { if (node->is_deferred_reference()) { // Deferred references must use a temporary even after loading @@ -129,7 +122,6 @@ void AwaitTransformer::VisitTypeNode(TypeNode* node) { } } - void AwaitTransformer::VisitAwaitNode(AwaitNode* node) { // Await transformation: // @@ -224,15 +216,15 @@ void AwaitTransformer::VisitAwaitNode(AwaitNode* node) { error_ne_null_branch->Add( new (Z) ThrowNode(token_pos, load_error_param, load_stack_trace_param)); preamble_->Add(new (Z) IfNode( - token_pos, new (Z) ComparisonNode( - token_pos, Token::kNE, load_error_param, - new (Z) LiteralNode(token_pos, Object::null_instance())), + token_pos, + new (Z) ComparisonNode( + token_pos, Token::kNE, load_error_param, + new (Z) LiteralNode(token_pos, Object::null_instance())), error_ne_null_branch, NULL)); result_ = MakeName(new (Z) LoadLocalNode(token_pos, result_param)); } - // Transforms boolean expressions into a sequence of evaluations that only // lazily evaluate subexpressions. // @@ -271,13 +263,11 @@ AstNode* AwaitTransformer::LazyTransform(const Token::Kind logical_op, return result; } - LocalScope* AwaitTransformer::ChainNewScope(LocalScope* parent) { return new (Z) LocalScope(parent, parent->function_level(), parent->loop_level()); } - void AwaitTransformer::VisitBinaryOpNode(BinaryOpNode* node) { AstNode* new_left = Transform(node->left()); AstNode* new_right = NULL; @@ -291,7 +281,6 @@ void AwaitTransformer::VisitBinaryOpNode(BinaryOpNode* node) { new_left, new_right)); } - void AwaitTransformer::VisitComparisonNode(ComparisonNode* node) { AstNode* new_left = Transform(node->left()); AstNode* new_right = Transform(node->right()); @@ -299,14 +288,12 @@ void AwaitTransformer::VisitComparisonNode(ComparisonNode* node) { new_left, new_right)); } - void AwaitTransformer::VisitUnaryOpNode(UnaryOpNode* node) { AstNode* new_operand = Transform(node->operand()); result_ = MakeName( new (Z) UnaryOpNode(node->token_pos(), node->kind(), new_operand)); } - // ::= () ? : // void AwaitTransformer::VisitConditionalExprNode(ConditionalExprNode* node) { @@ -328,7 +315,6 @@ void AwaitTransformer::VisitConditionalExprNode(ConditionalExprNode* node) { ST(node->token_pos()), new_condition, new_true_result, new_false_result)); } - void AwaitTransformer::VisitArgumentListNode(ArgumentListNode* node) { ArgumentListNode* new_args = new (Z) ArgumentListNode(node->token_pos()); for (intptr_t i = 0; i < node->length(); i++) { @@ -338,7 +324,6 @@ void AwaitTransformer::VisitArgumentListNode(ArgumentListNode* node) { result_ = new_args; } - void AwaitTransformer::VisitArrayNode(ArrayNode* node) { GrowableArray new_elements; for (intptr_t i = 0; i < node->length(); i++) { @@ -347,14 +332,12 @@ void AwaitTransformer::VisitArrayNode(ArrayNode* node) { result_ = new (Z) ArrayNode(node->token_pos(), node->type(), new_elements); } - void AwaitTransformer::VisitStringInterpolateNode(StringInterpolateNode* node) { ArrayNode* new_value = Transform(node->value())->AsArrayNode(); result_ = MakeName(new (Z) StringInterpolateNode(node->token_pos(), new_value)); } - void AwaitTransformer::VisitClosureNode(ClosureNode* node) { AstNode* new_receiver = node->receiver(); if (new_receiver != NULL) { @@ -364,7 +347,6 @@ void AwaitTransformer::VisitClosureNode(ClosureNode* node) { new_receiver, node->scope())); } - void AwaitTransformer::VisitInstanceCallNode(InstanceCallNode* node) { AstNode* new_receiver = Transform(node->receiver()); ArgumentListNode* new_args = @@ -374,7 +356,6 @@ void AwaitTransformer::VisitInstanceCallNode(InstanceCallNode* node) { node->is_conditional())); } - void AwaitTransformer::VisitStaticCallNode(StaticCallNode* node) { ArgumentListNode* new_args = Transform(node->arguments())->AsArgumentListNode(); @@ -382,7 +363,6 @@ void AwaitTransformer::VisitStaticCallNode(StaticCallNode* node) { new (Z) StaticCallNode(node->token_pos(), node->function(), new_args)); } - void AwaitTransformer::VisitConstructorCallNode(ConstructorCallNode* node) { ArgumentListNode* new_args = Transform(node->arguments())->AsArgumentListNode(); @@ -391,7 +371,6 @@ void AwaitTransformer::VisitConstructorCallNode(ConstructorCallNode* node) { node->constructor(), new_args)); } - void AwaitTransformer::VisitInstanceGetterNode(InstanceGetterNode* node) { AstNode* new_receiver = Transform(node->receiver()); result_ = MakeName(new (Z) InstanceGetterNode(node->token_pos(), new_receiver, @@ -399,7 +378,6 @@ void AwaitTransformer::VisitInstanceGetterNode(InstanceGetterNode* node) { node->is_conditional())); } - void AwaitTransformer::VisitInstanceSetterNode(InstanceSetterNode* node) { AstNode* new_receiver = node->receiver(); if (new_receiver != NULL) { @@ -411,7 +389,6 @@ void AwaitTransformer::VisitInstanceSetterNode(InstanceSetterNode* node) { node->is_conditional())); } - void AwaitTransformer::VisitStaticGetterNode(StaticGetterNode* node) { AstNode* new_receiver = node->receiver(); if (new_receiver != NULL) { @@ -423,7 +400,6 @@ void AwaitTransformer::VisitStaticGetterNode(StaticGetterNode* node) { result_ = MakeName(new_getter); } - void AwaitTransformer::VisitStaticSetterNode(StaticSetterNode* node) { AstNode* new_receiver = node->receiver(); if (new_receiver != NULL) { @@ -441,24 +417,20 @@ void AwaitTransformer::VisitStaticSetterNode(StaticSetterNode* node) { result_ = MakeName(new_setter); } - void AwaitTransformer::VisitLoadLocalNode(LoadLocalNode* node) { result_ = MakeName(node); } - void AwaitTransformer::VisitStoreLocalNode(StoreLocalNode* node) { AstNode* new_value = Transform(node->value()); result_ = MakeName( new (Z) StoreLocalNode(node->token_pos(), &node->local(), new_value)); } - void AwaitTransformer::VisitLoadStaticFieldNode(LoadStaticFieldNode* node) { result_ = MakeName(node); } - void AwaitTransformer::VisitStoreStaticFieldNode(StoreStaticFieldNode* node) { AstNode* new_value = Transform(node->value()); result_ = MakeName(new (Z) StoreStaticFieldNode( @@ -466,7 +438,6 @@ void AwaitTransformer::VisitStoreStaticFieldNode(StoreStaticFieldNode* node) { new_value)); } - void AwaitTransformer::VisitLoadIndexedNode(LoadIndexedNode* node) { AstNode* new_array = Transform(node->array()); AstNode* new_index = Transform(node->index_expr()); @@ -474,7 +445,6 @@ void AwaitTransformer::VisitLoadIndexedNode(LoadIndexedNode* node) { new_index, node->super_class())); } - void AwaitTransformer::VisitStoreIndexedNode(StoreIndexedNode* node) { AstNode* new_array = Transform(node->array()); AstNode* new_index = Transform(node->index_expr()); @@ -483,14 +453,12 @@ void AwaitTransformer::VisitStoreIndexedNode(StoreIndexedNode* node) { node->token_pos(), new_array, new_index, new_value, node->super_class())); } - void AwaitTransformer::VisitAssignableNode(AssignableNode* node) { AstNode* new_expr = Transform(node->expr()); result_ = MakeName(new (Z) AssignableNode(node->token_pos(), new_expr, node->type(), node->dst_name())); } - void AwaitTransformer::VisitLetNode(LetNode* node) { // Add all the initializer nodes to the preamble and the // temporary variables to the scope for async temporary variables. @@ -520,7 +488,6 @@ void AwaitTransformer::VisitLetNode(LetNode* node) { result_ = Transform(node->nodes()[last_node_index]); } - void AwaitTransformer::VisitThrowNode(ThrowNode* node) { AstNode* new_exception = Transform(node->exception()); result_ = MakeName( diff --git a/runtime/vm/atomic.h b/runtime/vm/atomic.h index 5a110a8d9c3..41dfad18d49 100644 --- a/runtime/vm/atomic.h +++ b/runtime/vm/atomic.h @@ -60,7 +60,6 @@ class AtomicOperations : public AllStatic { } }; - } // namespace dart #if defined(USING_SIMULATOR) && !defined(TARGET_ARCH_DBC) diff --git a/runtime/vm/atomic_android.h b/runtime/vm/atomic_android.h index a2f40f1fcaa..8b536953338 100644 --- a/runtime/vm/atomic_android.h +++ b/runtime/vm/atomic_android.h @@ -15,42 +15,34 @@ namespace dart { - inline uintptr_t AtomicOperations::FetchAndIncrement(uintptr_t* p) { return __sync_fetch_and_add(p, 1); } - inline intptr_t AtomicOperations::FetchAndIncrement(intptr_t* p) { return __sync_fetch_and_add(p, 1); } - inline void AtomicOperations::IncrementBy(intptr_t* p, intptr_t value) { __sync_fetch_and_add(p, value); } - inline void AtomicOperations::IncrementInt64By(int64_t* p, int64_t value) { __sync_fetch_and_add(p, value); } - inline uintptr_t AtomicOperations::FetchAndDecrement(uintptr_t* p) { return __sync_fetch_and_sub(p, 1); } - inline intptr_t AtomicOperations::FetchAndDecrement(intptr_t* p) { return __sync_fetch_and_sub(p, 1); } - inline void AtomicOperations::DecrementBy(intptr_t* p, intptr_t value) { __sync_fetch_and_sub(p, value); } - #if !defined(USING_SIMULATOR_ATOMICS) inline uword AtomicOperations::CompareAndSwapWord(uword* ptr, uword old_value, @@ -58,7 +50,6 @@ inline uword AtomicOperations::CompareAndSwapWord(uword* ptr, return __sync_val_compare_and_swap(ptr, old_value, new_value); } - inline uint32_t AtomicOperations::CompareAndSwapUint32(uint32_t* ptr, uint32_t old_value, uint32_t new_value) { diff --git a/runtime/vm/atomic_fuchsia.h b/runtime/vm/atomic_fuchsia.h index 2092e9fd214..fd873ed779f 100644 --- a/runtime/vm/atomic_fuchsia.h +++ b/runtime/vm/atomic_fuchsia.h @@ -19,37 +19,30 @@ inline uintptr_t AtomicOperations::FetchAndIncrement(uintptr_t* p) { return __sync_fetch_and_add(p, 1); } - inline intptr_t AtomicOperations::FetchAndIncrement(intptr_t* p) { return __sync_fetch_and_add(p, 1); } - inline void AtomicOperations::IncrementBy(intptr_t* p, intptr_t value) { __sync_fetch_and_add(p, value); } - inline void AtomicOperations::IncrementInt64By(int64_t* p, int64_t value) { __sync_fetch_and_add(p, value); } - inline uintptr_t AtomicOperations::FetchAndDecrement(uintptr_t* p) { return __sync_fetch_and_sub(p, 1); } - inline intptr_t AtomicOperations::FetchAndDecrement(intptr_t* p) { return __sync_fetch_and_sub(p, 1); } - inline void AtomicOperations::DecrementBy(intptr_t* p, intptr_t value) { __sync_fetch_and_sub(p, value); } - #if !defined(USING_SIMULATOR_ATOMICS) inline uword AtomicOperations::CompareAndSwapWord(uword* ptr, uword old_value, @@ -57,7 +50,6 @@ inline uword AtomicOperations::CompareAndSwapWord(uword* ptr, return __sync_val_compare_and_swap(ptr, old_value, new_value); } - inline uint32_t AtomicOperations::CompareAndSwapUint32(uint32_t* ptr, uint32_t old_value, uint32_t new_value) { diff --git a/runtime/vm/atomic_linux.h b/runtime/vm/atomic_linux.h index c1f7e2356d3..0c531a87913 100644 --- a/runtime/vm/atomic_linux.h +++ b/runtime/vm/atomic_linux.h @@ -15,42 +15,34 @@ namespace dart { - inline uintptr_t AtomicOperations::FetchAndIncrement(uintptr_t* p) { return __sync_fetch_and_add(p, 1); } - inline intptr_t AtomicOperations::FetchAndIncrement(intptr_t* p) { return __sync_fetch_and_add(p, 1); } - inline void AtomicOperations::IncrementBy(intptr_t* p, intptr_t value) { __sync_fetch_and_add(p, value); } - inline void AtomicOperations::IncrementInt64By(int64_t* p, int64_t value) { __sync_fetch_and_add(p, value); } - inline uintptr_t AtomicOperations::FetchAndDecrement(uintptr_t* p) { return __sync_fetch_and_sub(p, 1); } - inline intptr_t AtomicOperations::FetchAndDecrement(intptr_t* p) { return __sync_fetch_and_sub(p, 1); } - inline void AtomicOperations::DecrementBy(intptr_t* p, intptr_t value) { __sync_fetch_and_sub(p, value); } - #if !defined(USING_SIMULATOR_ATOMICS) inline uword AtomicOperations::CompareAndSwapWord(uword* ptr, uword old_value, @@ -58,7 +50,6 @@ inline uword AtomicOperations::CompareAndSwapWord(uword* ptr, return __sync_val_compare_and_swap(ptr, old_value, new_value); } - inline uint32_t AtomicOperations::CompareAndSwapUint32(uint32_t* ptr, uint32_t old_value, uint32_t new_value) { diff --git a/runtime/vm/atomic_macos.h b/runtime/vm/atomic_macos.h index 6913a3fb3f8..1ac693ab37a 100644 --- a/runtime/vm/atomic_macos.h +++ b/runtime/vm/atomic_macos.h @@ -15,42 +15,34 @@ namespace dart { - inline uintptr_t AtomicOperations::FetchAndIncrement(uintptr_t* p) { return __sync_fetch_and_add(p, 1); } - inline intptr_t AtomicOperations::FetchAndIncrement(intptr_t* p) { return __sync_fetch_and_add(p, 1); } - inline void AtomicOperations::IncrementBy(intptr_t* p, intptr_t value) { __sync_fetch_and_add(p, value); } - inline void AtomicOperations::IncrementInt64By(int64_t* p, int64_t value) { __sync_fetch_and_add(p, value); } - inline uintptr_t AtomicOperations::FetchAndDecrement(uintptr_t* p) { return __sync_fetch_and_sub(p, 1); } - inline intptr_t AtomicOperations::FetchAndDecrement(intptr_t* p) { return __sync_fetch_and_sub(p, 1); } - inline void AtomicOperations::DecrementBy(intptr_t* p, intptr_t value) { __sync_fetch_and_sub(p, value); } - #if !defined(USING_SIMULATOR_ATOMICS) inline uword AtomicOperations::CompareAndSwapWord(uword* ptr, uword old_value, @@ -58,7 +50,6 @@ inline uword AtomicOperations::CompareAndSwapWord(uword* ptr, return __sync_val_compare_and_swap(ptr, old_value, new_value); } - inline uint32_t AtomicOperations::CompareAndSwapUint32(uint32_t* ptr, uint32_t old_value, uint32_t new_value) { diff --git a/runtime/vm/atomic_simulator.h b/runtime/vm/atomic_simulator.h index 83bd623851c..281dc04ff34 100644 --- a/runtime/vm/atomic_simulator.h +++ b/runtime/vm/atomic_simulator.h @@ -19,7 +19,6 @@ inline uword AtomicOperations::CompareAndSwapWord(uword* ptr, return Simulator::CompareExchange(ptr, old_value, new_value); } - inline uint32_t AtomicOperations::CompareAndSwapUint32(uint32_t* ptr, uint32_t old_value, uint32_t new_value) { diff --git a/runtime/vm/atomic_test.cc b/runtime/vm/atomic_test.cc index 922429941f1..858ed35218f 100644 --- a/runtime/vm/atomic_test.cc +++ b/runtime/vm/atomic_test.cc @@ -2,9 +2,9 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +#include "vm/atomic.h" #include "platform/assert.h" #include "platform/utils.h" -#include "vm/atomic.h" #include "vm/globals.h" #include "vm/unit_test.h" @@ -17,7 +17,6 @@ VM_UNIT_TEST_CASE(FetchAndIncrement) { EXPECT_EQ(static_cast(43), v); } - VM_UNIT_TEST_CASE(FetchAndDecrement) { uintptr_t v = 42; EXPECT_EQ(static_cast(42), @@ -25,7 +24,6 @@ VM_UNIT_TEST_CASE(FetchAndDecrement) { EXPECT_EQ(static_cast(41), v); } - VM_UNIT_TEST_CASE(FetchAndIncrementSigned) { intptr_t v = -42; EXPECT_EQ(static_cast(-42), @@ -33,7 +31,6 @@ VM_UNIT_TEST_CASE(FetchAndIncrementSigned) { EXPECT_EQ(static_cast(-41), v); } - VM_UNIT_TEST_CASE(FetchAndDecrementSigned) { intptr_t v = -42; EXPECT_EQ(static_cast(-42), @@ -41,27 +38,23 @@ VM_UNIT_TEST_CASE(FetchAndDecrementSigned) { EXPECT_EQ(static_cast(-43), v); } - VM_UNIT_TEST_CASE(IncrementBy) { intptr_t v = 42; AtomicOperations::IncrementBy(&v, 100); EXPECT_EQ(static_cast(142), v); } - VM_UNIT_TEST_CASE(DecrementBy) { intptr_t v = 42; AtomicOperations::DecrementBy(&v, 41); EXPECT_EQ(static_cast(1), v); } - VM_UNIT_TEST_CASE(LoadRelaxed) { uword v = 42; EXPECT_EQ(static_cast(42), AtomicOperations::LoadRelaxed(&v)); } - TEST_CASE(CompareAndSwapWord) { uword old_value = 42; uword new_value = 100; @@ -70,7 +63,6 @@ TEST_CASE(CompareAndSwapWord) { EXPECT_EQ(static_cast(42), result); } - TEST_CASE(CompareAndSwapUint32) { uint32_t old_value = 42; uint32_t new_value = 100; diff --git a/runtime/vm/atomic_win.h b/runtime/vm/atomic_win.h index 2750f41aef8..9f2411d13dd 100644 --- a/runtime/vm/atomic_win.h +++ b/runtime/vm/atomic_win.h @@ -29,7 +29,6 @@ inline uintptr_t AtomicOperations::FetchAndIncrement(uintptr_t* p) { #endif } - inline intptr_t AtomicOperations::FetchAndIncrement(intptr_t* p) { #if defined(HOST_ARCH_X64) return static_cast( @@ -44,7 +43,6 @@ inline intptr_t AtomicOperations::FetchAndIncrement(intptr_t* p) { #endif } - inline void AtomicOperations::IncrementBy(intptr_t* p, intptr_t value) { #if defined(HOST_ARCH_X64) InterlockedExchangeAdd64(reinterpret_cast(p), @@ -56,7 +54,6 @@ inline void AtomicOperations::IncrementBy(intptr_t* p, intptr_t value) { #endif } - inline void AtomicOperations::IncrementInt64By(int64_t* p, int64_t value) { #if defined(HOST_ARCH_IA32) || defined(HOST_ARCH_X64) InterlockedExchangeAdd64(reinterpret_cast(p), @@ -66,7 +63,6 @@ inline void AtomicOperations::IncrementInt64By(int64_t* p, int64_t value) { #endif } - inline uintptr_t AtomicOperations::FetchAndDecrement(uintptr_t* p) { #if defined(HOST_ARCH_X64) return static_cast( @@ -81,7 +77,6 @@ inline uintptr_t AtomicOperations::FetchAndDecrement(uintptr_t* p) { #endif } - inline intptr_t AtomicOperations::FetchAndDecrement(intptr_t* p) { #if defined(HOST_ARCH_X64) return static_cast( @@ -96,7 +91,6 @@ inline intptr_t AtomicOperations::FetchAndDecrement(intptr_t* p) { #endif } - inline void AtomicOperations::DecrementBy(intptr_t* p, intptr_t value) { #if defined(HOST_ARCH_X64) InterlockedExchangeAdd64(reinterpret_cast(p), @@ -108,7 +102,6 @@ inline void AtomicOperations::DecrementBy(intptr_t* p, intptr_t value) { #endif } - #if !defined(USING_SIMULATOR) inline uword AtomicOperations::CompareAndSwapWord(uword* ptr, uword old_value, diff --git a/runtime/vm/become.cc b/runtime/vm/become.cc index 142169aae76..207a771d756 100644 --- a/runtime/vm/become.cc +++ b/runtime/vm/become.cc @@ -35,13 +35,11 @@ ForwardingCorpse* ForwardingCorpse::AsForwarder(uword addr, intptr_t size) { return result; } - void ForwardingCorpse::InitOnce() { ASSERT(sizeof(ForwardingCorpse) == kObjectAlignment); ASSERT(OFFSET_OF(ForwardingCorpse, tags_) == Object::tags_offset()); } - // Free list elements are used as a marker for forwarding objects. This is // safe because we cannot reach free list elements from live objects. Ideally // forwarding objects would have their own class id. See TODO below. @@ -49,7 +47,6 @@ static bool IsForwardingObject(RawObject* object) { return object->IsHeapObject() && object->IsForwardingCorpse(); } - static RawObject* GetForwardedObject(RawObject* object) { ASSERT(IsForwardingObject(object)); uword addr = reinterpret_cast(object) - kHeapObjectTag; @@ -57,7 +54,6 @@ static RawObject* GetForwardedObject(RawObject* object) { return forwarder->target(); } - static void ForwardObjectTo(RawObject* before_obj, RawObject* after_obj) { const intptr_t size_before = before_obj->Size(); @@ -75,7 +71,6 @@ static void ForwardObjectTo(RawObject* before_obj, RawObject* after_obj) { } } - class ForwardPointersVisitor : public ObjectPointerVisitor { public: explicit ForwardPointersVisitor(Isolate* isolate) @@ -107,7 +102,6 @@ class ForwardPointersVisitor : public ObjectPointerVisitor { DISALLOW_COPY_AND_ASSIGN(ForwardPointersVisitor); }; - class ForwardHeapPointersVisitor : public ObjectVisitor { public: explicit ForwardHeapPointersVisitor(ForwardPointersVisitor* pointer_visitor) @@ -124,7 +118,6 @@ class ForwardHeapPointersVisitor : public ObjectVisitor { DISALLOW_COPY_AND_ASSIGN(ForwardHeapPointersVisitor); }; - class ForwardHeapPointersHandleVisitor : public HandleVisitor { public: ForwardHeapPointersHandleVisitor() @@ -147,7 +140,6 @@ class ForwardHeapPointersHandleVisitor : public HandleVisitor { DISALLOW_COPY_AND_ASSIGN(ForwardHeapPointersHandleVisitor); }; - // On IA32, object pointers are embedded directly in the instruction stream, // which is normally write-protected, so we need to make it temporarily writable // to forward the pointers. On all other architectures, object pointers are @@ -178,20 +170,17 @@ class WritableCodeLiteralsScope : public ValueObject { }; #endif - void Become::MakeDummyObject(const Instance& instance) { // Make the forward pointer point to itself. // This is needed to distinguish it from a real forward object. ForwardObjectTo(instance.raw(), instance.raw()); } - static bool IsDummyObject(RawObject* object) { if (!object->IsForwardingCorpse()) return false; return GetForwardedObject(object) == object; } - void Become::CrashDump(RawObject* before_obj, RawObject* after_obj) { OS::PrintErr("DETECTED FATAL ISSUE IN BECOME MAPPINGS\n"); @@ -220,7 +209,6 @@ void Become::CrashDump(RawObject* before_obj, RawObject* after_obj) { } } - void Become::ElementsForwardIdentity(const Array& before, const Array& after) { Thread* thread = Thread::Current(); Isolate* isolate = thread->isolate(); diff --git a/runtime/vm/benchmark_test.cc b/runtime/vm/benchmark_test.cc index 3882e56132a..9ad3ab8e49e 100644 --- a/runtime/vm/benchmark_test.cc +++ b/runtime/vm/benchmark_test.cc @@ -25,7 +25,6 @@ Benchmark* Benchmark::first_ = NULL; Benchmark* Benchmark::tail_ = NULL; const char* Benchmark::executable_ = NULL; - // // Measure compile of all dart2js(compiler) functions. // @@ -52,10 +51,8 @@ static char* ComputeDart2JSPath(const char* arg) { return dart2js_path; } - static void func(Dart_NativeArguments args) {} - static Dart_NativeFunction NativeResolver(Dart_Handle name, int arg_count, bool* auto_setup_scope) { @@ -64,7 +61,6 @@ static Dart_NativeFunction NativeResolver(Dart_Handle name, return &func; } - static void SetupDart2JSPackagePath() { bool worked = bin::DartUtils::SetOriginalWorkingDirectory(); EXPECT(worked); @@ -84,7 +80,6 @@ static void SetupDart2JSPackagePath() { DART_CHECK_VALID(result); } - void Benchmark::RunAll(const char* executable) { SetExecutable(executable); Benchmark* benchmark = first_; @@ -94,7 +89,6 @@ void Benchmark::RunAll(const char* executable) { } } - Dart_Isolate Benchmark::CreateIsolate(const uint8_t* snapshot_data, const uint8_t* snapshot_instructions) { char* err = NULL; @@ -105,7 +99,6 @@ Dart_Isolate Benchmark::CreateIsolate(const uint8_t* snapshot_data, return isolate_; } - // // Measure compile of all functions in dart core lib classes. // @@ -125,10 +118,8 @@ BENCHMARK(CorelibCompileAll) { benchmark->set_score(elapsed_time); } - #ifndef PRODUCT - BENCHMARK(CorelibCompilerStats) { bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary); bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary); @@ -148,7 +139,6 @@ BENCHMARK(CorelibCompilerStats) { benchmark->set_score(elapsed_time); } - BENCHMARK(Dart2JSCompilerStats) { bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary); bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary); @@ -190,10 +180,8 @@ BENCHMARK(Dart2JSCompilerStats) { free(script); } - #endif // !PRODUCT - // // Measure creation of core isolate from a snapshot. // @@ -212,7 +200,6 @@ BENCHMARK(CorelibIsolateStartup) { Dart_EnterIsolate(reinterpret_cast(isolate)); } - // // Measure invocation of Dart API functions. // @@ -229,7 +216,6 @@ static void InitNativeFields(Dart_NativeArguments args) { Dart_ExitScope(); } - // The specific api functions called here are a bit arbitrary. We are // trying to get a sense of the overhead for using the dart api. static void UseDartApi(Dart_NativeArguments args) { @@ -260,7 +246,6 @@ static void UseDartApi(Dart_NativeArguments args) { Dart_SetReturnValue(args, Dart_NewInteger(value1 * receiver_value)); } - static Dart_NativeFunction bm_uda_lookup(Dart_Handle name, int argument_count, bool* auto_setup_scope) { @@ -276,7 +261,6 @@ static Dart_NativeFunction bm_uda_lookup(Dart_Handle name, } } - BENCHMARK(UseDartApi) { const int kNumIterations = 1000000; const char* kScriptChars = @@ -318,7 +302,6 @@ BENCHMARK(UseDartApi) { benchmark->set_score(elapsed_time); } - // // Measure time accessing internal and external strings. // @@ -357,7 +340,6 @@ BENCHMARK(DartStringAccess) { benchmark->set_score(elapsed_time); } - BENCHMARK(Dart2JSCompileAll) { bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary); bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary); @@ -395,7 +377,6 @@ BENCHMARK(Dart2JSCompileAll) { free(script); } - // // Measure frame lookup during stack traversal. // @@ -425,7 +406,6 @@ static void StackFrame_accessFrame(Dart_NativeArguments args) { Dart_SetReturnValue(args, Dart_NewInteger(elapsed_time)); } - static Dart_NativeFunction StackFrameNativeResolver(Dart_Handle name, int arg_count, bool* auto_setup_scope) { @@ -434,7 +414,6 @@ static Dart_NativeFunction StackFrameNativeResolver(Dart_Handle name, return &StackFrame_accessFrame; } - // Unit test case to verify stack frame iteration. BENCHMARK(FrameLookup) { const char* kScriptChars = @@ -487,19 +466,16 @@ BENCHMARK(FrameLookup) { benchmark->set_score(elapsed_time); } - static uint8_t* malloc_allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { return reinterpret_cast(realloc(ptr, new_size)); } - static void malloc_deallocator(uint8_t* ptr) { free(ptr); } - BENCHMARK_SIZE(CoreSnapshotSize) { const char* kScriptChars = "import 'dart:async';\n" @@ -534,7 +510,6 @@ BENCHMARK_SIZE(CoreSnapshotSize) { free(isolate_snapshot_data_buffer); } - BENCHMARK_SIZE(StandaloneSnapshotSize) { const char* kScriptChars = "import 'dart:async';\n" @@ -572,7 +547,6 @@ BENCHMARK_SIZE(StandaloneSnapshotSize) { free(isolate_snapshot_data_buffer); } - BENCHMARK(CreateMirrorSystem) { const char* kScriptChars = "import 'dart:mirrors';\n" @@ -591,7 +565,6 @@ BENCHMARK(CreateMirrorSystem) { benchmark->set_score(elapsed_time); } - BENCHMARK(EnterExitIsolate) { const char* kScriptChars = "import 'dart:core';\n" @@ -611,7 +584,6 @@ BENCHMARK(EnterExitIsolate) { benchmark->set_score(elapsed_time); } - static uint8_t message_buffer[64]; static uint8_t* message_allocator(uint8_t* ptr, intptr_t old_size, @@ -620,7 +592,6 @@ static uint8_t* message_allocator(uint8_t* ptr, } static void message_deallocator(uint8_t* ptr) {} - BENCHMARK(SerializeNull) { const Object& null_object = Object::Handle(); const intptr_t kLoopCount = 1000000; @@ -643,7 +614,6 @@ BENCHMARK(SerializeNull) { benchmark->set_score(elapsed_time); } - BENCHMARK(SerializeSmi) { const Integer& smi_object = Integer::Handle(Smi::New(42)); const intptr_t kLoopCount = 1000000; @@ -666,7 +636,6 @@ BENCHMARK(SerializeSmi) { benchmark->set_score(elapsed_time); } - BENCHMARK(SimpleMessage) { TransitionNativeToVM transition(thread); const Array& array_object = Array::Handle(Array::New(2)); @@ -692,7 +661,6 @@ BENCHMARK(SimpleMessage) { benchmark->set_score(elapsed_time); } - BENCHMARK(LargeMap) { const char* kScript = "makeMap() {\n" @@ -726,7 +694,6 @@ BENCHMARK(LargeMap) { benchmark->set_score(elapsed_time); } - BENCHMARK_MEMORY(InitialRSS) { benchmark->set_score(OS::MaxRSS()); } diff --git a/runtime/vm/benchmark_test.h b/runtime/vm/benchmark_test.h index d3569b04453..928537342bb 100644 --- a/runtime/vm/benchmark_test.h +++ b/runtime/vm/benchmark_test.h @@ -26,7 +26,7 @@ extern const uint8_t* vm_snapshot_data; extern const uint8_t* vm_snapshot_instructions; extern const uint8_t* core_isolate_snapshot_data; extern const uint8_t* core_isolate_snapshot_instructions; -} +} // namespace bin // The BENCHMARK macros are used for benchmarking a specific functionality // of the VM. @@ -59,7 +59,6 @@ inline Dart_Handle NewString(const char* str) { return Dart_NewStringFromCString(str); } - class Benchmark { public: typedef void(RunEntry)(Benchmark* benchmark); @@ -111,7 +110,6 @@ class Benchmark { DISALLOW_COPY_AND_ASSIGN(Benchmark); }; - class BenchmarkIsolateScope { public: explicit BenchmarkIsolateScope(Benchmark* benchmark) : benchmark_(benchmark) { diff --git a/runtime/vm/bigint_test.cc b/runtime/vm/bigint_test.cc index 22300f4541d..8ccf464e2e1 100644 --- a/runtime/vm/bigint_test.cc +++ b/runtime/vm/bigint_test.cc @@ -64,7 +64,6 @@ TEST_CASE(BigintSmi) { } } - TEST_CASE(BigintInt64) { const int64_t kValue = 100000000; const int64_t kValue64 = kValue * kValue; @@ -79,7 +78,6 @@ TEST_CASE(BigintInt64) { EXPECT_EQ(kMinInt64, bigint.AsInt64Value()); } - TEST_CASE(BigintUint64) { const Bigint& one = Bigint::Handle(Bigint::NewFromUint64(1)); EXPECT(one.FitsIntoInt64()); @@ -93,7 +91,6 @@ TEST_CASE(BigintUint64) { EXPECT_EQ(kMaxUint64, back); } - TEST_CASE(BigintDouble) { Bigint& bigint = Bigint::Handle(Bigint::NewFromInt64(5)); EXPECT_EQ(5.0, bigint.AsDoubleValue()); @@ -226,7 +223,6 @@ TEST_CASE(BigintDouble) { EXPECT_EQ(1.8446744073709553e+42, bigint.AsDoubleValue()); } - TEST_CASE(BigintHexStrings) { Zone* zone = Thread::Current()->zone(); { @@ -407,7 +403,6 @@ TEST_CASE(BigintHexStrings) { } } - TEST_CASE(BigintDecStrings) { Zone* zone = Thread::Current()->zone(); { @@ -511,7 +506,6 @@ TEST_CASE(BigintDecStrings) { } } - static void TestBigintCompare(const char* a, const char* b, int compare) { const Bigint& bigint_a = Bigint::Handle(Bigint::NewFromCString(a)); const Bigint& bigint_b = Bigint::Handle(Bigint::NewFromCString(b)); @@ -533,7 +527,6 @@ static void TestBigintCompare(const char* a, const char* b, int compare) { } } - TEST_CASE(BigintCompare) { TestBigintCompare("0x0", "0x0", 0); TestBigintCompare("0x1", "0x1", 0); @@ -582,7 +575,6 @@ TEST_CASE(BigintCompare) { TestBigintCompare("-0x10000000000000000", "0x0", -1); } - TEST_CASE(BigintDecimalStrings) { Zone* zone = Thread::Current()->zone(); { diff --git a/runtime/vm/bit_set_test.cc b/runtime/vm/bit_set_test.cc index 432d0864a19..32957702c7a 100644 --- a/runtime/vm/bit_set_test.cc +++ b/runtime/vm/bit_set_test.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "platform/assert.h" #include "vm/bit_set.h" +#include "platform/assert.h" #include "vm/unit_test.h" namespace dart { @@ -40,7 +40,6 @@ void TestBitSet() { } } - TEST_CASE(BitSetBasic) { TestBitSet<8>(); TestBitSet<42>(); diff --git a/runtime/vm/bit_vector.cc b/runtime/vm/bit_vector.cc index cc38df316d4..bb1df4dda81 100644 --- a/runtime/vm/bit_vector.cc +++ b/runtime/vm/bit_vector.cc @@ -32,7 +32,6 @@ void BitVector::Iterator::Advance() { current_word_ = current_word_ >> 1; } - bool BitVector::Equals(const BitVector& other) const { if (length_ != other.length_) return false; intptr_t i = 0; @@ -48,7 +47,6 @@ bool BitVector::Equals(const BitVector& other) const { return true; } - bool BitVector::AddAll(const BitVector* from) { ASSERT(data_length_ == from->data_length_); bool changed = false; @@ -63,7 +61,6 @@ bool BitVector::AddAll(const BitVector* from) { return changed; } - bool BitVector::RemoveAll(const BitVector* from) { ASSERT(data_length_ == from->data_length_); bool changed = false; @@ -91,7 +88,6 @@ bool BitVector::KillAndAdd(BitVector* kill, BitVector* gen) { return changed; } - void BitVector::Intersect(const BitVector* other) { ASSERT(other->length() == length()); for (intptr_t i = 0; i < data_length_; i++) { @@ -99,7 +95,6 @@ void BitVector::Intersect(const BitVector* other) { } } - bool BitVector::IsEmpty() const { for (intptr_t i = 0; i < data_length_; i++) { if (data_[i] != 0) { @@ -109,7 +104,6 @@ bool BitVector::IsEmpty() const { return true; } - void BitVector::Print() const { OS::Print("["); for (intptr_t i = 0; i < length_; i++) { diff --git a/runtime/vm/bit_vector_test.cc b/runtime/vm/bit_vector_test.cc index bcf0c913187..28ab5a31d67 100644 --- a/runtime/vm/bit_vector_test.cc +++ b/runtime/vm/bit_vector_test.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "platform/assert.h" #include "vm/bit_vector.h" +#include "platform/assert.h" #include "vm/unit_test.h" namespace dart { diff --git a/runtime/vm/bitfield.h b/runtime/vm/bitfield.h index e17ffcff27a..af2ca2a3e62 100644 --- a/runtime/vm/bitfield.h +++ b/runtime/vm/bitfield.h @@ -5,6 +5,8 @@ #ifndef RUNTIME_VM_BITFIELD_H_ #define RUNTIME_VM_BITFIELD_H_ +#include "platform/globals.h" + namespace dart { static const uword kUwordOne = 1U; diff --git a/runtime/vm/bitfield_test.cc b/runtime/vm/bitfield_test.cc index 8404ec9a347..d8e81820b2e 100644 --- a/runtime/vm/bitfield_test.cc +++ b/runtime/vm/bitfield_test.cc @@ -3,8 +3,9 @@ // BSD-style license that can be found in the LICENSE file. #include "platform/assert.h" -#include "vm/globals.h" + #include "vm/bitfield.h" +#include "vm/globals.h" #include "vm/unit_test.h" namespace dart { diff --git a/runtime/vm/bitmap.cc b/runtime/vm/bitmap.cc index f4d35b401d0..fd1d3439fdf 100644 --- a/runtime/vm/bitmap.cc +++ b/runtime/vm/bitmap.cc @@ -30,7 +30,6 @@ void BitmapBuilder::SetLength(intptr_t new_length) { length_ = new_length; } - bool BitmapBuilder::Get(intptr_t bit_offset) const { if (!InRange(bit_offset)) { return false; @@ -40,7 +39,6 @@ bool BitmapBuilder::Get(intptr_t bit_offset) const { return (byte_offset < data_size_in_bytes_) && GetBit(bit_offset); } - void BitmapBuilder::Set(intptr_t bit_offset, bool value) { if (!InRange(bit_offset)) { length_ = bit_offset + 1; @@ -63,14 +61,12 @@ void BitmapBuilder::Set(intptr_t bit_offset, bool value) { SetBit(bit_offset, value); } - void BitmapBuilder::SetRange(intptr_t min, intptr_t max, bool value) { for (intptr_t i = min; i <= max; i++) { Set(i, value); } } - void BitmapBuilder::Print() const { for (intptr_t i = 0; i < Length(); i++) { if (Get(i)) { @@ -81,7 +77,6 @@ void BitmapBuilder::Print() const { } } - bool BitmapBuilder::GetBit(intptr_t bit_offset) const { if (!InRange(bit_offset)) { return false; @@ -94,7 +89,6 @@ bool BitmapBuilder::GetBit(intptr_t bit_offset) const { return ((data_[byte_offset] & mask) != 0); } - void BitmapBuilder::SetBit(intptr_t bit_offset, bool value) { if (!InRange(bit_offset)) { FATAL1( diff --git a/runtime/vm/bitmap.h b/runtime/vm/bitmap.h index 289f4817a92..40a589ca09c 100644 --- a/runtime/vm/bitmap.h +++ b/runtime/vm/bitmap.h @@ -15,7 +15,6 @@ namespace dart { class RawStackMap; class StackMap; - // BitmapBuilder is used to build a bitmap. The implementation is optimized // for a dense set of small bit maps without a fixed upper bound (e.g: a // pointer map description of a stack). diff --git a/runtime/vm/bitmap_test.cc b/runtime/vm/bitmap_test.cc index 95fcd68e327..98a5e1746a4 100644 --- a/runtime/vm/bitmap_test.cc +++ b/runtime/vm/bitmap_test.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "platform/assert.h" #include "vm/bitmap.h" +#include "platform/assert.h" #include "vm/object.h" #include "vm/unit_test.h" diff --git a/runtime/vm/block_scheduler.cc b/runtime/vm/block_scheduler.cc index 7411fccecea..7513f807d91 100644 --- a/runtime/vm/block_scheduler.cc +++ b/runtime/vm/block_scheduler.cc @@ -19,7 +19,6 @@ static intptr_t GetEdgeCount(const Array& edge_counters, intptr_t edge_id) { return Smi::Value(Smi::RawCast(edge_counters.At(edge_id))); } - // There is an edge from instruction->successor. Set its weight (edge count // per function entry). static void SetEdgeWeight(BlockEntryInstr* block, @@ -50,7 +49,6 @@ static void SetEdgeWeight(BlockEntryInstr* block, } } - void BlockScheduler::AssignEdgeWeights() const { if (!FLAG_reorder_basic_blocks) { return; @@ -87,7 +85,6 @@ void BlockScheduler::AssignEdgeWeights() const { } } - // A weighted control-flow graph edge. struct Edge { Edge(BlockEntryInstr* source, BlockEntryInstr* target, double weight) @@ -100,7 +97,6 @@ struct Edge { double weight; }; - // A linked list node in a chain of blocks. struct Link : public ZoneAllocated { Link(BlockEntryInstr* block, Link* next) : block(block), next(next) {} @@ -109,7 +105,6 @@ struct Link : public ZoneAllocated { Link* next; }; - // A chain of blocks with first and last pointers for fast concatenation and // a length to support adding a shorter chain's links to a longer chain. struct Chain : public ZoneAllocated { @@ -121,7 +116,6 @@ struct Chain : public ZoneAllocated { intptr_t length; }; - int Edge::LowestWeightFirst(const Edge* a, const Edge* b) { if (a->weight < b->weight) { return -1; @@ -129,7 +123,6 @@ int Edge::LowestWeightFirst(const Edge* a, const Edge* b) { return (a->weight > b->weight) ? 1 : 0; } - // Combine two chains by adding the shorter chain's links to the longer // chain. static void Union(GrowableArray* chains, @@ -154,7 +147,6 @@ static void Union(GrowableArray* chains, } } - void BlockScheduler::ReorderBlocks() const { // Add every block to a chain of length 1 and compute a list of edges // sorted by weight. diff --git a/runtime/vm/boolfield.h b/runtime/vm/boolfield.h index fe20f5b0e5b..841587151ed 100644 --- a/runtime/vm/boolfield.h +++ b/runtime/vm/boolfield.h @@ -5,6 +5,7 @@ #ifndef RUNTIME_VM_BOOLFIELD_H_ #define RUNTIME_VM_BOOLFIELD_H_ +#include "platform/assert.h" #include "vm/globals.h" namespace dart { diff --git a/runtime/vm/boolfield_test.cc b/runtime/vm/boolfield_test.cc index b13001b847b..008044239ce 100644 --- a/runtime/vm/boolfield_test.cc +++ b/runtime/vm/boolfield_test.cc @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. #include "platform/assert.h" + #include "vm/boolfield.h" #include "vm/unit_test.h" diff --git a/runtime/vm/bootstrap.cc b/runtime/vm/bootstrap.cc index b1b21d19f25..8aa507588ef 100644 --- a/runtime/vm/bootstrap.cc +++ b/runtime/vm/bootstrap.cc @@ -28,13 +28,10 @@ struct BootstrapLibProps { const char** patch_paths; }; - enum { kPathsUriOffset = 0, kPathsSourceOffset = 1, kPathsEntryLength = 2 }; - const char** Bootstrap::profiler_patch_paths_ = NULL; - #define MAKE_PROPERTIES(CamelName, name) \ {ObjectStore::k##CamelName, "dart:" #name, Bootstrap::name##_source_paths_, \ "dart:" #name "-patch", Bootstrap::name##_patch_paths_}, @@ -44,10 +41,8 @@ static const BootstrapLibProps bootstrap_libraries[] = { #undef MAKE_PROPERTIES - static const intptr_t kBootstrapLibraryCount = ARRAY_SIZE(bootstrap_libraries); - static RawString* GetLibrarySourceByIndex(intptr_t index, const String& uri, bool patch) { @@ -84,7 +79,6 @@ static RawString* GetLibrarySourceByIndex(intptr_t index, return String::FromUTF8(utf8_array, file_length); } - static RawString* GetLibrarySource(const Library& lib, const String& uri, bool patch) { @@ -104,7 +98,6 @@ static RawString* GetLibrarySource(const Library& lib, return GetLibrarySourceByIndex(index, uri, patch); } - static RawError* Compile(const Library& library, const Script& script) { bool update_lib_status = (script.kind() == RawScript::kScriptTag || script.kind() == RawScript::kLibraryTag); @@ -124,7 +117,6 @@ static RawError* Compile(const Library& library, const Script& script) { return error.raw(); } - static Dart_Handle LoadPartSource(Thread* thread, const Library& lib, const String& uri) { @@ -151,7 +143,6 @@ static Dart_Handle LoadPartSource(Thread* thread, return Api::NewHandle(thread, error.raw()); } - static Dart_Handle BootstrapLibraryTagHandler(Dart_LibraryTag tag, Dart_Handle library, Dart_Handle uri) { @@ -187,7 +178,6 @@ static Dart_Handle BootstrapLibraryTagHandler(Dart_LibraryTag tag, return LoadPartSource(thread, lib, uri_str); } - static RawError* LoadPatchFiles(Thread* thread, const Library& lib, intptr_t index) { @@ -225,7 +215,6 @@ static RawError* LoadPatchFiles(Thread* thread, return Error::null(); } - static void Finish(Thread* thread, bool from_kernel) { Bootstrap::SetupNativeResolver(); if (!ClassFinalizer::ProcessPendingClasses(from_kernel)) { @@ -260,7 +249,6 @@ static void Finish(Thread* thread, bool from_kernel) { Compiler::CompileClass(cls); } - static RawError* BootstrapFromSource(Thread* thread) { Isolate* isolate = thread->isolate(); Zone* zone = thread->zone(); @@ -310,7 +298,6 @@ static RawError* BootstrapFromSource(Thread* thread) { return error.raw(); } - #if !defined(DART_PRECOMPILED_RUNTIME) static RawError* BootstrapFromKernel(Thread* thread, kernel::Program* program) { Zone* zone = thread->zone(); @@ -365,7 +352,6 @@ static RawError* BootstrapFromKernel(Thread* thread, kernel::Program* program) { } #endif - RawError* Bootstrap::DoBootstrapping(kernel::Program* kernel_program) { Thread* thread = Thread::Current(); Isolate* isolate = thread->isolate(); diff --git a/runtime/vm/bootstrap_natives.cc b/runtime/vm/bootstrap_natives.cc index 3a6126dfc38..0b6b193345a 100644 --- a/runtime/vm/bootstrap_natives.cc +++ b/runtime/vm/bootstrap_natives.cc @@ -18,7 +18,6 @@ namespace dart { #define REGISTER_NATIVE_ENTRY(name, count) \ {"" #name, BootstrapNatives::DN_##name, count}, - // List all native functions implemented in the vm or core bootstrap dart // libraries so that we can resolve the native function to it's entry // point. @@ -32,7 +31,6 @@ static struct NativeEntries { #endif // !DART_PRECOMPILED_RUNTIME }; - Dart_NativeFunction BootstrapNatives::Lookup(Dart_Handle name, int argument_count, bool* auto_setup_scope) { @@ -55,7 +53,6 @@ Dart_NativeFunction BootstrapNatives::Lookup(Dart_Handle name, return NULL; } - const uint8_t* BootstrapNatives::Symbol(Dart_NativeFunction* nf) { int num_entries = sizeof(BootStrapEntries) / sizeof(struct NativeEntries); for (int i = 0; i < num_entries; i++) { @@ -67,7 +64,6 @@ const uint8_t* BootstrapNatives::Symbol(Dart_NativeFunction* nf) { return NULL; } - void Bootstrap::SetupNativeResolver() { Library& library = Library::Handle(); @@ -140,7 +136,6 @@ void Bootstrap::SetupNativeResolver() { library.set_native_entry_symbol_resolver(symbol_resolver); } - bool Bootstrap::IsBootstapResolver(Dart_NativeEntryResolver resolver) { return (resolver == reinterpret_cast(BootstrapNatives::Lookup)); diff --git a/runtime/vm/bootstrap_nocore.cc b/runtime/vm/bootstrap_nocore.cc index f3dd693d2fa..5dc37b0dbdd 100644 --- a/runtime/vm/bootstrap_nocore.cc +++ b/runtime/vm/bootstrap_nocore.cc @@ -22,23 +22,18 @@ namespace dart { #define MAKE_PROPERTIES(CamelName, name) \ {ObjectStore::k##CamelName, "dart:" #name}, - struct BootstrapLibProps { ObjectStore::BootstrapLibraryId index; const char* uri; }; - static BootstrapLibProps bootstrap_libraries[] = { FOR_EACH_BOOTSTRAP_LIBRARY(MAKE_PROPERTIES)}; - #undef MAKE_PROPERTIES - static const intptr_t bootstrap_library_count = ARRAY_SIZE(bootstrap_libraries); - void Finish(Thread* thread, bool from_kernel) { Bootstrap::SetupNativeResolver(); ClassFinalizer::ProcessPendingClasses(from_kernel); @@ -71,7 +66,6 @@ void Finish(Thread* thread, bool from_kernel) { Compiler::CompileClass(cls); } - RawError* BootstrapFromKernel(Thread* thread, kernel::Program* program) { Zone* zone = thread->zone(); kernel::KernelReader reader(program); @@ -118,7 +112,6 @@ RawError* BootstrapFromKernel(Thread* thread, kernel::Program* program) { return Error::null(); } - RawError* Bootstrap::DoBootstrapping(kernel::Program* program) { Thread* thread = Thread::Current(); Isolate* isolate = thread->isolate(); diff --git a/runtime/vm/branch_optimizer.cc b/runtime/vm/branch_optimizer.cc index 0048b7ed637..3693eda4019 100644 --- a/runtime/vm/branch_optimizer.cc +++ b/runtime/vm/branch_optimizer.cc @@ -29,7 +29,6 @@ static bool PhiHasSingleUse(PhiInstr* phi, Value* use) { return true; } - bool BranchSimplifier::Match(JoinEntryInstr* block) { // Match the pattern of a branch on a comparison whose left operand is a // phi from the same block, and whose right operand is a constant. @@ -59,7 +58,6 @@ bool BranchSimplifier::Match(JoinEntryInstr* block) { (block->phis()->length() == 1); } - JoinEntryInstr* BranchSimplifier::ToJoinEntry(Zone* zone, TargetEntryInstr* target) { // Convert a target block into a join block. Branches will be duplicated @@ -74,7 +72,6 @@ JoinEntryInstr* BranchSimplifier::ToJoinEntry(Zone* zone, return join; } - BranchInstr* BranchSimplifier::CloneBranch(Zone* zone, BranchInstr* branch, Value* new_left, @@ -87,7 +84,6 @@ BranchInstr* BranchSimplifier::CloneBranch(Zone* zone, return new_branch; } - void BranchSimplifier::Simplify(FlowGraph* flow_graph) { // Optimize some branches that test the value of a phi. When it is safe // to do so, push the branch to each of the predecessor blocks. This is @@ -223,7 +219,6 @@ void BranchSimplifier::Simplify(FlowGraph* flow_graph) { } } - static bool IsTrivialBlock(BlockEntryInstr* block, Definition* defn) { return (block->IsTargetEntry() && (block->PredecessorCount() == 1)) && ((block->next() == block->last_instruction()) || @@ -231,7 +226,6 @@ static bool IsTrivialBlock(BlockEntryInstr* block, Definition* defn) { (defn->next() == block->last_instruction()))); } - static void EliminateTrivialBlock(BlockEntryInstr* block, Definition* instr, IfThenElseInstr* before) { @@ -245,7 +239,6 @@ static void EliminateTrivialBlock(BlockEntryInstr* block, } } - void IfConverter::Simplify(FlowGraph* flow_graph) { Zone* zone = flow_graph->zone(); bool changed = false; @@ -346,5 +339,4 @@ void IfConverter::Simplify(FlowGraph* flow_graph) { } } - } // namespace dart diff --git a/runtime/vm/branch_optimizer.h b/runtime/vm/branch_optimizer.h index 5758a7ce534..c1d77740591 100644 --- a/runtime/vm/branch_optimizer.h +++ b/runtime/vm/branch_optimizer.h @@ -41,7 +41,6 @@ class BranchSimplifier : public AllStatic { Value* new_right); }; - // Rewrite diamond control flow patterns that materialize values to use more // efficient branchless code patterns if such are supported on the current // platform. diff --git a/runtime/vm/cha.cc b/runtime/vm/cha.cc index 83a2bc50b4d..7045001c634 100644 --- a/runtime/vm/cha.cc +++ b/runtime/vm/cha.cc @@ -24,7 +24,6 @@ void CHA::AddToGuardedClasses(const Class& cls, intptr_t subclass_count) { return; } - bool CHA::IsGuardedClass(intptr_t cid) const { for (intptr_t i = 0; i < guarded_classes_.length(); ++i) { if (guarded_classes_[i].cls->id() == cid) return true; @@ -32,7 +31,6 @@ bool CHA::IsGuardedClass(intptr_t cid) const { return false; } - bool CHA::HasSubclasses(const Class& cls) { ASSERT(!cls.IsNull()); ASSERT(cls.id() >= kInstanceCid); @@ -51,14 +49,12 @@ bool CHA::HasSubclasses(const Class& cls) { return !direct_subclasses.IsNull() && (direct_subclasses.Length() > 0); } - bool CHA::HasSubclasses(intptr_t cid) const { const ClassTable& class_table = *thread_->isolate()->class_table(); Class& cls = Class::Handle(thread_->zone(), class_table.At(cid)); return HasSubclasses(cls); } - bool CHA::ConcreteSubclasses(const Class& cls, GrowableArray* class_ids) { if (cls.InVMHeap()) return false; @@ -83,7 +79,6 @@ bool CHA::ConcreteSubclasses(const Class& cls, return true; } - bool CHA::IsImplemented(const Class& cls) { // Function type aliases have different type checking rules. ASSERT(!cls.IsTypedefClass()); @@ -96,7 +91,6 @@ bool CHA::IsImplemented(const Class& cls) { return cls.is_implemented(); } - static intptr_t CountFinalizedSubclasses(Thread* thread, const Class& cls) { intptr_t count = 0; const GrowableObjectArray& cls_direct_subclasses = @@ -116,7 +110,6 @@ static intptr_t CountFinalizedSubclasses(Thread* thread, const Class& cls) { return count; } - bool CHA::IsConsistentWithCurrentHierarchy() const { for (intptr_t i = 0; i < guarded_classes_.length(); i++) { const intptr_t subclass_count = @@ -128,7 +121,6 @@ bool CHA::IsConsistentWithCurrentHierarchy() const { return true; } - bool CHA::HasOverride(const Class& cls, const String& function_name, intptr_t* subclasses_count) { @@ -173,12 +165,10 @@ bool CHA::HasOverride(const Class& cls, return false; } - void CHA::RegisterDependencies(const Code& code) const { for (intptr_t i = 0; i < guarded_classes_.length(); ++i) { guarded_classes_[i].cls->RegisterCHACode(code); } } - } // namespace dart diff --git a/runtime/vm/cha_test.cc b/runtime/vm/cha_test.cc index 873840c261a..978ed918a5e 100644 --- a/runtime/vm/cha_test.cc +++ b/runtime/vm/cha_test.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "platform/assert.h" #include "vm/cha.h" +#include "platform/assert.h" #include "vm/class_finalizer.h" #include "vm/globals.h" #include "vm/symbols.h" @@ -11,7 +11,6 @@ namespace dart { - TEST_CASE(ClassHierarchyAnalysis) { const char* kScriptChars = "class A {" diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc index 1db6629772b..da91d67627f 100644 --- a/runtime/vm/class_finalizer.cc +++ b/runtime/vm/class_finalizer.cc @@ -24,7 +24,6 @@ DEFINE_FLAG(bool, reify, true, "Reify type arguments of generic types."); DEFINE_FLAG(bool, trace_class_finalization, false, "Trace class finalization."); DEFINE_FLAG(bool, trace_type_finalization, false, "Trace type finalization."); - bool ClassFinalizer::AllClassesFinalized() { ObjectStore* object_store = Isolate::Current()->object_store(); const GrowableObjectArray& classes = @@ -32,7 +31,6 @@ bool ClassFinalizer::AllClassesFinalized() { return classes.Length() == 0; } - // Removes optimized code once we load more classes, since CHA based // optimizations may have become invalid. // Only methods which owner classes where subclasses can be invalid. @@ -55,7 +53,6 @@ static void RemoveCHAOptimizedCode( } } - void AddSuperType(const AbstractType& type, GrowableArray* finalized_super_classes) { ASSERT(type.HasResolvedTypeClass()); @@ -77,7 +74,6 @@ void AddSuperType(const AbstractType& type, AddSuperType(super_type, finalized_super_classes); } - // Use array instead of set since we expect very few subclassed classes // to occur. static void CollectFinalizedSuperClasses( @@ -96,7 +92,6 @@ static void CollectFinalizedSuperClasses( } } - static void CollectImmediateSuperInterfaces(const Class& cls, GrowableArray* cids) { const Array& interfaces = Array::Handle(cls.interfaces()); @@ -117,7 +112,6 @@ static void CollectImmediateSuperInterfaces(const Class& cls, } } - // Processing ObjectStore::pending_classes_ occurs: // a) when bootstrap process completes (VerifyBootstrapClasses). // b) after the user classes are loaded (dart_api). @@ -184,7 +178,6 @@ bool ClassFinalizer::ProcessPendingClasses(bool from_kernel) { return true; } - // Adds all interfaces of cls into 'collected'. Duplicate entries may occur. // No cycles are allowed. void ClassFinalizer::CollectInterfaces(const Class& cls, @@ -201,7 +194,6 @@ void ClassFinalizer::CollectInterfaces(const Class& cls, } } - #if !defined(DART_PRECOMPILED_RUNTIME) void ClassFinalizer::VerifyBootstrapClasses() { if (FLAG_trace_class_finalization) { @@ -270,7 +262,6 @@ void ClassFinalizer::VerifyBootstrapClasses() { } #endif // !defined(DART_PRECOMPILED_RUNTIME) - static bool IsLoaded(const Type& type) { if (type.HasResolvedTypeClass()) { return true; @@ -288,7 +279,6 @@ static bool IsLoaded(const Type& type) { } } - // Resolve unresolved_class in the library of cls, or return null. RawClass* ClassFinalizer::ResolveClass( const Class& cls, @@ -313,7 +303,6 @@ RawClass* ClassFinalizer::ResolveClass( return resolved_class.raw(); } - void ClassFinalizer::ResolveRedirectingFactory(const Class& cls, const Function& factory) { const Function& target = Function::Handle(factory.RedirectionTarget()); @@ -333,7 +322,6 @@ void ClassFinalizer::ResolveRedirectingFactory(const Class& cls, } } - void ClassFinalizer::ResolveRedirectingFactoryTarget( const Class& cls, const Function& factory, @@ -482,7 +470,6 @@ void ClassFinalizer::ResolveRedirectingFactoryTarget( factory.SetRedirectionTarget(target_target); } - void ClassFinalizer::ResolveTypeClass(const Class& cls, const Type& type) { if (type.IsFinalized()) { return; @@ -536,7 +523,6 @@ void ClassFinalizer::ResolveTypeClass(const Class& cls, const Type& type) { } } - void ClassFinalizer::ResolveType(const Class& cls, const AbstractType& type) { if (type.IsResolved()) { return; @@ -613,7 +599,6 @@ void ClassFinalizer::ResolveType(const Class& cls, const AbstractType& type) { } } - void ClassFinalizer::FinalizeTypeParameters(const Class& cls, PendingTypes* pending_types) { if (FLAG_trace_type_finalization) { @@ -640,7 +625,6 @@ void ClassFinalizer::FinalizeTypeParameters(const Class& cls, } } - // This function reports a compilation error if the recursive 'type' T being // finalized is a non-contractive type, i.e. if the induced type set S of P is // not finite, where P is the instantiation of T with its own type parameters. @@ -719,7 +703,6 @@ void ClassFinalizer::CheckRecursiveType(const Class& cls, } } - // Expand the type arguments of the given type and finalize its full type // argument vector. Return the number of type arguments (0 for a raw type). intptr_t ClassFinalizer::ExpandAndFinalizeTypeArguments( @@ -839,7 +822,6 @@ intptr_t ClassFinalizer::ExpandAndFinalizeTypeArguments( return full_arguments.IsNull() ? 0 : full_arguments.Length(); } - // Finalize the type argument vector 'arguments' of the type defined by the // class 'cls' parameterized with the type arguments 'cls_args'. // The vector 'cls_args' is already initialized as a subvector at the correct @@ -1004,7 +986,6 @@ void ClassFinalizer::FinalizeTypeArguments(const Class& cls, } } - // Check the type argument vector 'arguments' against the corresponding bounds // of the type parameters of class 'cls' and, recursively, of its superclasses. // Replace a type argument that cannot be checked at compile time by a @@ -1083,9 +1064,8 @@ void ClassFinalizer::CheckTypeArgumentBounds(const Class& cls, } // Shortcut the special case where we check a type parameter against its // declared upper bound. - if (error.IsNull() && - !(type_arg.Equals(type_param) && - instantiated_bound.Equals(declared_bound))) { + if (error.IsNull() && !(type_arg.Equals(type_param) && + instantiated_bound.Equals(declared_bound))) { // If type_arg is a type parameter, its declared bound may not be // finalized yet. if (type_arg.IsTypeParameter()) { @@ -1120,7 +1100,6 @@ void ClassFinalizer::CheckTypeArgumentBounds(const Class& cls, } } - void ClassFinalizer::CheckTypeBounds(const Class& cls, const AbstractType& type) { Zone* zone = Thread::Current()->zone(); @@ -1163,7 +1142,6 @@ void ClassFinalizer::CheckTypeBounds(const Class& cls, } } - RawAbstractType* ClassFinalizer::FinalizeType(const Class& cls, const AbstractType& type, FinalizationKind finalization, @@ -1349,7 +1327,6 @@ RawAbstractType* ClassFinalizer::FinalizeType(const Class& cls, } } - void ClassFinalizer::ResolveSignature(const Class& cls, const Function& function) { AbstractType& type = AbstractType::Handle(); @@ -1378,7 +1355,6 @@ void ClassFinalizer::ResolveSignature(const Class& cls, } } - void ClassFinalizer::FinalizeSignature(const Class& cls, const Function& function, FinalizationKind finalization) { @@ -1423,7 +1399,6 @@ void ClassFinalizer::FinalizeSignature(const Class& cls, } } - // Check if an instance field, getter, or method of same name exists // in any super class. static RawClass* FindSuperOwnerOfInstanceMember(const Class& cls, @@ -1451,7 +1426,6 @@ static RawClass* FindSuperOwnerOfInstanceMember(const Class& cls, return Class::null(); } - // Check if an instance method of same name exists in any super class. static RawClass* FindSuperOwnerOfFunction(const Class& cls, const String& name) { @@ -1469,7 +1443,6 @@ static RawClass* FindSuperOwnerOfFunction(const Class& cls, return Class::null(); } - // Resolve the upper bounds of the type parameters of class cls. void ClassFinalizer::ResolveUpperBounds(const Class& cls) { const intptr_t num_type_params = cls.NumTypeParameters(); @@ -1488,7 +1461,6 @@ void ClassFinalizer::ResolveUpperBounds(const Class& cls) { } } - // Finalize the upper bounds of the type parameters of class cls. void ClassFinalizer::FinalizeUpperBounds(const Class& cls, FinalizationKind finalization) { @@ -1512,7 +1484,6 @@ void ClassFinalizer::FinalizeUpperBounds(const Class& cls, } } - void ClassFinalizer::ResolveAndFinalizeMemberTypes(const Class& cls) { // Note that getters and setters are explicitly listed as such in the list of // functions of a class, so we do not need to consider fields as implicitly @@ -1772,7 +1743,6 @@ void ClassFinalizer::ResolveAndFinalizeMemberTypes(const Class& cls) { } } - // Clone the type parameters of the super class and of the mixin class of this // mixin application class and use them as the type parameters of this mixin // application class. Set the type arguments of the super type, of the mixin @@ -1964,7 +1934,6 @@ void ClassFinalizer::CloneMixinAppTypeParameters(const Class& mixin_app_class) { } } - /* Support for mixin alias. Consider the following example: @@ -2234,7 +2203,6 @@ void ClassFinalizer::ApplyMixinAppAlias(const Class& mixin_app_class, } } - void ClassFinalizer::ApplyMixinType(const Class& mixin_app_class, PendingTypes* pending_types) { if (mixin_app_class.is_mixin_type_applied()) { @@ -2293,7 +2261,6 @@ void ClassFinalizer::ApplyMixinType(const Class& mixin_app_class, mixin_app_class.set_mixin(mixin_type); } - void ClassFinalizer::CreateForwardingConstructors( const Class& mixin_app, const Class& mixin_cls, @@ -2356,7 +2323,6 @@ void ClassFinalizer::CreateForwardingConstructors( } } - void ClassFinalizer::ApplyMixinMembers(const Class& cls) { Zone* zone = Thread::Current()->zone(); const Type& mixin_type = Type::Handle(zone, cls.mixin()); @@ -2456,7 +2422,6 @@ void ClassFinalizer::ApplyMixinMembers(const Class& cls) { } } - void ClassFinalizer::FinalizeTypesInClass(const Class& cls) { Thread* thread = Thread::Current(); HANDLESCOPE(thread); @@ -2615,7 +2580,6 @@ void ClassFinalizer::FinalizeTypesInClass(const Class& cls) { } } - void ClassFinalizer::FinalizeClass(const Class& cls) { Thread* thread = Thread::Current(); HANDLESCOPE(thread); @@ -2692,7 +2656,6 @@ void ClassFinalizer::FinalizeClass(const Class& cls) { } } - // Allocate instances for each enumeration value, and populate the // static field 'values'. // By allocating the instances programmatically, we save an implicit final @@ -2773,7 +2736,6 @@ void ClassFinalizer::AllocateEnumValues(const Class& enum_cls) { ASSERT(!values_list.IsNull()); } - bool ClassFinalizer::IsSuperCycleFree(const Class& cls) { Class& test1 = Class::Handle(cls.raw()); Class& test2 = Class::Handle(cls.SuperClass()); @@ -2795,7 +2757,6 @@ bool ClassFinalizer::IsSuperCycleFree(const Class& cls) { return true; } - // Returns false if a function type alias illegally refers to itself. bool ClassFinalizer::IsTypedefCycleFree(const Class& cls, const AbstractType& type, @@ -2870,7 +2831,6 @@ bool ClassFinalizer::IsTypedefCycleFree(const Class& cls, return true; } - // Returns false if the mixin illegally refers to itself. bool ClassFinalizer::IsMixinCycleFree(const Class& cls, GrowableArray* visited) { @@ -2902,7 +2862,6 @@ bool ClassFinalizer::IsMixinCycleFree(const Class& cls, return true; } - void ClassFinalizer::CollectTypeArguments( const Class& cls, const Type& type, @@ -2939,7 +2898,6 @@ void ClassFinalizer::CollectTypeArguments( } } - RawType* ClassFinalizer::ResolveMixinAppType( const Class& cls, const MixinAppType& mixin_app_type) { @@ -3106,7 +3064,6 @@ RawType* ClassFinalizer::ResolveMixinAppType( return Type::New(mixin_app_class, mixin_app_args, mixin_app_type.token_pos()); } - // Recursively walks the graph of explicitly declared super type and // interfaces, resolving unresolved super types and interfaces. // Reports an error if there is an interface reference that cannot be @@ -3293,7 +3250,6 @@ void ClassFinalizer::ResolveSuperTypeAndInterfaces( cls.set_is_cycle_free(); } - // A class is marked as constant if it has one constant constructor. // A constant class can only have final instance fields. // Note: we must check for cycles before checking for const properties. @@ -3314,7 +3270,6 @@ void ClassFinalizer::CheckForLegalConstClass(const Class& cls) { } } - void ClassFinalizer::PrintClassInformation(const Class& cls) { Thread* thread = Thread::Current(); HANDLESCOPE(thread); @@ -3388,7 +3343,6 @@ void ClassFinalizer::MarkTypeMalformed(const Error& prev_error, } } - RawType* ClassFinalizer::NewFinalizedMalformedType(const Error& prev_error, const Script& script, TokenPosition type_pos, @@ -3408,7 +3362,6 @@ RawType* ClassFinalizer::NewFinalizedMalformedType(const Error& prev_error, return type.raw(); } - void ClassFinalizer::FinalizeMalformedType(const Error& prev_error, const Script& script, const Type& type, @@ -3420,7 +3373,6 @@ void ClassFinalizer::FinalizeMalformedType(const Error& prev_error, va_end(args); } - void ClassFinalizer::FinalizeMalboundedType(const Error& prev_error, const Script& script, const AbstractType& type, @@ -3442,13 +3394,11 @@ void ClassFinalizer::FinalizeMalboundedType(const Error& prev_error, } } - void ClassFinalizer::ReportError(const Error& error) { Report::LongJump(error); UNREACHABLE(); } - void ClassFinalizer::ReportErrors(const Error& prev_error, const Class& cls, TokenPosition token_pos, @@ -3462,7 +3412,6 @@ void ClassFinalizer::ReportErrors(const Error& prev_error, UNREACHABLE(); } - void ClassFinalizer::ReportError(const Class& cls, TokenPosition token_pos, const char* format, @@ -3476,7 +3425,6 @@ void ClassFinalizer::ReportError(const Class& cls, UNREACHABLE(); } - void ClassFinalizer::VerifyImplicitFieldOffsets() { #ifdef DEBUG Thread* thread = Thread::Current(); @@ -3550,7 +3498,6 @@ void ClassFinalizer::VerifyImplicitFieldOffsets() { #endif } - void ClassFinalizer::SortClasses() { Thread* T = Thread::Current(); Zone* Z = T->zone(); @@ -3624,7 +3571,6 @@ void ClassFinalizer::SortClasses() { RehashTypes(); // Types use cid's as part of their hashes. } - class CidRewriteVisitor : public ObjectVisitor { public: explicit CidRewriteVisitor(intptr_t* old_to_new_cids) @@ -3669,7 +3615,6 @@ class CidRewriteVisitor : public ObjectVisitor { intptr_t* old_to_new_cids_; }; - void ClassFinalizer::RemapClassIds(intptr_t* old_to_new_cid) { Isolate* I = Thread::Current()->isolate(); @@ -3699,7 +3644,6 @@ void ClassFinalizer::RemapClassIds(intptr_t* old_to_new_cid) { #endif } - class ClearTypeHashVisitor : public ObjectVisitor { public: explicit ClearTypeHashVisitor(Zone* zone) @@ -3731,7 +3675,6 @@ class ClearTypeHashVisitor : public ObjectVisitor { BoundedType& bounded_type_; }; - void ClassFinalizer::RehashTypes() { Thread* T = Thread::Current(); Zone* Z = T->zone(); @@ -3798,7 +3741,6 @@ void ClassFinalizer::RehashTypes() { object_store->set_canonical_type_arguments(typeargs_table.Release()); } - void ClassFinalizer::ClearAllCode() { class ClearCodeFunctionVisitor : public FunctionVisitor { void Visit(const Function& function) { diff --git a/runtime/vm/class_finalizer_test.cc b/runtime/vm/class_finalizer_test.cc index d2acc4a7317..2ccd1d0eec2 100644 --- a/runtime/vm/class_finalizer_test.cc +++ b/runtime/vm/class_finalizer_test.cc @@ -2,14 +2,13 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "platform/assert.h" #include "vm/class_finalizer.h" +#include "platform/assert.h" #include "vm/symbols.h" #include "vm/unit_test.h" namespace dart { - static RawClass* CreateTestClass(const char* name) { const String& class_name = String::Handle(Symbols::New(Thread::Current(), name)); @@ -22,7 +21,6 @@ static RawClass* CreateTestClass(const char* name) { return cls.raw(); } - TEST_CASE(ClassFinalizer) { Zone* zone = thread->zone(); Isolate* isolate = thread->isolate(); @@ -53,7 +51,6 @@ TEST_CASE(ClassFinalizer) { EXPECT(ClassFinalizer::ProcessPendingClasses()); } - TEST_CASE(ClassFinalize_Cycles) { Zone* zone = thread->zone(); Isolate* isolate = thread->isolate(); @@ -73,13 +70,11 @@ TEST_CASE(ClassFinalize_Cycles) { EXPECT(!ClassFinalizer::ProcessPendingClasses()); } - static RawLibrary* NewLib(const char* url_chars) { String& url = String::ZoneHandle(Symbols::New(Thread::Current(), url_chars)); return Library::New(url); } - TEST_CASE(ClassFinalize_Resolve) { Zone* zone = thread->zone(); Isolate* isolate = thread->isolate(); diff --git a/runtime/vm/class_table.cc b/runtime/vm/class_table.cc index b71efb7c5d6..0bf1d1a02f4 100644 --- a/runtime/vm/class_table.cc +++ b/runtime/vm/class_table.cc @@ -59,7 +59,6 @@ ClassTable::ClassTable() #endif // !PRODUCT } - ClassTable::ClassTable(ClassTable* original) : top_(original->top_), capacity_(original->top_), @@ -69,7 +68,6 @@ ClassTable::ClassTable(ClassTable* original) NOT_IN_PRODUCT(predefined_class_heap_stats_table_ = NULL); } - ClassTable::~ClassTable() { if (old_tables_ != NULL) { FreeOldTables(); @@ -84,34 +82,29 @@ ClassTable::~ClassTable() { } } - void ClassTable::AddOldTable(RawClass** old_table) { ASSERT(Thread::Current()->IsMutatorThread()); old_tables_->Add(old_table); } - void ClassTable::FreeOldTables() { while (old_tables_->length() > 0) { free(old_tables_->RemoveLast()); } } - #ifndef PRODUCT void ClassTable::SetTraceAllocationFor(intptr_t cid, bool trace) { ClassHeapStats* stats = PreliminaryStatsAt(cid); stats->set_trace_allocation(trace); } - bool ClassTable::TraceAllocationFor(intptr_t cid) { ClassHeapStats* stats = PreliminaryStatsAt(cid); return stats->trace_allocation(); } #endif // !PRODUCT - void ClassTable::Register(const Class& cls) { ASSERT(Thread::Current()->IsMutatorThread()); intptr_t index = cls.id(); @@ -162,7 +155,6 @@ void ClassTable::Register(const Class& cls) { } } - void ClassTable::AllocateIndex(intptr_t index) { if (index >= capacity_) { // Grow the capacity of the class table. @@ -197,7 +189,6 @@ void ClassTable::AllocateIndex(intptr_t index) { } } - void ClassTable::RegisterAt(intptr_t index, const Class& cls) { ASSERT(Thread::Current()->IsMutatorThread()); ASSERT(index != kIllegalCid); @@ -207,14 +198,12 @@ void ClassTable::RegisterAt(intptr_t index, const Class& cls) { table_[index] = cls.raw(); } - #if defined(DEBUG) void ClassTable::Unregister(intptr_t index) { table_[index] = 0; } #endif - void ClassTable::Remap(intptr_t* old_to_new_cid) { ASSERT(Thread::Current()->no_safepoint_scope_depth() > 0); intptr_t num_cids = NumCids(); @@ -228,13 +217,11 @@ void ClassTable::Remap(intptr_t* old_to_new_cid) { delete[] cls_by_old_cid; } - void ClassTable::VisitObjectPointers(ObjectPointerVisitor* visitor) { ASSERT(visitor != NULL); visitor->VisitPointers(reinterpret_cast(&table_[0]), top_); } - void ClassTable::Validate() { Class& cls = Class::Handle(); for (intptr_t cid = kNumPredefinedCids; cid < top_; cid++) { @@ -253,7 +240,6 @@ void ClassTable::Validate() { } } - void ClassTable::Print() { Class& cls = Class::Handle(); String& name = String::Handle(); @@ -270,7 +256,6 @@ void ClassTable::Print() { } } - #ifndef PRODUCT void ClassTable::PrintToJSONObject(JSONObject* object) { if (!FLAG_support_service) { @@ -289,7 +274,6 @@ void ClassTable::PrintToJSONObject(JSONObject* object) { } } - void ClassHeapStats::Initialize() { pre_gc.Reset(); post_gc.Reset(); @@ -302,7 +286,6 @@ void ClassHeapStats::Initialize() { USE(align_); } - void ClassHeapStats::ResetAtNewGC() { Verify(); pre_gc.new_count = post_gc.new_count + recent.new_count; @@ -317,7 +300,6 @@ void ClassHeapStats::ResetAtNewGC() { old_pre_new_gc_size_ = recent.old_size; } - void ClassHeapStats::ResetAtOldGC() { Verify(); pre_gc.old_count = post_gc.old_count + recent.old_count; @@ -330,7 +312,6 @@ void ClassHeapStats::ResetAtOldGC() { recent.ResetOld(); } - void ClassHeapStats::Verify() { pre_gc.Verify(); post_gc.Verify(); @@ -339,7 +320,6 @@ void ClassHeapStats::Verify() { last_reset.Verify(); } - void ClassHeapStats::UpdateSize(intptr_t instance_size) { pre_gc.UpdateSize(instance_size); post_gc.UpdateSize(instance_size); @@ -350,7 +330,6 @@ void ClassHeapStats::UpdateSize(intptr_t instance_size) { old_pre_new_gc_size_ = old_pre_new_gc_count_ * instance_size; } - void ClassHeapStats::ResetAccumulator() { // Remember how much was allocated so we can subtract this from the result // when printing. @@ -361,13 +340,11 @@ void ClassHeapStats::ResetAccumulator() { accumulated.Reset(); } - void ClassHeapStats::UpdatePromotedAfterNewGC() { promoted_count = recent.old_count - old_pre_new_gc_count_; promoted_size = recent.old_size - old_pre_new_gc_size_; } - void ClassHeapStats::PrintToJSONObject(const Class& cls, JSONObject* obj) const { if (!FLAG_support_service) { @@ -405,7 +382,6 @@ void ClassHeapStats::PrintToJSONObject(const Class& cls, obj->AddProperty("promotedBytes", promoted_size); } - void ClassTable::UpdateAllocatedNew(intptr_t cid, intptr_t size) { ClassHeapStats* stats = PreliminaryStatsAt(cid); ASSERT(stats != NULL); @@ -413,7 +389,6 @@ void ClassTable::UpdateAllocatedNew(intptr_t cid, intptr_t size) { stats->recent.AddNew(size); } - void ClassTable::UpdateAllocatedOld(intptr_t cid, intptr_t size) { ClassHeapStats* stats = PreliminaryStatsAt(cid); ASSERT(stats != NULL); @@ -421,12 +396,10 @@ void ClassTable::UpdateAllocatedOld(intptr_t cid, intptr_t size) { stats->recent.AddOld(size); } - bool ClassTable::ShouldUpdateSizeForClassId(intptr_t cid) { return !RawObject::IsVariableSizeClassId(cid); } - ClassHeapStats* ClassTable::PreliminaryStatsAt(intptr_t cid) { ASSERT(cid > 0); if (cid < kNumPredefinedCids) { @@ -436,7 +409,6 @@ ClassHeapStats* ClassTable::PreliminaryStatsAt(intptr_t cid) { return &class_heap_stats_table_[cid]; } - ClassHeapStats* ClassTable::StatsWithUpdatedSize(intptr_t cid) { if (!HasValidClassAt(cid) || (cid == kFreeListElement) || (cid == kForwardingCorpse) || (cid == kSmiCid)) { @@ -455,7 +427,6 @@ ClassHeapStats* ClassTable::StatsWithUpdatedSize(intptr_t cid) { return stats; } - void ClassTable::ResetCountersOld() { for (intptr_t i = 0; i < kNumPredefinedCids; i++) { predefined_class_heap_stats_table_[i].ResetAtOldGC(); @@ -465,7 +436,6 @@ void ClassTable::ResetCountersOld() { } } - void ClassTable::ResetCountersNew() { for (intptr_t i = 0; i < kNumPredefinedCids; i++) { predefined_class_heap_stats_table_[i].ResetAtNewGC(); @@ -475,7 +445,6 @@ void ClassTable::ResetCountersNew() { } } - void ClassTable::UpdatePromoted() { for (intptr_t i = 0; i < kNumPredefinedCids; i++) { predefined_class_heap_stats_table_[i].UpdatePromotedAfterNewGC(); @@ -485,25 +454,21 @@ void ClassTable::UpdatePromoted() { } } - ClassHeapStats** ClassTable::TableAddressFor(intptr_t cid) { return (cid < kNumPredefinedCids) ? &predefined_class_heap_stats_table_ : &class_heap_stats_table_; } - intptr_t ClassTable::TableOffsetFor(intptr_t cid) { return (cid < kNumPredefinedCids) ? OFFSET_OF(ClassTable, predefined_class_heap_stats_table_) : OFFSET_OF(ClassTable, class_heap_stats_table_); } - intptr_t ClassTable::ClassOffsetFor(intptr_t cid) { return cid * sizeof(ClassHeapStats); // NOLINT } - intptr_t ClassTable::CounterOffsetFor(intptr_t cid, bool is_new_space) { const intptr_t class_offset = ClassOffsetFor(cid); const intptr_t count_field_offset = @@ -512,12 +477,10 @@ intptr_t ClassTable::CounterOffsetFor(intptr_t cid, bool is_new_space) { return class_offset + count_field_offset; } - intptr_t ClassTable::StateOffsetFor(intptr_t cid) { return ClassOffsetFor(cid) + ClassHeapStats::state_offset(); } - intptr_t ClassTable::SizeOffsetFor(intptr_t cid, bool is_new_space) { const uword class_offset = ClassOffsetFor(cid); const uword size_field_offset = @@ -526,7 +489,6 @@ intptr_t ClassTable::SizeOffsetFor(intptr_t cid, bool is_new_space) { return class_offset + size_field_offset; } - void ClassTable::AllocationProfilePrintJSON(JSONStream* stream) { if (!FLAG_support_service) { return; @@ -566,7 +528,6 @@ void ClassTable::AllocationProfilePrintJSON(JSONStream* stream) { } } - void ClassTable::ResetAllocationAccumulators() { for (intptr_t i = 1; i < top_; i++) { ClassHeapStats* stats = StatsWithUpdatedSize(i); @@ -576,7 +537,6 @@ void ClassTable::ResetAllocationAccumulators() { } } - void ClassTable::UpdateLiveOld(intptr_t cid, intptr_t size, intptr_t count) { ClassHeapStats* stats = PreliminaryStatsAt(cid); ASSERT(stats != NULL); @@ -585,7 +545,6 @@ void ClassTable::UpdateLiveOld(intptr_t cid, intptr_t size, intptr_t count) { stats->post_gc.AddOld(size, count); } - void ClassTable::UpdateLiveNew(intptr_t cid, intptr_t size) { ClassHeapStats* stats = PreliminaryStatsAt(cid); ASSERT(stats != NULL); @@ -594,5 +553,4 @@ void ClassTable::UpdateLiveNew(intptr_t cid, intptr_t size) { } #endif // !PRODUCT - } // namespace dart diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc index 29e64aa7785..de332128c22 100644 --- a/runtime/vm/clustered_snapshot.cc +++ b/runtime/vm/clustered_snapshot.cc @@ -33,7 +33,6 @@ static RawObject* AllocateUninitialized(PageSpace* old_space, intptr_t size) { return reinterpret_cast(address + kHeapObjectTag); } - void Deserializer::InitializeHeader(RawObject* raw, intptr_t class_id, intptr_t size, @@ -51,7 +50,6 @@ void Deserializer::InitializeHeader(RawObject* raw, #endif } - #if !defined(DART_PRECOMPILED_RUNTIME) class ClassSerializationCluster : public SerializationCluster { public: @@ -136,7 +134,6 @@ class ClassSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class ClassDeserializationCluster : public DeserializationCluster { public: ClassDeserializationCluster() {} @@ -251,7 +248,6 @@ class ClassDeserializationCluster : public DeserializationCluster { intptr_t predefined_stop_index_; }; - #if !defined(DART_PRECOMPILED_RUNTIME) class UnresolvedClassSerializationCluster : public SerializationCluster { public: @@ -298,7 +294,6 @@ class UnresolvedClassSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class UnresolvedClassDeserializationCluster : public DeserializationCluster { public: UnresolvedClassDeserializationCluster() {} @@ -334,7 +329,6 @@ class UnresolvedClassDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class TypeArgumentsSerializationCluster : public SerializationCluster { public: @@ -385,7 +379,6 @@ class TypeArgumentsSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class TypeArgumentsDeserializationCluster : public DeserializationCluster { public: TypeArgumentsDeserializationCluster() {} @@ -426,7 +419,6 @@ class TypeArgumentsDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class PatchClassSerializationCluster : public SerializationCluster { public: @@ -471,7 +463,6 @@ class PatchClassSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class PatchClassDeserializationCluster : public DeserializationCluster { public: PatchClassDeserializationCluster() {} @@ -504,7 +495,6 @@ class PatchClassDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class FunctionSerializationCluster : public SerializationCluster { public: @@ -586,7 +576,6 @@ class FunctionSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class FunctionDeserializationCluster : public DeserializationCluster { public: FunctionDeserializationCluster() {} @@ -697,7 +686,6 @@ class FunctionDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class ClosureDataSerializationCluster : public SerializationCluster { public: @@ -744,7 +732,6 @@ class ClosureDataSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class ClosureDataDeserializationCluster : public DeserializationCluster { public: ClosureDataDeserializationCluster() {} @@ -782,7 +769,6 @@ class ClosureDataDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class SignatureDataSerializationCluster : public SerializationCluster { public: @@ -827,7 +813,6 @@ class SignatureDataSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class SignatureDataDeserializationCluster : public DeserializationCluster { public: SignatureDataDeserializationCluster() {} @@ -860,7 +845,6 @@ class SignatureDataDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class RedirectionDataSerializationCluster : public SerializationCluster { public: @@ -905,7 +889,6 @@ class RedirectionDataSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class RedirectionDataDeserializationCluster : public DeserializationCluster { public: RedirectionDataDeserializationCluster() {} @@ -940,7 +923,6 @@ class RedirectionDataDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class FieldSerializationCluster : public SerializationCluster { public: @@ -1050,7 +1032,6 @@ class FieldSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class FieldDeserializationCluster : public DeserializationCluster { public: FieldDeserializationCluster() {} @@ -1116,7 +1097,6 @@ class FieldDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class LiteralTokenSerializationCluster : public SerializationCluster { public: @@ -1162,7 +1142,6 @@ class LiteralTokenSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class LiteralTokenDeserializationCluster : public DeserializationCluster { public: LiteralTokenDeserializationCluster() {} @@ -1196,7 +1175,6 @@ class LiteralTokenDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class TokenStreamSerializationCluster : public SerializationCluster { public: @@ -1241,7 +1219,6 @@ class TokenStreamSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class TokenStreamDeserializationCluster : public DeserializationCluster { public: TokenStreamDeserializationCluster() {} @@ -1274,7 +1251,6 @@ class TokenStreamDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class ScriptSerializationCluster : public SerializationCluster { public: @@ -1324,7 +1300,6 @@ class ScriptSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class ScriptDeserializationCluster : public DeserializationCluster { public: ScriptDeserializationCluster() {} @@ -1366,7 +1341,6 @@ class ScriptDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class LibrarySerializationCluster : public SerializationCluster { public: @@ -1418,7 +1392,6 @@ class LibrarySerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class LibraryDeserializationCluster : public DeserializationCluster { public: LibraryDeserializationCluster() {} @@ -1464,7 +1437,6 @@ class LibraryDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class NamespaceSerializationCluster : public SerializationCluster { public: @@ -1509,7 +1481,6 @@ class NamespaceSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class NamespaceDeserializationCluster : public DeserializationCluster { public: NamespaceDeserializationCluster() {} @@ -1541,7 +1512,6 @@ class NamespaceDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class CodeSerializationCluster : public SerializationCluster { public: @@ -1651,7 +1621,6 @@ class CodeSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class CodeDeserializationCluster : public DeserializationCluster { public: CodeDeserializationCluster() {} @@ -1746,7 +1715,6 @@ class CodeDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class ObjectPoolSerializationCluster : public SerializationCluster { public: @@ -1835,7 +1803,6 @@ class ObjectPoolSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class ObjectPoolDeserializationCluster : public DeserializationCluster { public: ObjectPoolDeserializationCluster() {} @@ -1899,7 +1866,6 @@ class ObjectPoolDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) // PcDescriptor, StackMap, OneByteString, TwoByteString class RODataSerializationCluster : public SerializationCluster { @@ -1953,7 +1919,6 @@ class RODataSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class RODataDeserializationCluster : public DeserializationCluster { public: RODataDeserializationCluster() {} @@ -1972,7 +1937,6 @@ class RODataDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class ExceptionHandlersSerializationCluster : public SerializationCluster { public: @@ -2017,7 +1981,6 @@ class ExceptionHandlersSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class ExceptionHandlersDeserializationCluster : public DeserializationCluster { public: ExceptionHandlersDeserializationCluster() {} @@ -2103,7 +2066,6 @@ class ContextSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class ContextDeserializationCluster : public DeserializationCluster { public: ContextDeserializationCluster() {} @@ -2138,7 +2100,6 @@ class ContextDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class ContextScopeSerializationCluster : public SerializationCluster { public: @@ -2189,7 +2150,6 @@ class ContextScopeSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class ContextScopeDeserializationCluster : public DeserializationCluster { public: ContextScopeDeserializationCluster() {} @@ -2227,7 +2187,6 @@ class ContextScopeDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class UnlinkedCallSerializationCluster : public SerializationCluster { public: @@ -2272,7 +2231,6 @@ class UnlinkedCallSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class UnlinkedCallDeserializationCluster : public DeserializationCluster { public: UnlinkedCallDeserializationCluster() {} @@ -2307,7 +2265,6 @@ class UnlinkedCallDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class ICDataSerializationCluster : public SerializationCluster { public: @@ -2360,7 +2317,6 @@ class ICDataSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class ICDataDeserializationCluster : public DeserializationCluster { public: ICDataDeserializationCluster() {} @@ -2402,7 +2358,6 @@ class ICDataDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class MegamorphicCacheSerializationCluster : public SerializationCluster { public: @@ -2448,7 +2403,6 @@ class MegamorphicCacheSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class MegamorphicCacheDeserializationCluster : public DeserializationCluster { public: MegamorphicCacheDeserializationCluster() {} @@ -2484,7 +2438,6 @@ class MegamorphicCacheDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class SubtypeTestCacheSerializationCluster : public SerializationCluster { public: @@ -2520,7 +2473,6 @@ class SubtypeTestCacheSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class SubtypeTestCacheDeserializationCluster : public DeserializationCluster { public: SubtypeTestCacheDeserializationCluster() {} @@ -2551,7 +2503,6 @@ class SubtypeTestCacheDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class LanguageErrorSerializationCluster : public SerializationCluster { public: @@ -2599,7 +2550,6 @@ class LanguageErrorSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class LanguageErrorDeserializationCluster : public DeserializationCluster { public: LanguageErrorDeserializationCluster() {} @@ -2636,7 +2586,6 @@ class LanguageErrorDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class UnhandledExceptionSerializationCluster : public SerializationCluster { public: @@ -2681,7 +2630,6 @@ class UnhandledExceptionSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class UnhandledExceptionDeserializationCluster : public DeserializationCluster { public: UnhandledExceptionDeserializationCluster() {} @@ -2716,7 +2664,6 @@ class UnhandledExceptionDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class InstanceSerializationCluster : public SerializationCluster { public: @@ -2781,7 +2728,6 @@ class InstanceSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class InstanceDeserializationCluster : public DeserializationCluster { public: explicit InstanceDeserializationCluster(intptr_t cid) : cid_(cid) {} @@ -2835,7 +2781,6 @@ class InstanceDeserializationCluster : public DeserializationCluster { intptr_t instance_size_in_words_; }; - #if !defined(DART_PRECOMPILED_RUNTIME) class LibraryPrefixSerializationCluster : public SerializationCluster { public: @@ -2883,7 +2828,6 @@ class LibraryPrefixSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class LibraryPrefixDeserializationCluster : public DeserializationCluster { public: LibraryPrefixDeserializationCluster() {} @@ -2927,7 +2871,6 @@ class LibraryPrefixDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class TypeSerializationCluster : public SerializationCluster { public: @@ -3006,7 +2949,6 @@ class TypeSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class TypeDeserializationCluster : public DeserializationCluster { public: TypeDeserializationCluster() {} @@ -3065,7 +3007,6 @@ class TypeDeserializationCluster : public DeserializationCluster { intptr_t canonical_stop_index_; }; - #if !defined(DART_PRECOMPILED_RUNTIME) class TypeRefSerializationCluster : public SerializationCluster { public: @@ -3110,7 +3051,6 @@ class TypeRefSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class TypeRefDeserializationCluster : public DeserializationCluster { public: TypeRefDeserializationCluster() {} @@ -3142,7 +3082,6 @@ class TypeRefDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class TypeParameterSerializationCluster : public SerializationCluster { public: @@ -3192,7 +3131,6 @@ class TypeParameterSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class TypeParameterDeserializationCluster : public DeserializationCluster { public: TypeParameterDeserializationCluster() {} @@ -3229,7 +3167,6 @@ class TypeParameterDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class BoundedTypeSerializationCluster : public SerializationCluster { public: @@ -3274,7 +3211,6 @@ class BoundedTypeSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class BoundedTypeDeserializationCluster : public DeserializationCluster { public: BoundedTypeDeserializationCluster() {} @@ -3307,7 +3243,6 @@ class BoundedTypeDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class ClosureSerializationCluster : public SerializationCluster { public: @@ -3353,7 +3288,6 @@ class ClosureSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class ClosureDeserializationCluster : public DeserializationCluster { public: ClosureDeserializationCluster() {} @@ -3387,7 +3321,6 @@ class ClosureDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class MintSerializationCluster : public SerializationCluster { public: @@ -3430,7 +3363,6 @@ class MintSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class MintDeserializationCluster : public DeserializationCluster { public: MintDeserializationCluster() {} @@ -3482,7 +3414,6 @@ class MintDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class BigintSerializationCluster : public SerializationCluster { public: @@ -3528,7 +3459,6 @@ class BigintSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class BigintDeserializationCluster : public DeserializationCluster { public: BigintDeserializationCluster() {} @@ -3561,7 +3491,6 @@ class BigintDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class DoubleSerializationCluster : public SerializationCluster { public: @@ -3597,7 +3526,6 @@ class DoubleSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class DoubleDeserializationCluster : public DeserializationCluster { public: DoubleDeserializationCluster() {} @@ -3626,7 +3554,6 @@ class DoubleDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class GrowableObjectArraySerializationCluster : public SerializationCluster { public: @@ -3672,7 +3599,6 @@ class GrowableObjectArraySerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class GrowableObjectArrayDeserializationCluster : public DeserializationCluster { public: @@ -3709,7 +3635,6 @@ class GrowableObjectArrayDeserializationCluster } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class TypedDataSerializationCluster : public SerializationCluster { public: @@ -3752,7 +3677,6 @@ class TypedDataSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class TypedDataDeserializationCluster : public DeserializationCluster { public: explicit TypedDataDeserializationCluster(intptr_t cid) : cid_(cid) {} @@ -3793,7 +3717,6 @@ class TypedDataDeserializationCluster : public DeserializationCluster { const intptr_t cid_; }; - #if !defined(DART_PRECOMPILED_RUNTIME) class ExternalTypedDataSerializationCluster : public SerializationCluster { public: @@ -3834,7 +3757,6 @@ class ExternalTypedDataSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class ExternalTypedDataDeserializationCluster : public DeserializationCluster { public: explicit ExternalTypedDataDeserializationCluster(intptr_t cid) : cid_(cid) {} @@ -3872,7 +3794,6 @@ class ExternalTypedDataDeserializationCluster : public DeserializationCluster { const intptr_t cid_; }; - #if !defined(DART_PRECOMPILED_RUNTIME) class StackTraceSerializationCluster : public SerializationCluster { public: @@ -3917,7 +3838,6 @@ class StackTraceSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class StackTraceDeserializationCluster : public DeserializationCluster { public: StackTraceDeserializationCluster() {} @@ -3950,7 +3870,6 @@ class StackTraceDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class RegExpSerializationCluster : public SerializationCluster { public: @@ -3998,7 +3917,6 @@ class RegExpSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class RegExpDeserializationCluster : public DeserializationCluster { public: RegExpDeserializationCluster() {} @@ -4033,7 +3951,6 @@ class RegExpDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class WeakPropertySerializationCluster : public SerializationCluster { public: @@ -4078,7 +3995,6 @@ class WeakPropertySerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class WeakPropertyDeserializationCluster : public DeserializationCluster { public: WeakPropertyDeserializationCluster() {} @@ -4113,7 +4029,6 @@ class WeakPropertyDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class LinkedHashMapSerializationCluster : public SerializationCluster { public: @@ -4182,7 +4097,6 @@ class LinkedHashMapSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class LinkedHashMapDeserializationCluster : public DeserializationCluster { public: LinkedHashMapDeserializationCluster() {} @@ -4241,7 +4155,6 @@ class LinkedHashMapDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class ArraySerializationCluster : public SerializationCluster { public: @@ -4291,7 +4204,6 @@ class ArraySerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class ArrayDeserializationCluster : public DeserializationCluster { public: explicit ArrayDeserializationCluster(intptr_t cid) : cid_(cid) {} @@ -4331,7 +4243,6 @@ class ArrayDeserializationCluster : public DeserializationCluster { const intptr_t cid_; }; - #if !defined(DART_PRECOMPILED_RUNTIME) class OneByteStringSerializationCluster : public SerializationCluster { public: @@ -4373,7 +4284,6 @@ class OneByteStringSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class OneByteStringDeserializationCluster : public DeserializationCluster { public: OneByteStringDeserializationCluster() {} @@ -4410,7 +4320,6 @@ class OneByteStringDeserializationCluster : public DeserializationCluster { } }; - #if !defined(DART_PRECOMPILED_RUNTIME) class TwoByteStringSerializationCluster : public SerializationCluster { public: @@ -4452,7 +4361,6 @@ class TwoByteStringSerializationCluster : public SerializationCluster { }; #endif // !DART_PRECOMPILED_RUNTIME - class TwoByteStringDeserializationCluster : public DeserializationCluster { public: TwoByteStringDeserializationCluster() {} @@ -4488,7 +4396,6 @@ class TwoByteStringDeserializationCluster : public DeserializationCluster { } }; - Serializer::Serializer(Thread* thread, Snapshot::Kind kind, uint8_t** buffer, @@ -4520,12 +4427,10 @@ Serializer::Serializer(Thread* thread, } } - Serializer::~Serializer() { delete[] clusters_by_cid_; } - SerializationCluster* Serializer::NewClusterForClass(intptr_t cid) { #if defined(DART_PRECOMPILED_RUNTIME) UNREACHABLE(); @@ -4657,7 +4562,6 @@ SerializationCluster* Serializer::NewClusterForClass(intptr_t cid) { #endif // !DART_PRECOMPILED_RUNTIME } - void Serializer::Push(RawObject* object) { if (!object->IsHeapObject()) { RawSmi* smi = Smi::RawCast(object); @@ -4696,7 +4600,6 @@ void Serializer::Push(RawObject* object) { } } - void Serializer::Trace(RawObject* object) { intptr_t cid; if (!object->IsHeapObject()) { @@ -4725,7 +4628,6 @@ void Serializer::Trace(RawObject* object) { #endif } - void Serializer::UnexpectedObject(RawObject* raw_object, const char* message) { Object& object = Object::Handle(raw_object); OS::PrintErr("Unexpected object (%s): %s\n", message, object.ToCString()); @@ -4738,7 +4640,6 @@ void Serializer::UnexpectedObject(RawObject* raw_object, const char* message) { OS::Abort(); } - #if defined(SNAPSHOT_BACKTRACE) RawObject* Serializer::ParentOf(const Object& object) { for (intptr_t i = 0; i < parent_pairs_.length(); i += 2) { @@ -4750,7 +4651,6 @@ RawObject* Serializer::ParentOf(const Object& object) { } #endif // SNAPSHOT_BACKTRACE - void Serializer::WriteVersionAndFeatures() { const char* expected_version = Version::SnapshotString(); ASSERT(expected_version != NULL); @@ -4766,7 +4666,6 @@ void Serializer::WriteVersionAndFeatures() { free(const_cast(expected_features)); } - #if defined(DEBUG) static const int32_t kSectionMarker = 0xABAB; #endif @@ -4819,7 +4718,6 @@ void Serializer::Serialize() { } } - void Serializer::AddVMIsolateBaseObjects() { // These objects are always allocated by Object::InitOnce, so they are not // written into the snapshot. @@ -4867,7 +4765,6 @@ void Serializer::AddVMIsolateBaseObjects() { } } - intptr_t Serializer::WriteVMSnapshot(const Array& symbols, const Array& scripts) { NoSafepointScope no_safepoint; @@ -4906,7 +4803,6 @@ intptr_t Serializer::WriteVMSnapshot(const Array& symbols, return next_ref_index_ - 1; } - void Serializer::WriteIsolateSnapshot(intptr_t num_base_objects, ObjectStore* object_store) { NoSafepointScope no_safepoint; @@ -4944,7 +4840,6 @@ void Serializer::WriteIsolateSnapshot(intptr_t num_base_objects, heap_->ResetObjectIdTable(); } - Deserializer::Deserializer(Thread* thread, Snapshot::Kind kind, const uint8_t* buffer, @@ -4967,12 +4862,10 @@ Deserializer::Deserializer(Thread* thread, } } - Deserializer::~Deserializer() { delete[] clusters_; } - DeserializationCluster* Deserializer::ReadCluster() { intptr_t cid = ReadCid(); @@ -5096,7 +4989,6 @@ DeserializationCluster* Deserializer::ReadCluster() { return NULL; } - RawApiError* Deserializer::VerifyVersionAndFeatures(Isolate* isolate) { // If the version string doesn't match, return an error. // Note: New things are allocated only if we're going to return an error. @@ -5163,7 +5055,6 @@ RawApiError* Deserializer::VerifyVersionAndFeatures(Isolate* isolate) { return ApiError::null(); } - void Deserializer::Prepare() { num_base_objects_ = Read(); num_objects_ = Read(); @@ -5173,7 +5064,6 @@ void Deserializer::Prepare() { refs_ = Array::New(num_objects_ + 1, Heap::kOld); } - void Deserializer::Deserialize() { if (num_base_objects_ != (next_ref_index_ - 1)) { FATAL2("Snapshot expects %" Pd @@ -5222,7 +5112,6 @@ class HeapLocker : public StackResource { PageSpace* page_space_; }; - void Deserializer::AddVMIsolateBaseObjects() { // These objects are always allocated by Object::InitOnce, so they are not // written into the snapshot. @@ -5270,7 +5159,6 @@ void Deserializer::AddVMIsolateBaseObjects() { } } - void Deserializer::ReadVMSnapshot() { Array& symbol_table = Array::Handle(zone_); Array& refs = Array::Handle(zone_); @@ -5368,7 +5256,6 @@ void Deserializer::ReadIsolateSnapshot(ObjectStore* object_store) { Bootstrap::SetupNativeResolver(); } - // An object visitor which will iterate over all the token stream objects in the // heap and either count them or collect them into an array. This is used during // full snapshot generation of the VM isolate to write out all token streams so @@ -5403,7 +5290,6 @@ class SnapshotTokenStreamVisitor : public ObjectVisitor { const Array* token_streams_; }; - FullSnapshotWriter::FullSnapshotWriter(Snapshot::Kind kind, uint8_t** vm_snapshot_data_buffer, uint8_t** isolate_snapshot_data_buffer, @@ -5492,7 +5378,6 @@ FullSnapshotWriter::~FullSnapshotWriter() { token_streams_ = Array::null(); } - intptr_t FullSnapshotWriter::WriteVMSnapshot() { NOT_IN_PRODUCT(TimelineDurationScope tds( thread(), Timeline::GetIsolateStream(), "WriteVMSnapshot")); @@ -5524,7 +5409,6 @@ intptr_t FullSnapshotWriter::WriteVMSnapshot() { return num_objects; } - void FullSnapshotWriter::WriteIsolateSnapshot(intptr_t num_base_objects) { NOT_IN_PRODUCT(TimelineDurationScope tds( thread(), Timeline::GetIsolateStream(), "WriteIsolateSnapshot")); @@ -5553,7 +5437,6 @@ void FullSnapshotWriter::WriteIsolateSnapshot(intptr_t num_base_objects) { isolate_snapshot_size_ = serializer.bytes_written(); } - void FullSnapshotWriter::WriteFullSnapshot() { intptr_t num_base_objects; if (vm_snapshot_data_buffer() != NULL) { @@ -5576,7 +5459,6 @@ void FullSnapshotWriter::WriteFullSnapshot() { } } - static const uint8_t* DataBuffer(const Snapshot* snapshot) { if (Snapshot::IncludesCode(snapshot->kind())) { uword offset = @@ -5586,7 +5468,6 @@ static const uint8_t* DataBuffer(const Snapshot* snapshot) { return NULL; } - FullSnapshotReader::FullSnapshotReader(const Snapshot* snapshot, const uint8_t* instructions_buffer, Thread* thread) @@ -5599,7 +5480,6 @@ FullSnapshotReader::FullSnapshotReader(const Snapshot* snapshot, thread->isolate()->set_compilation_allowed(kind_ != Snapshot::kFullAOT); } - RawApiError* FullSnapshotReader::ReadVMSnapshot() { Deserializer deserializer(thread_, kind_, buffer_, size_, instructions_buffer_, data_buffer_); @@ -5623,7 +5503,6 @@ RawApiError* FullSnapshotReader::ReadVMSnapshot() { return ApiError::null(); } - RawApiError* FullSnapshotReader::ReadIsolateSnapshot() { Deserializer deserializer(thread_, kind_, buffer_, size_, instructions_buffer_, data_buffer_); diff --git a/runtime/vm/clustered_snapshot.h b/runtime/vm/clustered_snapshot.h index 7e7c77a880c..f68c6b8cc2b 100644 --- a/runtime/vm/clustered_snapshot.h +++ b/runtime/vm/clustered_snapshot.h @@ -64,7 +64,6 @@ class SerializationCluster : public ZoneAllocated { virtual void WriteFill(Serializer* serializer) = 0; }; - class DeserializationCluster : public ZoneAllocated { public: DeserializationCluster() : start_index_(-1), stop_index_(-1) {} @@ -87,7 +86,6 @@ class DeserializationCluster : public ZoneAllocated { intptr_t stop_index_; }; - class SmiObjectIdPair { public: SmiObjectIdPair() : smi_(NULL), id_(0) {} @@ -99,7 +97,6 @@ class SmiObjectIdPair { } }; - class SmiObjectIdPairTrait { public: typedef RawSmi* Key; @@ -112,10 +109,8 @@ class SmiObjectIdPairTrait { static inline bool IsKeyEqual(Pair kv, Key key) { return kv.smi_ == key; } }; - typedef DirectChainedHashMap SmiObjectIdMap; - class Serializer : public StackResource { public: Serializer(Thread* thread, @@ -280,7 +275,6 @@ class Serializer : public StackResource { DISALLOW_IMPLICIT_CONSTRUCTORS(Serializer); }; - class Deserializer : public StackResource { public: Deserializer(Thread* thread, @@ -380,7 +374,6 @@ class Deserializer : public StackResource { DeserializationCluster** clusters_; }; - class FullSnapshotWriter { public: static const intptr_t kInitialSize = 64 * KB; @@ -439,7 +432,6 @@ class FullSnapshotWriter { DISALLOW_COPY_AND_ASSIGN(FullSnapshotWriter); }; - class FullSnapshotReader { public: FullSnapshotReader(const Snapshot* snapshot, diff --git a/runtime/vm/code_descriptors.cc b/runtime/vm/code_descriptors.cc index cc8b043800c..53f44ca9ec4 100644 --- a/runtime/vm/code_descriptors.cc +++ b/runtime/vm/code_descriptors.cc @@ -34,7 +34,6 @@ void DescriptorList::AddDescriptor(RawPcDescriptors::Kind kind, } } - RawPcDescriptors* DescriptorList::FinalizePcDescriptors(uword entry_point) { if (encoded_data_.length() == 0) { return Object::empty_descriptors().raw(); @@ -42,7 +41,6 @@ RawPcDescriptors* DescriptorList::FinalizePcDescriptors(uword entry_point) { return PcDescriptors::New(&encoded_data_); } - void StackMapTableBuilder::AddEntry(intptr_t pc_offset, BitmapBuilder* bitmap, intptr_t register_bit_count) { @@ -50,7 +48,6 @@ void StackMapTableBuilder::AddEntry(intptr_t pc_offset, list_.Add(stack_map_, Heap::kOld); } - bool StackMapTableBuilder::Verify() { intptr_t num_entries = Length(); StackMap& map1 = StackMap::Handle(); @@ -66,7 +63,6 @@ bool StackMapTableBuilder::Verify() { return true; } - RawArray* StackMapTableBuilder::FinalizeStackMaps(const Code& code) { ASSERT(Verify()); intptr_t num_entries = Length(); @@ -76,14 +72,12 @@ RawArray* StackMapTableBuilder::FinalizeStackMaps(const Code& code) { return Array::MakeFixedLength(list_); } - RawStackMap* StackMapTableBuilder::MapAt(intptr_t index) const { StackMap& map = StackMap::Handle(); map ^= list_.At(index); return map.raw(); } - RawExceptionHandlers* ExceptionHandlerList::FinalizeExceptionHandlers( uword entry_point) const { intptr_t num_handlers = Length(); @@ -116,7 +110,6 @@ RawExceptionHandlers* ExceptionHandlerList::FinalizeExceptionHandlers( return handlers.raw(); } - static uint8_t* zone_allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { @@ -124,7 +117,6 @@ static uint8_t* zone_allocator(uint8_t* ptr, return zone->Realloc(ptr, old_size, new_size); } - class CatchEntryStateMapBuilder::TrieNode : public ZoneAllocated { public: TrieNode() : pair_(), entry_state_offset_(-1) {} @@ -158,25 +150,21 @@ CatchEntryStateMapBuilder::CatchEntryStateMapBuilder() buffer_(NULL), stream_(&buffer_, zone_allocator, 64) {} - void CatchEntryStateMapBuilder::AppendMove(intptr_t src_slot, intptr_t dest_slot) { moves_.Add(CatchEntryStatePair::FromMove(src_slot, dest_slot)); } - void CatchEntryStateMapBuilder::AppendConstant(intptr_t pool_id, intptr_t dest_slot) { moves_.Add(CatchEntryStatePair::FromConstant(pool_id, dest_slot)); } - void CatchEntryStateMapBuilder::NewMapping(intptr_t pc_offset) { moves_.Clear(); current_pc_offset_ = pc_offset; } - void CatchEntryStateMapBuilder::EndMapping() { intptr_t suffix_length = 0; TrieNode* suffix = root_; @@ -208,7 +196,6 @@ void CatchEntryStateMapBuilder::EndMapping() { } } - RawTypedData* CatchEntryStateMapBuilder::FinalizeCatchEntryStateMap() { TypedData& td = TypedData::Handle(TypedData::New( kTypedDataInt8ArrayCid, stream_.bytes_written(), Heap::kOld)); @@ -221,11 +208,9 @@ RawTypedData* CatchEntryStateMapBuilder::FinalizeCatchEntryStateMap() { return td.raw(); } - const TokenPosition CodeSourceMapBuilder::kInitialPosition = TokenPosition(TokenPosition::kDartCodeProloguePos); - CodeSourceMapBuilder::CodeSourceMapBuilder( bool stack_traces_only, const GrowableArray& caller_inline_id, @@ -251,14 +236,12 @@ CodeSourceMapBuilder::CodeSourceMapBuilder( written_token_pos_stack_.Add(kInitialPosition); } - void CodeSourceMapBuilder::FlushBuffer() { FlushBufferStack(); FlushBufferPosition(); FlushBufferPC(); } - void CodeSourceMapBuilder::FlushBufferStack() { for (intptr_t i = buffered_inline_id_stack_.length() - 1; i >= 0; i--) { intptr_t buffered_id = buffered_inline_id_stack_[i]; @@ -285,7 +268,6 @@ void CodeSourceMapBuilder::FlushBufferStack() { UNREACHABLE(); } - void CodeSourceMapBuilder::FlushBufferPosition() { ASSERT(buffered_token_pos_stack_.length() == written_token_pos_stack_.length()); @@ -298,14 +280,12 @@ void CodeSourceMapBuilder::FlushBufferPosition() { } } - void CodeSourceMapBuilder::FlushBufferPC() { if (buffered_pc_offset_ != written_pc_offset_) { WriteAdvancePC(buffered_pc_offset_ - written_pc_offset_); } } - void CodeSourceMapBuilder::StartInliningInterval(int32_t pc_offset, intptr_t inline_id) { if (buffered_inline_id_stack_.Last() == inline_id) { @@ -357,10 +337,8 @@ void CodeSourceMapBuilder::StartInliningInterval(int32_t pc_offset, } } - void CodeSourceMapBuilder::BeginCodeSourceRange(int32_t pc_offset) {} - void CodeSourceMapBuilder::EndCodeSourceRange(int32_t pc_offset, TokenPosition pos) { if (pc_offset == buffered_pc_offset_) { @@ -375,7 +353,6 @@ void CodeSourceMapBuilder::EndCodeSourceRange(int32_t pc_offset, BufferAdvancePC(pc_offset - buffered_pc_offset_); } - void CodeSourceMapBuilder::NoteDescriptor(RawPcDescriptors::Kind kind, int32_t pc_offset, TokenPosition pos) { @@ -389,7 +366,6 @@ void CodeSourceMapBuilder::NoteDescriptor(RawPcDescriptors::Kind kind, } } - intptr_t CodeSourceMapBuilder::GetFunctionId(intptr_t inline_id) { const Function& function = *inline_id_to_function_[inline_id]; for (intptr_t i = 0; i < inlined_functions_.Length(); i++) { @@ -401,7 +377,6 @@ intptr_t CodeSourceMapBuilder::GetFunctionId(intptr_t inline_id) { return inlined_functions_.Length() - 1; } - RawArray* CodeSourceMapBuilder::InliningIdToFunction() { if (inlined_functions_.Length() == 0) { return Object::empty_array().raw(); @@ -409,7 +384,6 @@ RawArray* CodeSourceMapBuilder::InliningIdToFunction() { return Array::MakeFixedLength(inlined_functions_); } - RawCodeSourceMap* CodeSourceMapBuilder::Finalize() { if (!stack_traces_only_) { FlushBuffer(); @@ -421,7 +395,6 @@ RawCodeSourceMap* CodeSourceMapBuilder::Finalize() { return map.raw(); } - void CodeSourceMapBuilder::WriteChangePosition(TokenPosition pos) { stream_.Write(kChangePosition); if (FLAG_precompiled_mode) { @@ -439,7 +412,6 @@ void CodeSourceMapBuilder::WriteChangePosition(TokenPosition pos) { written_token_pos_stack_.Last() = pos; } - void CodeSourceMapReader::GetInlinedFunctionsAt( int32_t pc_offset, GrowableArray* function_stack, @@ -492,7 +464,6 @@ void CodeSourceMapReader::GetInlinedFunctionsAt( } } - #ifndef PRODUCT void CodeSourceMapReader::PrintJSONInlineIntervals(JSONObject* jsobj) { { @@ -551,7 +522,6 @@ void CodeSourceMapReader::PrintJSONInlineIntervals(JSONObject* jsobj) { } #endif // !PRODUCT - void CodeSourceMapReader::DumpInlineIntervals(uword start) { GrowableArray function_stack; LogBlock lb; @@ -599,7 +569,6 @@ void CodeSourceMapReader::DumpInlineIntervals(uword start) { THR_Print("}\n"); } - void CodeSourceMapReader::DumpSourcePositions(uword start) { GrowableArray function_stack; GrowableArray token_positions; diff --git a/runtime/vm/code_descriptors.h b/runtime/vm/code_descriptors.h index 1648c48b618..c31b4a1f32b 100644 --- a/runtime/vm/code_descriptors.h +++ b/runtime/vm/code_descriptors.h @@ -43,7 +43,6 @@ class DescriptorList : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(DescriptorList); }; - class StackMapTableBuilder : public ZoneAllocated { public: StackMapTableBuilder() @@ -69,7 +68,6 @@ class StackMapTableBuilder : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(StackMapTableBuilder); }; - class ExceptionHandlerList : public ZoneAllocated { public: struct HandlerDesc { @@ -117,7 +115,6 @@ class ExceptionHandlerList : public ZoneAllocated { list_[try_index].needs_stacktrace |= needs_stacktrace; } - // Called by rethrows, to mark their enclosing handlers. void SetNeedsStackTrace(intptr_t try_index) { // Rethrows can be generated outside a try by the compiler. @@ -131,7 +128,6 @@ class ExceptionHandlerList : public ZoneAllocated { list_[try_index].needs_stacktrace = true; } - static bool ContainsDynamic(const Array& array) { for (intptr_t i = 0; i < array.Length(); i++) { if (array.At(i) == Type::DynamicType()) { @@ -148,7 +144,6 @@ class ExceptionHandlerList : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerList); }; - // An encoded move from stack/constant to stack performed struct CatchEntryStatePair { enum { kCatchEntryStateIsMove = 1, kCatchEntryStateDestShift = 1 }; @@ -176,7 +171,6 @@ struct CatchEntryStatePair { } }; - // Used to construct CatchEntryState metadata for AoT mode of compilation. class CatchEntryStateMapBuilder : public ZoneAllocated { public: @@ -201,7 +195,6 @@ class CatchEntryStateMapBuilder : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(CatchEntryStateMapBuilder); }; - // A CodeSourceMap maps from pc offsets to a stack of inlined functions and // their positions. This is encoded as a little bytecode that pushes and pops // functions and changes the top function's position as the PC advances. @@ -307,7 +300,6 @@ class CodeSourceMapBuilder : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(CodeSourceMapBuilder); }; - class CodeSourceMapReader : public ValueObject { public: CodeSourceMapReader(const CodeSourceMap& map, diff --git a/runtime/vm/code_descriptors_test.cc b/runtime/vm/code_descriptors_test.cc index 6f02a1cddc8..33ed6077a1b 100644 --- a/runtime/vm/code_descriptors_test.cc +++ b/runtime/vm/code_descriptors_test.cc @@ -5,8 +5,8 @@ #include "platform/assert.h" #include "vm/globals.h" -#include "vm/ast.h" #include "vm/assembler.h" +#include "vm/ast.h" #include "vm/code_descriptors.h" #include "vm/compiler.h" #include "vm/dart_entry.h" @@ -20,7 +20,6 @@ namespace dart { static const TokenPosition kPos = TokenPosition::kNoSource; - CODEGEN_TEST_GENERATE(StackMapCodegen, test) { ParsedFunction* parsed_function = new ParsedFunction(Thread::Current(), test->function()); @@ -166,7 +165,6 @@ CODEGEN_TEST_GENERATE(StackMapCodegen, test) { } CODEGEN_TEST_RUN(StackMapCodegen, Smi::New(1)) - static void NativeFunc(Dart_NativeArguments args) { Dart_Handle i = Dart_GetNativeArgument(args, 0); Dart_Handle k = Dart_GetNativeArgument(args, 1); @@ -181,7 +179,6 @@ static void NativeFunc(Dart_NativeArguments args) { } } - static Dart_NativeFunction native_resolver(Dart_Handle name, int argument_count, bool* auto_setup_scope) { @@ -190,7 +187,6 @@ static Dart_NativeFunction native_resolver(Dart_Handle name, return reinterpret_cast(&NativeFunc); } - TEST_CASE(StackMapGC) { const char* kScriptChars = "class A {" @@ -270,7 +266,6 @@ TEST_CASE(StackMapGC) { EXPECT(!result.IsError()); } - TEST_CASE(DescriptorList_TokenPositions) { DescriptorList* descriptors = new DescriptorList(64); ASSERT(descriptors != NULL); diff --git a/runtime/vm/code_generator_test.cc b/runtime/vm/code_generator_test.cc index 0d0f3f5aa01..05b084c9cc0 100644 --- a/runtime/vm/code_generator_test.cc +++ b/runtime/vm/code_generator_test.cc @@ -5,12 +5,12 @@ #include "platform/globals.h" #include "platform/assert.h" -#include "vm/globals.h" #include "vm/assembler.h" #include "vm/ast.h" #include "vm/class_finalizer.h" #include "vm/compiler.h" #include "vm/dart_entry.h" +#include "vm/globals.h" #include "vm/native_entry.h" #include "vm/native_entry_test.h" #include "vm/runtime_entry.h" @@ -22,20 +22,17 @@ namespace dart { static const TokenPosition kPos = TokenPosition::kMinSource; - CODEGEN_TEST_GENERATE(SimpleReturnCodegen, test) { test->node_sequence()->Add(new ReturnNode(kPos)); } CODEGEN_TEST_RUN(SimpleReturnCodegen, Instance::null()) - CODEGEN_TEST_GENERATE(SmiReturnCodegen, test) { LiteralNode* l = new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(3))); test->node_sequence()->Add(new ReturnNode(kPos, l)); } CODEGEN_TEST_RUN(SmiReturnCodegen, Smi::New(3)) - CODEGEN_TEST2_GENERATE(SimpleStaticCallCodegen, function, test) { // Wrap the SmiReturnCodegen test above as a static function and call it. ArgumentListNode* no_arguments = new ArgumentListNode(kPos); @@ -44,7 +41,6 @@ CODEGEN_TEST2_GENERATE(SimpleStaticCallCodegen, function, test) { } CODEGEN_TEST2_RUN(SimpleStaticCallCodegen, SmiReturnCodegen, Smi::New(3)) - // Helper to allocate and return a LocalVariable. static LocalVariable* NewTestLocalVariable(const char* name) { const String& variable_name = @@ -53,7 +49,6 @@ static LocalVariable* NewTestLocalVariable(const char* name) { return new LocalVariable(kPos, kPos, variable_name, variable_type); } - CODEGEN_TEST_GENERATE(ReturnParameterCodegen, test) { SequenceNode* node_seq = test->node_sequence(); const int num_params = 1; @@ -67,7 +62,6 @@ CODEGEN_TEST_GENERATE(ReturnParameterCodegen, test) { node_seq->Add(new ReturnNode(kPos, new LoadLocalNode(kPos, parameter))); } - CODEGEN_TEST2_GENERATE(StaticCallReturnParameterCodegen, function, test) { // Wrap and call the ReturnParameterCodegen test above as a static function. SequenceNode* node_seq = test->node_sequence(); @@ -80,7 +74,6 @@ CODEGEN_TEST2_RUN(StaticCallReturnParameterCodegen, ReturnParameterCodegen, Smi::New(3)) - CODEGEN_TEST_GENERATE(SmiParamSumCodegen, test) { SequenceNode* node_seq = test->node_sequence(); const int num_params = 2; @@ -103,7 +96,6 @@ CODEGEN_TEST_GENERATE(SmiParamSumCodegen, test) { node_seq->Add(new ReturnNode(kPos, new LoadLocalNode(kPos, sum))); } - CODEGEN_TEST2_GENERATE(StaticCallSmiParamSumCodegen, function, test) { // Wrap and call the SmiParamSumCodegen test above as a static function. SequenceNode* node_seq = test->node_sequence(); @@ -115,7 +107,6 @@ CODEGEN_TEST2_GENERATE(StaticCallSmiParamSumCodegen, function, test) { } CODEGEN_TEST2_RUN(StaticCallSmiParamSumCodegen, SmiParamSumCodegen, Smi::New(5)) - CODEGEN_TEST_GENERATE(SmiAddCodegen, test) { SequenceNode* node_seq = test->node_sequence(); LiteralNode* a = new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(3))); @@ -125,7 +116,6 @@ CODEGEN_TEST_GENERATE(SmiAddCodegen, test) { } CODEGEN_TEST_RUN(SmiAddCodegen, Smi::New(5)) - CODEGEN_TEST_GENERATE(GenericAddCodegen, test) { SequenceNode* node_seq = test->node_sequence(); LiteralNode* a = @@ -139,7 +129,6 @@ CODEGEN_TEST_GENERATE(GenericAddCodegen, test) { } CODEGEN_TEST_RUN(GenericAddCodegen, Double::New(15.0)) - CODEGEN_TEST_GENERATE(SmiBinaryOpCodegen, test) { SequenceNode* node_seq = test->node_sequence(); LiteralNode* a = new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(4))); @@ -155,7 +144,6 @@ CODEGEN_TEST_GENERATE(SmiBinaryOpCodegen, test) { } CODEGEN_TEST_RUN(SmiBinaryOpCodegen, Smi::New(3)) - CODEGEN_TEST_GENERATE(BoolNotCodegen, test) { SequenceNode* node_seq = test->node_sequence(); LiteralNode* b = new LiteralNode(kPos, Bool::False()); @@ -164,7 +152,6 @@ CODEGEN_TEST_GENERATE(BoolNotCodegen, test) { } CODEGEN_TEST_RUN(BoolNotCodegen, Bool::True().raw()) - CODEGEN_TEST_GENERATE(BoolAndCodegen, test) { SequenceNode* node_seq = test->node_sequence(); LiteralNode* a = new LiteralNode(kPos, Bool::True()); @@ -174,7 +161,6 @@ CODEGEN_TEST_GENERATE(BoolAndCodegen, test) { } CODEGEN_TEST_RUN(BoolAndCodegen, Bool::False().raw()) - CODEGEN_TEST_GENERATE(BinaryOpCodegen, test) { SequenceNode* node_seq = test->node_sequence(); LiteralNode* a = @@ -189,7 +175,6 @@ CODEGEN_TEST_GENERATE(BinaryOpCodegen, test) { } CODEGEN_TEST_RUN(BinaryOpCodegen, Double::New(2.5)); - CODEGEN_TEST_GENERATE(SmiUnaryOpCodegen, test) { SequenceNode* node_seq = test->node_sequence(); LiteralNode* a = new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(12))); @@ -198,7 +183,6 @@ CODEGEN_TEST_GENERATE(SmiUnaryOpCodegen, test) { } CODEGEN_TEST_RUN(SmiUnaryOpCodegen, Smi::New(-12)) - CODEGEN_TEST_GENERATE(DoubleUnaryOpCodegen, test) { SequenceNode* node_seq = test->node_sequence(); LiteralNode* a = @@ -208,7 +192,6 @@ CODEGEN_TEST_GENERATE(DoubleUnaryOpCodegen, test) { } CODEGEN_TEST_RUN(DoubleUnaryOpCodegen, Double::New(-12.0)) - static Library& MakeTestLibrary(const char* url) { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -224,14 +207,12 @@ static Library& MakeTestLibrary(const char* url) { return lib; } - static RawClass* LookupClass(const Library& lib, const char* name) { const String& cls_name = String::ZoneHandle(Symbols::New(Thread::Current(), name)); return lib.LookupClass(cls_name); } - CODEGEN_TEST_GENERATE(StaticCallCodegen, test) { const char* kScriptChars = "class A {\n" @@ -277,7 +258,6 @@ CODEGEN_TEST_GENERATE(StaticCallCodegen, test) { } CODEGEN_TEST_RUN(StaticCallCodegen, Smi::New(42 + 5)) - CODEGEN_TEST_GENERATE(InstanceCallCodegen, test) { const char* kScriptChars = "class A {\n" @@ -305,16 +285,16 @@ CODEGEN_TEST_GENERATE(InstanceCallCodegen, test) { String::ZoneHandle(Symbols::New(Thread::Current(), "bar")); ArgumentListNode* no_arguments = new ArgumentListNode(kPos); const TypeArguments& no_type_arguments = TypeArguments::ZoneHandle(); - InstanceCallNode* call_bar = new InstanceCallNode( - kPos, new ConstructorCallNode(kPos, no_type_arguments, constructor, - no_arguments), - function_bar_name, no_arguments); + InstanceCallNode* call_bar = + new InstanceCallNode(kPos, + new ConstructorCallNode(kPos, no_type_arguments, + constructor, no_arguments), + function_bar_name, no_arguments); test->node_sequence()->Add(new ReturnNode(kPos, call_bar)); } CODEGEN_TEST_RUN(InstanceCallCodegen, Smi::New(42)) - // Test allocation of dart objects. CODEGEN_TEST_GENERATE(AllocateNewObjectCodegen, test) { const char* kScriptChars = @@ -345,7 +325,6 @@ CODEGEN_TEST_GENERATE(AllocateNewObjectCodegen, test) { constructor, no_arguments))); } - CODEGEN_TEST_RAW_RUN(AllocateNewObjectCodegen, function) { const Object& result = Object::Handle( DartEntry::InvokeFunction(function, Object::empty_array())); diff --git a/runtime/vm/code_observers.cc b/runtime/vm/code_observers.cc index ec47c8fc413..485f94a9b02 100644 --- a/runtime/vm/code_observers.cc +++ b/runtime/vm/code_observers.cc @@ -2,7 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. - #include "vm/code_observers.h" #include "vm/os.h" @@ -16,7 +15,6 @@ Mutex* CodeObservers::mutex_ = NULL; intptr_t CodeObservers::observers_length_ = 0; CodeObserver** CodeObservers::observers_ = NULL; - void CodeObservers::Register(CodeObserver* observer) { observers_length_++; observers_ = reinterpret_cast( @@ -27,7 +25,6 @@ void CodeObservers::Register(CodeObserver* observer) { observers_[observers_length_ - 1] = observer; } - void CodeObservers::NotifyAll(const char* name, uword base, uword prologue_offset, @@ -41,7 +38,6 @@ void CodeObservers::NotifyAll(const char* name, } } - bool CodeObservers::AreActive() { for (intptr_t i = 0; i < observers_length_; i++) { if (observers_[i]->IsActive()) return true; @@ -49,7 +45,6 @@ bool CodeObservers::AreActive() { return false; } - void CodeObservers::DeleteAll() { for (intptr_t i = 0; i < observers_length_; i++) { delete observers_[i]; @@ -59,7 +54,6 @@ void CodeObservers::DeleteAll() { observers_ = NULL; } - void CodeObservers::InitOnce() { ASSERT(mutex_ == NULL); mutex_ = new Mutex(); @@ -67,7 +61,6 @@ void CodeObservers::InitOnce() { OS::RegisterCodeObservers(); } - #endif // !PRODUCT } // namespace dart diff --git a/runtime/vm/code_observers.h b/runtime/vm/code_observers.h index 1718d3944c4..58645969554 100644 --- a/runtime/vm/code_observers.h +++ b/runtime/vm/code_observers.h @@ -5,8 +5,8 @@ #ifndef RUNTIME_VM_CODE_OBSERVERS_H_ #define RUNTIME_VM_CODE_OBSERVERS_H_ -#include "vm/globals.h" #include "vm/allocation.h" +#include "vm/globals.h" namespace dart { @@ -38,7 +38,6 @@ class CodeObserver { DISALLOW_COPY_AND_ASSIGN(CodeObserver); }; - class CodeObservers : public AllStatic { public: static void InitOnce(); diff --git a/runtime/vm/code_patcher.cc b/runtime/vm/code_patcher.cc index 0c46d74678f..8f2d97a9b7d 100644 --- a/runtime/vm/code_patcher.cc +++ b/runtime/vm/code_patcher.cc @@ -12,7 +12,6 @@ namespace dart { DEFINE_FLAG(bool, write_protect_code, true, "Write protect jitted code"); - WritableInstructionsScope::WritableInstructionsScope(uword address, intptr_t size) : address_(address), size_(size) { @@ -23,7 +22,6 @@ WritableInstructionsScope::WritableInstructionsScope(uword address, } } - WritableInstructionsScope::~WritableInstructionsScope() { if (FLAG_write_protect_code) { bool status = VirtualMemory::Protect(reinterpret_cast(address_), diff --git a/runtime/vm/code_patcher.h b/runtime/vm/code_patcher.h index 8e413bff8e8..379dbb3ff71 100644 --- a/runtime/vm/code_patcher.h +++ b/runtime/vm/code_patcher.h @@ -24,7 +24,6 @@ class RawICData; class RawObject; class String; - // Stack-allocated class to create a scope where the specified region // [address, address + size] has write access enabled. This is used // when patching generated code. Access is reset to read-execute in @@ -39,7 +38,6 @@ class WritableInstructionsScope : public ValueObject { const intptr_t size_; }; - class CodePatcher : public AllStatic { public: // Dart static calls have a distinct, machine-dependent code pattern. diff --git a/runtime/vm/code_patcher_arm.cc b/runtime/vm/code_patcher_arm.cc index 70507f88f76..bc4ae08335f 100644 --- a/runtime/vm/code_patcher_arm.cc +++ b/runtime/vm/code_patcher_arm.cc @@ -20,7 +20,6 @@ RawCode* CodePatcher::GetStaticCallTargetAt(uword return_address, return call.TargetCode(); } - void CodePatcher::PatchStaticCallAt(uword return_address, const Code& code, const Code& new_target) { @@ -29,12 +28,10 @@ void CodePatcher::PatchStaticCallAt(uword return_address, call.SetTargetCode(new_target); } - void CodePatcher::InsertDeoptimizationCallAt(uword start) { UNREACHABLE(); } - RawCode* CodePatcher::GetInstanceCallAt(uword return_address, const Code& code, ICData* ic_data) { @@ -46,14 +43,12 @@ RawCode* CodePatcher::GetInstanceCallAt(uword return_address, return call.TargetCode(); } - intptr_t CodePatcher::InstanceCallSizeInBytes() { // The instance call instruction sequence has a variable size on ARM. UNREACHABLE(); return 0; } - RawFunction* CodePatcher::GetUnoptimizedStaticCallAt(uword return_address, const Code& code, ICData* ic_data_result) { @@ -67,7 +62,6 @@ RawFunction* CodePatcher::GetUnoptimizedStaticCallAt(uword return_address, return ic_data.GetTargetAt(0); } - void CodePatcher::PatchSwitchableCallAt(uword return_address, const Code& caller_code, const Object& data, @@ -78,7 +72,6 @@ void CodePatcher::PatchSwitchableCallAt(uword return_address, call.SetTarget(target); } - RawCode* CodePatcher::GetSwitchableCallTargetAt(uword return_address, const Code& caller_code) { ASSERT(caller_code.ContainsInstructionAt(return_address)); @@ -86,7 +79,6 @@ RawCode* CodePatcher::GetSwitchableCallTargetAt(uword return_address, return call.target(); } - RawObject* CodePatcher::GetSwitchableCallDataAt(uword return_address, const Code& caller_code) { ASSERT(caller_code.ContainsInstructionAt(return_address)); @@ -94,7 +86,6 @@ RawObject* CodePatcher::GetSwitchableCallDataAt(uword return_address, return call.data(); } - void CodePatcher::PatchNativeCallAt(uword return_address, const Code& code, NativeFunction target, @@ -105,7 +96,6 @@ void CodePatcher::PatchNativeCallAt(uword return_address, call.set_native_function(target); } - RawCode* CodePatcher::GetNativeCallAt(uword return_address, const Code& code, NativeFunction* target) { diff --git a/runtime/vm/code_patcher_arm64.cc b/runtime/vm/code_patcher_arm64.cc index b64b21d8ec8..5d8c56cf7cb 100644 --- a/runtime/vm/code_patcher_arm64.cc +++ b/runtime/vm/code_patcher_arm64.cc @@ -42,7 +42,6 @@ class PoolPointerCall : public ValueObject { DISALLOW_IMPLICIT_CONSTRUCTORS(PoolPointerCall); }; - RawCode* CodePatcher::GetStaticCallTargetAt(uword return_address, const Code& code) { ASSERT(code.ContainsInstructionAt(return_address)); @@ -50,14 +49,12 @@ RawCode* CodePatcher::GetStaticCallTargetAt(uword return_address, return call.Target(); } - void CodePatcher::PatchStaticCallAt(uword return_address, const Code& code, const Code& new_target) { PatchPoolPointerCallAt(return_address, code, new_target); } - void CodePatcher::PatchPoolPointerCallAt(uword return_address, const Code& code, const Code& new_target) { @@ -66,12 +63,10 @@ void CodePatcher::PatchPoolPointerCallAt(uword return_address, call.SetTarget(new_target); } - void CodePatcher::InsertDeoptimizationCallAt(uword start) { UNREACHABLE(); } - RawCode* CodePatcher::GetInstanceCallAt(uword return_address, const Code& code, ICData* ic_data) { @@ -83,14 +78,12 @@ RawCode* CodePatcher::GetInstanceCallAt(uword return_address, return call.TargetCode(); } - intptr_t CodePatcher::InstanceCallSizeInBytes() { // The instance call instruction sequence has a variable size on ARM64. UNREACHABLE(); return 0; } - RawFunction* CodePatcher::GetUnoptimizedStaticCallAt(uword return_address, const Code& code, ICData* ic_data_result) { @@ -104,7 +97,6 @@ RawFunction* CodePatcher::GetUnoptimizedStaticCallAt(uword return_address, return ic_data.GetTargetAt(0); } - void CodePatcher::PatchSwitchableCallAt(uword return_address, const Code& caller_code, const Object& data, @@ -115,7 +107,6 @@ void CodePatcher::PatchSwitchableCallAt(uword return_address, call.SetTarget(target); } - RawCode* CodePatcher::GetSwitchableCallTargetAt(uword return_address, const Code& caller_code) { ASSERT(caller_code.ContainsInstructionAt(return_address)); @@ -123,7 +114,6 @@ RawCode* CodePatcher::GetSwitchableCallTargetAt(uword return_address, return call.target(); } - RawObject* CodePatcher::GetSwitchableCallDataAt(uword return_address, const Code& caller_code) { ASSERT(caller_code.ContainsInstructionAt(return_address)); @@ -131,7 +121,6 @@ RawObject* CodePatcher::GetSwitchableCallDataAt(uword return_address, return call.data(); } - void CodePatcher::PatchNativeCallAt(uword return_address, const Code& code, NativeFunction target, @@ -142,7 +131,6 @@ void CodePatcher::PatchNativeCallAt(uword return_address, call.set_native_function(target); } - RawCode* CodePatcher::GetNativeCallAt(uword return_address, const Code& code, NativeFunction* target) { diff --git a/runtime/vm/code_patcher_arm64_test.cc b/runtime/vm/code_patcher_arm64_test.cc index 016362fef35..44da9ee02c3 100644 --- a/runtime/vm/code_patcher_arm64_test.cc +++ b/runtime/vm/code_patcher_arm64_test.cc @@ -48,7 +48,6 @@ ASSEMBLER_TEST_GENERATE(IcDataAccess, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(IcDataAccess, test) { uword end = test->payload_start() + test->code().Size(); uword return_address = end - Instr::kInstrSize; diff --git a/runtime/vm/code_patcher_arm_test.cc b/runtime/vm/code_patcher_arm_test.cc index 65693b5b208..565b101ad9a 100644 --- a/runtime/vm/code_patcher_arm_test.cc +++ b/runtime/vm/code_patcher_arm_test.cc @@ -48,7 +48,6 @@ ASSEMBLER_TEST_GENERATE(IcDataAccess, assembler) { __ Ret(); } - ASSEMBLER_TEST_RUN(IcDataAccess, test) { uword end = test->payload_start() + test->code().Size(); uword return_address = end - Instr::kInstrSize; diff --git a/runtime/vm/code_patcher_dbc.cc b/runtime/vm/code_patcher_dbc.cc index 60cc9d6b3c2..b7ae4860c97 100644 --- a/runtime/vm/code_patcher_dbc.cc +++ b/runtime/vm/code_patcher_dbc.cc @@ -20,7 +20,6 @@ RawCode* CodePatcher::GetStaticCallTargetAt(uword return_address, return call.TargetCode(); } - void CodePatcher::PatchStaticCallAt(uword return_address, const Code& code, const Code& new_target) { @@ -29,12 +28,10 @@ void CodePatcher::PatchStaticCallAt(uword return_address, call.SetTargetCode(new_target); } - void CodePatcher::InsertDeoptimizationCallAt(uword start) { CallPattern::InsertDeoptCallAt(start); } - RawCode* CodePatcher::GetInstanceCallAt(uword return_address, const Code& code, ICData* ic_data) { @@ -46,13 +43,11 @@ RawCode* CodePatcher::GetInstanceCallAt(uword return_address, return call.TargetCode(); } - intptr_t CodePatcher::InstanceCallSizeInBytes() { UNREACHABLE(); return 0; } - RawFunction* CodePatcher::GetUnoptimizedStaticCallAt(uword return_address, const Code& code, ICData* ic_data_result) { @@ -66,7 +61,6 @@ RawFunction* CodePatcher::GetUnoptimizedStaticCallAt(uword return_address, return ic_data.GetTargetAt(0); } - void CodePatcher::PatchSwitchableCallAt(uword return_address, const Code& caller_code, const Object& data, @@ -77,7 +71,6 @@ void CodePatcher::PatchSwitchableCallAt(uword return_address, call.SetTarget(target); } - RawCode* CodePatcher::GetSwitchableCallTargetAt(uword return_address, const Code& caller_code) { ASSERT(caller_code.ContainsInstructionAt(return_address)); @@ -85,7 +78,6 @@ RawCode* CodePatcher::GetSwitchableCallTargetAt(uword return_address, return call.target(); } - RawObject* CodePatcher::GetSwitchableCallDataAt(uword return_address, const Code& caller_code) { ASSERT(caller_code.ContainsInstructionAt(return_address)); @@ -93,7 +85,6 @@ RawObject* CodePatcher::GetSwitchableCallDataAt(uword return_address, return call.data(); } - void CodePatcher::PatchNativeCallAt(uword return_address, const Code& code, NativeFunction target, @@ -104,7 +95,6 @@ void CodePatcher::PatchNativeCallAt(uword return_address, call.set_native_function(target); } - RawCode* CodePatcher::GetNativeCallAt(uword return_address, const Code& code, NativeFunction* target) { diff --git a/runtime/vm/code_patcher_ia32.cc b/runtime/vm/code_patcher_ia32.cc index d0b0a3e5e43..f408644f2f1 100644 --- a/runtime/vm/code_patcher_ia32.cc +++ b/runtime/vm/code_patcher_ia32.cc @@ -55,7 +55,6 @@ class UnoptimizedCall : public ValueObject { DISALLOW_IMPLICIT_CONSTRUCTORS(UnoptimizedCall); }; - class NativeCall : public UnoptimizedCall { public: explicit NativeCall(uword return_address) : UnoptimizedCall(return_address) {} @@ -73,7 +72,6 @@ class NativeCall : public UnoptimizedCall { DISALLOW_IMPLICIT_CONSTRUCTORS(NativeCall); }; - class InstanceCall : public UnoptimizedCall { public: explicit InstanceCall(uword return_address) @@ -89,7 +87,6 @@ class InstanceCall : public UnoptimizedCall { DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceCall); }; - class UnoptimizedStaticCall : public UnoptimizedCall { public: explicit UnoptimizedStaticCall(uword return_address) @@ -105,7 +102,6 @@ class UnoptimizedStaticCall : public UnoptimizedCall { DISALLOW_IMPLICIT_CONSTRUCTORS(UnoptimizedStaticCall); }; - // The expected pattern of a dart static call: // mov EDX, arguments_descriptor_array (optional in polymorphic calls) // mov EDI, Immediate(code_object) @@ -150,7 +146,6 @@ class StaticCall : public ValueObject { DISALLOW_IMPLICIT_CONSTRUCTORS(StaticCall); }; - RawCode* CodePatcher::GetStaticCallTargetAt(uword return_address, const Code& code) { ASSERT(code.ContainsInstructionAt(return_address)); @@ -158,7 +153,6 @@ RawCode* CodePatcher::GetStaticCallTargetAt(uword return_address, return call.target(); } - void CodePatcher::PatchStaticCallAt(uword return_address, const Code& code, const Code& new_target) { @@ -169,12 +163,10 @@ void CodePatcher::PatchStaticCallAt(uword return_address, call.set_target(new_target); } - void CodePatcher::InsertDeoptimizationCallAt(uword start) { UNREACHABLE(); } - RawCode* CodePatcher::GetInstanceCallAt(uword return_address, const Code& code, ICData* ic_data) { @@ -186,7 +178,6 @@ RawCode* CodePatcher::GetInstanceCallAt(uword return_address, return Code::null(); } - RawFunction* CodePatcher::GetUnoptimizedStaticCallAt(uword return_address, const Code& code, ICData* ic_data_result) { @@ -200,7 +191,6 @@ RawFunction* CodePatcher::GetUnoptimizedStaticCallAt(uword return_address, return ic_data.GetTargetAt(0); } - void CodePatcher::PatchSwitchableCallAt(uword return_address, const Code& caller_code, const Object& data, @@ -209,7 +199,6 @@ void CodePatcher::PatchSwitchableCallAt(uword return_address, UNREACHABLE(); } - RawCode* CodePatcher::GetSwitchableCallTargetAt(uword return_address, const Code& caller_code) { // Switchable instance calls only generated for precompilation. @@ -217,7 +206,6 @@ RawCode* CodePatcher::GetSwitchableCallTargetAt(uword return_address, return Code::null(); } - RawObject* CodePatcher::GetSwitchableCallDataAt(uword return_address, const Code& caller_code) { // Switchable instance calls only generated for precompilation. @@ -225,7 +213,6 @@ RawObject* CodePatcher::GetSwitchableCallDataAt(uword return_address, return Object::null(); } - void CodePatcher::PatchNativeCallAt(uword return_address, const Code& code, NativeFunction target, @@ -233,7 +220,6 @@ void CodePatcher::PatchNativeCallAt(uword return_address, UNREACHABLE(); } - RawCode* CodePatcher::GetNativeCallAt(uword return_address, const Code& code, NativeFunction* target) { @@ -241,7 +227,6 @@ RawCode* CodePatcher::GetNativeCallAt(uword return_address, return NULL; } - intptr_t CodePatcher::InstanceCallSizeInBytes() { return InstanceCall::kPatternSize; } diff --git a/runtime/vm/code_patcher_ia32_test.cc b/runtime/vm/code_patcher_ia32_test.cc index 4ca31b021b4..79a01af4f6c 100644 --- a/runtime/vm/code_patcher_ia32_test.cc +++ b/runtime/vm/code_patcher_ia32_test.cc @@ -45,7 +45,6 @@ ASSEMBLER_TEST_GENERATE(IcDataAccess, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(IcDataAccess, test) { uword return_address = test->entry() + CodePatcher::InstanceCallSizeInBytes(); ICData& ic_data = ICData::Handle(); diff --git a/runtime/vm/code_patcher_x64.cc b/runtime/vm/code_patcher_x64.cc index 4b79751b10b..1ce5c5eb6da 100644 --- a/runtime/vm/code_patcher_x64.cc +++ b/runtime/vm/code_patcher_x64.cc @@ -16,7 +16,6 @@ namespace dart { - static bool MatchesPattern(uword addr, int16_t* pattern, intptr_t size) { uint8_t* bytes = reinterpret_cast(addr); for (intptr_t i = 0; i < size; i++) { @@ -28,19 +27,16 @@ static bool MatchesPattern(uword addr, int16_t* pattern, intptr_t size) { return true; } - intptr_t IndexFromPPLoad(uword start) { int32_t offset = *reinterpret_cast(start); return ObjectPool::IndexFromOffset(offset); } - intptr_t IndexFromPPLoadDisp8(uword start) { int8_t offset = *reinterpret_cast(start); return ObjectPool::IndexFromOffset(offset); } - class UnoptimizedCall : public ValueObject { public: UnoptimizedCall(uword return_address, const Code& code) @@ -87,7 +83,6 @@ class UnoptimizedCall : public ValueObject { DISALLOW_IMPLICIT_CONSTRUCTORS(UnoptimizedCall); }; - class NativeCall : public UnoptimizedCall { public: NativeCall(uword return_address, const Code& code) @@ -106,7 +101,6 @@ class NativeCall : public UnoptimizedCall { DISALLOW_IMPLICIT_CONSTRUCTORS(NativeCall); }; - class InstanceCall : public UnoptimizedCall { public: InstanceCall(uword return_address, const Code& code) @@ -122,7 +116,6 @@ class InstanceCall : public UnoptimizedCall { DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceCall); }; - class UnoptimizedStaticCall : public UnoptimizedCall { public: UnoptimizedStaticCall(uword return_address, const Code& code) @@ -138,7 +131,6 @@ class UnoptimizedStaticCall : public UnoptimizedCall { DISALLOW_IMPLICIT_CONSTRUCTORS(UnoptimizedStaticCall); }; - // The expected pattern of a call where the target is loaded from // the object pool. class PoolPointerCall : public ValueObject { @@ -181,7 +173,6 @@ class PoolPointerCall : public ValueObject { DISALLOW_IMPLICIT_CONSTRUCTORS(PoolPointerCall); }; - // Instance call that can switch between a direct monomorphic call, an IC call, // and a megamorphic call. // load guarded cid load ICData load MegamorphicCache @@ -236,7 +227,6 @@ class SwitchableCall : public ValueObject { DISALLOW_IMPLICIT_CONSTRUCTORS(SwitchableCall); }; - RawCode* CodePatcher::GetStaticCallTargetAt(uword return_address, const Code& code) { ASSERT(code.ContainsInstructionAt(return_address)); @@ -244,14 +234,12 @@ RawCode* CodePatcher::GetStaticCallTargetAt(uword return_address, return call.Target(); } - void CodePatcher::PatchStaticCallAt(uword return_address, const Code& code, const Code& new_target) { PatchPoolPointerCallAt(return_address, code, new_target); } - void CodePatcher::PatchPoolPointerCallAt(uword return_address, const Code& code, const Code& new_target) { @@ -260,7 +248,6 @@ void CodePatcher::PatchPoolPointerCallAt(uword return_address, call.SetTarget(new_target); } - RawCode* CodePatcher::GetInstanceCallAt(uword return_address, const Code& code, ICData* ic_data) { @@ -272,17 +259,14 @@ RawCode* CodePatcher::GetInstanceCallAt(uword return_address, return call.target(); } - intptr_t CodePatcher::InstanceCallSizeInBytes() { return InstanceCall::kCallPatternSize; } - void CodePatcher::InsertDeoptimizationCallAt(uword start) { UNREACHABLE(); } - RawFunction* CodePatcher::GetUnoptimizedStaticCallAt(uword return_address, const Code& code, ICData* ic_data_result) { @@ -296,7 +280,6 @@ RawFunction* CodePatcher::GetUnoptimizedStaticCallAt(uword return_address, return ic_data.GetTargetAt(0); } - void CodePatcher::PatchSwitchableCallAt(uword return_address, const Code& caller_code, const Object& data, @@ -307,7 +290,6 @@ void CodePatcher::PatchSwitchableCallAt(uword return_address, call.SetTarget(target); } - RawCode* CodePatcher::GetSwitchableCallTargetAt(uword return_address, const Code& caller_code) { ASSERT(caller_code.ContainsInstructionAt(return_address)); @@ -315,7 +297,6 @@ RawCode* CodePatcher::GetSwitchableCallTargetAt(uword return_address, return call.target(); } - RawObject* CodePatcher::GetSwitchableCallDataAt(uword return_address, const Code& caller_code) { ASSERT(caller_code.ContainsInstructionAt(return_address)); @@ -323,7 +304,6 @@ RawObject* CodePatcher::GetSwitchableCallDataAt(uword return_address, return call.data(); } - void CodePatcher::PatchNativeCallAt(uword return_address, const Code& code, NativeFunction target, @@ -334,7 +314,6 @@ void CodePatcher::PatchNativeCallAt(uword return_address, call.set_native_function(target); } - RawCode* CodePatcher::GetNativeCallAt(uword return_address, const Code& code, NativeFunction* target) { diff --git a/runtime/vm/code_patcher_x64_test.cc b/runtime/vm/code_patcher_x64_test.cc index 5c7b0295de1..824c3b79063 100644 --- a/runtime/vm/code_patcher_x64_test.cc +++ b/runtime/vm/code_patcher_x64_test.cc @@ -48,7 +48,6 @@ ASSEMBLER_TEST_GENERATE(IcDataAccess, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(IcDataAccess, test) { uword return_address = test->entry() + CodePatcher::InstanceCallSizeInBytes(); ICData& ic_data = ICData::Handle(); diff --git a/runtime/vm/compilation_trace.cc b/runtime/vm/compilation_trace.cc index 2fd2cf0b7b0..22be20ecfb4 100644 --- a/runtime/vm/compilation_trace.cc +++ b/runtime/vm/compilation_trace.cc @@ -19,7 +19,6 @@ CompilationTraceSaver::CompilationTraceSaver(Zone* zone) lib_(Library::Handle(zone)), uri_(String::Handle(zone)) {} - void CompilationTraceSaver::Visit(const Function& function) { if (!function.HasCode()) { return; // Not compiled. @@ -41,7 +40,6 @@ void CompilationTraceSaver::Visit(const Function& function) { func_name_.ToCString()); } - CompilationTraceLoader::CompilationTraceLoader(Thread* thread) : thread_(thread), zone_(thread->zone()), @@ -56,7 +54,6 @@ CompilationTraceLoader::CompilationTraceLoader(Thread* thread) field_(Field::Handle(zone_)), error_(Object::Handle(zone_)) {} - static char* FindCharacter(char* str, char goal, char* limit) { while (str < limit) { if (*str == goal) { @@ -67,7 +64,6 @@ static char* FindCharacter(char* str, char goal, char* limit) { return NULL; } - RawObject* CompilationTraceLoader::CompileTrace(uint8_t* buffer, intptr_t size) { // First compile functions named in the trace. @@ -136,7 +132,6 @@ RawObject* CompilationTraceLoader::CompileTrace(uint8_t* buffer, return Object::null(); } - // Use a fuzzy match to find the right function to compile. This allows a // compilation trace to remain mostly valid in the face of program changes, and // deals with implicit/dispatcher functions that don't have proper names. @@ -238,7 +233,6 @@ RawObject* CompilationTraceLoader::CompileTriple(const char* uri_cstr, return Object::null(); } - RawObject* CompilationTraceLoader::CompileFunction(const Function& function) { if (function.is_abstract()) { return Object::null(); @@ -246,7 +240,6 @@ RawObject* CompilationTraceLoader::CompileFunction(const Function& function) { return Compiler::CompileFunction(thread_, function); } - RawObject* CompilationTraceLoader::EvaluateInitializer(const Field& field) { LongJumpScope jump; if (setjmp(*jump.Set()) == 0) { diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc index 96d2fa8b481..bc465b30bf4 100644 --- a/runtime/vm/compiler.cc +++ b/runtime/vm/compiler.cc @@ -108,10 +108,8 @@ DEFINE_FLAG(bool, DECLARE_FLAG(bool, huge_method_cutoff_in_code_size); DECLARE_FLAG(bool, trace_failed_optimization_attempts); - #ifndef DART_PRECOMPILED_RUNTIME - bool UseKernelFrontEndFor(ParsedFunction* parsed_function) { const Function& function = parsed_function->function(); return (function.kernel_offset() > 0) || @@ -119,7 +117,6 @@ bool UseKernelFrontEndFor(ParsedFunction* parsed_function) { (function.kind() == RawFunction::kInvokeFieldDispatcher); } - void DartCompilationPipeline::ParseFunction(ParsedFunction* parsed_function) { if (!UseKernelFrontEndFor(parsed_function)) { Parser::ParseFunction(parsed_function); @@ -127,7 +124,6 @@ void DartCompilationPipeline::ParseFunction(ParsedFunction* parsed_function) { } } - FlowGraph* DartCompilationPipeline::BuildFlowGraph( Zone* zone, ParsedFunction* parsed_function, @@ -150,10 +146,8 @@ FlowGraph* DartCompilationPipeline::BuildFlowGraph( return builder.BuildGraph(); } - void DartCompilationPipeline::FinalizeCompilation(FlowGraph* flow_graph) {} - void IrregexpCompilationPipeline::ParseFunction( ParsedFunction* parsed_function) { VMTagScope tagScope(parsed_function->thread(), @@ -182,7 +176,6 @@ void IrregexpCompilationPipeline::ParseFunction( // Variables are allocated after compilation. } - FlowGraph* IrregexpCompilationPipeline::BuildFlowGraph( Zone* zone, ParsedFunction* parsed_function, @@ -209,12 +202,10 @@ FlowGraph* IrregexpCompilationPipeline::BuildFlowGraph( FlowGraph(*parsed_function, result.graph_entry, result.num_blocks); } - void IrregexpCompilationPipeline::FinalizeCompilation(FlowGraph* flow_graph) { backtrack_goto_->ComputeOffsetTable(); } - CompilationPipeline* CompilationPipeline::New(Zone* zone, const Function& function) { if (function.IsIrregexpFunction()) { @@ -224,7 +215,6 @@ CompilationPipeline* CompilationPipeline::New(Zone* zone, } } - // Compile a function. Should call only if the function has not been compiled. // Arg0: function object. DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { @@ -241,7 +231,6 @@ DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { } } - bool Compiler::CanOptimizeFunction(Thread* thread, const Function& function) { if (FLAG_support_debugger) { Isolate* isolate = thread->isolate(); @@ -304,13 +293,11 @@ bool Compiler::CanOptimizeFunction(Thread* thread, const Function& function) { return true; } - bool Compiler::IsBackgroundCompilation() { // For now: compilation in non mutator thread is the background compoilation. return !Thread::Current()->IsMutatorThread(); } - RawError* Compiler::Compile(const Library& library, const Script& script) { LongJumpScope jump; if (setjmp(*jump.Set()) == 0) { @@ -337,7 +324,6 @@ RawError* Compiler::Compile(const Library& library, const Script& script) { return Error::null(); } - static void AddRelatedClassesToList( const Class& cls, GrowableHandlePtrArray* parse_list, @@ -384,7 +370,6 @@ static void AddRelatedClassesToList( } } - RawError* Compiler::CompileClass(const Class& cls) { ASSERT(Thread::Current()->IsMutatorThread()); // If class is a top level class it is already parsed. @@ -510,7 +495,6 @@ RawError* Compiler::CompileClass(const Class& cls) { return Error::null(); } - class CompileParsedFunctionHelper : public ValueObject { public: CompileParsedFunctionHelper(ParsedFunction* parsed_function, @@ -548,7 +532,6 @@ class CompileParsedFunctionHelper : public ValueObject { DISALLOW_COPY_AND_ASSIGN(CompileParsedFunctionHelper); }; - RawCode* CompileParsedFunctionHelper::FinalizeCompilation( Assembler* assembler, FlowGraphCompiler* graph_compiler, @@ -714,7 +697,6 @@ RawCode* CompileParsedFunctionHelper::FinalizeCompilation( return code.raw(); } - void CompileParsedFunctionHelper::CheckIfBackgroundCompilerIsBeingStopped() { ASSERT(Compiler::IsBackgroundCompilation()); if (!isolate()->background_compiler()->is_running()) { @@ -724,7 +706,6 @@ void CompileParsedFunctionHelper::CheckIfBackgroundCompilerIsBeingStopped() { } } - // Return null if bailed out. // If optimized_result_code is not NULL then it is caller's responsibility // to install code. @@ -1240,7 +1221,6 @@ RawCode* CompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) { return result->raw(); } - static RawObject* CompileFunctionHelper(CompilationPipeline* pipeline, const Function& function, bool optimized, @@ -1406,7 +1386,6 @@ static RawObject* CompileFunctionHelper(CompilationPipeline* pipeline, return Object::null(); } - static RawError* ParseFunctionHelper(CompilationPipeline* pipeline, const Function& function, bool optimized, @@ -1463,7 +1442,6 @@ static RawError* ParseFunctionHelper(CompilationPipeline* pipeline, return Error::null(); } - RawObject* Compiler::CompileFunction(Thread* thread, const Function& function) { #ifdef DART_PRECOMPILER if (FLAG_precompiled_mode) { @@ -1493,7 +1471,6 @@ RawObject* Compiler::CompileFunction(Thread* thread, const Function& function) { /* optimized = */ false, kNoOSRDeoptId); } - RawError* Compiler::ParseFunction(Thread* thread, const Function& function) { Isolate* isolate = thread->isolate(); #if !defined(PRODUCT) @@ -1515,7 +1492,6 @@ RawError* Compiler::ParseFunction(Thread* thread, const Function& function) { /* optimized = */ false, kNoOSRDeoptId); } - RawError* Compiler::EnsureUnoptimizedCode(Thread* thread, const Function& function) { if (function.unoptimized_code() != Object::null()) { @@ -1547,7 +1523,6 @@ RawError* Compiler::EnsureUnoptimizedCode(Thread* thread, return Error::null(); } - RawObject* Compiler::CompileOptimizedFunction(Thread* thread, const Function& function, intptr_t osr_id) { @@ -1575,7 +1550,6 @@ RawObject* Compiler::CompileOptimizedFunction(Thread* thread, osr_id); } - // This is only used from unit tests. RawError* Compiler::CompileParsedFunction(ParsedFunction* parsed_function) { LongJumpScope jump; @@ -1601,7 +1575,6 @@ RawError* Compiler::CompileParsedFunction(ParsedFunction* parsed_function) { return Error::null(); } - void Compiler::ComputeLocalVarDescriptors(const Code& code) { ASSERT(!code.is_optimized()); const Function& function = Function::Handle(code.function()); @@ -1649,7 +1622,6 @@ void Compiler::ComputeLocalVarDescriptors(const Code& code) { Thread::Current()->set_deopt_id(prev_deopt_id); } - RawError* Compiler::CompileAllFunctions(const Class& cls) { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -1685,7 +1657,6 @@ RawError* Compiler::CompileAllFunctions(const Class& cls) { return Error::null(); } - RawError* Compiler::ParseAllFunctions(const Class& cls) { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -1719,7 +1690,6 @@ RawError* Compiler::ParseAllFunctions(const Class& cls) { return error.raw(); } - RawObject* Compiler::EvaluateStaticInitializer(const Field& field) { #ifdef DART_PRECOMPILER if (FLAG_precompiled_mode) { @@ -1782,7 +1752,6 @@ RawObject* Compiler::EvaluateStaticInitializer(const Field& field) { return error.raw(); } - RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) { #ifdef DART_PRECOMPILER if (FLAG_precompiled_mode) { @@ -1857,7 +1826,6 @@ RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) { return result.raw(); } - void Compiler::AbortBackgroundCompilation(intptr_t deopt_id, const char* msg) { if (FLAG_trace_compiler) { THR_Print("ABORT background compilation: %s\n", msg); @@ -1878,7 +1846,6 @@ void Compiler::AbortBackgroundCompilation(intptr_t deopt_id, const char* msg) { deopt_id, Object::background_compilation_error()); } - // C-heap allocated background compilation queue element. class QueueElement { public: @@ -1892,7 +1859,6 @@ class QueueElement { RawFunction* Function() const { return function_; } - void set_next(QueueElement* elem) { next_ = elem; } QueueElement* next() const { return next_; } @@ -1908,7 +1874,6 @@ class QueueElement { DISALLOW_COPY_AND_ASSIGN(QueueElement); }; - // Allocated in C-heap. Handles both input and output of background compilation. // It implements a FIFO queue, using Peek, Add, Remove operations. class BackgroundCompilationQueue { @@ -1988,7 +1953,6 @@ class BackgroundCompilationQueue { DISALLOW_COPY_AND_ASSIGN(BackgroundCompilationQueue); }; - BackgroundCompiler::BackgroundCompiler(Isolate* isolate) : isolate_(isolate), running_(true), @@ -1999,7 +1963,6 @@ BackgroundCompiler::BackgroundCompiler(Isolate* isolate) *done_ = false; } - // Fields all deleted in ::Stop; here clear them. BackgroundCompiler::~BackgroundCompiler() { isolate_ = NULL; @@ -2010,7 +1973,6 @@ BackgroundCompiler::~BackgroundCompiler() { function_queue_ = NULL; } - void BackgroundCompiler::Run() { while (running_) { // Maybe something is already in the queue, check first before waiting @@ -2081,7 +2043,6 @@ void BackgroundCompiler::Run() { } } - void BackgroundCompiler::CompileOptimized(const Function& function) { ASSERT(Thread::Current()->IsMutatorThread()); // TODO(srdjan): Checking different strategy for collecting garbage @@ -2101,12 +2062,10 @@ void BackgroundCompiler::CompileOptimized(const Function& function) { } } - void BackgroundCompiler::VisitPointers(ObjectPointerVisitor* visitor) { function_queue_->VisitObjectPointers(visitor); } - void BackgroundCompiler::Stop(Isolate* isolate) { BackgroundCompiler* task = isolate->background_compiler(); if (task == NULL) { @@ -2141,7 +2100,6 @@ void BackgroundCompiler::Stop(Isolate* isolate) { isolate->set_background_compiler(NULL); } - void BackgroundCompiler::Disable() { Thread* thread = Thread::Current(); ASSERT(thread != NULL); @@ -2158,7 +2116,6 @@ void BackgroundCompiler::Disable() { isolate->disable_background_compiler(); } - bool BackgroundCompiler::IsDisabled() { Thread* thread = Thread::Current(); ASSERT(thread != NULL); @@ -2167,7 +2124,6 @@ bool BackgroundCompiler::IsDisabled() { return isolate->is_background_compiler_disabled(); } - void BackgroundCompiler::Enable() { Thread* thread = Thread::Current(); ASSERT(thread != NULL); @@ -2176,7 +2132,6 @@ void BackgroundCompiler::Enable() { isolate->enable_background_compiler(); } - void BackgroundCompiler::EnsureInit(Thread* thread) { ASSERT(thread->IsMutatorThread()); // Finalize NoSuchMethodError, _Mint; occasionally needed in optimized @@ -2206,23 +2161,19 @@ void BackgroundCompiler::EnsureInit(Thread* thread) { } } - #else // DART_PRECOMPILED_RUNTIME - bool UseKernelFrontEndFor(ParsedFunction* parsed_function) { UNREACHABLE(); return false; } - CompilationPipeline* CompilationPipeline::New(Zone* zone, const Function& function) { UNREACHABLE(); return NULL; } - DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { const Function& function = Function::CheckedHandle(arguments.ArgAt(0)); FATAL3("Precompilation missed function %s (%" Pd ", %s)\n", @@ -2231,49 +2182,41 @@ DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { Function::KindToCString(function.kind())); } - bool Compiler::IsBackgroundCompilation() { return false; } - bool Compiler::CanOptimizeFunction(Thread* thread, const Function& function) { UNREACHABLE(); return false; } - RawError* Compiler::Compile(const Library& library, const Script& script) { FATAL1("Attempt to compile script %s", script.ToCString()); return Error::null(); } - RawError* Compiler::CompileClass(const Class& cls) { FATAL1("Attempt to compile class %s", cls.ToCString()); return Error::null(); } - RawObject* Compiler::CompileFunction(Thread* thread, const Function& function) { FATAL1("Attempt to compile function %s", function.ToCString()); return Error::null(); } - RawError* Compiler::ParseFunction(Thread* thread, const Function& function) { FATAL1("Attempt to parse function %s", function.ToCString()); return Error::null(); } - RawError* Compiler::EnsureUnoptimizedCode(Thread* thread, const Function& function) { FATAL1("Attempt to compile function %s", function.ToCString()); return Error::null(); } - RawObject* Compiler::CompileOptimizedFunction(Thread* thread, const Function& function, intptr_t osr_id) { @@ -2281,31 +2224,26 @@ RawObject* Compiler::CompileOptimizedFunction(Thread* thread, return Error::null(); } - RawError* Compiler::CompileParsedFunction(ParsedFunction* parsed_function) { FATAL1("Attempt to compile function %s", parsed_function->function().ToCString()); return Error::null(); } - void Compiler::ComputeLocalVarDescriptors(const Code& code) { UNREACHABLE(); } - RawError* Compiler::CompileAllFunctions(const Class& cls) { FATAL1("Attempt to compile class %s", cls.ToCString()); return Error::null(); } - RawError* Compiler::ParseAllFunctions(const Class& cls) { FATAL1("Attempt to parse class %s", cls.ToCString()); return Error::null(); } - RawObject* Compiler::EvaluateStaticInitializer(const Field& field) { ASSERT(field.HasPrecompiledInitializer()); const Function& initializer = @@ -2313,48 +2251,39 @@ RawObject* Compiler::EvaluateStaticInitializer(const Field& field) { return DartEntry::InvokeFunction(initializer, Object::empty_array()); } - RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) { UNREACHABLE(); return Object::null(); } - void Compiler::AbortBackgroundCompilation(intptr_t deopt_id, const char* msg) { UNREACHABLE(); } - void BackgroundCompiler::CompileOptimized(const Function& function) { UNREACHABLE(); } - void BackgroundCompiler::VisitPointers(ObjectPointerVisitor* visitor) { UNREACHABLE(); } - void BackgroundCompiler::Stop(Isolate* isolate) { UNREACHABLE(); } - void BackgroundCompiler::EnsureInit(Thread* thread) { UNREACHABLE(); } - void BackgroundCompiler::Disable() { UNREACHABLE(); } - void BackgroundCompiler::Enable() { UNREACHABLE(); } - bool BackgroundCompiler::IsDisabled() { UNREACHABLE(); return true; diff --git a/runtime/vm/compiler.h b/runtime/vm/compiler.h index 1b0d079871c..4b121af5f43 100644 --- a/runtime/vm/compiler.h +++ b/runtime/vm/compiler.h @@ -43,7 +43,6 @@ class CompilationPipeline : public ZoneAllocated { virtual ~CompilationPipeline() {} }; - class DartCompilationPipeline : public CompilationPipeline { public: virtual void ParseFunction(ParsedFunction* parsed_function); @@ -57,7 +56,6 @@ class DartCompilationPipeline : public CompilationPipeline { virtual void FinalizeCompilation(FlowGraph* flow_graph); }; - class IrregexpCompilationPipeline : public CompilationPipeline { public: IrregexpCompilationPipeline() : backtrack_goto_(NULL) {} @@ -76,7 +74,6 @@ class IrregexpCompilationPipeline : public CompilationPipeline { IndirectGotoInstr* backtrack_goto_; }; - class Compiler : public AllStatic { public: static const intptr_t kNoOSRDeoptId = Thread::kNoDeoptId; @@ -157,7 +154,6 @@ class Compiler : public AllStatic { static void AbortBackgroundCompilation(intptr_t deopt_id, const char* msg); }; - // Class to run optimizing compilation in a background thread. // Current implementation: one task per isolate, it dies with the owning // isolate. diff --git a/runtime/vm/compiler_stats.cc b/runtime/vm/compiler_stats.cc index 6448c44effd..647f70bf3cd 100644 --- a/runtime/vm/compiler_stats.cc +++ b/runtime/vm/compiler_stats.cc @@ -10,7 +10,6 @@ #include "vm/object_store.h" #include "vm/timer.h" - namespace dart { DEFINE_FLAG(bool, compiler_stats, false, "Compiler stat counters."); @@ -19,7 +18,6 @@ DEFINE_FLAG(bool, false, "Compiler stat counters for benchmark."); - class TokenStreamVisitor : public ObjectVisitor { public: explicit TokenStreamVisitor(CompilerStats* compiler_stats) @@ -48,7 +46,6 @@ class TokenStreamVisitor : public ObjectVisitor { CompilerStats* stats_; }; - CompilerStats::CompilerStats(Isolate* isolate) : isolate_(isolate), #define INITIALIZE_TIMER(timer_name, description) timer_name(true, description), @@ -62,10 +59,8 @@ CompilerStats::CompilerStats(Isolate* isolate) use_benchmark_output(false) { } - #ifndef PRODUCT - // Used to aggregate stats. Must be atomic. void CompilerStats::Add(const CompilerStats& other) { #define ADD_TOTAL(timer_name, literal) timer_name.AddTotal(other.timer_name); @@ -80,7 +75,6 @@ void CompilerStats::Add(const CompilerStats& other) { #undef ADD_COUNTER } - void CompilerStats::Clear() { #define CLEAR_TIMER(timer_name, literal) timer_name.Reset(); @@ -93,7 +87,6 @@ void CompilerStats::Clear() { #undef CLEAR_COUNTER } - bool CompilerStats::IsCleared() const { #define CHECK_TIMERS(timer_name, literal) \ if (!timer_name.IsReset()) return false; @@ -109,7 +102,6 @@ bool CompilerStats::IsCleared() const { return true; } - // This function is used as a callback in the log object to which the // compiler stats are printed. It will be called only once, to print // the accumulated text when all of the compiler stats values are @@ -127,7 +119,6 @@ static void PrintToStats(const char* format, ...) { va_end(args); } - void CompilerStats::Update() { // Traverse the heap and compute number of tokens in all // TokenStream objects. @@ -137,13 +128,11 @@ void CompilerStats::Update() { Dart::vm_isolate()->heap()->IterateObjects(&visitor); } - void CompilerStats::EnableBenchmark() { FLAG_compiler_stats = true; use_benchmark_output = true; } - // Generate output for Golem benchmark harness. If the output format // changes, the parsing function in Golem must be updated. char* CompilerStats::BenchmarkOutput() { @@ -198,7 +187,6 @@ char* CompilerStats::BenchmarkOutput() { return benchmark_text; } - char* CompilerStats::PrintToZone() { if (!FLAG_compiler_stats) { return NULL; diff --git a/runtime/vm/compiler_stats.h b/runtime/vm/compiler_stats.h index 65751330044..1ab70414403 100644 --- a/runtime/vm/compiler_stats.h +++ b/runtime/vm/compiler_stats.h @@ -11,13 +11,11 @@ #include "vm/isolate.h" #include "vm/timer.h" - namespace dart { DECLARE_FLAG(bool, compiler_stats); DECLARE_FLAG(bool, compiler_benchmark); - #define STAT_TIMERS(V) \ V(parser_timer, "parser timer") \ V(scanner_timer, "scanner timer") \ @@ -34,7 +32,6 @@ DECLARE_FLAG(bool, compiler_benchmark); V(graphcompiler_timer, "flow graph compiler timer") \ V(codefinalizer_timer, "code finalization timer") - #define STAT_COUNTERS(V) \ V(num_tokens_total) \ V(num_tokens_scanned) \ @@ -105,7 +102,6 @@ class CompilerStats { char* text; bool use_benchmark_output; - void EnableBenchmark(); char* BenchmarkOutput(); char* PrintToZone(); @@ -141,7 +137,6 @@ class CompilerStats { : NULL, \ thr); - } // namespace dart #endif // RUNTIME_VM_COMPILER_STATS_H_ diff --git a/runtime/vm/compiler_test.cc b/runtime/vm/compiler_test.cc index 8f3c1119291..3448bf50134 100644 --- a/runtime/vm/compiler_test.cc +++ b/runtime/vm/compiler_test.cc @@ -2,10 +2,10 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +#include "vm/compiler.h" #include "platform/assert.h" #include "vm/class_finalizer.h" #include "vm/code_patcher.h" -#include "vm/compiler.h" #include "vm/dart_api_impl.h" #include "vm/object.h" #include "vm/safepoint.h" @@ -28,7 +28,6 @@ ISOLATE_UNIT_TEST_CASE(CompileScript) { EXPECT(CompilerTest::TestCompileScript(lib, script)); } - ISOLATE_UNIT_TEST_CASE(CompileFunction) { const char* kScriptChars = "class A {\n" @@ -68,7 +67,6 @@ ISOLATE_UNIT_TEST_CASE(CompileFunction) { function_source.ToCString()); } - ISOLATE_UNIT_TEST_CASE(CompileFunctionOnHelperThread) { // Create a simple function and compile it without optimization. const char* kScriptChars = @@ -112,7 +110,6 @@ ISOLATE_UNIT_TEST_CASE(CompileFunctionOnHelperThread) { BackgroundCompiler::Stop(isolate); } - TEST_CASE(RegenerateAllocStubs) { const char* kScriptChars = "class A {\n" @@ -150,7 +147,6 @@ TEST_CASE(RegenerateAllocStubs) { EXPECT_VALID(result); } - TEST_CASE(EvalExpression) { const char* kScriptChars = "int ten = 2 * 5; \n" @@ -183,7 +179,6 @@ TEST_CASE(EvalExpression) { EXPECT_STREQ("Herr Nilsson 100.", val.ToCString()); } - ISOLATE_UNIT_TEST_CASE(EvalExpressionWithLazyCompile) { Library& lib = Library::Handle(Library::CoreLibrary()); @@ -198,7 +193,6 @@ ISOLATE_UNIT_TEST_CASE(EvalExpressionWithLazyCompile) { EXPECT_EQ(7, Integer::Cast(val).AsInt64Value()); } - ISOLATE_UNIT_TEST_CASE(EvalExpressionExhaustCIDs) { Library& lib = Library::Handle(Library::CoreLibrary()); diff --git a/runtime/vm/constant_propagator.cc b/runtime/vm/constant_propagator.cc index ae046315b50..40363cbd1f2 100644 --- a/runtime/vm/constant_propagator.cc +++ b/runtime/vm/constant_propagator.cc @@ -25,7 +25,6 @@ DEFINE_FLAG(bool, #define I (isolate()) #define Z (graph_->zone()) - ConstantPropagator::ConstantPropagator( FlowGraph* graph, const GrowableArray& ignored) @@ -38,7 +37,6 @@ ConstantPropagator::ConstantPropagator( block_worklist_(), definition_worklist_(graph, 10) {} - void ConstantPropagator::Optimize(FlowGraph* graph) { GrowableArray ignored; ConstantPropagator cp(graph, ignored); @@ -46,7 +44,6 @@ void ConstantPropagator::Optimize(FlowGraph* graph) { cp.Transform(); } - void ConstantPropagator::OptimizeBranches(FlowGraph* graph) { GrowableArray ignored; ConstantPropagator cp(graph, ignored); @@ -55,7 +52,6 @@ void ConstantPropagator::OptimizeBranches(FlowGraph* graph) { cp.EliminateRedundantBranches(); } - void ConstantPropagator::SetReachable(BlockEntryInstr* block) { if (!reachable_->Contains(block->preorder_number())) { reachable_->Add(block->preorder_number()); @@ -63,7 +59,6 @@ void ConstantPropagator::SetReachable(BlockEntryInstr* block) { } } - bool ConstantPropagator::SetValue(Definition* definition, const Object& value) { // We would like to assert we only go up (toward non-constant) in the lattice. // @@ -83,7 +78,6 @@ bool ConstantPropagator::SetValue(Definition* definition, const Object& value) { return false; } - // Compute the join of two values in the lattice, assign it to the first. void ConstantPropagator::Join(Object* left, const Object& right) { // Join(non-constant, X) = non-constant @@ -105,7 +99,6 @@ void ConstantPropagator::Join(Object* left, const Object& right) { *left = non_constant_.raw(); } - // -------------------------------------------------------------------------- // Analysis of blocks. Called at most once per block. The block is already // marked as reachable. All instructions in the block are analyzed. @@ -123,7 +116,6 @@ void ConstantPropagator::VisitGraphEntry(GraphEntryInstr* block) { } } - void ConstantPropagator::VisitJoinEntry(JoinEntryInstr* block) { // Phis are visited when visiting Goto at a predecessor. See VisitGoto. for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) { @@ -131,21 +123,18 @@ void ConstantPropagator::VisitJoinEntry(JoinEntryInstr* block) { } } - void ConstantPropagator::VisitTargetEntry(TargetEntryInstr* block) { for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) { it.Current()->Accept(this); } } - void ConstantPropagator::VisitIndirectEntry(IndirectEntryInstr* block) { for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) { it.Current()->Accept(this); } } - void ConstantPropagator::VisitCatchBlockEntry(CatchBlockEntryInstr* block) { const GrowableArray& defs = *block->initial_definitions(); for (intptr_t i = 0; i < defs.length(); ++i) { @@ -156,13 +145,11 @@ void ConstantPropagator::VisitCatchBlockEntry(CatchBlockEntryInstr* block) { } } - void ConstantPropagator::VisitParallelMove(ParallelMoveInstr* instr) { // Parallel moves have not yet been inserted in the graph. UNREACHABLE(); } - // -------------------------------------------------------------------------- // Analysis of control instructions. Unconditional successors are // reachable. Conditional successors are reachable depending on the @@ -171,22 +158,18 @@ void ConstantPropagator::VisitReturn(ReturnInstr* instr) { // Nothing to do. } - void ConstantPropagator::VisitThrow(ThrowInstr* instr) { // Nothing to do. } - void ConstantPropagator::VisitReThrow(ReThrowInstr* instr) { // Nothing to do. } - void ConstantPropagator::VisitStop(StopInstr* instr) { // Nothing to do. } - void ConstantPropagator::VisitGoto(GotoInstr* instr) { SetReachable(instr->successor()); @@ -197,14 +180,12 @@ void ConstantPropagator::VisitGoto(GotoInstr* instr) { } } - void ConstantPropagator::VisitIndirectGoto(IndirectGotoInstr* instr) { for (intptr_t i = 0; i < instr->SuccessorCount(); i++) { SetReachable(instr->SuccessorAt(i)); } } - void ConstantPropagator::VisitBranch(BranchInstr* instr) { instr->comparison()->Accept(this); @@ -230,45 +211,34 @@ void ConstantPropagator::VisitBranch(BranchInstr* instr) { } } - // -------------------------------------------------------------------------- // Analysis of non-definition instructions. They do not have values so they // cannot have constant values. void ConstantPropagator::VisitCheckStackOverflow( CheckStackOverflowInstr* instr) {} - void ConstantPropagator::VisitCheckClass(CheckClassInstr* instr) {} - void ConstantPropagator::VisitCheckClassId(CheckClassIdInstr* instr) {} - void ConstantPropagator::VisitGuardFieldClass(GuardFieldClassInstr* instr) {} - void ConstantPropagator::VisitGuardFieldLength(GuardFieldLengthInstr* instr) {} - void ConstantPropagator::VisitCheckSmi(CheckSmiInstr* instr) {} - void ConstantPropagator::VisitGenericCheckBound(GenericCheckBoundInstr* instr) { } - void ConstantPropagator::VisitCheckEitherNonSmi(CheckEitherNonSmiInstr* instr) { } - void ConstantPropagator::VisitCheckArrayBound(CheckArrayBoundInstr* instr) {} - void ConstantPropagator::VisitDeoptimize(DeoptimizeInstr* instr) { // TODO(vegorov) remove all code after DeoptimizeInstr as dead. } - Definition* ConstantPropagator::UnwrapPhi(Definition* defn) { if (defn->IsPhi()) { JoinEntryInstr* block = defn->AsPhi()->block(); @@ -290,13 +260,11 @@ Definition* ConstantPropagator::UnwrapPhi(Definition* defn) { return defn; } - void ConstantPropagator::MarkPhi(Definition* phi) { ASSERT(phi->IsPhi()); marked_phis_->Add(phi->ssa_temp_index()); } - // -------------------------------------------------------------------------- // Analysis of definitions. Compute the constant value. If it has changed // and the definition has input uses, add the definition to the definition @@ -318,7 +286,6 @@ void ConstantPropagator::VisitPhi(PhiInstr* instr) { } } - void ConstantPropagator::VisitRedefinition(RedefinitionInstr* instr) { // Ensure that we never remove redefinition of a constant unless we are also // are guaranteed to fold away code paths that correspond to non-matching @@ -331,17 +298,14 @@ void ConstantPropagator::VisitRedefinition(RedefinitionInstr* instr) { } } - void ConstantPropagator::VisitParameter(ParameterInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitPushArgument(PushArgumentInstr* instr) { SetValue(instr, instr->value()->definition()->constant_value()); } - void ConstantPropagator::VisitAssertAssignable(AssertAssignableInstr* instr) { const Object& value = instr->value()->definition()->constant_value(); if (IsNonConstant(value)) { @@ -357,7 +321,6 @@ void ConstantPropagator::VisitAssertAssignable(AssertAssignableInstr* instr) { } } - void ConstantPropagator::VisitAssertBoolean(AssertBooleanInstr* instr) { const Object& value = instr->value()->definition()->constant_value(); if (IsNonConstant(value)) { @@ -371,51 +334,42 @@ void ConstantPropagator::VisitAssertBoolean(AssertBooleanInstr* instr) { } } - void ConstantPropagator::VisitSpecialParameter(SpecialParameterInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitClosureCall(ClosureCallInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitInstanceCall(InstanceCallInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitPolymorphicInstanceCall( PolymorphicInstanceCallInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitStaticCall(StaticCallInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitLoadLocal(LoadLocalInstr* instr) { // Instruction is eliminated when translating to SSA. UNREACHABLE(); } - void ConstantPropagator::VisitDropTemps(DropTempsInstr* instr) { // Instruction is eliminated when translating to SSA. UNREACHABLE(); } - void ConstantPropagator::VisitStoreLocal(StoreLocalInstr* instr) { // Instruction is eliminated when translating to SSA. UNREACHABLE(); } - void ConstantPropagator::VisitIfThenElse(IfThenElseInstr* instr) { instr->comparison()->Accept(this); const Object& value = instr->comparison()->constant_value(); @@ -430,7 +384,6 @@ void ConstantPropagator::VisitIfThenElse(IfThenElseInstr* instr) { } } - void ConstantPropagator::VisitStrictCompare(StrictCompareInstr* instr) { Definition* left_defn = instr->left()->definition(); Definition* right_defn = instr->right()->definition(); @@ -483,7 +436,6 @@ void ConstantPropagator::VisitStrictCompare(StrictCompareInstr* instr) { } } - static bool CompareIntegers(Token::Kind kind, const Integer& left, const Integer& right) { @@ -507,7 +459,6 @@ static bool CompareIntegers(Token::Kind kind, } } - // Comparison instruction that is equivalent to the (left & right) == 0 // comparison pattern. void ConstantPropagator::VisitTestSmi(TestSmiInstr* instr) { @@ -531,13 +482,11 @@ void ConstantPropagator::VisitTestSmi(TestSmiInstr* instr) { } } - void ConstantPropagator::VisitTestCids(TestCidsInstr* instr) { // TODO(sra): Constant fold test. SetValue(instr, non_constant_); } - void ConstantPropagator::VisitEqualityCompare(EqualityCompareInstr* instr) { Definition* left_defn = instr->left()->definition(); Definition* right_defn = instr->right()->definition(); @@ -577,7 +526,6 @@ void ConstantPropagator::VisitEqualityCompare(EqualityCompareInstr* instr) { } } - void ConstantPropagator::VisitRelationalOp(RelationalOpInstr* instr) { const Object& left = instr->left()->definition()->constant_value(); const Object& right = instr->right()->definition()->constant_value(); @@ -597,17 +545,14 @@ void ConstantPropagator::VisitRelationalOp(RelationalOpInstr* instr) { } } - void ConstantPropagator::VisitNativeCall(NativeCallInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitDebugStepCheck(DebugStepCheckInstr* instr) { // Nothing to do. } - void ConstantPropagator::VisitOneByteStringFromCharCode( OneByteStringFromCharCodeInstr* instr) { const Object& o = instr->char_code()->definition()->constant_value(); @@ -625,7 +570,6 @@ void ConstantPropagator::VisitOneByteStringFromCharCode( } } - void ConstantPropagator::VisitStringToCharCode(StringToCharCodeInstr* instr) { const Object& o = instr->str()->definition()->constant_value(); if (o.IsNull() || IsNonConstant(o)) { @@ -638,12 +582,10 @@ void ConstantPropagator::VisitStringToCharCode(StringToCharCodeInstr* instr) { } } - void ConstantPropagator::VisitStringInterpolate(StringInterpolateInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitLoadIndexed(LoadIndexedInstr* instr) { const Object& array_obj = instr->array()->definition()->constant_value(); const Object& index_obj = instr->index()->definition()->constant_value(); @@ -680,29 +622,24 @@ void ConstantPropagator::VisitLoadIndexed(LoadIndexedInstr* instr) { } } - void ConstantPropagator::VisitLoadCodeUnits(LoadCodeUnitsInstr* instr) { // TODO(zerny): Implement constant propagation. SetValue(instr, non_constant_); } - void ConstantPropagator::VisitStoreIndexed(StoreIndexedInstr* instr) { SetValue(instr, instr->value()->definition()->constant_value()); } - void ConstantPropagator::VisitStoreInstanceField( StoreInstanceFieldInstr* instr) { SetValue(instr, instr->value()->definition()->constant_value()); } - void ConstantPropagator::VisitInitStaticField(InitStaticFieldInstr* instr) { // Nothing to do. } - void ConstantPropagator::VisitLoadStaticField(LoadStaticFieldInstr* instr) { if (!FLAG_fields_may_be_reset) { const Field& field = instr->StaticField(); @@ -719,12 +656,10 @@ void ConstantPropagator::VisitLoadStaticField(LoadStaticFieldInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitStoreStaticField(StoreStaticFieldInstr* instr) { SetValue(instr, instr->value()->definition()->constant_value()); } - void ConstantPropagator::VisitBooleanNegate(BooleanNegateInstr* instr) { const Object& value = instr->value()->definition()->constant_value(); if (IsNonConstant(value)) { @@ -735,7 +670,6 @@ void ConstantPropagator::VisitBooleanNegate(BooleanNegateInstr* instr) { } } - void ConstantPropagator::VisitInstanceOf(InstanceOfInstr* instr) { Definition* def = instr->value()->definition(); const Object& value = def->constant_value(); @@ -778,22 +712,18 @@ void ConstantPropagator::VisitInstanceOf(InstanceOfInstr* instr) { } } - void ConstantPropagator::VisitCreateArray(CreateArrayInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitAllocateObject(AllocateObjectInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitLoadUntagged(LoadUntaggedInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitLoadClassId(LoadClassIdInstr* instr) { intptr_t cid = instr->object()->Type()->ToCid(); if (cid != kDynamicCid) { @@ -812,7 +742,6 @@ void ConstantPropagator::VisitLoadClassId(LoadClassIdInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitLoadField(LoadFieldInstr* instr) { Value* instance = instr->instance(); if ((instr->recognized_kind() == MethodRecognizer::kObjectArrayLength) && @@ -860,7 +789,6 @@ void ConstantPropagator::VisitLoadField(LoadFieldInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitInstantiateType(InstantiateTypeInstr* instr) { const Object& object = instr->instantiator_type_arguments()->definition()->constant_value(); @@ -885,7 +813,6 @@ void ConstantPropagator::VisitInstantiateType(InstantiateTypeInstr* instr) { // constant, instantiate the type if no bound error is reported. } - void ConstantPropagator::VisitInstantiateTypeArguments( InstantiateTypeArgumentsInstr* instr) { const Object& instantiator_type_args = @@ -922,23 +849,19 @@ void ConstantPropagator::VisitInstantiateTypeArguments( // genericity. } - void ConstantPropagator::VisitAllocateContext(AllocateContextInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitAllocateUninitializedContext( AllocateUninitializedContextInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitCloneContext(CloneContextInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitBinaryIntegerOp(BinaryIntegerOpInstr* binary_op) { const Object& left = binary_op->left()->definition()->constant_value(); const Object& right = binary_op->right()->definition()->constant_value(); @@ -958,60 +881,49 @@ void ConstantPropagator::VisitBinaryIntegerOp(BinaryIntegerOpInstr* binary_op) { SetValue(binary_op, non_constant_); } - void ConstantPropagator::VisitCheckedSmiOp(CheckedSmiOpInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitCheckedSmiComparison( CheckedSmiComparisonInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitBinarySmiOp(BinarySmiOpInstr* instr) { VisitBinaryIntegerOp(instr); } - void ConstantPropagator::VisitBinaryInt32Op(BinaryInt32OpInstr* instr) { VisitBinaryIntegerOp(instr); } - void ConstantPropagator::VisitBinaryUint32Op(BinaryUint32OpInstr* instr) { VisitBinaryIntegerOp(instr); } - void ConstantPropagator::VisitShiftUint32Op(ShiftUint32OpInstr* instr) { VisitBinaryIntegerOp(instr); } - void ConstantPropagator::VisitBinaryMintOp(BinaryMintOpInstr* instr) { VisitBinaryIntegerOp(instr); } - void ConstantPropagator::VisitShiftMintOp(ShiftMintOpInstr* instr) { VisitBinaryIntegerOp(instr); } - void ConstantPropagator::VisitBoxInt64(BoxInt64Instr* instr) { // TODO(kmillikin): Handle box operation. SetValue(instr, non_constant_); } - void ConstantPropagator::VisitUnboxInt64(UnboxInt64Instr* instr) { // TODO(kmillikin): Handle unbox operation. SetValue(instr, non_constant_); } - void ConstantPropagator::VisitUnaryIntegerOp(UnaryIntegerOpInstr* unary_op) { const Object& value = unary_op->value()->definition()->constant_value(); if (IsConstant(value) && value.IsInteger()) { @@ -1026,17 +938,14 @@ void ConstantPropagator::VisitUnaryIntegerOp(UnaryIntegerOpInstr* unary_op) { SetValue(unary_op, non_constant_); } - void ConstantPropagator::VisitUnaryMintOp(UnaryMintOpInstr* instr) { VisitUnaryIntegerOp(instr); } - void ConstantPropagator::VisitUnarySmiOp(UnarySmiOpInstr* instr) { VisitUnaryIntegerOp(instr); } - void ConstantPropagator::VisitUnaryDoubleOp(UnaryDoubleOpInstr* instr) { const Object& value = instr->value()->definition()->constant_value(); if (IsNonConstant(value)) { @@ -1047,7 +956,6 @@ void ConstantPropagator::VisitUnaryDoubleOp(UnaryDoubleOpInstr* instr) { } } - void ConstantPropagator::VisitSmiToDouble(SmiToDoubleInstr* instr) { const Object& value = instr->value()->definition()->constant_value(); if (IsConstant(value) && value.IsInteger()) { @@ -1059,7 +967,6 @@ void ConstantPropagator::VisitSmiToDouble(SmiToDoubleInstr* instr) { } } - void ConstantPropagator::VisitMintToDouble(MintToDoubleInstr* instr) { const Object& value = instr->value()->definition()->constant_value(); if (IsConstant(value) && value.IsInteger()) { @@ -1071,7 +978,6 @@ void ConstantPropagator::VisitMintToDouble(MintToDoubleInstr* instr) { } } - void ConstantPropagator::VisitInt32ToDouble(Int32ToDoubleInstr* instr) { const Object& value = instr->value()->definition()->constant_value(); if (IsConstant(value) && value.IsInteger()) { @@ -1083,88 +989,73 @@ void ConstantPropagator::VisitInt32ToDouble(Int32ToDoubleInstr* instr) { } } - void ConstantPropagator::VisitDoubleToInteger(DoubleToIntegerInstr* instr) { // TODO(kmillikin): Handle conversion. SetValue(instr, non_constant_); } - void ConstantPropagator::VisitDoubleToSmi(DoubleToSmiInstr* instr) { // TODO(kmillikin): Handle conversion. SetValue(instr, non_constant_); } - void ConstantPropagator::VisitDoubleToDouble(DoubleToDoubleInstr* instr) { // TODO(kmillikin): Handle conversion. SetValue(instr, non_constant_); } - void ConstantPropagator::VisitDoubleToFloat(DoubleToFloatInstr* instr) { // TODO(kmillikin): Handle conversion. SetValue(instr, non_constant_); } - void ConstantPropagator::VisitFloatToDouble(FloatToDoubleInstr* instr) { // TODO(kmillikin): Handle conversion. SetValue(instr, non_constant_); } - void ConstantPropagator::VisitInvokeMathCFunction( InvokeMathCFunctionInstr* instr) { // TODO(kmillikin): Handle conversion. SetValue(instr, non_constant_); } - void ConstantPropagator::VisitTruncDivMod(TruncDivModInstr* instr) { // TODO(srdjan): Handle merged instruction. SetValue(instr, non_constant_); } - void ConstantPropagator::VisitExtractNthOutput(ExtractNthOutputInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitConstant(ConstantInstr* instr) { SetValue(instr, instr->value()); } - void ConstantPropagator::VisitUnboxedConstant(UnboxedConstantInstr* instr) { SetValue(instr, instr->value()); } - void ConstantPropagator::VisitConstraint(ConstraintInstr* instr) { // Should not be used outside of range analysis. UNREACHABLE(); } - void ConstantPropagator::VisitMaterializeObject(MaterializeObjectInstr* instr) { // Should not be used outside of allocation elimination pass. UNREACHABLE(); } - static bool IsIntegerOrDouble(const Object& value) { return value.IsInteger() || value.IsDouble(); } - static double ToDouble(const Object& value) { return value.IsInteger() ? Integer::Cast(value).AsDoubleValue() : Double::Cast(value).value(); } - void ConstantPropagator::VisitBinaryDoubleOp(BinaryDoubleOpInstr* instr) { const Object& left = instr->left()->definition()->constant_value(); const Object& right = instr->right()->definition()->constant_value(); @@ -1197,7 +1088,6 @@ void ConstantPropagator::VisitBinaryDoubleOp(BinaryDoubleOpInstr* instr) { } } - void ConstantPropagator::VisitDoubleTestOp(DoubleTestOpInstr* instr) { const Object& value = instr->value()->definition()->constant_value(); const bool is_negated = instr->kind() != Token::kEQ; @@ -1223,7 +1113,6 @@ void ConstantPropagator::VisitDoubleTestOp(DoubleTestOpInstr* instr) { } } - void ConstantPropagator::VisitBinaryFloat32x4Op(BinaryFloat32x4OpInstr* instr) { const Object& left = instr->left()->definition()->constant_value(); const Object& right = instr->right()->definition()->constant_value(); @@ -1235,170 +1124,139 @@ void ConstantPropagator::VisitBinaryFloat32x4Op(BinaryFloat32x4OpInstr* instr) { } } - void ConstantPropagator::VisitFloat32x4Constructor( Float32x4ConstructorInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitSimd32x4Shuffle(Simd32x4ShuffleInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitSimd32x4ShuffleMix( Simd32x4ShuffleMixInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitSimd32x4GetSignMask( Simd32x4GetSignMaskInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitFloat32x4Zero(Float32x4ZeroInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitFloat32x4Splat(Float32x4SplatInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitFloat32x4Comparison( Float32x4ComparisonInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitFloat32x4MinMax(Float32x4MinMaxInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitFloat32x4Scale(Float32x4ScaleInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitFloat32x4Sqrt(Float32x4SqrtInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitFloat32x4ZeroArg(Float32x4ZeroArgInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitFloat32x4Clamp(Float32x4ClampInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitFloat32x4With(Float32x4WithInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitFloat32x4ToInt32x4( Float32x4ToInt32x4Instr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitInt32x4Constructor( Int32x4ConstructorInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitInt32x4BoolConstructor( Int32x4BoolConstructorInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitInt32x4GetFlag(Int32x4GetFlagInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitInt32x4SetFlag(Int32x4SetFlagInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitInt32x4Select(Int32x4SelectInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitInt32x4ToFloat32x4( Int32x4ToFloat32x4Instr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitBinaryInt32x4Op(BinaryInt32x4OpInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitSimd64x2Shuffle(Simd64x2ShuffleInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitBinaryFloat64x2Op(BinaryFloat64x2OpInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitFloat32x4ToFloat64x2( Float32x4ToFloat64x2Instr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitFloat64x2ToFloat32x4( Float64x2ToFloat32x4Instr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitFloat64x2Zero(Float64x2ZeroInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitFloat64x2Splat(Float64x2SplatInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitFloat64x2Constructor( Float64x2ConstructorInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitFloat64x2ZeroArg(Float64x2ZeroArgInstr* instr) { // TODO(johnmccutchan): Implement constant propagation. SetValue(instr, non_constant_); } - void ConstantPropagator::VisitFloat64x2OneArg(Float64x2OneArgInstr* instr) { // TODO(johnmccutchan): Implement constant propagation. SetValue(instr, non_constant_); } - void ConstantPropagator::VisitMathUnary(MathUnaryInstr* instr) { const Object& value = instr->value()->definition()->constant_value(); if (IsNonConstant(value)) { @@ -1409,7 +1267,6 @@ void ConstantPropagator::VisitMathUnary(MathUnaryInstr* instr) { } } - void ConstantPropagator::VisitMathMinMax(MathMinMaxInstr* instr) { const Object& left = instr->left()->definition()->constant_value(); const Object& right = instr->right()->definition()->constant_value(); @@ -1421,13 +1278,11 @@ void ConstantPropagator::VisitMathMinMax(MathMinMaxInstr* instr) { } } - void ConstantPropagator::VisitCaseInsensitiveCompareUC16( CaseInsensitiveCompareUC16Instr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitUnbox(UnboxInstr* instr) { const Object& value = instr->value()->definition()->constant_value(); if (IsNonConstant(value)) { @@ -1438,7 +1293,6 @@ void ConstantPropagator::VisitUnbox(UnboxInstr* instr) { } } - void ConstantPropagator::VisitBox(BoxInstr* instr) { const Object& value = instr->value()->definition()->constant_value(); if (IsNonConstant(value)) { @@ -1449,43 +1303,36 @@ void ConstantPropagator::VisitBox(BoxInstr* instr) { } } - void ConstantPropagator::VisitBoxUint32(BoxUint32Instr* instr) { // TODO(kmillikin): Handle box operation. SetValue(instr, non_constant_); } - void ConstantPropagator::VisitUnboxUint32(UnboxUint32Instr* instr) { // TODO(kmillikin): Handle unbox operation. SetValue(instr, non_constant_); } - void ConstantPropagator::VisitBoxInt32(BoxInt32Instr* instr) { // TODO(kmillikin): Handle box operation. SetValue(instr, non_constant_); } - void ConstantPropagator::VisitUnboxInt32(UnboxInt32Instr* instr) { // TODO(kmillikin): Handle unbox operation. SetValue(instr, non_constant_); } - void ConstantPropagator::VisitUnboxedIntConverter( UnboxedIntConverterInstr* instr) { SetValue(instr, non_constant_); } - void ConstantPropagator::VisitUnaryUint32Op(UnaryUint32OpInstr* instr) { // TODO(kmillikin): Handle unary operations. SetValue(instr, non_constant_); } - void ConstantPropagator::Analyze() { GraphEntryInstr* entry = graph_->graph_entry(); reachable_->Add(entry->preorder_number()); @@ -1507,14 +1354,12 @@ void ConstantPropagator::Analyze() { } } - static bool IsEmptyBlock(BlockEntryInstr* block) { return block->next()->IsGoto() && (!block->IsJoinEntry() || (block->AsJoinEntry()->phis() == NULL)) && !block->IsIndirectEntry(); } - // Traverses a chain of empty blocks and returns the first reachable non-empty // block that is not dominated by the start block. The empty blocks are added // to the supplied bit vector. @@ -1529,7 +1374,6 @@ static BlockEntryInstr* FindFirstNonEmptySuccessor(TargetEntryInstr* block, return current; } - void ConstantPropagator::EliminateRedundantBranches() { // Canonicalize branches that have no side-effects and where true- and // false-targets are the same. @@ -1586,7 +1430,6 @@ void ConstantPropagator::EliminateRedundantBranches() { } } - void ConstantPropagator::Transform() { if (FLAG_trace_constant_propagation && FlowGraphPrinter::ShouldPrint(graph_->function())) { diff --git a/runtime/vm/constant_propagator.h b/runtime/vm/constant_propagator.h index 23f5fe963c9..e67160f2511 100644 --- a/runtime/vm/constant_propagator.h +++ b/runtime/vm/constant_propagator.h @@ -5,8 +5,8 @@ #ifndef RUNTIME_VM_CONSTANT_PROPAGATOR_H_ #define RUNTIME_VM_CONSTANT_PROPAGATOR_H_ -#include "vm/intermediate_language.h" #include "vm/flow_graph.h" +#include "vm/intermediate_language.h" namespace dart { @@ -85,7 +85,6 @@ class ConstantPropagator : public FlowGraphVisitor { DefinitionWorklist definition_worklist_; }; - } // namespace dart #endif // RUNTIME_VM_CONSTANT_PROPAGATOR_H_ diff --git a/runtime/vm/constants_arm.h b/runtime/vm/constants_arm.h index 9c9d86035e9..d30854c68fa 100644 --- a/runtime/vm/constants_arm.h +++ b/runtime/vm/constants_arm.h @@ -5,8 +5,8 @@ #ifndef RUNTIME_VM_CONSTANTS_ARM_H_ #define RUNTIME_VM_CONSTANTS_ARM_H_ -#include "platform/globals.h" #include "platform/assert.h" +#include "platform/globals.h" namespace dart { @@ -24,7 +24,6 @@ namespace dart { #error "Exactly one of VFPv3_D16 or VFPv3_D32 can be defined at a time." #endif - // The Linux/Android ABI and the iOS ABI differ in their choice of frame // pointer, their treatment of R9, and the interprocedural stack alignment. @@ -59,7 +58,6 @@ namespace dart { // iOS passes floating point arguments in registers (hardfp) - enum Register { R0 = 0, R1 = 1, @@ -94,7 +92,6 @@ enum Register { PC = R15, }; - // Values for single-precision floating point registers. enum SRegister { kNoSRegister = -1, @@ -133,7 +130,6 @@ enum SRegister { kNumberOfSRegisters = 32, }; - // Values for double-precision floating point registers. enum DRegister { kNoDRegister = -1, @@ -196,7 +192,6 @@ enum DRegister { kNumberOfOverlappingDRegisters = 16, }; - enum QRegister { kNoQRegister = -1, Q0 = 0, @@ -230,7 +225,6 @@ enum QRegister { #endif }; - static inline DRegister EvenDRegisterOf(QRegister q) { return static_cast(q * 2); } @@ -239,7 +233,6 @@ static inline DRegister OddDRegisterOf(QRegister q) { return static_cast((q * 2) + 1); } - static inline SRegister EvenSRegisterOf(DRegister d) { #if defined(VFPv3_D32) // When we have 32 D registers, the S registers only overlap the first 16. @@ -256,7 +249,6 @@ static inline SRegister OddSRegisterOf(DRegister d) { return static_cast((d * 2) + 1); } - // Register aliases for floating point scratch registers. const QRegister QTMP = Q7; // Overlaps with DTMP, STMP. const DRegister DTMP = EvenDRegisterOf(QTMP); // Overlaps with STMP. @@ -294,12 +286,10 @@ const Register kExceptionObjectReg = R0; // an exception is thrown. const Register kStackTraceObjectReg = R1; - // List of registers used in load/store multiple. typedef uint16_t RegList; const RegList kAllCpuRegistersList = 0xFFFF; - // C++ ABI call registers. const RegList kAbiArgumentCpuRegs = (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3); @@ -334,7 +324,6 @@ const QRegister kDartFirstVolatileFpuReg = Q0; const QRegister kDartLastVolatileFpuReg = Q3; const int kDartVolatileFpuRegCount = 4; - // Values for the condition field as defined in section A3.2. enum Condition { kNoCondition = -1, @@ -358,7 +347,6 @@ enum Condition { kInvalidCondition = 16 }; - // Opcodes for Data-processing instructions (instructions with a type 0 and 1) // as defined in section A3.4 enum Opcode { @@ -382,7 +370,6 @@ enum Opcode { kMaxOperand = 16 }; - // Shifter types for Data-processing operands as defined in section A5.1.2. enum Shift { kNoShift = -1, @@ -393,7 +380,6 @@ enum Shift { kMaxShift = 4 }; - // Constants used for the decoding or encoding of the individual fields of // instructions. Based on the "Figure 3-1 ARM instruction set summary". enum InstructionFields { @@ -472,7 +458,6 @@ enum InstructionFields { kBranchOffsetMask = 0x00ffffff }; - // The class Instr enables access to individual fields defined in the ARM // architecture instruction set encoding as described in figure A3-1. // @@ -529,7 +514,6 @@ class Instr { return (InstructionBits() >> shift) & ((1 << count) - 1); } - // Accessors for the different named fields used in the ARM encoding. // The naming of these accessor corresponds to figure A3-1. // Generally applicable fields diff --git a/runtime/vm/constants_arm64.h b/runtime/vm/constants_arm64.h index 315a8683606..8601724ff97 100644 --- a/runtime/vm/constants_arm64.h +++ b/runtime/vm/constants_arm64.h @@ -58,7 +58,6 @@ enum Register { LR = R30, }; - enum VRegister { V0 = 0, V1 = 1, @@ -138,7 +137,6 @@ const int64_t kWRegMask = 0x00000000ffffffffL; typedef uint32_t RegList; const RegList kAllCpuRegistersList = 0xFFFF; - // C++ ABI call registers. const RegList kAbiArgumentCpuRegs = (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3) | (1 << R4) | (1 << R5) | @@ -631,7 +629,6 @@ enum FPIntCvtOp { SCVTFD = FPIntCvtFixed | B22 | B17, }; - #define APPLY_OP_LIST(_V) \ _V(DPImmediate) \ _V(CompareBranch) \ @@ -671,7 +668,6 @@ enum FPIntCvtOp { _V(FPImm) \ _V(FPIntCvt) - enum Shift { kNoShift = -1, LSL = 0, // Logical shift left @@ -806,7 +802,6 @@ enum InstructionFields { kHintOp2Bits = 3, }; - // Helper functions for decoding logical immediates. static inline uint64_t RotateRight(uint64_t value, uint8_t rotate, diff --git a/runtime/vm/constants_dbc.h b/runtime/vm/constants_dbc.h index adb6d052bb6..0c2d530361d 100644 --- a/runtime/vm/constants_dbc.h +++ b/runtime/vm/constants_dbc.h @@ -5,11 +5,10 @@ #ifndef RUNTIME_VM_CONSTANTS_DBC_H_ #define RUNTIME_VM_CONSTANTS_DBC_H_ -#include "platform/globals.h" #include "platform/assert.h" +#include "platform/globals.h" #include "platform/utils.h" - namespace dart { // clang-format off diff --git a/runtime/vm/constants_ia32.h b/runtime/vm/constants_ia32.h index 25f927f329a..b34b6ec0494 100644 --- a/runtime/vm/constants_ia32.h +++ b/runtime/vm/constants_ia32.h @@ -22,7 +22,6 @@ enum Register { kNoRegister = -1, // Signals an illegal register. }; - enum ByteRegister { AL = 0, CL = 1, @@ -35,7 +34,6 @@ enum ByteRegister { kNoByteRegister = -1 // Signals an illegal register. }; - enum XmmRegister { XMM0 = 0, XMM1 = 1, @@ -49,14 +47,12 @@ enum XmmRegister { kNoXmmRegister = -1 // Signals an illegal register. }; - // Architecture independent aliases. typedef XmmRegister FpuRegister; const FpuRegister FpuTMP = XMM0; const int kNumberOfFpuRegisters = kNumberOfXmmRegisters; const FpuRegister kNoFpuRegister = kNoXmmRegister; - // Register aliases. const Register TMP = kNoRegister; // No scratch register used by assembler. const Register TMP2 = kNoRegister; // No second assembler scratch register. @@ -79,7 +75,6 @@ const Register kExceptionObjectReg = EAX; // an exception is thrown. const Register kStackTraceObjectReg = EDX; - typedef uint32_t RegList; const RegList kAllCpuRegistersList = 0xFF; @@ -88,7 +83,6 @@ const intptr_t kReservedCpuRegisters = (1 << SPREG) | (1 << FPREG) | (1 << THR); const RegList kDartAvailableCpuRegs = kAllCpuRegistersList & ~kReservedCpuRegisters; - enum ScaleFactor { TIMES_1 = 0, TIMES_2 = 1, @@ -98,7 +92,6 @@ enum ScaleFactor { TIMES_HALF_WORD_SIZE = kWordSizeLog2 - 1 }; - enum Condition { OVERFLOW = 0, NO_OVERFLOW = 1, @@ -127,7 +120,6 @@ enum Condition { INVALID_CONDITION = 16 }; - class Instr { public: static const uint8_t kHltInstruction = 0xF4; @@ -152,7 +144,6 @@ class Instr { DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); }; - // The largest multibyte nop we will emit. This could go up to 15 if it // becomes important to us. const int MAX_NOP_SIZE = 8; diff --git a/runtime/vm/constants_x64.h b/runtime/vm/constants_x64.h index 09fd07cc4a8..6acd4ba2af5 100644 --- a/runtime/vm/constants_x64.h +++ b/runtime/vm/constants_x64.h @@ -28,7 +28,6 @@ enum Register { kNoRegister = -1, // Signals an illegal register. }; - enum ByteRegister { AL = 0, CL = 1, @@ -41,7 +40,6 @@ enum ByteRegister { kNoByteRegister = -1 // Signals an illegal register. }; - enum XmmRegister { XMM0 = 0, XMM1 = 1, @@ -63,14 +61,12 @@ enum XmmRegister { kNoXmmRegister = -1 // Signals an illegal register. }; - // Architecture independent aliases. typedef XmmRegister FpuRegister; const FpuRegister FpuTMP = XMM0; const int kNumberOfFpuRegisters = kNumberOfXmmRegisters; const FpuRegister kNoFpuRegister = kNoXmmRegister; - enum RexBits { REX_NONE = 0, REX_B = 1 << 0, @@ -80,7 +76,6 @@ enum RexBits { REX_PREFIX = 1 << 6 }; - // Register aliases. const Register TMP = R11; // Used as scratch register by the assembler. const Register TMP2 = kNoRegister; // No second assembler scratch register. @@ -103,7 +98,6 @@ const Register kExceptionObjectReg = RAX; // an exception is thrown. const Register kStackTraceObjectReg = RDX; - typedef uint32_t RegList; const RegList kAllCpuRegistersList = 0xFFFF; @@ -113,7 +107,6 @@ const RegList kReservedCpuRegisters = const RegList kDartAvailableCpuRegs = kAllCpuRegistersList & ~kReservedCpuRegisters; - enum ScaleFactor { TIMES_1 = 0, TIMES_2 = 1, @@ -123,7 +116,6 @@ enum ScaleFactor { TIMES_HALF_WORD_SIZE = kWordSizeLog2 - 1 }; - enum Condition { OVERFLOW = 0, NO_OVERFLOW = 1, @@ -233,7 +225,6 @@ class Instr { DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); }; - // The largest multibyte nop we will emit. This could go up to 15 if it // becomes important to us. const int MAX_NOP_SIZE = 8; diff --git a/runtime/vm/cpu.h b/runtime/vm/cpu.h index 1ebb2bfddf7..e75e1a168f4 100644 --- a/runtime/vm/cpu.h +++ b/runtime/vm/cpu.h @@ -5,8 +5,8 @@ #ifndef RUNTIME_VM_CPU_H_ #define RUNTIME_VM_CPU_H_ -#include "vm/globals.h" #include "vm/allocation.h" +#include "vm/globals.h" namespace dart { @@ -14,7 +14,6 @@ namespace dart { class Error; class Instance; - class CPU : public AllStatic { public: static void FlushICache(uword start, uword size); diff --git a/runtime/vm/cpu_arm.cc b/runtime/vm/cpu_arm.cc index 7a55c0f4423..981d69f0abe 100644 --- a/runtime/vm/cpu_arm.cc +++ b/runtime/vm/cpu_arm.cc @@ -117,7 +117,6 @@ void CPU::FlushICache(uword start, uword size) { #endif } - const char* CPU::Id() { return #if defined(USING_SIMULATOR) @@ -126,7 +125,6 @@ const char* CPU::Id() { "arm"; } - bool HostCPUFeatures::integer_division_supported_ = false; bool HostCPUFeatures::vfp_supported_ = false; bool HostCPUFeatures::neon_supported_ = false; @@ -138,7 +136,6 @@ intptr_t HostCPUFeatures::store_pc_read_offset_ = 8; bool HostCPUFeatures::initialized_ = false; #endif - #if !defined(USING_SIMULATOR) #if HOST_OS_IOS void HostCPUFeatures::InitOnce() { @@ -284,7 +281,6 @@ void HostCPUFeatures::InitOnce() { #endif } - void HostCPUFeatures::Cleanup() { DEBUG_ASSERT(initialized_); #if defined(DEBUG) diff --git a/runtime/vm/cpu_arm64.cc b/runtime/vm/cpu_arm64.cc index 290d90da640..0c089aeff09 100644 --- a/runtime/vm/cpu_arm64.cc +++ b/runtime/vm/cpu_arm64.cc @@ -15,7 +15,7 @@ #if !defined(HOST_OS_FUCHSIA) #include /* NOLINT */ #endif -#include /* NOLINT */ +#include /* NOLINT */ #endif namespace dart { @@ -47,7 +47,6 @@ void CPU::FlushICache(uword start, uword size) { #endif } - const char* CPU::Id() { return #if defined(USING_SIMULATOR) @@ -56,13 +55,11 @@ const char* CPU::Id() { "arm64"; } - const char* HostCPUFeatures::hardware_ = NULL; #if defined(DEBUG) bool HostCPUFeatures::initialized_ = false; #endif - #if !defined(USING_SIMULATOR) void HostCPUFeatures::InitOnce() { CpuInfo::InitOnce(); @@ -72,7 +69,6 @@ void HostCPUFeatures::InitOnce() { #endif } - void HostCPUFeatures::Cleanup() { DEBUG_ASSERT(initialized_); #if defined(DEBUG) @@ -94,7 +90,6 @@ void HostCPUFeatures::InitOnce() { #endif } - void HostCPUFeatures::Cleanup() { DEBUG_ASSERT(initialized_); #if defined(DEBUG) diff --git a/runtime/vm/cpu_dbc.cc b/runtime/vm/cpu_dbc.cc index 0e61fbd4976..f677b39f048 100644 --- a/runtime/vm/cpu_dbc.cc +++ b/runtime/vm/cpu_dbc.cc @@ -16,12 +16,10 @@ void CPU::FlushICache(uword start, uword size) { // Nothing to do. } - const char* CPU::Id() { return "dbc"; } - const char* HostCPUFeatures::hardware_ = NULL; #if defined(DEBUG) bool HostCPUFeatures::initialized_ = false; @@ -35,7 +33,6 @@ void HostCPUFeatures::InitOnce() { #endif } - void HostCPUFeatures::Cleanup() { DEBUG_ASSERT(initialized_); #if defined(DEBUG) diff --git a/runtime/vm/cpu_ia32.cc b/runtime/vm/cpu_ia32.cc index a5f02c29dd6..5ff61736b7c 100644 --- a/runtime/vm/cpu_ia32.cc +++ b/runtime/vm/cpu_ia32.cc @@ -23,12 +23,10 @@ void CPU::FlushICache(uword start, uword size) { // Nothing to be done here. } - const char* CPU::Id() { return "ia32"; } - bool HostCPUFeatures::sse2_supported_ = false; bool HostCPUFeatures::sse4_1_supported_ = false; const char* HostCPUFeatures::hardware_ = NULL; @@ -49,7 +47,6 @@ void HostCPUFeatures::InitOnce() { #endif } - void HostCPUFeatures::Cleanup() { DEBUG_ASSERT(initialized_); #if defined(DEBUG) diff --git a/runtime/vm/cpu_test.cc b/runtime/vm/cpu_test.cc index ed76a8836bb..35c44f4beb0 100644 --- a/runtime/vm/cpu_test.cc +++ b/runtime/vm/cpu_test.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "platform/assert.h" #include "vm/cpu.h" +#include "platform/assert.h" #include "vm/globals.h" #include "vm/unit_test.h" diff --git a/runtime/vm/cpu_x64.cc b/runtime/vm/cpu_x64.cc index 72b3478e8a5..47637fd7260 100644 --- a/runtime/vm/cpu_x64.cc +++ b/runtime/vm/cpu_x64.cc @@ -19,17 +19,14 @@ namespace dart { DEFINE_FLAG(bool, use_sse41, true, "Use SSE 4.1 if available"); - void CPU::FlushICache(uword start, uword size) { // Nothing to be done here. } - const char* CPU::Id() { return "x64"; } - bool HostCPUFeatures::sse2_supported_ = true; bool HostCPUFeatures::sse4_1_supported_ = false; const char* HostCPUFeatures::hardware_ = NULL; @@ -48,7 +45,6 @@ void HostCPUFeatures::InitOnce() { #endif } - void HostCPUFeatures::Cleanup() { DEBUG_ASSERT(initialized_); #if defined(DEBUG) diff --git a/runtime/vm/cpuid.cc b/runtime/vm/cpuid.cc index 4800c5be72d..d0b450bebdc 100644 --- a/runtime/vm/cpuid.cc +++ b/runtime/vm/cpuid.cc @@ -34,7 +34,6 @@ void CpuId::GetCpuId(int32_t level, uint32_t info[4]) { #endif } - void CpuId::InitOnce() { uint32_t info[4] = {static_cast(-1)}; @@ -63,7 +62,6 @@ void CpuId::InitOnce() { CpuId::brand_string_ = brand_string; } - void CpuId::Cleanup() { ASSERT(id_string_ != NULL); free(const_cast(id_string_)); @@ -74,17 +72,14 @@ void CpuId::Cleanup() { brand_string_ = NULL; } - const char* CpuId::id_string() { return strdup(id_string_); } - const char* CpuId::brand_string() { return strdup(brand_string_); } - const char* CpuId::field(CpuInfoIndices idx) { switch (idx) { case kCpuInfoProcessor: diff --git a/runtime/vm/cpuinfo_android.cc b/runtime/vm/cpuinfo_android.cc index 9e50248fa29..5aa7f93ac4e 100644 --- a/runtime/vm/cpuinfo_android.cc +++ b/runtime/vm/cpuinfo_android.cc @@ -37,24 +37,20 @@ void CpuInfo::InitOnce() { #endif } - void CpuInfo::Cleanup() { ProcCpuInfo::Cleanup(); } - bool CpuInfo::FieldContains(CpuInfoIndices idx, const char* search_string) { ASSERT(method_ != kCpuInfoDefault); return ProcCpuInfo::FieldContains(FieldName(idx), search_string); } - const char* CpuInfo::ExtractField(CpuInfoIndices idx) { ASSERT(method_ != kCpuInfoDefault); return ProcCpuInfo::ExtractField(FieldName(idx)); } - bool CpuInfo::HasField(const char* field) { ASSERT(method_ != kCpuInfoDefault); return ProcCpuInfo::HasField(field); diff --git a/runtime/vm/cpuinfo_fuchsia.cc b/runtime/vm/cpuinfo_fuchsia.cc index 9ddb06e30e8..6b3e0767af1 100644 --- a/runtime/vm/cpuinfo_fuchsia.cc +++ b/runtime/vm/cpuinfo_fuchsia.cc @@ -31,14 +31,12 @@ void CpuInfo::InitOnce() { #endif } - void CpuInfo::Cleanup() { if (method_ == kCpuInfoCpuId) { CpuId::Cleanup(); } } - bool CpuInfo::FieldContains(CpuInfoIndices idx, const char* search_string) { if (method_ == kCpuInfoCpuId) { return strstr(CpuId::field(idx), search_string); @@ -47,7 +45,6 @@ bool CpuInfo::FieldContains(CpuInfoIndices idx, const char* search_string) { } } - const char* CpuInfo::ExtractField(CpuInfoIndices idx) { if (method_ == kCpuInfoCpuId) { return CpuId::field(idx); @@ -56,7 +53,6 @@ const char* CpuInfo::ExtractField(CpuInfoIndices idx) { } } - bool CpuInfo::HasField(const char* field) { if (method_ == kCpuInfoCpuId) { return (strcmp(field, fields_[kCpuInfoProcessor]) == 0) || diff --git a/runtime/vm/cpuinfo_linux.cc b/runtime/vm/cpuinfo_linux.cc index 3289a157398..94c4678eb1c 100644 --- a/runtime/vm/cpuinfo_linux.cc +++ b/runtime/vm/cpuinfo_linux.cc @@ -5,8 +5,8 @@ #include "vm/globals.h" #if defined(HOST_OS_LINUX) -#include "vm/cpuinfo.h" #include "vm/cpuid.h" +#include "vm/cpuinfo.h" #include "vm/proccpuinfo.h" #include "platform/assert.h" @@ -50,7 +50,6 @@ void CpuInfo::InitOnce() { #endif } - void CpuInfo::Cleanup() { if (method_ == kCpuInfoCpuId) { CpuId::Cleanup(); @@ -60,7 +59,6 @@ void CpuInfo::Cleanup() { } } - bool CpuInfo::FieldContains(CpuInfoIndices idx, const char* search_string) { if (method_ == kCpuInfoCpuId) { const char* field = CpuId::field(idx); @@ -73,7 +71,6 @@ bool CpuInfo::FieldContains(CpuInfoIndices idx, const char* search_string) { } } - const char* CpuInfo::ExtractField(CpuInfoIndices idx) { if (method_ == kCpuInfoCpuId) { return CpuId::field(idx); @@ -83,7 +80,6 @@ const char* CpuInfo::ExtractField(CpuInfoIndices idx) { } } - bool CpuInfo::HasField(const char* field) { if (method_ == kCpuInfoCpuId) { return (strcmp(field, fields_[kCpuInfoProcessor]) == 0) || diff --git a/runtime/vm/cpuinfo_macos.cc b/runtime/vm/cpuinfo_macos.cc index 6139f5602f1..b47720245dd 100644 --- a/runtime/vm/cpuinfo_macos.cc +++ b/runtime/vm/cpuinfo_macos.cc @@ -8,8 +8,8 @@ #include "vm/cpuinfo.h" #include // NOLINT -#include // NOLINT #include // NOLINT +#include // NOLINT #include "platform/assert.h" @@ -28,10 +28,8 @@ void CpuInfo::InitOnce() { fields_[kCpuInfoArchitecture] = NULL; } - void CpuInfo::Cleanup() {} - bool CpuInfo::FieldContains(CpuInfoIndices idx, const char* search_string) { ASSERT(method_ != kCpuInfoDefault); ASSERT(search_string != NULL); @@ -48,7 +46,6 @@ bool CpuInfo::FieldContains(CpuInfoIndices idx, const char* search_string) { return (strcasestr(dest, search_string) != NULL); } - const char* CpuInfo::ExtractField(CpuInfoIndices idx) { ASSERT(method_ != kCpuInfoDefault); const char* field = FieldName(idx); @@ -70,7 +67,6 @@ const char* CpuInfo::ExtractField(CpuInfoIndices idx) { return result; } - bool CpuInfo::HasField(const char* field) { ASSERT(method_ != kCpuInfoDefault); ASSERT(field != NULL); diff --git a/runtime/vm/cpuinfo_test.cc b/runtime/vm/cpuinfo_test.cc index 2d8434e1e47..34787fded6b 100644 --- a/runtime/vm/cpuinfo_test.cc +++ b/runtime/vm/cpuinfo_test.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "platform/assert.h" #include "vm/cpuinfo.h" +#include "platform/assert.h" #include "vm/globals.h" #include "vm/unit_test.h" diff --git a/runtime/vm/cpuinfo_win.cc b/runtime/vm/cpuinfo_win.cc index 7d0820a0c85..bef8c84d0e7 100644 --- a/runtime/vm/cpuinfo_win.cc +++ b/runtime/vm/cpuinfo_win.cc @@ -5,8 +5,8 @@ #include "vm/globals.h" #if defined(HOST_OS_WINDOWS) -#include "vm/cpuinfo.h" #include "vm/cpuid.h" +#include "vm/cpuinfo.h" // __cpuid() #include // NOLINT @@ -32,24 +32,20 @@ void CpuInfo::InitOnce() { fields_[kCpuInfoArchitecture] = NULL; } - void CpuInfo::Cleanup() { CpuId::Cleanup(); } - bool CpuInfo::FieldContains(CpuInfoIndices idx, const char* search_string) { ASSERT(method_ != kCpuInfoDefault); return strstr(CpuId::field(idx), search_string); } - const char* CpuInfo::ExtractField(CpuInfoIndices idx) { ASSERT(method_ != kCpuInfoDefault); return CpuId::field(idx); } - bool CpuInfo::HasField(const char* field) { ASSERT(method_ != kCpuInfoDefault); return (strcmp(field, fields_[kCpuInfoProcessor]) == 0) || diff --git a/runtime/vm/custom_isolate_test.cc b/runtime/vm/custom_isolate_test.cc index 188e6b8b48b..90ac39c680d 100644 --- a/runtime/vm/custom_isolate_test.cc +++ b/runtime/vm/custom_isolate_test.cc @@ -24,7 +24,6 @@ static Dart_NativeFunction NativeLookup(Dart_Handle name, int argc, bool* auto_setup_scope); - static const char* kCustomIsolateScriptChars = "import 'dart:isolate';\n" "\n" @@ -77,7 +76,6 @@ static const char* kCustomIsolateScriptChars = " return 'success';\n" "}\n"; - // An entry in our event queue. class Event { protected: @@ -95,7 +93,6 @@ class Event { Event* next_; }; - // A simple event queue for our test. class EventQueue { public: @@ -153,7 +150,6 @@ class EventQueue { }; EventQueue* event_queue; - // Start an isolate. class StartEvent : public Event { public: @@ -166,7 +162,6 @@ class StartEvent : public Event { const char* main_; }; - void StartEvent::Process() { OS::Print(">> StartEvent with isolate(%p)--\n", isolate()); Dart_EnterIsolate(isolate()); @@ -186,7 +181,6 @@ void StartEvent::Process() { Dart_ExitIsolate(); } - // Notify an isolate of a pending message. class MessageEvent : public Event { public: @@ -197,7 +191,6 @@ class MessageEvent : public Event { virtual void Process(); }; - void MessageEvent::Process() { OS::Print("$$ MessageEvent with isolate(%p)\n", isolate()); Dart_EnterIsolate(isolate()); @@ -219,14 +212,12 @@ void MessageEvent::Process() { ASSERT(Dart_CurrentIsolate() == NULL); } - static void NotifyMessage(Dart_Isolate dest_isolate) { OS::Print("-- Notify isolate(%p) of pending message --\n", dest_isolate); OS::Print("-- Adding MessageEvent to queue --\n"); event_queue->Add(new MessageEvent(dest_isolate)); } - static Dart_NativeFunction NativeLookup(Dart_Handle name, int argc, bool* auto_setup_scope) { @@ -243,7 +234,6 @@ static Dart_NativeFunction NativeLookup(Dart_Handle name, return NULL; } - char* saved_echo = NULL; static void native_echo(Dart_NativeArguments args) { Dart_EnterScope(); @@ -260,7 +250,6 @@ static void native_echo(Dart_NativeArguments args) { Dart_ExitScope(); } - static void CustomIsolateImpl_start(Dart_NativeArguments args) { OS::Print("-- Enter: CustomIsolateImpl_start --\n"); @@ -314,7 +303,6 @@ static void CustomIsolateImpl_start(Dart_NativeArguments args) { Dart_ExitScope(); } - VM_UNIT_TEST_CASE(CustomIsolates) { bool saved_flag = FLAG_trace_shutdown; FLAG_trace_shutdown = true; diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc index 33ca87bf6ba..90b0e2d4b04 100644 --- a/runtime/vm/dart.cc +++ b/runtime/vm/dart.cc @@ -21,8 +21,8 @@ #include "vm/message_handler.h" #include "vm/metrics.h" #include "vm/object.h" -#include "vm/object_store.h" #include "vm/object_id_ring.h" +#include "vm/object_store.h" #include "vm/port.h" #include "vm/profiler.h" #include "vm/service_isolate.h" @@ -80,7 +80,6 @@ class ReadOnlyHandles { DISALLOW_COPY_AND_ASSIGN(ReadOnlyHandles); }; - static void CheckOffsets() { #define CHECK_OFFSET(expr, offset) \ if ((expr) != (offset)) { \ @@ -110,7 +109,6 @@ static void CheckOffsets() { #undef CHECK_OFFSET } - char* Dart::InitOnce(const uint8_t* vm_isolate_snapshot, const uint8_t* instructions_snapshot, Dart_IsolateCreateCallback create, @@ -319,7 +317,6 @@ char* Dart::InitOnce(const uint8_t* vm_isolate_snapshot, return NULL; } - // This waits until only the VM isolate and the service isolate remains in the // list, i.e. list length == 2. void Dart::WaitForApplicationIsolateShutdown() { @@ -337,7 +334,6 @@ void Dart::WaitForApplicationIsolateShutdown() { ServiceIsolate::IsServiceIsolate(Isolate::isolates_list_head_))); } - // This waits until only the VM isolate remains in the list. void Dart::WaitForIsolateShutdown() { ASSERT(!Isolate::creation_enabled_); @@ -349,7 +345,6 @@ void Dart::WaitForIsolateShutdown() { ASSERT(Isolate::isolates_list_head_ == Dart::vm_isolate()); } - const char* Dart::Cleanup() { ASSERT(Isolate::Current() == NULL); if (vm_isolate_ == NULL) { @@ -370,7 +365,6 @@ const char* Dart::Cleanup() { Profiler::Shutdown(); } - { // Set the VM isolate as current isolate when shutting down // Metrics so that we can use a StackZone. @@ -488,7 +482,6 @@ const char* Dart::Cleanup() { return NULL; } - Isolate* Dart::CreateIsolate(const char* name_prefix, const Dart_IsolateFlags& api_flags) { // Create a new isolate. @@ -496,7 +489,6 @@ Isolate* Dart::CreateIsolate(const char* name_prefix, return isolate; } - static bool IsSnapshotCompatible(Snapshot::Kind vm_kind, Snapshot::Kind isolate_kind) { if (vm_kind == isolate_kind) return true; @@ -505,7 +497,6 @@ static bool IsSnapshotCompatible(Snapshot::Kind vm_kind, return Snapshot::IsFull(isolate_kind); } - RawError* Dart::InitializeIsolate(const uint8_t* snapshot_data, const uint8_t* snapshot_instructions, intptr_t snapshot_length, @@ -644,7 +635,6 @@ RawError* Dart::InitializeIsolate(const uint8_t* snapshot_data, return Error::null(); } - const char* Dart::FeaturesString(Isolate* isolate, Snapshot::Kind kind) { TextBuffer buffer(64); @@ -662,7 +652,7 @@ const char* Dart::FeaturesString(Isolate* isolate, Snapshot::Kind kind) { buffer.AddString(" support-debugger"); } - // Checked mode affects deopt ids. +// Checked mode affects deopt ids. #define ADD_FLAG(name, isolate_flag, flag) \ do { \ const bool name = (isolate != NULL) ? isolate->name() : flag; \ @@ -713,7 +703,6 @@ const char* Dart::FeaturesString(Isolate* isolate, Snapshot::Kind kind) { return buffer.Steal(); } - void Dart::RunShutdownCallback() { Isolate* isolate = Isolate::Current(); void* callback_data = isolate->init_callback_data(); @@ -723,7 +712,6 @@ void Dart::RunShutdownCallback() { } } - void Dart::ShutdownIsolate(Isolate* isolate) { ASSERT(Isolate::Current() == NULL); // We need to enter the isolate in order to shut it down. @@ -735,39 +723,33 @@ void Dart::ShutdownIsolate(Isolate* isolate) { ASSERT(Isolate::Current() == NULL); } - void Dart::ShutdownIsolate() { Isolate* isolate = Isolate::Current(); isolate->Shutdown(); delete isolate; } - int64_t Dart::UptimeMicros() { return OS::GetCurrentMonotonicMicros() - Dart::start_time_micros_; } - uword Dart::AllocateReadOnlyHandle() { ASSERT(Isolate::Current() == Dart::vm_isolate()); ASSERT(predefined_handles_ != NULL); return predefined_handles_->handles_.AllocateScopedHandle(); } - LocalHandle* Dart::AllocateReadOnlyApiHandle() { ASSERT(Isolate::Current() == Dart::vm_isolate()); ASSERT(predefined_handles_ != NULL); return predefined_handles_->api_handles_.AllocateHandle(); } - bool Dart::IsReadOnlyHandle(uword address) { ASSERT(predefined_handles_ != NULL); return predefined_handles_->handles_.IsValidScopedHandle(address); } - bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { ASSERT(predefined_handles_ != NULL); return predefined_handles_->api_handles_.IsValidHandle(handle); diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc index 029bb295c31..05f84cdee3b 100644 --- a/runtime/vm/dart_api_impl.cc +++ b/runtime/vm/dart_api_impl.cc @@ -59,7 +59,6 @@ namespace dart { // Facilitate quick access to the current zone once we have the current thread. #define Z (T->zone()) - DECLARE_FLAG(bool, use_dart_frontend); DECLARE_FLAG(bool, print_class_table); DECLARE_FLAG(bool, verify_handles); @@ -78,14 +77,12 @@ DEFINE_FLAG(bool, false, "Support Dart_MakeExternalString."); - ThreadLocalKey Api::api_native_key_ = kUnsetThreadLocalKey; Dart_Handle Api::true_handle_ = NULL; Dart_Handle Api::false_handle_ = NULL; Dart_Handle Api::null_handle_ = NULL; Dart_Handle Api::empty_string_handle_ = NULL; - const char* CanonicalFunction(const char* func) { if (strncmp(func, "dart::", 6) == 0) { return func + 6; @@ -154,7 +151,6 @@ class CheckFunctionTypesVisitor : public ObjectVisitor { }; #endif // #if defined(DEBUG). - static RawInstance* GetListInstance(Zone* zone, const Object& obj) { if (obj.IsInstance()) { const Library& core_lib = Library::Handle(zone, Library::CoreLibrary()); @@ -193,7 +189,6 @@ static RawInstance* GetMapInstance(Zone* zone, const Object& obj) { return Instance::null(); } - static bool IsCompiletimeErrorObject(Zone* zone, const Object& obj) { #if defined(DART_PRECOMPILED_RUNTIME) // All compile-time errors were handled at snapshot generation time and @@ -208,7 +203,6 @@ static bool IsCompiletimeErrorObject(Zone* zone, const Object& obj) { #endif } - static bool GetNativeStringArgument(NativeArguments* arguments, int arg_index, Dart_Handle* str, @@ -236,7 +230,6 @@ static bool GetNativeStringArgument(NativeArguments* arguments, return false; } - static bool GetNativeIntegerArgument(NativeArguments* arguments, int arg_index, int64_t* value) { @@ -260,7 +253,6 @@ static bool GetNativeIntegerArgument(NativeArguments* arguments, return false; } - static bool GetNativeUnsignedIntegerArgument(NativeArguments* arguments, int arg_index, uint64_t* value) { @@ -286,7 +278,6 @@ static bool GetNativeUnsignedIntegerArgument(NativeArguments* arguments, return false; } - static bool GetNativeDoubleArgument(NativeArguments* arguments, int arg_index, double* value) { @@ -307,7 +298,6 @@ static bool GetNativeDoubleArgument(NativeArguments* arguments, return false; } - static Dart_Handle GetNativeFieldsOfArgument(NativeArguments* arguments, int arg_index, int num_fields, @@ -342,7 +332,6 @@ static Dart_Handle GetNativeFieldsOfArgument(NativeArguments* arguments, current_func, field_count, num_fields); } - Heap::Space SpaceForExternal(Thread* thread, intptr_t size) { Heap* heap = thread->heap(); // If 'size' would be a significant fraction of new space, then use old. @@ -354,7 +343,6 @@ Heap::Space SpaceForExternal(Thread* thread, intptr_t size) { } } - static RawObject* Send0Arg(const Instance& receiver, const String& selector) { const intptr_t kTypeArgsLen = 0; const intptr_t kNumArgs = 1; @@ -370,7 +358,6 @@ static RawObject* Send0Arg(const Instance& receiver, const String& selector) { return DartEntry::InvokeFunction(function, args); } - static RawObject* Send1Arg(const Instance& receiver, const String& selector, const Instance& argument) { @@ -389,7 +376,6 @@ static RawObject* Send1Arg(const Instance& receiver, return DartEntry::InvokeFunction(function, args); } - static const char* GetErrorString(Thread* thread, const Object& obj) { // This function requires an API scope to be present. if (obj.IsError()) { @@ -409,7 +395,6 @@ static const char* GetErrorString(Thread* thread, const Object& obj) { } } - Dart_Handle Api::InitNewHandle(Thread* thread, RawObject* raw) { LocalHandles* local_handles = Api::TopScope(thread)->local_handles(); ASSERT(local_handles != NULL); @@ -418,7 +403,6 @@ Dart_Handle Api::InitNewHandle(Thread* thread, RawObject* raw) { return ref->apiHandle(); } - Dart_Handle Api::NewHandle(Thread* thread, RawObject* raw) { if (raw == Object::null()) { return Null(); @@ -432,7 +416,6 @@ Dart_Handle Api::NewHandle(Thread* thread, RawObject* raw) { return InitNewHandle(thread, raw); } - RawObject* Api::UnwrapHandle(Dart_Handle object) { #if defined(DEBUG) Thread* thread = Thread::Current(); @@ -446,7 +429,6 @@ RawObject* Api::UnwrapHandle(Dart_Handle object) { return (reinterpret_cast(object))->raw(); } - #define DEFINE_UNWRAP(type) \ const type& Api::Unwrap##type##Handle(Zone* zone, Dart_Handle dart_handle) { \ const Object& obj = Object::Handle(zone, Api::UnwrapHandle(dart_handle)); \ @@ -458,7 +440,6 @@ RawObject* Api::UnwrapHandle(Dart_Handle object) { CLASS_LIST_FOR_HANDLES(DEFINE_UNWRAP) #undef DEFINE_UNWRAP - const String& Api::UnwrapStringHandle(const ReusableObjectHandleScope& reuse, Dart_Handle dart_handle) { Object& ref = reuse.Handle(); @@ -469,7 +450,6 @@ const String& Api::UnwrapStringHandle(const ReusableObjectHandleScope& reuse, return Object::null_string(); } - const Instance& Api::UnwrapInstanceHandle( const ReusableObjectHandleScope& reuse, Dart_Handle dart_handle) { @@ -481,7 +461,6 @@ const Instance& Api::UnwrapInstanceHandle( return Object::null_instance(); } - Dart_Handle Api::CheckAndFinalizePendingClasses(Thread* thread) { Isolate* isolate = thread->isolate(); if (!isolate->AllowClassFinalization()) { @@ -495,12 +474,10 @@ Dart_Handle Api::CheckAndFinalizePendingClasses(Thread* thread) { return Api::NewHandle(thread, thread->sticky_error()); } - Dart_Isolate Api::CastIsolate(Isolate* isolate) { return reinterpret_cast(isolate); } - Dart_Handle Api::NewError(const char* format, ...) { Thread* T = Thread::Current(); CHECK_API_SCOPE(T); @@ -525,7 +502,6 @@ Dart_Handle Api::NewError(const char* format, ...) { return Api::NewHandle(T, ApiError::New(message)); } - void Api::SetupAcquiredError(Isolate* isolate) { ASSERT(isolate != NULL); ApiState* state = isolate->api_state(); @@ -533,7 +509,6 @@ void Api::SetupAcquiredError(Isolate* isolate) { state->SetupAcquiredError(); } - Dart_Handle Api::AcquiredError(Isolate* isolate) { ASSERT(isolate != NULL); ApiState* state = isolate->api_state(); @@ -542,7 +517,6 @@ Dart_Handle Api::AcquiredError(Isolate* isolate) { return reinterpret_cast(acquired_error_handle); } - bool Api::IsValid(Dart_Handle handle) { Isolate* isolate = Isolate::Current(); Thread* thread = Thread::Current(); @@ -560,7 +534,6 @@ bool Api::IsValid(Dart_Handle handle) { Dart::IsReadOnlyHandle(reinterpret_cast(handle)); } - ApiLocalScope* Api::TopScope(Thread* thread) { ASSERT(thread != NULL); ApiLocalScope* scope = thread->api_top_scope(); @@ -568,14 +541,12 @@ ApiLocalScope* Api::TopScope(Thread* thread) { return scope; } - void Api::InitOnce() { ASSERT(api_native_key_ == kUnsetThreadLocalKey); api_native_key_ = OSThread::CreateThreadLocal(); ASSERT(api_native_key_ != kUnsetThreadLocalKey); } - static Dart_Handle InitNewReadOnlyApiHandle(RawObject* raw) { ASSERT(raw->IsVMHeapObject()); LocalHandle* ref = Dart::AllocateReadOnlyApiHandle(); @@ -583,7 +554,6 @@ static Dart_Handle InitNewReadOnlyApiHandle(RawObject* raw) { return ref->apiHandle(); } - void Api::InitHandles() { Isolate* isolate = Isolate::Current(); ASSERT(isolate != NULL); @@ -604,7 +574,6 @@ void Api::InitHandles() { empty_string_handle_ = InitNewReadOnlyApiHandle(Symbols::Empty().raw()); } - bool Api::StringGetPeerHelper(NativeArguments* arguments, int arg_index, void** peer) { @@ -636,7 +605,6 @@ bool Api::StringGetPeerHelper(NativeArguments* arguments, return false; } - bool Api::GetNativeReceiver(NativeArguments* arguments, intptr_t* value) { NoSafepointScope no_safepoint_scope; RawObject* raw_obj = arguments->NativeArg0(); @@ -657,7 +625,6 @@ bool Api::GetNativeReceiver(NativeArguments* arguments, intptr_t* value) { return false; } - bool Api::GetNativeBooleanArgument(NativeArguments* arguments, int arg_index, bool* value) { @@ -677,7 +644,6 @@ bool Api::GetNativeBooleanArgument(NativeArguments* arguments, return false; } - bool Api::GetNativeIntegerArgument(NativeArguments* arguments, int arg_index, int64_t* value) { @@ -695,7 +661,6 @@ bool Api::GetNativeIntegerArgument(NativeArguments* arguments, return true; } - bool Api::GetNativeDoubleArgument(NativeArguments* arguments, int arg_index, double* value) { @@ -718,7 +683,6 @@ bool Api::GetNativeDoubleArgument(NativeArguments* arguments, return true; } - bool Api::GetNativeFieldsOfArgument(NativeArguments* arguments, int arg_index, int num_fields, @@ -744,19 +708,16 @@ bool Api::GetNativeFieldsOfArgument(NativeArguments* arguments, return false; } - void Api::SetWeakHandleReturnValue(NativeArguments* args, Dart_WeakPersistentHandle retval) { args->SetReturnUnsafe(FinalizablePersistentHandle::Cast(retval)->raw()); } - PersistentHandle* PersistentHandle::Cast(Dart_PersistentHandle handle) { ASSERT(Isolate::Current()->api_state()->IsValidPersistentHandle(handle)); return reinterpret_cast(handle); } - FinalizablePersistentHandle* FinalizablePersistentHandle::Cast( Dart_WeakPersistentHandle handle) { #if defined(DEBUG) @@ -766,7 +727,6 @@ FinalizablePersistentHandle* FinalizablePersistentHandle::Cast( return reinterpret_cast(handle); } - void FinalizablePersistentHandle::Finalize( Isolate* isolate, FinalizablePersistentHandle* handle) { @@ -783,24 +743,20 @@ void FinalizablePersistentHandle::Finalize( state->weak_persistent_handles().FreeHandle(handle); } - // --- Handles --- DART_EXPORT bool Dart_IsError(Dart_Handle handle) { return Api::IsError(handle); } - DART_EXPORT bool Dart_IsApiError(Dart_Handle object) { return Api::ClassId(object) == kApiErrorCid; } - DART_EXPORT bool Dart_IsUnhandledExceptionError(Dart_Handle object) { return Api::ClassId(object) == kUnhandledExceptionCid; } - DART_EXPORT bool Dart_IsCompilationError(Dart_Handle object) { if (::Dart_IsUnhandledExceptionError(object)) { DARTSCOPE(Thread::Current()); @@ -812,12 +768,10 @@ DART_EXPORT bool Dart_IsCompilationError(Dart_Handle object) { return Api::ClassId(object) == kLanguageErrorCid; } - DART_EXPORT bool Dart_IsFatalError(Dart_Handle object) { return Api::ClassId(object) == kUnwindErrorCid; } - DART_EXPORT const char* Dart_GetError(Dart_Handle handle) { API_TIMELINE_DURATION; DARTSCOPE(Thread::Current()); @@ -825,14 +779,12 @@ DART_EXPORT const char* Dart_GetError(Dart_Handle handle) { return GetErrorString(T, obj); } - DART_EXPORT bool Dart_ErrorHasException(Dart_Handle handle) { DARTSCOPE(Thread::Current()); const Object& obj = Object::Handle(Z, Api::UnwrapHandle(handle)); return obj.IsUnhandledException(); } - DART_EXPORT Dart_Handle Dart_ErrorGetException(Dart_Handle handle) { DARTSCOPE(Thread::Current()); const Object& obj = Object::Handle(Z, Api::UnwrapHandle(handle)); @@ -846,7 +798,6 @@ DART_EXPORT Dart_Handle Dart_ErrorGetException(Dart_Handle handle) { } } - DART_EXPORT Dart_Handle Dart_ErrorGetStackTrace(Dart_Handle handle) { DARTSCOPE(Thread::Current()); const Object& obj = Object::Handle(Z, Api::UnwrapHandle(handle)); @@ -860,7 +811,6 @@ DART_EXPORT Dart_Handle Dart_ErrorGetStackTrace(Dart_Handle handle) { } } - // TODO(turnidge): This clones Api::NewError. I need to use va_copy to // fix this but not sure if it available on all of our builds. DART_EXPORT Dart_Handle Dart_NewApiError(const char* error) { @@ -871,7 +821,6 @@ DART_EXPORT Dart_Handle Dart_NewApiError(const char* error) { return Api::NewHandle(T, ApiError::New(message)); } - DART_EXPORT Dart_Handle Dart_NewUnhandledExceptionError(Dart_Handle exception) { DARTSCOPE(Thread::Current()); CHECK_CALLBACK_STATE(T); @@ -891,7 +840,6 @@ DART_EXPORT Dart_Handle Dart_NewUnhandledExceptionError(Dart_Handle exception) { return Api::NewHandle(T, UnhandledException::New(obj, stacktrace)); } - DART_EXPORT Dart_Handle Dart_PropagateError(Dart_Handle handle) { Thread* thread = Thread::Current(); TransitionNativeToVM transition(thread); @@ -926,7 +874,6 @@ DART_EXPORT Dart_Handle Dart_PropagateError(Dart_Handle handle) { return Api::NewError("Cannot reach here. Internal error."); } - DART_EXPORT void _Dart_ReportErrorHandle(const char* file, int line, const char* handle, @@ -936,7 +883,6 @@ DART_EXPORT void _Dart_ReportErrorHandle(const char* file, OS::Abort(); } - DART_EXPORT Dart_Handle Dart_ToString(Dart_Handle object) { DARTSCOPE(Thread::Current()); const Object& obj = Object::Handle(Z, Api::UnwrapHandle(object)); @@ -953,7 +899,6 @@ DART_EXPORT Dart_Handle Dart_ToString(Dart_Handle object) { } } - DART_EXPORT bool Dart_IdentityEquals(Dart_Handle obj1, Dart_Handle obj2) { DARTSCOPE(Thread::Current()); { @@ -970,7 +915,6 @@ DART_EXPORT bool Dart_IdentityEquals(Dart_Handle obj1, Dart_Handle obj2) { return false; } - DART_EXPORT uint64_t Dart_IdentityHash(Dart_Handle obj) { DARTSCOPE(Thread::Current()); @@ -1012,7 +956,6 @@ DART_EXPORT uint64_t Dart_IdentityHash(Dart_Handle obj) { return 0; } - DART_EXPORT Dart_Handle Dart_HandleFromPersistent(Dart_PersistentHandle object) { Thread* thread = Thread::Current(); @@ -1025,7 +968,6 @@ Dart_HandleFromPersistent(Dart_PersistentHandle object) { return Api::NewHandle(thread, ref->raw()); } - DART_EXPORT Dart_Handle Dart_HandleFromWeakPersistent(Dart_WeakPersistentHandle object) { Thread* thread = Thread::Current(); @@ -1039,7 +981,6 @@ Dart_HandleFromWeakPersistent(Dart_WeakPersistentHandle object) { return Api::NewHandle(thread, weak_ref->raw()); } - DART_EXPORT Dart_PersistentHandle Dart_NewPersistentHandle(Dart_Handle object) { DARTSCOPE(Thread::Current()); Isolate* I = T->isolate(); @@ -1051,7 +992,6 @@ DART_EXPORT Dart_PersistentHandle Dart_NewPersistentHandle(Dart_Handle object) { return new_ref->apiHandle(); } - DART_EXPORT void Dart_SetPersistentHandle(Dart_PersistentHandle obj1, Dart_Handle obj2) { DARTSCOPE(Thread::Current()); @@ -1064,7 +1004,6 @@ DART_EXPORT void Dart_SetPersistentHandle(Dart_PersistentHandle obj1, obj1_ref->set_raw(obj2_ref); } - static Dart_WeakPersistentHandle AllocateFinalizableHandle( Thread* thread, Dart_Handle object, @@ -1083,7 +1022,6 @@ static Dart_WeakPersistentHandle AllocateFinalizableHandle( return finalizable_ref->apiHandle(); } - DART_EXPORT Dart_WeakPersistentHandle Dart_NewWeakPersistentHandle(Dart_Handle object, void* peer, @@ -1099,7 +1037,6 @@ Dart_NewWeakPersistentHandle(Dart_Handle object, external_allocation_size, callback); } - DART_EXPORT void Dart_DeletePersistentHandle(Dart_PersistentHandle object) { Isolate* isolate = Isolate::Current(); CHECK_ISOLATE(isolate); @@ -1113,7 +1050,6 @@ DART_EXPORT void Dart_DeletePersistentHandle(Dart_PersistentHandle object) { } } - DART_EXPORT void Dart_DeleteWeakPersistentHandle( Dart_Isolate current_isolate, Dart_WeakPersistentHandle object) { @@ -1129,7 +1065,6 @@ DART_EXPORT void Dart_DeleteWeakPersistentHandle( state->weak_persistent_handles().FreeHandle(weak_ref); } - // --- Garbage Collection Callbacks -- DART_EXPORT Dart_Handle @@ -1172,7 +1107,6 @@ Dart_SetGcCallbacks(Dart_GcPrologueCallback prologue_callback, return Api::Success(); } - // --- Initialization and Globals --- DART_EXPORT const char* Dart_VersionString() { @@ -1199,7 +1133,6 @@ DART_EXPORT char* Dart_Initialize(Dart_InitializeParams* params) { params->file_close, params->entropy_source, params->get_service_assets); } - DART_EXPORT char* Dart_Cleanup() { CHECK_NO_ISOLATE(Isolate::Current()); const char* err_msg = Dart::Cleanup(); @@ -1209,17 +1142,14 @@ DART_EXPORT char* Dart_Cleanup() { return NULL; } - DART_EXPORT bool Dart_SetVMFlags(int argc, const char** argv) { return Flags::ProcessCommandLineFlags(argc, argv); } - DART_EXPORT bool Dart_IsVMFlagSet(const char* flag_name) { return Flags::IsSet(flag_name); } - // --- Isolates --- static char* BuildIsolateName(const char* script_uri, const char* main) { @@ -1256,7 +1186,6 @@ static char* BuildIsolateName(const char* script_uri, const char* main) { return chars; } - static Dart_Isolate CreateIsolate(const char* script_uri, const char* main, const uint8_t* snapshot_data, @@ -1317,7 +1246,6 @@ static Dart_Isolate CreateIsolate(const char* script_uri, return reinterpret_cast(NULL); } - DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* script_uri, const char* main, @@ -1330,7 +1258,6 @@ Dart_CreateIsolate(const char* script_uri, -1, NULL, flags, callback_data, error); } - DART_EXPORT Dart_Isolate Dart_CreateIsolateFromKernel(const char* script_uri, const char* main, void* kernel_program, @@ -1342,7 +1269,6 @@ DART_EXPORT Dart_Isolate Dart_CreateIsolateFromKernel(const char* script_uri, flags, callback_data, error); } - DART_EXPORT void Dart_ShutdownIsolate() { Thread* T = Thread::Current(); Isolate* I = T->isolate(); @@ -1363,12 +1289,10 @@ DART_EXPORT void Dart_ShutdownIsolate() { Dart::ShutdownIsolate(); } - DART_EXPORT Dart_Isolate Dart_CurrentIsolate() { return Api::CastIsolate(Isolate::Current()); } - DART_EXPORT void* Dart_CurrentIsolateData() { Isolate* isolate = Isolate::Current(); CHECK_ISOLATE(isolate); @@ -1376,7 +1300,6 @@ DART_EXPORT void* Dart_CurrentIsolateData() { return isolate->init_callback_data(); } - DART_EXPORT void* Dart_IsolateData(Dart_Isolate isolate) { if (isolate == NULL) { FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC); @@ -1386,14 +1309,12 @@ DART_EXPORT void* Dart_IsolateData(Dart_Isolate isolate) { return iso->init_callback_data(); } - DART_EXPORT Dart_Handle Dart_DebugName() { DARTSCOPE(Thread::Current()); Isolate* I = T->isolate(); return Api::NewHandle(T, String::New(I->name())); } - DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate) { CHECK_NO_ISOLATE(Isolate::Current()); // TODO(16615): Validate isolate parameter. @@ -1413,7 +1334,6 @@ DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate) { T->EnterSafepoint(); } - DART_EXPORT void Dart_ThreadDisableProfiling() { OSThread* os_thread = OSThread::Current(); if (os_thread == NULL) { @@ -1422,7 +1342,6 @@ DART_EXPORT void Dart_ThreadDisableProfiling() { os_thread->DisableThreadInterrupts(); } - DART_EXPORT void Dart_ThreadEnableProfiling() { OSThread* os_thread = OSThread::Current(); if (os_thread == NULL) { @@ -1431,7 +1350,6 @@ DART_EXPORT void Dart_ThreadEnableProfiling() { os_thread->EnableThreadInterrupts(); } - DART_EXPORT bool Dart_ShouldPauseOnStart() { Isolate* isolate = Isolate::Current(); CHECK_ISOLATE(isolate); @@ -1439,7 +1357,6 @@ DART_EXPORT bool Dart_ShouldPauseOnStart() { return isolate->message_handler()->should_pause_on_start(); } - DART_EXPORT void Dart_SetShouldPauseOnStart(bool should_pause) { Isolate* isolate = Isolate::Current(); CHECK_ISOLATE(isolate); @@ -1451,7 +1368,6 @@ DART_EXPORT void Dart_SetShouldPauseOnStart(bool should_pause) { return isolate->message_handler()->set_should_pause_on_start(should_pause); } - DART_EXPORT bool Dart_IsPausedOnStart() { Isolate* isolate = Isolate::Current(); CHECK_ISOLATE(isolate); @@ -1459,7 +1375,6 @@ DART_EXPORT bool Dart_IsPausedOnStart() { return isolate->message_handler()->is_paused_on_start(); } - DART_EXPORT void Dart_SetPausedOnStart(bool paused) { Isolate* isolate = Isolate::Current(); CHECK_ISOLATE(isolate); @@ -1469,7 +1384,6 @@ DART_EXPORT void Dart_SetPausedOnStart(bool paused) { } } - DART_EXPORT bool Dart_ShouldPauseOnExit() { Isolate* isolate = Isolate::Current(); CHECK_ISOLATE(isolate); @@ -1477,7 +1391,6 @@ DART_EXPORT bool Dart_ShouldPauseOnExit() { return isolate->message_handler()->should_pause_on_exit(); } - DART_EXPORT void Dart_SetShouldPauseOnExit(bool should_pause) { Isolate* isolate = Isolate::Current(); CHECK_ISOLATE(isolate); @@ -1485,7 +1398,6 @@ DART_EXPORT void Dart_SetShouldPauseOnExit(bool should_pause) { return isolate->message_handler()->set_should_pause_on_exit(should_pause); } - DART_EXPORT bool Dart_IsPausedOnExit() { Isolate* isolate = Isolate::Current(); CHECK_ISOLATE(isolate); @@ -1493,7 +1405,6 @@ DART_EXPORT bool Dart_IsPausedOnExit() { return isolate->message_handler()->is_paused_on_exit(); } - DART_EXPORT void Dart_SetPausedOnExit(bool paused) { Isolate* isolate = Isolate::Current(); CHECK_ISOLATE(isolate); @@ -1503,7 +1414,6 @@ DART_EXPORT void Dart_SetPausedOnExit(bool paused) { } } - DART_EXPORT void Dart_SetStickyError(Dart_Handle error) { Thread* thread = Thread::Current(); DARTSCOPE(thread); @@ -1520,7 +1430,6 @@ DART_EXPORT void Dart_SetStickyError(Dart_Handle error) { isolate->SetStickyError(Api::UnwrapErrorHandle(Z, error).raw()); } - DART_EXPORT bool Dart_HasStickyError() { Thread* T = Thread::Current(); Isolate* isolate = T->isolate(); @@ -1529,7 +1438,6 @@ DART_EXPORT bool Dart_HasStickyError() { return isolate->sticky_error() != Error::null(); } - DART_EXPORT Dart_Handle Dart_GetStickyError() { Thread* T = Thread::Current(); Isolate* I = T->isolate(); @@ -1542,7 +1450,6 @@ DART_EXPORT Dart_Handle Dart_GetStickyError() { return Dart_Null(); } - DART_EXPORT void Dart_ExitIsolate() { Thread* T = Thread::Current(); CHECK_ISOLATE(T->isolate()); @@ -1556,7 +1463,6 @@ DART_EXPORT void Dart_ExitIsolate() { Thread::ExitIsolate(); } - static uint8_t* ApiReallocate(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { @@ -1565,7 +1471,6 @@ static uint8_t* ApiReallocate(uint8_t* ptr, ->Realloc(ptr, old_size, new_size); } - DART_EXPORT Dart_Handle Dart_CreateSnapshot(uint8_t** vm_snapshot_data_buffer, intptr_t* vm_snapshot_data_size, @@ -1610,7 +1515,6 @@ Dart_CreateSnapshot(uint8_t** vm_snapshot_data_buffer, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_CreateScriptSnapshot(uint8_t** script_snapshot_buffer, intptr_t* script_snapshot_size) { @@ -1638,7 +1542,6 @@ Dart_CreateScriptSnapshot(uint8_t** script_snapshot_buffer, return Api::Success(); } - DART_EXPORT void Dart_InterruptIsolate(Dart_Isolate isolate) { if (isolate == NULL) { FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC); @@ -1649,7 +1552,6 @@ DART_EXPORT void Dart_InterruptIsolate(Dart_Isolate isolate) { iso->SendInternalLibMessage(Isolate::kInterruptMsg, iso->pause_capability()); } - DART_EXPORT bool Dart_IsolateMakeRunnable(Dart_Isolate isolate) { CHECK_NO_ISOLATE(Isolate::Current()); API_TIMELINE_DURATION; @@ -1665,7 +1567,6 @@ DART_EXPORT bool Dart_IsolateMakeRunnable(Dart_Isolate isolate) { return iso->MakeRunnable(); } - // --- Messages and Ports --- DART_EXPORT void Dart_SetMessageNotifyCallback( @@ -1676,7 +1577,6 @@ DART_EXPORT void Dart_SetMessageNotifyCallback( isolate->set_message_notify_callback(message_notify_callback); } - DART_EXPORT Dart_MessageNotifyCallback Dart_GetMessageNotifyCallback() { Isolate* isolate = Isolate::Current(); CHECK_ISOLATE(isolate); @@ -1684,13 +1584,11 @@ DART_EXPORT Dart_MessageNotifyCallback Dart_GetMessageNotifyCallback() { return isolate->message_notify_callback(); } - struct RunLoopData { Monitor* monitor; bool done; }; - static void RunLoopDone(uword param) { RunLoopData* data = reinterpret_cast(param); ASSERT(data->monitor != NULL); @@ -1699,7 +1597,6 @@ static void RunLoopDone(uword param) { ml.Notify(); } - DART_EXPORT Dart_Handle Dart_RunLoop() { Isolate* I; { @@ -1737,7 +1634,6 @@ DART_EXPORT Dart_Handle Dart_RunLoop() { return Api::Success(); } - DART_EXPORT Dart_Handle Dart_HandleMessage() { Thread* T = Thread::Current(); Isolate* I = T->isolate(); @@ -1753,7 +1649,6 @@ DART_EXPORT Dart_Handle Dart_HandleMessage() { return Api::Success(); } - DART_EXPORT Dart_Handle Dart_HandleMessages() { Thread* T = Thread::Current(); Isolate* I = T->isolate(); @@ -1769,7 +1664,6 @@ DART_EXPORT Dart_Handle Dart_HandleMessages() { return Api::Success(); } - DART_EXPORT bool Dart_HandleServiceMessages() { Thread* T = Thread::Current(); Isolate* I = T->isolate(); @@ -1784,7 +1678,6 @@ DART_EXPORT bool Dart_HandleServiceMessages() { return (status != MessageHandler::kOK) || resume; } - DART_EXPORT bool Dart_HasServiceMessages() { Isolate* isolate = Isolate::Current(); ASSERT(isolate); @@ -1792,7 +1685,6 @@ DART_EXPORT bool Dart_HasServiceMessages() { return isolate->message_handler()->HasOOBMessages(); } - DART_EXPORT bool Dart_HasLivePorts() { Isolate* isolate = Isolate::Current(); ASSERT(isolate); @@ -1800,7 +1692,6 @@ DART_EXPORT bool Dart_HasLivePorts() { return isolate->message_handler()->HasLivePorts(); } - static uint8_t* malloc_allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { @@ -1808,12 +1699,10 @@ static uint8_t* malloc_allocator(uint8_t* ptr, return reinterpret_cast(new_ptr); } - static void malloc_deallocator(uint8_t* ptr) { free(reinterpret_cast(ptr)); } - DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle handle) { DARTSCOPE(Thread::Current()); API_TIMELINE_DURATION; @@ -1838,7 +1727,6 @@ DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle handle) { new Message(port_id, data, len, Message::kNormalPriority)); } - DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id) { DARTSCOPE(Thread::Current()); CHECK_CALLBACK_STATE(T); @@ -1849,7 +1737,6 @@ DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id) { return Api::NewHandle(T, SendPort::New(port_id)); } - DART_EXPORT Dart_Handle Dart_SendPortGetId(Dart_Handle port, Dart_Port* port_id) { DARTSCOPE(Thread::Current()); @@ -1866,14 +1753,12 @@ DART_EXPORT Dart_Handle Dart_SendPortGetId(Dart_Handle port, return Api::Success(); } - DART_EXPORT Dart_Port Dart_GetMainPortId() { Isolate* isolate = Isolate::Current(); CHECK_ISOLATE(isolate); return isolate->main_port(); } - // --- Scopes ---- DART_EXPORT void Dart_EnterScope() { @@ -1894,7 +1779,6 @@ DART_EXPORT void Dart_EnterScope() { thread->set_api_top_scope(new_scope); // New scope is now the top scope. } - DART_EXPORT void Dart_ExitScope() { Thread* T = Thread::Current(); CHECK_API_SCOPE(T); @@ -1911,7 +1795,6 @@ DART_EXPORT void Dart_ExitScope() { } } - DART_EXPORT uint8_t* Dart_ScopeAllocate(intptr_t size) { Zone* zone; Thread* thread = Thread::Current(); @@ -1926,7 +1809,6 @@ DART_EXPORT uint8_t* Dart_ScopeAllocate(intptr_t size) { return reinterpret_cast(zone->AllocUnsafe(size)); } - // --- Objects ---- DART_EXPORT Dart_Handle Dart_Null() { @@ -1934,18 +1816,15 @@ DART_EXPORT Dart_Handle Dart_Null() { return Api::Null(); } - DART_EXPORT Dart_Handle Dart_EmptyString() { ASSERT(Isolate::Current() != NULL); return Api::EmptyString(); } - DART_EXPORT bool Dart_IsNull(Dart_Handle object) { return Api::UnwrapHandle(object) == Object::null(); } - DART_EXPORT Dart_Handle Dart_ObjectEquals(Dart_Handle obj1, Dart_Handle obj2, bool* value) { @@ -1966,7 +1845,6 @@ DART_EXPORT Dart_Handle Dart_ObjectEquals(Dart_Handle obj1, } } - // TODO(iposva): This call actually implements IsInstanceOfClass. // Do we also need a real Dart_IsInstanceOf, which should take an instance // rather than an object? @@ -2003,7 +1881,6 @@ DART_EXPORT Dart_Handle Dart_ObjectIsType(Dart_Handle object, return Api::Success(); } - DART_EXPORT bool Dart_IsInstance(Dart_Handle object) { Thread* thread = Thread::Current(); CHECK_ISOLATE(thread->isolate()); @@ -2013,42 +1890,34 @@ DART_EXPORT bool Dart_IsInstance(Dart_Handle object) { return ref.IsInstance(); } - DART_EXPORT bool Dart_IsNumber(Dart_Handle object) { return RawObject::IsNumberClassId(Api::ClassId(object)); } - DART_EXPORT bool Dart_IsInteger(Dart_Handle object) { return RawObject::IsIntegerClassId(Api::ClassId(object)); } - DART_EXPORT bool Dart_IsDouble(Dart_Handle object) { return Api::ClassId(object) == kDoubleCid; } - DART_EXPORT bool Dart_IsBoolean(Dart_Handle object) { return Api::ClassId(object) == kBoolCid; } - DART_EXPORT bool Dart_IsString(Dart_Handle object) { return RawObject::IsStringClassId(Api::ClassId(object)); } - DART_EXPORT bool Dart_IsStringLatin1(Dart_Handle object) { return RawObject::IsOneByteStringClassId(Api::ClassId(object)); } - DART_EXPORT bool Dart_IsExternalString(Dart_Handle object) { return RawObject::IsExternalStringClassId(Api::ClassId(object)); } - DART_EXPORT bool Dart_IsList(Dart_Handle object) { if (RawObject::IsBuiltinListClassId(Api::ClassId(object))) { return true; @@ -2059,44 +1928,36 @@ DART_EXPORT bool Dart_IsList(Dart_Handle object) { return GetListInstance(Z, obj) != Instance::null(); } - DART_EXPORT bool Dart_IsMap(Dart_Handle object) { DARTSCOPE(Thread::Current()); const Object& obj = Object::Handle(Z, Api::UnwrapHandle(object)); return GetMapInstance(Z, obj) != Instance::null(); } - DART_EXPORT bool Dart_IsLibrary(Dart_Handle object) { return Api::ClassId(object) == kLibraryCid; } - DART_EXPORT bool Dart_IsType(Dart_Handle handle) { return Api::ClassId(handle) == kTypeCid; } - DART_EXPORT bool Dart_IsFunction(Dart_Handle handle) { return Api::ClassId(handle) == kFunctionCid; } - DART_EXPORT bool Dart_IsVariable(Dart_Handle handle) { return Api::ClassId(handle) == kFieldCid; } - DART_EXPORT bool Dart_IsTypeVariable(Dart_Handle handle) { return Api::ClassId(handle) == kTypeParameterCid; } - DART_EXPORT bool Dart_IsClosure(Dart_Handle object) { return Api::ClassId(object) == kClosureCid; } - DART_EXPORT bool Dart_IsTypedData(Dart_Handle handle) { intptr_t cid = Api::ClassId(handle); return RawObject::IsTypedDataClassId(cid) || @@ -2104,12 +1965,10 @@ DART_EXPORT bool Dart_IsTypedData(Dart_Handle handle) { RawObject::IsTypedDataViewClassId(cid); } - DART_EXPORT bool Dart_IsByteBuffer(Dart_Handle handle) { return Api::ClassId(handle) == kByteBufferCid; } - DART_EXPORT bool Dart_IsFuture(Dart_Handle handle) { API_TIMELINE_DURATION; DARTSCOPE(Thread::Current()); @@ -2130,7 +1989,6 @@ DART_EXPORT bool Dart_IsFuture(Dart_Handle handle) { return false; } - // --- Instances ---- DART_EXPORT Dart_Handle Dart_InstanceGetType(Dart_Handle instance) { @@ -2149,7 +2007,6 @@ DART_EXPORT Dart_Handle Dart_InstanceGetType(Dart_Handle instance) { return Api::NewHandle(T, type.Canonicalize()); } - // --- Numbers, Integers and Doubles ---- DART_EXPORT Dart_Handle Dart_IntegerFitsIntoInt64(Dart_Handle integer, @@ -2175,7 +2032,6 @@ DART_EXPORT Dart_Handle Dart_IntegerFitsIntoInt64(Dart_Handle integer, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_IntegerFitsIntoUint64(Dart_Handle integer, bool* fits) { // Fast path for Smis. @@ -2202,7 +2058,6 @@ DART_EXPORT Dart_Handle Dart_IntegerFitsIntoUint64(Dart_Handle integer, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_NewInteger(int64_t value) { // Fast path for Smis. Thread* thread = Thread::Current(); @@ -2219,7 +2074,6 @@ DART_EXPORT Dart_Handle Dart_NewInteger(int64_t value) { return Api::NewHandle(thread, Integer::New(value)); } - DART_EXPORT Dart_Handle Dart_NewIntegerFromUint64(uint64_t value) { DARTSCOPE(Thread::Current()); CHECK_CALLBACK_STATE(T); @@ -2227,7 +2081,6 @@ DART_EXPORT Dart_Handle Dart_NewIntegerFromUint64(uint64_t value) { return Api::NewHandle(T, Integer::NewFromUint64(value)); } - DART_EXPORT Dart_Handle Dart_NewIntegerFromHexCString(const char* str) { DARTSCOPE(Thread::Current()); CHECK_CALLBACK_STATE(T); @@ -2236,7 +2089,6 @@ DART_EXPORT Dart_Handle Dart_NewIntegerFromHexCString(const char* str) { return Api::NewHandle(T, Integer::New(str_obj)); } - DART_EXPORT Dart_Handle Dart_IntegerToInt64(Dart_Handle integer, int64_t* value) { // Fast path for Smis. @@ -2268,7 +2120,6 @@ DART_EXPORT Dart_Handle Dart_IntegerToInt64(Dart_Handle integer, CURRENT_FUNC, int_obj.ToCString()); } - DART_EXPORT Dart_Handle Dart_IntegerToUint64(Dart_Handle integer, uint64_t* value) { // Fast path for Smis. @@ -2304,7 +2155,6 @@ DART_EXPORT Dart_Handle Dart_IntegerToUint64(Dart_Handle integer, CURRENT_FUNC, int_obj.ToCString()); } - DART_EXPORT Dart_Handle Dart_IntegerToHexCString(Dart_Handle integer, const char** value) { API_TIMELINE_DURATION; @@ -2324,14 +2174,12 @@ DART_EXPORT Dart_Handle Dart_IntegerToHexCString(Dart_Handle integer, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_NewDouble(double value) { DARTSCOPE(Thread::Current()); CHECK_CALLBACK_STATE(T); return Api::NewHandle(T, Double::New(value)); } - DART_EXPORT Dart_Handle Dart_DoubleValue(Dart_Handle double_obj, double* value) { DARTSCOPE(Thread::Current()); @@ -2343,7 +2191,6 @@ DART_EXPORT Dart_Handle Dart_DoubleValue(Dart_Handle double_obj, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_GetClosure(Dart_Handle library, Dart_Handle function_name) { DARTSCOPE(Thread::Current()); @@ -2358,7 +2205,6 @@ DART_EXPORT Dart_Handle Dart_GetClosure(Dart_Handle library, return Api::NewHandle(T, lib.GetFunctionClosure(name)); } - // --- Booleans ---- DART_EXPORT Dart_Handle Dart_True() { @@ -2366,20 +2212,17 @@ DART_EXPORT Dart_Handle Dart_True() { return Api::True(); } - DART_EXPORT Dart_Handle Dart_False() { ASSERT(Isolate::Current() != NULL); return Api::False(); } - DART_EXPORT Dart_Handle Dart_NewBoolean(bool value) { Isolate* isolate = Isolate::Current(); CHECK_ISOLATE(isolate); return value ? Api::True() : Api::False(); } - DART_EXPORT Dart_Handle Dart_BooleanValue(Dart_Handle boolean_obj, bool* value) { DARTSCOPE(Thread::Current()); @@ -2391,10 +2234,8 @@ DART_EXPORT Dart_Handle Dart_BooleanValue(Dart_Handle boolean_obj, return Api::Success(); } - // --- Strings --- - DART_EXPORT Dart_Handle Dart_StringLength(Dart_Handle str, intptr_t* len) { Thread* thread = Thread::Current(); CHECK_ISOLATE(thread->isolate()); @@ -2407,7 +2248,6 @@ DART_EXPORT Dart_Handle Dart_StringLength(Dart_Handle str, intptr_t* len) { return Api::Success(); } - DART_EXPORT Dart_Handle Dart_NewStringFromCString(const char* str) { API_TIMELINE_DURATION; DARTSCOPE(Thread::Current()); @@ -2418,7 +2258,6 @@ DART_EXPORT Dart_Handle Dart_NewStringFromCString(const char* str) { return Api::NewHandle(T, String::New(str)); } - DART_EXPORT Dart_Handle Dart_NewStringFromUTF8(const uint8_t* utf8_array, intptr_t length) { API_TIMELINE_DURATION; @@ -2435,7 +2274,6 @@ DART_EXPORT Dart_Handle Dart_NewStringFromUTF8(const uint8_t* utf8_array, return Api::NewHandle(T, String::FromUTF8(utf8_array, length)); } - DART_EXPORT Dart_Handle Dart_NewStringFromUTF16(const uint16_t* utf16_array, intptr_t length) { DARTSCOPE(Thread::Current()); @@ -2447,7 +2285,6 @@ DART_EXPORT Dart_Handle Dart_NewStringFromUTF16(const uint16_t* utf16_array, return Api::NewHandle(T, String::FromUTF16(utf16_array, length)); } - DART_EXPORT Dart_Handle Dart_NewStringFromUTF32(const int32_t* utf32_array, intptr_t length) { API_TIMELINE_DURATION; @@ -2460,7 +2297,6 @@ DART_EXPORT Dart_Handle Dart_NewStringFromUTF32(const int32_t* utf32_array, return Api::NewHandle(T, String::FromUTF32(utf32_array, length)); } - DART_EXPORT Dart_Handle Dart_NewExternalLatin1String(const uint8_t* latin1_array, intptr_t length, @@ -2478,7 +2314,6 @@ Dart_NewExternalLatin1String(const uint8_t* latin1_array, SpaceForExternal(T, length))); } - DART_EXPORT Dart_Handle Dart_NewExternalUTF16String(const uint16_t* utf16_array, intptr_t length, void* peer, @@ -2494,7 +2329,6 @@ DART_EXPORT Dart_Handle Dart_NewExternalUTF16String(const uint16_t* utf16_array, SpaceForExternal(T, bytes))); } - DART_EXPORT Dart_Handle Dart_StringToCString(Dart_Handle object, const char** cstr) { API_TIMELINE_DURATION; @@ -2518,7 +2352,6 @@ DART_EXPORT Dart_Handle Dart_StringToCString(Dart_Handle object, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_StringToUTF8(Dart_Handle str, uint8_t** utf8_array, intptr_t* length) { @@ -2544,7 +2377,6 @@ DART_EXPORT Dart_Handle Dart_StringToUTF8(Dart_Handle str, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_StringToLatin1(Dart_Handle str, uint8_t* latin1_array, intptr_t* length) { @@ -2572,7 +2404,6 @@ DART_EXPORT Dart_Handle Dart_StringToLatin1(Dart_Handle str, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_StringToUTF16(Dart_Handle str, uint16_t* utf16_array, intptr_t* length) { @@ -2591,7 +2422,6 @@ DART_EXPORT Dart_Handle Dart_StringToUTF16(Dart_Handle str, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_StringStorageSize(Dart_Handle str, intptr_t* size) { Thread* thread = Thread::Current(); @@ -2608,7 +2438,6 @@ DART_EXPORT Dart_Handle Dart_StringStorageSize(Dart_Handle str, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_MakeExternalString(Dart_Handle str, void* array, intptr_t external_size, @@ -2667,7 +2496,6 @@ DART_EXPORT Dart_Handle Dart_MakeExternalString(Dart_Handle str, T, str_obj.MakeExternal(array, external_size, peer, cback)); } - DART_EXPORT Dart_Handle Dart_StringGetProperties(Dart_Handle object, intptr_t* char_size, intptr_t* str_len, @@ -2691,7 +2519,6 @@ DART_EXPORT Dart_Handle Dart_StringGetProperties(Dart_Handle object, return Api::Success(); } - // --- Lists --- DART_EXPORT Dart_Handle Dart_NewList(intptr_t length) { @@ -2701,14 +2528,12 @@ DART_EXPORT Dart_Handle Dart_NewList(intptr_t length) { return Api::NewHandle(T, Array::New(length)); } - #define GET_LIST_LENGTH(zone, type, obj, len) \ type& array = type::Handle(zone); \ array ^= obj.raw(); \ *len = array.Length(); \ return Api::Success(); - DART_EXPORT Dart_Handle Dart_ListLength(Dart_Handle list, intptr_t* len) { DARTSCOPE(Thread::Current()); const Object& obj = Object::Handle(Z, Api::UnwrapHandle(list)); @@ -2780,7 +2605,6 @@ DART_EXPORT Dart_Handle Dart_ListLength(Dart_Handle list, intptr_t* len) { } } - #define GET_LIST_ELEMENT(thread, type, obj, index) \ const type& array_obj = type::Cast(obj); \ if ((index >= 0) && (index < array_obj.Length())) { \ @@ -2788,7 +2612,6 @@ DART_EXPORT Dart_Handle Dart_ListLength(Dart_Handle list, intptr_t* len) { } \ return Api::NewError("Invalid index passed in to access list element"); - DART_EXPORT Dart_Handle Dart_ListGetAt(Dart_Handle list, intptr_t index) { DARTSCOPE(Thread::Current()); const Object& obj = Object::Handle(Z, Api::UnwrapHandle(list)); @@ -2811,7 +2634,6 @@ DART_EXPORT Dart_Handle Dart_ListGetAt(Dart_Handle list, intptr_t index) { } } - #define GET_LIST_RANGE(thread, type, obj, offset, length) \ const type& array_obj = type::Cast(obj); \ if ((offset >= 0) && (offset + length <= array_obj.Length())) { \ @@ -2822,7 +2644,6 @@ DART_EXPORT Dart_Handle Dart_ListGetAt(Dart_Handle list, intptr_t index) { } \ return Api::NewError("Invalid offset/length passed in to access list"); - DART_EXPORT Dart_Handle Dart_ListGetRange(Dart_Handle list, intptr_t offset, intptr_t length, @@ -2869,7 +2690,6 @@ DART_EXPORT Dart_Handle Dart_ListGetRange(Dart_Handle list, } } - #define SET_LIST_ELEMENT(type, obj, index, value) \ const type& array = type::Cast(obj); \ const Object& value_obj = Object::Handle(Z, Api::UnwrapHandle(value)); \ @@ -2882,7 +2702,6 @@ DART_EXPORT Dart_Handle Dart_ListGetRange(Dart_Handle list, } \ return Api::NewError("Invalid index passed in to set list element"); - DART_EXPORT Dart_Handle Dart_ListSetAt(Dart_Handle list, intptr_t index, Dart_Handle value) { @@ -2926,14 +2745,12 @@ DART_EXPORT Dart_Handle Dart_ListSetAt(Dart_Handle list, } } - static RawObject* ResolveConstructor(const char* current_func, const Class& cls, const String& class_name, const String& dotted_name, int num_args); - static RawObject* ThrowArgumentError(const char* exception_message) { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -3026,7 +2843,6 @@ static Dart_Handle CopyBytes(const T& array, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_ListGetAsBytes(Dart_Handle list, intptr_t offset, uint8_t* native_array, @@ -3128,7 +2944,6 @@ DART_EXPORT Dart_Handle Dart_ListGetAsBytes(Dart_Handle list, return Api::NewError("Object does not implement the 'List' interface"); } - #define SET_LIST_ELEMENT_AS_BYTES(type, obj, native_array, offset, length) \ const type& array = type::Cast(obj); \ Integer& integer = Integer::Handle(Z); \ @@ -3141,7 +2956,6 @@ DART_EXPORT Dart_Handle Dart_ListGetAsBytes(Dart_Handle list, } \ return Api::NewError("Invalid length passed in to set array elements"); - DART_EXPORT Dart_Handle Dart_ListSetAsBytes(Dart_Handle list, intptr_t offset, const uint8_t* native_array, @@ -3206,7 +3020,6 @@ DART_EXPORT Dart_Handle Dart_ListSetAsBytes(Dart_Handle list, return Api::NewError("Object does not implement the 'List' interface"); } - // --- Maps --- DART_EXPORT Dart_Handle Dart_MapGetAt(Dart_Handle map, Dart_Handle key) { @@ -3225,7 +3038,6 @@ DART_EXPORT Dart_Handle Dart_MapGetAt(Dart_Handle map, Dart_Handle key) { return Api::NewError("Object does not implement the 'Map' interface"); } - DART_EXPORT Dart_Handle Dart_MapContainsKey(Dart_Handle map, Dart_Handle key) { DARTSCOPE(Thread::Current()); CHECK_CALLBACK_STATE(T); @@ -3243,7 +3055,6 @@ DART_EXPORT Dart_Handle Dart_MapContainsKey(Dart_Handle map, Dart_Handle key) { return Api::NewError("Object does not implement the 'Map' interface"); } - DART_EXPORT Dart_Handle Dart_MapKeys(Dart_Handle map) { DARTSCOPE(Thread::Current()); CHECK_CALLBACK_STATE(T); @@ -3261,7 +3072,6 @@ DART_EXPORT Dart_Handle Dart_MapKeys(Dart_Handle map) { return Api::NewError("Object does not implement the 'Map' interface"); } - // --- Typed Data --- // Helper method to get the type of a TypedData object. @@ -3338,7 +3148,6 @@ static Dart_TypedData_Type GetType(intptr_t class_id) { return type; } - DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfTypedData(Dart_Handle object) { API_TIMELINE_DURATION; intptr_t class_id = Api::ClassId(object); @@ -3349,7 +3158,6 @@ DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfTypedData(Dart_Handle object) { return Dart_TypedData_kInvalid; } - DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfExternalTypedData(Dart_Handle object) { API_TIMELINE_DURATION; @@ -3371,7 +3179,6 @@ Dart_GetTypeOfExternalTypedData(Dart_Handle object) { return Dart_TypedData_kInvalid; } - static RawObject* GetByteDataConstructor(Thread* thread, const String& constructor_name, intptr_t num_args) { @@ -3385,7 +3192,6 @@ static RawObject* GetByteDataConstructor(Thread* thread, constructor_name, num_args); } - static Dart_Handle NewByteData(Thread* thread, intptr_t length) { CHECK_LENGTH(length, TypedData::MaxElements(kTypedDataInt8ArrayCid)); Zone* zone = thread->zone(); @@ -3408,13 +3214,11 @@ static Dart_Handle NewByteData(Thread* thread, intptr_t length) { return Api::NewHandle(thread, result.raw()); } - static Dart_Handle NewTypedData(Thread* thread, intptr_t cid, intptr_t length) { CHECK_LENGTH(length, TypedData::MaxElements(cid)); return Api::NewHandle(thread, TypedData::New(cid, length)); } - static Dart_Handle NewExternalTypedData(Thread* thread, intptr_t cid, void* data, @@ -3428,7 +3232,6 @@ static Dart_Handle NewExternalTypedData(Thread* thread, return Api::NewHandle(thread, result.raw()); } - static Dart_Handle NewExternalByteData(Thread* thread, void* data, intptr_t length) { @@ -3465,7 +3268,6 @@ static Dart_Handle NewExternalByteData(Thread* thread, return Api::NewHandle(thread, result.raw()); } - DART_EXPORT Dart_Handle Dart_NewTypedData(Dart_TypedData_Type type, intptr_t length) { DARTSCOPE(Thread::Current()); @@ -3505,7 +3307,6 @@ DART_EXPORT Dart_Handle Dart_NewTypedData(Dart_TypedData_Type type, return Api::Null(); } - DART_EXPORT Dart_Handle Dart_NewExternalTypedData(Dart_TypedData_Type type, void* data, intptr_t length) { @@ -3563,7 +3364,6 @@ DART_EXPORT Dart_Handle Dart_NewExternalTypedData(Dart_TypedData_Type type, return Api::Null(); } - static RawObject* GetByteBufferConstructor(Thread* thread, const String& class_name, const String& constructor_name, @@ -3578,7 +3378,6 @@ static RawObject* GetByteBufferConstructor(Thread* thread, num_args); } - DART_EXPORT Dart_Handle Dart_NewByteBuffer(Dart_Handle typed_data) { DARTSCOPE(Thread::Current()); intptr_t class_id = Api::ClassId(typed_data); @@ -3608,7 +3407,6 @@ DART_EXPORT Dart_Handle Dart_NewByteBuffer(Dart_Handle typed_data) { return Api::NewHandle(T, result.raw()); } - // Structure to record acquired typed data for verification purposes. class AcquiredData { public: @@ -3641,7 +3439,6 @@ class AcquiredData { DISALLOW_COPY_AND_ASSIGN(AcquiredData); }; - DART_EXPORT Dart_Handle Dart_TypedDataAcquireData(Dart_Handle object, Dart_TypedData_Type* type, void** data, @@ -3734,7 +3531,6 @@ DART_EXPORT Dart_Handle Dart_TypedDataAcquireData(Dart_Handle object, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_TypedDataReleaseData(Dart_Handle object) { DARTSCOPE(Thread::Current()); Isolate* I = T->isolate(); @@ -3762,7 +3558,6 @@ DART_EXPORT Dart_Handle Dart_TypedDataReleaseData(Dart_Handle object) { return Api::Success(); } - DART_EXPORT Dart_Handle Dart_GetDataFromByteBuffer(Dart_Handle object) { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -3777,7 +3572,6 @@ DART_EXPORT Dart_Handle Dart_GetDataFromByteBuffer(Dart_Handle object) { return Api::NewHandle(thread, ByteBuffer::Data(instance)); } - // --- Invoking Constructors, Methods, and Field accessors --- static RawObject* ResolveConstructor(const char* current_func, @@ -3822,7 +3616,6 @@ static RawObject* ResolveConstructor(const char* current_func, return constructor.raw(); } - DART_EXPORT Dart_Handle Dart_New(Dart_Handle type, Dart_Handle constructor_name, int number_of_arguments, @@ -3967,7 +3760,6 @@ DART_EXPORT Dart_Handle Dart_New(Dart_Handle type, return Api::NewHandle(T, new_object.raw()); } - static RawInstance* AllocateObject(Thread* thread, const Class& cls) { if (!cls.is_fields_marked_nullable()) { // Mark all fields as nullable. @@ -3994,7 +3786,6 @@ static RawInstance* AllocateObject(Thread* thread, const Class& cls) { return Instance::New(cls); } - DART_EXPORT Dart_Handle Dart_Allocate(Dart_Handle type) { DARTSCOPE(Thread::Current()); CHECK_CALLBACK_STATE(T); @@ -4018,7 +3809,6 @@ DART_EXPORT Dart_Handle Dart_Allocate(Dart_Handle type) { return Api::NewHandle(T, AllocateObject(T, cls)); } - DART_EXPORT Dart_Handle Dart_AllocateWithNativeFields(Dart_Handle type, intptr_t num_native_fields, @@ -4055,7 +3845,6 @@ Dart_AllocateWithNativeFields(Dart_Handle type, return Api::NewHandle(T, instance.raw()); } - static Dart_Handle SetupArguments(Thread* thread, int num_args, Dart_Handle* arguments, @@ -4082,7 +3871,6 @@ static Dart_Handle SetupArguments(Thread* thread, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_InvokeConstructor(Dart_Handle object, Dart_Handle name, int number_of_arguments, @@ -4159,7 +3947,6 @@ DART_EXPORT Dart_Handle Dart_InvokeConstructor(Dart_Handle object, CURRENT_FUNC); } - DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target, Dart_Handle name, int number_of_arguments, @@ -4304,7 +4091,6 @@ DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target, } } - DART_EXPORT Dart_Handle Dart_InvokeClosure(Dart_Handle closure, int number_of_arguments, Dart_Handle* arguments) { @@ -4336,7 +4122,6 @@ DART_EXPORT Dart_Handle Dart_InvokeClosure(Dart_Handle closure, return Api::NewHandle(T, DartEntry::InvokeClosure(args)); } - DART_EXPORT Dart_Handle Dart_GetField(Dart_Handle container, Dart_Handle name) { API_TIMELINE_DURATION; DARTSCOPE(Thread::Current()); @@ -4482,7 +4267,6 @@ DART_EXPORT Dart_Handle Dart_GetField(Dart_Handle container, Dart_Handle name) { } } - DART_EXPORT Dart_Handle Dart_SetField(Dart_Handle container, Dart_Handle name, Dart_Handle value) { @@ -4635,7 +4419,6 @@ DART_EXPORT Dart_Handle Dart_SetField(Dart_Handle container, CURRENT_FUNC); } - // --- Exceptions ---- DART_EXPORT Dart_Handle Dart_ThrowException(Dart_Handle exception) { @@ -4671,7 +4454,6 @@ DART_EXPORT Dart_Handle Dart_ThrowException(Dart_Handle exception) { return Api::NewError("Exception was not thrown, internal error"); } - DART_EXPORT Dart_Handle Dart_ReThrowException(Dart_Handle exception, Dart_Handle stacktrace) { Thread* thread = Thread::Current(); @@ -4713,7 +4495,6 @@ DART_EXPORT Dart_Handle Dart_ReThrowException(Dart_Handle exception, return Api::NewError("Exception was not re thrown, internal error"); } - // --- Native fields and functions --- DART_EXPORT Dart_Handle Dart_CreateNativeWrapperClass(Dart_Handle library, @@ -4744,7 +4525,6 @@ DART_EXPORT Dart_Handle Dart_CreateNativeWrapperClass(Dart_Handle library, return Api::NewHandle(T, cls.RareType()); } - DART_EXPORT Dart_Handle Dart_GetNativeInstanceFieldCount(Dart_Handle obj, int* count) { Thread* thread = Thread::Current(); @@ -4758,7 +4538,6 @@ DART_EXPORT Dart_Handle Dart_GetNativeInstanceFieldCount(Dart_Handle obj, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_GetNativeInstanceField(Dart_Handle obj, int index, intptr_t* value) { @@ -4778,7 +4557,6 @@ DART_EXPORT Dart_Handle Dart_GetNativeInstanceField(Dart_Handle obj, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_SetNativeInstanceField(Dart_Handle obj, int index, intptr_t value) { @@ -4796,7 +4574,6 @@ DART_EXPORT Dart_Handle Dart_SetNativeInstanceField(Dart_Handle obj, return Api::Success(); } - DART_EXPORT void* Dart_GetNativeIsolateData(Dart_NativeArguments args) { NativeArguments* arguments = reinterpret_cast(args); Isolate* isolate = arguments->thread()->isolate(); @@ -4804,7 +4581,6 @@ DART_EXPORT void* Dart_GetNativeIsolateData(Dart_NativeArguments args) { return isolate->init_callback_data(); } - DART_EXPORT Dart_Handle Dart_GetNativeArguments( Dart_NativeArguments args, int num_arguments, @@ -4936,7 +4712,6 @@ DART_EXPORT Dart_Handle Dart_GetNativeArguments( return Api::Success(); } - DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, int index) { NativeArguments* arguments = reinterpret_cast(args); @@ -4948,13 +4723,11 @@ DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, return Api::NewHandle(arguments->thread(), arguments->NativeArgAt(index)); } - DART_EXPORT int Dart_GetNativeArgumentCount(Dart_NativeArguments args) { NativeArguments* arguments = reinterpret_cast(args); return arguments->NativeArgCount(); } - DART_EXPORT Dart_Handle Dart_GetNativeFieldsOfArgument(Dart_NativeArguments args, int arg_index, @@ -4973,7 +4746,6 @@ Dart_GetNativeFieldsOfArgument(Dart_NativeArguments args, field_values, CURRENT_FUNC); } - DART_EXPORT Dart_Handle Dart_GetNativeReceiver(Dart_NativeArguments args, intptr_t* value) { NativeArguments* arguments = reinterpret_cast(args); @@ -4990,7 +4762,6 @@ DART_EXPORT Dart_Handle Dart_GetNativeReceiver(Dart_NativeArguments args, CURRENT_FUNC); } - DART_EXPORT Dart_Handle Dart_GetNativeStringArgument(Dart_NativeArguments args, int arg_index, void** peer) { @@ -5005,7 +4776,6 @@ DART_EXPORT Dart_Handle Dart_GetNativeStringArgument(Dart_NativeArguments args, return result; } - DART_EXPORT Dart_Handle Dart_GetNativeIntegerArgument(Dart_NativeArguments args, int index, int64_t* value) { @@ -5024,7 +4794,6 @@ DART_EXPORT Dart_Handle Dart_GetNativeIntegerArgument(Dart_NativeArguments args, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_GetNativeBooleanArgument(Dart_NativeArguments args, int index, bool* value) { @@ -5041,7 +4810,6 @@ DART_EXPORT Dart_Handle Dart_GetNativeBooleanArgument(Dart_NativeArguments args, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_GetNativeDoubleArgument(Dart_NativeArguments args, int index, double* value) { @@ -5060,7 +4828,6 @@ DART_EXPORT Dart_Handle Dart_GetNativeDoubleArgument(Dart_NativeArguments args, return Api::Success(); } - DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args, Dart_Handle retval) { NativeArguments* arguments = reinterpret_cast(args); @@ -5082,7 +4849,6 @@ DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args, Api::SetReturnValue(arguments, retval); } - DART_EXPORT void Dart_SetWeakHandleReturnValue(Dart_NativeArguments args, Dart_WeakPersistentHandle rval) { NativeArguments* arguments = reinterpret_cast(args); @@ -5095,7 +4861,6 @@ DART_EXPORT void Dart_SetWeakHandleReturnValue(Dart_NativeArguments args, Api::SetWeakHandleReturnValue(arguments, rval); } - // --- Environment --- RawString* Api::GetEnvironmentValue(Thread* thread, const String& name) { String& result = String::Handle(CallEnvironmentCallback(thread, name)); @@ -5147,7 +4912,6 @@ RawString* Api::GetEnvironmentValue(Thread* thread, const String& name) { return result.raw(); } - RawString* Api::CallEnvironmentCallback(Thread* thread, const String& name) { Isolate* isolate = thread->isolate(); Dart_EnvironmentCallback callback = isolate->environment_callback(); @@ -5172,7 +4936,6 @@ RawString* Api::CallEnvironmentCallback(Thread* thread, const String& name) { return result.raw(); } - DART_EXPORT Dart_Handle Dart_SetEnvironmentCallback(Dart_EnvironmentCallback callback) { Isolate* isolate = Isolate::Current(); @@ -5181,7 +4944,6 @@ Dart_SetEnvironmentCallback(Dart_EnvironmentCallback callback) { return Api::Success(); } - // --- Scripts and Libraries --- DART_EXPORT void Dart_SetBooleanReturnValue(Dart_NativeArguments args, bool retval) { @@ -5189,7 +4951,6 @@ DART_EXPORT void Dart_SetBooleanReturnValue(Dart_NativeArguments args, arguments->SetReturn(Bool::Get(retval)); } - DART_EXPORT void Dart_SetIntegerReturnValue(Dart_NativeArguments args, int64_t retval) { NativeArguments* arguments = reinterpret_cast(args); @@ -5204,7 +4965,6 @@ DART_EXPORT void Dart_SetIntegerReturnValue(Dart_NativeArguments args, } } - DART_EXPORT void Dart_SetDoubleReturnValue(Dart_NativeArguments args, double retval) { NativeArguments* arguments = reinterpret_cast(args); @@ -5213,7 +4973,6 @@ DART_EXPORT void Dart_SetDoubleReturnValue(Dart_NativeArguments args, Api::SetDoubleReturnValue(arguments, retval); } - // --- Scripts and Libraries --- DART_EXPORT Dart_Handle @@ -5224,7 +4983,6 @@ Dart_SetLibraryTagHandler(Dart_LibraryTagHandler handler) { return Api::Success(); } - DART_EXPORT Dart_Handle Dart_DefaultCanonicalizeUrl(Dart_Handle base_url, Dart_Handle url) { API_TIMELINE_DURATION; @@ -5248,7 +5006,6 @@ DART_EXPORT Dart_Handle Dart_DefaultCanonicalizeUrl(Dart_Handle base_url, return Api::NewHandle(T, String::New(resolved_uri)); } - // NOTE: Need to pass 'result' as a parameter here in order to avoid // warning: variable 'result' might be clobbered by 'longjmp' or 'vfork' // which shows up because of the use of setjmp. @@ -5274,7 +5031,6 @@ static void CompileSource(Thread* thread, } } - DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url, Dart_Handle resolved_url, Dart_Handle source, @@ -5331,7 +5087,6 @@ DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url, return result; } - DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer, intptr_t buffer_len) { API_TIMELINE_DURATION; @@ -5393,7 +5148,6 @@ DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer, return Api::NewHandle(T, library.raw()); } - DART_EXPORT void* Dart_ReadKernelBinary(const uint8_t* buffer, intptr_t buffer_len) { #if defined(DART_PRECOMPILED_RUNTIME) @@ -5406,7 +5160,6 @@ DART_EXPORT void* Dart_ReadKernelBinary(const uint8_t* buffer, #endif } - DART_EXPORT Dart_Handle Dart_LoadKernel(void* kernel_program) { API_TIMELINE_DURATION; DARTSCOPE(Thread::Current()); @@ -5449,7 +5202,6 @@ DART_EXPORT Dart_Handle Dart_LoadKernel(void* kernel_program) { #endif } - DART_EXPORT Dart_Handle Dart_RootLibrary() { Thread* thread = Thread::Current(); Isolate* isolate = thread->isolate(); @@ -5457,7 +5209,6 @@ DART_EXPORT Dart_Handle Dart_RootLibrary() { return Api::NewHandle(thread, isolate->object_store()->root_library()); } - DART_EXPORT Dart_Handle Dart_SetRootLibrary(Dart_Handle library) { DARTSCOPE(Thread::Current()); const Object& obj = Object::Handle(Z, Api::UnwrapHandle(library)); @@ -5470,7 +5221,6 @@ DART_EXPORT Dart_Handle Dart_SetRootLibrary(Dart_Handle library) { RETURN_TYPE_ERROR(Z, library, Library); } - DART_EXPORT Dart_Handle Dart_GetClass(Dart_Handle library, Dart_Handle class_name) { DARTSCOPE(Thread::Current()); @@ -5492,7 +5242,6 @@ DART_EXPORT Dart_Handle Dart_GetClass(Dart_Handle library, return Api::NewHandle(T, cls.RareType()); } - DART_EXPORT Dart_Handle Dart_GetType(Dart_Handle library, Dart_Handle class_name, intptr_t number_of_type_arguments, @@ -5565,7 +5314,6 @@ DART_EXPORT Dart_Handle Dart_GetType(Dart_Handle library, return Api::NewHandle(T, instantiated_type.raw()); } - DART_EXPORT Dart_Handle Dart_LibraryUrl(Dart_Handle library) { DARTSCOPE(Thread::Current()); const Library& lib = Api::UnwrapLibraryHandle(Z, library); @@ -5577,7 +5325,6 @@ DART_EXPORT Dart_Handle Dart_LibraryUrl(Dart_Handle library) { return Api::NewHandle(T, url.raw()); } - DART_EXPORT Dart_Handle Dart_GetLoadedLibraries() { DARTSCOPE(Thread::Current()); Isolate* I = T->isolate(); @@ -5597,7 +5344,6 @@ DART_EXPORT Dart_Handle Dart_GetLoadedLibraries() { return Api::NewHandle(T, library_list.raw()); } - DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url) { DARTSCOPE(Thread::Current()); const String& url_str = Api::UnwrapStringHandle(Z, url); @@ -5614,7 +5360,6 @@ DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url) { } } - DART_EXPORT Dart_Handle Dart_LibraryHandleError(Dart_Handle library_in, Dart_Handle error_in) { DARTSCOPE(Thread::Current()); @@ -5642,7 +5387,6 @@ DART_EXPORT Dart_Handle Dart_LibraryHandleError(Dart_Handle library_in, return error_in; } - #if !defined(DART_PRECOMPILED_RUNTIME) static Dart_Handle LoadKernelProgram(Dart_Handle url, Thread* T, void* kernel) { kernel::KernelReader reader(reinterpret_cast(kernel)); @@ -5658,7 +5402,6 @@ static Dart_Handle LoadKernelProgram(Dart_Handle url, Thread* T, void* kernel) { } #endif - DART_EXPORT Dart_Handle Dart_LoadLibrary(Dart_Handle url, Dart_Handle resolved_url, Dart_Handle source, @@ -5738,7 +5481,6 @@ DART_EXPORT Dart_Handle Dart_LoadLibrary(Dart_Handle url, return result; } - DART_EXPORT Dart_Handle Dart_LibraryImportLibrary(Dart_Handle library, Dart_Handle import, Dart_Handle prefix) { @@ -5780,7 +5522,6 @@ DART_EXPORT Dart_Handle Dart_LibraryImportLibrary(Dart_Handle library, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_GetImportsOfScheme(Dart_Handle scheme) { DARTSCOPE(Thread::Current()); Isolate* I = T->isolate(); @@ -5816,7 +5557,6 @@ DART_EXPORT Dart_Handle Dart_GetImportsOfScheme(Dart_Handle scheme) { return Api::NewHandle(T, Array::MakeFixedLength(result)); } - DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library, Dart_Handle url, Dart_Handle resolved_url, @@ -5867,7 +5607,6 @@ DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library, return result; } - DART_EXPORT Dart_Handle Dart_LibraryLoadPatch(Dart_Handle library, Dart_Handle url, Dart_Handle patch_source) { @@ -5898,7 +5637,6 @@ DART_EXPORT Dart_Handle Dart_LibraryLoadPatch(Dart_Handle library, return result; } - // Finalizes classes and invokes Dart core library function that completes // futures of loadLibrary calls (deferred library loading). DART_EXPORT Dart_Handle Dart_FinalizeLoading(bool complete_futures) { @@ -5959,7 +5697,6 @@ DART_EXPORT Dart_Handle Dart_FinalizeLoading(bool complete_futures) { return Api::Success(); } - DART_EXPORT Dart_Handle Dart_SetNativeResolver(Dart_Handle library, Dart_NativeEntryResolver resolver, @@ -5974,7 +5711,6 @@ Dart_SetNativeResolver(Dart_Handle library, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_GetNativeResolver(Dart_Handle library, Dart_NativeEntryResolver* resolver) { @@ -5991,7 +5727,6 @@ Dart_GetNativeResolver(Dart_Handle library, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_GetNativeSymbol(Dart_Handle library, Dart_NativeEntrySymbol* resolver) { if (resolver == NULL) { @@ -6031,7 +5766,6 @@ DART_EXPORT Dart_Handle Dart_GetPeer(Dart_Handle object, void** peer) { return Api::Success(); } - DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer) { Thread* thread = Thread::Current(); CHECK_ISOLATE(thread->isolate()); @@ -6051,7 +5785,6 @@ DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer) { return Api::Success(); } - // --- Dart Front-End (Kernel) support --- DART_EXPORT bool Dart_IsKernelIsolate(Dart_Isolate isolate) { @@ -6063,7 +5796,6 @@ DART_EXPORT bool Dart_IsKernelIsolate(Dart_Isolate isolate) { #endif } - DART_EXPORT bool Dart_KernelIsolateIsRunning() { #ifdef DART_PRECOMPILED_RUNTIME return false; @@ -6072,7 +5804,6 @@ DART_EXPORT bool Dart_KernelIsolateIsRunning() { #endif } - DART_EXPORT Dart_Port Dart_KernelPort() { #ifdef DART_PRECOMPILED_RUNTIME return false; @@ -6081,7 +5812,6 @@ DART_EXPORT Dart_Port Dart_KernelPort() { #endif } - DART_EXPORT Dart_KernelCompilationResult Dart_CompileToKernel(const char* script_uri) { #ifdef DART_PRECOMPILED_RUNTIME @@ -6116,17 +5846,14 @@ DART_EXPORT bool Dart_IsServiceIsolate(Dart_Isolate isolate) { return ServiceIsolate::IsServiceIsolate(iso); } - DART_EXPORT Dart_Port Dart_ServiceWaitForLoadPort() { return ServiceIsolate::WaitForLoadPort(); } - DART_EXPORT int64_t Dart_TimelineGetMicros() { return OS::GetCurrentMonotonicMicros(); } - #if defined(PRODUCT) DART_EXPORT void Dart_RegisterIsolateServiceRequestCallback( const char* name, @@ -6135,7 +5862,6 @@ DART_EXPORT void Dart_RegisterIsolateServiceRequestCallback( return; } - DART_EXPORT void Dart_RegisterRootServiceRequestCallback( const char* name, Dart_ServiceRequestCallback callback, @@ -6143,14 +5869,12 @@ DART_EXPORT void Dart_RegisterRootServiceRequestCallback( return; } - DART_EXPORT Dart_Handle Dart_SetServiceStreamCallbacks( Dart_ServiceStreamListenCallback listen_callback, Dart_ServiceStreamCancelCallback cancel_callback) { return Api::Success(); } - DART_EXPORT Dart_Handle Dart_ServiceSendDataEvent(const char* stream_id, const char* event_kind, const uint8_t* bytes, @@ -6158,36 +5882,30 @@ DART_EXPORT Dart_Handle Dart_ServiceSendDataEvent(const char* stream_id, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_SetFileModifiedCallback(Dart_FileModifiedCallback file_mod_callback) { return Api::Success(); } - DART_EXPORT bool Dart_IsReloading() { return false; } - DART_EXPORT void Dart_GlobalTimelineSetRecordedStreams(int64_t stream_mask) { return; } - DART_EXPORT void Dart_SetEmbedderTimelineCallbacks( Dart_EmbedderTimelineStartRecording start_recording, Dart_EmbedderTimelineStopRecording stop_recording) { return; } - DART_EXPORT bool Dart_GlobalTimelineGetTrace(Dart_StreamConsumer consumer, void* user_data) { return false; } - DART_EXPORT void Dart_TimelineEvent(const char* label, int64_t timestamp0, int64_t timestamp1_or_async_id, @@ -6207,7 +5925,6 @@ DART_EXPORT void Dart_RegisterIsolateServiceRequestCallback( } } - DART_EXPORT void Dart_RegisterRootServiceRequestCallback( const char* name, Dart_ServiceRequestCallback callback, @@ -6217,7 +5934,6 @@ DART_EXPORT void Dart_RegisterRootServiceRequestCallback( } } - DART_EXPORT Dart_Handle Dart_SetServiceStreamCallbacks( Dart_ServiceStreamListenCallback listen_callback, Dart_ServiceStreamCancelCallback cancel_callback) { @@ -6256,7 +5972,6 @@ DART_EXPORT Dart_Handle Dart_SetServiceStreamCallbacks( return Api::Success(); } - DART_EXPORT Dart_Handle Dart_ServiceSendDataEvent(const char* stream_id, const char* event_kind, const uint8_t* bytes, @@ -6280,7 +5995,6 @@ DART_EXPORT Dart_Handle Dart_ServiceSendDataEvent(const char* stream_id, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_SetFileModifiedCallback(Dart_FileModifiedCallback file_modified_callback) { if (!FLAG_support_service) { @@ -6304,7 +6018,6 @@ Dart_SetFileModifiedCallback(Dart_FileModifiedCallback file_modified_callback) { return Api::Success(); } - DART_EXPORT bool Dart_IsReloading() { Thread* thread = Thread::Current(); Isolate* isolate = thread->isolate(); @@ -6312,7 +6025,6 @@ DART_EXPORT bool Dart_IsReloading() { return isolate->IsReloading(); } - DART_EXPORT void Dart_GlobalTimelineSetRecordedStreams(int64_t stream_mask) { if (!FLAG_support_timeline) { return; @@ -6339,7 +6051,6 @@ DART_EXPORT void Dart_GlobalTimelineSetRecordedStreams(int64_t stream_mask) { Timeline::SetStreamVMEnabled(vm_enabled); } - static void StartStreamToConsumer(Dart_StreamConsumer consumer, void* user_data, const char* stream_name) { @@ -6347,7 +6058,6 @@ static void StartStreamToConsumer(Dart_StreamConsumer consumer, consumer(Dart_StreamConsumer_kStart, stream_name, NULL, 0, user_data); } - static void FinishStreamToConsumer(Dart_StreamConsumer consumer, void* user_data, const char* stream_name) { @@ -6355,7 +6065,6 @@ static void FinishStreamToConsumer(Dart_StreamConsumer consumer, consumer(Dart_StreamConsumer_kFinish, stream_name, NULL, 0, user_data); } - static void DataStreamToConsumer(Dart_StreamConsumer consumer, void* user_data, const char* output, @@ -6386,7 +6095,6 @@ static void DataStreamToConsumer(Dart_StreamConsumer consumer, ASSERT(remaining == 0); } - static bool StreamTraceEvents(Dart_StreamConsumer consumer, void* user_data, JSONStream* js) { @@ -6418,7 +6126,6 @@ static bool StreamTraceEvents(Dart_StreamConsumer consumer, return true; } - DART_EXPORT void Dart_SetEmbedderTimelineCallbacks( Dart_EmbedderTimelineStartRecording start_recording, Dart_EmbedderTimelineStopRecording stop_recording) { @@ -6429,7 +6136,6 @@ DART_EXPORT void Dart_SetEmbedderTimelineCallbacks( Timeline::set_stop_recording_cb(stop_recording); } - DART_EXPORT bool Dart_GlobalTimelineGetTrace(Dart_StreamConsumer consumer, void* user_data) { if (!FLAG_support_timeline) { @@ -6460,7 +6166,6 @@ DART_EXPORT bool Dart_GlobalTimelineGetTrace(Dart_StreamConsumer consumer, return success; } - DART_EXPORT void Dart_TimelineEvent(const char* label, int64_t timestamp0, int64_t timestamp1_or_async_id, @@ -6530,7 +6235,6 @@ DART_EXPORT void Dart_TimelineEvent(const char* label, } #endif // defined(PRODUCT) - DART_EXPORT void Dart_SetThreadName(const char* name) { OSThread* thread = OSThread::Current(); if (thread == NULL) { @@ -6540,7 +6244,6 @@ DART_EXPORT void Dart_SetThreadName(const char* name) { thread->SetName(name); } - DART_EXPORT Dart_Handle Dart_SaveCompilationTrace(uint8_t** buffer, intptr_t* buffer_length) { @@ -6555,7 +6258,6 @@ Dart_Handle Dart_SaveCompilationTrace(uint8_t** buffer, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_LoadCompilationTrace(uint8_t* buffer, intptr_t buffer_length) { Thread* thread = Thread::Current(); @@ -6571,7 +6273,6 @@ Dart_Handle Dart_LoadCompilationTrace(uint8_t* buffer, intptr_t buffer_length) { return Api::Success(); } - DART_EXPORT Dart_Handle Dart_SaveJITFeedback(uint8_t** buffer, intptr_t* buffer_length) { #if defined(DART_PRECOMPILED_RUNTIME) @@ -6771,7 +6472,6 @@ Dart_Precompile(Dart_QualifiedFunctionName entry_points[], #endif } - DART_EXPORT Dart_Handle Dart_CreateAppAOTSnapshotAsAssembly(uint8_t** assembly_buffer, intptr_t* assembly_size) { @@ -6813,7 +6513,6 @@ Dart_CreateAppAOTSnapshotAsAssembly(uint8_t** assembly_buffer, #endif } - DART_EXPORT Dart_Handle Dart_CreateAppAOTSnapshotAsBlobs(uint8_t** vm_snapshot_data_buffer, intptr_t* vm_snapshot_data_size, @@ -6874,7 +6573,6 @@ Dart_CreateAppAOTSnapshotAsBlobs(uint8_t** vm_snapshot_data_buffer, #endif } - DART_EXPORT Dart_Handle Dart_CreateCoreJITSnapshotAsBlobs( uint8_t** vm_snapshot_data_buffer, intptr_t* vm_snapshot_data_size, @@ -6938,7 +6636,6 @@ DART_EXPORT Dart_Handle Dart_CreateCoreJITSnapshotAsBlobs( #endif } - DART_EXPORT Dart_Handle Dart_CreateAppJITSnapshotAsBlobs(uint8_t** isolate_snapshot_data_buffer, intptr_t* isolate_snapshot_data_size, @@ -6990,7 +6687,6 @@ Dart_CreateAppJITSnapshotAsBlobs(uint8_t** isolate_snapshot_data_buffer, #endif } - DART_EXPORT bool Dart_IsPrecompiledRuntime() { #if defined(DART_PRECOMPILED_RUNTIME) return true; @@ -6999,7 +6695,6 @@ DART_EXPORT bool Dart_IsPrecompiledRuntime() { #endif } - DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { #ifndef PRODUCT Profiler::DumpStackTrace(context); diff --git a/runtime/vm/dart_api_impl.h b/runtime/vm/dart_api_impl.h index 013725c51da..c1d3a5d25ab 100644 --- a/runtime/vm/dart_api_impl.h +++ b/runtime/vm/dart_api_impl.h @@ -67,7 +67,6 @@ const char* CanonicalFunction(const char* func); TransitionNativeToVM transition(T); \ HANDLESCOPE(T); - #define RETURN_TYPE_ERROR(zone, dart_handle, type) \ do { \ const Object& tmp = \ @@ -82,7 +81,6 @@ const char* CanonicalFunction(const char* func); CURRENT_FUNC, #dart_handle, #type); \ } while (0) - #define RETURN_NULL_ERROR(parameter) \ return Api::NewError("%s expects argument '%s' to be non-null.", \ CURRENT_FUNC, #parameter) @@ -103,7 +101,6 @@ const char* CanonicalFunction(const char* func); } \ } while (0) - class Api : AllStatic { public: // Create on the stack to provide a new throw-safe api scope. diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc index 006b77f9d53..60ff7cc4517 100644 --- a/runtime/vm/dart_api_impl_test.cc +++ b/runtime/vm/dart_api_impl_test.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +#include "vm/dart_api_impl.h" #include "bin/builtin.h" -#include "vm/compiler.h" #include "include/dart_api.h" #include "include/dart_mirrors_api.h" #include "include/dart_native_api.h" @@ -12,7 +12,7 @@ #include "platform/text_buffer.h" #include "platform/utils.h" #include "vm/class_finalizer.h" -#include "vm/dart_api_impl.h" +#include "vm/compiler.h" #include "vm/dart_api_state.h" #include "vm/lockers.h" #include "vm/timeline.h" @@ -64,7 +64,6 @@ TEST_CASE(ErrorHandleBasics) { EXPECT_VALID(Dart_ErrorGetStackTrace(exception)); } - TEST_CASE(StackTraceInfo) { const char* kScriptChars = "bar() => throw new Error();\n" @@ -135,7 +134,6 @@ TEST_CASE(StackTraceInfo) { EXPECT(Dart_IsError(result)); } - TEST_CASE(DeepStackTraceInfo) { const char* kScriptChars = "foo(n) => n == 1 ? throw new Error() : foo(n-1);\n" @@ -214,7 +212,6 @@ TEST_CASE(DeepStackTraceInfo) { EXPECT(Dart_IsError(result)); } - TEST_CASE(StackOverflowStackTraceInfo) { const char* kScriptChars = "class C {\n" @@ -263,7 +260,6 @@ TEST_CASE(StackOverflowStackTraceInfo) { EXPECT(Dart_IsError(result)); } - TEST_CASE(OutOfMemoryStackTraceInfo) { const char* kScriptChars = "var number_of_ints = 134000000;\n" @@ -281,7 +277,6 @@ TEST_CASE(OutOfMemoryStackTraceInfo) { EXPECT(Dart_IsError(result)); // No StackTrace for OutOfMemory. } - void CurrentStackTraceNative(Dart_NativeArguments args) { Dart_EnterScope(); @@ -369,7 +364,6 @@ void CurrentStackTraceNative(Dart_NativeArguments args) { Dart_ExitScope(); } - static Dart_NativeFunction CurrentStackTraceNativeLookup( Dart_Handle name, int argument_count, @@ -379,7 +373,6 @@ static Dart_NativeFunction CurrentStackTraceNativeLookup( return reinterpret_cast(&CurrentStackTraceNative); } - TEST_CASE(CurrentStackTraceInfo) { const char* kScriptChars = "inspectStack() native 'CurrentStackTraceNatve';\n" @@ -396,10 +389,8 @@ TEST_CASE(CurrentStackTraceInfo) { EXPECT_EQ(42, value); } - #endif // !PRODUCT - TEST_CASE(ErrorHandleTypes) { const String& compile_message = String::Handle(String::New("CompileError")); const String& fatal_message = String::Handle(String::New("FatalError")); @@ -451,7 +442,6 @@ TEST_CASE(ErrorHandleTypes) { EXPECT_STREQ("FatalError", Dart_GetError(fatal_error)); } - TEST_CASE(UnhandleExceptionError) { const char* exception_cstr = ""; @@ -501,14 +491,12 @@ TEST_CASE(UnhandleExceptionError) { EXPECT_STREQ(kRegularString, exception_cstr); } - // Should we propagate the error via Dart_SetReturnValue? static bool use_set_return = false; // Should we propagate the error via Dart_ThrowException? static bool use_throw_exception = false; - void PropagateErrorNative(Dart_NativeArguments args) { Dart_Handle closure = Dart_GetNativeArgument(args, 0); EXPECT(Dart_IsClosure(closure)); @@ -527,7 +515,6 @@ void PropagateErrorNative(Dart_NativeArguments args) { } } - static Dart_NativeFunction PropagateError_native_lookup( Dart_Handle name, int argument_count, @@ -537,7 +524,6 @@ static Dart_NativeFunction PropagateError_native_lookup( return reinterpret_cast(&PropagateErrorNative); } - TEST_CASE(Dart_PropagateError) { const char* kScriptChars = "raiseCompileError() {\n" @@ -601,14 +587,12 @@ TEST_CASE(Dart_PropagateError) { EXPECT_SUBSTRING("myException", Dart_GetError(result)); } - TEST_CASE(Dart_Error) { Dart_Handle error = Api::NewError("An %s", "error"); EXPECT(Dart_IsError(error)); EXPECT_STREQ("An error", Dart_GetError(error)); } - TEST_CASE(Null) { Dart_Handle null = Dart_Null(); EXPECT_VALID(null); @@ -619,14 +603,12 @@ TEST_CASE(Null) { EXPECT(!Dart_IsNull(str)); } - TEST_CASE(EmptyString) { Dart_Handle empty = Dart_EmptyString(); EXPECT_VALID(empty); EXPECT(!Dart_IsNull(empty)); } - TEST_CASE(IdentityEquals) { Dart_Handle five = Dart_NewInteger(5); Dart_Handle five_again = Dart_NewInteger(5); @@ -677,7 +659,6 @@ TEST_CASE(IdentityEquals) { } } - TEST_CASE(IdentityHash) { Dart_Handle five = Dart_NewInteger(5); Dart_Handle five_again = Dart_NewInteger(5); @@ -718,7 +699,6 @@ TEST_CASE(IdentityHash) { } } - TEST_CASE(ObjectEquals) { bool equal = false; Dart_Handle five = NewString("5"); @@ -743,7 +723,6 @@ TEST_CASE(ObjectEquals) { EXPECT(!equal); } - TEST_CASE(InstanceValues) { EXPECT(Dart_IsInstance(NewString("test"))); EXPECT(Dart_IsInstance(Dart_True())); @@ -752,7 +731,6 @@ TEST_CASE(InstanceValues) { EXPECT(!Dart_IsInstance(Dart_Null())); } - TEST_CASE(InstanceGetType) { Zone* zone = thread->zone(); // Get the handle from a valid instance handle. @@ -795,7 +773,6 @@ TEST_CASE(InstanceGetType) { "type Instance."); } - TEST_CASE(BooleanValues) { Dart_Handle str = NewString("test"); EXPECT(!Dart_IsBoolean(str)); @@ -819,7 +796,6 @@ TEST_CASE(BooleanValues) { EXPECT(!value); } - TEST_CASE(BooleanConstants) { Dart_Handle true_handle = Dart_True(); EXPECT_VALID(true_handle); @@ -839,7 +815,6 @@ TEST_CASE(BooleanConstants) { EXPECT(!value); } - TEST_CASE(DoubleValues) { const double kDoubleVal1 = 201.29; const double kDoubleVal2 = 101.19; @@ -856,7 +831,6 @@ TEST_CASE(DoubleValues) { EXPECT_EQ(kDoubleVal2, out2); } - TEST_CASE(NumberValues) { // TODO(antonm): add various kinds of ints (smi, mint, bigint). const char* kScriptChars = @@ -889,7 +863,6 @@ TEST_CASE(NumberValues) { EXPECT(!Dart_IsNumber(result)); } - TEST_CASE(IntegerValues) { const int64_t kIntegerVal1 = 100; const int64_t kIntegerVal2 = 0xffffffff; @@ -943,7 +916,6 @@ TEST_CASE(IntegerValues) { EXPECT(Dart_IsError(result)); } - TEST_CASE(IntegerFitsIntoInt64) { Dart_Handle max = Dart_NewInteger(kMaxInt64); EXPECT(Dart_IsInteger(max)); @@ -974,7 +946,6 @@ TEST_CASE(IntegerFitsIntoInt64) { EXPECT(!fits); } - TEST_CASE(IntegerFitsIntoUint64) { Dart_Handle max = Dart_NewIntegerFromUint64(kMaxUint64); EXPECT(Dart_IsInteger(max)); @@ -1005,7 +976,6 @@ TEST_CASE(IntegerFitsIntoUint64) { EXPECT(!fits); } - TEST_CASE(ArrayValues) { EXPECT(!Dart_IsList(Dart_Null())); const int kArrayLength = 10; @@ -1042,7 +1012,6 @@ TEST_CASE(ArrayValues) { } } - TEST_CASE(IsString) { uint8_t latin1[] = {'o', 'n', 'e', 0xC2, 0xA2}; @@ -1121,7 +1090,6 @@ TEST_CASE(IsString) { EXPECT(!Dart_IsExternalString(str32)); } - TEST_CASE(NewString) { const char* ascii = "string"; Dart_Handle ascii_str = NewString(ascii); @@ -1143,7 +1111,6 @@ TEST_CASE(NewString) { EXPECT(Dart_IsError(invalid_str)); } - TEST_CASE(MalformedStringToUTF8) { // 1D11E = treble clef // [0] should be high surrogate D834 @@ -1189,7 +1156,6 @@ TEST_CASE(MalformedStringToUTF8) { } } - // Helper class to ensure new gen GC is triggered without any side effects. // The normal call to CollectGarbage(Heap::kNew) could potentially trigger // an old gen collection if there is a promotion failure and this could @@ -1211,12 +1177,10 @@ class GCTestHelper : public AllStatic { } }; - static void ExternalStringCallbackFinalizer(void* peer) { *static_cast(peer) *= 2; } - TEST_CASE(ExternalStringCallback) { int peer8 = 40; int peer16 = 41; @@ -1252,7 +1216,6 @@ TEST_CASE(ExternalStringCallback) { } } - TEST_CASE(ExternalStringPretenure) { { Dart_EnterScope(); @@ -1292,7 +1255,6 @@ TEST_CASE(ExternalStringPretenure) { } } - TEST_CASE(ExternalTypedDataPretenure) { { Dart_EnterScope(); @@ -1321,7 +1283,6 @@ TEST_CASE(ExternalTypedDataPretenure) { } } - TEST_CASE(ListAccess) { const char* kScriptChars = "List testMain() {" @@ -1472,7 +1433,6 @@ TEST_CASE(ListAccess) { EXPECT(Dart_IsUnhandledExceptionError(result)); } - TEST_CASE(MapAccess) { EXPECT(!Dart_IsMap(Dart_Null())); const char* kScriptChars = @@ -1565,7 +1525,6 @@ TEST_CASE(MapAccess) { EXPECT(Dart_IsError(Dart_MapKeys(a))); } - TEST_CASE(IsFuture) { const char* kScriptChars = "import 'dart:async';" @@ -1591,7 +1550,6 @@ TEST_CASE(IsFuture) { EXPECT(!Dart_IsFuture(null)); } - TEST_CASE(TypedDataViewListGetAsBytes) { const int kSize = 1000; @@ -1624,7 +1582,6 @@ TEST_CASE(TypedDataViewListGetAsBytes) { delete[] data; } - TEST_CASE(TypedDataViewListIsTypedData) { const int kSize = 1000; @@ -1647,7 +1604,6 @@ TEST_CASE(TypedDataViewListIsTypedData) { EXPECT(Dart_IsTypedData(view_obj)); } - TEST_CASE(TypedDataAccess) { EXPECT_EQ(Dart_TypedData_kInvalid, Dart_GetTypeOfTypedData(Dart_True())); EXPECT_EQ(Dart_TypedData_kInvalid, @@ -1721,7 +1677,6 @@ TEST_CASE(TypedDataAccess) { } } - TEST_CASE(ByteBufferAccess) { EXPECT(!Dart_IsByteBuffer(Dart_True())); Dart_Handle byte_array = Dart_NewTypedData(Dart_TypedData_kUint8, 10); @@ -1765,7 +1720,6 @@ TEST_CASE(ByteBufferAccess) { EXPECT(Dart_IsError(result)); } - static int kLength = 16; static void ByteDataNativeFunction(Dart_NativeArguments args) { @@ -1777,7 +1731,6 @@ static void ByteDataNativeFunction(Dart_NativeArguments args) { Dart_ExitScope(); } - static Dart_NativeFunction ByteDataNativeResolver(Dart_Handle name, int arg_count, bool* auto_setup_scope) { @@ -1786,7 +1739,6 @@ static Dart_NativeFunction ByteDataNativeResolver(Dart_Handle name, return &ByteDataNativeFunction; } - TEST_CASE(ByteDataAccess) { const char* kScriptChars = "import 'dart:typed_data';\n" @@ -1822,7 +1774,6 @@ TEST_CASE(ByteDataAccess) { EXPECT_VALID(result); } - static const intptr_t kExtLength = 16; static int8_t data[kExtLength] = { 0x41, 0x42, 0x41, 0x42, 0x41, 0x42, 0x41, 0x42, @@ -1840,7 +1791,6 @@ static void ExternalByteDataNativeFunction(Dart_NativeArguments args) { Dart_ExitScope(); } - static Dart_NativeFunction ExternalByteDataNativeResolver( Dart_Handle name, int arg_count, @@ -1850,7 +1800,6 @@ static Dart_NativeFunction ExternalByteDataNativeResolver( return &ExternalByteDataNativeFunction; } - TEST_CASE(ExternalByteDataAccess) { // TODO(asiva): Once we have getInt16LE and getInt16BE support use the // appropriate getter instead of the host endian format used now. @@ -1897,10 +1846,8 @@ TEST_CASE(ExternalByteDataAccess) { } } - #ifndef PRODUCT - static const intptr_t kOptExtLength = 16; static int8_t opt_data[kOptExtLength] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, @@ -1918,7 +1865,6 @@ static void OptExternalByteDataNativeFunction(Dart_NativeArguments args) { Dart_ExitScope(); } - static Dart_NativeFunction OptExternalByteDataNativeResolver( Dart_Handle name, int arg_count, @@ -1928,7 +1874,6 @@ static Dart_NativeFunction OptExternalByteDataNativeResolver( return &OptExternalByteDataNativeFunction; } - TEST_CASE(OptimizedExternalByteDataAccess) { const char* kScriptChars = "import 'dart:typed_data';\n" @@ -1970,10 +1915,8 @@ TEST_CASE(OptimizedExternalByteDataAccess) { FLAG_optimization_counter_threshold = old_oct; } - #endif // !PRODUCT - static void TestTypedDataDirectAccess() { Dart_Handle str = Dart_NewStringFromCString("junk"); Dart_Handle byte_array = Dart_NewTypedData(Dart_TypedData_kUint8, 10); @@ -2013,19 +1956,16 @@ static void TestTypedDataDirectAccess() { " to be of type 'TypedData'."); } - TEST_CASE(TypedDataDirectAccessUnverified) { FLAG_verify_acquired_data = false; TestTypedDataDirectAccess(); } - TEST_CASE(TypedDataDirectAccessVerified) { FLAG_verify_acquired_data = true; TestTypedDataDirectAccess(); } - static void TestDirectAccess(Dart_Handle lib, Dart_Handle array, Dart_TypedData_Type expected_type, @@ -2076,7 +2016,6 @@ static void TestDirectAccess(Dart_Handle lib, EXPECT_VALID(result); } - static void TestTypedDataDirectAccess1() { const char* kScriptChars = "import 'dart:typed_data';\n" @@ -2121,19 +2060,16 @@ static void TestTypedDataDirectAccess1() { TestDirectAccess(lib, ext_list_access_test_obj, Dart_TypedData_kUint8, true); } - TEST_CASE(TypedDataDirectAccess1Unverified) { FLAG_verify_acquired_data = false; TestTypedDataDirectAccess1(); } - TEST_CASE(TypedDataDirectAccess1Verified) { FLAG_verify_acquired_data = true; TestTypedDataDirectAccess1(); } - static void TestTypedDataViewDirectAccess() { const char* kScriptChars = "import 'dart:typed_data';\n" @@ -2172,19 +2108,16 @@ static void TestTypedDataViewDirectAccess() { TestDirectAccess(lib, list_access_test_obj, Dart_TypedData_kInt8, false); } - TEST_CASE(TypedDataViewDirectAccessUnverified) { FLAG_verify_acquired_data = false; TestTypedDataViewDirectAccess(); } - TEST_CASE(TypedDataViewDirectAccessVerified) { FLAG_verify_acquired_data = true; TestTypedDataViewDirectAccess(); } - static void TestByteDataDirectAccess() { const char* kScriptChars = "import 'dart:typed_data';\n" @@ -2223,19 +2156,16 @@ static void TestByteDataDirectAccess() { TestDirectAccess(lib, list_access_test_obj, Dart_TypedData_kByteData, false); } - TEST_CASE(ByteDataDirectAccessUnverified) { FLAG_verify_acquired_data = false; TestByteDataDirectAccess(); } - TEST_CASE(ByteDataDirectAccessVerified) { FLAG_verify_acquired_data = true; TestByteDataDirectAccess(); } - static void ExternalTypedDataAccessTests(Dart_Handle obj, Dart_TypedData_Type expected_type, uint8_t data[], @@ -2292,7 +2222,6 @@ static void ExternalTypedDataAccessTests(Dart_Handle obj, } } - TEST_CASE(ExternalTypedDataAccess) { uint8_t data[] = {0, 11, 22, 33, 44, 55, 66, 77}; intptr_t data_length = ARRAY_SIZE(data); @@ -2302,7 +2231,6 @@ TEST_CASE(ExternalTypedDataAccess) { ExternalTypedDataAccessTests(obj, Dart_TypedData_kUint8, data, data_length); } - TEST_CASE(ExternalClampedTypedDataAccess) { uint8_t data[] = {0, 11, 22, 33, 44, 55, 66, 77}; intptr_t data_length = ARRAY_SIZE(data); @@ -2313,7 +2241,6 @@ TEST_CASE(ExternalClampedTypedDataAccess) { data_length); } - TEST_CASE(ExternalUint8ClampedArrayAccess) { const char* kScriptChars = "testClamped(List a) {\n" @@ -2348,26 +2275,22 @@ TEST_CASE(ExternalUint8ClampedArrayAccess) { EXPECT(value); } - static void NopCallback(void* isolate_callback_data, Dart_WeakPersistentHandle handle, void* peer) {} - static void UnreachedCallback(void* isolate_callback_data, Dart_WeakPersistentHandle handle, void* peer) { UNREACHABLE(); } - static void ExternalTypedDataFinalizer(void* isolate_callback_data, Dart_WeakPersistentHandle handle, void* peer) { *static_cast(peer) = 42; } - TEST_CASE(ExternalTypedDataCallback) { int peer = 0; { @@ -2392,7 +2315,6 @@ TEST_CASE(ExternalTypedDataCallback) { } } - static void SlowFinalizer(void* isolate_callback_data, Dart_WeakPersistentHandle handle, void* peer) { @@ -2401,7 +2323,6 @@ static void SlowFinalizer(void* isolate_callback_data, (*count)++; } - TEST_CASE(SlowFinalizer) { intptr_t count = 0; for (intptr_t i = 0; i < 10; i++) { @@ -2426,7 +2347,6 @@ TEST_CASE(SlowFinalizer) { EXPECT_EQ(20, count); } - static void CheckFloat32x4Data(Dart_Handle obj) { void* raw_data = NULL; intptr_t len; @@ -2441,7 +2361,6 @@ static void CheckFloat32x4Data(Dart_Handle obj) { EXPECT_VALID(Dart_TypedDataReleaseData(obj)); } - TEST_CASE(Float32x4List) { const char* kScriptChars = "import 'dart:typed_data';\n" @@ -2483,7 +2402,6 @@ TEST_CASE(Float32x4List) { } } - // Unit test for entering a scope, creating a local handle and exiting // the scope. VM_UNIT_TEST_CASE(EnterExitScope) { @@ -2506,7 +2424,6 @@ VM_UNIT_TEST_CASE(EnterExitScope) { EXPECT(scope == thread->api_top_scope()); } - // Unit test for creating and deleting persistent handles. VM_UNIT_TEST_CASE(PersistentHandles) { const char* kTestString1 = "Test String1"; @@ -2574,7 +2491,6 @@ VM_UNIT_TEST_CASE(PersistentHandles) { Dart_ShutdownIsolate(); } - // Test that we are able to create a persistent handle from a // persistent handle. VM_UNIT_TEST_CASE(NewPersistentHandle_FromPersistentHandle) { @@ -2606,7 +2522,6 @@ VM_UNIT_TEST_CASE(NewPersistentHandle_FromPersistentHandle) { EXPECT(value); } - // Test that we can assign to a persistent handle. VM_UNIT_TEST_CASE(AssignToPersistentHandle) { const char* kTestString1 = "Test String1"; @@ -2640,21 +2555,17 @@ VM_UNIT_TEST_CASE(AssignToPersistentHandle) { EXPECT(Dart_IsNull(obj)); } - static Dart_Handle AsHandle(Dart_PersistentHandle weak) { return Dart_HandleFromPersistent(weak); } - static Dart_Handle AsHandle(Dart_WeakPersistentHandle weak) { return Dart_HandleFromWeakPersistent(weak); } - static Dart_WeakPersistentHandle weak_new_ref = NULL; static Dart_WeakPersistentHandle weak_old_ref = NULL; - static void WeakPersistentHandleCallback(void* isolate_callback_data, Dart_WeakPersistentHandle handle, void* peer) { @@ -2665,7 +2576,6 @@ static void WeakPersistentHandleCallback(void* isolate_callback_data, } } - TEST_CASE(WeakPersistentHandle) { Dart_Handle local_new_ref = Dart_Null(); weak_new_ref = Dart_NewWeakPersistentHandle(local_new_ref, NULL, 0, @@ -2786,7 +2696,6 @@ TEST_CASE(WeakPersistentHandle) { } } - TEST_CASE(WeakPersistentHandleErrors) { Dart_EnterScope(); @@ -2807,14 +2716,12 @@ TEST_CASE(WeakPersistentHandleErrors) { Dart_ExitScope(); } - static void WeakPersistentHandlePeerFinalizer(void* isolate_callback_data, Dart_WeakPersistentHandle handle, void* peer) { *static_cast(peer) = 42; } - TEST_CASE(WeakPersistentHandleCallback) { Dart_WeakPersistentHandle weak_ref = NULL; int peer = 0; @@ -2838,7 +2745,6 @@ TEST_CASE(WeakPersistentHandleCallback) { } } - TEST_CASE(WeakPersistentHandleNoCallback) { Dart_WeakPersistentHandle weak_ref = NULL; int peer = 0; @@ -2865,7 +2771,6 @@ TEST_CASE(WeakPersistentHandleNoCallback) { } } - VM_UNIT_TEST_CASE(WeakPersistentHandlesCallbackShutdown) { TestCase::CreateTestIsolate(); Dart_EnterScope(); @@ -2878,7 +2783,6 @@ VM_UNIT_TEST_CASE(WeakPersistentHandlesCallbackShutdown) { EXPECT(peer == 42); } - TEST_CASE(WeakPersistentHandleExternalAllocationSize) { Heap* heap = Isolate::Current()->heap(); EXPECT(heap->ExternalInWords(Heap::kNew) == 0); @@ -2931,7 +2835,6 @@ TEST_CASE(WeakPersistentHandleExternalAllocationSize) { } } - TEST_CASE(WeakPersistentHandleExternalAllocationSizeNewspaceGC) { Dart_Isolate isolate = reinterpret_cast(Isolate::Current()); Heap* heap = Isolate::Current()->heap(); @@ -2975,7 +2878,6 @@ TEST_CASE(WeakPersistentHandleExternalAllocationSizeNewspaceGC) { } } - TEST_CASE(WeakPersistentHandleExternalAllocationSizeOldspaceGC) { // Check that external allocation in old space can trigger GC. Isolate* isolate = Isolate::Current(); @@ -3005,7 +2907,6 @@ TEST_CASE(WeakPersistentHandleExternalAllocationSizeOldspaceGC) { Dart_ExitScope(); } - TEST_CASE(WeakPersistentHandleExternalAllocationSizeOddReferents) { Heap* heap = Isolate::Current()->heap(); Dart_WeakPersistentHandle weak1 = NULL; @@ -3041,12 +2942,10 @@ TEST_CASE(WeakPersistentHandleExternalAllocationSizeOddReferents) { } } - static Dart_WeakPersistentHandle weak1 = NULL; static Dart_WeakPersistentHandle weak2 = NULL; static Dart_WeakPersistentHandle weak3 = NULL; - static void ImplicitReferencesCallback(void* isolate_callback_data, Dart_WeakPersistentHandle handle, void* peer) { @@ -3059,7 +2958,6 @@ static void ImplicitReferencesCallback(void* isolate_callback_data, } } - TEST_CASE(ImplicitReferencesOldSpace) { Dart_PersistentHandle strong = NULL; Dart_WeakPersistentHandle strong_weak = NULL; @@ -3125,12 +3023,10 @@ TEST_CASE(ImplicitReferencesOldSpace) { } } - TEST_CASE(ImplicitReferencesNewSpace) { Dart_PersistentHandle strong = NULL; Dart_WeakPersistentHandle strong_weak = NULL; - Dart_EnterScope(); { CHECK_API_SCOPE(thread); @@ -3191,36 +3087,28 @@ TEST_CASE(ImplicitReferencesNewSpace) { } } - static int global_prologue_callback_status; - static void PrologueCallbackTimes2() { global_prologue_callback_status *= 2; } - static void PrologueCallbackTimes3() { global_prologue_callback_status *= 3; } - static int global_epilogue_callback_status; - static void EpilogueCallbackNOP() {} - static void EpilogueCallbackTimes4() { global_epilogue_callback_status *= 4; } - static void EpilogueCallbackTimes5() { global_epilogue_callback_status *= 5; } - TEST_CASE(SetGarbageCollectionCallbacks) { // GC callback addition testing. @@ -3250,7 +3138,6 @@ TEST_CASE(SetGarbageCollectionCallbacks) { EXPECT(Dart_IsError(Dart_SetGcCallbacks(NULL, &EpilogueCallbackTimes4))); } - TEST_CASE(SingleGarbageCollectionCallback) { // Add a prologue callback. EXPECT_VALID( @@ -3359,7 +3246,6 @@ TEST_CASE(SingleGarbageCollectionCallback) { } } - // Unit test for creating multiple scopes and local handles within them. // Ensure that the local handles get all cleaned out when exiting the // scope. @@ -3423,7 +3309,6 @@ VM_UNIT_TEST_CASE(LocalHandles) { Dart_ShutdownIsolate(); } - // Unit test for creating multiple scopes and allocating objects in the // zone for the scope. Ensure that the memory is freed when the scope // exits. @@ -3468,7 +3353,6 @@ VM_UNIT_TEST_CASE(LocalZoneMemory) { Dart_ShutdownIsolate(); } - VM_UNIT_TEST_CASE(Isolates) { // This test currently assumes that the Dart_Isolate type is an opaque // representation of Isolate*. @@ -3492,7 +3376,6 @@ VM_UNIT_TEST_CASE(Isolates) { EXPECT(NULL == Dart_CurrentIsolate()); } - VM_UNIT_TEST_CASE(CurrentIsolateData) { intptr_t mydata = 12345; char* err; @@ -3506,7 +3389,6 @@ VM_UNIT_TEST_CASE(CurrentIsolateData) { Dart_ShutdownIsolate(); } - VM_UNIT_TEST_CASE(IsolateSetCheckedMode) { const char* kScriptChars = "int bad1() {\n" @@ -3563,17 +3445,14 @@ VM_UNIT_TEST_CASE(IsolateSetCheckedMode) { Dart_ShutdownIsolate(); } - TEST_CASE(DebugName) { Dart_Handle debug_name = Dart_DebugName(); EXPECT_VALID(debug_name); EXPECT(Dart_IsString(debug_name)); } - static void MyMessageNotifyCallback(Dart_Isolate dest_isolate) {} - VM_UNIT_TEST_CASE(SetMessageCallbacks) { Dart_Isolate dart_isolate = TestCase::CreateTestIsolate(); Dart_SetMessageNotifyCallback(&MyMessageNotifyCallback); @@ -3582,7 +3461,6 @@ VM_UNIT_TEST_CASE(SetMessageCallbacks) { Dart_ShutdownIsolate(); } - TEST_CASE(SetStickyError) { const char* kScriptChars = "main() => throw 'HI';"; Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); @@ -3599,7 +3477,6 @@ TEST_CASE(SetStickyError) { EXPECT(Dart_GetStickyError() == Dart_Null()); } - TEST_CASE(TypeGetNonParamtericTypes) { const char* kScriptChars = "class MyClass0 {\n" @@ -3691,7 +3568,6 @@ TEST_CASE(TypeGetNonParamtericTypes) { EXPECT(Dart_IdentityEquals(type2, type2_obj)); } - TEST_CASE(TypeGetParameterizedTypes) { const char* kScriptChars = "class MyClass0 {\n" @@ -3795,7 +3671,6 @@ TEST_CASE(TypeGetParameterizedTypes) { EXPECT(!Dart_IdentityEquals(type1_obj, myclass1_type)); } - static void TestFieldOk(Dart_Handle container, Dart_Handle name, bool final, @@ -3833,13 +3708,11 @@ static void TestFieldOk(Dart_Handle container, } } - static void TestFieldNotFound(Dart_Handle container, Dart_Handle name) { EXPECT(Dart_IsError(Dart_GetField(container, name))); EXPECT(Dart_IsError(Dart_SetField(container, name, Dart_Null()))); } - TEST_CASE(FieldAccess) { const char* kScriptChars = "class BaseFields {\n" @@ -4091,7 +3964,6 @@ TEST_CASE(FieldAccess) { TestFieldNotFound(lib, name); } - TEST_CASE(SetField_FunnyValue) { const char* kScriptChars = "var top;\n"; @@ -4125,12 +3997,10 @@ TEST_CASE(SetField_FunnyValue) { EXPECT_STREQ("myerror", Dart_GetError(result)); } - void NativeFieldLookup(Dart_NativeArguments args) { UNREACHABLE(); } - static Dart_NativeFunction native_field_lookup(Dart_Handle name, int argument_count, bool* auto_setup_scope) { @@ -4139,7 +4009,6 @@ static Dart_NativeFunction native_field_lookup(Dart_Handle name, return reinterpret_cast(&NativeFieldLookup); } - TEST_CASE(InjectNativeFields1) { const char* kScriptChars = "class NativeFields extends NativeFieldsWrapper {\n" @@ -4191,7 +4060,6 @@ TEST_CASE(InjectNativeFields1) { EXPECT_EQ(kNumNativeFields, cls.num_native_fields()); } - TEST_CASE(InjectNativeFields2) { const char* kScriptChars = "class NativeFields extends NativeFieldsWrapper {\n" @@ -4219,7 +4087,6 @@ TEST_CASE(InjectNativeFields2) { EXPECT(Dart_IsError(result)); } - TEST_CASE(InjectNativeFields3) { const char* kScriptChars = "import 'dart:nativewrappers';" @@ -4261,7 +4128,6 @@ TEST_CASE(InjectNativeFields3) { EXPECT_EQ(kNumNativeFields, cls.num_native_fields()); } - TEST_CASE(InjectNativeFields4) { const char* kScriptChars = "import 'dart:nativewrappers';" @@ -4297,7 +4163,6 @@ TEST_CASE(InjectNativeFields4) { #endif } - static const int kTestNumNativeFields = 2; static const intptr_t kNativeField1Value = 30; static const intptr_t kNativeField2Value = 40; @@ -4308,7 +4173,6 @@ void TestNativeFieldsAccess_init(Dart_NativeArguments args) { Dart_SetNativeInstanceField(receiver, 1, kNativeField2Value); } - void TestNativeFieldsAccess_access(Dart_NativeArguments args) { intptr_t field_values[kTestNumNativeFields]; Dart_Handle result = Dart_GetNativeFieldsOfArgument( @@ -4323,7 +4187,6 @@ void TestNativeFieldsAccess_access(Dart_NativeArguments args) { EXPECT_EQ(0, field_values[1]); } - static Dart_NativeFunction TestNativeFieldsAccess_lookup(Dart_Handle name, int argument_count, bool* auto_scope) { @@ -4345,7 +4208,6 @@ static Dart_NativeFunction TestNativeFieldsAccess_lookup(Dart_Handle name, } } - TEST_CASE(TestNativeFieldsAccess) { const char* kScriptChars = "import 'dart:nativewrappers';" @@ -4374,7 +4236,6 @@ TEST_CASE(TestNativeFieldsAccess) { EXPECT_VALID(result); } - TEST_CASE(InjectNativeFieldsSuperClass) { const char* kScriptChars = "import 'dart:nativewrappers';" @@ -4404,7 +4265,6 @@ TEST_CASE(InjectNativeFieldsSuperClass) { EXPECT_EQ(42, value); } - static void TestNativeFields(Dart_Handle retobj) { // Access and set various instance fields of the object. Dart_Handle result = Dart_GetField(retobj, NewString("fld3")); @@ -4480,7 +4340,6 @@ static void TestNativeFields(Dart_Handle retobj) { EXPECT_EQ(20, value); } - TEST_CASE(NativeFieldAccess) { const char* kScriptChars = "class NativeFields extends NativeFieldsWrapper {\n" @@ -4530,7 +4389,6 @@ TEST_CASE(NativeFieldAccess) { EXPECT_STREQ("myerror", Dart_GetError(result)); } - TEST_CASE(ImplicitNativeFieldAccess) { const char* kScriptChars = "import 'dart:nativewrappers';" @@ -4557,7 +4415,6 @@ TEST_CASE(ImplicitNativeFieldAccess) { TestNativeFields(retobj); } - TEST_CASE(NegativeNativeFieldAccess) { const char* kScriptChars = "class NativeFields {\n" @@ -4629,7 +4486,6 @@ TEST_CASE(NegativeNativeFieldAccess) { EXPECT(Dart_IsError(result)); } - TEST_CASE(NegativeNativeFieldInIsolateMessage) { const char* kScriptChars = "import 'dart:isolate';\n" @@ -4667,7 +4523,6 @@ TEST_CASE(NegativeNativeFieldInIsolateMessage) { EXPECT(Dart_IsError(retobj)); } - TEST_CASE(GetStaticField_RunsInitializer) { const char* kScriptChars = "class TestClass {\n" @@ -4709,7 +4564,6 @@ TEST_CASE(GetStaticField_RunsInitializer) { EXPECT_EQ(13, value); } - TEST_CASE(GetField_CheckIsolate) { const char* kScriptChars = "class TestClass {\n" @@ -4731,7 +4585,6 @@ TEST_CASE(GetField_CheckIsolate) { EXPECT_EQ(11, value); } - TEST_CASE(SetField_CheckIsolate) { const char* kScriptChars = "class TestClass {\n" @@ -4756,7 +4609,6 @@ TEST_CASE(SetField_CheckIsolate) { EXPECT_EQ(13, value); } - TEST_CASE(New) { const char* kScriptChars = "class MyClass {\n" @@ -4988,7 +4840,6 @@ TEST_CASE(New) { EXPECT(!instanceOf); } - TEST_CASE(New_Issue2971) { // Issue 2971: We were unable to use Dart_New to construct an // instance of List, due to problems implementing interface @@ -5006,7 +4857,6 @@ TEST_CASE(New_Issue2971) { EXPECT(Dart_IsList(list_obj)); } - static Dart_Handle PrivateLibName(Dart_Handle lib, const char* str) { EXPECT(Dart_IsLibrary(lib)); Thread* thread = Thread::Current(); @@ -5015,7 +4865,6 @@ static Dart_Handle PrivateLibName(Dart_Handle lib, const char* str) { return Api::NewHandle(thread, library_obj.PrivateName(name)); } - TEST_CASE(Invoke) { const char* kScriptChars = "class BaseMethods {\n" @@ -5135,7 +4984,6 @@ TEST_CASE(Invoke) { EXPECT_STREQ("hidden top !!!", str); } - TEST_CASE(Invoke_PrivateStatic) { const char* kScriptChars = "class Methods {\n" @@ -5161,7 +5009,6 @@ TEST_CASE(Invoke_PrivateStatic) { EXPECT_STREQ("hidden static !!!", str); } - TEST_CASE(Invoke_FunnyArgs) { const char* kScriptChars = "test(arg) => 'hello $arg';\n"; @@ -5208,7 +5055,6 @@ TEST_CASE(Invoke_FunnyArgs) { EXPECT_STREQ("myerror", Dart_GetError(result)); } - TEST_CASE(Invoke_Null) { Dart_Handle result = Dart_Invoke(Dart_Null(), NewString("toString"), 0, NULL); EXPECT_VALID(result); @@ -5224,7 +5070,6 @@ TEST_CASE(Invoke_Null) { EXPECT(Dart_ErrorHasException(result)); } - TEST_CASE(InvokeNoSuchMethod) { const char* kScriptChars = "import 'dart:_internal' as _internal;\n" @@ -5289,7 +5134,6 @@ TEST_CASE(InvokeNoSuchMethod) { EXPECT_EQ(3, value); } - TEST_CASE(Invoke_CrossLibrary) { const char* kLibrary1Chars = "library library1_name;\n" @@ -5328,7 +5172,6 @@ TEST_CASE(Invoke_CrossLibrary) { "did not find top-level function '_imported'"); } - TEST_CASE(InvokeClosure) { const char* kScriptChars = "class InvokeClosure {\n" @@ -5395,14 +5238,12 @@ TEST_CASE(InvokeClosure) { EXPECT(Dart_ErrorHasException(result)); } - void ExceptionNative(Dart_NativeArguments args) { Dart_EnterScope(); Dart_ThrowException(NewString("Hello from ExceptionNative!")); UNREACHABLE(); } - static Dart_NativeFunction native_lookup(Dart_Handle name, int argument_count, bool* auto_setup_scope) { @@ -5411,7 +5252,6 @@ static Dart_NativeFunction native_lookup(Dart_Handle name, return reinterpret_cast(&ExceptionNative); } - TEST_CASE(ThrowException) { const char* kScriptChars = "int test() native \"ThrowException_native\";"; Dart_Handle result; @@ -5436,7 +5276,6 @@ TEST_CASE(ThrowException) { EXPECT_EQ(size, thread->ZoneSizeInBytes()); } - static intptr_t kNativeArgumentNativeField1Value = 30; static intptr_t kNativeArgumentNativeField2Value = 40; static intptr_t native_arg_str_peer = 100; @@ -5459,7 +5298,6 @@ static void NativeArgumentCreate(Dart_NativeArguments args) { Dart_SetReturnValue(args, obj); } - static void NativeArgumentAccess(Dart_NativeArguments args) { const int kNumNativeFields = 2; @@ -5559,7 +5397,6 @@ static void NativeArgumentAccess(Dart_NativeArguments args) { Dart_SetIntegerReturnValue(args, 0); } - static Dart_NativeFunction native_args_lookup(Dart_Handle name, int argument_count, bool* auto_scope_setup) { @@ -5579,7 +5416,6 @@ static Dart_NativeFunction native_args_lookup(Dart_Handle name, return NULL; } - TEST_CASE(GetNativeArguments) { const bool saved_flag = FLAG_support_externalizable_strings; FLAG_support_externalizable_strings = true; @@ -5631,7 +5467,6 @@ TEST_CASE(GetNativeArguments) { FLAG_support_externalizable_strings = saved_flag; } - static void NativeArgumentCounter(Dart_NativeArguments args) { Dart_EnterScope(); int count = Dart_GetNativeArgumentCount(args); @@ -5639,7 +5474,6 @@ static void NativeArgumentCounter(Dart_NativeArguments args) { Dart_ExitScope(); } - static Dart_NativeFunction gnac_lookup(Dart_Handle name, int argument_count, bool* auto_setup_scope) { @@ -5648,7 +5482,6 @@ static Dart_NativeFunction gnac_lookup(Dart_Handle name, return reinterpret_cast(&NativeArgumentCounter); } - TEST_CASE(GetNativeArgumentCount) { const char* kScriptChars = "class MyObject {" @@ -5672,7 +5505,6 @@ TEST_CASE(GetNativeArgumentCount) { EXPECT_EQ(3, value); } - TEST_CASE(GetType) { const char* kScriptChars = "library testlib;\n" @@ -5721,7 +5553,6 @@ TEST_CASE(GetType) { EXPECT_STREQ("myerror", Dart_GetError(type)); } - TEST_CASE(InstanceOf) { const char* kScriptChars = "class OtherClass {\n" @@ -5787,7 +5618,6 @@ TEST_CASE(InstanceOf) { EXPECT(Dart_IsError(result)); } - static Dart_Handle library_handler(Dart_LibraryTag tag, Dart_Handle library, Dart_Handle url) { @@ -5797,7 +5627,6 @@ static Dart_Handle library_handler(Dart_LibraryTag tag, return Api::Success(); } - TEST_CASE(LoadScript) { const char* kScriptChars = "main() {" @@ -5871,7 +5700,6 @@ TEST_CASE(LoadScript) { Dart_GetError(result)); } - TEST_CASE(RootLibrary) { const char* kScriptChars = "library testlib;" @@ -5903,7 +5731,6 @@ TEST_CASE(RootLibrary) { EXPECT_VALID(Dart_StringToCString(lib_uri, &uri_cstr)); EXPECT_STREQ(TestCase::url(), uri_cstr); - Dart_Handle core_uri = Dart_NewStringFromCString("dart:core"); Dart_Handle core_lib = Dart_LookupLibrary(core_uri); EXPECT_VALID(core_lib); @@ -5929,10 +5756,8 @@ TEST_CASE(RootLibrary) { EXPECT(Dart_IsNull(root_lib)); // Root library did change. } - static int index = 0; - static Dart_Handle import_library_handler(Dart_LibraryTag tag, Dart_Handle library, Dart_Handle url) { @@ -5966,7 +5791,6 @@ static Dart_Handle import_library_handler(Dart_LibraryTag tag, return Api::Success(); } - TEST_CASE(LoadScript_CompileError) { const char* kScriptChars = ")"; Dart_Handle url = NewString(TestCase::url()); @@ -5978,7 +5802,6 @@ TEST_CASE(LoadScript_CompileError) { EXPECT(strstr(Dart_GetError(result), "unexpected token ')'")); } - TEST_CASE(LookupLibrary) { const char* kScriptChars = "import 'library1_dart';" @@ -6025,7 +5848,6 @@ TEST_CASE(LookupLibrary) { Dart_GetError(result)); } - TEST_CASE(LibraryName) { const char* kLibrary1Chars = "library library1_name;"; Dart_Handle url = NewString("library1_url"); @@ -6057,10 +5879,8 @@ TEST_CASE(LibraryName) { EXPECT_STREQ("library1_name", cstr); } - #ifndef PRODUCT - TEST_CASE(LibraryId) { const char* kLibrary1Chars = "library library1_name;"; Dart_Handle url = NewString("library1_url"); @@ -6096,10 +5916,8 @@ TEST_CASE(LibraryId) { EXPECT_STREQ("library1_name", cstr); } - #endif // !PRODUCT - TEST_CASE(LibraryUrl) { const char* kLibrary1Chars = "library library1_name;"; Dart_Handle url = NewString("library1_url"); @@ -6131,7 +5949,6 @@ TEST_CASE(LibraryUrl) { EXPECT_STREQ("library1_url", cstr); } - TEST_CASE(LibraryGetClassNames) { const char* kLibraryChars = "library library_name;\n" @@ -6170,7 +5987,6 @@ TEST_CASE(LibraryGetClassNames) { EXPECT_STREQ("[A, B, C, _A, _B, _C]", list_cstr); } - TEST_CASE(GetFunctionNames) { const char* kLibraryChars = "library library_name;\n" @@ -6242,7 +6058,6 @@ TEST_CASE(GetFunctionNames) { EXPECT_STREQ("[A2, B2, C2=, MyClass, _A2, _B2, _C2=]", list_cstr); } - TEST_CASE(LibraryImportLibrary) { const char* kLibrary1Chars = "library library1_name;"; const char* kLibrary2Chars = "library library2_name;"; @@ -6297,7 +6112,6 @@ TEST_CASE(LibraryImportLibrary) { EXPECT_VALID(result); } - TEST_CASE(ImportLibraryWithPrefix) { const char* kLibrary1Chars = "library library1_name;" @@ -6339,7 +6153,6 @@ TEST_CASE(ImportLibraryWithPrefix) { EXPECT_EQ(42, value); } - TEST_CASE(LoadLibrary) { const char* kLibrary1Chars = "library library1_name;"; Dart_Handle error = Dart_NewApiError("incoming error"); @@ -6400,7 +6213,6 @@ TEST_CASE(LoadLibrary) { Dart_GetError(result)); } - TEST_CASE(LoadLibrary_CompileError) { const char* kLibrary1Chars = "library library1_name;" @@ -6412,7 +6224,6 @@ TEST_CASE(LoadLibrary_CompileError) { EXPECT(strstr(Dart_GetError(result), "unexpected token ')'")); } - TEST_CASE(LoadSource) { const char* kLibrary1Chars = "library library1_name;"; const char* kSourceChars = "part of library1_name;\n// Something innocuous"; @@ -6502,7 +6313,6 @@ TEST_CASE(LoadSource) { EXPECT(Dart_IsError(result)); } - TEST_CASE(LoadSource_LateLoad) { const char* kLibrary1Chars = "library library1_name;\n" @@ -6552,7 +6362,6 @@ TEST_CASE(LoadSource_LateLoad) { EXPECT_STREQ("bar", result_cstr); } - TEST_CASE(LoadPatch) { const char* kLibrary1Chars = "library library1_name;"; const char* kSourceChars = @@ -6703,14 +6512,12 @@ TEST_CASE(LoadPatchSignatureMismatch) { FLAG_ignore_patch_signature_mismatch = old_flag_value; } - static void PatchNativeFunction(Dart_NativeArguments args) { Dart_EnterScope(); Dart_SetReturnValue(args, Dart_Null()); Dart_ExitScope(); } - static Dart_NativeFunction PatchNativeResolver(Dart_Handle name, int arg_count, bool* auto_setup_scope) { @@ -6719,7 +6526,6 @@ static Dart_NativeFunction PatchNativeResolver(Dart_Handle name, return &PatchNativeFunction; } - TEST_CASE(ParsePatchLibrary) { const char* kLibraryChars = "library patched_library;\n" @@ -6890,21 +6696,18 @@ TEST_CASE(ParsePatchLibrary) { EXPECT_EQ(4, lib_scripts.Length()); } - static void MyNativeFunction1(Dart_NativeArguments args) { Dart_EnterScope(); Dart_SetReturnValue(args, Dart_NewInteger(654321)); Dart_ExitScope(); } - static void MyNativeFunction2(Dart_NativeArguments args) { Dart_EnterScope(); Dart_SetReturnValue(args, Dart_NewInteger(123456)); Dart_ExitScope(); } - static Dart_NativeFunction MyNativeResolver1(Dart_Handle name, int arg_count, bool* auto_setup_scope) { @@ -6913,7 +6716,6 @@ static Dart_NativeFunction MyNativeResolver1(Dart_Handle name, return &MyNativeFunction1; } - static Dart_NativeFunction MyNativeResolver2(Dart_Handle name, int arg_count, bool* auto_setup_scope) { @@ -6922,7 +6724,6 @@ static Dart_NativeFunction MyNativeResolver2(Dart_Handle name, return &MyNativeFunction2; } - TEST_CASE(SetNativeResolver) { const char* kScriptChars = "class Test {" @@ -7003,7 +6804,6 @@ TEST_CASE(SetNativeResolver) { "cannot be found"); } - // Test that an imported name does not clash with the same name defined // in the importing library. TEST_CASE(ImportLibrary2) { @@ -7041,7 +6841,6 @@ TEST_CASE(ImportLibrary2) { EXPECT_VALID(result); } - // Test that if the same name is imported from two libraries, it is // an error if that name is referenced. TEST_CASE(ImportLibrary3) { @@ -7081,7 +6880,6 @@ TEST_CASE(ImportLibrary3) { EXPECT_SUBSTRING("NoSuchMethodError", Dart_GetError(result)); } - // Test that if the same name is imported from two libraries, it is // not an error if that name is not used. TEST_CASE(ImportLibrary4) { @@ -7118,7 +6916,6 @@ TEST_CASE(ImportLibrary4) { EXPECT_VALID(result); } - TEST_CASE(ImportLibrary5) { const char* kScriptChars = "import 'lib.dart';\n" @@ -7149,7 +6946,6 @@ TEST_CASE(ImportLibrary5) { EXPECT_VALID(result); } - void NewNativePort_send123(Dart_Port dest_port_id, Dart_CObject* message) { // Gets a send port message. EXPECT_NOTNULL(message); @@ -7165,7 +6961,6 @@ void NewNativePort_send123(Dart_Port dest_port_id, Dart_CObject* message) { response); } - void NewNativePort_send321(Dart_Port dest_port_id, Dart_CObject* message) { // Gets a null message. EXPECT_NOTNULL(message); @@ -7181,21 +6976,18 @@ void NewNativePort_send321(Dart_Port dest_port_id, Dart_CObject* message) { response); } - TEST_CASE(IllegalNewSendPort) { Dart_Handle error = Dart_NewSendPort(ILLEGAL_PORT); EXPECT(Dart_IsError(error)); EXPECT(Dart_IsApiError(error)); } - TEST_CASE(IllegalPost) { Dart_Handle message = Dart_True(); bool success = Dart_Post(ILLEGAL_PORT, message); EXPECT(!success); } - VM_UNIT_TEST_CASE(NewNativePort) { // Create a port with a bogus handler. Dart_Port error_port = Dart_NewNativePort("Foo", NULL, true); @@ -7255,7 +7047,6 @@ VM_UNIT_TEST_CASE(NewNativePort) { EXPECT(Dart_CloseNativePort(port_id2)); } - void NewNativePort_sendInteger123(Dart_Port dest_port_id, Dart_CObject* message) { // Gets a send port message. @@ -7268,7 +7059,6 @@ void NewNativePort_sendInteger123(Dart_Port dest_port_id, 123); } - void NewNativePort_sendInteger321(Dart_Port dest_port_id, Dart_CObject* message) { // Gets a null message. @@ -7281,7 +7071,6 @@ void NewNativePort_sendInteger321(Dart_Port dest_port_id, 321); } - TEST_CASE(NativePortPostInteger) { const char* kScriptChars = "import 'dart:isolate';\n" @@ -7333,7 +7122,6 @@ TEST_CASE(NativePortPostInteger) { EXPECT(Dart_CloseNativePort(port_id2)); } - void NewNativePort_nativeReceiveNull(Dart_Port dest_port_id, Dart_CObject* message) { EXPECT_NOTNULL(message); @@ -7348,7 +7136,6 @@ void NewNativePort_nativeReceiveNull(Dart_Port dest_port_id, } } - TEST_CASE(NativePortReceiveNull) { const char* kScriptChars = "import 'dart:isolate';\n" @@ -7386,7 +7173,6 @@ TEST_CASE(NativePortReceiveNull) { EXPECT(Dart_CloseNativePort(port_id1)); } - void NewNativePort_nativeReceiveInteger(Dart_Port dest_port_id, Dart_CObject* message) { EXPECT_NOTNULL(message); @@ -7402,7 +7188,6 @@ void NewNativePort_nativeReceiveInteger(Dart_Port dest_port_id, } } - TEST_CASE(NativePortReceiveInteger) { const char* kScriptChars = "import 'dart:isolate';\n" @@ -7440,7 +7225,6 @@ TEST_CASE(NativePortReceiveInteger) { EXPECT(Dart_CloseNativePort(port_id1)); } - static Dart_Isolate RunLoopTestCallback(const char* script_name, const char* main, const char* package_root, @@ -7486,7 +7270,6 @@ static Dart_Isolate RunLoopTestCallback(const char* script_name, return isolate; } - // Common code for RunLoop_Success/RunLoop_Failure. static void RunLoopTest(bool throw_exception) { Dart_IsolateCreateCallback saved = Isolate::CreateCallback(); @@ -7517,23 +7300,19 @@ static void RunLoopTest(bool throw_exception) { Isolate::SetCreateCallback(saved); } - VM_UNIT_TEST_CASE(RunLoop_Success) { RunLoopTest(false); } - VM_UNIT_TEST_CASE(RunLoop_Exception) { RunLoopTest(true); } - // Utility functions and variables for test case IsolateInterrupt starts here. static Monitor* sync = NULL; static Dart_Isolate shared_isolate = NULL; static bool main_entered = false; - void MarkMainEntered(Dart_NativeArguments args) { Dart_EnterScope(); // Start a Dart API scope for invoking API functions. // Indicate that main has been entered. @@ -7546,7 +7325,6 @@ void MarkMainEntered(Dart_NativeArguments args) { Dart_ExitScope(); } - static Dart_NativeFunction IsolateInterruptTestNativeLookup( Dart_Handle name, int argument_count, @@ -7556,7 +7334,6 @@ static Dart_NativeFunction IsolateInterruptTestNativeLookup( return reinterpret_cast(&MarkMainEntered); } - void BusyLoop_start(uword unused) { const char* kScriptChars = "class Native {\n" @@ -7610,7 +7387,6 @@ void BusyLoop_start(uword unused) { } } - static void* saved_callback_data; static void IsolateShutdownTestCallback(void* callback_data) { saved_callback_data = callback_data; @@ -7702,7 +7478,6 @@ VM_UNIT_TEST_CASE(IsolateShutdownRunDartCode) { Dart_ExitScope(); } - // The shutdown callback has not been called. EXPECT_EQ(0, add_result); @@ -7733,7 +7508,6 @@ static void NativeFoo1(Dart_NativeArguments args) { Dart_ExitScope(); } - static void NativeFoo2(Dart_NativeArguments args) { Dart_EnterScope(); intptr_t i = Dart_GetNativeArgumentCount(args); @@ -7756,7 +7530,6 @@ static void NativeFoo2(Dart_NativeArguments args) { Dart_ExitScope(); } - static void NativeFoo3(Dart_NativeArguments args) { Dart_EnterScope(); intptr_t i = Dart_GetNativeArgumentCount(args); @@ -7767,7 +7540,6 @@ static void NativeFoo3(Dart_NativeArguments args) { Dart_ExitScope(); } - static void NativeFoo4(Dart_NativeArguments args) { Dart_EnterScope(); intptr_t i = Dart_GetNativeArgumentCount(args); @@ -7780,7 +7552,6 @@ static void NativeFoo4(Dart_NativeArguments args) { Dart_ExitScope(); } - static Dart_NativeFunction MyNativeClosureResolver(Dart_Handle name, int arg_count, bool* auto_setup_scope) { @@ -7809,7 +7580,6 @@ static Dart_NativeFunction MyNativeClosureResolver(Dart_Handle name, } } - TEST_CASE(NativeFunctionClosure) { const char* kScriptChars = "class Test {" @@ -7885,7 +7655,6 @@ TEST_CASE(NativeFunctionClosure) { EXPECT_EQ(0, value); } - static void StaticNativeFoo1(Dart_NativeArguments args) { Dart_EnterScope(); intptr_t i = Dart_GetNativeArgumentCount(args); @@ -7894,7 +7663,6 @@ static void StaticNativeFoo1(Dart_NativeArguments args) { Dart_ExitScope(); } - static void StaticNativeFoo2(Dart_NativeArguments args) { Dart_EnterScope(); intptr_t i = Dart_GetNativeArgumentCount(args); @@ -7904,7 +7672,6 @@ static void StaticNativeFoo2(Dart_NativeArguments args) { Dart_ExitScope(); } - static void StaticNativeFoo3(Dart_NativeArguments args) { Dart_EnterScope(); intptr_t i = Dart_GetNativeArgumentCount(args); @@ -7915,7 +7682,6 @@ static void StaticNativeFoo3(Dart_NativeArguments args) { Dart_ExitScope(); } - static void StaticNativeFoo4(Dart_NativeArguments args) { Dart_EnterScope(); intptr_t i = Dart_GetNativeArgumentCount(args); @@ -7928,7 +7694,6 @@ static void StaticNativeFoo4(Dart_NativeArguments args) { Dart_ExitScope(); } - static Dart_NativeFunction MyStaticNativeClosureResolver( Dart_Handle name, int arg_count, @@ -7958,7 +7723,6 @@ static Dart_NativeFunction MyStaticNativeClosureResolver( } } - TEST_CASE(NativeStaticFunctionClosure) { const char* kScriptChars = "class Test {" @@ -8035,7 +7799,6 @@ TEST_CASE(NativeStaticFunctionClosure) { EXPECT_EQ(0, value); } - TEST_CASE(RangeLimits) { uint8_t chars8[1] = {'a'}; uint16_t chars16[1] = {'a'}; @@ -8061,7 +7824,6 @@ TEST_CASE(RangeLimits) { "expects argument 'length' to be in the range"); } - TEST_CASE(NewString_Null) { Dart_Handle str = Dart_NewStringFromUTF8(NULL, 0); EXPECT_VALID(str); @@ -8085,7 +7847,6 @@ TEST_CASE(NewString_Null) { EXPECT_EQ(0, len); } - // Try to allocate a peer with a handles to objects of prohibited // subtypes. TEST_CASE(InvalidGetSetPeer) { @@ -8117,7 +7878,6 @@ TEST_CASE(InvalidGetSetPeer) { EXPECT(Dart_IsError(Dart_SetPeer(dbl, &out))); } - // Allocates an object in new space and assigns it a peer. Removes // the peer and checks that the count of peer objects is decremented // by one. @@ -8143,7 +7903,6 @@ TEST_CASE(OneNewSpacePeer) { EXPECT_EQ(0, isolate->heap()->PeerCount()); } - // Allocates an object in new space and assigns it a peer. Allows the // peer referent to be garbage collected and checks that the count of // peer objects is decremented by one. @@ -8183,7 +7942,6 @@ TEST_CASE(CollectOneNewSpacePeer) { } } - // Allocates two objects in new space and assigns them peers. Removes // the peers and checks that the count of peer objects is decremented // by two. @@ -8223,7 +7981,6 @@ TEST_CASE(TwoNewSpacePeers) { EXPECT(o2 == NULL); } - // Allocates two objects in new space and assigns them a peer. Allow // the peer referents to be garbage collected and check that the count // of peer objects is decremented by two. @@ -8266,7 +8023,6 @@ TEST_CASE(CollectTwoNewSpacePeers) { } } - // Allocates several objects in new space. Performs successive // garbage collections and checks that the peer count is stable. TEST_CASE(CopyNewSpacePeers) { @@ -8300,7 +8056,6 @@ TEST_CASE(CopyNewSpacePeers) { } } - // Allocates an object in new space and assigns it a peer. Promotes // the peer to old space. Removes the peer and check that the count // of peer objects is decremented by one. @@ -8341,7 +8096,6 @@ TEST_CASE(OnePromotedPeer) { EXPECT_EQ(0, isolate->heap()->PeerCount()); } - // Allocates an object in old space and assigns it a peer. Removes // the peer and checks that the count of peer objects is decremented // by one. @@ -8374,7 +8128,6 @@ TEST_CASE(OneOldSpacePeer) { EXPECT_EQ(0, isolate->heap()->PeerCount()); } - // Allocates an object in old space and assigns it a peer. Allow the // peer referent to be garbage collected and check that the count of // peer objects is decremented by one. @@ -8414,7 +8167,6 @@ TEST_CASE(CollectOneOldSpacePeer) { } } - // Allocates two objects in old space and assigns them peers. Removes // the peers and checks that the count of peer objects is decremented // by two. @@ -8458,7 +8210,6 @@ TEST_CASE(TwoOldSpacePeers) { EXPECT(o2 == NULL); } - // Allocates two objects in old space and assigns them a peer. Allows // the peer referents to be garbage collected and checks that the // count of peer objects is decremented by two. @@ -8504,13 +8255,11 @@ TEST_CASE(CollectTwoOldSpacePeers) { } } - // Test API call to make strings external. static void MakeExternalCback(void* peer) { *static_cast(peer) *= 2; } - TEST_CASE(MakeExternalString) { const bool saved_flag = FLAG_support_externalizable_strings; FLAG_support_externalizable_strings = true; @@ -8696,7 +8445,6 @@ TEST_CASE(MakeExternalString) { FLAG_support_externalizable_strings = saved_flag; } - TEST_CASE(ExternalizeConstantStrings) { const bool saved_flag = FLAG_support_externalizable_strings; FLAG_support_externalizable_strings = true; @@ -8722,7 +8470,6 @@ TEST_CASE(ExternalizeConstantStrings) { FLAG_support_externalizable_strings = saved_flag; } - TEST_CASE(LazyLoadDeoptimizes) { const char* kLoadFirst = "library L;\n" @@ -8765,13 +8512,11 @@ TEST_CASE(LazyLoadDeoptimizes) { EXPECT_VALID(result); } - // Test external strings and optimized code. static void ExternalStringDeoptimize_Finalize(void* peer) { delete[] reinterpret_cast(peer); } - static void A_change_str_native(Dart_NativeArguments args) { Dart_EnterScope(); Dart_Handle str = Dart_GetNativeArgument(args, 0); @@ -8793,7 +8538,6 @@ static void A_change_str_native(Dart_NativeArguments args) { Dart_ExitScope(); } - static Dart_NativeFunction ExternalStringDeoptimize_native_lookup( Dart_Handle name, int argument_count, @@ -8803,7 +8547,6 @@ static Dart_NativeFunction ExternalStringDeoptimize_native_lookup( return reinterpret_cast(&A_change_str_native); } - // Do not use guarding mechanism on externalizable classes, since their class // can change on the fly, TEST_CASE(GuardExternalizedString) { @@ -8845,7 +8588,6 @@ TEST_CASE(GuardExternalizedString) { FLAG_support_externalizable_strings = saved_flag; } - TEST_CASE(ExternalStringDeoptimize) { const bool saved_flag = FLAG_support_externalizable_strings; FLAG_support_externalizable_strings = true; @@ -8881,7 +8623,6 @@ TEST_CASE(ExternalStringDeoptimize) { FLAG_support_externalizable_strings = saved_flag; } - TEST_CASE(ExternalStringPolymorphicDeoptimize) { const bool saved_flag = FLAG_support_externalizable_strings; FLAG_support_externalizable_strings = true; @@ -8918,7 +8659,6 @@ TEST_CASE(ExternalStringPolymorphicDeoptimize) { FLAG_support_externalizable_strings = saved_flag; } - TEST_CASE(ExternalStringLoadElimination) { const bool saved_flag = FLAG_support_externalizable_strings; FLAG_support_externalizable_strings = true; @@ -8949,7 +8689,6 @@ TEST_CASE(ExternalStringLoadElimination) { FLAG_support_externalizable_strings = saved_flag; } - TEST_CASE(ExternalStringGuardFieldDeoptimize) { const bool saved_flag = FLAG_support_externalizable_strings; FLAG_support_externalizable_strings = true; @@ -8991,7 +8730,6 @@ TEST_CASE(ExternalStringGuardFieldDeoptimize) { FLAG_support_externalizable_strings = saved_flag; } - TEST_CASE(ExternalStringStaticFieldDeoptimize) { const bool saved_flag = FLAG_support_externalizable_strings; FLAG_support_externalizable_strings = true; @@ -9028,7 +8766,6 @@ TEST_CASE(ExternalStringStaticFieldDeoptimize) { FLAG_support_externalizable_strings = saved_flag; } - TEST_CASE(ExternalStringTrimDoubleParse) { const bool saved_flag = FLAG_support_externalizable_strings; FLAG_support_externalizable_strings = true; @@ -9058,7 +8795,6 @@ TEST_CASE(ExternalStringTrimDoubleParse) { FLAG_support_externalizable_strings = saved_flag; } - TEST_CASE(ExternalStringDoubleParse) { const bool saved_flag = FLAG_support_externalizable_strings; FLAG_support_externalizable_strings = true; @@ -9088,7 +8824,6 @@ TEST_CASE(ExternalStringDoubleParse) { FLAG_support_externalizable_strings = saved_flag; } - TEST_CASE(ExternalStringIndexOf) { const char* kScriptChars = "main(String pattern) {\n" @@ -9113,7 +8848,6 @@ TEST_CASE(ExternalStringIndexOf) { EXPECT_EQ(6, value); } - TEST_CASE(StringFromExternalTypedData) { const char* kScriptChars = "test(external) {\n" @@ -9191,10 +8925,8 @@ TEST_CASE(StringFromExternalTypedData) { } } - #ifndef PRODUCT - TEST_CASE(Timeline_Dart_TimelineDuration) { Isolate* isolate = Isolate::Current(); // Grab embedder stream. @@ -9213,7 +8945,6 @@ TEST_CASE(Timeline_Dart_TimelineDuration) { EXPECT_SUBSTRING("testDurationEvent", js.ToCString()); } - TEST_CASE(Timeline_Dart_TimelineInstant) { Isolate* isolate = Isolate::Current(); // Grab embedder stream. @@ -9231,7 +8962,6 @@ TEST_CASE(Timeline_Dart_TimelineInstant) { EXPECT_SUBSTRING("testInstantEvent", js.ToCString()); } - TEST_CASE(Timeline_Dart_TimelineAsyncDisabled) { // Grab embedder stream. TimelineStream* stream = Timeline::GetEmbedderStream(); @@ -9249,7 +8979,6 @@ TEST_CASE(Timeline_Dart_TimelineAsyncDisabled) { EXPECT_NOTSUBSTRING("testAsyncEvent", js.ToCString()); } - TEST_CASE(Timeline_Dart_TimelineAsync) { Isolate* isolate = Isolate::Current(); // Grab embedder stream. @@ -9269,13 +8998,11 @@ TEST_CASE(Timeline_Dart_TimelineAsync) { EXPECT_SUBSTRING("testAsyncEvent", js.ToCString()); } - struct AppendData { uint8_t* buffer; intptr_t buffer_length; }; - static void AppendStreamConsumer(Dart_StreamConsumer_State state, const char* stream_name, const uint8_t* buffer, @@ -9302,7 +9029,6 @@ static void AppendStreamConsumer(Dart_StreamConsumer_State state, data->buffer_length += buffer_length; } - TEST_CASE(Timeline_Dart_TimelineGetTrace) { const char* kScriptChars = "foo() => 'a';\n" @@ -9346,7 +9072,6 @@ TEST_CASE(Timeline_Dart_TimelineGetTrace) { free(data.buffer); } - TEST_CASE(Timeline_Dart_TimelineGetTraceOnlyDartEvents) { const char* kScriptChars = "import 'dart:developer';\n" @@ -9394,7 +9119,6 @@ TEST_CASE(Timeline_Dart_TimelineGetTraceOnlyDartEvents) { free(data.buffer); } - TEST_CASE(Timeline_Dart_TimelineGetTraceWithDartEvents) { const char* kScriptChars = "import 'dart:developer';\n" @@ -9487,13 +9211,10 @@ TEST_CASE(Timeline_Dart_TimelineGetTraceGlobalOverride) { free(data.buffer); } - static const char* arg_names[] = {"arg0"}; - static const char* arg_values[] = {"value0"}; - TEST_CASE(Timeline_Dart_GlobalTimelineGetTrace) { const char* kScriptChars = "bar() => 'z';\n" @@ -9611,7 +9332,6 @@ TEST_CASE(Timeline_Dart_GlobalTimelineGetTrace) { free(data.buffer); } - class GlobalTimelineThreadData { public: GlobalTimelineThreadData() @@ -9641,7 +9361,6 @@ class GlobalTimelineThreadData { bool running_; }; - static void GlobalTimelineThread(uword parameter) { GlobalTimelineThreadData* data = reinterpret_cast(parameter); @@ -9658,7 +9377,6 @@ static void GlobalTimelineThread(uword parameter) { } } - // This test is the same as the one above except that the calls to // Dart_GlobalTimelineGetTrace are made from a fresh thread. This ensures that // we can call the function from a thread for which we have not set up a @@ -9771,7 +9489,6 @@ static void StopRecording() { stop_called = true; } - TEST_CASE(Timeline_Dart_EmbedderTimelineStartStopRecording) { Dart_SetEmbedderTimelineCallbacks(StartRecording, StopRecording); @@ -9790,7 +9507,6 @@ TEST_CASE(Timeline_Dart_EmbedderTimelineStartStopRecording) { EXPECT(stop_called); } - TEST_CASE(Dart_LoadLibraryPatch_1) { const char* kScriptChars1 = "class A {\n" @@ -9823,7 +9539,6 @@ TEST_CASE(Dart_LoadLibraryPatch_1) { EXPECT_VALID(result); } - TEST_CASE(Dart_LoadLibraryPatch_Error1) { const char* kScriptChars1 = "class A {\n" @@ -9854,7 +9569,6 @@ TEST_CASE(Dart_LoadLibraryPatch_Error1) { EXPECT(Dart_IsError(result)); } - TEST_CASE(Dart_LoadLibraryPatch_Error2) { const char* kScriptChars1 = "class A {\n" @@ -9885,7 +9599,6 @@ TEST_CASE(Dart_LoadLibraryPatch_Error2) { OS::Print("Patched class executed\n"); } - TEST_CASE(Dart_LoadLibraryPatch_Error3) { const char* kScriptChars1 = "class A {\n" diff --git a/runtime/vm/dart_api_message.cc b/runtime/vm/dart_api_message.cc index 60985b1dcaa..37f1a32bb61 100644 --- a/runtime/vm/dart_api_message.cc +++ b/runtime/vm/dart_api_message.cc @@ -19,7 +19,6 @@ ApiMessageReader::ApiMessageReader(const uint8_t* buffer, intptr_t length) vm_isolate_references_(kNumInitialReferences), vm_symbol_references_(NULL) {} - ApiMessageReader::ApiMessageReader(Message* msg) : BaseReader(msg->IsRaw() ? reinterpret_cast(msg->raw_obj()) : msg->data(), @@ -29,7 +28,6 @@ ApiMessageReader::ApiMessageReader(Message* msg) vm_isolate_references_(kNumInitialReferences), vm_symbol_references_(NULL) {} - void ApiMessageReader::Init() { // We need to have an enclosing ApiNativeScope. ASSERT(ApiNativeScope::Current() != NULL); @@ -47,7 +45,6 @@ void ApiMessageReader::Init() { static_cast(Dart_CObject_Internal::kDynamicType); } - Dart_CObject* ApiMessageReader::ReadMessage() { Init(); if (PendingBytes() > 0) { @@ -64,7 +61,6 @@ Dart_CObject* ApiMessageReader::ReadMessage() { } } - intptr_t ApiMessageReader::LookupInternalClass(intptr_t class_header) { if (IsVMIsolateObject(class_header)) { return GetVMIsolateObjectId(class_header); @@ -73,7 +69,6 @@ intptr_t ApiMessageReader::LookupInternalClass(intptr_t class_header) { return SerializedHeaderData::decode(class_header); } - Dart_CObject* ApiMessageReader::AllocateDartCObject(Dart_CObject_Type type) { Dart_CObject* value = reinterpret_cast(allocator(sizeof(Dart_CObject))); @@ -82,38 +77,32 @@ Dart_CObject* ApiMessageReader::AllocateDartCObject(Dart_CObject_Type type) { return value; } - Dart_CObject* ApiMessageReader::AllocateDartCObjectUnsupported() { return AllocateDartCObject(Dart_CObject_kUnsupported); } - Dart_CObject* ApiMessageReader::AllocateDartCObjectNull() { return AllocateDartCObject(Dart_CObject_kNull); } - Dart_CObject* ApiMessageReader::AllocateDartCObjectBool(bool val) { Dart_CObject* value = AllocateDartCObject(Dart_CObject_kBool); value->value.as_bool = val; return value; } - Dart_CObject* ApiMessageReader::AllocateDartCObjectInt32(int32_t val) { Dart_CObject* value = AllocateDartCObject(Dart_CObject_kInt32); value->value.as_int32 = val; return value; } - Dart_CObject* ApiMessageReader::AllocateDartCObjectInt64(int64_t val) { Dart_CObject* value = AllocateDartCObject(Dart_CObject_kInt64); value->value.as_int64 = val; return value; } - _Dart_CObject* ApiMessageReader::singleton_uint32_typed_data_ = NULL; Dart_CObject* ApiMessageReader::AllocateDartCObjectBigint() { @@ -129,14 +118,12 @@ Dart_CObject* ApiMessageReader::AllocateDartCObjectBigint() { return value; } - Dart_CObject* ApiMessageReader::AllocateDartCObjectDouble(double val) { Dart_CObject* value = AllocateDartCObject(Dart_CObject_kDouble); value->value.as_double = val; return value; } - Dart_CObject* ApiMessageReader::AllocateDartCObjectString(intptr_t length) { // Allocate a Dart_CObject structure followed by an array of chars // for the string content. The pointer to the string content is set @@ -149,7 +136,6 @@ Dart_CObject* ApiMessageReader::AllocateDartCObjectString(intptr_t length) { return value; } - static int GetTypedDataSizeInBytes(Dart_TypedData_Type type) { switch (type) { case Dart_TypedData_kInt8: @@ -174,7 +160,6 @@ static int GetTypedDataSizeInBytes(Dart_TypedData_Type type) { return -1; } - Dart_CObject* ApiMessageReader::AllocateDartCObjectTypedData( Dart_TypedData_Type type, intptr_t length) { @@ -197,7 +182,6 @@ Dart_CObject* ApiMessageReader::AllocateDartCObjectTypedData( return value; } - Dart_CObject* ApiMessageReader::AllocateDartCObjectArray(intptr_t length) { // Allocate a Dart_CObject structure followed by an array of // pointers to Dart_CObject structures. The pointer to the array @@ -215,7 +199,6 @@ Dart_CObject* ApiMessageReader::AllocateDartCObjectArray(intptr_t length) { return value; } - Dart_CObject* ApiMessageReader::AllocateDartCObjectVmIsolateObj(intptr_t id) { RawObject* raw = VmIsolateSnapshotObject(id); intptr_t cid = raw->GetClassId(); @@ -254,7 +237,6 @@ Dart_CObject* ApiMessageReader::AllocateDartCObjectVmIsolateObj(intptr_t id) { } } - Dart_CObject_Internal* ApiMessageReader::AllocateDartCObjectInternal( Dart_CObject_Internal::Type type) { Dart_CObject_Internal* value = reinterpret_cast( @@ -264,12 +246,10 @@ Dart_CObject_Internal* ApiMessageReader::AllocateDartCObjectInternal( return value; } - Dart_CObject_Internal* ApiMessageReader::AllocateDartCObjectClass() { return AllocateDartCObjectInternal(Dart_CObject_Internal::kClass); } - ApiMessageReader::BackRefNode* ApiMessageReader::AllocateBackRefNode( Dart_CObject* reference, DeserializeState state) { @@ -280,7 +260,6 @@ ApiMessageReader::BackRefNode* ApiMessageReader::AllocateBackRefNode( return value; } - static Dart_TypedData_Type GetTypedDataTypeFromView( Dart_CObject_Internal* object, char* class_name) { @@ -314,7 +293,6 @@ static Dart_TypedData_Type GetTypedDataTypeFromView( return Dart_TypedData_kInvalid; } - Dart_CObject* ApiMessageReader::ReadInlinedObject(intptr_t object_id) { // Read the class header information and lookup the class. intptr_t class_header = Read(); @@ -407,7 +385,6 @@ Dart_CObject* ApiMessageReader::ReadInlinedObject(intptr_t object_id) { return ReadInternalVMObject(class_id, object_id); } - Dart_CObject* ApiMessageReader::ReadPredefinedSymbol(intptr_t object_id) { ASSERT(Symbols::IsPredefinedSymbolId(object_id)); intptr_t symbol_id = object_id - kMaxPredefinedObjectIds; @@ -430,12 +407,10 @@ Dart_CObject* ApiMessageReader::ReadPredefinedSymbol(intptr_t object_id) { return object; } - intptr_t ApiMessageReader::NextAvailableObjectId() const { return backward_references_.length() + kMaxPredefinedObjectIds; } - Dart_CObject* ApiMessageReader::CreateDartCObjectString(RawObject* raw) { ASSERT(RawObject::IsOneByteStringClassId(raw->GetClassId())); RawOneByteString* raw_str = reinterpret_cast(raw); @@ -447,7 +422,6 @@ Dart_CObject* ApiMessageReader::CreateDartCObjectString(RawObject* raw) { return object; } - Dart_CObject* ApiMessageReader::GetCanonicalMintObject(Dart_CObject_Type type, int64_t value64) { Dart_CObject* object = NULL; @@ -468,7 +442,6 @@ Dart_CObject* ApiMessageReader::GetCanonicalMintObject(Dart_CObject_Type type, return object; } - Dart_CObject* ApiMessageReader::ReadObjectRef() { int64_t value64 = Read(); if ((value64 & kSmiTagMask) == 0) { @@ -523,7 +496,6 @@ Dart_CObject* ApiMessageReader::ReadObjectRef() { return ReadInternalVMObject(class_id, object_id); } - Dart_CObject* ApiMessageReader::ReadVMIsolateObject(intptr_t value) { intptr_t object_id = GetVMIsolateObjectId(value); if (object_id == kNullObject) { @@ -545,7 +517,6 @@ Dart_CObject* ApiMessageReader::ReadVMIsolateObject(intptr_t value) { return AllocateDartCObjectNull(); } - Dart_CObject* ApiMessageReader::ReadInternalVMObject(intptr_t class_id, intptr_t object_id) { switch (class_id) { @@ -705,7 +676,6 @@ Dart_CObject* ApiMessageReader::ReadInternalVMObject(intptr_t class_id, AllocateDartCObjectTypedData(Dart_TypedData_k##type, len); \ AddBackRef(object_id, object, kIsDeserialized); - #define READ_TYPED_DATA(type, ctype) \ { \ READ_TYPED_DATA_HEADER(type); \ @@ -817,7 +787,6 @@ Dart_CObject* ApiMessageReader::ReadInternalVMObject(intptr_t class_id, } } - Dart_CObject* ApiMessageReader::ReadIndexedObject(intptr_t object_id) { if (object_id == kDynamicType || object_id == kDoubleType || object_id == kIntType || object_id == kBoolType || @@ -831,7 +800,6 @@ Dart_CObject* ApiMessageReader::ReadIndexedObject(intptr_t object_id) { return backward_references_[index]->reference(); } - Dart_CObject* ApiMessageReader::ReadObject() { Dart_CObject* value = ReadObjectImpl(); for (intptr_t i = 0; i < backward_references_.length(); i++) { @@ -843,7 +811,6 @@ Dart_CObject* ApiMessageReader::ReadObject() { return value; } - Dart_CObject* ApiMessageReader::ReadObjectImpl() { int64_t value64 = Read(); if ((value64 & kSmiTagMask) == 0) { @@ -871,7 +838,6 @@ Dart_CObject* ApiMessageReader::ReadObjectImpl() { return ReadInlinedObject(object_id); } - void ApiMessageReader::AddBackRef(intptr_t id, Dart_CObject* obj, DeserializeState state) { @@ -882,7 +848,6 @@ void ApiMessageReader::AddBackRef(intptr_t id, backward_references_.Add(node); } - Dart_CObject* ApiMessageReader::GetBackRef(intptr_t id) { ASSERT(id >= kMaxPredefinedObjectIds); intptr_t index = (id - kMaxPredefinedObjectIds); @@ -892,7 +857,6 @@ Dart_CObject* ApiMessageReader::GetBackRef(intptr_t id) { return NULL; } - void ApiMessageWriter::WriteMessage(intptr_t field_count, intptr_t* data) { // Write out the serialization header value for this object. WriteInlinedObjectHeader(kMaxPredefinedObjectIds); @@ -913,7 +877,6 @@ void ApiMessageWriter::WriteMessage(intptr_t field_count, intptr_t* data) { } } - void ApiMessageWriter::MarkCObject(Dart_CObject* object, intptr_t object_id) { // Mark the object as serialized by adding the object id to the // upper bits of the type field in the Dart_CObject structure. Add @@ -924,19 +887,16 @@ void ApiMessageWriter::MarkCObject(Dart_CObject* object, intptr_t object_id) { ((mark_value) << kDartCObjectTypeBits) | object->type); } - void ApiMessageWriter::UnmarkCObject(Dart_CObject* object) { ASSERT(IsCObjectMarked(object)); object->type = static_cast(object->type & kDartCObjectTypeMask); } - bool ApiMessageWriter::IsCObjectMarked(Dart_CObject* object) { return (object->type & kDartCObjectMarkMask) != 0; } - intptr_t ApiMessageWriter::GetMarkedCObjectMark(Dart_CObject* object) { ASSERT(IsCObjectMarked(object)); intptr_t mark_value = @@ -945,7 +905,6 @@ intptr_t ApiMessageWriter::GetMarkedCObjectMark(Dart_CObject* object) { return mark_value - kDartCObjectMarkOffset; } - void ApiMessageWriter::UnmarkAllCObjects(Dart_CObject* object) { if (!IsCObjectMarked(object)) return; UnmarkCObject(object); @@ -957,7 +916,6 @@ void ApiMessageWriter::UnmarkAllCObjects(Dart_CObject* object) { } } - void ApiMessageWriter::AddToForwardList(Dart_CObject* object) { if (forward_id_ >= forward_list_length_) { void* new_list = NULL; @@ -977,18 +935,15 @@ void ApiMessageWriter::AddToForwardList(Dart_CObject* object) { forward_id_ += 1; } - void ApiMessageWriter::WriteSmi(int64_t value) { ASSERT(Smi::IsValid(value)); Write(Smi::New(static_cast(value))); } - void ApiMessageWriter::WriteNullObject() { WriteVMIsolateObject(kNullObject); } - void ApiMessageWriter::WriteMint(Dart_CObject* object, int64_t value) { ASSERT(!Smi::IsValid(value)); // Write out the serialization header value for mint object. @@ -1000,7 +955,6 @@ void ApiMessageWriter::WriteMint(Dart_CObject* object, int64_t value) { Write(value); } - void ApiMessageWriter::WriteInt32(Dart_CObject* object) { int64_t value = object->value.as_int32; if (Smi::IsValid(value)) { @@ -1010,7 +964,6 @@ void ApiMessageWriter::WriteInt32(Dart_CObject* object) { } } - void ApiMessageWriter::WriteInt64(Dart_CObject* object) { int64_t value = object->value.as_int64; if (Smi::IsValid(value)) { @@ -1020,7 +973,6 @@ void ApiMessageWriter::WriteInt64(Dart_CObject* object) { } } - void ApiMessageWriter::WriteInlinedHeader(Dart_CObject* object) { // Write out the serialization header value for this object. WriteInlinedObjectHeader(kMaxPredefinedObjectIds + object_id_); @@ -1030,7 +982,6 @@ void ApiMessageWriter::WriteInlinedHeader(Dart_CObject* object) { object_id_++; } - bool ApiMessageWriter::WriteCObject(Dart_CObject* object) { if (IsCObjectMarked(object)) { intptr_t object_id = GetMarkedCObjectMark(object); @@ -1064,7 +1015,6 @@ bool ApiMessageWriter::WriteCObject(Dart_CObject* object) { return WriteCObjectInlined(object, type); } - bool ApiMessageWriter::WriteCObjectRef(Dart_CObject* object) { if (IsCObjectMarked(object)) { intptr_t object_id = GetMarkedCObjectMark(object); @@ -1092,7 +1042,6 @@ bool ApiMessageWriter::WriteCObjectRef(Dart_CObject* object) { return WriteCObjectInlined(object, type); } - bool ApiMessageWriter::WriteForwardedCObject(Dart_CObject* object) { ASSERT(IsCObjectMarked(object)); Dart_CObject_Type type = @@ -1121,7 +1070,6 @@ bool ApiMessageWriter::WriteForwardedCObject(Dart_CObject* object) { return true; } - bool ApiMessageWriter::WriteCObjectInlined(Dart_CObject* object, Dart_CObject_Type type) { switch (type) { @@ -1269,9 +1217,8 @@ bool ApiMessageWriter::WriteCObjectInlined(Dart_CObject* object, WriteIndexedObject(kExternalTypedDataUint8ArrayCid); WriteTags(0); intptr_t length = object->value.as_external_typed_data.length; - if (length < 0 || - length > - ExternalTypedData::MaxElements(kExternalTypedDataUint8ArrayCid)) { + if (length < 0 || length > ExternalTypedData::MaxElements( + kExternalTypedDataUint8ArrayCid)) { return false; } uint8_t* data = object->value.as_external_typed_data.data; @@ -1306,7 +1253,6 @@ bool ApiMessageWriter::WriteCObjectInlined(Dart_CObject* object, return true; } - bool ApiMessageWriter::WriteCMessage(Dart_CObject* object) { bool success = WriteCObject(object); if (!success) { diff --git a/runtime/vm/dart_api_message.h b/runtime/vm/dart_api_message.h index c74737ea477..d2a84e2dd34 100644 --- a/runtime/vm/dart_api_message.h +++ b/runtime/vm/dart_api_message.h @@ -41,7 +41,6 @@ struct Dart_CObject_Internal : public Dart_CObject { } internal; }; - // Reads a message snapshot into a C structure. class ApiMessageReader : public BaseReader { public: @@ -153,7 +152,6 @@ class ApiMessageReader : public BaseReader { static _Dart_CObject* singleton_uint32_typed_data_; }; - class ApiMessageWriter : public BaseWriter { public: static const intptr_t kInitialSize = 512; @@ -205,7 +203,6 @@ class ApiMessageWriter : public BaseWriter { DISALLOW_COPY_AND_ASSIGN(ApiMessageWriter); }; - // This class handles translation of certain RawObjects to CObjects for // NativeMessageHandlers. // diff --git a/runtime/vm/dart_api_state.h b/runtime/vm/dart_api_state.h index b222449b799..71b4524dad9 100644 --- a/runtime/vm/dart_api_state.h +++ b/runtime/vm/dart_api_state.h @@ -121,7 +121,6 @@ class ApiZone { DISALLOW_COPY_AND_ASSIGN(ApiZone); }; - // Implementation of local handles which are handed out from every // dart API call, these handles are valid only in the present scope // and are destroyed when a Dart_ExitScope() is called. @@ -143,12 +142,10 @@ class LocalHandle { DISALLOW_COPY_AND_ASSIGN(LocalHandle); }; - // A distinguished callback which indicates that a persistent handle // should not be deleted from the dart api. void ProtectedHandleCallback(void* peer); - // Implementation of persistent handles which are handed out through the // dart API. class PersistentHandle { @@ -187,7 +184,6 @@ class PersistentHandle { DISALLOW_COPY_AND_ASSIGN(PersistentHandle); }; - // Implementation of persistent handles which are handed out through the // dart API. class FinalizablePersistentHandle { @@ -338,7 +334,6 @@ class FinalizablePersistentHandle { DISALLOW_COPY_AND_ASSIGN(FinalizablePersistentHandle); }; - // Local handles repository structure. static const int kLocalHandleSizeInWords = sizeof(LocalHandle) / kWordSize; static const int kLocalHandlesPerChunk = 64; @@ -365,7 +360,6 @@ class LocalHandles : Handles(), free_list_(NULL) {} - ~FinalizablePersistentHandles() { - free_list_ = NULL; - } + ~FinalizablePersistentHandles() { free_list_ = NULL; } // Accessors. FinalizablePersistentHandle* free_list() const { return free_list_; } @@ -571,7 +561,6 @@ class FinalizablePersistentHandles DISALLOW_COPY_AND_ASSIGN(FinalizablePersistentHandles); }; - // Structure used for the implementation of local scopes used in dart_api. // These local scopes manage handles and memory allocated in the scope. class ApiLocalScope { @@ -611,7 +600,6 @@ class ApiLocalScope { DISALLOW_COPY_AND_ASSIGN(ApiLocalScope); }; - class ApiNativeScope { public: ApiNativeScope() { @@ -662,7 +650,6 @@ class ApiNativeScope { ApiZone zone_; }; - // Api growable arrays use a zone for allocation. The constructor // picks the zone from the current isolate if in an isolate // environment. When outside an isolate environment it picks the zone @@ -681,7 +668,6 @@ class ApiGrowableArray : public BaseGrowableArray { : BaseGrowableArray(initial_capacity, zone) {} }; - // Implementation of the API State used in dart api for maintaining // local scopes, persistent handles etc. These are setup on a per isolate // basis and destroyed when the isolate is shutdown. @@ -792,7 +778,6 @@ class ApiState { DISALLOW_COPY_AND_ASSIGN(ApiState); }; - inline FinalizablePersistentHandle* FinalizablePersistentHandle::New( Isolate* isolate, const Object& object, diff --git a/runtime/vm/dart_entry.cc b/runtime/vm/dart_entry.cc index 97851a024ee..88004653383 100644 --- a/runtime/vm/dart_entry.cc +++ b/runtime/vm/dart_entry.cc @@ -20,7 +20,6 @@ namespace dart { // A cache of VM heap allocated arguments descriptors. RawArray* ArgumentsDescriptor::cached_args_descriptors_[kCachedDescriptorCount]; - RawObject* DartEntry::InvokeFunction(const Function& function, const Array& arguments) { ASSERT(Thread::Current()->IsMutatorThread()); @@ -30,7 +29,6 @@ RawObject* DartEntry::InvokeFunction(const Function& function, return InvokeFunction(function, arguments, arguments_descriptor); } - class ScopedIsolateStackLimits : public ValueObject { public: explicit ScopedIsolateStackLimits(Thread* thread, uword current_sp) @@ -65,7 +63,6 @@ class ScopedIsolateStackLimits : public ValueObject { uword saved_stack_limit_; }; - // Clears/restores Thread::long_jump_base on construction/destruction. // Ensures that we do not attempt to long jump across Dart frames. class SuspendLongJumpScope : public StackResource { @@ -84,7 +81,6 @@ class SuspendLongJumpScope : public StackResource { LongJumpScope* saved_long_jump_base_; }; - RawObject* DartEntry::InvokeFunction(const Function& function, const Array& arguments, const Array& arguments_descriptor, @@ -132,7 +128,6 @@ RawObject* DartEntry::InvokeFunction(const Function& function, #endif } - RawObject* DartEntry::InvokeClosure(const Array& arguments) { const int kTypeArgsLen = 0; // No support to pass type args to generic func. const Array& arguments_descriptor = @@ -140,7 +135,6 @@ RawObject* DartEntry::InvokeClosure(const Array& arguments) { return InvokeClosure(arguments, arguments_descriptor); } - RawObject* DartEntry::InvokeClosure(const Array& arguments, const Array& arguments_descriptor) { Thread* thread = Thread::Current(); @@ -215,7 +209,6 @@ RawObject* DartEntry::InvokeClosure(const Array& arguments, arguments_descriptor); } - RawObject* DartEntry::InvokeNoSuchMethod(const Instance& receiver, const String& target_name, const Array& arguments, @@ -268,24 +261,20 @@ RawObject* DartEntry::InvokeNoSuchMethod(const Instance& receiver, return InvokeFunction(function, args); } - ArgumentsDescriptor::ArgumentsDescriptor(const Array& array) : array_(array) {} intptr_t ArgumentsDescriptor::TypeArgsLen() const { return Smi::Cast(Object::Handle(array_.At(kTypeArgsLenIndex))).Value(); } - intptr_t ArgumentsDescriptor::Count() const { return Smi::Cast(Object::Handle(array_.At(kCountIndex))).Value(); } - intptr_t ArgumentsDescriptor::PositionalCount() const { return Smi::Cast(Object::Handle(array_.At(kPositionalCountIndex))).Value(); } - RawString* ArgumentsDescriptor::NameAt(intptr_t index) const { const intptr_t offset = kFirstNamedEntryIndex + (index * kNamedEntrySize) + kNameOffset; @@ -294,40 +283,33 @@ RawString* ArgumentsDescriptor::NameAt(intptr_t index) const { return result.raw(); } - intptr_t ArgumentsDescriptor::PositionAt(intptr_t index) const { const intptr_t offset = kFirstNamedEntryIndex + (index * kNamedEntrySize) + kPositionOffset; return Smi::Value(Smi::RawCast(array_.At(offset))); } - bool ArgumentsDescriptor::MatchesNameAt(intptr_t index, const String& other) const { return NameAt(index) == other.raw(); } - intptr_t ArgumentsDescriptor::type_args_len_offset() { return Array::element_offset(kTypeArgsLenIndex); } - intptr_t ArgumentsDescriptor::count_offset() { return Array::element_offset(kCountIndex); } - intptr_t ArgumentsDescriptor::positional_count_offset() { return Array::element_offset(kPositionalCountIndex); } - intptr_t ArgumentsDescriptor::first_named_entry_offset() { return Array::element_offset(kFirstNamedEntryIndex); } - RawArray* ArgumentsDescriptor::New(intptr_t type_args_len, intptr_t num_arguments, const Array& optional_arguments_names) { @@ -392,7 +374,6 @@ RawArray* ArgumentsDescriptor::New(intptr_t type_args_len, return descriptor.raw(); } - RawArray* ArgumentsDescriptor::New(intptr_t type_args_len, intptr_t num_arguments) { ASSERT(type_args_len >= 0); @@ -403,7 +384,6 @@ RawArray* ArgumentsDescriptor::New(intptr_t type_args_len, return NewNonCached(type_args_len, num_arguments); } - RawArray* ArgumentsDescriptor::NewNonCached(intptr_t type_args_len, intptr_t num_arguments, bool canonicalize) { @@ -439,7 +419,6 @@ RawArray* ArgumentsDescriptor::NewNonCached(intptr_t type_args_len, return descriptor.raw(); } - void ArgumentsDescriptor::InitOnce() { for (int i = 0; i < kCachedDescriptorCount; i++) { cached_args_descriptors_[i] = @@ -447,7 +426,6 @@ void ArgumentsDescriptor::InitOnce() { } } - RawObject* DartLibraryCalls::InstanceCreate(const Library& lib, const String& class_name, const String& constructor_name, @@ -480,7 +458,6 @@ RawObject* DartLibraryCalls::InstanceCreate(const Library& lib, return exception_object.raw(); } - RawObject* DartLibraryCalls::ToString(const Instance& receiver) { const int kTypeArgsLen = 0; const int kNumArguments = 1; // Receiver. @@ -497,7 +474,6 @@ RawObject* DartLibraryCalls::ToString(const Instance& receiver) { return result.raw(); } - RawObject* DartLibraryCalls::HashCode(const Instance& receiver) { const int kTypeArgsLen = 0; const int kNumArguments = 1; // Receiver. @@ -514,7 +490,6 @@ RawObject* DartLibraryCalls::HashCode(const Instance& receiver) { return result.raw(); } - RawObject* DartLibraryCalls::Equals(const Instance& left, const Instance& right) { const int kTypeArgsLen = 0; @@ -534,7 +509,6 @@ RawObject* DartLibraryCalls::Equals(const Instance& left, return result.raw(); } - RawObject* DartLibraryCalls::LookupHandler(Dart_Port port_id) { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -562,7 +536,6 @@ RawObject* DartLibraryCalls::LookupHandler(Dart_Port port_id) { return result.raw(); } - RawObject* DartLibraryCalls::HandleMessage(const Object& handler, const Instance& message) { Thread* thread = Thread::Current(); @@ -600,7 +573,6 @@ RawObject* DartLibraryCalls::HandleMessage(const Object& handler, return result.raw(); } - RawObject* DartLibraryCalls::DrainMicrotaskQueue() { Zone* zone = Thread::Current()->zone(); Library& isolate_lib = Library::Handle(zone, Library::IsolateLibrary()); @@ -614,7 +586,6 @@ RawObject* DartLibraryCalls::DrainMicrotaskQueue() { return result.raw(); } - RawObject* DartLibraryCalls::MapSetAt(const Instance& map, const Instance& key, const Instance& value) { diff --git a/runtime/vm/dart_entry.h b/runtime/vm/dart_entry.h index 9722ed2e966..d3aad80980f 100644 --- a/runtime/vm/dart_entry.h +++ b/runtime/vm/dart_entry.h @@ -119,7 +119,6 @@ class ArgumentsDescriptor : public ValueObject { DISALLOW_COPY_AND_ASSIGN(ArgumentsDescriptor); }; - // DartEntry abstracts functionality needed to resolve dart functions // and invoke them from C++. class DartEntry : public AllStatic { @@ -165,7 +164,6 @@ class DartEntry : public AllStatic { const Array& arguments_descriptor); }; - // Utility functions to call from VM into Dart bootstrap libraries. // Each may return an exception object. class DartLibraryCalls : public AllStatic { diff --git a/runtime/vm/dart_entry_test.cc b/runtime/vm/dart_entry_test.cc index eb694cfb584..6add7fec017 100644 --- a/runtime/vm/dart_entry_test.cc +++ b/runtime/vm/dart_entry_test.cc @@ -42,7 +42,6 @@ TEST_CASE(DartEntry) { EXPECT_EQ(Smi::New(42), retval.raw()); } - TEST_CASE(InvokeStatic_CompileError) { const char* kScriptChars = "class A {\n" @@ -67,7 +66,6 @@ TEST_CASE(InvokeStatic_CompileError) { EXPECT_SUBSTRING("++++", Error::Cast(retval).ToErrorCString()); } - TEST_CASE(InvokeDynamic_CompileError) { const char* kScriptChars = "class A {\n" diff --git a/runtime/vm/datastream.h b/runtime/vm/datastream.h index 5a43bd5917c..4adff13de00 100644 --- a/runtime/vm/datastream.h +++ b/runtime/vm/datastream.h @@ -287,7 +287,6 @@ class ReadStream : public ValueObject { DISALLOW_COPY_AND_ASSIGN(ReadStream); }; - // Stream for writing various types into a buffer. class WriteStream : public ValueObject { public: diff --git a/runtime/vm/debugger.cc b/runtime/vm/debugger.cc index 6bfbede60ab..ac05de0b610 100644 --- a/runtime/vm/debugger.cc +++ b/runtime/vm/debugger.cc @@ -36,7 +36,6 @@ #include "vm/token_position.h" #include "vm/visitor.h" - namespace dart { DEFINE_FLAG(bool, @@ -59,12 +58,10 @@ DEFINE_FLAG(bool, DECLARE_FLAG(bool, warn_on_pause_with_no_debugger); - #ifndef PRODUCT Debugger::EventHandler* Debugger::event_handler_ = NULL; - class RemoteObjectCache : public ZoneAllocated { public: explicit RemoteObjectCache(intptr_t initial_size); @@ -78,7 +75,6 @@ class RemoteObjectCache : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(RemoteObjectCache); }; - // Create an unresolved breakpoint in given token range and script. BreakpointLocation::BreakpointLocation(const Script& script, TokenPosition token_pos, @@ -120,7 +116,6 @@ BreakpointLocation::BreakpointLocation(const String& url, ASSERT(requested_line_number_ >= 0); } - BreakpointLocation::~BreakpointLocation() { Breakpoint* bpt = breakpoints(); while (bpt != NULL) { @@ -130,12 +125,10 @@ BreakpointLocation::~BreakpointLocation() { } } - bool BreakpointLocation::AnyEnabled() const { return breakpoints() != NULL; } - void BreakpointLocation::SetResolved(const Function& func, TokenPosition token_pos) { ASSERT(!IsLatent()); @@ -149,7 +142,6 @@ void BreakpointLocation::SetResolved(const Function& func, is_resolved_ = true; } - // TODO(hausner): Get rid of library parameter. A source breakpoint location // does not imply a library, since the same source code can be included // in more than one library, e.g. the text location of mixin functions. @@ -174,7 +166,6 @@ void BreakpointLocation::GetCodeLocation(Library* lib, } } - intptr_t BreakpointLocation::LineNumber() { ASSERT(IsResolved()); // Compute line number lazily since it causes scanning of the script. @@ -185,7 +176,6 @@ intptr_t BreakpointLocation::LineNumber() { return line_number_; } - intptr_t BreakpointLocation::ColumnNumber() { ASSERT(IsResolved()); // Compute column number lazily since it causes scanning of the script. @@ -196,19 +186,16 @@ intptr_t BreakpointLocation::ColumnNumber() { return column_number_; } - void Breakpoint::set_bpt_location(BreakpointLocation* new_bpt_location) { // Only latent breakpoints can be moved. ASSERT((new_bpt_location == NULL) || bpt_location_->IsLatent()); bpt_location_ = new_bpt_location; } - void Breakpoint::VisitObjectPointers(ObjectPointerVisitor* visitor) { visitor->VisitPointer(reinterpret_cast(&closure_)); } - void BreakpointLocation::VisitObjectPointers(ObjectPointerVisitor* visitor) { visitor->VisitPointer(reinterpret_cast(&script_)); visitor->VisitPointer(reinterpret_cast(&url_)); @@ -221,7 +208,6 @@ void BreakpointLocation::VisitObjectPointers(ObjectPointerVisitor* visitor) { } } - void Breakpoint::PrintJSON(JSONStream* stream) { JSONObject jsobj(stream); jsobj.AddProperty("type", "Breakpoint"); @@ -239,7 +225,6 @@ void Breakpoint::PrintJSON(JSONStream* stream) { } } - void CodeBreakpoint::VisitObjectPointers(ObjectPointerVisitor* visitor) { visitor->VisitPointer(reinterpret_cast(&code_)); #if !defined(TARGET_ARCH_DBC) @@ -247,7 +232,6 @@ void CodeBreakpoint::VisitObjectPointers(ObjectPointerVisitor* visitor) { #endif } - ActivationFrame::ActivationFrame(uword pc, uword fp, uword sp, @@ -277,7 +261,6 @@ ActivationFrame::ActivationFrame(uword pc, desc_indices_(8), pc_desc_(PcDescriptors::ZoneHandle()) {} - ActivationFrame::ActivationFrame(Kind kind) : pc_(0), fp_(0), @@ -300,7 +283,6 @@ ActivationFrame::ActivationFrame(Kind kind) desc_indices_(8), pc_desc_(PcDescriptors::ZoneHandle()) {} - ActivationFrame::ActivationFrame(const Closure& async_activation) : pc_(0), fp_(0), @@ -331,14 +313,12 @@ ActivationFrame::ActivationFrame(const Closure& async_activation) ASSERT(!ctx_.IsNull()); } - bool Debugger::NeedsIsolateEvents() { return ((isolate_ != Dart::vm_isolate()) && !ServiceIsolate::IsServiceIsolateDescendant(isolate_) && ((event_handler_ != NULL) || Service::isolate_stream.enabled())); } - bool Debugger::NeedsDebugEvents() { ASSERT(isolate_ != Dart::vm_isolate() && !ServiceIsolate::IsServiceIsolateDescendant(isolate_)); @@ -346,7 +326,6 @@ bool Debugger::NeedsDebugEvents() { Service::debug_stream.enabled()); } - void Debugger::InvokeEventHandler(ServiceEvent* event) { ASSERT(!event->IsPause()); // For pause events, call Pause instead. Service::HandleEvent(event); @@ -358,17 +337,14 @@ void Debugger::InvokeEventHandler(ServiceEvent* event) { } } - RawError* Debugger::PauseInterrupted() { return PauseRequest(ServiceEvent::kPauseInterrupted); } - RawError* Debugger::PausePostRequest() { return PauseRequest(ServiceEvent::kPausePostRequest); } - RawError* Debugger::PauseRequest(ServiceEvent::EventKind kind) { if (ignore_breakpoints_ || IsPaused()) { // We don't let the isolate get interrupted if we are already @@ -394,7 +370,6 @@ RawError* Debugger::PauseRequest(ServiceEvent::EventKind kind) { return error.raw(); } - void Debugger::SendBreakpointEvent(ServiceEvent::EventKind kind, Breakpoint* bpt) { if (NeedsDebugEvents()) { @@ -406,7 +381,6 @@ void Debugger::SendBreakpointEvent(ServiceEvent::EventKind kind, } } - void BreakpointLocation::AddBreakpoint(Breakpoint* bpt, Debugger* dbg) { bpt->set_next(breakpoints()); set_breakpoints(bpt); @@ -415,7 +389,6 @@ void BreakpointLocation::AddBreakpoint(Breakpoint* bpt, Debugger* dbg) { dbg->SendBreakpointEvent(ServiceEvent::kBreakpointAdded, bpt); } - Breakpoint* BreakpointLocation::AddRepeated(Debugger* dbg) { Breakpoint* bpt = breakpoints(); while (bpt != NULL) { @@ -430,7 +403,6 @@ Breakpoint* BreakpointLocation::AddRepeated(Debugger* dbg) { return bpt; } - Breakpoint* BreakpointLocation::AddSingleShot(Debugger* dbg) { Breakpoint* bpt = breakpoints(); while (bpt != NULL) { @@ -445,7 +417,6 @@ Breakpoint* BreakpointLocation::AddSingleShot(Debugger* dbg) { return bpt; } - Breakpoint* BreakpointLocation::AddPerClosure(Debugger* dbg, const Instance& closure, bool for_over_await) { @@ -469,7 +440,6 @@ Breakpoint* BreakpointLocation::AddPerClosure(Debugger* dbg, return bpt; } - const char* Debugger::QualifiedFunctionName(const Function& func) { const String& func_name = String::Handle(func.name()); Class& func_class = Class::Handle(func.Owner()); @@ -480,7 +450,6 @@ const char* Debugger::QualifiedFunctionName(const Function& func) { func_class.IsTopLevel() ? "" : ".", func_name.ToCString()); } - // Returns true if the function |func| overlaps the token range // [|token_pos|, |end_token_pos|] in |script|. static bool FunctionOverlaps(const Function& func, @@ -497,7 +466,6 @@ static bool FunctionOverlaps(const Function& func, return false; } - static bool IsImplicitFunction(const Function& func) { switch (func.kind()) { case RawFunction::kImplicitGetter: @@ -517,7 +485,6 @@ static bool IsImplicitFunction(const Function& func) { return false; } - bool Debugger::HasBreakpoint(const Function& func, Zone* zone) { if (!func.HasCode()) { // If the function is not compiled yet, just check whether there @@ -546,7 +513,6 @@ bool Debugger::HasBreakpoint(const Function& func, Zone* zone) { return false; } - bool Debugger::HasBreakpoint(const Code& code) { CodeBreakpoint* cbpt = code_breakpoints_; while (cbpt != NULL) { @@ -558,13 +524,11 @@ bool Debugger::HasBreakpoint(const Code& code) { return false; } - void Debugger::PrintBreakpointsToJSONArray(JSONArray* jsarr) const { PrintBreakpointsListToJSONArray(breakpoint_locations_, jsarr); PrintBreakpointsListToJSONArray(latent_locations_, jsarr); } - void Debugger::PrintBreakpointsListToJSONArray(BreakpointLocation* sbpt, JSONArray* jsarr) const { while (sbpt != NULL) { @@ -577,7 +541,6 @@ void Debugger::PrintBreakpointsListToJSONArray(BreakpointLocation* sbpt, } } - void Debugger::PrintSettingsToJSONObject(JSONObject* jsobj) const { // This won't cut it when we support filtering by class, etc. switch (GetExceptionPauseInfo()) { @@ -595,29 +558,24 @@ void Debugger::PrintSettingsToJSONObject(JSONObject* jsobj) const { } } - RawString* ActivationFrame::QualifiedFunctionName() { return String::New(Debugger::QualifiedFunctionName(function())); } - RawString* ActivationFrame::SourceUrl() { const Script& script = Script::Handle(SourceScript()); return script.url(); } - RawScript* ActivationFrame::SourceScript() { return function().script(); } - RawLibrary* ActivationFrame::Library() { const Class& cls = Class::Handle(function().origin()); return cls.library(); } - void ActivationFrame::GetPcDescriptors() { if (pc_desc_.IsNull()) { pc_desc_ = code().pc_descriptors(); @@ -625,7 +583,6 @@ void ActivationFrame::GetPcDescriptors() { } } - // Compute token_pos_ and try_index_ and token_pos_initialized_. TokenPosition ActivationFrame::TokenPos() { if (!token_pos_initialized_) { @@ -646,7 +603,6 @@ TokenPosition ActivationFrame::TokenPos() { return token_pos_; } - intptr_t ActivationFrame::TryIndex() { if (!token_pos_initialized_) { TokenPos(); // Side effect: computes token_pos_initialized_, try_index_. @@ -654,7 +610,6 @@ intptr_t ActivationFrame::TryIndex() { return try_index_; } - intptr_t ActivationFrame::DeoptId() { if (!token_pos_initialized_) { TokenPos(); // Side effect: computes token_pos_initialized_, try_index_. @@ -662,7 +617,6 @@ intptr_t ActivationFrame::DeoptId() { return deopt_id_; } - intptr_t ActivationFrame::LineNumber() { // Compute line number lazily since it causes scanning of the script. if ((line_number_ < 0) && TokenPos().IsSourcePosition()) { @@ -673,7 +627,6 @@ intptr_t ActivationFrame::LineNumber() { return line_number_; } - intptr_t ActivationFrame::ColumnNumber() { // Compute column number lazily since it causes scanning of the script. if ((column_number_ < 0) && TokenPos().IsSourcePosition()) { @@ -688,7 +641,6 @@ intptr_t ActivationFrame::ColumnNumber() { return column_number_; } - void ActivationFrame::GetVarDescriptors() { if (var_descriptors_.IsNull()) { Code& unoptimized_code = Code::Handle(function().unoptimized_code()); @@ -708,12 +660,10 @@ void ActivationFrame::GetVarDescriptors() { } } - bool ActivationFrame::IsDebuggable() const { return Debugger::IsDebuggable(function()); } - void ActivationFrame::PrintDescriptorsError(const char* message) { OS::PrintErr("Bad descriptors: %s\n", message); OS::PrintErr("function %s\n", function().ToQualifiedCString()); @@ -734,7 +684,6 @@ void ActivationFrame::PrintDescriptorsError(const char* message) { OS::Abort(); } - // Calculate the context level at the current token index of the frame. intptr_t ActivationFrame::ContextLevel() { const Context& ctx = GetSavedCurrentContext(); @@ -768,7 +717,6 @@ intptr_t ActivationFrame::ContextLevel() { return context_level_; } - RawObject* ActivationFrame::GetAsyncContextVariable(const String& name) { if (!function_.IsAsyncClosure() && !function_.IsAsyncGenClosure()) { return Object::null(); @@ -798,12 +746,10 @@ RawObject* ActivationFrame::GetAsyncContextVariable(const String& name) { return Object::null(); } - RawObject* ActivationFrame::GetAsyncCompleter() { return GetAsyncContextVariable(Symbols::AsyncCompleter()); } - RawObject* ActivationFrame::GetAsyncCompleterAwaiter(const Object& completer) { const Class& sync_completer_cls = Class::Handle(completer.clazz()); ASSERT(!sync_completer_cls.IsNull()); @@ -826,12 +772,10 @@ RawObject* ActivationFrame::GetAsyncCompleterAwaiter(const Object& completer) { return future.GetField(awaiter_field); } - RawObject* ActivationFrame::GetAsyncStreamControllerStream() { return GetAsyncContextVariable(Symbols::ControllerStream()); } - RawObject* ActivationFrame::GetAsyncStreamControllerStreamAwaiter( const Object& stream) { const Class& stream_cls = Class::Handle(stream.clazz()); @@ -843,7 +787,6 @@ RawObject* ActivationFrame::GetAsyncStreamControllerStreamAwaiter( return Instance::Cast(stream).GetField(awaiter_field); } - RawObject* ActivationFrame::GetAsyncAwaiter() { const Object& async_stream_controller_stream = Object::Handle(GetAsyncStreamControllerStream()); @@ -858,12 +801,10 @@ RawObject* ActivationFrame::GetAsyncAwaiter() { return Object::null(); } - RawObject* ActivationFrame::GetCausalStack() { return GetAsyncContextVariable(Symbols::AsyncStackTraceVar()); } - bool ActivationFrame::HandlesException(const Instance& exc_obj) { if ((kind_ == kAsyncSuspensionMarker) || (kind_ == kAsyncCausal)) { // These frames are historical. @@ -911,7 +852,6 @@ bool ActivationFrame::HandlesException(const Instance& exc_obj) { return false; } - void ActivationFrame::ExtractTokenPositionFromAsyncClosure() { // Attempt to determine the token position from the async closure. ASSERT(function_.IsAsyncGenClosure() || function_.IsAsyncClosure()); @@ -965,7 +905,6 @@ void ActivationFrame::ExtractTokenPositionFromAsyncClosure() { } } - bool ActivationFrame::IsAsyncMachinery() const { Isolate* isolate = Isolate::Current(); if (function_.raw() == isolate->object_store()->complete_on_async_return()) { @@ -980,7 +919,6 @@ bool ActivationFrame::IsAsyncMachinery() const { return false; } - // Get the saved current context of this activation. const Context& ActivationFrame::GetSavedCurrentContext() { if (!ctx_.IsNull()) return ctx_; @@ -1013,7 +951,6 @@ const Context& ActivationFrame::GetSavedCurrentContext() { return ctx_; } - RawObject* ActivationFrame::GetAsyncOperation() { GetVarDescriptors(); intptr_t var_desc_len = var_descriptors_.Length(); @@ -1033,7 +970,6 @@ RawObject* ActivationFrame::GetAsyncOperation() { return Object::null(); } - ActivationFrame* DebuggerStackTrace::GetHandlerFrame( const Instance& exc_obj) const { for (intptr_t frame_index = 0; frame_index < Length(); frame_index++) { @@ -1045,7 +981,6 @@ ActivationFrame* DebuggerStackTrace::GetHandlerFrame( return NULL; } - void ActivationFrame::GetDescIndices() { if (vars_initialized_) { return; @@ -1121,18 +1056,15 @@ void ActivationFrame::GetDescIndices() { vars_initialized_ = true; } - intptr_t ActivationFrame::NumLocalVariables() { GetDescIndices(); return desc_indices_.length(); } - DART_FORCE_INLINE static RawObject* GetVariableValue(uword addr) { return *reinterpret_cast(addr); } - RawObject* ActivationFrame::GetParameter(intptr_t index) { intptr_t num_parameters = function().num_fixed_parameters(); ASSERT(0 <= index && index < num_parameters); @@ -1150,13 +1082,11 @@ RawObject* ActivationFrame::GetParameter(intptr_t index) { } } - RawObject* ActivationFrame::GetClosure() { ASSERT(function().IsClosureFunction()); return GetParameter(0); } - RawObject* ActivationFrame::GetStackVar(intptr_t slot_index) { if (deopt_frame_.IsNull()) { return GetVariableValue(LocalVarAddress(fp(), slot_index)); @@ -1165,7 +1095,6 @@ RawObject* ActivationFrame::GetStackVar(intptr_t slot_index) { } } - bool ActivationFrame::IsRewindable() const { if (deopt_frame_.IsNull()) { return true; @@ -1183,7 +1112,6 @@ bool ActivationFrame::IsRewindable() const { return true; } - void ActivationFrame::PrintContextMismatchError(intptr_t ctx_slot, intptr_t frame_ctx_level, intptr_t var_ctx_level) { @@ -1232,7 +1160,6 @@ void ActivationFrame::PrintContextMismatchError(intptr_t ctx_slot, } } - void ActivationFrame::VariableAt(intptr_t i, String* name, TokenPosition* declaration_token_pos, @@ -1264,7 +1191,6 @@ void ActivationFrame::VariableAt(intptr_t i, } } - RawObject* ActivationFrame::GetContextVar(intptr_t var_ctx_level, intptr_t ctx_slot) { const Context& ctx = GetSavedCurrentContext(); @@ -1297,7 +1223,6 @@ RawObject* ActivationFrame::GetContextVar(intptr_t var_ctx_level, } } - RawArray* ActivationFrame::GetLocalVariables() { GetDescIndices(); intptr_t num_variables = desc_indices_.length(); @@ -1313,7 +1238,6 @@ RawArray* ActivationFrame::GetLocalVariables() { return list.raw(); } - RawObject* ActivationFrame::GetReceiver() { GetDescIndices(); intptr_t num_variables = desc_indices_.length(); @@ -1329,17 +1253,14 @@ RawObject* ActivationFrame::GetReceiver() { return Symbols::OptimizedOut().raw(); } - static bool IsSyntheticVariableName(const String& var_name) { return (var_name.Length() >= 1) && (var_name.CharAt(0) == ':'); } - static bool IsPrivateVariableName(const String& var_name) { return (var_name.Length() >= 1) && (var_name.CharAt(0) == '_'); } - RawObject* ActivationFrame::Evaluate(const String& expr, const GrowableObjectArray& param_names, const GrowableObjectArray& param_values) { @@ -1394,7 +1315,6 @@ RawObject* ActivationFrame::Evaluate(const String& expr, return Object::null(); } - const char* ActivationFrame::ToCString() { const String& url = String::Handle(SourceUrl()); intptr_t line = LineNumber(); @@ -1412,7 +1332,6 @@ const char* ActivationFrame::ToCString() { ContextLevel()); } - void ActivationFrame::PrintToJSONObject(JSONObject* jsobj, bool full) { if (kind_ == kRegular) { PrintToJSONObjectRegular(jsobj, full); @@ -1427,7 +1346,6 @@ void ActivationFrame::PrintToJSONObject(JSONObject* jsobj, bool full) { } } - void ActivationFrame::PrintToJSONObjectRegular(JSONObject* jsobj, bool full) { const Script& script = Script::Handle(SourceScript()); jsobj->AddProperty("type", "Frame"); @@ -1474,7 +1392,6 @@ void ActivationFrame::PrintToJSONObjectRegular(JSONObject* jsobj, bool full) { } } - void ActivationFrame::PrintToJSONObjectAsyncCausal(JSONObject* jsobj, bool full) { jsobj->AddProperty("type", "Frame"); @@ -1492,7 +1409,6 @@ void ActivationFrame::PrintToJSONObjectAsyncCausal(JSONObject* jsobj, } } - void ActivationFrame::PrintToJSONObjectAsyncSuspensionMarker(JSONObject* jsobj, bool full) { jsobj->AddProperty("type", "Frame"); @@ -1500,7 +1416,6 @@ void ActivationFrame::PrintToJSONObjectAsyncSuspensionMarker(JSONObject* jsobj, jsobj->AddProperty("marker", "AsynchronousSuspension"); } - void ActivationFrame::PrintToJSONObjectAsyncActivation(JSONObject* jsobj, bool full) { jsobj->AddProperty("type", "Frame"); @@ -1518,36 +1433,30 @@ void ActivationFrame::PrintToJSONObjectAsyncActivation(JSONObject* jsobj, } } - static bool IsFunctionVisible(const Function& function) { return FLAG_show_invisible_frames || function.is_visible(); } - void DebuggerStackTrace::AddActivation(ActivationFrame* frame) { if (IsFunctionVisible(frame->function())) { trace_.Add(frame); } } - void DebuggerStackTrace::AddMarker(ActivationFrame::Kind marker) { ASSERT(marker == ActivationFrame::kAsyncSuspensionMarker); trace_.Add(new ActivationFrame(marker)); } - void DebuggerStackTrace::AddAsyncCausalFrame(uword pc, const Code& code) { trace_.Add(new ActivationFrame(pc, 0, 0, code, Array::Handle(), 0, ActivationFrame::kAsyncCausal)); } - const uint8_t kSafepointKind = RawPcDescriptors::kIcCall | RawPcDescriptors::kUnoptStaticCall | RawPcDescriptors::kRuntimeCall; - CodeBreakpoint::CodeBreakpoint(const Code& code, TokenPosition token_pos, uword pc, @@ -1573,7 +1482,6 @@ CodeBreakpoint::CodeBreakpoint(const Code& code, ASSERT((breakpoint_kind_ & kSafepointKind) != 0); } - CodeBreakpoint::~CodeBreakpoint() { // Make sure we don't leave patched code behind. ASSERT(!IsEnabled()); @@ -1587,24 +1495,20 @@ CodeBreakpoint::~CodeBreakpoint() { #endif } - RawFunction* CodeBreakpoint::function() const { return Code::Handle(code_).function(); } - RawScript* CodeBreakpoint::SourceCode() { const Function& func = Function::Handle(this->function()); return func.script(); } - RawString* CodeBreakpoint::SourceUrl() { const Script& script = Script::Handle(SourceCode()); return script.url(); } - intptr_t CodeBreakpoint::LineNumber() { // Compute line number lazily since it causes scanning of the script. if (line_number_ < 0) { @@ -1614,7 +1518,6 @@ intptr_t CodeBreakpoint::LineNumber() { return line_number_; } - void CodeBreakpoint::Enable() { if (!is_enabled_) { PatchCode(); @@ -1622,7 +1525,6 @@ void CodeBreakpoint::Enable() { ASSERT(is_enabled_); } - void CodeBreakpoint::Disable() { if (is_enabled_) { RestoreCode(); @@ -1630,13 +1532,11 @@ void CodeBreakpoint::Disable() { ASSERT(!is_enabled_); } - RemoteObjectCache::RemoteObjectCache(intptr_t initial_size) { objs_ = &GrowableObjectArray::ZoneHandle(GrowableObjectArray::New(initial_size)); } - intptr_t RemoteObjectCache::AddObject(const Object& obj) { intptr_t len = objs_->Length(); for (intptr_t i = 0; i < len; i++) { @@ -1648,13 +1548,11 @@ intptr_t RemoteObjectCache::AddObject(const Object& obj) { return len; } - RawObject* RemoteObjectCache::GetObj(intptr_t obj_id) const { ASSERT(IsValidId(obj_id)); return objs_->At(obj_id); } - Debugger::Debugger() : isolate_(NULL), isolate_id_(ILLEGAL_ISOLATE_ID), @@ -1680,7 +1578,6 @@ Debugger::Debugger() synthetic_async_breakpoint_(NULL), exc_pause_info_(kNoPauseOnExceptions) {} - Debugger::~Debugger() { isolate_id_ = ILLEGAL_ISOLATE_ID; ASSERT(!IsPaused()); @@ -1693,7 +1590,6 @@ Debugger::~Debugger() { ASSERT(synthetic_async_breakpoint_ == NULL); } - void Debugger::Shutdown() { // TODO(johnmccutchan): Do not create a debugger for isolates that don't need // them. Then, assert here that isolate_ is not one of those isolates. @@ -1723,10 +1619,8 @@ void Debugger::Shutdown() { } } - void Debugger::OnIsolateRunnable() {} - static RawFunction* ResolveLibraryFunction(const Library& library, const String& fname) { ASSERT(!library.IsNull()); @@ -1737,7 +1631,6 @@ static RawFunction* ResolveLibraryFunction(const Library& library, return Function::null(); } - bool Debugger::SetupStepOverAsyncSuspension(const char** error) { ActivationFrame* top_frame = TopDartFrame(); if (!IsAtAsyncJump(top_frame)) { @@ -1762,7 +1655,6 @@ bool Debugger::SetupStepOverAsyncSuspension(const char** error) { return true; } - bool Debugger::SetResumeAction(ResumeAction action, intptr_t frame_index, const char** error) { @@ -1792,7 +1684,6 @@ bool Debugger::SetResumeAction(ResumeAction action, } } - RawFunction* Debugger::ResolveFunction(const Library& library, const String& class_name, const String& function_name) { @@ -1813,7 +1704,6 @@ RawFunction* Debugger::ResolveFunction(const Library& library, return function.raw(); } - // Deoptimize all functions in the isolate. // TODO(hausner): Actually we only need to deoptimize those functions // that inline the function that contains the newly created breakpoint. @@ -1867,7 +1757,6 @@ void Debugger::DeoptimizeWorld() { } } - ActivationFrame* Debugger::CollectDartFrame(Isolate* isolate, uword pc, StackFrame* frame, @@ -1889,7 +1778,6 @@ ActivationFrame* Debugger::CollectDartFrame(Isolate* isolate, return activation; } - RawArray* Debugger::DeoptimizeToArray(Thread* thread, StackFrame* frame, const Code& code) { @@ -1912,7 +1800,6 @@ RawArray* Debugger::DeoptimizeToArray(Thread* thread, return dest_frame.raw(); } - DebuggerStackTrace* Debugger::CollectStackTrace() { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -1972,7 +1859,6 @@ void Debugger::AppendCodeFrames(Thread* thread, } } - DebuggerStackTrace* Debugger::CollectAsyncCausalStackTrace() { if (!FLAG_causal_async_stacks) { return NULL; @@ -2058,7 +1944,6 @@ DebuggerStackTrace* Debugger::CollectAsyncCausalStackTrace() { return stack_trace; } - DebuggerStackTrace* Debugger::CollectAwaiterReturnStackTrace() { if (!FLAG_async_debugger) { return NULL; @@ -2205,7 +2090,6 @@ DebuggerStackTrace* Debugger::CollectAwaiterReturnStackTrace() { return stack_trace; } - ActivationFrame* Debugger::TopDartFrame() const { StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames, Thread::Current(), @@ -2220,39 +2104,32 @@ ActivationFrame* Debugger::TopDartFrame() const { return activation; } - DebuggerStackTrace* Debugger::StackTrace() { return (stack_trace_ != NULL) ? stack_trace_ : CollectStackTrace(); } - DebuggerStackTrace* Debugger::CurrentStackTrace() { return CollectStackTrace(); } - DebuggerStackTrace* Debugger::AsyncCausalStackTrace() { return (async_causal_stack_trace_ != NULL) ? async_causal_stack_trace_ : CollectAsyncCausalStackTrace(); } - DebuggerStackTrace* Debugger::CurrentAsyncCausalStackTrace() { return CollectAsyncCausalStackTrace(); } - DebuggerStackTrace* Debugger::AwaiterStackTrace() { return (awaiter_stack_trace_ != NULL) ? awaiter_stack_trace_ : CollectAwaiterReturnStackTrace(); } - DebuggerStackTrace* Debugger::CurrentAwaiterStackTrace() { return CollectAwaiterReturnStackTrace(); } - DebuggerStackTrace* Debugger::StackTraceFrom(const class StackTrace& ex_trace) { DebuggerStackTrace* stack_trace = new DebuggerStackTrace(8); Function& function = Function::Handle(); @@ -2305,7 +2182,6 @@ DebuggerStackTrace* Debugger::StackTraceFrom(const class StackTrace& ex_trace) { return stack_trace; } - void Debugger::SetExceptionPauseInfo(Dart_ExceptionPauseInfo pause_info) { ASSERT((pause_info == kNoPauseOnExceptions) || (pause_info == kPauseOnUnhandledExceptions) || @@ -2313,12 +2189,10 @@ void Debugger::SetExceptionPauseInfo(Dart_ExceptionPauseInfo pause_info) { exc_pause_info_ = pause_info; } - Dart_ExceptionPauseInfo Debugger::GetExceptionPauseInfo() const { return exc_pause_info_; } - bool Debugger::ShouldPauseOnException(DebuggerStackTrace* stack_trace, const Instance& exception) { if (exc_pause_info_ == kNoPauseOnExceptions) { @@ -2340,7 +2214,6 @@ bool Debugger::ShouldPauseOnException(DebuggerStackTrace* stack_trace, return false; } - void Debugger::PauseException(const Instance& exc) { if (FLAG_stress_async_stacks) { CollectAwaiterReturnStackTrace(); @@ -2376,7 +2249,6 @@ void Debugger::PauseException(const Instance& exc) { ClearCachedStackTraces(); } - static TokenPosition LastTokenOnLine(Zone* zone, const TokenStream& tokens, TokenPosition pos) { @@ -2392,7 +2264,6 @@ static TokenPosition LastTokenOnLine(Zone* zone, return last_pos; } - // Returns the best fit token position for a breakpoint. // // Takes a range of tokens [requested_token_pos, last_token_pos] and @@ -2575,7 +2446,6 @@ TokenPosition Debugger::ResolveBreakpointPos(const Function& func, return TokenPosition::kNoSource; } - void Debugger::MakeCodeBreakpointAt(const Function& func, BreakpointLocation* loc) { ASSERT(loc->token_pos_.IsReal()); @@ -2614,7 +2484,6 @@ void Debugger::MakeCodeBreakpointAt(const Function& func, } } - void Debugger::FindCompiledFunctions(const Script& script, TokenPosition start_pos, TokenPosition end_pos, @@ -2687,7 +2556,6 @@ void Debugger::FindCompiledFunctions(const Script& script, } } - static void SelectBestFit(Function* best_fit, Function* func) { if (best_fit->IsNull()) { *best_fit = func->raw(); @@ -2699,7 +2567,6 @@ static void SelectBestFit(Function* best_fit, Function* func) { } } - // Returns true if a best fit is found. A best fit can either be a function // or a field. If it is a function, then the best fit function is returned // in |best_fit|. If a best fit is a field, it means that a latent @@ -2807,7 +2674,6 @@ bool Debugger::FindBestFit(const Script& script, return false; } - BreakpointLocation* Debugger::SetBreakpoint(const Script& script, TokenPosition token_pos, TokenPosition last_token_pos, @@ -2896,7 +2762,6 @@ BreakpointLocation* Debugger::SetBreakpoint(const Script& script, return bpt; } - // Synchronize the enabled/disabled state of all code breakpoints // associated with the breakpoint location loc. void Debugger::SyncBreakpointLocation(BreakpointLocation* loc) { @@ -2915,7 +2780,6 @@ void Debugger::SyncBreakpointLocation(BreakpointLocation* loc) { } } - RawError* Debugger::OneTimeBreakAtEntry(const Function& target_function) { LongJumpScope jump; if (setjmp(*jump.Set()) == 0) { @@ -2926,7 +2790,6 @@ RawError* Debugger::OneTimeBreakAtEntry(const Function& target_function) { } } - Breakpoint* Debugger::SetBreakpointAtEntry(const Function& target_function, bool single_shot) { ASSERT(!target_function.IsNull()); @@ -2944,7 +2807,6 @@ Breakpoint* Debugger::SetBreakpointAtEntry(const Function& target_function, } } - Breakpoint* Debugger::SetBreakpointAtActivation(const Instance& closure, bool for_over_await) { if (!closure.IsClosure()) { @@ -2957,7 +2819,6 @@ Breakpoint* Debugger::SetBreakpointAtActivation(const Instance& closure, return bpt_location->AddPerClosure(this, closure, for_over_await); } - Breakpoint* Debugger::BreakpointAtActivation(const Instance& closure) { if (!closure.IsClosure()) { return NULL; @@ -2980,7 +2841,6 @@ Breakpoint* Debugger::BreakpointAtActivation(const Instance& closure) { return NULL; } - Breakpoint* Debugger::SetBreakpointAtLine(const String& script_url, intptr_t line_number) { // Prevent future tests from calling this function in the wrong @@ -2996,7 +2856,6 @@ Breakpoint* Debugger::SetBreakpointAtLine(const String& script_url, return NULL; } - Breakpoint* Debugger::SetBreakpointAtLineCol(const String& script_url, intptr_t line_number, intptr_t column_number) { @@ -3013,7 +2872,6 @@ Breakpoint* Debugger::SetBreakpointAtLineCol(const String& script_url, return NULL; } - BreakpointLocation* Debugger::BreakpointLocationAtLineCol( const String& script_url, intptr_t line_number, @@ -3084,19 +2942,16 @@ BreakpointLocation* Debugger::BreakpointLocationAtLineCol( return bpt; } - intptr_t Debugger::CacheObject(const Object& obj) { ASSERT(obj_cache_ != NULL); return obj_cache_->AddObject(obj); } - bool Debugger::IsValidObjectId(intptr_t obj_id) { ASSERT(obj_cache_ != NULL); return obj_cache_->IsValidId(obj_id); } - RawObject* Debugger::GetCachedObject(intptr_t obj_id) { ASSERT(obj_cache_ != NULL); return obj_cache_->GetObj(obj_id); @@ -3127,7 +2982,6 @@ RawObject* Debugger::GetInstanceField(const Class& cls, return result.raw(); } - RawObject* Debugger::GetStaticField(const Class& cls, const String& field_name) { const Field& fld = @@ -3162,7 +3016,6 @@ RawObject* Debugger::GetStaticField(const Class& cls, return result.raw(); } - RawArray* Debugger::GetInstanceFields(const Instance& obj) { Class& cls = Class::Handle(obj.clazz()); Array& fields = Array::Handle(); @@ -3188,7 +3041,6 @@ RawArray* Debugger::GetInstanceFields(const Instance& obj) { return Array::MakeFixedLength(field_list); } - RawArray* Debugger::GetStaticFields(const Class& cls) { const GrowableObjectArray& field_list = GrowableObjectArray::Handle(GrowableObjectArray::New(8)); @@ -3208,7 +3060,6 @@ RawArray* Debugger::GetStaticFields(const Class& cls) { return Array::MakeFixedLength(field_list); } - void Debugger::CollectLibraryFields(const GrowableObjectArray& field_list, const Library& lib, const String& prefix, @@ -3247,7 +3098,6 @@ void Debugger::CollectLibraryFields(const GrowableObjectArray& field_list, } } - RawArray* Debugger::GetLibraryFields(const Library& lib) { Zone* zone = Thread::Current()->zone(); const GrowableObjectArray& field_list = @@ -3256,7 +3106,6 @@ RawArray* Debugger::GetLibraryFields(const Library& lib) { return Array::MakeFixedLength(field_list); } - RawArray* Debugger::GetGlobalFields(const Library& lib) { Zone* zone = Thread::Current()->zone(); const GrowableObjectArray& field_list = @@ -3285,7 +3134,6 @@ RawArray* Debugger::GetGlobalFields(const Library& lib) { return Array::MakeFixedLength(field_list); } - // static void Debugger::VisitObjectPointers(ObjectPointerVisitor* visitor) { ASSERT(visitor != NULL); @@ -3307,13 +3155,11 @@ void Debugger::VisitObjectPointers(ObjectPointerVisitor* visitor) { visitor->VisitPointer(reinterpret_cast(&top_frame_awaiter_)); } - // static void Debugger::SetEventHandler(EventHandler* handler) { event_handler_ = handler; } - void Debugger::Pause(ServiceEvent* event) { ASSERT(event->IsPause()); // Should call InvokeEventHandler instead. ASSERT(!ignore_breakpoints_); // We shouldn't get here when ignoring bpts. @@ -3366,25 +3212,21 @@ void Debugger::Pause(ServiceEvent* event) { obj_cache_ = NULL; // Zone allocated } - void Debugger::EnterSingleStepMode() { ResetSteppingFramePointers(); DeoptimizeWorld(); isolate_->set_single_step(true); } - void Debugger::ResetSteppingFramePointers() { stepping_fp_ = 0; async_stepping_fp_ = 0; } - bool Debugger::SteppedForSyntheticAsyncBreakpoint() const { return synthetic_async_breakpoint_ != NULL; } - void Debugger::CleanupSyntheticAsyncBreakpoint() { if (synthetic_async_breakpoint_ != NULL) { RemoveBreakpoint(synthetic_async_breakpoint_->id()); @@ -3392,7 +3234,6 @@ void Debugger::CleanupSyntheticAsyncBreakpoint() { } } - void Debugger::RememberTopFrameAwaiter() { if (!FLAG_async_debugger) { return; @@ -3404,7 +3245,6 @@ void Debugger::RememberTopFrameAwaiter() { } } - void Debugger::SetAsyncSteppingFramePointer() { if (!FLAG_async_debugger) { return; @@ -3417,7 +3257,6 @@ void Debugger::SetAsyncSteppingFramePointer() { } } - void Debugger::HandleSteppingRequest(DebuggerStackTrace* stack_trace, bool skip_next_step) { ResetSteppingFramePointers(); @@ -3495,7 +3334,6 @@ void Debugger::HandleSteppingRequest(DebuggerStackTrace* stack_trace, } } - void Debugger::CacheStackTraces(DebuggerStackTrace* stack_trace, DebuggerStackTrace* async_causal_stack_trace, DebuggerStackTrace* awaiter_stack_trace) { @@ -3507,14 +3345,12 @@ void Debugger::CacheStackTraces(DebuggerStackTrace* stack_trace, awaiter_stack_trace_ = awaiter_stack_trace; } - void Debugger::ClearCachedStackTraces() { stack_trace_ = NULL; async_causal_stack_trace_ = NULL; awaiter_stack_trace_ = NULL; } - static intptr_t FindNextRewindFrameIndex(DebuggerStackTrace* stack, intptr_t frame_index) { for (intptr_t i = frame_index + 1; i < stack->Length(); i++) { @@ -3526,7 +3362,6 @@ static intptr_t FindNextRewindFrameIndex(DebuggerStackTrace* stack, return -1; } - // Can the top frame be rewound? bool Debugger::CanRewindFrame(intptr_t frame_index, const char** error) const { // check rewind pc is found @@ -3568,7 +3403,6 @@ bool Debugger::CanRewindFrame(intptr_t frame_index, const char** error) const { return true; } - // Given a return address pc, find the "rewind" pc, which is the pc // before the corresponding call. static uword LookupRewindPc(const Code& code, uword pc) { @@ -3596,7 +3430,6 @@ static uword LookupRewindPc(const Code& code, uword pc) { return 0; } - void Debugger::RewindToFrame(intptr_t frame_index) { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -3641,7 +3474,6 @@ void Debugger::RewindToFrame(intptr_t frame_index) { UNIMPLEMENTED(); } - void Debugger::RewindToUnoptimizedFrame(StackFrame* frame, const Code& code) { // We will be jumping out of the debugger rather than exiting this // function, so prepare the debugger state. @@ -3669,7 +3501,6 @@ void Debugger::RewindToUnoptimizedFrame(StackFrame* frame, const Code& code) { UNREACHABLE(); } - void Debugger::RewindToOptimizedFrame(StackFrame* frame, const Code& optimized_code, intptr_t sub_index) { @@ -3699,7 +3530,6 @@ void Debugger::RewindToOptimizedFrame(StackFrame* frame, UNREACHABLE(); } - void Debugger::RewindPostDeopt() { intptr_t rewind_frame = post_deopt_frame_index_; post_deopt_frame_index_ = -1; @@ -3742,7 +3572,6 @@ void Debugger::RewindPostDeopt() { } } - // static bool Debugger::IsDebuggable(const Function& func) { if (!func.is_debuggable()) { @@ -3753,7 +3582,6 @@ bool Debugger::IsDebuggable(const Function& func) { return lib.IsDebuggable(); } - void Debugger::SignalPausedEvent(ActivationFrame* top_frame, Breakpoint* bpt) { resume_action_ = kContinue; ResetSteppingFramePointers(); @@ -3772,7 +3600,6 @@ void Debugger::SignalPausedEvent(ActivationFrame* top_frame, Breakpoint* bpt) { Pause(&event); } - bool Debugger::IsAtAsyncJump(ActivationFrame* top_frame) { Zone* zone = Thread::Current()->zone(); Object& closure_or_null = @@ -3877,7 +3704,6 @@ RawError* Debugger::PauseStepping() { frame->TokenPos().ToCString()); } - CacheStackTraces(CollectStackTrace(), CollectAsyncCausalStackTrace(), CollectAwaiterReturnStackTrace()); if (SteppedForSyntheticAsyncBreakpoint()) { @@ -3893,7 +3719,6 @@ RawError* Debugger::PauseStepping() { return error.raw(); } - RawError* Debugger::PauseBreakpoint() { // We ignore this breakpoint when the VM is executing code invoked // by the debugger to evaluate variables values, or when we see a nested @@ -3966,7 +3791,6 @@ RawError* Debugger::PauseBreakpoint() { return error.raw(); } - Breakpoint* Debugger::FindHitBreakpoint(BreakpointLocation* location, ActivationFrame* top_frame) { if (location == NULL) { @@ -4011,7 +3835,6 @@ Breakpoint* Debugger::FindHitBreakpoint(BreakpointLocation* location, return NULL; } - void Debugger::PauseDeveloper(const String& msg) { // We ignore this breakpoint when the VM is executing code invoked // by the debugger to evaluate variables values, or when we see a nested @@ -4034,7 +3857,6 @@ void Debugger::PauseDeveloper(const String& msg) { ClearCachedStackTraces(); } - void Debugger::Initialize(Isolate* isolate) { if (initialized_) { return; @@ -4048,7 +3870,6 @@ void Debugger::Initialize(Isolate* isolate) { initialized_ = true; } - void Debugger::NotifyIsolateCreated() { if (NeedsIsolateEvents()) { ServiceEvent event(isolate_, ServiceEvent::kIsolateStart); @@ -4056,7 +3877,6 @@ void Debugger::NotifyIsolateCreated() { } } - // Return innermost closure contained in 'function' that contains // the given token position. RawFunction* Debugger::FindInnermostClosure(const Function& function, @@ -4081,7 +3901,6 @@ RawFunction* Debugger::FindInnermostClosure(const Function& function, return best_fit.raw(); } - void Debugger::NotifyCompilation(const Function& func) { if (breakpoint_locations_ == NULL) { // Return with minimal overhead if there are no breakpoints. @@ -4174,7 +3993,6 @@ void Debugger::NotifyCompilation(const Function& func) { } } - void Debugger::NotifyDoneLoading() { if (latent_locations_ == NULL) { // Common, fast path. @@ -4290,7 +4108,6 @@ void Debugger::NotifyDoneLoading() { } } - // TODO(hausner): Could potentially make this faster by checking // whether the call target at pc is a debugger stub. bool Debugger::HasActiveBreakpoint(uword pc) { @@ -4298,7 +4115,6 @@ bool Debugger::HasActiveBreakpoint(uword pc) { return (bpt != NULL) && (bpt->IsEnabled()); } - CodeBreakpoint* Debugger::GetCodeBreakpoint(uword breakpoint_address) { CodeBreakpoint* bpt = code_breakpoints_; while (bpt != NULL) { @@ -4310,7 +4126,6 @@ CodeBreakpoint* Debugger::GetCodeBreakpoint(uword breakpoint_address) { return NULL; } - RawCode* Debugger::GetPatchedStubAddress(uword breakpoint_address) { CodeBreakpoint* bpt = GetCodeBreakpoint(breakpoint_address); if (bpt != NULL) { @@ -4320,7 +4135,6 @@ RawCode* Debugger::GetPatchedStubAddress(uword breakpoint_address) { return Code::null(); } - // Remove and delete the source breakpoint bpt and its associated // code breakpoints. void Debugger::RemoveBreakpoint(intptr_t bp_id) { @@ -4330,7 +4144,6 @@ void Debugger::RemoveBreakpoint(intptr_t bp_id) { RemoveBreakpointFromTheList(bp_id, &latent_locations_); } - // Remove and delete the source breakpoint bpt and its associated // code breakpoints. Returns true, if breakpoint was found and removed, // returns false, if breakpoint was not found. @@ -4400,7 +4213,6 @@ bool Debugger::RemoveBreakpointFromTheList(intptr_t bp_id, return false; } - // Unlink code breakpoints from the given breakpoint location. // They will later be deleted when control returns from the pause event // callback. Also, disable the breakpoint so it no longer fires if it @@ -4418,7 +4230,6 @@ void Debugger::UnlinkCodeBreakpoints(BreakpointLocation* bpt_location) { } } - // Remove and delete unlinked code breakpoints, i.e. breakpoints that // are not associated with a breakpoint location. void Debugger::RemoveUnlinkedCodeBreakpoints() { @@ -4443,7 +4254,6 @@ void Debugger::RemoveUnlinkedCodeBreakpoints() { needs_breakpoint_cleanup_ = false; } - BreakpointLocation* Debugger::GetBreakpointLocation(const Script& script, TokenPosition token_pos, intptr_t requested_column) { @@ -4458,7 +4268,6 @@ BreakpointLocation* Debugger::GetBreakpointLocation(const Script& script, return NULL; } - Breakpoint* Debugger::GetBreakpointById(intptr_t id) { Breakpoint* bpt = GetBreakpointByIdInTheList(id, breakpoint_locations_); if (bpt != NULL) { @@ -4467,7 +4276,6 @@ Breakpoint* Debugger::GetBreakpointById(intptr_t id) { return GetBreakpointByIdInTheList(id, latent_locations_); } - Breakpoint* Debugger::GetBreakpointByIdInTheList(intptr_t id, BreakpointLocation* list) { BreakpointLocation* loc = list; @@ -4484,7 +4292,6 @@ Breakpoint* Debugger::GetBreakpointByIdInTheList(intptr_t id, return NULL; } - void Debugger::MaybeAsyncStepInto(const Closure& async_op) { if (FLAG_async_debugger && IsSingleStepping()) { // We are single stepping, set a breakpoint on the closure activation @@ -4493,13 +4300,11 @@ void Debugger::MaybeAsyncStepInto(const Closure& async_op) { } } - void Debugger::AsyncStepInto(const Closure& async_op) { SetBreakpointAtActivation(async_op, true); Continue(); } - void Debugger::Continue() { SetResumeAction(kContinue); stepping_fp_ = 0; @@ -4507,7 +4312,6 @@ void Debugger::Continue() { isolate_->set_single_step(false); } - BreakpointLocation* Debugger::GetLatentBreakpoint(const String& url, intptr_t line, intptr_t column) { @@ -4528,14 +4332,12 @@ BreakpointLocation* Debugger::GetLatentBreakpoint(const String& url, return bpt; } - void Debugger::RegisterBreakpointLocation(BreakpointLocation* bpt) { ASSERT(bpt->next() == NULL); bpt->set_next(breakpoint_locations_); breakpoint_locations_ = bpt; } - void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { ASSERT(bpt->next() == NULL); bpt->set_next(code_breakpoints_); diff --git a/runtime/vm/debugger.h b/runtime/vm/debugger.h index e1b23926585..665a3ef3821 100644 --- a/runtime/vm/debugger.h +++ b/runtime/vm/debugger.h @@ -22,7 +22,6 @@ DECLARE_FLAG(bool, verbose_debug); if (FLAG_verbose_debug) Log::Current()->Print(format, ##__VA_ARGS__) #endif - namespace dart { class CodeBreakpoint; @@ -103,7 +102,6 @@ class Breakpoint { DISALLOW_COPY_AND_ASSIGN(Breakpoint); }; - // BreakpointLocation represents a collection of breakpoint conditions at the // same token position in Dart source. There may be more than one CodeBreakpoint // object per BreakpointLocation. @@ -189,7 +187,6 @@ class BreakpointLocation { DISALLOW_COPY_AND_ASSIGN(BreakpointLocation); }; - // CodeBreakpoint represents a location in compiled code. There may be // more than one CodeBreakpoint for one BreakpointLocation, e.g. when a // function gets compiled as a regular function and as a closure. @@ -251,7 +248,6 @@ class CodeBreakpoint { DISALLOW_COPY_AND_ASSIGN(CodeBreakpoint); }; - // ActivationFrame represents one dart function activation frame // on the call stack. class ActivationFrame : public ZoneAllocated { @@ -420,7 +416,6 @@ class ActivationFrame : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(ActivationFrame); }; - // Array of function activations on the call stack. class DebuggerStackTrace : public ZoneAllocated { public: @@ -443,7 +438,6 @@ class DebuggerStackTrace : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(DebuggerStackTrace); }; - class Debugger { public: enum ResumeAction { @@ -718,7 +712,6 @@ class Debugger { DebuggerStackTrace* awaiter_stack_trace); void ClearCachedStackTraces(); - // Can we rewind to the indicated frame? bool CanRewindFrame(intptr_t frame_index, const char** error) const; @@ -798,7 +791,6 @@ class Debugger { DISALLOW_COPY_AND_ASSIGN(Debugger); }; - } // namespace dart #endif // RUNTIME_VM_DEBUGGER_H_ diff --git a/runtime/vm/debugger_api_impl.cc b/runtime/vm/debugger_api_impl.cc index 85a6a59a9a0..66ff8a019ea 100644 --- a/runtime/vm/debugger_api_impl.cc +++ b/runtime/vm/debugger_api_impl.cc @@ -36,7 +36,6 @@ namespace dart { var ^= tmp.raw(); \ } while (0) - #define CHECK_AND_CAST(type, var, param) \ type* var = NULL; \ do { \ @@ -47,7 +46,6 @@ namespace dart { var = reinterpret_cast(param); \ } while (0) - #define CHECK_NOT_NULL(param) \ if (param == NULL) { \ return Api::NewError("%s expects argument '%s' to be non-null.", \ @@ -59,7 +57,6 @@ namespace dart { return Api::NewError("%s requires debugger support.", CURRENT_FUNC); \ } - DART_EXPORT intptr_t Dart_CacheObject(Dart_Handle object_in) { DARTSCOPE(Thread::Current()); Isolate* I = T->isolate(); @@ -70,7 +67,6 @@ DART_EXPORT intptr_t Dart_CacheObject(Dart_Handle object_in) { return I->debugger()->CacheObject(obj); } - DART_EXPORT Dart_Handle Dart_GetCachedObject(intptr_t obj_id) { DARTSCOPE(Thread::Current()); Isolate* I = T->isolate(); @@ -82,7 +78,6 @@ DART_EXPORT Dart_Handle Dart_GetCachedObject(intptr_t obj_id) { return Api::NewHandle(T, I->debugger()->GetCachedObject(obj_id)); } - DART_EXPORT Dart_Handle Dart_StackTraceLength(Dart_StackTrace trace, intptr_t* length) { DARTSCOPE(Thread::Current()); @@ -92,7 +87,6 @@ DART_EXPORT Dart_Handle Dart_StackTraceLength(Dart_StackTrace trace, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_GetActivationFrame(Dart_StackTrace trace, int frame_index, Dart_ActivationFrame* frame) { @@ -113,7 +107,6 @@ static Dart_BreakpointResolvedHandler* bp_resolved_handler = NULL; static Dart_ExceptionThrownHandler* exc_thrown_handler = NULL; static Dart_IsolateEventHandler* isolate_event_handler = NULL; - static void DebuggerEventHandler(ServiceEvent* event) { Thread* thread = Thread::Current(); Isolate* isolate = thread->isolate(); @@ -181,33 +174,28 @@ static void DebuggerEventHandler(ServiceEvent* event) { Dart_ExitScope(); } - DART_EXPORT void Dart_SetPausedEventHandler(Dart_PausedEventHandler handler) { paused_event_handler = handler; Debugger::SetEventHandler(DebuggerEventHandler); } - DART_EXPORT void Dart_SetBreakpointResolvedHandler( Dart_BreakpointResolvedHandler handler) { bp_resolved_handler = handler; Debugger::SetEventHandler(DebuggerEventHandler); } - DART_EXPORT void Dart_SetExceptionThrownHandler( Dart_ExceptionThrownHandler handler) { exc_thrown_handler = handler; Debugger::SetEventHandler(DebuggerEventHandler); } - DART_EXPORT void Dart_SetIsolateEventHandler(Dart_IsolateEventHandler handler) { isolate_event_handler = handler; Debugger::SetEventHandler(DebuggerEventHandler); } - DART_EXPORT Dart_Handle Dart_SetExceptionPauseInfo(Dart_ExceptionPauseInfo pause_info) { DARTSCOPE(Thread::Current()); @@ -217,7 +205,6 @@ Dart_SetExceptionPauseInfo(Dart_ExceptionPauseInfo pause_info) { return Api::Success(); } - DART_EXPORT Dart_ExceptionPauseInfo Dart_GetExceptionPauseInfo() { DARTSCOPE(Thread::Current()); Isolate* I = T->isolate(); @@ -227,7 +214,6 @@ DART_EXPORT Dart_ExceptionPauseInfo Dart_GetExceptionPauseInfo() { return I->debugger()->GetExceptionPauseInfo(); } - DART_EXPORT Dart_Handle Dart_GetStackTrace(Dart_StackTrace* trace) { DARTSCOPE(Thread::Current()); Isolate* I = T->isolate(); @@ -238,7 +224,6 @@ DART_EXPORT Dart_Handle Dart_GetStackTrace(Dart_StackTrace* trace) { return Api::Success(); } - DART_EXPORT Dart_Handle Dart_GetStackTraceFromError(Dart_Handle handle, Dart_StackTrace* trace) { DARTSCOPE(Thread::Current()); @@ -264,7 +249,6 @@ DART_EXPORT Dart_Handle Dart_GetStackTraceFromError(Dart_Handle handle, } } - DART_EXPORT Dart_Handle Dart_ActivationFrameInfo(Dart_ActivationFrame activation_frame, Dart_Handle* function_name, @@ -288,7 +272,6 @@ Dart_ActivationFrameInfo(Dart_ActivationFrame activation_frame, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_ActivationFrameGetLocation(Dart_ActivationFrame activation_frame, Dart_Handle* function_name, @@ -326,7 +309,6 @@ Dart_ActivationFrameGetFramePointer(Dart_ActivationFrame activation_frame, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_GetFunctionOrigin(Dart_Handle function_in) { DARTSCOPE(Thread::Current()); UNWRAP_AND_CHECK_PARAM(Function, function, function_in); @@ -338,7 +320,6 @@ DART_EXPORT Dart_Handle Dart_GetFunctionOrigin(Dart_Handle function_in) { return Api::Null(); } - DART_EXPORT Dart_Handle Dart_GetLocalVariables(Dart_ActivationFrame activation_frame) { DARTSCOPE(Thread::Current()); @@ -346,7 +327,6 @@ Dart_GetLocalVariables(Dart_ActivationFrame activation_frame) { return Api::NewHandle(T, frame->GetLocalVariables()); } - DART_EXPORT Dart_Handle Dart_SetBreakpoint(Dart_Handle script_url_in, intptr_t line_number) { DARTSCOPE(Thread::Current()); @@ -363,7 +343,6 @@ DART_EXPORT Dart_Handle Dart_SetBreakpoint(Dart_Handle script_url_in, return Dart_NewInteger(bpt->id()); } - DART_EXPORT Dart_Handle Dart_GetBreakpointURL(intptr_t bp_id) { DARTSCOPE(Thread::Current()); Isolate* I = T->isolate(); @@ -378,7 +357,6 @@ DART_EXPORT Dart_Handle Dart_GetBreakpointURL(intptr_t bp_id) { return Api::NewHandle(T, bpt->bpt_location()->url()); } - DART_EXPORT Dart_Handle Dart_GetBreakpointLine(intptr_t bp_id) { DARTSCOPE(Thread::Current()); Isolate* I = T->isolate(); @@ -397,7 +375,6 @@ DART_EXPORT Dart_Handle Dart_GetBreakpointLine(intptr_t bp_id) { } } - DART_EXPORT Dart_Handle Dart_SetBreakpointAtEntry(Dart_Handle library_in, Dart_Handle class_name_in, @@ -435,7 +412,6 @@ Dart_SetBreakpointAtEntry(Dart_Handle library_in, return Dart_NewInteger(bpt->id()); } - DART_EXPORT Dart_Handle Dart_OneTimeBreakAtEntry(Dart_Handle library_in, Dart_Handle class_name_in, Dart_Handle function_name_in) { @@ -471,7 +447,6 @@ DART_EXPORT Dart_Handle Dart_OneTimeBreakAtEntry(Dart_Handle library_in, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_RemoveBreakpoint(intptr_t bp_id) { DARTSCOPE(Thread::Current()); Isolate* I = T->isolate(); @@ -480,7 +455,6 @@ DART_EXPORT Dart_Handle Dart_RemoveBreakpoint(intptr_t bp_id) { return Api::Success(); } - DART_EXPORT Dart_Handle Dart_SetStepOver() { DARTSCOPE(Thread::Current()); Isolate* I = T->isolate(); @@ -489,7 +463,6 @@ DART_EXPORT Dart_Handle Dart_SetStepOver() { return Api::Success(); } - DART_EXPORT Dart_Handle Dart_SetStepInto() { DARTSCOPE(Thread::Current()); Isolate* I = T->isolate(); @@ -498,7 +471,6 @@ DART_EXPORT Dart_Handle Dart_SetStepInto() { return Api::Success(); } - DART_EXPORT Dart_Handle Dart_SetStepOut() { DARTSCOPE(Thread::Current()); Isolate* I = T->isolate(); @@ -507,7 +479,6 @@ DART_EXPORT Dart_Handle Dart_SetStepOut() { return Api::Success(); } - DART_EXPORT Dart_Handle Dart_GetInstanceFields(Dart_Handle object_in) { DARTSCOPE(Thread::Current()); Isolate* I = T->isolate(); @@ -516,7 +487,6 @@ DART_EXPORT Dart_Handle Dart_GetInstanceFields(Dart_Handle object_in) { return Api::NewHandle(T, I->debugger()->GetInstanceFields(obj)); } - DART_EXPORT Dart_Handle Dart_GetStaticFields(Dart_Handle target) { DARTSCOPE(Thread::Current()); Isolate* I = T->isolate(); @@ -530,7 +500,6 @@ DART_EXPORT Dart_Handle Dart_GetStaticFields(Dart_Handle target) { return Api::NewHandle(T, I->debugger()->GetStaticFields(cls)); } - DART_EXPORT Dart_Handle Dart_GetLibraryFields(intptr_t library_id) { DARTSCOPE(Thread::Current()); Isolate* I = T->isolate(); @@ -543,7 +512,6 @@ DART_EXPORT Dart_Handle Dart_GetLibraryFields(intptr_t library_id) { return Api::NewHandle(T, I->debugger()->GetLibraryFields(lib)); } - DART_EXPORT Dart_Handle Dart_GetGlobalVariables(intptr_t library_id) { DARTSCOPE(Thread::Current()); Isolate* I = T->isolate(); @@ -557,7 +525,6 @@ DART_EXPORT Dart_Handle Dart_GetGlobalVariables(intptr_t library_id) { return Api::NewHandle(T, I->debugger()->GetGlobalFields(lib)); } - DART_EXPORT Dart_Handle Dart_ActivationFrameEvaluate(Dart_ActivationFrame activation_frame, Dart_Handle expr_in) { @@ -572,7 +539,6 @@ Dart_ActivationFrameEvaluate(Dart_ActivationFrame activation_frame, return Api::NewHandle(T, frame->Evaluate(expr, names, values)); } - DART_EXPORT Dart_Handle Dart_EvaluateExpr(Dart_Handle target_in, Dart_Handle expr_in) { DARTSCOPE(Thread::Current()); @@ -608,14 +574,12 @@ DART_EXPORT Dart_Handle Dart_EvaluateExpr(Dart_Handle target_in, return Api::NewError("%s: unsupported target type", CURRENT_FUNC); } - DART_EXPORT Dart_Handle Dart_GetObjClass(Dart_Handle object_in) { DARTSCOPE(Thread::Current()); UNWRAP_AND_CHECK_PARAM(Instance, obj, object_in); return Api::NewHandle(T, obj.GetType(Heap::kNew)); } - DART_EXPORT Dart_Handle Dart_GetObjClassId(Dart_Handle object_in, intptr_t* class_id) { DARTSCOPE(Thread::Current()); @@ -625,7 +589,6 @@ DART_EXPORT Dart_Handle Dart_GetObjClassId(Dart_Handle object_in, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_GetClassFromId(intptr_t class_id) { DARTSCOPE(Thread::Current()); Isolate* I = T->isolate(); @@ -636,7 +599,6 @@ DART_EXPORT Dart_Handle Dart_GetClassFromId(intptr_t class_id) { return Api::NewHandle(T, I->class_table()->At(class_id)); } - DART_EXPORT Dart_Handle Dart_GetSupertype(Dart_Handle type_in) { DARTSCOPE(Thread::Current()); @@ -682,7 +644,6 @@ DART_EXPORT Dart_Handle Dart_GetSupertype(Dart_Handle type_in) { return Api::NewHandle(T, instantiated_type.Canonicalize()); } - DART_EXPORT Dart_Handle Dart_GetClosureInfo(Dart_Handle closure, Dart_Handle* name, Dart_Handle* signature, @@ -724,7 +685,6 @@ DART_EXPORT Dart_Handle Dart_GetClosureInfo(Dart_Handle closure, return Api::True(); } - DART_EXPORT Dart_Handle Dart_GetClassInfo(intptr_t cls_id, Dart_Handle* class_name, intptr_t* library_id, @@ -758,7 +718,6 @@ DART_EXPORT Dart_Handle Dart_GetClassInfo(intptr_t cls_id, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_ScriptGetSource(intptr_t library_id, Dart_Handle script_url_in) { DARTSCOPE(Thread::Current()); @@ -777,7 +736,6 @@ DART_EXPORT Dart_Handle Dart_ScriptGetSource(intptr_t library_id, return Api::NewHandle(T, script.Source()); } - DART_EXPORT Dart_Handle Dart_ScriptGetTokenInfo(intptr_t library_id, Dart_Handle script_url_in) { DARTSCOPE(Thread::Current()); @@ -799,7 +757,6 @@ DART_EXPORT Dart_Handle Dart_ScriptGetTokenInfo(intptr_t library_id, return Api::NewHandle(T, Array::MakeFixedLength(info)); } - DART_EXPORT Dart_Handle Dart_GenerateScriptSource(Dart_Handle library_url_in, Dart_Handle script_url_in) { DARTSCOPE(Thread::Current()); @@ -823,7 +780,6 @@ DART_EXPORT Dart_Handle Dart_GenerateScriptSource(Dart_Handle library_url_in, return Api::NewHandle(T, script.GenerateSource()); } - DART_EXPORT Dart_Handle Dart_GetScriptURLs(Dart_Handle library_url_in) { DARTSCOPE(Thread::Current()); UNWRAP_AND_CHECK_PARAM(String, library_url, library_url_in); @@ -848,7 +804,6 @@ DART_EXPORT Dart_Handle Dart_GetScriptURLs(Dart_Handle library_url_in) { return Api::NewHandle(T, script_list.raw()); } - DART_EXPORT Dart_Handle Dart_GetLibraryIds() { DARTSCOPE(Thread::Current()); Isolate* I = T->isolate(); @@ -869,7 +824,6 @@ DART_EXPORT Dart_Handle Dart_GetLibraryIds() { return Api::NewHandle(T, library_id_list.raw()); } - DART_EXPORT Dart_Handle Dart_GetLibraryFromId(intptr_t library_id) { DARTSCOPE(Thread::Current()); const Library& lib = Library::Handle(Z, Library::GetLibrary(library_id)); @@ -880,7 +834,6 @@ DART_EXPORT Dart_Handle Dart_GetLibraryFromId(intptr_t library_id) { return Api::NewHandle(T, lib.raw()); } - DART_EXPORT Dart_Handle Dart_LibraryId(Dart_Handle library, intptr_t* library_id) { DARTSCOPE(Thread::Current()); @@ -895,7 +848,6 @@ DART_EXPORT Dart_Handle Dart_LibraryId(Dart_Handle library, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_GetLibraryImports(intptr_t library_id) { DARTSCOPE(Thread::Current()); const Library& lib = Library::Handle(Library::GetLibrary(library_id)); @@ -932,7 +884,6 @@ DART_EXPORT Dart_Handle Dart_GetLibraryImports(intptr_t library_id) { return Api::NewHandle(T, Array::MakeFixedLength(import_list)); } - DART_EXPORT Dart_Handle Dart_GetLibraryURL(intptr_t library_id) { DARTSCOPE(Thread::Current()); const Library& lib = Library::Handle(Z, Library::GetLibrary(library_id)); @@ -943,7 +894,6 @@ DART_EXPORT Dart_Handle Dart_GetLibraryURL(intptr_t library_id) { return Api::NewHandle(T, lib.url()); } - DART_EXPORT Dart_Handle Dart_GetLibraryDebuggable(intptr_t library_id, bool* is_debuggable) { DARTSCOPE(Thread::Current()); @@ -957,7 +907,6 @@ DART_EXPORT Dart_Handle Dart_GetLibraryDebuggable(intptr_t library_id, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_SetLibraryDebuggable(intptr_t library_id, bool is_debuggable) { DARTSCOPE(Thread::Current()); @@ -970,13 +919,11 @@ DART_EXPORT Dart_Handle Dart_SetLibraryDebuggable(intptr_t library_id, return Api::Success(); } - DART_EXPORT Dart_Isolate Dart_GetIsolate(Dart_IsolateId isolate_id) { Isolate* isolate = PortMap::GetIsolate(isolate_id); return Api::CastIsolate(isolate); } - DART_EXPORT Dart_IsolateId Dart_GetIsolateId(Dart_Isolate dart_isolate) { Isolate* isolate = reinterpret_cast(dart_isolate); if (isolate->debugger() == NULL) { diff --git a/runtime/vm/debugger_api_impl_test.cc b/runtime/vm/debugger_api_impl_test.cc index 24a339aeea2..e0685b8833c 100644 --- a/runtime/vm/debugger_api_impl_test.cc +++ b/runtime/vm/debugger_api_impl_test.cc @@ -26,7 +26,6 @@ static void LoadScript(const char* source) { EXPECT_VALID(script_lib); } - static void SetBreakpointAtEntry(const char* cname, const char* fname) { ASSERT(script_lib != NULL); ASSERT(!Dart_IsError(script_lib)); @@ -36,7 +35,6 @@ static void SetBreakpointAtEntry(const char* cname, const char* fname) { EXPECT(Dart_IsInteger(res)); } - static void DisableDebuggabilityOfDartColonLibraries() { const char* dart_colon = "dart:"; const intptr_t dart_colon_length = strlen(dart_colon); @@ -59,7 +57,6 @@ static void DisableDebuggabilityOfDartColonLibraries() { } } - static Dart_Handle Invoke(const char* func_name) { ASSERT(script_lib != NULL); ASSERT(!Dart_IsError(script_lib)); @@ -67,7 +64,6 @@ static Dart_Handle Invoke(const char* func_name) { return Dart_Invoke(script_lib, NewString(func_name), 0, NULL); } - static char const* ToCString(Dart_Handle str) { EXPECT(Dart_IsString(str)); char const* c_str = NULL; @@ -75,7 +71,6 @@ static char const* ToCString(Dart_Handle str) { return c_str; } - static int64_t ToInt64(Dart_Handle h) { EXPECT(Dart_IsInteger(h)); int64_t i = 0; @@ -84,7 +79,6 @@ static int64_t ToInt64(Dart_Handle h) { return i; } - static double ToDouble(Dart_Handle h) { EXPECT(Dart_IsDouble(h)); double d = 0.0; @@ -93,7 +87,6 @@ static double ToDouble(Dart_Handle h) { return d; } - static char const* BreakpointInfo(Dart_StackTrace trace) { static char info_str[128]; Dart_ActivationFrame frame; @@ -111,10 +104,8 @@ static char const* BreakpointInfo(Dart_StackTrace trace) { return info_str; } - static void PrintValue(Dart_Handle value, bool expand); - static void PrintObjectList(Dart_Handle list, const char* prefix, bool expand) { intptr_t list_length = 0; Dart_Handle retval = Dart_ListLength(list, &list_length); @@ -129,7 +120,6 @@ static void PrintObjectList(Dart_Handle list, const char* prefix, bool expand) { } } - static void PrintObject(Dart_Handle obj, bool expand) { Dart_Handle obj_class = Dart_GetObjClass(obj); EXPECT_VALID(obj_class); @@ -149,7 +139,6 @@ static void PrintObject(Dart_Handle obj, bool expand) { PrintObjectList(statics, "static field", false); } - static void PrintValue(Dart_Handle value, bool expand) { if (Dart_IsNull(value)) { OS::Print("null"); @@ -168,7 +157,6 @@ static void PrintValue(Dart_Handle value, bool expand) { } } - static void PrintActivationFrame(Dart_ActivationFrame frame) { Dart_Handle func_name; Dart_Handle res; @@ -195,7 +183,6 @@ static void PrintActivationFrame(Dart_ActivationFrame frame) { } } - static Dart_Handle GetLocalVariable(Dart_ActivationFrame frame, const char* name) { Dart_Handle locals = Dart_GetLocalVariables(frame); @@ -217,7 +204,6 @@ static Dart_Handle GetLocalVariable(Dart_ActivationFrame frame, return Dart_Null(); } - static void PrintStackTrace(Dart_StackTrace trace) { intptr_t trace_len; Dart_Handle res = Dart_StackTraceLength(trace, &trace_len); @@ -230,7 +216,6 @@ static void PrintStackTrace(Dart_StackTrace trace) { } } - static void VerifyListEquals(Dart_Handle expected, Dart_Handle got, bool skip_null_expects) { @@ -256,7 +241,6 @@ static void VerifyListEquals(Dart_Handle expected, } } - static void VerifyStackFrame(Dart_ActivationFrame frame, const char* expected_name, Dart_Handle expected_locals, @@ -285,7 +269,6 @@ static void VerifyStackFrame(Dart_ActivationFrame frame, } } - static void VerifyStackTrace(Dart_StackTrace trace, const char* func_names[], Dart_Handle local_vars[], @@ -321,7 +304,6 @@ static void VerifyStackTrace(Dart_StackTrace trace, } } - void TestBreakpointHandler(Dart_IsolateId isolate_id, intptr_t bp_id, const Dart_CodeLocation& location) { @@ -350,7 +332,6 @@ void TestBreakpointHandler(Dart_IsolateId isolate_id, } } - TEST_CASE(Debug_Breakpoint) { const char* kScriptChars = "void moo(s) { } \n" @@ -423,7 +404,6 @@ static void SaveStackTrace(Dart_StackTrace trace) { } } - static void InspectOptimizedStack_Breakpoint(Dart_IsolateId isolate_id, intptr_t bp_id, const Dart_CodeLocation& loc) { @@ -432,7 +412,6 @@ static void InspectOptimizedStack_Breakpoint(Dart_IsolateId isolate_id, SaveStackTrace(trace); } - static void InspectStackTest(bool optimize) { const char* kScriptChars = "void breakpointNow() {\n" @@ -515,19 +494,16 @@ static void InspectStackTest(bool optimize) { isolate->set_use_osr(saved_use_osr); } - TEST_CASE(Debug_InspectStack_NotOptimized) { InspectStackTest(false); } - TEST_CASE(Debug_InspectStack_Optimized) { // Ensure code gets optimized. FLAG_background_compilation = false; InspectStackTest(true); } - static void InspectStackWithClosureTest(bool optimize) { const char* kScriptChars = "void breakpointNow() {\n" @@ -615,19 +591,16 @@ static void InspectStackWithClosureTest(bool optimize) { FLAG_use_osr = saved_osr; } - TEST_CASE(Debug_InspectStackWithClosure_NotOptimized) { InspectStackWithClosureTest(false); } - TEST_CASE(Debug_InspectStackWithClosure_Optimized) { // Ensure code gets optimized. FLAG_background_compilation = false; InspectStackWithClosureTest(true); } - void TestStepOutHandler(Dart_IsolateId isolate_id, intptr_t bp_id, const Dart_CodeLocation& location) { @@ -659,7 +632,6 @@ void TestStepOutHandler(Dart_IsolateId isolate_id, Dart_SetStepOut(); } - TEST_CASE(Debug_StepOut) { const char* kScriptChars = "f1() { return 1; } \n" @@ -741,7 +713,6 @@ void TestStepIntoHandler(Dart_IsolateId isolate_id, Dart_SetStepInto(); } - TEST_CASE(Debug_StepInto) { const char* kScriptChars = "f1() { return 1; } \n" @@ -780,7 +751,6 @@ TEST_CASE(Debug_StepInto) { EXPECT(breakpoint_hit_counter == ARRAY_SIZE(step_into_expected_bpts)); } - static void StepIntoHandler(Dart_IsolateId isolate_id, intptr_t bp_id, const Dart_CodeLocation& location) { @@ -796,7 +766,6 @@ static void StepIntoHandler(Dart_IsolateId isolate_id, Dart_SetStepInto(); } - TEST_CASE(Debug_IgnoreBP) { const char* kScriptChars = "class B { \n" @@ -826,7 +795,6 @@ TEST_CASE(Debug_IgnoreBP) { EXPECT(breakpoint_hit == true); } - TEST_CASE(Debug_DeoptimizeFunction) { const char* kScriptChars = "foo(x) => 2 * x; \n" @@ -844,7 +812,6 @@ TEST_CASE(Debug_DeoptimizeFunction) { LoadScript(kScriptChars); Dart_SetPausedEventHandler(&StepIntoHandler); - // Cause function foo to be optimized before we set a BP. Dart_Handle res = Invoke("warmup"); EXPECT_VALID(res); @@ -852,7 +819,6 @@ TEST_CASE(Debug_DeoptimizeFunction) { // Now set breakpoint in main and then step into optimized function foo. SetBreakpointAtEntry("", "main"); - breakpoint_hit = false; breakpoint_hit_counter = 0; Dart_Handle retval = Invoke("main"); @@ -863,7 +829,6 @@ TEST_CASE(Debug_DeoptimizeFunction) { EXPECT(breakpoint_hit == true); } - void TestSingleStepHandler(Dart_IsolateId isolate_id, intptr_t bp_id, const Dart_CodeLocation& location) { @@ -896,7 +861,6 @@ void TestSingleStepHandler(Dart_IsolateId isolate_id, Dart_SetStepOver(); } - TEST_CASE(Debug_SingleStep) { const char* kScriptChars = "moo(s) { return 1; } \n" @@ -923,7 +887,6 @@ TEST_CASE(Debug_SingleStep) { EXPECT(breakpoint_hit == true); } - static void ClosureBreakpointHandler(Dart_IsolateId isolate_id, intptr_t bp_id, const Dart_CodeLocation& location) { @@ -951,7 +914,6 @@ static void ClosureBreakpointHandler(Dart_IsolateId isolate_id, } } - TEST_CASE(Debug_ClosureBreakpoint) { const char* kScriptChars = "callback(s) { \n" @@ -978,7 +940,6 @@ TEST_CASE(Debug_ClosureBreakpoint) { EXPECT_EQ(2, breakpoint_hit_counter); } - static void ExprClosureBreakpointHandler(Dart_IsolateId isolate_id, intptr_t bp_id, const Dart_CodeLocation& location) { @@ -996,7 +957,6 @@ static void ExprClosureBreakpointHandler(Dart_IsolateId isolate_id, VerifyStackTrace(trace, expected_trace, expected_locals, 2, false); } - TEST_CASE(Debug_ExprClosureBreakpoint) { const char* kScriptChars = "var c; \n" @@ -1025,7 +985,6 @@ TEST_CASE(Debug_ExprClosureBreakpoint) { EXPECT_EQ(1, breakpoint_hit_counter); } - void TestBreakpointHandlerWithVerify(Dart_IsolateId isolate_id, intptr_t bp_id, const Dart_CodeLocation& location) { @@ -1045,14 +1004,12 @@ void TestBreakpointHandlerWithVerify(Dart_IsolateId isolate_id, VerifyPointersVisitor::VerifyPointers(); } - static void NoopNativeFunction(Dart_NativeArguments args) { Dart_EnterScope(); Dart_SetReturnValue(args, Dart_True()); Dart_ExitScope(); } - static Dart_NativeFunction NoopNativeResolver(Dart_Handle name, int arg_count, bool* auto_setup_scope) { @@ -1061,7 +1018,6 @@ static Dart_NativeFunction NoopNativeResolver(Dart_Handle name, return &NoopNativeFunction; } - TEST_CASE(Debug_BreakpointStubPatching) { // Note changes to this script may require changes to the breakpoint line // numbers below. @@ -1112,7 +1068,6 @@ TEST_CASE(Debug_BreakpointStubPatching) { EXPECT_EQ(num_breakpoints, breakpoint_hit_counter); } - static intptr_t bp_id_to_be_deleted; static void DeleteBreakpointHandler(Dart_IsolateId isolate_id, @@ -1149,7 +1104,6 @@ static void DeleteBreakpointHandler(Dart_IsolateId isolate_id, } } - TEST_CASE(Debug_DeleteBreakpoint) { const char* kScriptChars = "moo(s) { } \n" @@ -1186,7 +1140,6 @@ TEST_CASE(Debug_DeleteBreakpoint) { EXPECT_EQ(2, breakpoint_hit_counter); } - static void InspectStaticFieldHandler(Dart_IsolateId isolate_id, intptr_t bp_id, const Dart_CodeLocation& location) { @@ -1243,7 +1196,6 @@ static void InspectStaticFieldHandler(Dart_IsolateId isolate_id, } } - TEST_CASE(Debug_InspectStaticField) { const char* kScriptChars = " class A { \n" @@ -1269,7 +1221,6 @@ TEST_CASE(Debug_InspectStaticField) { EXPECT_VALID(retval); } - TEST_CASE(Debug_InspectObject) { const char* kScriptChars = " class A { \n" @@ -1391,7 +1342,6 @@ TEST_CASE(Debug_InspectObject) { EXPECT(Dart_IsError(value_handle)); } - static Dart_IsolateId test_isolate_id = ILLEGAL_ISOLATE_ID; static int verify_callback = 0; static void TestIsolateID(Dart_IsolateId isolate_id, Dart_IsolateEvent kind) { @@ -1414,7 +1364,6 @@ static void TestIsolateID(Dart_IsolateId isolate_id, Dart_IsolateEvent kind) { } } - VM_UNIT_TEST_CASE(Debug_IsolateID) { const char* kScriptChars = "void moo(s) { } \n" @@ -1443,7 +1392,6 @@ VM_UNIT_TEST_CASE(Debug_IsolateID) { EXPECT(verify_callback == 0x5); // Only created and shutdown events. } - static Monitor* sync = NULL; static bool isolate_interrupted = false; static bool pause_event_handled = false; @@ -1451,7 +1399,6 @@ static bool interrupt_thread_stopped = false; static Dart_IsolateId interrupt_isolate_id = ILLEGAL_ISOLATE_ID; static volatile bool continue_isolate_loop = true; - static void InterruptIsolateHandler(Dart_IsolateId isolateId, intptr_t breakpointId, const Dart_CodeLocation& location) { @@ -1487,7 +1434,6 @@ static void TestInterruptIsolate(Dart_IsolateId isolate_id, } } - static void InterruptNativeFunction(Dart_NativeArguments args) { Dart_EnterScope(); Dart_Handle val = Dart_NewBoolean(continue_isolate_loop); @@ -1495,7 +1441,6 @@ static void InterruptNativeFunction(Dart_NativeArguments args) { Dart_ExitScope(); } - static Dart_NativeFunction InterruptNativeResolver(Dart_Handle name, int arg_count, bool* auto_setup_scope) { @@ -1504,7 +1449,6 @@ static Dart_NativeFunction InterruptNativeResolver(Dart_Handle name, return &InterruptNativeFunction; } - static void InterruptIsolateRun(uword unused) { const char* kScriptChars = "void moo(s) { } \n" @@ -1543,7 +1487,6 @@ static void InterruptIsolateRun(uword unused) { } } - TEST_CASE(Debug_InterruptIsolate) { bool saved_flag = FLAG_trace_shutdown; FLAG_trace_shutdown = true; @@ -1607,7 +1550,6 @@ TEST_CASE(Debug_InterruptIsolate) { FLAG_trace_shutdown = saved_flag; } - static void StackTraceDump1BreakpointHandler( Dart_IsolateId isolate_id, intptr_t bp_id, @@ -1694,7 +1636,6 @@ static void StackTraceDump1BreakpointHandler( true); } - TEST_CASE(Debug_StackTraceDump1) { const char* kScriptChars = "class Test {\n" @@ -1756,7 +1697,6 @@ TEST_CASE(Debug_StackTraceDump1) { EXPECT_EQ(1, breakpoint_hit_counter); } - static void StackTraceDump2ExceptionHandler(Dart_IsolateId isolate_id, Dart_Handle exception_object, Dart_StackTrace trace) { @@ -1852,7 +1792,6 @@ static void StackTraceDump2ExceptionHandler(Dart_IsolateId isolate_id, true); } - TEST_CASE(Debug_StackTraceDump2) { const char* kScriptChars = "class Test {\n" @@ -1905,7 +1844,6 @@ TEST_CASE(Debug_StackTraceDump2) { EXPECT_EQ(1, breakpoint_hit_counter); } - void TestEvaluateHandler(Dart_IsolateId isolate_id, intptr_t bp_id, const Dart_CodeLocation& location) { @@ -1947,7 +1885,6 @@ void TestEvaluateHandler(Dart_IsolateId isolate_id, breakpoint_hit_counter++; } - TEST_CASE(Debug_EvaluateExpr) { const char* kScriptChars = "import 'dart:math'; \n" @@ -1969,7 +1906,6 @@ TEST_CASE(Debug_EvaluateExpr) { LoadScript(kScriptChars); Dart_SetPausedEventHandler(&TestEvaluateHandler); - Dart_Handle script_url = NewString(TestCase::url()); intptr_t line_no = 4; Dart_Handle res = Dart_SetBreakpoint(script_url, line_no); @@ -2046,7 +1982,6 @@ TEST_CASE(Debug_EvaluateExpr) { EXPECT(Dart_IsError(error)); } - static void EvaluateInActivationOfEvaluateHandler(Dart_IsolateId isolate_id, Dart_Handle exception_object, Dart_StackTrace trace) { @@ -2060,7 +1995,6 @@ static void EvaluateInActivationOfEvaluateHandler(Dart_IsolateId isolate_id, EXPECT_EQ(5.0, ToDouble(result)); } - TEST_CASE(Debug_EvaluateInActivationOfEvaluate) { // This library deliberately declares no top-level variables or methods. This // exercises a path in eval where a library may have no top-level anonymous @@ -2085,14 +2019,12 @@ TEST_CASE(Debug_EvaluateInActivationOfEvaluate) { EXPECT_EQ(1, breakpoint_hit_counter); } - static void UnhandledExceptionHandler(Dart_IsolateId isolate_id, Dart_Handle exception_object, Dart_StackTrace trace) { breakpoint_hit_counter++; } - // Check that the debugger is not called when an exception is // caught by Dart code. TEST_CASE(Debug_BreakOnUnhandledException) { @@ -2130,7 +2062,6 @@ TEST_CASE(Debug_BreakOnUnhandledException) { EXPECT_EQ(1, breakpoint_hit_counter); } - TEST_CASE(Debug_GetClosureInfo) { const char* kScriptChars = "void foo() { return 43; } \n" @@ -2162,7 +2093,6 @@ TEST_CASE(Debug_GetClosureInfo) { EXPECT(loc.library_id > 0); } - TEST_CASE(Debug_GetSupertype) { const char* kScriptChars = "class Test {\n" @@ -2182,7 +2112,6 @@ TEST_CASE(Debug_GetSupertype) { "int main() {\n" "}\n"; - Zone* zone = thread->zone(); LoadScript(kScriptChars); ASSERT(script_lib != NULL); @@ -2269,7 +2198,6 @@ TEST_CASE(Debug_GetSupertype) { } } - TEST_CASE(Debug_ListSuperType) { const char* kScriptChars = "List testMain() {" diff --git a/runtime/vm/debugger_arm.cc b/runtime/vm/debugger_arm.cc index c14eb7167ab..ee75cd7fa03 100644 --- a/runtime/vm/debugger_arm.cc +++ b/runtime/vm/debugger_arm.cc @@ -19,7 +19,6 @@ RawCode* CodeBreakpoint::OrigStubAddress() const { return saved_value_; } - void CodeBreakpoint::PatchCode() { ASSERT(!is_enabled_); Code& stub_target = Code::Handle(); @@ -40,7 +39,6 @@ void CodeBreakpoint::PatchCode() { is_enabled_ = true; } - void CodeBreakpoint::RestoreCode() { ASSERT(is_enabled_); const Code& code = Code::Handle(code_); diff --git a/runtime/vm/debugger_arm64.cc b/runtime/vm/debugger_arm64.cc index 842d1a28355..4d53e7cf944 100644 --- a/runtime/vm/debugger_arm64.cc +++ b/runtime/vm/debugger_arm64.cc @@ -19,7 +19,6 @@ RawCode* CodeBreakpoint::OrigStubAddress() const { return saved_value_; } - void CodeBreakpoint::PatchCode() { ASSERT(!is_enabled_); Code& stub_target = Code::Handle(); @@ -41,7 +40,6 @@ void CodeBreakpoint::PatchCode() { is_enabled_ = true; } - void CodeBreakpoint::RestoreCode() { ASSERT(is_enabled_); const Code& code = Code::Handle(code_); diff --git a/runtime/vm/debugger_dbc.cc b/runtime/vm/debugger_dbc.cc index 83046771b12..8287e2bbb0e 100644 --- a/runtime/vm/debugger_dbc.cc +++ b/runtime/vm/debugger_dbc.cc @@ -19,17 +19,14 @@ RawCode* CodeBreakpoint::OrigStubAddress() const { return reinterpret_cast(static_cast(saved_value_)); } - static Instr* CallInstructionFromReturnAddress(uword pc) { return reinterpret_cast(pc) - 1; } - static Instr* FastSmiInstructionFromReturnAddress(uword pc) { return reinterpret_cast(pc) - 2; } - void CodeBreakpoint::PatchCode() { ASSERT(!is_enabled_); const Code& code = Code::Handle(code_); @@ -71,7 +68,6 @@ void CodeBreakpoint::PatchCode() { is_enabled_ = true; } - void CodeBreakpoint::RestoreCode() { ASSERT(is_enabled_); const Code& code = Code::Handle(code_); diff --git a/runtime/vm/debugger_ia32.cc b/runtime/vm/debugger_ia32.cc index 83cd02df726..ad534bcee61 100644 --- a/runtime/vm/debugger_ia32.cc +++ b/runtime/vm/debugger_ia32.cc @@ -23,7 +23,6 @@ RawCode* CodeBreakpoint::OrigStubAddress() const { return saved_value_; } - void CodeBreakpoint::PatchCode() { ASSERT(!is_enabled_); const Code& code = Code::Handle(code_); @@ -51,7 +50,6 @@ void CodeBreakpoint::PatchCode() { is_enabled_ = true; } - void CodeBreakpoint::RestoreCode() { ASSERT(is_enabled_); const Code& code = Code::Handle(code_); diff --git a/runtime/vm/debugger_test.cc b/runtime/vm/debugger_test.cc index 842d0234f31..8b21da072cd 100644 --- a/runtime/vm/debugger_test.cc +++ b/runtime/vm/debugger_test.cc @@ -2,9 +2,9 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +#include "vm/debugger.h" #include "vm/dart_api_impl.h" #include "vm/dart_api_message.h" -#include "vm/debugger.h" #include "vm/message.h" #include "vm/unit_test.h" @@ -283,7 +283,6 @@ TEST_CASE(Debugger_PrintBreakpointsToJSONArray) { } } - static bool saw_paused_event = false; static void InspectPausedEvent(Dart_IsolateId isolate_id, @@ -300,7 +299,6 @@ static void InspectPausedEvent(Dart_IsolateId isolate_id, saw_paused_event = true; } - TEST_CASE(Debugger_PauseEvent) { const char* kScriptChars = "main() {\n" @@ -332,7 +330,6 @@ TEST_CASE(Debugger_PauseEvent) { EXPECT(saw_paused_event); } - static uint8_t* malloc_allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { @@ -340,10 +337,8 @@ static uint8_t* malloc_allocator(uint8_t* ptr, return reinterpret_cast(new_ptr); } - const char* rewind_frame_index = "-1"; - // Build and send a fake resume OOB message for testing purposes. void SendResumeMessage(Isolate* isolate) { // Format is: [ oob_type, port, seq, method_name, [keys], [values] ] @@ -433,7 +428,6 @@ void SendResumeMessage(Isolate* isolate) { } } - static void RewindOnce(Dart_IsolateId isolate_id, intptr_t bp_id, const Dart_CodeLocation& loc) { @@ -451,7 +445,6 @@ static void RewindOnce(Dart_IsolateId isolate_id, } } - TEST_CASE(Debugger_RewindOneFrame_Unoptimized) { SetFlagScope sfs(&FLAG_trace_rewind, true); @@ -490,7 +483,6 @@ TEST_CASE(Debugger_RewindOneFrame_Unoptimized) { EXPECT(saw_paused_event); } - TEST_CASE(Debugger_RewindTwoFrames_Unoptimized) { SetFlagScope sfs(&FLAG_trace_rewind, true); @@ -537,7 +529,6 @@ TEST_CASE(Debugger_RewindTwoFrames_Unoptimized) { EXPECT(saw_paused_event); } - TEST_CASE(Debugger_Rewind_Optimized) { SetFlagScope sfs1(&FLAG_trace_rewind, true); SetFlagScope sfs2(&FLAG_prune_dead_locals, false); diff --git a/runtime/vm/debugger_x64.cc b/runtime/vm/debugger_x64.cc index 58c45c96486..3fbb4133138 100644 --- a/runtime/vm/debugger_x64.cc +++ b/runtime/vm/debugger_x64.cc @@ -21,7 +21,6 @@ RawCode* CodeBreakpoint::OrigStubAddress() const { return saved_value_; } - void CodeBreakpoint::PatchCode() { ASSERT(!is_enabled_); Code& stub_target = Code::Handle(); @@ -42,7 +41,6 @@ void CodeBreakpoint::PatchCode() { is_enabled_ = true; } - void CodeBreakpoint::RestoreCode() { ASSERT(is_enabled_); const Code& code = Code::Handle(code_); diff --git a/runtime/vm/deferred_objects.cc b/runtime/vm/deferred_objects.cc index 4e2b3da0642..455e446c125 100644 --- a/runtime/vm/deferred_objects.cc +++ b/runtime/vm/deferred_objects.cc @@ -15,7 +15,6 @@ namespace dart { DECLARE_FLAG(bool, trace_deoptimization); DECLARE_FLAG(bool, trace_deoptimization_verbose); - void DeferredDouble::Materialize(DeoptContext* deopt_context) { RawDouble** double_slot = reinterpret_cast(slot()); *double_slot = Double::New(value()); @@ -26,7 +25,6 @@ void DeferredDouble::Materialize(DeoptContext* deopt_context) { } } - void DeferredMint::Materialize(DeoptContext* deopt_context) { RawMint** mint_slot = reinterpret_cast(slot()); ASSERT(!Smi::IsValid(value())); @@ -40,7 +38,6 @@ void DeferredMint::Materialize(DeoptContext* deopt_context) { } } - void DeferredFloat32x4::Materialize(DeoptContext* deopt_context) { RawFloat32x4** float32x4_slot = reinterpret_cast(slot()); RawFloat32x4* raw_float32x4 = Float32x4::New(value()); @@ -56,7 +53,6 @@ void DeferredFloat32x4::Materialize(DeoptContext* deopt_context) { } } - void DeferredFloat64x2::Materialize(DeoptContext* deopt_context) { RawFloat64x2** float64x2_slot = reinterpret_cast(slot()); RawFloat64x2* raw_float64x2 = Float64x2::New(value()); @@ -70,7 +66,6 @@ void DeferredFloat64x2::Materialize(DeoptContext* deopt_context) { } } - void DeferredInt32x4::Materialize(DeoptContext* deopt_context) { RawInt32x4** int32x4_slot = reinterpret_cast(slot()); RawInt32x4* raw_int32x4 = Int32x4::New(value()); @@ -86,7 +81,6 @@ void DeferredInt32x4::Materialize(DeoptContext* deopt_context) { } } - void DeferredObjectRef::Materialize(DeoptContext* deopt_context) { DeferredObject* obj = deopt_context->GetDeferredObject(index()); *slot() = obj->object(); @@ -98,7 +92,6 @@ void DeferredObjectRef::Materialize(DeoptContext* deopt_context) { } } - void DeferredRetAddr::Materialize(DeoptContext* deopt_context) { Thread* thread = deopt_context->thread(); Zone* zone = deopt_context->zone(); @@ -153,7 +146,6 @@ void DeferredRetAddr::Materialize(DeoptContext* deopt_context) { } } - void DeferredPcMarker::Materialize(DeoptContext* deopt_context) { Thread* thread = deopt_context->thread(); Zone* zone = deopt_context->zone(); @@ -195,7 +187,6 @@ void DeferredPcMarker::Materialize(DeoptContext* deopt_context) { } } - void DeferredPp::Materialize(DeoptContext* deopt_context) { Thread* thread = deopt_context->thread(); Zone* zone = deopt_context->zone(); @@ -219,7 +210,6 @@ void DeferredPp::Materialize(DeoptContext* deopt_context) { } } - RawObject* DeferredObject::object() { if (object_ == NULL) { Create(); @@ -227,7 +217,6 @@ RawObject* DeferredObject::object() { return object_->raw(); } - void DeferredObject::Create() { if (object_ != NULL) { return; @@ -256,14 +245,12 @@ void DeferredObject::Create() { } } - static intptr_t ToContextIndex(intptr_t offset_in_bytes) { intptr_t result = (offset_in_bytes - Context::variable_offset(0)) / kWordSize; ASSERT(result >= 0); return result; } - void DeferredObject::Fill() { Create(); // Ensure instance is created. diff --git a/runtime/vm/deferred_objects.h b/runtime/vm/deferred_objects.h index eb817af93f3..39a335e59f5 100644 --- a/runtime/vm/deferred_objects.h +++ b/runtime/vm/deferred_objects.h @@ -37,7 +37,6 @@ class DeferredSlot { DISALLOW_COPY_AND_ASSIGN(DeferredSlot); }; - class DeferredDouble : public DeferredSlot { public: DeferredDouble(double value, RawObject** slot, DeferredSlot* next) @@ -53,7 +52,6 @@ class DeferredDouble : public DeferredSlot { DISALLOW_COPY_AND_ASSIGN(DeferredDouble); }; - class DeferredMint : public DeferredSlot { public: DeferredMint(int64_t value, RawObject** slot, DeferredSlot* next) @@ -69,7 +67,6 @@ class DeferredMint : public DeferredSlot { DISALLOW_COPY_AND_ASSIGN(DeferredMint); }; - class DeferredFloat32x4 : public DeferredSlot { public: DeferredFloat32x4(simd128_value_t value, RawObject** slot, DeferredSlot* next) @@ -85,7 +82,6 @@ class DeferredFloat32x4 : public DeferredSlot { DISALLOW_COPY_AND_ASSIGN(DeferredFloat32x4); }; - class DeferredFloat64x2 : public DeferredSlot { public: DeferredFloat64x2(simd128_value_t value, RawObject** slot, DeferredSlot* next) @@ -101,7 +97,6 @@ class DeferredFloat64x2 : public DeferredSlot { DISALLOW_COPY_AND_ASSIGN(DeferredFloat64x2); }; - class DeferredInt32x4 : public DeferredSlot { public: DeferredInt32x4(simd128_value_t value, RawObject** slot, DeferredSlot* next) @@ -117,7 +112,6 @@ class DeferredInt32x4 : public DeferredSlot { DISALLOW_COPY_AND_ASSIGN(DeferredInt32x4); }; - // Describes a slot that contains a reference to an object that had its // allocation removed by AllocationSinking pass. // Object itself is described and materialized by DeferredObject. @@ -136,7 +130,6 @@ class DeferredObjectRef : public DeferredSlot { DISALLOW_COPY_AND_ASSIGN(DeferredObjectRef); }; - class DeferredRetAddr : public DeferredSlot { public: DeferredRetAddr(intptr_t index, @@ -156,7 +149,6 @@ class DeferredRetAddr : public DeferredSlot { DISALLOW_COPY_AND_ASSIGN(DeferredRetAddr); }; - class DeferredPcMarker : public DeferredSlot { public: DeferredPcMarker(intptr_t index, RawObject** slot, DeferredSlot* next) @@ -172,7 +164,6 @@ class DeferredPcMarker : public DeferredSlot { DISALLOW_COPY_AND_ASSIGN(DeferredPcMarker); }; - class DeferredPp : public DeferredSlot { public: DeferredPp(intptr_t index, RawObject** slot, DeferredSlot* next) @@ -188,7 +179,6 @@ class DeferredPp : public DeferredSlot { DISALLOW_COPY_AND_ASSIGN(DeferredPp); }; - // Describes an object which allocation was removed by AllocationSinking pass. // Arguments for materialization are stored as a part of expression stack // for the bottommost deoptimized frame so that GC could discover them. diff --git a/runtime/vm/deopt_instructions.cc b/runtime/vm/deopt_instructions.cc index fa90ec270e3..0367a054db1 100644 --- a/runtime/vm/deopt_instructions.cc +++ b/runtime/vm/deopt_instructions.cc @@ -24,7 +24,6 @@ DEFINE_FLAG(bool, DECLARE_FLAG(bool, trace_deoptimization); DECLARE_FLAG(bool, trace_deoptimization_verbose); - DeoptContext::DeoptContext(const StackFrame* frame, const Code& code, DestFrameOptions dest_options, @@ -132,7 +131,6 @@ DeoptContext::DeoptContext(const StackFrame* frame, } } - DeoptContext::~DeoptContext() { // Delete memory for source frame and registers. if (source_frame_is_allocated_) { @@ -183,7 +181,6 @@ DeoptContext::~DeoptContext() { #endif // !PRODUCT } - void DeoptContext::VisitObjectPointers(ObjectPointerVisitor* visitor) { visitor->VisitPointer(reinterpret_cast(&object_pool_)); visitor->VisitPointer(reinterpret_cast(&deopt_info_)); @@ -198,7 +195,6 @@ void DeoptContext::VisitObjectPointers(ObjectPointerVisitor* visitor) { } } - intptr_t DeoptContext::DestStackAdjustment() const { return dest_frame_size_ - kDartFrameFixedSize - num_args_ #if !defined(TARGET_ARCH_DBC) @@ -207,7 +203,6 @@ intptr_t DeoptContext::DestStackAdjustment() const { - kParamEndSlotFromFp; } - intptr_t DeoptContext::GetSourceFp() const { #if !defined(TARGET_ARCH_DBC) return source_frame_[source_frame_size_ - 1 - num_args_ - @@ -218,7 +213,6 @@ intptr_t DeoptContext::GetSourceFp() const { #endif } - intptr_t DeoptContext::GetSourcePp() const { #if !defined(TARGET_ARCH_DBC) return source_frame_[source_frame_size_ - 1 - num_args_ - @@ -230,7 +224,6 @@ intptr_t DeoptContext::GetSourcePp() const { #endif } - intptr_t DeoptContext::GetSourcePc() const { #if !defined(TARGET_ARCH_DBC) return source_frame_[source_frame_size_ - num_args_ + kSavedPcSlotFromSp]; @@ -240,17 +233,14 @@ intptr_t DeoptContext::GetSourcePc() const { #endif } - intptr_t DeoptContext::GetCallerFp() const { return caller_fp_; } - void DeoptContext::SetCallerFp(intptr_t caller_fp) { caller_fp_ = caller_fp; } - static bool IsObjectInstruction(DeoptInstr::Kind kind) { switch (kind) { case DeoptInstr::kConstant: @@ -284,7 +274,6 @@ static bool IsObjectInstruction(DeoptInstr::Kind kind) { return false; } - void DeoptContext::FillDestFrame() { const Code& code = Code::Handle(code_); const TypedData& deopt_info = TypedData::Handle(deopt_info_); @@ -344,7 +333,6 @@ void DeoptContext::FillDestFrame() { } } - intptr_t* DeoptContext::CatchEntryState(intptr_t num_vars) { const Code& code = Code::Handle(code_); const TypedData& deopt_info = TypedData::Handle(deopt_info_); @@ -380,7 +368,6 @@ intptr_t* DeoptContext::CatchEntryState(intptr_t num_vars) { return state; } - static void FillDeferredSlots(DeoptContext* deopt_context, DeferredSlot** slot_list) { DeferredSlot* slot = *slot_list; @@ -396,7 +383,6 @@ static void FillDeferredSlots(DeoptContext* deopt_context, } } - // Materializes all deferred objects. Returns the total number of // artificial arguments used during deoptimization. intptr_t DeoptContext::MaterializeDeferredObjects() { @@ -438,7 +424,6 @@ intptr_t DeoptContext::MaterializeDeferredObjects() { return deopt_arg_count; } - RawArray* DeoptContext::DestFrameAsArray() { ASSERT(dest_frame_ != NULL && dest_frame_is_allocated_); const Array& dest_array = Array::Handle(zone(), Array::New(dest_frame_size_)); @@ -450,7 +435,6 @@ RawArray* DeoptContext::DestFrameAsArray() { return dest_array.raw(); } - // Deoptimization instruction creating return address using function and // deopt-id stored at 'object_table_index'. class DeoptRetAddressInstr : public DeoptInstr { @@ -499,7 +483,6 @@ class DeoptRetAddressInstr : public DeoptInstr { DISALLOW_COPY_AND_ASSIGN(DeoptRetAddressInstr); }; - // Deoptimization instruction moving a constant stored at 'object_table_index'. class DeoptConstantInstr : public DeoptInstr { public: @@ -533,7 +516,6 @@ class DeoptConstantInstr : public DeoptInstr { DISALLOW_COPY_AND_ASSIGN(DeoptConstantInstr); }; - // Deoptimization instruction moving value from optimized frame at // 'source_index' to specified slots in the unoptimized frame. // 'source_index' represents the slot index of the frame (0 being @@ -567,7 +549,6 @@ class DeoptWordInstr : public DeoptInstr { DISALLOW_COPY_AND_ASSIGN(DeoptWordInstr); }; - class DeoptIntegerInstrBase : public DeoptInstr { public: DeoptIntegerInstrBase() {} @@ -589,7 +570,6 @@ class DeoptIntegerInstrBase : public DeoptInstr { DISALLOW_COPY_AND_ASSIGN(DeoptIntegerInstrBase); }; - class DeoptMintPairInstr : public DeoptIntegerInstrBase { public: explicit DeoptMintPairInstr(intptr_t source_index) @@ -628,7 +608,6 @@ class DeoptMintPairInstr : public DeoptIntegerInstrBase { DISALLOW_COPY_AND_ASSIGN(DeoptMintPairInstr); }; - template class DeoptIntInstr : public DeoptIntegerInstrBase { public: @@ -653,12 +632,10 @@ class DeoptIntInstr : public DeoptIntegerInstrBase { DISALLOW_COPY_AND_ASSIGN(DeoptIntInstr); }; - typedef DeoptIntInstr DeoptUint32Instr; typedef DeoptIntInstr DeoptInt32Instr; typedef DeoptIntInstr DeoptMintInstr; - template class DeoptFpuInstr : public DeoptInstr { public: @@ -740,7 +717,6 @@ class DeoptPcMarkerInstr : public DeoptInstr { DISALLOW_COPY_AND_ASSIGN(DeoptPcMarkerInstr); }; - // Deoptimization instruction creating a pool pointer for the code of // function at 'object_table_index'. class DeoptPpInstr : public DeoptInstr { @@ -770,7 +746,6 @@ class DeoptPpInstr : public DeoptInstr { DISALLOW_COPY_AND_ASSIGN(DeoptPpInstr); }; - // Deoptimization instruction copying the caller saved FP from optimized frame. class DeoptCallerFpInstr : public DeoptInstr { public: @@ -789,7 +764,6 @@ class DeoptCallerFpInstr : public DeoptInstr { DISALLOW_COPY_AND_ASSIGN(DeoptCallerFpInstr); }; - // Deoptimization instruction copying the caller saved PP from optimized frame. class DeoptCallerPpInstr : public DeoptInstr { public: @@ -806,7 +780,6 @@ class DeoptCallerPpInstr : public DeoptInstr { DISALLOW_COPY_AND_ASSIGN(DeoptCallerPpInstr); }; - // Deoptimization instruction copying the caller return address from optimized // frame. class DeoptCallerPcInstr : public DeoptInstr { @@ -824,7 +797,6 @@ class DeoptCallerPcInstr : public DeoptInstr { DISALLOW_COPY_AND_ASSIGN(DeoptCallerPcInstr); }; - // Write reference to a materialized object with the given index into the // stack slot. class DeoptMaterializedObjectRefInstr : public DeoptInstr { @@ -851,7 +823,6 @@ class DeoptMaterializedObjectRefInstr : public DeoptInstr { DISALLOW_COPY_AND_ASSIGN(DeoptMaterializedObjectRefInstr); }; - // Materialize object with the given number of fields. // Arguments for materialization (class and field-value pairs) are pushed // to the expression stack of the bottom-most frame. @@ -880,7 +851,6 @@ class DeoptMaterializeObjectInstr : public DeoptInstr { DISALLOW_COPY_AND_ASSIGN(DeoptMaterializeObjectInstr); }; - uword DeoptInstr::GetRetAddress(DeoptInstr* instr, const ObjectPool& object_table, Code* code) { @@ -909,7 +879,6 @@ uword DeoptInstr::GetRetAddress(DeoptInstr* instr, return res; } - DeoptInstr* DeoptInstr::Create(intptr_t kind_as_int, intptr_t source_index) { Kind kind = static_cast(kind_as_int); switch (kind) { @@ -954,7 +923,6 @@ DeoptInstr* DeoptInstr::Create(intptr_t kind_as_int, intptr_t source_index) { return NULL; } - const char* DeoptInstr::KindToCString(Kind kind) { switch (kind) { case kWord: @@ -997,7 +965,6 @@ const char* DeoptInstr::KindToCString(Kind kind) { return NULL; } - class DeoptInfoBuilder::TrieNode : public ZoneAllocated { public: // Construct the root node representing the implicit "shared" terminator @@ -1029,7 +996,6 @@ class DeoptInfoBuilder::TrieNode : public ZoneAllocated { GrowableArray children_; }; - DeoptInfoBuilder::DeoptInfoBuilder(Zone* zone, const intptr_t num_args, Assembler* assembler) @@ -1042,12 +1008,10 @@ DeoptInfoBuilder::DeoptInfoBuilder(Zone* zone, frame_start_(-1), materializations_() {} - intptr_t DeoptInfoBuilder::FindOrAddObjectInTable(const Object& obj) const { return assembler_->object_pool_wrapper().FindObject(obj); } - intptr_t DeoptInfoBuilder::CalculateStackIndex( const Location& source_loc) const { return source_loc.stack_index() < 0 @@ -1055,7 +1019,6 @@ intptr_t DeoptInfoBuilder::CalculateStackIndex( : source_loc.stack_index() + num_args_ + kDartFrameFixedSize; } - CpuRegisterSource DeoptInfoBuilder::ToCpuRegisterSource(const Location& loc) { if (loc.IsRegister()) { return CpuRegisterSource(CpuRegisterSource::kRegister, loc.reg()); @@ -1066,7 +1029,6 @@ CpuRegisterSource DeoptInfoBuilder::ToCpuRegisterSource(const Location& loc) { } } - FpuRegisterSource DeoptInfoBuilder::ToFpuRegisterSource( const Location& loc, Location::Kind stack_slot_kind) { @@ -1094,7 +1056,6 @@ void DeoptInfoBuilder::AddReturnAddress(const Function& function, DeoptRetAddressInstr(object_table_index, deopt_id)); } - void DeoptInfoBuilder::AddPcMarker(const Function& function, intptr_t dest_index) { intptr_t object_table_index = FindOrAddObjectInTable(function); @@ -1102,14 +1063,12 @@ void DeoptInfoBuilder::AddPcMarker(const Function& function, instructions_.Add(new (zone()) DeoptPcMarkerInstr(object_table_index)); } - void DeoptInfoBuilder::AddPp(const Function& function, intptr_t dest_index) { intptr_t object_table_index = FindOrAddObjectInTable(function); ASSERT(dest_index == FrameSize()); instructions_.Add(new (zone()) DeoptPpInstr(object_table_index)); } - void DeoptInfoBuilder::AddCopy(Value* value, const Location& source_loc, const intptr_t dest_index) { @@ -1183,32 +1142,27 @@ void DeoptInfoBuilder::AddCopy(Value* value, instructions_.Add(deopt_instr); } - void DeoptInfoBuilder::AddCallerFp(intptr_t dest_index) { ASSERT(dest_index == FrameSize()); instructions_.Add(new (zone()) DeoptCallerFpInstr()); } - void DeoptInfoBuilder::AddCallerPp(intptr_t dest_index) { ASSERT(dest_index == FrameSize()); instructions_.Add(new (zone()) DeoptCallerPpInstr()); } - void DeoptInfoBuilder::AddCallerPc(intptr_t dest_index) { ASSERT(dest_index == FrameSize()); instructions_.Add(new (zone()) DeoptCallerPcInstr()); } - void DeoptInfoBuilder::AddConstant(const Object& obj, intptr_t dest_index) { ASSERT(dest_index == FrameSize()); intptr_t object_table_index = FindOrAddObjectInTable(obj); instructions_.Add(new (zone()) DeoptConstantInstr(object_table_index)); } - void DeoptInfoBuilder::AddMaterialization(MaterializeObjectInstr* mat) { const intptr_t index = FindMaterialization(mat); if (index >= 0) { @@ -1237,7 +1191,6 @@ void DeoptInfoBuilder::AddMaterialization(MaterializeObjectInstr* mat) { } } - intptr_t DeoptInfoBuilder::EmitMaterializationArguments(intptr_t dest_index) { ASSERT(dest_index == kDartFrameFixedSize); for (intptr_t i = 0; i < materializations_.length(); i++) { @@ -1257,7 +1210,6 @@ intptr_t DeoptInfoBuilder::EmitMaterializationArguments(intptr_t dest_index) { return dest_index; } - intptr_t DeoptInfoBuilder::FindMaterialization( MaterializeObjectInstr* mat) const { for (intptr_t i = 0; i < materializations_.length(); i++) { @@ -1268,14 +1220,12 @@ intptr_t DeoptInfoBuilder::FindMaterialization( return -1; } - static uint8_t* ZoneReAlloc(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { return Thread::Current()->zone()->Realloc(ptr, old_size, new_size); } - RawTypedData* DeoptInfoBuilder::CreateDeoptInfo(const Array& deopt_table) { intptr_t length = instructions_.length(); @@ -1292,7 +1242,6 @@ RawTypedData* DeoptInfoBuilder::CreateDeoptInfo(const Array& deopt_table) { } } - // Allocate space for the translation. If the shared suffix is longer // than one instruction, we replace it with a single suffix instruction. const bool use_suffix = suffix_length > 1; @@ -1344,7 +1293,6 @@ RawTypedData* DeoptInfoBuilder::CreateDeoptInfo(const Array& deopt_table) { return deopt_info.raw(); } - intptr_t DeoptTable::SizeFor(intptr_t length) { return length * kEntrySize; } @@ -1361,13 +1309,11 @@ void DeoptTable::SetEntry(const Array& table, table.SetAt(i + 2, reason); } - intptr_t DeoptTable::GetLength(const Array& table) { ASSERT((table.Length() % kEntrySize) == 0); return table.Length() / kEntrySize; } - void DeoptTable::GetEntry(const Array& table, intptr_t index, Smi* offset, diff --git a/runtime/vm/deopt_instructions.h b/runtime/vm/deopt_instructions.h index 3ccafccbf5e..ea9fe721fb9 100644 --- a/runtime/vm/deopt_instructions.h +++ b/runtime/vm/deopt_instructions.h @@ -373,7 +373,6 @@ class DeoptInstr : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(DeoptInstr); }; - // Helper class that allows to read a value of the given register from // the DeoptContext as the specified type. // It calls different method depending on which kind of register (cpu/fpu) and @@ -395,7 +394,6 @@ struct RegisterReader { } }; - template <> struct RegisterReader { static simd128_value_t Read(DeoptContext* context, FpuRegister reg) { @@ -403,7 +401,6 @@ struct RegisterReader { } }; - // Class that encapsulates reading and writing of values that were either in // the registers in the optimized code or were spilled from those registers // to the stack. @@ -473,11 +470,9 @@ class RegisterSource { const intptr_t source_index_; }; - typedef RegisterSource CpuRegisterSource; typedef RegisterSource FpuRegisterSource; - // Builds a deoptimization info table, one DeoptInfo at a time. Call AddXXX // methods in the order of their target, starting wih deoptimized code // continuation pc and ending with the first argument of the deoptimized @@ -564,7 +559,6 @@ class DeoptInfoBuilder : public ValueObject { DISALLOW_COPY_AND_ASSIGN(DeoptInfoBuilder); }; - // Utilities for managing the deopt table and its entries. The table is // stored in an Array in the heap. It consists of triples of (PC offset, // info, reason). Elements of each entry are stored consecutively in the diff --git a/runtime/vm/disassembler.cc b/runtime/vm/disassembler.cc index d47919a13d3..ea886284fbc 100644 --- a/runtime/vm/disassembler.cc +++ b/runtime/vm/disassembler.cc @@ -5,6 +5,7 @@ #include "vm/disassembler.h" #include "vm/assembler.h" +#include "vm/code_patcher.h" #include "vm/deopt_instructions.h" #include "vm/globals.h" #include "vm/il_printer.h" @@ -12,8 +13,6 @@ #include "vm/json_stream.h" #include "vm/log.h" #include "vm/os.h" -#include "vm/code_patcher.h" - namespace dart { @@ -45,7 +44,6 @@ void DisassembleToStdout::ConsumeInstruction(const Code& code, THR_Print("\n"); } - void DisassembleToStdout::Print(const char* format, ...) { va_list args; va_start(args, format); @@ -53,7 +51,6 @@ void DisassembleToStdout::Print(const char* format, ...) { va_end(args); } - void DisassembleToJSONStream::ConsumeInstruction(const Code& code, char* hex_buffer, intptr_t hex_size, @@ -76,7 +73,6 @@ void DisassembleToJSONStream::ConsumeInstruction(const Code& code, } } - void DisassembleToJSONStream::Print(const char* format, ...) { va_list args; va_start(args, format); @@ -101,7 +97,6 @@ void DisassembleToJSONStream::Print(const char* format, ...) { free(p); } - void Disassembler::Disassemble(uword start, uword end, DisassemblyFormatter* formatter, @@ -159,7 +154,6 @@ void Disassembler::Disassemble(uword start, } } - void Disassembler::DisassembleCodeHelper(const char* function_fullname, const Code& code, bool optimized) { @@ -302,7 +296,6 @@ void Disassembler::DisassembleCodeHelper(const char* function_fullname, } } - void Disassembler::DisassembleCode(const Function& function, const Code& code, bool optimized) { @@ -310,7 +303,6 @@ void Disassembler::DisassembleCode(const Function& function, DisassembleCodeHelper(function_fullname, code, optimized); } - #endif // !PRODUCT } // namespace dart diff --git a/runtime/vm/disassembler.h b/runtime/vm/disassembler.h index 62eb06fa7af..364f4f57650 100644 --- a/runtime/vm/disassembler.h +++ b/runtime/vm/disassembler.h @@ -36,7 +36,6 @@ class DisassemblyFormatter { virtual void Print(const char* format, ...) = 0; }; - // Basic disassembly formatter that outputs the disassembled instruction // to stdout. class DisassembleToStdout : public DisassemblyFormatter { @@ -59,7 +58,6 @@ class DisassembleToStdout : public DisassemblyFormatter { DISALLOW_COPY_AND_ASSIGN(DisassembleToStdout); }; - // Disassemble into a JSONStream. class DisassembleToJSONStream : public DisassemblyFormatter { public: @@ -83,7 +81,6 @@ class DisassembleToJSONStream : public DisassemblyFormatter { DISALLOW_COPY_AND_ASSIGN(DisassembleToJSONStream); }; - // Disassemble instructions. class Disassembler : public AllStatic { public: diff --git a/runtime/vm/disassembler_arm.cc b/runtime/vm/disassembler_arm.cc index 0058f2944d5..47be39d9da6 100644 --- a/runtime/vm/disassembler_arm.cc +++ b/runtime/vm/disassembler_arm.cc @@ -77,12 +77,10 @@ class ARMDecoder : public ValueObject { DISALLOW_COPY_AND_ASSIGN(ARMDecoder); }; - // Support for assertions in the ARMDecoder formatting functions. #define STRING_STARTS_WITH(string, compare_string) \ (strncmp(string, compare_string, strlen(compare_string)) == 0) - // Append the str to the output buffer. void ARMDecoder::Print(const char* str) { char cur = *str++; @@ -93,7 +91,6 @@ void ARMDecoder::Print(const char* str) { buffer_[buffer_pos_] = '\0'; } - // These condition names are defined in a way to match the native disassembler // formatting. See for example the command "objdump -d ". static const char* cond_names[kNumberOfConditions] = { @@ -101,13 +98,11 @@ static const char* cond_names[kNumberOfConditions] = { "hi", "ls", "ge", "lt", "gt", "le", "", "invalid", }; - // Print the condition guarding the instruction. void ARMDecoder::PrintCondition(Instr* instr) { Print(cond_names[instr->ConditionField()]); } - // These register names are defined in a way to match the native disassembler // formatting, except for register alias pp (r5). // See for example the command "objdump -d ". @@ -121,7 +116,6 @@ static const char* reg_names[kNumberOfCpuRegisters] = { #endif }; - // Print the register name according to the active name converter. void ARMDecoder::PrintRegister(int reg) { ASSERT(0 <= reg); @@ -129,7 +123,6 @@ void ARMDecoder::PrintRegister(int reg) { Print(reg_names[reg]); } - void ARMDecoder::PrintSRegister(int reg) { ASSERT(0 <= reg); ASSERT(reg < kNumberOfSRegisters); @@ -137,7 +130,6 @@ void ARMDecoder::PrintSRegister(int reg) { remaining_size_in_buffer(), "s%d", reg); } - void ARMDecoder::PrintDRegister(int reg) { ASSERT(0 <= reg); ASSERT(reg < kNumberOfDRegisters); @@ -145,7 +137,6 @@ void ARMDecoder::PrintDRegister(int reg) { remaining_size_in_buffer(), "d%d", reg); } - void ARMDecoder::PrintQRegister(int reg) { ASSERT(0 <= reg); ASSERT(reg < kNumberOfQRegisters); @@ -153,12 +144,10 @@ void ARMDecoder::PrintQRegister(int reg) { remaining_size_in_buffer(), "q%d", reg); } - // These shift names are defined in a way to match the native disassembler // formatting. See for example the command "objdump -d ". static const char* shift_names[kMaxShift] = {"lsl", "lsr", "asr", "ror"}; - // Print the register shift operands for the instruction. Generally used for // data processing instructions. void ARMDecoder::PrintShiftRm(Instr* instr) { @@ -193,7 +182,6 @@ void ARMDecoder::PrintShiftRm(Instr* instr) { } } - // Print the immediate operand for the instruction. Generally used for data // processing instructions. void ARMDecoder::PrintShiftImm(Instr* instr) { @@ -204,7 +192,6 @@ void ARMDecoder::PrintShiftImm(Instr* instr) { remaining_size_in_buffer(), "#%d", imm); } - // Print PU formatting to reduce complexity of FormatOption. void ARMDecoder::PrintPU(Instr* instr) { switch (instr->PUField()) { @@ -231,7 +218,6 @@ void ARMDecoder::PrintPU(Instr* instr) { } } - // Handle all register based formatting in these functions to reduce the // complexity of FormatOption. int ARMDecoder::FormatRegister(Instr* instr, const char* format) { @@ -287,7 +273,6 @@ int ARMDecoder::FormatRegister(Instr* instr, const char* format) { return -1; } - int ARMDecoder::FormatSRegister(Instr* instr, const char* format) { ASSERT(format[0] == 's'); if (format[1] == 'n') { // 'sn: Sn register @@ -327,7 +312,6 @@ int ARMDecoder::FormatSRegister(Instr* instr, const char* format) { return -1; } - void ARMDecoder::PrintDRegisterList(int start, int reg_count) { Print("{"); for (int i = start; i < start + reg_count; i++) { @@ -339,7 +323,6 @@ void ARMDecoder::PrintDRegisterList(int start, int reg_count) { Print("}"); } - int ARMDecoder::FormatDRegister(Instr* instr, const char* format) { ASSERT(format[0] == 'd'); if (format[1] == 'n') { // 'dn: Dn register @@ -371,7 +354,6 @@ int ARMDecoder::FormatDRegister(Instr* instr, const char* format) { return -1; } - int ARMDecoder::FormatQRegister(Instr* instr, const char* format) { ASSERT(format[0] == 'q'); if (format[1] == 'n') { // 'qn: Qn register @@ -391,7 +373,6 @@ int ARMDecoder::FormatQRegister(Instr* instr, const char* format) { return -1; } - // FormatOption takes a formatting string and interprets it based on // the current instructions. The format string points to the first // character of the option string (the option escape has already been @@ -623,7 +604,6 @@ int ARMDecoder::FormatOption(Instr* instr, const char* format) { return -1; } - // Format takes a formatting string for a whole instruction and prints it into // the output buffer. All escaped options are handed to FormatOption to be // parsed further. @@ -640,14 +620,12 @@ void ARMDecoder::Format(Instr* instr, const char* format) { buffer_[buffer_pos_] = '\0'; } - // For currently unimplemented decodings the disassembler calls Unknown(instr) // which will just print "unknown" of the instruction bits. void ARMDecoder::Unknown(Instr* instr) { Format(instr, "unknown"); } - void ARMDecoder::DecodeType01(Instr* instr) { if (!instr->IsDataProcessing()) { // miscellaneous, multiply, sync primitives, extra loads and stores. @@ -932,7 +910,6 @@ void ARMDecoder::DecodeType01(Instr* instr) { } } - void ARMDecoder::DecodeType2(Instr* instr) { switch (instr->PUField()) { case 0: { @@ -967,7 +944,6 @@ void ARMDecoder::DecodeType2(Instr* instr) { } } - void ARMDecoder::DecodeType3(Instr* instr) { if (instr->IsDivision()) { if (!TargetCPUFeatures::integer_division_supported()) { @@ -1014,7 +990,6 @@ void ARMDecoder::DecodeType3(Instr* instr) { } } - void ARMDecoder::DecodeType4(Instr* instr) { if (instr->Bit(22) == 1) { Unknown(instr); // Privileged mode currently not supported. @@ -1025,12 +1000,10 @@ void ARMDecoder::DecodeType4(Instr* instr) { } } - void ARMDecoder::DecodeType5(Instr* instr) { Format(instr, "b'l'cond 'target ; 'dest"); } - void ARMDecoder::DecodeType6(Instr* instr) { if (instr->IsVFPDoubleTransfer()) { if (instr->Bit(8) == 0) { @@ -1095,7 +1068,6 @@ void ARMDecoder::DecodeType6(Instr* instr) { } } - void ARMDecoder::DecodeType7(Instr* instr) { if (instr->Bit(24) == 1) { Format(instr, "svc'cond #'svc"); @@ -1327,7 +1299,6 @@ void ARMDecoder::DecodeType7(Instr* instr) { } } - void ARMDecoder::DecodeSIMDDataProcessing(Instr* instr) { ASSERT(instr->ConditionField() == kSpecialCondition); if (instr->Bit(6) == 1) { @@ -1457,7 +1428,6 @@ void ARMDecoder::DecodeSIMDDataProcessing(Instr* instr) { } } - void ARMDecoder::InstructionDecode(uword pc) { Instr* instr = Instr::At(pc); @@ -1512,7 +1482,6 @@ void ARMDecoder::InstructionDecode(uword pc) { } } - void Disassembler::DecodeInstruction(char* hex_buffer, intptr_t hex_size, char* human_buffer, diff --git a/runtime/vm/disassembler_arm64.cc b/runtime/vm/disassembler_arm64.cc index f397db087bd..17baa0ee0b0 100644 --- a/runtime/vm/disassembler_arm64.cc +++ b/runtime/vm/disassembler_arm64.cc @@ -51,7 +51,6 @@ class ARM64Decoder : public ValueObject { APPLY_OP_LIST(DECODE_OP) #undef DECODE_OP - // Convenience functions. char* get_buffer() const { return buffer_; } char* current_position_in_buffer() { return buffer_ + buffer_pos_; } @@ -65,12 +64,10 @@ class ARM64Decoder : public ValueObject { DISALLOW_COPY_AND_ASSIGN(ARM64Decoder); }; - // Support for assertions in the ARM64Decoder formatting functions. #define STRING_STARTS_WITH(string, compare_string) \ (strncmp(string, compare_string, strlen(compare_string)) == 0) - // Append the str to the output buffer. void ARM64Decoder::Print(const char* str) { char cur = *str++; @@ -81,7 +78,6 @@ void ARM64Decoder::Print(const char* str) { buffer_[buffer_pos_] = '\0'; } - // These register names are defined in a way to match the native disassembler // formatting, except for register aliases ctx (r9), pp (r10) and sp (r19). // See for example the command "objdump -d ". @@ -91,7 +87,6 @@ static const char* reg_names[kNumberOfCpuRegisters] = { "r22", "r23", "r24", "r25", "thr", "pp", "ctx", "fp", "lr", "r31", }; - // Print the register name according to the active name converter. void ARM64Decoder::PrintRegister(int reg, R31Type r31t) { ASSERT(0 <= reg); @@ -104,7 +99,6 @@ void ARM64Decoder::PrintRegister(int reg, R31Type r31t) { } } - void ARM64Decoder::PrintVRegister(int reg) { ASSERT(0 <= reg); ASSERT(reg < kNumberOfVRegisters); @@ -112,17 +106,14 @@ void ARM64Decoder::PrintVRegister(int reg) { remaining_size_in_buffer(), "v%d", reg); } - // These shift names are defined in a way to match the native disassembler // formatting. See for example the command "objdump -d ". static const char* shift_names[kMaxShift] = {"lsl", "lsr", "asr", "ror"}; - static const char* extend_names[kMaxExtend] = { "uxtb", "uxth", "uxtw", "uxtx", "sxtb", "sxth", "sxtw", "sxtx", }; - // These condition names are defined in a way to match the native disassembler // formatting. See for example the command "objdump -d ". static const char* cond_names[kNumberOfConditions] = { @@ -130,7 +121,6 @@ static const char* cond_names[kNumberOfConditions] = { "hi", "ls", "ge", "lt", "gt", "le", "", "invalid", }; - // Print the condition guarding the instruction. void ARM64Decoder::PrintCondition(Instr* instr) { if (instr->IsConditionalSelectOp()) { @@ -140,7 +130,6 @@ void ARM64Decoder::PrintCondition(Instr* instr) { } } - // Print the register shift operands for the instruction. Generally used for // data processing instructions. void ARM64Decoder::PrintShiftExtendRm(Instr* instr) { @@ -183,7 +172,6 @@ void ARM64Decoder::PrintShiftExtendRm(Instr* instr) { } } - void ARM64Decoder::PrintMemOperand(Instr* instr) { const Register rn = instr->RnField(); if (instr->Bit(24) == 1) { @@ -252,7 +240,6 @@ void ARM64Decoder::PrintMemOperand(Instr* instr) { } } - void ARM64Decoder::PrintPairMemOperand(Instr* instr) { const Register rn = instr->RnField(); const int32_t simm7 = instr->SImm7Field(); @@ -283,7 +270,6 @@ void ARM64Decoder::PrintPairMemOperand(Instr* instr) { } } - // Handle all register based formatting in these functions to reduce the // complexity of FormatOption. int ARM64Decoder::FormatRegister(Instr* instr, const char* format) { @@ -317,7 +303,6 @@ int ARM64Decoder::FormatRegister(Instr* instr, const char* format) { return -1; } - int ARM64Decoder::FormatVRegister(Instr* instr, const char* format) { ASSERT(format[0] == 'v'); if (format[1] == 'd') { @@ -341,7 +326,6 @@ int ARM64Decoder::FormatVRegister(Instr* instr, const char* format) { return -1; } - // FormatOption takes a formatting string and interprets it based on // the current instructions. The format string points to the first // character of the option string (the option escape has already been @@ -639,7 +623,6 @@ int ARM64Decoder::FormatOption(Instr* instr, const char* format) { return -1; } - // Format takes a formatting string for a whole instruction and prints it into // the output buffer. All escaped options are handed to FormatOption to be // parsed further. @@ -656,14 +639,12 @@ void ARM64Decoder::Format(Instr* instr, const char* format) { buffer_[buffer_pos_] = '\0'; } - // For currently unimplemented decodings the disassembler calls Unknown(instr) // which will just print "unknown" of the instruction bits. void ARM64Decoder::Unknown(Instr* instr) { Format(instr, "unknown"); } - void ARM64Decoder::DecodeMoveWide(Instr* instr) { switch (instr->Bits(29, 2)) { case 0: @@ -681,7 +662,6 @@ void ARM64Decoder::DecodeMoveWide(Instr* instr) { } } - void ARM64Decoder::DecodeLoadStoreReg(Instr* instr) { if (instr->Bit(26) == 1) { // SIMD or FP src/dst. @@ -700,7 +680,6 @@ void ARM64Decoder::DecodeLoadStoreReg(Instr* instr) { } } - void ARM64Decoder::DecodeLoadStoreRegPair(Instr* instr) { if (instr->Bit(22) == 1) { // Load. @@ -711,7 +690,6 @@ void ARM64Decoder::DecodeLoadStoreRegPair(Instr* instr) { } } - void ARM64Decoder::DecodeLoadRegLiteral(Instr* instr) { if ((instr->Bit(31) != 0) || (instr->Bit(29) != 0) || (instr->Bits(24, 3) != 0)) { @@ -724,7 +702,6 @@ void ARM64Decoder::DecodeLoadRegLiteral(Instr* instr) { } } - void ARM64Decoder::DecodeLoadStoreExclusive(Instr* instr) { if ((instr->Bit(23) != 0) || (instr->Bit(21) != 0) || (instr->Bit(15) != 0)) { Unknown(instr); @@ -742,7 +719,6 @@ void ARM64Decoder::DecodeLoadStoreExclusive(Instr* instr) { } } - void ARM64Decoder::DecodeAddSubImm(Instr* instr) { switch (instr->Bit(30)) { case 0: { @@ -772,7 +748,6 @@ void ARM64Decoder::DecodeAddSubImm(Instr* instr) { } } - void ARM64Decoder::DecodeLogicalImm(Instr* instr) { int op = instr->Bits(29, 2); switch (op) { @@ -799,7 +774,6 @@ void ARM64Decoder::DecodeLogicalImm(Instr* instr) { } } - void ARM64Decoder::DecodePCRel(Instr* instr) { const int op = instr->Bit(31); if (op == 0) { @@ -809,7 +783,6 @@ void ARM64Decoder::DecodePCRel(Instr* instr) { } } - void ARM64Decoder::DecodeDPImmediate(Instr* instr) { if (instr->IsMoveWideOp()) { DecodeMoveWide(instr); @@ -824,7 +797,6 @@ void ARM64Decoder::DecodeDPImmediate(Instr* instr) { } } - void ARM64Decoder::DecodeExceptionGen(Instr* instr) { if ((instr->Bits(0, 2) == 1) && (instr->Bits(2, 3) == 0) && (instr->Bits(21, 3) == 0)) { @@ -847,7 +819,6 @@ void ARM64Decoder::DecodeExceptionGen(Instr* instr) { } } - void ARM64Decoder::DecodeSystem(Instr* instr) { if (instr->InstructionBits() == CLREX) { Format(instr, "clrex"); @@ -867,7 +838,6 @@ void ARM64Decoder::DecodeSystem(Instr* instr) { } } - void ARM64Decoder::DecodeUnconditionalBranchReg(Instr* instr) { if ((instr->Bits(0, 5) == 0) && (instr->Bits(10, 5) == 0) && (instr->Bits(16, 5) == 0x1f)) { @@ -888,7 +858,6 @@ void ARM64Decoder::DecodeUnconditionalBranchReg(Instr* instr) { } } - void ARM64Decoder::DecodeCompareAndBranch(Instr* instr) { const int op = instr->Bit(24); if (op == 0) { @@ -898,7 +867,6 @@ void ARM64Decoder::DecodeCompareAndBranch(Instr* instr) { } } - void ARM64Decoder::DecodeConditionalBranch(Instr* instr) { if ((instr->Bit(24) != 0) || (instr->Bit(4) != 0)) { Unknown(instr); @@ -907,7 +875,6 @@ void ARM64Decoder::DecodeConditionalBranch(Instr* instr) { Format(instr, "b'cond 'dest19"); } - void ARM64Decoder::DecodeTestAndBranch(Instr* instr) { const int op = instr->Bit(24); if (op == 0) { @@ -917,7 +884,6 @@ void ARM64Decoder::DecodeTestAndBranch(Instr* instr) { } } - void ARM64Decoder::DecodeUnconditionalBranch(Instr* instr) { const int op = instr->Bit(31); if (op == 0) { @@ -947,7 +913,6 @@ void ARM64Decoder::DecodeCompareBranch(Instr* instr) { } } - void ARM64Decoder::DecodeLoadStore(Instr* instr) { if (instr->IsLoadStoreRegOp()) { DecodeLoadStoreReg(instr); @@ -962,7 +927,6 @@ void ARM64Decoder::DecodeLoadStore(Instr* instr) { } } - void ARM64Decoder::DecodeAddSubShiftExt(Instr* instr) { switch (instr->Bit(30)) { case 0: { @@ -987,7 +951,6 @@ void ARM64Decoder::DecodeAddSubShiftExt(Instr* instr) { } } - void ARM64Decoder::DecodeAddSubWithCarry(Instr* instr) { switch (instr->Bit(30)) { case 0: { @@ -1004,7 +967,6 @@ void ARM64Decoder::DecodeAddSubWithCarry(Instr* instr) { } } - void ARM64Decoder::DecodeLogicalShift(Instr* instr) { const int op = (instr->Bits(29, 2) << 1) | instr->Bit(21); switch (op) { @@ -1044,7 +1006,6 @@ void ARM64Decoder::DecodeLogicalShift(Instr* instr) { } } - void ARM64Decoder::DecodeMiscDP1Source(Instr* instr) { if (instr->Bit(29) != 0) { Unknown(instr); @@ -1061,7 +1022,6 @@ void ARM64Decoder::DecodeMiscDP1Source(Instr* instr) { } } - void ARM64Decoder::DecodeMiscDP2Source(Instr* instr) { if (instr->Bit(29) != 0) { Unknown(instr); @@ -1090,7 +1050,6 @@ void ARM64Decoder::DecodeMiscDP2Source(Instr* instr) { } } - void ARM64Decoder::DecodeMiscDP3Source(Instr* instr) { if ((instr->Bits(29, 2) == 0) && (instr->Bits(21, 3) == 0) && (instr->Bit(15) == 0)) { @@ -1116,7 +1075,6 @@ void ARM64Decoder::DecodeMiscDP3Source(Instr* instr) { } } - void ARM64Decoder::DecodeConditionalSelect(Instr* instr) { if ((instr->Bits(29, 2) == 0) && (instr->Bits(10, 2) == 0)) { Format(instr, "mov'sf'cond 'rd, 'rn, 'rm"); @@ -1129,7 +1087,6 @@ void ARM64Decoder::DecodeConditionalSelect(Instr* instr) { } } - void ARM64Decoder::DecodeDPRegister(Instr* instr) { if (instr->IsAddSubShiftExtOp()) { DecodeAddSubShiftExt(instr); @@ -1150,7 +1107,6 @@ void ARM64Decoder::DecodeDPRegister(Instr* instr) { } } - void ARM64Decoder::DecodeSIMDCopy(Instr* instr) { const int32_t Q = instr->Bit(30); const int32_t op = instr->Bit(29); @@ -1175,7 +1131,6 @@ void ARM64Decoder::DecodeSIMDCopy(Instr* instr) { } } - void ARM64Decoder::DecodeSIMDThreeSame(Instr* instr) { const int32_t Q = instr->Bit(30); const int32_t U = instr->Bit(29); @@ -1233,7 +1188,6 @@ void ARM64Decoder::DecodeSIMDThreeSame(Instr* instr) { } } - void ARM64Decoder::DecodeSIMDTwoReg(Instr* instr) { const int32_t Q = instr->Bit(30); const int32_t U = instr->Bit(29); @@ -1288,7 +1242,6 @@ void ARM64Decoder::DecodeSIMDTwoReg(Instr* instr) { } } - void ARM64Decoder::DecodeDPSimd1(Instr* instr) { if (instr->IsSIMDCopyOp()) { DecodeSIMDCopy(instr); @@ -1301,7 +1254,6 @@ void ARM64Decoder::DecodeDPSimd1(Instr* instr) { } } - void ARM64Decoder::DecodeFPImm(Instr* instr) { if ((instr->Bit(31) != 0) || (instr->Bit(29) != 0) || (instr->Bit(23) != 0) || (instr->Bits(5, 5) != 0)) { @@ -1317,7 +1269,6 @@ void ARM64Decoder::DecodeFPImm(Instr* instr) { } } - void ARM64Decoder::DecodeFPIntCvt(Instr* instr) { if ((instr->Bit(29) != 0)) { Unknown(instr); @@ -1349,7 +1300,6 @@ void ARM64Decoder::DecodeFPIntCvt(Instr* instr) { } } - void ARM64Decoder::DecodeFPOneSource(Instr* instr) { const int opc = instr->Bits(15, 6); @@ -1385,7 +1335,6 @@ void ARM64Decoder::DecodeFPOneSource(Instr* instr) { } } - void ARM64Decoder::DecodeFPTwoSource(Instr* instr) { if (instr->Bits(22, 2) != 1) { Unknown(instr); @@ -1412,7 +1361,6 @@ void ARM64Decoder::DecodeFPTwoSource(Instr* instr) { } } - void ARM64Decoder::DecodeFPCompare(Instr* instr) { if ((instr->Bit(22) == 1) && (instr->Bits(3, 2) == 0)) { Format(instr, "fcmpd 'vn, 'vm"); @@ -1427,7 +1375,6 @@ void ARM64Decoder::DecodeFPCompare(Instr* instr) { } } - void ARM64Decoder::DecodeFP(Instr* instr) { if (instr->IsFPImmOp()) { DecodeFPImm(instr); @@ -1444,7 +1391,6 @@ void ARM64Decoder::DecodeFP(Instr* instr) { } } - void ARM64Decoder::DecodeDPSimd2(Instr* instr) { if (instr->IsFPOp()) { DecodeFP(instr); @@ -1453,7 +1399,6 @@ void ARM64Decoder::DecodeDPSimd2(Instr* instr) { } } - void ARM64Decoder::InstructionDecode(uword pc) { Instr* instr = Instr::At(pc); @@ -1474,7 +1419,6 @@ void ARM64Decoder::InstructionDecode(uword pc) { } } - void Disassembler::DecodeInstruction(char* hex_buffer, intptr_t hex_size, char* human_buffer, diff --git a/runtime/vm/disassembler_dbc.cc b/runtime/vm/disassembler_dbc.cc index 3759bb97d20..e12fdf330e2 100644 --- a/runtime/vm/disassembler_dbc.cc +++ b/runtime/vm/disassembler_dbc.cc @@ -29,7 +29,6 @@ typedef void (*BytecodeFormatter)(char* buffer, uint32_t bc); typedef void (*Fmt)(char** buf, intptr_t* size, uword pc, int32_t value); - template void FormatOperand(char** buf, intptr_t* size, @@ -44,25 +43,20 @@ void FormatOperand(char** buf, } } - static void Fmt___(char** buf, intptr_t* size, uword pc, int32_t value) {} - static void Fmttgt(char** buf, intptr_t* size, uword pc, int32_t value) { FormatOperand(buf, size, "-> %" Px, pc + (value << 2)); } - static void Fmtlit(char** buf, intptr_t* size, uword pc, int32_t value) { FormatOperand(buf, size, "k%d", value); } - static void Fmtreg(char** buf, intptr_t* size, uword pc, int32_t value) { FormatOperand(buf, size, "r%d", value); } - static void Fmtxeg(char** buf, intptr_t* size, uword pc, int32_t value) { if (value < 0) { FormatOperand(buf, size, "FP[%d]", value); @@ -71,12 +65,10 @@ static void Fmtxeg(char** buf, intptr_t* size, uword pc, int32_t value) { } } - static void Fmtnum(char** buf, intptr_t* size, uword pc, int32_t value) { FormatOperand(buf, size, "#%d", value); } - static void Apply(char** buf, intptr_t* size, uword pc, @@ -93,7 +85,6 @@ static void Apply(char** buf, } } - static void Format0(char* buf, intptr_t size, uword pc, @@ -102,7 +93,6 @@ static void Format0(char* buf, Fmt op2, Fmt op3) {} - static void FormatT(char* buf, intptr_t size, uword pc, @@ -114,7 +104,6 @@ static void FormatT(char* buf, Apply(&buf, &size, pc, op1, x, ""); } - static void FormatA(char* buf, intptr_t size, uword pc, @@ -126,7 +115,6 @@ static void FormatA(char* buf, Apply(&buf, &size, pc, op1, a, ""); } - static void FormatA_D(char* buf, intptr_t size, uword pc, @@ -140,7 +128,6 @@ static void FormatA_D(char* buf, Apply(&buf, &size, pc, op2, bc, ""); } - static void FormatA_X(char* buf, intptr_t size, uword pc, @@ -154,7 +141,6 @@ static void FormatA_X(char* buf, Apply(&buf, &size, pc, op2, bc, ""); } - static void FormatX(char* buf, intptr_t size, uword pc, @@ -166,7 +152,6 @@ static void FormatX(char* buf, Apply(&buf, &size, pc, op1, bc, ""); } - static void FormatD(char* buf, intptr_t size, uword pc, @@ -178,7 +163,6 @@ static void FormatD(char* buf, Apply(&buf, &size, pc, op1, bc, ""); } - static void FormatA_B_C(char* buf, intptr_t size, uword pc, @@ -194,7 +178,6 @@ static void FormatA_B_C(char* buf, Apply(&buf, &size, pc, op3, c, ""); } - #define BYTECODE_FORMATTER(name, encoding, op1, op2, op3) \ static void Format##name(char* buf, intptr_t size, uword pc, uint32_t op) { \ Format##encoding(buf, size, pc, op, Fmt##op1, Fmt##op2, Fmt##op3); \ @@ -202,14 +185,12 @@ static void FormatA_B_C(char* buf, BYTECODES_LIST(BYTECODE_FORMATTER) #undef BYTECODE_FORMATTER - static const BytecodeFormatter kFormatters[] = { #define BYTECODE_FORMATTER(name, encoding, op1, op2, op3) &Format##name, BYTECODES_LIST(BYTECODE_FORMATTER) #undef BYTECODE_FORMATTER }; - void Disassembler::DecodeInstruction(char* hex_buffer, intptr_t hex_size, char* human_buffer, @@ -242,7 +223,6 @@ void Disassembler::DecodeInstruction(char* hex_buffer, } } - } // namespace dart #endif // defined TARGET_ARCH_DBC diff --git a/runtime/vm/disassembler_ia32.cc b/runtime/vm/disassembler_ia32.cc index 90957ce1886..35414588d6f 100644 --- a/runtime/vm/disassembler_ia32.cc +++ b/runtime/vm/disassembler_ia32.cc @@ -20,14 +20,12 @@ namespace dart { // Tables used for decoding of x86 instructions. enum OperandOrder { UNSET_OP_ORDER = 0, REG_OPER_OP_ORDER, OPER_REG_OP_ORDER }; - struct ByteMnemonic { int b; // -1 terminates, otherwise must be in range (0..255) const char* mnem; OperandOrder op_order_; }; - static ByteMnemonic two_operands_instr[] = { {0x01, "add", OPER_REG_OP_ORDER}, {0x03, "add", REG_OPER_OP_ORDER}, {0x09, "or", OPER_REG_OP_ORDER}, {0x0B, "or", REG_OPER_OP_ORDER}, @@ -41,7 +39,6 @@ static ByteMnemonic two_operands_instr[] = { {0x8A, "mov_b", REG_OPER_OP_ORDER}, {0x8B, "mov", REG_OPER_OP_ORDER}, {0x8D, "lea", REG_OPER_OP_ORDER}, {-1, "", UNSET_OP_ORDER}}; - static ByteMnemonic zero_operands_instr[] = { {0xC3, "ret", UNSET_OP_ORDER}, {0xC9, "leave", UNSET_OP_ORDER}, {0x90, "nop", UNSET_OP_ORDER}, {0xF4, "hlt", UNSET_OP_ORDER}, @@ -51,40 +48,34 @@ static ByteMnemonic zero_operands_instr[] = { {0x99, "cdq", UNSET_OP_ORDER}, {0x9B, "fwait", UNSET_OP_ORDER}, {-1, "", UNSET_OP_ORDER}}; - static ByteMnemonic call_jump_instr[] = {{0xE8, "call", UNSET_OP_ORDER}, {0xE9, "jmp", UNSET_OP_ORDER}, {-1, "", UNSET_OP_ORDER}}; - static ByteMnemonic short_immediate_instr[] = { {0x05, "add", UNSET_OP_ORDER}, {0x0D, "or", UNSET_OP_ORDER}, {0x15, "adc", UNSET_OP_ORDER}, {0x25, "and", UNSET_OP_ORDER}, {0x2D, "sub", UNSET_OP_ORDER}, {0x35, "xor", UNSET_OP_ORDER}, {0x3D, "cmp", UNSET_OP_ORDER}, {-1, "", UNSET_OP_ORDER}}; - static const char* jump_conditional_mnem[] = { /*0*/ "jo", "jno", "jc", "jnc", /*4*/ "jz", "jnz", "jna", "ja", /*8*/ "js", "jns", "jpe", "jpo", /*12*/ "jl", "jnl", "jng", "jg"}; - static const char* set_conditional_mnem[] = { /*0*/ "seto", "setno", "setc", "setnc", /*4*/ "setz", "setnz", "setna", "seta", /*8*/ "sets", "setns", "setpe", "setpo", /*12*/ "setl", "setnl", "setng", "setg"}; - static const char* conditional_move_mnem[] = { /*0*/ "cmovo", "cmovno", "cmovc", "cmovnc", /*4*/ "cmovz", "cmovnz", "cmovna", "cmova", /*8*/ "cmovs", "cmovns", "cmovpe", "cmovpo", /*12*/ "cmovl", "cmovnl", "cmovng", "cmovg"}; - enum InstructionType { NO_INSTR, ZERO_OPERANDS_INSTR, @@ -96,14 +87,12 @@ enum InstructionType { SHORT_IMMEDIATE_INSTR }; - struct InstructionDesc { const char* mnem; InstructionType type; OperandOrder op_order_; }; - class InstructionTable : public ValueObject { public: InstructionTable(); @@ -123,13 +112,11 @@ class InstructionTable : public ValueObject { DISALLOW_COPY_AND_ASSIGN(InstructionTable); }; - InstructionTable::InstructionTable() { Clear(); Init(); } - void InstructionTable::Clear() { for (int i = 0; i < 256; i++) { instructions_[i].mnem = ""; @@ -138,7 +125,6 @@ void InstructionTable::Clear() { } } - void InstructionTable::Init() { CopyTable(two_operands_instr, TWO_OPERANDS_INSTR); CopyTable(zero_operands_instr, ZERO_OPERANDS_INSTR); @@ -153,7 +139,6 @@ void InstructionTable::Init() { SetTableRange(MOVE_REG_INSTR, 0xB8, 0xBF, "mov"); } - void InstructionTable::CopyTable(ByteMnemonic bm[], InstructionType type) { for (int i = 0; bm[i].b >= 0; i++) { InstructionDesc* id = &instructions_[bm[i].b]; @@ -164,7 +149,6 @@ void InstructionTable::CopyTable(ByteMnemonic bm[], InstructionType type) { } } - void InstructionTable::SetTableRange(InstructionType type, uint8_t start, uint8_t end, @@ -177,7 +161,6 @@ void InstructionTable::SetTableRange(InstructionType type, } } - void InstructionTable::AddJumpConditionalShort() { for (uint8_t b = 0x70; b <= 0x7F; b++) { InstructionDesc* id = &instructions_[b]; @@ -187,10 +170,8 @@ void InstructionTable::AddJumpConditionalShort() { } } - static InstructionTable instruction_table; - // Mnemonics for instructions 0xF0 byte. // Returns NULL if the instruction is not handled here. static const char* F0Mnem(uint8_t f0byte) { @@ -287,7 +268,6 @@ static const char* PackedDoubleMnemonic(uint8_t data) { return mnemonic; } - static bool IsTwoXmmRegInstruction(uint8_t f0byte) { return f0byte == 0x28 || f0byte == 0x11 || f0byte == 0x12 || f0byte == 0x14 || f0byte == 0x15 || f0byte == 0x16 || f0byte == 0x51 || f0byte == 0x52 || @@ -296,7 +276,6 @@ static bool IsTwoXmmRegInstruction(uint8_t f0byte) { f0byte == 0x5F || f0byte == 0x5A; } - // The implementation of x86 decoding based on the above tables. class X86Decoder : public ValueObject { public: @@ -379,7 +358,6 @@ class X86Decoder : public ValueObject { *base = data & 7; } - // Convenience functions. char* get_buffer() const { return buffer_; } char* current_position_in_buffer() { return buffer_ + buffer_pos_; } @@ -392,14 +370,12 @@ class X86Decoder : public ValueObject { DISALLOW_COPY_AND_ASSIGN(X86Decoder); }; - void X86Decoder::PrintInt(int value) { char int_buffer[16]; OS::SNPrint(int_buffer, sizeof(int_buffer), "%#x", value); Print(int_buffer); } - // Append the int value (printed in hex) to the output buffer. void X86Decoder::PrintHex(int value, bool signed_value) { char hex_buffer[16]; @@ -411,7 +387,6 @@ void X86Decoder::PrintHex(int value, bool signed_value) { Print(hex_buffer); } - // Append the str to the output buffer. void X86Decoder::Print(const char* str) { char cur = *str++; @@ -422,7 +397,6 @@ void X86Decoder::Print(const char* str) { buffer_[buffer_pos_] = '\0'; } - static const int kMaxCPURegisters = 8; static const char* cpu_regs[kMaxCPURegisters] = {"eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi"}; @@ -441,14 +415,12 @@ void X86Decoder::PrintCPURegister(int reg) { Print(cpu_regs[reg]); } - void X86Decoder::PrintCPUByteRegister(int reg) { ASSERT(0 <= reg); ASSERT(reg < kMaxByteCPURegisters); Print(byte_cpu_regs[reg]); } - void X86Decoder::PrintXmmRegister(int reg) { ASSERT(0 <= reg); ASSERT(reg < kMaxXmmRegisters); @@ -463,7 +435,6 @@ void X86Decoder::PrintXmmComparison(int comparison) { Print(comparisons[comparison]); } - void X86Decoder::PrintAddress(uword addr) { char addr_buffer[32]; OS::SNPrint(addr_buffer, sizeof(addr_buffer), "%#" Px "", addr); @@ -478,7 +449,6 @@ void X86Decoder::PrintAddress(uword addr) { } } - int X86Decoder::PrintRightOperandHelper(uint8_t* modrmp, RegisterNamePrinter register_printer) { int mod, regop, rm; @@ -599,22 +569,18 @@ int X86Decoder::PrintRightOperandHelper(uint8_t* modrmp, UNREACHABLE(); } - int X86Decoder::PrintRightOperand(uint8_t* modrmp) { return PrintRightOperandHelper(modrmp, &X86Decoder::PrintCPURegister); } - int X86Decoder::PrintRightXmmOperand(uint8_t* modrmp) { return PrintRightOperandHelper(modrmp, &X86Decoder::PrintXmmRegister); } - int X86Decoder::PrintRightByteOperand(uint8_t* modrmp) { return PrintRightOperandHelper(modrmp, &X86Decoder::PrintCPUByteRegister); } - int X86Decoder::PrintOperands(const char* mnem, OperandOrder op_order, uint8_t* data) { @@ -646,7 +612,6 @@ int X86Decoder::PrintOperands(const char* mnem, return advance; } - int X86Decoder::PrintImmediateOp(uint8_t* data, bool size_override) { bool sign_extension_bit = (*data & 0x02) != 0; uint8_t modrm = *(data + 1); @@ -697,7 +662,6 @@ int X86Decoder::PrintImmediateOp(uint8_t* data, bool size_override) { } } - int X86Decoder::DecodeEnter(uint8_t* data) { uint16_t size = *reinterpret_cast(data + 1); uint8_t level = *reinterpret_cast(data + 3); @@ -708,7 +672,6 @@ int X86Decoder::DecodeEnter(uint8_t* data) { return 4; } - // Returns number of bytes used, including *data. int X86Decoder::JumpShort(uint8_t* data) { ASSERT(*data == 0xEB); @@ -719,7 +682,6 @@ int X86Decoder::JumpShort(uint8_t* data) { return 2; } - // Returns number of bytes used, including *data. int X86Decoder::JumpConditional(uint8_t* data, const char* comment) { ASSERT(*data == 0x0F); @@ -737,7 +699,6 @@ int X86Decoder::JumpConditional(uint8_t* data, const char* comment) { return 6; // includes 0x0F } - // Returns number of bytes used, including *data. int X86Decoder::JumpConditionalShort(uint8_t* data, const char* comment) { uint8_t cond = *data & 0x0F; @@ -754,7 +715,6 @@ int X86Decoder::JumpConditionalShort(uint8_t* data, const char* comment) { return 2; } - // Returns number of bytes used, including *data. int X86Decoder::SetCC(uint8_t* data) { ASSERT(*data == 0x0F); @@ -766,7 +726,6 @@ int X86Decoder::SetCC(uint8_t* data) { return 3; // includes 0x0F } - // Returns number of bytes used, including *data. int X86Decoder::CMov(uint8_t* data) { ASSERT(*data == 0x0F); @@ -776,7 +735,6 @@ int X86Decoder::CMov(uint8_t* data) { return 2 + op_size; // includes 0x0F } - int X86Decoder::D1D3C1Instruction(uint8_t* data) { uint8_t op = *data; ASSERT(op == 0xD1 || op == 0xD3 || op == 0xC1); @@ -820,7 +778,6 @@ int X86Decoder::D1D3C1Instruction(uint8_t* data) { return num_bytes; } - uint8_t* X86Decoder::F3Instruction(uint8_t* data) { if (*(data + 1) == 0x0F) { uint8_t b2 = *(data + 2); @@ -937,7 +894,6 @@ uint8_t* X86Decoder::F3Instruction(uint8_t* data) { return data; } - // Returns number of bytes used, including *data. int X86Decoder::F7Instruction(uint8_t* data) { ASSERT(*data == 0xF7); @@ -1181,7 +1137,6 @@ int X86Decoder::FPUInstruction(uint8_t* data) { return 2; } - uint8_t* X86Decoder::SSEInstruction(uint8_t prefix, uint8_t primary, uint8_t* data) { @@ -1213,7 +1168,6 @@ uint8_t* X86Decoder::SSEInstruction(uint8_t prefix, return data; } - int X86Decoder::BitwisePDInstruction(uint8_t* data) { const char* mnem = (*data == 0x57) ? "xorpd" : (*data == 0x56) ? "orpd" : "andpd"; @@ -1226,7 +1180,6 @@ int X86Decoder::BitwisePDInstruction(uint8_t* data) { return 1 + PrintRightXmmOperand(data + 1); } - int X86Decoder::Packed660F38Instruction(uint8_t* data) { if (*(data + 1) == 0x25) { Print("pmovsxdq "); @@ -1247,7 +1200,6 @@ int X86Decoder::Packed660F38Instruction(uint8_t* data) { return 1; } - // Called when disassembling test eax, 0xXXXXX. void X86Decoder::CheckPrintStop(uint8_t* data) { // Recognize stop pattern. @@ -1277,7 +1229,6 @@ const char* X86Decoder::GetBranchPrefix(uint8_t** data) { } } - bool X86Decoder::DecodeInstructionType(const InstructionDesc& idesc, const char* branch_hint, uint8_t** data) { @@ -1340,7 +1291,6 @@ bool X86Decoder::DecodeInstructionType(const InstructionDesc& idesc, } } - int X86Decoder::InstructionDecode(uword pc) { uint8_t* data = reinterpret_cast(pc); // Check for hints. @@ -1912,7 +1862,6 @@ int X86Decoder::InstructionDecode(uword pc) { return instr_len; } // NOLINT - void Disassembler::DecodeInstruction(char* hex_buffer, intptr_t hex_size, char* human_buffer, diff --git a/runtime/vm/disassembler_test.cc b/runtime/vm/disassembler_test.cc index 8df643e3572..81cb8466289 100644 --- a/runtime/vm/disassembler_test.cc +++ b/runtime/vm/disassembler_test.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "vm/assembler.h" #include "vm/disassembler.h" +#include "vm/assembler.h" #include "vm/unit_test.h" #include "vm/virtual_memory.h" diff --git a/runtime/vm/disassembler_x64.cc b/runtime/vm/disassembler_x64.cc index 26735dfd65e..657fbc07fb0 100644 --- a/runtime/vm/disassembler_x64.cc +++ b/runtime/vm/disassembler_x64.cc @@ -38,7 +38,6 @@ struct ByteMnemonic { const char* mnem; }; - static const ByteMnemonic two_operands_instr[] = { {0x00, BYTE_OPER_REG_OP_ORDER, "add"}, {0x01, OPER_REG_OP_ORDER, "add"}, @@ -84,7 +83,6 @@ static const ByteMnemonic two_operands_instr[] = { {0x8D, REG_OPER_OP_ORDER, "lea"}, {-1, UNSET_OP_ORDER, ""}}; - static const ByteMnemonic zero_operands_instr[] = { {0xC3, UNSET_OP_ORDER, "ret"}, {0xC9, UNSET_OP_ORDER, "leave"}, {0xF4, UNSET_OP_ORDER, "hlt"}, {0xFC, UNSET_OP_ORDER, "cld"}, @@ -96,12 +94,10 @@ static const ByteMnemonic zero_operands_instr[] = { {0xA6, UNSET_OP_ORDER, "cmps"}, {0xA7, UNSET_OP_ORDER, "cmps"}, {-1, UNSET_OP_ORDER, ""}}; - static const ByteMnemonic call_jump_instr[] = {{0xE8, UNSET_OP_ORDER, "call"}, {0xE9, UNSET_OP_ORDER, "jmp"}, {-1, UNSET_OP_ORDER, ""}}; - static const ByteMnemonic short_immediate_instr[] = { {0x05, UNSET_OP_ORDER, "add"}, {0x0D, UNSET_OP_ORDER, "or"}, {0x15, UNSET_OP_ORDER, "adc"}, {0x1D, UNSET_OP_ORDER, "sbb"}, @@ -109,12 +105,10 @@ static const ByteMnemonic short_immediate_instr[] = { {0x35, UNSET_OP_ORDER, "xor"}, {0x3D, UNSET_OP_ORDER, "cmp"}, {-1, UNSET_OP_ORDER, ""}}; - static const char* const conditional_code_suffix[] = { "o", "no", "c", "nc", "z", "nz", "na", "a", "s", "ns", "pe", "po", "l", "ge", "le", "g"}; - enum InstructionType { NO_INSTR, ZERO_OPERANDS_INSTR, @@ -127,7 +121,6 @@ enum InstructionType { SHORT_IMMEDIATE_INSTR }; - enum Prefixes { ESCAPE_PREFIX = 0x0F, OPERAND_SIZE_OVERRIDE_PREFIX = 0x66, @@ -137,7 +130,6 @@ enum Prefixes { REPEQ_PREFIX = REP_PREFIX }; - struct InstructionDesc { const char* mnem; InstructionType type; @@ -145,7 +137,6 @@ struct InstructionDesc { bool byte_size_operation; // Fixed 8-bit operation. }; - class InstructionTable : public ValueObject { public: InstructionTable(); @@ -166,13 +157,11 @@ class InstructionTable : public ValueObject { DISALLOW_COPY_AND_ASSIGN(InstructionTable); }; - InstructionTable::InstructionTable() { Clear(); Init(); } - void InstructionTable::Clear() { for (int i = 0; i < 256; i++) { instructions_[i].mnem = "(bad)"; @@ -182,7 +171,6 @@ void InstructionTable::Clear() { } } - void InstructionTable::Init() { CopyTable(two_operands_instr, TWO_OPERANDS_INSTR); CopyTable(zero_operands_instr, ZERO_OPERANDS_INSTR); @@ -194,7 +182,6 @@ void InstructionTable::Init() { SetTableRange(MOVE_REG_INSTR, 0xB8, 0xBF, false, "mov"); } - void InstructionTable::CopyTable(const ByteMnemonic bm[], InstructionType type) { for (int i = 0; bm[i].b >= 0; i++) { @@ -209,7 +196,6 @@ void InstructionTable::CopyTable(const ByteMnemonic bm[], } } - void InstructionTable::SetTableRange(InstructionType type, uint8_t start, uint8_t end, @@ -224,7 +210,6 @@ void InstructionTable::SetTableRange(InstructionType type, } } - void InstructionTable::AddJumpConditionalShort() { for (uint8_t b = 0x70; b <= 0x7F; b++) { InstructionDesc* id = &instructions_[b]; @@ -234,10 +219,8 @@ void InstructionTable::AddJumpConditionalShort() { } } - static InstructionTable instruction_table; - static InstructionDesc cmov_instructions[16] = { {"cmovo", TWO_OPERANDS_INSTR, REG_OPER_OP_ORDER, false}, {"cmovno", TWO_OPERANDS_INSTR, REG_OPER_OP_ORDER, false}, @@ -256,11 +239,9 @@ static InstructionDesc cmov_instructions[16] = { {"cmovle", TWO_OPERANDS_INSTR, REG_OPER_OP_ORDER, false}, {"cmovg", TWO_OPERANDS_INSTR, REG_OPER_OP_ORDER, false}}; - //------------------------------------------------- // DisassemblerX64 implementation. - static const int kMaxXmmRegisters = 16; static const char* xmm_regs[kMaxXmmRegisters] = { "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7", @@ -392,7 +373,6 @@ class DisassemblerX64 : public ValueObject { DISALLOW_COPY_AND_ASSIGN(DisassemblerX64); }; - // Append the str to the output buffer. void DisassemblerX64::Print(const char* format, ...) { intptr_t available = buffer_size_ - buffer_pos_; @@ -410,7 +390,6 @@ void DisassemblerX64::Print(const char* format, ...) { ASSERT(buffer_pos_ < buffer_size_); } - int DisassemblerX64::PrintRightOperandHelper( uint8_t* modrmp, RegisterNameMapping direct_register_name) { @@ -491,7 +470,6 @@ int DisassemblerX64::PrintRightOperandHelper( UNREACHABLE(); } - int DisassemblerX64::PrintImmediate(uint8_t* data, OperandSize size, bool sign_extend) { @@ -553,7 +531,6 @@ void DisassemblerX64::PrintDisp(int disp, const char* after) { if (after != NULL) Print("%s", after); } - // Returns number of bytes used by machine instruction, including *data byte. // Writes immediate instructions to 'tmp_buffer_'. int DisassemblerX64::PrintImmediateOp(uint8_t* data) { @@ -599,7 +576,6 @@ int DisassemblerX64::PrintImmediateOp(uint8_t* data) { return 1 + count; } - // Returns number of bytes used, including *data. int DisassemblerX64::F6F7Instruction(uint8_t* data) { ASSERT(*data == 0xF7 || *data == 0xF6); @@ -641,7 +617,6 @@ int DisassemblerX64::F6F7Instruction(uint8_t* data) { } } - int DisassemblerX64::ShiftInstruction(uint8_t* data) { uint8_t op = *data & (~1); if (op != 0xD0 && op != 0xD2 && op != 0xC0) { @@ -702,23 +677,19 @@ int DisassemblerX64::ShiftInstruction(uint8_t* data) { return num_bytes; } - int DisassemblerX64::PrintRightOperand(uint8_t* modrmp) { return PrintRightOperandHelper(modrmp, &DisassemblerX64::NameOfCPURegister); } - int DisassemblerX64::PrintRightByteOperand(uint8_t* modrmp) { return PrintRightOperandHelper(modrmp, &DisassemblerX64::NameOfByteCPURegister); } - int DisassemblerX64::PrintRightXMMOperand(uint8_t* modrmp) { return PrintRightOperandHelper(modrmp, &DisassemblerX64::NameOfXMMRegister); } - // Returns number of bytes used including the current *data. // Writes instruction's mnemonic, left and right operands to 'tmp_buffer_'. int DisassemblerX64::PrintOperands(const char* mnem, @@ -751,13 +722,11 @@ int DisassemblerX64::PrintOperands(const char* mnem, return advance; } - void DisassemblerX64::PrintAddress(uint8_t* addr_byte_ptr) { uword addr = reinterpret_cast(addr_byte_ptr); Print("%#" Px "", addr); } - // Returns number of bytes used, including *data. int DisassemblerX64::JumpShort(uint8_t* data) { ASSERT(0xEB == *data); @@ -768,7 +737,6 @@ int DisassemblerX64::JumpShort(uint8_t* data) { return 2; } - // Returns number of bytes used, including *data. int DisassemblerX64::JumpConditional(uint8_t* data) { ASSERT(0x0F == *data); @@ -780,7 +748,6 @@ int DisassemblerX64::JumpConditional(uint8_t* data) { return 6; // includes 0x0F } - // Returns number of bytes used, including *data. int DisassemblerX64::JumpConditionalShort(uint8_t* data) { uint8_t cond = *data & 0x0F; @@ -792,7 +759,6 @@ int DisassemblerX64::JumpConditionalShort(uint8_t* data) { return 2; } - // Returns number of bytes used, including *data. int DisassemblerX64::SetCC(uint8_t* data) { ASSERT(0x0F == *data); @@ -803,7 +769,6 @@ int DisassemblerX64::SetCC(uint8_t* data) { return 3; // includes 0x0F } - // Returns number of bytes used, including *data. int DisassemblerX64::FPUInstruction(uint8_t* data) { uint8_t escape_opcode = *data; @@ -817,7 +782,6 @@ int DisassemblerX64::FPUInstruction(uint8_t* data) { } } - int DisassemblerX64::MemoryFPUInstruction(int escape_opcode, int modrm_byte, uint8_t* modrm_start) { @@ -1070,7 +1034,6 @@ int DisassemblerX64::RegisterFPUInstruction(int escape_opcode, return 2; } - // TODO(srdjan): Should we add a branch hint argument? bool DisassemblerX64::DecodeInstructionType(uint8_t** data) { uint8_t current; @@ -1185,7 +1148,6 @@ bool DisassemblerX64::DecodeInstructionType(uint8_t** data) { return true; } - // Handle all two-byte opcodes, which start with 0x0F. // These instructions may be affected by an 0x66, 0xF2, or 0xF3 prefix. // We do not use any three-byte opcodes, which start with 0x0F38 or 0x0F3A. @@ -1568,7 +1530,6 @@ int DisassemblerX64::TwoByteOpcodeInstruction(uint8_t* data) { return static_cast(current - data); } - // Mnemonics for two-byte opcode instructions starting with 0x0F. // The argument is the second byte of the two-byte opcode. // Returns NULL if the instruction is not handled here. @@ -1626,7 +1587,6 @@ const char* DisassemblerX64::TwoByteMnemonic(uint8_t opcode) { } } - int DisassemblerX64::InstructionDecode(uword pc) { uint8_t* data = reinterpret_cast(pc); @@ -1943,7 +1903,6 @@ int DisassemblerX64::InstructionDecode(uword pc) { return instr_len; } - void Disassembler::DecodeInstruction(char* hex_buffer, intptr_t hex_size, char* human_buffer, diff --git a/runtime/vm/double_conversion.cc b/runtime/vm/double_conversion.cc index 4490d5faf0a..1cd64596ac7 100644 --- a/runtime/vm/double_conversion.cc +++ b/runtime/vm/double_conversion.cc @@ -90,7 +90,6 @@ RawString* DoubleToStringAsFixed(double d, int fraction_digits) { return String::New(builder.Finalize()); } - RawString* DoubleToStringAsExponential(double d, int fraction_digits) { static const int kMinFractionDigits = -1; // -1 represents shortest mode. static const int kMaxFractionDigits = 20; @@ -121,7 +120,6 @@ RawString* DoubleToStringAsExponential(double d, int fraction_digits) { return String::New(builder.Finalize()); } - RawString* DoubleToStringAsPrecision(double d, int precision) { static const int kMinPrecisionDigits = 1; static const int kMaxPrecisionDigits = 21; @@ -158,7 +156,6 @@ RawString* DoubleToStringAsPrecision(double d, int precision) { return String::New(builder.Finalize()); } - bool CStringToDouble(const char* str, intptr_t length, double* result) { if (length == 0) { return false; @@ -174,5 +171,4 @@ bool CStringToDouble(const char* str, intptr_t length, double* result) { return (parsed_count == length); } - } // namespace dart diff --git a/runtime/vm/dwarf.cc b/runtime/vm/dwarf.cc index d5cd28fcf87..2b2bf2af68b 100644 --- a/runtime/vm/dwarf.cc +++ b/runtime/vm/dwarf.cc @@ -48,7 +48,6 @@ class InliningNode : public ZoneAllocated { InliningNode* children_next; }; - Dwarf::Dwarf(Zone* zone, WriteStream* stream) : zone_(zone), stream_(stream), @@ -60,7 +59,6 @@ Dwarf::Dwarf(Zone* zone, WriteStream* stream) script_to_index_(zone), temp_(0) {} - intptr_t Dwarf::AddCode(const Code& code) { ASSERT(!code.IsNull()); CodeIndexPair* pair = code_to_index_.Lookup(&code); @@ -87,7 +85,6 @@ intptr_t Dwarf::AddCode(const Code& code) { return index; } - intptr_t Dwarf::AddFunction(const Function& function) { ASSERT(!function.IsNull()); FunctionIndexPair* pair = function_to_index_.Lookup(&function); @@ -103,7 +100,6 @@ intptr_t Dwarf::AddFunction(const Function& function) { return index; } - intptr_t Dwarf::AddScript(const Script& script) { ASSERT(!script.IsNull()); ScriptIndexPair* pair = script_to_index_.Lookup(&script); @@ -118,7 +114,6 @@ intptr_t Dwarf::AddScript(const Script& script) { return index; } - intptr_t Dwarf::LookupFunction(const Function& function) { ASSERT(!function.IsNull()); FunctionIndexPair* pair = function_to_index_.Lookup(&function); @@ -129,7 +124,6 @@ intptr_t Dwarf::LookupFunction(const Function& function) { return pair->index_; } - intptr_t Dwarf::LookupScript(const Script& script) { ASSERT(!script.IsNull()); ScriptIndexPair* pair = script_to_index_.Lookup(&script); @@ -140,7 +134,6 @@ intptr_t Dwarf::LookupScript(const Script& script) { return pair->index_; } - void Dwarf::Print(const char* format, ...) { va_list args; va_start(args, format); @@ -148,7 +141,6 @@ void Dwarf::Print(const char* format, ...) { va_end(args); } - void Dwarf::WriteAbbreviations() { // Dwarf data mostly takes the form of a tree, whose nodes are called // DIEs. Each DIE begins with an abbreviation code, and the abbreviation @@ -226,7 +218,6 @@ void Dwarf::WriteAbbreviations() { uleb128(0); // End of abbreviations. } - void Dwarf::WriteCompilationUnit() { // 7.5.1.1 Compilation Unit Header @@ -289,7 +280,6 @@ void Dwarf::WriteCompilationUnit() { Print(".Lcu_end:\n"); } - void Dwarf::WriteAbstractFunctions() { Script& script = Script::Handle(zone_); String& name = String::Handle(zone_); @@ -310,7 +300,6 @@ void Dwarf::WriteAbstractFunctions() { } } - void Dwarf::WriteConcreteFunctions() { Function& function = Function::Handle(zone_); Script& script = Script::Handle(zone_); @@ -349,7 +338,6 @@ void Dwarf::WriteConcreteFunctions() { } } - // Our state machine encodes position metadata such that we don't know the // end pc for an inlined function until it is popped, but DWARF DIEs encode // it where the function is pushed. We expand the state transitions into @@ -424,7 +412,6 @@ InliningNode* Dwarf::ExpandInliningTree(const Code& code) { return root_node; } - void Dwarf::WriteInliningNode(InliningNode* node, intptr_t root_code_index, const Script& parent_script) { @@ -459,7 +446,6 @@ void Dwarf::WriteInliningNode(InliningNode* node, uleb128(0); // End of children. } - void Dwarf::WriteLines() { #if defined(TARGET_OS_MACOS) || defined(TARGET_OS_MACOS_IOS) Print(".section __DWARF,__debug_line,regular,debug\n"); diff --git a/runtime/vm/exceptions.cc b/runtime/vm/exceptions.cc index 7b715410609..343373fa127 100644 --- a/runtime/vm/exceptions.cc +++ b/runtime/vm/exceptions.cc @@ -23,7 +23,6 @@ #include "vm/symbols.h" #include "vm/tags.h" - namespace dart { DECLARE_FLAG(bool, trace_deoptimization); @@ -32,7 +31,6 @@ DEFINE_FLAG(bool, false, "Prints a stack trace everytime a throw occurs."); - class StackTraceBuilder : public ValueObject { public: StackTraceBuilder() {} @@ -41,7 +39,6 @@ class StackTraceBuilder : public ValueObject { virtual void AddFrame(const Code& code, const Smi& offset) = 0; }; - class RegularStackTraceBuilder : public StackTraceBuilder { public: explicit RegularStackTraceBuilder(Zone* zone) @@ -66,7 +63,6 @@ class RegularStackTraceBuilder : public StackTraceBuilder { DISALLOW_COPY_AND_ASSIGN(RegularStackTraceBuilder); }; - class PreallocatedStackTraceBuilder : public StackTraceBuilder { public: explicit PreallocatedStackTraceBuilder(const Instance& stacktrace) @@ -90,7 +86,6 @@ class PreallocatedStackTraceBuilder : public StackTraceBuilder { DISALLOW_COPY_AND_ASSIGN(PreallocatedStackTraceBuilder); }; - void PreallocatedStackTraceBuilder::AddFrame(const Code& code, const Smi& offset) { if (cur_index_ >= StackTrace::kPreallocatedStackdepth) { @@ -126,7 +121,6 @@ void PreallocatedStackTraceBuilder::AddFrame(const Code& code, cur_index_ += 1; } - static void BuildStackTrace(StackTraceBuilder* builder) { StackFrameIterator frames(StackFrameIterator::kDontValidateFrames, Thread::Current(), @@ -146,7 +140,6 @@ static void BuildStackTrace(StackTraceBuilder* builder) { } } - static RawObject** VariableAt(uword fp, int stack_slot) { #if defined(TARGET_ARCH_DBC) return reinterpret_cast(fp + stack_slot * kWordSize); @@ -160,7 +153,6 @@ static RawObject** VariableAt(uword fp, int stack_slot) { #endif } - class ExceptionHandlerFinder : public StackResource { public: explicit ExceptionHandlerFinder(Thread* thread) @@ -347,7 +339,6 @@ class ExceptionHandlerFinder : public StackResource { intptr_t pc_; // Current pc in the handler frame. }; - static void FindErrorHandler(uword* handler_pc, uword* handler_sp, uword* handler_fp) { @@ -366,7 +357,6 @@ static void FindErrorHandler(uword* handler_pc, *handler_fp = frame->fp(); } - static uword RemapExceptionPCForDeopt(Thread* thread, uword program_counter, uword frame_pointer) { @@ -396,7 +386,6 @@ static uword RemapExceptionPCForDeopt(Thread* thread, return program_counter; } - static void ClearLazyDeopts(Thread* thread, uword frame_pointer) { #if !defined(TARGET_ARCH_DBC) MallocGrowableArray* pending_deopts = @@ -440,7 +429,6 @@ static void ClearLazyDeopts(Thread* thread, uword frame_pointer) { #endif // !DBC } - static void JumpToExceptionHandler(Thread* thread, uword program_counter, uword stack_pointer, @@ -457,7 +445,6 @@ static void JumpToExceptionHandler(Thread* thread, frame_pointer, false /* do not clear deopt */); } - void Exceptions::JumpToFrame(Thread* thread, uword program_counter, uword stack_pointer, @@ -499,7 +486,6 @@ void Exceptions::JumpToFrame(Thread* thread, UNREACHABLE(); } - static RawField* LookupStackTraceField(const Instance& instance) { if (instance.GetClassId() < kNumPredefinedCids) { // 'class Error' is not a predefined class. @@ -532,12 +518,10 @@ static RawField* LookupStackTraceField(const Instance& instance) { return Field::null(); } - RawStackTrace* Exceptions::CurrentStackTrace() { return GetStackTraceForException(); } - static void ThrowExceptionHelper(Thread* thread, const Instance& incoming_exception, const Instance& existing_stacktrace, @@ -637,7 +621,6 @@ static void ThrowExceptionHelper(Thread* thread, UNREACHABLE(); } - // Static helpers for allocating, initializing, and throwing an error instance. // Return the script of the Dart function that called the native entry or the @@ -650,7 +633,6 @@ RawScript* Exceptions::GetCallerScript(DartFrameIterator* iterator) { return caller.script(); } - // Allocate a new instance of the given class name. // TODO(hausner): Rename this NewCoreInstance to call out the fact that // the class name is resolved in the core library implicitly? @@ -667,7 +649,6 @@ RawInstance* Exceptions::NewInstance(const char* class_name) { return Instance::New(cls); } - // Allocate, initialize, and throw a TypeError or CastError. // If error_msg is not null, throw a TypeError, even for a type cast. void Exceptions::CreateAndThrowTypeError(TokenPosition location, @@ -778,7 +759,6 @@ void Exceptions::CreateAndThrowTypeError(TokenPosition location, UNREACHABLE(); } - void Exceptions::Throw(Thread* thread, const Instance& exception) { // Do not notify debugger on stack overflow and out of memory exceptions. // The VM would crash when the debugger calls back into the VM to @@ -795,7 +775,6 @@ void Exceptions::Throw(Thread* thread, const Instance& exception) { false); } - void Exceptions::ReThrow(Thread* thread, const Instance& exception, const Instance& stacktrace) { @@ -803,7 +782,6 @@ void Exceptions::ReThrow(Thread* thread, ThrowExceptionHelper(thread, exception, stacktrace, true); } - void Exceptions::PropagateError(const Error& error) { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -829,7 +807,6 @@ void Exceptions::PropagateError(const Error& error) { UNREACHABLE(); } - void Exceptions::ThrowByType(ExceptionType type, const Array& arguments) { Thread* thread = Thread::Current(); const Object& result = @@ -844,7 +821,6 @@ void Exceptions::ThrowByType(ExceptionType type, const Array& arguments) { } } - void Exceptions::ThrowOOM() { Thread* thread = Thread::Current(); Isolate* isolate = thread->isolate(); @@ -853,7 +829,6 @@ void Exceptions::ThrowOOM() { Throw(thread, oom); } - void Exceptions::ThrowStackOverflow() { Thread* thread = Thread::Current(); Isolate* isolate = thread->isolate(); @@ -862,14 +837,12 @@ void Exceptions::ThrowStackOverflow() { Throw(thread, stack_overflow); } - void Exceptions::ThrowArgumentError(const Instance& arg) { const Array& args = Array::Handle(Array::New(1)); args.SetAt(0, arg); Exceptions::ThrowByType(Exceptions::kArgument, args); } - void Exceptions::ThrowRangeError(const char* argument_name, const Integer& argument_value, intptr_t expected_from, @@ -882,21 +855,18 @@ void Exceptions::ThrowRangeError(const char* argument_name, Exceptions::ThrowByType(Exceptions::kRange, args); } - void Exceptions::ThrowRangeErrorMsg(const char* msg) { const Array& args = Array::Handle(Array::New(1)); args.SetAt(0, String::Handle(String::New(msg))); Exceptions::ThrowByType(Exceptions::kRangeMsg, args); } - void Exceptions::ThrowCompileTimeError(const LanguageError& error) { const Array& args = Array::Handle(Array::New(1)); args.SetAt(0, String::Handle(error.FormatMessage())); Exceptions::ThrowByType(Exceptions::kCompileTimeError, args); } - RawObject* Exceptions::Create(ExceptionType type, const Array& arguments) { Library& library = Library::Handle(); const String* class_name = NULL; @@ -988,5 +958,4 @@ RawObject* Exceptions::Create(ExceptionType type, const Array& arguments) { *constructor_name, arguments); } - } // namespace dart diff --git a/runtime/vm/exceptions.h b/runtime/vm/exceptions.h index 9debccee01d..114e0851d62 100644 --- a/runtime/vm/exceptions.h +++ b/runtime/vm/exceptions.h @@ -102,7 +102,6 @@ struct ExceptionHandlerInfo { int8_t is_generated; // True if this is a generated handler. }; - class CatchEntryState { public: enum { kCatchEntryStateIsMove = 1, kCatchEntryStateDestShift = 1 }; diff --git a/runtime/vm/exceptions_test.cc b/runtime/vm/exceptions_test.cc index 5fbfaa240fc..55ca3941981 100644 --- a/runtime/vm/exceptions_test.cc +++ b/runtime/vm/exceptions_test.cc @@ -9,11 +9,9 @@ namespace dart { - #define FUNCTION_NAME(name) UnhandledExcp_##name #define REGISTER_FUNCTION(name, count) {"" #name, FUNCTION_NAME(name), count}, - void FUNCTION_NAME(Unhandled_equals)(Dart_NativeArguments args) { NativeArguments* arguments = reinterpret_cast(args); const Instance& expected = Instance::CheckedHandle(arguments->NativeArgAt(0)); @@ -25,7 +23,6 @@ void FUNCTION_NAME(Unhandled_equals)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(Unhandled_invoke)(Dart_NativeArguments args) { // Invoke the specified entry point. Dart_Handle cls = Dart_GetClass(TestCase::lib(), NewString("Second")); @@ -35,7 +32,6 @@ void FUNCTION_NAME(Unhandled_invoke)(Dart_NativeArguments args) { return; } - void FUNCTION_NAME(Unhandled_invoke2)(Dart_NativeArguments args) { // Invoke the specified entry point. Dart_Handle cls = Dart_GetClass(TestCase::lib(), NewString("Second")); @@ -49,7 +45,6 @@ void FUNCTION_NAME(Unhandled_invoke2)(Dart_NativeArguments args) { return; } - // List all native functions implemented in the vm or core boot strap dart // libraries so that we can resolve the native function to it's entry // point. @@ -58,14 +53,12 @@ void FUNCTION_NAME(Unhandled_invoke2)(Dart_NativeArguments args) { V(Unhandled_invoke, 0) \ V(Unhandled_invoke2, 0) - static struct NativeEntries { const char* name_; Dart_NativeFunction function_; int argument_count_; } BuiltinEntries[] = {UNHANDLED_NATIVE_LIST(REGISTER_FUNCTION)}; - static Dart_NativeFunction native_lookup(Dart_Handle name, int argument_count, bool* auto_setup_scope) { @@ -86,7 +79,6 @@ static Dart_NativeFunction native_lookup(Dart_Handle name, return NULL; } - // Unit test case to verify unhandled exceptions. TEST_CASE(UnhandledExceptions) { const char* kScriptChars = diff --git a/runtime/vm/fixed_cache.h b/runtime/vm/fixed_cache.h index 2d6e00a7507..1af3a93cf90 100644 --- a/runtime/vm/fixed_cache.h +++ b/runtime/vm/fixed_cache.h @@ -53,9 +53,7 @@ class FixedCache { pairs_[i].value = value; } - void Clear() { - length_ = 0; - } + void Clear() { length_ = 0; } private: intptr_t LowerBound(K key) { diff --git a/runtime/vm/fixed_cache_test.cc b/runtime/vm/fixed_cache_test.cc index b27202890ff..849c4fbc303 100644 --- a/runtime/vm/fixed_cache_test.cc +++ b/runtime/vm/fixed_cache_test.cc @@ -2,9 +2,9 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +#include "vm/fixed_cache.h" #include #include "platform/assert.h" -#include "vm/fixed_cache.h" #include "vm/unit_test.h" namespace dart { @@ -18,7 +18,6 @@ UNIT_TEST_CASE(FixedCacheEmpty) { EXPECT(cache.Lookup(0) == NULL); } - UNIT_TEST_CASE(FixedCacheHalfFull) { FixedCache cache; // Insert at end. @@ -42,7 +41,6 @@ UNIT_TEST_CASE(FixedCacheHalfFull) { EXPECT(cache.Lookup(50) == NULL); } - struct Resource { Resource() : id(0) { copies++; } explicit Resource(int id_) : id(id_) { copies++; } diff --git a/runtime/vm/flags.cc b/runtime/vm/flags.cc index 5c7d2467538..998d322f8bf 100644 --- a/runtime/vm/flags.cc +++ b/runtime/vm/flags.cc @@ -60,7 +60,6 @@ DEFINE_FLAG(bool, Flags::Register_##type(&FLAG_##name, #name, default_value, comment); #endif - // Define all of the non-product flags here. FLAG_LIST(PRODUCT_FLAG_MARCO, RELEASE_FLAG_MARCO, @@ -72,7 +71,6 @@ FLAG_LIST(PRODUCT_FLAG_MARCO, #undef PRODUCT_FLAG_MARCO #undef PRECOMPILE_FLAG_MARCO - bool Flags::initialized_ = false; // List of registered flags. @@ -144,7 +142,6 @@ class Flag { bool changed_; }; - Flag* Flags::Lookup(const char* name) { for (intptr_t i = 0; i < num_flags_; i++) { Flag* flag = flags_[i]; @@ -155,14 +152,12 @@ Flag* Flags::Lookup(const char* name) { return NULL; } - bool Flags::IsSet(const char* name) { Flag* flag = Lookup(name); return (flag != NULL) && (flag->type_ == Flag::kBoolean) && (flag->bool_ptr_ != NULL) && (*flag->bool_ptr_ == true); } - void Flags::AddFlag(Flag* flag) { ASSERT(!initialized_); if (num_flags_ == capacity_) { @@ -183,7 +178,6 @@ void Flags::AddFlag(Flag* flag) { flags_[num_flags_++] = flag; } - bool Flags::Register_bool(bool* addr, const char* name, bool default_value, @@ -198,7 +192,6 @@ bool Flags::Register_bool(bool* addr, return default_value; } - int Flags::Register_int(int* addr, const char* name, int default_value, @@ -211,7 +204,6 @@ int Flags::Register_int(int* addr, return default_value; } - uint64_t Flags::Register_uint64_t(uint64_t* addr, const char* name, uint64_t default_value, @@ -224,7 +216,6 @@ uint64_t Flags::Register_uint64_t(uint64_t* addr, return default_value; } - const char* Flags::Register_charp(charp* addr, const char* name, const char* default_value, @@ -235,7 +226,6 @@ const char* Flags::Register_charp(charp* addr, return default_value; } - bool Flags::Register_func(FlagHandler handler, const char* name, const char* comment) { @@ -245,7 +235,6 @@ bool Flags::Register_func(FlagHandler handler, return false; } - static void Normalize(char* s) { intptr_t len = strlen(s); for (intptr_t i = 0; i < len; i++) { @@ -255,7 +244,6 @@ static void Normalize(char* s) { } } - bool Flags::SetFlagFromString(Flag* flag, const char* argument) { ASSERT(!flag->IsUnrecognized()); switch (flag->type_) { @@ -322,7 +310,6 @@ bool Flags::SetFlagFromString(Flag* flag, const char* argument) { return true; } - void Flags::Parse(const char* option) { // Find the beginning of the option argument, if it exists. const char* equals = option; @@ -382,7 +369,6 @@ void Flags::Parse(const char* option) { delete[] name; } - static bool IsValidFlag(const char* name, const char* prefix, intptr_t prefix_length) { @@ -391,14 +377,12 @@ static bool IsValidFlag(const char* name, (strncmp(name, prefix, prefix_length) == 0)); } - int Flags::CompareFlagNames(const void* left, const void* right) { const Flag* left_flag = *reinterpret_cast(left); const Flag* right_flag = *reinterpret_cast(right); return strcmp(left_flag->name_, right_flag->name_); } - bool Flags::ProcessCommandLineFlags(int number_of_vm_flags, const char** vm_flags) { if (initialized_) { @@ -444,7 +428,6 @@ bool Flags::ProcessCommandLineFlags(int number_of_vm_flags, return true; } - bool Flags::SetFlag(const char* name, const char* value, const char** error) { Flag* flag = Lookup(name); if (flag == NULL) { @@ -458,7 +441,6 @@ bool Flags::SetFlag(const char* name, const char* value, const char** error) { return true; } - void Flags::PrintFlags() { OS::Print("Flag settings:\n"); for (intptr_t i = 0; i < num_flags_; ++i) { @@ -466,7 +448,6 @@ void Flags::PrintFlags() { } } - #ifndef PRODUCT void Flags::PrintFlagToJSONArray(JSONArray* jsarr, const Flag* flag) { if (!FLAG_support_service) { @@ -511,7 +492,6 @@ void Flags::PrintFlagToJSONArray(JSONArray* jsarr, const Flag* flag) { } } - void Flags::PrintJSON(JSONStream* js) { if (!FLAG_support_service) { return; diff --git a/runtime/vm/flags.h b/runtime/vm/flags.h index db14c2403f6..2b31c3569e2 100644 --- a/runtime/vm/flags.h +++ b/runtime/vm/flags.h @@ -20,7 +20,6 @@ typedef const char* charp; #define DEFINE_FLAG_HANDLER(handler, name, comment) \ bool DUMMY_##name = Flags::Register_func(handler, #name, comment); - namespace dart { typedef void (*FlagHandler)(bool value); diff --git a/runtime/vm/flags_test.cc b/runtime/vm/flags_test.cc index 5bef9b0be98..476bfb87a46 100644 --- a/runtime/vm/flags_test.cc +++ b/runtime/vm/flags_test.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "platform/assert.h" #include "vm/flags.h" +#include "platform/assert.h" #include "vm/heap.h" #include "vm/unit_test.h" @@ -19,7 +19,6 @@ VM_UNIT_TEST_CASE(BasicFlags) { EXPECT_EQ(false, FLAG_print_flags); } - DEFINE_FLAG(bool, parse_flag_bool_test, true, "Flags::Parse (bool) testing"); DEFINE_FLAG(charp, string_opt_test, NULL, "Testing: string option."); DEFINE_FLAG(charp, entrypoint_test, "main", "Testing: entrypoint"); diff --git a/runtime/vm/flow_graph.cc b/runtime/vm/flow_graph.cc index 9314d92018d..943c4de7d37 100644 --- a/runtime/vm/flow_graph.cc +++ b/runtime/vm/flow_graph.cc @@ -9,9 +9,9 @@ #include "vm/flow_graph_builder.h" #include "vm/flow_graph_compiler.h" #include "vm/flow_graph_range_analysis.h" +#include "vm/growable_array.h" #include "vm/il_printer.h" #include "vm/intermediate_language.h" -#include "vm/growable_array.h" #include "vm/object_store.h" namespace dart { @@ -22,7 +22,6 @@ DEFINE_FLAG(bool, trace_smi_widening, false, "Trace Smi->Int32 widening pass."); DEFINE_FLAG(bool, prune_dead_locals, true, "optimize dead locals away"); DECLARE_FLAG(bool, verify_compiler); - FlowGraph::FlowGraph(const ParsedFunction& parsed_function, GraphEntryInstr* graph_entry, intptr_t max_block_id) @@ -52,14 +51,12 @@ FlowGraph::FlowGraph(const ParsedFunction& parsed_function, DiscoverBlocks(); } - void FlowGraph::EnsureSSATempIndex(Definition* defn, Definition* replacement) { if ((replacement->ssa_temp_index() == -1) && (defn->ssa_temp_index() != -1)) { AllocateSSAIndexes(replacement); } } - void FlowGraph::ReplaceCurrentInstruction(ForwardInstructionIterator* iterator, Instruction* current, Instruction* replacement) { @@ -98,7 +95,6 @@ void FlowGraph::ReplaceCurrentInstruction(ForwardInstructionIterator* iterator, iterator->RemoveCurrentFromGraph(); } - void FlowGraph::AddToDeferredPrefixes( ZoneGrowableArray* from) { ZoneGrowableArray* to = deferred_prefixes(); @@ -113,20 +109,17 @@ void FlowGraph::AddToDeferredPrefixes( } } - bool FlowGraph::ShouldReorderBlocks(const Function& function, bool is_optimized) { return is_optimized && FLAG_reorder_basic_blocks && !function.is_intrinsic(); } - GrowableArray* FlowGraph::CodegenBlockOrder( bool is_optimized) { return ShouldReorderBlocks(function(), is_optimized) ? &optimized_block_order_ : &reverse_postorder_; } - ConstantInstr* FlowGraph::GetConstant(const Object& object) { ConstantInstr* constant = constant_instr_pool_.LookupValue(object); if (constant == NULL) { @@ -141,7 +134,6 @@ ConstantInstr* FlowGraph::GetConstant(const Object& object) { return constant; } - void FlowGraph::AddToInitialDefinitions(Definition* defn) { // TODO(zerny): Set previous to the graph entry so it is accessible by // GetBlock. Remove this once there is a direct pointer to the block. @@ -149,7 +141,6 @@ void FlowGraph::AddToInitialDefinitions(Definition* defn) { graph_entry_->initial_definitions()->Add(defn); } - void FlowGraph::InsertBefore(Instruction* next, Instruction* instr, Environment* env, @@ -157,7 +148,6 @@ void FlowGraph::InsertBefore(Instruction* next, InsertAfter(next->previous(), instr, env, use_kind); } - void FlowGraph::InsertAfter(Instruction* prev, Instruction* instr, Environment* env, @@ -173,7 +163,6 @@ void FlowGraph::InsertAfter(Instruction* prev, } } - Instruction* FlowGraph::AppendTo(Instruction* prev, Instruction* instr, Environment* env, @@ -189,7 +178,6 @@ Instruction* FlowGraph::AppendTo(Instruction* prev, return prev->AppendInstruction(instr); } - // A wrapper around block entries including an index of the next successor to // be read. class BlockTraversalState { @@ -213,7 +201,6 @@ class BlockTraversalState { DISALLOW_ALLOCATION(); }; - void FlowGraph::DiscoverBlocks() { StackZone zone(thread()); @@ -258,7 +245,6 @@ void FlowGraph::DiscoverBlocks() { loop_invariant_loads_ = NULL; } - void FlowGraph::MergeBlocks() { bool changed = false; BitVector* merged = new (zone()) BitVector(zone(), postorder().length()); @@ -300,7 +286,6 @@ void FlowGraph::MergeBlocks() { if (changed) DiscoverBlocks(); } - // Debugging code to verify the construction of use lists. static intptr_t MembershipCount(Value* use, Value* list) { intptr_t count = 0; @@ -311,7 +296,6 @@ static intptr_t MembershipCount(Value* use, Value* list) { return count; } - static void VerifyUseListsInInstruction(Instruction* instr) { ASSERT(instr != NULL); ASSERT(!instr->IsJoinEntry()); @@ -400,7 +384,6 @@ void FlowGraph::ComputeIsReceiverRecursive( } } - void FlowGraph::ComputeIsReceiver(PhiInstr* phi) const { GrowableArray unmark; ComputeIsReceiverRecursive(phi, &unmark); @@ -418,7 +401,6 @@ void FlowGraph::ComputeIsReceiver(PhiInstr* phi) const { } } - bool FlowGraph::IsReceiver(Definition* def) const { def = def->OriginalDefinition(); // Could be redefined. if (def->IsParameter()) return (def->AsParameter()->index() == 0); @@ -432,7 +414,6 @@ bool FlowGraph::IsReceiver(Definition* def) const { return (phi->is_receiver() == PhiInstr::kReceiver); } - // Use CHA to determine if the call needs a class check: if the callee's // receiver is the same as the caller's receiver and there are no overridden // callee functions, then no class check is needed. @@ -467,7 +448,6 @@ bool FlowGraph::InstanceCallNeedsClassCheck(InstanceCallInstr* call, return true; } - Instruction* FlowGraph::CreateCheckClass(Definition* to_check, const Cids& cids, intptr_t deopt_id, @@ -480,7 +460,6 @@ Instruction* FlowGraph::CreateCheckClass(Definition* to_check, CheckClassInstr(new (zone()) Value(to_check), deopt_id, cids, token_pos); } - bool FlowGraph::VerifyUseLists() { // Verify the initial definitions. for (intptr_t i = 0; i < graph_entry_->initial_definitions()->length(); ++i) { @@ -506,7 +485,6 @@ bool FlowGraph::VerifyUseLists() { return true; // Return true so we can ASSERT validation. } - // Verify that a redefinition dominates all uses of the redefined value. bool FlowGraph::VerifyRedefinitions() { for (BlockIterator block_it = reverse_postorder_iterator(); !block_it.Done(); @@ -535,7 +513,6 @@ bool FlowGraph::VerifyRedefinitions() { return true; } - LivenessAnalysis::LivenessAnalysis( intptr_t variable_count, const GrowableArray& postorder) @@ -546,7 +523,6 @@ LivenessAnalysis::LivenessAnalysis( kill_(postorder.length()), live_in_(postorder.length()) {} - bool LivenessAnalysis::UpdateLiveOut(const BlockEntryInstr& block) { BitVector* live_out = live_out_[block.postorder_number()]; bool changed = false; @@ -562,7 +538,6 @@ bool LivenessAnalysis::UpdateLiveOut(const BlockEntryInstr& block) { return changed; } - bool LivenessAnalysis::UpdateLiveIn(const BlockEntryInstr& block) { BitVector* live_out = live_out_[block.postorder_number()]; BitVector* kill = kill_[block.postorder_number()]; @@ -570,7 +545,6 @@ bool LivenessAnalysis::UpdateLiveIn(const BlockEntryInstr& block) { return live_in->KillAndAdd(kill, live_out); } - void LivenessAnalysis::ComputeLiveInAndLiveOutSets() { const intptr_t block_count = postorder_.length(); bool changed; @@ -591,7 +565,6 @@ void LivenessAnalysis::ComputeLiveInAndLiveOutSets() { } while (changed); } - void LivenessAnalysis::Analyze() { const intptr_t block_count = postorder_.length(); for (intptr_t i = 0; i < block_count; i++) { @@ -604,7 +577,6 @@ void LivenessAnalysis::Analyze() { ComputeLiveInAndLiveOutSets(); } - static void PrintBitVector(const char* tag, BitVector* v) { OS::Print("%s:", tag); for (BitVector::Iterator it(v); !it.Done(); it.Advance()) { @@ -613,7 +585,6 @@ static void PrintBitVector(const char* tag, BitVector* v) { OS::Print("\n"); } - void LivenessAnalysis::Dump() { const intptr_t block_count = postorder_.length(); for (intptr_t i = 0; i < block_count; i++) { @@ -633,7 +604,6 @@ void LivenessAnalysis::Dump() { } } - // Computes liveness information for local variables. class VariableLivenessAnalysis : public LivenessAnalysis { public: @@ -710,7 +680,6 @@ class VariableLivenessAnalysis : public LivenessAnalysis { GrowableArray assigned_vars_; }; - void VariableLivenessAnalysis::ComputeInitialSets() { const intptr_t block_count = postorder_.length(); @@ -771,7 +740,6 @@ void VariableLivenessAnalysis::ComputeInitialSets() { } } - void FlowGraph::ComputeSSA( intptr_t next_virtual_register_number, ZoneGrowableArray* inlining_parameters) { @@ -788,7 +756,6 @@ void FlowGraph::ComputeSSA( InsertPhis(preorder_, variable_liveness.ComputeAssignedVars(), dominance_frontier, &live_phis); - // Rename uses to reference inserted phis where appropriate. // Collect phis that reach a non-environment use. Rename(&live_phis, &variable_liveness, inlining_parameters); @@ -798,7 +765,6 @@ void FlowGraph::ComputeSSA( RemoveDeadPhis(&live_phis); } - // Compute immediate dominators and the dominance frontier for each basic // block. As a side effect of the algorithm, sets the immediate dominator // of each basic block. @@ -902,7 +868,6 @@ void FlowGraph::ComputeDominators( } } - void FlowGraph::CompressPath(intptr_t start_index, intptr_t current_index, GrowableArray* parent, @@ -916,7 +881,6 @@ void FlowGraph::CompressPath(intptr_t start_index, } } - void FlowGraph::InsertPhis(const GrowableArray& preorder, const GrowableArray& assigned_vars, const GrowableArray& dom_frontier, @@ -976,7 +940,6 @@ void FlowGraph::InsertPhis(const GrowableArray& preorder, } } - void FlowGraph::Rename(GrowableArray* live_phis, VariableLivenessAnalysis* variable_liveness, ZoneGrowableArray* inlining_parameters) { @@ -1070,7 +1033,6 @@ void FlowGraph::Rename(GrowableArray* live_phis, RenameRecursive(entry, &env, live_phis, variable_liveness); } - void FlowGraph::AttachEnvironment(Instruction* instr, GrowableArray* env) { Environment* deopt_env = @@ -1089,7 +1051,6 @@ void FlowGraph::AttachEnvironment(Instruction* instr, } } - void FlowGraph::RenameRecursive(BlockEntryInstr* block_entry, GrowableArray* env, GrowableArray* live_phis, @@ -1288,7 +1249,6 @@ void FlowGraph::RenameRecursive(BlockEntryInstr* block_entry, } } - void FlowGraph::RemoveDeadPhis(GrowableArray* live_phis) { // Augment live_phis with those that have implicit real used at // potentially throwing instructions if there is a try-catch in this graph. @@ -1334,7 +1294,6 @@ void FlowGraph::RemoveDeadPhis(GrowableArray* live_phis) { } } - RedefinitionInstr* FlowGraph::EnsureRedefinition(Instruction* prev, Definition* original, CompileType compile_type) { @@ -1353,7 +1312,6 @@ RedefinitionInstr* FlowGraph::EnsureRedefinition(Instruction* prev, return redef; } - void FlowGraph::RemoveRedefinitions() { // Remove redefinition instructions inserted to inhibit hoisting. for (BlockIterator block_it = reverse_postorder_iterator(); !block_it.Done(); @@ -1374,7 +1332,6 @@ void FlowGraph::RemoveRedefinitions() { } } - // Find the natural loop for the back edge m->n and attach loop information // to block n (loop header). The algorithm is described in "Advanced Compiler // Design & Implementation" (Muchnick) p192. @@ -1401,7 +1358,6 @@ BitVector* FlowGraph::FindLoop(BlockEntryInstr* m, BlockEntryInstr* n) const { return loop; } - ZoneGrowableArray* FlowGraph::ComputeLoops() const { ZoneGrowableArray* loop_headers = new (zone()) ZoneGrowableArray(); @@ -1446,7 +1402,6 @@ ZoneGrowableArray* FlowGraph::ComputeLoops() const { return loop_headers; } - intptr_t FlowGraph::InstructionCount() const { intptr_t size = 0; // Iterate each block, skipping the graph entry. @@ -1459,12 +1414,10 @@ intptr_t FlowGraph::InstructionCount() const { return size; } - void FlowGraph::ComputeBlockEffects() { block_effects_ = new (zone()) BlockEffects(this); } - BlockEffects::BlockEffects(FlowGraph* flow_graph) : available_at_(flow_graph->postorder().length()) { // We are tracking a single effect. @@ -1545,32 +1498,27 @@ BlockEffects::BlockEffects(FlowGraph* flow_graph) } while (changed); } - bool BlockEffects::IsAvailableAt(Instruction* instr, BlockEntryInstr* block) const { return (instr->Dependencies().IsNone()) || IsSideEffectFreePath(instr->GetBlock(), block); } - bool BlockEffects::CanBeMovedTo(Instruction* instr, BlockEntryInstr* block) const { return (instr->Dependencies().IsNone()) || IsSideEffectFreePath(block, instr->GetBlock()); } - bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, BlockEntryInstr* to) const { return available_at_[to->postorder_number()]->Contains( from->postorder_number()); } - // Quick access to the current zone. #define Z (zone()) - void FlowGraph::ConvertUse(Value* use, Representation from_rep) { const Representation to_rep = use->instruction()->RequiredInputRepresentation(use->use_index()); @@ -1580,28 +1528,23 @@ void FlowGraph::ConvertUse(Value* use, Representation from_rep) { InsertConversion(from_rep, to_rep, use, /*is_environment_use=*/false); } - static bool IsUnboxedInteger(Representation rep) { return (rep == kUnboxedInt32) || (rep == kUnboxedUint32) || (rep == kUnboxedMint); } - static bool ShouldInlineSimd() { return FlowGraphCompiler::SupportsUnboxedSimd128(); } - static bool CanUnboxDouble() { return FlowGraphCompiler::SupportsUnboxedDoubles(); } - static bool CanConvertUnboxedMintToDouble() { return FlowGraphCompiler::CanConvertUnboxedMintToDouble(); } - void FlowGraph::InsertConversion(Representation from, Representation to, Value* use, @@ -1673,7 +1616,6 @@ void FlowGraph::InsertConversion(Representation from, } } - void FlowGraph::ConvertEnvironmentUse(Value* use, Representation from_rep) { const Representation to_rep = kTagged; if (from_rep == to_rep) { @@ -1682,7 +1624,6 @@ void FlowGraph::ConvertEnvironmentUse(Value* use, Representation from_rep) { InsertConversion(from_rep, to_rep, use, /*is_environment_use=*/true); } - void FlowGraph::InsertConversionsFor(Definition* def) { const Representation from_rep = def->representation(); @@ -1703,7 +1644,6 @@ void FlowGraph::InsertConversionsFor(Definition* def) { } } - static void UnboxPhi(PhiInstr* phi) { Representation unboxed = phi->representation(); @@ -1784,7 +1724,6 @@ static void UnboxPhi(PhiInstr* phi) { phi->set_representation(unboxed); } - void FlowGraph::SelectRepresentations() { // Conservatively unbox all phis that were proven to be of Double, // Float32x4, or Int32x4 type. @@ -1834,7 +1773,6 @@ void FlowGraph::SelectRepresentations() { } } - #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_IA32) // Smi widening pass is only meaningful on platforms where Smi // is smaller than 32bit. For now only support it on ARM and ia32. @@ -1843,7 +1781,6 @@ static bool CanBeWidened(BinarySmiOpInstr* smi_op) { smi_op->right()); } - static bool BenefitsFromWidening(BinarySmiOpInstr* smi_op) { // TODO(vegorov): when shifts with non-constants shift count are supported // add them here as we save untagging for the count. @@ -1859,7 +1796,6 @@ static bool BenefitsFromWidening(BinarySmiOpInstr* smi_op) { } } - void FlowGraph::WidenSmiToInt32() { GrowableArray candidates; @@ -2049,7 +1985,6 @@ void FlowGraph::WidenSmiToInt32() { } #endif - void FlowGraph::EliminateEnvironments() { // After this pass we can no longer perform LICM and hoist instructions // that can deoptimize. @@ -2076,7 +2011,6 @@ void FlowGraph::EliminateEnvironments() { } } - bool FlowGraph::Canonicalize() { bool changed = false; @@ -2105,7 +2039,6 @@ bool FlowGraph::Canonicalize() { return changed; } - // Optimize (a << b) & c pattern: if c is a positive Smi or zero, then the // shift can be a truncating Smi shift-left and result is always Smi. // Merging occurs only per basic-block. @@ -2153,7 +2086,6 @@ void FlowGraph::TryOptimizePatterns() { } } - // Returns true if use is dominated by the given instruction. // Note: uses that occur at instruction itself are not dominated by it. static bool IsDominatedUse(Instruction* dom, Value* use) { @@ -2181,7 +2113,6 @@ static bool IsDominatedUse(Instruction* dom, Value* use) { return dom_block->Dominates(use_block); } - void FlowGraph::RenameDominatedUses(Definition* def, Instruction* dom, Definition* other) { @@ -2193,7 +2124,6 @@ void FlowGraph::RenameDominatedUses(Definition* def, } } - void FlowGraph::RenameUsesDominatedByRedefinitions() { for (BlockIterator block_it = reverse_postorder_iterator(); !block_it.Done(); block_it.Advance()) { @@ -2208,7 +2138,6 @@ void FlowGraph::RenameUsesDominatedByRedefinitions() { } } - static bool IsPositiveOrZeroSmiConst(Definition* d) { ConstantInstr* const_instr = d->AsConstant(); if ((const_instr != NULL) && (const_instr->value().IsSmi())) { @@ -2217,7 +2146,6 @@ static bool IsPositiveOrZeroSmiConst(Definition* d) { return false; } - static BinarySmiOpInstr* AsSmiShiftLeftInstruction(Definition* d) { BinarySmiOpInstr* instr = d->AsBinarySmiOp(); if ((instr != NULL) && (instr->op_kind() == Token::kSHL)) { @@ -2226,7 +2154,6 @@ static BinarySmiOpInstr* AsSmiShiftLeftInstruction(Definition* d) { return NULL; } - void FlowGraph::OptimizeLeftShiftBitAndSmiOp( ForwardInstructionIterator* current_iterator, Definition* bit_and_instr, @@ -2263,7 +2190,6 @@ void FlowGraph::OptimizeLeftShiftBitAndSmiOp( } } - // Dart: // var x = d % 10; // var y = d ~/ 10; @@ -2334,7 +2260,6 @@ void FlowGraph::TryMergeTruncDivMod( } } - void FlowGraph::AppendExtractNthOutputForMerged(Definition* instr, intptr_t index, Representation rep, @@ -2345,5 +2270,4 @@ void FlowGraph::AppendExtractNthOutputForMerged(Definition* instr, InsertAfter(instr, extract, NULL, FlowGraph::kValue); } - } // namespace dart diff --git a/runtime/vm/flow_graph.h b/runtime/vm/flow_graph.h index 705f6743a60..5c215af2465 100644 --- a/runtime/vm/flow_graph.h +++ b/runtime/vm/flow_graph.h @@ -43,7 +43,6 @@ class BlockIterator : public ValueObject { intptr_t current_; }; - struct ConstantPoolTrait { typedef ConstantInstr* Value; typedef const Object& Key; @@ -75,7 +74,6 @@ struct ConstantPoolTrait { } }; - // Class to encapsulate the construction and manipulation of the flow graph. class FlowGraph : public ZoneAllocated { public: @@ -420,7 +418,6 @@ class FlowGraph : public ZoneAllocated { intptr_t inlining_id_; }; - class LivenessAnalysis : public ValueObject { public: LivenessAnalysis(intptr_t variable_count, @@ -495,7 +492,6 @@ class LivenessAnalysis : public ValueObject { GrowableArray live_in_; }; - // Information about side effect free paths between blocks. class BlockEffects : public ZoneAllocated { public: @@ -523,7 +519,6 @@ class BlockEffects : public ZoneAllocated { GrowableArray available_at_; }; - class DefinitionWorklist : public ValueObject { public: DefinitionWorklist(FlowGraph* flow_graph, intptr_t initial_capacity) @@ -564,7 +559,6 @@ class DefinitionWorklist : public ValueObject { BitVector* contains_vector_; }; - } // namespace dart #endif // RUNTIME_VM_FLOW_GRAPH_H_ diff --git a/runtime/vm/flow_graph_allocator.cc b/runtime/vm/flow_graph_allocator.cc index 903d17bf831..e70a5b781ee 100644 --- a/runtime/vm/flow_graph_allocator.cc +++ b/runtime/vm/flow_graph_allocator.cc @@ -5,10 +5,10 @@ #include "vm/flow_graph_allocator.h" #include "vm/bit_vector.h" -#include "vm/intermediate_language.h" -#include "vm/il_printer.h" #include "vm/flow_graph.h" #include "vm/flow_graph_compiler.h" +#include "vm/il_printer.h" +#include "vm/intermediate_language.h" #include "vm/log.h" #include "vm/parser.h" #include "vm/stack_frame.h" @@ -24,7 +24,6 @@ namespace dart { #define TRACE_ALLOC(statement) #endif - static const intptr_t kNoVirtualRegister = -1; static const intptr_t kTempVirtualRegister = -2; static const intptr_t kIllegalPosition = -1; @@ -41,32 +40,26 @@ static intptr_t ToSecondPairVreg(intptr_t vreg) { return vreg + kPairVirtualRegisterOffset; } - static intptr_t MinPosition(intptr_t a, intptr_t b) { return (a < b) ? a : b; } - static bool IsInstructionStartPosition(intptr_t pos) { return (pos & 1) == 0; } - static bool IsInstructionEndPosition(intptr_t pos) { return (pos & 1) == 1; } - static intptr_t ToInstructionStart(intptr_t pos) { return (pos & ~1); } - static intptr_t ToInstructionEnd(intptr_t pos) { return (pos | 1); } - FlowGraphAllocator::FlowGraphAllocator(const FlowGraph& flow_graph, bool intrinsic_mode) : flow_graph_(flow_graph), @@ -117,7 +110,6 @@ FlowGraphAllocator::FlowGraphAllocator(const FlowGraph& flow_graph, } } - static void DeepLiveness(MaterializeObjectInstr* mat, BitVector* live_in) { if (mat->was_visited_for_liveness()) { return; @@ -138,7 +130,6 @@ static void DeepLiveness(MaterializeObjectInstr* mat, BitVector* live_in) { } } - void SSALivenessAnalysis::ComputeInitialSets() { const intptr_t block_count = postorder_.length(); for (intptr_t i = 0; i < block_count; i++) { @@ -267,7 +258,6 @@ void SSALivenessAnalysis::ComputeInitialSets() { } } - UsePosition* LiveRange::AddUse(intptr_t pos, Location* location_slot) { ASSERT(location_slot != NULL); ASSERT((first_use_interval_->start_ <= pos) && @@ -303,7 +293,6 @@ UsePosition* LiveRange::AddUse(intptr_t pos, Location* location_slot) { return uses_; } - void LiveRange::AddSafepoint(intptr_t pos, LocationSummary* locs) { ASSERT(IsInstructionStartPosition(pos)); SafepointPosition* safepoint = @@ -322,7 +311,6 @@ void LiveRange::AddSafepoint(intptr_t pos, LocationSummary* locs) { } } - void LiveRange::AddHintedUse(intptr_t pos, Location* location_slot, Location* hint) { @@ -330,7 +318,6 @@ void LiveRange::AddHintedUse(intptr_t pos, AddUse(pos, location_slot)->set_hint(hint); } - void LiveRange::AddUseInterval(intptr_t start, intptr_t end) { ASSERT(start < end); @@ -367,7 +354,6 @@ void LiveRange::AddUseInterval(intptr_t start, intptr_t end) { } } - void LiveRange::DefineAt(intptr_t pos) { // Live ranges are being build by visiting instructions in post-order. // This implies that use intervals will be prepended in a monotonically @@ -388,7 +374,6 @@ void LiveRange::DefineAt(intptr_t pos) { } } - LiveRange* FlowGraphAllocator::GetLiveRange(intptr_t vreg) { if (live_ranges_[vreg] == NULL) { Representation rep = value_representations_[vreg]; @@ -398,7 +383,6 @@ LiveRange* FlowGraphAllocator::GetLiveRange(intptr_t vreg) { return live_ranges_[vreg]; } - LiveRange* FlowGraphAllocator::MakeLiveRangeForTemporary() { // Representation does not matter for temps. Representation ignored = kNoRepresentation; @@ -409,7 +393,6 @@ LiveRange* FlowGraphAllocator::MakeLiveRangeForTemporary() { return range; } - void FlowGraphAllocator::BlockRegisterLocation(Location loc, intptr_t from, intptr_t to, @@ -432,7 +415,6 @@ void FlowGraphAllocator::BlockRegisterLocation(Location loc, blocking_ranges[loc.register_code()]->AddUseInterval(from, to); } - // Block location from the start of the instruction to its end. void FlowGraphAllocator::BlockLocation(Location loc, intptr_t from, @@ -450,7 +432,6 @@ void FlowGraphAllocator::BlockLocation(Location loc, } } - void LiveRange::Print() { if (first_use_interval() == NULL) { return; @@ -494,7 +475,6 @@ void LiveRange::Print() { } } - void FlowGraphAllocator::PrintLiveRanges() { #if defined(DEBUG) for (intptr_t i = 0; i < temporaries_.length(); i++) { @@ -509,7 +489,6 @@ void FlowGraphAllocator::PrintLiveRanges() { } } - // Returns true if all uses of the given range inside the given loop // have Any allocation policy. static bool HasOnlyUnconstrainedUsesInLoop(LiveRange* range, @@ -527,7 +506,6 @@ static bool HasOnlyUnconstrainedUsesInLoop(LiveRange* range, return true; } - // Returns true if all uses of the given range have Any allocation policy. static bool HasOnlyUnconstrainedUses(LiveRange* range) { UsePosition* use = range->first_use(); @@ -540,7 +518,6 @@ static bool HasOnlyUnconstrainedUses(LiveRange* range) { return true; } - void FlowGraphAllocator::BuildLiveRanges() { const intptr_t block_count = postorder_.length(); ASSERT(postorder_.Last()->IsGraphEntry()); @@ -586,7 +563,6 @@ void FlowGraphAllocator::BuildLiveRanges() { current = current->previous(); } - // Check if any values live into the loop can be spilled for free. if (block_info->is_loop_header()) { current_interference_set = NULL; @@ -647,7 +623,6 @@ void FlowGraphAllocator::BuildLiveRanges() { } } - void FlowGraphAllocator::SplitInitialDefinitionAt(LiveRange* range, intptr_t pos) { if (range->End() > pos) { @@ -656,7 +631,6 @@ void FlowGraphAllocator::SplitInitialDefinitionAt(LiveRange* range, } } - void FlowGraphAllocator::ProcessInitialDefinition(Definition* defn, LiveRange* range, BlockEntryInstr* block) { @@ -787,7 +761,6 @@ void FlowGraphAllocator::ProcessInitialDefinition(Definition* defn, } } - static Location::Kind RegisterKindFromPolicy(Location loc) { if (loc.policy() == Location::kRequiresFpuRegister) { return Location::kFpuRegister; @@ -796,7 +769,6 @@ static Location::Kind RegisterKindFromPolicy(Location loc) { } } - static Location::Kind RegisterKindForResult(Instruction* instr) { const Representation rep = instr->representation(); #if !defined(TARGET_ARCH_DBC) @@ -815,7 +787,6 @@ static Location::Kind RegisterKindForResult(Instruction* instr) { #endif } - // // When describing shape of live ranges in comments below we are going to use // the following notation: @@ -913,7 +884,6 @@ Instruction* FlowGraphAllocator::ConnectOutgoingPhiMoves( return goto_instr->previous(); } - void FlowGraphAllocator::ConnectIncomingPhiMoves(JoinEntryInstr* join) { // For join blocks we need to add destinations of phi resolution moves // to phi's live range so that register allocator will fill them with moves. @@ -975,7 +945,6 @@ void FlowGraphAllocator::ConnectIncomingPhiMoves(JoinEntryInstr* join) { } } - void FlowGraphAllocator::ProcessEnvironmentUses(BlockEntryInstr* block, Instruction* current) { ASSERT(current->env() != NULL); @@ -1057,7 +1026,6 @@ void FlowGraphAllocator::ProcessEnvironmentUses(BlockEntryInstr* block, } } - void FlowGraphAllocator::ProcessMaterializationUses( BlockEntryInstr* block, const intptr_t block_start_pos, @@ -1111,7 +1079,6 @@ void FlowGraphAllocator::ProcessMaterializationUses( } } - void FlowGraphAllocator::ProcessOneInput(BlockEntryInstr* block, intptr_t pos, Location* in_ref, @@ -1175,7 +1142,6 @@ void FlowGraphAllocator::ProcessOneInput(BlockEntryInstr* block, } } - void FlowGraphAllocator::ProcessOneOutput(BlockEntryInstr* block, intptr_t pos, Location* out, @@ -1283,7 +1249,6 @@ void FlowGraphAllocator::ProcessOneOutput(BlockEntryInstr* block, CompleteRange(range, RegisterKindForResult(def)); } - // Create and update live ranges corresponding to instruction's inputs, // temporaries and output. void FlowGraphAllocator::ProcessOneInstruction(BlockEntryInstr* block, @@ -1433,7 +1398,6 @@ void FlowGraphAllocator::ProcessOneInstruction(BlockEntryInstr* block, pos + 1); } - #if defined(DEBUG) // Verify that temps, inputs and output were specified as fixed // locations. Every register is blocked now so attempt to @@ -1533,7 +1497,6 @@ void FlowGraphAllocator::ProcessOneInstruction(BlockEntryInstr* block, } } - static ParallelMoveInstr* CreateParallelMoveBefore(Instruction* instr, intptr_t pos) { ASSERT(pos > 0); @@ -1548,7 +1511,6 @@ static ParallelMoveInstr* CreateParallelMoveBefore(Instruction* instr, return move; } - static ParallelMoveInstr* CreateParallelMoveAfter(Instruction* instr, intptr_t pos) { Instruction* next = instr->next(); @@ -1558,7 +1520,6 @@ static ParallelMoveInstr* CreateParallelMoveAfter(Instruction* instr, return CreateParallelMoveBefore(next, pos); } - // Linearize the control flow graph. The chosen order will be used by the // linear-scan register allocator. Number most instructions with a pair of // numbers representing lifetime positions. Introduce explicit parallel @@ -1623,7 +1584,6 @@ void FlowGraphAllocator::NumberInstructions() { } } - // Discover structural (reducible) loops nesting structure. void FlowGraphAllocator::DiscoverLoops() { // This algorithm relies on the assumption that we emit blocks in reverse @@ -1673,22 +1633,18 @@ void FlowGraphAllocator::DiscoverLoops() { } } - Instruction* FlowGraphAllocator::InstructionAt(intptr_t pos) const { return instructions_[pos / 2]; } - BlockInfo* FlowGraphAllocator::BlockInfoAt(intptr_t pos) const { return block_info_[pos / 2]; } - bool FlowGraphAllocator::IsBlockEntry(intptr_t pos) const { return IsInstructionStartPosition(pos) && InstructionAt(pos)->IsBlockEntry(); } - void AllocationFinger::Initialize(LiveRange* range) { first_pending_use_interval_ = range->first_use_interval(); first_register_use_ = range->first_use(); @@ -1696,7 +1652,6 @@ void AllocationFinger::Initialize(LiveRange* range) { first_hinted_use_ = range->first_use(); } - bool AllocationFinger::Advance(const intptr_t start) { UseInterval* a = first_pending_use_interval_; while (a != NULL && a->end() <= start) @@ -1705,7 +1660,6 @@ bool AllocationFinger::Advance(const intptr_t start) { return (first_pending_use_interval_ == NULL); } - Location AllocationFinger::FirstHint() { UsePosition* use = first_hinted_use_; @@ -1717,7 +1671,6 @@ Location AllocationFinger::FirstHint() { return Location::NoLocation(); } - static UsePosition* FirstUseAfter(UsePosition* use, intptr_t after) { while ((use != NULL) && (use->pos() < after)) { use = use->next(); @@ -1725,7 +1678,6 @@ static UsePosition* FirstUseAfter(UsePosition* use, intptr_t after) { return use; } - UsePosition* AllocationFinger::FirstRegisterUse(intptr_t after) { for (UsePosition* use = FirstUseAfter(first_register_use_, after); use != NULL; use = use->next()) { @@ -1740,7 +1692,6 @@ UsePosition* AllocationFinger::FirstRegisterUse(intptr_t after) { return NULL; } - UsePosition* AllocationFinger::FirstRegisterBeneficialUse(intptr_t after) { for (UsePosition* use = FirstUseAfter(first_register_beneficial_use_, after); use != NULL; use = use->next()) { @@ -1753,7 +1704,6 @@ UsePosition* AllocationFinger::FirstRegisterBeneficialUse(intptr_t after) { return NULL; } - UsePosition* AllocationFinger::FirstInterferingUse(intptr_t after) { if (IsInstructionEndPosition(after)) { // If after is a position at the end of the instruction disregard @@ -1763,7 +1713,6 @@ UsePosition* AllocationFinger::FirstInterferingUse(intptr_t after) { return FirstRegisterUse(after); } - void AllocationFinger::UpdateAfterSplit(intptr_t first_use_after_split_pos) { if ((first_register_use_ != NULL) && (first_register_use_->pos() >= first_use_after_split_pos)) { @@ -1776,7 +1725,6 @@ void AllocationFinger::UpdateAfterSplit(intptr_t first_use_after_split_pos) { } } - intptr_t UseInterval::Intersect(UseInterval* other) { if (this->start() <= other->start()) { if (other->start() < this->end()) return other->start(); @@ -1786,7 +1734,6 @@ intptr_t UseInterval::Intersect(UseInterval* other) { return kIllegalPosition; } - static intptr_t FirstIntersection(UseInterval* a, UseInterval* u) { while (a != NULL && u != NULL) { const intptr_t pos = a->Intersect(u); @@ -1802,7 +1749,6 @@ static intptr_t FirstIntersection(UseInterval* a, UseInterval* u) { return kMaxPosition; } - template PositionType* SplitListOfPositions(PositionType** head, intptr_t split_pos, @@ -1830,7 +1776,6 @@ PositionType* SplitListOfPositions(PositionType** head, return pos; } - LiveRange* LiveRange::SplitAt(intptr_t split_pos) { if (Start() == split_pos) return this; @@ -1894,7 +1839,6 @@ LiveRange* LiveRange::SplitAt(intptr_t split_pos) { return next_sibling_; } - LiveRange* FlowGraphAllocator::SplitBetween(LiveRange* range, intptr_t from, intptr_t to) { @@ -1933,7 +1877,6 @@ LiveRange* FlowGraphAllocator::SplitBetween(LiveRange* range, return range->SplitAt(split_pos); } - void FlowGraphAllocator::SpillBetween(LiveRange* range, intptr_t from, intptr_t to) { @@ -1954,7 +1897,6 @@ void FlowGraphAllocator::SpillBetween(LiveRange* range, } } - void FlowGraphAllocator::SpillAfter(LiveRange* range, intptr_t from) { TRACE_ALLOC(THR_Print("spill v%" Pd " [%" Pd ", %" Pd ") after %" Pd "\n", range->vreg(), range->Start(), range->End(), from)); @@ -1979,7 +1921,6 @@ void FlowGraphAllocator::SpillAfter(LiveRange* range, intptr_t from) { Spill(tail); } - void FlowGraphAllocator::AllocateSpillSlotFor(LiveRange* range) { #if defined(TARGET_ARCH_DBC) // There is no need to support spilling on DBC because we have a lot of @@ -2077,7 +2018,6 @@ void FlowGraphAllocator::AllocateSpillSlotFor(LiveRange* range) { spilled_.Add(range); } - void FlowGraphAllocator::MarkAsObjectAtSafepoints(LiveRange* range) { intptr_t stack_index = range->spill_slot().stack_index(); ASSERT(stack_index >= 0); @@ -2092,7 +2032,6 @@ void FlowGraphAllocator::MarkAsObjectAtSafepoints(LiveRange* range) { } } - void FlowGraphAllocator::Spill(LiveRange* range) { LiveRange* parent = GetLiveRange(range->vreg()); if (parent->spill_slot().IsInvalid()) { @@ -2105,7 +2044,6 @@ void FlowGraphAllocator::Spill(LiveRange* range) { ConvertAllUses(range); } - intptr_t FlowGraphAllocator::FirstIntersectionWithAllocated( intptr_t reg, LiveRange* unallocated) { @@ -2125,7 +2063,6 @@ intptr_t FlowGraphAllocator::FirstIntersectionWithAllocated( return intersection; } - void ReachingDefs::AddPhi(PhiInstr* phi) { if (phi->reaching_defs() == NULL) { Zone* zone = flow_graph_.zone(); @@ -2150,7 +2087,6 @@ void ReachingDefs::AddPhi(PhiInstr* phi) { } } - void ReachingDefs::Compute() { // Transitively collect all phis that are used by the given phi. for (intptr_t i = 0; i < phis_.length(); i++) { @@ -2185,7 +2121,6 @@ void ReachingDefs::Compute() { phis_.Clear(); } - BitVector* ReachingDefs::Get(PhiInstr* phi) { if (phi->reaching_defs() == NULL) { ASSERT(phis_.is_empty()); @@ -2195,7 +2130,6 @@ BitVector* ReachingDefs::Get(PhiInstr* phi) { return phi->reaching_defs(); } - bool FlowGraphAllocator::AllocateFreeRegister(LiveRange* unallocated) { intptr_t candidate = kNoRegister; intptr_t free_until = 0; @@ -2325,7 +2259,6 @@ bool FlowGraphAllocator::AllocateFreeRegister(LiveRange* unallocated) { return true; } - bool FlowGraphAllocator::RangeHasOnlyUnconstrainedUsesInLoop(LiveRange* range, intptr_t loop_id) { if (range->vreg() >= 0) { @@ -2335,7 +2268,6 @@ bool FlowGraphAllocator::RangeHasOnlyUnconstrainedUsesInLoop(LiveRange* range, return false; } - bool FlowGraphAllocator::IsCheapToEvictRegisterInLoop(BlockInfo* loop, intptr_t reg) { const intptr_t loop_start = loop->entry()->start_pos(); @@ -2357,7 +2289,6 @@ bool FlowGraphAllocator::IsCheapToEvictRegisterInLoop(BlockInfo* loop, return true; } - bool FlowGraphAllocator::HasCheapEvictionCandidate(LiveRange* phi_range) { ASSERT(phi_range->is_loop_phi()); @@ -2375,7 +2306,6 @@ bool FlowGraphAllocator::HasCheapEvictionCandidate(LiveRange* phi_range) { return false; } - void FlowGraphAllocator::AllocateAnyRegister(LiveRange* unallocated) { // If a loop phi has no register uses we might still want to allocate it // to the register to reduce amount of memory moves on the back edge. @@ -2428,7 +2358,6 @@ void FlowGraphAllocator::AllocateAnyRegister(LiveRange* unallocated) { AssignNonFreeRegister(unallocated, candidate); } - bool FlowGraphAllocator::UpdateFreeUntil(intptr_t reg, LiveRange* unallocated, intptr_t* cur_free_until, @@ -2482,7 +2411,6 @@ bool FlowGraphAllocator::UpdateFreeUntil(intptr_t reg, return true; } - void FlowGraphAllocator::RemoveEvicted(intptr_t reg, intptr_t first_evicted) { intptr_t to = first_evicted; intptr_t from = first_evicted + 1; @@ -2493,7 +2421,6 @@ void FlowGraphAllocator::RemoveEvicted(intptr_t reg, intptr_t first_evicted) { registers_[reg]->TruncateTo(to); } - void FlowGraphAllocator::AssignNonFreeRegister(LiveRange* unallocated, intptr_t reg) { intptr_t first_evicted = -1; @@ -2521,7 +2448,6 @@ void FlowGraphAllocator::AssignNonFreeRegister(LiveRange* unallocated, #endif } - bool FlowGraphAllocator::EvictIntersection(LiveRange* allocated, LiveRange* unallocated) { UseInterval* first_unallocated = @@ -2546,7 +2472,6 @@ bool FlowGraphAllocator::EvictIntersection(LiveRange* allocated, return true; } - MoveOperands* FlowGraphAllocator::AddMoveAt(intptr_t pos, Location to, Location from) { @@ -2572,7 +2497,6 @@ MoveOperands* FlowGraphAllocator::AddMoveAt(intptr_t pos, return parallel_move->AddMove(to, from); } - void FlowGraphAllocator::ConvertUseTo(UsePosition* use, Location loc) { ASSERT(!loc.IsPairLocation()); ASSERT(use->location_slot() != NULL); @@ -2584,7 +2508,6 @@ void FlowGraphAllocator::ConvertUseTo(UsePosition* use, Location loc) { *slot = loc; } - void FlowGraphAllocator::ConvertAllUses(LiveRange* range) { if (range->vreg() == kNoVirtualRegister) return; @@ -2620,7 +2543,6 @@ void FlowGraphAllocator::ConvertAllUses(LiveRange* range) { } } - void FlowGraphAllocator::AdvanceActiveIntervals(const intptr_t start) { for (intptr_t reg = 0; reg < NumberOfRegisters(); reg++) { if (registers_[reg]->is_empty()) continue; @@ -2639,7 +2561,6 @@ void FlowGraphAllocator::AdvanceActiveIntervals(const intptr_t start) { } } - bool LiveRange::Contains(intptr_t pos) const { if (!CanCover(pos)) return false; @@ -2653,7 +2574,6 @@ bool LiveRange::Contains(intptr_t pos) const { return false; } - void FlowGraphAllocator::AssignSafepoints(Definition* defn, LiveRange* range) { for (intptr_t i = safepoints_.length() - 1; i >= 0; i--) { Instruction* safepoint_instr = safepoints_[i]; @@ -2673,13 +2593,11 @@ void FlowGraphAllocator::AssignSafepoints(Definition* defn, LiveRange* range) { } } - static inline bool ShouldBeAllocatedBefore(LiveRange* a, LiveRange* b) { // TODO(vegorov): consider first hint position when ordering live ranges. return a->Start() <= b->Start(); } - static void AddToSortedListOfRanges(GrowableArray* list, LiveRange* range) { range->finger()->Initialize(range); @@ -2698,12 +2616,10 @@ static void AddToSortedListOfRanges(GrowableArray* list, list->InsertAt(0, range); } - void FlowGraphAllocator::AddToUnallocated(LiveRange* range) { AddToSortedListOfRanges(&unallocated_, range); } - void FlowGraphAllocator::CompleteRange(LiveRange* range, Location::Kind kind) { switch (kind) { case Location::kRegister: @@ -2719,7 +2635,6 @@ void FlowGraphAllocator::CompleteRange(LiveRange* range, Location::Kind kind) { } } - #if defined(DEBUG) bool FlowGraphAllocator::UnallocatedIsSorted() { for (intptr_t i = unallocated_.length() - 1; i >= 1; i--) { @@ -2734,7 +2649,6 @@ bool FlowGraphAllocator::UnallocatedIsSorted() { } #endif - void FlowGraphAllocator::PrepareForAllocation( Location::Kind register_kind, intptr_t number_of_registers, @@ -2765,7 +2679,6 @@ void FlowGraphAllocator::PrepareForAllocation( } } - void FlowGraphAllocator::AllocateUnallocatedRanges() { #if defined(DEBUG) ASSERT(UnallocatedIsSorted()); @@ -2800,7 +2713,6 @@ void FlowGraphAllocator::AllocateUnallocatedRanges() { TRACE_ALLOC(THR_Print("Allocation completed\n")); } - bool FlowGraphAllocator::TargetLocationIsSpillSlot(LiveRange* range, Location target) { if (target.IsStackSlot() || target.IsDoubleStackSlot() || @@ -2811,7 +2723,6 @@ bool FlowGraphAllocator::TargetLocationIsSpillSlot(LiveRange* range, return false; } - void FlowGraphAllocator::ConnectSplitSiblings(LiveRange* parent, BlockEntryInstr* source_block, BlockEntryInstr* target_block) { @@ -2881,7 +2792,6 @@ void FlowGraphAllocator::ConnectSplitSiblings(LiveRange* parent, } } - void FlowGraphAllocator::ResolveControlFlow() { // Resolve linear control flow between touching split siblings // inside basic blocks. @@ -2937,7 +2847,6 @@ void FlowGraphAllocator::ResolveControlFlow() { } } - static Representation RepresentationForRange(Representation definition_rep) { if (definition_rep == kUnboxedMint) { // kUnboxedMint is split into two ranges, each of which are kUntagged. @@ -2949,7 +2858,6 @@ static Representation RepresentationForRange(Representation definition_rep) { return definition_rep; } - void FlowGraphAllocator::CollectRepresentations() { // Parameters. GraphEntryInstr* graph_entry = flow_graph_.graph_entry(); @@ -3006,7 +2914,6 @@ void FlowGraphAllocator::CollectRepresentations() { } } - void FlowGraphAllocator::AllocateRegisters() { CollectRepresentations(); @@ -3108,5 +3015,4 @@ void FlowGraphAllocator::AllocateRegisters() { } } - } // namespace dart diff --git a/runtime/vm/flow_graph_allocator.h b/runtime/vm/flow_graph_allocator.h index a1d72423904..42ed4807f1d 100644 --- a/runtime/vm/flow_graph_allocator.h +++ b/runtime/vm/flow_graph_allocator.h @@ -18,7 +18,6 @@ class LiveRange; class UseInterval; class UsePosition; - class ReachingDefs : public ValueObject { public: explicit ReachingDefs(const FlowGraph& flow_graph) @@ -34,7 +33,6 @@ class ReachingDefs : public ValueObject { GrowableArray phis_; }; - class SSALivenessAnalysis : public LivenessAnalysis { public: explicit SSALivenessAnalysis(const FlowGraph& flow_graph) @@ -49,7 +47,6 @@ class SSALivenessAnalysis : public LivenessAnalysis { GraphEntryInstr* graph_entry_; }; - class FlowGraphAllocator : public ValueObject { public: // Number of stack slots needed for a fpu register spill slot. @@ -153,7 +150,6 @@ class FlowGraphAllocator : public ValueObject { LiveRange** blocking_ranges, bool* blocked_registers); - // Process live ranges sorted by their start and assign registers // to them void AllocateUnallocatedRanges(); @@ -311,7 +307,6 @@ class FlowGraphAllocator : public ValueObject { GrowableArray blocked_registers_; - // Worklist for register allocator. Always maintained sorted according // to ShouldBeAllocatedBefore predicate. GrowableArray unallocated_; @@ -337,7 +332,6 @@ class FlowGraphAllocator : public ValueObject { DISALLOW_COPY_AND_ASSIGN(FlowGraphAllocator); }; - // Additional information about a block that is not contained in a // block entry. class BlockInfo : public ZoneAllocated { @@ -400,7 +394,6 @@ class BlockInfo : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(BlockInfo); }; - // UsePosition represents a single use of an SSA value by some instruction. // It points to a location slot which either tells register allocator // where instruction expects the value (if slot contains a fixed location) or @@ -427,7 +420,6 @@ class UsePosition : public ZoneAllocated { bool HasHint() const { return (hint_ != NULL) && !hint_->IsUnallocated(); } - void set_next(UsePosition* next) { next_ = next; } UsePosition* next() const { return next_; } @@ -442,7 +434,6 @@ class UsePosition : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(UsePosition); }; - // UseInterval represents a holeless half open interval of liveness for a given // SSA value: [start, end) in terms of lifetime positions that // NumberInstructions assigns to instructions. Register allocator has to keep @@ -479,7 +470,6 @@ class UseInterval : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(UseInterval); }; - // AllocationFinger is used to keep track of currently active position // for the register allocator and cache lookup results. class AllocationFinger : public ValueObject { @@ -512,7 +502,6 @@ class AllocationFinger : public ValueObject { DISALLOW_COPY_AND_ASSIGN(AllocationFinger); }; - class SafepointPosition : public ZoneAllocated { public: SafepointPosition(intptr_t pos, LocationSummary* locs) @@ -532,7 +521,6 @@ class SafepointPosition : public ZoneAllocated { SafepointPosition* next_; }; - // LiveRange represents a sequence of UseIntervals for a given SSA value. class LiveRange : public ZoneAllocated { public: @@ -658,7 +646,6 @@ class LiveRange : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(LiveRange); }; - } // namespace dart #endif // RUNTIME_VM_FLOW_GRAPH_ALLOCATOR_H_ diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc index a5e893434f1..4ed2701b4eb 100644 --- a/runtime/vm/flow_graph_builder.cc +++ b/runtime/vm/flow_graph_builder.cc @@ -7,8 +7,8 @@ #include "lib/invocation_mirror.h" #include "vm/ast_printer.h" #include "vm/bit_vector.h" -#include "vm/compiler.h" #include "vm/class_finalizer.h" +#include "vm/compiler.h" #include "vm/exceptions.h" #include "vm/flags.h" #include "vm/flow_graph.h" @@ -75,7 +75,6 @@ uword FlowGraphBuilder::FindDoubleConstant(double value) { return 0; } - #define RECOGNIZE_FACTORY(symbol, class_name, constructor_name, cid, fp) \ {Symbols::k##symbol##Id, cid, fp, #symbol ", " #cid}, // NOLINT @@ -107,7 +106,6 @@ intptr_t FactoryRecognizer::ResultCid(const Function& factory) { return kDynamicCid; } - // Base class for a stack of enclosing statements of interest (e.g., // blocks (breakable) and loops (continuable)). class NestedStatement : public ValueObject { @@ -151,20 +149,17 @@ class NestedStatement : public ValueObject { const intptr_t try_index_; }; - intptr_t NestedStatement::ContextLevel() const { // Context level is determined by the innermost nested statement having one. return (outer() == NULL) ? 0 : outer()->ContextLevel(); } - void NestedStatement::AdjustContextLevel(intptr_t context_level) { // There must be a NestedContextAdjustment on the nesting stack. ASSERT(outer() != NULL); outer()->AdjustContextLevel(context_level); } - intptr_t FlowGraphBuilder::GetNextDeoptId() const { intptr_t deopt_id = thread()->GetNextDeoptId(); if (context_level_array_ != NULL) { @@ -175,12 +170,10 @@ intptr_t FlowGraphBuilder::GetNextDeoptId() const { return deopt_id; } - intptr_t FlowGraphBuilder::context_level() const { return (nesting_stack() == NULL) ? 0 : nesting_stack()->ContextLevel(); } - JoinEntryInstr* NestedStatement::BreakTargetFor(SourceLabel* label) { if (label != label_) return NULL; if (break_target_ == NULL) { @@ -190,12 +183,10 @@ JoinEntryInstr* NestedStatement::BreakTargetFor(SourceLabel* label) { return break_target_; } - JoinEntryInstr* NestedStatement::ContinueTargetFor(SourceLabel* label) { return NULL; } - // A nested statement that has its own context level. class NestedBlock : public NestedStatement { public: @@ -208,14 +199,12 @@ class NestedBlock : public NestedStatement { LocalScope* scope_; }; - intptr_t NestedBlock::ContextLevel() const { return ((scope_ == NULL) || (scope_->num_context_variables() == 0)) ? NestedStatement::ContextLevel() : scope_->context_level(); } - // A nested statement reflecting a context level adjustment. class NestedContextAdjustment : public NestedStatement { public: @@ -233,7 +222,6 @@ class NestedContextAdjustment : public NestedStatement { intptr_t context_level_; }; - // A nested statement that can be the target of a continue as well as a // break. class NestedLoop : public NestedStatement { @@ -253,7 +241,6 @@ class NestedLoop : public NestedStatement { JoinEntryInstr* continue_target_; }; - JoinEntryInstr* NestedLoop::ContinueTargetFor(SourceLabel* label) { if (label != this->label()) return NULL; if (continue_target_ == NULL) { @@ -263,7 +250,6 @@ JoinEntryInstr* NestedLoop::ContinueTargetFor(SourceLabel* label) { return continue_target_; } - // A nested switch which can be the target of a break if labeled, and whose // cases can be the targets of continues. class NestedSwitch : public NestedStatement { @@ -277,7 +263,6 @@ class NestedSwitch : public NestedStatement { GrowableArray case_targets_; }; - NestedSwitch::NestedSwitch(FlowGraphBuilder* owner, SwitchNode* node) : NestedStatement(owner, node->label()), case_labels_(node->body()->length()), @@ -292,7 +277,6 @@ NestedSwitch::NestedSwitch(FlowGraphBuilder* owner, SwitchNode* node) } } - JoinEntryInstr* NestedSwitch::ContinueTargetFor(SourceLabel* label) { // Allocate a join for a case clause that matches the label. This block // is not necessarily targeted by a continue, but we always use a join in @@ -308,7 +292,6 @@ JoinEntryInstr* NestedSwitch::ContinueTargetFor(SourceLabel* label) { return NULL; } - FlowGraphBuilder::FlowGraphBuilder( const ParsedFunction& parsed_function, const ZoneGrowableArray& ic_data_array, @@ -339,12 +322,10 @@ FlowGraphBuilder::FlowGraphBuilder( await_joins_(new (Z) ZoneGrowableArray()), await_token_positions_(new (Z) ZoneGrowableArray()) {} - void FlowGraphBuilder::AddCatchEntry(CatchBlockEntryInstr* entry) { graph_entry_->AddCatchEntry(entry); } - void InlineExitCollector::PrepareGraphs(FlowGraph* callee_graph) { ASSERT(callee_graph->graph_entry()->SuccessorCount() == 1); ASSERT(callee_graph->max_block_id() > caller_graph_->max_block_id()); @@ -389,13 +370,11 @@ void InlineExitCollector::PrepareGraphs(FlowGraph* callee_graph) { RemoveUnreachableExits(callee_graph); } - void InlineExitCollector::AddExit(ReturnInstr* exit) { Data data = {NULL, exit}; exits_.Add(data); } - void InlineExitCollector::Union(const InlineExitCollector* other) { // It doesn't make sense to combine different calls or calls from // different graphs. @@ -404,12 +383,10 @@ void InlineExitCollector::Union(const InlineExitCollector* other) { exits_.AddArray(other->exits_); } - int InlineExitCollector::LowestBlockIdFirst(const Data* a, const Data* b) { return (a->exit_block->block_id() - b->exit_block->block_id()); } - void InlineExitCollector::RemoveUnreachableExits(FlowGraph* callee_graph) { const GrowableArray& postorder = callee_graph->postorder(); int j = 0; @@ -427,7 +404,6 @@ void InlineExitCollector::RemoveUnreachableExits(FlowGraph* callee_graph) { exits_.TruncateTo(j); } - void InlineExitCollector::SortExits() { // Assign block entries here because we did not necessarily know them when // the return exit was added to the array. @@ -437,7 +413,6 @@ void InlineExitCollector::SortExits() { exits_.Sort(LowestBlockIdFirst); } - Definition* InlineExitCollector::JoinReturns(BlockEntryInstr** exit_block, Instruction** last_instruction, intptr_t try_index) { @@ -543,7 +518,6 @@ Definition* InlineExitCollector::JoinReturns(BlockEntryInstr** exit_block, } } - void InlineExitCollector::ReplaceCall(TargetEntryInstr* callee_entry) { ASSERT(call_->previous() != NULL); ASSERT(call_->next() != NULL); @@ -659,7 +633,6 @@ void InlineExitCollector::ReplaceCall(TargetEntryInstr* callee_entry) { call_->UnuseAllInputs(); } - void EffectGraphVisitor::Append(const EffectGraphVisitor& other_fragment) { ASSERT(is_open()); if (other_fragment.is_empty()) return; @@ -671,7 +644,6 @@ void EffectGraphVisitor::Append(const EffectGraphVisitor& other_fragment) { exit_ = other_fragment.exit(); } - Value* EffectGraphVisitor::Bind(Definition* definition) { ASSERT(is_open()); owner()->DeallocateTemps(definition->InputCount()); @@ -686,7 +658,6 @@ Value* EffectGraphVisitor::Bind(Definition* definition) { return new (Z) Value(definition); } - void EffectGraphVisitor::Do(Definition* definition) { ASSERT(is_open()); owner()->DeallocateTemps(definition->InputCount()); @@ -699,7 +670,6 @@ void EffectGraphVisitor::Do(Definition* definition) { exit_ = definition; } - void EffectGraphVisitor::AddInstruction(Instruction* instruction) { ASSERT(is_open()); ASSERT(instruction->IsPushArgument() || !instruction->IsDefinition()); @@ -714,7 +684,6 @@ void EffectGraphVisitor::AddInstruction(Instruction* instruction) { } } - void EffectGraphVisitor::AddReturnExit(TokenPosition token_pos, Value* value) { ASSERT(is_open()); ReturnInstr* return_instr = @@ -727,7 +696,6 @@ void EffectGraphVisitor::AddReturnExit(TokenPosition token_pos, Value* value) { CloseFragment(); } - void EffectGraphVisitor::Goto(JoinEntryInstr* join) { ASSERT(is_open()); if (is_empty()) { @@ -738,7 +706,6 @@ void EffectGraphVisitor::Goto(JoinEntryInstr* join) { CloseFragment(); } - // Appends a graph fragment to a block entry instruction. Returns the entry // instruction if the fragment was empty or else the exit of the fragment if // it was non-empty (so NULL if the fragment is closed). @@ -753,7 +720,6 @@ static Instruction* AppendFragment(BlockEntryInstr* entry, return fragment.exit(); } - void EffectGraphVisitor::Join(const TestGraphVisitor& test_fragment, const EffectGraphVisitor& true_fragment, const EffectGraphVisitor& false_fragment) { @@ -789,7 +755,6 @@ void EffectGraphVisitor::Join(const TestGraphVisitor& test_fragment, } } - void EffectGraphVisitor::TieLoop( TokenPosition token_pos, const TestGraphVisitor& test_fragment, @@ -833,7 +798,6 @@ void EffectGraphVisitor::TieLoop( exit_ = test_fragment.CreateFalseSuccessor(); } - PushArgumentInstr* EffectGraphVisitor::PushArgument(Value* value) { owner_->add_args_pushed(1); PushArgumentInstr* result = new (Z) PushArgumentInstr(value); @@ -841,7 +805,6 @@ PushArgumentInstr* EffectGraphVisitor::PushArgument(Value* value) { return result; } - Definition* EffectGraphVisitor::BuildStoreTemp(const LocalVariable& local, Value* value, TokenPosition token_pos) { @@ -850,21 +813,18 @@ Definition* EffectGraphVisitor::BuildStoreTemp(const LocalVariable& local, return new (Z) StoreLocalInstr(local, value, ST(token_pos)); } - Definition* EffectGraphVisitor::BuildStoreExprTemp(Value* value, TokenPosition token_pos) { return BuildStoreTemp(*owner()->parsed_function().expression_temp_var(), value, token_pos); } - Definition* EffectGraphVisitor::BuildLoadExprTemp(TokenPosition token_pos) { ASSERT(!token_pos.IsClassifying()); return BuildLoadLocal(*owner()->parsed_function().expression_temp_var(), token_pos); } - Definition* EffectGraphVisitor::BuildStoreLocal(const LocalVariable& local, Value* value, TokenPosition token_pos) { @@ -889,7 +849,6 @@ Definition* EffectGraphVisitor::BuildStoreLocal(const LocalVariable& local, } } - Definition* EffectGraphVisitor::BuildLoadLocal(const LocalVariable& local, TokenPosition token_pos) { if (local.IsConst()) { @@ -913,7 +872,6 @@ Definition* EffectGraphVisitor::BuildLoadLocal(const LocalVariable& local, } } - // Stores current context into the 'variable' void EffectGraphVisitor::BuildSaveContext(const LocalVariable& variable, TokenPosition token_pos) { @@ -922,7 +880,6 @@ void EffectGraphVisitor::BuildSaveContext(const LocalVariable& variable, Do(BuildStoreLocal(variable, context, token_pos)); } - // Loads context saved in 'context_variable' into the current context. void EffectGraphVisitor::BuildRestoreContext(const LocalVariable& variable, TokenPosition token_pos) { @@ -930,20 +887,17 @@ void EffectGraphVisitor::BuildRestoreContext(const LocalVariable& variable, Do(BuildStoreContext(load_saved_context, token_pos)); } - Definition* EffectGraphVisitor::BuildStoreContext(Value* value, TokenPosition token_pos) { return new (Z) StoreLocalInstr( *owner()->parsed_function().current_context_var(), value, token_pos); } - Definition* EffectGraphVisitor::BuildCurrentContext(TokenPosition token_pos) { return new (Z) LoadLocalInstr( *owner()->parsed_function().current_context_var(), token_pos); } - void TestGraphVisitor::ConnectBranchesTo( const GrowableArray& branches, JoinEntryInstr* join) const { @@ -957,17 +911,14 @@ void TestGraphVisitor::ConnectBranchesTo( } } - void TestGraphVisitor::IfTrueGoto(JoinEntryInstr* join) const { ConnectBranchesTo(true_successor_addresses_, join); } - void TestGraphVisitor::IfFalseGoto(JoinEntryInstr* join) const { ConnectBranchesTo(false_successor_addresses_, join); } - BlockEntryInstr* TestGraphVisitor::CreateSuccessorFor( const GrowableArray& branches) const { ASSERT(!branches.is_empty()); @@ -987,17 +938,14 @@ BlockEntryInstr* TestGraphVisitor::CreateSuccessorFor( return join; } - BlockEntryInstr* TestGraphVisitor::CreateTrueSuccessor() const { return CreateSuccessorFor(true_successor_addresses_); } - BlockEntryInstr* TestGraphVisitor::CreateFalseSuccessor() const { return CreateSuccessorFor(false_successor_addresses_); } - void TestGraphVisitor::ReturnValue(Value* value) { Isolate* isolate = Isolate::Current(); if (isolate->type_checks() || isolate->asserts()) { @@ -1016,7 +964,6 @@ void TestGraphVisitor::ReturnValue(Value* value) { false_successor_addresses_.Add(branch->false_successor_address()); } - void TestGraphVisitor::MergeBranchWithStrictCompare(StrictCompareInstr* comp) { BranchInstr* branch = new (Z) BranchInstr(comp, owner()->GetNextDeoptId()); AddInstruction(branch); @@ -1025,7 +972,6 @@ void TestGraphVisitor::MergeBranchWithStrictCompare(StrictCompareInstr* comp) { false_successor_addresses_.Add(branch->false_successor_address()); } - void TestGraphVisitor::MergeBranchWithNegate(BooleanNegateInstr* neg) { ASSERT(!Isolate::Current()->type_checks()); Value* constant_true = Bind(new (Z) ConstantInstr(Bool::True())); @@ -1039,7 +985,6 @@ void TestGraphVisitor::MergeBranchWithNegate(BooleanNegateInstr* neg) { false_successor_addresses_.Add(branch->false_successor_address()); } - void TestGraphVisitor::ReturnDefinition(Definition* definition) { StrictCompareInstr* comp = definition->AsStrictCompare(); if (comp != NULL) { @@ -1056,7 +1001,6 @@ void TestGraphVisitor::ReturnDefinition(Definition* definition) { ReturnValue(Bind(definition)); } - // Special handling for AND/OR. void TestGraphVisitor::VisitBinaryOpNode(BinaryOpNode* node) { // Operators "&&" and "||" cannot be overloaded therefore do not call @@ -1088,18 +1032,15 @@ void TestGraphVisitor::VisitBinaryOpNode(BinaryOpNode* node) { ValueGraphVisitor::VisitBinaryOpNode(node); } - void EffectGraphVisitor::Bailout(const char* reason) const { owner()->Bailout(reason); } - void EffectGraphVisitor::InlineBailout(const char* reason) const { owner()->function().set_is_inlinable(false); if (owner()->IsInlining()) owner()->Bailout(reason); } - // ::= Return { value: // inlined_finally_list: * } void EffectGraphVisitor::VisitReturnNode(ReturnNode* node) { @@ -1233,13 +1174,11 @@ void EffectGraphVisitor::VisitReturnNode(ReturnNode* node) { } } - // ::= Literal { literal: Instance } void EffectGraphVisitor::VisitLiteralNode(LiteralNode* node) { ReturnDefinition(new (Z) ConstantInstr(node->literal(), node->token_pos())); } - // Type nodes are used when a type is referenced as a literal. Type nodes // can also be used for the right-hand side of instanceof comparisons, // but they are handled specially in that context, not here. @@ -1247,7 +1186,6 @@ void EffectGraphVisitor::VisitTypeNode(TypeNode* node) { return; } - void ValueGraphVisitor::VisitTypeNode(TypeNode* node) { const AbstractType& type = node->type(); // Type may be malbounded, but not malformed. @@ -1274,7 +1212,6 @@ void ValueGraphVisitor::VisitTypeNode(TypeNode* node) { owner()->GetNextDeoptId())); } - // Returns true if the type check can be skipped, for example, if the // destination type is dynamic or if the compile type of the value is a subtype // of the destination type. @@ -1317,7 +1254,6 @@ bool EffectGraphVisitor::CanSkipTypeCheck(TokenPosition token_pos, return eliminated; } - // :: Assignable { expr: // type: AbstractType // dst_name: String } @@ -1335,7 +1271,6 @@ void EffectGraphVisitor::VisitAssignableNode(AssignableNode* node) { } } - void ValueGraphVisitor::VisitAssignableNode(AssignableNode* node) { ValueGraphVisitor for_value(owner()); node->expr()->Visit(&for_value); @@ -1344,7 +1279,6 @@ void ValueGraphVisitor::VisitAssignableNode(AssignableNode* node) { node->type(), node->dst_name())); } - // :: BinaryOp { kind: Token::Kind // left: // right: } @@ -1404,7 +1338,6 @@ void EffectGraphVisitor::VisitBinaryOpNode(BinaryOpNode* node) { ReturnDefinition(call); } - // Special handling for AND/OR. void ValueGraphVisitor::VisitBinaryOpNode(BinaryOpNode* node) { // Operators "&&" and "||" cannot be overloaded therefore do not call @@ -1452,7 +1385,6 @@ void ValueGraphVisitor::VisitBinaryOpNode(BinaryOpNode* node) { EffectGraphVisitor::VisitBinaryOpNode(node); } - PushArgumentInstr* EffectGraphVisitor::PushInstantiatorTypeArguments( const AbstractType& type, TokenPosition token_pos) { @@ -1464,7 +1396,6 @@ PushArgumentInstr* EffectGraphVisitor::PushInstantiatorTypeArguments( } } - PushArgumentInstr* EffectGraphVisitor::PushFunctionTypeArguments( const AbstractType& type, TokenPosition token_pos) { @@ -1476,20 +1407,17 @@ PushArgumentInstr* EffectGraphVisitor::PushFunctionTypeArguments( } } - Value* EffectGraphVisitor::BuildNullValue(TokenPosition token_pos) { return Bind( new (Z) ConstantInstr(Object::ZoneHandle(Z, Object::null()), token_pos)); } - Value* EffectGraphVisitor::BuildEmptyTypeArguments(TokenPosition token_pos) { return Bind(new (Z) ConstantInstr( TypeArguments::ZoneHandle(Z, Object::empty_type_arguments().raw()), token_pos)); } - // Used for testing incoming arguments. AssertAssignableInstr* EffectGraphVisitor::BuildAssertAssignable( TokenPosition token_pos, @@ -1516,7 +1444,6 @@ AssertAssignableInstr* EffectGraphVisitor::BuildAssertAssignable( dst_type, dst_name, deopt_id); } - // Used for type casts and to test assignments. Value* EffectGraphVisitor::BuildAssignableValue(TokenPosition token_pos, Value* value, @@ -1528,7 +1455,6 @@ Value* EffectGraphVisitor::BuildAssignableValue(TokenPosition token_pos, return Bind(BuildAssertAssignable(token_pos, value, dst_type, dst_name)); } - void EffectGraphVisitor::BuildTypeTest(ComparisonNode* node) { ASSERT(Token::IsTypeTestOperator(node->kind())); const AbstractType& type = node->right()->AsTypeNode()->type(); @@ -1597,7 +1523,6 @@ void EffectGraphVisitor::BuildTypeTest(ComparisonNode* node) { ReturnDefinition(result); } - void EffectGraphVisitor::BuildTypeCast(ComparisonNode* node) { ASSERT(Token::IsTypeCastOperator(node->kind())); ASSERT(!node->right()->AsTypeNode()->type().IsNull()); @@ -1633,7 +1558,6 @@ void EffectGraphVisitor::BuildTypeCast(ComparisonNode* node) { ReturnDefinition(call); } - StrictCompareInstr* EffectGraphVisitor::BuildStrictCompare( AstNode* left, AstNode* right, @@ -1651,7 +1575,6 @@ StrictCompareInstr* EffectGraphVisitor::BuildStrictCompare( return comp; } - // :: Comparison { kind: Token::Kind // left: // right: } @@ -1746,7 +1669,6 @@ void EffectGraphVisitor::VisitComparisonNode(ComparisonNode* node) { ReturnDefinition(comp); } - void EffectGraphVisitor::VisitUnaryOpNode(UnaryOpNode* node) { // "!" cannot be overloaded, therefore do not call operator. if (node->kind() == Token::kNOT) { @@ -1779,7 +1701,6 @@ void EffectGraphVisitor::VisitUnaryOpNode(UnaryOpNode* node) { ReturnDefinition(call); } - void EffectGraphVisitor::VisitConditionalExprNode(ConditionalExprNode* node) { TestGraphVisitor for_test(owner(), node->condition()->token_pos()); node->condition()->Visit(&for_test); @@ -1793,7 +1714,6 @@ void EffectGraphVisitor::VisitConditionalExprNode(ConditionalExprNode* node) { Join(for_test, for_true, for_false); } - void ValueGraphVisitor::VisitConditionalExprNode(ConditionalExprNode* node) { TestGraphVisitor for_test(owner(), node->condition()->token_pos()); node->condition()->Visit(&for_test); @@ -1814,7 +1734,6 @@ void ValueGraphVisitor::VisitConditionalExprNode(ConditionalExprNode* node) { ReturnDefinition(BuildLoadExprTemp(node->token_pos())); } - // ::= If { condition: // true_branch: // false_branch: } @@ -1832,7 +1751,6 @@ void EffectGraphVisitor::VisitIfNode(IfNode* node) { Join(for_test, for_true, for_false); } - void EffectGraphVisitor::VisitSwitchNode(SwitchNode* node) { NestedSwitch nested_switch(owner(), node); EffectGraphVisitor switch_body(owner()); @@ -1844,7 +1762,6 @@ void EffectGraphVisitor::VisitSwitchNode(SwitchNode* node) { } } - // A case node contains zero or more case expressions, can contain default // and a case statement body. // Compose fragment as follows: @@ -1947,7 +1864,6 @@ void EffectGraphVisitor::VisitCaseNode(CaseNode* node) { exit_ = exit_instruction; } - // ::= While { label: SourceLabel // condition: // body: } @@ -1989,7 +1905,6 @@ void EffectGraphVisitor::VisitWhileNode(WhileNode* node) { } } - // The fragment is composed as follows: // a) body-entry-join // b) [ body ] @@ -2042,7 +1957,6 @@ void EffectGraphVisitor::VisitDoWhileNode(DoWhileNode* node) { } } - // A ForNode can contain break and continue jumps. 'break' joins to // ForNode exit, 'continue' joins at increment entry. The fragment is composed // as follows: @@ -2122,7 +2036,6 @@ void EffectGraphVisitor::VisitForNode(ForNode* node) { } } - void EffectGraphVisitor::VisitJumpNode(JumpNode* node) { if (FLAG_support_debugger && owner()->function().is_debuggable()) { AddInstruction(new (Z) DebugStepCheckInstr(node->token_pos(), @@ -2158,18 +2071,15 @@ void EffectGraphVisitor::VisitJumpNode(JumpNode* node) { Goto(jump_target); } - void EffectGraphVisitor::VisitArgumentListNode(ArgumentListNode* node) { UNREACHABLE(); } - void EffectGraphVisitor::VisitAwaitNode(AwaitNode* node) { // Await nodes are temporary during parsing. UNREACHABLE(); } - void EffectGraphVisitor::VisitAwaitMarkerNode(AwaitMarkerNode* node) { // We need to create a new await state which involves: // * Increase the jump counter. Sanity check against the list of targets. @@ -2198,14 +2108,12 @@ void EffectGraphVisitor::VisitAwaitMarkerNode(AwaitMarkerNode* node) { BuildSaveContext(*ctx_var, node->token_pos()); } - intptr_t EffectGraphVisitor::GetCurrentTempLocalIndex() const { return kFirstLocalSlotFromFp - owner()->num_stack_locals() - owner()->num_copied_params() - owner()->args_pushed() - owner()->temp_count() + 1; } - LocalVariable* EffectGraphVisitor::EnterTempLocalScope(Value* value) { ASSERT(value->definition()->temp_index() == (owner()->temp_count() - 1)); intptr_t index = GetCurrentTempLocalIndex(); @@ -2219,12 +2127,10 @@ LocalVariable* EffectGraphVisitor::EnterTempLocalScope(Value* value) { return var; } - Definition* EffectGraphVisitor::ExitTempLocalScope(Value* value) { return new (Z) DropTempsInstr(0, value); } - void EffectGraphVisitor::BuildLetTempExpressions(LetNode* node) { intptr_t num_temps = node->num_temps(); for (intptr_t i = 0; i < num_temps; ++i) { @@ -2237,7 +2143,6 @@ void EffectGraphVisitor::BuildLetTempExpressions(LetNode* node) { } } - void EffectGraphVisitor::VisitLetNode(LetNode* node) { BuildLetTempExpressions(node); @@ -2255,7 +2160,6 @@ void EffectGraphVisitor::VisitLetNode(LetNode* node) { } } - void ValueGraphVisitor::VisitLetNode(LetNode* node) { BuildLetTempExpressions(node); @@ -2280,7 +2184,6 @@ void ValueGraphVisitor::VisitLetNode(LetNode* node) { } } - void EffectGraphVisitor::VisitArrayNode(ArrayNode* node) { const TypeArguments& type_args = TypeArguments::ZoneHandle(Z, node->type().arguments()); @@ -2317,7 +2220,6 @@ void EffectGraphVisitor::VisitArrayNode(ArrayNode* node) { } } - void EffectGraphVisitor::VisitStringInterpolateNode( StringInterpolateNode* node) { ValueGraphVisitor for_argument(owner()); @@ -2352,7 +2254,6 @@ void EffectGraphVisitor::VisitStringInterpolateNode( ReturnDefinition(instr); } - void EffectGraphVisitor::VisitClosureNode(ClosureNode* node) { const Function& function = node->function(); if (function.IsImplicitStaticClosureFunction()) { @@ -2471,7 +2372,6 @@ void EffectGraphVisitor::VisitClosureNode(ClosureNode* node) { } } - void EffectGraphVisitor::BuildPushTypeArguments( const ArgumentListNode& node, ZoneGrowableArray* values) { @@ -2492,7 +2392,6 @@ void EffectGraphVisitor::BuildPushTypeArguments( } } - void EffectGraphVisitor::BuildPushArguments( const ArgumentListNode& node, ZoneGrowableArray* values) { @@ -2505,7 +2404,6 @@ void EffectGraphVisitor::BuildPushArguments( } } - void EffectGraphVisitor::BuildInstanceCallConditional(InstanceCallNode* node) { const TokenPosition token_pos = node->token_pos(); LocalVariable* temp_var = owner()->parsed_function().expression_temp_var(); @@ -2534,7 +2432,6 @@ void EffectGraphVisitor::BuildInstanceCallConditional(InstanceCallNode* node) { Join(for_test, for_true, for_false); } - void ValueGraphVisitor::VisitInstanceCallNode(InstanceCallNode* node) { if (node->is_conditional()) { ValueGraphVisitor for_receiver(owner()); @@ -2548,7 +2445,6 @@ void ValueGraphVisitor::VisitInstanceCallNode(InstanceCallNode* node) { } } - void EffectGraphVisitor::VisitInstanceCallNode(InstanceCallNode* node) { if (node->is_conditional()) { ASSERT(node->arguments()->type_args_len() == 0); @@ -2576,7 +2472,6 @@ void EffectGraphVisitor::VisitInstanceCallNode(InstanceCallNode* node) { } } - // ::= StaticCall { function: Function // arguments: } void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) { @@ -2595,7 +2490,6 @@ void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) { ReturnDefinition(call); } - void EffectGraphVisitor::BuildClosureCall(ClosureCallNode* node, bool result_needed) { ZoneGrowableArray* arguments = @@ -2633,17 +2527,14 @@ void EffectGraphVisitor::BuildClosureCall(ClosureCallNode* node, ReturnDefinition(ExitTempLocalScope(closure_value)); } - void EffectGraphVisitor::VisitClosureCallNode(ClosureCallNode* node) { BuildClosureCall(node, false); } - void ValueGraphVisitor::VisitClosureCallNode(ClosureCallNode* node) { BuildClosureCall(node, true); } - void EffectGraphVisitor::VisitInitStaticFieldNode(InitStaticFieldNode* node) { Value* field = Bind( new (Z) ConstantInstr(Field::ZoneHandle(Z, node->field().Original()))); @@ -2651,7 +2542,6 @@ void EffectGraphVisitor::VisitInitStaticFieldNode(InitStaticFieldNode* node) { owner()->GetNextDeoptId())); } - void EffectGraphVisitor::VisitCloneContextNode(CloneContextNode* node) { Value* context = Bind(BuildCurrentContext(node->token_pos())); Value* clone = Bind(new (Z) CloneContextInstr(node->token_pos(), context, @@ -2659,7 +2549,6 @@ void EffectGraphVisitor::VisitCloneContextNode(CloneContextNode* node) { Do(BuildStoreContext(clone, node->token_pos())); } - Value* EffectGraphVisitor::BuildObjectAllocation(ConstructorCallNode* node) { const Class& cls = Class::ZoneHandle(Z, node->constructor().Owner()); const bool cls_is_parameterized = cls.NumTypeArguments() > 0; @@ -2679,7 +2568,6 @@ Value* EffectGraphVisitor::BuildObjectAllocation(ConstructorCallNode* node) { return Bind(allocation); } - void EffectGraphVisitor::BuildConstructorCall( ConstructorCallNode* node, PushArgumentInstr* push_alloc_value) { @@ -2695,7 +2583,6 @@ void EffectGraphVisitor::BuildConstructorCall( owner()->ic_data_array(), owner()->GetNextDeoptId())); } - static intptr_t GetResultCidOfListFactory(ConstructorCallNode* node) { const Function& function = node->constructor(); const Class& function_class = Class::Handle(function.Owner()); @@ -2719,7 +2606,6 @@ static intptr_t GetResultCidOfListFactory(ConstructorCallNode* node) { return kDynamicCid; // Not a known list constructor. } - void EffectGraphVisitor::VisitConstructorCallNode(ConstructorCallNode* node) { if (node->constructor().IsFactory()) { ZoneGrowableArray* arguments = @@ -2761,7 +2647,6 @@ void EffectGraphVisitor::VisitConstructorCallNode(ConstructorCallNode* node) { BuildConstructorCall(node, push_allocated_value); } - Value* EffectGraphVisitor::BuildInstantiator(TokenPosition token_pos) { Function& outer_function = Function::Handle(Z, owner()->function().raw()); while (outer_function.IsLocalFunction()) { @@ -2777,7 +2662,6 @@ Value* EffectGraphVisitor::BuildInstantiator(TokenPosition token_pos) { return result; } - Value* EffectGraphVisitor::BuildInstantiatorTypeArguments( TokenPosition token_pos) { const Class& instantiator_class = @@ -2820,7 +2704,6 @@ Value* EffectGraphVisitor::BuildInstantiatorTypeArguments( token_pos)); } - Value* EffectGraphVisitor::BuildFunctionTypeArguments(TokenPosition token_pos) { LocalVariable* function_type_arguments_var = owner()->parsed_function().function_type_arguments(); @@ -2846,7 +2729,6 @@ Value* EffectGraphVisitor::BuildFunctionTypeArguments(TokenPosition token_pos) { return Bind(BuildLoadLocal(*function_type_arguments_var, token_pos)); } - Value* EffectGraphVisitor::BuildInstantiatedTypeArguments( TokenPosition token_pos, const TypeArguments& type_arguments) { @@ -2879,7 +2761,6 @@ Value* EffectGraphVisitor::BuildInstantiatedTypeArguments( function_type_args, owner()->GetNextDeoptId())); } - void ValueGraphVisitor::VisitConstructorCallNode(ConstructorCallNode* node) { if (node->constructor().IsFactory()) { EffectGraphVisitor::VisitConstructorCallNode(node); @@ -2905,7 +2786,6 @@ void ValueGraphVisitor::VisitConstructorCallNode(ConstructorCallNode* node) { } } - void EffectGraphVisitor::BuildInstanceGetterConditional( InstanceGetterNode* node) { const TokenPosition token_pos = node->token_pos(); @@ -2935,7 +2815,6 @@ void EffectGraphVisitor::BuildInstanceGetterConditional( Join(for_test, for_true, for_false); } - void ValueGraphVisitor::VisitInstanceGetterNode(InstanceGetterNode* node) { if (node->is_conditional()) { ValueGraphVisitor for_receiver(owner()); @@ -2949,7 +2828,6 @@ void ValueGraphVisitor::VisitInstanceGetterNode(InstanceGetterNode* node) { } } - void EffectGraphVisitor::VisitInstanceGetterNode(InstanceGetterNode* node) { ValueGraphVisitor for_receiver(owner()); node->receiver()->Visit(&for_receiver); @@ -2973,7 +2851,6 @@ void EffectGraphVisitor::VisitInstanceGetterNode(InstanceGetterNode* node) { } } - void EffectGraphVisitor::BuildInstanceSetterArguments( InstanceSetterNode* node, ZoneGrowableArray* arguments, @@ -2996,7 +2873,6 @@ void EffectGraphVisitor::BuildInstanceSetterArguments( arguments->Add(PushArgument(value)); } - void EffectGraphVisitor::VisitInstanceSetterNode(InstanceSetterNode* node) { const TokenPosition token_pos = node->token_pos(); if (node->is_conditional()) { @@ -3037,7 +2913,6 @@ void EffectGraphVisitor::VisitInstanceSetterNode(InstanceSetterNode* node) { ReturnDefinition(call); } - void ValueGraphVisitor::VisitInstanceSetterNode(InstanceSetterNode* node) { const TokenPosition token_pos = node->token_pos(); if (node->is_conditional()) { @@ -3083,7 +2958,6 @@ void ValueGraphVisitor::VisitInstanceSetterNode(InstanceSetterNode* node) { ReturnDefinition(BuildLoadExprTemp(token_pos)); } - void EffectGraphVisitor::VisitStaticGetterNode(StaticGetterNode* node) { const String& getter_name = String::ZoneHandle(Z, Field::GetterSymbol(node->field_name())); @@ -3149,7 +3023,6 @@ void EffectGraphVisitor::VisitStaticGetterNode(StaticGetterNode* node) { ReturnDefinition(call); } - void EffectGraphVisitor::BuildStaticSetter(StaticSetterNode* node, bool result_is_needed) { const String& setter_name = @@ -3218,17 +3091,14 @@ void EffectGraphVisitor::BuildStaticSetter(StaticSetterNode* node, } } - void EffectGraphVisitor::VisitStaticSetterNode(StaticSetterNode* node) { BuildStaticSetter(node, false); // Result not needed. } - void ValueGraphVisitor::VisitStaticSetterNode(StaticSetterNode* node) { BuildStaticSetter(node, true); // Result needed. } - static intptr_t OffsetForLengthGetter(MethodRecognizer::Kind kind) { switch (kind) { case MethodRecognizer::kObjectArrayLength: @@ -3247,7 +3117,6 @@ static intptr_t OffsetForLengthGetter(MethodRecognizer::Kind kind) { } } - LoadLocalInstr* EffectGraphVisitor::BuildLoadThisVar(LocalScope* scope, TokenPosition token_pos) { LocalVariable* receiver_var = scope->LookupVariable(Symbols::This(), @@ -3255,7 +3124,6 @@ LoadLocalInstr* EffectGraphVisitor::BuildLoadThisVar(LocalScope* scope, return new (Z) LoadLocalInstr(*receiver_var, token_pos); } - LoadFieldInstr* EffectGraphVisitor::BuildNativeGetter( NativeBodyNode* node, MethodRecognizer::Kind kind, @@ -3270,7 +3138,6 @@ LoadFieldInstr* EffectGraphVisitor::BuildNativeGetter( return load; } - ConstantInstr* EffectGraphVisitor::DoNativeSetterStoreValue( NativeBodyNode* node, intptr_t offset, @@ -3285,7 +3152,6 @@ ConstantInstr* EffectGraphVisitor::DoNativeSetterStoreValue( return new (Z) ConstantInstr(Object::ZoneHandle(Z, Object::null())); } - void EffectGraphVisitor::VisitNativeBodyNode(NativeBodyNode* node) { const Function& function = owner()->function(); const TokenPosition token_pos = node->token_pos(); @@ -3443,25 +3309,21 @@ void EffectGraphVisitor::VisitNativeBodyNode(NativeBodyNode* node) { ReturnDefinition(native_call); } - void EffectGraphVisitor::VisitPrimaryNode(PrimaryNode* node) { // PrimaryNodes are temporary during parsing. UNREACHABLE(); } - // ::= LoadLocal { local: LocalVariable } void EffectGraphVisitor::VisitLoadLocalNode(LoadLocalNode* node) { // Nothing to do. } - void ValueGraphVisitor::VisitLoadLocalNode(LoadLocalNode* node) { Definition* load = BuildLoadLocal(node->local(), node->token_pos()); ReturnDefinition(load); } - // ::= StoreLocal { local: LocalVariable // value: } void EffectGraphVisitor::VisitStoreLocalNode(StoreLocalNode* node) { @@ -3499,7 +3361,6 @@ void EffectGraphVisitor::VisitStoreLocalNode(StoreLocalNode* node) { ReturnDefinition(store); } - void EffectGraphVisitor::VisitLoadInstanceFieldNode( LoadInstanceFieldNode* node) { ValueGraphVisitor for_instance(owner()); @@ -3512,7 +3373,6 @@ void EffectGraphVisitor::VisitLoadInstanceFieldNode( ReturnDefinition(load); } - void EffectGraphVisitor::VisitStoreInstanceFieldNode( StoreInstanceFieldNode* node) { const TokenPosition token_pos = node->token_pos(); @@ -3550,7 +3410,6 @@ void EffectGraphVisitor::VisitStoreInstanceFieldNode( ReturnDefinition(store); } - void EffectGraphVisitor::VisitLoadStaticFieldNode(LoadStaticFieldNode* node) { const TokenPosition token_pos = node->token_pos(); if (node->field().is_const()) { @@ -3567,7 +3426,6 @@ void EffectGraphVisitor::VisitLoadStaticFieldNode(LoadStaticFieldNode* node) { ReturnDefinition(load); } - Definition* EffectGraphVisitor::BuildStoreStaticField( StoreStaticFieldNode* node, bool result_is_needed, @@ -3609,19 +3467,16 @@ Definition* EffectGraphVisitor::BuildStoreStaticField( } } - void EffectGraphVisitor::VisitStoreStaticFieldNode(StoreStaticFieldNode* node) { ReturnDefinition( BuildStoreStaticField(node, kResultNotNeeded, node->token_pos())); } - void ValueGraphVisitor::VisitStoreStaticFieldNode(StoreStaticFieldNode* node) { ReturnDefinition( BuildStoreStaticField(node, kResultNeeded, node->token_pos())); } - void EffectGraphVisitor::VisitLoadIndexedNode(LoadIndexedNode* node) { Function* super_function = NULL; if (node->IsSuperLoad()) { @@ -3673,7 +3528,6 @@ void EffectGraphVisitor::VisitLoadIndexedNode(LoadIndexedNode* node) { } } - Definition* EffectGraphVisitor::BuildStoreIndexedValues(StoreIndexedNode* node, bool result_is_needed) { Function* super_function = NULL; @@ -3757,24 +3611,20 @@ Definition* EffectGraphVisitor::BuildStoreIndexedValues(StoreIndexedNode* node, } } - void EffectGraphVisitor::VisitStoreIndexedNode(StoreIndexedNode* node) { ReturnDefinition(BuildStoreIndexedValues(node, kResultNotNeeded)); } - void ValueGraphVisitor::VisitStoreIndexedNode(StoreIndexedNode* node) { ReturnDefinition(BuildStoreIndexedValues(node, kResultNeeded)); } - bool EffectGraphVisitor::HasContextScope() const { const ContextScope& context_scope = ContextScope::Handle(owner()->function().context_scope()); return !context_scope.IsNull() && (context_scope.num_variables() > 0); } - void EffectGraphVisitor::UnchainContexts(intptr_t n) { // TODO(johnmccutchan): Pass this in. const TokenPosition token_pos = TokenPosition::kContext; @@ -3790,7 +3640,6 @@ void EffectGraphVisitor::UnchainContexts(intptr_t n) { } } - void EffectGraphVisitor::AdjustContextLevel(LocalScope* target_scope) { ASSERT(target_scope != NULL); intptr_t target_context_level = 0; @@ -3817,7 +3666,6 @@ void EffectGraphVisitor::AdjustContextLevel(LocalScope* target_scope) { owner()->nesting_stack()->AdjustContextLevel(target_context_level); } - // ::= Sequence { scope: LocalScope // nodes: * // label: SourceLabel } @@ -3998,7 +3846,6 @@ void EffectGraphVisitor::VisitSequenceNode(SequenceNode* node) { Do(call_async_set_thread_stack_trace); } - if (FLAG_support_debugger && is_top_level_sequence && function.is_debuggable()) { // Place a debug check at method entry to ensure breaking on a method always @@ -4168,7 +4015,6 @@ void EffectGraphVisitor::VisitSequenceNode(SequenceNode* node) { } } - void EffectGraphVisitor::VisitCatchClauseNode(CatchClauseNode* node) { InlineBailout("EffectGraphVisitor::VisitCatchClauseNode (exception)"); // Restores current context from local variable ':saved_try_context_var'. @@ -4179,7 +4025,6 @@ void EffectGraphVisitor::VisitCatchClauseNode(CatchClauseNode* node) { Append(for_catch); } - void EffectGraphVisitor::VisitTryCatchNode(TryCatchNode* node) { InlineBailout("EffectGraphVisitor::VisitTryCatchNode (exception)"); CatchClauseNode* catch_block = node->catch_block(); @@ -4313,7 +4158,6 @@ void EffectGraphVisitor::VisitTryCatchNode(TryCatchNode* node) { } } - // Looks up dynamic method noSuchMethod in target_class // (including its super class chain) and builds a static call to it. StaticCallInstr* EffectGraphVisitor::BuildStaticNoSuchMethodCall( @@ -4355,7 +4199,6 @@ StaticCallInstr* EffectGraphVisitor::BuildStaticNoSuchMethodCall( push_arguments, owner()->ic_data_array(), owner()->GetNextDeoptId()); } - StaticCallInstr* EffectGraphVisitor::BuildThrowNoSuchMethodError( TokenPosition token_pos, const Class& function_class, @@ -4422,7 +4265,6 @@ StaticCallInstr* EffectGraphVisitor::BuildThrowNoSuchMethodError( owner()->GetNextDeoptId()); } - void EffectGraphVisitor::BuildThrowNode(ThrowNode* node) { if (FLAG_support_debugger) { if (node->exception()->IsLiteralNode() || @@ -4452,13 +4294,11 @@ void EffectGraphVisitor::BuildThrowNode(ThrowNode* node) { AddInstruction(instr); } - void EffectGraphVisitor::VisitThrowNode(ThrowNode* node) { BuildThrowNode(node); CloseFragment(); } - // A throw cannot be part of an expression, however, the parser may replace // certain expression nodes with a throw. In that case generate a literal null // so that the fragment is not closed in the middle of an expression. @@ -4468,7 +4308,6 @@ void ValueGraphVisitor::VisitThrowNode(ThrowNode* node) { new (Z) ConstantInstr(Instance::ZoneHandle(Z, Instance::null()))); } - void EffectGraphVisitor::VisitInlinedFinallyNode(InlinedFinallyNode* node) { InlineBailout("EffectGraphVisitor::VisitInlinedFinallyNode (exception)"); const intptr_t try_index = owner()->try_index(); @@ -4510,12 +4349,10 @@ void EffectGraphVisitor::VisitInlinedFinallyNode(InlinedFinallyNode* node) { exit_ = for_finally_block.exit_; } - void EffectGraphVisitor::VisitStopNode(StopNode* node) { AddInstruction(new (Z) StopInstr(node->message())); } - FlowGraph* FlowGraphBuilder::BuildGraph() { VMTagScope tagScope(thread(), VMTag::kCompileFlowGraphBuilderTagId, FLAG_profile_vm); @@ -4554,17 +4391,14 @@ FlowGraph* FlowGraphBuilder::BuildGraph() { return graph; } - void FlowGraphBuilder::AppendAwaitTokenPosition(TokenPosition token_pos) { await_token_positions_->Add(token_pos); } - void FlowGraphBuilder::Bailout(const char* reason) const { parsed_function_.Bailout("FlowGraphBuilder", reason); } - bool FlowGraphBuilder::SimpleInstanceOfType(const AbstractType& type) { // Bail if the type is still uninstantiated at compile time. if (!type.IsInstantiated()) return false; diff --git a/runtime/vm/flow_graph_builder.h b/runtime/vm/flow_graph_builder.h index b4018dfdc8a..f195a4e3b06 100644 --- a/runtime/vm/flow_graph_builder.h +++ b/runtime/vm/flow_graph_builder.h @@ -90,7 +90,6 @@ class InlineExitCollector : public ZoneAllocated { GrowableArray exits_; }; - // Build a flow graph from a parsed function's AST. class FlowGraphBuilder : public ValueObject { public: @@ -230,7 +229,6 @@ class FlowGraphBuilder : public ValueObject { DISALLOW_IMPLICIT_CONSTRUCTORS(FlowGraphBuilder); }; - // Translate an AstNode to a control-flow graph fragment for its effects // (e.g., a statement or an expression in an effect context). Implements a // function from an AstNode and next temporary index to a graph fragment @@ -468,7 +466,6 @@ class EffectGraphVisitor : public AstNodeVisitor { Instruction* exit_; }; - // Translate an AstNode to a control-flow graph fragment for both its effects // and value (e.g., for an expression in a value context). Implements a // function from an AstNode and next temporary index to a graph fragment (as @@ -514,7 +511,6 @@ class ValueGraphVisitor : public EffectGraphVisitor { } }; - // Translate an AstNode to a control-flow graph fragment for both its // effects and true/false control flow (e.g., for an expression in a test // context). The resulting graph is always closed (even if it is empty) diff --git a/runtime/vm/flow_graph_builder_test.cc b/runtime/vm/flow_graph_builder_test.cc index b5c457d153c..bbec3498c5d 100644 --- a/runtime/vm/flow_graph_builder_test.cc +++ b/runtime/vm/flow_graph_builder_test.cc @@ -2,10 +2,10 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +#include "vm/flow_graph_builder.h" #include "vm/compiler.h" #include "vm/dart_api_impl.h" #include "vm/dart_entry.h" -#include "vm/flow_graph_builder.h" #include "vm/intermediate_language.h" #include "vm/unit_test.h" @@ -280,7 +280,6 @@ class SourcePositionTest : public ValueObject { GrowableArray* blocks_; }; - TEST_CASE(SourcePosition_InstanceCalls) { const char* kScript = "var x = 5;\n" @@ -301,7 +300,6 @@ TEST_CASE(SourcePosition_InstanceCalls) { spt.EnsureSourcePositions(); } - TEST_CASE(SourcePosition_If) { const char* kScript = "var x = 5;\n" @@ -330,7 +328,6 @@ TEST_CASE(SourcePosition_If) { spt.EnsureSourcePositions(); } - TEST_CASE(SourcePosition_ForLoop) { const char* kScript = "var x = 0;\n" @@ -361,7 +358,6 @@ TEST_CASE(SourcePosition_ForLoop) { spt.EnsureSourcePositions(); } - TEST_CASE(SourcePosition_While) { const char* kScript = "var x = 0;\n" @@ -410,7 +406,6 @@ TEST_CASE(SourcePosition_While) { spt.EnsureSourcePositions(); } - TEST_CASE(SourcePosition_WhileContinueBreak) { const char* kScript = "var x = 0;\n" @@ -450,7 +445,6 @@ TEST_CASE(SourcePosition_WhileContinueBreak) { spt.EnsureSourcePositions(); } - TEST_CASE(SourcePosition_LoadIndexed) { const char* kScript = "var x = 0;\n" @@ -489,7 +483,6 @@ TEST_CASE(SourcePosition_LoadIndexed) { spt.EnsureSourcePositions(); } - TEST_CASE(SourcePosition_StoreIndexed) { const char* kScript = "var x = 0;\n" @@ -533,7 +526,6 @@ TEST_CASE(SourcePosition_StoreIndexed) { spt.EnsureSourcePositions(); } - TEST_CASE(SourcePosition_BitwiseOperations) { const char* kScript = "var x = 0;\n" @@ -583,7 +575,6 @@ TEST_CASE(SourcePosition_BitwiseOperations) { spt.EnsureSourcePositions(); } - TEST_CASE(SourcePosition_IfElse) { const char* kScript = "var x = 5;\n" @@ -613,7 +604,6 @@ TEST_CASE(SourcePosition_IfElse) { spt.EnsureSourcePositions(); } - TEST_CASE(SourcePosition_Switch) { const char* kScript = "var x = 5;\n" @@ -626,7 +616,6 @@ TEST_CASE(SourcePosition_Switch) { " }\n" "}\n"; - SourcePositionTest spt(thread, kScript); spt.BuildGraphFor("main"); @@ -659,7 +648,6 @@ TEST_CASE(SourcePosition_Switch) { spt.EnsureSourcePositions(); } - TEST_CASE(SourcePosition_TryCatchFinally) { const char* kScript = "var x = 5;\n" @@ -711,7 +699,6 @@ TEST_CASE(SourcePosition_TryCatchFinally) { spt.EnsureSourcePositions(); } - TEST_CASE(SourcePosition_InstanceFields) { const char* kScript = "class A {\n" @@ -741,7 +728,6 @@ TEST_CASE(SourcePosition_InstanceFields) { spt.EnsureSourcePositions(); } - TEST_CASE(SourcePosition_Async) { const char* kScript = "import 'dart:async';\n" @@ -769,7 +755,6 @@ static bool SyntheticRoundTripTest(TokenPosition token_pos) { return synthetic_token_pos.FromSynthetic() == token_pos; } - VM_UNIT_TEST_CASE(SourcePosition_SyntheticTokens) { EXPECT(TokenPosition::kNoSourcePos == -1); EXPECT(TokenPosition::kMinSourcePos == 0); diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc index 9d63c970b41..85d27f6d51c 100644 --- a/runtime/vm/flow_graph_compiler.cc +++ b/runtime/vm/flow_graph_compiler.cc @@ -111,7 +111,6 @@ COMPILE_ASSERT(FLAG_load_deferred_eagerly); #endif // DART_PRECOMPILED_RUNTIME - // Assign locations to incoming arguments, i.e., values pushed above spill slots // with PushArgument. Recursively allocates from outermost to innermost // environment. @@ -128,7 +127,6 @@ void CompilerDeoptInfo::AllocateIncomingParametersRecursive( } } - void CompilerDeoptInfo::EmitMaterializations(Environment* env, DeoptInfoBuilder* builder) { for (Environment::DeepIterator it(env); !it.Done(); it.Advance()) { @@ -141,7 +139,6 @@ void CompilerDeoptInfo::EmitMaterializations(Environment* env, } } - FlowGraphCompiler::FlowGraphCompiler( Assembler* assembler, FlowGraph* flow_graph, @@ -212,7 +209,6 @@ FlowGraphCompiler::FlowGraphCompiler( inline_id_to_token_pos, inline_id_to_function); } - bool FlowGraphCompiler::IsUnboxedField(const Field& field) { bool valid_class = (SupportsUnboxedDoubles() && (field.guarded_cid() == kDoubleCid)) || @@ -222,14 +218,12 @@ bool FlowGraphCompiler::IsUnboxedField(const Field& field) { !field.is_nullable() && valid_class; } - bool FlowGraphCompiler::IsPotentialUnboxedField(const Field& field) { return field.is_unboxing_candidate() && (FlowGraphCompiler::IsUnboxedField(field) || (!field.is_final() && (field.guarded_cid() == kIllegalCid))); } - void FlowGraphCompiler::InitCompiler() { pc_descriptors_list_ = new (zone()) DescriptorList(64); exception_handlers_list_ = new (zone()) ExceptionHandlerList(); @@ -288,22 +282,18 @@ void FlowGraphCompiler::InitCompiler() { } } - bool FlowGraphCompiler::CanOptimize() { return FLAG_optimization_counter_threshold >= 0; } - bool FlowGraphCompiler::CanOptimizeFunction() const { return CanOptimize() && !parsed_function().function().HasBreakpoint(); } - bool FlowGraphCompiler::CanOSRFunction() const { return isolate()->use_osr() && CanOptimizeFunction() && !is_optimizing(); } - bool FlowGraphCompiler::ForceSlowPathForStackOverflow() const { if ((FLAG_stacktrace_every > 0) || (FLAG_deoptimize_every > 0) || (isolate()->reload_every_n_stack_overflow_checks() > 0)) { @@ -322,7 +312,6 @@ bool FlowGraphCompiler::ForceSlowPathForStackOverflow() const { return false; } - static bool IsEmptyBlock(BlockEntryInstr* block) { return !block->IsCatchBlockEntry() && !block->HasNonRedundantParallelMove() && block->next()->IsGoto() && @@ -330,7 +319,6 @@ static bool IsEmptyBlock(BlockEntryInstr* block) { !block->IsIndirectEntry(); } - void FlowGraphCompiler::CompactBlock(BlockEntryInstr* block) { BlockInfo* block_info = block_info_[block->postorder_number()]; @@ -349,7 +337,6 @@ void FlowGraphCompiler::CompactBlock(BlockEntryInstr* block) { } } - void FlowGraphCompiler::CompactBlocks() { // This algorithm does not garbage collect blocks in place, but merely // records forwarding label information. In this way it avoids having to @@ -378,7 +365,6 @@ void FlowGraphCompiler::CompactBlocks() { block_info->set_next_nonempty_label(nonempty_label); } - void FlowGraphCompiler::EmitCatchEntryState(Environment* env, intptr_t try_index) { #if defined(DART_PRECOMPILER) || defined(DART_PRECOMPILED_RUNTIME) @@ -453,7 +439,6 @@ void FlowGraphCompiler::EmitCatchEntryState(Environment* env, #endif // defined(DART_PRECOMPILER) || defined(DART_PRECOMPILED_RUNTIME) } - void FlowGraphCompiler::EmitCallsiteMetaData(TokenPosition token_pos, intptr_t deopt_id, RawPcDescriptors::Kind kind, @@ -463,7 +448,6 @@ void FlowGraphCompiler::EmitCallsiteMetaData(TokenPosition token_pos, EmitCatchEntryState(); } - void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) { if (!is_optimizing()) { if (instr->CanBecomeDeoptimizationTarget() && !instr->IsGoto()) { @@ -477,7 +461,6 @@ void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) { } } - void FlowGraphCompiler::EmitSourceLine(Instruction* instr) { if (!instr->token_pos().IsReal() || (instr->env() == NULL)) { return; @@ -493,7 +476,6 @@ void FlowGraphCompiler::EmitSourceLine(Instruction* instr) { line.ToCString()); } - static void LoopInfoComment( Assembler* assembler, const BlockEntryInstr& block, @@ -510,7 +492,6 @@ static void LoopInfoComment( } } - void FlowGraphCompiler::VisitBlocks() { CompactBlocks(); const ZoneGrowableArray* loop_headers = NULL; @@ -586,12 +567,10 @@ void FlowGraphCompiler::VisitBlocks() { set_current_block(NULL); } - void FlowGraphCompiler::Bailout(const char* reason) { parsed_function_.Bailout("FlowGraphCompiler", reason); } - intptr_t FlowGraphCompiler::StackSize() const { if (is_optimizing_) { return flow_graph_.graph_entry()->spill_slot_count(); @@ -601,30 +580,25 @@ intptr_t FlowGraphCompiler::StackSize() const { } } - Label* FlowGraphCompiler::GetJumpLabel(BlockEntryInstr* block_entry) const { const intptr_t block_index = block_entry->postorder_number(); return block_info_[block_index]->jump_label(); } - bool FlowGraphCompiler::WasCompacted(BlockEntryInstr* block_entry) const { const intptr_t block_index = block_entry->postorder_number(); return block_info_[block_index]->WasCompacted(); } - Label* FlowGraphCompiler::NextNonEmptyLabel() const { const intptr_t current_index = current_block()->postorder_number(); return block_info_[current_index]->next_nonempty_label(); } - bool FlowGraphCompiler::CanFallThroughTo(BlockEntryInstr* block_entry) const { return NextNonEmptyLabel() == GetJumpLabel(block_entry); } - BranchLabels FlowGraphCompiler::CreateBranchLabels(BranchInstr* branch) const { Label* true_label = GetJumpLabel(branch->true_successor()); Label* false_label = GetJumpLabel(branch->false_successor()); @@ -633,12 +607,10 @@ BranchLabels FlowGraphCompiler::CreateBranchLabels(BranchInstr* branch) const { return result; } - void FlowGraphCompiler::AddSlowPathCode(SlowPathCode* code) { slow_path_code_.Add(code); } - void FlowGraphCompiler::GenerateDeferredCode() { for (intptr_t i = 0; i < slow_path_code_.length(); i++) { BeginCodeSourceRange(); @@ -652,7 +624,6 @@ void FlowGraphCompiler::GenerateDeferredCode() { } } - void FlowGraphCompiler::AddExceptionHandler(intptr_t try_index, intptr_t outer_try_index, intptr_t pc_offset, @@ -665,12 +636,10 @@ void FlowGraphCompiler::AddExceptionHandler(intptr_t try_index, needs_stacktrace); } - void FlowGraphCompiler::SetNeedsStackTrace(intptr_t try_index) { exception_handlers_list_->SetNeedsStackTrace(try_index); } - void FlowGraphCompiler::AddDescriptor(RawPcDescriptors::Kind kind, intptr_t pc_offset, intptr_t deopt_id, @@ -683,7 +652,6 @@ void FlowGraphCompiler::AddDescriptor(RawPcDescriptors::Kind kind, try_index); } - // Uses current pc position and try-index. void FlowGraphCompiler::AddCurrentDescriptor(RawPcDescriptors::Kind kind, intptr_t deopt_id, @@ -692,21 +660,18 @@ void FlowGraphCompiler::AddCurrentDescriptor(RawPcDescriptors::Kind kind, CurrentTryIndex()); } - void FlowGraphCompiler::AddStaticCallTarget(const Function& func) { ASSERT(func.IsZoneHandle()); static_calls_target_table_.Add( new (zone()) StaticCallsStruct(assembler()->CodeSize(), &func, NULL)); } - void FlowGraphCompiler::AddStubCallTarget(const Code& code) { ASSERT(code.IsZoneHandle()); static_calls_target_table_.Add( new (zone()) StaticCallsStruct(assembler()->CodeSize(), NULL, &code)); } - CompilerDeoptInfo* FlowGraphCompiler::AddDeoptIndexAtCall(intptr_t deopt_id) { ASSERT(is_optimizing()); ASSERT(!intrinsic_mode()); @@ -719,7 +684,6 @@ CompilerDeoptInfo* FlowGraphCompiler::AddDeoptIndexAtCall(intptr_t deopt_id) { return info; } - // This function must be in sync with FlowGraphCompiler::SaveLiveRegisters // and FlowGraphCompiler::SlowPathEnvironmentFor. // See StackFrame::VisitObjectPointers for the details of how stack map is @@ -804,7 +768,6 @@ void FlowGraphCompiler::RecordSafepoint(LocationSummary* locs, } } - // This function must be kept in sync with: // // FlowGraphCompiler::RecordSafepoint @@ -861,7 +824,6 @@ Environment* FlowGraphCompiler::SlowPathEnvironmentFor( return env; } - Label* FlowGraphCompiler::AddDeoptStub(intptr_t deopt_id, ICData::DeoptReasonId reason, uint32_t flags) { @@ -888,7 +850,6 @@ Label* FlowGraphCompiler::AddDeoptStub(intptr_t deopt_id, return stub->entry_label(); } - #if defined(TARGET_ARCH_DBC) void FlowGraphCompiler::EmitDeopt(intptr_t deopt_id, ICData::DeoptReasonId reason, @@ -906,7 +867,6 @@ void FlowGraphCompiler::EmitDeopt(intptr_t deopt_id, } #endif // defined(TARGET_ARCH_DBC) - void FlowGraphCompiler::FinalizeExceptionHandlers(const Code& code) { ASSERT(exception_handlers_list_ != NULL); const ExceptionHandlers& handlers = ExceptionHandlers::Handle( @@ -920,7 +880,6 @@ void FlowGraphCompiler::FinalizeExceptionHandlers(const Code& code) { } } - void FlowGraphCompiler::FinalizePcDescriptors(const Code& code) { ASSERT(pc_descriptors_list_ != NULL); const PcDescriptors& descriptors = PcDescriptors::Handle( @@ -929,7 +888,6 @@ void FlowGraphCompiler::FinalizePcDescriptors(const Code& code) { code.set_pc_descriptors(descriptors); } - RawArray* FlowGraphCompiler::CreateDeoptInfo(Assembler* assembler) { // No deopt information if we precompile (no deoptimization allowed). if (FLAG_precompiled_mode) { @@ -962,7 +920,6 @@ RawArray* FlowGraphCompiler::CreateDeoptInfo(Assembler* assembler) { } } - void FlowGraphCompiler::FinalizeStackMaps(const Code& code) { if (stackmap_table_builder_ == NULL) { code.set_stackmaps(Object::null_array()); @@ -973,7 +930,6 @@ void FlowGraphCompiler::FinalizeStackMaps(const Code& code) { } } - void FlowGraphCompiler::FinalizeVarDescriptors(const Code& code) { if (code.is_optimized()) { // Optimized code does not need variable descriptors. They are @@ -1035,7 +991,6 @@ void FlowGraphCompiler::FinalizeStaticCallTargetsTable(const Code& code) { targets.Length() * sizeof(uword)); } - void FlowGraphCompiler::FinalizeCodeSourceMap(const Code& code) { const Array& inlined_id_array = Array::Handle(zone(), code_source_map_builder_->InliningIdToFunction()); @@ -1058,7 +1013,6 @@ void FlowGraphCompiler::FinalizeCodeSourceMap(const Code& code) { #endif } - // Returns 'true' if regular code generation should be skipped. bool FlowGraphCompiler::TryIntrinsify() { // Intrinsification skips arguments checks, therefore disable if in checked @@ -1113,7 +1067,6 @@ bool FlowGraphCompiler::TryIntrinsify() { return complete; } - // DBC is very different from other architectures in how it performs instance // and static calls because it does not use stubs. #if !defined(TARGET_ARCH_DBC) @@ -1133,7 +1086,6 @@ void FlowGraphCompiler::GenerateCallWithDeopt(TokenPosition token_pos, } } - void FlowGraphCompiler::GenerateInstanceCall(intptr_t deopt_id, TokenPosition token_pos, intptr_t argument_count, @@ -1192,7 +1144,6 @@ void FlowGraphCompiler::GenerateInstanceCall(intptr_t deopt_id, } } - void FlowGraphCompiler::GenerateStaticCall(intptr_t deopt_id, TokenPosition token_pos, const Function& function, @@ -1223,7 +1174,6 @@ void FlowGraphCompiler::GenerateStaticCall(intptr_t deopt_id, } } - void FlowGraphCompiler::GenerateNumberTypeCheck(Register kClassIdReg, const AbstractType& type, Label* is_instance_lbl, @@ -1243,7 +1193,6 @@ void FlowGraphCompiler::GenerateNumberTypeCheck(Register kClassIdReg, CheckClassIds(kClassIdReg, args, is_instance_lbl, is_not_instance_lbl); } - void FlowGraphCompiler::GenerateStringTypeCheck(Register kClassIdReg, Label* is_instance_lbl, Label* is_not_instance_lbl) { @@ -1256,7 +1205,6 @@ void FlowGraphCompiler::GenerateStringTypeCheck(Register kClassIdReg, CheckClassIds(kClassIdReg, args, is_instance_lbl, is_not_instance_lbl); } - void FlowGraphCompiler::GenerateListTypeCheck(Register kClassIdReg, Label* is_instance_lbl) { assembler()->Comment("ListTypeCheck"); @@ -1282,7 +1230,6 @@ void FlowGraphCompiler::EmitComment(Instruction* instr) { #endif } - #if !defined(TARGET_ARCH_DBC) // TODO(vegorov) enable edge-counters on DBC if we consider them beneficial. bool FlowGraphCompiler::NeedsEdgeCounter(TargetEntryInstr* block) { @@ -1293,7 +1240,6 @@ bool FlowGraphCompiler::NeedsEdgeCounter(TargetEntryInstr* block) { (block == flow_graph().graph_entry()->normal_entry()))); } - // Allocate a register that is not explicitly blocked. static Register AllocateFreeRegister(bool* blocked_registers) { for (intptr_t regno = 0; regno < kNumberOfCpuRegisters; regno++) { @@ -1307,7 +1253,6 @@ static Register AllocateFreeRegister(bool* blocked_registers) { } #endif - void FlowGraphCompiler::AllocateRegistersLocally(Instruction* instr) { ASSERT(!is_optimizing()); instr->InitializeLocationSummary(zone(), false); // Not optimizing. @@ -1406,16 +1351,13 @@ void FlowGraphCompiler::AllocateRegistersLocally(Instruction* instr) { #endif // !defined(TARGET_ARCH_DBC) } - static uword RegMaskBit(Register reg) { return ((reg) != kNoRegister) ? (1 << (reg)) : 0; } - ParallelMoveResolver::ParallelMoveResolver(FlowGraphCompiler* compiler) : compiler_(compiler), moves_(32) {} - void ParallelMoveResolver::EmitNativeCode(ParallelMoveInstr* parallel_move) { ASSERT(moves_.is_empty()); // Build up a worklist of moves. @@ -1443,7 +1385,6 @@ void ParallelMoveResolver::EmitNativeCode(ParallelMoveInstr* parallel_move) { moves_.Clear(); } - void ParallelMoveResolver::BuildInitialMoveList( ParallelMoveInstr* parallel_move) { // Perform a linear sweep of the moves to add them to the initial list of @@ -1456,7 +1397,6 @@ void ParallelMoveResolver::BuildInitialMoveList( } } - void ParallelMoveResolver::PerformMove(int index) { // Each call to this function performs a move and deletes it from the move // graph. We first recursively perform any move blocking this one. We @@ -1525,7 +1465,6 @@ void ParallelMoveResolver::PerformMove(int index) { compiler_->EndCodeSourceRange(TokenPosition::kParallelMove); } - bool ParallelMoveResolver::IsScratchLocation(Location loc) { for (int i = 0; i < moves_.length(); ++i) { if (moves_[i]->Blocks(loc)) { @@ -1542,7 +1481,6 @@ bool ParallelMoveResolver::IsScratchLocation(Location loc) { return false; } - intptr_t ParallelMoveResolver::AllocateScratchRegister( Location::Kind kind, uword blocked_mask, @@ -1577,7 +1515,6 @@ intptr_t ParallelMoveResolver::AllocateScratchRegister( return scratch; } - ParallelMoveResolver::ScratchFpuRegisterScope::ScratchFpuRegisterScope( ParallelMoveResolver* resolver, FpuRegister blocked) @@ -1594,14 +1531,12 @@ ParallelMoveResolver::ScratchFpuRegisterScope::ScratchFpuRegisterScope( } } - ParallelMoveResolver::ScratchFpuRegisterScope::~ScratchFpuRegisterScope() { if (spilled_) { resolver_->RestoreFpuScratch(reg_); } } - ParallelMoveResolver::ScratchRegisterScope::ScratchRegisterScope( ParallelMoveResolver* resolver, Register blocked) @@ -1625,14 +1560,12 @@ ParallelMoveResolver::ScratchRegisterScope::ScratchRegisterScope( } } - ParallelMoveResolver::ScratchRegisterScope::~ScratchRegisterScope() { if (spilled_) { resolver_->RestoreScratch(reg_); } } - const ICData* FlowGraphCompiler::GetOrAddInstanceCallICData( intptr_t deopt_id, const String& target_name, @@ -1663,7 +1596,6 @@ const ICData* FlowGraphCompiler::GetOrAddInstanceCallICData( return &ic_data; } - const ICData* FlowGraphCompiler::GetOrAddStaticCallICData( intptr_t deopt_id, const Function& target, @@ -1695,7 +1627,6 @@ const ICData* FlowGraphCompiler::GetOrAddStaticCallICData( return &ic_data; } - intptr_t FlowGraphCompiler::GetOptimizationThreshold() const { intptr_t threshold; if (is_optimizing()) { @@ -1714,7 +1645,6 @@ intptr_t FlowGraphCompiler::GetOptimizationThreshold() const { return threshold; } - const Class& FlowGraphCompiler::BoxClassFor(Representation rep) { switch (rep) { case kUnboxedDouble: @@ -1733,18 +1663,15 @@ const Class& FlowGraphCompiler::BoxClassFor(Representation rep) { } } - void FlowGraphCompiler::BeginCodeSourceRange() { code_source_map_builder_->BeginCodeSourceRange(assembler()->CodeSize()); } - void FlowGraphCompiler::EndCodeSourceRange(TokenPosition token_pos) { code_source_map_builder_->EndCodeSourceRange(assembler()->CodeSize(), token_pos); } - const CallTargets* FlowGraphCompiler::ResolveCallTargetsForReceiverCid( intptr_t cid, const String& selector, @@ -1762,7 +1689,6 @@ const CallTargets* FlowGraphCompiler::ResolveCallTargetsForReceiverCid( return targets; } - bool FlowGraphCompiler::LookupMethodFor(int class_id, const String& name, const ArgumentsDescriptor& args_desc, @@ -1793,7 +1719,6 @@ bool FlowGraphCompiler::LookupMethodFor(int class_id, return true; } - #if !defined(TARGET_ARCH_DBC) // DBC emits calls very differently from other architectures due to its // interpreted nature. @@ -1832,7 +1757,6 @@ void FlowGraphCompiler::EmitPolymorphicInstanceCall( } } - #define __ assembler()-> void FlowGraphCompiler::EmitTestAndCall(const CallTargets& targets, const String& function_name, @@ -1983,7 +1907,6 @@ void FlowGraphCompiler::FrameStateUpdateWith(Instruction* instr) { } } - void FlowGraphCompiler::FrameStatePush(Definition* defn) { Representation rep = defn->representation(); if ((rep == kUnboxedDouble) || (rep == kUnboxedFloat64x2) || @@ -2001,14 +1924,12 @@ void FlowGraphCompiler::FrameStatePush(Definition* defn) { frame_state_.Add(rep); } - void FlowGraphCompiler::FrameStatePop(intptr_t count) { ASSERT(!is_optimizing()); frame_state_.TruncateTo( Utils::Maximum(static_cast(0), frame_state_.length() - count)); } - bool FlowGraphCompiler::FrameStateIsSafeToCall() { ASSERT(!is_optimizing()); for (intptr_t i = 0; i < frame_state_.length(); i++) { @@ -2019,12 +1940,10 @@ bool FlowGraphCompiler::FrameStateIsSafeToCall() { return true; } - void FlowGraphCompiler::FrameStateClear() { ASSERT(!is_optimizing()); frame_state_.TruncateTo(0); } #endif // defined(DEBUG) && !defined(TARGET_ARCH_DBC) - } // namespace dart diff --git a/runtime/vm/flow_graph_compiler.h b/runtime/vm/flow_graph_compiler.h index 0a7949af78c..08fd3062d31 100644 --- a/runtime/vm/flow_graph_compiler.h +++ b/runtime/vm/flow_graph_compiler.h @@ -23,7 +23,6 @@ template class GrowableArray; class ParsedFunction; - class ParallelMoveResolver : public ValueObject { public: explicit ParallelMoveResolver(FlowGraphCompiler* compiler); @@ -59,7 +58,6 @@ class ParallelMoveResolver : public ValueObject { bool spilled_; }; - bool IsScratchLocation(Location loc); intptr_t AllocateScratchRegister(Location::Kind kind, uword blocked_mask, @@ -109,7 +107,6 @@ class ParallelMoveResolver : public ValueObject { GrowableArray moves_; }; - // Used for describing a deoptimization point after call (lazy deoptimization). // For deoptimization before instruction use class CompilerDeoptInfoWithStub. class CompilerDeoptInfo : public ZoneAllocated { @@ -134,7 +131,6 @@ class CompilerDeoptInfo : public ZoneAllocated { DeoptInfoBuilder* builder, const Array& deopt_table); - // No code needs to be generated. virtual void GenerateCode(FlowGraphCompiler* compiler, intptr_t stub_ix) {} @@ -176,7 +172,6 @@ class CompilerDeoptInfo : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(CompilerDeoptInfo); }; - class CompilerDeoptInfoWithStub : public CompilerDeoptInfo { public: CompilerDeoptInfoWithStub(intptr_t deopt_id, @@ -209,7 +204,6 @@ class CompilerDeoptInfoWithStub : public CompilerDeoptInfo { DISALLOW_COPY_AND_ASSIGN(CompilerDeoptInfoWithStub); }; - class SlowPathCode : public ZoneAllocated { public: SlowPathCode() : entry_label_(), exit_label_() {} @@ -232,7 +226,6 @@ class SlowPathCode : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(SlowPathCode); }; - class FlowGraphCompiler : public ValueObject { private: class BlockInfo : public ZoneAllocated { diff --git a/runtime/vm/flow_graph_compiler_arm.cc b/runtime/vm/flow_graph_compiler_arm.cc index 37b2e1f6440..bfc04a3d5fc 100644 --- a/runtime/vm/flow_graph_compiler_arm.cc +++ b/runtime/vm/flow_graph_compiler_arm.cc @@ -28,7 +28,6 @@ DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); DEFINE_FLAG(bool, unbox_doubles, true, "Optimize double arithmetic."); DECLARE_FLAG(bool, enable_simd_inline); - FlowGraphCompiler::~FlowGraphCompiler() { // BlockInfos are zone-allocated, so their destructors are not called. // Verify the labels explicitly here. @@ -37,47 +36,39 @@ FlowGraphCompiler::~FlowGraphCompiler() { } } - bool FlowGraphCompiler::SupportsUnboxedDoubles() { return TargetCPUFeatures::vfp_supported() && FLAG_unbox_doubles; } - bool FlowGraphCompiler::SupportsUnboxedMints() { return FLAG_unbox_mints; } - bool FlowGraphCompiler::SupportsUnboxedSimd128() { return TargetCPUFeatures::neon_supported() && FLAG_enable_simd_inline; } - bool FlowGraphCompiler::SupportsHardwareDivision() { return TargetCPUFeatures::can_divide(); } - bool FlowGraphCompiler::CanConvertUnboxedMintToDouble() { // ARM does not have a short instruction sequence for converting int64 to // double. return false; } - void FlowGraphCompiler::EnterIntrinsicMode() { ASSERT(!intrinsic_mode()); intrinsic_mode_ = true; ASSERT(!assembler()->constant_pool_allowed()); } - void FlowGraphCompiler::ExitIntrinsicMode() { ASSERT(intrinsic_mode()); intrinsic_mode_ = false; } - RawTypedData* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler, DeoptInfoBuilder* builder, const Array& deopt_table) { @@ -164,7 +155,6 @@ RawTypedData* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler, return builder->CreateDeoptInfo(deopt_table); } - void CompilerDeoptInfoWithStub::GenerateCode(FlowGraphCompiler* compiler, intptr_t stub_ix) { // Calls do not need stubs, they share a deoptimization trampoline. @@ -189,10 +179,8 @@ void CompilerDeoptInfoWithStub::GenerateCode(FlowGraphCompiler* compiler, #undef __ } - #define __ assembler()-> - // Fall through if bool_register contains null. void FlowGraphCompiler::GenerateBoolToJump(Register bool_register, Label* is_true, @@ -206,7 +194,6 @@ void FlowGraphCompiler::GenerateBoolToJump(Register bool_register, __ Bind(&fall_through); } - // R0: instance (must be preserved). // R2: instantiator type arguments (if used). // R1: function type arguments (if used). @@ -244,7 +231,6 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateCallSubtypeTestStub( return type_test_cache.raw(); } - // Jumps to labels 'is_instance' or 'is_not_instance' respectively, if // type test is conclusive, otherwise fallthrough if a type test could not // be completed. @@ -323,7 +309,6 @@ FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest( is_instance_lbl, is_not_instance_lbl); } - void FlowGraphCompiler::CheckClassIds(Register class_id_reg, const GrowableArray& class_ids, Label* is_equal_lbl, @@ -335,7 +320,6 @@ void FlowGraphCompiler::CheckClassIds(Register class_id_reg, __ b(is_not_equal_lbl); } - // Testing against an instantiated type with no arguments, without // SubtypeTestCache. // R0: instance being type checked (preserved). @@ -403,7 +387,6 @@ bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest( return true; } - // Uses SubtypeTestCache to store instance class and result. // R0: instance to test. // Clobbers R1-R4, R8, R9. @@ -435,7 +418,6 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateSubtype1TestCacheLookup( is_instance_lbl, is_not_instance_lbl); } - // Generates inlined check if 'type' is a type parameter or type itself // R0: instance (preserved). RawSubtypeTestCache* FlowGraphCompiler::GenerateUninstantiatedTypeTest( @@ -450,8 +432,9 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateUninstantiatedTypeTest( const TypeParameter& type_param = TypeParameter::Cast(type); const Register kInstantiatorTypeArgumentsReg = R2; const Register kFunctionTypeArgumentsReg = R1; - __ ldm(IA, SP, (1 << kFunctionTypeArgumentsReg) | - (1 << kInstantiatorTypeArgumentsReg)); + __ ldm(IA, SP, + (1 << kFunctionTypeArgumentsReg) | + (1 << kInstantiatorTypeArgumentsReg)); // R2: instantiator type arguments. // R1: function type arguments. const Register kTypeArgumentsReg = @@ -501,8 +484,9 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateUninstantiatedTypeTest( const Register kFunctionTypeArgumentsReg = R1; __ tst(kInstanceReg, Operand(kSmiTagMask)); // Is instance Smi? __ b(is_not_instance_lbl, EQ); - __ ldm(IA, SP, (1 << kFunctionTypeArgumentsReg) | - (1 << kInstantiatorTypeArgumentsReg)); + __ ldm(IA, SP, + (1 << kFunctionTypeArgumentsReg) | + (1 << kInstantiatorTypeArgumentsReg)); // Uninstantiated type class is known at compile time, but the type // arguments are determined at runtime by the instantiator(s). const Register kTempReg = kNoRegister; @@ -514,7 +498,6 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateUninstantiatedTypeTest( return SubtypeTestCache::null(); } - // Inputs: // - R0: instance being type checked (preserved). // - R2: optional instantiator type arguments (preserved). @@ -557,7 +540,6 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof( is_not_instance_lbl); } - // If instanceof type test cannot be performed successfully at compile time and // therefore eliminated, optimize it by adding inlined tests for: // - NULL -> return type == Null (type is not Object or dynamic). @@ -603,8 +585,9 @@ void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos, Label done; if (!test_cache.IsNull()) { // Generate runtime call. - __ ldm(IA, SP, (1 << kFunctionTypeArgumentsReg) | - (1 << kInstantiatorTypeArgumentsReg)); + __ ldm(IA, SP, + (1 << kFunctionTypeArgumentsReg) | + (1 << kInstantiatorTypeArgumentsReg)); __ PushObject(Object::null_object()); // Make room for the result. __ Push(R0); // Push the instance. __ PushObject(type); // Push the type. @@ -630,7 +613,6 @@ void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos, __ Drop(2); } - // Optimize assignable type check by adding inlined tests for: // - NULL -> return NULL. // - Smi -> compile time subtype check (only if dst class is not parameterized). @@ -687,8 +669,9 @@ void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos, &runtime_call); __ Bind(&runtime_call); - __ ldm(IA, SP, (1 << kFunctionTypeArgumentsReg) | - (1 << kInstantiatorTypeArgumentsReg)); + __ ldm( + IA, SP, + (1 << kFunctionTypeArgumentsReg) | (1 << kInstantiatorTypeArgumentsReg)); __ PushObject(Object::null_object()); // Make room for the result. __ Push(R0); // Push the source object. __ PushObject(dst_type); // Push the type of the destination. @@ -708,7 +691,6 @@ void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos, (1 << kInstantiatorTypeArgumentsReg)); } - void FlowGraphCompiler::EmitInstructionEpilogue(Instruction* instr) { if (is_optimizing()) { return; @@ -719,7 +701,6 @@ void FlowGraphCompiler::EmitInstructionEpilogue(Instruction* instr) { } } - // Input parameters: // R4: arguments descriptor array. void FlowGraphCompiler::CopyParameters() { @@ -812,8 +793,9 @@ void FlowGraphCompiler::CopyParameters() { __ add(NOTFP, FP, Operand(NOTFP, LSL, 1)); __ AddImmediate(NOTFP, NOTFP, kParamEndSlotFromFp * kWordSize); // Let R8 point to the entry of the first named argument. - __ add(R8, R4, Operand(ArgumentsDescriptor::first_named_entry_offset() - - kHeapObjectTag)); + __ add(R8, R4, + Operand(ArgumentsDescriptor::first_named_entry_offset() - + kHeapObjectTag)); for (int i = 0; i < num_opt_named_params; i++) { Label load_default_value, assign_optional_parameter; const int param_pos = opt_param_position[i]; @@ -921,7 +903,6 @@ void FlowGraphCompiler::CopyParameters() { __ b(&null_args_loop, PL); } - void FlowGraphCompiler::GenerateInlinedGetter(intptr_t offset) { // LR: return address. // SP: receiver. @@ -932,7 +913,6 @@ void FlowGraphCompiler::GenerateInlinedGetter(intptr_t offset) { __ Ret(); } - void FlowGraphCompiler::GenerateInlinedSetter(intptr_t offset) { // LR: return address. // SP+1: receiver. @@ -946,10 +926,8 @@ void FlowGraphCompiler::GenerateInlinedSetter(intptr_t offset) { __ Ret(); } - static const Register new_pp = NOTFP; - void FlowGraphCompiler::EmitFrameEntry() { const Function& function = parsed_function().function(); if (CanOptimizeFunction() && function.IsOptimizable() && @@ -985,7 +963,6 @@ void FlowGraphCompiler::EmitFrameEntry() { } } - // Input parameters: // LR: return address. // SP: address of last argument. @@ -1120,7 +1097,6 @@ void FlowGraphCompiler::CompileGraph() { GenerateDeferredCode(); } - void FlowGraphCompiler::GenerateCall(TokenPosition token_pos, const StubEntry& stub_entry, RawPcDescriptors::Kind kind, @@ -1129,7 +1105,6 @@ void FlowGraphCompiler::GenerateCall(TokenPosition token_pos, EmitCallsiteMetaData(token_pos, Thread::kNoDeoptId, kind, locs); } - void FlowGraphCompiler::GeneratePatchableCall(TokenPosition token_pos, const StubEntry& stub_entry, RawPcDescriptors::Kind kind, @@ -1138,7 +1113,6 @@ void FlowGraphCompiler::GeneratePatchableCall(TokenPosition token_pos, EmitCallsiteMetaData(token_pos, Thread::kNoDeoptId, kind, locs); } - void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, TokenPosition token_pos, const StubEntry& stub_entry, @@ -1158,7 +1132,6 @@ void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, } } - void FlowGraphCompiler::GenerateStaticDartCall(intptr_t deopt_id, TokenPosition token_pos, const StubEntry& stub_entry, @@ -1185,7 +1158,6 @@ void FlowGraphCompiler::GenerateStaticDartCall(intptr_t deopt_id, AddStaticCallTarget(target); } - void FlowGraphCompiler::GenerateRuntimeCall(TokenPosition token_pos, intptr_t deopt_id, const RuntimeEntry& entry, @@ -1207,7 +1179,6 @@ void FlowGraphCompiler::GenerateRuntimeCall(TokenPosition token_pos, } } - void FlowGraphCompiler::EmitEdgeCounter(intptr_t edge_id) { // We do not check for overflow when incrementing the edge counter. The // function should normally be optimized long before the counter can @@ -1230,7 +1201,6 @@ void FlowGraphCompiler::EmitEdgeCounter(intptr_t edge_id) { #endif // DEBUG } - void FlowGraphCompiler::EmitOptimizedInstanceCall(const StubEntry& stub_entry, const ICData& ic_data, intptr_t argument_count, @@ -1252,7 +1222,6 @@ void FlowGraphCompiler::EmitOptimizedInstanceCall(const StubEntry& stub_entry, __ Drop(argument_count); } - void FlowGraphCompiler::EmitInstanceCall(const StubEntry& stub_entry, const ICData& ic_data, intptr_t argument_count, @@ -1266,7 +1235,6 @@ void FlowGraphCompiler::EmitInstanceCall(const StubEntry& stub_entry, __ Drop(argument_count); } - void FlowGraphCompiler::EmitMegamorphicInstanceCall( const String& name, const Array& arguments_descriptor, @@ -1313,7 +1281,6 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall( __ Drop(argument_count); } - void FlowGraphCompiler::EmitSwitchableInstanceCall(const ICData& ic_data, intptr_t argument_count, intptr_t deopt_id, @@ -1344,7 +1311,6 @@ void FlowGraphCompiler::EmitSwitchableInstanceCall(const ICData& ic_data, __ Drop(argument_count); } - void FlowGraphCompiler::EmitUnoptimizedStaticCall(intptr_t argument_count, intptr_t deopt_id, TokenPosition token_pos, @@ -1358,7 +1324,6 @@ void FlowGraphCompiler::EmitUnoptimizedStaticCall(intptr_t argument_count, __ Drop(argument_count); } - void FlowGraphCompiler::EmitOptimizedStaticCall( const Function& function, const Array& arguments_descriptor, @@ -1381,7 +1346,6 @@ void FlowGraphCompiler::EmitOptimizedStaticCall( __ Drop(argument_count); } - Condition FlowGraphCompiler::EmitEqualityRegConstCompare( Register reg, const Object& obj, @@ -1409,7 +1373,6 @@ Condition FlowGraphCompiler::EmitEqualityRegConstCompare( return EQ; } - Condition FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, Register right, bool needs_number_check, @@ -1435,7 +1398,6 @@ Condition FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, return EQ; } - // This function must be in sync with FlowGraphCompiler::RecordSafepoint and // FlowGraphCompiler::SlowPathEnvironmentFor. void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { @@ -1479,7 +1441,6 @@ void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { } } - void FlowGraphCompiler::RestoreLiveRegisters(LocationSummary* locs) { RegList reg_list = 0; for (intptr_t i = kNumberOfCpuRegisters - 1; i >= 0; --i) { @@ -1509,7 +1470,6 @@ void FlowGraphCompiler::RestoreLiveRegisters(LocationSummary* locs) { } } - #if defined(DEBUG) void FlowGraphCompiler::ClobberDeadTempRegisters(LocationSummary* locs) { // Clobber temporaries that have not been manually preserved. @@ -1524,7 +1484,6 @@ void FlowGraphCompiler::ClobberDeadTempRegisters(LocationSummary* locs) { } #endif - void FlowGraphCompiler::EmitTestAndCallLoadReceiver( intptr_t argument_count, const Array& arguments_descriptor) { @@ -1534,19 +1493,16 @@ void FlowGraphCompiler::EmitTestAndCallLoadReceiver( __ LoadObject(R4, arguments_descriptor); } - void FlowGraphCompiler::EmitTestAndCallSmiBranch(Label* label, bool if_smi) { __ tst(R0, Operand(kSmiTagMask)); // Jump if receiver is not Smi. __ b(label, if_smi ? EQ : NE); } - void FlowGraphCompiler::EmitTestAndCallLoadCid() { __ LoadClassId(R2, R0); } - int FlowGraphCompiler::EmitTestAndCallCheckCid(Label* next_label, const CidRange& range, int bias) { @@ -1563,11 +1519,9 @@ int FlowGraphCompiler::EmitTestAndCallCheckCid(Label* next_label, return bias; } - #undef __ #define __ compiler_->assembler()-> - void ParallelMoveResolver::EmitMove(int index) { MoveOperands* move = moves_[index]; const Location source = move->src(); @@ -1688,7 +1642,6 @@ void ParallelMoveResolver::EmitMove(int index) { move->Eliminate(); } - void ParallelMoveResolver::EmitSwap(int index) { MoveOperands* move = moves_[index]; const Location source = move->src(); @@ -1787,32 +1740,27 @@ void ParallelMoveResolver::EmitSwap(int index) { } } - void ParallelMoveResolver::MoveMemoryToMemory(const Address& dst, const Address& src) { UNREACHABLE(); } - void ParallelMoveResolver::StoreObject(const Address& dst, const Object& obj) { UNREACHABLE(); } - // Do not call or implement this function. Instead, use the form below that // uses an offset from the frame pointer instead of an Address. void ParallelMoveResolver::Exchange(Register reg, const Address& mem) { UNREACHABLE(); } - // Do not call or implement this function. Instead, use the form below that // uses offsets from the frame pointer instead of Addresses. void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { UNREACHABLE(); } - void ParallelMoveResolver::Exchange(Register reg, Register base_reg, intptr_t stack_offset) { @@ -1822,7 +1770,6 @@ void ParallelMoveResolver::Exchange(Register reg, __ StoreToOffset(kWord, tmp.reg(), base_reg, stack_offset); } - void ParallelMoveResolver::Exchange(Register base_reg1, intptr_t stack_offset1, Register base_reg2, @@ -1835,29 +1782,24 @@ void ParallelMoveResolver::Exchange(Register base_reg1, __ StoreToOffset(kWord, tmp2.reg(), base_reg1, stack_offset1); } - void ParallelMoveResolver::SpillScratch(Register reg) { __ Push(reg); } - void ParallelMoveResolver::RestoreScratch(Register reg) { __ Pop(reg); } - void ParallelMoveResolver::SpillFpuScratch(FpuRegister reg) { DRegister dreg = EvenDRegisterOf(reg); __ vstrd(dreg, Address(SP, -kDoubleSize, Address::PreIndex)); } - void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { DRegister dreg = EvenDRegisterOf(reg); __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); } - #undef __ } // namespace dart diff --git a/runtime/vm/flow_graph_compiler_arm64.cc b/runtime/vm/flow_graph_compiler_arm64.cc index b5cbad9544a..40b461bd2f6 100644 --- a/runtime/vm/flow_graph_compiler_arm64.cc +++ b/runtime/vm/flow_graph_compiler_arm64.cc @@ -26,7 +26,6 @@ namespace dart { DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); DECLARE_FLAG(bool, enable_simd_inline); - FlowGraphCompiler::~FlowGraphCompiler() { // BlockInfos are zone-allocated, so their destructors are not called. // Verify the labels explicitly here. @@ -35,47 +34,39 @@ FlowGraphCompiler::~FlowGraphCompiler() { } } - bool FlowGraphCompiler::SupportsUnboxedDoubles() { return true; } - bool FlowGraphCompiler::SupportsUnboxedMints() { return false; } - bool FlowGraphCompiler::SupportsUnboxedSimd128() { return FLAG_enable_simd_inline; } - bool FlowGraphCompiler::CanConvertUnboxedMintToDouble() { // ARM does not have a short instruction sequence for converting int64 to // double. return false; } - bool FlowGraphCompiler::SupportsHardwareDivision() { return true; } - void FlowGraphCompiler::EnterIntrinsicMode() { ASSERT(!intrinsic_mode()); intrinsic_mode_ = true; ASSERT(!assembler()->constant_pool_allowed()); } - void FlowGraphCompiler::ExitIntrinsicMode() { ASSERT(intrinsic_mode()); intrinsic_mode_ = false; } - RawTypedData* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler, DeoptInfoBuilder* builder, const Array& deopt_table) { @@ -162,7 +153,6 @@ RawTypedData* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler, return builder->CreateDeoptInfo(deopt_table); } - void CompilerDeoptInfoWithStub::GenerateCode(FlowGraphCompiler* compiler, intptr_t stub_ix) { // Calls do not need stubs, they share a deoptimization trampoline. @@ -182,10 +172,8 @@ void CompilerDeoptInfoWithStub::GenerateCode(FlowGraphCompiler* compiler, #undef __ } - #define __ assembler()-> - // Fall through if bool_register contains null. void FlowGraphCompiler::GenerateBoolToJump(Register bool_register, Label* is_true, @@ -199,7 +187,6 @@ void FlowGraphCompiler::GenerateBoolToJump(Register bool_register, __ Bind(&fall_through); } - // R0: instance (must be preserved). // R1: instantiator type arguments (if used). // R2: function type arguments (if used). @@ -236,7 +223,6 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateCallSubtypeTestStub( return type_test_cache.raw(); } - // Jumps to labels 'is_instance' or 'is_not_instance' respectively, if // type test is conclusive, otherwise fallthrough if a type test could not // be completed. @@ -315,7 +301,6 @@ FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest( is_instance_lbl, is_not_instance_lbl); } - void FlowGraphCompiler::CheckClassIds(Register class_id_reg, const GrowableArray& class_ids, Label* is_equal_lbl, @@ -327,7 +312,6 @@ void FlowGraphCompiler::CheckClassIds(Register class_id_reg, __ b(is_not_equal_lbl); } - // Testing against an instantiated type with no arguments, without // SubtypeTestCache. // R0: instance being type checked (preserved). @@ -395,7 +379,6 @@ bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest( return true; } - // Uses SubtypeTestCache to store instance class and result. // R0: instance to test. // Clobbers R1-R5. @@ -427,7 +410,6 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateSubtype1TestCacheLookup( is_instance_lbl, is_not_instance_lbl); } - // Generates inlined check if 'type' is a type parameter or type itself // R0: instance (preserved). RawSubtypeTestCache* FlowGraphCompiler::GenerateUninstantiatedTypeTest( @@ -506,7 +488,6 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateUninstantiatedTypeTest( return SubtypeTestCache::null(); } - // Inputs: // - R0: instance being type checked (preserved). // - R1: optional instantiator type arguments (preserved). @@ -549,7 +530,6 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof( is_not_instance_lbl); } - // If instanceof type test cannot be performed successfully at compile time and // therefore eliminated, optimize it by adding inlined tests for: // - NULL -> return type == Null (type is not Object or dynamic). @@ -622,7 +602,6 @@ void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos, __ Drop(2); } - // Optimize assignable type check by adding inlined tests for: // - NULL -> return NULL. // - Smi -> compile time subtype check (only if dst class is not parameterized). @@ -696,7 +675,6 @@ void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos, __ PopPair(kFunctionTypeArgumentsReg, kInstantiatorTypeArgumentsReg); } - void FlowGraphCompiler::EmitInstructionEpilogue(Instruction* instr) { if (is_optimizing()) { return; @@ -707,7 +685,6 @@ void FlowGraphCompiler::EmitInstructionEpilogue(Instruction* instr) { } } - // Input parameters: // R4: arguments descriptor array. void FlowGraphCompiler::CopyParameters() { @@ -801,8 +778,9 @@ void FlowGraphCompiler::CopyParameters() { __ add(R7, FP, Operand(R7, LSL, 2)); __ AddImmediate(R7, kParamEndSlotFromFp * kWordSize); // Let R6 point to the entry of the first named argument. - __ add(R6, R4, Operand(ArgumentsDescriptor::first_named_entry_offset() - - kHeapObjectTag)); + __ add(R6, R4, + Operand(ArgumentsDescriptor::first_named_entry_offset() - + kHeapObjectTag)); for (int i = 0; i < num_opt_named_params; i++) { Label load_default_value, assign_optional_parameter; const int param_pos = opt_param_position[i]; @@ -909,7 +887,6 @@ void FlowGraphCompiler::CopyParameters() { __ b(&null_args_loop, PL); } - void FlowGraphCompiler::GenerateInlinedGetter(intptr_t offset) { // LR: return address. // SP: receiver. @@ -920,7 +897,6 @@ void FlowGraphCompiler::GenerateInlinedGetter(intptr_t offset) { __ ret(); } - void FlowGraphCompiler::GenerateInlinedSetter(intptr_t offset) { // LR: return address. // SP+1: receiver. @@ -934,7 +910,6 @@ void FlowGraphCompiler::GenerateInlinedSetter(intptr_t offset) { __ ret(); } - void FlowGraphCompiler::EmitFrameEntry() { const Function& function = parsed_function().function(); Register new_pp = kNoRegister; @@ -978,7 +953,6 @@ void FlowGraphCompiler::EmitFrameEntry() { } } - // Input parameters: // LR: return address. // SP: address of last argument. @@ -1112,7 +1086,6 @@ void FlowGraphCompiler::CompileGraph() { GenerateDeferredCode(); } - void FlowGraphCompiler::GenerateCall(TokenPosition token_pos, const StubEntry& stub_entry, RawPcDescriptors::Kind kind, @@ -1121,7 +1094,6 @@ void FlowGraphCompiler::GenerateCall(TokenPosition token_pos, EmitCallsiteMetaData(token_pos, Thread::kNoDeoptId, kind, locs); } - void FlowGraphCompiler::GeneratePatchableCall(TokenPosition token_pos, const StubEntry& stub_entry, RawPcDescriptors::Kind kind, @@ -1130,7 +1102,6 @@ void FlowGraphCompiler::GeneratePatchableCall(TokenPosition token_pos, EmitCallsiteMetaData(token_pos, Thread::kNoDeoptId, kind, locs); } - void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, TokenPosition token_pos, const StubEntry& stub_entry, @@ -1150,7 +1121,6 @@ void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, } } - void FlowGraphCompiler::GenerateStaticDartCall(intptr_t deopt_id, TokenPosition token_pos, const StubEntry& stub_entry, @@ -1177,7 +1147,6 @@ void FlowGraphCompiler::GenerateStaticDartCall(intptr_t deopt_id, AddStaticCallTarget(target); } - void FlowGraphCompiler::GenerateRuntimeCall(TokenPosition token_pos, intptr_t deopt_id, const RuntimeEntry& entry, @@ -1199,7 +1168,6 @@ void FlowGraphCompiler::GenerateRuntimeCall(TokenPosition token_pos, } } - void FlowGraphCompiler::EmitEdgeCounter(intptr_t edge_id) { // We do not check for overflow when incrementing the edge counter. The // function should normally be optimized long before the counter can @@ -1215,7 +1183,6 @@ void FlowGraphCompiler::EmitEdgeCounter(intptr_t edge_id) { __ StoreFieldToOffset(TMP, R0, Array::element_offset(edge_id)); } - void FlowGraphCompiler::EmitOptimizedInstanceCall(const StubEntry& stub_entry, const ICData& ic_data, intptr_t argument_count, @@ -1237,7 +1204,6 @@ void FlowGraphCompiler::EmitOptimizedInstanceCall(const StubEntry& stub_entry, __ Drop(argument_count); } - void FlowGraphCompiler::EmitInstanceCall(const StubEntry& stub_entry, const ICData& ic_data, intptr_t argument_count, @@ -1251,7 +1217,6 @@ void FlowGraphCompiler::EmitInstanceCall(const StubEntry& stub_entry, __ Drop(argument_count); } - void FlowGraphCompiler::EmitMegamorphicInstanceCall( const String& name, const Array& arguments_descriptor, @@ -1299,7 +1264,6 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall( __ Drop(argument_count); } - void FlowGraphCompiler::EmitSwitchableInstanceCall(const ICData& ic_data, intptr_t argument_count, intptr_t deopt_id, @@ -1329,7 +1293,6 @@ void FlowGraphCompiler::EmitSwitchableInstanceCall(const ICData& ic_data, __ Drop(argument_count); } - void FlowGraphCompiler::EmitUnoptimizedStaticCall(intptr_t argument_count, intptr_t deopt_id, TokenPosition token_pos, @@ -1343,7 +1306,6 @@ void FlowGraphCompiler::EmitUnoptimizedStaticCall(intptr_t argument_count, __ Drop(argument_count); } - void FlowGraphCompiler::EmitOptimizedStaticCall( const Function& function, const Array& arguments_descriptor, @@ -1366,7 +1328,6 @@ void FlowGraphCompiler::EmitOptimizedStaticCall( __ Drop(argument_count); } - Condition FlowGraphCompiler::EmitEqualityRegConstCompare( Register reg, const Object& obj, @@ -1394,7 +1355,6 @@ Condition FlowGraphCompiler::EmitEqualityRegConstCompare( return EQ; } - Condition FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, Register right, bool needs_number_check, @@ -1420,7 +1380,6 @@ Condition FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, return EQ; } - // This function must be in sync with FlowGraphCompiler::RecordSafepoint and // FlowGraphCompiler::SlowPathEnvironmentFor. void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { @@ -1452,7 +1411,6 @@ void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { } } - void FlowGraphCompiler::RestoreLiveRegisters(LocationSummary* locs) { for (intptr_t i = 0; i < kNumberOfCpuRegisters; ++i) { Register reg = static_cast(i); @@ -1473,7 +1431,6 @@ void FlowGraphCompiler::RestoreLiveRegisters(LocationSummary* locs) { } } - #if defined(DEBUG) void FlowGraphCompiler::ClobberDeadTempRegisters(LocationSummary* locs) { // Clobber temporaries that have not been manually preserved. @@ -1488,7 +1445,6 @@ void FlowGraphCompiler::ClobberDeadTempRegisters(LocationSummary* locs) { } #endif - void FlowGraphCompiler::EmitTestAndCallLoadReceiver( intptr_t argument_count, const Array& arguments_descriptor) { @@ -1498,19 +1454,16 @@ void FlowGraphCompiler::EmitTestAndCallLoadReceiver( __ LoadObject(R4, arguments_descriptor); } - void FlowGraphCompiler::EmitTestAndCallSmiBranch(Label* label, bool if_smi) { __ tsti(R0, Immediate(kSmiTagMask)); // Jump if receiver is not Smi. __ b(label, if_smi ? EQ : NE); } - void FlowGraphCompiler::EmitTestAndCallLoadCid() { __ LoadClassId(R2, R0); } - int FlowGraphCompiler::EmitTestAndCallCheckCid(Label* next_label, const CidRange& range, int bias) { @@ -1527,11 +1480,9 @@ int FlowGraphCompiler::EmitTestAndCallCheckCid(Label* next_label, return bias; } - #undef __ #define __ compiler_->assembler()-> - void ParallelMoveResolver::EmitMove(int index) { MoveOperands* move = moves_[index]; const Location source = move->src(); @@ -1644,7 +1595,6 @@ void ParallelMoveResolver::EmitMove(int index) { move->Eliminate(); } - void ParallelMoveResolver::EmitSwap(int index) { MoveOperands* move = moves_[index]; const Location source = move->src(); @@ -1733,32 +1683,27 @@ void ParallelMoveResolver::EmitSwap(int index) { } } - void ParallelMoveResolver::MoveMemoryToMemory(const Address& dst, const Address& src) { UNREACHABLE(); } - void ParallelMoveResolver::StoreObject(const Address& dst, const Object& obj) { UNREACHABLE(); } - // Do not call or implement this function. Instead, use the form below that // uses an offset from the frame pointer instead of an Address. void ParallelMoveResolver::Exchange(Register reg, const Address& mem) { UNREACHABLE(); } - // Do not call or implement this function. Instead, use the form below that // uses offsets from the frame pointer instead of Addresses. void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { UNREACHABLE(); } - void ParallelMoveResolver::Exchange(Register reg, Register base_reg, intptr_t stack_offset) { @@ -1768,7 +1713,6 @@ void ParallelMoveResolver::Exchange(Register reg, __ StoreToOffset(tmp.reg(), base_reg, stack_offset); } - void ParallelMoveResolver::Exchange(Register base_reg1, intptr_t stack_offset1, Register base_reg2, @@ -1781,27 +1725,22 @@ void ParallelMoveResolver::Exchange(Register base_reg1, __ StoreToOffset(tmp2.reg(), base_reg1, stack_offset1); } - void ParallelMoveResolver::SpillScratch(Register reg) { __ Push(reg); } - void ParallelMoveResolver::RestoreScratch(Register reg) { __ Pop(reg); } - void ParallelMoveResolver::SpillFpuScratch(FpuRegister reg) { __ PushDouble(reg); } - void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { __ PopDouble(reg); } - #undef __ } // namespace dart diff --git a/runtime/vm/flow_graph_compiler_dbc.cc b/runtime/vm/flow_graph_compiler_dbc.cc index 992c94ce275..63da152dbbc 100644 --- a/runtime/vm/flow_graph_compiler_dbc.cc +++ b/runtime/vm/flow_graph_compiler_dbc.cc @@ -37,7 +37,6 @@ FlowGraphCompiler::~FlowGraphCompiler() { } } - bool FlowGraphCompiler::SupportsUnboxedDoubles() { #if defined(ARCH_IS_64_BIT) return true; @@ -47,39 +46,32 @@ bool FlowGraphCompiler::SupportsUnboxedDoubles() { #endif } - bool FlowGraphCompiler::SupportsUnboxedMints() { return false; } - bool FlowGraphCompiler::SupportsUnboxedSimd128() { return false; } - bool FlowGraphCompiler::SupportsHardwareDivision() { return true; } - bool FlowGraphCompiler::CanConvertUnboxedMintToDouble() { return false; } - void FlowGraphCompiler::EnterIntrinsicMode() { ASSERT(!intrinsic_mode()); intrinsic_mode_ = true; } - void FlowGraphCompiler::ExitIntrinsicMode() { ASSERT(intrinsic_mode()); intrinsic_mode_ = false; } - RawTypedData* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler, DeoptInfoBuilder* builder, const Array& deopt_table) { @@ -166,7 +158,6 @@ RawTypedData* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler, builder->AddPcMarker(previous->function(), slot_ix++); builder->AddConstant(previous->function(), slot_ix++); - // For the outermost environment, set the incoming arguments. for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { builder->AddCopy(previous->ValueAt(i), previous->LocationAt(i), slot_ix++); @@ -175,7 +166,6 @@ RawTypedData* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler, return builder->CreateDeoptInfo(deopt_table); } - void FlowGraphCompiler::RecordAfterCallHelper(TokenPosition token_pos, intptr_t deopt_id, intptr_t argument_count, @@ -204,22 +194,18 @@ void FlowGraphCompiler::RecordAfterCallHelper(TokenPosition token_pos, } } - void FlowGraphCompiler::RecordAfterCall(Instruction* instr, CallResult result) { RecordAfterCallHelper(instr->token_pos(), instr->deopt_id(), instr->ArgumentCount(), result, instr->locs()); } - void CompilerDeoptInfoWithStub::GenerateCode(FlowGraphCompiler* compiler, intptr_t stub_ix) { UNREACHABLE(); } - #define __ assembler()-> - void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos, intptr_t deopt_id, const AbstractType& dst_type, @@ -279,7 +265,6 @@ void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos, } } - void FlowGraphCompiler::EmitInstructionEpilogue(Instruction* instr) { if (!is_optimizing()) { Definition* defn = instr->AsDefinition(); @@ -294,7 +279,6 @@ void FlowGraphCompiler::EmitInstructionEpilogue(Instruction* instr) { } } - void FlowGraphCompiler::GenerateInlinedGetter(intptr_t offset) { __ Move(0, -(1 + kParamEndSlotFromFp)); ASSERT(offset % kWordSize == 0); @@ -307,7 +291,6 @@ void FlowGraphCompiler::GenerateInlinedGetter(intptr_t offset) { __ Return(0); } - void FlowGraphCompiler::GenerateInlinedSetter(intptr_t offset) { __ Move(0, -(2 + kParamEndSlotFromFp)); __ Move(1, -(1 + kParamEndSlotFromFp)); @@ -322,7 +305,6 @@ void FlowGraphCompiler::GenerateInlinedSetter(intptr_t offset) { __ Return(0); } - void FlowGraphCompiler::EmitFrameEntry() { const Function& function = parsed_function().function(); const intptr_t num_fixed_params = function.num_fixed_parameters(); @@ -388,7 +370,6 @@ void FlowGraphCompiler::EmitFrameEntry() { } } - if (has_optional_params) { if (!is_optimizing()) { ASSERT(num_locals > 0); // There is always at least context_var. @@ -429,7 +410,6 @@ void FlowGraphCompiler::EmitFrameEntry() { } } - void FlowGraphCompiler::CompileGraph() { InitCompiler(); @@ -442,7 +422,6 @@ void FlowGraphCompiler::CompileGraph() { VisitBlocks(); } - uint16_t FlowGraphCompiler::ToEmbeddableCid(intptr_t cid, Instruction* instruction) { if (!Utils::IsUint(16, cid)) { @@ -452,7 +431,6 @@ uint16_t FlowGraphCompiler::ToEmbeddableCid(intptr_t cid, return static_cast(cid); } - intptr_t FlowGraphCompiler::CatchEntryRegForVariable(const LocalVariable& var) { ASSERT(is_optimizing()); ASSERT(var.index() <= 0); @@ -460,11 +438,9 @@ intptr_t FlowGraphCompiler::CatchEntryRegForVariable(const LocalVariable& var) { (flow_graph().num_non_copied_params() - var.index()); } - #undef __ #define __ compiler_->assembler()-> - void ParallelMoveResolver::EmitMove(int index) { MoveOperands* move = moves_[index]; const Location source = move->src(); @@ -497,7 +473,6 @@ void ParallelMoveResolver::EmitMove(int index) { move->Eliminate(); } - void ParallelMoveResolver::EmitSwap(int index) { MoveOperands* move = moves_[index]; const Location source = move->src(); @@ -522,39 +497,33 @@ void ParallelMoveResolver::EmitSwap(int index) { } } - void ParallelMoveResolver::MoveMemoryToMemory(const Address& dst, const Address& src) { UNREACHABLE(); } - void ParallelMoveResolver::StoreObject(const Address& dst, const Object& obj) { UNREACHABLE(); } - // Do not call or implement this function. Instead, use the form below that // uses an offset from the frame pointer instead of an Address. void ParallelMoveResolver::Exchange(Register reg, const Address& mem) { UNREACHABLE(); } - // Do not call or implement this function. Instead, use the form below that // uses offsets from the frame pointer instead of Addresses. void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { UNREACHABLE(); } - void ParallelMoveResolver::Exchange(Register reg, Register base_reg, intptr_t stack_offset) { UNIMPLEMENTED(); } - void ParallelMoveResolver::Exchange(Register base_reg1, intptr_t stack_offset1, Register base_reg2, @@ -562,27 +531,22 @@ void ParallelMoveResolver::Exchange(Register base_reg1, UNIMPLEMENTED(); } - void ParallelMoveResolver::SpillScratch(Register reg) { UNIMPLEMENTED(); } - void ParallelMoveResolver::RestoreScratch(Register reg) { UNIMPLEMENTED(); } - void ParallelMoveResolver::SpillFpuScratch(FpuRegister reg) { UNIMPLEMENTED(); } - void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { UNIMPLEMENTED(); } - #undef __ } // namespace dart diff --git a/runtime/vm/flow_graph_compiler_ia32.cc b/runtime/vm/flow_graph_compiler_ia32.cc index e6f13b0e22b..65331b3cf14 100644 --- a/runtime/vm/flow_graph_compiler_ia32.cc +++ b/runtime/vm/flow_graph_compiler_ia32.cc @@ -30,7 +30,6 @@ DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); DECLARE_FLAG(bool, enable_simd_inline); - FlowGraphCompiler::~FlowGraphCompiler() { // BlockInfos are zone-allocated, so their destructors are not called. // Verify the labels explicitly here. @@ -40,44 +39,36 @@ FlowGraphCompiler::~FlowGraphCompiler() { } } - bool FlowGraphCompiler::SupportsUnboxedDoubles() { return true; } - bool FlowGraphCompiler::SupportsUnboxedMints() { return FLAG_unbox_mints; } - bool FlowGraphCompiler::SupportsUnboxedSimd128() { return FLAG_enable_simd_inline; } - bool FlowGraphCompiler::SupportsHardwareDivision() { return true; } - bool FlowGraphCompiler::CanConvertUnboxedMintToDouble() { return true; } - void FlowGraphCompiler::EnterIntrinsicMode() { ASSERT(!intrinsic_mode()); intrinsic_mode_ = true; } - void FlowGraphCompiler::ExitIntrinsicMode() { ASSERT(intrinsic_mode()); intrinsic_mode_ = false; } - RawTypedData* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler, DeoptInfoBuilder* builder, const Array& deopt_table) { @@ -162,7 +153,6 @@ RawTypedData* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler, return builder->CreateDeoptInfo(deopt_table); } - void CompilerDeoptInfoWithStub::GenerateCode(FlowGraphCompiler* compiler, intptr_t stub_ix) { // Calls do not need stubs, they share a deoptimization trampoline. @@ -183,10 +173,8 @@ void CompilerDeoptInfoWithStub::GenerateCode(FlowGraphCompiler* compiler, #undef __ } - #define __ assembler()-> - // Fall through if bool_register contains null. void FlowGraphCompiler::GenerateBoolToJump(Register bool_register, Label* is_true, @@ -202,7 +190,6 @@ void FlowGraphCompiler::GenerateBoolToJump(Register bool_register, __ Bind(&fall_through); } - // Clobbers ECX. RawSubtypeTestCache* FlowGraphCompiler::GenerateCallSubtypeTestStub( TypeTestStubKind test_kind, @@ -248,7 +235,6 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateCallSubtypeTestStub( return type_test_cache.raw(); } - // Jumps to labels 'is_instance' or 'is_not_instance' respectively, if // type test is conclusive, otherwise fallthrough if a type test could not // be completed. @@ -326,7 +312,6 @@ FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest( is_instance_lbl, is_not_instance_lbl); } - void FlowGraphCompiler::CheckClassIds(Register class_id_reg, const GrowableArray& class_ids, Label* is_equal_lbl, @@ -338,7 +323,6 @@ void FlowGraphCompiler::CheckClassIds(Register class_id_reg, __ jmp(is_not_equal_lbl); } - // Testing against an instantiated type with no arguments, without // SubtypeTestCache. // EAX: instance to test against (preserved). @@ -406,7 +390,6 @@ bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest( return true; } - // Uses SubtypeTestCache to store instance class and result. // EAX: instance to test. // Clobbers EDI, ECX. @@ -438,7 +421,6 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateSubtype1TestCacheLookup( is_instance_lbl, is_not_instance_lbl); } - // Generates inlined check if 'type' is a type parameter or type itself // EAX: instance (preserved). // Clobbers EDX, EDI, ECX. @@ -520,7 +502,6 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateUninstantiatedTypeTest( return SubtypeTestCache::null(); } - // Inputs: // - EAX: instance to test against (preserved). // - EDX: optional instantiator type arguments (preserved). @@ -563,7 +544,6 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof( is_not_instance_lbl); } - // If instanceof type test cannot be performed successfully at compile time and // therefore eliminated, optimize it by adding inlined tests for: // - NULL -> return type == Null (type is not Object or dynamic). @@ -613,11 +593,11 @@ void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos, // Generate runtime call. __ movl(EDX, Address(ESP, 1 * kWordSize)); // Get instantiator type args. __ movl(ECX, Address(ESP, 0 * kWordSize)); // Get function type args. - __ PushObject(Object::null_object()); // Make room for the result. - __ pushl(EAX); // Push the instance. - __ PushObject(type); // Push the type. - __ pushl(EDX); // Instantiator type arguments. - __ pushl(ECX); // Function type arguments. + __ PushObject(Object::null_object()); // Make room for the result. + __ pushl(EAX); // Push the instance. + __ PushObject(type); // Push the type. + __ pushl(EDX); // Instantiator type arguments. + __ pushl(ECX); // Function type arguments. __ LoadObject(EAX, test_cache); __ pushl(EAX); GenerateRuntimeCall(token_pos, deopt_id, kInstanceofRuntimeEntry, 5, locs); @@ -638,7 +618,6 @@ void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos, __ popl(EDX); // Remove pushed instantiator type arguments. } - // Optimize assignable type check by adding inlined tests for: // - NULL -> return NULL. // - Smi -> compile time subtype check (only if dst class is not parameterized). @@ -697,12 +676,12 @@ void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos, __ Bind(&runtime_call); __ movl(EDX, Address(ESP, 1 * kWordSize)); // Get instantiator type args. __ movl(ECX, Address(ESP, 0 * kWordSize)); // Get function type args. - __ PushObject(Object::null_object()); // Make room for the result. - __ pushl(EAX); // Push the source object. - __ PushObject(dst_type); // Push the type of the destination. - __ pushl(EDX); // Instantiator type arguments. - __ pushl(ECX); // Function type arguments. - __ PushObject(dst_name); // Push the name of the destination. + __ PushObject(Object::null_object()); // Make room for the result. + __ pushl(EAX); // Push the source object. + __ PushObject(dst_type); // Push the type of the destination. + __ pushl(EDX); // Instantiator type arguments. + __ pushl(ECX); // Function type arguments. + __ PushObject(dst_name); // Push the name of the destination. __ LoadObject(EAX, test_cache); __ pushl(EAX); GenerateRuntimeCall(token_pos, deopt_id, kTypeCheckRuntimeEntry, 6, locs); @@ -716,7 +695,6 @@ void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos, __ popl(EDX); // Remove pushed instantiator type arguments. } - void FlowGraphCompiler::EmitInstructionEpilogue(Instruction* instr) { if (is_optimizing()) { return; @@ -735,7 +713,6 @@ void FlowGraphCompiler::EmitInstructionEpilogue(Instruction* instr) { } } - void FlowGraphCompiler::CopyParameters() { __ Comment("Copy parameters"); const Function& function = parsed_function().function(); @@ -936,7 +913,6 @@ void FlowGraphCompiler::CopyParameters() { __ j(POSITIVE, &null_args_loop, Assembler::kNearJump); } - void FlowGraphCompiler::GenerateInlinedGetter(intptr_t offset) { // TOS: return address. // +1 : receiver. @@ -947,7 +923,6 @@ void FlowGraphCompiler::GenerateInlinedGetter(intptr_t offset) { __ ret(); } - void FlowGraphCompiler::GenerateInlinedSetter(intptr_t offset) { // TOS: return address. // +1 : value @@ -963,7 +938,6 @@ void FlowGraphCompiler::GenerateInlinedSetter(intptr_t offset) { __ ret(); } - // NOTE: If the entry code shape changes, ReturnAddressLocator in profiler.cc // needs to be updated to match. void FlowGraphCompiler::EmitFrameEntry() { @@ -996,7 +970,6 @@ void FlowGraphCompiler::EmitFrameEntry() { } } - void FlowGraphCompiler::CompileGraph() { InitCompiler(); @@ -1132,7 +1105,6 @@ void FlowGraphCompiler::CompileGraph() { GenerateDeferredCode(); } - void FlowGraphCompiler::GenerateCall(TokenPosition token_pos, const StubEntry& stub_entry, RawPcDescriptors::Kind kind, @@ -1141,7 +1113,6 @@ void FlowGraphCompiler::GenerateCall(TokenPosition token_pos, EmitCallsiteMetaData(token_pos, Thread::kNoDeoptId, kind, locs); } - void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, TokenPosition token_pos, const StubEntry& stub_entry, @@ -1161,7 +1132,6 @@ void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, } } - void FlowGraphCompiler::GenerateStaticDartCall(intptr_t deopt_id, TokenPosition token_pos, const StubEntry& stub_entry, @@ -1172,7 +1142,6 @@ void FlowGraphCompiler::GenerateStaticDartCall(intptr_t deopt_id, AddStaticCallTarget(target); } - void FlowGraphCompiler::GenerateRuntimeCall(TokenPosition token_pos, intptr_t deopt_id, const RuntimeEntry& entry, @@ -1194,7 +1163,6 @@ void FlowGraphCompiler::GenerateRuntimeCall(TokenPosition token_pos, } } - void FlowGraphCompiler::EmitUnoptimizedStaticCall(intptr_t argument_count, intptr_t deopt_id, TokenPosition token_pos, @@ -1208,7 +1176,6 @@ void FlowGraphCompiler::EmitUnoptimizedStaticCall(intptr_t argument_count, __ Drop(argument_count); } - void FlowGraphCompiler::EmitEdgeCounter(intptr_t edge_id) { // We do not check for overflow when incrementing the edge counter. The // function should normally be optimized long before the counter can @@ -1221,7 +1188,6 @@ void FlowGraphCompiler::EmitEdgeCounter(intptr_t edge_id) { __ IncrementSmiField(FieldAddress(EAX, Array::element_offset(edge_id)), 1); } - void FlowGraphCompiler::EmitOptimizedInstanceCall(const StubEntry& stub_entry, const ICData& ic_data, intptr_t argument_count, @@ -1242,7 +1208,6 @@ void FlowGraphCompiler::EmitOptimizedInstanceCall(const StubEntry& stub_entry, __ Drop(argument_count); } - void FlowGraphCompiler::EmitInstanceCall(const StubEntry& stub_entry, const ICData& ic_data, intptr_t argument_count, @@ -1256,7 +1221,6 @@ void FlowGraphCompiler::EmitInstanceCall(const StubEntry& stub_entry, __ Drop(argument_count); } - void FlowGraphCompiler::EmitMegamorphicInstanceCall( const String& name, const Array& arguments_descriptor, @@ -1294,7 +1258,6 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall( __ Drop(argument_count); } - void FlowGraphCompiler::EmitSwitchableInstanceCall(const ICData& ic_data, intptr_t argument_count, intptr_t deopt_id, @@ -1304,7 +1267,6 @@ void FlowGraphCompiler::EmitSwitchableInstanceCall(const ICData& ic_data, UNREACHABLE(); } - void FlowGraphCompiler::EmitOptimizedStaticCall( const Function& function, const Array& arguments_descriptor, @@ -1326,7 +1288,6 @@ void FlowGraphCompiler::EmitOptimizedStaticCall( __ Drop(argument_count); } - Condition FlowGraphCompiler::EmitEqualityRegConstCompare( Register reg, const Object& obj, @@ -1360,7 +1321,6 @@ Condition FlowGraphCompiler::EmitEqualityRegConstCompare( return EQUAL; } - Condition FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, Register right, bool needs_number_check, @@ -1384,7 +1344,6 @@ Condition FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, return EQUAL; } - // This function must be in sync with FlowGraphCompiler::RecordSafepoint and // FlowGraphCompiler::SlowPathEnvironmentFor. void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { @@ -1420,7 +1379,6 @@ void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { } } - void FlowGraphCompiler::RestoreLiveRegisters(LocationSummary* locs) { for (intptr_t i = 0; i < kNumberOfCpuRegisters; ++i) { Register reg = static_cast(i); @@ -1445,7 +1403,6 @@ void FlowGraphCompiler::RestoreLiveRegisters(LocationSummary* locs) { } } - #if defined(DEBUG) void FlowGraphCompiler::ClobberDeadTempRegisters(LocationSummary* locs) { // Clobber temporaries that have not been manually preserved. @@ -1460,7 +1417,6 @@ void FlowGraphCompiler::ClobberDeadTempRegisters(LocationSummary* locs) { } #endif - void FlowGraphCompiler::EmitTestAndCallLoadReceiver( intptr_t argument_count, const Array& arguments_descriptor) { @@ -1470,19 +1426,16 @@ void FlowGraphCompiler::EmitTestAndCallLoadReceiver( __ LoadObject(EDX, arguments_descriptor); } - void FlowGraphCompiler::EmitTestAndCallSmiBranch(Label* label, bool if_smi) { __ testl(EAX, Immediate(kSmiTagMask)); // Jump if receiver is (not) Smi. __ j(if_smi ? ZERO : NOT_ZERO, label); } - void FlowGraphCompiler::EmitTestAndCallLoadCid() { __ LoadClassId(EDI, EAX); } - int FlowGraphCompiler::EmitTestAndCallCheckCid(Label* next_label, const CidRange& range, int bias) { @@ -1499,11 +1452,9 @@ int FlowGraphCompiler::EmitTestAndCallCheckCid(Label* next_label, return bias; } - #undef __ #define __ compiler_->assembler()-> - void ParallelMoveResolver::EmitMove(int index) { MoveOperands* move = moves_[index]; const Location source = move->src(); @@ -1610,7 +1561,6 @@ void ParallelMoveResolver::EmitMove(int index) { move->Eliminate(); } - void ParallelMoveResolver::EmitSwap(int index) { MoveOperands* move = moves_[index]; const Location source = move->src(); @@ -1686,7 +1636,6 @@ void ParallelMoveResolver::EmitSwap(int index) { } } - void ParallelMoveResolver::MoveMemoryToMemory(const Address& dst, const Address& src) { ScratchRegisterScope ensure_scratch(this, kNoRegister); @@ -1694,7 +1643,6 @@ void ParallelMoveResolver::MoveMemoryToMemory(const Address& dst, __ movl(dst, ensure_scratch.reg()); } - void ParallelMoveResolver::StoreObject(const Address& dst, const Object& obj) { if (Assembler::IsSafeSmi(obj) || obj.IsNull()) { __ movl(dst, Immediate(reinterpret_cast(obj.raw()))); @@ -1705,7 +1653,6 @@ void ParallelMoveResolver::StoreObject(const Address& dst, const Object& obj) { } } - void ParallelMoveResolver::Exchange(Register reg, const Address& mem) { ScratchRegisterScope ensure_scratch(this, reg); __ movl(ensure_scratch.reg(), mem); @@ -1713,7 +1660,6 @@ void ParallelMoveResolver::Exchange(Register reg, const Address& mem) { __ movl(reg, ensure_scratch.reg()); } - void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { ScratchRegisterScope ensure_scratch1(this, kNoRegister); ScratchRegisterScope ensure_scratch2(this, ensure_scratch1.reg()); @@ -1723,14 +1669,12 @@ void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { __ movl(mem1, ensure_scratch2.reg()); } - void ParallelMoveResolver::Exchange(Register reg, Register base_reg, intptr_t stack_offset) { UNREACHABLE(); } - void ParallelMoveResolver::Exchange(Register base_reg1, intptr_t stack_offset1, Register base_reg2, @@ -1738,29 +1682,24 @@ void ParallelMoveResolver::Exchange(Register base_reg1, UNREACHABLE(); } - void ParallelMoveResolver::SpillScratch(Register reg) { __ pushl(reg); } - void ParallelMoveResolver::RestoreScratch(Register reg) { __ popl(reg); } - void ParallelMoveResolver::SpillFpuScratch(FpuRegister reg) { __ subl(ESP, Immediate(kFpuRegisterSize)); __ movups(Address(ESP, 0), reg); } - void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { __ movups(reg, Address(ESP, 0)); __ addl(ESP, Immediate(kFpuRegisterSize)); } - #undef __ } // namespace dart diff --git a/runtime/vm/flow_graph_compiler_x64.cc b/runtime/vm/flow_graph_compiler_x64.cc index b75a1ae17cf..5c97ebc35cd 100644 --- a/runtime/vm/flow_graph_compiler_x64.cc +++ b/runtime/vm/flow_graph_compiler_x64.cc @@ -26,7 +26,6 @@ DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); DECLARE_FLAG(bool, enable_simd_inline); - FlowGraphCompiler::~FlowGraphCompiler() { // BlockInfos are zone-allocated, so their destructors are not called. // Verify the labels explicitly here. @@ -36,45 +35,37 @@ FlowGraphCompiler::~FlowGraphCompiler() { } } - bool FlowGraphCompiler::SupportsUnboxedDoubles() { return true; } - bool FlowGraphCompiler::SupportsUnboxedMints() { return FLAG_unbox_mints; } - bool FlowGraphCompiler::SupportsUnboxedSimd128() { return FLAG_enable_simd_inline; } - bool FlowGraphCompiler::SupportsHardwareDivision() { return true; } - bool FlowGraphCompiler::CanConvertUnboxedMintToDouble() { return false; } - void FlowGraphCompiler::EnterIntrinsicMode() { ASSERT(!intrinsic_mode()); intrinsic_mode_ = true; ASSERT(!assembler()->constant_pool_allowed()); } - void FlowGraphCompiler::ExitIntrinsicMode() { ASSERT(intrinsic_mode()); intrinsic_mode_ = false; } - RawTypedData* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler, DeoptInfoBuilder* builder, const Array& deopt_table) { @@ -161,7 +152,6 @@ RawTypedData* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler, return builder->CreateDeoptInfo(deopt_table); } - void CompilerDeoptInfoWithStub::GenerateCode(FlowGraphCompiler* compiler, intptr_t stub_ix) { // Calls do not need stubs, they share a deoptimization trampoline. @@ -183,10 +173,8 @@ void CompilerDeoptInfoWithStub::GenerateCode(FlowGraphCompiler* compiler, #undef __ } - #define __ assembler()-> - // Fall through if bool_register contains null. void FlowGraphCompiler::GenerateBoolToJump(Register bool_register, Label* is_true, @@ -200,7 +188,6 @@ void FlowGraphCompiler::GenerateBoolToJump(Register bool_register, __ Bind(&fall_through); } - // Clobbers RCX. RawSubtypeTestCache* FlowGraphCompiler::GenerateCallSubtypeTestStub( TypeTestStubKind test_kind, @@ -244,7 +231,6 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateCallSubtypeTestStub( return type_test_cache.raw(); } - // Jumps to labels 'is_instance' or 'is_not_instance' respectively, if // type test is conclusive, otherwise fallthrough if a type test could not // be completed. @@ -322,7 +308,6 @@ FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest( is_instance_lbl, is_not_instance_lbl); } - void FlowGraphCompiler::CheckClassIds(Register class_id_reg, const GrowableArray& class_ids, Label* is_equal_lbl, @@ -334,7 +319,6 @@ void FlowGraphCompiler::CheckClassIds(Register class_id_reg, __ jmp(is_not_equal_lbl); } - // Testing against an instantiated type with no arguments, without // SubtypeTestCache. // RAX: instance to test against (preserved). @@ -402,7 +386,6 @@ bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest( return true; } - // Uses SubtypeTestCache to store instance class and result. // RAX: instance to test. // Clobbers R10, R13. @@ -434,7 +417,6 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateSubtype1TestCacheLookup( is_instance_lbl, is_not_instance_lbl); } - // Generates inlined check if 'type' is a type parameter or type itself // RAX: instance (preserved). // Clobbers RDI, RDX, R10. @@ -515,7 +497,6 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateUninstantiatedTypeTest( return SubtypeTestCache::null(); } - // Inputs: // - RAX: instance to test against (preserved). // - RDX: optional instantiator type arguments (preserved). @@ -558,7 +539,6 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof( is_not_instance_lbl); } - // If instanceof type test cannot be performed successfully at compile time and // therefore eliminated, optimize it by adding inlined tests for: // - NULL -> return type == Null (type is not Object or dynamic). @@ -606,11 +586,11 @@ void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos, // Generate runtime call. __ movq(RDX, Address(RSP, 1 * kWordSize)); // Get instantiator type args. __ movq(RCX, Address(RSP, 0 * kWordSize)); // Get function type args. - __ PushObject(Object::null_object()); // Make room for the result. - __ pushq(RAX); // Push the instance. - __ PushObject(type); // Push the type. - __ pushq(RDX); // Instantiator type arguments. - __ pushq(RCX); // Function type arguments. + __ PushObject(Object::null_object()); // Make room for the result. + __ pushq(RAX); // Push the instance. + __ PushObject(type); // Push the type. + __ pushq(RDX); // Instantiator type arguments. + __ pushq(RCX); // Function type arguments. __ LoadUniqueObject(RAX, test_cache); __ pushq(RAX); GenerateRuntimeCall(token_pos, deopt_id, kInstanceofRuntimeEntry, 5, locs); @@ -631,7 +611,6 @@ void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos, __ popq(RDX); // Remove pushed instantiator type arguments. } - // Optimize assignable type check by adding inlined tests for: // - NULL -> return NULL. // - Smi -> compile time subtype check (only if dst class is not parameterized). @@ -688,12 +667,12 @@ void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos, __ Bind(&runtime_call); __ movq(RDX, Address(RSP, 1 * kWordSize)); // Get instantiator type args. __ movq(RCX, Address(RSP, 0 * kWordSize)); // Get function type args. - __ PushObject(Object::null_object()); // Make room for the result. - __ pushq(RAX); // Push the source object. - __ PushObject(dst_type); // Push the type of the destination. - __ pushq(RDX); // Instantiator type arguments. - __ pushq(RCX); // Function type arguments. - __ PushObject(dst_name); // Push the name of the destination. + __ PushObject(Object::null_object()); // Make room for the result. + __ pushq(RAX); // Push the source object. + __ PushObject(dst_type); // Push the type of the destination. + __ pushq(RDX); // Instantiator type arguments. + __ pushq(RCX); // Function type arguments. + __ PushObject(dst_name); // Push the name of the destination. __ LoadUniqueObject(RAX, test_cache); __ pushq(RAX); GenerateRuntimeCall(token_pos, deopt_id, kTypeCheckRuntimeEntry, 6, locs); @@ -707,7 +686,6 @@ void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos, __ popq(RDX); // Remove pushed instantiator type arguments. } - void FlowGraphCompiler::EmitInstructionEpilogue(Instruction* instr) { if (is_optimizing()) { return; @@ -726,7 +704,6 @@ void FlowGraphCompiler::EmitInstructionEpilogue(Instruction* instr) { } } - void FlowGraphCompiler::CopyParameters() { __ Comment("Copy parameters"); const Function& function = parsed_function().function(); @@ -929,7 +906,6 @@ void FlowGraphCompiler::CopyParameters() { __ j(POSITIVE, &null_args_loop, Assembler::kNearJump); } - void FlowGraphCompiler::GenerateInlinedGetter(intptr_t offset) { // TOS: return address. // +1 : receiver. @@ -940,7 +916,6 @@ void FlowGraphCompiler::GenerateInlinedGetter(intptr_t offset) { __ ret(); } - void FlowGraphCompiler::GenerateInlinedSetter(intptr_t offset) { // TOS: return address. // +1 : value @@ -954,7 +929,6 @@ void FlowGraphCompiler::GenerateInlinedSetter(intptr_t offset) { __ ret(); } - // NOTE: If the entry code shape changes, ReturnAddressLocator in profiler.cc // needs to be updated to match. void FlowGraphCompiler::EmitFrameEntry() { @@ -991,7 +965,6 @@ void FlowGraphCompiler::EmitFrameEntry() { } } - void FlowGraphCompiler::CompileGraph() { InitCompiler(); const Function& function = parsed_function().function(); @@ -1127,7 +1100,6 @@ void FlowGraphCompiler::CompileGraph() { GenerateDeferredCode(); } - void FlowGraphCompiler::GenerateCall(TokenPosition token_pos, const StubEntry& stub_entry, RawPcDescriptors::Kind kind, @@ -1136,7 +1108,6 @@ void FlowGraphCompiler::GenerateCall(TokenPosition token_pos, EmitCallsiteMetaData(token_pos, Thread::kNoDeoptId, kind, locs); } - void FlowGraphCompiler::GeneratePatchableCall(TokenPosition token_pos, const StubEntry& stub_entry, RawPcDescriptors::Kind kind, @@ -1145,7 +1116,6 @@ void FlowGraphCompiler::GeneratePatchableCall(TokenPosition token_pos, EmitCallsiteMetaData(token_pos, Thread::kNoDeoptId, kind, locs); } - void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, TokenPosition token_pos, const StubEntry& stub_entry, @@ -1165,7 +1135,6 @@ void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, } } - void FlowGraphCompiler::GenerateStaticDartCall(intptr_t deopt_id, TokenPosition token_pos, const StubEntry& stub_entry, @@ -1192,7 +1161,6 @@ void FlowGraphCompiler::GenerateStaticDartCall(intptr_t deopt_id, AddStaticCallTarget(target); } - void FlowGraphCompiler::GenerateRuntimeCall(TokenPosition token_pos, intptr_t deopt_id, const RuntimeEntry& entry, @@ -1214,7 +1182,6 @@ void FlowGraphCompiler::GenerateRuntimeCall(TokenPosition token_pos, } } - void FlowGraphCompiler::EmitUnoptimizedStaticCall(intptr_t argument_count, intptr_t deopt_id, TokenPosition token_pos, @@ -1228,7 +1195,6 @@ void FlowGraphCompiler::EmitUnoptimizedStaticCall(intptr_t argument_count, __ Drop(argument_count, RCX); } - void FlowGraphCompiler::EmitEdgeCounter(intptr_t edge_id) { // We do not check for overflow when incrementing the edge counter. The // function should normally be optimized long before the counter can @@ -1242,7 +1208,6 @@ void FlowGraphCompiler::EmitEdgeCounter(intptr_t edge_id) { __ IncrementSmiField(FieldAddress(RAX, Array::element_offset(edge_id)), 1); } - void FlowGraphCompiler::EmitOptimizedInstanceCall(const StubEntry& stub_entry, const ICData& ic_data, intptr_t argument_count, @@ -1263,7 +1228,6 @@ void FlowGraphCompiler::EmitOptimizedInstanceCall(const StubEntry& stub_entry, __ Drop(argument_count, RCX); } - void FlowGraphCompiler::EmitInstanceCall(const StubEntry& stub_entry, const ICData& ic_data, intptr_t argument_count, @@ -1277,7 +1241,6 @@ void FlowGraphCompiler::EmitInstanceCall(const StubEntry& stub_entry, __ Drop(argument_count, RCX); } - void FlowGraphCompiler::EmitMegamorphicInstanceCall( const String& name, const Array& arguments_descriptor, @@ -1322,7 +1285,6 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall( __ Drop(argument_count, RCX); } - void FlowGraphCompiler::EmitSwitchableInstanceCall(const ICData& ic_data, intptr_t argument_count, intptr_t deopt_id, @@ -1339,7 +1301,6 @@ void FlowGraphCompiler::EmitSwitchableInstanceCall(const ICData& ic_data, __ LoadUniqueObject(RBX, ic_data); __ call(RCX); - EmitCallsiteMetaData(token_pos, deopt_id, RawPcDescriptors::kOther, locs); const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); if (is_optimizing()) { @@ -1352,7 +1313,6 @@ void FlowGraphCompiler::EmitSwitchableInstanceCall(const ICData& ic_data, __ Drop(argument_count, RCX); } - void FlowGraphCompiler::EmitOptimizedStaticCall( const Function& function, const Array& arguments_descriptor, @@ -1375,7 +1335,6 @@ void FlowGraphCompiler::EmitOptimizedStaticCall( __ Drop(argument_count, RCX); } - Condition FlowGraphCompiler::EmitEqualityRegConstCompare( Register reg, const Object& obj, @@ -1409,7 +1368,6 @@ Condition FlowGraphCompiler::EmitEqualityRegConstCompare( return EQUAL; } - Condition FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, Register right, bool needs_number_check, @@ -1433,7 +1391,6 @@ Condition FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, return EQUAL; } - // This function must be in sync with FlowGraphCompiler::RecordSafepoint and // FlowGraphCompiler::SlowPathEnvironmentFor. void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { @@ -1447,13 +1404,11 @@ void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { locs->live_registers()->fpu_registers()); } - void FlowGraphCompiler::RestoreLiveRegisters(LocationSummary* locs) { __ PopRegisters(locs->live_registers()->cpu_registers(), locs->live_registers()->fpu_registers()); } - #if defined(DEBUG) void FlowGraphCompiler::ClobberDeadTempRegisters(LocationSummary* locs) { // Clobber temporaries that have not been manually preserved. @@ -1468,7 +1423,6 @@ void FlowGraphCompiler::ClobberDeadTempRegisters(LocationSummary* locs) { } #endif - void FlowGraphCompiler::EmitTestAndCallLoadReceiver( intptr_t argument_count, const Array& arguments_descriptor) { @@ -1478,19 +1432,16 @@ void FlowGraphCompiler::EmitTestAndCallLoadReceiver( __ LoadObject(R10, arguments_descriptor); } - void FlowGraphCompiler::EmitTestAndCallSmiBranch(Label* label, bool if_smi) { __ testq(RAX, Immediate(kSmiTagMask)); // Jump if receiver is (not) Smi. __ j(if_smi ? ZERO : NOT_ZERO, label); } - void FlowGraphCompiler::EmitTestAndCallLoadCid() { __ LoadClassId(RDI, RAX); } - int FlowGraphCompiler::EmitTestAndCallCheckCid(Label* next_label, const CidRange& range, int bias) { @@ -1507,11 +1458,9 @@ int FlowGraphCompiler::EmitTestAndCallCheckCid(Label* next_label, return bias; } - #undef __ #define __ compiler_->assembler()-> - void ParallelMoveResolver::EmitMove(int index) { MoveOperands* move = moves_[index]; const Location source = move->src(); @@ -1605,7 +1554,6 @@ void ParallelMoveResolver::EmitMove(int index) { move->Eliminate(); } - void ParallelMoveResolver::EmitSwap(int index) { MoveOperands* move = moves_[index]; const Location source = move->src(); @@ -1681,35 +1629,29 @@ void ParallelMoveResolver::EmitSwap(int index) { } } - void ParallelMoveResolver::MoveMemoryToMemory(const Address& dst, const Address& src) { __ MoveMemoryToMemory(dst, src); } - void ParallelMoveResolver::StoreObject(const Address& dst, const Object& obj) { __ StoreObject(dst, obj); } - void ParallelMoveResolver::Exchange(Register reg, const Address& mem) { __ Exchange(reg, mem); } - void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { __ Exchange(mem1, mem2); } - void ParallelMoveResolver::Exchange(Register reg, Register base_reg, intptr_t stack_offset) { UNREACHABLE(); } - void ParallelMoveResolver::Exchange(Register base_reg1, intptr_t stack_offset1, Register base_reg2, @@ -1717,29 +1659,24 @@ void ParallelMoveResolver::Exchange(Register base_reg1, UNREACHABLE(); } - void ParallelMoveResolver::SpillScratch(Register reg) { __ pushq(reg); } - void ParallelMoveResolver::RestoreScratch(Register reg) { __ popq(reg); } - void ParallelMoveResolver::SpillFpuScratch(FpuRegister reg) { __ AddImmediate(RSP, Immediate(-kFpuRegisterSize)); __ movups(Address(RSP, 0), reg); } - void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { __ movups(reg, Address(RSP, 0)); __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); } - #undef __ } // namespace dart diff --git a/runtime/vm/flow_graph_inliner.cc b/runtime/vm/flow_graph_inliner.cc index 04fa7f7b00c..9b44975bfdc 100644 --- a/runtime/vm/flow_graph_inliner.cc +++ b/runtime/vm/flow_graph_inliner.cc @@ -5,12 +5,9 @@ #include "vm/flow_graph_inliner.h" #include "vm/aot_optimizer.h" -#include "vm/precompiler.h" #include "vm/block_scheduler.h" #include "vm/branch_optimizer.h" #include "vm/compiler.h" -#include "vm/kernel.h" -#include "vm/kernel_to_il.h" #include "vm/flags.h" #include "vm/flow_graph.h" #include "vm/flow_graph_builder.h" @@ -18,9 +15,12 @@ #include "vm/flow_graph_type_propagator.h" #include "vm/il_printer.h" #include "vm/jit_optimizer.h" +#include "vm/kernel.h" +#include "vm/kernel_to_il.h" #include "vm/longjump.h" #include "vm/object.h" #include "vm/object_store.h" +#include "vm/precompiler.h" #include "vm/timer.h" namespace dart { @@ -116,7 +116,6 @@ DECLARE_FLAG(bool, verify_compiler); } \ } while (false) - // Test if a call is recursive by looking in the deoptimization environment. static bool IsCallRecursive(const Function& function, Definition* call) { Environment* env = call->env(); @@ -129,14 +128,12 @@ static bool IsCallRecursive(const Function& function, Definition* call) { return false; } - // Helper to get the default value of a formal parameter. static ConstantInstr* GetDefaultValue(intptr_t i, const ParsedFunction& parsed_function) { return new ConstantInstr(parsed_function.DefaultParameterValueAt(i)); } - // Pair of an argument name and its value. struct NamedArgument { String* name; @@ -144,7 +141,6 @@ struct NamedArgument { NamedArgument(String* name, Value* value) : name(name), value(value) {} }; - // Helper to collect information about a callee graph when considering it for // inlining. class GraphInfoCollector : public ValueObject { @@ -194,7 +190,6 @@ class GraphInfoCollector : public ValueObject { intptr_t instruction_count_; }; - // Structure for collecting inline data needed to print inlining tree. struct InlinedInfo { const Function* caller; @@ -214,7 +209,6 @@ struct InlinedInfo { bailout_reason(reason) {} }; - // A collection of call sites to consider for inlining. class CallSites : public ValueObject { public: @@ -352,7 +346,6 @@ class CallSites : public ValueObject { } } - void FindCallSites(FlowGraph* graph, intptr_t depth, GrowableArray* inlined_info) { @@ -429,7 +422,6 @@ class CallSites : public ValueObject { DISALLOW_COPY_AND_ASSIGN(CallSites); }; - struct InlinedCallData { InlinedCallData(Definition* call, intptr_t first_param_index, // 1 if type args are passed. @@ -455,7 +447,6 @@ struct InlinedCallData { const intptr_t caller_inlining_id; }; - class CallSiteInliner; class PolymorphicInliner : public ValueObject { @@ -497,7 +488,6 @@ class PolymorphicInliner : public ValueObject { const intptr_t caller_inlining_id_; }; - static bool HasAnnotation(const Function& function, const char* annotation) { const Class& owner = Class::Handle(function.Owner()); const Library& library = Library::Handle(owner.library()); @@ -516,7 +506,6 @@ static bool HasAnnotation(const Function& function, const char* annotation) { return false; } - static void ReplaceParameterStubs(Zone* zone, FlowGraph* caller_graph, InlinedCallData* call_data, @@ -606,7 +595,6 @@ static void ReplaceParameterStubs(Zone* zone, DEBUG_ASSERT(!FLAG_verify_compiler || caller_graph->VerifyUseLists()); } - class CallSiteInliner : public ValueObject { public: explicit CallSiteInliner(FlowGraphInliner* inliner, intptr_t threshold) @@ -883,7 +871,6 @@ class CallSiteInliner : public ValueObject { } } - // Build the callee graph. InlineExitCollector* exit_collector = new (Z) InlineExitCollector(caller_graph_, call); @@ -1485,7 +1472,6 @@ class CallSiteInliner : public ValueObject { DISALLOW_COPY_AND_ASSIGN(CallSiteInliner); }; - PolymorphicInliner::PolymorphicInliner(CallSiteInliner* owner, PolymorphicInstanceCallInstr* call, const Function& caller_function, @@ -1501,22 +1487,18 @@ PolymorphicInliner::PolymorphicInliner(CallSiteInliner* owner, caller_function_(caller_function), caller_inlining_id_(caller_inlining_id) {} - Isolate* PolymorphicInliner::isolate() const { return owner_->caller_graph()->isolate(); } - Zone* PolymorphicInliner::zone() const { return owner_->caller_graph()->zone(); } - intptr_t PolymorphicInliner::AllocateBlockId() const { return owner_->caller_graph()->allocate_block_id(); } - // Inlined bodies are shared if two different class ids have the same // inlined target. This sharing is represented by using three different // types of entries in the inlined_entries_ array: @@ -1577,7 +1559,6 @@ bool PolymorphicInliner::CheckInlinedDuplicate(const Function& target) { return false; } - bool PolymorphicInliner::CheckNonInlinedDuplicate(const Function& target) { for (intptr_t i = 0; i < non_inlined_variants_->length(); ++i) { if (target.raw() == non_inlined_variants_->TargetAt(i)->target->raw()) { @@ -1588,7 +1569,6 @@ bool PolymorphicInliner::CheckNonInlinedDuplicate(const Function& target) { return false; } - bool PolymorphicInliner::TryInliningPoly(const TargetInfo& target_info) { if ((!FLAG_precompiled_mode || owner_->inliner_->use_speculative_inlining()) && @@ -1620,7 +1600,6 @@ bool PolymorphicInliner::TryInliningPoly(const TargetInfo& target_info) { return true; } - static Instruction* AppendInstruction(Instruction* first, Instruction* second) { for (intptr_t i = second->InputCount() - 1; i >= 0; --i) { Value* input = second->InputAt(i); @@ -1630,7 +1609,6 @@ static Instruction* AppendInstruction(Instruction* first, Instruction* second) { return second; } - bool PolymorphicInliner::TryInlineRecognizedMethod(intptr_t receiver_cid, const Function& target) { TargetEntryInstr* entry; @@ -1673,7 +1651,6 @@ bool PolymorphicInliner::TryInlineRecognizedMethod(intptr_t receiver_cid, return false; } - // Build a DAG to dispatch to the inlined function bodies. Load the class // id of the receiver and make explicit comparisons for each inlined body, // in frequency order. If all variants are inlined, the entry to the last @@ -1919,7 +1896,6 @@ TargetEntryInstr* PolymorphicInliner::BuildDecisionGraph() { return entry; } - static void TracePolyInlining(const CallTargets& targets, intptr_t idx, intptr_t total, @@ -1932,12 +1908,10 @@ static void TracePolyInlining(const CallTargets& targets, targets.TargetAt(idx)->count, total, percent, message); } - bool PolymorphicInliner::trace_inlining() const { return owner_->trace_inlining(); } - void PolymorphicInliner::Inline() { ASSERT(&variants_ == &call_->targets_); @@ -2019,18 +1993,15 @@ void PolymorphicInliner::Inline() { exit_collector_->ReplaceCall(entry); } - static uint16_t ClampUint16(intptr_t v) { return (v > 0xFFFF) ? 0xFFFF : static_cast(v); } - static bool ShouldTraceInlining(FlowGraph* flow_graph) { const Function& top = flow_graph->parsed_function().function(); return FLAG_trace_inlining && FlowGraphPrinter::ShouldPrint(top); } - FlowGraphInliner::FlowGraphInliner( FlowGraph* flow_graph, GrowableArray* inline_id_to_function, @@ -2050,7 +2021,6 @@ FlowGraphInliner::FlowGraphInliner( ASSERT(!use_speculative_inlining || (inlining_black_list != NULL)); } - void FlowGraphInliner::CollectGraphInfo(FlowGraph* flow_graph, bool force) { const Function& function = flow_graph->function(); if (force || (function.optimized_instruction_count() == 0)) { @@ -2063,7 +2033,6 @@ void FlowGraphInliner::CollectGraphInfo(FlowGraph* flow_graph, bool force) { } } - // TODO(srdjan): This is only needed when disassembling and/or profiling. // Sets inlining id for all instructions of this flow-graph, as well for the // FlowGraph itself. @@ -2083,7 +2052,6 @@ void FlowGraphInliner::SetInliningId(FlowGraph* flow_graph, } } - // Use function name to determine if inlineable operator. // Add names as necessary. static bool IsInlineableOperator(const Function& function) { @@ -2093,7 +2061,6 @@ static bool IsInlineableOperator(const Function& function) { (function.name() == Symbols::Minus().raw()); } - bool FlowGraphInliner::AlwaysInline(const Function& function) { const char* kAlwaysInlineAnnotation = "AlwaysInline"; if (FLAG_enable_inlining_annotations && @@ -2124,7 +2091,6 @@ bool FlowGraphInliner::AlwaysInline(const Function& function) { return MethodRecognizer::AlwaysInline(function); } - void FlowGraphInliner::Inline() { // Collect graph info and store it on the function. // We might later use it for an early bailout from the inlining. @@ -2176,7 +2142,6 @@ void FlowGraphInliner::Inline() { } } - intptr_t FlowGraphInliner::NextInlineId(const Function& function, TokenPosition tp, intptr_t parent_id) { @@ -2193,17 +2158,14 @@ intptr_t FlowGraphInliner::NextInlineId(const Function& function, return id; } - static bool ShouldInlineSimd() { return FlowGraphCompiler::SupportsUnboxedSimd128(); } - static bool CanUnboxDouble() { return FlowGraphCompiler::SupportsUnboxedDoubles(); } - static bool ShouldInlineInt64ArrayOps() { #if defined(TARGET_ARCH_X64) return true; @@ -2212,14 +2174,12 @@ static bool ShouldInlineInt64ArrayOps() { #endif } - static bool CanUnboxInt32() { // Int32/Uint32 can be unboxed if it fits into a smi or the platform // supports unboxed mints. return (kSmiBits >= 32) || FlowGraphCompiler::SupportsUnboxedMints(); } - // Quick access to the current one. #undef Z #define Z (flow_graph->zone()) @@ -2266,7 +2226,6 @@ static intptr_t PrepareInlineIndexedOp(FlowGraph* flow_graph, return array_cid; } - static bool InlineGetIndexed(FlowGraph* flow_graph, MethodRecognizer::Kind kind, Instruction* call, @@ -2311,7 +2270,6 @@ static bool InlineGetIndexed(FlowGraph* flow_graph, return true; } - static bool InlineSetIndexed(FlowGraph* flow_graph, MethodRecognizer::Kind kind, const Function& target, @@ -2452,7 +2410,6 @@ static bool InlineSetIndexed(FlowGraph* flow_graph, return true; } - static bool InlineDoubleOp(FlowGraph* flow_graph, Token::Kind op_kind, Instruction* call, @@ -2479,7 +2436,6 @@ static bool InlineDoubleOp(FlowGraph* flow_graph, return true; } - static bool InlineDoubleTestOp(FlowGraph* flow_graph, Instruction* call, Definition* receiver, @@ -2504,7 +2460,6 @@ static bool InlineDoubleTestOp(FlowGraph* flow_graph, return true; } - static bool InlineSmiBitAndFromSmi(FlowGraph* flow_graph, Instruction* call, Definition* receiver, @@ -2527,7 +2482,6 @@ static bool InlineSmiBitAndFromSmi(FlowGraph* flow_graph, return true; } - static bool InlineGrowableArraySetter(FlowGraph* flow_graph, intptr_t offset, StoreBarrierType store_barrier_type, @@ -2553,7 +2507,6 @@ static bool InlineGrowableArraySetter(FlowGraph* flow_graph, return true; } - static void PrepareInlineByteArrayBaseOp(FlowGraph* flow_graph, Instruction* call, intptr_t array_cid, @@ -2614,7 +2567,6 @@ static void PrepareInlineByteArrayBaseOp(FlowGraph* flow_graph, } } - static bool InlineByteArrayBaseLoad(FlowGraph* flow_graph, Instruction* call, Definition* receiver, @@ -2657,7 +2609,6 @@ static bool InlineByteArrayBaseLoad(FlowGraph* flow_graph, return true; } - static bool InlineByteArrayBaseStore(FlowGraph* flow_graph, const Function& target, Instruction* call, @@ -2770,7 +2721,6 @@ static bool InlineByteArrayBaseStore(FlowGraph* flow_graph, return true; } - // Returns the LoadIndexedInstr. static Definition* PrepareInlineStringIndexOp(FlowGraph* flow_graph, Instruction* call, @@ -2823,7 +2773,6 @@ static Definition* PrepareInlineStringIndexOp(FlowGraph* flow_graph, return load_indexed; } - static bool InlineStringBaseCharAt(FlowGraph* flow_graph, Instruction* call, Definition* receiver, @@ -2852,7 +2801,6 @@ static bool InlineStringBaseCharAt(FlowGraph* flow_graph, return true; } - static bool InlineStringCodeUnitAt(FlowGraph* flow_graph, Instruction* call, Definition* receiver, @@ -2875,7 +2823,6 @@ static bool InlineStringCodeUnitAt(FlowGraph* flow_graph, return true; } - // Only used for monomorphic calls. bool FlowGraphInliner::TryReplaceInstanceCallWithInline( FlowGraph* flow_graph, @@ -2929,7 +2876,6 @@ bool FlowGraphInliner::TryReplaceInstanceCallWithInline( return false; } - bool FlowGraphInliner::TryReplaceStaticCallWithInline( FlowGraph* flow_graph, ForwardInstructionIterator* iterator, @@ -2968,7 +2914,6 @@ bool FlowGraphInliner::TryReplaceStaticCallWithInline( return false; } - static bool InlineFloat32x4Method(FlowGraph* flow_graph, Instruction* call, Definition* receiver, @@ -3074,7 +3019,6 @@ static bool InlineFloat32x4Method(FlowGraph* flow_graph, return true; } - static bool CheckMask(Definition* definition, intptr_t* mask_ptr) { if (!definition->IsConstant()) return false; ConstantInstr* constant_instruction = definition->AsConstant(); @@ -3088,7 +3032,6 @@ static bool CheckMask(Definition* definition, intptr_t* mask_ptr) { return true; } - static bool InlineSimdShuffleMethod(FlowGraph* flow_graph, Instruction* call, Definition* receiver, @@ -3117,7 +3060,6 @@ static bool InlineSimdShuffleMethod(FlowGraph* flow_graph, return true; } - static bool InlineSimdShuffleMixMethod(FlowGraph* flow_graph, Instruction* call, Definition* receiver, @@ -3147,7 +3089,6 @@ static bool InlineSimdShuffleMixMethod(FlowGraph* flow_graph, return true; } - static bool InlineInt32x4Method(FlowGraph* flow_graph, Instruction* call, Definition* receiver, @@ -3204,7 +3145,6 @@ static bool InlineInt32x4Method(FlowGraph* flow_graph, return true; } - static bool InlineFloat64x2Method(FlowGraph* flow_graph, Instruction* call, Definition* receiver, @@ -3257,7 +3197,6 @@ static bool InlineFloat64x2Method(FlowGraph* flow_graph, return true; } - static bool InlineSimdConstructor(FlowGraph* flow_graph, Instruction* call, MethodRecognizer::Kind kind, @@ -3339,7 +3278,6 @@ static bool InlineSimdConstructor(FlowGraph* flow_graph, return true; } - static bool InlineMathCFunction(FlowGraph* flow_graph, Instruction* call, MethodRecognizer::Kind kind, @@ -3379,7 +3317,6 @@ static bool InlineMathCFunction(FlowGraph* flow_graph, return true; } - bool FlowGraphInliner::TryInlineRecognizedMethod(FlowGraph* flow_graph, intptr_t receiver_cid, const Function& target, @@ -3802,6 +3739,5 @@ bool FlowGraphInliner::TryInlineRecognizedMethod(FlowGraph* flow_graph, } } - } // namespace dart #endif // !defined(DART_PRECOMPILED_RUNTIME) diff --git a/runtime/vm/flow_graph_range_analysis.cc b/runtime/vm/flow_graph_range_analysis.cc index fcf55ee2ddc..bbd0b4c3ad7 100644 --- a/runtime/vm/flow_graph_range_analysis.cc +++ b/runtime/vm/flow_graph_range_analysis.cc @@ -40,7 +40,6 @@ void RangeAnalysis::Analyze() { RemoveConstraints(); } - static Definition* UnwrapConstraint(Definition* defn) { while (defn->IsConstraint()) { defn = defn->AsConstraint()->value()->definition(); @@ -48,7 +47,6 @@ static Definition* UnwrapConstraint(Definition* defn) { return defn; } - // Simple induction variable is a variable that satisfies the following pattern: // // v1 <- phi(v0, v1 + 1) @@ -108,7 +106,6 @@ class InductionVariableInfo : public ZoneAllocated { PhiInstr* bound_; }; - static ConstraintInstr* FindBoundingConstraint(PhiInstr* phi, Definition* defn) { ConstraintInstr* limit = NULL; @@ -129,7 +126,6 @@ static ConstraintInstr* FindBoundingConstraint(PhiInstr* phi, return limit; } - static InductionVariableInfo* DetectSimpleInductionVariable(PhiInstr* phi) { if (phi->Type()->ToCid() != kSmiCid) { return NULL; @@ -165,7 +161,6 @@ static InductionVariableInfo* DetectSimpleInductionVariable(PhiInstr* phi) { return NULL; } - void RangeAnalysis::DiscoverSimpleInductionVariables() { GrowableArray loop_variables; @@ -211,7 +206,6 @@ void RangeAnalysis::DiscoverSimpleInductionVariables() { } } - void RangeAnalysis::CollectValues() { const GrowableArray& initial = *flow_graph_->graph_entry()->initial_definitions(); @@ -226,7 +220,6 @@ void RangeAnalysis::CollectValues() { !block_it.Done(); block_it.Advance()) { BlockEntryInstr* block = block_it.Current(); - if (block->IsGraphEntry() || block->IsCatchBlockEntry()) { const GrowableArray& initial = block->IsGraphEntry() @@ -270,7 +263,6 @@ void RangeAnalysis::CollectValues() { } } - // For a comparison operation return an operation for the equivalent flipped // comparison: a (op) b === b (op') a. static Token::Kind FlipComparison(Token::Kind op) { @@ -293,7 +285,6 @@ static Token::Kind FlipComparison(Token::Kind op) { } } - // Given a boundary (right operand) and a comparison operation return // a symbolic range constraint for the left operand of the comparison assuming // that it evaluated to true. @@ -324,7 +315,6 @@ Range* RangeAnalysis::ConstraintSmiRange(Token::Kind op, Definition* boundary) { } } - ConstraintInstr* RangeAnalysis::InsertConstraintFor(Value* use, Definition* defn, Range* constraint_range, @@ -351,7 +341,6 @@ ConstraintInstr* RangeAnalysis::InsertConstraintFor(Value* use, return constraint; } - bool RangeAnalysis::ConstrainValueAfterBranch(Value* use, Definition* defn) { BranchInstr* branch = use->instruction()->AsBranch(); RelationalOpInstr* rel_op = branch->comparison()->AsRelationalOp(); @@ -394,7 +383,6 @@ bool RangeAnalysis::ConstrainValueAfterBranch(Value* use, Definition* defn) { return false; } - void RangeAnalysis::InsertConstraintsFor(Definition* defn) { for (Value* use = defn->input_use_list(); use != NULL; use = use->next_use()) { @@ -411,7 +399,6 @@ void RangeAnalysis::InsertConstraintsFor(Definition* defn) { } } - void RangeAnalysis::ConstrainValueAfterCheckArrayBound(Value* use, Definition* defn) { CheckArrayBoundInstr* check = use->instruction()->AsCheckArrayBound(); @@ -431,7 +418,6 @@ void RangeAnalysis::ConstrainValueAfterCheckArrayBound(Value* use, InsertConstraintFor(use, defn, constraint_range, check); } - void RangeAnalysis::InsertConstraints() { for (intptr_t i = 0; i < values_.length(); i++) { InsertConstraintsFor(values_[i]); @@ -442,7 +428,6 @@ void RangeAnalysis::InsertConstraints() { } } - const Range* RangeAnalysis::GetSmiRange(Value* value) const { Definition* defn = value->definition(); const Range* range = defn->range(); @@ -464,7 +449,6 @@ const Range* RangeAnalysis::GetSmiRange(Value* value) const { return range; } - const Range* RangeAnalysis::GetIntRange(Value* value) const { Definition* defn = value->definition(); const Range* range = defn->range(); @@ -486,7 +470,6 @@ const Range* RangeAnalysis::GetIntRange(Value* value) const { return range; } - static bool AreEqualDefinitions(Definition* a, Definition* b) { a = UnwrapConstraint(a); b = UnwrapConstraint(b); @@ -495,13 +478,11 @@ static bool AreEqualDefinitions(Definition* a, Definition* b) { b->Dependencies().IsNone() && a->Equals(b)); } - static bool DependOnSameSymbol(const RangeBoundary& a, const RangeBoundary& b) { return a.IsSymbol() && b.IsSymbol() && AreEqualDefinitions(a.symbol(), b.symbol()); } - // Given the current range of a phi and a newly computed range check // if it is growing towards negative infinity, if it does widen it to // MinSmi. @@ -560,7 +541,6 @@ static RangeBoundary WidenMax(const Range* range, : RangeBoundary::MaxConstant(size); } - // Given the current range of a phi and a newly computed range check // if we can perform narrowing: use newly computed minimum to improve precision // of the computed range. We do it only if current minimum was widened and is @@ -578,7 +558,6 @@ static RangeBoundary NarrowMin(const Range* range, return range->min().IsMinimumOrBelow(size) ? new_range->min() : range->min(); } - // Given the current range of a phi and a newly computed range check // if we can perform narrowing: use newly computed maximum to improve precision // of the computed range. We do it only if current maximum was widened and is @@ -596,7 +575,6 @@ static RangeBoundary NarrowMax(const Range* range, return range->max().IsMaximumOrAbove(size) ? new_range->max() : range->max(); } - char RangeAnalysis::OpPrefix(JoinOperator op) { switch (op) { case WIDEN: @@ -610,7 +588,6 @@ char RangeAnalysis::OpPrefix(JoinOperator op) { return ' '; } - static RangeBoundary::RangeSize RangeSizeForPhi(Definition* phi) { ASSERT(phi->IsPhi()); if (phi->Type()->ToCid() == kSmiCid) { @@ -625,7 +602,6 @@ static RangeBoundary::RangeSize RangeSizeForPhi(Definition* phi) { } } - bool RangeAnalysis::InferRange(JoinOperator op, Definition* defn, intptr_t iteration) { @@ -660,7 +636,6 @@ bool RangeAnalysis::InferRange(JoinOperator op, return false; } - void RangeAnalysis::CollectDefinitions(BitVector* set) { for (BlockIterator block_it = flow_graph_->reverse_postorder_iterator(); !block_it.Done(); block_it.Advance()) { @@ -686,7 +661,6 @@ void RangeAnalysis::CollectDefinitions(BitVector* set) { } } - void RangeAnalysis::Iterate(JoinOperator op, intptr_t max_iterations) { // TODO(vegorov): switch to worklist if this becomes performance bottleneck. intptr_t iteration = 0; @@ -704,7 +678,6 @@ void RangeAnalysis::Iterate(JoinOperator op, intptr_t max_iterations) { } while (changed && (iteration < max_iterations)); } - void RangeAnalysis::InferRanges() { if (FLAG_trace_range_analysis) { FlowGraphPrinter::PrintGraph("Range Analysis (BEFORE)", flow_graph_); @@ -761,7 +734,6 @@ void RangeAnalysis::InferRanges() { } } - void RangeAnalysis::AssignRangesRecursively(Definition* defn) { if (!Range::IsUnknown(defn->range())) { return; @@ -785,7 +757,6 @@ void RangeAnalysis::AssignRangesRecursively(Definition* defn) { } } - // Scheduler is a helper class that inserts floating control-flow less // subgraphs into the flow graph. // It always attempts to schedule instructions into the loop preheader in the @@ -915,7 +886,6 @@ class Scheduler { GrowableArray emitted_; }; - // If bounds check 0 <= index < length is not redundant we attempt to // replace it with a sequence of checks that guarantee // @@ -1082,7 +1052,6 @@ class BoundsCheckGeneralizer { Thread::kNoDeoptId); } - BinarySmiOpInstr* MakeBinaryOp(Token::Kind op_kind, Definition* left, intptr_t right) { @@ -1443,7 +1412,6 @@ class BoundsCheckGeneralizer { f->Print(" {%s}", Range::ToCString(index_bound->range())); } - static const char* IndexBoundToCString(Definition* index_bound) { char buffer[1024]; BufferFormatter f(buffer, sizeof(buffer)); @@ -1457,7 +1425,6 @@ class BoundsCheckGeneralizer { Scheduler scheduler_; }; - void RangeAnalysis::EliminateRedundantBoundsChecks() { if (FLAG_array_bounds_check_elimination) { const Function& function = flow_graph_->function(); @@ -1486,7 +1453,6 @@ void RangeAnalysis::EliminateRedundantBoundsChecks() { } } - void RangeAnalysis::MarkUnreachableBlocks() { for (intptr_t i = 0; i < constraints_.length(); i++) { if (Range::IsUnknown(constraints_[i]->range())) { @@ -1521,7 +1487,6 @@ void RangeAnalysis::MarkUnreachableBlocks() { } } - void RangeAnalysis::RemoveConstraints() { for (intptr_t i = 0; i < constraints_.length(); i++) { Definition* def = constraints_[i]->value()->definition(); @@ -1535,7 +1500,6 @@ void RangeAnalysis::RemoveConstraints() { } } - static void NarrowBinaryMintOp(BinaryMintOpInstr* mint_op) { if (RangeUtils::Fits(mint_op->range(), RangeBoundary::kRangeBoundaryInt32) && RangeUtils::Fits(mint_op->left()->definition()->range(), @@ -1553,7 +1517,6 @@ static void NarrowBinaryMintOp(BinaryMintOpInstr* mint_op) { } } - static void NarrowShiftMintOp(ShiftMintOpInstr* mint_op) { if (RangeUtils::Fits(mint_op->range(), RangeBoundary::kRangeBoundaryInt32) && RangeUtils::Fits(mint_op->left()->definition()->range(), @@ -1571,7 +1534,6 @@ static void NarrowShiftMintOp(ShiftMintOpInstr* mint_op) { } } - void RangeAnalysis::NarrowMintToInt32() { for (intptr_t i = 0; i < binary_mint_ops_.length(); i++) { NarrowBinaryMintOp(binary_mint_ops_[i]); @@ -1582,7 +1544,6 @@ void RangeAnalysis::NarrowMintToInt32() { } } - IntegerInstructionSelector::IntegerInstructionSelector(FlowGraph* flow_graph) : flow_graph_(flow_graph) { ASSERT(flow_graph_ != NULL); @@ -1591,7 +1552,6 @@ IntegerInstructionSelector::IntegerInstructionSelector(FlowGraph* flow_graph) new (zone_) BitVector(zone_, flow_graph_->current_ssa_temp_index()); } - void IntegerInstructionSelector::Select() { if (FLAG_trace_integer_ir_selection) { THR_Print("---- starting integer ir selection -------\n"); @@ -1607,7 +1567,6 @@ void IntegerInstructionSelector::Select() { } } - bool IntegerInstructionSelector::IsPotentialUint32Definition(Definition* def) { // TODO(johnmccutchan): Consider Smi operations, to avoid unnecessary tagging // & untagged of intermediate results. @@ -1616,7 +1575,6 @@ bool IntegerInstructionSelector::IsPotentialUint32Definition(Definition* def) { def->IsShiftMintOp() || def->IsUnaryMintOp(); } - void IntegerInstructionSelector::FindPotentialUint32Definitions() { if (FLAG_trace_integer_ir_selection) { THR_Print("++++ Finding potential Uint32 definitions:\n"); @@ -1642,7 +1600,6 @@ void IntegerInstructionSelector::FindPotentialUint32Definitions() { } } - // BinaryMintOp masks and stores into unsigned typed arrays that truncate the // value into a Uint32 range. bool IntegerInstructionSelector::IsUint32NarrowingDefinition(Definition* def) { @@ -1663,7 +1620,6 @@ bool IntegerInstructionSelector::IsUint32NarrowingDefinition(Definition* def) { return false; } - void IntegerInstructionSelector::FindUint32NarrowingDefinitions() { ASSERT(selected_uint32_defs_ != NULL); if (FLAG_trace_integer_ir_selection) { @@ -1681,7 +1637,6 @@ void IntegerInstructionSelector::FindUint32NarrowingDefinitions() { } } - bool IntegerInstructionSelector::AllUsesAreUint32Narrowing(Value* list_head) { for (Value::Iterator it(list_head); !it.Done(); it.Advance()) { Value* use = it.Current(); @@ -1694,7 +1649,6 @@ bool IntegerInstructionSelector::AllUsesAreUint32Narrowing(Value* list_head) { return true; } - bool IntegerInstructionSelector::CanBecomeUint32(Definition* def) { ASSERT(IsPotentialUint32Definition(def)); if (def->IsBoxInt64()) { @@ -1724,7 +1678,6 @@ bool IntegerInstructionSelector::CanBecomeUint32(Definition* def) { AllUsesAreUint32Narrowing(def->env_use_list()); } - void IntegerInstructionSelector::Propagate() { ASSERT(selected_uint32_defs_ != NULL); bool changed = true; @@ -1760,7 +1713,6 @@ void IntegerInstructionSelector::Propagate() { } } - Definition* IntegerInstructionSelector::ConstructReplacementFor( Definition* def) { // Should only see mint definitions. @@ -1800,7 +1752,6 @@ Definition* IntegerInstructionSelector::ConstructReplacementFor( return NULL; } - void IntegerInstructionSelector::ReplaceInstructions() { if (FLAG_trace_integer_ir_selection) { THR_Print("++++ Replacing instructions:\n"); @@ -1825,7 +1776,6 @@ void IntegerInstructionSelector::ReplaceInstructions() { } } - RangeBoundary RangeBoundary::FromDefinition(Definition* defn, int64_t offs) { if (defn->IsConstant() && defn->AsConstant()->value().IsSmi()) { return FromConstant(Smi::Cast(defn->AsConstant()->value()).Value() + offs); @@ -1833,7 +1783,6 @@ RangeBoundary RangeBoundary::FromDefinition(Definition* defn, int64_t offs) { return RangeBoundary(kSymbol, reinterpret_cast(defn), offs); } - RangeBoundary RangeBoundary::LowerBound() const { if (IsInfinity()) { return NegativeInfinity(); @@ -1843,7 +1792,6 @@ RangeBoundary RangeBoundary::LowerBound() const { RangeBoundary::FromConstant(offset_), NegativeInfinity()); } - RangeBoundary RangeBoundary::UpperBound() const { if (IsInfinity()) { return PositiveInfinity(); @@ -1854,7 +1802,6 @@ RangeBoundary RangeBoundary::UpperBound() const { RangeBoundary::FromConstant(offset_), PositiveInfinity()); } - RangeBoundary RangeBoundary::Add(const RangeBoundary& a, const RangeBoundary& b, const RangeBoundary& overflow) { @@ -1870,7 +1817,6 @@ RangeBoundary RangeBoundary::Add(const RangeBoundary& a, return RangeBoundary::FromConstant(result); } - RangeBoundary RangeBoundary::Sub(const RangeBoundary& a, const RangeBoundary& b, const RangeBoundary& overflow) { @@ -1885,7 +1831,6 @@ RangeBoundary RangeBoundary::Sub(const RangeBoundary& a, return RangeBoundary::FromConstant(result); } - bool RangeBoundary::SymbolicAdd(const RangeBoundary& a, const RangeBoundary& b, RangeBoundary* result) { @@ -1904,7 +1849,6 @@ bool RangeBoundary::SymbolicAdd(const RangeBoundary& a, return false; } - bool RangeBoundary::SymbolicSub(const RangeBoundary& a, const RangeBoundary& b, RangeBoundary* result) { @@ -1921,7 +1865,6 @@ bool RangeBoundary::SymbolicSub(const RangeBoundary& a, return false; } - bool RangeBoundary::Equals(const RangeBoundary& other) const { if (IsConstant() && other.IsConstant()) { return ConstantValue() == other.ConstantValue(); @@ -1935,7 +1878,6 @@ bool RangeBoundary::Equals(const RangeBoundary& other) const { return false; } - RangeBoundary RangeBoundary::Shl(const RangeBoundary& value_boundary, int64_t shift_count, const RangeBoundary& overflow) { @@ -1954,7 +1896,6 @@ RangeBoundary RangeBoundary::Shl(const RangeBoundary& value_boundary, return overflow; } - static RangeBoundary CanonicalizeBoundary(const RangeBoundary& a, const RangeBoundary& overflow) { if (a.IsConstant() || a.IsInfinity()) { @@ -2016,14 +1957,12 @@ static RangeBoundary CanonicalizeBoundary(const RangeBoundary& a, return RangeBoundary::FromDefinition(symbol, offset); } - static bool CanonicalizeMaxBoundary(RangeBoundary* a) { if (!a->IsSymbol()) return false; Range* range = a->symbol()->range(); if ((range == NULL) || !range->max().IsSymbol()) return false; - if (Utils::WillAddOverflow(range->max().offset(), a->offset())) { *a = RangeBoundary::PositiveInfinity(); return true; @@ -2038,7 +1977,6 @@ static bool CanonicalizeMaxBoundary(RangeBoundary* a) { return true; } - static bool CanonicalizeMinBoundary(RangeBoundary* a) { if (!a->IsSymbol()) return false; @@ -2083,7 +2021,6 @@ static bool CanonicalizeForComparison(RangeBoundary* a, return false; } - RangeBoundary RangeBoundary::JoinMin(RangeBoundary a, RangeBoundary b, RangeBoundary::RangeSize size) { @@ -2110,7 +2047,6 @@ RangeBoundary RangeBoundary::JoinMin(RangeBoundary a, } } - RangeBoundary RangeBoundary::JoinMax(RangeBoundary a, RangeBoundary b, RangeBoundary::RangeSize size) { @@ -2137,7 +2073,6 @@ RangeBoundary RangeBoundary::JoinMax(RangeBoundary a, } } - RangeBoundary RangeBoundary::IntersectionMin(RangeBoundary a, RangeBoundary b) { ASSERT(!a.IsPositiveInfinity() && !b.IsPositiveInfinity()); ASSERT(!a.IsUnknown() && !b.IsUnknown()); @@ -2163,7 +2098,6 @@ RangeBoundary RangeBoundary::IntersectionMin(RangeBoundary a, RangeBoundary b) { return (inf_a >= inf_b) ? a : b; } - RangeBoundary RangeBoundary::IntersectionMax(RangeBoundary a, RangeBoundary b) { ASSERT(!a.IsNegativeInfinity() && !b.IsNegativeInfinity()); ASSERT(!a.IsUnknown() && !b.IsUnknown()); @@ -2189,38 +2123,32 @@ RangeBoundary RangeBoundary::IntersectionMax(RangeBoundary a, RangeBoundary b) { return (sup_a <= sup_b) ? a : b; } - int64_t RangeBoundary::ConstantValue() const { ASSERT(IsConstant()); return value_; } - bool Range::IsPositive() const { return OnlyGreaterThanOrEqualTo(0); } - bool Range::OnlyLessThanOrEqualTo(int64_t val) const { const RangeBoundary upper_bound = max().UpperBound(); return !upper_bound.IsPositiveInfinity() && (upper_bound.ConstantValue() <= val); } - bool Range::OnlyGreaterThanOrEqualTo(int64_t val) const { const RangeBoundary lower_bound = min().LowerBound(); return !lower_bound.IsNegativeInfinity() && (lower_bound.ConstantValue() >= val); } - // Inclusive. bool Range::IsWithin(int64_t min_int, int64_t max_int) const { return OnlyGreaterThanOrEqualTo(min_int) && OnlyLessThanOrEqualTo(max_int); } - bool Range::Overlaps(int64_t min_int, int64_t max_int) const { RangeBoundary lower = min().LowerBound(); RangeBoundary upper = max().UpperBound(); @@ -2234,7 +2162,6 @@ bool Range::Overlaps(int64_t min_int, int64_t max_int) const { return false; } - bool Range::IsUnsatisfiable() const { // Infinity case: [+inf, ...] || [..., -inf] if (min().IsPositiveInfinity() || max().IsNegativeInfinity()) { @@ -2249,19 +2176,16 @@ bool Range::IsUnsatisfiable() const { return DependOnSameSymbol(min(), max()) && min().offset() > max().offset(); } - void Range::Clamp(RangeBoundary::RangeSize size) { min_ = min_.Clamp(size); max_ = max_.Clamp(size); } - void Range::ClampToConstant(RangeBoundary::RangeSize size) { min_ = min_.LowerBound().Clamp(size); max_ = max_.UpperBound().Clamp(size); } - void Range::Shl(const Range* left, const Range* right, RangeBoundary* result_min, @@ -2290,7 +2214,6 @@ void Range::Shl(const Range* left, : RangeBoundary::NegativeInfinity()); } - void Range::Shr(const Range* left, const Range* right, RangeBoundary* result_min, @@ -2311,7 +2234,6 @@ void Range::Shr(const Range* left, left_max, left_max.ConstantValue() > 0 ? right_min : right_max); } - void Range::And(const Range* left_range, const Range* right_range, RangeBoundary* result_min, @@ -2336,14 +2258,12 @@ void Range::And(const Range* left_range, BitwiseOp(left_range, right_range, result_min, result_max); } - static int BitSize(const Range* range) { const int64_t min = Range::ConstantMin(range).ConstantValue(); const int64_t max = Range::ConstantMax(range).ConstantValue(); return Utils::Maximum(Utils::BitLength(min), Utils::BitLength(max)); } - void Range::BitwiseOp(const Range* left_range, const Range* right_range, RangeBoundary* result_min, @@ -2361,7 +2281,6 @@ void Range::BitwiseOp(const Range* left_range, RangeBoundary::FromConstant((static_cast(1) << bitsize) - 1); } - static bool IsArrayLength(Definition* defn) { if (defn == NULL) { return false; @@ -2370,7 +2289,6 @@ static bool IsArrayLength(Definition* defn) { return (load != NULL) && load->IsImmutableLengthLoad(); } - void Range::Add(const Range* left_range, const Range* right_range, RangeBoundary* result_min, @@ -2401,7 +2319,6 @@ void Range::Add(const Range* left_range, } } - void Range::Sub(const Range* left_range, const Range* right_range, RangeBoundary* result_min, @@ -2432,7 +2349,6 @@ void Range::Sub(const Range* left_range, } } - void Range::Mul(const Range* left_range, const Range* right_range, RangeBoundary* result_min, @@ -2479,19 +2395,16 @@ void Range::Mul(const Range* left_range, *result_max = RangeBoundary::PositiveInfinity(); } - // Both the a and b ranges are >= 0. bool Range::OnlyPositiveOrZero(const Range& a, const Range& b) { return a.OnlyGreaterThanOrEqualTo(0) && b.OnlyGreaterThanOrEqualTo(0); } - // Both the a and b ranges are <= 0. bool Range::OnlyNegativeOrZero(const Range& a, const Range& b) { return a.OnlyLessThanOrEqualTo(0) && b.OnlyLessThanOrEqualTo(0); } - // Return the maximum absolute value included in range. int64_t Range::ConstantAbsMax(const Range* range) { if (range == NULL) { @@ -2502,7 +2415,6 @@ int64_t Range::ConstantAbsMax(const Range* range) { return Utils::Maximum(abs_min, abs_max); } - // Return the minimum absolute value included in range. int64_t Range::ConstantAbsMin(const Range* range) { if (range == NULL) { @@ -2513,7 +2425,6 @@ int64_t Range::ConstantAbsMin(const Range* range) { return Utils::Minimum(abs_min, abs_max); } - void Range::BinaryOp(const Token::Kind op, const Range* left_range, const Range* right_range, @@ -2571,7 +2482,6 @@ void Range::BinaryOp(const Token::Kind op, *result = Range(min, max); } - void Definition::set_range(const Range& range) { if (range_ == NULL) { range_ = new Range(); @@ -2579,7 +2489,6 @@ void Definition::set_range(const Range& range) { *range_ = range; } - void Definition::InferRange(RangeAnalysis* analysis, Range* range) { if (Type()->ToCid() == kSmiCid) { *range = Range::Full(RangeBoundary::kRangeBoundarySmi); @@ -2595,12 +2504,10 @@ void Definition::InferRange(RangeAnalysis* analysis, Range* range) { } } - static bool DependsOnSymbol(const RangeBoundary& a, Definition* symbol) { return a.IsSymbol() && (UnwrapConstraint(a.symbol()) == symbol); } - // Given the range and definition update the range so that // it covers both original range and definitions range. // @@ -2658,14 +2565,12 @@ static void Join(Range* range, } } - // A definition dominates a phi if its block dominates the phi's block // and the two blocks are different. static bool DominatesPhi(BlockEntryInstr* a, BlockEntryInstr* phi_block) { return a->Dominates(phi_block) && (a != phi_block); } - // When assigning range to a phi we must take care to avoid self-reference // cycles when phi's range depends on the phi itself. // To prevent such cases we impose additional restriction on symbols that @@ -2688,7 +2593,6 @@ static RangeBoundary EnsureAcyclicSymbol(BlockEntryInstr* phi_block, return limit; } - static const Range* GetInputRange(RangeAnalysis* analysis, RangeBoundary::RangeSize size, Value* input) { @@ -2705,7 +2609,6 @@ static const Range* GetInputRange(RangeAnalysis* analysis, } } - void PhiInstr::InferRange(RangeAnalysis* analysis, Range* range) { const RangeBoundary::RangeSize size = RangeSizeForPhi(this); for (intptr_t i = 0; i < InputCount(); i++) { @@ -2721,7 +2624,6 @@ void PhiInstr::InferRange(RangeAnalysis* analysis, Range* range) { EnsureAcyclicSymbol(phi_block, range->max(), RangeBoundary::MaxSmi())); } - void ConstantInstr::InferRange(RangeAnalysis* analysis, Range* range) { if (value_.IsSmi()) { int64_t value = Smi::Cast(value_).Value(); @@ -2737,7 +2639,6 @@ void ConstantInstr::InferRange(RangeAnalysis* analysis, Range* range) { } } - void ConstraintInstr::InferRange(RangeAnalysis* analysis, Range* range) { const Range* value_range = analysis->GetSmiRange(value()); if (Range::IsUnknown(value_range)) { @@ -2758,7 +2659,6 @@ void ConstraintInstr::InferRange(RangeAnalysis* analysis, Range* range) { *range = result; } - void LoadFieldInstr::InferRange(RangeAnalysis* analysis, Range* range) { switch (recognized_kind()) { case MethodRecognizer::kObjectArrayLength: @@ -2781,7 +2681,6 @@ void LoadFieldInstr::InferRange(RangeAnalysis* analysis, Range* range) { } } - void LoadIndexedInstr::InferRange(RangeAnalysis* analysis, Range* range) { switch (class_id()) { case kTypedDataInt8ArrayCid: @@ -2825,7 +2724,6 @@ void LoadIndexedInstr::InferRange(RangeAnalysis* analysis, Range* range) { } } - void LoadCodeUnitsInstr::InferRange(RangeAnalysis* analysis, Range* range) { ASSERT(RawObject::IsStringClassId(class_id())); switch (class_id()) { @@ -2842,7 +2740,6 @@ void LoadCodeUnitsInstr::InferRange(RangeAnalysis* analysis, Range* range) { } } - void IfThenElseInstr::InferRange(RangeAnalysis* analysis, Range* range) { const intptr_t min = Utils::Minimum(if_true_, if_false_); const intptr_t max = Utils::Maximum(if_true_, if_false_); @@ -2850,7 +2747,6 @@ void IfThenElseInstr::InferRange(RangeAnalysis* analysis, Range* range) { Range(RangeBoundary::FromConstant(min), RangeBoundary::FromConstant(max)); } - static RangeBoundary::RangeSize RepresentationToRangeSize(Representation r) { switch (r) { case kTagged: @@ -2865,7 +2761,6 @@ static RangeBoundary::RangeSize RepresentationToRangeSize(Representation r) { } } - void BinaryIntegerOpInstr::InferRangeHelper(const Range* left_range, const Range* right_range, Range* range) { @@ -2891,7 +2786,6 @@ void BinaryIntegerOpInstr::InferRangeHelper(const Range* left_range, range->Clamp(range_size); } - static void CacheRange(Range** slot, const Range* range, RangeBoundary::RangeSize size) { @@ -2908,7 +2802,6 @@ static void CacheRange(Range** slot, } } - void BinarySmiOpInstr::InferRange(RangeAnalysis* analysis, Range* range) { const Range* right_smi_range = analysis->GetSmiRange(right()); // TODO(vegorov) completely remove this once GetSmiRange is eliminated. @@ -2920,19 +2813,16 @@ void BinarySmiOpInstr::InferRange(RangeAnalysis* analysis, Range* range) { InferRangeHelper(analysis->GetSmiRange(left()), right_smi_range, range); } - void BinaryInt32OpInstr::InferRange(RangeAnalysis* analysis, Range* range) { InferRangeHelper(analysis->GetSmiRange(left()), analysis->GetSmiRange(right()), range); } - void BinaryMintOpInstr::InferRange(RangeAnalysis* analysis, Range* range) { InferRangeHelper(left()->definition()->range(), right()->definition()->range(), range); } - void ShiftMintOpInstr::InferRange(RangeAnalysis* analysis, Range* range) { CacheRange(&shift_range_, right()->definition()->range(), RangeBoundary::kRangeBoundaryInt64); @@ -2940,7 +2830,6 @@ void ShiftMintOpInstr::InferRange(RangeAnalysis* analysis, Range* range) { right()->definition()->range(), range); } - void BoxIntegerInstr::InferRange(RangeAnalysis* analysis, Range* range) { const Range* value_range = value()->definition()->range(); if (!Range::IsUnknown(value_range)) { @@ -2948,7 +2837,6 @@ void BoxIntegerInstr::InferRange(RangeAnalysis* analysis, Range* range) { } } - void UnboxInt32Instr::InferRange(RangeAnalysis* analysis, Range* range) { if (value()->Type()->ToCid() == kSmiCid) { const Range* value_range = analysis->GetSmiRange(value()); @@ -2967,7 +2855,6 @@ void UnboxInt32Instr::InferRange(RangeAnalysis* analysis, Range* range) { } } - void UnboxUint32Instr::InferRange(RangeAnalysis* analysis, Range* range) { const Range* value_range = NULL; @@ -2991,7 +2878,6 @@ void UnboxUint32Instr::InferRange(RangeAnalysis* analysis, Range* range) { } } - void UnboxInt64Instr::InferRange(RangeAnalysis* analysis, Range* range) { const Range* value_range = value()->definition()->range(); if (value_range != NULL) { @@ -3002,7 +2888,6 @@ void UnboxInt64Instr::InferRange(RangeAnalysis* analysis, Range* range) { } } - void UnboxedIntConverterInstr::InferRange(RangeAnalysis* analysis, Range* range) { ASSERT((from() == kUnboxedInt32) || (from() == kUnboxedMint) || @@ -3027,7 +2912,6 @@ void UnboxedIntConverterInstr::InferRange(RangeAnalysis* analysis, } } - bool CheckArrayBoundInstr::IsRedundant(const RangeBoundary& length) { Range* index_range = index()->definition()->range(); @@ -3081,5 +2965,4 @@ bool CheckArrayBoundInstr::IsRedundant(const RangeBoundary& length) { return false; } - } // namespace dart diff --git a/runtime/vm/flow_graph_range_analysis.h b/runtime/vm/flow_graph_range_analysis.h index 6690e18268e..09778a072e9 100644 --- a/runtime/vm/flow_graph_range_analysis.h +++ b/runtime/vm/flow_graph_range_analysis.h @@ -102,7 +102,6 @@ class RangeBoundary : public ValueObject { return FromConstant(kMaxInt64); } - // Given two boundaries a and b, select one of them as c so that // // inf {[a, ...) ^ [b, ...)} >= inf {c} @@ -286,7 +285,6 @@ class RangeBoundary : public ValueObject { int64_t offset_; }; - class Range : public ZoneAllocated { public: Range() : min_(), max_() {} @@ -363,7 +361,6 @@ class Range : public ZoneAllocated { return range->max().UpperBound().Clamp(size); } - // [0, +inf] bool IsPositive() const; @@ -458,7 +455,6 @@ class Range : public ZoneAllocated { RangeBoundary max_; }; - class RangeUtils : public AllStatic { public: static bool Fits(Range* range, RangeBoundary::RangeSize size) { @@ -484,7 +480,6 @@ class RangeUtils : public AllStatic { } }; - // Range analysis for integer values. class RangeAnalysis : public ValueObject { public: @@ -548,7 +543,6 @@ class RangeAnalysis : public ValueObject { Instruction* dom, Definition* other); - // Infer ranges for integer (smi or mint) definitions. void InferRanges(); @@ -608,7 +602,6 @@ class RangeAnalysis : public ValueObject { DISALLOW_COPY_AND_ASSIGN(RangeAnalysis); }; - // Replaces Mint IL instructions with Uint32 IL instructions // when possible. Uses output of RangeAnalysis. class IntegerInstructionSelector : public ValueObject { @@ -637,7 +630,6 @@ class IntegerInstructionSelector : public ValueObject { Zone* zone_; }; - } // namespace dart #endif // RUNTIME_VM_FLOW_GRAPH_RANGE_ANALYSIS_H_ diff --git a/runtime/vm/flow_graph_range_analysis_test.cc b/runtime/vm/flow_graph_range_analysis_test.cc index a15cea68aa3..6e01d2a0f5c 100644 --- a/runtime/vm/flow_graph_range_analysis_test.cc +++ b/runtime/vm/flow_graph_range_analysis_test.cc @@ -94,7 +94,6 @@ TEST_CASE(RangeTests) { #undef TEST_RANGE_OP } - TEST_CASE(RangeTestsInfinity) { // +/- inf overflowed. EXPECT(RangeBoundary::NegativeInfinity().OverflowedSmi()); @@ -152,7 +151,6 @@ TEST_CASE(RangeTestsInfinity) { EXPECT(unsatisfiable_left->IsUnsatisfiable()); } - TEST_CASE(RangeUtils) { // [-inf, +inf]. const Range& range_0 = *(new Range(RangeBoundary::NegativeInfinity(), @@ -238,7 +236,6 @@ TEST_CASE(RangeUtils) { RangeBoundary::PositiveInfinity())); } - TEST_CASE(RangeBinaryOp) { Range* range_a = new Range(RangeBoundary::FromConstant(-1), RangeBoundary::PositiveInfinity()); @@ -287,7 +284,6 @@ TEST_CASE(RangeBinaryOp) { } } - TEST_CASE(RangeAdd) { #define TEST_RANGE_ADD(l_min, l_max, r_min, r_max, result_min, result_max) \ { \ @@ -368,7 +364,6 @@ TEST_CASE(RangeAdd) { #undef TEST_RANGE_ADD } - TEST_CASE(RangeSub) { #define TEST_RANGE_SUB(l_min, l_max, r_min, r_max, result_min, result_max) \ { \ @@ -419,11 +414,9 @@ TEST_CASE(RangeSub) { RangeBoundary(static_cast(kMaxInt32) + 30), RangeBoundary(static_cast(kMaxInt32) + 40)); - #undef TEST_RANGE_SUB } - TEST_CASE(RangeAnd) { #define TEST_RANGE_AND(l_min, l_max, r_min, r_max, result_min, result_max) \ { \ @@ -478,7 +471,6 @@ TEST_CASE(RangeAnd) { #undef TEST_RANGE_AND } - TEST_CASE(RangeIntersectionMinMax) { // Test IntersectionMin and IntersectionMax methods which for constants are // simply defined as Max/Min respectively. @@ -558,7 +550,6 @@ TEST_CASE(RangeIntersectionMinMax) { .ConstantValue() == 1); } - TEST_CASE(RangeJoinMinMax) { // Test IntersectionMin and IntersectionMax methods which for constants are // simply defined as Min/Max respectively. diff --git a/runtime/vm/flow_graph_type_propagator.cc b/runtime/vm/flow_graph_type_propagator.cc index 88465a60263..c86ebb32cd9 100644 --- a/runtime/vm/flow_graph_type_propagator.cc +++ b/runtime/vm/flow_graph_type_propagator.cc @@ -4,8 +4,8 @@ #include "vm/flow_graph_type_propagator.h" -#include "vm/cha.h" #include "vm/bit_vector.h" +#include "vm/cha.h" #include "vm/il_printer.h" #include "vm/object_store.h" #include "vm/regexp_assembler.h" @@ -21,7 +21,6 @@ DEFINE_FLAG(bool, DECLARE_FLAG(bool, propagate_types); - void FlowGraphTypePropagator::Propagate(FlowGraph* flow_graph) { #ifndef PRODUCT Thread* thread = flow_graph->thread(); @@ -33,7 +32,6 @@ void FlowGraphTypePropagator::Propagate(FlowGraph* flow_graph) { propagator.Propagate(); } - FlowGraphTypePropagator::FlowGraphTypePropagator(FlowGraph* flow_graph) : FlowGraphVisitor(flow_graph->reverse_postorder()), flow_graph_(flow_graph), @@ -59,7 +57,6 @@ FlowGraphTypePropagator::FlowGraphTypePropagator(FlowGraph* flow_graph) } } - void FlowGraphTypePropagator::Propagate() { if (FLAG_support_il_printer && FLAG_trace_type_propagation && FlowGraphPrinter::ShouldPrint(flow_graph_->function())) { @@ -113,7 +110,6 @@ void FlowGraphTypePropagator::Propagate() { } } - void FlowGraphTypePropagator::PropagateRecursive(BlockEntryInstr* block) { if (visited_blocks_->Contains(block->postorder_number())) { return; @@ -157,7 +153,6 @@ void FlowGraphTypePropagator::PropagateRecursive(BlockEntryInstr* block) { RollbackTo(rollback_point); } - void FlowGraphTypePropagator::RollbackTo(intptr_t rollback_point) { for (intptr_t i = rollback_.length() - 1; i >= rollback_point; i--) { types_[rollback_[i].index()] = rollback_[i].type(); @@ -165,7 +160,6 @@ void FlowGraphTypePropagator::RollbackTo(intptr_t rollback_point) { rollback_.TruncateTo(rollback_point); } - CompileType* FlowGraphTypePropagator::TypeOf(Definition* def) { const intptr_t index = def->ssa_temp_index(); @@ -177,14 +171,12 @@ CompileType* FlowGraphTypePropagator::TypeOf(Definition* def) { return type; } - void FlowGraphTypePropagator::SetTypeOf(Definition* def, CompileType* type) { const intptr_t index = def->ssa_temp_index(); rollback_.Add(RollbackEntry(index, types_[index])); types_[index] = type; } - void FlowGraphTypePropagator::SetCid(Definition* def, intptr_t cid) { CompileType* current = TypeOf(def); if (current->IsNone() || (current->ToCid() != cid)) { @@ -192,7 +184,6 @@ void FlowGraphTypePropagator::SetCid(Definition* def, intptr_t cid) { } } - void FlowGraphTypePropagator::VisitValue(Value* value) { CompileType* type = TypeOf(value->definition()); value->SetReachingType(type); @@ -205,26 +196,22 @@ void FlowGraphTypePropagator::VisitValue(Value* value) { } } - void FlowGraphTypePropagator::VisitJoinEntry(JoinEntryInstr* join) { for (PhiIterator it(join); !it.Done(); it.Advance()) { worklist_.Add(it.Current()); } } - void FlowGraphTypePropagator::VisitCheckSmi(CheckSmiInstr* check) { SetCid(check->value()->definition(), kSmiCid); } - void FlowGraphTypePropagator::VisitCheckArrayBound( CheckArrayBoundInstr* check) { // Array bounds checks also test index for smi. SetCid(check->index()->definition(), kSmiCid); } - void FlowGraphTypePropagator::VisitCheckClass(CheckClassInstr* check) { if (!check->cids().IsMonomorphic()) { return; @@ -239,7 +226,6 @@ void FlowGraphTypePropagator::VisitCheckClass(CheckClassInstr* check) { SetCid(check->value()->definition(), check->cids().MonomorphicReceiverCid()); } - void FlowGraphTypePropagator::VisitCheckClassId(CheckClassIdInstr* check) { if (!check->Dependencies().IsNone()) { // TODO(vegorov): If check is affected by side-effect we can still propagate @@ -254,7 +240,6 @@ void FlowGraphTypePropagator::VisitCheckClassId(CheckClassIdInstr* check) { } } - void FlowGraphTypePropagator::CheckNonNullSelector( Instruction* call, Definition* receiver, @@ -286,7 +271,6 @@ void FlowGraphTypePropagator::CheckNonNullSelector( } } - void FlowGraphTypePropagator::VisitInstanceCall(InstanceCallInstr* instr) { if (instr->has_unique_selector()) { SetCid(instr->ArgumentAt(0), instr->ic_data()->GetReceiverClassIdAt(0)); @@ -295,7 +279,6 @@ void FlowGraphTypePropagator::VisitInstanceCall(InstanceCallInstr* instr) { CheckNonNullSelector(instr, instr->ArgumentAt(0), instr->function_name()); } - void FlowGraphTypePropagator::VisitPolymorphicInstanceCall( PolymorphicInstanceCallInstr* instr) { if (instr->instance_call()->has_unique_selector()) { @@ -306,7 +289,6 @@ void FlowGraphTypePropagator::VisitPolymorphicInstanceCall( instr->instance_call()->function_name()); } - void FlowGraphTypePropagator::VisitGuardFieldClass( GuardFieldClassInstr* guard) { const intptr_t cid = guard->field().guarded_cid(); @@ -325,14 +307,12 @@ void FlowGraphTypePropagator::VisitGuardFieldClass( } } - void FlowGraphTypePropagator::VisitAssertAssignable( AssertAssignableInstr* instr) { SetTypeOf(instr->value()->definition(), new CompileType(instr->ComputeType())); } - void FlowGraphTypePropagator::VisitBranch(BranchInstr* instr) { StrictCompareInstr* comparison = instr->comparison()->AsStrictCompare(); if (comparison == NULL) return; @@ -397,7 +377,6 @@ void FlowGraphTypePropagator::VisitBranch(BranchInstr* instr) { } } - void FlowGraphTypePropagator::AddToWorklist(Definition* defn) { if (defn->ssa_temp_index() == -1) { return; @@ -410,7 +389,6 @@ void FlowGraphTypePropagator::AddToWorklist(Definition* defn) { } } - Definition* FlowGraphTypePropagator::RemoveLastFromWorklist() { Definition* defn = worklist_.RemoveLast(); ASSERT(defn->ssa_temp_index() != -1); @@ -418,7 +396,6 @@ Definition* FlowGraphTypePropagator::RemoveLastFromWorklist() { return defn; } - // In the given block strengthen type assertions by hoisting first class or smi // check over the same value up to the point before the assertion. This allows // to eliminate type assertions that are postdominated by class or smi checks as @@ -449,7 +426,6 @@ void FlowGraphTypePropagator::StrengthenAsserts(BlockEntryInstr* block) { collected_asserts_->TruncateTo(0); } - void FlowGraphTypePropagator::StrengthenAssertWith(Instruction* check) { // Marker that is used to mark values that already had type assertion // strengthened. @@ -487,7 +463,6 @@ void FlowGraphTypePropagator::StrengthenAssertWith(Instruction* check) { (*asserts_)[defn->ssa_temp_index()] = kStrengthenedAssertMarker; } - void CompileType::Union(CompileType* other) { if (other->IsNone()) { return; @@ -529,59 +504,48 @@ void CompileType::Union(CompileType* other) { } } - static bool IsNullableCid(intptr_t cid) { ASSERT(cid != kIllegalCid); return cid == kNullCid || cid == kDynamicCid; } - CompileType CompileType::Create(intptr_t cid, const AbstractType& type) { return CompileType(IsNullableCid(cid), cid, &type); } - CompileType CompileType::FromAbstractType(const AbstractType& type, bool is_nullable) { return CompileType(is_nullable, kIllegalCid, &type); } - CompileType CompileType::FromCid(intptr_t cid) { return CompileType(IsNullableCid(cid), cid, NULL); } - CompileType CompileType::Dynamic() { return Create(kDynamicCid, Object::dynamic_type()); } - CompileType CompileType::Null() { return Create(kNullCid, Type::ZoneHandle(Type::NullType())); } - CompileType CompileType::Bool() { return Create(kBoolCid, Type::ZoneHandle(Type::BoolType())); } - CompileType CompileType::Int() { return FromAbstractType(Type::ZoneHandle(Type::Int64Type()), kNonNullable); } - CompileType CompileType::Smi() { return Create(kSmiCid, Type::ZoneHandle(Type::SmiType())); } - CompileType CompileType::String() { return FromAbstractType(Type::ZoneHandle(Type::StringType()), kNonNullable); } - intptr_t CompileType::ToCid() { if ((cid_ == kNullCid) || (cid_ == kDynamicCid)) { return cid_; @@ -590,7 +554,6 @@ intptr_t CompileType::ToCid() { return is_nullable_ ? static_cast(kDynamicCid) : ToNullableCid(); } - intptr_t CompileType::ToNullableCid() { if (cid_ == kIllegalCid) { if (type_ == NULL) { @@ -636,17 +599,14 @@ intptr_t CompileType::ToNullableCid() { return cid_; } - bool CompileType::HasDecidableNullability() { return !is_nullable_ || IsNull(); } - bool CompileType::IsNull() { return (ToCid() == kNullCid); } - const AbstractType* CompileType::ToAbstractType() { if (type_ == NULL) { // Type propagation has not run. Return dynamic-type. @@ -676,7 +636,6 @@ const AbstractType* CompileType::ToAbstractType() { return type_; } - bool CompileType::CanComputeIsInstanceOf(const AbstractType& type, bool is_nullable, bool* is_instance) { @@ -722,7 +681,6 @@ bool CompileType::CanComputeIsInstanceOf(const AbstractType& type, return *is_instance; } - bool CompileType::IsMoreSpecificThan(const AbstractType& other) { if (IsNone()) { return false; @@ -731,7 +689,6 @@ bool CompileType::IsMoreSpecificThan(const AbstractType& other) { return ToAbstractType()->IsMoreSpecificThan(other, NULL, NULL, Heap::kOld); } - CompileType* Value::Type() { if (reaching_type_ == NULL) { reaching_type_ = definition()->Type(); @@ -739,14 +696,12 @@ CompileType* Value::Type() { return reaching_type_; } - CompileType PhiInstr::ComputeType() const { // Initially type of phis is unknown until type propagation is run // for the first time. return CompileType::None(); } - bool PhiInstr::RecomputeType() { CompileType result = CompileType::None(); for (intptr_t i = 0; i < InputCount(); i++) { @@ -766,7 +721,6 @@ bool PhiInstr::RecomputeType() { return UpdateType(result); } - CompileType RedefinitionInstr::ComputeType() const { if (constrained_type_ != NULL) { // Check if the type associated with this redefinition is more specific @@ -798,17 +752,14 @@ CompileType RedefinitionInstr::ComputeType() const { return *value()->Type(); } - bool RedefinitionInstr::RecomputeType() { return UpdateType(ComputeType()); } - CompileType IfThenElseInstr::ComputeType() const { return CompileType::FromCid(kSmiCid); } - CompileType ParameterInstr::ComputeType() const { // Note that returning the declared type of the formal parameter would be // incorrect, because ParameterInstr is used as input to the type check @@ -893,12 +844,10 @@ CompileType ParameterInstr::ComputeType() const { return CompileType::Dynamic(); } - CompileType PushArgumentInstr::ComputeType() const { return CompileType::Dynamic(); } - CompileType ConstantInstr::ComputeType() const { if (value().IsNull()) { return CompileType::Null(); @@ -921,7 +870,6 @@ CompileType ConstantInstr::ComputeType() const { } } - CompileType AssertAssignableInstr::ComputeType() const { CompileType* value_type = value()->Type(); @@ -932,54 +880,44 @@ CompileType AssertAssignableInstr::ComputeType() const { return CompileType::Create(value_type->ToCid(), dst_type()); } - bool AssertAssignableInstr::RecomputeType() { return UpdateType(ComputeType()); } - CompileType AssertBooleanInstr::ComputeType() const { return CompileType::Bool(); } - CompileType BooleanNegateInstr::ComputeType() const { return CompileType::Bool(); } - CompileType InstanceOfInstr::ComputeType() const { return CompileType::Bool(); } - CompileType StrictCompareInstr::ComputeType() const { return CompileType::Bool(); } - CompileType TestSmiInstr::ComputeType() const { return CompileType::Bool(); } - CompileType TestCidsInstr::ComputeType() const { return CompileType::Bool(); } - CompileType EqualityCompareInstr::ComputeType() const { // Used for numeric comparisons only. return CompileType::Bool(); } - CompileType RelationalOpInstr::ComputeType() const { // Used for numeric comparisons only. return CompileType::Bool(); } - CompileType SpecialParameterInstr::ComputeType() const { switch (kind()) { case kContext: @@ -991,25 +929,21 @@ CompileType SpecialParameterInstr::ComputeType() const { return CompileType::Dynamic(); } - CompileType CloneContextInstr::ComputeType() const { return CompileType(CompileType::kNonNullable, kContextCid, &Object::dynamic_type()); } - CompileType AllocateContextInstr::ComputeType() const { return CompileType(CompileType::kNonNullable, kContextCid, &Object::dynamic_type()); } - CompileType AllocateUninitializedContextInstr::ComputeType() const { return CompileType(CompileType::kNonNullable, kContextCid, &Object::dynamic_type()); } - CompileType PolymorphicInstanceCallInstr::ComputeType() const { if (!IsSureToCallSingleRecognizedTarget()) return CompileType::Dynamic(); const Function& target = *targets_.TargetAt(0)->target; @@ -1018,7 +952,6 @@ CompileType PolymorphicInstanceCallInstr::ComputeType() const { : CompileType::Dynamic(); } - CompileType StaticCallInstr::ComputeType() const { if (result_cid_ != kDynamicCid) { return CompileType::FromCid(result_cid_); @@ -1035,7 +968,6 @@ CompileType StaticCallInstr::ComputeType() const { : CompileType::Dynamic(); } - CompileType LoadLocalInstr::ComputeType() const { if (Isolate::Current()->type_checks()) { return CompileType::FromAbstractType(local().type()); @@ -1043,34 +975,28 @@ CompileType LoadLocalInstr::ComputeType() const { return CompileType::Dynamic(); } - CompileType DropTempsInstr::ComputeType() const { return *value()->Type(); } - CompileType StoreLocalInstr::ComputeType() const { // Returns stored value. return *value()->Type(); } - CompileType OneByteStringFromCharCodeInstr::ComputeType() const { return CompileType::FromCid(kOneByteStringCid); } - CompileType StringToCharCodeInstr::ComputeType() const { return CompileType::FromCid(kSmiCid); } - CompileType StringInterpolateInstr::ComputeType() const { // TODO(srdjan): Do better and determine if it is a one or two byte string. return CompileType::String(); } - CompileType LoadStaticFieldInstr::ComputeType() const { bool is_nullable = CompileType::kNullable; intptr_t cid = kDynamicCid; @@ -1100,13 +1026,11 @@ CompileType LoadStaticFieldInstr::ComputeType() const { return CompileType(is_nullable, cid, abstract_type); } - CompileType CreateArrayInstr::ComputeType() const { // TODO(fschneider): Add abstract type and type arguments to the compile type. return CompileType::FromCid(kArrayCid); } - CompileType AllocateObjectInstr::ComputeType() const { if (!closure_function().IsNull()) { ASSERT(cls().id() == kClosureCid); @@ -1117,17 +1041,14 @@ CompileType AllocateObjectInstr::ComputeType() const { return CompileType::FromCid(cls().id()); } - CompileType LoadUntaggedInstr::ComputeType() const { return CompileType::Dynamic(); } - CompileType LoadClassIdInstr::ComputeType() const { return CompileType::FromCid(kSmiCid); } - CompileType LoadFieldInstr::ComputeType() const { // Type may be null if the field is a VM field, e.g. context parent. // Keep it as null for debug purposes and do not return dynamic in production @@ -1160,7 +1081,6 @@ CompileType LoadFieldInstr::ComputeType() const { return CompileType::Create(result_cid_, *abstract_type); } - CompileType LoadCodeUnitsInstr::ComputeType() const { switch (class_id()) { case kOneByteStringCid: @@ -1175,33 +1095,27 @@ CompileType LoadCodeUnitsInstr::ComputeType() const { } } - CompileType BinaryInt32OpInstr::ComputeType() const { // TODO(vegorov): range analysis information shall be used here. return CompileType::Int(); } - CompileType BinarySmiOpInstr::ComputeType() const { return CompileType::FromCid(kSmiCid); } - CompileType UnarySmiOpInstr::ComputeType() const { return CompileType::FromCid(kSmiCid); } - CompileType UnaryDoubleOpInstr::ComputeType() const { return CompileType::FromCid(kDoubleCid); } - CompileType DoubleToSmiInstr::ComputeType() const { return CompileType::FromCid(kSmiCid); } - CompileType ConstraintInstr::ComputeType() const { return CompileType::FromCid(kSmiCid); } @@ -1212,52 +1126,42 @@ CompileType BinaryMintOpInstr::ComputeType() const { return CompileType::Int(); } - CompileType ShiftMintOpInstr::ComputeType() const { return CompileType::Int(); } - CompileType UnaryMintOpInstr::ComputeType() const { return CompileType::Int(); } - CompileType BoxIntegerInstr::ComputeType() const { return ValueFitsSmi() ? CompileType::FromCid(kSmiCid) : CompileType::Int(); } - bool BoxIntegerInstr::RecomputeType() { return UpdateType(ComputeType()); } - CompileType UnboxIntegerInstr::ComputeType() const { return CompileType::Int(); } - CompileType DoubleToIntegerInstr::ComputeType() const { return CompileType::Int(); } - CompileType BinaryDoubleOpInstr::ComputeType() const { return CompileType::FromCid(kDoubleCid); } - CompileType DoubleTestOpInstr::ComputeType() const { return CompileType::FromCid(kBoolCid); } - CompileType BinaryFloat32x4OpInstr::ComputeType() const { return CompileType::FromCid(kFloat32x4Cid); } - CompileType Simd32x4ShuffleInstr::ComputeType() const { if ((op_kind() == MethodRecognizer::kFloat32x4ShuffleX) || (op_kind() == MethodRecognizer::kFloat32x4ShuffleY) || @@ -1272,7 +1176,6 @@ CompileType Simd32x4ShuffleInstr::ComputeType() const { return CompileType::FromCid(kFloat32x4Cid); } - CompileType Simd32x4ShuffleMixInstr::ComputeType() const { if (op_kind() == MethodRecognizer::kInt32x4ShuffleMix) { return CompileType::FromCid(kInt32x4Cid); @@ -1281,67 +1184,54 @@ CompileType Simd32x4ShuffleMixInstr::ComputeType() const { return CompileType::FromCid(kFloat32x4Cid); } - CompileType Simd32x4GetSignMaskInstr::ComputeType() const { return CompileType::Int(); } - CompileType Float32x4ConstructorInstr::ComputeType() const { return CompileType::FromCid(kFloat32x4Cid); } - CompileType Float32x4ZeroInstr::ComputeType() const { return CompileType::FromCid(kFloat32x4Cid); } - CompileType Float32x4SplatInstr::ComputeType() const { return CompileType::FromCid(kFloat32x4Cid); } - CompileType Float32x4ComparisonInstr::ComputeType() const { return CompileType::FromCid(kInt32x4Cid); } - CompileType Float32x4MinMaxInstr::ComputeType() const { return CompileType::FromCid(kFloat32x4Cid); } - CompileType Float32x4ScaleInstr::ComputeType() const { return CompileType::FromCid(kFloat32x4Cid); } - CompileType Float32x4SqrtInstr::ComputeType() const { return CompileType::FromCid(kFloat32x4Cid); } - CompileType Float32x4ZeroArgInstr::ComputeType() const { return CompileType::FromCid(kFloat32x4Cid); } - CompileType Float32x4ClampInstr::ComputeType() const { return CompileType::FromCid(kFloat32x4Cid); } - CompileType Float32x4WithInstr::ComputeType() const { return CompileType::FromCid(kFloat32x4Cid); } - CompileType Float32x4ToInt32x4Instr::ComputeType() const { return CompileType::FromCid(kInt32x4Cid); } - CompileType Simd64x2ShuffleInstr::ComputeType() const { if ((op_kind() == MethodRecognizer::kFloat64x2GetX) || (op_kind() == MethodRecognizer::kFloat64x2GetY)) { @@ -1351,32 +1241,26 @@ CompileType Simd64x2ShuffleInstr::ComputeType() const { return CompileType::FromCid(kDoubleCid); } - CompileType Float64x2ZeroInstr::ComputeType() const { return CompileType::FromCid(kFloat64x2Cid); } - CompileType Float64x2SplatInstr::ComputeType() const { return CompileType::FromCid(kFloat64x2Cid); } - CompileType Float64x2ConstructorInstr::ComputeType() const { return CompileType::FromCid(kFloat64x2Cid); } - CompileType Float32x4ToFloat64x2Instr::ComputeType() const { return CompileType::FromCid(kFloat64x2Cid); } - CompileType Float64x2ToFloat32x4Instr::ComputeType() const { return CompileType::FromCid(kFloat32x4Cid); } - CompileType Float64x2ZeroArgInstr::ComputeType() const { if (op_kind() == MethodRecognizer::kFloat64x2GetSignMask) { return CompileType::Int(); @@ -1384,67 +1268,54 @@ CompileType Float64x2ZeroArgInstr::ComputeType() const { return CompileType::FromCid(kFloat64x2Cid); } - CompileType Float64x2OneArgInstr::ComputeType() const { return CompileType::FromCid(kFloat64x2Cid); } - CompileType Int32x4ConstructorInstr::ComputeType() const { return CompileType::FromCid(kInt32x4Cid); } - CompileType Int32x4BoolConstructorInstr::ComputeType() const { return CompileType::FromCid(kInt32x4Cid); } - CompileType Int32x4GetFlagInstr::ComputeType() const { return CompileType::FromCid(kBoolCid); } - CompileType Int32x4SelectInstr::ComputeType() const { return CompileType::FromCid(kFloat32x4Cid); } - CompileType Int32x4SetFlagInstr::ComputeType() const { return CompileType::FromCid(kInt32x4Cid); } - CompileType Int32x4ToFloat32x4Instr::ComputeType() const { return CompileType::FromCid(kFloat32x4Cid); } - CompileType BinaryInt32x4OpInstr::ComputeType() const { return CompileType::FromCid(kInt32x4Cid); } - CompileType BinaryFloat64x2OpInstr::ComputeType() const { return CompileType::FromCid(kFloat64x2Cid); } - CompileType MathUnaryInstr::ComputeType() const { return CompileType::FromCid(kDoubleCid); } - CompileType MathMinMaxInstr::ComputeType() const { return CompileType::FromCid(result_cid_); } - CompileType CaseInsensitiveCompareUC16Instr::ComputeType() const { return CompileType::FromCid(kBoolCid); } - CompileType UnboxInstr::ComputeType() const { switch (representation()) { case kUnboxedDouble: @@ -1468,7 +1339,6 @@ CompileType UnboxInstr::ComputeType() const { } } - CompileType BoxInstr::ComputeType() const { switch (from_representation()) { case kUnboxedDouble: @@ -1489,48 +1359,39 @@ CompileType BoxInstr::ComputeType() const { } } - CompileType Int32ToDoubleInstr::ComputeType() const { return CompileType::FromCid(kDoubleCid); } - CompileType SmiToDoubleInstr::ComputeType() const { return CompileType::FromCid(kDoubleCid); } - CompileType MintToDoubleInstr::ComputeType() const { return CompileType::FromCid(kDoubleCid); } - CompileType DoubleToDoubleInstr::ComputeType() const { return CompileType::FromCid(kDoubleCid); } - CompileType FloatToDoubleInstr::ComputeType() const { return CompileType::FromCid(kDoubleCid); } - CompileType DoubleToFloatInstr::ComputeType() const { // Type is double when converted back. return CompileType::FromCid(kDoubleCid); } - CompileType InvokeMathCFunctionInstr::ComputeType() const { return CompileType::FromCid(kDoubleCid); } - CompileType TruncDivModInstr::ComputeType() const { return CompileType::Dynamic(); } - CompileType ExtractNthOutputInstr::ComputeType() const { return CompileType::FromCid(definition_cid_); } diff --git a/runtime/vm/freelist.cc b/runtime/vm/freelist.cc index 221a5ea4bf9..61435807ccc 100644 --- a/runtime/vm/freelist.cc +++ b/runtime/vm/freelist.cc @@ -13,7 +13,6 @@ namespace dart { - FreeListElement* FreeListElement::AsElement(uword addr, intptr_t size) { // Precondition: the (page containing the) header of the element is // writable. @@ -43,37 +42,31 @@ FreeListElement* FreeListElement::AsElement(uword addr, intptr_t size) { // writable. } - void FreeListElement::InitOnce() { ASSERT(sizeof(FreeListElement) == kObjectAlignment); ASSERT(OFFSET_OF(FreeListElement, tags_) == Object::tags_offset()); } - intptr_t FreeListElement::HeaderSizeFor(intptr_t size) { if (size == 0) return 0; return ((size > RawObject::SizeTag::kMaxSizeTag) ? 3 : 2) * kWordSize; } - FreeList::FreeList() : mutex_(new Mutex()), freelist_search_budget_(kInitialFreeListSearchBudget) { Reset(); } - FreeList::~FreeList() { delete mutex_; } - uword FreeList::TryAllocate(intptr_t size, bool is_protected) { MutexLocker ml(mutex_); return TryAllocateLocked(size, is_protected); } - uword FreeList::TryAllocateLocked(intptr_t size, bool is_protected) { DEBUG_ASSERT(mutex_->IsOwnedByCurrentThread()); // Precondition: is_protected is false or else all free list elements are @@ -189,13 +182,11 @@ uword FreeList::TryAllocateLocked(intptr_t size, bool is_protected) { return 0; } - void FreeList::Free(uword addr, intptr_t size) { MutexLocker ml(mutex_); FreeLocked(addr, size); } - void FreeList::FreeLocked(uword addr, intptr_t size) { DEBUG_ASSERT(mutex_->IsOwnedByCurrentThread()); // Precondition required by AsElement and EnqueueElement: the (page @@ -209,7 +200,6 @@ void FreeList::FreeLocked(uword addr, intptr_t size) { // Postcondition: the (page containing the) header is left writable. } - void FreeList::Reset() { MutexLocker ml(mutex_); free_map_.Reset(); @@ -219,7 +209,6 @@ void FreeList::Reset() { } } - intptr_t FreeList::IndexForSize(intptr_t size) { ASSERT(size >= kObjectAlignment); ASSERT(Utils::IsAligned(size, kObjectAlignment)); @@ -231,7 +220,6 @@ intptr_t FreeList::IndexForSize(intptr_t size) { return index; } - void FreeList::EnqueueElement(FreeListElement* element, intptr_t index) { FreeListElement* next = free_lists_[index]; if (next == NULL && index != kNumLists) { @@ -243,7 +231,6 @@ void FreeList::EnqueueElement(FreeListElement* element, intptr_t index) { free_lists_[index] = element; } - FreeListElement* FreeList::DequeueElement(intptr_t index) { FreeListElement* result = free_lists_[index]; FreeListElement* next = result->next(); @@ -261,7 +248,6 @@ FreeListElement* FreeList::DequeueElement(intptr_t index) { return result; } - intptr_t FreeList::LengthLocked(int index) const { DEBUG_ASSERT(mutex_->IsOwnedByCurrentThread()); ASSERT(index >= 0); @@ -275,7 +261,6 @@ intptr_t FreeList::LengthLocked(int index) const { return result; } - void FreeList::PrintSmall() const { int small_sizes = 0; int small_objects = 0; @@ -298,7 +283,6 @@ void FreeList::PrintSmall() const { } } - class IntptrPair { public: IntptrPair() : first_(-1), second_(-1) {} @@ -322,7 +306,6 @@ class IntptrPair { intptr_t second_; }; - void FreeList::PrintLarge() const { int large_sizes = 0; int large_objects = 0; @@ -357,14 +340,12 @@ void FreeList::PrintLarge() const { } } - void FreeList::Print() const { MutexLocker ml(mutex_); PrintSmall(); PrintLarge(); } - void FreeList::SplitElementAfterAndEnqueue(FreeListElement* element, intptr_t size, bool is_protected) { @@ -392,13 +373,11 @@ void FreeList::SplitElementAfterAndEnqueue(FreeListElement* element, } } - FreeListElement* FreeList::TryAllocateLarge(intptr_t minimum_size) { MutexLocker ml(mutex_); return TryAllocateLargeLocked(minimum_size); } - FreeListElement* FreeList::TryAllocateLargeLocked(intptr_t minimum_size) { DEBUG_ASSERT(mutex_->IsOwnedByCurrentThread()); FreeListElement* previous = NULL; @@ -428,7 +407,6 @@ FreeListElement* FreeList::TryAllocateLargeLocked(intptr_t minimum_size) { return NULL; } - uword FreeList::TryAllocateSmallLocked(intptr_t size) { DEBUG_ASSERT(mutex_->IsOwnedByCurrentThread()); if (size > last_free_small_size_) { diff --git a/runtime/vm/freelist.h b/runtime/vm/freelist.h index cbd7656181c..e5fa43dc743 100644 --- a/runtime/vm/freelist.h +++ b/runtime/vm/freelist.h @@ -8,8 +8,8 @@ #include "platform/assert.h" #include "vm/allocation.h" #include "vm/bit_set.h" -#include "vm/raw_object.h" #include "vm/os_thread.h" +#include "vm/raw_object.h" namespace dart { @@ -74,7 +74,6 @@ class FreeListElement { DISALLOW_IMPLICIT_CONSTRUCTORS(FreeListElement); }; - class FreeList { public: FreeList(); diff --git a/runtime/vm/freelist_test.cc b/runtime/vm/freelist_test.cc index 4b240eb141a..60394661d9b 100644 --- a/runtime/vm/freelist_test.cc +++ b/runtime/vm/freelist_test.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "platform/assert.h" #include "vm/freelist.h" +#include "platform/assert.h" #include "vm/unit_test.h" namespace dart { @@ -18,7 +18,6 @@ static uword Allocate(FreeList* free_list, intptr_t size, bool is_protected) { return result; } - static void Free(FreeList* free_list, uword address, intptr_t size, @@ -36,7 +35,6 @@ static void Free(FreeList* free_list, } } - static void TestFreeList(VirtualMemory* region, FreeList* free_list, bool is_protected) { @@ -96,7 +94,6 @@ TEST_CASE(FreeList) { delete free_list; } - TEST_CASE(FreeListProtected) { FreeList* free_list = new FreeList(); const intptr_t kBlobSize = 1 * MB; @@ -110,7 +107,6 @@ TEST_CASE(FreeListProtected) { delete free_list; } - TEST_CASE(FreeListProtectedTinyObjects) { FreeList* free_list = new FreeList(); const intptr_t kBlobSize = 1 * MB; @@ -148,7 +144,6 @@ TEST_CASE(FreeListProtectedTinyObjects) { delete[] objects; } - TEST_CASE(FreeListProtectedVariableSizeObjects) { FreeList* free_list = new FreeList(); const intptr_t kBlobSize = 8 * KB; diff --git a/runtime/vm/gc_marker.cc b/runtime/vm/gc_marker.cc index 95acfbbbad4..0acd8bc76ac 100644 --- a/runtime/vm/gc_marker.cc +++ b/runtime/vm/gc_marker.cc @@ -8,6 +8,7 @@ #include "vm/dart_api_state.h" #include "vm/isolate.h" #include "vm/log.h" +#include "vm/object_id_ring.h" #include "vm/pages.h" #include "vm/raw_object.h" #include "vm/stack_frame.h" @@ -17,7 +18,6 @@ #include "vm/thread_registry.h" #include "vm/timeline.h" #include "vm/visitor.h" -#include "vm/object_id_ring.h" namespace dart { @@ -85,7 +85,6 @@ class SkippedCodeFunctions : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(SkippedCodeFunctions); }; - class MarkerWorkList : public ValueObject { public: explicit MarkerWorkList(MarkingStack* marking_stack) @@ -137,7 +136,6 @@ class MarkerWorkList : public ValueObject { MarkingStack* marking_stack_; }; - template class MarkingVisitorBase : public ObjectPointerVisitor { public: @@ -416,11 +414,9 @@ class MarkingVisitorBase : public ObjectPointerVisitor { DISALLOW_IMPLICIT_CONSTRUCTORS(MarkingVisitorBase); }; - typedef MarkingVisitorBase UnsyncMarkingVisitor; typedef MarkingVisitorBase SyncMarkingVisitor; - static bool IsUnreachable(const RawObject* raw_obj) { if (!raw_obj->IsHeapObject()) { return false; @@ -434,7 +430,6 @@ static bool IsUnreachable(const RawObject* raw_obj) { return !raw_obj->IsMarked(); } - class MarkingWeakVisitor : public HandleVisitor { public: explicit MarkingWeakVisitor(Thread* thread) : HandleVisitor(thread) {} @@ -452,7 +447,6 @@ class MarkingWeakVisitor : public HandleVisitor { DISALLOW_COPY_AND_ASSIGN(MarkingWeakVisitor); }; - void GCMarker::Prologue(Isolate* isolate, bool invoke_api_callbacks) { if (invoke_api_callbacks && (isolate->gc_prologue_callback() != NULL)) { (isolate->gc_prologue_callback())(); @@ -462,14 +456,12 @@ void GCMarker::Prologue(Isolate* isolate, bool invoke_api_callbacks) { isolate->store_buffer()->Reset(); } - void GCMarker::Epilogue(Isolate* isolate, bool invoke_api_callbacks) { if (invoke_api_callbacks && (isolate->gc_epilogue_callback() != NULL)) { (isolate->gc_epilogue_callback())(); } } - void GCMarker::IterateRoots(Isolate* isolate, ObjectPointerVisitor* visitor, intptr_t slice_index, @@ -487,14 +479,12 @@ void GCMarker::IterateRoots(Isolate* isolate, // slices are empty. } - void GCMarker::IterateWeakRoots(Isolate* isolate, HandleVisitor* visitor) { ApiState* state = isolate->api_state(); ASSERT(state != NULL); isolate->VisitWeakPersistentHandles(visitor); } - void GCMarker::ProcessWeakTables(PageSpace* page_space) { for (int sel = 0; sel < Heap::kNumWeakSelectors; sel++) { WeakTable* table = @@ -512,13 +502,11 @@ void GCMarker::ProcessWeakTables(PageSpace* page_space) { } } - class ObjectIdRingClearPointerVisitor : public ObjectPointerVisitor { public: explicit ObjectIdRingClearPointerVisitor(Isolate* isolate) : ObjectPointerVisitor(isolate) {} - void VisitPointers(RawObject** first, RawObject** last) { for (RawObject** current = first; current <= last; current++) { RawObject* raw_obj = *current; @@ -531,7 +519,6 @@ class ObjectIdRingClearPointerVisitor : public ObjectPointerVisitor { } }; - void GCMarker::ProcessObjectIdTable(Isolate* isolate) { #ifndef PRODUCT if (!FLAG_support_service) { @@ -544,7 +531,6 @@ void GCMarker::ProcessObjectIdTable(Isolate* isolate) { #endif // !PRODUCT } - class MarkTask : public ThreadPool::Task { public: MarkTask(GCMarker* marker, @@ -668,7 +654,6 @@ class MarkTask : public ThreadPool::Task { DISALLOW_COPY_AND_ASSIGN(MarkTask); }; - template void GCMarker::FinalizeResultsFrom(MarkingVisitorType* visitor) { { @@ -690,7 +675,6 @@ void GCMarker::FinalizeResultsFrom(MarkingVisitorType* visitor) { visitor->Finalize(); } - void GCMarker::MarkObjects(Isolate* isolate, PageSpace* page_space, bool invoke_api_callbacks, diff --git a/runtime/vm/gc_sweeper.cc b/runtime/vm/gc_sweeper.cc index 2860292406e..cb1d34a5831 100644 --- a/runtime/vm/gc_sweeper.cc +++ b/runtime/vm/gc_sweeper.cc @@ -72,7 +72,6 @@ bool GCSweeper::SweepPage(HeapPage* page, FreeList* freelist, bool locked) { return in_use; } - intptr_t GCSweeper::SweepLargePage(HeapPage* page) { intptr_t words_to_end = 0; RawObject* raw_obj = RawObject::FromAddr(page->object_start()); @@ -96,7 +95,6 @@ intptr_t GCSweeper::SweepLargePage(HeapPage* page) { return words_to_end; } - class SweeperTask : public ThreadPool::Task { public: SweeperTask(Isolate* isolate, @@ -168,7 +166,6 @@ class SweeperTask : public ThreadPool::Task { FreeList* freelist_; }; - void GCSweeper::SweepConcurrent(Isolate* isolate, HeapPage* first, HeapPage* last, diff --git a/runtime/vm/gdb_helpers.cc b/runtime/vm/gdb_helpers.cc index b50d912e0ed..a15676cb957 100644 --- a/runtime/vm/gdb_helpers.cc +++ b/runtime/vm/gdb_helpers.cc @@ -15,13 +15,11 @@ void _printRawObject(RawObject* object) { OS::PrintErr("%s\n", Object::Handle(object).ToCString()); } - DART_EXPORT Object* _handle(RawObject* object) { return &Object::Handle(object); } - // An utility method for convenient printing of dart stack traces when // inside 'gdb'. Note: This function will only work when there is a // valid exit frame information. It will not work when a breakpoint is @@ -33,7 +31,6 @@ void _printDartStackTrace() { OS::PrintErr("=== Current Trace:\n%s===\n", stacktrace.ToCString()); } - // Like _printDartStackTrace, but works in a NoSafepointScope. Use it if you're // in the middle of a GC or interested in stub frames. DART_EXPORT @@ -48,7 +45,6 @@ void _printStackTrace() { } } - class PrintObjectPointersVisitor : public ObjectPointerVisitor { public: PrintObjectPointersVisitor() : ObjectPointerVisitor(Isolate::Current()) {} @@ -61,7 +57,6 @@ class PrintObjectPointersVisitor : public ObjectPointerVisitor { } }; - DART_EXPORT void _printStackTraceWithLocals() { PrintObjectPointersVisitor visitor; diff --git a/runtime/vm/globals.h b/runtime/vm/globals.h index 16c0df193a8..00088390a54 100644 --- a/runtime/vm/globals.h +++ b/runtime/vm/globals.h @@ -43,7 +43,6 @@ const intptr_t kSmiMin32 = -(static_cast(1) << kSmiBits32); ((sizeof(array) / sizeof(*(array))) / \ static_cast(!(sizeof(array) % sizeof(*(array))))) // NOLINT - #if defined(ARCH_IS_64_BIT) #define HASH_IN_OBJECT_HEADER 1 #endif @@ -76,12 +75,10 @@ const intptr_t kOffsetOfPtr = 32; return reinterpret_cast(result); \ } while (0) - // A type large enough to contain the value of the C++ vtable. This is needed // to support the handle operations. typedef uword cpp_vtable; - // When using GCC we can use GCC attributes to ensure that certain // constants are 8 or 16 byte aligned. #if defined(HOST_OS_WINDOWS) @@ -92,7 +89,6 @@ typedef uword cpp_vtable; #define ALIGN16 __attribute__((aligned(16))) #endif - // Zap value used to indicate uninitialized handle area (debug purposes). #if defined(ARCH_IS_32_BIT) static const uword kZapUninitializedWord = 0xabababab; @@ -100,7 +96,6 @@ static const uword kZapUninitializedWord = 0xabababab; static const uword kZapUninitializedWord = 0xabababababababab; #endif - // Macros to get the contents of the fp register. #if defined(HOST_OS_WINDOWS) diff --git a/runtime/vm/growable_array.h b/runtime/vm/growable_array.h index b8e27a30f77..4788bffa624 100644 --- a/runtime/vm/growable_array.h +++ b/runtime/vm/growable_array.h @@ -31,7 +31,6 @@ class GrowableArray : public BaseGrowableArray { ASSERT_NOTNULL(Thread::Current()->zone())) {} }; - template class ZoneGrowableArray : public BaseGrowableArray { public: @@ -47,7 +46,6 @@ class ZoneGrowableArray : public BaseGrowableArray { ASSERT_NOTNULL(Thread::Current()->zone())) {} }; - // T must be a Handle type. template class BaseGrowableHandlePtrArray : public B { @@ -77,7 +75,6 @@ class BaseGrowableHandlePtrArray : public B { DISALLOW_COPY_AND_ASSIGN(BaseGrowableHandlePtrArray); }; - template class GrowableHandlePtrArray : public BaseGrowableHandlePtrArray { @@ -86,7 +83,6 @@ class GrowableHandlePtrArray : BaseGrowableHandlePtrArray(zone, initial_capacity) {} }; - template class ZoneGrowableHandlePtrArray : public BaseGrowableHandlePtrArray { diff --git a/runtime/vm/growable_array_test.cc b/runtime/vm/growable_array_test.cc index 4a9782de529..75ec5514959 100644 --- a/runtime/vm/growable_array_test.cc +++ b/runtime/vm/growable_array_test.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "platform/assert.h" #include "vm/growable_array.h" +#include "platform/assert.h" #include "vm/unit_test.h" namespace dart { @@ -62,17 +62,14 @@ void TestGrowableArray() { EXPECT(h.is_empty()); } - TEST_CASE(GrowableArray) { TestGrowableArray, GrowableArray >(); } - TEST_CASE(MallocGrowableArray) { TestGrowableArray, MallocGrowableArray >(); } - static int greatestFirst(const int* a, const int* b) { if (*a > *b) { return -1; @@ -94,7 +91,6 @@ TEST_CASE(GrowableArraySort) { EXPECT_EQ(4, g.Last()); } - TEST_CASE(GrowableHandlePtr) { Zone* zone = Thread::Current()->zone(); GrowableHandlePtrArray test1(zone, 1); diff --git a/runtime/vm/guard_field_test.cc b/runtime/vm/guard_field_test.cc index 54815b8240c..098825541f3 100644 --- a/runtime/vm/guard_field_test.cc +++ b/runtime/vm/guard_field_test.cc @@ -26,7 +26,6 @@ RawField* LookupField(Dart_Handle library, return field.raw(); } - TEST_CASE(GuardFieldSimpleTest) { const char* script_chars = "class A {\n" @@ -77,7 +76,6 @@ TEST_CASE(GuardFieldSimpleTest) { EXPECT_EQ(no_length, f3.guarded_list_length()); } - TEST_CASE(GuardFieldFinalListTest) { const char* script_chars = "class A {\n" @@ -130,7 +128,6 @@ TEST_CASE(GuardFieldFinalListTest) { EXPECT_EQ(false, f3.is_nullable()); } - TEST_CASE(GuardFieldFinalVariableLengthListTest) { const char* script_chars = "class A {\n" @@ -183,7 +180,6 @@ TEST_CASE(GuardFieldFinalVariableLengthListTest) { EXPECT_EQ(false, f3.is_nullable()); } - TEST_CASE(GuardFieldConstructorTest) { const char* script_chars = "import 'dart:typed_data';\n" @@ -241,7 +237,6 @@ TEST_CASE(GuardFieldConstructorTest) { EXPECT_EQ(false, f3.is_nullable()); } - TEST_CASE(GuardFieldConstructor2Test) { const char* script_chars = "import 'dart:typed_data';\n" diff --git a/runtime/vm/handles.cc b/runtime/vm/handles.cc index f3818d7cc69..866260a4206 100644 --- a/runtime/vm/handles.cc +++ b/runtime/vm/handles.cc @@ -19,7 +19,6 @@ namespace dart { DEFINE_FLAG(bool, verify_handles, false, "Verify handles."); - VMHandles::~VMHandles() { if (FLAG_trace_handles) { OS::PrintErr("*** Handle Counts for 0x(%" Px "):Zone = %d,Scoped = %d\n", @@ -30,13 +29,11 @@ VMHandles::~VMHandles() { } } - void VMHandles::VisitObjectPointers(ObjectPointerVisitor* visitor) { return Handles::VisitObjectPointers(visitor); } - #if defined(DEBUG) static bool IsCurrentApiNativeScope(Zone* zone) { ApiNativeScope* scope = ApiNativeScope::Current(); @@ -44,27 +41,23 @@ static bool IsCurrentApiNativeScope(Zone* zone) { } #endif // DEBUG - uword VMHandles::AllocateHandle(Zone* zone) { DEBUG_ASSERT(!IsCurrentApiNativeScope(zone)); return Handles::AllocateHandle(zone); } - uword VMHandles::AllocateZoneHandle(Zone* zone) { DEBUG_ASSERT(!IsCurrentApiNativeScope(zone)); return Handles::AllocateZoneHandle(zone); } - bool VMHandles::IsZoneHandle(uword handle) { return Handles::IsZoneHandle(handle); } - int VMHandles::ScopedHandleCount() { Thread* thread = Thread::Current(); ASSERT(thread->zone() != NULL); @@ -72,7 +65,6 @@ int VMHandles::ScopedHandleCount() { return handles->CountScopedHandles(); } - int VMHandles::ZoneHandleCount() { Thread* thread = Thread::Current(); ASSERT(thread->zone() != NULL); @@ -80,7 +72,6 @@ int VMHandles::ZoneHandleCount() { return handles->CountZoneHandles(); } - void HandleScope::Initialize() { ASSERT(thread()->no_handle_scope_depth() == 0); VMHandles* handles = thread()->zone()->handles(); @@ -93,12 +84,10 @@ void HandleScope::Initialize() { #endif } - HandleScope::HandleScope(Thread* thread) : StackResource(thread) { Initialize(); } - HandleScope::~HandleScope() { ASSERT(thread()->zone() != NULL); VMHandles* handles = thread()->zone()->handles(); @@ -113,13 +102,11 @@ HandleScope::~HandleScope() { #endif } - #if defined(DEBUG) NoHandleScope::NoHandleScope(Thread* thread) : StackResource(thread) { thread->IncrementNoHandleScopeDepth(); } - NoHandleScope::~NoHandleScope() { thread()->DecrementNoHandleScopeDepth(); } diff --git a/runtime/vm/handles.h b/runtime/vm/handles.h index b96a3bf88c2..374181a1363 100644 --- a/runtime/vm/handles.h +++ b/runtime/vm/handles.h @@ -55,7 +55,6 @@ namespace dart { // .... // } - // Forward declarations. class ObjectPointerVisitor; class Thread; @@ -77,7 +76,6 @@ class HandleVisitor { DISALLOW_IMPLICIT_CONSTRUCTORS(HandleVisitor); }; - template class Handles { public: @@ -239,7 +237,6 @@ class Handles { DISALLOW_COPY_AND_ASSIGN(Handles); }; - static const int kVMHandleSizeInWords = 2; static const int kVMHandlesPerChunk = 64; static const int kOffsetOfRawPtr = kWordSize; @@ -281,7 +278,6 @@ class VMHandles : public Handles:: VisitScopedHandles(visitor); } - template void Handles:: VisitScopedHandles(ObjectPointerVisitor* visitor) { @@ -40,7 +39,6 @@ void Handles:: UNREACHABLE(); } - template void Handles::Visit( HandleVisitor* visitor) { @@ -59,7 +57,6 @@ void Handles::Visit( } while (block != NULL); } - template void Handles::Reset() { // Delete all the extra zone handle blocks allocated and reinit the first @@ -76,7 +73,6 @@ void Handles::Reset() { scoped_blocks_ = &first_scoped_block_; } - // Figure out the current handle scope using the current Zone and // allocate a handle in that scope. The function assumes that a // current handle scope exists. It asserts for this appropriately. @@ -93,7 +89,6 @@ uword Handles:: return handles->AllocateScopedHandle(); } - // The function assumes that 'zone' is the current zone and asserts for // this appropriately. template @@ -110,7 +105,6 @@ uword Handles:: return address; } - // Figure out the current zone using the current Thread and // check if the specified handle has been allocated in this zone. template @@ -126,7 +120,6 @@ bool Handles:: return handles->IsValidZoneHandle(handle); } - template void Handles:: DeleteAll() { @@ -144,7 +137,6 @@ void Handles:: scoped_blocks_ = &first_scoped_block_; } - template void Handles:: DeleteHandleBlocks(HandlesBlock* blocks) { @@ -155,7 +147,6 @@ void Handles:: } } - template void Handles:: SetupNextScopeBlock() { @@ -174,7 +165,6 @@ void Handles:: #endif } - // Validation of the handle involves iterating through all the // handle blocks to check if the handle is valid, please // use this only in ASSERT code for verification purposes. @@ -191,7 +181,6 @@ bool Handles:: return false; } - template bool Handles:: IsValidZoneHandle(uword handle) const { @@ -205,7 +194,6 @@ bool Handles:: return false; } - template void Handles:: SetupNextZoneBlock() { @@ -218,7 +206,6 @@ void Handles:: ASSERT(zone_blocks_ != NULL); } - #if defined(DEBUG) template void Handles:: @@ -234,7 +221,6 @@ void Handles:: ASSERT(false); } - template void Handles:: ZapFreeScopedHandles() { @@ -246,7 +232,6 @@ void Handles:: } #endif - template int Handles:: CountScopedHandles() const { @@ -263,7 +248,6 @@ int Handles:: return 0; } - template int Handles:: CountZoneHandles() const { @@ -276,7 +260,6 @@ int Handles:: return count; } - template Handles::HandlesBlock:: ~HandlesBlock() { @@ -285,7 +268,6 @@ Handles::HandlesBlock:: #endif } - template void Handles:: HandlesBlock::ReInit() { @@ -296,7 +278,6 @@ void Handles:: #endif } - template void Handles:: HandlesBlock::VisitObjectPointers(ObjectPointerVisitor* visitor) { @@ -307,7 +288,6 @@ void Handles:: } } - template void Handles:: HandlesBlock::Visit(HandleVisitor* visitor) { @@ -317,7 +297,6 @@ void Handles:: } } - #if defined(DEBUG) template void Handles:: @@ -330,7 +309,6 @@ void Handles:: } #endif - template int Handles:: HandlesBlock::HandleCount() const { diff --git a/runtime/vm/handles_test.cc b/runtime/vm/handles_test.cc index 6c472b1d77b..0c6348258d8 100644 --- a/runtime/vm/handles_test.cc +++ b/runtime/vm/handles_test.cc @@ -2,10 +2,10 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +#include "vm/handles.h" #include "platform/assert.h" #include "vm/dart_api_state.h" #include "vm/flags.h" -#include "vm/handles.h" #include "vm/heap.h" #include "vm/object.h" #include "vm/unit_test.h" @@ -37,7 +37,6 @@ TEST_CASE(AllocateZoneHandle) { EXPECT_EQ((2 * kNumHandles) + initial_count, VMHandles::ZoneHandleCount()); } - // Unit test for Scope handle allocation. TEST_CASE(AllocateScopeHandle) { #if defined(DEBUG) @@ -78,12 +77,10 @@ TEST_CASE(AllocateScopeHandle) { EXPECT_EQ(handle_count, VMHandles::ScopedHandleCount()); } - static void NoopCallback(void* isolate_callback_data, Dart_WeakPersistentHandle handle, void* peer) {} - // Unit test for handle validity checks. TEST_CASE(CheckHandleValidity) { #if defined(DEBUG) diff --git a/runtime/vm/hash_map.h b/runtime/vm/hash_map.h index 3bb99649bf0..4e6b0bc647a 100644 --- a/runtime/vm/hash_map.h +++ b/runtime/vm/hash_map.h @@ -113,7 +113,6 @@ class BaseDirectChainedHashMap : public B { Allocator* allocator_; }; - template BaseDirectChainedHashMap::BaseDirectChainedHashMap( const BaseDirectChainedHashMap& other) @@ -131,7 +130,6 @@ BaseDirectChainedHashMap::BaseDirectChainedHashMap( memmove(lists_, other.lists_, lists_size_ * sizeof(HashMapListElement)); } - template typename KeyValueTrait::Pair* BaseDirectChainedHashMap::Lookup( @@ -157,7 +155,6 @@ BaseDirectChainedHashMap::Lookup( return NULL; } - template typename KeyValueTrait::Value BaseDirectChainedHashMap::LookupValue( @@ -168,7 +165,6 @@ BaseDirectChainedHashMap::LookupValue( return (pair == NULL) ? kNoValue : KeyValueTrait::ValueOf(*pair); } - template typename KeyValueTrait::Pair* BaseDirectChainedHashMap::Iterator::Next() { @@ -203,7 +199,6 @@ BaseDirectChainedHashMap::Iterator::Next() { return NULL; } - template void BaseDirectChainedHashMap::Resize( intptr_t new_size) { @@ -253,7 +248,6 @@ void BaseDirectChainedHashMap::Resize( allocator_->template Free(old_array, old_size); } - template void BaseDirectChainedHashMap::ResizeLists( intptr_t new_size) { @@ -279,7 +273,6 @@ void BaseDirectChainedHashMap::ResizeLists( allocator_->template Free(old_lists, old_size); } - template void BaseDirectChainedHashMap::Insert( typename KeyValueTrait::Pair kv) { @@ -311,7 +304,6 @@ void BaseDirectChainedHashMap::Insert( } } - template bool BaseDirectChainedHashMap::Remove( typename KeyValueTrait::Key key) { @@ -373,7 +365,6 @@ bool BaseDirectChainedHashMap::Remove( return true; } - template class DirectChainedHashMap : public BaseDirectChainedHashMap { @@ -387,7 +378,6 @@ class DirectChainedHashMap ASSERT_NOTNULL(zone)) {} }; - template class MallocDirectChainedHashMap : public BaseDirectChainedHashMap { @@ -396,7 +386,6 @@ class MallocDirectChainedHashMap : BaseDirectChainedHashMap(NULL) {} }; - template class PointerKeyValueTrait { public: @@ -413,7 +402,6 @@ class PointerKeyValueTrait { static inline bool IsKeyEqual(Pair kv, Key key) { return kv->Equals(key); } }; - template class NumbersKeyValueTrait { public: @@ -427,7 +415,6 @@ class NumbersKeyValueTrait { static inline bool IsKeyEqual(Pair kv, Key key) { return kv.first() == key; } }; - template class RawPointerKeyValueTrait { public: diff --git a/runtime/vm/hash_map_test.cc b/runtime/vm/hash_map_test.cc index 2f49b362983..6a1e4f3a4a0 100644 --- a/runtime/vm/hash_map_test.cc +++ b/runtime/vm/hash_map_test.cc @@ -2,9 +2,9 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +#include "vm/hash_map.h" #include "platform/assert.h" #include "vm/unit_test.h" -#include "vm/hash_map.h" namespace dart { @@ -18,7 +18,6 @@ class TestValue { intptr_t x_; }; - TEST_CASE(DirectChainedHashMap) { DirectChainedHashMap > map; EXPECT(map.IsEmpty()); @@ -40,7 +39,6 @@ TEST_CASE(DirectChainedHashMap) { EXPECT(map2.LookupValue(&v3) == &v1); } - TEST_CASE(DirectChainedHashMapInsertRemove) { DirectChainedHashMap > map; EXPECT(map.IsEmpty()); @@ -98,7 +96,6 @@ TEST_CASE(DirectChainedHashMapInsertRemove) { EXPECT(map.IsEmpty()); } - TEST_CASE(MallocDirectChainedHashMap) { MallocDirectChainedHashMap > map; EXPECT(map.IsEmpty()); @@ -117,7 +114,6 @@ TEST_CASE(MallocDirectChainedHashMap) { EXPECT(map2.LookupValue(&v3) == &v1); } - class IntptrPair { public: IntptrPair() : first_(-1), second_(-1) {} @@ -140,7 +136,6 @@ class IntptrPair { intptr_t second_; }; - TEST_CASE(DirectChainedHashMapIterator) { IntptrPair p1(1, 1); IntptrPair p2(2, 2); diff --git a/runtime/vm/hash_table.h b/runtime/vm/hash_table.h index 61db8304785..06b97d3ad87 100644 --- a/runtime/vm/hash_table.h +++ b/runtime/vm/hash_table.h @@ -55,7 +55,6 @@ namespace dart { // KeyTraits methods must not run Dart code (since the C++ code doesn't check // for concurrent modification). - // Open-addressing hash table template using a RawArray as backing storage. // // The elements of the array are partitioned into entries: @@ -383,7 +382,6 @@ class HashTable : public ValueObject { friend class HashTables; }; - // Table with unspecified iteration order. No payload overhead or metadata. template class UnorderedHashTable : public HashTable { @@ -419,7 +417,6 @@ class UnorderedHashTable : public HashTable { // No extra book-keeping needed for Initialize, InsertKey, DeleteEntry. }; - class HashTables : public AllStatic { public: // Allocates and initializes a table. @@ -503,7 +500,6 @@ class HashTables : public AllStatic { } }; - template class HashMap : public BaseIterTable { public: @@ -589,7 +585,6 @@ class HashMap : public BaseIterTable { } }; - template class UnorderedHashMap : public HashMap > { public: @@ -601,7 +596,6 @@ class UnorderedHashMap : public HashMap > { : BaseMap(key, value, data) {} }; - template class HashSet : public BaseIterTable { public: @@ -678,7 +672,6 @@ class HashSet : public BaseIterTable { } }; - template class UnorderedHashSet : public HashSet > { public: diff --git a/runtime/vm/hash_table_test.cc b/runtime/vm/hash_table_test.cc index 9c8daca94d4..88858d39e1b 100644 --- a/runtime/vm/hash_table_test.cc +++ b/runtime/vm/hash_table_test.cc @@ -11,8 +11,8 @@ #include #include "platform/assert.h" -#include "vm/unit_test.h" #include "vm/hash_table.h" +#include "vm/unit_test.h" namespace dart { @@ -35,7 +35,6 @@ class TestTraits { static RawObject* NewKey(const char* key) { return String::New(key); } }; - template void Validate(const Table& table) { // Verify consistency of entry state tracking. @@ -54,7 +53,6 @@ void Validate(const Table& table) { EXPECT_EQ(0, num_deleted); } - TEST_CASE(HashTable) { typedef HashTable Table; Table table(Thread::Current()->zone(), HashTables::New(5)); @@ -115,7 +113,6 @@ TEST_CASE(HashTable) { table.Release(); } - std::string ToStdString(const String& str) { EXPECT(str.IsOneByteString()); std::string result; @@ -125,7 +122,6 @@ std::string ToStdString(const String& str) { return result; } - // Checks that 'expected' and 'actual' are equal sets. If 'ordered' is true, // it also verifies that their iteration orders match, i.e., that actual's // insertion order coincides with lexicographic order. @@ -156,7 +152,6 @@ void VerifyStringSetsEqual(const std::set& expected, std::equal(actual_vec.begin(), actual_vec.end(), expected_vec.begin())); } - // Checks that 'expected' and 'actual' are equal maps. If 'ordered' is true, // it also verifies that their iteration orders match, i.e., that actual's // insertion order coincides with lexicographic order. @@ -193,7 +188,6 @@ void VerifyStringMapsEqual(const std::map& expected, } } - template void TestSet(intptr_t initial_capacity, bool ordered) { std::set expected; @@ -219,7 +213,6 @@ void TestSet(intptr_t initial_capacity, bool ordered) { actual.Release(); } - template void TestMap(intptr_t initial_capacity, bool ordered) { std::map expected; @@ -250,7 +243,6 @@ void TestMap(intptr_t initial_capacity, bool ordered) { actual.Release(); } - TEST_CASE(Sets) { for (intptr_t initial_capacity = 0; initial_capacity < 32; ++initial_capacity) { @@ -258,7 +250,6 @@ TEST_CASE(Sets) { } } - TEST_CASE(Maps) { for (intptr_t initial_capacity = 0; initial_capacity < 32; ++initial_capacity) { diff --git a/runtime/vm/heap.cc b/runtime/vm/heap.cc index f73af75a691..9d741133bed 100644 --- a/runtime/vm/heap.cc +++ b/runtime/vm/heap.cc @@ -47,7 +47,6 @@ Heap::Heap(Isolate* isolate, stats_.num_ = 0; } - Heap::~Heap() { delete barrier_; delete barrier_done_; @@ -58,7 +57,6 @@ Heap::~Heap() { } } - uword Heap::AllocateNew(intptr_t size) { ASSERT(Thread::Current()->no_safepoint_scope_depth() == 0); // Currently, only the Dart thread may allocate in new space. @@ -77,7 +75,6 @@ uword Heap::AllocateNew(intptr_t size) { return addr; } - uword Heap::AllocateOld(intptr_t size, HeapPage::PageType type) { ASSERT(Thread::Current()->no_safepoint_scope_depth() == 0); uword addr = old_space_.TryAllocate(size, type); @@ -125,7 +122,6 @@ uword Heap::AllocateOld(intptr_t size, HeapPage::PageType type) { return 0; } - void Heap::AllocateExternal(intptr_t size, Space space) { ASSERT(Thread::Current()->no_safepoint_scope_depth() == 0); if (space == kNew) { @@ -163,44 +159,36 @@ bool Heap::Contains(uword addr) const { return new_space_.Contains(addr) || old_space_.Contains(addr); } - bool Heap::NewContains(uword addr) const { return new_space_.Contains(addr); } - bool Heap::OldContains(uword addr) const { return old_space_.Contains(addr); } - bool Heap::CodeContains(uword addr) const { return old_space_.Contains(addr, HeapPage::kExecutable); } - bool Heap::DataContains(uword addr) const { return old_space_.DataContains(addr); } - void Heap::VisitObjects(ObjectVisitor* visitor) const { new_space_.VisitObjects(visitor); old_space_.VisitObjects(visitor); } - void Heap::VisitObjectsNoImagePages(ObjectVisitor* visitor) const { new_space_.VisitObjects(visitor); old_space_.VisitObjectsNoImagePages(visitor); } - void Heap::VisitObjectsImagePages(ObjectVisitor* visitor) const { old_space_.VisitObjectsImagePages(visitor); } - HeapIterationScope::HeapIterationScope(bool writable) : StackResource(Thread::Current()), old_space_(isolate()->heap()->old_space()), @@ -228,7 +216,6 @@ HeapIterationScope::HeapIterationScope(bool writable) } } - HeapIterationScope::~HeapIterationScope() { if (writable_) { thread()->heap()->WriteProtectCode(true); @@ -244,7 +231,6 @@ HeapIterationScope::~HeapIterationScope() { ml.NotifyAll(); } - void Heap::IterateObjects(ObjectVisitor* visitor) const { // The visitor must not allocate from the heap. NoSafepointScope no_safepoint_scope_; @@ -252,25 +238,21 @@ void Heap::IterateObjects(ObjectVisitor* visitor) const { IterateOldObjects(visitor); } - void Heap::IterateOldObjects(ObjectVisitor* visitor) const { HeapIterationScope heap_iteration_scope; old_space_.VisitObjects(visitor); } - void Heap::IterateOldObjectsNoImagePages(ObjectVisitor* visitor) const { HeapIterationScope heap_iteration_scope; old_space_.VisitObjectsNoImagePages(visitor); } - void Heap::VisitObjectPointers(ObjectPointerVisitor* visitor) const { new_space_.VisitObjectPointers(visitor); old_space_.VisitObjectPointers(visitor); } - RawInstructions* Heap::FindObjectInCodeSpace(FindObjectVisitor* visitor) const { // Only executable pages can have RawInstructions objects. RawObject* raw_obj = old_space_.FindObject(visitor, HeapPage::kExecutable); @@ -279,18 +261,15 @@ RawInstructions* Heap::FindObjectInCodeSpace(FindObjectVisitor* visitor) const { return reinterpret_cast(raw_obj); } - RawObject* Heap::FindOldObject(FindObjectVisitor* visitor) const { HeapIterationScope heap_iteration_scope; return old_space_.FindObject(visitor, HeapPage::kData); } - RawObject* Heap::FindNewObject(FindObjectVisitor* visitor) const { return new_space_.FindObject(visitor); } - RawObject* Heap::FindObject(FindObjectVisitor* visitor) const { // The visitor must not allocate from the heap. NoSafepointScope no_safepoint_scope; @@ -306,7 +285,6 @@ RawObject* Heap::FindObject(FindObjectVisitor* visitor) const { return raw_obj; } - bool Heap::BeginNewSpaceGC(Thread* thread) { MonitorLocker ml(&gc_in_progress_monitor_); bool start_gc_on_thread = true; @@ -321,7 +299,6 @@ bool Heap::BeginNewSpaceGC(Thread* thread) { return false; } - void Heap::EndNewSpaceGC() { MonitorLocker ml(&gc_in_progress_monitor_); ASSERT(gc_new_space_in_progress_); @@ -329,7 +306,6 @@ void Heap::EndNewSpaceGC() { ml.NotifyAll(); } - bool Heap::BeginOldSpaceGC(Thread* thread) { MonitorLocker ml(&gc_in_progress_monitor_); bool start_gc_on_thread = true; @@ -344,7 +320,6 @@ bool Heap::BeginOldSpaceGC(Thread* thread) { return false; } - void Heap::EndOldSpaceGC() { MonitorLocker ml(&gc_in_progress_monitor_); ASSERT(gc_old_space_in_progress_); @@ -352,7 +327,6 @@ void Heap::EndOldSpaceGC() { ml.NotifyAll(); } - #ifndef PRODUCT void Heap::UpdateClassHeapStatsBeforeGC(Heap::Space space) { ClassTable* class_table = isolate()->class_table(); @@ -364,7 +338,6 @@ void Heap::UpdateClassHeapStatsBeforeGC(Heap::Space space) { } #endif - void Heap::EvacuateNewSpace(Thread* thread, GCReason reason) { ASSERT(reason == kFull); if (BeginNewSpaceGC(thread)) { @@ -381,7 +354,6 @@ void Heap::EvacuateNewSpace(Thread* thread, GCReason reason) { } } - void Heap::CollectNewSpaceGarbage(Thread* thread, ApiCallbacks api_callbacks, GCReason reason) { @@ -405,7 +377,6 @@ void Heap::CollectNewSpaceGarbage(Thread* thread, } } - void Heap::CollectOldSpaceGarbage(Thread* thread, ApiCallbacks api_callbacks, GCReason reason) { @@ -427,7 +398,6 @@ void Heap::CollectOldSpaceGarbage(Thread* thread, } } - void Heap::CollectGarbage(Space space, ApiCallbacks api_callbacks, GCReason reason) { @@ -447,7 +417,6 @@ void Heap::CollectGarbage(Space space, } } - void Heap::CollectGarbage(Space space) { Thread* thread = Thread::Current(); if (space == kOld) { @@ -458,7 +427,6 @@ void Heap::CollectGarbage(Space space) { } } - void Heap::CollectAllGarbage() { Thread* thread = Thread::Current(); @@ -468,7 +436,6 @@ void Heap::CollectAllGarbage() { CollectOldSpaceGarbage(thread, kInvokeApiCallbacks, kFull); } - void Heap::WaitForSweeperTasks(Thread* thread) { MonitorLocker ml(old_space_.tasks_lock()); while (old_space_.tasks() > 0) { @@ -476,7 +443,6 @@ void Heap::WaitForSweeperTasks(Thread* thread) { } } - void Heap::UpdateGlobalMaxUsed() { ASSERT(isolate_ != NULL); // We are accessing the used in words count for both new and old space @@ -486,29 +452,24 @@ void Heap::UpdateGlobalMaxUsed() { (UsedInWords(Heap::kOld) * kWordSize)); } - void Heap::InitGrowthControl() { old_space_.InitGrowthControl(); } - void Heap::SetGrowthControlState(bool state) { old_space_.SetGrowthControlState(state); } - bool Heap::GrowthControlState() { return old_space_.GrowthControlState(); } - void Heap::WriteProtect(bool read_only) { read_only_ = read_only; new_space_.WriteProtect(read_only); old_space_.WriteProtect(read_only); } - intptr_t Heap::TopOffset(Heap::Space space) { if (space == kNew) { return OFFSET_OF(Heap, new_space_) + Scavenger::top_offset(); @@ -518,7 +479,6 @@ intptr_t Heap::TopOffset(Heap::Space space) { } } - intptr_t Heap::EndOffset(Heap::Space space) { if (space == kNew) { return OFFSET_OF(Heap, new_space_) + Scavenger::end_offset(); @@ -528,7 +488,6 @@ intptr_t Heap::EndOffset(Heap::Space space) { } } - void Heap::Init(Isolate* isolate, intptr_t max_new_gen_words, intptr_t max_old_gen_words, @@ -539,7 +498,6 @@ void Heap::Init(Isolate* isolate, isolate->set_heap(heap); } - void Heap::RegionName(Heap* heap, Space space, char* name, intptr_t name_size) { const bool no_isolate_name = (heap == NULL) || (heap->isolate() == NULL) || (heap->isolate()->debugger_name() == NULL); @@ -562,13 +520,11 @@ void Heap::RegionName(Heap* heap, Space space, char* name, intptr_t name_size) { OS::SNPrint(name, name_size, "dart-%s %s", space_name, isolate_name); } - void Heap::AddRegionsToObjectSet(ObjectSet* set) const { new_space_.AddRegionsToObjectSet(set); old_space_.AddRegionsToObjectSet(set); } - ObjectSet* Heap::CreateAllocatedObjectSet( Zone* zone, MarkExpectation mark_expectation) const { @@ -598,13 +554,11 @@ ObjectSet* Heap::CreateAllocatedObjectSet( return allocated_set; } - bool Heap::Verify(MarkExpectation mark_expectation) const { HeapIterationScope heap_iteration_scope; return VerifyGC(mark_expectation); } - bool Heap::VerifyGC(MarkExpectation mark_expectation) const { StackZone stack_zone(Thread::Current()); ObjectSet* allocated_set = @@ -616,7 +570,6 @@ bool Heap::VerifyGC(MarkExpectation mark_expectation) const { return true; } - void Heap::PrintSizes() const { OS::PrintErr( "New space (%" Pd64 "k of %" Pd64 @@ -626,24 +579,20 @@ void Heap::PrintSizes() const { (UsedInWords(kOld) / KBInWords), (CapacityInWords(kOld) / KBInWords)); } - int64_t Heap::UsedInWords(Space space) const { return space == kNew ? new_space_.UsedInWords() : old_space_.UsedInWords(); } - int64_t Heap::CapacityInWords(Space space) const { return space == kNew ? new_space_.CapacityInWords() : old_space_.CapacityInWords(); } - int64_t Heap::ExternalInWords(Space space) const { return space == kNew ? new_space_.ExternalInWords() : old_space_.ExternalInWords(); } - int64_t Heap::GCTimeInMicros(Space space) const { if (space == kNew) { return new_space_.gc_time_micros(); @@ -651,7 +600,6 @@ int64_t Heap::GCTimeInMicros(Space space) const { return old_space_.gc_time_micros(); } - intptr_t Heap::Collections(Space space) const { if (space == kNew) { return new_space_.collections(); @@ -659,7 +607,6 @@ intptr_t Heap::Collections(Space space) const { return old_space_.collections(); } - const char* Heap::GCReasonToString(GCReason gc_reason) { switch (gc_reason) { case kNewSpace: @@ -680,7 +627,6 @@ const char* Heap::GCReasonToString(GCReason gc_reason) { } } - int64_t Heap::PeerCount() const { return new_weak_tables_[kPeers]->count() + old_weak_tables_[kPeers]->count(); } @@ -692,19 +638,16 @@ int64_t Heap::HashCount() const { } #endif - int64_t Heap::ObjectIdCount() const { return new_weak_tables_[kObjectIds]->count() + old_weak_tables_[kObjectIds]->count(); } - void Heap::ResetObjectIdTable() { new_weak_tables_[kObjectIds]->Reset(); old_weak_tables_[kObjectIds]->Reset(); } - intptr_t Heap::GetWeakEntry(RawObject* raw_obj, WeakSelector sel) const { if (raw_obj->IsNewObject()) { return new_weak_tables_[sel]->GetValue(raw_obj); @@ -713,7 +656,6 @@ intptr_t Heap::GetWeakEntry(RawObject* raw_obj, WeakSelector sel) const { return old_weak_tables_[sel]->GetValue(raw_obj); } - void Heap::SetWeakEntry(RawObject* raw_obj, WeakSelector sel, intptr_t val) { if (raw_obj->IsNewObject()) { new_weak_tables_[sel]->SetValue(raw_obj, val); @@ -723,7 +665,6 @@ void Heap::SetWeakEntry(RawObject* raw_obj, WeakSelector sel, intptr_t val) { } } - #ifndef PRODUCT void Heap::PrintToJSONObject(Space space, JSONObject* object) const { if (space == kNew) { @@ -734,7 +675,6 @@ void Heap::PrintToJSONObject(Space space, JSONObject* object) const { } #endif // PRODUCT - void Heap::RecordBeforeGC(Space space, GCReason reason) { ASSERT((space == kNew && gc_new_space_in_progress_) || (space == kOld && gc_old_space_in_progress_)); @@ -750,7 +690,6 @@ void Heap::RecordBeforeGC(Space space, GCReason reason) { stats_.data_[i] = 0; } - void Heap::RecordAfterGC(Space space) { stats_.after_.micros_ = OS::GetCurrentMonotonicMicros(); int64_t delta = stats_.after_.micros_ - stats_.before_.micros_; @@ -775,7 +714,6 @@ void Heap::RecordAfterGC(Space space) { #endif // !PRODUCT } - void Heap::PrintStats() { if (!FLAG_verbose_gc) return; @@ -842,7 +780,6 @@ void Heap::PrintStats() { // clang-format on } - void Heap::PrintStatsToTimeline(TimelineEventScope* event) { #if !defined(PRODUCT) if ((event == NULL) || !event->enabled()) { @@ -878,7 +815,6 @@ void Heap::PrintStatsToTimeline(TimelineEventScope* event) { #endif // !defined(PRODUCT) } - NoHeapGrowthControlScope::NoHeapGrowthControlScope() : StackResource(Thread::Current()) { Heap* heap = reinterpret_cast(isolate())->heap(); @@ -886,19 +822,16 @@ NoHeapGrowthControlScope::NoHeapGrowthControlScope() heap->DisableGrowthControl(); } - NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { Heap* heap = reinterpret_cast(isolate())->heap(); heap->SetGrowthControlState(current_growth_controller_state_); } - WritableVMIsolateScope::WritableVMIsolateScope(Thread* thread) : StackResource(thread) { Dart::vm_isolate()->heap()->WriteProtect(false); } - WritableVMIsolateScope::~WritableVMIsolateScope() { ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); Dart::vm_isolate()->heap()->WriteProtect(true); diff --git a/runtime/vm/heap.h b/runtime/vm/heap.h index 6c68d0fcba6..4fff18f22d4 100644 --- a/runtime/vm/heap.h +++ b/runtime/vm/heap.h @@ -315,7 +315,6 @@ class Heap { // ensure thread-safety. bool VerifyGC(MarkExpectation mark_expectation = kForbidMarked) const; - // Helper functions for garbage collection. void CollectNewSpaceGarbage(Thread* thread, ApiCallbacks api_callbacks, @@ -375,7 +374,6 @@ class Heap { DISALLOW_COPY_AND_ASSIGN(Heap); }; - class HeapIterationScope : public StackResource { public: explicit HeapIterationScope(bool writable = false); @@ -389,7 +387,6 @@ class HeapIterationScope : public StackResource { DISALLOW_COPY_AND_ASSIGN(HeapIterationScope); }; - class NoHeapGrowthControlScope : public StackResource { public: NoHeapGrowthControlScope(); @@ -400,7 +397,6 @@ class NoHeapGrowthControlScope : public StackResource { DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); }; - // Note: During this scope, the code pages are non-executable. class WritableVMIsolateScope : StackResource { public: diff --git a/runtime/vm/heap_test.cc b/runtime/vm/heap_test.cc index 8c616d3f01f..cc681155c4c 100644 --- a/runtime/vm/heap_test.cc +++ b/runtime/vm/heap_test.cc @@ -73,7 +73,6 @@ TEST_CASE(LargeSweep) { heap->CollectGarbage(Heap::kOld); } - #ifndef PRODUCT class ClassHeapStatsTestHelper { public: @@ -90,7 +89,6 @@ class ClassHeapStatsTestHelper { } }; - static RawClass* GetClass(const Library& lib, const char* name) { const Class& cls = Class::Handle( lib.LookupClass(String::Handle(Symbols::New(Thread::Current(), name)))); @@ -98,7 +96,6 @@ static RawClass* GetClass(const Library& lib, const char* name) { return cls.raw(); } - TEST_CASE(ClassHeapStats) { const char* kScriptChars = "class A {\n" @@ -192,7 +189,6 @@ TEST_CASE(ClassHeapStats) { EXPECT_EQ(0, class_stats->recent.old_count); } - TEST_CASE(ArrayHeapStats) { const char* kScriptChars = "List f(int len) {\n" @@ -232,7 +228,6 @@ TEST_CASE(ArrayHeapStats) { } #endif // !PRODUCT - class FindOnly : public FindObjectVisitor { public: explicit FindOnly(RawObject* target) : target_(target) { @@ -248,7 +243,6 @@ class FindOnly : public FindObjectVisitor { RawObject* target_; }; - class FindNothing : public FindObjectVisitor { public: FindNothing() {} @@ -256,7 +250,6 @@ class FindNothing : public FindObjectVisitor { virtual bool FindObject(RawObject* obj) const { return false; } }; - TEST_CASE(FindObject) { Isolate* isolate = Isolate::Current(); Heap* heap = isolate->heap(); @@ -276,7 +269,6 @@ TEST_CASE(FindObject) { } } - TEST_CASE(IterateReadOnly) { const String& obj = String::Handle(String::New("x", Heap::kOld)); Heap* heap = Thread::Current()->isolate()->heap(); @@ -287,7 +279,6 @@ TEST_CASE(IterateReadOnly) { EXPECT(heap->Contains(RawObject::ToAddr(obj.raw()))); } - void TestBecomeForward(Heap::Space before_space, Heap::Space after_space) { Isolate* isolate = Isolate::Current(); Heap* heap = isolate->heap(); @@ -312,27 +303,22 @@ void TestBecomeForward(Heap::Space before_space, Heap::Space after_space) { EXPECT(before_obj.raw() == after_obj.raw()); } - ISOLATE_UNIT_TEST_CASE(BecomeFowardOldToOld) { TestBecomeForward(Heap::kOld, Heap::kOld); } - ISOLATE_UNIT_TEST_CASE(BecomeFowardNewToNew) { TestBecomeForward(Heap::kNew, Heap::kNew); } - ISOLATE_UNIT_TEST_CASE(BecomeFowardOldToNew) { TestBecomeForward(Heap::kOld, Heap::kNew); } - ISOLATE_UNIT_TEST_CASE(BecomeFowardNewToOld) { TestBecomeForward(Heap::kNew, Heap::kOld); } - ISOLATE_UNIT_TEST_CASE(BecomeForwardRememberedObject) { Isolate* isolate = Isolate::Current(); Heap* heap = isolate->heap(); @@ -363,7 +349,6 @@ ISOLATE_UNIT_TEST_CASE(BecomeForwardRememberedObject) { EXPECT(before_obj.raw() == after_obj.raw()); } - ISOLATE_UNIT_TEST_CASE(CollectAllGarbage_DeadOldToNew) { Isolate* isolate = Isolate::Current(); Heap* heap = isolate->heap(); @@ -386,7 +371,6 @@ ISOLATE_UNIT_TEST_CASE(CollectAllGarbage_DeadOldToNew) { EXPECT(size_before == size_after); } - ISOLATE_UNIT_TEST_CASE(CollectAllGarbage_DeadNewToOld) { Isolate* isolate = Isolate::Current(); Heap* heap = isolate->heap(); @@ -409,7 +393,6 @@ ISOLATE_UNIT_TEST_CASE(CollectAllGarbage_DeadNewToOld) { EXPECT(size_before == size_after); } - ISOLATE_UNIT_TEST_CASE(CollectAllGarbage_DeadGenCycle) { Isolate* isolate = Isolate::Current(); Heap* heap = isolate->heap(); @@ -433,7 +416,6 @@ ISOLATE_UNIT_TEST_CASE(CollectAllGarbage_DeadGenCycle) { EXPECT(size_before == size_after); } - ISOLATE_UNIT_TEST_CASE(CollectAllGarbage_LiveNewToOld) { Isolate* isolate = Isolate::Current(); Heap* heap = isolate->heap(); @@ -455,7 +437,6 @@ ISOLATE_UNIT_TEST_CASE(CollectAllGarbage_LiveNewToOld) { EXPECT(size_before < size_after); } - ISOLATE_UNIT_TEST_CASE(CollectAllGarbage_LiveOldToNew) { Isolate* isolate = Isolate::Current(); Heap* heap = isolate->heap(); @@ -477,7 +458,6 @@ ISOLATE_UNIT_TEST_CASE(CollectAllGarbage_LiveOldToNew) { EXPECT(size_before < size_after); } - ISOLATE_UNIT_TEST_CASE(CollectAllGarbage_LiveOldDeadNew) { Isolate* isolate = Isolate::Current(); Heap* heap = isolate->heap(); @@ -499,7 +479,6 @@ ISOLATE_UNIT_TEST_CASE(CollectAllGarbage_LiveOldDeadNew) { EXPECT(size_before < size_after); } - ISOLATE_UNIT_TEST_CASE(CollectAllGarbage_LiveNewDeadOld) { Isolate* isolate = Isolate::Current(); Heap* heap = isolate->heap(); @@ -521,7 +500,6 @@ ISOLATE_UNIT_TEST_CASE(CollectAllGarbage_LiveNewDeadOld) { EXPECT(size_before < size_after); } - ISOLATE_UNIT_TEST_CASE(CollectAllGarbage_LiveNewToOldChain) { Isolate* isolate = Isolate::Current(); Heap* heap = isolate->heap(); @@ -546,7 +524,6 @@ ISOLATE_UNIT_TEST_CASE(CollectAllGarbage_LiveNewToOldChain) { EXPECT(size_before < size_after); } - ISOLATE_UNIT_TEST_CASE(CollectAllGarbage_LiveOldToNewChain) { Isolate* isolate = Isolate::Current(); Heap* heap = isolate->heap(); diff --git a/runtime/vm/il_printer.cc b/runtime/vm/il_printer.cc index 653d564e6a8..d46c8ec54d2 100644 --- a/runtime/vm/il_printer.cc +++ b/runtime/vm/il_printer.cc @@ -32,7 +32,6 @@ void BufferFormatter::Print(const char* format, ...) { va_end(args); } - void BufferFormatter::VPrint(const char* format, va_list args) { intptr_t available = size_ - position_; if (available <= 0) return; @@ -42,7 +41,6 @@ void BufferFormatter::VPrint(const char* format, va_list args) { } } - // Checks whether function's name matches the given filter, which is // a comma-separated list of strings. bool FlowGraphPrinter::PassesFilter(const char* filter, @@ -83,12 +81,10 @@ bool FlowGraphPrinter::PassesFilter(const char* filter, return found; } - bool FlowGraphPrinter::ShouldPrint(const Function& function) { return PassesFilter(FLAG_print_flow_graph_filter, function); } - void FlowGraphPrinter::PrintGraph(const char* phase, FlowGraph* flow_graph) { LogBlock lb; THR_Print("*** BEGIN CFG\n%s\n", phase); @@ -98,7 +94,6 @@ void FlowGraphPrinter::PrintGraph(const char* phase, FlowGraph* flow_graph) { fflush(stdout); } - void FlowGraphPrinter::PrintBlock(BlockEntryInstr* block, bool print_locations) { // Print the block entry. @@ -112,7 +107,6 @@ void FlowGraphPrinter::PrintBlock(BlockEntryInstr* block, } } - void FlowGraphPrinter::PrintBlocks() { if (!function_.IsNull()) { THR_Print("==== %s\n", function_.ToFullyQualifiedCString()); @@ -123,12 +117,10 @@ void FlowGraphPrinter::PrintBlocks() { } } - void FlowGraphPrinter::PrintInstruction(Instruction* instr) { PrintOneInstruction(instr, print_locations_); } - void FlowGraphPrinter::PrintOneInstruction(Instruction* instr, bool print_locations) { char str[4000]; @@ -150,7 +142,6 @@ void FlowGraphPrinter::PrintOneInstruction(Instruction* instr, } } - void FlowGraphPrinter::PrintTypeCheck(const ParsedFunction& parsed_function, TokenPosition token_pos, Value* value, @@ -169,7 +160,6 @@ void FlowGraphPrinter::PrintTypeCheck(const ParsedFunction& parsed_function, String::Handle(dst_type.Name()).ToCString(), dst_name.ToCString()); } - void CompileType::PrintTo(BufferFormatter* f) const { const char* type_name = "?"; if ((cid_ != kIllegalCid) && (cid_ != kDynamicCid)) { @@ -186,7 +176,6 @@ void CompileType::PrintTo(BufferFormatter* f) const { f->Print("T{%s%s}", type_name, is_nullable_ ? "?" : ""); } - const char* CompileType::ToCString() const { char buffer[1024]; BufferFormatter f(buffer, sizeof(buffer)); @@ -194,7 +183,6 @@ const char* CompileType::ToCString() const { return Thread::Current()->zone()->MakeCopyOfString(buffer); } - static void PrintTargetsHelper(BufferFormatter* f, const CallTargets& targets, intptr_t num_checks_to_print) { @@ -231,7 +219,6 @@ static void PrintTargetsHelper(BufferFormatter* f, f->Print("]"); } - static void PrintCidsHelper(BufferFormatter* f, const Cids& targets, intptr_t num_checks_to_print) { @@ -261,7 +248,6 @@ static void PrintCidsHelper(BufferFormatter* f, f->Print("]"); } - static void PrintICDataHelper(BufferFormatter* f, const ICData& ic_data, intptr_t num_checks_to_print) { @@ -295,7 +281,6 @@ static void PrintICDataHelper(BufferFormatter* f, f->Print("]"); } - static void PrintICDataSortedHelper(BufferFormatter* f, const ICData& ic_data_orig) { const ICData& ic_data = @@ -311,7 +296,6 @@ static void PrintICDataSortedHelper(BufferFormatter* f, f->Print("]"); } - void FlowGraphPrinter::PrintICData(const ICData& ic_data, intptr_t num_checks_to_print) { char buffer[1024]; @@ -322,7 +306,6 @@ void FlowGraphPrinter::PrintICData(const ICData& ic_data, THR_Print(" arg-desc %" Pd "\n", a.Length()); } - void FlowGraphPrinter::PrintCidRangeData(const CallTargets& targets, intptr_t num_checks_to_print) { char buffer[1024]; @@ -332,7 +315,6 @@ void FlowGraphPrinter::PrintCidRangeData(const CallTargets& targets, // TODO(erikcorry): Print args descriptor. } - static void PrintUse(BufferFormatter* f, const Definition& definition) { if (definition.HasSSATemp()) { if (definition.HasPairRepresentation()) { @@ -346,7 +328,6 @@ static void PrintUse(BufferFormatter* f, const Definition& definition) { } } - const char* Instruction::ToCString() const { char buffer[1024]; BufferFormatter f(buffer, sizeof(buffer)); @@ -354,7 +335,6 @@ const char* Instruction::ToCString() const { return Thread::Current()->zone()->MakeCopyOfString(buffer); } - void Instruction::PrintTo(BufferFormatter* f) const { if (GetDeoptId() != Thread::kNoDeoptId) { f->Print("%s:%" Pd "(", DebugName(), GetDeoptId()); @@ -365,7 +345,6 @@ void Instruction::PrintTo(BufferFormatter* f) const { f->Print(")"); } - void Instruction::PrintOperandsTo(BufferFormatter* f) const { for (int i = 0; i < InputCount(); ++i) { if (i > 0) f->Print(", "); @@ -373,7 +352,6 @@ void Instruction::PrintOperandsTo(BufferFormatter* f) const { } } - void Definition::PrintTo(BufferFormatter* f) const { PrintUse(f, *this); if (HasSSATemp() || HasTemp()) f->Print(" <- "); @@ -396,7 +374,6 @@ void Definition::PrintTo(BufferFormatter* f) const { } } - void Definition::PrintOperandsTo(BufferFormatter* f) const { for (int i = 0; i < InputCount(); ++i) { if (i > 0) f->Print(", "); @@ -406,7 +383,6 @@ void Definition::PrintOperandsTo(BufferFormatter* f) const { } } - void Value::PrintTo(BufferFormatter* f) const { PrintUse(f, *definition()); @@ -416,7 +392,6 @@ void Value::PrintTo(BufferFormatter* f) const { } } - void ConstantInstr::PrintOperandsTo(BufferFormatter* f) const { const char* cstr = value().ToCString(); const char* new_line = strchr(cstr, '\n'); @@ -431,14 +406,12 @@ void ConstantInstr::PrintOperandsTo(BufferFormatter* f) const { } } - void ConstraintInstr::PrintOperandsTo(BufferFormatter* f) const { value()->PrintTo(f); f->Print(" ^ "); constraint()->PrintTo(f); } - void Range::PrintTo(BufferFormatter* f) const { f->Print("["); min_.PrintTo(f); @@ -447,7 +420,6 @@ void Range::PrintTo(BufferFormatter* f) const { f->Print("]"); } - const char* Range::ToCString(const Range* range) { if (range == NULL) return "[_|_, _|_]"; @@ -457,7 +429,6 @@ const char* Range::ToCString(const Range* range) { return Thread::Current()->zone()->MakeCopyOfString(buffer); } - void RangeBoundary::PrintTo(BufferFormatter* f) const { switch (kind_) { case kSymbol: @@ -480,7 +451,6 @@ void RangeBoundary::PrintTo(BufferFormatter* f) const { } } - const char* RangeBoundary::ToCString() const { char buffer[256]; BufferFormatter f(buffer, sizeof(buffer)); @@ -488,7 +458,6 @@ const char* RangeBoundary::ToCString() const { return Thread::Current()->zone()->MakeCopyOfString(buffer); } - void DropTempsInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%" Pd "", num_temps()); if (value() != NULL) { @@ -497,7 +466,6 @@ void DropTempsInstr::PrintOperandsTo(BufferFormatter* f) const { } } - void AssertAssignableInstr::PrintOperandsTo(BufferFormatter* f) const { value()->PrintTo(f); f->Print(", %s, '%s',", dst_type().ToCString(), dst_name().ToCString()); @@ -508,12 +476,10 @@ void AssertAssignableInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print(")"); } - void AssertBooleanInstr::PrintOperandsTo(BufferFormatter* f) const { value()->PrintTo(f); } - void ClosureCallInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print(" function="); InputAt(0)->PrintTo(f); @@ -524,7 +490,6 @@ void ClosureCallInstr::PrintOperandsTo(BufferFormatter* f) const { } } - void InstanceCallInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print(" %s<%" Pd ">", function_name().ToCString(), type_args_len()); for (intptr_t i = 0; i < ArgumentCount(); ++i) { @@ -540,7 +505,6 @@ void InstanceCallInstr::PrintOperandsTo(BufferFormatter* f) const { } } - void PolymorphicInstanceCallInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print(" %s<%" Pd ">", instance_call()->function_name().ToCString(), instance_call()->type_args_len()); @@ -554,7 +518,6 @@ void PolymorphicInstanceCallInstr::PrintOperandsTo(BufferFormatter* f) const { } } - void StrictCompareInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s, ", Token::Str(kind())); left()->PrintTo(f); @@ -565,7 +528,6 @@ void StrictCompareInstr::PrintOperandsTo(BufferFormatter* f) const { } } - void TestCidsInstr::PrintOperandsTo(BufferFormatter* f) const { left()->PrintTo(f); f->Print(" %s [", Token::Str(kind())); @@ -584,14 +546,12 @@ void TestCidsInstr::PrintOperandsTo(BufferFormatter* f) const { } } - void EqualityCompareInstr::PrintOperandsTo(BufferFormatter* f) const { left()->PrintTo(f); f->Print(" %s ", Token::Str(kind())); right()->PrintTo(f); } - void StaticCallInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print(" %s<%" Pd "> ", String::Handle(function().name()).ToCString(), type_args_len()); @@ -601,30 +561,25 @@ void StaticCallInstr::PrintOperandsTo(BufferFormatter* f) const { } } - void LoadLocalInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s @%d", local().name().ToCString(), local().index()); } - void StoreLocalInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s @%d, ", local().name().ToCString(), local().index()); value()->PrintTo(f); } - void NativeCallInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s", native_name().ToCString()); } - void GuardFieldInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s %s, ", String::Handle(field().name()).ToCString(), field().GuardedPropertiesAsCString()); value()->PrintTo(f); } - void StoreInstanceFieldInstr::PrintOperandsTo(BufferFormatter* f) const { if (field().IsNull()) { f->Print("{%" Pd "}, ", offset_in_bytes()); @@ -637,24 +592,20 @@ void StoreInstanceFieldInstr::PrintOperandsTo(BufferFormatter* f) const { value()->PrintTo(f); } - void IfThenElseInstr::PrintOperandsTo(BufferFormatter* f) const { comparison()->PrintOperandsTo(f); f->Print(" ? %" Pd " : %" Pd, if_true_, if_false_); } - void LoadStaticFieldInstr::PrintOperandsTo(BufferFormatter* f) const { field_value()->PrintTo(f); } - void StoreStaticFieldInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s, ", String::Handle(field().name()).ToCString()); value()->PrintTo(f); } - void InstanceOfInstr::PrintOperandsTo(BufferFormatter* f) const { value()->PrintTo(f); f->Print(" IS %s,", String::Handle(type().Name()).ToCString()); @@ -665,7 +616,6 @@ void InstanceOfInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print(")"); } - void RelationalOpInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s, ", Token::Str(kind())); left()->PrintTo(f); @@ -673,7 +623,6 @@ void RelationalOpInstr::PrintOperandsTo(BufferFormatter* f) const { right()->PrintTo(f); } - void AllocateObjectInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s", String::Handle(cls().ScrubbedName()).ToCString()); for (intptr_t i = 0; i < ArgumentCount(); i++) { @@ -686,7 +635,6 @@ void AllocateObjectInstr::PrintOperandsTo(BufferFormatter* f) const { } } - void MaterializeObjectInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s", String::Handle(cls_.ScrubbedName()).ToCString()); for (intptr_t i = 0; i < InputCount(); i++) { @@ -696,7 +644,6 @@ void MaterializeObjectInstr::PrintOperandsTo(BufferFormatter* f) const { } } - void LoadFieldInstr::PrintOperandsTo(BufferFormatter* f) const { instance()->PrintTo(f); f->Print(", %" Pd, offset_in_bytes()); @@ -717,7 +664,6 @@ void LoadFieldInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print(", immutable=%d", immutable_); } - void InstantiateTypeInstr::PrintOperandsTo(BufferFormatter* f) const { const String& type_name = String::Handle(type().Name()); f->Print("%s,", type_name.ToCString()); @@ -728,7 +674,6 @@ void InstantiateTypeInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print(")"); } - void InstantiateTypeArgumentsInstr::PrintOperandsTo(BufferFormatter* f) const { const String& type_args = String::Handle(type_arguments().Name()); f->Print("%s,", type_args.ToCString()); @@ -739,12 +684,10 @@ void InstantiateTypeArgumentsInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print(")"); } - void AllocateContextInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%" Pd "", num_context_variables()); } - void AllocateUninitializedContextInstr::PrintOperandsTo( BufferFormatter* f) const { f->Print("%" Pd "", num_context_variables()); @@ -754,30 +697,25 @@ void AllocateUninitializedContextInstr::PrintOperandsTo( } } - void MathUnaryInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("'%s', ", MathUnaryInstr::KindToCString(kind())); value()->PrintTo(f); } - void TruncDivModInstr::PrintOperandsTo(BufferFormatter* f) const { Definition::PrintOperandsTo(f); } - void ExtractNthOutputInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("Extract %" Pd " from ", index()); Definition::PrintOperandsTo(f); } - void UnaryIntegerOpInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s, ", Token::Str(op_kind())); value()->PrintTo(f); } - void CheckedSmiOpInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s", Token::Str(op_kind())); f->Print(", "); @@ -786,7 +724,6 @@ void CheckedSmiOpInstr::PrintOperandsTo(BufferFormatter* f) const { right()->PrintTo(f); } - void CheckedSmiComparisonInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s", Token::Str(kind())); f->Print(", "); @@ -795,7 +732,6 @@ void CheckedSmiComparisonInstr::PrintOperandsTo(BufferFormatter* f) const { right()->PrintTo(f); } - void BinaryIntegerOpInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s", Token::Str(op_kind())); if (is_truncating()) { @@ -809,7 +745,6 @@ void BinaryIntegerOpInstr::PrintOperandsTo(BufferFormatter* f) const { right()->PrintTo(f); } - void BinaryDoubleOpInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s, ", Token::Str(op_kind())); left()->PrintTo(f); @@ -817,7 +752,6 @@ void BinaryDoubleOpInstr::PrintOperandsTo(BufferFormatter* f) const { right()->PrintTo(f); } - void DoubleTestOpInstr::PrintOperandsTo(BufferFormatter* f) const { switch (op_kind()) { case MethodRecognizer::kDouble_getIsNaN: @@ -832,7 +766,6 @@ void DoubleTestOpInstr::PrintOperandsTo(BufferFormatter* f) const { value()->PrintTo(f); } - void BinaryFloat32x4OpInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s, ", Token::Str(op_kind())); left()->PrintTo(f); @@ -840,7 +773,6 @@ void BinaryFloat32x4OpInstr::PrintOperandsTo(BufferFormatter* f) const { right()->PrintTo(f); } - void BinaryFloat64x2OpInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s, ", Token::Str(op_kind())); left()->PrintTo(f); @@ -848,14 +780,12 @@ void BinaryFloat64x2OpInstr::PrintOperandsTo(BufferFormatter* f) const { right()->PrintTo(f); } - void Simd32x4ShuffleInstr::PrintOperandsTo(BufferFormatter* f) const { // TODO(johnmccutchan): Add proper string enumeration of shuffle. f->Print("%s, ", MethodRecognizer::KindToCString(op_kind())); value()->PrintTo(f); } - void Simd32x4ShuffleMixInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s, ", MethodRecognizer::KindToCString(op_kind())); xy()->PrintTo(f); @@ -863,7 +793,6 @@ void Simd32x4ShuffleMixInstr::PrintOperandsTo(BufferFormatter* f) const { zw()->PrintTo(f); } - void Simd32x4GetSignMaskInstr::PrintOperandsTo(BufferFormatter* f) const { if (op_kind() == MethodRecognizer::kFloat32x4GetSignMask) { f->Print("Float32x4.getSignMask "); @@ -874,13 +803,11 @@ void Simd32x4GetSignMaskInstr::PrintOperandsTo(BufferFormatter* f) const { value()->PrintTo(f); } - void Float32x4SplatInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("SPLAT "); value()->PrintTo(f); } - void Float32x4ConstructorInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("Float32x4("); value0()->PrintTo(f); @@ -893,7 +820,6 @@ void Float32x4ConstructorInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print(")"); } - void Float32x4ComparisonInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("Float32x4 Comparison %s, ", MethodRecognizer::KindToCString(op_kind())); @@ -902,7 +828,6 @@ void Float32x4ComparisonInstr::PrintOperandsTo(BufferFormatter* f) const { right()->PrintTo(f); } - void Float32x4MinMaxInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s, ", MethodRecognizer::KindToCString(op_kind())); left()->PrintTo(f); @@ -910,13 +835,11 @@ void Float32x4MinMaxInstr::PrintOperandsTo(BufferFormatter* f) const { right()->PrintTo(f); } - void Float32x4SqrtInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s, ", MethodRecognizer::KindToCString(op_kind())); left()->PrintTo(f); } - void Float32x4ScaleInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s, ", MethodRecognizer::KindToCString(op_kind())); left()->PrintTo(f); @@ -924,19 +847,16 @@ void Float32x4ScaleInstr::PrintOperandsTo(BufferFormatter* f) const { right()->PrintTo(f); } - void Float32x4ZeroArgInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s, ", MethodRecognizer::KindToCString(op_kind())); left()->PrintTo(f); } - void Float32x4ClampInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("Float32x4.clamp, "); left()->PrintTo(f); } - void Float32x4WithInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s, ", MethodRecognizer::KindToCString(op_kind())); left()->PrintTo(f); @@ -944,26 +864,22 @@ void Float32x4WithInstr::PrintOperandsTo(BufferFormatter* f) const { replacement()->PrintTo(f); } - void Float32x4ToInt32x4Instr::PrintOperandsTo(BufferFormatter* f) const { f->Print("Float32x4.toInt32x4 "); left()->PrintTo(f); } - void Simd64x2ShuffleInstr::PrintOperandsTo(BufferFormatter* f) const { // TODO(johnmccutchan): Add proper string enumeration of shuffle. f->Print("%s, ", MethodRecognizer::KindToCString(op_kind())); value()->PrintTo(f); } - void Float64x2SplatInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("Float64x2.splat "); value()->PrintTo(f); } - void Float64x2ConstructorInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("Float64x2("); value0()->PrintTo(f); @@ -972,25 +888,21 @@ void Float64x2ConstructorInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print(")"); } - void Float32x4ToFloat64x2Instr::PrintOperandsTo(BufferFormatter* f) const { f->Print("Float64x2.fromFloat32x4 "); left()->PrintTo(f); } - void Float64x2ToFloat32x4Instr::PrintOperandsTo(BufferFormatter* f) const { f->Print("Float32x4.fromFloat64x2 "); left()->PrintTo(f); } - void Float64x2ZeroArgInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s, ", MethodRecognizer::KindToCString(op_kind())); left()->PrintTo(f); } - void Float64x2OneArgInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s(", MethodRecognizer::KindToCString(op_kind())); left()->PrintTo(f); @@ -999,7 +911,6 @@ void Float64x2OneArgInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print(")"); } - void Int32x4ConstructorInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("Int32x4("); value0()->PrintTo(f); @@ -1012,7 +923,6 @@ void Int32x4ConstructorInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print(")"); } - void Int32x4BoolConstructorInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("Int32x4.bool("); value0()->PrintTo(f); @@ -1025,13 +935,11 @@ void Int32x4BoolConstructorInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print(")"); } - void Int32x4GetFlagInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("Int32x4.%s ", MethodRecognizer::KindToCString(op_kind())); value()->PrintTo(f); } - void Int32x4SetFlagInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("Int32x4.%s ", MethodRecognizer::KindToCString(op_kind())); value()->PrintTo(f); @@ -1039,7 +947,6 @@ void Int32x4SetFlagInstr::PrintOperandsTo(BufferFormatter* f) const { flagValue()->PrintTo(f); } - void Int32x4SelectInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("Int32x4.select "); mask()->PrintTo(f); @@ -1049,13 +956,11 @@ void Int32x4SelectInstr::PrintOperandsTo(BufferFormatter* f) const { falseValue()->PrintTo(f); } - void Int32x4ToFloat32x4Instr::PrintOperandsTo(BufferFormatter* f) const { f->Print("Int32x4.toFloat32x4 "); left()->PrintTo(f); } - void BinaryInt32x4OpInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s, ", Token::Str(op_kind())); left()->PrintTo(f); @@ -1063,13 +968,11 @@ void BinaryInt32x4OpInstr::PrintOperandsTo(BufferFormatter* f) const { right()->PrintTo(f); } - void UnaryDoubleOpInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s, ", Token::Str(op_kind())); value()->PrintTo(f); } - void CheckClassIdInstr::PrintOperandsTo(BufferFormatter* f) const { value()->PrintTo(f); @@ -1087,7 +990,6 @@ void CheckClassIdInstr::PrintOperandsTo(BufferFormatter* f) const { } } - void CheckClassInstr::PrintOperandsTo(BufferFormatter* f) const { value()->PrintTo(f); PrintCidsHelper(f, cids_, FlowGraphPrinter::kPrintAll); @@ -1096,13 +998,11 @@ void CheckClassInstr::PrintOperandsTo(BufferFormatter* f) const { } } - void InvokeMathCFunctionInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s, ", MethodRecognizer::KindToCString(recognized_kind_)); Definition::PrintOperandsTo(f); } - void GraphEntryInstr::PrintTo(BufferFormatter* f) const { const GrowableArray& defns = initial_definitions_; f->Print("B%" Pd "[graph]:%" Pd, block_id(), GetDeoptId()); @@ -1117,7 +1017,6 @@ void GraphEntryInstr::PrintTo(BufferFormatter* f) const { } } - void JoinEntryInstr::PrintTo(BufferFormatter* f) const { if (try_index() != CatchClauseNode::kInvalidTryIndex) { f->Print("B%" Pd "[join try_idx %" Pd "]:%" Pd " pred(", block_id(), @@ -1145,7 +1044,6 @@ void JoinEntryInstr::PrintTo(BufferFormatter* f) const { } } - void IndirectEntryInstr::PrintTo(BufferFormatter* f) const { ASSERT(try_index() == CatchClauseNode::kInvalidTryIndex); f->Print("B%" Pd "[join indirect]:%" Pd " pred(", block_id(), GetDeoptId()); @@ -1169,7 +1067,6 @@ void IndirectEntryInstr::PrintTo(BufferFormatter* f) const { } } - static const char* RepresentationToCString(Representation rep) { switch (rep) { case kTagged: @@ -1200,7 +1097,6 @@ static const char* RepresentationToCString(Representation rep) { return "?"; } - void PhiInstr::PrintTo(BufferFormatter* f) const { if (HasPairRepresentation()) { f->Print("(v%" Pd ", v%" Pd ") <- phi(", ssa_temp_index(), @@ -1233,7 +1129,6 @@ void PhiInstr::PrintTo(BufferFormatter* f) const { } } - void UnboxIntegerInstr::PrintOperandsTo(BufferFormatter* f) const { if (is_truncating()) { f->Print("[tr], "); @@ -1241,24 +1136,20 @@ void UnboxIntegerInstr::PrintOperandsTo(BufferFormatter* f) const { Definition::PrintOperandsTo(f); } - void UnboxedIntConverterInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%s->%s%s, ", RepresentationToCString(from()), RepresentationToCString(to()), is_truncating() ? "[tr]" : ""); Definition::PrintOperandsTo(f); } - void ParameterInstr::PrintOperandsTo(BufferFormatter* f) const { f->Print("%" Pd, index()); } - void CheckStackOverflowInstr::PrintOperandsTo(BufferFormatter* f) const { if (in_loop()) f->Print("depth %" Pd, loop_depth()); } - void TargetEntryInstr::PrintTo(BufferFormatter* f) const { if (try_index() != CatchClauseNode::kInvalidTryIndex) { f->Print("B%" Pd "[target try_idx %" Pd "]:%" Pd, block_id(), try_index(), @@ -1272,7 +1163,6 @@ void TargetEntryInstr::PrintTo(BufferFormatter* f) const { } } - void CatchBlockEntryInstr::PrintTo(BufferFormatter* f) const { f->Print("B%" Pd "[target catch try_idx %" Pd " catch_try_idx %" Pd "]", block_id(), try_index(), catch_try_index()); @@ -1293,12 +1183,10 @@ void CatchBlockEntryInstr::PrintTo(BufferFormatter* f) const { } } - void PushArgumentInstr::PrintOperandsTo(BufferFormatter* f) const { value()->PrintTo(f); } - void GotoInstr::PrintTo(BufferFormatter* f) const { if (HasParallelMove()) { parallel_move()->PrintTo(f); @@ -1311,7 +1199,6 @@ void GotoInstr::PrintTo(BufferFormatter* f) const { } } - void IndirectGotoInstr::PrintTo(BufferFormatter* f) const { if (GetDeoptId() != Thread::kNoDeoptId) { f->Print("igoto:%" Pd "(", GetDeoptId()); @@ -1322,7 +1209,6 @@ void IndirectGotoInstr::PrintTo(BufferFormatter* f) const { f->Print(")"); } - void BranchInstr::PrintTo(BufferFormatter* f) const { f->Print("%s ", DebugName()); f->Print("if "); @@ -1332,7 +1218,6 @@ void BranchInstr::PrintTo(BufferFormatter* f) const { false_successor()->block_id()); } - void ParallelMoveInstr::PrintTo(BufferFormatter* f) const { f->Print("%s ", DebugName()); for (intptr_t i = 0; i < moves_.length(); i++) { @@ -1343,7 +1228,6 @@ void ParallelMoveInstr::PrintTo(BufferFormatter* f) const { } } - void Environment::PrintTo(BufferFormatter* f) const { f->Print(" env={ "); int arg_count = 0; @@ -1371,21 +1255,17 @@ const char* Environment::ToCString() const { return Thread::Current()->zone()->MakeCopyOfString(buffer); } - #else // PRODUCT - const char* Instruction::ToCString() const { return DebugName(); } - void FlowGraphPrinter::PrintOneInstruction(Instruction* instr, bool print_locations) { UNREACHABLE(); } - void FlowGraphPrinter::PrintTypeCheck(const ParsedFunction& parsed_function, TokenPosition token_pos, Value* value, @@ -1395,24 +1275,20 @@ void FlowGraphPrinter::PrintTypeCheck(const ParsedFunction& parsed_function, UNREACHABLE(); } - void FlowGraphPrinter::PrintBlock(BlockEntryInstr* block, bool print_locations) { UNREACHABLE(); } - void FlowGraphPrinter::PrintGraph(const char* phase, FlowGraph* flow_graph) { UNREACHABLE(); } - void FlowGraphPrinter::PrintICData(const ICData& ic_data, intptr_t num_checks_to_print) { UNREACHABLE(); } - bool FlowGraphPrinter::ShouldPrint(const Function& function) { return false; } diff --git a/runtime/vm/il_printer.h b/runtime/vm/il_printer.h index b3553e4462a..6d930be69b1 100644 --- a/runtime/vm/il_printer.h +++ b/runtime/vm/il_printer.h @@ -26,10 +26,8 @@ class BufferFormatter : public ValueObject { DISALLOW_COPY_AND_ASSIGN(BufferFormatter); }; - class ParsedFunction; - // Graph printing. class FlowGraphPrinter : public ValueObject { public: diff --git a/runtime/vm/instructions_arm.cc b/runtime/vm/instructions_arm.cc index 8de71dbd38d..0b0bf644820 100644 --- a/runtime/vm/instructions_arm.cc +++ b/runtime/vm/instructions_arm.cc @@ -31,7 +31,6 @@ CallPattern::CallPattern(uword pc, const Code& code) ASSERT(reg == CODE_REG); } - NativeCallPattern::NativeCallPattern(uword pc, const Code& code) : object_pool_(ObjectPool::Handle(code.GetObjectPool())), end_(pc), @@ -50,31 +49,26 @@ NativeCallPattern::NativeCallPattern(uword pc, const Code& code) ASSERT(reg == R9); } - RawCode* NativeCallPattern::target() const { return reinterpret_cast( object_pool_.ObjectAt(target_code_pool_index_)); } - void NativeCallPattern::set_target(const Code& new_target) const { object_pool_.SetObjectAt(target_code_pool_index_, new_target); // No need to flush the instruction cache, since the code is not modified. } - NativeFunction NativeCallPattern::native_function() const { return reinterpret_cast( object_pool_.RawValueAt(native_function_pool_index_)); } - void NativeCallPattern::set_native_function(NativeFunction func) const { object_pool_.SetRawValueAt(native_function_pool_index_, reinterpret_cast(func)); } - // Decodes a load sequence ending at 'end' (the last instruction of the load // sequence is the instruction before the one at end). Returns a pointer to // the first instruction in the sequence. Returns the register being loaded @@ -99,7 +93,6 @@ uword InstructionPattern::DecodeLoadObject(uword end, return start; } - // Decodes a load sequence ending at 'end' (the last instruction of the load // sequence is the instruction before the one at end). Returns a pointer to // the first instruction in the sequence. Returns the register being loaded @@ -150,7 +143,6 @@ uword InstructionPattern::DecodeLoadWordImmediate(uword end, return start; } - static bool IsLoadWithOffset(int32_t instr, Register base, intptr_t* offset, @@ -164,7 +156,6 @@ static bool IsLoadWithOffset(int32_t instr, return false; } - // Decodes a load sequence ending at 'end' (the last instruction of the load // sequence is the instruction before the one at end). Returns a pointer to // the first instruction in the sequence. Returns the register being loaded @@ -199,7 +190,6 @@ uword InstructionPattern::DecodeLoadWordFromPool(uword end, return start; } - bool DecodeLoadObjectFromPoolOrThread(uword pc, const Code& code, Object* obj) { ASSERT(code.ContainsInstructionAt(pc)); @@ -221,7 +211,6 @@ bool DecodeLoadObjectFromPoolOrThread(uword pc, const Code& code, Object* obj) { return false; } - RawICData* CallPattern::IcData() { if (ic_data_.IsNull()) { Register reg; @@ -232,18 +221,15 @@ RawICData* CallPattern::IcData() { return ic_data_.raw(); } - RawCode* CallPattern::TargetCode() const { return reinterpret_cast( object_pool_.ObjectAt(target_code_pool_index_)); } - void CallPattern::SetTargetCode(const Code& target_code) const { object_pool_.SetObjectAt(target_code_pool_index_, target_code); } - SwitchableCallPattern::SwitchableCallPattern(uword pc, const Code& code) : object_pool_(ObjectPool::Handle(code.GetObjectPool())), data_pool_index_(-1), @@ -261,32 +247,26 @@ SwitchableCallPattern::SwitchableCallPattern(uword pc, const Code& code) ASSERT(reg == CODE_REG); } - RawObject* SwitchableCallPattern::data() const { return object_pool_.ObjectAt(data_pool_index_); } - RawCode* SwitchableCallPattern::target() const { return reinterpret_cast(object_pool_.ObjectAt(target_pool_index_)); } - void SwitchableCallPattern::SetData(const Object& data) const { ASSERT(!Object::Handle(object_pool_.ObjectAt(data_pool_index_)).IsCode()); object_pool_.SetObjectAt(data_pool_index_, data); } - void SwitchableCallPattern::SetTarget(const Code& target) const { ASSERT(Object::Handle(object_pool_.ObjectAt(target_pool_index_)).IsCode()); object_pool_.SetObjectAt(target_pool_index_, target); } - ReturnPattern::ReturnPattern(uword pc) : pc_(pc) {} - bool ReturnPattern::IsValid() const { Instr* bx_lr = Instr::At(pc_); const int32_t B4 = 1 << 4; diff --git a/runtime/vm/instructions_arm.h b/runtime/vm/instructions_arm.h index c4f48110d9b..0738d64cec1 100644 --- a/runtime/vm/instructions_arm.h +++ b/runtime/vm/instructions_arm.h @@ -47,7 +47,6 @@ class InstructionPattern : public AllStatic { intptr_t* index); }; - class CallPattern : public ValueObject { public: CallPattern(uword pc, const Code& code); @@ -69,7 +68,6 @@ class CallPattern : public ValueObject { DISALLOW_COPY_AND_ASSIGN(CallPattern); }; - class NativeCallPattern : public ValueObject { public: NativeCallPattern(uword pc, const Code& code); @@ -90,7 +88,6 @@ class NativeCallPattern : public ValueObject { DISALLOW_COPY_AND_ASSIGN(NativeCallPattern); }; - // Instance call that can switch between a direct monomorphic call, an IC call, // and a megamorphic call. // load guarded cid load ICData load MegamorphicCache @@ -113,7 +110,6 @@ class SwitchableCallPattern : public ValueObject { DISALLOW_COPY_AND_ASSIGN(SwitchableCallPattern); }; - class ReturnPattern : public ValueObject { public: explicit ReturnPattern(uword pc); diff --git a/runtime/vm/instructions_arm64.cc b/runtime/vm/instructions_arm64.cc index b7b26b52b2a..12b7fcf90a8 100644 --- a/runtime/vm/instructions_arm64.cc +++ b/runtime/vm/instructions_arm64.cc @@ -31,7 +31,6 @@ CallPattern::CallPattern(uword pc, const Code& code) ASSERT(reg == CODE_REG); } - NativeCallPattern::NativeCallPattern(uword pc, const Code& code) : object_pool_(ObjectPool::Handle(code.GetObjectPool())), end_(pc), @@ -50,36 +49,30 @@ NativeCallPattern::NativeCallPattern(uword pc, const Code& code) ASSERT(reg == R5); } - RawCode* NativeCallPattern::target() const { return reinterpret_cast( object_pool_.ObjectAt(target_code_pool_index_)); } - void NativeCallPattern::set_target(const Code& target) const { object_pool_.SetObjectAt(target_code_pool_index_, target); // No need to flush the instruction cache, since the code is not modified. } - NativeFunction NativeCallPattern::native_function() const { return reinterpret_cast( object_pool_.RawValueAt(native_function_pool_index_)); } - void NativeCallPattern::set_native_function(NativeFunction func) const { object_pool_.SetRawValueAt(native_function_pool_index_, reinterpret_cast(func)); } - intptr_t InstructionPattern::OffsetFromPPIndex(intptr_t index) { return Array::element_offset(index); } - // Decodes a load sequence ending at 'end' (the last instruction of the load // sequence is the instruction before the one at end). Returns a pointer to // the first instruction in the sequence. Returns the register being loaded @@ -108,7 +101,6 @@ uword InstructionPattern::DecodeLoadObject(uword end, return start; } - // Decodes a load sequence ending at 'end' (the last instruction of the load // sequence is the instruction before the one at end). Returns a pointer to // the first instruction in the sequence. Returns the register being loaded @@ -182,7 +174,6 @@ uword InstructionPattern::DecodeLoadWordImmediate(uword end, return start; } - // Decodes a load sequence ending at 'end' (the last instruction of the load // sequence is the instruction before the one at end). Returns a pointer to // the first instruction in the sequence. Returns the register being loaded @@ -255,7 +246,6 @@ uword InstructionPattern::DecodeLoadWordFromPool(uword end, return start; } - bool DecodeLoadObjectFromPoolOrThread(uword pc, const Code& code, Object* obj) { ASSERT(code.ContainsInstructionAt(pc)); @@ -281,7 +271,6 @@ bool DecodeLoadObjectFromPoolOrThread(uword pc, const Code& code, Object* obj) { return false; } - // Encodes a load sequence ending at 'end'. Encodes a fixed length two // instruction load from the pool pointer in PP using the destination // register reg as a temporary for the base address. @@ -302,7 +291,6 @@ void InstructionPattern::EncodeLoadWordFromPoolFixed(uword end, instr->SetInstructionBits(instr->InstructionBits() | B22); } - RawICData* CallPattern::IcData() { if (ic_data_.IsNull()) { Register reg; @@ -313,19 +301,16 @@ RawICData* CallPattern::IcData() { return ic_data_.raw(); } - RawCode* CallPattern::TargetCode() const { return reinterpret_cast( object_pool_.ObjectAt(target_code_pool_index_)); } - void CallPattern::SetTargetCode(const Code& target) const { object_pool_.SetObjectAt(target_code_pool_index_, target); // No need to flush the instruction cache, since the code is not modified. } - SwitchableCallPattern::SwitchableCallPattern(uword pc, const Code& code) : object_pool_(ObjectPool::Handle(code.GetObjectPool())), data_pool_index_(-1), @@ -343,32 +328,26 @@ SwitchableCallPattern::SwitchableCallPattern(uword pc, const Code& code) ASSERT(reg == CODE_REG); } - RawObject* SwitchableCallPattern::data() const { return object_pool_.ObjectAt(data_pool_index_); } - RawCode* SwitchableCallPattern::target() const { return reinterpret_cast(object_pool_.ObjectAt(target_pool_index_)); } - void SwitchableCallPattern::SetData(const Object& data) const { ASSERT(!Object::Handle(object_pool_.ObjectAt(data_pool_index_)).IsCode()); object_pool_.SetObjectAt(data_pool_index_, data); } - void SwitchableCallPattern::SetTarget(const Code& target) const { ASSERT(Object::Handle(object_pool_.ObjectAt(target_pool_index_)).IsCode()); object_pool_.SetObjectAt(target_pool_index_, target); } - ReturnPattern::ReturnPattern(uword pc) : pc_(pc) {} - bool ReturnPattern::IsValid() const { Instr* bx_lr = Instr::At(pc_); const Register crn = ConcreteRegister(LR); diff --git a/runtime/vm/instructions_arm64.h b/runtime/vm/instructions_arm64.h index 01808fc4c6c..f352e8867ea 100644 --- a/runtime/vm/instructions_arm64.h +++ b/runtime/vm/instructions_arm64.h @@ -54,7 +54,6 @@ class InstructionPattern : public AllStatic { static intptr_t OffsetFromPPIndex(intptr_t index); }; - class CallPattern : public ValueObject { public: CallPattern(uword pc, const Code& code); @@ -76,7 +75,6 @@ class CallPattern : public ValueObject { DISALLOW_COPY_AND_ASSIGN(CallPattern); }; - class NativeCallPattern : public ValueObject { public: NativeCallPattern(uword pc, const Code& code); @@ -97,7 +95,6 @@ class NativeCallPattern : public ValueObject { DISALLOW_COPY_AND_ASSIGN(NativeCallPattern); }; - // Instance call that can switch between a direct monomorphic call, an IC call, // and a megamorphic call. // load guarded cid load ICData load MegamorphicCache @@ -120,7 +117,6 @@ class SwitchableCallPattern : public ValueObject { DISALLOW_COPY_AND_ASSIGN(SwitchableCallPattern); }; - class ReturnPattern : public ValueObject { public: explicit ReturnPattern(uword pc); diff --git a/runtime/vm/instructions_arm64_test.cc b/runtime/vm/instructions_arm64_test.cc index 648ee17d733..35ba23f92e3 100644 --- a/runtime/vm/instructions_arm64_test.cc +++ b/runtime/vm/instructions_arm64_test.cc @@ -22,7 +22,6 @@ ASSEMBLER_TEST_GENERATE(Call, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Call, test) { // The return address, which must be the address of an instruction contained // in the code, points to the Ret instruction above, i.e. one instruction @@ -32,7 +31,6 @@ ASSEMBLER_TEST_RUN(Call, test) { EXPECT_EQ(StubCode::InvokeDartCode_entry()->code(), call.TargetCode()); } - } // namespace dart #endif // defined TARGET_ARCH_ARM64 diff --git a/runtime/vm/instructions_arm_test.cc b/runtime/vm/instructions_arm_test.cc index 24effd843e9..c1077da1264 100644 --- a/runtime/vm/instructions_arm_test.cc +++ b/runtime/vm/instructions_arm_test.cc @@ -22,7 +22,6 @@ ASSEMBLER_TEST_GENERATE(Call, assembler) { __ Ret(); } - ASSEMBLER_TEST_RUN(Call, test) { // The return address, which must be the address of an instruction contained // in the code, points to the Ret instruction above, i.e. one instruction diff --git a/runtime/vm/instructions_dbc.cc b/runtime/vm/instructions_dbc.cc index 7667a5f2b6b..88115c59485 100644 --- a/runtime/vm/instructions_dbc.cc +++ b/runtime/vm/instructions_dbc.cc @@ -37,7 +37,6 @@ static bool HasLoadFromPool(Instr instr) { } } - static bool GetLoadedObjectAt(uword pc, const ObjectPool& object_pool, Object* obj) { @@ -52,7 +51,6 @@ static bool GetLoadedObjectAt(uword pc, return false; } - CallPattern::CallPattern(uword pc, const Code& code) : object_pool_(ObjectPool::Handle(code.GetObjectPool())), end_(pc), @@ -67,7 +65,6 @@ CallPattern::CallPattern(uword pc, const Code& code) target_code_pool_index_ = Bytecode::DecodeD(call_instr); } - NativeCallPattern::NativeCallPattern(uword pc, const Code& code) : object_pool_(ObjectPool::Handle(code.GetObjectPool())), end_(pc), @@ -76,31 +73,26 @@ NativeCallPattern::NativeCallPattern(uword pc, const Code& code) UNIMPLEMENTED(); } - RawCode* NativeCallPattern::target() const { return reinterpret_cast( object_pool_.ObjectAt(target_code_pool_index_)); } - void NativeCallPattern::set_target(const Code& new_target) const { object_pool_.SetObjectAt(target_code_pool_index_, new_target); // No need to flush the instruction cache, since the code is not modified. } - NativeFunction NativeCallPattern::native_function() const { return reinterpret_cast( object_pool_.RawValueAt(native_function_pool_index_)); } - void NativeCallPattern::set_native_function(NativeFunction func) const { object_pool_.SetRawValueAt(native_function_pool_index_, reinterpret_cast(func)); } - // Decodes a load sequence ending at 'end' (the last instruction of the load // sequence is the instruction before the one at end). Returns a pointer to // the first instruction in the sequence. Returns the register being loaded @@ -114,7 +106,6 @@ uword InstructionPattern::DecodeLoadObject(uword end, return 0; } - // Decodes a load sequence ending at 'end' (the last instruction of the load // sequence is the instruction before the one at end). Returns a pointer to // the first instruction in the sequence. Returns the register being loaded @@ -127,7 +118,6 @@ uword InstructionPattern::DecodeLoadWordImmediate(uword end, return 0; } - // Decodes a load sequence ending at 'end' (the last instruction of the load // sequence is the instruction before the one at end). Returns a pointer to // the first instruction in the sequence. Returns the register being loaded @@ -140,14 +130,12 @@ uword InstructionPattern::DecodeLoadWordFromPool(uword end, return 0; } - bool DecodeLoadObjectFromPoolOrThread(uword pc, const Code& code, Object* obj) { ASSERT(code.ContainsInstructionAt(pc)); const ObjectPool& pool = ObjectPool::Handle(code.object_pool()); return GetLoadedObjectAt(pc, pool, obj); } - RawICData* CallPattern::IcData() { if (ic_data_.IsNull()) { bool found = GetLoadedObjectAt(ic_data_load_end_, object_pool_, &ic_data_); @@ -156,18 +144,15 @@ RawICData* CallPattern::IcData() { return ic_data_.raw(); } - RawCode* CallPattern::TargetCode() const { return reinterpret_cast( object_pool_.ObjectAt(target_code_pool_index_)); } - void CallPattern::SetTargetCode(const Code& target_code) const { object_pool_.SetObjectAt(target_code_pool_index_, target_code); } - void CallPattern::InsertDeoptCallAt(uword pc) { const uint8_t argc = Bytecode::IsCallOpcode(Bytecode::At(pc)) ? Bytecode::DecodeArgc(Bytecode::At(pc)) @@ -175,7 +160,6 @@ void CallPattern::InsertDeoptCallAt(uword pc) { *reinterpret_cast(pc) = Bytecode::Encode(Bytecode::kDeopt, argc, 0); } - SwitchableCallPattern::SwitchableCallPattern(uword pc, const Code& code) : object_pool_(ObjectPool::Handle(code.GetObjectPool())), data_pool_index_(-1), @@ -183,34 +167,28 @@ SwitchableCallPattern::SwitchableCallPattern(uword pc, const Code& code) UNIMPLEMENTED(); } - RawObject* SwitchableCallPattern::data() const { return object_pool_.ObjectAt(data_pool_index_); } - RawCode* SwitchableCallPattern::target() const { return reinterpret_cast(object_pool_.ObjectAt(target_pool_index_)); } - void SwitchableCallPattern::SetData(const Object& data) const { ASSERT(!Object::Handle(object_pool_.ObjectAt(data_pool_index_)).IsCode()); object_pool_.SetObjectAt(data_pool_index_, data); } - void SwitchableCallPattern::SetTarget(const Code& target) const { ASSERT(Object::Handle(object_pool_.ObjectAt(target_pool_index_)).IsCode()); object_pool_.SetObjectAt(target_pool_index_, target); } - ReturnPattern::ReturnPattern(uword pc) : pc_(pc) { USE(pc_); } - bool ReturnPattern::IsValid() const { UNIMPLEMENTED(); return false; diff --git a/runtime/vm/instructions_dbc.h b/runtime/vm/instructions_dbc.h index e0ea7999033..301c14b25b9 100644 --- a/runtime/vm/instructions_dbc.h +++ b/runtime/vm/instructions_dbc.h @@ -47,7 +47,6 @@ class InstructionPattern : public AllStatic { intptr_t* index); }; - class CallPattern : public ValueObject { public: CallPattern(uword pc, const Code& code); @@ -71,7 +70,6 @@ class CallPattern : public ValueObject { DISALLOW_COPY_AND_ASSIGN(CallPattern); }; - class NativeCallPattern : public ValueObject { public: NativeCallPattern(uword pc, const Code& code); @@ -92,7 +90,6 @@ class NativeCallPattern : public ValueObject { DISALLOW_COPY_AND_ASSIGN(NativeCallPattern); }; - // Instance call that can switch between a direct monomorphic call, an IC call, // and a megamorphic call. // load guarded cid load ICData load MegamorphicCache @@ -115,7 +112,6 @@ class SwitchableCallPattern : public ValueObject { DISALLOW_COPY_AND_ASSIGN(SwitchableCallPattern); }; - class ReturnPattern : public ValueObject { public: explicit ReturnPattern(uword pc); diff --git a/runtime/vm/instructions_ia32.h b/runtime/vm/instructions_ia32.h index d408a5ace73..2bf8510f729 100644 --- a/runtime/vm/instructions_ia32.h +++ b/runtime/vm/instructions_ia32.h @@ -60,7 +60,6 @@ class InstructionPattern : public ValueObject { DISALLOW_COPY_AND_ASSIGN(InstructionPattern); }; - class CallPattern : public InstructionPattern { public: explicit CallPattern(uword pc) : InstructionPattern(pc) {} @@ -83,13 +82,11 @@ class CallPattern : public InstructionPattern { return kCallPattern; } - private: static const int kLengthInBytes = 5; DISALLOW_COPY_AND_ASSIGN(CallPattern); }; - class ReturnPattern : public InstructionPattern { public: explicit ReturnPattern(uword pc) : InstructionPattern(pc) {} @@ -104,7 +101,6 @@ class ReturnPattern : public InstructionPattern { static const int kLengthInBytes = 1; }; - // push ebp // mov ebp, esp class ProloguePattern : public InstructionPattern { @@ -122,7 +118,6 @@ class ProloguePattern : public InstructionPattern { static const int kLengthInBytes = 3; }; - // mov ebp, esp class SetFramePointerPattern : public InstructionPattern { diff --git a/runtime/vm/instructions_ia32_test.cc b/runtime/vm/instructions_ia32_test.cc index 6b01cdb8916..bfa42573d11 100644 --- a/runtime/vm/instructions_ia32_test.cc +++ b/runtime/vm/instructions_ia32_test.cc @@ -21,14 +21,12 @@ ASSEMBLER_TEST_GENERATE(Call, assembler) { __ ret(); } - ASSEMBLER_TEST_RUN(Call, test) { CallPattern call(test->entry()); EXPECT_EQ(StubCode::InvokeDartCode_entry()->EntryPoint(), call.TargetAddress()); } - } // namespace dart #endif // defined TARGET_ARCH_IA32 diff --git a/runtime/vm/instructions_x64.cc b/runtime/vm/instructions_x64.cc index bc0553da1a7..d998642ff35 100644 --- a/runtime/vm/instructions_x64.cc +++ b/runtime/vm/instructions_x64.cc @@ -8,8 +8,8 @@ #include "vm/instructions.h" #include "vm/instructions_x64.h" -#include "vm/cpu.h" #include "vm/constants_x64.h" +#include "vm/cpu.h" #include "vm/object.h" namespace dart { diff --git a/runtime/vm/instructions_x64.h b/runtime/vm/instructions_x64.h index 56add2e4616..0c58007ce65 100644 --- a/runtime/vm/instructions_x64.h +++ b/runtime/vm/instructions_x64.h @@ -20,11 +20,9 @@ class RawClass; class Immediate; class RawObject; - intptr_t IndexFromPPLoad(uword start); intptr_t IndexFromPPLoadDisp8(uword start); - // Template class for all instruction pattern classes. // P has to specify a static pattern and a pattern length method. template @@ -64,7 +62,6 @@ class InstructionPattern : public ValueObject { DISALLOW_COPY_AND_ASSIGN(InstructionPattern); }; - class ReturnPattern : public InstructionPattern { public: explicit ReturnPattern(uword pc) : InstructionPattern(pc) {} @@ -80,7 +77,6 @@ class ReturnPattern : public InstructionPattern { static const int kLengthInBytes = 1; }; - // push rbp // mov rbp, rsp class ProloguePattern : public InstructionPattern { @@ -99,7 +95,6 @@ class ProloguePattern : public InstructionPattern { static const int kLengthInBytes = 4; }; - // mov rbp, rsp class SetFramePointerPattern : public InstructionPattern { diff --git a/runtime/vm/instructions_x64_test.cc b/runtime/vm/instructions_x64_test.cc index 3e7fb7db96a..5b119db6f62 100644 --- a/runtime/vm/instructions_x64_test.cc +++ b/runtime/vm/instructions_x64_test.cc @@ -19,10 +19,8 @@ ASSEMBLER_TEST_GENERATE(Call, assembler) { __ ret(); } - static intptr_t prologue_code_size = -1; - ASSEMBLER_TEST_GENERATE(Jump, assembler) { ASSERT(assembler->CodeSize() == 0); __ pushq(PP); @@ -34,7 +32,6 @@ ASSEMBLER_TEST_GENERATE(Jump, assembler) { __ ret(); } - } // namespace dart #endif // defined TARGET_ARCH_X64 diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc index 42af3635fac..59161ca7b73 100644 --- a/runtime/vm/intermediate_language.cc +++ b/runtime/vm/intermediate_language.cc @@ -44,7 +44,6 @@ DEFINE_FLAG(bool, DECLARE_FLAG(bool, eliminate_type_checks); DECLARE_FLAG(bool, support_externalizable_strings); - #if defined(DEBUG) void Instruction::CheckField(const Field& field) const { ASSERT(field.IsZoneHandle()); @@ -52,7 +51,6 @@ void Instruction::CheckField(const Field& field) const { } #endif // DEBUG - Definition::Definition(intptr_t deopt_id) : Instruction(deopt_id), range_(NULL), @@ -63,7 +61,6 @@ Definition::Definition(intptr_t deopt_id) env_use_list_(NULL), constant_value_(NULL) {} - // A value in the constant propagation lattice. // - non-constant sentinel // - a constant (any non-sentinel value) @@ -75,7 +72,6 @@ Object& Definition::constant_value() { return *constant_value_; } - Definition* Definition::OriginalDefinition() { Definition* defn = this; while (defn->IsRedefinition() || defn->IsAssertAssignable()) { @@ -88,7 +84,6 @@ Definition* Definition::OriginalDefinition() { return defn; } - const ICData* Instruction::GetICData( const ZoneGrowableArray& ic_data_array) const { // The deopt_id can be outside the range of the IC data array for @@ -110,7 +105,6 @@ const ICData* Instruction::GetICData( return NULL; } - intptr_t Instruction::Hashcode() const { intptr_t result = tag(); for (intptr_t i = 0; i < InputCount(); ++i) { @@ -121,7 +115,6 @@ intptr_t Instruction::Hashcode() const { return result; } - bool Instruction::Equals(Instruction* other) const { if (tag() != other->tag()) return false; for (intptr_t i = 0; i < InputCount(); ++i) { @@ -130,18 +123,15 @@ bool Instruction::Equals(Instruction* other) const { return AttributesEqual(other); } - void Instruction::Unsupported(FlowGraphCompiler* compiler) { compiler->Bailout(ToCString()); UNREACHABLE(); } - bool Value::Equals(Value* other) const { return definition() == other->definition(); } - static int OrderById(CidRange* const* a, CidRange* const* b) { // Negative if 'a' should sort before 'b'. ASSERT((*a)->IsSingleCid()); @@ -149,7 +139,6 @@ static int OrderById(CidRange* const* a, CidRange* const* b) { return (*a)->cid_start - (*b)->cid_start; } - static int OrderByFrequency(CidRange* const* a, CidRange* const* b) { const TargetInfo* target_info_a = static_cast(*a); const TargetInfo* target_info_b = static_cast(*b); @@ -157,7 +146,6 @@ static int OrderByFrequency(CidRange* const* a, CidRange* const* b) { return target_info_b->count - target_info_a->count; } - bool Cids::ContainsExternalizableCids() const { for (intptr_t i = 0; i < length(); i++) { for (intptr_t cid = cid_ranges_[i]->cid_start; @@ -170,7 +158,6 @@ bool Cids::ContainsExternalizableCids() const { return false; } - bool Cids::Equals(const Cids& other) const { if (length() != other.length()) return false; for (int i = 0; i < length(); i++) { @@ -182,7 +169,6 @@ bool Cids::Equals(const Cids& other) const { return true; } - intptr_t Cids::ComputeLowestCid() const { intptr_t min = kIntptrMax; for (intptr_t i = 0; i < cid_ranges_.length(); ++i) { @@ -191,7 +177,6 @@ intptr_t Cids::ComputeLowestCid() const { return min; } - intptr_t Cids::ComputeHighestCid() const { intptr_t max = -1; for (intptr_t i = 0; i < cid_ranges_.length(); ++i) { @@ -200,7 +185,6 @@ intptr_t Cids::ComputeHighestCid() const { return max; } - bool Cids::HasClassId(intptr_t cid) const { for (int i = 0; i < length(); i++) { if (cid_ranges_[i]->Contains(cid)) { @@ -210,14 +194,12 @@ bool Cids::HasClassId(intptr_t cid) const { return false; } - Cids* Cids::CreateMonomorphic(Zone* zone, intptr_t cid) { Cids* cids = new (zone) Cids(zone); cids->Add(new (zone) CidRange(cid, cid)); return cids; } - Cids* Cids::Create(Zone* zone, const ICData& ic_data, int argument_number) { Cids* cids = new (zone) Cids(zone); cids->CreateHelper(zone, ic_data, argument_number, @@ -240,7 +222,6 @@ Cids* Cids::Create(Zone* zone, const ICData& ic_data, int argument_number) { return cids; } - void Cids::CreateHelper(Zone* zone, const ICData& ic_data, int argument_number, @@ -274,19 +255,16 @@ void Cids::CreateHelper(Zone* zone, } } - bool Cids::IsMonomorphic() const { if (length() != 1) return false; return cid_ranges_[0]->IsSingleCid(); } - intptr_t Cids::MonomorphicReceiverCid() const { ASSERT(IsMonomorphic()); return cid_ranges_[0]->cid_start; } - CheckClassInstr::CheckClassInstr(Value* value, intptr_t deopt_id, const Cids& cids, @@ -305,21 +283,18 @@ CheckClassInstr::CheckClassInstr(Value* value, cids[0].cid_start != kSmiCid); } - bool CheckClassInstr::AttributesEqual(Instruction* other) const { CheckClassInstr* other_check = other->AsCheckClass(); ASSERT(other_check != NULL); return cids().Equals(other_check->cids()); } - EffectSet CheckClassInstr::Dependencies() const { // Externalization of strings via the API can change the class-id. return cids_.ContainsExternalizableCids() ? EffectSet::Externalization() : EffectSet::None(); } - EffectSet CheckClassIdInstr::Dependencies() const { // Externalization of strings via the API can change the class-id. for (intptr_t i = cids_.cid_start; i <= cids_.cid_end; i++) { @@ -328,7 +303,6 @@ EffectSet CheckClassIdInstr::Dependencies() const { return EffectSet::None(); } - bool CheckClassInstr::IsDeoptIfNull() const { if (!cids().IsMonomorphic()) { return false; @@ -340,7 +314,6 @@ bool CheckClassInstr::IsDeoptIfNull() const { return in_type->is_nullable() && (in_type->ToNullableCid() == cid); } - // Null object is a singleton of null-class (except for some sentinel, // transitional temporaries). Instead of checking against the null class only // we can check against null instance instead. @@ -352,7 +325,6 @@ bool CheckClassInstr::IsDeoptIfNotNull() const { return cid == kNullCid; } - bool CheckClassInstr::IsCompactCidRange(const Cids& cids) { const intptr_t number_of_checks = cids.length(); // If there are only two checks, the extra register pressure needed for the @@ -367,12 +339,10 @@ bool CheckClassInstr::IsCompactCidRange(const Cids& cids) { return (max - min) < kBitsPerWord; } - bool CheckClassInstr::IsBitTest() const { return is_bit_test_; } - intptr_t CheckClassInstr::ComputeCidMask() const { ASSERT(IsBitTest()); intptr_t min = cids_.ComputeLowestCid(); @@ -390,19 +360,16 @@ intptr_t CheckClassInstr::ComputeCidMask() const { return mask; } - bool LoadFieldInstr::IsUnboxedLoad() const { return FLAG_unbox_numeric_fields && (field() != NULL) && FlowGraphCompiler::IsUnboxedField(*field()); } - bool LoadFieldInstr::IsPotentialUnboxedLoad() const { return FLAG_unbox_numeric_fields && (field() != NULL) && FlowGraphCompiler::IsPotentialUnboxedField(*field()); } - Representation LoadFieldInstr::representation() const { if (IsUnboxedLoad()) { const intptr_t cid = field()->UnboxedFieldCid(); @@ -420,19 +387,16 @@ Representation LoadFieldInstr::representation() const { return kTagged; } - bool StoreInstanceFieldInstr::IsUnboxedStore() const { return FLAG_unbox_numeric_fields && !field().IsNull() && FlowGraphCompiler::IsUnboxedField(field()); } - bool StoreInstanceFieldInstr::IsPotentialUnboxedStore() const { return FLAG_unbox_numeric_fields && !field().IsNull() && FlowGraphCompiler::IsPotentialUnboxedField(field()); } - Representation StoreInstanceFieldInstr::RequiredInputRepresentation( intptr_t index) const { ASSERT((index == 0) || (index == 1)); @@ -452,17 +416,14 @@ Representation StoreInstanceFieldInstr::RequiredInputRepresentation( return kTagged; } - bool GuardFieldClassInstr::AttributesEqual(Instruction* other) const { return field().raw() == other->AsGuardFieldClass()->field().raw(); } - bool GuardFieldLengthInstr::AttributesEqual(Instruction* other) const { return field().raw() == other->AsGuardFieldLength()->field().raw(); } - bool AssertAssignableInstr::AttributesEqual(Instruction* other) const { AssertAssignableInstr* other_assert = other->AsAssertAssignable(); ASSERT(other_assert != NULL); @@ -471,7 +432,6 @@ bool AssertAssignableInstr::AttributesEqual(Instruction* other) const { return dst_type().raw() == other_assert->dst_type().raw(); } - bool StrictCompareInstr::AttributesEqual(Instruction* other) const { StrictCompareInstr* other_op = other->AsStrictCompare(); ASSERT(other_op != NULL); @@ -479,7 +439,6 @@ bool StrictCompareInstr::AttributesEqual(Instruction* other) const { (needs_number_check() == other_op->needs_number_check()); } - bool MathMinMaxInstr::AttributesEqual(Instruction* other) const { MathMinMaxInstr* other_op = other->AsMathMinMax(); ASSERT(other_op != NULL); @@ -487,7 +446,6 @@ bool MathMinMaxInstr::AttributesEqual(Instruction* other) const { (result_cid() == other_op->result_cid()); } - bool BinaryIntegerOpInstr::AttributesEqual(Instruction* other) const { ASSERT(other->tag() == tag()); BinaryIntegerOpInstr* other_op = other->AsBinaryIntegerOp(); @@ -496,12 +454,10 @@ bool BinaryIntegerOpInstr::AttributesEqual(Instruction* other) const { (is_truncating() == other_op->is_truncating()); } - EffectSet LoadFieldInstr::Dependencies() const { return immutable_ ? EffectSet::None() : EffectSet::All(); } - bool LoadFieldInstr::AttributesEqual(Instruction* other) const { LoadFieldInstr* other_load = other->AsLoadField(); ASSERT(other_load != NULL); @@ -513,7 +469,6 @@ bool LoadFieldInstr::AttributesEqual(Instruction* other) const { (offset_in_bytes() == other_load->offset_in_bytes()); } - Instruction* InitStaticFieldInstr::Canonicalize(FlowGraph* flow_graph) { const bool is_initialized = (field_.StaticValue() != Object::sentinel().raw()) && @@ -525,14 +480,12 @@ Instruction* InitStaticFieldInstr::Canonicalize(FlowGraph* flow_graph) { return is_initialized && !FLAG_fields_may_be_reset ? NULL : this; } - EffectSet LoadStaticFieldInstr::Dependencies() const { return (StaticField().is_final() && !FLAG_fields_may_be_reset) ? EffectSet::None() : EffectSet::All(); } - bool LoadStaticFieldInstr::AttributesEqual(Instruction* other) const { LoadStaticFieldInstr* other_load = other->AsLoadStaticField(); ASSERT(other_load != NULL); @@ -542,14 +495,12 @@ bool LoadStaticFieldInstr::AttributesEqual(Instruction* other) const { return StaticField().raw() == other_load->StaticField().raw(); } - const Field& LoadStaticFieldInstr::StaticField() const { Field& field = Field::ZoneHandle(); field ^= field_value()->BoundConstant().raw(); return field; } - ConstantInstr::ConstantInstr(const Object& value, TokenPosition token_pos) : value_(value), token_pos_(token_pos) { // Check that the value is not an incorrect Integer representation. @@ -559,14 +510,12 @@ ConstantInstr::ConstantInstr(const Object& value, TokenPosition token_pos) ASSERT(!value.IsField() || Field::Cast(value).IsOriginal()); } - bool ConstantInstr::AttributesEqual(Instruction* other) const { ConstantInstr* other_constant = other->AsConstant(); ASSERT(other_constant != NULL); return (value().raw() == other_constant->value().raw()); } - UnboxedConstantInstr::UnboxedConstantInstr(const Object& value, Representation representation) : ConstantInstr(value), @@ -579,20 +528,17 @@ UnboxedConstantInstr::UnboxedConstantInstr(const Object& value, } } - // Returns true if the value represents a constant. bool Value::BindsToConstant() const { return definition()->IsConstant(); } - // Returns true if the value represents constant null. bool Value::BindsToConstantNull() const { ConstantInstr* constant = definition()->AsConstant(); return (constant != NULL) && constant->value().IsNull(); } - const Object& Value::BoundConstant() const { ASSERT(BindsToConstant()); ConstantInstr* constant = definition()->AsConstant(); @@ -600,7 +546,6 @@ const Object& Value::BoundConstant() const { return constant->value(); } - GraphEntryInstr::GraphEntryInstr(const ParsedFunction& parsed_function, TargetEntryInstr* normal_entry, intptr_t osr_id) @@ -617,7 +562,6 @@ GraphEntryInstr::GraphEntryInstr(const ParsedFunction& parsed_function, spill_slot_count_(0), fixed_slot_count_(0) {} - ConstantInstr* GraphEntryInstr::constant_null() { ASSERT(initial_definitions_.length() > 0); for (intptr_t i = 0; i < initial_definitions_.length(); ++i) { @@ -628,7 +572,6 @@ ConstantInstr* GraphEntryInstr::constant_null() { return NULL; } - CatchBlockEntryInstr* GraphEntryInstr::GetCatchEntry(intptr_t index) { // TODO(fschneider): Sort the catch entries by catch_try_index to avoid // searching. @@ -638,12 +581,10 @@ CatchBlockEntryInstr* GraphEntryInstr::GetCatchEntry(intptr_t index) { return NULL; } - bool GraphEntryInstr::IsCompiledForOsr() const { return osr_id_ != Compiler::kNoOSRDeoptId; } - // ==== Support for visiting flow graphs. #define DEFINE_ACCEPT(ShortName) \ @@ -655,7 +596,6 @@ FOR_EACH_INSTRUCTION(DEFINE_ACCEPT) #undef DEFINE_ACCEPT - void Instruction::SetEnvironment(Environment* deopt_env) { intptr_t use_index = 0; for (Environment::DeepIterator it(deopt_env); !it.Done(); it.Advance()) { @@ -666,7 +606,6 @@ void Instruction::SetEnvironment(Environment* deopt_env) { env_ = deopt_env; } - void Instruction::RemoveEnvironment() { for (Environment::DeepIterator it(env()); !it.Done(); it.Advance()) { it.CurrentValue()->RemoveFromUseList(); @@ -674,7 +613,6 @@ void Instruction::RemoveEnvironment() { env_ = NULL; } - Instruction* Instruction::RemoveFromGraph(bool return_previous) { ASSERT(!IsBlockEntry()); ASSERT(!IsBranch()); @@ -699,7 +637,6 @@ Instruction* Instruction::RemoveFromGraph(bool return_previous) { return return_previous ? prev_instr : next_instr; } - void Instruction::InsertAfter(Instruction* prev) { ASSERT(previous_ == NULL); ASSERT(next_ == NULL); @@ -716,7 +653,6 @@ void Instruction::InsertAfter(Instruction* prev) { } } - Instruction* Instruction::AppendInstruction(Instruction* tail) { LinkTo(tail); // Update def-use chains whenever instructions are added to the graph @@ -728,7 +664,6 @@ Instruction* Instruction::AppendInstruction(Instruction* tail) { return tail; } - BlockEntryInstr* Instruction::GetBlock() { // TODO(fschneider): Implement a faster way to get the block of an // instruction. @@ -739,17 +674,14 @@ BlockEntryInstr* Instruction::GetBlock() { return result->AsBlockEntry(); } - void ForwardInstructionIterator::RemoveCurrentFromGraph() { current_ = current_->RemoveFromGraph(true); // Set current_ to previous. } - void BackwardInstructionIterator::RemoveCurrentFromGraph() { current_ = current_->RemoveFromGraph(false); // Set current_ to next. } - // Default implementation of visiting basic blocks. Can be overridden. void FlowGraphVisitor::VisitBlocks() { ASSERT(current_iterator_ == NULL); @@ -765,7 +697,6 @@ void FlowGraphVisitor::VisitBlocks() { } } - bool Value::NeedsStoreBuffer() { if (Type()->IsNull() || (Type()->ToNullableCid() == kSmiCid) || (Type()->ToNullableCid() == kBoolCid)) { @@ -775,7 +706,6 @@ bool Value::NeedsStoreBuffer() { return !BindsToConstant(); } - void JoinEntryInstr::AddPredecessor(BlockEntryInstr* predecessor) { // Require the predecessors to be sorted by block_id to make managing // their corresponding phi inputs simpler. @@ -793,7 +723,6 @@ void JoinEntryInstr::AddPredecessor(BlockEntryInstr* predecessor) { predecessors_.InsertAt(index, predecessor); } - intptr_t JoinEntryInstr::IndexOfPredecessor(BlockEntryInstr* pred) const { for (intptr_t i = 0; i < predecessors_.length(); ++i) { if (predecessors_[i] == pred) return i; @@ -801,7 +730,6 @@ intptr_t JoinEntryInstr::IndexOfPredecessor(BlockEntryInstr* pred) const { return -1; } - void Value::AddToList(Value* value, Value** list) { Value* next = *list; *list = value; @@ -810,7 +738,6 @@ void Value::AddToList(Value* value, Value** list) { if (next != NULL) next->set_previous_use(value); } - void Value::RemoveFromUseList() { Definition* def = definition(); Value* next = next_use(); @@ -830,7 +757,6 @@ void Value::RemoveFromUseList() { set_next_use(NULL); } - // True if the definition has a single input use and is used only in // environments at the same instruction as that input use. bool Definition::HasOnlyUse(Value* use) const { @@ -845,12 +771,10 @@ bool Definition::HasOnlyUse(Value* use) const { return true; } - bool Definition::HasOnlyInputUse(Value* use) const { return (input_use_list() == use) && (use->next_use() == NULL); } - void Definition::ReplaceUsesWith(Definition* other) { ASSERT(other != NULL); ASSERT(this != other); @@ -890,7 +814,6 @@ void Definition::ReplaceUsesWith(Definition* other) { } } - void Instruction::UnuseAllInputs() { for (intptr_t i = InputCount() - 1; i >= 0; --i) { InputAt(i)->RemoveFromUseList(); @@ -900,7 +823,6 @@ void Instruction::UnuseAllInputs() { } } - void Instruction::InheritDeoptTargetAfter(FlowGraph* flow_graph, Definition* call, Definition* result) { @@ -913,7 +835,6 @@ void Instruction::InheritDeoptTargetAfter(FlowGraph* flow_graph, env()->set_deopt_id(deopt_id_); } - void Instruction::InheritDeoptTarget(Zone* zone, Instruction* other) { ASSERT(other->env() != NULL); CopyDeoptIdFrom(*other); @@ -921,14 +842,12 @@ void Instruction::InheritDeoptTarget(Zone* zone, Instruction* other) { env()->set_deopt_id(deopt_id_); } - void BranchInstr::InheritDeoptTarget(Zone* zone, Instruction* other) { ASSERT(env() == NULL); Instruction::InheritDeoptTarget(zone, other); comparison()->SetDeoptId(*this); } - bool Instruction::IsDominatedBy(Instruction* dom) { BlockEntryInstr* block = GetBlock(); BlockEntryInstr* dom_block = dom->GetBlock(); @@ -956,7 +875,6 @@ bool Instruction::IsDominatedBy(Instruction* dom) { return dom_block->Dominates(block); } - bool Instruction::HasUnmatchedInputRepresentations() const { for (intptr_t i = 0; i < InputCount(); i++) { Definition* input = InputAt(i)->definition(); @@ -968,7 +886,6 @@ bool Instruction::HasUnmatchedInputRepresentations() const { return false; } - void Definition::ReplaceWith(Definition* other, ForwardInstructionIterator* iterator) { // Record other's input uses. @@ -1003,7 +920,6 @@ void Definition::ReplaceWith(Definition* other, set_next(NULL); } - void BranchInstr::SetComparison(ComparisonInstr* new_comparison) { for (intptr_t i = new_comparison->InputCount() - 1; i >= 0; --i) { Value* input = new_comparison->InputAt(i); @@ -1019,7 +935,6 @@ void BranchInstr::SetComparison(ComparisonInstr* new_comparison) { comparison_ = new_comparison; } - // ==== Postorder graph traversal. static bool IsMarked(BlockEntryInstr* block, GrowableArray* preorder) { @@ -1031,7 +946,6 @@ static bool IsMarked(BlockEntryInstr* block, return (i >= 0) && (i < preorder->length()) && ((*preorder)[i] == block); } - // Base class implementation used for JoinEntry and TargetEntry. bool BlockEntryInstr::DiscoverBlock(BlockEntryInstr* predecessor, GrowableArray* preorder, @@ -1083,7 +997,6 @@ bool BlockEntryInstr::DiscoverBlock(BlockEntryInstr* predecessor, return true; } - void GraphEntryInstr::RelinkToOsrEntry(Zone* zone, intptr_t max_block_id) { ASSERT(osr_id_ != Compiler::kNoOSRDeoptId); BitVector* block_marks = new (zone) BitVector(zone, max_block_id + 1); @@ -1091,7 +1004,6 @@ void GraphEntryInstr::RelinkToOsrEntry(Zone* zone, intptr_t max_block_id) { ASSERT(found); } - bool BlockEntryInstr::FindOsrEntryAndRelink(GraphEntryInstr* graph_entry, Instruction* parent, BitVector* block_marks) { @@ -1138,7 +1050,6 @@ bool BlockEntryInstr::FindOsrEntryAndRelink(GraphEntryInstr* graph_entry, return false; } - bool BlockEntryInstr::Dominates(BlockEntryInstr* other) const { // TODO(fschneider): Make this faster by e.g. storing dominators for each // block while computing the dominator tree. @@ -1150,7 +1061,6 @@ bool BlockEntryInstr::Dominates(BlockEntryInstr* other) const { return current == this; } - BlockEntryInstr* BlockEntryInstr::ImmediateDominator() const { Instruction* last = dominator()->last_instruction(); if ((last->SuccessorCount() == 1) && (last->SuccessorAt(0) == this)) { @@ -1159,7 +1069,6 @@ BlockEntryInstr* BlockEntryInstr::ImmediateDominator() const { return NULL; } - // Helper to mutate the graph during inlining. This block should be // replaced with new_block as a predecessor of all of this block's // successors. For each successor, the predecessors will be reordered @@ -1223,7 +1132,6 @@ void BlockEntryInstr::ReplaceAsPredecessorWith(BlockEntryInstr* new_block) { } } - void BlockEntryInstr::ClearAllInstructions() { JoinEntryInstr* join = this->AsJoinEntry(); if (join != NULL) { @@ -1237,7 +1145,6 @@ void BlockEntryInstr::ClearAllInstructions() { } } - PhiInstr* JoinEntryInstr::InsertPhi(intptr_t var_index, intptr_t var_count) { // Lazily initialize the array of phis. // Currently, phis are stored in a sparse array that holds the phi @@ -1253,7 +1160,6 @@ PhiInstr* JoinEntryInstr::InsertPhi(intptr_t var_index, intptr_t var_count) { return (*phis_)[var_index] = new PhiInstr(this, PredecessorCount()); } - void JoinEntryInstr::InsertPhi(PhiInstr* phi) { // Lazily initialize the array of phis. if (phis_ == NULL) { @@ -1298,12 +1204,10 @@ void JoinEntryInstr::RemoveDeadPhis(Definition* replacement) { } } - intptr_t Instruction::SuccessorCount() const { return 0; } - BlockEntryInstr* Instruction::SuccessorAt(intptr_t index) const { // Called only if index is in range. Only control-transfer instructions // can have non-zero successor counts and they override this function. @@ -1311,23 +1215,19 @@ BlockEntryInstr* Instruction::SuccessorAt(intptr_t index) const { return NULL; } - intptr_t GraphEntryInstr::SuccessorCount() const { return 1 + catch_entries_.length(); } - BlockEntryInstr* GraphEntryInstr::SuccessorAt(intptr_t index) const { if (index == 0) return normal_entry_; return catch_entries_[index - 1]; } - intptr_t BranchInstr::SuccessorCount() const { return 2; } - BlockEntryInstr* BranchInstr::SuccessorAt(intptr_t index) const { if (index == 0) return true_successor_; if (index == 1) return false_successor_; @@ -1335,30 +1235,25 @@ BlockEntryInstr* BranchInstr::SuccessorAt(intptr_t index) const { return NULL; } - intptr_t GotoInstr::SuccessorCount() const { return 1; } - BlockEntryInstr* GotoInstr::SuccessorAt(intptr_t index) const { ASSERT(index == 0); return successor(); } - void Instruction::Goto(JoinEntryInstr* entry) { LinkTo(new GotoInstr(entry, Thread::Current()->GetNextDeoptId())); } - bool UnboxedIntConverterInstr::ComputeCanDeoptimize() const { return (to() == kUnboxedInt32) && !is_truncating() && !RangeUtils::Fits(value()->definition()->range(), RangeBoundary::kRangeBoundaryInt32); } - bool UnboxInt32Instr::ComputeCanDeoptimize() const { const intptr_t value_cid = value()->Type()->ToCid(); if (value_cid == kSmiCid) { @@ -1380,7 +1275,6 @@ bool UnboxInt32Instr::ComputeCanDeoptimize() const { } } - bool UnboxUint32Instr::ComputeCanDeoptimize() const { ASSERT(is_truncating()); if ((value()->Type()->ToCid() == kSmiCid) || @@ -1392,7 +1286,6 @@ bool UnboxUint32Instr::ComputeCanDeoptimize() const { return !RangeUtils::Fits(value_range, RangeBoundary::kRangeBoundaryInt64); } - bool BinaryInt32OpInstr::ComputeCanDeoptimize() const { switch (op_kind()) { case Token::kBIT_AND: @@ -1417,7 +1310,6 @@ bool BinaryInt32OpInstr::ComputeCanDeoptimize() const { } } - bool BinarySmiOpInstr::ComputeCanDeoptimize() const { switch (op_kind()) { case Token::kBIT_AND: @@ -1439,12 +1331,10 @@ bool BinarySmiOpInstr::ComputeCanDeoptimize() const { } } - bool ShiftMintOpInstr::IsShiftCountInRange() const { return RangeUtils::IsWithin(shift_range(), 0, kMintShiftCountLimit); } - bool BinaryIntegerOpInstr::RightIsPowerOfTwoConstant() const { if (!right()->definition()->IsConstant()) return false; const Object& constant = right()->definition()->AsConstant()->value(); @@ -1453,7 +1343,6 @@ bool BinaryIntegerOpInstr::RightIsPowerOfTwoConstant() const { return Utils::IsPowerOfTwo(Utils::Abs(int_value)); } - static intptr_t RepresentationBits(Representation r) { switch (r) { case kTagged: @@ -1469,13 +1358,11 @@ static intptr_t RepresentationBits(Representation r) { } } - static int64_t RepresentationMask(Representation r) { return static_cast(static_cast(-1) >> (64 - RepresentationBits(r))); } - static bool ToIntegerConstant(Value* value, int64_t* result) { if (!value->BindsToConstant()) { UnboxInstr* unbox = value->definition()->AsUnbox(); @@ -1518,7 +1405,6 @@ static bool ToIntegerConstant(Value* value, int64_t* result) { return false; } - static Definition* CanonicalizeCommutativeDoubleArithmetic(Token::Kind op, Value* left, Value* right) { @@ -1551,7 +1437,6 @@ static Definition* CanonicalizeCommutativeDoubleArithmetic(Token::Kind op, return NULL; } - Definition* DoubleToFloatInstr::Canonicalize(FlowGraph* flow_graph) { #ifdef DEBUG // Must only be used in Float32 StoreIndexedInstr or FloatToDoubleInstr or @@ -1573,12 +1458,10 @@ Definition* DoubleToFloatInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - Definition* FloatToDoubleInstr::Canonicalize(FlowGraph* flow_graph) { return HasUses() ? this : NULL; } - Definition* BinaryDoubleOpInstr::Canonicalize(FlowGraph* flow_graph) { if (!HasUses()) return NULL; @@ -1606,12 +1489,10 @@ Definition* BinaryDoubleOpInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - Definition* DoubleTestOpInstr::Canonicalize(FlowGraph* flow_graph) { return HasUses() ? this : NULL; } - static bool IsCommutative(Token::Kind op) { switch (op) { case Token::kMUL: @@ -1625,7 +1506,6 @@ static bool IsCommutative(Token::Kind op) { } } - UnaryIntegerOpInstr* UnaryIntegerOpInstr::Make(Representation representation, Token::Kind op_kind, Value* value, @@ -1661,7 +1541,6 @@ UnaryIntegerOpInstr* UnaryIntegerOpInstr::Make(Representation representation, return op; } - BinaryIntegerOpInstr* BinaryIntegerOpInstr::Make(Representation representation, Token::Kind op_kind, Value* left, @@ -1713,7 +1592,6 @@ BinaryIntegerOpInstr* BinaryIntegerOpInstr::Make(Representation representation, return op; } - static bool IsRepresentable(const Integer& value, Representation rep) { switch (rep) { case kTagged: // Smi case. @@ -1736,7 +1614,6 @@ static bool IsRepresentable(const Integer& value, Representation rep) { return false; } - RawInteger* UnaryIntegerOpInstr::Evaluate(const Integer& value) const { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -1774,7 +1651,6 @@ RawInteger* UnaryIntegerOpInstr::Evaluate(const Integer& value) const { return result.raw(); } - RawInteger* BinaryIntegerOpInstr::Evaluate(const Integer& left, const Integer& right) const { Thread* thread = Thread::Current(); @@ -1833,7 +1709,6 @@ RawInteger* BinaryIntegerOpInstr::Evaluate(const Integer& left, return result.raw(); } - Definition* BinaryIntegerOpInstr::CreateConstantResult(FlowGraph* flow_graph, const Integer& result) { Definition* result_defn = flow_graph->GetConstant(result); @@ -1845,7 +1720,6 @@ Definition* BinaryIntegerOpInstr::CreateConstantResult(FlowGraph* flow_graph, return result_defn; } - Definition* CheckedSmiOpInstr::Canonicalize(FlowGraph* flow_graph) { if ((left()->Type()->ToCid() == kSmiCid) && (right()->Type()->ToCid() == kSmiCid)) { @@ -1872,14 +1746,12 @@ Definition* CheckedSmiOpInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - ComparisonInstr* CheckedSmiComparisonInstr::CopyWithNewOperands(Value* left, Value* right) { UNREACHABLE(); return NULL; } - Definition* CheckedSmiComparisonInstr::Canonicalize(FlowGraph* flow_graph) { if ((left()->Type()->ToCid() == kSmiCid) && (right()->Type()->ToCid() == kSmiCid)) { @@ -1901,7 +1773,6 @@ Definition* CheckedSmiComparisonInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - Definition* BinaryIntegerOpInstr::Canonicalize(FlowGraph* flow_graph) { // If both operands are constants evaluate this expression. Might // occur due to load forwarding after constant propagation pass @@ -2051,18 +1922,15 @@ Definition* BinaryIntegerOpInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - // Optimizations that eliminate or simplify individual instructions. Instruction* Instruction::Canonicalize(FlowGraph* flow_graph) { return this; } - Definition* Definition::Canonicalize(FlowGraph* flow_graph) { return this; } - Definition* RedefinitionInstr::Canonicalize(FlowGraph* flow_graph) { if (!HasUses()) { return NULL; @@ -2074,7 +1942,6 @@ Definition* RedefinitionInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - Instruction* CheckStackOverflowInstr::Canonicalize(FlowGraph* flow_graph) { switch (kind_) { case kOsrAndPreemption: @@ -2090,7 +1957,6 @@ Instruction* CheckStackOverflowInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - bool LoadFieldInstr::IsImmutableLengthLoad() const { switch (recognized_kind()) { case MethodRecognizer::kObjectArrayLength: @@ -2103,7 +1969,6 @@ bool LoadFieldInstr::IsImmutableLengthLoad() const { } } - MethodRecognizer::Kind LoadFieldInstr::RecognizedKindFromArrayCid( intptr_t cid) { if (RawObject::IsTypedDataClassId(cid) || @@ -2123,7 +1988,6 @@ MethodRecognizer::Kind LoadFieldInstr::RecognizedKindFromArrayCid( } } - bool LoadFieldInstr::IsFixedLengthArrayCid(intptr_t cid) { if (RawObject::IsTypedDataClassId(cid) || RawObject::IsExternalTypedDataClassId(cid)) { @@ -2139,12 +2003,10 @@ bool LoadFieldInstr::IsFixedLengthArrayCid(intptr_t cid) { } } - Definition* ConstantInstr::Canonicalize(FlowGraph* flow_graph) { return HasUses() ? this : NULL; } - // A math unary instruction has a side effect (exception // thrown) if the argument is not a number. // TODO(srdjan): eliminate if has no uses and input is guaranteed to be number. @@ -2152,7 +2014,6 @@ Definition* MathUnaryInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - bool LoadFieldInstr::Evaluate(const Object& instance, Object* result) { if (field() == NULL || !field()->is_final() || !instance.IsInstance()) { return false; @@ -2174,7 +2035,6 @@ bool LoadFieldInstr::Evaluate(const Object& instance, Object* result) { return true; } - Definition* LoadFieldInstr::Canonicalize(FlowGraph* flow_graph) { if (!HasUses()) return NULL; @@ -2222,7 +2082,6 @@ Definition* LoadFieldInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - Definition* AssertBooleanInstr::Canonicalize(FlowGraph* flow_graph) { if (FLAG_eliminate_type_checks && (value()->Type()->ToCid() == kBoolCid)) { return value()->definition(); @@ -2231,7 +2090,6 @@ Definition* AssertBooleanInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - Definition* AssertAssignableInstr::Canonicalize(FlowGraph* flow_graph) { if (FLAG_eliminate_type_checks && value()->Type()->IsAssignableTo(dst_type())) { @@ -2282,12 +2140,10 @@ Definition* AssertAssignableInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - Definition* InstantiateTypeArgumentsInstr::Canonicalize(FlowGraph* flow_graph) { return (Isolate::Current()->type_checks() || HasUses()) ? this : NULL; } - LocationSummary* DebugStepCheckInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -2297,12 +2153,10 @@ LocationSummary* DebugStepCheckInstr::MakeLocationSummary(Zone* zone, return locs; } - Instruction* DebugStepCheckInstr::Canonicalize(FlowGraph* flow_graph) { return NULL; } - static bool HasTryBlockUse(Value* use_list) { for (Value::Iterator it(use_list); !it.Done(); it.Advance()) { Value* use = it.Current(); @@ -2314,7 +2168,6 @@ static bool HasTryBlockUse(Value* use_list) { return false; } - Definition* BoxInstr::Canonicalize(FlowGraph* flow_graph) { if ((input_use_list() == NULL) && !HasTryBlockUse(env_use_list())) { // Environments can accommodate any representation. No need to box. @@ -2333,13 +2186,11 @@ Definition* BoxInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - bool BoxIntegerInstr::ValueFitsSmi() const { Range* range = value()->definition()->range(); return RangeUtils::Fits(range, RangeBoundary::kRangeBoundarySmi); } - Definition* BoxIntegerInstr::Canonicalize(FlowGraph* flow_graph) { if ((input_use_list() == NULL) && !HasTryBlockUse(env_use_list())) { // Environments can accommodate any representation. No need to box. @@ -2349,7 +2200,6 @@ Definition* BoxIntegerInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - Definition* BoxInt64Instr::Canonicalize(FlowGraph* flow_graph) { Definition* replacement = BoxIntegerInstr::Canonicalize(flow_graph); if (replacement != this) { @@ -2383,7 +2233,6 @@ Definition* BoxInt64Instr::Canonicalize(FlowGraph* flow_graph) { return this; } - Definition* UnboxInstr::Canonicalize(FlowGraph* flow_graph) { if (!HasUses() && !CanDeoptimize()) return NULL; @@ -2416,7 +2265,6 @@ Definition* UnboxInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - Definition* UnboxIntegerInstr::Canonicalize(FlowGraph* flow_graph) { if (!HasUses() && !CanDeoptimize()) return NULL; @@ -2450,7 +2298,6 @@ Definition* UnboxIntegerInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - Definition* UnboxInt32Instr::Canonicalize(FlowGraph* flow_graph) { Definition* replacement = UnboxIntegerInstr::Canonicalize(flow_graph); if (replacement != this) { @@ -2479,7 +2326,6 @@ Definition* UnboxInt32Instr::Canonicalize(FlowGraph* flow_graph) { return this; } - Definition* UnboxedIntConverterInstr::Canonicalize(FlowGraph* flow_graph) { if (!HasUses()) return NULL; @@ -2522,7 +2368,6 @@ Definition* UnboxedIntConverterInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - Definition* BooleanNegateInstr::Canonicalize(FlowGraph* flow_graph) { Definition* defn = value()->definition(); if (defn->IsComparison() && defn->HasOnlyUse(value()) && @@ -2533,13 +2378,11 @@ Definition* BooleanNegateInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - static bool MayBeBoxableNumber(intptr_t cid) { return (cid == kDynamicCid) || (cid == kMintCid) || (cid == kBigintCid) || (cid == kDoubleCid); } - static bool MaybeNumber(CompileType* type) { ASSERT(Type::Handle(Type::Number()) .IsMoreSpecificThan(Type::Handle(Type::Number()), NULL, NULL, @@ -2550,7 +2393,6 @@ static bool MaybeNumber(CompileType* type) { type->IsMoreSpecificThan(Type::Handle(Type::Number())); } - // Returns a replacement for a strict comparison and signals if the result has // to be negated. static Definition* CanonicalizeStrictCompare(StrictCompareInstr* compare, @@ -2611,13 +2453,11 @@ static Definition* CanonicalizeStrictCompare(StrictCompareInstr* compare, return compare; } - static bool BindsToGivenConstant(Value* v, intptr_t expected) { return v->BindsToConstant() && v->BoundConstant().IsSmi() && (Smi::Cast(v->BoundConstant()).Value() == expected); } - // Recognize patterns (a & b) == 0 and (a & 2^n) != 2^n. static bool RecognizeTestPattern(Value* left, Value* right, bool* negate) { if (!right->BindsToConstant() || !right->BoundConstant().IsSmi()) { @@ -2629,7 +2469,6 @@ static bool RecognizeTestPattern(Value* left, Value* right, bool* negate) { return false; } - BinarySmiOpInstr* mask_op = left->definition()->AsBinarySmiOp(); if ((mask_op == NULL) || (mask_op->op_kind() != Token::kBIT_AND) || !mask_op->HasOnlyUse(left)) { @@ -2654,7 +2493,6 @@ static bool RecognizeTestPattern(Value* left, Value* right, bool* negate) { return false; } - Instruction* BranchInstr::Canonicalize(FlowGraph* flow_graph) { Zone* zone = flow_graph->zone(); // Only handle strict-compares. @@ -2725,7 +2563,6 @@ Instruction* BranchInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - Definition* StrictCompareInstr::Canonicalize(FlowGraph* flow_graph) { if (!HasUses()) return NULL; bool negated = false; @@ -2738,7 +2575,6 @@ Definition* StrictCompareInstr::Canonicalize(FlowGraph* flow_graph) { return replacement; } - Instruction* CheckClassInstr::Canonicalize(FlowGraph* flow_graph) { const intptr_t value_cid = value()->Type()->ToCid(); if (value_cid == kDynamicCid) { @@ -2748,7 +2584,6 @@ Instruction* CheckClassInstr::Canonicalize(FlowGraph* flow_graph) { return cids().HasClassId(value_cid) ? NULL : this; } - Instruction* CheckClassIdInstr::Canonicalize(FlowGraph* flow_graph) { if (value()->BindsToConstant()) { const Object& constant_value = value()->BoundConstant(); @@ -2760,7 +2595,6 @@ Instruction* CheckClassIdInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - TestCidsInstr::TestCidsInstr(TokenPosition token_pos, Token::Kind kind, Value* value, @@ -2784,7 +2618,6 @@ TestCidsInstr::TestCidsInstr(TokenPosition token_pos, #endif } - Definition* TestCidsInstr::Canonicalize(FlowGraph* flow_graph) { CompileType* in_type = left()->Type(); intptr_t cid = in_type->ToCid(); @@ -2812,7 +2645,6 @@ Definition* TestCidsInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - Instruction* GuardFieldClassInstr::Canonicalize(FlowGraph* flow_graph) { if (field().guarded_cid() == kDynamicCid) { return NULL; // Nothing to guard. @@ -2831,7 +2663,6 @@ Instruction* GuardFieldClassInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - Instruction* GuardFieldLengthInstr::Canonicalize(FlowGraph* flow_graph) { if (!field().needs_length_check()) { return NULL; // Nothing to guard. @@ -2861,12 +2692,10 @@ Instruction* GuardFieldLengthInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - Instruction* CheckSmiInstr::Canonicalize(FlowGraph* flow_graph) { return (value()->Type()->ToCid() == kSmiCid) ? NULL : this; } - Instruction* CheckEitherNonSmiInstr::Canonicalize(FlowGraph* flow_graph) { if ((left()->Type()->ToCid() == kDoubleCid) || (right()->Type()->ToCid() == kDoubleCid)) { @@ -2875,7 +2704,6 @@ Instruction* CheckEitherNonSmiInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - BoxInstr* BoxInstr::Create(Representation from, Value* value) { switch (from) { case kUnboxedInt32: @@ -2899,7 +2727,6 @@ BoxInstr* BoxInstr::Create(Representation from, Value* value) { } } - UnboxInstr* UnboxInstr::Create(Representation to, Value* value, intptr_t deopt_id) { @@ -2926,7 +2753,6 @@ UnboxInstr* UnboxInstr::Create(Representation to, } } - bool UnboxInstr::CanConvertSmi() const { switch (representation()) { case kUnboxedDouble: @@ -2944,7 +2770,6 @@ bool UnboxInstr::CanConvertSmi() const { } } - CallTargets* CallTargets::Create(Zone* zone, const ICData& ic_data) { CallTargets* targets = new (zone) CallTargets(zone); targets->CreateHelper(zone, ic_data, /* argument_number = */ 0, @@ -2954,7 +2779,6 @@ CallTargets* CallTargets::Create(Zone* zone, const ICData& ic_data) { return targets; } - CallTargets* CallTargets::CreateAndExpand(Zone* zone, const ICData& ic_data) { CallTargets& targets = *new (zone) CallTargets(zone); targets.CreateHelper(zone, ic_data, /* argument_number = */ 0, @@ -3014,7 +2838,6 @@ CallTargets* CallTargets::CreateAndExpand(Zone* zone, const ICData& ic_data) { return &targets; } - void CallTargets::MergeIntoRanges() { // Merge adjacent class id ranges. int dest = 0; @@ -3040,7 +2863,6 @@ void CallTargets::MergeIntoRanges() { Sort(OrderByFrequency); } - // Shared code generation methods (EmitNativeCode and // MakeLocationSummary). Only assembly code that can be shared across all // architectures can be used. Machine specific register allocation and code @@ -3054,14 +2876,12 @@ LocationSummary* GraphEntryInstr::MakeLocationSummary(Zone* zone, return NULL; } - LocationSummary* JoinEntryInstr::MakeLocationSummary(Zone* zone, bool optimizing) const { UNREACHABLE(); return NULL; } - void JoinEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(compiler->GetJumpLabel(this)); if (!compiler->is_optimizing()) { @@ -3073,14 +2893,12 @@ void JoinEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* TargetEntryInstr::MakeLocationSummary(Zone* zone, bool optimizing) const { UNREACHABLE(); return NULL; } - void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(compiler->GetJumpLabel(this)); if (!compiler->is_optimizing()) { @@ -3103,7 +2921,6 @@ void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - void IndirectGotoInstr::ComputeOffsetTable() { if (GetBlock()->offset() < 0) { // Don't generate a table when contained in an unreachable block. @@ -3137,55 +2954,46 @@ void IndirectGotoInstr::ComputeOffsetTable() { } } - LocationSummary* IndirectEntryInstr::MakeLocationSummary( Zone* zone, bool optimizing) const { return JoinEntryInstr::MakeLocationSummary(zone, optimizing); } - void IndirectEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { JoinEntryInstr::EmitNativeCode(compiler); } - LocationSummary* PhiInstr::MakeLocationSummary(Zone* zone, bool optimizing) const { UNREACHABLE(); return NULL; } - void PhiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { UNREACHABLE(); } - LocationSummary* RedefinitionInstr::MakeLocationSummary(Zone* zone, bool optimizing) const { UNREACHABLE(); return NULL; } - void RedefinitionInstr::EmitNativeCode(FlowGraphCompiler* compiler) { UNREACHABLE(); } - LocationSummary* ParameterInstr::MakeLocationSummary(Zone* zone, bool optimizing) const { UNREACHABLE(); return NULL; } - void ParameterInstr::EmitNativeCode(FlowGraphCompiler* compiler) { UNREACHABLE(); } - bool ParallelMoveInstr::IsRedundant() const { for (intptr_t i = 0; i < moves_.length(); i++) { if (!moves_[i]->IsRedundant()) { @@ -3195,30 +3003,25 @@ bool ParallelMoveInstr::IsRedundant() const { return true; } - LocationSummary* ParallelMoveInstr::MakeLocationSummary(Zone* zone, bool optimizing) const { return NULL; } - void ParallelMoveInstr::EmitNativeCode(FlowGraphCompiler* compiler) { UNREACHABLE(); } - LocationSummary* ConstraintInstr::MakeLocationSummary(Zone* zone, bool optimizing) const { UNREACHABLE(); return NULL; } - void ConstraintInstr::EmitNativeCode(FlowGraphCompiler* compiler) { UNREACHABLE(); } - LocationSummary* MaterializeObjectInstr::MakeLocationSummary( Zone* zone, bool optimizing) const { @@ -3226,12 +3029,10 @@ LocationSummary* MaterializeObjectInstr::MakeLocationSummary( return NULL; } - void MaterializeObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { UNREACHABLE(); } - // This function should be kept in sync with // FlowGraphCompiler::SlowPathEnvironmentFor(). void MaterializeObjectInstr::RemapRegisters(intptr_t* cpu_reg_slots, @@ -3247,7 +3048,6 @@ void MaterializeObjectInstr::RemapRegisters(intptr_t* cpu_reg_slots, } } - LocationSummary* SpecialParameterInstr::MakeLocationSummary(Zone* zone, bool opt) const { // Only appears in initial definitions, never in normal code. @@ -3255,13 +3055,11 @@ LocationSummary* SpecialParameterInstr::MakeLocationSummary(Zone* zone, return NULL; } - void SpecialParameterInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // Only appears in initial definitions, never in normal code. UNREACHABLE(); } - LocationSummary* DropTempsInstr::MakeLocationSummary(Zone* zone, bool optimizing) const { return (InputCount() == 1) @@ -3271,7 +3069,6 @@ LocationSummary* DropTempsInstr::MakeLocationSummary(Zone* zone, LocationSummary::kNoCall); } - void DropTempsInstr::EmitNativeCode(FlowGraphCompiler* compiler) { #if defined(TARGET_ARCH_DBC) // On DBC the action of poping the TOS value and then pushing it @@ -3292,7 +3089,6 @@ void DropTempsInstr::EmitNativeCode(FlowGraphCompiler* compiler) { #endif // defined(TARGET_ARCH_DBC) } - StrictCompareInstr::StrictCompareInstr(TokenPosition token_pos, Token::Kind kind, Value* left, @@ -3306,13 +3102,11 @@ StrictCompareInstr::StrictCompareInstr(TokenPosition token_pos, SetInputAt(1, right); } - LocationSummary* InstanceCallInstr::MakeLocationSummary(Zone* zone, bool optimizing) const { return MakeCallSummary(zone); } - // DBC does not use specialized inline cache stubs for smi operations. #if !defined(TARGET_ARCH_DBC) static const StubEntry* TwoArgsSmiOpInlineCacheEntry(Token::Kind kind) { @@ -3373,7 +3167,6 @@ static void TryFastPathSmiOp(FlowGraphCompiler* compiler, } #endif - void InstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Zone* zone = compiler->zone(); const ICData* call_ic_data = NULL; @@ -3464,12 +3257,10 @@ void InstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { #endif // !defined(TARGET_ARCH_DBC) } - bool InstanceCallInstr::MatchesCoreName(const String& name) { return function_name().raw() == Library::PrivateCoreLibName(name).raw(); } - RawFunction* InstanceCallInstr::ResolveForReceiverClass(const Class& cls) { const Array& args_desc_array = Array::Handle(GetArgumentsDescriptor()); ArgumentsDescriptor args_desc(args_desc_array); @@ -3477,14 +3268,12 @@ RawFunction* InstanceCallInstr::ResolveForReceiverClass(const Class& cls) { args_desc); } - bool CallTargets::HasSingleRecognizedTarget() const { if (!HasSingleTarget()) return false; return MethodRecognizer::RecognizeKind(FirstTarget()) != MethodRecognizer::kUnknown; } - bool CallTargets::HasSingleTarget() const { ASSERT(length() != 0); for (int i = 0; i < length(); i++) { @@ -3493,14 +3282,12 @@ bool CallTargets::HasSingleTarget() const { return true; } - const Function& CallTargets::FirstTarget() const { ASSERT(length() != 0); ASSERT(TargetAt(0)->target->IsZoneHandle()); return *TargetAt(0)->target; } - const Function& CallTargets::MostPopularTarget() const { ASSERT(length() != 0); ASSERT(TargetAt(0)->target->IsZoneHandle()); @@ -3510,7 +3297,6 @@ const Function& CallTargets::MostPopularTarget() const { return *TargetAt(0)->target; } - intptr_t CallTargets::AggregateCallCount() const { intptr_t sum = 0; for (int i = 0; i < length(); i++) { @@ -3519,7 +3305,6 @@ intptr_t CallTargets::AggregateCallCount() const { return sum; } - bool PolymorphicInstanceCallInstr::HasOnlyDispatcherOrImplicitAccessorTargets() const { const intptr_t len = targets_.length(); @@ -3533,12 +3318,10 @@ bool PolymorphicInstanceCallInstr::HasOnlyDispatcherOrImplicitAccessorTargets() return true; } - intptr_t PolymorphicInstanceCallInstr::CallCount() const { return targets().AggregateCallCount(); } - // DBC does not support optimizing compiler and thus doesn't emit // PolymorphicInstanceCallInstr. #if !defined(TARGET_ARCH_DBC) @@ -3552,7 +3335,6 @@ void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } #endif - RawType* PolymorphicInstanceCallInstr::ComputeRuntimeType( const CallTargets& targets) { bool is_string = true; @@ -3586,7 +3368,6 @@ RawType* PolymorphicInstanceCallInstr::ComputeRuntimeType( return Type::null(); } - Definition* InstanceCallInstr::Canonicalize(FlowGraph* flow_graph) { const intptr_t receiver_cid = PushArgumentAt(0)->value()->Type()->ToCid(); @@ -3614,7 +3395,6 @@ Definition* InstanceCallInstr::Canonicalize(FlowGraph* flow_graph) { return specialized; } - Definition* PolymorphicInstanceCallInstr::Canonicalize(FlowGraph* flow_graph) { if (!IsSureToCallSingleRecognizedTarget()) { return this; @@ -3632,13 +3412,11 @@ Definition* PolymorphicInstanceCallInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - bool PolymorphicInstanceCallInstr::IsSureToCallSingleRecognizedTarget() const { if (FLAG_precompiled_mode && !complete()) return false; return targets_.HasSingleRecognizedTarget(); } - Definition* StaticCallInstr::Canonicalize(FlowGraph* flow_graph) { if (!FLAG_precompiled_mode) { return this; @@ -3655,13 +3433,11 @@ Definition* StaticCallInstr::Canonicalize(FlowGraph* flow_graph) { return this; } - LocationSummary* StaticCallInstr::MakeLocationSummary(Zone* zone, bool optimizing) const { return MakeCallSummary(zone); } - void StaticCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Zone* zone = compiler->zone(); const ICData* call_ic_data = NULL; @@ -3717,7 +3493,6 @@ void StaticCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { #endif // !defined(TARGET_ARCH_DBC) } - void AssertAssignableInstr::EmitNativeCode(FlowGraphCompiler* compiler) { compiler->GenerateAssertAssignable(token_pos(), deopt_id(), dst_type(), dst_name(), locs()); @@ -3728,13 +3503,11 @@ void AssertAssignableInstr::EmitNativeCode(FlowGraphCompiler* compiler) { #endif // !defined(TARGET_ARCH_DBC) } - LocationSummary* DeoptimizeInstr::MakeLocationSummary(Zone* zone, bool opt) const { return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kNoCall); } - void DeoptimizeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { #if !defined(TARGET_ARCH_DBC) __ Jump(compiler->AddDeoptStub(deopt_id(), deopt_reason_)); @@ -3743,7 +3516,6 @@ void DeoptimizeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { #endif } - #if !defined(TARGET_ARCH_DBC) void CheckClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckClass, @@ -3790,7 +3562,6 @@ void CheckClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } #endif - Environment* Environment::From(Zone* zone, const GrowableArray& definitions, intptr_t fixed_parameter_count, @@ -3804,12 +3575,10 @@ Environment* Environment::From(Zone* zone, return env; } - void Environment::PushValue(Value* value) { values_.Add(value); } - Environment* Environment::DeepCopy(Zone* zone, intptr_t length) const { ASSERT(length <= values_.length()); Environment* copy = new (zone) @@ -3828,7 +3597,6 @@ Environment* Environment::DeepCopy(Zone* zone, intptr_t length) const { return copy; } - // Copies the environment and updates the environment use lists. void Environment::DeepCopyTo(Zone* zone, Instruction* instr) const { for (Environment::DeepIterator it(instr->env()); !it.Done(); it.Advance()) { @@ -3843,7 +3611,6 @@ void Environment::DeepCopyTo(Zone* zone, Instruction* instr) const { } } - void Environment::DeepCopyAfterTo(Zone* zone, Instruction* instr, intptr_t argc, @@ -3866,7 +3633,6 @@ void Environment::DeepCopyAfterTo(Zone* zone, } } - // Copies the environment as outer on an inlined instruction and updates the // environment use lists. void Environment::DeepCopyToOuter(Zone* zone, Instruction* instr) const { @@ -3885,48 +3651,41 @@ void Environment::DeepCopyToOuter(Zone* zone, Instruction* instr) const { } } - ComparisonInstr* DoubleTestOpInstr::CopyWithNewOperands(Value* new_left, Value* new_right) { UNREACHABLE(); return NULL; } - ComparisonInstr* EqualityCompareInstr::CopyWithNewOperands(Value* new_left, Value* new_right) { return new EqualityCompareInstr(token_pos(), kind(), new_left, new_right, operation_cid(), deopt_id()); } - ComparisonInstr* RelationalOpInstr::CopyWithNewOperands(Value* new_left, Value* new_right) { return new RelationalOpInstr(token_pos(), kind(), new_left, new_right, operation_cid(), deopt_id()); } - ComparisonInstr* StrictCompareInstr::CopyWithNewOperands(Value* new_left, Value* new_right) { return new StrictCompareInstr(token_pos(), kind(), new_left, new_right, needs_number_check(), Thread::kNoDeoptId); } - ComparisonInstr* TestSmiInstr::CopyWithNewOperands(Value* new_left, Value* new_right) { return new TestSmiInstr(token_pos(), kind(), new_left, new_right); } - ComparisonInstr* TestCidsInstr::CopyWithNewOperands(Value* new_left, Value* new_right) { return new TestCidsInstr(token_pos(), kind(), new_left, cid_results(), deopt_id()); } - bool TestCidsInstr::AttributesEqual(Instruction* other) const { TestCidsInstr* other_instr = other->AsTestCids(); if (!ComparisonInstr::AttributesEqual(other)) { @@ -3943,14 +3702,12 @@ bool TestCidsInstr::AttributesEqual(Instruction* other) const { return true; } - #if !defined(TARGET_ARCH_DBC) static bool BindsToSmiConstant(Value* value) { return value->BindsToConstant() && value->BoundConstant().IsSmi(); } #endif - bool IfThenElseInstr::Supports(ComparisonInstr* comparison, Value* v1, Value* v2) { @@ -3972,7 +3729,6 @@ bool IfThenElseInstr::Supports(ComparisonInstr* comparison, #endif // !defined(TARGET_ARCH_DBC) } - bool PhiInstr::IsRedundant() const { ASSERT(InputCount() > 1); Definition* first = InputAt(0)->definition(); @@ -3983,19 +3739,16 @@ bool PhiInstr::IsRedundant() const { return true; } - bool CheckArrayBoundInstr::IsFixedLengthArrayType(intptr_t cid) { return LoadFieldInstr::IsFixedLengthArrayCid(cid); } - Instruction* CheckArrayBoundInstr::Canonicalize(FlowGraph* flow_graph) { return IsRedundant(RangeBoundary::FromDefinition(length()->definition())) ? NULL : this; } - intptr_t CheckArrayBoundInstr::LengthOffsetFor(intptr_t class_id) { if (RawObject::IsExternalTypedDataClassId(class_id)) { return ExternalTypedData::length_offset(); @@ -4018,7 +3771,6 @@ intptr_t CheckArrayBoundInstr::LengthOffsetFor(intptr_t class_id) { } } - const Function& StringInterpolateInstr::CallFunction() const { if (function_.IsNull()) { const int kTypeArgsLen = 0; @@ -4035,7 +3787,6 @@ const Function& StringInterpolateInstr::CallFunction() const { return function_; } - // Replace StringInterpolateInstr with a constant string if all inputs are // constant of [string, number, boolean, null]. // Leave the CreateArrayInstr and StoreIndexedInstr in the stream in case @@ -4109,7 +3860,6 @@ Definition* StringInterpolateInstr::Canonicalize(FlowGraph* flow_graph) { return flow_graph->GetConstant(concatenated); } - static AlignmentType StrengthenAlignment(intptr_t cid, AlignmentType alignment) { switch (cid) { @@ -4133,7 +3883,6 @@ static AlignmentType StrengthenAlignment(intptr_t cid, return alignment; } - LoadIndexedInstr::LoadIndexedInstr(Value* array, Value* index, intptr_t index_scale, @@ -4150,7 +3899,6 @@ LoadIndexedInstr::LoadIndexedInstr(Value* array, SetInputAt(1, index); } - StoreIndexedInstr::StoreIndexedInstr(Value* array, Value* index, Value* value, @@ -4171,7 +3919,6 @@ StoreIndexedInstr::StoreIndexedInstr(Value* array, SetInputAt(kValuePos, value); } - InvokeMathCFunctionInstr::InvokeMathCFunctionInstr( ZoneGrowableArray* inputs, intptr_t deopt_id, @@ -4189,7 +3936,6 @@ InvokeMathCFunctionInstr::InvokeMathCFunctionInstr( } } - intptr_t InvokeMathCFunctionInstr::ArgumentCountFor( MethodRecognizer::Kind kind) { switch (kind) { @@ -4217,7 +3963,6 @@ intptr_t InvokeMathCFunctionInstr::ArgumentCountFor( return 0; } - const RuntimeEntry& InvokeMathCFunctionInstr::TargetFunction() const { switch (recognized_kind_) { case MethodRecognizer::kDoubleTruncate: @@ -4252,7 +3997,6 @@ const RuntimeEntry& InvokeMathCFunctionInstr::TargetFunction() const { return kLibcPowRuntimeEntry; } - const char* MathUnaryInstr::KindToCString(MathUnaryKind kind) { switch (kind) { case kIllegal: @@ -4266,19 +4010,16 @@ const char* MathUnaryInstr::KindToCString(MathUnaryKind kind) { return ""; } - const RuntimeEntry& CaseInsensitiveCompareUC16Instr::TargetFunction() const { return kCaseInsensitiveCompareUC16RuntimeEntry; } - TruncDivModInstr::TruncDivModInstr(Value* lhs, Value* rhs, intptr_t deopt_id) : TemplateDefinition(deopt_id) { SetInputAt(0, lhs); SetInputAt(1, rhs); } - intptr_t TruncDivModInstr::OutputIndexOf(Token::Kind token) { switch (token) { case Token::kTRUNCDIV: @@ -4291,7 +4032,6 @@ intptr_t TruncDivModInstr::OutputIndexOf(Token::Kind token) { } } - void NativeCallInstr::SetupNative() { if (link_lazily()) { // Resolution will happen during NativeEntry::LinkNativeCall. diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h index 4b2a4eaff1b..7a16660adfc 100644 --- a/runtime/vm/intermediate_language.h +++ b/runtime/vm/intermediate_language.h @@ -178,7 +178,6 @@ class CompileType : public ZoneAllocated { const AbstractType* type_; }; - class EffectSet : public ValueObject { public: enum Effects { @@ -207,7 +206,6 @@ class EffectSet : public ValueObject { intptr_t effects_; }; - class Value : public ZoneAllocated { public: // A forward iterator that allows removing the current value from the @@ -311,7 +309,6 @@ class Value : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(Value); }; - // An embedded container with N elements of type T. Used (with partial // specialization for N=0) because embedded arrays cannot have size 0. template @@ -339,7 +336,6 @@ class EmbeddedArray { T elements_[N]; }; - template class EmbeddedArray { public: @@ -356,7 +352,6 @@ class EmbeddedArray { } }; - // Instructions. // M is a single argument macro. It is applied to each concrete instruction @@ -569,7 +564,6 @@ FOR_EACH_ABSTRACT_INSTRUCTION(FORWARD_DECLARATION) #define PRINT_OPERANDS_TO_SUPPORT #endif // !PRODUCT - // Represents a range of class-ids for use in class checks and polymorphic // dispatches. struct CidRange : public ZoneAllocated { @@ -586,7 +580,6 @@ struct CidRange : public ZoneAllocated { intptr_t cid_end; }; - // Together with CidRange, this represents a mapping from a range of class-ids // to a method for a given selector (method name). Also can contain an // indication of how frequently a given method has been called at a call site. @@ -605,7 +598,6 @@ struct TargetInfo : public CidRange { intptr_t count; }; - // A set of class-ids, arranged in ranges. Used for the CheckClass // and PolymorphicInstanceCall instructions. class Cids : public ZoneAllocated { @@ -654,7 +646,6 @@ class Cids : public ZoneAllocated { DISALLOW_IMPLICIT_CONSTRUCTORS(Cids); }; - class CallTargets : public Cids { public: explicit CallTargets(Zone* zone) : Cids(zone) {} @@ -679,7 +670,6 @@ class CallTargets : public Cids { void MergeIntoRanges(); }; - class Instruction : public ZoneAllocated { public: #define DECLARE_TAG(type) k##type, @@ -985,14 +975,12 @@ class Instruction : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(Instruction); }; - struct BranchLabels { Label* true_label; Label* false_label; Label* fall_through; }; - class PureInstruction : public Instruction { public: explicit PureInstruction(intptr_t deopt_id) : Instruction(deopt_id) {} @@ -1003,18 +991,15 @@ class PureInstruction : public Instruction { virtual EffectSet Effects() const { return EffectSet::None(); } }; - // Types to be used as ThrowsTrait for TemplateInstruction/TemplateDefinition. struct Throws { static const bool kCanThrow = true; }; - struct NoThrow { static const bool kCanThrow = false; }; - // Types to be used as CSETrait for TemplateInstruction/TemplateDefinition. // Pure instructions are those that allow CSE and have no effects and // no dependencies. @@ -1023,13 +1008,11 @@ struct Pure { typedef PureBase Base; }; - template struct NoCSE { typedef DefaultBase Base; }; - template class CSETrait = NoCSE> @@ -1051,7 +1034,6 @@ class TemplateInstruction virtual void RawSetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } }; - class MoveOperands : public ZoneAllocated { public: MoveOperands(Location dest, Location src) : dest_(dest), src_(src) {} @@ -1109,7 +1091,6 @@ class MoveOperands : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(MoveOperands); }; - class ParallelMoveInstr : public TemplateInstruction<0, NoThrow> { public: ParallelMoveInstr() : moves_(4) {} @@ -1154,7 +1135,6 @@ class ParallelMoveInstr : public TemplateInstruction<0, NoThrow> { DISALLOW_COPY_AND_ASSIGN(ParallelMoveInstr); }; - // Basic block entries are administrative nodes. There is a distinguished // graph entry with no predecessor. Joins are the only nodes with multiple // predecessors. Targets are all other basic block entries. The types @@ -1338,7 +1318,6 @@ class BlockEntryInstr : public Instruction { DISALLOW_COPY_AND_ASSIGN(BlockEntryInstr); }; - class ForwardInstructionIterator : public ValueObject { public: explicit ForwardInstructionIterator(BlockEntryInstr* block_entry) @@ -1362,7 +1341,6 @@ class ForwardInstructionIterator : public ValueObject { Instruction* current_; }; - class BackwardInstructionIterator : public ValueObject { public: explicit BackwardInstructionIterator(BlockEntryInstr* block_entry) @@ -1386,7 +1364,6 @@ class BackwardInstructionIterator : public ValueObject { Instruction* current_; }; - class GraphEntryInstr : public BlockEntryInstr { public: GraphEntryInstr(const ParsedFunction& parsed_function, @@ -1469,7 +1446,6 @@ class GraphEntryInstr : public BlockEntryInstr { DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr); }; - class JoinEntryInstr : public BlockEntryInstr { public: JoinEntryInstr(intptr_t block_id, intptr_t try_index, intptr_t deopt_id) @@ -1520,7 +1496,6 @@ class JoinEntryInstr : public BlockEntryInstr { DISALLOW_COPY_AND_ASSIGN(JoinEntryInstr); }; - class PhiIterator : public ValueObject { public: explicit PhiIterator(JoinEntryInstr* join) : phis_(join->phis()), index_(0) {} @@ -1539,7 +1514,6 @@ class PhiIterator : public ValueObject { intptr_t index_; }; - class TargetEntryInstr : public BlockEntryInstr { public: TargetEntryInstr(intptr_t block_id, intptr_t try_index, intptr_t deopt_id) @@ -1578,7 +1552,6 @@ class TargetEntryInstr : public BlockEntryInstr { DISALLOW_COPY_AND_ASSIGN(TargetEntryInstr); }; - class IndirectEntryInstr : public JoinEntryInstr { public: IndirectEntryInstr(intptr_t block_id, @@ -1598,7 +1571,6 @@ class IndirectEntryInstr : public JoinEntryInstr { const intptr_t indirect_id_; }; - class CatchBlockEntryInstr : public BlockEntryInstr { public: CatchBlockEntryInstr(TokenPosition handler_token_pos, @@ -1684,7 +1656,6 @@ class CatchBlockEntryInstr : public BlockEntryInstr { DISALLOW_COPY_AND_ASSIGN(CatchBlockEntryInstr); }; - // If the result of the allocation is not stored into any field, passed // as an argument or used in a phi then it can't alias with any other // SSA value. @@ -1737,7 +1708,6 @@ class AliasIdentity : public ValueObject { intptr_t value_; }; - // Abstract super-class of all instructions that define a value (Bind, Phi). class Definition : public Instruction { public: @@ -1818,7 +1788,6 @@ class Definition : public Instruction { bool HasOnlyUse(Value* use) const; bool HasOnlyInputUse(Value* use) const; - Value* input_use_list() const { return input_use_list_; } void set_input_use_list(Value* head) { input_use_list_ = head; } @@ -1897,7 +1866,6 @@ class Definition : public Instruction { DISALLOW_COPY_AND_ASSIGN(Definition); }; - // Change a value's definition after use lists have been computed. inline void Value::BindTo(Definition* def) { RemoveFromUseList(); @@ -1905,14 +1873,12 @@ inline void Value::BindTo(Definition* def) { def->AddInputUse(this); } - inline void Value::BindToEnvironment(Definition* def) { RemoveFromUseList(); set_definition(def); def->AddEnvUse(this); } - class PureDefinition : public Definition { public: explicit PureDefinition(intptr_t deopt_id) : Definition(deopt_id) {} @@ -1923,7 +1889,6 @@ class PureDefinition : public Definition { virtual EffectSet Effects() const { return EffectSet::None(); } }; - template class CSETrait = NoCSE> @@ -1947,10 +1912,8 @@ class TemplateDefinition : public CSETrait::Base { virtual void RawSetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } }; - class InductionVariableInfo; - class PhiInstr : public Definition { public: PhiInstr(JoinEntryInstr* block, intptr_t num_inputs) @@ -2050,7 +2013,6 @@ class PhiInstr : public Definition { DISALLOW_COPY_AND_ASSIGN(PhiInstr); }; - class ParameterInstr : public Definition { public: ParameterInstr(intptr_t index, @@ -2098,7 +2060,6 @@ class ParameterInstr : public Definition { DISALLOW_COPY_AND_ASSIGN(ParameterInstr); }; - class PushArgumentInstr : public TemplateDefinition<1, NoThrow> { public: explicit PushArgumentInstr(Value* value) { SetInputAt(0, value); } @@ -2123,12 +2084,10 @@ class PushArgumentInstr : public TemplateDefinition<1, NoThrow> { DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr); }; - inline Definition* Instruction::ArgumentAt(intptr_t index) const { return PushArgumentAt(index)->value()->definition(); } - class ReturnInstr : public TemplateInstruction<1, NoThrow> { public: ReturnInstr(TokenPosition token_pos, Value* value, intptr_t deopt_id) @@ -2157,7 +2116,6 @@ class ReturnInstr : public TemplateInstruction<1, NoThrow> { DISALLOW_COPY_AND_ASSIGN(ReturnInstr); }; - class ThrowInstr : public TemplateInstruction<0, Throws> { public: explicit ThrowInstr(TokenPosition token_pos, intptr_t deopt_id) @@ -2179,7 +2137,6 @@ class ThrowInstr : public TemplateInstruction<0, Throws> { DISALLOW_COPY_AND_ASSIGN(ThrowInstr); }; - class ReThrowInstr : public TemplateInstruction<0, Throws> { public: // 'catch_try_index' can be CatchClauseNode::kInvalidTryIndex if the @@ -2209,7 +2166,6 @@ class ReThrowInstr : public TemplateInstruction<0, Throws> { DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); }; - class StopInstr : public TemplateInstruction<0, NoThrow> { public: explicit StopInstr(const char* message) : message_(message) { @@ -2234,7 +2190,6 @@ class StopInstr : public TemplateInstruction<0, NoThrow> { DISALLOW_COPY_AND_ASSIGN(StopInstr); }; - class GotoInstr : public TemplateInstruction<0, NoThrow> { public: explicit GotoInstr(JoinEntryInstr* entry, intptr_t deopt_id) @@ -2299,7 +2254,6 @@ class GotoInstr : public TemplateInstruction<0, NoThrow> { ParallelMoveInstr* parallel_move_; }; - // IndirectGotoInstr represents a dynamically computed jump. Only // IndirectEntryInstr targets are valid targets of an indirect goto. The // concrete target to jump to is given as a parameter to the indirect goto. @@ -2355,7 +2309,6 @@ class IndirectGotoInstr : public TemplateInstruction<1, NoThrow> { TypedData& offsets_; }; - class ComparisonInstr : public Definition { public: Value* left() const { return InputAt(0); } @@ -2430,7 +2383,6 @@ class ComparisonInstr : public Definition { DISALLOW_COPY_AND_ASSIGN(ComparisonInstr); }; - class PureComparison : public ComparisonInstr { public: virtual bool AllowsCSE() const { return true; } @@ -2443,7 +2395,6 @@ class PureComparison : public ComparisonInstr { : ComparisonInstr(token_pos, kind, deopt_id) {} }; - template class CSETrait = NoCSE> @@ -2470,7 +2421,6 @@ class TemplateComparison virtual void RawSetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } }; - class BranchInstr : public Instruction { public: explicit BranchInstr(ComparisonInstr* comparison, intptr_t deopt_id) @@ -2550,7 +2500,6 @@ class BranchInstr : public Instruction { DISALLOW_COPY_AND_ASSIGN(BranchInstr); }; - class DeoptimizeInstr : public TemplateInstruction<0, NoThrow, Pure> { public: DeoptimizeInstr(ICData::DeoptReasonId deopt_reason, intptr_t deopt_id) @@ -2568,7 +2517,6 @@ class DeoptimizeInstr : public TemplateInstruction<0, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(DeoptimizeInstr); }; - class RedefinitionInstr : public TemplateDefinition<1, NoThrow> { public: explicit RedefinitionInstr(Value* value) : constrained_type_(NULL) { @@ -2596,7 +2544,6 @@ class RedefinitionInstr : public TemplateDefinition<1, NoThrow> { DISALLOW_COPY_AND_ASSIGN(RedefinitionInstr); }; - class ConstraintInstr : public TemplateDefinition<1, NoThrow> { public: ConstraintInstr(Value* value, Range* constraint) @@ -2637,7 +2584,6 @@ class ConstraintInstr : public TemplateDefinition<1, NoThrow> { DISALLOW_COPY_AND_ASSIGN(ConstraintInstr); }; - class ConstantInstr : public TemplateDefinition<0, NoThrow, Pure> { public: ConstantInstr(const Object& value, @@ -2667,7 +2613,6 @@ class ConstantInstr : public TemplateDefinition<0, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(ConstantInstr); }; - // Merged ConstantInstr -> UnboxedXXX into UnboxedConstantInstr. // TODO(srdjan): Implemented currently for doubles only, should implement // for other unboxing instructions. @@ -2690,7 +2635,6 @@ class UnboxedConstantInstr : public ConstantInstr { DISALLOW_COPY_AND_ASSIGN(UnboxedConstantInstr); }; - class AssertAssignableInstr : public TemplateDefinition<3, Throws, Pure> { public: AssertAssignableInstr(TokenPosition token_pos, @@ -2750,7 +2694,6 @@ class AssertAssignableInstr : public TemplateDefinition<3, Throws, Pure> { DISALLOW_COPY_AND_ASSIGN(AssertAssignableInstr); }; - class AssertBooleanInstr : public TemplateDefinition<1, Throws, Pure> { public: AssertBooleanInstr(TokenPosition token_pos, Value* value, intptr_t deopt_id) @@ -2778,7 +2721,6 @@ class AssertBooleanInstr : public TemplateDefinition<1, Throws, Pure> { DISALLOW_COPY_AND_ASSIGN(AssertBooleanInstr); }; - // Denotes a special parameter, currently either the context of a closure // or the type arguments of a generic function. class SpecialParameterInstr : public TemplateDefinition<0, NoThrow> { @@ -2804,7 +2746,6 @@ class SpecialParameterInstr : public TemplateDefinition<0, NoThrow> { DISALLOW_COPY_AND_ASSIGN(SpecialParameterInstr); }; - struct ArgumentsInfo { ArgumentsInfo(intptr_t type_args_len, intptr_t pushed_argc, @@ -2824,7 +2765,6 @@ struct ArgumentsInfo { const Array& argument_names; }; - template class TemplateDartCall : public TemplateDefinition { public: @@ -2867,7 +2807,6 @@ class TemplateDartCall : public TemplateDefinition { DISALLOW_COPY_AND_ASSIGN(TemplateDartCall); }; - class ClosureCallInstr : public TemplateDartCall<1> { public: ClosureCallInstr(Value* function, @@ -2913,7 +2852,6 @@ class ClosureCallInstr : public TemplateDartCall<1> { DISALLOW_COPY_AND_ASSIGN(ClosureCallInstr); }; - class InstanceCallInstr : public TemplateDartCall<0> { public: InstanceCallInstr(TokenPosition token_pos, @@ -2999,7 +2937,6 @@ class InstanceCallInstr : public TemplateDartCall<0> { DISALLOW_COPY_AND_ASSIGN(InstanceCallInstr); }; - class PolymorphicInstanceCallInstr : public TemplateDefinition<0, Throws> { public: PolymorphicInstanceCallInstr(InstanceCallInstr* instance_call, @@ -3076,7 +3013,6 @@ class PolymorphicInstanceCallInstr : public TemplateDefinition<0, Throws> { DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr); }; - class StrictCompareInstr : public TemplateComparison<2, NoThrow, Pure> { public: StrictCompareInstr(TokenPosition token_pos, @@ -3111,7 +3047,6 @@ class StrictCompareInstr : public TemplateComparison<2, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(StrictCompareInstr); }; - // Comparison instruction that is equivalent to the (left & right) == 0 // comparison pattern. class TestSmiInstr : public TemplateComparison<2, NoThrow, Pure> { @@ -3142,7 +3077,6 @@ class TestSmiInstr : public TemplateComparison<2, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(TestSmiInstr); }; - // Checks the input value cid against cids stored in a table and returns either // a result or deoptimizes. If the cid is not in the list and there is a deopt // id, then the instruction deoptimizes. If there is no deopt id, all the @@ -3190,7 +3124,6 @@ class TestCidsInstr : public TemplateComparison<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(TestCidsInstr); }; - class EqualityCompareInstr : public TemplateComparison<2, NoThrow, Pure> { public: EqualityCompareInstr(TokenPosition token_pos, @@ -3227,7 +3160,6 @@ class EqualityCompareInstr : public TemplateComparison<2, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr); }; - class RelationalOpInstr : public TemplateComparison<2, NoThrow, Pure> { public: RelationalOpInstr(TokenPosition token_pos, @@ -3264,7 +3196,6 @@ class RelationalOpInstr : public TemplateComparison<2, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(RelationalOpInstr); }; - // TODO(vegorov): ComparisonInstr should be switched to use IfTheElseInstr for // materialization of true and false constants. class IfThenElseInstr : public Definition { @@ -3347,7 +3278,6 @@ class IfThenElseInstr : public Definition { DISALLOW_COPY_AND_ASSIGN(IfThenElseInstr); }; - class StaticCallInstr : public TemplateDartCall<0> { public: StaticCallInstr(TokenPosition token_pos, @@ -3466,7 +3396,6 @@ class StaticCallInstr : public TemplateDartCall<0> { DISALLOW_COPY_AND_ASSIGN(StaticCallInstr); }; - class LoadLocalInstr : public TemplateDefinition<0, NoThrow> { public: LoadLocalInstr(const LocalVariable& local, TokenPosition token_pos) @@ -3499,7 +3428,6 @@ class LoadLocalInstr : public TemplateDefinition<0, NoThrow> { DISALLOW_COPY_AND_ASSIGN(LoadLocalInstr); }; - class DropTempsInstr : public Definition { public: DropTempsInstr(intptr_t num_temps, Value* value) @@ -3548,7 +3476,6 @@ class DropTempsInstr : public Definition { DISALLOW_COPY_AND_ASSIGN(DropTempsInstr); }; - class StoreLocalInstr : public TemplateDefinition<1, NoThrow> { public: StoreLocalInstr(const LocalVariable& local, @@ -3590,7 +3517,6 @@ class StoreLocalInstr : public TemplateDefinition<1, NoThrow> { DISALLOW_COPY_AND_ASSIGN(StoreLocalInstr); }; - class NativeCallInstr : public TemplateDefinition<0, Throws> { public: explicit NativeCallInstr(NativeBodyNode* node) @@ -3650,7 +3576,6 @@ class NativeCallInstr : public TemplateDefinition<0, Throws> { DISALLOW_COPY_AND_ASSIGN(NativeCallInstr); }; - class DebugStepCheckInstr : public TemplateInstruction<0, NoThrow> { public: DebugStepCheckInstr(TokenPosition token_pos, @@ -3674,10 +3599,8 @@ class DebugStepCheckInstr : public TemplateInstruction<0, NoThrow> { DISALLOW_COPY_AND_ASSIGN(DebugStepCheckInstr); }; - enum StoreBarrierType { kNoStoreBarrier, kEmitStoreBarrier }; - class StoreInstanceFieldInstr : public TemplateDefinition<2, NoThrow> { public: StoreInstanceFieldInstr(const Field& field, @@ -3767,7 +3690,6 @@ class StoreInstanceFieldInstr : public TemplateDefinition<2, NoThrow> { DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldInstr); }; - class GuardFieldInstr : public TemplateInstruction<1, NoThrow, Pure> { public: GuardFieldInstr(Value* value, const Field& field, intptr_t deopt_id) @@ -3794,7 +3716,6 @@ class GuardFieldInstr : public TemplateInstruction<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(GuardFieldInstr); }; - class GuardFieldClassInstr : public GuardFieldInstr { public: GuardFieldClassInstr(Value* value, const Field& field, intptr_t deopt_id) @@ -3812,7 +3733,6 @@ class GuardFieldClassInstr : public GuardFieldInstr { DISALLOW_COPY_AND_ASSIGN(GuardFieldClassInstr); }; - class GuardFieldLengthInstr : public GuardFieldInstr { public: GuardFieldLengthInstr(Value* value, const Field& field, intptr_t deopt_id) @@ -3830,7 +3750,6 @@ class GuardFieldLengthInstr : public GuardFieldInstr { DISALLOW_COPY_AND_ASSIGN(GuardFieldLengthInstr); }; - class LoadStaticFieldInstr : public TemplateDefinition<1, NoThrow> { public: LoadStaticFieldInstr(Value* field_value, TokenPosition token_pos) @@ -3863,7 +3782,6 @@ class LoadStaticFieldInstr : public TemplateDefinition<1, NoThrow> { DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr); }; - class StoreStaticFieldInstr : public TemplateDefinition<1, NoThrow> { public: StoreStaticFieldInstr(const Field& field, @@ -3962,7 +3880,6 @@ class LoadIndexedInstr : public TemplateDefinition<2, NoThrow> { DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr); }; - // Loads the specified number of code units from the given string, packing // multiple code units into a single datatype. In essence, this is a specialized // version of LoadIndexedInstr which accepts only string targets and can load @@ -4032,7 +3949,6 @@ class LoadCodeUnitsInstr : public TemplateDefinition<2, NoThrow> { DISALLOW_COPY_AND_ASSIGN(LoadCodeUnitsInstr); }; - class OneByteStringFromCharCodeInstr : public TemplateDefinition<1, NoThrow, Pure> { public: @@ -4053,7 +3969,6 @@ class OneByteStringFromCharCodeInstr DISALLOW_COPY_AND_ASSIGN(OneByteStringFromCharCodeInstr); }; - class StringToCharCodeInstr : public TemplateDefinition<1, NoThrow, Pure> { public: StringToCharCodeInstr(Value* str, intptr_t cid) : cid_(cid) { @@ -4078,7 +3993,6 @@ class StringToCharCodeInstr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(StringToCharCodeInstr); }; - class StringInterpolateInstr : public TemplateDefinition<1, Throws> { public: StringInterpolateInstr(Value* value, @@ -4111,7 +4025,6 @@ class StringInterpolateInstr : public TemplateDefinition<1, Throws> { DISALLOW_COPY_AND_ASSIGN(StringInterpolateInstr); }; - class StoreIndexedInstr : public TemplateDefinition<3, NoThrow> { public: StoreIndexedInstr(Value* array, @@ -4166,7 +4079,6 @@ class StoreIndexedInstr : public TemplateDefinition<3, NoThrow> { DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr); }; - // Note overrideable, built-in: value ? false : true. class BooleanNegateInstr : public TemplateDefinition<1, NoThrow> { public: @@ -4187,7 +4099,6 @@ class BooleanNegateInstr : public TemplateDefinition<1, NoThrow> { DISALLOW_COPY_AND_ASSIGN(BooleanNegateInstr); }; - class InstanceOfInstr : public TemplateDefinition<3, Throws> { public: InstanceOfInstr(TokenPosition token_pos, @@ -4228,7 +4139,6 @@ class InstanceOfInstr : public TemplateDefinition<3, Throws> { DISALLOW_COPY_AND_ASSIGN(InstanceOfInstr); }; - class AllocateObjectInstr : public TemplateDefinition<0, NoThrow> { public: AllocateObjectInstr(TokenPosition token_pos, @@ -4278,7 +4188,6 @@ class AllocateObjectInstr : public TemplateDefinition<0, NoThrow> { DISALLOW_COPY_AND_ASSIGN(AllocateObjectInstr); }; - class AllocateUninitializedContextInstr : public TemplateDefinition<0, NoThrow> { public: @@ -4311,7 +4220,6 @@ class AllocateUninitializedContextInstr DISALLOW_COPY_AND_ASSIGN(AllocateUninitializedContextInstr); }; - // This instruction captures the state of the object which had its allocation // removed during the AllocationSinking pass. // It does not produce any real code only deoptimization information. @@ -4414,7 +4322,6 @@ class MaterializeObjectInstr : public Definition { DISALLOW_COPY_AND_ASSIGN(MaterializeObjectInstr); }; - class CreateArrayInstr : public TemplateDefinition<2, Throws> { public: CreateArrayInstr(TokenPosition token_pos, @@ -4453,7 +4360,6 @@ class CreateArrayInstr : public TemplateDefinition<2, Throws> { DISALLOW_COPY_AND_ASSIGN(CreateArrayInstr); }; - // Note: this instruction must not be moved without the indexed access that // depends on it (e.g. out of loops). GC may cause collect // the array while the external data-array is still accessed. @@ -4489,7 +4395,6 @@ class LoadUntaggedInstr : public TemplateDefinition<1, NoThrow> { DISALLOW_COPY_AND_ASSIGN(LoadUntaggedInstr); }; - class LoadClassIdInstr : public TemplateDefinition<1, NoThrow> { public: explicit LoadClassIdInstr(Value* object) { SetInputAt(0, object); } @@ -4513,7 +4418,6 @@ class LoadClassIdInstr : public TemplateDefinition<1, NoThrow> { DISALLOW_COPY_AND_ASSIGN(LoadClassIdInstr); }; - class LoadFieldInstr : public TemplateDefinition<1, NoThrow> { public: LoadFieldInstr(Value* instance, @@ -4623,7 +4527,6 @@ class LoadFieldInstr : public TemplateDefinition<1, NoThrow> { DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr); }; - class InstantiateTypeInstr : public TemplateDefinition<2, Throws> { public: InstantiateTypeInstr(TokenPosition token_pos, @@ -4657,7 +4560,6 @@ class InstantiateTypeInstr : public TemplateDefinition<2, Throws> { DISALLOW_COPY_AND_ASSIGN(InstantiateTypeInstr); }; - class InstantiateTypeArgumentsInstr : public TemplateDefinition<2, Throws> { public: InstantiateTypeArgumentsInstr(TokenPosition token_pos, @@ -4699,7 +4601,6 @@ class InstantiateTypeArgumentsInstr : public TemplateDefinition<2, Throws> { DISALLOW_COPY_AND_ASSIGN(InstantiateTypeArgumentsInstr); }; - class AllocateContextInstr : public TemplateDefinition<0, NoThrow> { public: AllocateContextInstr(TokenPosition token_pos, intptr_t num_context_variables) @@ -4724,7 +4625,6 @@ class AllocateContextInstr : public TemplateDefinition<0, NoThrow> { DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr); }; - class InitStaticFieldInstr : public TemplateInstruction<1, Throws> { public: InitStaticFieldInstr(Value* input, const Field& field, intptr_t deopt_id) @@ -4748,7 +4648,6 @@ class InitStaticFieldInstr : public TemplateInstruction<1, Throws> { DISALLOW_COPY_AND_ASSIGN(InitStaticFieldInstr); }; - class CloneContextInstr : public TemplateDefinition<1, NoThrow> { public: CloneContextInstr(TokenPosition token_pos, @@ -4774,7 +4673,6 @@ class CloneContextInstr : public TemplateDefinition<1, NoThrow> { DISALLOW_COPY_AND_ASSIGN(CloneContextInstr); }; - class CheckEitherNonSmiInstr : public TemplateInstruction<2, NoThrow, Pure> { public: CheckEitherNonSmiInstr(Value* left, Value* right, intptr_t deopt_id) @@ -4802,7 +4700,6 @@ class CheckEitherNonSmiInstr : public TemplateInstruction<2, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(CheckEitherNonSmiInstr); }; - class Boxing : public AllStatic { public: static bool Supports(Representation rep) { @@ -4862,7 +4759,6 @@ class Boxing : public AllStatic { } }; - class BoxInstr : public TemplateDefinition<1, NoThrow, Pure> { public: static BoxInstr* Create(Representation from, Value* value); @@ -4905,7 +4801,6 @@ class BoxInstr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(BoxInstr); }; - class BoxIntegerInstr : public BoxInstr { public: BoxIntegerInstr(Representation representation, Value* value) @@ -4926,7 +4821,6 @@ class BoxIntegerInstr : public BoxInstr { DISALLOW_COPY_AND_ASSIGN(BoxIntegerInstr); }; - class BoxInteger32Instr : public BoxIntegerInstr { public: BoxInteger32Instr(Representation representation, Value* value) @@ -4938,7 +4832,6 @@ class BoxInteger32Instr : public BoxIntegerInstr { DISALLOW_COPY_AND_ASSIGN(BoxInteger32Instr); }; - class BoxInt32Instr : public BoxInteger32Instr { public: explicit BoxInt32Instr(Value* value) @@ -4950,7 +4843,6 @@ class BoxInt32Instr : public BoxInteger32Instr { DISALLOW_COPY_AND_ASSIGN(BoxInt32Instr); }; - class BoxUint32Instr : public BoxInteger32Instr { public: explicit BoxUint32Instr(Value* value) @@ -4962,7 +4854,6 @@ class BoxUint32Instr : public BoxInteger32Instr { DISALLOW_COPY_AND_ASSIGN(BoxUint32Instr); }; - class BoxInt64Instr : public BoxIntegerInstr { public: explicit BoxInt64Instr(Value* value) : BoxIntegerInstr(kUnboxedMint, value) {} @@ -4975,7 +4866,6 @@ class BoxInt64Instr : public BoxIntegerInstr { DISALLOW_COPY_AND_ASSIGN(BoxInt64Instr); }; - class UnboxInstr : public TemplateDefinition<1, NoThrow, Pure> { public: static UnboxInstr* Create(Representation to, Value* value, intptr_t deopt_id); @@ -5027,7 +4917,6 @@ class UnboxInstr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(UnboxInstr); }; - class UnboxIntegerInstr : public UnboxInstr { public: enum TruncationMode { kTruncate, kNoTruncation }; @@ -5061,7 +4950,6 @@ class UnboxIntegerInstr : public UnboxInstr { DISALLOW_COPY_AND_ASSIGN(UnboxIntegerInstr); }; - class UnboxInteger32Instr : public UnboxIntegerInstr { public: UnboxInteger32Instr(Representation representation, @@ -5076,7 +4964,6 @@ class UnboxInteger32Instr : public UnboxIntegerInstr { DISALLOW_COPY_AND_ASSIGN(UnboxInteger32Instr); }; - class UnboxUint32Instr : public UnboxInteger32Instr { public: UnboxUint32Instr(Value* value, intptr_t deopt_id) @@ -5094,7 +4981,6 @@ class UnboxUint32Instr : public UnboxInteger32Instr { DISALLOW_COPY_AND_ASSIGN(UnboxUint32Instr); }; - class UnboxInt32Instr : public UnboxInteger32Instr { public: UnboxInt32Instr(TruncationMode truncation_mode, @@ -5114,7 +5000,6 @@ class UnboxInt32Instr : public UnboxInteger32Instr { DISALLOW_COPY_AND_ASSIGN(UnboxInt32Instr); }; - class UnboxInt64Instr : public UnboxIntegerInstr { public: UnboxInt64Instr(Value* value, intptr_t deopt_id) @@ -5128,13 +5013,11 @@ class UnboxInt64Instr : public UnboxIntegerInstr { DISALLOW_COPY_AND_ASSIGN(UnboxInt64Instr); }; - bool Definition::IsMintDefinition() { return (Type()->ToCid() == kMintCid) || IsBinaryMintOp() || IsUnaryMintOp() || IsShiftMintOp() || IsBoxInt64() || IsUnboxInt64(); } - class MathUnaryInstr : public TemplateDefinition<1, NoThrow, Pure> { public: enum MathUnaryKind { @@ -5184,7 +5067,6 @@ class MathUnaryInstr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(MathUnaryInstr); }; - // Calls into the runtime and performs a case-insensitive comparison of the // UTF16 strings (i.e. TwoByteString or ExternalTwoByteString) located at // str[lhs_index:lhs_index + length] and str[rhs_index:rhs_index + length]. @@ -5235,7 +5117,6 @@ class CaseInsensitiveCompareUC16Instr DISALLOW_COPY_AND_ASSIGN(CaseInsensitiveCompareUC16Instr); }; - // Represents Math's static min and max functions. class MathMinMaxInstr : public TemplateDefinition<2, NoThrow, Pure> { public: @@ -5294,7 +5175,6 @@ class MathMinMaxInstr : public TemplateDefinition<2, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(MathMinMaxInstr); }; - class BinaryDoubleOpInstr : public TemplateDefinition<2, NoThrow, Pure> { public: BinaryDoubleOpInstr(Token::Kind op_kind, @@ -5347,7 +5227,6 @@ class BinaryDoubleOpInstr : public TemplateDefinition<2, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(BinaryDoubleOpInstr); }; - class DoubleTestOpInstr : public TemplateComparison<1, NoThrow, Pure> { public: DoubleTestOpInstr(MethodRecognizer::Kind op_kind, @@ -5390,7 +5269,6 @@ class DoubleTestOpInstr : public TemplateComparison<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(DoubleTestOpInstr); }; - class BinaryFloat32x4OpInstr : public TemplateDefinition<2, NoThrow, Pure> { public: BinaryFloat32x4OpInstr(Token::Kind op_kind, @@ -5437,7 +5315,6 @@ class BinaryFloat32x4OpInstr : public TemplateDefinition<2, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(BinaryFloat32x4OpInstr); }; - class Simd32x4ShuffleInstr : public TemplateDefinition<1, NoThrow, Pure> { public: Simd32x4ShuffleInstr(MethodRecognizer::Kind op_kind, @@ -5506,7 +5383,6 @@ class Simd32x4ShuffleInstr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Simd32x4ShuffleInstr); }; - class Simd32x4ShuffleMixInstr : public TemplateDefinition<2, NoThrow, Pure> { public: Simd32x4ShuffleMixInstr(MethodRecognizer::Kind op_kind, @@ -5568,7 +5444,6 @@ class Simd32x4ShuffleMixInstr : public TemplateDefinition<2, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Simd32x4ShuffleMixInstr); }; - class Float32x4ConstructorInstr : public TemplateDefinition<4, NoThrow, Pure> { public: Float32x4ConstructorInstr(Value* value0, @@ -5614,7 +5489,6 @@ class Float32x4ConstructorInstr : public TemplateDefinition<4, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Float32x4ConstructorInstr); }; - class Float32x4SplatInstr : public TemplateDefinition<1, NoThrow, Pure> { public: Float32x4SplatInstr(Value* value, intptr_t deopt_id) @@ -5650,7 +5524,6 @@ class Float32x4SplatInstr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Float32x4SplatInstr); }; - // TODO(vegorov) replace with UnboxedConstantInstr. class Float32x4ZeroInstr : public TemplateDefinition<0, NoThrow, Pure> { public: @@ -5669,7 +5542,6 @@ class Float32x4ZeroInstr : public TemplateDefinition<0, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Float32x4ZeroInstr); }; - class Float32x4ComparisonInstr : public TemplateDefinition<2, NoThrow, Pure> { public: Float32x4ComparisonInstr(MethodRecognizer::Kind op_kind, @@ -5716,7 +5588,6 @@ class Float32x4ComparisonInstr : public TemplateDefinition<2, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Float32x4ComparisonInstr); }; - class Float32x4MinMaxInstr : public TemplateDefinition<2, NoThrow, Pure> { public: Float32x4MinMaxInstr(MethodRecognizer::Kind op_kind, @@ -5763,7 +5634,6 @@ class Float32x4MinMaxInstr : public TemplateDefinition<2, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Float32x4MinMaxInstr); }; - class Float32x4ScaleInstr : public TemplateDefinition<2, NoThrow, Pure> { public: Float32x4ScaleInstr(MethodRecognizer::Kind op_kind, @@ -5813,7 +5683,6 @@ class Float32x4ScaleInstr : public TemplateDefinition<2, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Float32x4ScaleInstr); }; - class Float32x4SqrtInstr : public TemplateDefinition<1, NoThrow, Pure> { public: Float32x4SqrtInstr(MethodRecognizer::Kind op_kind, @@ -5857,7 +5726,6 @@ class Float32x4SqrtInstr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Float32x4SqrtInstr); }; - // TODO(vegorov) rename to Unary to match naming convention for arithmetic. class Float32x4ZeroArgInstr : public TemplateDefinition<1, NoThrow, Pure> { public: @@ -5902,7 +5770,6 @@ class Float32x4ZeroArgInstr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Float32x4ZeroArgInstr); }; - class Float32x4ClampInstr : public TemplateDefinition<3, NoThrow, Pure> { public: Float32x4ClampInstr(Value* left, @@ -5945,7 +5812,6 @@ class Float32x4ClampInstr : public TemplateDefinition<3, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Float32x4ClampInstr); }; - class Float32x4WithInstr : public TemplateDefinition<2, NoThrow, Pure> { public: Float32x4WithInstr(MethodRecognizer::Kind op_kind, @@ -5995,7 +5861,6 @@ class Float32x4WithInstr : public TemplateDefinition<2, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Float32x4WithInstr); }; - class Simd64x2ShuffleInstr : public TemplateDefinition<1, NoThrow, Pure> { public: Simd64x2ShuffleInstr(MethodRecognizer::Kind op_kind, @@ -6056,7 +5921,6 @@ class Simd64x2ShuffleInstr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Simd64x2ShuffleInstr); }; - class Float32x4ToInt32x4Instr : public TemplateDefinition<1, NoThrow, Pure> { public: Float32x4ToInt32x4Instr(Value* left, intptr_t deopt_id) @@ -6092,7 +5956,6 @@ class Float32x4ToInt32x4Instr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Float32x4ToInt32x4Instr); }; - class Float32x4ToFloat64x2Instr : public TemplateDefinition<1, NoThrow, Pure> { public: Float32x4ToFloat64x2Instr(Value* left, intptr_t deopt_id) @@ -6128,7 +5991,6 @@ class Float32x4ToFloat64x2Instr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Float32x4ToFloat64x2Instr); }; - class Float64x2ToFloat32x4Instr : public TemplateDefinition<1, NoThrow, Pure> { public: Float64x2ToFloat32x4Instr(Value* left, intptr_t deopt_id) @@ -6164,7 +6026,6 @@ class Float64x2ToFloat32x4Instr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Float64x2ToFloat32x4Instr); }; - class Float64x2ConstructorInstr : public TemplateDefinition<2, NoThrow, Pure> { public: Float64x2ConstructorInstr(Value* value0, Value* value1, intptr_t deopt_id) @@ -6202,7 +6063,6 @@ class Float64x2ConstructorInstr : public TemplateDefinition<2, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Float64x2ConstructorInstr); }; - class Float64x2SplatInstr : public TemplateDefinition<1, NoThrow, Pure> { public: Float64x2SplatInstr(Value* value, intptr_t deopt_id) @@ -6238,7 +6098,6 @@ class Float64x2SplatInstr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Float64x2SplatInstr); }; - class Float64x2ZeroInstr : public TemplateDefinition<0, NoThrow, Pure> { public: Float64x2ZeroInstr() {} @@ -6256,7 +6115,6 @@ class Float64x2ZeroInstr : public TemplateDefinition<0, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Float64x2ZeroInstr); }; - // TODO(vegorov) rename to Unary to match arithmetic instructions. class Float64x2ZeroArgInstr : public TemplateDefinition<1, NoThrow, Pure> { public: @@ -6307,7 +6165,6 @@ class Float64x2ZeroArgInstr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Float64x2ZeroArgInstr); }; - class Float64x2OneArgInstr : public TemplateDefinition<2, NoThrow, Pure> { public: Float64x2OneArgInstr(MethodRecognizer::Kind op_kind, @@ -6362,7 +6219,6 @@ class Float64x2OneArgInstr : public TemplateDefinition<2, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Float64x2OneArgInstr); }; - class Int32x4ConstructorInstr : public TemplateDefinition<4, NoThrow, Pure> { public: Int32x4ConstructorInstr(Value* value0, @@ -6408,7 +6264,6 @@ class Int32x4ConstructorInstr : public TemplateDefinition<4, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Int32x4ConstructorInstr); }; - class Int32x4BoolConstructorInstr : public TemplateDefinition<4, NoThrow, Pure> { public: @@ -6455,7 +6310,6 @@ class Int32x4BoolConstructorInstr DISALLOW_COPY_AND_ASSIGN(Int32x4BoolConstructorInstr); }; - class Int32x4GetFlagInstr : public TemplateDefinition<1, NoThrow, Pure> { public: Int32x4GetFlagInstr(MethodRecognizer::Kind op_kind, @@ -6499,7 +6353,6 @@ class Int32x4GetFlagInstr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Int32x4GetFlagInstr); }; - class Simd32x4GetSignMaskInstr : public TemplateDefinition<1, NoThrow, Pure> { public: Simd32x4GetSignMaskInstr(MethodRecognizer::Kind op_kind, @@ -6547,7 +6400,6 @@ class Simd32x4GetSignMaskInstr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Simd32x4GetSignMaskInstr); }; - class Int32x4SelectInstr : public TemplateDefinition<3, NoThrow, Pure> { public: Int32x4SelectInstr(Value* mask, @@ -6593,7 +6445,6 @@ class Int32x4SelectInstr : public TemplateDefinition<3, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Int32x4SelectInstr); }; - class Int32x4SetFlagInstr : public TemplateDefinition<2, NoThrow, Pure> { public: Int32x4SetFlagInstr(MethodRecognizer::Kind op_kind, @@ -6643,7 +6494,6 @@ class Int32x4SetFlagInstr : public TemplateDefinition<2, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Int32x4SetFlagInstr); }; - class Int32x4ToFloat32x4Instr : public TemplateDefinition<1, NoThrow, Pure> { public: Int32x4ToFloat32x4Instr(Value* left, intptr_t deopt_id) @@ -6679,7 +6529,6 @@ class Int32x4ToFloat32x4Instr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Int32x4ToFloat32x4Instr); }; - class BinaryInt32x4OpInstr : public TemplateDefinition<2, NoThrow, Pure> { public: BinaryInt32x4OpInstr(Token::Kind op_kind, @@ -6726,7 +6575,6 @@ class BinaryInt32x4OpInstr : public TemplateDefinition<2, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(BinaryInt32x4OpInstr); }; - class BinaryFloat64x2OpInstr : public TemplateDefinition<2, NoThrow, Pure> { public: BinaryFloat64x2OpInstr(Token::Kind op_kind, @@ -6773,7 +6621,6 @@ class BinaryFloat64x2OpInstr : public TemplateDefinition<2, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(BinaryFloat64x2OpInstr); }; - class UnaryIntegerOpInstr : public TemplateDefinition<1, NoThrow, Pure> { public: UnaryIntegerOpInstr(Token::Kind op_kind, Value* value, intptr_t deopt_id) @@ -6811,7 +6658,6 @@ class UnaryIntegerOpInstr : public TemplateDefinition<1, NoThrow, Pure> { const Token::Kind op_kind_; }; - // Handles both Smi operations: BIT_OR and NEGATE. class UnarySmiOpInstr : public UnaryIntegerOpInstr { public: @@ -6830,7 +6676,6 @@ class UnarySmiOpInstr : public UnaryIntegerOpInstr { DISALLOW_COPY_AND_ASSIGN(UnarySmiOpInstr); }; - class UnaryUint32OpInstr : public UnaryIntegerOpInstr { public: UnaryUint32OpInstr(Token::Kind op_kind, Value* value, intptr_t deopt_id) @@ -6855,7 +6700,6 @@ class UnaryUint32OpInstr : public UnaryIntegerOpInstr { DISALLOW_COPY_AND_ASSIGN(UnaryUint32OpInstr); }; - class UnaryMintOpInstr : public UnaryIntegerOpInstr { public: UnaryMintOpInstr(Token::Kind op_kind, Value* value, intptr_t deopt_id) @@ -6880,7 +6724,6 @@ class UnaryMintOpInstr : public UnaryIntegerOpInstr { DISALLOW_COPY_AND_ASSIGN(UnaryMintOpInstr); }; - class CheckedSmiOpInstr : public TemplateDefinition<2, Throws> { public: CheckedSmiOpInstr(Token::Kind op_kind, @@ -6914,7 +6757,6 @@ class CheckedSmiOpInstr : public TemplateDefinition<2, Throws> { DISALLOW_COPY_AND_ASSIGN(CheckedSmiOpInstr); }; - class CheckedSmiComparisonInstr : public TemplateComparison<2, Throws> { public: CheckedSmiComparisonInstr(Token::Kind op_kind, @@ -6969,7 +6811,6 @@ class CheckedSmiComparisonInstr : public TemplateComparison<2, Throws> { DISALLOW_COPY_AND_ASSIGN(CheckedSmiComparisonInstr); }; - class BinaryIntegerOpInstr : public TemplateDefinition<2, NoThrow, Pure> { public: BinaryIntegerOpInstr(Token::Kind op_kind, @@ -7021,7 +6862,6 @@ class BinaryIntegerOpInstr : public TemplateDefinition<2, NoThrow, Pure> { virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); } - PRINT_OPERANDS_TO_SUPPORT DEFINE_INSTRUCTION_TYPE_CHECK(BinaryIntegerOp) @@ -7040,7 +6880,6 @@ class BinaryIntegerOpInstr : public TemplateDefinition<2, NoThrow, Pure> { bool is_truncating_; }; - class BinarySmiOpInstr : public BinaryIntegerOpInstr { public: BinarySmiOpInstr(Token::Kind op_kind, @@ -7065,7 +6904,6 @@ class BinarySmiOpInstr : public BinaryIntegerOpInstr { DISALLOW_COPY_AND_ASSIGN(BinarySmiOpInstr); }; - class BinaryInt32OpInstr : public BinaryIntegerOpInstr { public: BinaryInt32OpInstr(Token::Kind op_kind, @@ -7122,7 +6960,6 @@ class BinaryInt32OpInstr : public BinaryIntegerOpInstr { DISALLOW_COPY_AND_ASSIGN(BinaryInt32OpInstr); }; - class BinaryUint32OpInstr : public BinaryIntegerOpInstr { public: BinaryUint32OpInstr(Token::Kind op_kind, @@ -7150,7 +6987,6 @@ class BinaryUint32OpInstr : public BinaryIntegerOpInstr { DISALLOW_COPY_AND_ASSIGN(BinaryUint32OpInstr); }; - class ShiftUint32OpInstr : public BinaryIntegerOpInstr { public: ShiftUint32OpInstr(Token::Kind op_kind, @@ -7178,7 +7014,6 @@ class ShiftUint32OpInstr : public BinaryIntegerOpInstr { DISALLOW_COPY_AND_ASSIGN(ShiftUint32OpInstr); }; - class BinaryMintOpInstr : public BinaryIntegerOpInstr { public: BinaryMintOpInstr(Token::Kind op_kind, @@ -7226,7 +7061,6 @@ class BinaryMintOpInstr : public BinaryIntegerOpInstr { DISALLOW_COPY_AND_ASSIGN(BinaryMintOpInstr); }; - class ShiftMintOpInstr : public BinaryIntegerOpInstr { public: ShiftMintOpInstr(Token::Kind op_kind, @@ -7272,7 +7106,6 @@ class ShiftMintOpInstr : public BinaryIntegerOpInstr { DISALLOW_COPY_AND_ASSIGN(ShiftMintOpInstr); }; - // Handles only NEGATE. class UnaryDoubleOpInstr : public TemplateDefinition<1, NoThrow, Pure> { public: @@ -7313,7 +7146,6 @@ class UnaryDoubleOpInstr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(UnaryDoubleOpInstr); }; - class CheckStackOverflowInstr : public TemplateInstruction<0, NoThrow> { public: enum Kind { @@ -7360,7 +7192,6 @@ class CheckStackOverflowInstr : public TemplateInstruction<0, NoThrow> { DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowInstr); }; - // TODO(vegorov): remove this instruction in favor of Int32ToDouble. class SmiToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> { public: @@ -7387,7 +7218,6 @@ class SmiToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr); }; - class Int32ToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> { public: explicit Int32ToDoubleInstr(Value* value) { SetInputAt(0, value); } @@ -7412,7 +7242,6 @@ class Int32ToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(Int32ToDoubleInstr); }; - class MintToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> { public: MintToDoubleInstr(Value* value, intptr_t deopt_id) @@ -7445,7 +7274,6 @@ class MintToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(MintToDoubleInstr); }; - class DoubleToIntegerInstr : public TemplateDefinition<1, Throws> { public: DoubleToIntegerInstr(Value* value, InstanceCallInstr* instance_call) @@ -7472,7 +7300,6 @@ class DoubleToIntegerInstr : public TemplateDefinition<1, Throws> { DISALLOW_COPY_AND_ASSIGN(DoubleToIntegerInstr); }; - // Similar to 'DoubleToIntegerInstr' but expects unboxed double as input // and creates a Smi. class DoubleToSmiInstr : public TemplateDefinition<1, NoThrow, Pure> { @@ -7502,7 +7329,6 @@ class DoubleToSmiInstr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(DoubleToSmiInstr); }; - class DoubleToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> { public: DoubleToDoubleInstr(Value* value, @@ -7540,7 +7366,6 @@ class DoubleToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(DoubleToDoubleInstr); }; - class DoubleToFloatInstr : public TemplateDefinition<1, NoThrow, Pure> { public: DoubleToFloatInstr(Value* value, intptr_t deopt_id) @@ -7579,7 +7404,6 @@ class DoubleToFloatInstr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(DoubleToFloatInstr); }; - class FloatToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> { public: FloatToDoubleInstr(Value* value, intptr_t deopt_id) @@ -7612,7 +7436,6 @@ class FloatToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(FloatToDoubleInstr); }; - class InvokeMathCFunctionInstr : public PureDefinition { public: InvokeMathCFunctionInstr(ZoneGrowableArray* inputs, @@ -7671,7 +7494,6 @@ class InvokeMathCFunctionInstr : public PureDefinition { DISALLOW_COPY_AND_ASSIGN(InvokeMathCFunctionInstr); }; - class ExtractNthOutputInstr : public TemplateDefinition<1, NoThrow, Pure> { public: // Extract the Nth output register from value. @@ -7720,7 +7542,6 @@ class ExtractNthOutputInstr : public TemplateDefinition<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(ExtractNthOutputInstr); }; - class TruncDivModInstr : public TemplateDefinition<2, NoThrow, Pure> { public: TruncDivModInstr(Value* lhs, Value* rhs, intptr_t deopt_id); @@ -7762,7 +7583,6 @@ class TruncDivModInstr : public TemplateDefinition<2, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(TruncDivModInstr); }; - class CheckClassInstr : public TemplateInstruction<1, NoThrow> { public: CheckClassInstr(Value* value, @@ -7825,7 +7645,6 @@ class CheckClassInstr : public TemplateInstruction<1, NoThrow> { DISALLOW_COPY_AND_ASSIGN(CheckClassInstr); }; - class CheckSmiInstr : public TemplateInstruction<1, NoThrow, Pure> { public: CheckSmiInstr(Value* value, intptr_t deopt_id, TokenPosition token_pos) @@ -7856,7 +7675,6 @@ class CheckSmiInstr : public TemplateInstruction<1, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr); }; - class CheckClassIdInstr : public TemplateInstruction<1, NoThrow> { public: CheckClassIdInstr(Value* value, CidRange cids, intptr_t deopt_id) @@ -7888,7 +7706,6 @@ class CheckClassIdInstr : public TemplateInstruction<1, NoThrow> { DISALLOW_COPY_AND_ASSIGN(CheckClassIdInstr); }; - class CheckArrayBoundInstr : public TemplateInstruction<2, NoThrow, Pure> { public: CheckArrayBoundInstr(Value* length, Value* index, intptr_t deopt_id) @@ -7931,7 +7748,6 @@ class CheckArrayBoundInstr : public TemplateInstruction<2, NoThrow, Pure> { DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundInstr); }; - class GenericCheckBoundInstr : public TemplateInstruction<2, Throws, NoCSE> { public: GenericCheckBoundInstr(Value* length, Value* index, intptr_t deopt_id) @@ -7957,7 +7773,6 @@ class GenericCheckBoundInstr : public TemplateInstruction<2, Throws, NoCSE> { DISALLOW_COPY_AND_ASSIGN(GenericCheckBoundInstr); }; - class UnboxedIntConverterInstr : public TemplateDefinition<1, NoThrow> { public: UnboxedIntConverterInstr(Representation from, @@ -8023,7 +7838,6 @@ class UnboxedIntConverterInstr : public TemplateDefinition<1, NoThrow> { DISALLOW_COPY_AND_ASSIGN(UnboxedIntConverterInstr); }; - #undef DECLARE_INSTRUCTION class Environment : public ZoneAllocated { @@ -8234,7 +8048,6 @@ class Environment : public ZoneAllocated { parsed_function_(parsed_function), outer_(outer) {} - GrowableArray values_; Location* locations_; const intptr_t fixed_parameter_count_; @@ -8245,7 +8058,6 @@ class Environment : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(Environment); }; - // Visitor base class to visit each instruction and computation in a flow // graph as defined by a reversed list of basic blocks. class FlowGraphVisitor : public ValueObject { @@ -8279,7 +8091,6 @@ class FlowGraphVisitor : public ValueObject { DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); }; - // Helper macros for platform ports. #define DEFINE_UNIMPLEMENTED_INSTRUCTION(Name) \ LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ @@ -8288,7 +8099,6 @@ class FlowGraphVisitor : public ValueObject { } \ void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } - } // namespace dart #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ diff --git a/runtime/vm/intermediate_language_arm.cc b/runtime/vm/intermediate_language_arm.cc index 7af5dade7f2..293ba9f8b46 100644 --- a/runtime/vm/intermediate_language_arm.cc +++ b/runtime/vm/intermediate_language_arm.cc @@ -36,7 +36,6 @@ LocationSummary* Instruction::MakeCallSummary(Zone* zone) { return result; } - LocationSummary* PushArgumentInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -47,7 +46,6 @@ LocationSummary* PushArgumentInstr::MakeLocationSummary(Zone* zone, return locs; } - void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // In SSA mode, we need an explicit push. Nothing to do in non-SSA mode // where PushArgument is handled by BindInstr::EmitNativeCode. @@ -66,7 +64,6 @@ void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* ReturnInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; const intptr_t kNumTemps = 0; @@ -76,7 +73,6 @@ LocationSummary* ReturnInstr::MakeLocationSummary(Zone* zone, bool opt) const { return locs; } - // Attempt optimized compilation at return instruction instead of at the entry. // The entry needs to be patchable, no inlined objects are allowed in the area // that will be overwritten by the patch instructions: a branch macro sequence. @@ -110,7 +106,6 @@ void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ set_constant_pool_allowed(true); } - static Condition NegateCondition(Condition condition) { switch (condition) { case EQ: @@ -143,21 +138,18 @@ static Condition NegateCondition(Condition condition) { } } - // Detect pattern when one value is zero and another is a power of 2. static bool IsPowerOfTwoKind(intptr_t v1, intptr_t v2) { return (Utils::IsPowerOfTwo(v1) && (v2 == 0)) || (Utils::IsPowerOfTwo(v2) && (v1 == 0)); } - LocationSummary* IfThenElseInstr::MakeLocationSummary(Zone* zone, bool opt) const { comparison()->InitializeLocationSummary(zone, opt); return comparison()->locs(); } - void IfThenElseInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register result = locs()->out(0).reg(); @@ -212,7 +204,6 @@ void IfThenElseInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* ClosureCallInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -224,7 +215,6 @@ LocationSummary* ClosureCallInstr::MakeLocationSummary(Zone* zone, return summary; } - void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // Load arguments descriptor in R4. const intptr_t argument_count = ArgumentCount(); // Includes type args. @@ -258,27 +248,23 @@ void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Drop(argument_count); } - LocationSummary* LoadLocalInstr::MakeLocationSummary(Zone* zone, bool opt) const { return LocationSummary::Make(zone, 0, Location::RequiresRegister(), LocationSummary::kNoCall); } - void LoadLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register result = locs()->out(0).reg(); __ LoadFromOffset(kWord, result, FP, local().index() * kWordSize); } - LocationSummary* StoreLocalInstr::MakeLocationSummary(Zone* zone, bool opt) const { return LocationSummary::Make(zone, 1, Location::SameAsFirstInput(), LocationSummary::kNoCall); } - void StoreLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register value = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); @@ -286,14 +272,12 @@ void StoreLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ StoreToOffset(kWord, value, FP, local().index() * kWordSize); } - LocationSummary* ConstantInstr::MakeLocationSummary(Zone* zone, bool opt) const { return LocationSummary::Make(zone, 0, Location::RequiresRegister(), LocationSummary::kNoCall); } - void ConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // The register allocator drops constant definitions that have no uses. if (!locs()->out(0).IsInvalid()) { @@ -302,7 +286,6 @@ void ConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* UnboxedConstantInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -321,7 +304,6 @@ LocationSummary* UnboxedConstantInstr::MakeLocationSummary(Zone* zone, return locs; } - void UnboxedConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // The register allocator drops constant definitions that have no uses. if (!locs()->out(0).IsInvalid()) { @@ -347,7 +329,6 @@ void UnboxedConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* AssertAssignableInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 3; @@ -361,7 +342,6 @@ LocationSummary* AssertAssignableInstr::MakeLocationSummary(Zone* zone, return summary; } - LocationSummary* AssertBooleanInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -373,7 +353,6 @@ LocationSummary* AssertBooleanInstr::MakeLocationSummary(Zone* zone, return locs; } - static void EmitAssertBoolean(Register reg, TokenPosition token_pos, intptr_t deopt_id, @@ -403,7 +382,6 @@ static void EmitAssertBoolean(Register reg, __ Bind(&done); } - void AssertBooleanInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register obj = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); @@ -412,7 +390,6 @@ void AssertBooleanInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(obj == result); } - static Condition TokenKindToSmiCondition(Token::Kind kind) { switch (kind) { case Token::kEQ: @@ -433,7 +410,6 @@ static Condition TokenKindToSmiCondition(Token::Kind kind) { } } - LocationSummary* EqualityCompareInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -474,7 +450,6 @@ LocationSummary* EqualityCompareInstr::MakeLocationSummary(Zone* zone, return NULL; } - static void LoadValueCid(FlowGraphCompiler* compiler, Register value_cid_reg, Register value_reg, @@ -491,7 +466,6 @@ static void LoadValueCid(FlowGraphCompiler* compiler, } } - static Condition FlipCondition(Condition condition) { switch (condition) { case EQ: @@ -520,7 +494,6 @@ static Condition FlipCondition(Condition condition) { } } - static void EmitBranchOnCondition(FlowGraphCompiler* compiler, Condition true_condition, BranchLabels labels) { @@ -539,7 +512,6 @@ static void EmitBranchOnCondition(FlowGraphCompiler* compiler, } } - static Condition EmitSmiComparisonOp(FlowGraphCompiler* compiler, LocationSummary* locs, Token::Kind kind) { @@ -560,7 +532,6 @@ static Condition EmitSmiComparisonOp(FlowGraphCompiler* compiler, return true_condition; } - static Condition TokenKindToMintCondition(Token::Kind kind) { switch (kind) { case Token::kEQ: @@ -581,7 +552,6 @@ static Condition TokenKindToMintCondition(Token::Kind kind) { } } - static Condition EmitUnboxedMintEqualityOp(FlowGraphCompiler* compiler, LocationSummary* locs, Token::Kind kind) { @@ -600,7 +570,6 @@ static Condition EmitUnboxedMintEqualityOp(FlowGraphCompiler* compiler, return TokenKindToMintCondition(kind); } - static Condition EmitUnboxedMintComparisonOp(FlowGraphCompiler* compiler, LocationSummary* locs, Token::Kind kind, @@ -645,7 +614,6 @@ static Condition EmitUnboxedMintComparisonOp(FlowGraphCompiler* compiler, return lo_cond; } - static Condition TokenKindToDoubleCondition(Token::Kind kind) { switch (kind) { case Token::kEQ: @@ -666,7 +634,6 @@ static Condition TokenKindToDoubleCondition(Token::Kind kind) { } } - static Condition EmitDoubleComparisonOp(FlowGraphCompiler* compiler, LocationSummary* locs, BranchLabels labels, @@ -686,7 +653,6 @@ static Condition EmitDoubleComparisonOp(FlowGraphCompiler* compiler, return true_condition; } - Condition EqualityCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { if (operation_cid() == kSmiCid) { @@ -699,7 +665,6 @@ Condition EqualityCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, } } - LocationSummary* TestSmiInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; const intptr_t kNumTemps = 0; @@ -712,7 +677,6 @@ LocationSummary* TestSmiInstr::MakeLocationSummary(Zone* zone, bool opt) const { return locs; } - Condition TestSmiInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { const Register left = locs()->in(0).reg(); @@ -728,7 +692,6 @@ Condition TestSmiInstr::EmitComparisonCode(FlowGraphCompiler* compiler, return true_condition; } - LocationSummary* TestCidsInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -741,18 +704,16 @@ LocationSummary* TestCidsInstr::MakeLocationSummary(Zone* zone, return locs; } - Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { ASSERT((kind() == Token::kIS) || (kind() == Token::kISNOT)); const Register val_reg = locs()->in(0).reg(); const Register cid_reg = locs()->temp(0).reg(); - Label* deopt = - CanDeoptimize() - ? compiler->AddDeoptStub(deopt_id(), ICData::kDeoptTestCids, - licm_hoisted_ ? ICData::kHoisted : 0) - : NULL; + Label* deopt = CanDeoptimize() ? compiler->AddDeoptStub( + deopt_id(), ICData::kDeoptTestCids, + licm_hoisted_ ? ICData::kHoisted : 0) + : NULL; const intptr_t true_result = (kind() == Token::kIS) ? 1 : 0; const ZoneGrowableArray& data = cid_results(); @@ -786,7 +747,6 @@ Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler, return kInvalidCondition; } - LocationSummary* RelationalOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -823,7 +783,6 @@ LocationSummary* RelationalOpInstr::MakeLocationSummary(Zone* zone, return summary; } - Condition RelationalOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { if (operation_cid() == kSmiCid) { @@ -836,13 +795,11 @@ Condition RelationalOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler, } } - LocationSummary* NativeCallInstr::MakeLocationSummary(Zone* zone, bool opt) const { return MakeCallSummary(zone); } - void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { SetupNative(); const Register result = locs()->out(0).reg(); @@ -898,7 +855,6 @@ void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Pop(result); } - LocationSummary* OneByteStringFromCharCodeInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -908,7 +864,6 @@ LocationSummary* OneByteStringFromCharCodeInstr::MakeLocationSummary( LocationSummary::kNoCall); } - void OneByteStringFromCharCodeInstr::EmitNativeCode( FlowGraphCompiler* compiler) { ASSERT(compiler->is_optimizing()); @@ -920,7 +875,6 @@ void OneByteStringFromCharCodeInstr::EmitNativeCode( __ ldr(result, Address(result, char_code, LSL, 1)); // Char code is a smi. } - LocationSummary* StringToCharCodeInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -928,7 +882,6 @@ LocationSummary* StringToCharCodeInstr::MakeLocationSummary(Zone* zone, LocationSummary::kNoCall); } - void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(cid_ == kOneByteStringCid); const Register str = locs()->in(0).reg(); @@ -940,7 +893,6 @@ void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ SmiTag(result); } - LocationSummary* StringInterpolateInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -952,7 +904,6 @@ LocationSummary* StringInterpolateInstr::MakeLocationSummary(Zone* zone, return summary; } - void StringInterpolateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register array = locs()->in(0).reg(); __ Push(array); @@ -965,7 +916,6 @@ void StringInterpolateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->out(0).reg() == R0); } - LocationSummary* LoadUntaggedInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -973,7 +923,6 @@ LocationSummary* LoadUntaggedInstr::MakeLocationSummary(Zone* zone, LocationSummary::kNoCall); } - void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register obj = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); @@ -985,7 +934,6 @@ void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* LoadClassIdInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -993,7 +941,6 @@ LocationSummary* LoadClassIdInstr::MakeLocationSummary(Zone* zone, LocationSummary::kNoCall); } - void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register object = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); @@ -1007,7 +954,6 @@ void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - CompileType LoadIndexedInstr::ComputeType() const { switch (class_id_) { case kArrayCid: @@ -1047,7 +993,6 @@ CompileType LoadIndexedInstr::ComputeType() const { } } - Representation LoadIndexedInstr::representation() const { switch (class_id_) { case kArrayCid: @@ -1083,7 +1028,6 @@ Representation LoadIndexedInstr::representation() const { } } - static bool CanBeImmediateIndex(Value* value, intptr_t cid, bool is_external, @@ -1121,7 +1065,6 @@ static bool CanBeImmediateIndex(Value* value, return false; } - LocationSummary* LoadIndexedInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -1175,7 +1118,6 @@ LocationSummary* LoadIndexedInstr::MakeLocationSummary(Zone* zone, return locs; } - void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // The array register points to the backing store for external arrays. const Register array = locs()->in(0).reg(); @@ -1326,7 +1268,6 @@ void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - Representation StoreIndexedInstr::RequiredInputRepresentation( intptr_t idx) const { // Array can be a Dart object or a pointer to external data. @@ -1363,7 +1304,6 @@ Representation StoreIndexedInstr::RequiredInputRepresentation( } } - LocationSummary* StoreIndexedInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 3; @@ -1435,7 +1375,6 @@ LocationSummary* StoreIndexedInstr::MakeLocationSummary(Zone* zone, return locs; } - void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // The array register points to the backing store for external arrays. const Register array = locs()->in(0).reg(); @@ -1587,7 +1526,6 @@ void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* GuardFieldClassInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -1621,7 +1559,6 @@ LocationSummary* GuardFieldClassInstr::MakeLocationSummary(Zone* zone, return summary; } - void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(sizeof(classid_t) == kInt16Size); @@ -1763,7 +1700,6 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&ok); } - LocationSummary* GuardFieldLengthInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -1790,7 +1726,6 @@ LocationSummary* GuardFieldLengthInstr::MakeLocationSummary(Zone* zone, UNREACHABLE(); } - void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (field().guarded_list_length() == Field::kNoFixedLength) { if (Compiler::IsBackgroundCompilation()) { @@ -1866,7 +1801,6 @@ void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - class BoxAllocationSlowPath : public SlowPathCode { public: BoxAllocationSlowPath(Instruction* instruction, @@ -1920,7 +1854,6 @@ class BoxAllocationSlowPath : public SlowPathCode { const Register result_; }; - LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Zone* zone, bool opt) const { const bool might_box = (representation() == kTagged) && !can_pack_into_smi(); @@ -1947,7 +1880,6 @@ LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Zone* zone, return summary; } - void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // The string register points to the backing store for external strings. const Register str = locs()->in(0).reg(); @@ -2044,7 +1976,6 @@ void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -2077,7 +2008,6 @@ LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Zone* zone, return summary; } - static void EnsureMutableBox(FlowGraphCompiler* compiler, StoreInstanceFieldInstr* instruction, Register box_reg, @@ -2097,7 +2027,6 @@ static void EnsureMutableBox(FlowGraphCompiler* compiler, __ Bind(&done); } - void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(sizeof(classid_t) == kInt16Size); @@ -2246,7 +2175,6 @@ void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&skip_store); } - LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -2258,7 +2186,6 @@ LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone, return summary; } - // When the parser is building an implicit static getter for optimization, // it can generate a function body where deoptimization ids do not line up // with the unoptimized code. @@ -2270,7 +2197,6 @@ void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ LoadFieldFromOffset(kWord, result, field, Field::static_value_offset()); } - LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { LocationSummary* locs = @@ -2281,7 +2207,6 @@ LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(Zone* zone, return locs; } - void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register value = locs()->in(0).reg(); const Register temp = locs()->temp(0).reg(); @@ -2296,7 +2221,6 @@ void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* InstanceOfInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 3; @@ -2310,7 +2234,6 @@ LocationSummary* InstanceOfInstr::MakeLocationSummary(Zone* zone, return summary; } - void InstanceOfInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->in(0).reg() == R0); // Value. ASSERT(locs()->in(1).reg() == R2); // Instantiator type arguments. @@ -2320,7 +2243,6 @@ void InstanceOfInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->out(0).reg() == R0); } - LocationSummary* CreateArrayInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -2333,7 +2255,6 @@ LocationSummary* CreateArrayInstr::MakeLocationSummary(Zone* zone, return locs; } - // Inlines array allocation for known constant values. static void InlineArrayAllocation(FlowGraphCompiler* compiler, intptr_t num_elements, @@ -2387,7 +2308,6 @@ static void InlineArrayAllocation(FlowGraphCompiler* compiler, __ b(done); } - void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register kLengthReg = R2; const Register kElemTypeReg = R1; @@ -2424,7 +2344,6 @@ void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->out(0).reg() == kResultReg); } - LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -2432,9 +2351,9 @@ LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, (IsUnboxedLoad() && opt) ? 1 : ((IsPotentialUnboxedLoad()) ? 3 : 0); LocationSummary* locs = new (zone) LocationSummary( - zone, kNumInputs, kNumTemps, (opt && !IsPotentialUnboxedLoad()) - ? LocationSummary::kNoCall - : LocationSummary::kCallOnSlowPath); + zone, kNumInputs, kNumTemps, + (opt && !IsPotentialUnboxedLoad()) ? LocationSummary::kNoCall + : LocationSummary::kCallOnSlowPath); locs->set_in(0, Location::RequiresRegister()); @@ -2450,7 +2369,6 @@ LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, return locs; } - void LoadFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(sizeof(classid_t) == kInt16Size); @@ -2556,7 +2474,6 @@ void LoadFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&done); } - LocationSummary* InstantiateTypeInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -2569,7 +2486,6 @@ LocationSummary* InstantiateTypeInstr::MakeLocationSummary(Zone* zone, return locs; } - void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register instantiator_type_args_reg = locs()->in(0).reg(); const Register function_type_args_reg = locs()->in(1).reg(); @@ -2588,7 +2504,6 @@ void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Pop(result_reg); // Pop instantiated type. } - LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -2602,7 +2517,6 @@ LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary( return locs; } - void InstantiateTypeArgumentsInstr::EmitNativeCode( FlowGraphCompiler* compiler) { const Register instantiator_type_args_reg = locs()->in(0).reg(); @@ -2669,7 +2583,6 @@ void InstantiateTypeArgumentsInstr::EmitNativeCode( __ Bind(&type_arguments_instantiated); } - LocationSummary* AllocateUninitializedContextInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -2685,7 +2598,6 @@ LocationSummary* AllocateUninitializedContextInstr::MakeLocationSummary( return locs; } - class AllocateContextSlowPath : public SlowPathCode { public: explicit AllocateContextSlowPath( @@ -2717,7 +2629,6 @@ class AllocateContextSlowPath : public SlowPathCode { AllocateUninitializedContextInstr* instruction_; }; - void AllocateUninitializedContextInstr::EmitNativeCode( FlowGraphCompiler* compiler) { Register temp0 = locs()->temp(0).reg(); @@ -2740,7 +2651,6 @@ void AllocateUninitializedContextInstr::EmitNativeCode( __ Bind(slow_path->exit_label()); } - LocationSummary* AllocateContextInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -2752,7 +2662,6 @@ LocationSummary* AllocateContextInstr::MakeLocationSummary(Zone* zone, return locs; } - void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->temp(0).reg() == R1); ASSERT(locs()->out(0).reg() == R0); @@ -2762,7 +2671,6 @@ void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { RawPcDescriptors::kOther, locs()); } - LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -2774,7 +2682,6 @@ LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone, return locs; } - void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register field = locs()->in(0).reg(); Register temp = locs()->temp(0).reg(); @@ -2796,7 +2703,6 @@ void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&no_call); } - LocationSummary* CloneContextInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -2808,7 +2714,6 @@ LocationSummary* CloneContextInstr::MakeLocationSummary(Zone* zone, return locs; } - void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register context_value = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); @@ -2821,14 +2726,12 @@ void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Pop(result); // Get result (cloned context). } - LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Zone* zone, bool opt) const { UNREACHABLE(); return NULL; } - void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(compiler->GetJumpLabel(this)); compiler->AddExceptionHandler(catch_try_index(), try_index(), @@ -2890,7 +2793,6 @@ void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -2901,7 +2803,6 @@ LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Zone* zone, return summary; } - class CheckStackOverflowSlowPath : public SlowPathCode { public: explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) @@ -2949,7 +2850,6 @@ class CheckStackOverflowSlowPath : public SlowPathCode { Label osr_entry_label_; }; - void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); compiler->AddSlowPathCode(slow_path); @@ -2975,7 +2875,6 @@ void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(slow_path->exit_label()); } - static void EmitSmiShiftLeft(FlowGraphCompiler* compiler, BinarySmiOpInstr* shift_left) { const LocationSummary& locs = *shift_left->locs(); @@ -3068,7 +2967,6 @@ static void EmitSmiShiftLeft(FlowGraphCompiler* compiler, } } - class CheckedSmiSlowPath : public SlowPathCode { public: CheckedSmiSlowPath(CheckedSmiOpInstr* instruction, intptr_t try_index) @@ -3110,7 +3008,6 @@ class CheckedSmiSlowPath : public SlowPathCode { intptr_t try_index_; }; - LocationSummary* CheckedSmiOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -3123,7 +3020,6 @@ LocationSummary* CheckedSmiOpInstr::MakeLocationSummary(Zone* zone, return summary; } - void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { CheckedSmiSlowPath* slow_path = new CheckedSmiSlowPath(this, compiler->CurrentTryIndex()); @@ -3205,7 +3101,6 @@ void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(slow_path->exit_label()); } - class CheckedSmiComparisonSlowPath : public SlowPathCode { public: CheckedSmiComparisonSlowPath(CheckedSmiComparisonInstr* instruction, @@ -3264,7 +3159,6 @@ class CheckedSmiComparisonSlowPath : public SlowPathCode { bool merged_; }; - LocationSummary* CheckedSmiComparisonInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -3279,14 +3173,12 @@ LocationSummary* CheckedSmiComparisonInstr::MakeLocationSummary( return summary; } - Condition CheckedSmiComparisonInstr::EmitComparisonCode( FlowGraphCompiler* compiler, BranchLabels labels) { return EmitSmiComparisonOp(compiler, locs(), kind()); } - #define EMIT_SMI_CHECK \ Register left = locs()->in(0).reg(); \ Register right = locs()->in(1).reg(); \ @@ -3305,7 +3197,6 @@ Condition CheckedSmiComparisonInstr::EmitComparisonCode( } \ __ b(slow_path->entry_label(), NE) - void CheckedSmiComparisonInstr::EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch) { BranchLabels labels = compiler->CreateBranchLabels(branch); @@ -3320,7 +3211,6 @@ void CheckedSmiComparisonInstr::EmitBranchCode(FlowGraphCompiler* compiler, __ Bind(slow_path->exit_label()); } - void CheckedSmiComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { BranchLabels labels = {NULL, NULL, NULL}; CheckedSmiComparisonSlowPath* slow_path = new CheckedSmiComparisonSlowPath( @@ -3337,7 +3227,6 @@ void CheckedSmiComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } #undef EMIT_SMI_CHECK - LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -3391,7 +3280,6 @@ LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone, return summary; } - void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (op_kind() == Token::kSHL) { EmitSmiShiftLeft(compiler, this); @@ -3652,7 +3540,6 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - static void EmitInt32ShiftLeft(FlowGraphCompiler* compiler, BinaryInt32OpInstr* shift_left) { const LocationSummary& locs = *shift_left->locs(); @@ -3679,7 +3566,6 @@ static void EmitInt32ShiftLeft(FlowGraphCompiler* compiler, __ Lsl(result, left, Operand(value)); } - LocationSummary* BinaryInt32OpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -3703,7 +3589,6 @@ LocationSummary* BinaryInt32OpInstr::MakeLocationSummary(Zone* zone, return summary; } - void BinaryInt32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (op_kind() == Token::kSHL) { EmitInt32ShiftLeft(compiler, this); @@ -3856,7 +3741,6 @@ void BinaryInt32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary(Zone* zone, bool opt) const { intptr_t left_cid = left()->Type()->ToCid(); @@ -3871,7 +3755,6 @@ LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary(Zone* zone, return summary; } - void CheckEitherNonSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinaryDoubleOp, @@ -3893,7 +3776,6 @@ void CheckEitherNonSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ b(deopt, EQ); } - LocationSummary* BoxInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; const intptr_t kNumTemps = 1; @@ -3905,7 +3787,6 @@ LocationSummary* BoxInstr::MakeLocationSummary(Zone* zone, bool opt) const { return summary; } - void BoxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register out_reg = locs()->out(0).reg(); const DRegister value = EvenDRegisterOf(locs()->in(0).fpu_reg()); @@ -3930,7 +3811,6 @@ void BoxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* UnboxInstr::MakeLocationSummary(Zone* zone, bool opt) const { const bool needs_temp = CanDeoptimize(); const intptr_t kNumInputs = 1; @@ -3950,7 +3830,6 @@ LocationSummary* UnboxInstr::MakeLocationSummary(Zone* zone, bool opt) const { return summary; } - void UnboxInstr::EmitLoadFromBox(FlowGraphCompiler* compiler) { const Register box = locs()->in(0).reg(); @@ -3984,7 +3863,6 @@ void UnboxInstr::EmitLoadFromBox(FlowGraphCompiler* compiler) { } } - void UnboxInstr::EmitSmiConversion(FlowGraphCompiler* compiler) { const Register box = locs()->in(0).reg(); @@ -4010,7 +3888,6 @@ void UnboxInstr::EmitSmiConversion(FlowGraphCompiler* compiler) { } } - void UnboxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const intptr_t value_cid = value()->Type()->ToCid(); const intptr_t box_cid = BoxCid(); @@ -4049,7 +3926,6 @@ void UnboxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* BoxInteger32Instr::MakeLocationSummary(Zone* zone, bool opt) const { ASSERT((from_representation() == kUnboxedInt32) || @@ -4068,7 +3944,6 @@ LocationSummary* BoxInteger32Instr::MakeLocationSummary(Zone* zone, return summary; } - void BoxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) { Register value = locs()->in(0).reg(); Register out = locs()->out(0).reg(); @@ -4102,7 +3977,6 @@ void BoxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* BoxInt64Instr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4120,7 +3994,6 @@ LocationSummary* BoxInt64Instr::MakeLocationSummary(Zone* zone, return summary; } - void BoxInt64Instr::EmitNativeCode(FlowGraphCompiler* compiler) { if (ValueFitsSmi()) { PairLocation* value_pair = locs()->in(0).AsPairLocation(); @@ -4151,7 +4024,6 @@ void BoxInt64Instr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&done); } - static void LoadInt32FromMint(FlowGraphCompiler* compiler, Register mint, Register result, @@ -4165,7 +4037,6 @@ static void LoadInt32FromMint(FlowGraphCompiler* compiler, } } - LocationSummary* UnboxInteger32Instr::MakeLocationSummary(Zone* zone, bool opt) const { ASSERT((representation() == kUnboxedInt32) || @@ -4183,16 +4054,14 @@ LocationSummary* UnboxInteger32Instr::MakeLocationSummary(Zone* zone, return summary; } - void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) { const intptr_t value_cid = value()->Type()->ToCid(); const Register value = locs()->in(0).reg(); const Register out = locs()->out(0).reg(); const Register temp = CanDeoptimize() ? locs()->temp(0).reg() : kNoRegister; - Label* deopt = - CanDeoptimize() - ? compiler->AddDeoptStub(GetDeoptId(), ICData::kDeoptUnboxInteger) - : NULL; + Label* deopt = CanDeoptimize() ? compiler->AddDeoptStub( + GetDeoptId(), ICData::kDeoptUnboxInteger) + : NULL; Label* out_of_range = !is_truncating() ? deopt : NULL; ASSERT(value != out); @@ -4215,7 +4084,6 @@ void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4228,7 +4096,6 @@ LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary(Zone* zone, return summary; } - void BinaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const DRegister left = EvenDRegisterOf(locs()->in(0).fpu_reg()); const DRegister right = EvenDRegisterOf(locs()->in(1).fpu_reg()); @@ -4251,7 +4118,6 @@ void BinaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* DoubleTestOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4267,7 +4133,6 @@ LocationSummary* DoubleTestOpInstr::MakeLocationSummary(Zone* zone, return summary; } - Condition DoubleTestOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { const DRegister value = EvenDRegisterOf(locs()->in(0).fpu_reg()); @@ -4305,7 +4170,6 @@ LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone, return summary; } - void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister left = locs()->in(0).fpu_reg(); const QRegister right = locs()->in(1).fpu_reg(); @@ -4329,7 +4193,6 @@ void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* BinaryFloat64x2OpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4342,7 +4205,6 @@ LocationSummary* BinaryFloat64x2OpInstr::MakeLocationSummary(Zone* zone, return summary; } - void BinaryFloat64x2OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister left = locs()->in(0).fpu_reg(); const QRegister right = locs()->in(1).fpu_reg(); @@ -4379,7 +4241,6 @@ void BinaryFloat64x2OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Simd32x4ShuffleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4392,7 +4253,6 @@ LocationSummary* Simd32x4ShuffleInstr::MakeLocationSummary(Zone* zone, return summary; } - void Simd32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister value = locs()->in(0).fpu_reg(); const QRegister result = locs()->out(0).fpu_reg(); @@ -4461,7 +4321,6 @@ void Simd32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Simd32x4ShuffleMixInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4475,7 +4334,6 @@ LocationSummary* Simd32x4ShuffleMixInstr::MakeLocationSummary(Zone* zone, return summary; } - void Simd32x4ShuffleMixInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister left = locs()->in(0).fpu_reg(); const QRegister right = locs()->in(1).fpu_reg(); @@ -4519,7 +4377,6 @@ void Simd32x4ShuffleMixInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4532,7 +4389,6 @@ LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary(Zone* zone, return summary; } - void Simd32x4GetSignMaskInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister value = locs()->in(0).fpu_reg(); const DRegister dvalue0 = EvenDRegisterOf(value); @@ -4560,7 +4416,6 @@ void Simd32x4GetSignMaskInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ SmiTag(out); } - LocationSummary* Float32x4ConstructorInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -4577,7 +4432,6 @@ LocationSummary* Float32x4ConstructorInstr::MakeLocationSummary( return summary; } - void Float32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister q0 = locs()->in(0).fpu_reg(); const QRegister q1 = locs()->in(1).fpu_reg(); @@ -4594,7 +4448,6 @@ void Float32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ vcvtsd(OddSRegisterOf(dr1), EvenDRegisterOf(q3)); } - LocationSummary* Float32x4ZeroInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -4605,13 +4458,11 @@ LocationSummary* Float32x4ZeroInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister q = locs()->out(0).fpu_reg(); __ veorq(q, q, q); } - LocationSummary* Float32x4SplatInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4623,7 +4474,6 @@ LocationSummary* Float32x4SplatInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister value = locs()->in(0).fpu_reg(); const QRegister result = locs()->out(0).fpu_reg(); @@ -4637,7 +4487,6 @@ void Float32x4SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ vdup(kWord, result, DTMP, 0); } - LocationSummary* Float32x4ComparisonInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4650,7 +4499,6 @@ LocationSummary* Float32x4ComparisonInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister left = locs()->in(0).fpu_reg(); const QRegister right = locs()->in(1).fpu_reg(); @@ -4683,7 +4531,6 @@ void Float32x4ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float32x4MinMaxInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4696,7 +4543,6 @@ LocationSummary* Float32x4MinMaxInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4MinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister left = locs()->in(0).fpu_reg(); const QRegister right = locs()->in(1).fpu_reg(); @@ -4714,7 +4560,6 @@ void Float32x4MinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float32x4SqrtInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4727,7 +4572,6 @@ LocationSummary* Float32x4SqrtInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4SqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister left = locs()->in(0).fpu_reg(); const QRegister result = locs()->out(0).fpu_reg(); @@ -4748,7 +4592,6 @@ void Float32x4SqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float32x4ScaleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4761,7 +4604,6 @@ LocationSummary* Float32x4ScaleInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4ScaleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister left = locs()->in(0).fpu_reg(); const QRegister right = locs()->in(1).fpu_reg(); @@ -4778,7 +4620,6 @@ void Float32x4ScaleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float32x4ZeroArgInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4790,7 +4631,6 @@ LocationSummary* Float32x4ZeroArgInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister left = locs()->in(0).fpu_reg(); const QRegister result = locs()->out(0).fpu_reg(); @@ -4807,7 +4647,6 @@ void Float32x4ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float32x4ClampInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 3; @@ -4821,7 +4660,6 @@ LocationSummary* Float32x4ClampInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4ClampInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister left = locs()->in(0).fpu_reg(); const QRegister lower = locs()->in(1).fpu_reg(); @@ -4831,7 +4669,6 @@ void Float32x4ClampInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ vmaxqs(result, result, lower); } - LocationSummary* Float32x4WithInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4845,7 +4682,6 @@ LocationSummary* Float32x4WithInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4WithInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister replacement = locs()->in(0).fpu_reg(); const QRegister value = locs()->in(1).fpu_reg(); @@ -4881,7 +4717,6 @@ void Float32x4WithInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float32x4ToInt32x4Instr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4893,7 +4728,6 @@ LocationSummary* Float32x4ToInt32x4Instr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4ToInt32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister value = locs()->in(0).fpu_reg(); const QRegister result = locs()->out(0).fpu_reg(); @@ -4903,7 +4737,6 @@ void Float32x4ToInt32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Simd64x2ShuffleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4915,7 +4748,6 @@ LocationSummary* Simd64x2ShuffleInstr::MakeLocationSummary(Zone* zone, return summary; } - void Simd64x2ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister value = locs()->in(0).fpu_reg(); @@ -4938,7 +4770,6 @@ void Simd64x2ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float64x2ZeroInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -4949,13 +4780,11 @@ LocationSummary* Float64x2ZeroInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float64x2ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister q = locs()->out(0).fpu_reg(); __ veorq(q, q, q); } - LocationSummary* Float64x2SplatInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4967,7 +4796,6 @@ LocationSummary* Float64x2SplatInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float64x2SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister value = locs()->in(0).fpu_reg(); @@ -4983,7 +4811,6 @@ void Float64x2SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ vmovd(dresult1, dvalue); } - LocationSummary* Float64x2ConstructorInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -4997,7 +4824,6 @@ LocationSummary* Float64x2ConstructorInstr::MakeLocationSummary( return summary; } - void Float64x2ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister q0 = locs()->in(0).fpu_reg(); const QRegister q1 = locs()->in(1).fpu_reg(); @@ -5013,7 +4839,6 @@ void Float64x2ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ vmovd(dr1, d1); } - LocationSummary* Float64x2ToFloat32x4Instr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -5027,7 +4852,6 @@ LocationSummary* Float64x2ToFloat32x4Instr::MakeLocationSummary( return summary; } - void Float64x2ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister q = locs()->in(0).fpu_reg(); const QRegister r = locs()->out(0).fpu_reg(); @@ -5045,7 +4869,6 @@ void Float64x2ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { __ vcvtsd(OddSRegisterOf(dr0), dq1); } - LocationSummary* Float32x4ToFloat64x2Instr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -5059,7 +4882,6 @@ LocationSummary* Float32x4ToFloat64x2Instr::MakeLocationSummary( return summary; } - void Float32x4ToFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister q = locs()->in(0).fpu_reg(); const QRegister r = locs()->out(0).fpu_reg(); @@ -5075,7 +4897,6 @@ void Float32x4ToFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) { __ vcvtds(dr1, OddSRegisterOf(dq0)); } - LocationSummary* Float64x2ZeroArgInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5095,7 +4916,6 @@ LocationSummary* Float64x2ZeroArgInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float64x2ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister q = locs()->in(0).fpu_reg(); @@ -5142,7 +4962,6 @@ void Float64x2ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float64x2OneArgInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -5155,7 +4974,6 @@ LocationSummary* Float64x2OneArgInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float64x2OneArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister left = locs()->in(0).fpu_reg(); const DRegister left0 = EvenDRegisterOf(left); @@ -5216,7 +5034,6 @@ void Float64x2OneArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Int32x4ConstructorInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 4; @@ -5231,7 +5048,6 @@ LocationSummary* Int32x4ConstructorInstr::MakeLocationSummary(Zone* zone, return summary; } - void Int32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register v0 = locs()->in(0).reg(); const Register v1 = locs()->in(1).reg(); @@ -5245,7 +5061,6 @@ void Int32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ vmovdrr(dresult1, v2, v3); } - LocationSummary* Int32x4BoolConstructorInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -5262,7 +5077,6 @@ LocationSummary* Int32x4BoolConstructorInstr::MakeLocationSummary( return summary; } - void Int32x4BoolConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register v0 = locs()->in(0).reg(); const Register v1 = locs()->in(1).reg(); @@ -5290,7 +5104,6 @@ void Int32x4BoolConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ vmovdr(dresult1, 1, temp, EQ); } - LocationSummary* Int32x4GetFlagInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5303,7 +5116,6 @@ LocationSummary* Int32x4GetFlagInstr::MakeLocationSummary(Zone* zone, return summary; } - void Int32x4GetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister value = locs()->in(0).fpu_reg(); const Register result = locs()->out(0).reg(); @@ -5337,7 +5149,6 @@ void Int32x4GetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ LoadObject(result, Bool::False(), EQ); } - LocationSummary* Int32x4SelectInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 3; @@ -5352,7 +5163,6 @@ LocationSummary* Int32x4SelectInstr::MakeLocationSummary(Zone* zone, return summary; } - void Int32x4SelectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister mask = locs()->in(0).fpu_reg(); const QRegister trueValue = locs()->in(1).fpu_reg(); @@ -5372,7 +5182,6 @@ void Int32x4SelectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ vorrq(out, mask, temp); } - LocationSummary* Int32x4SetFlagInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -5385,7 +5194,6 @@ LocationSummary* Int32x4SetFlagInstr::MakeLocationSummary(Zone* zone, return summary; } - void Int32x4SetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister mask = locs()->in(0).fpu_reg(); const Register flag = locs()->in(1).reg(); @@ -5419,7 +5227,6 @@ void Int32x4SetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Int32x4ToFloat32x4Instr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5431,7 +5238,6 @@ LocationSummary* Int32x4ToFloat32x4Instr::MakeLocationSummary(Zone* zone, return summary; } - void Int32x4ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister value = locs()->in(0).fpu_reg(); const QRegister result = locs()->out(0).fpu_reg(); @@ -5441,7 +5247,6 @@ void Int32x4ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* BinaryInt32x4OpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -5454,7 +5259,6 @@ LocationSummary* BinaryInt32x4OpInstr::MakeLocationSummary(Zone* zone, return summary; } - void BinaryInt32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister left = locs()->in(0).fpu_reg(); const QRegister right = locs()->in(1).fpu_reg(); @@ -5480,7 +5284,6 @@ void BinaryInt32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* MathUnaryInstr::MakeLocationSummary(Zone* zone, bool opt) const { ASSERT((kind() == MathUnaryInstr::kSqrt) || @@ -5494,7 +5297,6 @@ LocationSummary* MathUnaryInstr::MakeLocationSummary(Zone* zone, return summary; } - void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (kind() == MathUnaryInstr::kSqrt) { const DRegister val = EvenDRegisterOf(locs()->in(0).fpu_reg()); @@ -5509,7 +5311,6 @@ void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -5524,14 +5325,12 @@ LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary( return summary; } - void CaseInsensitiveCompareUC16Instr::EmitNativeCode( FlowGraphCompiler* compiler) { // Call the function. __ CallRuntime(TargetFunction(), TargetFunction().argument_count()); } - LocationSummary* MathMinMaxInstr::MakeLocationSummary(Zone* zone, bool opt) const { if (result_cid() == kDoubleCid) { @@ -5558,7 +5357,6 @@ LocationSummary* MathMinMaxInstr::MakeLocationSummary(Zone* zone, return summary; } - void MathMinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT((op_kind() == MethodRecognizer::kMathMin) || (op_kind() == MethodRecognizer::kMathMax)); @@ -5617,7 +5415,6 @@ void MathMinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* UnarySmiOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5631,7 +5428,6 @@ LocationSummary* UnarySmiOpInstr::MakeLocationSummary(Zone* zone, return summary; } - void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register value = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); @@ -5652,7 +5448,6 @@ void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* UnaryDoubleOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5664,14 +5459,12 @@ LocationSummary* UnaryDoubleOpInstr::MakeLocationSummary(Zone* zone, return summary; } - void UnaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); const DRegister value = EvenDRegisterOf(locs()->in(0).fpu_reg()); __ vnegd(result, value); } - LocationSummary* Int32ToDoubleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5683,7 +5476,6 @@ LocationSummary* Int32ToDoubleInstr::MakeLocationSummary(Zone* zone, return result; } - void Int32ToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register value = locs()->in(0).reg(); const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); @@ -5691,7 +5483,6 @@ void Int32ToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ vcvtdi(result, STMP); } - LocationSummary* SmiToDoubleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5703,7 +5494,6 @@ LocationSummary* SmiToDoubleInstr::MakeLocationSummary(Zone* zone, return result; } - void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register value = locs()->in(0).reg(); const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); @@ -5712,19 +5502,16 @@ void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ vcvtdi(result, STMP); } - LocationSummary* MintToDoubleInstr::MakeLocationSummary(Zone* zone, bool opt) const { UNIMPLEMENTED(); return NULL; } - void MintToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } - LocationSummary* DoubleToIntegerInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5736,7 +5523,6 @@ LocationSummary* DoubleToIntegerInstr::MakeLocationSummary(Zone* zone, return result; } - void DoubleToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register result = locs()->out(0).reg(); const Register value_obj = locs()->in(0).reg(); @@ -5775,7 +5561,6 @@ void DoubleToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&done); } - LocationSummary* DoubleToSmiInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5787,7 +5572,6 @@ LocationSummary* DoubleToSmiInstr::MakeLocationSummary(Zone* zone, return result; } - void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptDoubleToSmi); const Register result = locs()->out(0).reg(); @@ -5806,19 +5590,16 @@ void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ SmiTag(result); } - LocationSummary* DoubleToDoubleInstr::MakeLocationSummary(Zone* zone, bool opt) const { UNIMPLEMENTED(); return NULL; } - void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } - LocationSummary* DoubleToFloatInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5831,7 +5612,6 @@ LocationSummary* DoubleToFloatInstr::MakeLocationSummary(Zone* zone, return result; } - void DoubleToFloatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const DRegister value = EvenDRegisterOf(locs()->in(0).fpu_reg()); const SRegister result = @@ -5839,7 +5619,6 @@ void DoubleToFloatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ vcvtsd(result, value); } - LocationSummary* FloatToDoubleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5852,7 +5631,6 @@ LocationSummary* FloatToDoubleInstr::MakeLocationSummary(Zone* zone, return result; } - void FloatToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const SRegister value = EvenSRegisterOf(EvenDRegisterOf(locs()->in(0).fpu_reg())); @@ -5860,7 +5638,6 @@ void FloatToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ vcvtds(result, value); } - LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(Zone* zone, bool opt) const { ASSERT((InputCount() == 1) || (InputCount() == 2)); @@ -5891,7 +5668,6 @@ LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(Zone* zone, return result; } - // Pseudo code: // if (exponent == 0.0) return 1.0; // // Speed up simple cases. @@ -6027,7 +5803,6 @@ static void InvokeDoublePow(FlowGraphCompiler* compiler, __ Bind(&skip_call); } - void InvokeMathCFunctionInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (recognized_kind() == MethodRecognizer::kMathDoublePow) { InvokeDoublePow(compiler, this); @@ -6052,7 +5827,6 @@ void InvokeMathCFunctionInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* ExtractNthOutputInstr::MakeLocationSummary(Zone* zone, bool opt) const { // Only use this instruction in optimized code. @@ -6085,7 +5859,6 @@ LocationSummary* ExtractNthOutputInstr::MakeLocationSummary(Zone* zone, return summary; } - void ExtractNthOutputInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->in(0).IsPairLocation()); PairLocation* pair = locs()->in(0).AsPairLocation(); @@ -6102,7 +5875,6 @@ void ExtractNthOutputInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* TruncDivModInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -6119,7 +5891,6 @@ LocationSummary* TruncDivModInstr::MakeLocationSummary(Zone* zone, return summary; } - void TruncDivModInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(CanDeoptimize()); Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinarySmiOp); @@ -6170,14 +5941,12 @@ void TruncDivModInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&done); } - LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary( Zone* zone, bool opt) const { return MakeCallSummary(zone); } - LocationSummary* BranchInstr::MakeLocationSummary(Zone* zone, bool opt) const { comparison()->InitializeLocationSummary(zone, opt); // Branches don't produce a result. @@ -6185,12 +5954,10 @@ LocationSummary* BranchInstr::MakeLocationSummary(Zone* zone, bool opt) const { return comparison()->locs(); } - void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) { comparison()->EmitBranchCode(compiler, this); } - LocationSummary* CheckClassInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -6208,7 +5975,6 @@ LocationSummary* CheckClassInstr::MakeLocationSummary(Zone* zone, return summary; } - void CheckClassInstr::EmitNullCheck(FlowGraphCompiler* compiler, Label* deopt) { __ CompareObject(locs()->in(0).reg(), Object::null_object()); ASSERT(IsDeoptIfNull() || IsDeoptIfNotNull()); @@ -6216,7 +5982,6 @@ void CheckClassInstr::EmitNullCheck(FlowGraphCompiler* compiler, Label* deopt) { __ b(deopt, cond); } - void CheckClassInstr::EmitBitTest(FlowGraphCompiler* compiler, intptr_t min, intptr_t max, @@ -6234,7 +5999,6 @@ void CheckClassInstr::EmitBitTest(FlowGraphCompiler* compiler, __ b(deopt, EQ); } - int CheckClassInstr::EmitCheckCid(FlowGraphCompiler* compiler, int bias, intptr_t cid_start, @@ -6266,7 +6030,6 @@ int CheckClassInstr::EmitCheckCid(FlowGraphCompiler* compiler, return bias; } - LocationSummary* CheckSmiInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -6277,7 +6040,6 @@ LocationSummary* CheckSmiInstr::MakeLocationSummary(Zone* zone, return summary; } - void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register value = locs()->in(0).reg(); Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckSmi, @@ -6285,7 +6047,6 @@ void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ BranchIfNotSmi(value, deopt); } - LocationSummary* CheckClassIdInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -6297,7 +6058,6 @@ LocationSummary* CheckClassIdInstr::MakeLocationSummary(Zone* zone, return summary; } - void CheckClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register value = locs()->in(0).reg(); Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckClass); @@ -6311,7 +6071,6 @@ void CheckClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* GenericCheckBoundInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -6323,7 +6082,6 @@ LocationSummary* GenericCheckBoundInstr::MakeLocationSummary(Zone* zone, return locs; } - class RangeErrorSlowPath : public SlowPathCode { public: RangeErrorSlowPath(GenericCheckBoundInstr* instruction, intptr_t try_index) @@ -6353,7 +6111,6 @@ class RangeErrorSlowPath : public SlowPathCode { intptr_t try_index_; }; - void GenericCheckBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { RangeErrorSlowPath* slow_path = new RangeErrorSlowPath(this, compiler->CurrentTryIndex()); @@ -6371,7 +6128,6 @@ void GenericCheckBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ b(slow_path->entry_label(), CS); } - LocationSummary* CheckArrayBoundInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -6383,7 +6139,6 @@ LocationSummary* CheckArrayBoundInstr::MakeLocationSummary(Zone* zone, return locs; } - void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { uint32_t flags = generalized_ ? ICData::kGeneralized : 0; flags |= licm_hoisted_ ? ICData::kHoisted : 0; @@ -6433,7 +6188,6 @@ void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* BinaryMintOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -6449,7 +6203,6 @@ LocationSummary* BinaryMintOpInstr::MakeLocationSummary(Zone* zone, return summary; } - void BinaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { PairLocation* left_pair = locs()->in(0).AsPairLocation(); Register left_lo = left_pair->At(0).reg(); @@ -6513,7 +6266,6 @@ void BinaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* ShiftMintOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -6528,7 +6280,6 @@ LocationSummary* ShiftMintOpInstr::MakeLocationSummary(Zone* zone, return summary; } - void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { PairLocation* left_pair = locs()->in(0).AsPairLocation(); Register left_lo = left_pair->At(0).reg(); @@ -6650,7 +6401,6 @@ void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* UnaryMintOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -6664,7 +6414,6 @@ LocationSummary* UnaryMintOpInstr::MakeLocationSummary(Zone* zone, return summary; } - void UnaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(op_kind() == Token::kBIT_NOT); PairLocation* left_pair = locs()->in(0).AsPairLocation(); @@ -6678,22 +6427,18 @@ void UnaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ mvn(out_hi, Operand(left_hi)); } - CompileType BinaryUint32OpInstr::ComputeType() const { return CompileType::Int(); } - CompileType ShiftUint32OpInstr::ComputeType() const { return CompileType::Int(); } - CompileType UnaryUint32OpInstr::ComputeType() const { return CompileType::Int(); } - LocationSummary* BinaryUint32OpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -6706,7 +6451,6 @@ LocationSummary* BinaryUint32OpInstr::MakeLocationSummary(Zone* zone, return summary; } - void BinaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register left = locs()->in(0).reg(); Register right = locs()->in(1).reg(); @@ -6736,7 +6480,6 @@ void BinaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* ShiftUint32OpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -6750,7 +6493,6 @@ LocationSummary* ShiftUint32OpInstr::MakeLocationSummary(Zone* zone, return summary; } - void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const intptr_t kShifterLimit = 31; @@ -6806,7 +6548,6 @@ void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* UnaryUint32OpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -6818,7 +6559,6 @@ LocationSummary* UnaryUint32OpInstr::MakeLocationSummary(Zone* zone, return summary; } - void UnaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register left = locs()->in(0).reg(); Register out = locs()->out(0).reg(); @@ -6829,7 +6569,6 @@ void UnaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ mvn(out, Operand(left)); } - LocationSummary* UnboxedIntConverterInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -6855,7 +6594,6 @@ LocationSummary* UnboxedIntConverterInstr::MakeLocationSummary(Zone* zone, return summary; } - void UnboxedIntConverterInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (from() == kUnboxedInt32 && to() == kUnboxedUint32) { const Register out = locs()->out(0).reg(); @@ -6905,24 +6643,20 @@ void UnboxedIntConverterInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* ThrowInstr::MakeLocationSummary(Zone* zone, bool opt) const { return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kCall); } - void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { compiler->GenerateRuntimeCall(token_pos(), deopt_id(), kThrowRuntimeEntry, 1, locs()); __ bkpt(0); } - LocationSummary* ReThrowInstr::MakeLocationSummary(Zone* zone, bool opt) const { return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kCall); } - void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { compiler->SetNeedsStackTrace(catch_try_index()); compiler->GenerateRuntimeCall(token_pos(), deopt_id(), kReThrowRuntimeEntry, @@ -6930,29 +6664,24 @@ void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ bkpt(0); } - LocationSummary* StopInstr::MakeLocationSummary(Zone* zone, bool opt) const { return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kNoCall); } - void StopInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Stop(message()); } - void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (!compiler->CanFallThroughTo(normal_entry())) { __ b(compiler->GetJumpLabel(normal_entry())); } } - LocationSummary* GotoInstr::MakeLocationSummary(Zone* zone, bool opt) const { return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kNoCall); } - void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (!compiler->is_optimizing()) { if (FLAG_reorder_basic_blocks) { @@ -6974,7 +6703,6 @@ void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* IndirectGotoInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -6989,7 +6717,6 @@ LocationSummary* IndirectGotoInstr::MakeLocationSummary(Zone* zone, return summary; } - void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register target_address_reg = locs()->temp_slot(0)->reg(); @@ -7008,7 +6735,6 @@ void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ bx(target_address_reg); } - LocationSummary* StrictCompareInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -7047,7 +6773,6 @@ LocationSummary* StrictCompareInstr::MakeLocationSummary(Zone* zone, return locs; } - Condition StrictCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { Location left = locs()->in(0); @@ -7073,7 +6798,6 @@ Condition StrictCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, return true_condition; } - void ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // The ARM code may not use true- and false-labels here. Label is_true, is_false, done; @@ -7100,7 +6824,6 @@ void ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - void ComparisonInstr::EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch) { BranchLabels labels = compiler->CreateBranchLabels(branch); @@ -7110,14 +6833,12 @@ void ComparisonInstr::EmitBranchCode(FlowGraphCompiler* compiler, } } - LocationSummary* BooleanNegateInstr::MakeLocationSummary(Zone* zone, bool opt) const { return LocationSummary::Make(zone, 1, Location::RequiresRegister(), LocationSummary::kNoCall); } - void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register value = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); @@ -7127,13 +6848,11 @@ void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ LoadObject(result, Bool::False(), EQ); } - LocationSummary* AllocateObjectInstr::MakeLocationSummary(Zone* zone, bool opt) const { return MakeCallSummary(zone); } - void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Code& stub = Code::ZoneHandle( compiler->zone(), StubCode::GetAllocationStubForClass(cls())); @@ -7144,7 +6863,6 @@ void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Drop(ArgumentCount()); // Discard arguments. } - void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(!compiler->is_optimizing()); __ BranchLinkPatchable(*StubCode::DebugStepCheck_entry()); @@ -7152,7 +6870,6 @@ void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) { compiler->RecordSafepoint(locs()); } - } // namespace dart #endif // defined TARGET_ARCH_ARM diff --git a/runtime/vm/intermediate_language_arm64.cc b/runtime/vm/intermediate_language_arm64.cc index 2e53e4458b2..73bf9673b8c 100644 --- a/runtime/vm/intermediate_language_arm64.cc +++ b/runtime/vm/intermediate_language_arm64.cc @@ -35,7 +35,6 @@ LocationSummary* Instruction::MakeCallSummary(Zone* zone) { return result; } - LocationSummary* PushArgumentInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -46,7 +45,6 @@ LocationSummary* PushArgumentInstr::MakeLocationSummary(Zone* zone, return locs; } - void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // In SSA mode, we need an explicit push. Nothing to do in non-SSA mode // where PushArgument is handled by BindInstr::EmitNativeCode. @@ -65,7 +63,6 @@ void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* ReturnInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; const intptr_t kNumTemps = 0; @@ -75,7 +72,6 @@ LocationSummary* ReturnInstr::MakeLocationSummary(Zone* zone, bool opt) const { return locs; } - // Attempt optimized compilation at return instruction instead of at the entry. // The entry needs to be patchable, no inlined objects are allowed in the area // that will be overwritten by the patch instructions: a branch macro sequence. @@ -109,7 +105,6 @@ void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ set_constant_pool_allowed(true); } - static Condition NegateCondition(Condition condition) { switch (condition) { case EQ: @@ -142,21 +137,18 @@ static Condition NegateCondition(Condition condition) { } } - // Detect pattern when one value is zero and another is a power of 2. static bool IsPowerOfTwoKind(intptr_t v1, intptr_t v2) { return (Utils::IsPowerOfTwo(v1) && (v2 == 0)) || (Utils::IsPowerOfTwo(v2) && (v1 == 0)); } - LocationSummary* IfThenElseInstr::MakeLocationSummary(Zone* zone, bool opt) const { comparison()->InitializeLocationSummary(zone, opt); return comparison()->locs(); } - void IfThenElseInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register result = locs()->out(0).reg(); @@ -208,7 +200,6 @@ void IfThenElseInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* ClosureCallInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -220,7 +211,6 @@ LocationSummary* ClosureCallInstr::MakeLocationSummary(Zone* zone, return summary; } - void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // Load arguments descriptor in R4. const intptr_t argument_count = ArgumentCount(); // Includes type args. @@ -255,27 +245,23 @@ void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Drop(argument_count); } - LocationSummary* LoadLocalInstr::MakeLocationSummary(Zone* zone, bool opt) const { return LocationSummary::Make(zone, 0, Location::RequiresRegister(), LocationSummary::kNoCall); } - void LoadLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register result = locs()->out(0).reg(); __ LoadFromOffset(result, FP, local().index() * kWordSize); } - LocationSummary* StoreLocalInstr::MakeLocationSummary(Zone* zone, bool opt) const { return LocationSummary::Make(zone, 1, Location::SameAsFirstInput(), LocationSummary::kNoCall); } - void StoreLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register value = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); @@ -283,14 +269,12 @@ void StoreLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ StoreToOffset(value, FP, local().index() * kWordSize); } - LocationSummary* ConstantInstr::MakeLocationSummary(Zone* zone, bool opt) const { return LocationSummary::Make(zone, 0, Location::RequiresRegister(), LocationSummary::kNoCall); } - void ConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // The register allocator drops constant definitions that have no uses. if (!locs()->out(0).IsInvalid()) { @@ -299,7 +283,6 @@ void ConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* UnboxedConstantInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -309,7 +292,6 @@ LocationSummary* UnboxedConstantInstr::MakeLocationSummary(Zone* zone, return LocationSummary::Make(zone, kNumInputs, out, LocationSummary::kNoCall); } - void UnboxedConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (!locs()->out(0).IsInvalid()) { switch (representation_) { @@ -333,7 +315,6 @@ void UnboxedConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* AssertAssignableInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 3; @@ -347,7 +328,6 @@ LocationSummary* AssertAssignableInstr::MakeLocationSummary(Zone* zone, return summary; } - LocationSummary* AssertBooleanInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -359,7 +339,6 @@ LocationSummary* AssertBooleanInstr::MakeLocationSummary(Zone* zone, return locs; } - static void EmitAssertBoolean(Register reg, TokenPosition token_pos, intptr_t deopt_id, @@ -389,7 +368,6 @@ static void EmitAssertBoolean(Register reg, __ Bind(&done); } - void AssertBooleanInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register obj = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); @@ -398,7 +376,6 @@ void AssertBooleanInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(obj == result); } - static Condition TokenKindToSmiCondition(Token::Kind kind) { switch (kind) { case Token::kEQ: @@ -419,7 +396,6 @@ static Condition TokenKindToSmiCondition(Token::Kind kind) { } } - static Condition FlipCondition(Condition condition) { switch (condition) { case EQ: @@ -448,7 +424,6 @@ static Condition FlipCondition(Condition condition) { } } - static void EmitBranchOnCondition(FlowGraphCompiler* compiler, Condition true_condition, BranchLabels labels) { @@ -467,7 +442,6 @@ static void EmitBranchOnCondition(FlowGraphCompiler* compiler, } } - static Condition EmitSmiComparisonOp(FlowGraphCompiler* compiler, LocationSummary* locs, Token::Kind kind) { @@ -488,7 +462,6 @@ static Condition EmitSmiComparisonOp(FlowGraphCompiler* compiler, return true_condition; } - LocationSummary* EqualityCompareInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -519,7 +492,6 @@ LocationSummary* EqualityCompareInstr::MakeLocationSummary(Zone* zone, return NULL; } - static Condition TokenKindToDoubleCondition(Token::Kind kind) { switch (kind) { case Token::kEQ: @@ -540,7 +512,6 @@ static Condition TokenKindToDoubleCondition(Token::Kind kind) { } } - static Condition EmitDoubleComparisonOp(FlowGraphCompiler* compiler, LocationSummary* locs, BranchLabels labels, @@ -557,7 +528,6 @@ static Condition EmitDoubleComparisonOp(FlowGraphCompiler* compiler, return true_condition; } - Condition EqualityCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { if (operation_cid() == kSmiCid) { @@ -568,7 +538,6 @@ Condition EqualityCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, } } - LocationSummary* TestSmiInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; const intptr_t kNumTemps = 0; @@ -581,7 +550,6 @@ LocationSummary* TestSmiInstr::MakeLocationSummary(Zone* zone, bool opt) const { return locs; } - Condition TestSmiInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { const Register left = locs()->in(0).reg(); @@ -597,7 +565,6 @@ Condition TestSmiInstr::EmitComparisonCode(FlowGraphCompiler* compiler, return true_condition; } - LocationSummary* TestCidsInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -610,18 +577,16 @@ LocationSummary* TestCidsInstr::MakeLocationSummary(Zone* zone, return locs; } - Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { ASSERT((kind() == Token::kIS) || (kind() == Token::kISNOT)); const Register val_reg = locs()->in(0).reg(); const Register cid_reg = locs()->temp(0).reg(); - Label* deopt = - CanDeoptimize() - ? compiler->AddDeoptStub(deopt_id(), ICData::kDeoptTestCids, - licm_hoisted_ ? ICData::kHoisted : 0) - : NULL; + Label* deopt = CanDeoptimize() ? compiler->AddDeoptStub( + deopt_id(), ICData::kDeoptTestCids, + licm_hoisted_ ? ICData::kHoisted : 0) + : NULL; const intptr_t true_result = (kind() == Token::kIS) ? 1 : 0; const ZoneGrowableArray& data = cid_results(); @@ -655,7 +620,6 @@ Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler, return kInvalidCondition; } - LocationSummary* RelationalOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -681,7 +645,6 @@ LocationSummary* RelationalOpInstr::MakeLocationSummary(Zone* zone, return summary; } - Condition RelationalOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { if (operation_cid() == kSmiCid) { @@ -692,13 +655,11 @@ Condition RelationalOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler, } } - LocationSummary* NativeCallInstr::MakeLocationSummary(Zone* zone, bool opt) const { return MakeCallSummary(zone); } - void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { SetupNative(); const Register result = locs()->out(0).reg(); @@ -754,7 +715,6 @@ void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Pop(result); } - LocationSummary* OneByteStringFromCharCodeInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -764,7 +724,6 @@ LocationSummary* OneByteStringFromCharCodeInstr::MakeLocationSummary( LocationSummary::kNoCall); } - void OneByteStringFromCharCodeInstr::EmitNativeCode( FlowGraphCompiler* compiler) { ASSERT(compiler->is_optimizing()); @@ -777,7 +736,6 @@ void OneByteStringFromCharCodeInstr::EmitNativeCode( __ ldr(result, Address(result, TMP, UXTX, Address::Scaled)); } - LocationSummary* StringToCharCodeInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -785,7 +743,6 @@ LocationSummary* StringToCharCodeInstr::MakeLocationSummary(Zone* zone, LocationSummary::kNoCall); } - void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(cid_ == kOneByteStringCid); const Register str = locs()->in(0).reg(); @@ -798,7 +755,6 @@ void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ SmiTag(result); } - LocationSummary* StringInterpolateInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -810,7 +766,6 @@ LocationSummary* StringInterpolateInstr::MakeLocationSummary(Zone* zone, return summary; } - void StringInterpolateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register array = locs()->in(0).reg(); __ Push(array); @@ -823,7 +778,6 @@ void StringInterpolateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->out(0).reg() == R0); } - LocationSummary* LoadUntaggedInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -831,7 +785,6 @@ LocationSummary* LoadUntaggedInstr::MakeLocationSummary(Zone* zone, LocationSummary::kNoCall); } - void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register obj = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); @@ -843,7 +796,6 @@ void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* LoadClassIdInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -851,7 +803,6 @@ LocationSummary* LoadClassIdInstr::MakeLocationSummary(Zone* zone, LocationSummary::kNoCall); } - void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register object = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); @@ -865,7 +816,6 @@ void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - CompileType LoadIndexedInstr::ComputeType() const { switch (class_id_) { case kArrayCid: @@ -903,7 +853,6 @@ CompileType LoadIndexedInstr::ComputeType() const { } } - Representation LoadIndexedInstr::representation() const { switch (class_id_) { case kArrayCid: @@ -939,7 +888,6 @@ Representation LoadIndexedInstr::representation() const { } } - static bool CanBeImmediateIndex(Value* value, intptr_t cid, bool is_external) { ConstantInstr* constant = value->definition()->AsConstant(); if ((constant == NULL) || !constant->value().IsSmi()) { @@ -957,7 +905,6 @@ static bool CanBeImmediateIndex(Value* value, intptr_t cid, bool is_external) { Address::OperandSizeFor(cid)); } - LocationSummary* LoadIndexedInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -984,7 +931,6 @@ LocationSummary* LoadIndexedInstr::MakeLocationSummary(Zone* zone, return locs; } - void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // The array register points to the backing store for external arrays. const Register array = locs()->in(0).reg(); @@ -1122,7 +1068,6 @@ void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -1135,7 +1080,6 @@ LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Zone* zone, return summary; } - void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // The string register points to the backing store for external strings. const Register str = locs()->in(0).reg(); @@ -1184,7 +1128,6 @@ void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - Representation StoreIndexedInstr::RequiredInputRepresentation( intptr_t idx) const { // Array can be a Dart object or a pointer to external data. @@ -1221,7 +1164,6 @@ Representation StoreIndexedInstr::RequiredInputRepresentation( } } - LocationSummary* StoreIndexedInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 3; @@ -1272,7 +1214,6 @@ LocationSummary* StoreIndexedInstr::MakeLocationSummary(Zone* zone, return locs; } - void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // The array register points to the backing store for external arrays. const Register array = locs()->in(0).reg(); @@ -1412,7 +1353,6 @@ void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - static void LoadValueCid(FlowGraphCompiler* compiler, Register value_cid_reg, Register value_reg, @@ -1431,7 +1371,6 @@ static void LoadValueCid(FlowGraphCompiler* compiler, __ Bind(&done); } - LocationSummary* GuardFieldClassInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -1465,7 +1404,6 @@ LocationSummary* GuardFieldClassInstr::MakeLocationSummary(Zone* zone, return summary; } - void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(sizeof(classid_t) == kInt16Size); const intptr_t value_cid = value()->Type()->ToCid(); @@ -1607,7 +1545,6 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&ok); } - LocationSummary* GuardFieldLengthInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -1630,7 +1567,6 @@ LocationSummary* GuardFieldLengthInstr::MakeLocationSummary(Zone* zone, UNREACHABLE(); } - void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (field().guarded_list_length() == Field::kNoFixedLength) { if (Compiler::IsBackgroundCompilation()) { @@ -1702,7 +1638,6 @@ void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - class BoxAllocationSlowPath : public SlowPathCode { public: BoxAllocationSlowPath(Instruction* instruction, @@ -1756,7 +1691,6 @@ class BoxAllocationSlowPath : public SlowPathCode { const Register result_; }; - static void EnsureMutableBox(FlowGraphCompiler* compiler, StoreInstanceFieldInstr* instruction, Register box_reg, @@ -1774,7 +1708,6 @@ static void EnsureMutableBox(FlowGraphCompiler* compiler, __ Bind(&done); } - LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -1805,7 +1738,6 @@ LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Zone* zone, return summary; } - void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(sizeof(classid_t) == kInt16Size); Label skip_store; @@ -1958,7 +1890,6 @@ void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&skip_store); } - LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -1970,7 +1901,6 @@ LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone, return summary; } - // When the parser is building an implicit static getter for optimization, // it can generate a function body where deoptimization ids do not line up // with the unoptimized code. @@ -1982,7 +1912,6 @@ void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ LoadFieldFromOffset(result, field, Field::static_value_offset()); } - LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { LocationSummary* locs = @@ -1993,7 +1922,6 @@ LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(Zone* zone, return locs; } - void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register value = locs()->in(0).reg(); const Register temp = locs()->temp(0).reg(); @@ -2008,7 +1936,6 @@ void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* InstanceOfInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 3; @@ -2022,7 +1949,6 @@ LocationSummary* InstanceOfInstr::MakeLocationSummary(Zone* zone, return summary; } - void InstanceOfInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->in(0).reg() == R0); // Value. ASSERT(locs()->in(1).reg() == R1); // Instantiator type arguments. @@ -2032,7 +1958,6 @@ void InstanceOfInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->out(0).reg() == R0); } - LocationSummary* CreateArrayInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -2045,7 +1970,6 @@ LocationSummary* CreateArrayInstr::MakeLocationSummary(Zone* zone, return locs; } - // Inlines array allocation for known constant values. static void InlineArrayAllocation(FlowGraphCompiler* compiler, intptr_t num_elements, @@ -2102,7 +2026,6 @@ static void InlineArrayAllocation(FlowGraphCompiler* compiler, __ b(done); } - void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register kLengthReg = R2; const Register kElemTypeReg = R1; @@ -2139,16 +2062,15 @@ void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->out(0).reg() == kResultReg); } - LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; const intptr_t kNumTemps = (IsUnboxedLoad() && opt) ? 1 : ((IsPotentialUnboxedLoad()) ? 1 : 0); LocationSummary* locs = new (zone) LocationSummary( - zone, kNumInputs, kNumTemps, (opt && !IsPotentialUnboxedLoad()) - ? LocationSummary::kNoCall - : LocationSummary::kCallOnSlowPath); + zone, kNumInputs, kNumTemps, + (opt && !IsPotentialUnboxedLoad()) ? LocationSummary::kNoCall + : LocationSummary::kCallOnSlowPath); locs->set_in(0, Location::RequiresRegister()); @@ -2161,7 +2083,6 @@ LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, return locs; } - void LoadFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(sizeof(classid_t) == kInt16Size); const Register instance_reg = locs()->in(0).reg(); @@ -2263,7 +2184,6 @@ void LoadFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&done); } - LocationSummary* InstantiateTypeInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -2276,7 +2196,6 @@ LocationSummary* InstantiateTypeInstr::MakeLocationSummary(Zone* zone, return locs; } - void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register instantiator_type_args_reg = locs()->in(0).reg(); const Register function_type_args_reg = locs()->in(1).reg(); @@ -2295,7 +2214,6 @@ void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(instantiator_type_args_reg == result_reg); } - LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -2309,7 +2227,6 @@ LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary( return locs; } - void InstantiateTypeArgumentsInstr::EmitNativeCode( FlowGraphCompiler* compiler) { const Register instantiator_type_args_reg = locs()->in(0).reg(); @@ -2376,7 +2293,6 @@ void InstantiateTypeArgumentsInstr::EmitNativeCode( __ Bind(&type_arguments_instantiated); } - LocationSummary* AllocateUninitializedContextInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -2392,7 +2308,6 @@ LocationSummary* AllocateUninitializedContextInstr::MakeLocationSummary( return locs; } - class AllocateContextSlowPath : public SlowPathCode { public: explicit AllocateContextSlowPath( @@ -2424,7 +2339,6 @@ class AllocateContextSlowPath : public SlowPathCode { AllocateUninitializedContextInstr* instruction_; }; - void AllocateUninitializedContextInstr::EmitNativeCode( FlowGraphCompiler* compiler) { Register temp0 = locs()->temp(0).reg(); @@ -2447,7 +2361,6 @@ void AllocateUninitializedContextInstr::EmitNativeCode( __ Bind(slow_path->exit_label()); } - LocationSummary* AllocateContextInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -2459,7 +2372,6 @@ LocationSummary* AllocateContextInstr::MakeLocationSummary(Zone* zone, return locs; } - void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->temp(0).reg() == R1); ASSERT(locs()->out(0).reg() == R0); @@ -2480,7 +2392,6 @@ LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone, return locs; } - void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register field = locs()->in(0).reg(); Register temp = locs()->temp(0).reg(); @@ -2502,7 +2413,6 @@ void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&no_call); } - LocationSummary* CloneContextInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -2514,7 +2424,6 @@ LocationSummary* CloneContextInstr::MakeLocationSummary(Zone* zone, return locs; } - void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register context_value = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); @@ -2527,14 +2436,12 @@ void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Pop(result); // Get result (cloned context). } - LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Zone* zone, bool opt) const { UNREACHABLE(); return NULL; } - void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(compiler->GetJumpLabel(this)); compiler->AddExceptionHandler(catch_try_index(), try_index(), @@ -2598,7 +2505,6 @@ void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -2609,7 +2515,6 @@ LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Zone* zone, return summary; } - class CheckStackOverflowSlowPath : public SlowPathCode { public: explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) @@ -2657,7 +2562,6 @@ class CheckStackOverflowSlowPath : public SlowPathCode { Label osr_entry_label_; }; - void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); compiler->AddSlowPathCode(slow_path); @@ -2685,7 +2589,6 @@ void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(slow_path->exit_label()); } - static void EmitSmiShiftLeft(FlowGraphCompiler* compiler, BinarySmiOpInstr* shift_left) { const LocationSummary& locs = *shift_left->locs(); @@ -2783,7 +2686,6 @@ static void EmitSmiShiftLeft(FlowGraphCompiler* compiler, } } - class CheckedSmiSlowPath : public SlowPathCode { public: CheckedSmiSlowPath(CheckedSmiOpInstr* instruction, intptr_t try_index) @@ -2825,7 +2727,6 @@ class CheckedSmiSlowPath : public SlowPathCode { intptr_t try_index_; }; - LocationSummary* CheckedSmiOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -2838,7 +2739,6 @@ LocationSummary* CheckedSmiOpInstr::MakeLocationSummary(Zone* zone, return summary; } - void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { CheckedSmiSlowPath* slow_path = new CheckedSmiSlowPath(this, compiler->CurrentTryIndex()); @@ -2923,7 +2823,6 @@ void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(slow_path->exit_label()); } - class CheckedSmiComparisonSlowPath : public SlowPathCode { public: CheckedSmiComparisonSlowPath(CheckedSmiComparisonInstr* instruction, @@ -2982,7 +2881,6 @@ class CheckedSmiComparisonSlowPath : public SlowPathCode { bool merged_; }; - LocationSummary* CheckedSmiComparisonInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -2997,14 +2895,12 @@ LocationSummary* CheckedSmiComparisonInstr::MakeLocationSummary( return summary; } - Condition CheckedSmiComparisonInstr::EmitComparisonCode( FlowGraphCompiler* compiler, BranchLabels labels) { return EmitSmiComparisonOp(compiler, locs(), kind()); } - #define EMIT_SMI_CHECK \ Register left = locs()->in(0).reg(); \ Register right = locs()->in(1).reg(); \ @@ -3023,7 +2919,6 @@ Condition CheckedSmiComparisonInstr::EmitComparisonCode( } \ __ b(slow_path->entry_label(), NE) - void CheckedSmiComparisonInstr::EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch) { BranchLabels labels = compiler->CreateBranchLabels(branch); @@ -3038,7 +2933,6 @@ void CheckedSmiComparisonInstr::EmitBranchCode(FlowGraphCompiler* compiler, __ Bind(slow_path->exit_label()); } - void CheckedSmiComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Label true_label, false_label, done; BranchLabels labels = {&true_label, &false_label, &false_label}; @@ -3060,7 +2954,6 @@ void CheckedSmiComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(slow_path->exit_label()); } - LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -3099,7 +2992,6 @@ LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone, return summary; } - void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (op_kind() == Token::kSHL) { EmitSmiShiftLeft(compiler, this); @@ -3336,7 +3228,6 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary(Zone* zone, bool opt) const { intptr_t left_cid = left()->Type()->ToCid(); @@ -3351,7 +3242,6 @@ LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary(Zone* zone, return summary; } - void CheckEitherNonSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinaryDoubleOp, @@ -3373,7 +3263,6 @@ void CheckEitherNonSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ b(deopt, EQ); } - LocationSummary* BoxInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; const intptr_t kNumTemps = 1; @@ -3385,7 +3274,6 @@ LocationSummary* BoxInstr::MakeLocationSummary(Zone* zone, bool opt) const { return summary; } - void BoxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register out_reg = locs()->out(0).reg(); const Register temp_reg = locs()->temp(0).reg(); @@ -3410,7 +3298,6 @@ void BoxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* UnboxInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; const intptr_t kNumTemps = 0; @@ -3421,7 +3308,6 @@ LocationSummary* UnboxInstr::MakeLocationSummary(Zone* zone, bool opt) const { return summary; } - void UnboxInstr::EmitLoadFromBox(FlowGraphCompiler* compiler) { const Register box = locs()->in(0).reg(); @@ -3451,7 +3337,6 @@ void UnboxInstr::EmitLoadFromBox(FlowGraphCompiler* compiler) { } } - void UnboxInstr::EmitSmiConversion(FlowGraphCompiler* compiler) { const Register box = locs()->in(0).reg(); @@ -3474,7 +3359,6 @@ void UnboxInstr::EmitSmiConversion(FlowGraphCompiler* compiler) { } } - void UnboxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const intptr_t value_cid = value()->Type()->ToCid(); const intptr_t box_cid = BoxCid(); @@ -3512,7 +3396,6 @@ void UnboxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* BoxInteger32Instr::MakeLocationSummary(Zone* zone, bool opt) const { ASSERT((from_representation() == kUnboxedInt32) || @@ -3526,7 +3409,6 @@ LocationSummary* BoxInteger32Instr::MakeLocationSummary(Zone* zone, return summary; } - void BoxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) { Register value = locs()->in(0).reg(); Register out = locs()->out(0).reg(); @@ -3543,10 +3425,8 @@ void BoxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - DEFINE_UNIMPLEMENTED_INSTRUCTION(BoxInt64Instr) - LocationSummary* UnboxInteger32Instr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -3558,15 +3438,13 @@ LocationSummary* UnboxInteger32Instr::MakeLocationSummary(Zone* zone, return summary; } - void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) { const intptr_t value_cid = value()->Type()->ToCid(); const Register out = locs()->out(0).reg(); const Register value = locs()->in(0).reg(); - Label* deopt = - CanDeoptimize() - ? compiler->AddDeoptStub(GetDeoptId(), ICData::kDeoptUnboxInteger) - : NULL; + Label* deopt = CanDeoptimize() ? compiler->AddDeoptStub( + GetDeoptId(), ICData::kDeoptUnboxInteger) + : NULL; if (value_cid == kSmiCid) { __ SmiUntag(out, value); @@ -3603,7 +3481,6 @@ void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -3616,7 +3493,6 @@ LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary(Zone* zone, return summary; } - void BinaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister left = locs()->in(0).fpu_reg(); const VRegister right = locs()->in(1).fpu_reg(); @@ -3639,7 +3515,6 @@ void BinaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* DoubleTestOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -3655,7 +3530,6 @@ LocationSummary* DoubleTestOpInstr::MakeLocationSummary(Zone* zone, return summary; } - Condition DoubleTestOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { ASSERT(compiler->is_optimizing()); @@ -3676,7 +3550,6 @@ Condition DoubleTestOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler, } } - LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -3689,7 +3562,6 @@ LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone, return summary; } - void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister left = locs()->in(0).fpu_reg(); const VRegister right = locs()->in(1).fpu_reg(); @@ -3713,7 +3585,6 @@ void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* BinaryFloat64x2OpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -3726,7 +3597,6 @@ LocationSummary* BinaryFloat64x2OpInstr::MakeLocationSummary(Zone* zone, return summary; } - void BinaryFloat64x2OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister left = locs()->in(0).fpu_reg(); const VRegister right = locs()->in(1).fpu_reg(); @@ -3750,7 +3620,6 @@ void BinaryFloat64x2OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Simd32x4ShuffleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -3762,7 +3631,6 @@ LocationSummary* Simd32x4ShuffleInstr::MakeLocationSummary(Zone* zone, return summary; } - void Simd32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister value = locs()->in(0).fpu_reg(); const VRegister result = locs()->out(0).fpu_reg(); @@ -3806,7 +3674,6 @@ void Simd32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Simd32x4ShuffleMixInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -3819,7 +3686,6 @@ LocationSummary* Simd32x4ShuffleMixInstr::MakeLocationSummary(Zone* zone, return summary; } - void Simd32x4ShuffleMixInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister left = locs()->in(0).fpu_reg(); const VRegister right = locs()->in(1).fpu_reg(); @@ -3838,7 +3704,6 @@ void Simd32x4ShuffleMixInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -3851,7 +3716,6 @@ LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary(Zone* zone, return summary; } - void Simd32x4GetSignMaskInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister value = locs()->in(0).fpu_reg(); const Register out = locs()->out(0).reg(); @@ -3876,7 +3740,6 @@ void Simd32x4GetSignMaskInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ SmiTag(out); } - LocationSummary* Float32x4ConstructorInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -3892,7 +3755,6 @@ LocationSummary* Float32x4ConstructorInstr::MakeLocationSummary( return summary; } - void Float32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister v0 = locs()->in(0).fpu_reg(); const VRegister v1 = locs()->in(1).fpu_reg(); @@ -3910,7 +3772,6 @@ void Float32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ vinss(r, 3, VTMP, 0); } - LocationSummary* Float32x4ZeroInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -3921,13 +3782,11 @@ LocationSummary* Float32x4ZeroInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister v = locs()->out(0).fpu_reg(); __ veor(v, v, v); } - LocationSummary* Float32x4SplatInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -3939,7 +3798,6 @@ LocationSummary* Float32x4SplatInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister value = locs()->in(0).fpu_reg(); const VRegister result = locs()->out(0).fpu_reg(); @@ -3951,7 +3809,6 @@ void Float32x4SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ vdups(result, VTMP, 0); } - LocationSummary* Float32x4ComparisonInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -3964,7 +3821,6 @@ LocationSummary* Float32x4ComparisonInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister left = locs()->in(0).fpu_reg(); const VRegister right = locs()->in(1).fpu_reg(); @@ -3997,7 +3853,6 @@ void Float32x4ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float32x4MinMaxInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4010,7 +3865,6 @@ LocationSummary* Float32x4MinMaxInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4MinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister left = locs()->in(0).fpu_reg(); const VRegister right = locs()->in(1).fpu_reg(); @@ -4028,7 +3882,6 @@ void Float32x4MinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float32x4SqrtInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4040,7 +3893,6 @@ LocationSummary* Float32x4SqrtInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4SqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister left = locs()->in(0).fpu_reg(); const VRegister result = locs()->out(0).fpu_reg(); @@ -4060,7 +3912,6 @@ void Float32x4SqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float32x4ScaleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4073,7 +3924,6 @@ LocationSummary* Float32x4ScaleInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4ScaleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister left = locs()->in(0).fpu_reg(); const VRegister right = locs()->in(1).fpu_reg(); @@ -4090,7 +3940,6 @@ void Float32x4ScaleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float32x4ZeroArgInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4102,7 +3951,6 @@ LocationSummary* Float32x4ZeroArgInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister left = locs()->in(0).fpu_reg(); const VRegister result = locs()->out(0).fpu_reg(); @@ -4119,7 +3967,6 @@ void Float32x4ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float32x4ClampInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 3; @@ -4133,7 +3980,6 @@ LocationSummary* Float32x4ClampInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4ClampInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister left = locs()->in(0).fpu_reg(); const VRegister lower = locs()->in(1).fpu_reg(); @@ -4143,7 +3989,6 @@ void Float32x4ClampInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ vmaxs(result, result, lower); } - LocationSummary* Float32x4WithInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4156,7 +4001,6 @@ LocationSummary* Float32x4WithInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4WithInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister replacement = locs()->in(0).fpu_reg(); const VRegister value = locs()->in(1).fpu_reg(); @@ -4185,7 +4029,6 @@ void Float32x4WithInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float32x4ToInt32x4Instr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4197,7 +4040,6 @@ LocationSummary* Float32x4ToInt32x4Instr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4ToInt32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister value = locs()->in(0).fpu_reg(); const VRegister result = locs()->out(0).fpu_reg(); @@ -4207,7 +4049,6 @@ void Float32x4ToInt32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Simd64x2ShuffleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4219,7 +4060,6 @@ LocationSummary* Simd64x2ShuffleInstr::MakeLocationSummary(Zone* zone, return summary; } - void Simd64x2ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister value = locs()->in(0).fpu_reg(); const VRegister result = locs()->out(0).fpu_reg(); @@ -4236,7 +4076,6 @@ void Simd64x2ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float64x2ZeroInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -4247,13 +4086,11 @@ LocationSummary* Float64x2ZeroInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float64x2ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister v = locs()->out(0).fpu_reg(); __ veor(v, v, v); } - LocationSummary* Float64x2SplatInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4265,14 +4102,12 @@ LocationSummary* Float64x2SplatInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float64x2SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister value = locs()->in(0).fpu_reg(); const VRegister result = locs()->out(0).fpu_reg(); __ vdupd(result, value, 0); } - LocationSummary* Float64x2ConstructorInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -4286,7 +4121,6 @@ LocationSummary* Float64x2ConstructorInstr::MakeLocationSummary( return summary; } - void Float64x2ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister v0 = locs()->in(0).fpu_reg(); const VRegister v1 = locs()->in(1).fpu_reg(); @@ -4295,7 +4129,6 @@ void Float64x2ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ vinsd(r, 1, v1, 0); } - LocationSummary* Float64x2ToFloat32x4Instr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -4308,7 +4141,6 @@ LocationSummary* Float64x2ToFloat32x4Instr::MakeLocationSummary( return summary; } - void Float64x2ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister q = locs()->in(0).fpu_reg(); const VRegister r = locs()->out(0).fpu_reg(); @@ -4325,7 +4157,6 @@ void Float64x2ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { __ vinss(r, 1, VTMP, 0); } - LocationSummary* Float32x4ToFloat64x2Instr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -4338,7 +4169,6 @@ LocationSummary* Float32x4ToFloat64x2Instr::MakeLocationSummary( return summary; } - void Float32x4ToFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister q = locs()->in(0).fpu_reg(); const VRegister r = locs()->out(0).fpu_reg(); @@ -4353,7 +4183,6 @@ void Float32x4ToFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) { __ vinsd(r, 1, VTMP, 0); } - LocationSummary* Float64x2ZeroArgInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4372,7 +4201,6 @@ LocationSummary* Float64x2ZeroArgInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float64x2ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister value = locs()->in(0).fpu_reg(); @@ -4408,7 +4236,6 @@ void Float64x2ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float64x2OneArgInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4421,7 +4248,6 @@ LocationSummary* Float64x2OneArgInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float64x2OneArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister left = locs()->in(0).fpu_reg(); const VRegister right = locs()->in(1).fpu_reg(); @@ -4450,7 +4276,6 @@ void Float64x2OneArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Int32x4ConstructorInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 4; @@ -4465,7 +4290,6 @@ LocationSummary* Int32x4ConstructorInstr::MakeLocationSummary(Zone* zone, return summary; } - void Int32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register v0 = locs()->in(0).reg(); const Register v1 = locs()->in(1).reg(); @@ -4479,7 +4303,6 @@ void Int32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ vinsw(result, 3, v3); } - LocationSummary* Int32x4BoolConstructorInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -4496,7 +4319,6 @@ LocationSummary* Int32x4BoolConstructorInstr::MakeLocationSummary( return summary; } - void Int32x4BoolConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register v0 = locs()->in(0).reg(); const Register v1 = locs()->in(1).reg(); @@ -4530,7 +4352,6 @@ void Int32x4BoolConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ vinsw(result, 3, TMP); } - LocationSummary* Int32x4GetFlagInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4542,7 +4363,6 @@ LocationSummary* Int32x4GetFlagInstr::MakeLocationSummary(Zone* zone, return summary; } - void Int32x4GetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister value = locs()->in(0).fpu_reg(); const Register result = locs()->out(0).reg(); @@ -4570,7 +4390,6 @@ void Int32x4GetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ csel(result, TMP, result, EQ); } - LocationSummary* Int32x4SelectInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 3; @@ -4585,7 +4404,6 @@ LocationSummary* Int32x4SelectInstr::MakeLocationSummary(Zone* zone, return summary; } - void Int32x4SelectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister mask = locs()->in(0).fpu_reg(); const VRegister trueValue = locs()->in(1).fpu_reg(); @@ -4605,7 +4423,6 @@ void Int32x4SelectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ vorr(out, mask, temp); } - LocationSummary* Int32x4SetFlagInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4618,7 +4435,6 @@ LocationSummary* Int32x4SetFlagInstr::MakeLocationSummary(Zone* zone, return summary; } - void Int32x4SetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister mask = locs()->in(0).fpu_reg(); const Register flag = locs()->in(1).reg(); @@ -4649,7 +4465,6 @@ void Int32x4SetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Int32x4ToFloat32x4Instr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4661,7 +4476,6 @@ LocationSummary* Int32x4ToFloat32x4Instr::MakeLocationSummary(Zone* zone, return summary; } - void Int32x4ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister value = locs()->in(0).fpu_reg(); const VRegister result = locs()->out(0).fpu_reg(); @@ -4671,7 +4485,6 @@ void Int32x4ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* BinaryInt32x4OpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4684,7 +4497,6 @@ LocationSummary* BinaryInt32x4OpInstr::MakeLocationSummary(Zone* zone, return summary; } - void BinaryInt32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister left = locs()->in(0).fpu_reg(); const VRegister right = locs()->in(1).fpu_reg(); @@ -4710,7 +4522,6 @@ void BinaryInt32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* MathUnaryInstr::MakeLocationSummary(Zone* zone, bool opt) const { ASSERT((kind() == MathUnaryInstr::kSqrt) || @@ -4724,7 +4535,6 @@ LocationSummary* MathUnaryInstr::MakeLocationSummary(Zone* zone, return summary; } - void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (kind() == MathUnaryInstr::kSqrt) { const VRegister val = locs()->in(0).fpu_reg(); @@ -4739,7 +4549,6 @@ void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -4754,14 +4563,12 @@ LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary( return summary; } - void CaseInsensitiveCompareUC16Instr::EmitNativeCode( FlowGraphCompiler* compiler) { // Call the function. __ CallRuntime(TargetFunction(), TargetFunction().argument_count()); } - LocationSummary* MathMinMaxInstr::MakeLocationSummary(Zone* zone, bool opt) const { if (result_cid() == kDoubleCid) { @@ -4787,7 +4594,6 @@ LocationSummary* MathMinMaxInstr::MakeLocationSummary(Zone* zone, return summary; } - void MathMinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT((op_kind() == MethodRecognizer::kMathMin) || (op_kind() == MethodRecognizer::kMathMax)); @@ -4847,7 +4653,6 @@ void MathMinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* UnarySmiOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4861,7 +4666,6 @@ LocationSummary* UnarySmiOpInstr::MakeLocationSummary(Zone* zone, return summary; } - void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register value = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); @@ -4882,7 +4686,6 @@ void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* UnaryDoubleOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4894,14 +4697,12 @@ LocationSummary* UnaryDoubleOpInstr::MakeLocationSummary(Zone* zone, return summary; } - void UnaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister result = locs()->out(0).fpu_reg(); const VRegister value = locs()->in(0).fpu_reg(); __ fnegd(result, value); } - LocationSummary* Int32ToDoubleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4913,14 +4714,12 @@ LocationSummary* Int32ToDoubleInstr::MakeLocationSummary(Zone* zone, return result; } - void Int32ToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register value = locs()->in(0).reg(); const VRegister result = locs()->out(0).fpu_reg(); __ scvtfdw(result, value); } - LocationSummary* SmiToDoubleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4932,7 +4731,6 @@ LocationSummary* SmiToDoubleInstr::MakeLocationSummary(Zone* zone, return result; } - void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register value = locs()->in(0).reg(); const VRegister result = locs()->out(0).fpu_reg(); @@ -4940,19 +4738,16 @@ void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ scvtfdx(result, TMP); } - LocationSummary* MintToDoubleInstr::MakeLocationSummary(Zone* zone, bool opt) const { UNIMPLEMENTED(); return NULL; } - void MintToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } - LocationSummary* DoubleToIntegerInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4964,7 +4759,6 @@ LocationSummary* DoubleToIntegerInstr::MakeLocationSummary(Zone* zone, return result; } - void DoubleToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register result = locs()->out(0).reg(); const Register value_obj = locs()->in(0).reg(); @@ -5001,7 +4795,6 @@ void DoubleToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&done); } - LocationSummary* DoubleToSmiInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5013,7 +4806,6 @@ LocationSummary* DoubleToSmiInstr::MakeLocationSummary(Zone* zone, return result; } - void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptDoubleToSmi); const Register result = locs()->out(0).reg(); @@ -5031,19 +4823,16 @@ void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ SmiTag(result); } - LocationSummary* DoubleToDoubleInstr::MakeLocationSummary(Zone* zone, bool opt) const { UNIMPLEMENTED(); return NULL; } - void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } - LocationSummary* DoubleToFloatInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5055,14 +4844,12 @@ LocationSummary* DoubleToFloatInstr::MakeLocationSummary(Zone* zone, return result; } - void DoubleToFloatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister value = locs()->in(0).fpu_reg(); const VRegister result = locs()->out(0).fpu_reg(); __ fcvtsd(result, value); } - LocationSummary* FloatToDoubleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5074,14 +4861,12 @@ LocationSummary* FloatToDoubleInstr::MakeLocationSummary(Zone* zone, return result; } - void FloatToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const VRegister value = locs()->in(0).fpu_reg(); const VRegister result = locs()->out(0).fpu_reg(); __ fcvtds(result, value); } - LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(Zone* zone, bool opt) const { ASSERT((InputCount() == 1) || (InputCount() == 2)); @@ -5100,7 +4885,6 @@ LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(Zone* zone, return result; } - // Pseudo code: // if (exponent == 0.0) return 1.0; // // Speed up simple cases. @@ -5213,7 +4997,6 @@ static void InvokeDoublePow(FlowGraphCompiler* compiler, __ Bind(&skip_call); } - void InvokeMathCFunctionInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (recognized_kind() == MethodRecognizer::kMathDoublePow) { InvokeDoublePow(compiler, this); @@ -5222,7 +5005,6 @@ void InvokeMathCFunctionInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ CallRuntime(TargetFunction(), InputCount()); } - LocationSummary* ExtractNthOutputInstr::MakeLocationSummary(Zone* zone, bool opt) const { // Only use this instruction in optimized code. @@ -5255,7 +5037,6 @@ LocationSummary* ExtractNthOutputInstr::MakeLocationSummary(Zone* zone, return summary; } - void ExtractNthOutputInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->in(0).IsPairLocation()); PairLocation* pair = locs()->in(0).AsPairLocation(); @@ -5272,7 +5053,6 @@ void ExtractNthOutputInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* TruncDivModInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -5287,7 +5067,6 @@ LocationSummary* TruncDivModInstr::MakeLocationSummary(Zone* zone, return summary; } - void TruncDivModInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(CanDeoptimize()); Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinarySmiOp); @@ -5336,14 +5115,12 @@ void TruncDivModInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&done); } - LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary( Zone* zone, bool opt) const { return MakeCallSummary(zone); } - LocationSummary* BranchInstr::MakeLocationSummary(Zone* zone, bool opt) const { comparison()->InitializeLocationSummary(zone, opt); // Branches don't produce a result. @@ -5351,12 +5128,10 @@ LocationSummary* BranchInstr::MakeLocationSummary(Zone* zone, bool opt) const { return comparison()->locs(); } - void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) { comparison()->EmitBranchCode(compiler, this); } - LocationSummary* CheckClassInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5374,7 +5149,6 @@ LocationSummary* CheckClassInstr::MakeLocationSummary(Zone* zone, return summary; } - void CheckClassInstr::EmitNullCheck(FlowGraphCompiler* compiler, Label* deopt) { __ CompareObject(locs()->in(0).reg(), Object::null_object()); ASSERT(IsDeoptIfNull() || IsDeoptIfNotNull()); @@ -5382,7 +5156,6 @@ void CheckClassInstr::EmitNullCheck(FlowGraphCompiler* compiler, Label* deopt) { __ b(deopt, cond); } - void CheckClassInstr::EmitBitTest(FlowGraphCompiler* compiler, intptr_t min, intptr_t max, @@ -5400,7 +5173,6 @@ void CheckClassInstr::EmitBitTest(FlowGraphCompiler* compiler, __ b(deopt, EQ); } - int CheckClassInstr::EmitCheckCid(FlowGraphCompiler* compiler, int bias, intptr_t cid_start, @@ -5432,7 +5204,6 @@ int CheckClassInstr::EmitCheckCid(FlowGraphCompiler* compiler, return bias; } - LocationSummary* CheckClassIdInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5444,7 +5215,6 @@ LocationSummary* CheckClassIdInstr::MakeLocationSummary(Zone* zone, return summary; } - void CheckClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register value = locs()->in(0).reg(); Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckClass); @@ -5458,7 +5228,6 @@ void CheckClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* CheckSmiInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5469,7 +5238,6 @@ LocationSummary* CheckSmiInstr::MakeLocationSummary(Zone* zone, return summary; } - void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register value = locs()->in(0).reg(); Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckSmi, @@ -5477,7 +5245,6 @@ void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ BranchIfNotSmi(value, deopt); } - LocationSummary* GenericCheckBoundInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -5489,7 +5256,6 @@ LocationSummary* GenericCheckBoundInstr::MakeLocationSummary(Zone* zone, return locs; } - class RangeErrorSlowPath : public SlowPathCode { public: RangeErrorSlowPath(GenericCheckBoundInstr* instruction, intptr_t try_index) @@ -5519,7 +5285,6 @@ class RangeErrorSlowPath : public SlowPathCode { intptr_t try_index_; }; - void GenericCheckBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { RangeErrorSlowPath* slow_path = new RangeErrorSlowPath(this, compiler->CurrentTryIndex()); @@ -5537,7 +5302,6 @@ void GenericCheckBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ b(slow_path->entry_label(), CS); } - LocationSummary* CheckArrayBoundInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -5549,7 +5313,6 @@ LocationSummary* CheckArrayBoundInstr::MakeLocationSummary(Zone* zone, return locs; } - void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { uint32_t flags = generalized_ ? ICData::kGeneralized : 0; flags |= licm_hoisted_ ? ICData::kHoisted : 0; @@ -5606,64 +5369,53 @@ void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* BinaryMintOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { UNIMPLEMENTED(); return NULL; } - void BinaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } - LocationSummary* ShiftMintOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { UNIMPLEMENTED(); return NULL; } - void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } - LocationSummary* UnaryMintOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { UNIMPLEMENTED(); return NULL; } - void UnaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } - CompileType BinaryUint32OpInstr::ComputeType() const { return CompileType::FromCid(kSmiCid); } - CompileType ShiftUint32OpInstr::ComputeType() const { return CompileType::FromCid(kSmiCid); } - CompileType UnaryUint32OpInstr::ComputeType() const { return CompileType::FromCid(kSmiCid); } - DEFINE_UNIMPLEMENTED_INSTRUCTION(BinaryUint32OpInstr) DEFINE_UNIMPLEMENTED_INSTRUCTION(ShiftUint32OpInstr) DEFINE_UNIMPLEMENTED_INSTRUCTION(UnaryUint32OpInstr) DEFINE_UNIMPLEMENTED_INSTRUCTION(BinaryInt32OpInstr) - LocationSummary* UnboxedIntConverterInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5683,7 +5435,6 @@ LocationSummary* UnboxedIntConverterInstr::MakeLocationSummary(Zone* zone, return summary; } - void UnboxedIntConverterInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (from() == kUnboxedInt32 && to() == kUnboxedUint32) { const Register value = locs()->in(0).reg(); @@ -5720,24 +5471,20 @@ void UnboxedIntConverterInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* ThrowInstr::MakeLocationSummary(Zone* zone, bool opt) const { return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kCall); } - void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { compiler->GenerateRuntimeCall(token_pos(), deopt_id(), kThrowRuntimeEntry, 1, locs()); __ brk(0); } - LocationSummary* ReThrowInstr::MakeLocationSummary(Zone* zone, bool opt) const { return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kCall); } - void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { compiler->SetNeedsStackTrace(catch_try_index()); compiler->GenerateRuntimeCall(token_pos(), deopt_id(), kReThrowRuntimeEntry, @@ -5745,29 +5492,24 @@ void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ brk(0); } - LocationSummary* StopInstr::MakeLocationSummary(Zone* zone, bool opt) const { return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kNoCall); } - void StopInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Stop(message()); } - void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (!compiler->CanFallThroughTo(normal_entry())) { __ b(compiler->GetJumpLabel(normal_entry())); } } - LocationSummary* GotoInstr::MakeLocationSummary(Zone* zone, bool opt) const { return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kNoCall); } - void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (!compiler->is_optimizing()) { if (FLAG_reorder_basic_blocks) { @@ -5789,7 +5531,6 @@ void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* IndirectGotoInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5804,7 +5545,6 @@ LocationSummary* IndirectGotoInstr::MakeLocationSummary(Zone* zone, return summary; } - void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register target_address_reg = locs()->temp_slot(0)->reg(); @@ -5828,7 +5568,6 @@ void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ br(target_address_reg); } - LocationSummary* StrictCompareInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -5853,7 +5592,6 @@ LocationSummary* StrictCompareInstr::MakeLocationSummary(Zone* zone, return locs; } - Condition StrictCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { Location left = locs()->in(0); @@ -5879,7 +5617,6 @@ Condition StrictCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, return true_condition; } - void ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Label is_true, is_false; BranchLabels labels = {&is_true, &is_false, &is_false}; @@ -5899,7 +5636,6 @@ void ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&done); } - void ComparisonInstr::EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch) { BranchLabels labels = compiler->CreateBranchLabels(branch); @@ -5909,14 +5645,12 @@ void ComparisonInstr::EmitBranchCode(FlowGraphCompiler* compiler, } } - LocationSummary* BooleanNegateInstr::MakeLocationSummary(Zone* zone, bool opt) const { return LocationSummary::Make(zone, 1, Location::RequiresRegister(), LocationSummary::kNoCall); } - void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register value = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); @@ -5927,13 +5661,11 @@ void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ csel(result, TMP, result, EQ); } - LocationSummary* AllocateObjectInstr::MakeLocationSummary(Zone* zone, bool opt) const { return MakeCallSummary(zone); } - void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Code& stub = Code::ZoneHandle( compiler->zone(), StubCode::GetAllocationStubForClass(cls())); @@ -5944,7 +5676,6 @@ void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Drop(ArgumentCount()); // Discard arguments. } - void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(!compiler->is_optimizing()); __ BranchLinkPatchable(*StubCode::DebugStepCheck_entry()); @@ -5952,7 +5683,6 @@ void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) { compiler->RecordSafepoint(locs()); } - } // namespace dart #endif // defined TARGET_ARCH_ARM64 diff --git a/runtime/vm/intermediate_language_dbc.cc b/runtime/vm/intermediate_language_dbc.cc index 06c483dec10..b3f5d4a42f0 100644 --- a/runtime/vm/intermediate_language_dbc.cc +++ b/runtime/vm/intermediate_language_dbc.cc @@ -7,8 +7,8 @@ #include "vm/intermediate_language.h" -#include "vm/cpu.h" #include "vm/compiler.h" +#include "vm/cpu.h" #include "vm/dart_entry.h" #include "vm/flow_graph.h" #include "vm/flow_graph_compiler.h" @@ -118,7 +118,6 @@ static LocationSummary* CreateLocationSummary( return locs; } - #define DEFINE_MAKE_LOCATION_SUMMARY(Name, ...) \ LocationSummary* Name##Instr::MakeLocationSummary(Zone* zone, bool opt) \ const { \ @@ -179,11 +178,9 @@ FOR_EACH_UNREACHABLE_INSTRUCTION(DEFINE_UNREACHABLE) #undef DEFINE_UNREACHABLE - // Only used in AOT compilation. DEFINE_UNIMPLEMENTED_EMIT_BRANCH_CODE(CheckedSmiComparison) - EMIT_NATIVE_CODE(InstanceOf, 3, Location::SameAsFirstInput(), @@ -210,13 +207,11 @@ EMIT_NATIVE_CODE(InstanceOf, } } - DEFINE_MAKE_LOCATION_SUMMARY(AssertAssignable, 3, Location::SameAsFirstInput(), LocationSummary::kCall); - EMIT_NATIVE_CODE(AssertBoolean, 1, Location::SameAsFirstInput(), @@ -233,7 +228,6 @@ EMIT_NATIVE_CODE(AssertBoolean, } } - EMIT_NATIVE_CODE(PolymorphicInstanceCall, 0, Location::RegisterLocation(0), @@ -282,12 +276,10 @@ EMIT_NATIVE_CODE(PolymorphicInstanceCall, __ PopLocal(locs()->out(0).reg()); } - EMIT_NATIVE_CODE(Stop, 0) { __ Stop(message()); } - EMIT_NATIVE_CODE(CheckStackOverflow, 0, Location::NoLocation(), @@ -302,21 +294,18 @@ EMIT_NATIVE_CODE(CheckStackOverflow, compiler->RecordAfterCall(this, FlowGraphCompiler::kNoResult); } - EMIT_NATIVE_CODE(PushArgument, 1) { if (compiler->is_optimizing()) { __ Push(locs()->in(0).reg()); } } - EMIT_NATIVE_CODE(LoadLocal, 0) { ASSERT(!compiler->is_optimizing()); ASSERT(local().index() != 0); __ Push((local().index() > 0) ? (-local().index()) : (-local().index() - 1)); } - EMIT_NATIVE_CODE(StoreLocal, 0) { ASSERT(!compiler->is_optimizing()); ASSERT(local().index() != 0); @@ -329,7 +318,6 @@ EMIT_NATIVE_CODE(StoreLocal, 0) { } } - EMIT_NATIVE_CODE(LoadClassId, 1, Location::RequiresRegister()) { if (compiler->is_optimizing()) { __ LoadClassId(locs()->out(0).reg(), locs()->in(0).reg()); @@ -338,7 +326,6 @@ EMIT_NATIVE_CODE(LoadClassId, 1, Location::RequiresRegister()) { } } - EMIT_NATIVE_CODE(Constant, 0, Location::RequiresRegister()) { if (compiler->is_optimizing()) { if (locs()->out(0).IsRegister()) { @@ -349,7 +336,6 @@ EMIT_NATIVE_CODE(Constant, 0, Location::RequiresRegister()) { } } - EMIT_NATIVE_CODE(UnboxedConstant, 0, Location::RequiresRegister()) { // The register allocator drops constant definitions that have no uses. if (locs()->out(0).IsInvalid()) { @@ -368,7 +354,6 @@ EMIT_NATIVE_CODE(UnboxedConstant, 0, Location::RequiresRegister()) { } } - EMIT_NATIVE_CODE(Return, 1) { if (compiler->is_optimizing()) { __ Return(locs()->in(0).reg()); @@ -377,7 +362,6 @@ EMIT_NATIVE_CODE(Return, 1) { } } - LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -393,7 +377,6 @@ LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(Zone* zone, return locs; } - void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (compiler->is_optimizing()) { __ LoadConstant(locs()->temp(0).reg(), @@ -407,7 +390,6 @@ void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - EMIT_NATIVE_CODE(LoadStaticField, 1, Location::RequiresRegister()) { if (compiler->is_optimizing()) { __ LoadField(locs()->out(0).reg(), locs()->in(0).reg(), @@ -418,7 +400,6 @@ EMIT_NATIVE_CODE(LoadStaticField, 1, Location::RequiresRegister()) { } } - EMIT_NATIVE_CODE(InitStaticField, 1, Location::NoLocation(), @@ -432,7 +413,6 @@ EMIT_NATIVE_CODE(InitStaticField, compiler->RecordAfterCall(this, FlowGraphCompiler::kNoResult); } - EMIT_NATIVE_CODE(ClosureCall, 1, Location::RegisterLocation(0), @@ -452,7 +432,6 @@ EMIT_NATIVE_CODE(ClosureCall, } } - static void EmitBranchOnCondition(FlowGraphCompiler* compiler, Condition true_condition, BranchLabels labels) { @@ -481,7 +460,6 @@ static void EmitBranchOnCondition(FlowGraphCompiler* compiler, } } - Condition StrictCompareInstr::GetNextInstructionCondition( FlowGraphCompiler* compiler, BranchLabels labels) { @@ -489,7 +467,6 @@ Condition StrictCompareInstr::GetNextInstructionCondition( : NEXT_IS_FALSE; } - Condition StrictCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { ASSERT((kind() == Token::kNE_STRICT) || (kind() == Token::kEQ_STRICT)); @@ -532,14 +509,12 @@ Condition StrictCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, return condition; } - DEFINE_MAKE_LOCATION_SUMMARY(StrictCompare, 2, Location::RequiresRegister(), needs_number_check() ? LocationSummary::kCall : LocationSummary::kNoCall) - void ComparisonInstr::EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch) { BranchLabels labels = compiler->CreateBranchLabels(branch); @@ -549,7 +524,6 @@ void ComparisonInstr::EmitBranchCode(FlowGraphCompiler* compiler, } } - void ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Label is_true, is_false; BranchLabels labels = {&is_true, &is_false, &is_false}; @@ -598,7 +572,6 @@ void ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* BranchInstr::MakeLocationSummary(Zone* zone, bool opt) const { comparison()->InitializeLocationSummary(zone, opt); if (!comparison()->HasLocs()) { @@ -609,12 +582,10 @@ LocationSummary* BranchInstr::MakeLocationSummary(Zone* zone, bool opt) const { return comparison()->locs(); } - void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) { comparison()->EmitBranchCode(compiler, this); } - EMIT_NATIVE_CODE(Goto, 0) { if (!compiler->is_optimizing()) { // Add a deoptimization descriptor for deoptimizing instructions that @@ -632,14 +603,12 @@ EMIT_NATIVE_CODE(Goto, 0) { } } - Condition TestSmiInstr::GetNextInstructionCondition(FlowGraphCompiler* compiler, BranchLabels labels) { ASSERT((kind() == Token::kEQ) || (kind() == Token::kNE)); return (kind() == Token::kEQ) ? NEXT_IS_TRUE : NEXT_IS_FALSE; } - Condition TestSmiInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { ASSERT((kind() == Token::kEQ) || (kind() == Token::kNE)); @@ -649,13 +618,11 @@ Condition TestSmiInstr::EmitComparisonCode(FlowGraphCompiler* compiler, return (kind() == Token::kEQ) ? NEXT_IS_TRUE : NEXT_IS_FALSE; } - DEFINE_MAKE_LOCATION_SUMMARY(TestSmi, 2, Location::RequiresRegister(), LocationSummary::kNoCall) - Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { ASSERT((kind() == Token::kIS) || (kind() == Token::kISNOT)); @@ -689,20 +656,17 @@ Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler, return NEXT_IS_TRUE; } - Condition TestCidsInstr::GetNextInstructionCondition( FlowGraphCompiler* compiler, BranchLabels labels) { return NEXT_IS_TRUE; } - DEFINE_MAKE_LOCATION_SUMMARY(TestCids, 1, Location::RequiresRegister(), LocationSummary::kNoCall) - EMIT_NATIVE_CODE(CreateArray, 2, Location::RequiresRegister(), @@ -723,7 +687,6 @@ EMIT_NATIVE_CODE(CreateArray, } } - EMIT_NATIVE_CODE(StoreIndexed, 3, Location::NoLocation(), @@ -806,7 +769,6 @@ EMIT_NATIVE_CODE(StoreIndexed, } } - EMIT_NATIVE_CODE(LoadIndexed, 2, Location::RequiresRegister(), @@ -919,7 +881,6 @@ EMIT_NATIVE_CODE(LoadIndexed, } } - EMIT_NATIVE_CODE(StringInterpolate, 1, Location::RegisterLocation(0), @@ -947,7 +908,6 @@ EMIT_NATIVE_CODE(StringInterpolate, } } - EMIT_NATIVE_CODE(NativeCall, 0, Location::NoLocation(), @@ -976,7 +936,6 @@ EMIT_NATIVE_CODE(NativeCall, token_pos()); } - EMIT_NATIVE_CODE(OneByteStringFromCharCode, 1, Location::RequiresRegister(), @@ -987,7 +946,6 @@ EMIT_NATIVE_CODE(OneByteStringFromCharCode, __ OneByteStringFromCharCode(result, char_code); } - EMIT_NATIVE_CODE(StringToCharCode, 1, Location::RequiresRegister(), @@ -998,7 +956,6 @@ EMIT_NATIVE_CODE(StringToCharCode, __ StringToCharCode(result, str); } - EMIT_NATIVE_CODE(AllocateObject, 0, Location::RequiresRegister(), @@ -1066,7 +1023,6 @@ EMIT_NATIVE_CODE(AllocateObject, } } - EMIT_NATIVE_CODE(StoreInstanceField, 2) { ASSERT(!HasTemp()); ASSERT(offset_in_bytes() % kWordSize == 0); @@ -1084,7 +1040,6 @@ EMIT_NATIVE_CODE(StoreInstanceField, 2) { } } - EMIT_NATIVE_CODE(LoadField, 1, Location::RequiresRegister()) { ASSERT(offset_in_bytes() % kWordSize == 0); if (compiler->is_optimizing()) { @@ -1101,7 +1056,6 @@ EMIT_NATIVE_CODE(LoadField, 1, Location::RequiresRegister()) { } } - EMIT_NATIVE_CODE(LoadUntagged, 1, Location::RequiresRegister()) { const Register obj = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); @@ -1113,7 +1067,6 @@ EMIT_NATIVE_CODE(LoadUntagged, 1, Location::RequiresRegister()) { } } - EMIT_NATIVE_CODE(BooleanNegate, 1, Location::RequiresRegister()) { if (compiler->is_optimizing()) { __ BooleanNegate(locs()->out(0).reg(), locs()->in(0).reg()); @@ -1122,7 +1075,6 @@ EMIT_NATIVE_CODE(BooleanNegate, 1, Location::RequiresRegister()) { } } - EMIT_NATIVE_CODE(AllocateContext, 0, Location::RequiresRegister(), @@ -1134,7 +1086,6 @@ EMIT_NATIVE_CODE(AllocateContext, token_pos()); } - EMIT_NATIVE_CODE(AllocateUninitializedContext, 0, Location::RequiresRegister(), @@ -1149,7 +1100,6 @@ EMIT_NATIVE_CODE(AllocateUninitializedContext, __ PopLocal(locs()->out(0).reg()); } - EMIT_NATIVE_CODE(CloneContext, 1, Location::RequiresRegister(), @@ -1166,7 +1116,6 @@ EMIT_NATIVE_CODE(CloneContext, } } - EMIT_NATIVE_CODE(CatchBlockEntry, 0) { __ Bind(compiler->GetJumpLabel(this)); compiler->AddExceptionHandler(catch_try_index(), try_index(), @@ -1250,7 +1199,6 @@ EMIT_NATIVE_CODE(CatchBlockEntry, 0) { __ SetFrame(compiler->StackSize()); } - EMIT_NATIVE_CODE(Throw, 0, Location::NoLocation(), LocationSummary::kCall) { __ Throw(0); compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id(), @@ -1259,7 +1207,6 @@ EMIT_NATIVE_CODE(Throw, 0, Location::NoLocation(), LocationSummary::kCall) { __ Trap(); } - EMIT_NATIVE_CODE(ReThrow, 0, Location::NoLocation(), LocationSummary::kCall) { compiler->SetNeedsStackTrace(catch_try_index()); __ Throw(1); @@ -1305,20 +1252,17 @@ EMIT_NATIVE_CODE(InstantiateTypeArguments, } } - void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ DebugStep(); compiler->AddCurrentDescriptor(stub_kind_, deopt_id_, token_pos()); } - void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (!compiler->CanFallThroughTo(normal_entry())) { __ Jump(compiler->GetJumpLabel(normal_entry())); } } - LocationSummary* Instruction::MakeCallSummary(Zone* zone) { LocationSummary* result = new (zone) LocationSummary(zone, 0, 0, LocationSummary::kCall); @@ -1328,22 +1272,18 @@ LocationSummary* Instruction::MakeCallSummary(Zone* zone) { return result; } - CompileType BinaryUint32OpInstr::ComputeType() const { return CompileType::Int(); } - CompileType ShiftUint32OpInstr::ComputeType() const { return CompileType::Int(); } - CompileType UnaryUint32OpInstr::ComputeType() const { return CompileType::Int(); } - CompileType LoadIndexedInstr::ComputeType() const { switch (class_id_) { case kArrayCid: @@ -1383,7 +1323,6 @@ CompileType LoadIndexedInstr::ComputeType() const { } } - Representation LoadIndexedInstr::representation() const { switch (class_id_) { case kArrayCid: @@ -1419,7 +1358,6 @@ Representation LoadIndexedInstr::representation() const { } } - Representation StoreIndexedInstr::RequiredInputRepresentation( intptr_t idx) const { // Array can be a Dart object or a pointer to external data. @@ -1463,7 +1401,6 @@ Representation StoreIndexedInstr::RequiredInputRepresentation( } } - void Environment::DropArguments(intptr_t argc) { #if defined(DEBUG) // Check that we are in the backend - register allocation has been run. @@ -1476,14 +1413,12 @@ void Environment::DropArguments(intptr_t argc) { values_.TruncateTo(values_.length() - argc); } - EMIT_NATIVE_CODE(CheckSmi, 1) { __ CheckSmi(locs()->in(0).reg()); compiler->EmitDeopt(deopt_id(), ICData::kDeoptCheckSmi, licm_hoisted_ ? ICData::kHoisted : 0); } - EMIT_NATIVE_CODE(CheckEitherNonSmi, 2) { const Register left = locs()->in(0).reg(); const Register right = locs()->in(1).reg(); @@ -1492,7 +1427,6 @@ EMIT_NATIVE_CODE(CheckEitherNonSmi, 2) { licm_hoisted_ ? ICData::kHoisted : 0); } - EMIT_NATIVE_CODE(CheckClassId, 1) { if (cids_.IsSingleCid()) { __ CheckClassId(locs()->in(0).reg(), @@ -1505,7 +1439,6 @@ EMIT_NATIVE_CODE(CheckClassId, 1) { compiler->EmitDeopt(deopt_id(), ICData::kDeoptCheckClass); } - EMIT_NATIVE_CODE(CheckClass, 1) { const Register value = locs()->in(0).reg(); if (IsNullCheck()) { @@ -1570,7 +1503,6 @@ EMIT_NATIVE_CODE(CheckClass, 1) { licm_hoisted_ ? ICData::kHoisted : 0); } - EMIT_NATIVE_CODE(BinarySmiOp, 2, Location::RequiresRegister()) { const Register left = locs()->in(0).reg(); const Register right = locs()->in(1).reg(); @@ -1628,7 +1560,6 @@ EMIT_NATIVE_CODE(BinarySmiOp, 2, Location::RequiresRegister()) { } } - EMIT_NATIVE_CODE(UnarySmiOp, 1, Location::RequiresRegister()) { switch (op_kind()) { case Token::kNEGATE: { @@ -1645,7 +1576,6 @@ EMIT_NATIVE_CODE(UnarySmiOp, 1, Location::RequiresRegister()) { } } - EMIT_NATIVE_CODE(Box, 1, Location::RequiresRegister(), LocationSummary::kCall) { ASSERT(from_representation() == kUnboxedDouble); const Register value = locs()->in(0).reg(); @@ -1672,7 +1602,6 @@ EMIT_NATIVE_CODE(Box, 1, Location::RequiresRegister(), LocationSummary::kCall) { __ WriteIntoDouble(out, value); } - EMIT_NATIVE_CODE(Unbox, 1, Location::RequiresRegister()) { ASSERT(representation() == kUnboxedDouble); const intptr_t value_cid = value()->Type()->ToCid(); @@ -1694,7 +1623,6 @@ EMIT_NATIVE_CODE(Unbox, 1, Location::RequiresRegister()) { } } - EMIT_NATIVE_CODE(UnboxInteger32, 1, Location::RequiresRegister()) { #if defined(ARCH_IS_64_BIT) const Register out = locs()->out(0).reg(); @@ -1712,7 +1640,6 @@ EMIT_NATIVE_CODE(UnboxInteger32, 1, Location::RequiresRegister()) { #endif // defined(ARCH_IS_64_BIT) } - EMIT_NATIVE_CODE(BoxInteger32, 1, Location::RequiresRegister()) { #if defined(ARCH_IS_64_BIT) const Register out = locs()->out(0).reg(); @@ -1729,7 +1656,6 @@ EMIT_NATIVE_CODE(BoxInteger32, 1, Location::RequiresRegister()) { #endif // defined(ARCH_IS_64_BIT) } - EMIT_NATIVE_CODE(DoubleToSmi, 1, Location::RequiresRegister()) { const Register value = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); @@ -1737,14 +1663,12 @@ EMIT_NATIVE_CODE(DoubleToSmi, 1, Location::RequiresRegister()) { compiler->EmitDeopt(deopt_id(), ICData::kDeoptDoubleToSmi); } - EMIT_NATIVE_CODE(SmiToDouble, 1, Location::RequiresRegister()) { const Register value = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); __ SmiToDouble(result, value); } - EMIT_NATIVE_CODE(BinaryDoubleOp, 2, Location::RequiresRegister()) { const Register left = locs()->in(0).reg(); const Register right = locs()->in(1).reg(); @@ -1767,7 +1691,6 @@ EMIT_NATIVE_CODE(BinaryDoubleOp, 2, Location::RequiresRegister()) { } } - Condition DoubleTestOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { ASSERT(compiler->is_optimizing()); @@ -1786,7 +1709,6 @@ Condition DoubleTestOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler, return is_negated ? NEXT_IS_FALSE : NEXT_IS_TRUE; } - Condition DoubleTestOpInstr::GetNextInstructionCondition( FlowGraphCompiler* compiler, BranchLabels labels) { @@ -1794,17 +1716,14 @@ Condition DoubleTestOpInstr::GetNextInstructionCondition( return is_negated ? NEXT_IS_FALSE : NEXT_IS_TRUE; } - DEFINE_MAKE_LOCATION_SUMMARY(DoubleTestOp, 1, Location::RequiresRegister()) - EMIT_NATIVE_CODE(UnaryDoubleOp, 1, Location::RequiresRegister()) { const Register value = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); __ DNeg(result, value); } - EMIT_NATIVE_CODE(MathUnary, 1, Location::RequiresRegister()) { const Register value = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); @@ -1818,7 +1737,6 @@ EMIT_NATIVE_CODE(MathUnary, 1, Location::RequiresRegister()) { } } - EMIT_NATIVE_CODE(DoubleToDouble, 1, Location::RequiresRegister()) { const Register in = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); @@ -1837,21 +1755,18 @@ EMIT_NATIVE_CODE(DoubleToDouble, 1, Location::RequiresRegister()) { } } - EMIT_NATIVE_CODE(DoubleToFloat, 1, Location::RequiresRegister()) { const Register in = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); __ DoubleToFloat(result, in); } - EMIT_NATIVE_CODE(FloatToDouble, 1, Location::RequiresRegister()) { const Register in = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); __ FloatToDouble(result, in); } - EMIT_NATIVE_CODE(InvokeMathCFunction, InputCount(), Location::RequiresRegister()) { @@ -1873,7 +1788,6 @@ EMIT_NATIVE_CODE(InvokeMathCFunction, } } - EMIT_NATIVE_CODE(MathMinMax, 2, Location::RequiresRegister()) { ASSERT((op_kind() == MethodRecognizer::kMathMin) || (op_kind() == MethodRecognizer::kMathMax)); @@ -1896,7 +1810,6 @@ EMIT_NATIVE_CODE(MathMinMax, 2, Location::RequiresRegister()) { } } - static Token::Kind FlipCondition(Token::Kind kind) { switch (kind) { case Token::kEQ: @@ -1917,7 +1830,6 @@ static Token::Kind FlipCondition(Token::Kind kind) { } } - static Bytecode::Opcode OpcodeForSmiCondition(Token::Kind kind) { switch (kind) { case Token::kEQ: @@ -1938,7 +1850,6 @@ static Bytecode::Opcode OpcodeForSmiCondition(Token::Kind kind) { } } - static Bytecode::Opcode OpcodeForDoubleCondition(Token::Kind kind) { switch (kind) { case Token::kEQ: @@ -1959,7 +1870,6 @@ static Bytecode::Opcode OpcodeForDoubleCondition(Token::Kind kind) { } } - static Condition EmitSmiComparisonOp(FlowGraphCompiler* compiler, LocationSummary* locs, Token::Kind kind, @@ -1981,7 +1891,6 @@ static Condition EmitSmiComparisonOp(FlowGraphCompiler* compiler, return condition; } - static Condition EmitDoubleComparisonOp(FlowGraphCompiler* compiler, LocationSummary* locs, Token::Kind kind) { @@ -1998,7 +1907,6 @@ static Condition EmitDoubleComparisonOp(FlowGraphCompiler* compiler, return condition; } - Condition EqualityCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { if (operation_cid() == kSmiCid) { @@ -2009,7 +1917,6 @@ Condition EqualityCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, } } - Condition EqualityCompareInstr::GetNextInstructionCondition( FlowGraphCompiler* compiler, BranchLabels labels) { @@ -2022,10 +1929,8 @@ Condition EqualityCompareInstr::GetNextInstructionCondition( } } - DEFINE_MAKE_LOCATION_SUMMARY(EqualityCompare, 2, Location::RequiresRegister()); - Condition RelationalOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { if (operation_cid() == kSmiCid) { @@ -2036,7 +1941,6 @@ Condition RelationalOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler, } } - Condition RelationalOpInstr::GetNextInstructionCondition( FlowGraphCompiler* compiler, BranchLabels labels) { @@ -2049,10 +1953,8 @@ Condition RelationalOpInstr::GetNextInstructionCondition( } } - DEFINE_MAKE_LOCATION_SUMMARY(RelationalOp, 2, Location::RequiresRegister()) - EMIT_NATIVE_CODE(CheckArrayBound, 2) { const Register length = locs()->in(kLengthPos).reg(); const Register index = locs()->in(kIndexPos).reg(); diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc index f67900c7885..f5d16a8d893 100644 --- a/runtime/vm/intermediate_language_ia32.cc +++ b/runtime/vm/intermediate_language_ia32.cc @@ -36,7 +36,6 @@ LocationSummary* Instruction::MakeCallSummary(Zone* zone) { return result; } - LocationSummary* PushArgumentInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -47,7 +46,6 @@ LocationSummary* PushArgumentInstr::MakeLocationSummary(Zone* zone, return locs; } - void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // In SSA mode, we need an explicit push. Nothing to do in non-SSA mode // where PushArgument is handled by BindInstr::EmitNativeCode. @@ -64,7 +62,6 @@ void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* ReturnInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; const intptr_t kNumTemps = 0; @@ -74,7 +71,6 @@ LocationSummary* ReturnInstr::MakeLocationSummary(Zone* zone, bool opt) const { return locs; } - // Attempt optimized compilation at return instruction instead of at the entry. // The entry needs to be patchable, no inlined objects are allowed in the area // that will be overwritten by the patch instruction: a jump). @@ -105,7 +101,6 @@ void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ ret(); } - LocationSummary* LoadLocalInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -117,13 +112,11 @@ LocationSummary* LoadLocalInstr::MakeLocationSummary(Zone* zone, LocationSummary::kNoCall); } - void LoadLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(!compiler->is_optimizing()); // Nothing to do. } - LocationSummary* StoreLocalInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -131,7 +124,6 @@ LocationSummary* StoreLocalInstr::MakeLocationSummary(Zone* zone, LocationSummary::kNoCall); } - void StoreLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register value = locs()->in(0).reg(); Register result = locs()->out(0).reg(); @@ -139,7 +131,6 @@ void StoreLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ movl(Address(EBP, local().index() * kWordSize), value); } - LocationSummary* ConstantInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -150,7 +141,6 @@ LocationSummary* ConstantInstr::MakeLocationSummary(Zone* zone, LocationSummary::kNoCall); } - void ConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // The register allocator drops constant definitions that have no uses. Location out = locs()->out(0); @@ -161,7 +151,6 @@ void ConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* UnboxedConstantInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -181,7 +170,6 @@ LocationSummary* UnboxedConstantInstr::MakeLocationSummary(Zone* zone, return locs; } - void UnboxedConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // The register allocator drops constant definitions that have no uses. if (!locs()->out(0).IsInvalid()) { @@ -208,7 +196,6 @@ void UnboxedConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* AssertAssignableInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 3; @@ -222,7 +209,6 @@ LocationSummary* AssertAssignableInstr::MakeLocationSummary(Zone* zone, return summary; } - LocationSummary* AssertBooleanInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -234,7 +220,6 @@ LocationSummary* AssertBooleanInstr::MakeLocationSummary(Zone* zone, return locs; } - static void EmitAssertBoolean(Register reg, TokenPosition token_pos, intptr_t deopt_id, @@ -264,7 +249,6 @@ static void EmitAssertBoolean(Register reg, __ Bind(&done); } - void AssertBooleanInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register obj = locs()->in(0).reg(); Register result = locs()->out(0).reg(); @@ -273,7 +257,6 @@ void AssertBooleanInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(obj == result); } - static Condition TokenKindToSmiCondition(Token::Kind kind) { switch (kind) { case Token::kEQ: @@ -294,7 +277,6 @@ static Condition TokenKindToSmiCondition(Token::Kind kind) { } } - LocationSummary* EqualityCompareInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -336,7 +318,6 @@ LocationSummary* EqualityCompareInstr::MakeLocationSummary(Zone* zone, return NULL; } - static void LoadValueCid(FlowGraphCompiler* compiler, Register value_cid_reg, Register value_reg, @@ -355,7 +336,6 @@ static void LoadValueCid(FlowGraphCompiler* compiler, __ Bind(&done); } - static Condition FlipCondition(Condition condition) { switch (condition) { case EQUAL: @@ -384,7 +364,6 @@ static Condition FlipCondition(Condition condition) { } } - static Condition NegateCondition(Condition condition) { switch (condition) { case EQUAL: @@ -417,7 +396,6 @@ static Condition NegateCondition(Condition condition) { } } - static void EmitBranchOnCondition(FlowGraphCompiler* compiler, Condition true_condition, BranchLabels labels) { @@ -436,7 +414,6 @@ static void EmitBranchOnCondition(FlowGraphCompiler* compiler, } } - static Condition EmitSmiComparisonOp(FlowGraphCompiler* compiler, const LocationSummary& locs, Token::Kind kind, @@ -460,7 +437,6 @@ static Condition EmitSmiComparisonOp(FlowGraphCompiler* compiler, return true_condition; } - static Condition TokenKindToMintCondition(Token::Kind kind) { switch (kind) { case Token::kEQ: @@ -481,7 +457,6 @@ static Condition TokenKindToMintCondition(Token::Kind kind) { } } - static Condition EmitUnboxedMintEqualityOp(FlowGraphCompiler* compiler, const LocationSummary& locs, Token::Kind kind, @@ -504,7 +479,6 @@ static Condition EmitUnboxedMintEqualityOp(FlowGraphCompiler* compiler, return true_condition; } - static Condition EmitUnboxedMintComparisonOp(FlowGraphCompiler* compiler, const LocationSummary& locs, Token::Kind kind, @@ -548,7 +522,6 @@ static Condition EmitUnboxedMintComparisonOp(FlowGraphCompiler* compiler, return lo_cond; } - static Condition TokenKindToDoubleCondition(Token::Kind kind) { switch (kind) { case Token::kEQ: @@ -569,7 +542,6 @@ static Condition TokenKindToDoubleCondition(Token::Kind kind) { } } - static Condition EmitDoubleComparisonOp(FlowGraphCompiler* compiler, const LocationSummary& locs, Token::Kind kind, @@ -586,7 +558,6 @@ static Condition EmitDoubleComparisonOp(FlowGraphCompiler* compiler, return true_condition; } - Condition EqualityCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { if (operation_cid() == kSmiCid) { @@ -599,7 +570,6 @@ Condition EqualityCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, } } - void ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Label is_true, is_false; BranchLabels labels = {&is_true, &is_false, &is_false}; @@ -618,7 +588,6 @@ void ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&done); } - void ComparisonInstr::EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch) { BranchLabels labels = compiler->CreateBranchLabels(branch); @@ -628,7 +597,6 @@ void ComparisonInstr::EmitBranchCode(FlowGraphCompiler* compiler, } } - LocationSummary* TestSmiInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; const intptr_t kNumTemps = 0; @@ -641,7 +609,6 @@ LocationSummary* TestSmiInstr::MakeLocationSummary(Zone* zone, bool opt) const { return locs; } - Condition TestSmiInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { Register left = locs()->in(0).reg(); @@ -657,7 +624,6 @@ Condition TestSmiInstr::EmitComparisonCode(FlowGraphCompiler* compiler, return true_condition; } - LocationSummary* TestCidsInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -670,18 +636,16 @@ LocationSummary* TestCidsInstr::MakeLocationSummary(Zone* zone, return locs; } - Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { ASSERT((kind() == Token::kIS) || (kind() == Token::kISNOT)); Register val_reg = locs()->in(0).reg(); Register cid_reg = locs()->temp(0).reg(); - Label* deopt = - CanDeoptimize() - ? compiler->AddDeoptStub(deopt_id(), ICData::kDeoptTestCids, - licm_hoisted_ ? ICData::kHoisted : 0) - : NULL; + Label* deopt = CanDeoptimize() ? compiler->AddDeoptStub( + deopt_id(), ICData::kDeoptTestCids, + licm_hoisted_ ? ICData::kHoisted : 0) + : NULL; const intptr_t true_result = (kind() == Token::kIS) ? 1 : 0; const ZoneGrowableArray& data = cid_results(); @@ -714,7 +678,6 @@ Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler, return INVALID_CONDITION; } - LocationSummary* RelationalOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -751,7 +714,6 @@ LocationSummary* RelationalOpInstr::MakeLocationSummary(Zone* zone, return summary; } - Condition RelationalOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { if (operation_cid() == kSmiCid) { @@ -764,13 +726,11 @@ Condition RelationalOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler, } } - LocationSummary* NativeCallInstr::MakeLocationSummary(Zone* zone, bool opt) const { return MakeCallSummary(zone); } - void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { SetupNative(); Register result = locs()->out(0).reg(); @@ -807,7 +767,6 @@ void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ popl(result); } - static bool CanBeImmediateIndex(Value* value, intptr_t cid) { ConstantInstr* constant = value->definition()->AsConstant(); if ((constant == NULL) || !Assembler::IsSafeSmi(constant->value())) { @@ -820,7 +779,6 @@ static bool CanBeImmediateIndex(Value* value, intptr_t cid) { return Utils::IsInt(32, displacement); } - LocationSummary* OneByteStringFromCharCodeInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -830,7 +788,6 @@ LocationSummary* OneByteStringFromCharCodeInstr::MakeLocationSummary( LocationSummary::kNoCall); } - void OneByteStringFromCharCodeInstr::EmitNativeCode( FlowGraphCompiler* compiler) { Register char_code = locs()->in(0).reg(); @@ -842,7 +799,6 @@ void OneByteStringFromCharCodeInstr::EmitNativeCode( Symbols::kNullCharCodeSymbolOffset * kWordSize)); } - LocationSummary* StringToCharCodeInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -850,7 +806,6 @@ LocationSummary* StringToCharCodeInstr::MakeLocationSummary(Zone* zone, LocationSummary::kNoCall); } - void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(cid_ == kOneByteStringCid); Register str = locs()->in(0).reg(); @@ -867,7 +822,6 @@ void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&done); } - LocationSummary* StringInterpolateInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -879,7 +833,6 @@ LocationSummary* StringInterpolateInstr::MakeLocationSummary(Zone* zone, return summary; } - void StringInterpolateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register array = locs()->in(0).reg(); __ pushl(array); @@ -892,7 +845,6 @@ void StringInterpolateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->out(0).reg() == EAX); } - LocationSummary* LoadUntaggedInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -900,7 +852,6 @@ LocationSummary* LoadUntaggedInstr::MakeLocationSummary(Zone* zone, LocationSummary::kNoCall); } - void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register obj = locs()->in(0).reg(); Register result = locs()->out(0).reg(); @@ -912,7 +863,6 @@ void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* LoadClassIdInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -920,7 +870,6 @@ LocationSummary* LoadClassIdInstr::MakeLocationSummary(Zone* zone, LocationSummary::kNoCall); } - void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register object = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); @@ -945,7 +894,6 @@ void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - CompileType LoadIndexedInstr::ComputeType() const { switch (class_id_) { case kArrayCid: @@ -985,7 +933,6 @@ CompileType LoadIndexedInstr::ComputeType() const { } } - Representation LoadIndexedInstr::representation() const { switch (class_id_) { case kArrayCid: @@ -1021,7 +968,6 @@ Representation LoadIndexedInstr::representation() const { } } - LocationSummary* LoadIndexedInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -1056,7 +1002,6 @@ LocationSummary* LoadIndexedInstr::MakeLocationSummary(Zone* zone, return locs; } - void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // The array register points to the backing store for external arrays. const Register array = locs()->in(0).reg(); @@ -1156,7 +1101,6 @@ void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - Representation StoreIndexedInstr::RequiredInputRepresentation( intptr_t idx) const { // Array can be a Dart object or a pointer to external data. @@ -1193,7 +1137,6 @@ Representation StoreIndexedInstr::RequiredInputRepresentation( } } - LocationSummary* StoreIndexedInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 3; @@ -1252,7 +1195,6 @@ LocationSummary* StoreIndexedInstr::MakeLocationSummary(Zone* zone, return locs; } - void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // The array register points to the backing store for external arrays. const Register array = locs()->in(0).reg(); @@ -1352,7 +1294,6 @@ void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* GuardFieldClassInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -1384,7 +1325,6 @@ LocationSummary* GuardFieldClassInstr::MakeLocationSummary(Zone* zone, return summary; } - void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(sizeof(classid_t) == kInt16Size); const intptr_t value_cid = value()->Type()->ToCid(); @@ -1530,7 +1470,6 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&ok); } - LocationSummary* GuardFieldLengthInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -1553,7 +1492,6 @@ LocationSummary* GuardFieldLengthInstr::MakeLocationSummary(Zone* zone, UNREACHABLE(); } - void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (field().guarded_list_length() == Field::kNoFixedLength) { if (Compiler::IsBackgroundCompilation()) { @@ -1624,7 +1562,6 @@ void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - class BoxAllocationSlowPath : public SlowPathCode { public: BoxAllocationSlowPath(Instruction* instruction, @@ -1680,7 +1617,6 @@ class BoxAllocationSlowPath : public SlowPathCode { const Register result_; }; - LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -1713,7 +1649,6 @@ LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Zone* zone, return summary; } - static void EnsureMutableBox(FlowGraphCompiler* compiler, StoreInstanceFieldInstr* instruction, Register box_reg, @@ -1734,7 +1669,6 @@ static void EnsureMutableBox(FlowGraphCompiler* compiler, __ Bind(&done); } - void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(sizeof(classid_t) == kInt16Size); Label skip_store; @@ -1832,7 +1766,6 @@ void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // Fall through. __ jmp(&store_pointer); - if (!compiler->is_optimizing()) { locs()->live_registers()->Add(locs()->in(0)); locs()->live_registers()->Add(locs()->in(1)); @@ -1888,7 +1821,6 @@ void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&skip_store); } - LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -1902,7 +1834,6 @@ LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone, return summary; } - // When the parser is building an implicit static getter for optimization, // it can generate a function body where deoptimization ids do not line up // with the unoptimized code. @@ -1914,7 +1845,6 @@ void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ movl(result, FieldAddress(field, Field::static_value_offset())); } - LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { LocationSummary* locs = @@ -1925,7 +1855,6 @@ LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(Zone* zone, return locs; } - void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register value = locs()->in(0).reg(); Register temp = locs()->temp(0).reg(); @@ -1940,7 +1869,6 @@ void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* InstanceOfInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 3; @@ -1954,7 +1882,6 @@ LocationSummary* InstanceOfInstr::MakeLocationSummary(Zone* zone, return summary; } - void InstanceOfInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->in(0).reg() == EAX); // Value. ASSERT(locs()->in(1).reg() == EDX); // Instantiator type arguments. @@ -1964,7 +1891,6 @@ void InstanceOfInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->out(0).reg() == EAX); } - // TODO(srdjan): In case of constant inputs make CreateArray kNoCall and // use slow path stub. LocationSummary* CreateArrayInstr::MakeLocationSummary(Zone* zone, @@ -1979,7 +1905,6 @@ LocationSummary* CreateArrayInstr::MakeLocationSummary(Zone* zone, return locs; } - // Inlines array allocation for known constant values. static void InlineArrayAllocation(FlowGraphCompiler* compiler, intptr_t num_elements, @@ -2034,7 +1959,6 @@ static void InlineArrayAllocation(FlowGraphCompiler* compiler, __ jmp(done, Assembler::kNearJump); } - void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // Allocate the array. EDX = length, ECX = element type. const Register kLengthReg = EDX; @@ -2074,7 +1998,6 @@ void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->out(0).reg() == kResultReg); } - LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -2082,9 +2005,9 @@ LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, (IsUnboxedLoad() && opt) ? 1 : ((IsPotentialUnboxedLoad()) ? 2 : 0); LocationSummary* locs = new (zone) LocationSummary( - zone, kNumInputs, kNumTemps, (opt && !IsPotentialUnboxedLoad()) - ? LocationSummary::kNoCall - : LocationSummary::kCallOnSlowPath); + zone, kNumInputs, kNumTemps, + (opt && !IsPotentialUnboxedLoad()) ? LocationSummary::kNoCall + : LocationSummary::kCallOnSlowPath); locs->set_in(0, Location::RequiresRegister()); @@ -2099,7 +2022,6 @@ LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, return locs; } - void LoadFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(sizeof(classid_t) == kInt16Size); @@ -2134,7 +2056,6 @@ void LoadFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register temp = locs()->temp(1).reg(); XmmRegister value = locs()->temp(0).fpu_reg(); - Label load_pointer; Label load_double; Label load_float32x4; @@ -2200,7 +2121,6 @@ void LoadFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&done); } - LocationSummary* InstantiateTypeInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -2213,7 +2133,6 @@ LocationSummary* InstantiateTypeInstr::MakeLocationSummary(Zone* zone, return locs; } - void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register instantiator_type_args_reg = locs()->in(0).reg(); Register function_type_args_reg = locs()->in(1).reg(); @@ -2233,7 +2152,6 @@ void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(instantiator_type_args_reg == result_reg); } - LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -2247,7 +2165,6 @@ LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary( return locs; } - void InstantiateTypeArgumentsInstr::EmitNativeCode( FlowGraphCompiler* compiler) { Register instantiator_type_args_reg = locs()->in(0).reg(); @@ -2316,7 +2233,6 @@ void InstantiateTypeArgumentsInstr::EmitNativeCode( __ Bind(&type_arguments_instantiated); } - LocationSummary* AllocateUninitializedContextInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -2331,7 +2247,6 @@ LocationSummary* AllocateUninitializedContextInstr::MakeLocationSummary( return locs; } - class AllocateContextSlowPath : public SlowPathCode { public: explicit AllocateContextSlowPath( @@ -2363,7 +2278,6 @@ class AllocateContextSlowPath : public SlowPathCode { AllocateUninitializedContextInstr* instruction_; }; - void AllocateUninitializedContextInstr::EmitNativeCode( FlowGraphCompiler* compiler) { ASSERT(compiler->is_optimizing()); @@ -2388,7 +2302,6 @@ void AllocateUninitializedContextInstr::EmitNativeCode( __ Bind(slow_path->exit_label()); } - LocationSummary* AllocateContextInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -2400,7 +2313,6 @@ LocationSummary* AllocateContextInstr::MakeLocationSummary(Zone* zone, return locs; } - void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->temp(0).reg() == EDX); ASSERT(locs()->out(0).reg() == EAX); @@ -2410,7 +2322,6 @@ void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { RawPcDescriptors::kOther, locs()); } - LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -2422,7 +2333,6 @@ LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone, return locs; } - void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register field = locs()->in(0).reg(); Register temp = locs()->temp(0).reg(); @@ -2445,7 +2355,6 @@ void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&no_call); } - LocationSummary* CloneContextInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -2457,7 +2366,6 @@ LocationSummary* CloneContextInstr::MakeLocationSummary(Zone* zone, return locs; } - void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register context_value = locs()->in(0).reg(); Register result = locs()->out(0).reg(); @@ -2470,14 +2378,12 @@ void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ popl(result); // Get result (cloned context). } - LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Zone* zone, bool opt) const { UNREACHABLE(); return NULL; } - void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(compiler->GetJumpLabel(this)); compiler->AddExceptionHandler(catch_try_index(), try_index(), @@ -2552,7 +2458,6 @@ void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -2565,7 +2470,6 @@ LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Zone* zone, return summary; } - class CheckStackOverflowSlowPath : public SlowPathCode { public: explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) @@ -2612,7 +2516,6 @@ class CheckStackOverflowSlowPath : public SlowPathCode { Label osr_entry_label_; }; - void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); compiler->AddSlowPathCode(slow_path); @@ -2638,7 +2541,6 @@ void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(slow_path->exit_label()); } - static void EmitSmiShiftLeft(FlowGraphCompiler* compiler, BinarySmiOpInstr* shift_left) { const LocationSummary& locs = *shift_left->locs(); @@ -2750,7 +2652,6 @@ static void EmitSmiShiftLeft(FlowGraphCompiler* compiler, } } - LocationSummary* CheckedSmiOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { // Only for precompiled code, not on ia32 currently. @@ -2758,13 +2659,11 @@ LocationSummary* CheckedSmiOpInstr::MakeLocationSummary(Zone* zone, return NULL; } - void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // Only for precompiled code, not on ia32 currently. UNIMPLEMENTED(); } - LocationSummary* CheckedSmiComparisonInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -2773,7 +2672,6 @@ LocationSummary* CheckedSmiComparisonInstr::MakeLocationSummary( return NULL; } - Condition CheckedSmiComparisonInstr::EmitComparisonCode( FlowGraphCompiler* compiler, BranchLabels labels) { @@ -2782,25 +2680,21 @@ Condition CheckedSmiComparisonInstr::EmitComparisonCode( return ZERO; } - void CheckedSmiComparisonInstr::EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* instr) { // Only for precompiled code, not on ia32 currently. UNIMPLEMENTED(); } - void CheckedSmiComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // Only for precompiled code, not on ia32 currently. UNIMPLEMENTED(); } - static bool IsSmiValue(const Object& constant, intptr_t value) { return constant.IsSmi() && (Smi::Cast(constant).Value() == value); } - LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -2874,7 +2768,6 @@ LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone, } } - template static void EmitIntegerArithmetic(FlowGraphCompiler* compiler, Token::Kind op_kind, @@ -2906,7 +2799,6 @@ static void EmitIntegerArithmetic(FlowGraphCompiler* compiler, if (deopt != NULL) __ j(OVERFLOW, deopt); } - void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (op_kind() == Token::kSHL) { EmitSmiShiftLeft(compiler, this); @@ -2998,7 +2890,6 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { EmitIntegerArithmetic(compiler, op_kind(), left, right, deopt); break; - case Token::kTRUNCDIV: { if (RangeUtils::CanBeZero(right_range())) { // Handle divide by zero in runtime. @@ -3107,7 +2998,6 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* BinaryInt32OpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -3152,7 +3042,6 @@ LocationSummary* BinaryInt32OpInstr::MakeLocationSummary(Zone* zone, } } - static void EmitInt32ShiftLeft(FlowGraphCompiler* compiler, BinaryInt32OpInstr* shift_left) { const LocationSummary& locs = *shift_left->locs(); @@ -3184,7 +3073,6 @@ static void EmitInt32ShiftLeft(FlowGraphCompiler* compiler, __ shll(left, Immediate(value)); } - void BinaryInt32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (op_kind() == Token::kSHL) { EmitInt32ShiftLeft(compiler, this); @@ -3214,7 +3102,6 @@ void BinaryInt32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { deopt); break; - case Token::kTRUNCDIV: { UNREACHABLE(); break; @@ -3258,7 +3145,6 @@ void BinaryInt32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* BinaryUint32OpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -3276,7 +3162,6 @@ LocationSummary* BinaryUint32OpInstr::MakeLocationSummary(Zone* zone, return summary; } - void BinaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register left = locs()->in(0).reg(); Register right = locs()->in(1).reg(); @@ -3301,7 +3186,6 @@ void BinaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary(Zone* zone, bool opt) const { intptr_t left_cid = left()->Type()->ToCid(); @@ -3319,7 +3203,6 @@ LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary(Zone* zone, return summary; } - void CheckEitherNonSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinaryDoubleOp, @@ -3343,7 +3226,6 @@ void CheckEitherNonSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ j(ZERO, deopt); } - LocationSummary* BoxInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; const intptr_t kNumTemps = 1; @@ -3355,7 +3237,6 @@ LocationSummary* BoxInstr::MakeLocationSummary(Zone* zone, bool opt) const { return summary; } - void BoxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register out_reg = locs()->out(0).reg(); XmmRegister value = locs()->in(0).fpu_reg(); @@ -3379,7 +3260,6 @@ void BoxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* UnboxInstr::MakeLocationSummary(Zone* zone, bool opt) const { const bool needs_temp = CanDeoptimize() || @@ -3402,7 +3282,6 @@ LocationSummary* UnboxInstr::MakeLocationSummary(Zone* zone, bool opt) const { return summary; } - void UnboxInstr::EmitLoadFromBox(FlowGraphCompiler* compiler) { const Register box = locs()->in(0).reg(); @@ -3435,7 +3314,6 @@ void UnboxInstr::EmitLoadFromBox(FlowGraphCompiler* compiler) { } } - void UnboxInstr::EmitSmiConversion(FlowGraphCompiler* compiler) { const Register box = locs()->in(0).reg(); @@ -3465,7 +3343,6 @@ void UnboxInstr::EmitSmiConversion(FlowGraphCompiler* compiler) { } } - void UnboxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const intptr_t value_cid = value()->Type()->ToCid(); const intptr_t box_cid = BoxCid(); @@ -3506,7 +3383,6 @@ void UnboxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* BoxInteger32Instr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -3527,7 +3403,6 @@ LocationSummary* BoxInteger32Instr::MakeLocationSummary(Zone* zone, return summary; } - void BoxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register value = locs()->in(0).reg(); const Register out = locs()->out(0).reg(); @@ -3562,7 +3437,6 @@ void BoxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* BoxInt64Instr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -3580,7 +3454,6 @@ LocationSummary* BoxInt64Instr::MakeLocationSummary(Zone* zone, return summary; } - void BoxInt64Instr::EmitNativeCode(FlowGraphCompiler* compiler) { if (ValueFitsSmi()) { PairLocation* value_pair = locs()->in(0).AsPairLocation(); @@ -3628,7 +3501,6 @@ void BoxInt64Instr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&done); } - LocationSummary* UnboxInteger32Instr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t value_cid = value()->Type()->ToCid(); @@ -3655,7 +3527,6 @@ LocationSummary* UnboxInteger32Instr::MakeLocationSummary(Zone* zone, return summary; } - static void LoadInt32FromMint(FlowGraphCompiler* compiler, Register result, const Address& lo, @@ -3672,16 +3543,14 @@ static void LoadInt32FromMint(FlowGraphCompiler* compiler, } } - void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) { const intptr_t value_cid = value()->Type()->ToCid(); Register value = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); const Register temp = CanDeoptimize() ? locs()->temp(0).reg() : kNoRegister; - Label* deopt = - CanDeoptimize() - ? compiler->AddDeoptStub(GetDeoptId(), ICData::kDeoptUnboxInteger) - : NULL; + Label* deopt = CanDeoptimize() ? compiler->AddDeoptStub( + GetDeoptId(), ICData::kDeoptUnboxInteger) + : NULL; Label* out_of_range = !is_truncating() ? deopt : NULL; const intptr_t lo_offset = Mint::value_offset(); @@ -3717,7 +3586,6 @@ void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Zone* zone, bool opt) const { const bool might_box = (representation() == kTagged) && !can_pack_into_smi(); @@ -3747,7 +3615,6 @@ LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Zone* zone, return summary; } - void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // The string register points to the backing store for external strings. const Register str = locs()->in(0).reg(); @@ -3846,7 +3713,6 @@ void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -3859,7 +3725,6 @@ LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary(Zone* zone, return summary; } - void BinaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); XmmRegister right = locs()->in(1).fpu_reg(); @@ -3884,7 +3749,6 @@ void BinaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* DoubleTestOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -3900,7 +3764,6 @@ LocationSummary* DoubleTestOpInstr::MakeLocationSummary(Zone* zone, return summary; } - Condition DoubleTestOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { ASSERT(compiler->is_optimizing()); @@ -3934,7 +3797,6 @@ Condition DoubleTestOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler, } } - LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -3947,7 +3809,6 @@ LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone, return summary; } - void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); XmmRegister right = locs()->in(1).fpu_reg(); @@ -3972,7 +3833,6 @@ void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* BinaryFloat64x2OpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -3985,7 +3845,6 @@ LocationSummary* BinaryFloat64x2OpInstr::MakeLocationSummary(Zone* zone, return summary; } - void BinaryFloat64x2OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); XmmRegister right = locs()->in(1).fpu_reg(); @@ -4010,7 +3869,6 @@ void BinaryFloat64x2OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Simd32x4ShuffleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4022,7 +3880,6 @@ LocationSummary* Simd32x4ShuffleInstr::MakeLocationSummary(Zone* zone, return summary; } - void Simd32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister value = locs()->in(0).fpu_reg(); @@ -4054,7 +3911,6 @@ void Simd32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Simd32x4ShuffleMixInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4067,7 +3923,6 @@ LocationSummary* Simd32x4ShuffleMixInstr::MakeLocationSummary(Zone* zone, return summary; } - void Simd32x4ShuffleMixInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); XmmRegister right = locs()->in(1).fpu_reg(); @@ -4083,7 +3938,6 @@ void Simd32x4ShuffleMixInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4095,7 +3949,6 @@ LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary(Zone* zone, return summary; } - void Simd32x4GetSignMaskInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister value = locs()->in(0).fpu_reg(); Register out = locs()->out(0).reg(); @@ -4104,7 +3957,6 @@ void Simd32x4GetSignMaskInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ SmiTag(out); } - LocationSummary* Float32x4ConstructorInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -4120,7 +3972,6 @@ LocationSummary* Float32x4ConstructorInstr::MakeLocationSummary( return summary; } - void Float32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister v0 = locs()->in(0).fpu_reg(); XmmRegister v1 = locs()->in(1).fpu_reg(); @@ -4143,7 +3994,6 @@ void Float32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ addl(ESP, Immediate(16)); } - LocationSummary* Float32x4ZeroInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -4154,13 +4004,11 @@ LocationSummary* Float32x4ZeroInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister value = locs()->out(0).fpu_reg(); __ xorps(value, value); } - LocationSummary* Float32x4SplatInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4172,7 +4020,6 @@ LocationSummary* Float32x4SplatInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister value = locs()->out(0).fpu_reg(); ASSERT(locs()->in(0).fpu_reg() == locs()->out(0).fpu_reg()); @@ -4182,7 +4029,6 @@ void Float32x4SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ shufps(value, value, Immediate(0x00)); } - LocationSummary* Float32x4ComparisonInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4195,7 +4041,6 @@ LocationSummary* Float32x4ComparisonInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); XmmRegister right = locs()->in(1).fpu_reg(); @@ -4227,7 +4072,6 @@ void Float32x4ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float32x4MinMaxInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4240,7 +4084,6 @@ LocationSummary* Float32x4MinMaxInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4MinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); XmmRegister right = locs()->in(1).fpu_reg(); @@ -4259,7 +4102,6 @@ void Float32x4MinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float32x4ScaleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4272,7 +4114,6 @@ LocationSummary* Float32x4ScaleInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4ScaleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); XmmRegister right = locs()->in(1).fpu_reg(); @@ -4290,7 +4131,6 @@ void Float32x4ScaleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float32x4SqrtInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4302,7 +4142,6 @@ LocationSummary* Float32x4SqrtInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4SqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); @@ -4323,7 +4162,6 @@ void Float32x4SqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float32x4ZeroArgInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4335,7 +4173,6 @@ LocationSummary* Float32x4ZeroArgInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); @@ -4352,7 +4189,6 @@ void Float32x4ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float32x4ClampInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 3; @@ -4366,7 +4202,6 @@ LocationSummary* Float32x4ClampInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4ClampInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); XmmRegister lower = locs()->in(1).fpu_reg(); @@ -4376,7 +4211,6 @@ void Float32x4ClampInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ maxps(left, lower); } - LocationSummary* Float32x4WithInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4389,7 +4223,6 @@ LocationSummary* Float32x4WithInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4WithInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister replacement = locs()->in(0).fpu_reg(); XmmRegister value = locs()->in(1).fpu_reg(); @@ -4446,7 +4279,6 @@ void Float32x4WithInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float32x4ToInt32x4Instr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4458,12 +4290,10 @@ LocationSummary* Float32x4ToInt32x4Instr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4ToInt32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { // NOP. } - LocationSummary* Simd64x2ShuffleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4475,7 +4305,6 @@ LocationSummary* Simd64x2ShuffleInstr::MakeLocationSummary(Zone* zone, return summary; } - void Simd64x2ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister value = locs()->in(0).fpu_reg(); @@ -4493,7 +4322,6 @@ void Simd64x2ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float64x2ZeroInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -4504,13 +4332,11 @@ LocationSummary* Float64x2ZeroInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float64x2ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister value = locs()->out(0).fpu_reg(); __ xorpd(value, value); } - LocationSummary* Float64x2SplatInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4522,13 +4348,11 @@ LocationSummary* Float64x2SplatInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float64x2SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister value = locs()->out(0).fpu_reg(); __ shufpd(value, value, Immediate(0x0)); } - LocationSummary* Float64x2ConstructorInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -4542,7 +4366,6 @@ LocationSummary* Float64x2ConstructorInstr::MakeLocationSummary( return summary; } - void Float64x2ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister v0 = locs()->in(0).fpu_reg(); XmmRegister v1 = locs()->in(1).fpu_reg(); @@ -4553,7 +4376,6 @@ void Float64x2ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ shufpd(v0, v1, Immediate(0x0)); } - LocationSummary* Float64x2ToFloat32x4Instr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -4566,13 +4388,11 @@ LocationSummary* Float64x2ToFloat32x4Instr::MakeLocationSummary( return summary; } - void Float64x2ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister value = locs()->out(0).fpu_reg(); __ cvtpd2ps(value, value); } - LocationSummary* Float32x4ToFloat64x2Instr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -4585,13 +4405,11 @@ LocationSummary* Float32x4ToFloat64x2Instr::MakeLocationSummary( return summary; } - void Float32x4ToFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister value = locs()->out(0).fpu_reg(); __ cvtps2pd(value, value); } - LocationSummary* Float64x2ZeroArgInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4609,7 +4427,6 @@ LocationSummary* Float64x2ZeroArgInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float64x2ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); @@ -4635,7 +4452,6 @@ void Float64x2ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float64x2OneArgInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4648,7 +4464,6 @@ LocationSummary* Float64x2OneArgInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float64x2OneArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); XmmRegister right = locs()->in(1).fpu_reg(); @@ -4690,7 +4505,6 @@ void Float64x2OneArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Int32x4ConstructorInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 4; @@ -4705,7 +4519,6 @@ LocationSummary* Int32x4ConstructorInstr::MakeLocationSummary(Zone* zone, return summary; } - void Int32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register v0 = locs()->in(0).reg(); Register v1 = locs()->in(1).reg(); @@ -4721,7 +4534,6 @@ void Int32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ addl(ESP, Immediate(4 * kInt32Size)); } - LocationSummary* Int32x4BoolConstructorInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -4737,7 +4549,6 @@ LocationSummary* Int32x4BoolConstructorInstr::MakeLocationSummary( return summary; } - void Int32x4BoolConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register v0 = locs()->in(0).reg(); Register v1 = locs()->in(1).reg(); @@ -4785,7 +4596,6 @@ void Int32x4BoolConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ addl(ESP, Immediate(16)); } - LocationSummary* Int32x4GetFlagInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4797,7 +4607,6 @@ LocationSummary* Int32x4GetFlagInstr::MakeLocationSummary(Zone* zone, return summary; } - void Int32x4GetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister value = locs()->in(0).fpu_reg(); Register result = locs()->out(0).reg(); @@ -4832,7 +4641,6 @@ void Int32x4GetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&done); } - LocationSummary* Int32x4SelectInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 3; @@ -4847,7 +4655,6 @@ LocationSummary* Int32x4SelectInstr::MakeLocationSummary(Zone* zone, return summary; } - void Int32x4SelectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister mask = locs()->in(0).fpu_reg(); XmmRegister trueValue = locs()->in(1).fpu_reg(); @@ -4867,7 +4674,6 @@ void Int32x4SelectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ orps(mask, temp); } - LocationSummary* Int32x4SetFlagInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4880,7 +4686,6 @@ LocationSummary* Int32x4SetFlagInstr::MakeLocationSummary(Zone* zone, return summary; } - void Int32x4SetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister mask = locs()->in(0).fpu_reg(); Register flag = locs()->in(1).reg(); @@ -4925,7 +4730,6 @@ void Int32x4SetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ addl(ESP, Immediate(16)); } - LocationSummary* Int32x4ToFloat32x4Instr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4937,12 +4741,10 @@ LocationSummary* Int32x4ToFloat32x4Instr::MakeLocationSummary(Zone* zone, return summary; } - void Int32x4ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { // NOP. } - LocationSummary* BinaryInt32x4OpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4955,7 +4757,6 @@ LocationSummary* BinaryInt32x4OpInstr::MakeLocationSummary(Zone* zone, return summary; } - void BinaryInt32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); XmmRegister right = locs()->in(1).fpu_reg(); @@ -4984,7 +4785,6 @@ void BinaryInt32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* MathUnaryInstr::MakeLocationSummary(Zone* zone, bool opt) const { ASSERT((kind() == MathUnaryInstr::kSqrt) || @@ -5002,7 +4802,6 @@ LocationSummary* MathUnaryInstr::MakeLocationSummary(Zone* zone, return summary; } - void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (kind() == MathUnaryInstr::kSqrt) { __ sqrtsd(locs()->out(0).fpu_reg(), locs()->in(0).fpu_reg()); @@ -5015,7 +4814,6 @@ void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -5030,7 +4828,6 @@ LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary( return summary; } - void CaseInsensitiveCompareUC16Instr::EmitNativeCode( FlowGraphCompiler* compiler) { // Save ESP. EDI is chosen because it is callee saved so we do not need to @@ -5051,7 +4848,6 @@ void CaseInsensitiveCompareUC16Instr::EmitNativeCode( __ movl(ESP, kSavedSPReg); } - LocationSummary* MathMinMaxInstr::MakeLocationSummary(Zone* zone, bool opt) const { if (result_cid() == kDoubleCid) { @@ -5079,7 +4875,6 @@ LocationSummary* MathMinMaxInstr::MakeLocationSummary(Zone* zone, return summary; } - void MathMinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT((op_kind() == MethodRecognizer::kMathMin) || (op_kind() == MethodRecognizer::kMathMax)); @@ -5140,7 +4935,6 @@ void MathMinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* UnarySmiOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5148,7 +4942,6 @@ LocationSummary* UnarySmiOpInstr::MakeLocationSummary(Zone* zone, LocationSummary::kNoCall); } - void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register value = locs()->in(0).reg(); ASSERT(value == locs()->out(0).reg()); @@ -5168,7 +4961,6 @@ void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* UnaryDoubleOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5180,14 +4972,12 @@ LocationSummary* UnaryDoubleOpInstr::MakeLocationSummary(Zone* zone, return summary; } - void UnaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister value = locs()->in(0).fpu_reg(); ASSERT(locs()->out(0).fpu_reg() == value); __ DoubleNegate(value); } - LocationSummary* Int32ToDoubleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5199,14 +4989,12 @@ LocationSummary* Int32ToDoubleInstr::MakeLocationSummary(Zone* zone, return result; } - void Int32ToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register value = locs()->in(0).reg(); FpuRegister result = locs()->out(0).fpu_reg(); __ cvtsi2sd(result, value); } - LocationSummary* SmiToDoubleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5218,7 +5006,6 @@ LocationSummary* SmiToDoubleInstr::MakeLocationSummary(Zone* zone, return result; } - void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register value = locs()->in(0).reg(); FpuRegister result = locs()->out(0).fpu_reg(); @@ -5226,7 +5013,6 @@ void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ cvtsi2sd(result, value); } - LocationSummary* MintToDoubleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5239,7 +5025,6 @@ LocationSummary* MintToDoubleInstr::MakeLocationSummary(Zone* zone, return result; } - void MintToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { PairLocation* pair = locs()->in(0).AsPairLocation(); Register in_lo = pair->At(0).reg(); @@ -5261,7 +5046,6 @@ void MintToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ addl(ESP, Immediate(2 * kWordSize)); } - LocationSummary* DoubleToIntegerInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5273,7 +5057,6 @@ LocationSummary* DoubleToIntegerInstr::MakeLocationSummary(Zone* zone, return result; } - void DoubleToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register result = locs()->out(0).reg(); Register value_obj = locs()->in(0).reg(); @@ -5304,7 +5087,6 @@ void DoubleToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&done); } - LocationSummary* DoubleToSmiInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5316,7 +5098,6 @@ LocationSummary* DoubleToSmiInstr::MakeLocationSummary(Zone* zone, return result; } - void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptDoubleToSmi); Register result = locs()->out(0).reg(); @@ -5328,7 +5109,6 @@ void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ SmiTag(result); } - LocationSummary* DoubleToDoubleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5340,7 +5120,6 @@ LocationSummary* DoubleToDoubleInstr::MakeLocationSummary(Zone* zone, return result; } - void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister value = locs()->in(0).fpu_reg(); XmmRegister result = locs()->out(0).fpu_reg(); @@ -5359,7 +5138,6 @@ void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* DoubleToFloatInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5371,12 +5149,10 @@ LocationSummary* DoubleToFloatInstr::MakeLocationSummary(Zone* zone, return result; } - void DoubleToFloatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ cvtsd2ss(locs()->out(0).fpu_reg(), locs()->in(0).fpu_reg()); } - LocationSummary* FloatToDoubleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5388,12 +5164,10 @@ LocationSummary* FloatToDoubleInstr::MakeLocationSummary(Zone* zone, return result; } - void FloatToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ cvtss2sd(locs()->out(0).fpu_reg(), locs()->in(0).fpu_reg()); } - LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(Zone* zone, bool opt) const { ASSERT((InputCount() == 1) || (InputCount() == 2)); @@ -5418,7 +5192,6 @@ LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(Zone* zone, return result; } - // Pseudo code: // if (exponent == 0.0) return 1.0; // // Speed up simple cases. @@ -5551,7 +5324,6 @@ static void InvokeDoublePow(FlowGraphCompiler* compiler, __ Bind(&skip_call); } - void InvokeMathCFunctionInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (recognized_kind() == MethodRecognizer::kMathDoublePow) { InvokeDoublePow(compiler, this); @@ -5571,7 +5343,6 @@ void InvokeMathCFunctionInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ movl(ESP, locs()->temp(kSavedSpTempIndex).reg()); } - LocationSummary* ExtractNthOutputInstr::MakeLocationSummary(Zone* zone, bool opt) const { // Only use this instruction in optimized code. @@ -5604,7 +5375,6 @@ LocationSummary* ExtractNthOutputInstr::MakeLocationSummary(Zone* zone, return summary; } - void ExtractNthOutputInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->in(0).IsPairLocation()); PairLocation* pair = locs()->in(0).AsPairLocation(); @@ -5621,7 +5391,6 @@ void ExtractNthOutputInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* TruncDivModInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -5637,7 +5406,6 @@ LocationSummary* TruncDivModInstr::MakeLocationSummary(Zone* zone, return summary; } - void TruncDivModInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(CanDeoptimize()); Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinarySmiOp); @@ -5701,14 +5469,12 @@ void TruncDivModInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ SmiTag(EDX); } - LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary( Zone* zone, bool opt) const { return MakeCallSummary(zone); } - LocationSummary* BranchInstr::MakeLocationSummary(Zone* zone, bool opt) const { comparison()->InitializeLocationSummary(zone, opt); // Branches don't produce a result. @@ -5716,12 +5482,10 @@ LocationSummary* BranchInstr::MakeLocationSummary(Zone* zone, bool opt) const { return comparison()->locs(); } - void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) { comparison()->EmitBranchCode(compiler, this); } - LocationSummary* CheckClassInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5739,7 +5503,6 @@ LocationSummary* CheckClassInstr::MakeLocationSummary(Zone* zone, return summary; } - void CheckClassInstr::EmitNullCheck(FlowGraphCompiler* compiler, Label* deopt) { const Immediate& raw_null = Immediate(reinterpret_cast(Object::null())); @@ -5749,7 +5512,6 @@ void CheckClassInstr::EmitNullCheck(FlowGraphCompiler* compiler, Label* deopt) { __ j(cond, deopt); } - void CheckClassInstr::EmitBitTest(FlowGraphCompiler* compiler, intptr_t min, intptr_t max, @@ -5766,7 +5528,6 @@ void CheckClassInstr::EmitBitTest(FlowGraphCompiler* compiler, __ j(NOT_CARRY, deopt); } - int CheckClassInstr::EmitCheckCid(FlowGraphCompiler* compiler, int bias, intptr_t cid_start, @@ -5803,7 +5564,6 @@ int CheckClassInstr::EmitCheckCid(FlowGraphCompiler* compiler, return bias; } - LocationSummary* CheckSmiInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5814,7 +5574,6 @@ LocationSummary* CheckSmiInstr::MakeLocationSummary(Zone* zone, return summary; } - void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register value = locs()->in(0).reg(); Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckSmi, @@ -5822,7 +5581,6 @@ void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ BranchIfNotSmi(value, deopt); } - LocationSummary* CheckClassIdInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5834,7 +5592,6 @@ LocationSummary* CheckClassIdInstr::MakeLocationSummary(Zone* zone, return summary; } - void CheckClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register value = locs()->in(0).reg(); Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckClass); @@ -5848,7 +5605,6 @@ void CheckClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* GenericCheckBoundInstr::MakeLocationSummary(Zone* zone, bool opt) const { // Only needed for AOT. @@ -5856,13 +5612,11 @@ LocationSummary* GenericCheckBoundInstr::MakeLocationSummary(Zone* zone, return NULL; } - void GenericCheckBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // Only needed for AOT. UNIMPLEMENTED(); } - // Length: register or constant. // Index: register, constant or stack slot. LocationSummary* CheckArrayBoundInstr::MakeLocationSummary(Zone* zone, @@ -5880,7 +5634,6 @@ LocationSummary* CheckArrayBoundInstr::MakeLocationSummary(Zone* zone, return locs; } - void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { uint32_t flags = generalized_ ? ICData::kGeneralized : 0; flags |= licm_hoisted_ ? ICData::kHoisted : 0; @@ -5943,7 +5696,6 @@ void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* BinaryMintOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -5976,7 +5728,6 @@ LocationSummary* BinaryMintOpInstr::MakeLocationSummary(Zone* zone, } } - void BinaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { PairLocation* left_pair = locs()->in(0).AsPairLocation(); Register left_lo = left_pair->At(0).reg(); @@ -6046,7 +5797,6 @@ void BinaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* ShiftMintOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -6065,7 +5815,6 @@ LocationSummary* ShiftMintOpInstr::MakeLocationSummary(Zone* zone, return summary; } - void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { PairLocation* left_pair = locs()->in(0).AsPairLocation(); Register left_lo = left_pair->At(0).reg(); @@ -6237,7 +5986,6 @@ void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* UnaryMintOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -6250,7 +5998,6 @@ LocationSummary* UnaryMintOpInstr::MakeLocationSummary(Zone* zone, return summary; } - void UnaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(op_kind() == Token::kBIT_NOT); PairLocation* left_pair = locs()->in(0).AsPairLocation(); @@ -6265,22 +6012,18 @@ void UnaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ notl(left_hi); } - CompileType BinaryUint32OpInstr::ComputeType() const { return CompileType::Int(); } - CompileType ShiftUint32OpInstr::ComputeType() const { return CompileType::Int(); } - CompileType UnaryUint32OpInstr::ComputeType() const { return CompileType::Int(); } - LocationSummary* ShiftUint32OpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -6293,7 +6036,6 @@ LocationSummary* ShiftUint32OpInstr::MakeLocationSummary(Zone* zone, return summary; } - void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const intptr_t kShifterLimit = 31; @@ -6301,7 +6043,6 @@ void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register out = locs()->out(0).reg(); ASSERT(left == out); - Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinaryMintOp); if (locs()->in(1).IsConstant()) { @@ -6311,7 +6052,6 @@ void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(constant.IsSmi()); const intptr_t shift_value = Smi::Cast(constant).Value(); - // Do the shift: (shift_value > 0) && (shift_value <= kShifterLimit). switch (op_kind()) { case Token::kSHR: @@ -6365,7 +6105,6 @@ void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&done); } - LocationSummary* UnaryUint32OpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -6377,7 +6116,6 @@ LocationSummary* UnaryUint32OpInstr::MakeLocationSummary(Zone* zone, return summary; } - void UnaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register out = locs()->out(0).reg(); ASSERT(locs()->in(0).reg() == out); @@ -6387,7 +6125,6 @@ void UnaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ notl(out); } - LocationSummary* UnboxedIntConverterInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -6416,7 +6153,6 @@ LocationSummary* UnboxedIntConverterInstr::MakeLocationSummary(Zone* zone, return summary; } - void UnboxedIntConverterInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (from() == kUnboxedInt32 && to() == kUnboxedUint32) { // Representations are bitwise equivalent. @@ -6472,24 +6208,20 @@ void UnboxedIntConverterInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* ThrowInstr::MakeLocationSummary(Zone* zone, bool opt) const { return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kCall); } - void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { compiler->GenerateRuntimeCall(token_pos(), deopt_id(), kThrowRuntimeEntry, 1, locs()); __ int3(); } - LocationSummary* ReThrowInstr::MakeLocationSummary(Zone* zone, bool opt) const { return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kCall); } - void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { compiler->SetNeedsStackTrace(catch_try_index()); compiler->GenerateRuntimeCall(token_pos(), deopt_id(), kReThrowRuntimeEntry, @@ -6497,29 +6229,24 @@ void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ int3(); } - LocationSummary* StopInstr::MakeLocationSummary(Zone* zone, bool opt) const { return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kNoCall); } - void StopInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Stop(message()); } - void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (!compiler->CanFallThroughTo(normal_entry())) { __ jmp(compiler->GetJumpLabel(normal_entry())); } } - LocationSummary* GotoInstr::MakeLocationSummary(Zone* zone, bool opt) const { return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kNoCall); } - void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (!compiler->is_optimizing()) { if (FLAG_reorder_basic_blocks) { @@ -6541,7 +6268,6 @@ void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* IndirectGotoInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -6556,7 +6282,6 @@ LocationSummary* IndirectGotoInstr::MakeLocationSummary(Zone* zone, return summary; } - void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register target_reg = locs()->temp_slot(0)->reg(); @@ -6579,7 +6304,6 @@ void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ jmp(target_reg); } - LocationSummary* StrictCompareInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -6604,7 +6328,6 @@ LocationSummary* StrictCompareInstr::MakeLocationSummary(Zone* zone, return locs; } - Condition StrictCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { Location left = locs()->in(0); @@ -6630,14 +6353,12 @@ Condition StrictCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, return true_condition; } - // Detect pattern when one value is zero and another is a power of 2. static bool IsPowerOfTwoKind(intptr_t v1, intptr_t v2) { return (Utils::IsPowerOfTwo(v1) && (v2 == 0)) || (Utils::IsPowerOfTwo(v2) && (v1 == 0)); } - LocationSummary* IfThenElseInstr::MakeLocationSummary(Zone* zone, bool opt) const { comparison()->InitializeLocationSummary(zone, opt); @@ -6646,7 +6367,6 @@ LocationSummary* IfThenElseInstr::MakeLocationSummary(Zone* zone, return comparison()->locs(); } - void IfThenElseInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->out(0).reg() == EDX); @@ -6698,7 +6418,6 @@ void IfThenElseInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* ClosureCallInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -6710,7 +6429,6 @@ LocationSummary* ClosureCallInstr::MakeLocationSummary(Zone* zone, return summary; } - void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // Load arguments descriptor. const intptr_t argument_count = ArgumentCount(); // Includes type args. @@ -6742,14 +6460,12 @@ void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Drop(argument_count); } - LocationSummary* BooleanNegateInstr::MakeLocationSummary(Zone* zone, bool opt) const { return LocationSummary::Make(zone, 1, Location::RequiresRegister(), LocationSummary::kNoCall); } - void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register value = locs()->in(0).reg(); Register result = locs()->out(0).reg(); @@ -6762,13 +6478,11 @@ void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&done); } - LocationSummary* AllocateObjectInstr::MakeLocationSummary(Zone* zone, bool opt) const { return MakeCallSummary(zone); } - void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Code& stub = Code::ZoneHandle( compiler->zone(), StubCode::GetAllocationStubForClass(cls())); @@ -6779,14 +6493,12 @@ void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Drop(ArgumentCount()); // Discard arguments. } - void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(!compiler->is_optimizing()); __ Call(*StubCode::DebugStepCheck_entry()); compiler->EmitCallsiteMetaData(token_pos(), deopt_id_, stub_kind_, locs()); } - } // namespace dart #undef __ diff --git a/runtime/vm/intermediate_language_test.cc b/runtime/vm/intermediate_language_test.cc index eae90affa5c..b6c885315f5 100644 --- a/runtime/vm/intermediate_language_test.cc +++ b/runtime/vm/intermediate_language_test.cc @@ -18,7 +18,6 @@ TEST_CASE(InstructionTests) { EXPECT(!context->IsBlockEntry()); } - TEST_CASE(OptimizationTests) { JoinEntryInstr* join = new JoinEntryInstr( 1, CatchClauseNode::kInvalidTryIndex, Thread::kNoDeoptId); @@ -40,5 +39,4 @@ TEST_CASE(OptimizationTests) { EXPECT(!c3->Equals(c1)); } - } // namespace dart diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc index 24ba11602f3..be66e18f678 100644 --- a/runtime/vm/intermediate_language_x64.cc +++ b/runtime/vm/intermediate_language_x64.cc @@ -34,7 +34,6 @@ LocationSummary* Instruction::MakeCallSummary(Zone* zone) { return result; } - LocationSummary* PushArgumentInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -45,7 +44,6 @@ LocationSummary* PushArgumentInstr::MakeLocationSummary(Zone* zone, return locs; } - void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // In SSA mode, we need an explicit push. Nothing to do in non-SSA mode // where PushArgument is handled by BindInstr::EmitNativeCode. @@ -62,7 +60,6 @@ void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* ReturnInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; const intptr_t kNumTemps = 0; @@ -72,7 +69,6 @@ LocationSummary* ReturnInstr::MakeLocationSummary(Zone* zone, bool opt) const { return locs; } - // Attempt optimized compilation at return instruction instead of at the entry. // The entry needs to be patchable, no inlined objects are allowed in the area // that will be overwritten by the patch instruction: a jump). @@ -107,7 +103,6 @@ void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ set_constant_pool_allowed(true); } - static Condition NegateCondition(Condition condition) { switch (condition) { case EQUAL: @@ -140,14 +135,12 @@ static Condition NegateCondition(Condition condition) { } } - // Detect pattern when one value is zero and another is a power of 2. static bool IsPowerOfTwoKind(intptr_t v1, intptr_t v2) { return (Utils::IsPowerOfTwo(v1) && (v2 == 0)) || (Utils::IsPowerOfTwo(v2) && (v1 == 0)); } - LocationSummary* IfThenElseInstr::MakeLocationSummary(Zone* zone, bool opt) const { comparison()->InitializeLocationSummary(zone, opt); @@ -156,7 +149,6 @@ LocationSummary* IfThenElseInstr::MakeLocationSummary(Zone* zone, return comparison()->locs(); } - void IfThenElseInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->out(0).reg() == RDX); @@ -208,7 +200,6 @@ void IfThenElseInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* LoadLocalInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -220,13 +211,11 @@ LocationSummary* LoadLocalInstr::MakeLocationSummary(Zone* zone, LocationSummary::kNoCall); } - void LoadLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(!compiler->is_optimizing()); // Nothing to do. } - LocationSummary* StoreLocalInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -234,7 +223,6 @@ LocationSummary* StoreLocalInstr::MakeLocationSummary(Zone* zone, LocationSummary::kNoCall); } - void StoreLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register value = locs()->in(0).reg(); Register result = locs()->out(0).reg(); @@ -242,7 +230,6 @@ void StoreLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ movq(Address(RBP, local().index() * kWordSize), value); } - LocationSummary* ConstantInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -253,7 +240,6 @@ LocationSummary* ConstantInstr::MakeLocationSummary(Zone* zone, LocationSummary::kNoCall); } - void ConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // The register allocator drops constant definitions that have no uses. Location out = locs()->out(0); @@ -264,7 +250,6 @@ void ConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* UnboxedConstantInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -285,7 +270,6 @@ LocationSummary* UnboxedConstantInstr::MakeLocationSummary(Zone* zone, return locs; } - void UnboxedConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // The register allocator drops constant definitions that have no uses. if (!locs()->out(0).IsInvalid()) { @@ -310,7 +294,6 @@ void UnboxedConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* AssertAssignableInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 3; @@ -324,7 +307,6 @@ LocationSummary* AssertAssignableInstr::MakeLocationSummary(Zone* zone, return summary; } - LocationSummary* AssertBooleanInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -336,7 +318,6 @@ LocationSummary* AssertBooleanInstr::MakeLocationSummary(Zone* zone, return locs; } - static void EmitAssertBoolean(Register reg, TokenPosition token_pos, intptr_t deopt_id, @@ -366,7 +347,6 @@ static void EmitAssertBoolean(Register reg, __ Bind(&done); } - void AssertBooleanInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register obj = locs()->in(0).reg(); Register result = locs()->out(0).reg(); @@ -375,7 +355,6 @@ void AssertBooleanInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(obj == result); } - static Condition TokenKindToIntCondition(Token::Kind kind) { switch (kind) { case Token::kEQ: @@ -396,7 +375,6 @@ static Condition TokenKindToIntCondition(Token::Kind kind) { } } - LocationSummary* EqualityCompareInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -436,7 +414,6 @@ LocationSummary* EqualityCompareInstr::MakeLocationSummary(Zone* zone, return NULL; } - static void LoadValueCid(FlowGraphCompiler* compiler, Register value_cid_reg, Register value_reg, @@ -455,7 +432,6 @@ static void LoadValueCid(FlowGraphCompiler* compiler, __ Bind(&done); } - static Condition FlipCondition(Condition condition) { switch (condition) { case EQUAL: @@ -484,7 +460,6 @@ static Condition FlipCondition(Condition condition) { } } - static void EmitBranchOnCondition(FlowGraphCompiler* compiler, Condition true_condition, BranchLabels labels) { @@ -503,7 +478,6 @@ static void EmitBranchOnCondition(FlowGraphCompiler* compiler, } } - static Condition EmitInt64ComparisonOp(FlowGraphCompiler* compiler, const LocationSummary& locs, Token::Kind kind) { @@ -526,7 +500,6 @@ static Condition EmitInt64ComparisonOp(FlowGraphCompiler* compiler, return true_condition; } - static Condition TokenKindToDoubleCondition(Token::Kind kind) { switch (kind) { case Token::kEQ: @@ -547,7 +520,6 @@ static Condition TokenKindToDoubleCondition(Token::Kind kind) { } } - static Condition EmitDoubleComparisonOp(FlowGraphCompiler* compiler, const LocationSummary& locs, Token::Kind kind, @@ -564,7 +536,6 @@ static Condition EmitDoubleComparisonOp(FlowGraphCompiler* compiler, return true_condition; } - Condition EqualityCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { if ((operation_cid() == kSmiCid) || (operation_cid() == kMintCid)) { @@ -575,7 +546,6 @@ Condition EqualityCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, } } - void ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Label is_true, is_false; BranchLabels labels = {&is_true, &is_false, &is_false}; @@ -594,7 +564,6 @@ void ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&done); } - void ComparisonInstr::EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch) { BranchLabels labels = compiler->CreateBranchLabels(branch); @@ -604,7 +573,6 @@ void ComparisonInstr::EmitBranchCode(FlowGraphCompiler* compiler, } } - LocationSummary* TestSmiInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; const intptr_t kNumTemps = 0; @@ -617,7 +585,6 @@ LocationSummary* TestSmiInstr::MakeLocationSummary(Zone* zone, bool opt) const { return locs; } - Condition TestSmiInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { Register left_reg = locs()->in(0).reg(); @@ -633,7 +600,6 @@ Condition TestSmiInstr::EmitComparisonCode(FlowGraphCompiler* compiler, return true_condition; } - LocationSummary* TestCidsInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -646,18 +612,16 @@ LocationSummary* TestCidsInstr::MakeLocationSummary(Zone* zone, return locs; } - Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { ASSERT((kind() == Token::kIS) || (kind() == Token::kISNOT)); Register val_reg = locs()->in(0).reg(); Register cid_reg = locs()->temp(0).reg(); - Label* deopt = - CanDeoptimize() - ? compiler->AddDeoptStub(deopt_id(), ICData::kDeoptTestCids, - licm_hoisted_ ? ICData::kHoisted : 0) - : NULL; + Label* deopt = CanDeoptimize() ? compiler->AddDeoptStub( + deopt_id(), ICData::kDeoptTestCids, + licm_hoisted_ ? ICData::kHoisted : 0) + : NULL; const intptr_t true_result = (kind() == Token::kIS) ? 1 : 0; const ZoneGrowableArray& data = cid_results(); @@ -690,7 +654,6 @@ Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler, return INVALID_CONDITION; } - LocationSummary* RelationalOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -723,7 +686,6 @@ LocationSummary* RelationalOpInstr::MakeLocationSummary(Zone* zone, return summary; } - Condition RelationalOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { if ((operation_cid() == kSmiCid) || (operation_cid() == kMintCid)) { @@ -734,13 +696,11 @@ Condition RelationalOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler, } } - LocationSummary* NativeCallInstr::MakeLocationSummary(Zone* zone, bool opt) const { return MakeCallSummary(zone); } - void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { SetupNative(); Register result = locs()->out(0).reg(); @@ -780,7 +740,6 @@ void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ popq(result); } - static bool CanBeImmediateIndex(Value* index, intptr_t cid) { if (!index->definition()->IsConstant()) return false; const Object& constant = index->definition()->AsConstant()->value(); @@ -792,7 +751,6 @@ static bool CanBeImmediateIndex(Value* index, intptr_t cid) { return Utils::IsInt(32, disp); } - LocationSummary* OneByteStringFromCharCodeInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -802,7 +760,6 @@ LocationSummary* OneByteStringFromCharCodeInstr::MakeLocationSummary( LocationSummary::kNoCall); } - void OneByteStringFromCharCodeInstr::EmitNativeCode( FlowGraphCompiler* compiler) { ASSERT(compiler->is_optimizing()); @@ -815,7 +772,6 @@ void OneByteStringFromCharCodeInstr::EmitNativeCode( Symbols::kNullCharCodeSymbolOffset * kWordSize)); } - LocationSummary* StringToCharCodeInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -823,7 +779,6 @@ LocationSummary* StringToCharCodeInstr::MakeLocationSummary(Zone* zone, LocationSummary::kNoCall); } - void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(cid_ == kOneByteStringCid); Register str = locs()->in(0).reg(); @@ -840,7 +795,6 @@ void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&done); } - LocationSummary* StringInterpolateInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -852,7 +806,6 @@ LocationSummary* StringInterpolateInstr::MakeLocationSummary(Zone* zone, return summary; } - void StringInterpolateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register array = locs()->in(0).reg(); __ pushq(array); @@ -865,7 +818,6 @@ void StringInterpolateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->out(0).reg() == RAX); } - LocationSummary* LoadUntaggedInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -873,7 +825,6 @@ LocationSummary* LoadUntaggedInstr::MakeLocationSummary(Zone* zone, LocationSummary::kNoCall); } - void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register obj = locs()->in(0).reg(); Register result = locs()->out(0).reg(); @@ -885,7 +836,6 @@ void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* LoadClassIdInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -893,7 +843,6 @@ LocationSummary* LoadClassIdInstr::MakeLocationSummary(Zone* zone, LocationSummary::kNoCall); } - void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register object = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); @@ -918,7 +867,6 @@ void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - CompileType LoadIndexedInstr::ComputeType() const { switch (class_id_) { case kArrayCid: @@ -959,7 +907,6 @@ CompileType LoadIndexedInstr::ComputeType() const { } } - Representation LoadIndexedInstr::representation() const { switch (class_id_) { case kArrayCid: @@ -997,7 +944,6 @@ Representation LoadIndexedInstr::representation() const { } } - LocationSummary* LoadIndexedInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -1029,7 +975,6 @@ LocationSummary* LoadIndexedInstr::MakeLocationSummary(Zone* zone, return locs; } - void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // The array register points to the backing store for external arrays. const Register array = locs()->in(0).reg(); @@ -1134,7 +1079,6 @@ void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -1150,7 +1094,6 @@ LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Zone* zone, return summary; } - void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // The string register points to the backing store for external strings. const Register str = locs()->in(0).reg(); @@ -1201,7 +1144,6 @@ void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - Representation StoreIndexedInstr::RequiredInputRepresentation( intptr_t idx) const { if (idx == 0) return kNoRepresentation; @@ -1239,7 +1181,6 @@ Representation StoreIndexedInstr::RequiredInputRepresentation( } } - LocationSummary* StoreIndexedInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 3; @@ -1303,7 +1244,6 @@ LocationSummary* StoreIndexedInstr::MakeLocationSummary(Zone* zone, return locs; } - void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // The array register points to the backing store for external arrays. const Register array = locs()->in(0).reg(); @@ -1410,7 +1350,6 @@ void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* GuardFieldClassInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -1439,11 +1378,9 @@ LocationSummary* GuardFieldClassInstr::MakeLocationSummary(Zone* zone, summary->set_temp(i, Location::RequiresRegister()); } - return summary; } - void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(sizeof(classid_t) == kInt16Size); const intptr_t value_cid = value()->Type()->ToCid(); @@ -1575,7 +1512,6 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&ok); } - LocationSummary* GuardFieldLengthInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -1598,7 +1534,6 @@ LocationSummary* GuardFieldLengthInstr::MakeLocationSummary(Zone* zone, UNREACHABLE(); } - void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (field().guarded_list_length() == Field::kNoFixedLength) { if (Compiler::IsBackgroundCompilation()) { @@ -1669,7 +1604,6 @@ void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - class BoxAllocationSlowPath : public SlowPathCode { public: BoxAllocationSlowPath(Instruction* instruction, @@ -1725,7 +1659,6 @@ class BoxAllocationSlowPath : public SlowPathCode { const Register result_; }; - LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -1758,7 +1691,6 @@ LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Zone* zone, return summary; } - static void EnsureMutableBox(FlowGraphCompiler* compiler, StoreInstanceFieldInstr* instruction, Register box_reg, @@ -1777,7 +1709,6 @@ static void EnsureMutableBox(FlowGraphCompiler* compiler, __ Bind(&done); } - void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(sizeof(classid_t) == kInt16Size); Label skip_store; @@ -1929,7 +1860,6 @@ void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&skip_store); } - LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -1941,7 +1871,6 @@ LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone, return summary; } - // When the parser is building an implicit static getter for optimization, // it can generate a function body where deoptimization ids do not line up // with the unoptimized code. @@ -1953,7 +1882,6 @@ void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ movq(result, FieldAddress(field, Field::static_value_offset())); } - LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { LocationSummary* locs = @@ -1964,7 +1892,6 @@ LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(Zone* zone, return locs; } - void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register value = locs()->in(0).reg(); Register temp = locs()->temp(0).reg(); @@ -1979,7 +1906,6 @@ void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* InstanceOfInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 3; @@ -1993,7 +1919,6 @@ LocationSummary* InstanceOfInstr::MakeLocationSummary(Zone* zone, return summary; } - void InstanceOfInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->in(0).reg() == RAX); // Value. ASSERT(locs()->in(1).reg() == RDX); // Instantiator type arguments. @@ -2003,7 +1928,6 @@ void InstanceOfInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->out(0).reg() == RAX); } - // TODO(srdjan): In case of constant inputs make CreateArray kNoCall and // use slow path stub. LocationSummary* CreateArrayInstr::MakeLocationSummary(Zone* zone, @@ -2018,7 +1942,6 @@ LocationSummary* CreateArrayInstr::MakeLocationSummary(Zone* zone, return locs; } - // Inlines array allocation for known constant values. static void InlineArrayAllocation(FlowGraphCompiler* compiler, intptr_t num_elements, @@ -2070,7 +1993,6 @@ static void InlineArrayAllocation(FlowGraphCompiler* compiler, __ jmp(done, Assembler::kNearJump); } - void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // Allocate the array. R10 = length, RBX = element type. const Register kLengthReg = R10; @@ -2111,16 +2033,15 @@ void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->out(0).reg() == kResultReg); } - LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; const intptr_t kNumTemps = (IsUnboxedLoad() && opt) ? 1 : ((IsPotentialUnboxedLoad()) ? 2 : 0); LocationSummary* locs = new (zone) LocationSummary( - zone, kNumInputs, kNumTemps, (opt && !IsPotentialUnboxedLoad()) - ? LocationSummary::kNoCall - : LocationSummary::kCallOnSlowPath); + zone, kNumInputs, kNumTemps, + (opt && !IsPotentialUnboxedLoad()) ? LocationSummary::kNoCall + : LocationSummary::kCallOnSlowPath); locs->set_in(0, Location::RequiresRegister()); @@ -2135,7 +2056,6 @@ LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, return locs; } - void LoadFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(sizeof(classid_t) == kInt16Size); Register instance_reg = locs()->in(0).reg(); @@ -2234,7 +2154,6 @@ void LoadFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&done); } - LocationSummary* InstantiateTypeInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -2247,7 +2166,6 @@ LocationSummary* InstantiateTypeInstr::MakeLocationSummary(Zone* zone, return locs; } - void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register instantiator_type_args_reg = locs()->in(0).reg(); Register function_type_args_reg = locs()->in(1).reg(); @@ -2266,7 +2184,6 @@ void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ popq(result_reg); // Pop instantiated type. } - LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -2280,7 +2197,6 @@ LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary( return locs; } - void InstantiateTypeArgumentsInstr::EmitNativeCode( FlowGraphCompiler* compiler) { Register instantiator_type_args_reg = locs()->in(0).reg(); @@ -2348,7 +2264,6 @@ void InstantiateTypeArgumentsInstr::EmitNativeCode( __ Bind(&type_arguments_instantiated); } - LocationSummary* AllocateUninitializedContextInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -2363,7 +2278,6 @@ LocationSummary* AllocateUninitializedContextInstr::MakeLocationSummary( return locs; } - class AllocateContextSlowPath : public SlowPathCode { public: explicit AllocateContextSlowPath( @@ -2395,7 +2309,6 @@ class AllocateContextSlowPath : public SlowPathCode { AllocateUninitializedContextInstr* instruction_; }; - void AllocateUninitializedContextInstr::EmitNativeCode( FlowGraphCompiler* compiler) { ASSERT(compiler->is_optimizing()); @@ -2419,7 +2332,6 @@ void AllocateUninitializedContextInstr::EmitNativeCode( __ Bind(slow_path->exit_label()); } - LocationSummary* AllocateContextInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -2431,7 +2343,6 @@ LocationSummary* AllocateContextInstr::MakeLocationSummary(Zone* zone, return locs; } - void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->temp(0).reg() == R10); ASSERT(locs()->out(0).reg() == RAX); @@ -2441,7 +2352,6 @@ void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { RawPcDescriptors::kOther, locs()); } - LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -2453,7 +2363,6 @@ LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone, return locs; } - void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register field = locs()->in(0).reg(); Register temp = locs()->temp(0).reg(); @@ -2476,7 +2385,6 @@ void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&no_call); } - LocationSummary* CloneContextInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -2488,7 +2396,6 @@ LocationSummary* CloneContextInstr::MakeLocationSummary(Zone* zone, return locs; } - void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register context_value = locs()->in(0).reg(); Register result = locs()->out(0).reg(); @@ -2501,14 +2408,12 @@ void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ popq(result); // Get result (cloned context). } - LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Zone* zone, bool opt) const { UNREACHABLE(); return NULL; } - void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(compiler->GetJumpLabel(this)); compiler->AddExceptionHandler(catch_try_index(), try_index(), @@ -2581,7 +2486,6 @@ void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -2592,7 +2496,6 @@ LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Zone* zone, return summary; } - class CheckStackOverflowSlowPath : public SlowPathCode { public: explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) @@ -2629,7 +2532,6 @@ class CheckStackOverflowSlowPath : public SlowPathCode { __ jmp(exit_label()); } - Label* osr_entry_label() { ASSERT(Isolate::Current()->use_osr()); return &osr_entry_label_; @@ -2640,7 +2542,6 @@ class CheckStackOverflowSlowPath : public SlowPathCode { Label osr_entry_label_; }; - void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); compiler->AddSlowPathCode(slow_path); @@ -2666,7 +2567,6 @@ void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(slow_path->exit_label()); } - static void EmitSmiShiftLeft(FlowGraphCompiler* compiler, BinarySmiOpInstr* shift_left) { const LocationSummary& locs = *shift_left->locs(); @@ -2780,7 +2680,6 @@ static void EmitSmiShiftLeft(FlowGraphCompiler* compiler, } } - class CheckedSmiSlowPath : public SlowPathCode { public: CheckedSmiSlowPath(CheckedSmiOpInstr* instruction, intptr_t try_index) @@ -2822,7 +2721,6 @@ class CheckedSmiSlowPath : public SlowPathCode { intptr_t try_index_; }; - LocationSummary* CheckedSmiOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { bool is_shift = (op_kind() == Token::kSHL) || (op_kind() == Token::kSHR); @@ -2854,7 +2752,6 @@ LocationSummary* CheckedSmiOpInstr::MakeLocationSummary(Zone* zone, return summary; } - void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { CheckedSmiSlowPath* slow_path = new CheckedSmiSlowPath(this, compiler->CurrentTryIndex()); @@ -2943,7 +2840,6 @@ void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(slow_path->exit_label()); } - class CheckedSmiComparisonSlowPath : public SlowPathCode { public: CheckedSmiComparisonSlowPath(CheckedSmiComparisonInstr* instruction, @@ -3001,7 +2897,6 @@ class CheckedSmiComparisonSlowPath : public SlowPathCode { bool merged_; }; - LocationSummary* CheckedSmiComparisonInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -3016,14 +2911,12 @@ LocationSummary* CheckedSmiComparisonInstr::MakeLocationSummary( return summary; } - Condition CheckedSmiComparisonInstr::EmitComparisonCode( FlowGraphCompiler* compiler, BranchLabels labels) { return EmitInt64ComparisonOp(compiler, *locs(), kind()); } - #define EMIT_SMI_CHECK \ intptr_t left_cid = left()->Type()->ToCid(); \ intptr_t right_cid = right()->Type()->ToCid(); \ @@ -3042,7 +2935,6 @@ Condition CheckedSmiComparisonInstr::EmitComparisonCode( } \ __ j(NOT_ZERO, slow_path->entry_label()) - void CheckedSmiComparisonInstr::EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch) { BranchLabels labels = compiler->CreateBranchLabels(branch); @@ -3057,7 +2949,6 @@ void CheckedSmiComparisonInstr::EmitBranchCode(FlowGraphCompiler* compiler, __ Bind(slow_path->exit_label()); } - void CheckedSmiComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Label true_label, false_label, done; BranchLabels labels = {&true_label, &false_label, &false_label}; @@ -3079,7 +2970,6 @@ void CheckedSmiComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(slow_path->exit_label()); } - static bool CanBeImmediate(const Object& constant) { return constant.IsSmi() && Immediate(reinterpret_cast(constant.raw())).is_int32(); @@ -3089,7 +2979,6 @@ static bool IsSmiValue(const Object& constant, intptr_t value) { return constant.IsSmi() && (Smi::Cast(constant).Value() == value); } - LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -3264,7 +3153,6 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { return; } // locs()->in(1).IsConstant(). - if (locs()->in(1).IsStackSlot()) { const Address& right = locs()->in(1).ToStackSlotAddress(); switch (op_kind()) { @@ -3499,7 +3387,6 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary(Zone* zone, bool opt) const { intptr_t left_cid = left()->Type()->ToCid(); @@ -3517,7 +3404,6 @@ LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary(Zone* zone, return summary; } - void CheckEitherNonSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinaryDoubleOp, @@ -3541,7 +3427,6 @@ void CheckEitherNonSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ j(ZERO, deopt); } - LocationSummary* BoxInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; const intptr_t kNumTemps = 1; @@ -3553,7 +3438,6 @@ LocationSummary* BoxInstr::MakeLocationSummary(Zone* zone, bool opt) const { return summary; } - void BoxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register out_reg = locs()->out(0).reg(); Register temp = locs()->temp(0).reg(); @@ -3578,7 +3462,6 @@ void BoxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* UnboxInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; const intptr_t kNumTemps = 0; @@ -3597,7 +3480,6 @@ LocationSummary* UnboxInstr::MakeLocationSummary(Zone* zone, bool opt) const { return summary; } - void UnboxInstr::EmitLoadFromBox(FlowGraphCompiler* compiler) { const Register box = locs()->in(0).reg(); @@ -3628,7 +3510,6 @@ void UnboxInstr::EmitLoadFromBox(FlowGraphCompiler* compiler) { } } - void UnboxInstr::EmitSmiConversion(FlowGraphCompiler* compiler) { const Register box = locs()->in(0).reg(); @@ -3653,7 +3534,6 @@ void UnboxInstr::EmitSmiConversion(FlowGraphCompiler* compiler) { } } - void UnboxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const intptr_t value_cid = value()->Type()->ToCid(); const intptr_t box_cid = BoxCid(); @@ -3691,7 +3571,6 @@ void UnboxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* UnboxInteger32Instr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -3706,14 +3585,12 @@ LocationSummary* UnboxInteger32Instr::MakeLocationSummary(Zone* zone, return summary; } - void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) { const intptr_t value_cid = value()->Type()->ToCid(); const Register value = locs()->in(0).reg(); - Label* deopt = - CanDeoptimize() - ? compiler->AddDeoptStub(GetDeoptId(), ICData::kDeoptUnboxInteger) - : NULL; + Label* deopt = CanDeoptimize() ? compiler->AddDeoptStub( + GetDeoptId(), ICData::kDeoptUnboxInteger) + : NULL; ASSERT(value == locs()->out(0).reg()); if (value_cid == kSmiCid) { @@ -3752,7 +3629,6 @@ void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* BoxInteger32Instr::MakeLocationSummary(Zone* zone, bool opt) const { ASSERT((from_representation() == kUnboxedInt32) || @@ -3766,7 +3642,6 @@ LocationSummary* BoxInteger32Instr::MakeLocationSummary(Zone* zone, return summary; } - void BoxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register value = locs()->in(0).reg(); const Register out = locs()->out(0).reg(); @@ -3782,7 +3657,6 @@ void BoxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) { __ SmiTag(out); } - LocationSummary* BoxInt64Instr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -3799,7 +3673,6 @@ LocationSummary* BoxInt64Instr::MakeLocationSummary(Zone* zone, return summary; } - void BoxInt64Instr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register out = locs()->out(0).reg(); const Register value = locs()->in(0).reg(); @@ -3816,7 +3689,6 @@ void BoxInt64Instr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -3829,7 +3701,6 @@ LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary(Zone* zone, return summary; } - void BinaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); XmmRegister right = locs()->in(1).fpu_reg(); @@ -3854,7 +3725,6 @@ void BinaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* DoubleTestOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -3870,7 +3740,6 @@ LocationSummary* DoubleTestOpInstr::MakeLocationSummary(Zone* zone, return summary; } - Condition DoubleTestOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { ASSERT(compiler->is_optimizing()); @@ -3895,7 +3764,6 @@ Condition DoubleTestOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler, } } - LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -3908,7 +3776,6 @@ LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone, return summary; } - void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); XmmRegister right = locs()->in(1).fpu_reg(); @@ -3933,7 +3800,6 @@ void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* BinaryFloat64x2OpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -3946,7 +3812,6 @@ LocationSummary* BinaryFloat64x2OpInstr::MakeLocationSummary(Zone* zone, return summary; } - void BinaryFloat64x2OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); XmmRegister right = locs()->in(1).fpu_reg(); @@ -3971,7 +3836,6 @@ void BinaryFloat64x2OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Simd32x4ShuffleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -3983,7 +3847,6 @@ LocationSummary* Simd32x4ShuffleInstr::MakeLocationSummary(Zone* zone, return summary; } - void Simd32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister value = locs()->in(0).fpu_reg(); @@ -4015,7 +3878,6 @@ void Simd32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Simd32x4ShuffleMixInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4028,7 +3890,6 @@ LocationSummary* Simd32x4ShuffleMixInstr::MakeLocationSummary(Zone* zone, return summary; } - void Simd32x4ShuffleMixInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); XmmRegister right = locs()->in(1).fpu_reg(); @@ -4044,7 +3905,6 @@ void Simd32x4ShuffleMixInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4056,7 +3916,6 @@ LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary(Zone* zone, return summary; } - void Simd32x4GetSignMaskInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister value = locs()->in(0).fpu_reg(); Register out = locs()->out(0).reg(); @@ -4065,7 +3924,6 @@ void Simd32x4GetSignMaskInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ SmiTag(out); } - LocationSummary* Float32x4ConstructorInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -4081,7 +3939,6 @@ LocationSummary* Float32x4ConstructorInstr::MakeLocationSummary( return summary; } - void Float32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister v0 = locs()->in(0).fpu_reg(); XmmRegister v1 = locs()->in(1).fpu_reg(); @@ -4104,7 +3961,6 @@ void Float32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ AddImmediate(RSP, Immediate(16)); } - LocationSummary* Float32x4ZeroInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -4115,13 +3971,11 @@ LocationSummary* Float32x4ZeroInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister value = locs()->out(0).fpu_reg(); __ xorps(value, value); } - LocationSummary* Float32x4SplatInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4133,7 +3987,6 @@ LocationSummary* Float32x4SplatInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister value = locs()->out(0).fpu_reg(); ASSERT(locs()->in(0).fpu_reg() == locs()->out(0).fpu_reg()); @@ -4143,7 +3996,6 @@ void Float32x4SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ shufps(value, value, Immediate(0x00)); } - LocationSummary* Float32x4ComparisonInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4156,7 +4008,6 @@ LocationSummary* Float32x4ComparisonInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); XmmRegister right = locs()->in(1).fpu_reg(); @@ -4188,7 +4039,6 @@ void Float32x4ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float32x4MinMaxInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4201,7 +4051,6 @@ LocationSummary* Float32x4MinMaxInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4MinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); XmmRegister right = locs()->in(1).fpu_reg(); @@ -4220,7 +4069,6 @@ void Float32x4MinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float32x4ScaleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4233,7 +4081,6 @@ LocationSummary* Float32x4ScaleInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4ScaleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); XmmRegister right = locs()->in(1).fpu_reg(); @@ -4251,7 +4098,6 @@ void Float32x4ScaleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float32x4SqrtInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4263,7 +4109,6 @@ LocationSummary* Float32x4SqrtInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4SqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); @@ -4284,7 +4129,6 @@ void Float32x4SqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float32x4ZeroArgInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4296,7 +4140,6 @@ LocationSummary* Float32x4ZeroArgInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); @@ -4313,7 +4156,6 @@ void Float32x4ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float32x4ClampInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 3; @@ -4327,7 +4169,6 @@ LocationSummary* Float32x4ClampInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4ClampInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); XmmRegister lower = locs()->in(1).fpu_reg(); @@ -4337,7 +4178,6 @@ void Float32x4ClampInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ maxps(left, lower); } - LocationSummary* Float32x4WithInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4350,7 +4190,6 @@ LocationSummary* Float32x4WithInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4WithInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister replacement = locs()->in(0).fpu_reg(); XmmRegister value = locs()->in(1).fpu_reg(); @@ -4407,7 +4246,6 @@ void Float32x4WithInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float32x4ToInt32x4Instr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4419,12 +4257,10 @@ LocationSummary* Float32x4ToInt32x4Instr::MakeLocationSummary(Zone* zone, return summary; } - void Float32x4ToInt32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { // NOP. } - LocationSummary* Simd64x2ShuffleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4436,7 +4272,6 @@ LocationSummary* Simd64x2ShuffleInstr::MakeLocationSummary(Zone* zone, return summary; } - void Simd64x2ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister value = locs()->in(0).fpu_reg(); @@ -4453,7 +4288,6 @@ void Simd64x2ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float64x2ZeroInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 0; @@ -4464,13 +4298,11 @@ LocationSummary* Float64x2ZeroInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float64x2ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister value = locs()->out(0).fpu_reg(); __ xorpd(value, value); } - LocationSummary* Float64x2SplatInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4482,13 +4314,11 @@ LocationSummary* Float64x2SplatInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float64x2SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister value = locs()->out(0).fpu_reg(); __ shufpd(value, value, Immediate(0x0)); } - LocationSummary* Float64x2ConstructorInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -4502,7 +4332,6 @@ LocationSummary* Float64x2ConstructorInstr::MakeLocationSummary( return summary; } - void Float64x2ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister v0 = locs()->in(0).fpu_reg(); XmmRegister v1 = locs()->in(1).fpu_reg(); @@ -4513,7 +4342,6 @@ void Float64x2ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ shufpd(v0, v1, Immediate(0x0)); } - LocationSummary* Float64x2ToFloat32x4Instr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -4526,13 +4354,11 @@ LocationSummary* Float64x2ToFloat32x4Instr::MakeLocationSummary( return summary; } - void Float64x2ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister value = locs()->out(0).fpu_reg(); __ cvtpd2ps(value, value); } - LocationSummary* Float32x4ToFloat64x2Instr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -4545,13 +4371,11 @@ LocationSummary* Float32x4ToFloat64x2Instr::MakeLocationSummary( return summary; } - void Float32x4ToFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister value = locs()->out(0).fpu_reg(); __ cvtps2pd(value, value); } - LocationSummary* Float64x2ZeroArgInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4569,7 +4393,6 @@ LocationSummary* Float64x2ZeroArgInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float64x2ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); @@ -4595,7 +4418,6 @@ void Float64x2ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Float64x2OneArgInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4608,7 +4430,6 @@ LocationSummary* Float64x2OneArgInstr::MakeLocationSummary(Zone* zone, return summary; } - void Float64x2OneArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); XmmRegister right = locs()->in(1).fpu_reg(); @@ -4650,7 +4471,6 @@ void Float64x2OneArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Int32x4ConstructorInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 4; @@ -4665,7 +4485,6 @@ LocationSummary* Int32x4ConstructorInstr::MakeLocationSummary(Zone* zone, return summary; } - void Int32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register v0 = locs()->in(0).reg(); Register v1 = locs()->in(1).reg(); @@ -4681,7 +4500,6 @@ void Int32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ AddImmediate(RSP, Immediate(4 * kInt32Size)); } - LocationSummary* Int32x4BoolConstructorInstr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -4698,7 +4516,6 @@ LocationSummary* Int32x4BoolConstructorInstr::MakeLocationSummary( return summary; } - void Int32x4BoolConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register v0 = locs()->in(0).reg(); Register v1 = locs()->in(1).reg(); @@ -4752,7 +4569,6 @@ void Int32x4BoolConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ AddImmediate(RSP, Immediate(16)); } - LocationSummary* Int32x4GetFlagInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4764,7 +4580,6 @@ LocationSummary* Int32x4GetFlagInstr::MakeLocationSummary(Zone* zone, return summary; } - void Int32x4GetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister value = locs()->in(0).fpu_reg(); Register result = locs()->out(0).reg(); @@ -4799,7 +4614,6 @@ void Int32x4GetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&done); } - LocationSummary* Int32x4SelectInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 3; @@ -4814,7 +4628,6 @@ LocationSummary* Int32x4SelectInstr::MakeLocationSummary(Zone* zone, return summary; } - void Int32x4SelectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister mask = locs()->in(0).fpu_reg(); XmmRegister trueValue = locs()->in(1).fpu_reg(); @@ -4834,7 +4647,6 @@ void Int32x4SelectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ orps(mask, temp); } - LocationSummary* Int32x4SetFlagInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4848,7 +4660,6 @@ LocationSummary* Int32x4SetFlagInstr::MakeLocationSummary(Zone* zone, return summary; } - void Int32x4SetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister mask = locs()->in(0).fpu_reg(); Register flag = locs()->in(1).reg(); @@ -4902,7 +4713,6 @@ void Int32x4SetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ AddImmediate(RSP, Immediate(16)); } - LocationSummary* Int32x4ToFloat32x4Instr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -4914,12 +4724,10 @@ LocationSummary* Int32x4ToFloat32x4Instr::MakeLocationSummary(Zone* zone, return summary; } - void Int32x4ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { // NOP. } - LocationSummary* BinaryInt32x4OpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -4932,7 +4740,6 @@ LocationSummary* BinaryInt32x4OpInstr::MakeLocationSummary(Zone* zone, return summary; } - void BinaryInt32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister left = locs()->in(0).fpu_reg(); XmmRegister right = locs()->in(1).fpu_reg(); @@ -4961,7 +4768,6 @@ void BinaryInt32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* MathUnaryInstr::MakeLocationSummary(Zone* zone, bool opt) const { ASSERT((kind() == MathUnaryInstr::kSqrt) || @@ -4979,7 +4785,6 @@ LocationSummary* MathUnaryInstr::MakeLocationSummary(Zone* zone, return summary; } - void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (kind() == MathUnaryInstr::kSqrt) { __ sqrtsd(locs()->out(0).fpu_reg(), locs()->in(0).fpu_reg()); @@ -4992,7 +4797,6 @@ void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary( Zone* zone, bool opt) const { @@ -5007,7 +4811,6 @@ LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary( return summary; } - void CaseInsensitiveCompareUC16Instr::EmitNativeCode( FlowGraphCompiler* compiler) { // Save RSP. R13 is chosen because it is callee saved so we do not need to @@ -5023,7 +4826,6 @@ void CaseInsensitiveCompareUC16Instr::EmitNativeCode( __ movq(RSP, kSavedSPReg); } - LocationSummary* UnarySmiOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5031,7 +4833,6 @@ LocationSummary* UnarySmiOpInstr::MakeLocationSummary(Zone* zone, LocationSummary::kNoCall); } - void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register value = locs()->in(0).reg(); ASSERT(value == locs()->out(0).reg()); @@ -5052,7 +4853,6 @@ void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* UnaryDoubleOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5064,14 +4864,12 @@ LocationSummary* UnaryDoubleOpInstr::MakeLocationSummary(Zone* zone, return summary; } - void UnaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister value = locs()->in(0).fpu_reg(); ASSERT(locs()->out(0).fpu_reg() == value); __ DoubleNegate(value); } - LocationSummary* MathMinMaxInstr::MakeLocationSummary(Zone* zone, bool opt) const { if (result_cid() == kDoubleCid) { @@ -5098,7 +4896,6 @@ LocationSummary* MathMinMaxInstr::MakeLocationSummary(Zone* zone, return summary; } - void MathMinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT((op_kind() == MethodRecognizer::kMathMin) || (op_kind() == MethodRecognizer::kMathMax)); @@ -5161,7 +4958,6 @@ void MathMinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* Int32ToDoubleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5173,14 +4969,12 @@ LocationSummary* Int32ToDoubleInstr::MakeLocationSummary(Zone* zone, return result; } - void Int32ToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register value = locs()->in(0).reg(); FpuRegister result = locs()->out(0).fpu_reg(); __ cvtsi2sdl(result, value); } - LocationSummary* SmiToDoubleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5192,7 +4986,6 @@ LocationSummary* SmiToDoubleInstr::MakeLocationSummary(Zone* zone, return result; } - void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register value = locs()->in(0).reg(); FpuRegister result = locs()->out(0).fpu_reg(); @@ -5200,19 +4993,16 @@ void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ cvtsi2sdq(result, value); } - LocationSummary* MintToDoubleInstr::MakeLocationSummary(Zone* zone, bool opt) const { UNIMPLEMENTED(); return NULL; } - void MintToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } - LocationSummary* DoubleToIntegerInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5225,7 +5015,6 @@ LocationSummary* DoubleToIntegerInstr::MakeLocationSummary(Zone* zone, return result; } - void DoubleToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register result = locs()->out(0).reg(); Register value_obj = locs()->in(0).reg(); @@ -5259,7 +5048,6 @@ void DoubleToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&done); } - LocationSummary* DoubleToSmiInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5272,7 +5060,6 @@ LocationSummary* DoubleToSmiInstr::MakeLocationSummary(Zone* zone, return result; } - void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptDoubleToSmi); Register result = locs()->out(0).reg(); @@ -5289,7 +5076,6 @@ void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ SmiTag(result); } - LocationSummary* DoubleToDoubleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5301,7 +5087,6 @@ LocationSummary* DoubleToDoubleInstr::MakeLocationSummary(Zone* zone, return result; } - void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { XmmRegister value = locs()->in(0).fpu_reg(); XmmRegister result = locs()->out(0).fpu_reg(); @@ -5320,7 +5105,6 @@ void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* DoubleToFloatInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5332,12 +5116,10 @@ LocationSummary* DoubleToFloatInstr::MakeLocationSummary(Zone* zone, return result; } - void DoubleToFloatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ cvtsd2ss(locs()->out(0).fpu_reg(), locs()->in(0).fpu_reg()); } - LocationSummary* FloatToDoubleInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5349,12 +5131,10 @@ LocationSummary* FloatToDoubleInstr::MakeLocationSummary(Zone* zone, return result; } - void FloatToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ cvtss2sd(locs()->out(0).fpu_reg(), locs()->in(0).fpu_reg()); } - LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(Zone* zone, bool opt) const { // Calling convention on x64 uses XMM0 and XMM1 to pass the first two @@ -5384,7 +5164,6 @@ LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(Zone* zone, return result; } - // Pseudo code: // if (exponent == 0.0) return 1.0; // // Speed up simple cases. @@ -5517,7 +5296,6 @@ static void InvokeDoublePow(FlowGraphCompiler* compiler, __ Bind(&skip_call); } - void InvokeMathCFunctionInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (recognized_kind() == MethodRecognizer::kMathDoublePow) { InvokeDoublePow(compiler, this); @@ -5537,7 +5315,6 @@ void InvokeMathCFunctionInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ movq(RSP, locs()->temp(kSavedSpTempIndex).reg()); } - LocationSummary* ExtractNthOutputInstr::MakeLocationSummary(Zone* zone, bool opt) const { // Only use this instruction in optimized code. @@ -5570,7 +5347,6 @@ LocationSummary* ExtractNthOutputInstr::MakeLocationSummary(Zone* zone, return summary; } - void ExtractNthOutputInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(locs()->in(0).IsPairLocation()); PairLocation* pair = locs()->in(0).AsPairLocation(); @@ -5587,7 +5363,6 @@ void ExtractNthOutputInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* TruncDivModInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -5602,7 +5377,6 @@ LocationSummary* TruncDivModInstr::MakeLocationSummary(Zone* zone, return summary; } - void TruncDivModInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(CanDeoptimize()); Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinarySmiOp); @@ -5692,14 +5466,12 @@ void TruncDivModInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // in-range arguments, cannot create out-of-range result. } - LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary( Zone* zone, bool opt) const { return MakeCallSummary(zone); } - LocationSummary* BranchInstr::MakeLocationSummary(Zone* zone, bool opt) const { comparison()->InitializeLocationSummary(zone, opt); // Branches don't produce a result. @@ -5707,12 +5479,10 @@ LocationSummary* BranchInstr::MakeLocationSummary(Zone* zone, bool opt) const { return comparison()->locs(); } - void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) { comparison()->EmitBranchCode(compiler, this); } - LocationSummary* CheckClassInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5730,14 +5500,12 @@ LocationSummary* CheckClassInstr::MakeLocationSummary(Zone* zone, return summary; } - void CheckClassInstr::EmitNullCheck(FlowGraphCompiler* compiler, Label* deopt) { __ CompareObject(locs()->in(0).reg(), Object::null_object()); Condition cond = IsDeoptIfNull() ? EQUAL : NOT_EQUAL; __ j(cond, deopt); } - void CheckClassInstr::EmitBitTest(FlowGraphCompiler* compiler, intptr_t min, intptr_t max, @@ -5754,7 +5522,6 @@ void CheckClassInstr::EmitBitTest(FlowGraphCompiler* compiler, __ j(NOT_CARRY, deopt); } - int CheckClassInstr::EmitCheckCid(FlowGraphCompiler* compiler, int bias, intptr_t cid_start, @@ -5791,7 +5558,6 @@ int CheckClassInstr::EmitCheckCid(FlowGraphCompiler* compiler, return bias; } - LocationSummary* CheckSmiInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5802,7 +5568,6 @@ LocationSummary* CheckSmiInstr::MakeLocationSummary(Zone* zone, return summary; } - void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register value = locs()->in(0).reg(); Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckSmi, @@ -5810,7 +5575,6 @@ void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ BranchIfNotSmi(value, deopt); } - LocationSummary* CheckClassIdInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -5822,7 +5586,6 @@ LocationSummary* CheckClassIdInstr::MakeLocationSummary(Zone* zone, return summary; } - void CheckClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register value = locs()->in(0).reg(); Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckClass); @@ -5836,7 +5599,6 @@ void CheckClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* GenericCheckBoundInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -5848,7 +5610,6 @@ LocationSummary* GenericCheckBoundInstr::MakeLocationSummary(Zone* zone, return locs; } - class RangeErrorSlowPath : public SlowPathCode { public: RangeErrorSlowPath(GenericCheckBoundInstr* instruction, intptr_t try_index) @@ -5878,7 +5639,6 @@ class RangeErrorSlowPath : public SlowPathCode { intptr_t try_index_; }; - void GenericCheckBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { RangeErrorSlowPath* slow_path = new RangeErrorSlowPath(this, compiler->CurrentTryIndex()); @@ -5895,7 +5655,6 @@ void GenericCheckBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ j(ABOVE_EQUAL, slow_path->entry_label()); } - LocationSummary* CheckArrayBoundInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -5907,7 +5666,6 @@ LocationSummary* CheckArrayBoundInstr::MakeLocationSummary(Zone* zone, return locs; } - void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { uint32_t flags = generalized_ ? ICData::kGeneralized : 0; flags |= licm_hoisted_ ? ICData::kHoisted : 0; @@ -5959,7 +5717,6 @@ void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - template static void EmitInt64Arithmetic(FlowGraphCompiler* compiler, Token::Kind op_kind, @@ -5991,7 +5748,6 @@ static void EmitInt64Arithmetic(FlowGraphCompiler* compiler, if (deopt != NULL) __ j(OVERFLOW, deopt); } - LocationSummary* BinaryMintOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -6004,7 +5760,6 @@ LocationSummary* BinaryMintOpInstr::MakeLocationSummary(Zone* zone, return summary; } - void BinaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register left = locs()->in(0).reg(); const Register right = locs()->in(1).reg(); @@ -6020,7 +5775,6 @@ void BinaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { EmitInt64Arithmetic(compiler, op_kind(), left, right, deopt); } - LocationSummary* UnaryMintOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -6032,7 +5786,6 @@ LocationSummary* UnaryMintOpInstr::MakeLocationSummary(Zone* zone, return summary; } - void UnaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(op_kind() == Token::kBIT_NOT); const Register left = locs()->in(0).reg(); @@ -6041,7 +5794,6 @@ void UnaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ notq(left); } - LocationSummary* ShiftMintOpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -6057,7 +5809,6 @@ LocationSummary* ShiftMintOpInstr::MakeLocationSummary(Zone* zone, return summary; } - void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register left = locs()->in(0).reg(); const Register out = locs()->out(0).reg(); @@ -6130,22 +5881,18 @@ void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - CompileType BinaryUint32OpInstr::ComputeType() const { return CompileType::FromCid(kSmiCid); } - CompileType ShiftUint32OpInstr::ComputeType() const { return CompileType::FromCid(kSmiCid); } - CompileType UnaryUint32OpInstr::ComputeType() const { return CompileType::FromCid(kSmiCid); } - LocationSummary* BinaryUint32OpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -6158,7 +5905,6 @@ LocationSummary* BinaryUint32OpInstr::MakeLocationSummary(Zone* zone, return summary; } - template static void EmitIntegerArithmetic(FlowGraphCompiler* compiler, Token::Kind op_kind, @@ -6190,7 +5936,6 @@ static void EmitIntegerArithmetic(FlowGraphCompiler* compiler, if (deopt != NULL) __ j(OVERFLOW, deopt); } - void BinaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register left = locs()->in(0).reg(); Register right = locs()->in(1).reg(); @@ -6210,7 +5955,6 @@ void BinaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* ShiftUint32OpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; @@ -6223,7 +5967,6 @@ LocationSummary* ShiftUint32OpInstr::MakeLocationSummary(Zone* zone, return summary; } - void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const intptr_t kShifterLimit = 31; @@ -6231,7 +5974,6 @@ void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register out = locs()->out(0).reg(); ASSERT(left == out); - Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinaryMintOp); if (locs()->in(1).IsConstant()) { @@ -6294,7 +6036,6 @@ void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&done); } - LocationSummary* UnaryUint32OpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -6306,7 +6047,6 @@ LocationSummary* UnaryUint32OpInstr::MakeLocationSummary(Zone* zone, return summary; } - void UnaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register out = locs()->out(0).reg(); ASSERT(locs()->in(0).reg() == out); @@ -6316,10 +6056,8 @@ void UnaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ notl(out); } - DEFINE_UNIMPLEMENTED_INSTRUCTION(BinaryInt32OpInstr) - LocationSummary* UnboxedIntConverterInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -6343,7 +6081,6 @@ LocationSummary* UnboxedIntConverterInstr::MakeLocationSummary(Zone* zone, return summary; } - void UnboxedIntConverterInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (from() == kUnboxedInt32 && to() == kUnboxedUint32) { const Register value = locs()->in(0).reg(); @@ -6398,24 +6135,20 @@ void UnboxedIntConverterInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* ThrowInstr::MakeLocationSummary(Zone* zone, bool opt) const { return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kCall); } - void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { compiler->GenerateRuntimeCall(token_pos(), deopt_id(), kThrowRuntimeEntry, 1, locs()); __ int3(); } - LocationSummary* ReThrowInstr::MakeLocationSummary(Zone* zone, bool opt) const { return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kCall); } - void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { compiler->SetNeedsStackTrace(catch_try_index()); compiler->GenerateRuntimeCall(token_pos(), deopt_id(), kReThrowRuntimeEntry, @@ -6423,29 +6156,24 @@ void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ int3(); } - LocationSummary* StopInstr::MakeLocationSummary(Zone* zone, bool opt) const { return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kNoCall); } - void StopInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Stop(message()); } - void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (!compiler->CanFallThroughTo(normal_entry())) { __ jmp(compiler->GetJumpLabel(normal_entry())); } } - LocationSummary* GotoInstr::MakeLocationSummary(Zone* zone, bool opt) const { return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kNoCall); } - void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (!compiler->is_optimizing()) { if (FLAG_reorder_basic_blocks) { @@ -6467,7 +6195,6 @@ void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } } - LocationSummary* IndirectGotoInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -6482,7 +6209,6 @@ LocationSummary* IndirectGotoInstr::MakeLocationSummary(Zone* zone, return summary; } - void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register offset_reg = locs()->in(0).reg(); Register target_address_reg = locs()->temp(0).reg(); @@ -6531,7 +6257,6 @@ LocationSummary* StrictCompareInstr::MakeLocationSummary(Zone* zone, return locs; } - Condition StrictCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, BranchLabels labels) { Location left = locs()->in(0); @@ -6557,7 +6282,6 @@ Condition StrictCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, return true_condition; } - LocationSummary* ClosureCallInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 1; @@ -6569,7 +6293,6 @@ LocationSummary* ClosureCallInstr::MakeLocationSummary(Zone* zone, return summary; } - void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // Arguments descriptor is expected in R10. const intptr_t argument_count = ArgumentCount(); // Includes type args. @@ -6603,14 +6326,12 @@ void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Drop(argument_count); } - LocationSummary* BooleanNegateInstr::MakeLocationSummary(Zone* zone, bool opt) const { return LocationSummary::Make(zone, 1, Location::RequiresRegister(), LocationSummary::kNoCall); } - void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register value = locs()->in(0).reg(); Register result = locs()->out(0).reg(); @@ -6623,13 +6344,11 @@ void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&done); } - LocationSummary* AllocateObjectInstr::MakeLocationSummary(Zone* zone, bool opt) const { return MakeCallSummary(zone); } - void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Code& stub = Code::ZoneHandle( compiler->zone(), StubCode::GetAllocationStubForClass(cls())); @@ -6640,7 +6359,6 @@ void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Drop(ArgumentCount()); // Discard arguments. } - void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(!compiler->is_optimizing()); __ CallPatchable(*StubCode::DebugStepCheck_entry()); @@ -6648,7 +6366,6 @@ void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) { compiler->RecordSafepoint(locs()); } - } // namespace dart #undef __ diff --git a/runtime/vm/intrinsifier.cc b/runtime/vm/intrinsifier.cc index 51d0e29ba44..8eb5fabd52e 100644 --- a/runtime/vm/intrinsifier.cc +++ b/runtime/vm/intrinsifier.cc @@ -3,22 +3,21 @@ // BSD-style license that can be found in the LICENSE file. // Class for intrinsifying functions. +#include "vm/intrinsifier.h" #include "vm/assembler.h" #include "vm/compiler.h" #include "vm/cpu.h" #include "vm/flags.h" #include "vm/flow_graph.h" -#include "vm/flow_graph_compiler.h" #include "vm/flow_graph_allocator.h" #include "vm/flow_graph_builder.h" +#include "vm/flow_graph_compiler.h" #include "vm/il_printer.h" #include "vm/intermediate_language.h" -#include "vm/intrinsifier.h" #include "vm/object.h" #include "vm/parser.h" #include "vm/symbols.h" - namespace dart { DEFINE_FLAG(bool, intrinsify, true, "Instrinsify when possible"); @@ -59,7 +58,6 @@ bool Intrinsifier::CanIntrinsify(const Function& function) { return true; } - #if !defined(DART_PRECOMPILED_RUNTIME) void Intrinsifier::InitializeState() { Thread* thread = Thread::Current(); @@ -121,7 +119,6 @@ void Intrinsifier::InitializeState() { } #endif // !defined(DART_PRECOMPILED_RUNTIME) - // DBC does not use graph intrinsics. #if !defined(TARGET_ARCH_DBC) static void EmitCodeFor(FlowGraphCompiler* compiler, FlowGraph* graph) { @@ -160,7 +157,6 @@ static void EmitCodeFor(FlowGraphCompiler* compiler, FlowGraph* graph) { } #endif - bool Intrinsifier::GraphIntrinsify(const ParsedFunction& parsed_function, FlowGraphCompiler* compiler) { #if !defined(TARGET_ARCH_DBC) @@ -214,7 +210,6 @@ bool Intrinsifier::GraphIntrinsify(const ParsedFunction& parsed_function, #endif // !defined(TARGET_ARCH_DBC) } - // Returns true if fall-through code can be omitted. bool Intrinsifier::Intrinsify(const ParsedFunction& parsed_function, FlowGraphCompiler* compiler) { @@ -270,7 +265,6 @@ bool Intrinsifier::Intrinsify(const ParsedFunction& parsed_function, return false; } - #if !defined(TARGET_ARCH_DBC) static intptr_t CidForRepresentation(Representation rep) { switch (rep) { @@ -290,7 +284,6 @@ static intptr_t CidForRepresentation(Representation rep) { } } - // Notes about the graph intrinsics: // // IR instructions which would jump to a deoptimization sequence on failure @@ -384,14 +377,12 @@ class BlockBuilder : public ValueObject { return invoke_math_c_function; } - FlowGraph* flow_graph_; BlockEntryInstr* entry_; Instruction* current_; Environment* fall_through_env_; }; - static void PrepareIndexedOp(BlockBuilder* builder, Definition* array, Definition* index, @@ -481,7 +472,6 @@ static bool IntrinsifyArrayGetIndexed(FlowGraph* flow_graph, return true; } - static bool IntrinsifyArraySetIndexed(FlowGraph* flow_graph, intptr_t array_cid) { GraphEntryInstr* graph_entry = flow_graph->graph_entry(); @@ -581,7 +571,6 @@ static bool IntrinsifyArraySetIndexed(FlowGraph* flow_graph, return true; } - #define DEFINE_ARRAY_GETTER_INTRINSIC(enum_name) \ bool Intrinsifier::Build_##enum_name##GetIndexed(FlowGraph* flow_graph) { \ return IntrinsifyArrayGetIndexed( \ @@ -589,7 +578,6 @@ static bool IntrinsifyArraySetIndexed(FlowGraph* flow_graph, MethodRecognizer::k##enum_name##GetIndexed)); \ } - #define DEFINE_ARRAY_SETTER_INTRINSIC(enum_name) \ bool Intrinsifier::Build_##enum_name##SetIndexed(FlowGraph* flow_graph) { \ return IntrinsifyArraySetIndexed( \ @@ -618,7 +606,6 @@ DEFINE_ARRAY_GETTER_SETTER_INTRINSICS(Uint32Array) #undef DEFINE_ARRAY_GETTER_INTRINSIC #undef DEFINE_ARRAY_SETTER_INTRINSIC - #define DEFINE_FLOAT_ARRAY_GETTER_INTRINSIC(enum_name) \ bool Intrinsifier::Build_##enum_name##GetIndexed(FlowGraph* flow_graph) { \ if (!FlowGraphCompiler::SupportsUnboxedDoubles()) { \ @@ -629,7 +616,6 @@ DEFINE_ARRAY_GETTER_SETTER_INTRINSICS(Uint32Array) MethodRecognizer::k##enum_name##GetIndexed)); \ } - #define DEFINE_FLOAT_ARRAY_SETTER_INTRINSIC(enum_name) \ bool Intrinsifier::Build_##enum_name##SetIndexed(FlowGraph* flow_graph) { \ if (!FlowGraphCompiler::SupportsUnboxedDoubles()) { \ @@ -651,7 +637,6 @@ DEFINE_FLOAT_ARRAY_GETTER_SETTER_INTRINSICS(Float32Array) #undef DEFINE_FLOAT_ARRAY_GETTER_INTRINSIC #undef DEFINE_FLOAT_ARRAY_SETTER_INTRINSIC - #define DEFINE_SIMD_ARRAY_GETTER_INTRINSIC(enum_name) \ bool Intrinsifier::Build_##enum_name##GetIndexed(FlowGraph* flow_graph) { \ if (!FlowGraphCompiler::SupportsUnboxedSimd128()) { \ @@ -662,7 +647,6 @@ DEFINE_FLOAT_ARRAY_GETTER_SETTER_INTRINSICS(Float32Array) MethodRecognizer::k##enum_name##GetIndexed)); \ } - #define DEFINE_SIMD_ARRAY_SETTER_INTRINSIC(enum_name) \ bool Intrinsifier::Build_##enum_name##SetIndexed(FlowGraph* flow_graph) { \ if (!FlowGraphCompiler::SupportsUnboxedSimd128()) { \ @@ -685,7 +669,6 @@ DEFINE_SIMD_ARRAY_GETTER_SETTER_INTRINSICS(Float64x2Array) #undef DEFINE_SIMD_ARRAY_GETTER_INTRINSIC #undef DEFINE_SIMD_ARRAY_SETTER_INTRINSIC - static bool BuildCodeUnitAt(FlowGraph* flow_graph, intptr_t cid) { GraphEntryInstr* graph_entry = flow_graph->graph_entry(); TargetEntryInstr* normal_entry = graph_entry->normal_entry(); @@ -715,29 +698,24 @@ static bool BuildCodeUnitAt(FlowGraph* flow_graph, intptr_t cid) { return true; } - bool Intrinsifier::Build_OneByteStringCodeUnitAt(FlowGraph* flow_graph) { return BuildCodeUnitAt(flow_graph, kOneByteStringCid); } - bool Intrinsifier::Build_TwoByteStringCodeUnitAt(FlowGraph* flow_graph) { return BuildCodeUnitAt(flow_graph, kTwoByteStringCid); } - bool Intrinsifier::Build_ExternalOneByteStringCodeUnitAt( FlowGraph* flow_graph) { return BuildCodeUnitAt(flow_graph, kExternalOneByteStringCid); } - bool Intrinsifier::Build_ExternalTwoByteStringCodeUnitAt( FlowGraph* flow_graph) { return BuildCodeUnitAt(flow_graph, kExternalTwoByteStringCid); } - static bool BuildBinaryFloat32x4Op(FlowGraph* flow_graph, Token::Kind kind) { if (!FlowGraphCompiler::SupportsUnboxedSimd128()) return false; @@ -769,22 +747,18 @@ static bool BuildBinaryFloat32x4Op(FlowGraph* flow_graph, Token::Kind kind) { return true; } - bool Intrinsifier::Build_Float32x4Mul(FlowGraph* flow_graph) { return BuildBinaryFloat32x4Op(flow_graph, Token::kMUL); } - bool Intrinsifier::Build_Float32x4Sub(FlowGraph* flow_graph) { return BuildBinaryFloat32x4Op(flow_graph, Token::kSUB); } - bool Intrinsifier::Build_Float32x4Add(FlowGraph* flow_graph) { return BuildBinaryFloat32x4Op(flow_graph, Token::kADD); } - static bool BuildFloat32x4Shuffle(FlowGraph* flow_graph, MethodRecognizer::Kind kind) { if (!FlowGraphCompiler::SupportsUnboxedDoubles() || @@ -810,31 +784,26 @@ static bool BuildFloat32x4Shuffle(FlowGraph* flow_graph, return true; } - bool Intrinsifier::Build_Float32x4ShuffleX(FlowGraph* flow_graph) { return BuildFloat32x4Shuffle(flow_graph, MethodRecognizer::kFloat32x4ShuffleX); } - bool Intrinsifier::Build_Float32x4ShuffleY(FlowGraph* flow_graph) { return BuildFloat32x4Shuffle(flow_graph, MethodRecognizer::kFloat32x4ShuffleY); } - bool Intrinsifier::Build_Float32x4ShuffleZ(FlowGraph* flow_graph) { return BuildFloat32x4Shuffle(flow_graph, MethodRecognizer::kFloat32x4ShuffleZ); } - bool Intrinsifier::Build_Float32x4ShuffleW(FlowGraph* flow_graph) { return BuildFloat32x4Shuffle(flow_graph, MethodRecognizer::kFloat32x4ShuffleW); } - static bool BuildLoadField(FlowGraph* flow_graph, intptr_t offset) { GraphEntryInstr* graph_entry = flow_graph->graph_entry(); TargetEntryInstr* normal_entry = graph_entry->normal_entry(); @@ -848,32 +817,26 @@ static bool BuildLoadField(FlowGraph* flow_graph, intptr_t offset) { return true; } - bool Intrinsifier::Build_ObjectArrayLength(FlowGraph* flow_graph) { return BuildLoadField(flow_graph, Array::length_offset()); } - bool Intrinsifier::Build_ImmutableArrayLength(FlowGraph* flow_graph) { return BuildLoadField(flow_graph, Array::length_offset()); } - bool Intrinsifier::Build_GrowableArrayLength(FlowGraph* flow_graph) { return BuildLoadField(flow_graph, GrowableObjectArray::length_offset()); } - bool Intrinsifier::Build_StringBaseLength(FlowGraph* flow_graph) { return BuildLoadField(flow_graph, String::length_offset()); } - bool Intrinsifier::Build_TypedDataLength(FlowGraph* flow_graph) { return BuildLoadField(flow_graph, TypedData::length_offset()); } - bool Intrinsifier::Build_GrowableArrayCapacity(FlowGraph* flow_graph) { GraphEntryInstr* graph_entry = flow_graph->graph_entry(); TargetEntryInstr* normal_entry = graph_entry->normal_entry(); @@ -891,7 +854,6 @@ bool Intrinsifier::Build_GrowableArrayCapacity(FlowGraph* flow_graph) { return true; } - bool Intrinsifier::Build_GrowableArrayGetIndexed(FlowGraph* flow_graph) { GraphEntryInstr* graph_entry = flow_graph->graph_entry(); TargetEntryInstr* normal_entry = graph_entry->normal_entry(); @@ -914,7 +876,6 @@ bool Intrinsifier::Build_GrowableArrayGetIndexed(FlowGraph* flow_graph) { return true; } - bool Intrinsifier::Build_GrowableArraySetIndexed(FlowGraph* flow_graph) { if (Isolate::Current()->type_checks()) { return false; @@ -946,7 +907,6 @@ bool Intrinsifier::Build_GrowableArraySetIndexed(FlowGraph* flow_graph) { return true; } - bool Intrinsifier::Build_GrowableArraySetData(FlowGraph* flow_graph) { GraphEntryInstr* graph_entry = flow_graph->graph_entry(); TargetEntryInstr* normal_entry = graph_entry->normal_entry(); @@ -969,7 +929,6 @@ bool Intrinsifier::Build_GrowableArraySetData(FlowGraph* flow_graph) { return true; } - bool Intrinsifier::Build_GrowableArraySetLength(FlowGraph* flow_graph) { GraphEntryInstr* graph_entry = flow_graph->graph_entry(); TargetEntryInstr* normal_entry = graph_entry->normal_entry(); @@ -988,7 +947,6 @@ bool Intrinsifier::Build_GrowableArraySetLength(FlowGraph* flow_graph) { return true; } - bool Intrinsifier::Build_DoubleFlipSignBit(FlowGraph* flow_graph) { if (!FlowGraphCompiler::SupportsUnboxedDoubles()) { return false; @@ -1009,7 +967,6 @@ bool Intrinsifier::Build_DoubleFlipSignBit(FlowGraph* flow_graph) { return true; } - static bool BuildInvokeMathCFunction(BlockBuilder* builder, MethodRecognizer::Kind kind, intptr_t num_parameters = 1) { @@ -1037,7 +994,6 @@ static bool BuildInvokeMathCFunction(BlockBuilder* builder, return true; } - bool Intrinsifier::Build_MathSin(FlowGraph* flow_graph) { if (!FlowGraphCompiler::SupportsUnboxedDoubles()) return false; @@ -1048,7 +1004,6 @@ bool Intrinsifier::Build_MathSin(FlowGraph* flow_graph) { return BuildInvokeMathCFunction(&builder, MethodRecognizer::kMathSin); } - bool Intrinsifier::Build_MathCos(FlowGraph* flow_graph) { if (!FlowGraphCompiler::SupportsUnboxedDoubles()) return false; @@ -1059,7 +1014,6 @@ bool Intrinsifier::Build_MathCos(FlowGraph* flow_graph) { return BuildInvokeMathCFunction(&builder, MethodRecognizer::kMathCos); } - bool Intrinsifier::Build_MathTan(FlowGraph* flow_graph) { if (!FlowGraphCompiler::SupportsUnboxedDoubles()) return false; @@ -1070,7 +1024,6 @@ bool Intrinsifier::Build_MathTan(FlowGraph* flow_graph) { return BuildInvokeMathCFunction(&builder, MethodRecognizer::kMathTan); } - bool Intrinsifier::Build_MathAsin(FlowGraph* flow_graph) { if (!FlowGraphCompiler::SupportsUnboxedDoubles()) return false; @@ -1081,7 +1034,6 @@ bool Intrinsifier::Build_MathAsin(FlowGraph* flow_graph) { return BuildInvokeMathCFunction(&builder, MethodRecognizer::kMathAsin); } - bool Intrinsifier::Build_MathAcos(FlowGraph* flow_graph) { if (!FlowGraphCompiler::SupportsUnboxedDoubles()) return false; @@ -1092,7 +1044,6 @@ bool Intrinsifier::Build_MathAcos(FlowGraph* flow_graph) { return BuildInvokeMathCFunction(&builder, MethodRecognizer::kMathAcos); } - bool Intrinsifier::Build_MathAtan(FlowGraph* flow_graph) { if (!FlowGraphCompiler::SupportsUnboxedDoubles()) return false; @@ -1103,7 +1054,6 @@ bool Intrinsifier::Build_MathAtan(FlowGraph* flow_graph) { return BuildInvokeMathCFunction(&builder, MethodRecognizer::kMathAtan); } - bool Intrinsifier::Build_MathAtan2(FlowGraph* flow_graph) { if (!FlowGraphCompiler::SupportsUnboxedDoubles()) return false; @@ -1115,7 +1065,6 @@ bool Intrinsifier::Build_MathAtan2(FlowGraph* flow_graph) { /* num_parameters = */ 2); } - bool Intrinsifier::Build_DoubleMod(FlowGraph* flow_graph) { if (!FlowGraphCompiler::SupportsUnboxedDoubles()) return false; @@ -1127,7 +1076,6 @@ bool Intrinsifier::Build_DoubleMod(FlowGraph* flow_graph) { /* num_parameters = */ 2); } - bool Intrinsifier::Build_DoubleCeil(FlowGraph* flow_graph) { if (!FlowGraphCompiler::SupportsUnboxedDoubles()) return false; // TODO(johnmccutchan): On X86 this intrinsic can be written in a different @@ -1141,7 +1089,6 @@ bool Intrinsifier::Build_DoubleCeil(FlowGraph* flow_graph) { return BuildInvokeMathCFunction(&builder, MethodRecognizer::kDoubleCeil); } - bool Intrinsifier::Build_DoubleFloor(FlowGraph* flow_graph) { if (!FlowGraphCompiler::SupportsUnboxedDoubles()) return false; // TODO(johnmccutchan): On X86 this intrinsic can be written in a different @@ -1155,7 +1102,6 @@ bool Intrinsifier::Build_DoubleFloor(FlowGraph* flow_graph) { return BuildInvokeMathCFunction(&builder, MethodRecognizer::kDoubleFloor); } - bool Intrinsifier::Build_DoubleTruncate(FlowGraph* flow_graph) { if (!FlowGraphCompiler::SupportsUnboxedDoubles()) return false; // TODO(johnmccutchan): On X86 this intrinsic can be written in a different @@ -1169,7 +1115,6 @@ bool Intrinsifier::Build_DoubleTruncate(FlowGraph* flow_graph) { return BuildInvokeMathCFunction(&builder, MethodRecognizer::kDoubleTruncate); } - bool Intrinsifier::Build_DoubleRound(FlowGraph* flow_graph) { if (!FlowGraphCompiler::SupportsUnboxedDoubles()) return false; @@ -1180,16 +1125,13 @@ bool Intrinsifier::Build_DoubleRound(FlowGraph* flow_graph) { return BuildInvokeMathCFunction(&builder, MethodRecognizer::kDoubleRound); } - void Intrinsifier::RegExp_ExecuteMatch(Assembler* assembler) { IntrinsifyRegExpExecuteMatch(assembler, /*sticky=*/false); } - void Intrinsifier::RegExp_ExecuteMatchSticky(Assembler* assembler) { IntrinsifyRegExpExecuteMatch(assembler, /*sticky=*/true); } #endif // !defined(TARGET_ARCH_DBC) - } // namespace dart diff --git a/runtime/vm/intrinsifier_arm.cc b/runtime/vm/intrinsifier_arm.cc index 905dfcacb5c..b053d0f4ae5 100644 --- a/runtime/vm/intrinsifier_arm.cc +++ b/runtime/vm/intrinsifier_arm.cc @@ -29,17 +29,14 @@ namespace dart { #define __ assembler-> - intptr_t Intrinsifier::ParameterSlotFromSp() { return -1; } - static bool IsABIPreservedRegister(Register reg) { return ((1 << reg) & kAbiPreservedCpuRegs) != 0; } - void Intrinsifier::IntrinsicCallPrologue(Assembler* assembler) { ASSERT(IsABIPreservedRegister(CODE_REG)); ASSERT(IsABIPreservedRegister(ARGS_DESC_REG)); @@ -50,14 +47,12 @@ void Intrinsifier::IntrinsicCallPrologue(Assembler* assembler) { assembler->mov(CALLEE_SAVED_TEMP, Operand(LR)); } - void Intrinsifier::IntrinsicCallEpilogue(Assembler* assembler) { // Restore LR. assembler->Comment("IntrinsicCallEpilogue"); assembler->mov(LR, Operand(CALLEE_SAVED_TEMP)); } - // Intrinsify only for Smi value and index. Non-smi values need a store buffer // update. Array length is always a Smi. void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) { @@ -88,7 +83,6 @@ void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) { __ Bind(&fall_through); } - // Allocate a GrowableObjectArray using the backing array specified. // On stack: type argument (+1), data (+0). void Intrinsifier::GrowableArray_Allocate(Assembler* assembler) { @@ -123,7 +117,6 @@ void Intrinsifier::GrowableArray_Allocate(Assembler* assembler) { __ Bind(&fall_through); } - // Add an element to growable array if it doesn't need to grow, otherwise // call into regular code. // On stack: growable array (+1), value (+0). @@ -158,7 +151,6 @@ void Intrinsifier::GrowableArray_add(Assembler* assembler) { __ Bind(&fall_through); } - #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_shift) \ Label fall_through; \ const intptr_t kArrayLengthStackOffset = 0 * kWordSize; \ @@ -250,7 +242,6 @@ void Intrinsifier::GrowableArray_add(Assembler* assembler) { __ Ret(); \ __ Bind(&fall_through); - static int GetScaleFactor(intptr_t size) { switch (size) { case 1: @@ -268,7 +259,6 @@ static int GetScaleFactor(intptr_t size) { return -1; } - #define TYPED_DATA_ALLOCATOR(clazz) \ void Intrinsifier::TypedData_##clazz##_factory(Assembler* assembler) { \ intptr_t size = TypedData::ElementSizeInBytes(kTypedData##clazz##Cid); \ @@ -279,7 +269,6 @@ static int GetScaleFactor(intptr_t size) { CLASS_LIST_TYPED_DATA(TYPED_DATA_ALLOCATOR) #undef TYPED_DATA_ALLOCATOR - // Loads args from stack into R0 and R1 // Tests if they are smis, jumps to label not_smi if not. static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) { @@ -291,7 +280,6 @@ static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) { return; } - void Intrinsifier::Integer_addFromInteger(Assembler* assembler) { Label fall_through; TestBothArgumentsSmis(assembler, &fall_through); // Checks two smis. @@ -301,12 +289,10 @@ void Intrinsifier::Integer_addFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_add(Assembler* assembler) { Integer_addFromInteger(assembler); } - void Intrinsifier::Integer_subFromInteger(Assembler* assembler) { Label fall_through; TestBothArgumentsSmis(assembler, &fall_through); @@ -316,7 +302,6 @@ void Intrinsifier::Integer_subFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_sub(Assembler* assembler) { Label fall_through; TestBothArgumentsSmis(assembler, &fall_through); @@ -326,7 +311,6 @@ void Intrinsifier::Integer_sub(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_mulFromInteger(Assembler* assembler) { Label fall_through; TestBothArgumentsSmis(assembler, &fall_through); // checks two smis @@ -337,12 +321,10 @@ void Intrinsifier::Integer_mulFromInteger(Assembler* assembler) { __ Bind(&fall_through); // Fall through on overflow. } - void Intrinsifier::Integer_mul(Assembler* assembler) { Integer_mulFromInteger(assembler); } - // Optimizations: // - result is 0 if: // - left is 0 @@ -390,7 +372,6 @@ static void EmitRemainderOperation(Assembler* assembler) { return; } - // Implementation: // res = left % right; // if (res < 0) { @@ -433,7 +414,6 @@ void Intrinsifier::Integer_moduloFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_truncDivide(Assembler* assembler) { if (!TargetCPUFeatures::can_divide()) { return; @@ -458,7 +438,6 @@ void Intrinsifier::Integer_truncDivide(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_negate(Assembler* assembler) { Label fall_through; __ ldr(R0, Address(SP, +0 * kWordSize)); // Grab first argument. @@ -470,7 +449,6 @@ void Intrinsifier::Integer_negate(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_bitAndFromInteger(Assembler* assembler) { Label fall_through; @@ -481,12 +459,10 @@ void Intrinsifier::Integer_bitAndFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_bitAnd(Assembler* assembler) { Integer_bitAndFromInteger(assembler); } - void Intrinsifier::Integer_bitOrFromInteger(Assembler* assembler) { Label fall_through; @@ -497,12 +473,10 @@ void Intrinsifier::Integer_bitOrFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_bitOr(Assembler* assembler) { Integer_bitOrFromInteger(assembler); } - void Intrinsifier::Integer_bitXorFromInteger(Assembler* assembler) { Label fall_through; @@ -513,12 +487,10 @@ void Intrinsifier::Integer_bitXorFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_bitXor(Assembler* assembler) { Integer_bitXorFromInteger(assembler); } - void Intrinsifier::Integer_shl(Assembler* assembler) { ASSERT(kSmiTagShift == 1); ASSERT(kSmiTag == 0); @@ -561,14 +533,12 @@ void Intrinsifier::Integer_shl(Assembler* assembler) { Class::Handle(Isolate::Current()->object_store()->mint_class()); __ TryAllocate(mint_class, &fall_through, R0, R2); - __ str(R1, FieldAddress(R0, Mint::value_offset())); __ str(NOTFP, FieldAddress(R0, Mint::value_offset() + kWordSize)); __ Ret(); __ Bind(&fall_through); } - static void Get64SmiOrMint(Assembler* assembler, Register res_hi, Register res_lo, @@ -595,7 +565,6 @@ static void Get64SmiOrMint(Assembler* assembler, return; } - static void CompareIntegers(Assembler* assembler, Condition true_condition) { Label try_mint_smi, is_true, is_false, drop_two_fall_through, fall_through; TestBothArgumentsSmis(assembler, &try_mint_smi); @@ -651,32 +620,26 @@ static void CompareIntegers(Assembler* assembler, Condition true_condition) { __ Bind(&fall_through); } - void Intrinsifier::Integer_greaterThanFromInt(Assembler* assembler) { CompareIntegers(assembler, LT); } - void Intrinsifier::Integer_lessThan(Assembler* assembler) { Integer_greaterThanFromInt(assembler); } - void Intrinsifier::Integer_greaterThan(Assembler* assembler) { CompareIntegers(assembler, GT); } - void Intrinsifier::Integer_lessEqualThan(Assembler* assembler) { CompareIntegers(assembler, LE); } - void Intrinsifier::Integer_greaterEqualThan(Assembler* assembler) { CompareIntegers(assembler, GE); } - // This is called for Smi, Mint and Bigint receivers. The right argument // can be Smi, Mint, Bigint or double. void Intrinsifier::Integer_equalToInteger(Assembler* assembler) { @@ -728,12 +691,10 @@ void Intrinsifier::Integer_equalToInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_equal(Assembler* assembler) { Integer_equalToInteger(assembler); } - void Intrinsifier::Integer_sar(Assembler* assembler) { Label fall_through; @@ -755,7 +716,6 @@ void Intrinsifier::Integer_sar(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Smi_bitNegate(Assembler* assembler) { __ ldr(R0, Address(SP, 0 * kWordSize)); __ mvn(R0, Operand(R0)); @@ -763,7 +723,6 @@ void Intrinsifier::Smi_bitNegate(Assembler* assembler) { __ Ret(); } - void Intrinsifier::Smi_bitLength(Assembler* assembler) { __ ldr(R0, Address(SP, 0 * kWordSize)); __ SmiUntag(R0); @@ -775,12 +734,10 @@ void Intrinsifier::Smi_bitLength(Assembler* assembler) { __ Ret(); } - void Intrinsifier::Smi_bitAndFromSmi(Assembler* assembler) { Integer_bitAndFromInteger(assembler); } - void Intrinsifier::Bigint_lsh(Assembler* assembler) { // static void _lsh(Uint32List x_digits, int x_used, int n, // Uint32List r_digits) @@ -797,8 +754,9 @@ void Intrinsifier::Bigint_lsh(Assembler* assembler) { // NOTFP = &x_digits[x_used] __ add(NOTFP, R8, Operand(R0, LSL, 1)); // R6 = &r_digits[1] - __ add(R6, R2, Operand(TypedData::data_offset() - kHeapObjectTag + - Bigint::kBytesPerDigit)); + __ add(R6, R2, + Operand(TypedData::data_offset() - kHeapObjectTag + + Bigint::kBytesPerDigit)); // R6 = &r_digits[x_used + n ~/ _DIGIT_BITS + 1] __ add(R4, R4, Operand(R0, ASR, 1)); __ add(R6, R6, Operand(R4, LSL, 2)); @@ -820,7 +778,6 @@ void Intrinsifier::Bigint_lsh(Assembler* assembler) { __ Ret(); } - void Intrinsifier::Bigint_rsh(Assembler* assembler) { // static void _lsh(Uint32List x_digits, int x_used, int n, // Uint32List r_digits) @@ -864,7 +821,6 @@ void Intrinsifier::Bigint_rsh(Assembler* assembler) { __ Ret(); } - void Intrinsifier::Bigint_absAdd(Assembler* assembler) { // static void _absAdd(Uint32List digits, int used, // Uint32List a_digits, int a_used, @@ -924,7 +880,6 @@ void Intrinsifier::Bigint_absAdd(Assembler* assembler) { __ Ret(); } - void Intrinsifier::Bigint_absSub(Assembler* assembler) { // static void _absSub(Uint32List digits, int used, // Uint32List a_digits, int a_used, @@ -980,7 +935,6 @@ void Intrinsifier::Bigint_absSub(Assembler* assembler) { __ Ret(); } - void Intrinsifier::Bigint_mulAdd(Assembler* assembler) { // Pseudo code: // static int _mulAdd(Uint32List x_digits, int xi, @@ -1082,7 +1036,6 @@ void Intrinsifier::Bigint_mulAdd(Assembler* assembler) { __ Ret(); } - void Intrinsifier::Bigint_sqrAdd(Assembler* assembler) { // Pseudo code: // static int _sqrAdd(Uint32List x_digits, int i, @@ -1196,12 +1149,10 @@ void Intrinsifier::Bigint_sqrAdd(Assembler* assembler) { __ Ret(); } - void Intrinsifier::Bigint_estQuotientDigit(Assembler* assembler) { // No unsigned 64-bit / 32-bit divide instruction. } - void Intrinsifier::Montgomery_mulMod(Assembler* assembler) { // Pseudo code: // static int _mulMod(Uint32List args, Uint32List digits, int i) { @@ -1235,7 +1186,6 @@ void Intrinsifier::Montgomery_mulMod(Assembler* assembler) { __ Ret(); } - // Check if the last argument is a double, jump to label 'is_smi' if smi // (easy to convert to double), otherwise jump to label 'not_double_smi', // Returns the last argument in R0. @@ -1250,7 +1200,6 @@ static void TestLastArgumentIsDouble(Assembler* assembler, // Fall through with Double in R0. } - // Both arguments on stack, arg0 (left) is a double, arg1 (right) is of unknown // type. Return true or false object in the register R0. Any NaN argument // returns false. Any non-double arg1 causes control flow to fall through to the @@ -1284,32 +1233,26 @@ static void CompareDoubles(Assembler* assembler, Condition true_condition) { } } - void Intrinsifier::Double_greaterThan(Assembler* assembler) { CompareDoubles(assembler, HI); } - void Intrinsifier::Double_greaterEqualThan(Assembler* assembler) { CompareDoubles(assembler, CS); } - void Intrinsifier::Double_lessThan(Assembler* assembler) { CompareDoubles(assembler, CC); } - void Intrinsifier::Double_equal(Assembler* assembler) { CompareDoubles(assembler, EQ); } - void Intrinsifier::Double_lessEqualThan(Assembler* assembler) { CompareDoubles(assembler, LS); } - // Expects left argument to be double (receiver). Right argument is unknown. // Both arguments are on stack. static void DoubleArithmeticOperations(Assembler* assembler, Token::Kind kind) { @@ -1352,27 +1295,22 @@ static void DoubleArithmeticOperations(Assembler* assembler, Token::Kind kind) { } } - void Intrinsifier::Double_add(Assembler* assembler) { DoubleArithmeticOperations(assembler, Token::kADD); } - void Intrinsifier::Double_mul(Assembler* assembler) { DoubleArithmeticOperations(assembler, Token::kMUL); } - void Intrinsifier::Double_sub(Assembler* assembler) { DoubleArithmeticOperations(assembler, Token::kSUB); } - void Intrinsifier::Double_div(Assembler* assembler) { DoubleArithmeticOperations(assembler, Token::kDIV); } - // Left is double right is integer (Bigint, Mint or Smi) void Intrinsifier::Double_mulFromInteger(Assembler* assembler) { if (TargetCPUFeatures::vfp_supported()) { @@ -1397,7 +1335,6 @@ void Intrinsifier::Double_mulFromInteger(Assembler* assembler) { } } - void Intrinsifier::DoubleFromInteger(Assembler* assembler) { if (TargetCPUFeatures::vfp_supported()) { Label fall_through; @@ -1418,7 +1355,6 @@ void Intrinsifier::DoubleFromInteger(Assembler* assembler) { } } - void Intrinsifier::Double_getIsNaN(Assembler* assembler) { if (TargetCPUFeatures::vfp_supported()) { Label is_true; @@ -1432,7 +1368,6 @@ void Intrinsifier::Double_getIsNaN(Assembler* assembler) { } } - void Intrinsifier::Double_getIsInfinite(Assembler* assembler) { if (TargetCPUFeatures::vfp_supported()) { __ ldr(R0, Address(SP, 0 * kWordSize)); @@ -1457,7 +1392,6 @@ void Intrinsifier::Double_getIsInfinite(Assembler* assembler) { } } - void Intrinsifier::Double_getIsNegative(Assembler* assembler) { if (TargetCPUFeatures::vfp_supported()) { Label is_false, is_true, is_zero; @@ -1487,7 +1421,6 @@ void Intrinsifier::Double_getIsNegative(Assembler* assembler) { } } - void Intrinsifier::DoubleToInteger(Assembler* assembler) { if (TargetCPUFeatures::vfp_supported()) { Label fall_through; @@ -1512,7 +1445,6 @@ void Intrinsifier::DoubleToInteger(Assembler* assembler) { } } - void Intrinsifier::MathSqrt(Assembler* assembler) { if (TargetCPUFeatures::vfp_supported()) { Label fall_through, is_smi, double_op; @@ -1535,7 +1467,6 @@ void Intrinsifier::MathSqrt(Assembler* assembler) { } } - // var state = ((_A * (_state[kSTATE_LO])) + _state[kSTATE_HI]) & _MASK_64; // _state[kSTATE_LO] = state & _MASK_32; // _state[kSTATE_HI] = state >> 32; @@ -1584,7 +1515,6 @@ void Intrinsifier::Random_nextState(Assembler* assembler) { __ Ret(); } - void Intrinsifier::ObjectEquals(Assembler* assembler) { __ ldr(R0, Address(SP, 0 * kWordSize)); __ ldr(R1, Address(SP, 1 * kWordSize)); @@ -1594,7 +1524,6 @@ void Intrinsifier::ObjectEquals(Assembler* assembler) { __ Ret(); } - static void RangeCheck(Assembler* assembler, Register val, Register tmp, @@ -1607,11 +1536,9 @@ static void RangeCheck(Assembler* assembler, __ b(target, cc); } - const Condition kIfNotInRange = HI; const Condition kIfInRange = LS; - static void JumpIfInteger(Assembler* assembler, Register cid, Register tmp, @@ -1619,7 +1546,6 @@ static void JumpIfInteger(Assembler* assembler, RangeCheck(assembler, cid, tmp, kSmiCid, kBigintCid, kIfInRange, target); } - static void JumpIfNotInteger(Assembler* assembler, Register cid, Register tmp, @@ -1627,7 +1553,6 @@ static void JumpIfNotInteger(Assembler* assembler, RangeCheck(assembler, cid, tmp, kSmiCid, kBigintCid, kIfNotInRange, target); } - static void JumpIfString(Assembler* assembler, Register cid, Register tmp, @@ -1636,7 +1561,6 @@ static void JumpIfString(Assembler* assembler, kIfInRange, target); } - static void JumpIfNotString(Assembler* assembler, Register cid, Register tmp, @@ -1645,7 +1569,6 @@ static void JumpIfNotString(Assembler* assembler, kIfNotInRange, target); } - // Return type quickly for simple types (not parameterized and not signature). void Intrinsifier::ObjectRuntimeType(Assembler* assembler) { Label fall_through, use_canonical_type, not_double, not_integer; @@ -1694,7 +1617,6 @@ void Intrinsifier::ObjectRuntimeType(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::ObjectHaveSameRuntimeType(Assembler* assembler) { Label fall_through, different_cids, equal, not_equal, not_integer; __ ldr(R0, Address(SP, 0 * kWordSize)); @@ -1749,7 +1671,6 @@ void Intrinsifier::ObjectHaveSameRuntimeType(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::String_getHashCode(Assembler* assembler) { __ ldr(R0, Address(SP, 0 * kWordSize)); __ ldr(R0, FieldAddress(R0, String::hash_offset())); @@ -1757,7 +1678,6 @@ void Intrinsifier::String_getHashCode(Assembler* assembler) { __ bx(LR, NE); // Hash not yet computed. } - void GenerateSubstringMatchesSpecialization(Assembler* assembler, intptr_t receiver_cid, intptr_t other_cid, @@ -1828,7 +1748,6 @@ void GenerateSubstringMatchesSpecialization(Assembler* assembler, __ b(return_true); } - // bool _substringMatches(int start, String other) // This intrinsic handles a OneByteString or TwoByteString receiver with a // OneByteString other. @@ -1874,17 +1793,14 @@ void Intrinsifier::StringBaseSubstringMatches(Assembler* assembler) { __ Pop(R4); } - void Intrinsifier::Object_getHash(Assembler* assembler) { UNREACHABLE(); } - void Intrinsifier::Object_setHash(Assembler* assembler) { UNREACHABLE(); } - void Intrinsifier::StringBaseCharAt(Assembler* assembler) { Label fall_through, try_two_byte_string; @@ -1925,7 +1841,6 @@ void Intrinsifier::StringBaseCharAt(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::StringBaseIsEmpty(Assembler* assembler) { __ ldr(R0, Address(SP, 0 * kWordSize)); __ ldr(R0, FieldAddress(R0, String::length_offset())); @@ -1935,7 +1850,6 @@ void Intrinsifier::StringBaseIsEmpty(Assembler* assembler) { __ Ret(); } - void Intrinsifier::OneByteString_getHashCode(Assembler* assembler) { __ ldr(R1, Address(SP, 0 * kWordSize)); __ ldr(R0, FieldAddress(R1, String::hash_offset())); @@ -1994,7 +1908,6 @@ void Intrinsifier::OneByteString_getHashCode(Assembler* assembler) { __ Ret(); } - // Allocates one-byte string of length 'end - start'. The content is not // initialized. // 'length-reg' (R2) contains tagged length. @@ -2070,7 +1983,6 @@ static void TryAllocateOnebyteString(Assembler* assembler, __ b(failure); } - // Arg0: OneByteString (receiver). // Arg1: Start index as Smi. // Arg2: End index as Smi. @@ -2130,7 +2042,6 @@ void Intrinsifier::OneByteString_substringUnchecked(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::OneByteStringSetAt(Assembler* assembler) { __ ldr(R2, Address(SP, 0 * kWordSize)); // Value. __ ldr(R1, Address(SP, 1 * kWordSize)); // Index. @@ -2142,7 +2053,6 @@ void Intrinsifier::OneByteStringSetAt(Assembler* assembler) { __ Ret(); } - void Intrinsifier::OneByteString_allocate(Assembler* assembler) { __ ldr(R2, Address(SP, 0 * kWordSize)); // Length. Label fall_through, ok; @@ -2154,7 +2064,6 @@ void Intrinsifier::OneByteString_allocate(Assembler* assembler) { __ Bind(&fall_through); } - // TODO(srdjan): Add combinations (one-byte/two-byte/external strings). static void StringEquality(Assembler* assembler, intptr_t string_cid) { Label fall_through, is_true, is_false, loop; @@ -2219,17 +2128,14 @@ static void StringEquality(Assembler* assembler, intptr_t string_cid) { __ Bind(&fall_through); } - void Intrinsifier::OneByteString_equality(Assembler* assembler) { StringEquality(assembler, kOneByteStringCid); } - void Intrinsifier::TwoByteString_equality(Assembler* assembler) { StringEquality(assembler, kTwoByteStringCid); } - void Intrinsifier::IntrinsifyRegExpExecuteMatch(Assembler* assembler, bool sticky) { if (FLAG_interpret_irregexp) return; @@ -2263,7 +2169,6 @@ void Intrinsifier::IntrinsifyRegExpExecuteMatch(Assembler* assembler, __ bx(R1); } - // On stack: user tag (+0). void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { // R1: Isolate. @@ -2281,21 +2186,18 @@ void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { __ Ret(); } - void Intrinsifier::UserTag_defaultTag(Assembler* assembler) { __ LoadIsolate(R0); __ ldr(R0, Address(R0, Isolate::default_tag_offset())); __ Ret(); } - void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { __ LoadIsolate(R0); __ ldr(R0, Address(R0, Isolate::current_tag_offset())); __ Ret(); } - void Intrinsifier::Timeline_isDartStreamEnabled(Assembler* assembler) { if (!FLAG_support_timeline) { __ LoadObject(R0, Bool::False()); @@ -2312,14 +2214,12 @@ void Intrinsifier::Timeline_isDartStreamEnabled(Assembler* assembler) { __ Ret(); } - void Intrinsifier::ClearAsyncThreadStackTrace(Assembler* assembler) { __ LoadObject(R0, Object::null_object()); __ str(R0, Address(THR, Thread::async_stack_trace_offset())); __ Ret(); } - void Intrinsifier::SetAsyncThreadStackTrace(Assembler* assembler) { __ ldr(R0, Address(THR, Thread::async_stack_trace_offset())); __ LoadObject(R0, Object::null_object()); diff --git a/runtime/vm/intrinsifier_arm64.cc b/runtime/vm/intrinsifier_arm64.cc index 3c5f4f6c341..b9438a715c2 100644 --- a/runtime/vm/intrinsifier_arm64.cc +++ b/runtime/vm/intrinsifier_arm64.cc @@ -28,17 +28,14 @@ namespace dart { #define __ assembler-> - intptr_t Intrinsifier::ParameterSlotFromSp() { return -1; } - static bool IsABIPreservedRegister(Register reg) { return ((1 << reg) & kAbiPreservedCpuRegs) != 0; } - void Intrinsifier::IntrinsicCallPrologue(Assembler* assembler) { ASSERT(IsABIPreservedRegister(CODE_REG)); ASSERT(!IsABIPreservedRegister(ARGS_DESC_REG)); @@ -54,14 +51,12 @@ void Intrinsifier::IntrinsicCallPrologue(Assembler* assembler) { assembler->mov(CALLEE_SAVED_TEMP2, ARGS_DESC_REG); } - void Intrinsifier::IntrinsicCallEpilogue(Assembler* assembler) { assembler->Comment("IntrinsicCallEpilogue"); assembler->mov(LR, CALLEE_SAVED_TEMP); assembler->mov(ARGS_DESC_REG, CALLEE_SAVED_TEMP2); } - // Intrinsify only for Smi value and index. Non-smi values need a store buffer // update. Array length is always a Smi. void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) { @@ -92,7 +87,6 @@ void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) { __ Bind(&fall_through); } - // Allocate a GrowableObjectArray using the backing array specified. // On stack: type argument (+1), data (+0). void Intrinsifier::GrowableArray_Allocate(Assembler* assembler) { @@ -126,7 +120,6 @@ void Intrinsifier::GrowableArray_Allocate(Assembler* assembler) { __ Bind(&fall_through); } - // Add an element to growable array if it doesn't need to grow, otherwise // call into regular code. // On stack: growable array (+1), value (+0). @@ -160,7 +153,6 @@ void Intrinsifier::GrowableArray_add(Assembler* assembler) { __ Bind(&fall_through); } - static int GetScaleFactor(intptr_t size) { switch (size) { case 1: @@ -178,7 +170,6 @@ static int GetScaleFactor(intptr_t size) { return -1; } - #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_shift) \ Label fall_through; \ const intptr_t kArrayLengthStackOffset = 0 * kWordSize; \ @@ -262,7 +253,6 @@ static int GetScaleFactor(intptr_t size) { __ ret(); \ __ Bind(&fall_through); - #define TYPED_DATA_ALLOCATOR(clazz) \ void Intrinsifier::TypedData_##clazz##_factory(Assembler* assembler) { \ intptr_t size = TypedData::ElementSizeInBytes(kTypedData##clazz##Cid); \ @@ -273,7 +263,6 @@ static int GetScaleFactor(intptr_t size) { CLASS_LIST_TYPED_DATA(TYPED_DATA_ALLOCATOR) #undef TYPED_DATA_ALLOCATOR - // Loads args from stack into R0 and R1 // Tests if they are smis, jumps to label not_smi if not. static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) { @@ -284,7 +273,6 @@ static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) { __ b(not_smi, NE); } - void Intrinsifier::Integer_addFromInteger(Assembler* assembler) { Label fall_through; TestBothArgumentsSmis(assembler, &fall_through); // Checks two smis. @@ -294,12 +282,10 @@ void Intrinsifier::Integer_addFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_add(Assembler* assembler) { Integer_addFromInteger(assembler); } - void Intrinsifier::Integer_subFromInteger(Assembler* assembler) { Label fall_through; TestBothArgumentsSmis(assembler, &fall_through); @@ -309,7 +295,6 @@ void Intrinsifier::Integer_subFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_sub(Assembler* assembler) { Label fall_through; TestBothArgumentsSmis(assembler, &fall_through); @@ -319,7 +304,6 @@ void Intrinsifier::Integer_sub(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_mulFromInteger(Assembler* assembler) { Label fall_through; @@ -336,12 +320,10 @@ void Intrinsifier::Integer_mulFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_mul(Assembler* assembler) { Integer_mulFromInteger(assembler); } - // Optimizations: // - result is 0 if: // - left is 0 @@ -390,7 +372,6 @@ static void EmitRemainderOperation(Assembler* assembler) { __ msub(result, right, tmp, left); // result <- left - right * tmp } - // Implementation: // res = left % right; // if (res < 0) { @@ -433,7 +414,6 @@ void Intrinsifier::Integer_moduloFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_truncDivide(Assembler* assembler) { // Check to see if we have integer division Label fall_through; @@ -456,7 +436,6 @@ void Intrinsifier::Integer_truncDivide(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_negate(Assembler* assembler) { Label fall_through; __ ldr(R0, Address(SP, +0 * kWordSize)); // Grab first argument. @@ -468,7 +447,6 @@ void Intrinsifier::Integer_negate(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_bitAndFromInteger(Assembler* assembler) { Label fall_through; TestBothArgumentsSmis(assembler, &fall_through); // Checks two smis. @@ -477,12 +455,10 @@ void Intrinsifier::Integer_bitAndFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_bitAnd(Assembler* assembler) { Integer_bitAndFromInteger(assembler); } - void Intrinsifier::Integer_bitOrFromInteger(Assembler* assembler) { Label fall_through; TestBothArgumentsSmis(assembler, &fall_through); // Checks two smis. @@ -491,12 +467,10 @@ void Intrinsifier::Integer_bitOrFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_bitOr(Assembler* assembler) { Integer_bitOrFromInteger(assembler); } - void Intrinsifier::Integer_bitXorFromInteger(Assembler* assembler) { Label fall_through; @@ -506,12 +480,10 @@ void Intrinsifier::Integer_bitXorFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_bitXor(Assembler* assembler) { Integer_bitXorFromInteger(assembler); } - void Intrinsifier::Integer_shl(Assembler* assembler) { ASSERT(kSmiTagShift == 1); ASSERT(kSmiTag == 0); @@ -539,7 +511,6 @@ void Intrinsifier::Integer_shl(Assembler* assembler) { __ Bind(&fall_through); } - static void CompareIntegers(Assembler* assembler, Condition true_condition) { Label fall_through, true_label; TestBothArgumentsSmis(assembler, &fall_through); @@ -552,32 +523,26 @@ static void CompareIntegers(Assembler* assembler, Condition true_condition) { __ Bind(&fall_through); } - void Intrinsifier::Integer_greaterThanFromInt(Assembler* assembler) { CompareIntegers(assembler, LT); } - void Intrinsifier::Integer_lessThan(Assembler* assembler) { Integer_greaterThanFromInt(assembler); } - void Intrinsifier::Integer_greaterThan(Assembler* assembler) { CompareIntegers(assembler, GT); } - void Intrinsifier::Integer_lessEqualThan(Assembler* assembler) { CompareIntegers(assembler, LE); } - void Intrinsifier::Integer_greaterEqualThan(Assembler* assembler) { CompareIntegers(assembler, GE); } - // This is called for Smi, Mint and Bigint receivers. The right argument // can be Smi, Mint, Bigint or double. void Intrinsifier::Integer_equalToInteger(Assembler* assembler) { @@ -630,12 +595,10 @@ void Intrinsifier::Integer_equalToInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_equal(Assembler* assembler) { Integer_equalToInteger(assembler); } - void Intrinsifier::Integer_sar(Assembler* assembler) { Label fall_through; @@ -658,7 +621,6 @@ void Intrinsifier::Integer_sar(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Smi_bitNegate(Assembler* assembler) { __ ldr(R0, Address(SP, 0 * kWordSize)); __ mvn(R0, R0); @@ -666,7 +628,6 @@ void Intrinsifier::Smi_bitNegate(Assembler* assembler) { __ ret(); } - void Intrinsifier::Smi_bitLength(Assembler* assembler) { __ ldr(R0, Address(SP, 0 * kWordSize)); __ SmiUntag(R0); @@ -679,12 +640,10 @@ void Intrinsifier::Smi_bitLength(Assembler* assembler) { __ ret(); } - void Intrinsifier::Smi_bitAndFromSmi(Assembler* assembler) { Integer_bitAndFromInteger(assembler); } - void Intrinsifier::Bigint_lsh(Assembler* assembler) { // static void _lsh(Uint32List x_digits, int x_used, int n, // Uint32List r_digits) @@ -703,8 +662,9 @@ void Intrinsifier::Bigint_lsh(Assembler* assembler) { // R7 = &x_digits[2*R2] __ add(R7, R6, Operand(R2, LSL, 3)); // R8 = &r_digits[2*1] - __ add(R8, R4, Operand(TypedData::data_offset() - kHeapObjectTag + - 2 * Bigint::kBytesPerDigit)); + __ add(R8, R4, + Operand(TypedData::data_offset() - kHeapObjectTag + + 2 * Bigint::kBytesPerDigit)); // R8 = &r_digits[2*(R2 + n ~/ (2*_DIGIT_BITS) + 1)] __ add(R0, R0, Operand(R2)); __ add(R8, R8, Operand(R0, LSL, 3)); @@ -728,7 +688,6 @@ void Intrinsifier::Bigint_lsh(Assembler* assembler) { __ ret(); } - void Intrinsifier::Bigint_rsh(Assembler* assembler) { // static void _lsh(Uint32List x_digits, int x_used, int n, // Uint32List r_digits) @@ -776,7 +735,6 @@ void Intrinsifier::Bigint_rsh(Assembler* assembler) { __ ret(); } - void Intrinsifier::Bigint_absAdd(Assembler* assembler) { // static void _absAdd(Uint32List digits, int used, // Uint32List a_digits, int a_used, @@ -842,7 +800,6 @@ void Intrinsifier::Bigint_absAdd(Assembler* assembler) { __ ret(); } - void Intrinsifier::Bigint_absSub(Assembler* assembler) { // static void _absSub(Uint32List digits, int used, // Uint32List a_digits, int a_used, @@ -902,7 +859,6 @@ void Intrinsifier::Bigint_absSub(Assembler* assembler) { __ ret(); } - void Intrinsifier::Bigint_mulAdd(Assembler* assembler) { // Pseudo code: // static int _mulAdd(Uint32List x_digits, int xi, @@ -1013,7 +969,6 @@ void Intrinsifier::Bigint_mulAdd(Assembler* assembler) { __ ret(); } - void Intrinsifier::Bigint_sqrAdd(Assembler* assembler) { // Pseudo code: // static int _sqrAdd(Uint32List x_digits, int i, @@ -1128,7 +1083,6 @@ void Intrinsifier::Bigint_sqrAdd(Assembler* assembler) { __ ret(); } - void Intrinsifier::Bigint_estQuotientDigit(Assembler* assembler) { // There is no 128-bit by 64-bit division instruction on arm64, so we use two // 64-bit by 32-bit divisions and two 64-bit by 64-bit multiplications to @@ -1302,7 +1256,6 @@ void Intrinsifier::Bigint_estQuotientDigit(Assembler* assembler) { __ ret(); } - void Intrinsifier::Montgomery_mulMod(Assembler* assembler) { // Pseudo code: // static int _mulMod(Uint32List args, Uint32List digits, int i) { @@ -1337,7 +1290,6 @@ void Intrinsifier::Montgomery_mulMod(Assembler* assembler) { __ ret(); } - // Check if the last argument is a double, jump to label 'is_smi' if smi // (easy to convert to double), otherwise jump to label 'not_double_smi', // Returns the last argument in R0. @@ -1352,7 +1304,6 @@ static void TestLastArgumentIsDouble(Assembler* assembler, // Fall through with Double in R0. } - // Both arguments on stack, arg0 (left) is a double, arg1 (right) is of unknown // type. Return true or false object in the register R0. Any NaN argument // returns false. Any non-double arg1 causes control flow to fall through to the @@ -1385,32 +1336,26 @@ static void CompareDoubles(Assembler* assembler, Condition true_condition) { __ Bind(&fall_through); } - void Intrinsifier::Double_greaterThan(Assembler* assembler) { CompareDoubles(assembler, HI); } - void Intrinsifier::Double_greaterEqualThan(Assembler* assembler) { CompareDoubles(assembler, CS); } - void Intrinsifier::Double_lessThan(Assembler* assembler) { CompareDoubles(assembler, CC); } - void Intrinsifier::Double_equal(Assembler* assembler) { CompareDoubles(assembler, EQ); } - void Intrinsifier::Double_lessEqualThan(Assembler* assembler) { CompareDoubles(assembler, LS); } - // Expects left argument to be double (receiver). Right argument is unknown. // Both arguments are on stack. static void DoubleArithmeticOperations(Assembler* assembler, Token::Kind kind) { @@ -1452,27 +1397,22 @@ static void DoubleArithmeticOperations(Assembler* assembler, Token::Kind kind) { __ Bind(&fall_through); } - void Intrinsifier::Double_add(Assembler* assembler) { DoubleArithmeticOperations(assembler, Token::kADD); } - void Intrinsifier::Double_mul(Assembler* assembler) { DoubleArithmeticOperations(assembler, Token::kMUL); } - void Intrinsifier::Double_sub(Assembler* assembler) { DoubleArithmeticOperations(assembler, Token::kSUB); } - void Intrinsifier::Double_div(Assembler* assembler) { DoubleArithmeticOperations(assembler, Token::kDIV); } - // Left is double right is integer (Bigint, Mint or Smi) void Intrinsifier::Double_mulFromInteger(Assembler* assembler) { Label fall_through; @@ -1494,7 +1434,6 @@ void Intrinsifier::Double_mulFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::DoubleFromInteger(Assembler* assembler) { Label fall_through; @@ -1512,7 +1451,6 @@ void Intrinsifier::DoubleFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Double_getIsNaN(Assembler* assembler) { __ ldr(R0, Address(SP, 0 * kWordSize)); __ LoadDFieldFromOffset(V0, R0, Double::value_offset()); @@ -1523,7 +1461,6 @@ void Intrinsifier::Double_getIsNaN(Assembler* assembler) { __ ret(); } - void Intrinsifier::Double_getIsInfinite(Assembler* assembler) { __ ldr(R0, Address(SP, 0 * kWordSize)); __ LoadFieldFromOffset(R0, R0, Double::value_offset()); @@ -1537,7 +1474,6 @@ void Intrinsifier::Double_getIsInfinite(Assembler* assembler) { __ ret(); } - void Intrinsifier::Double_getIsNegative(Assembler* assembler) { const Register false_reg = R0; const Register true_reg = R2; @@ -1567,7 +1503,6 @@ void Intrinsifier::Double_getIsNegative(Assembler* assembler) { __ ret(); } - void Intrinsifier::DoubleToInteger(Assembler* assembler) { Label fall_through; @@ -1589,7 +1524,6 @@ void Intrinsifier::DoubleToInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::MathSqrt(Assembler* assembler) { Label fall_through, is_smi, double_op; TestLastArgumentIsDouble(assembler, &is_smi, &fall_through); @@ -1609,7 +1543,6 @@ void Intrinsifier::MathSqrt(Assembler* assembler) { __ Bind(&fall_through); } - // var state = ((_A * (_state[kSTATE_LO])) + _state[kSTATE_HI]) & _MASK_64; // _state[kSTATE_LO] = state & _MASK_32; // _state[kSTATE_HI] = state >> 32; @@ -1653,7 +1586,6 @@ void Intrinsifier::Random_nextState(Assembler* assembler) { __ ret(); } - void Intrinsifier::ObjectEquals(Assembler* assembler) { __ ldr(R0, Address(SP, 0 * kWordSize)); __ ldr(R1, Address(SP, 1 * kWordSize)); @@ -1664,7 +1596,6 @@ void Intrinsifier::ObjectEquals(Assembler* assembler) { __ ret(); } - static void RangeCheck(Assembler* assembler, Register val, Register tmp, @@ -1677,11 +1608,9 @@ static void RangeCheck(Assembler* assembler, __ b(target, cc); } - const Condition kIfNotInRange = HI; const Condition kIfInRange = LS; - static void JumpIfInteger(Assembler* assembler, Register cid, Register tmp, @@ -1689,7 +1618,6 @@ static void JumpIfInteger(Assembler* assembler, RangeCheck(assembler, cid, tmp, kSmiCid, kBigintCid, kIfInRange, target); } - static void JumpIfNotInteger(Assembler* assembler, Register cid, Register tmp, @@ -1697,7 +1625,6 @@ static void JumpIfNotInteger(Assembler* assembler, RangeCheck(assembler, cid, tmp, kSmiCid, kBigintCid, kIfNotInRange, target); } - static void JumpIfString(Assembler* assembler, Register cid, Register tmp, @@ -1706,7 +1633,6 @@ static void JumpIfString(Assembler* assembler, kIfInRange, target); } - static void JumpIfNotString(Assembler* assembler, Register cid, Register tmp, @@ -1715,7 +1641,6 @@ static void JumpIfNotString(Assembler* assembler, kIfNotInRange, target); } - // Return type quickly for simple types (not parameterized and not signature). void Intrinsifier::ObjectRuntimeType(Assembler* assembler) { Label fall_through, use_canonical_type, not_double, not_integer; @@ -1764,7 +1689,6 @@ void Intrinsifier::ObjectRuntimeType(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::ObjectHaveSameRuntimeType(Assembler* assembler) { Label fall_through, different_cids, equal, not_equal, not_integer; __ ldr(R0, Address(SP, 0 * kWordSize)); @@ -1819,7 +1743,6 @@ void Intrinsifier::ObjectHaveSameRuntimeType(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::String_getHashCode(Assembler* assembler) { Label fall_through; __ ldr(R0, Address(SP, 0 * kWordSize)); @@ -1831,7 +1754,6 @@ void Intrinsifier::String_getHashCode(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Object_getHash(Assembler* assembler) { __ ldr(R0, Address(SP, 0 * kWordSize)); __ ldr(R0, FieldAddress(R0, String::hash_offset()), kUnsignedWord); @@ -1839,7 +1761,6 @@ void Intrinsifier::Object_getHash(Assembler* assembler) { __ ret(); } - void Intrinsifier::Object_setHash(Assembler* assembler) { __ ldr(R0, Address(SP, 1 * kWordSize)); // Object. __ ldr(R1, Address(SP, 0 * kWordSize)); // Value. @@ -1848,7 +1769,6 @@ void Intrinsifier::Object_setHash(Assembler* assembler) { __ ret(); } - void GenerateSubstringMatchesSpecialization(Assembler* assembler, intptr_t receiver_cid, intptr_t other_cid, @@ -1915,7 +1835,6 @@ void GenerateSubstringMatchesSpecialization(Assembler* assembler, __ b(return_true); } - // bool _substringMatches(int start, String other) // This intrinsic handles a OneByteString or TwoByteString receiver with a // OneByteString other. @@ -1957,7 +1876,6 @@ void Intrinsifier::StringBaseSubstringMatches(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::StringBaseCharAt(Assembler* assembler) { Label fall_through, try_two_byte_string; @@ -1998,7 +1916,6 @@ void Intrinsifier::StringBaseCharAt(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::StringBaseIsEmpty(Assembler* assembler) { __ ldr(R0, Address(SP, 0 * kWordSize)); __ ldr(R0, FieldAddress(R0, String::length_offset())); @@ -2009,7 +1926,6 @@ void Intrinsifier::StringBaseIsEmpty(Assembler* assembler) { __ ret(); } - void Intrinsifier::OneByteString_getHashCode(Assembler* assembler) { Label compute_hash; __ ldr(R1, Address(SP, 0 * kWordSize)); // OneByteString object. @@ -2069,7 +1985,6 @@ void Intrinsifier::OneByteString_getHashCode(Assembler* assembler) { __ ret(); } - // Allocates one-byte string of length 'end - start'. The content is not // initialized. // 'length-reg' (R2) contains tagged length. @@ -2146,7 +2061,6 @@ static void TryAllocateOnebyteString(Assembler* assembler, __ b(failure); } - // Arg0: OneByteString (receiver). // Arg1: Start index as Smi. // Arg2: End index as Smi. @@ -2206,7 +2120,6 @@ void Intrinsifier::OneByteString_substringUnchecked(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::OneByteStringSetAt(Assembler* assembler) { __ ldr(R2, Address(SP, 0 * kWordSize)); // Value. __ ldr(R1, Address(SP, 1 * kWordSize)); // Index. @@ -2218,7 +2131,6 @@ void Intrinsifier::OneByteStringSetAt(Assembler* assembler) { __ ret(); } - void Intrinsifier::OneByteString_allocate(Assembler* assembler) { Label fall_through, ok; @@ -2231,7 +2143,6 @@ void Intrinsifier::OneByteString_allocate(Assembler* assembler) { __ Bind(&fall_through); } - // TODO(srdjan): Add combinations (one-byte/two-byte/external strings). static void StringEquality(Assembler* assembler, intptr_t string_cid) { Label fall_through, is_true, is_false, loop; @@ -2296,17 +2207,14 @@ static void StringEquality(Assembler* assembler, intptr_t string_cid) { __ Bind(&fall_through); } - void Intrinsifier::OneByteString_equality(Assembler* assembler) { StringEquality(assembler, kOneByteStringCid); } - void Intrinsifier::TwoByteString_equality(Assembler* assembler) { StringEquality(assembler, kTwoByteStringCid); } - void Intrinsifier::IntrinsifyRegExpExecuteMatch(Assembler* assembler, bool sticky) { if (FLAG_interpret_irregexp) return; @@ -2340,7 +2248,6 @@ void Intrinsifier::IntrinsifyRegExpExecuteMatch(Assembler* assembler, __ br(R1); } - // On stack: user tag (+0). void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { // R1: Isolate. @@ -2358,21 +2265,18 @@ void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { __ ret(); } - void Intrinsifier::UserTag_defaultTag(Assembler* assembler) { __ LoadIsolate(R0); __ ldr(R0, Address(R0, Isolate::default_tag_offset())); __ ret(); } - void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { __ LoadIsolate(R0); __ ldr(R0, Address(R0, Isolate::current_tag_offset())); __ ret(); } - void Intrinsifier::Timeline_isDartStreamEnabled(Assembler* assembler) { if (!FLAG_support_timeline) { __ LoadObject(R0, Bool::False()); @@ -2390,14 +2294,12 @@ void Intrinsifier::Timeline_isDartStreamEnabled(Assembler* assembler) { __ ret(); } - void Intrinsifier::ClearAsyncThreadStackTrace(Assembler* assembler) { __ LoadObject(R0, Object::null_object()); __ str(R0, Address(THR, Thread::async_stack_trace_offset())); __ ret(); } - void Intrinsifier::SetAsyncThreadStackTrace(Assembler* assembler) { __ ldr(R0, Address(THR, Thread::async_stack_trace_offset())); __ LoadObject(R0, Object::null_object()); diff --git a/runtime/vm/intrinsifier_dbc.cc b/runtime/vm/intrinsifier_dbc.cc index e96746824af..5ffe3a40c0e 100644 --- a/runtime/vm/intrinsifier_dbc.cc +++ b/runtime/vm/intrinsifier_dbc.cc @@ -14,8 +14,8 @@ #include "vm/object.h" #include "vm/object_store.h" #include "vm/regexp_assembler.h" -#include "vm/symbols.h" #include "vm/simulator.h" +#include "vm/symbols.h" namespace dart { diff --git a/runtime/vm/intrinsifier_ia32.cc b/runtime/vm/intrinsifier_ia32.cc index d739d35adc0..24cb10f4380 100644 --- a/runtime/vm/intrinsifier_ia32.cc +++ b/runtime/vm/intrinsifier_ia32.cc @@ -36,12 +36,10 @@ namespace dart { #define __ assembler-> - intptr_t Intrinsifier::ParameterSlotFromSp() { return 0; } - void Intrinsifier::IntrinsicCallPrologue(Assembler* assembler) { COMPILE_ASSERT(CALLEE_SAVED_TEMP != ARGS_DESC_REG); @@ -49,13 +47,11 @@ void Intrinsifier::IntrinsicCallPrologue(Assembler* assembler) { assembler->movl(CALLEE_SAVED_TEMP, ARGS_DESC_REG); } - void Intrinsifier::IntrinsicCallEpilogue(Assembler* assembler) { assembler->Comment("IntrinsicCallEpilogue"); assembler->movl(ARGS_DESC_REG, CALLEE_SAVED_TEMP); } - static intptr_t ComputeObjectArrayTypeArgumentsOffset() { const Library& core_lib = Library::Handle(Library::CoreLibrary()); const Class& cls = @@ -67,7 +63,6 @@ static intptr_t ComputeObjectArrayTypeArgumentsOffset() { return field_offset; } - // Intrinsify only for Smi value and index. Non-smi values need a store buffer // update. Array length is always a Smi. void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) { @@ -123,7 +118,6 @@ void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) { __ Bind(&fall_through); } - // Allocate a GrowableObjectArray using the backing array specified. // On stack: type argument (+2), data (+1), return-address (+0). void Intrinsifier::GrowableArray_Allocate(Assembler* assembler) { @@ -158,7 +152,6 @@ void Intrinsifier::GrowableArray_Allocate(Assembler* assembler) { __ Bind(&fall_through); } - // Add an element to growable array if it doesn't need to grow, otherwise // call into regular code. // On stack: growable array (+2), value (+1), return-address (+0). @@ -188,7 +181,6 @@ void Intrinsifier::GrowableArray_add(Assembler* assembler) { __ Bind(&fall_through); } - #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_factor) \ Label fall_through; \ const intptr_t kArrayLengthStackOffset = 1 * kWordSize; \ @@ -284,7 +276,6 @@ void Intrinsifier::GrowableArray_add(Assembler* assembler) { __ ret(); \ __ Bind(&fall_through); - static ScaleFactor GetScaleFactor(intptr_t size) { switch (size) { case 1: @@ -302,7 +293,6 @@ static ScaleFactor GetScaleFactor(intptr_t size) { return static_cast(0); } - #define TYPED_DATA_ALLOCATOR(clazz) \ void Intrinsifier::TypedData_##clazz##_factory(Assembler* assembler) { \ intptr_t size = TypedData::ElementSizeInBytes(kTypedData##clazz##Cid); \ @@ -313,7 +303,6 @@ static ScaleFactor GetScaleFactor(intptr_t size) { CLASS_LIST_TYPED_DATA(TYPED_DATA_ALLOCATOR) #undef TYPED_DATA_ALLOCATOR - // Tests if two top most arguments are smis, jumps to label not_smi if not. // Topmost argument is in EAX. static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) { @@ -324,7 +313,6 @@ static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) { __ j(NOT_ZERO, not_smi, Assembler::kNearJump); } - void Intrinsifier::Integer_addFromInteger(Assembler* assembler) { Label fall_through; TestBothArgumentsSmis(assembler, &fall_through); @@ -335,12 +323,10 @@ void Intrinsifier::Integer_addFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_add(Assembler* assembler) { Integer_addFromInteger(assembler); } - void Intrinsifier::Integer_subFromInteger(Assembler* assembler) { Label fall_through; TestBothArgumentsSmis(assembler, &fall_through); @@ -351,7 +337,6 @@ void Intrinsifier::Integer_subFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_sub(Assembler* assembler) { Label fall_through; TestBothArgumentsSmis(assembler, &fall_through); @@ -364,7 +349,6 @@ void Intrinsifier::Integer_sub(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_mulFromInteger(Assembler* assembler) { Label fall_through; TestBothArgumentsSmis(assembler, &fall_through); @@ -377,12 +361,10 @@ void Intrinsifier::Integer_mulFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_mul(Assembler* assembler) { Integer_mulFromInteger(assembler); } - // Optimizations: // - result is 0 if: // - left is 0 @@ -422,7 +404,6 @@ static void EmitRemainderOperation(Assembler* assembler) { __ idivl(EBX); } - // Implementation: // res = left % right; // if (res < 0) { @@ -465,7 +446,6 @@ void Intrinsifier::Integer_moduloFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_truncDivide(Assembler* assembler) { Label fall_through; TestBothArgumentsSmis(assembler, &fall_through); @@ -489,7 +469,6 @@ void Intrinsifier::Integer_truncDivide(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_negate(Assembler* assembler) { Label fall_through; __ movl(EAX, Address(ESP, +1 * kWordSize)); @@ -502,7 +481,6 @@ void Intrinsifier::Integer_negate(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_bitAndFromInteger(Assembler* assembler) { Label fall_through; TestBothArgumentsSmis(assembler, &fall_through); @@ -513,12 +491,10 @@ void Intrinsifier::Integer_bitAndFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_bitAnd(Assembler* assembler) { Integer_bitAndFromInteger(assembler); } - void Intrinsifier::Integer_bitOrFromInteger(Assembler* assembler) { Label fall_through; TestBothArgumentsSmis(assembler, &fall_through); @@ -529,12 +505,10 @@ void Intrinsifier::Integer_bitOrFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_bitOr(Assembler* assembler) { Integer_bitOrFromInteger(assembler); } - void Intrinsifier::Integer_bitXorFromInteger(Assembler* assembler) { Label fall_through; TestBothArgumentsSmis(assembler, &fall_through); @@ -545,12 +519,10 @@ void Intrinsifier::Integer_bitXorFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_bitXor(Assembler* assembler) { Integer_bitXorFromInteger(assembler); } - void Intrinsifier::Integer_shl(Assembler* assembler) { ASSERT(kSmiTagShift == 1); ASSERT(kSmiTag == 0); @@ -599,7 +571,6 @@ void Intrinsifier::Integer_shl(Assembler* assembler) { __ Bind(&fall_through); } - static void Push64SmiOrMint(Assembler* assembler, Register reg, Register tmp, @@ -623,7 +594,6 @@ static void Push64SmiOrMint(Assembler* assembler, __ Bind(&done); } - static void CompareIntegers(Assembler* assembler, Condition true_condition) { Label try_mint_smi, is_true, is_false, drop_two_fall_through, fall_through; TestBothArgumentsSmis(assembler, &try_mint_smi); @@ -682,32 +652,26 @@ static void CompareIntegers(Assembler* assembler, Condition true_condition) { __ Bind(&fall_through); } - void Intrinsifier::Integer_greaterThanFromInt(Assembler* assembler) { CompareIntegers(assembler, LESS); } - void Intrinsifier::Integer_lessThan(Assembler* assembler) { Integer_greaterThanFromInt(assembler); } - void Intrinsifier::Integer_greaterThan(Assembler* assembler) { CompareIntegers(assembler, GREATER); } - void Intrinsifier::Integer_lessEqualThan(Assembler* assembler) { CompareIntegers(assembler, LESS_EQUAL); } - void Intrinsifier::Integer_greaterEqualThan(Assembler* assembler) { CompareIntegers(assembler, GREATER_EQUAL); } - // This is called for Smi, Mint and Bigint receivers. The right argument // can be Smi, Mint, Bigint or double. void Intrinsifier::Integer_equalToInteger(Assembler* assembler) { @@ -758,12 +722,10 @@ void Intrinsifier::Integer_equalToInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_equal(Assembler* assembler) { Integer_equalToInteger(assembler); } - void Intrinsifier::Integer_sar(Assembler* assembler) { Label fall_through, shift_count_ok; TestBothArgumentsSmis(assembler, &fall_through); @@ -789,7 +751,6 @@ void Intrinsifier::Integer_sar(Assembler* assembler) { __ Bind(&fall_through); } - // Argument is Smi (receiver). void Intrinsifier::Smi_bitNegate(Assembler* assembler) { __ movl(EAX, Address(ESP, +1 * kWordSize)); // Receiver. @@ -798,7 +759,6 @@ void Intrinsifier::Smi_bitNegate(Assembler* assembler) { __ ret(); } - void Intrinsifier::Smi_bitLength(Assembler* assembler) { ASSERT(kSmiTagShift == 1); __ movl(EAX, Address(ESP, +1 * kWordSize)); // Receiver. @@ -814,12 +774,10 @@ void Intrinsifier::Smi_bitLength(Assembler* assembler) { __ ret(); } - void Intrinsifier::Smi_bitAndFromSmi(Assembler* assembler) { Integer_bitAndFromInteger(assembler); } - void Intrinsifier::Bigint_lsh(Assembler* assembler) { // static void _lsh(Uint32List x_digits, int x_used, int n, // Uint32List r_digits) @@ -864,7 +822,6 @@ void Intrinsifier::Bigint_lsh(Assembler* assembler) { __ ret(); } - void Intrinsifier::Bigint_rsh(Assembler* assembler) { // static void _rsh(Uint32List x_digits, int x_used, int n, // Uint32List r_digits) @@ -910,7 +867,6 @@ void Intrinsifier::Bigint_rsh(Assembler* assembler) { __ ret(); } - void Intrinsifier::Bigint_absAdd(Assembler* assembler) { // static void _absAdd(Uint32List digits, int used, // Uint32List a_digits, int a_used, @@ -970,7 +926,6 @@ void Intrinsifier::Bigint_absAdd(Assembler* assembler) { __ ret(); } - void Intrinsifier::Bigint_absSub(Assembler* assembler) { // static void _absSub(Uint32List digits, int used, // Uint32List a_digits, int a_used, @@ -1026,7 +981,6 @@ void Intrinsifier::Bigint_absSub(Assembler* assembler) { __ ret(); } - void Intrinsifier::Bigint_mulAdd(Assembler* assembler) { // Pseudo code: // static int _mulAdd(Uint32List x_digits, int xi, @@ -1146,7 +1100,6 @@ void Intrinsifier::Bigint_mulAdd(Assembler* assembler) { __ ret(); } - void Intrinsifier::Bigint_sqrAdd(Assembler* assembler) { // Pseudo code: // static int _sqrAdd(Uint32List x_digits, int i, @@ -1279,7 +1232,6 @@ void Intrinsifier::Bigint_sqrAdd(Assembler* assembler) { __ ret(); } - void Intrinsifier::Bigint_estQuotientDigit(Assembler* assembler) { // Pseudo code: // static int _estQuotientDigit(Uint32List args, Uint32List digits, int i) { @@ -1336,7 +1288,6 @@ void Intrinsifier::Bigint_estQuotientDigit(Assembler* assembler) { __ ret(); } - void Intrinsifier::Montgomery_mulMod(Assembler* assembler) { // Pseudo code: // static int _mulMod(Uint32List args, Uint32List digits, int i) { @@ -1371,7 +1322,6 @@ void Intrinsifier::Montgomery_mulMod(Assembler* assembler) { __ ret(); } - // Check if the last argument is a double, jump to label 'is_smi' if smi // (easy to convert to double), otherwise jump to label 'not_double_smi', // Returns the last argument in EAX. @@ -1386,7 +1336,6 @@ static void TestLastArgumentIsDouble(Assembler* assembler, // Fall through if double. } - // Both arguments on stack, arg0 (left) is a double, arg1 (right) is of unknown // type. Return true or false object in the register EAX. Any NaN argument // returns false. Any non-double arg1 causes control flow to fall through to the @@ -1416,37 +1365,31 @@ static void CompareDoubles(Assembler* assembler, Condition true_condition) { __ Bind(&fall_through); } - // arg0 is Double, arg1 is unknown. void Intrinsifier::Double_greaterThan(Assembler* assembler) { CompareDoubles(assembler, ABOVE); } - // arg0 is Double, arg1 is unknown. void Intrinsifier::Double_greaterEqualThan(Assembler* assembler) { CompareDoubles(assembler, ABOVE_EQUAL); } - // arg0 is Double, arg1 is unknown. void Intrinsifier::Double_lessThan(Assembler* assembler) { CompareDoubles(assembler, BELOW); } - // arg0 is Double, arg1 is unknown. void Intrinsifier::Double_equal(Assembler* assembler) { CompareDoubles(assembler, EQUAL); } - // arg0 is Double, arg1 is unknown. void Intrinsifier::Double_lessEqualThan(Assembler* assembler) { CompareDoubles(assembler, BELOW_EQUAL); } - // Expects left argument to be double (receiver). Right argument is unknown. // Both arguments are on stack. static void DoubleArithmeticOperations(Assembler* assembler, Token::Kind kind) { @@ -1487,27 +1430,22 @@ static void DoubleArithmeticOperations(Assembler* assembler, Token::Kind kind) { __ Bind(&fall_through); } - void Intrinsifier::Double_add(Assembler* assembler) { DoubleArithmeticOperations(assembler, Token::kADD); } - void Intrinsifier::Double_mul(Assembler* assembler) { DoubleArithmeticOperations(assembler, Token::kMUL); } - void Intrinsifier::Double_sub(Assembler* assembler) { DoubleArithmeticOperations(assembler, Token::kSUB); } - void Intrinsifier::Double_div(Assembler* assembler) { DoubleArithmeticOperations(assembler, Token::kDIV); } - // Left is double right is integer (Bigint, Mint or Smi) void Intrinsifier::Double_mulFromInteger(Assembler* assembler) { Label fall_through; @@ -1531,7 +1469,6 @@ void Intrinsifier::Double_mulFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::DoubleFromInteger(Assembler* assembler) { Label fall_through; __ movl(EAX, Address(ESP, +1 * kWordSize)); @@ -1550,7 +1487,6 @@ void Intrinsifier::DoubleFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Double_getIsNaN(Assembler* assembler) { Label is_true; __ movl(EAX, Address(ESP, +1 * kWordSize)); @@ -1564,7 +1500,6 @@ void Intrinsifier::Double_getIsNaN(Assembler* assembler) { __ ret(); } - void Intrinsifier::Double_getIsInfinite(Assembler* assembler) { Label not_inf; __ movl(EAX, Address(ESP, +1 * kWordSize)); @@ -1588,7 +1523,6 @@ void Intrinsifier::Double_getIsInfinite(Assembler* assembler) { __ ret(); } - void Intrinsifier::Double_getIsNegative(Assembler* assembler) { Label is_false, is_true, is_zero; __ movl(EAX, Address(ESP, +1 * kWordSize)); @@ -1612,7 +1546,6 @@ void Intrinsifier::Double_getIsNegative(Assembler* assembler) { __ jmp(&is_false, Assembler::kNearJump); } - void Intrinsifier::DoubleToInteger(Assembler* assembler) { __ movl(EAX, Address(ESP, +1 * kWordSize)); __ movsd(XMM0, FieldAddress(EAX, Double::value_offset())); @@ -1627,7 +1560,6 @@ void Intrinsifier::DoubleToInteger(Assembler* assembler) { __ Bind(&fall_through); } - // Argument type is not known void Intrinsifier::MathSqrt(Assembler* assembler) { Label fall_through, is_smi, double_op; @@ -1650,7 +1582,6 @@ void Intrinsifier::MathSqrt(Assembler* assembler) { __ Bind(&fall_through); } - // var state = ((_A * (_state[kSTATE_LO])) + _state[kSTATE_HI]) & _MASK_64; // _state[kSTATE_LO] = state & _MASK_32; // _state[kSTATE_HI] = state >> 32; @@ -1696,7 +1627,6 @@ void Intrinsifier::Random_nextState(Assembler* assembler) { __ ret(); } - // Identity comparison. void Intrinsifier::ObjectEquals(Assembler* assembler) { Label is_true; @@ -1710,7 +1640,6 @@ void Intrinsifier::ObjectEquals(Assembler* assembler) { __ ret(); } - static void RangeCheck(Assembler* assembler, Register reg, intptr_t low, @@ -1722,35 +1651,29 @@ static void RangeCheck(Assembler* assembler, __ j(cc, target); } - const Condition kIfNotInRange = ABOVE; const Condition kIfInRange = BELOW_EQUAL; - static void JumpIfInteger(Assembler* assembler, Register cid, Label* target) { RangeCheck(assembler, cid, kSmiCid, kBigintCid, kIfInRange, target); } - static void JumpIfNotInteger(Assembler* assembler, Register cid, Label* target) { RangeCheck(assembler, cid, kSmiCid, kBigintCid, kIfNotInRange, target); } - static void JumpIfString(Assembler* assembler, Register cid, Label* target) { RangeCheck(assembler, cid, kOneByteStringCid, kExternalTwoByteStringCid, kIfInRange, target); } - static void JumpIfNotString(Assembler* assembler, Register cid, Label* target) { RangeCheck(assembler, cid, kOneByteStringCid, kExternalTwoByteStringCid, kIfNotInRange, target); } - // Return type quickly for simple types (not parameterized and not signature). void Intrinsifier::ObjectRuntimeType(Assembler* assembler) { Label fall_through, use_canonical_type, not_double, not_integer; @@ -1807,7 +1730,6 @@ void Intrinsifier::ObjectRuntimeType(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::ObjectHaveSameRuntimeType(Assembler* assembler) { Label fall_through, different_cids, equal, not_equal, not_integer; @@ -1871,7 +1793,6 @@ void Intrinsifier::ObjectHaveSameRuntimeType(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::String_getHashCode(Assembler* assembler) { Label fall_through; __ movl(EAX, Address(ESP, +1 * kWordSize)); // String object. @@ -1883,23 +1804,19 @@ void Intrinsifier::String_getHashCode(Assembler* assembler) { // Hash not yet computed. } - // bool _substringMatches(int start, String other) void Intrinsifier::StringBaseSubstringMatches(Assembler* assembler) { // For precompilation, not implemented on IA32. } - void Intrinsifier::Object_getHash(Assembler* assembler) { UNREACHABLE(); } - void Intrinsifier::Object_setHash(Assembler* assembler) { UNREACHABLE(); } - void Intrinsifier::StringBaseCharAt(Assembler* assembler) { Label fall_through, try_two_byte_string; __ movl(EBX, Address(ESP, +1 * kWordSize)); // Index. @@ -1938,7 +1855,6 @@ void Intrinsifier::StringBaseCharAt(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::StringBaseIsEmpty(Assembler* assembler) { Label is_true; // Get length. @@ -1953,7 +1869,6 @@ void Intrinsifier::StringBaseIsEmpty(Assembler* assembler) { __ ret(); } - void Intrinsifier::OneByteString_getHashCode(Assembler* assembler) { Label compute_hash; __ movl(EBX, Address(ESP, +1 * kWordSize)); // OneByteString object. @@ -2022,7 +1937,6 @@ void Intrinsifier::OneByteString_getHashCode(Assembler* assembler) { __ ret(); } - // Allocates one-byte string of length 'end - start'. The content is not // initialized. 'length-reg' contains tagged length. // Returns new string as tagged pointer in EAX. @@ -2102,7 +2016,6 @@ static void TryAllocateOnebyteString(Assembler* assembler, __ jmp(failure); } - // Arg0: OneByteString (receiver) // Arg1: Start index as Smi. // Arg2: End index as Smi. @@ -2151,7 +2064,6 @@ void Intrinsifier::OneByteString_substringUnchecked(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::OneByteStringSetAt(Assembler* assembler) { __ movl(ECX, Address(ESP, +1 * kWordSize)); // Value. __ movl(EBX, Address(ESP, +2 * kWordSize)); // Index. @@ -2162,7 +2074,6 @@ void Intrinsifier::OneByteStringSetAt(Assembler* assembler) { __ ret(); } - void Intrinsifier::OneByteString_allocate(Assembler* assembler) { __ movl(EDI, Address(ESP, +1 * kWordSize)); // Length. Label fall_through, ok; @@ -2175,7 +2086,6 @@ void Intrinsifier::OneByteString_allocate(Assembler* assembler) { __ Bind(&fall_through); } - // TODO(srdjan): Add combinations (one-byte/two-byte/external strings). static void StringEquality(Assembler* assembler, intptr_t string_cid) { Label fall_through, is_true, is_false, loop; @@ -2232,17 +2142,14 @@ static void StringEquality(Assembler* assembler, intptr_t string_cid) { __ Bind(&fall_through); } - void Intrinsifier::OneByteString_equality(Assembler* assembler) { StringEquality(assembler, kOneByteStringCid); } - void Intrinsifier::TwoByteString_equality(Assembler* assembler) { StringEquality(assembler, kTwoByteStringCid); } - void Intrinsifier::IntrinsifyRegExpExecuteMatch(Assembler* assembler, bool sticky) { if (FLAG_interpret_irregexp) return; @@ -2262,8 +2169,9 @@ void Intrinsifier::IntrinsifyRegExpExecuteMatch(Assembler* assembler, __ movl(EDI, Address(ESP, kStringParamOffset)); __ LoadClassId(EDI, EDI); __ SubImmediate(EDI, Immediate(kOneByteStringCid)); - __ movl(EAX, FieldAddress(EBX, EDI, TIMES_4, RegExp::function_offset( - kOneByteStringCid, sticky))); + __ movl(EAX, + FieldAddress(EBX, EDI, TIMES_4, + RegExp::function_offset(kOneByteStringCid, sticky))); // Registers are now set up for the lazy compile stub. It expects the function // in EAX, the argument descriptor in EDX, and IC-Data in ECX. @@ -2274,7 +2182,6 @@ void Intrinsifier::IntrinsifyRegExpExecuteMatch(Assembler* assembler, __ jmp(EDI); } - // On stack: user tag (+1), return-address (+0). void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { // RDI: Isolate. @@ -2292,21 +2199,18 @@ void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { __ ret(); } - void Intrinsifier::UserTag_defaultTag(Assembler* assembler) { __ LoadIsolate(EAX); __ movl(EAX, Address(EAX, Isolate::default_tag_offset())); __ ret(); } - void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { __ LoadIsolate(EAX); __ movl(EAX, Address(EAX, Isolate::current_tag_offset())); __ ret(); } - void Intrinsifier::Timeline_isDartStreamEnabled(Assembler* assembler) { if (!FLAG_support_timeline) { __ LoadObject(EAX, Bool::False()); @@ -2329,14 +2233,12 @@ void Intrinsifier::Timeline_isDartStreamEnabled(Assembler* assembler) { __ ret(); } - void Intrinsifier::ClearAsyncThreadStackTrace(Assembler* assembler) { __ LoadObject(EAX, Object::null_object()); __ movl(Address(THR, Thread::async_stack_trace_offset()), EAX); __ ret(); } - void Intrinsifier::SetAsyncThreadStackTrace(Assembler* assembler) { __ movl(Address(THR, Thread::async_stack_trace_offset()), EAX); __ LoadObject(EAX, Object::null_object()); diff --git a/runtime/vm/intrinsifier_x64.cc b/runtime/vm/intrinsifier_x64.cc index 3b97a1bf80b..1fb4a004edf 100644 --- a/runtime/vm/intrinsifier_x64.cc +++ b/runtime/vm/intrinsifier_x64.cc @@ -28,17 +28,14 @@ namespace dart { #define __ assembler-> - intptr_t Intrinsifier::ParameterSlotFromSp() { return 0; } - static bool IsABIPreservedRegister(Register reg) { return ((1 << reg) & CallingConventions::kCalleeSaveCpuRegisters) != 0; } - void Intrinsifier::IntrinsicCallPrologue(Assembler* assembler) { ASSERT(IsABIPreservedRegister(CODE_REG)); ASSERT(!IsABIPreservedRegister(ARGS_DESC_REG)); @@ -50,13 +47,11 @@ void Intrinsifier::IntrinsicCallPrologue(Assembler* assembler) { assembler->movq(CALLEE_SAVED_TEMP, ARGS_DESC_REG); } - void Intrinsifier::IntrinsicCallEpilogue(Assembler* assembler) { assembler->Comment("IntrinsicCallEpilogue"); assembler->movq(ARGS_DESC_REG, CALLEE_SAVED_TEMP); } - void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) { if (Isolate::Current()->type_checks()) { return; @@ -82,7 +77,6 @@ void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) { __ Bind(&fall_through); } - // Allocate a GrowableObjectArray using the backing array specified. // On stack: type argument (+2), data (+1), return-address (+0). void Intrinsifier::GrowableArray_Allocate(Assembler* assembler) { @@ -118,7 +112,6 @@ void Intrinsifier::GrowableArray_Allocate(Assembler* assembler) { __ Bind(&fall_through); } - // Add an element to growable array if it doesn't need to grow, otherwise // call into regular code. // On stack: growable array (+2), value (+1), return-address (+0). @@ -146,7 +139,6 @@ void Intrinsifier::GrowableArray_add(Assembler* assembler) { __ Bind(&fall_through); } - #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_factor) \ Label fall_through; \ const intptr_t kArrayLengthStackOffset = 1 * kWordSize; \ @@ -242,7 +234,6 @@ void Intrinsifier::GrowableArray_add(Assembler* assembler) { __ ret(); \ __ Bind(&fall_through); - static ScaleFactor GetScaleFactor(intptr_t size) { switch (size) { case 1: @@ -260,7 +251,6 @@ static ScaleFactor GetScaleFactor(intptr_t size) { return static_cast(0); } - #define TYPED_DATA_ALLOCATOR(clazz) \ void Intrinsifier::TypedData_##clazz##_factory(Assembler* assembler) { \ intptr_t size = TypedData::ElementSizeInBytes(kTypedData##clazz##Cid); \ @@ -271,7 +261,6 @@ static ScaleFactor GetScaleFactor(intptr_t size) { CLASS_LIST_TYPED_DATA(TYPED_DATA_ALLOCATOR) #undef TYPED_DATA_ALLOCATOR - // Tests if two top most arguments are smis, jumps to label not_smi if not. // Topmost argument is in RAX. static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) { @@ -282,7 +271,6 @@ static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) { __ j(NOT_ZERO, not_smi); } - void Intrinsifier::Integer_addFromInteger(Assembler* assembler) { Label fall_through; TestBothArgumentsSmis(assembler, &fall_through); @@ -294,12 +282,10 @@ void Intrinsifier::Integer_addFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_add(Assembler* assembler) { Integer_addFromInteger(assembler); } - void Intrinsifier::Integer_subFromInteger(Assembler* assembler) { Label fall_through; TestBothArgumentsSmis(assembler, &fall_through); @@ -311,7 +297,6 @@ void Intrinsifier::Integer_subFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_sub(Assembler* assembler) { Label fall_through; TestBothArgumentsSmis(assembler, &fall_through); @@ -325,7 +310,6 @@ void Intrinsifier::Integer_sub(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_mulFromInteger(Assembler* assembler) { Label fall_through; TestBothArgumentsSmis(assembler, &fall_through); @@ -339,12 +323,10 @@ void Intrinsifier::Integer_mulFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_mul(Assembler* assembler) { Integer_mulFromInteger(assembler); } - // Optimizations: // - result is 0 if: // - left is 0 @@ -408,7 +390,6 @@ static void EmitRemainderOperation(Assembler* assembler) { __ Bind(&done); } - // Implementation: // res = left % right; // if (res < 0) { @@ -451,7 +432,6 @@ void Intrinsifier::Integer_moduloFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_truncDivide(Assembler* assembler) { Label fall_through, not_32bit; TestBothArgumentsSmis(assembler, &fall_through); @@ -498,7 +478,6 @@ void Intrinsifier::Integer_truncDivide(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_negate(Assembler* assembler) { Label fall_through; __ movq(RAX, Address(RSP, +1 * kWordSize)); @@ -511,7 +490,6 @@ void Intrinsifier::Integer_negate(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_bitAndFromInteger(Assembler* assembler) { Label fall_through; TestBothArgumentsSmis(assembler, &fall_through); @@ -522,12 +500,10 @@ void Intrinsifier::Integer_bitAndFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_bitAnd(Assembler* assembler) { Integer_bitAndFromInteger(assembler); } - void Intrinsifier::Integer_bitOrFromInteger(Assembler* assembler) { Label fall_through; TestBothArgumentsSmis(assembler, &fall_through); @@ -538,12 +514,10 @@ void Intrinsifier::Integer_bitOrFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_bitOr(Assembler* assembler) { Integer_bitOrFromInteger(assembler); } - void Intrinsifier::Integer_bitXorFromInteger(Assembler* assembler) { Label fall_through; TestBothArgumentsSmis(assembler, &fall_through); @@ -554,12 +528,10 @@ void Intrinsifier::Integer_bitXorFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_bitXor(Assembler* assembler) { Integer_bitXorFromInteger(assembler); } - void Intrinsifier::Integer_shl(Assembler* assembler) { ASSERT(kSmiTagShift == 1); ASSERT(kSmiTag == 0); @@ -591,7 +563,6 @@ void Intrinsifier::Integer_shl(Assembler* assembler) { __ Bind(&fall_through); } - static void CompareIntegers(Assembler* assembler, Condition true_condition) { Label fall_through, true_label; TestBothArgumentsSmis(assembler, &fall_through); @@ -606,32 +577,26 @@ static void CompareIntegers(Assembler* assembler, Condition true_condition) { __ Bind(&fall_through); } - void Intrinsifier::Integer_lessThan(Assembler* assembler) { CompareIntegers(assembler, LESS); } - void Intrinsifier::Integer_greaterThanFromInt(Assembler* assembler) { CompareIntegers(assembler, LESS); } - void Intrinsifier::Integer_greaterThan(Assembler* assembler) { CompareIntegers(assembler, GREATER); } - void Intrinsifier::Integer_lessEqualThan(Assembler* assembler) { CompareIntegers(assembler, LESS_EQUAL); } - void Intrinsifier::Integer_greaterEqualThan(Assembler* assembler) { CompareIntegers(assembler, GREATER_EQUAL); } - // This is called for Smi, Mint and Bigint receivers. The right argument // can be Smi, Mint, Bigint or double. void Intrinsifier::Integer_equalToInteger(Assembler* assembler) { @@ -686,12 +651,10 @@ void Intrinsifier::Integer_equalToInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Integer_equal(Assembler* assembler) { Integer_equalToInteger(assembler); } - void Intrinsifier::Integer_sar(Assembler* assembler) { Label fall_through, shift_count_ok; TestBothArgumentsSmis(assembler, &fall_through); @@ -716,7 +679,6 @@ void Intrinsifier::Integer_sar(Assembler* assembler) { __ Bind(&fall_through); } - // Argument is Smi (receiver). void Intrinsifier::Smi_bitNegate(Assembler* assembler) { __ movq(RAX, Address(RSP, +1 * kWordSize)); // Index. @@ -725,7 +687,6 @@ void Intrinsifier::Smi_bitNegate(Assembler* assembler) { __ ret(); } - void Intrinsifier::Smi_bitLength(Assembler* assembler) { ASSERT(kSmiTagShift == 1); __ movq(RAX, Address(RSP, +1 * kWordSize)); // Index. @@ -741,12 +702,10 @@ void Intrinsifier::Smi_bitLength(Assembler* assembler) { __ ret(); } - void Intrinsifier::Smi_bitAndFromSmi(Assembler* assembler) { Integer_bitAndFromInteger(assembler); } - void Intrinsifier::Bigint_lsh(Assembler* assembler) { // static void _lsh(Uint32List x_digits, int x_used, int n, // Uint32List r_digits) @@ -771,8 +730,9 @@ void Intrinsifier::Bigint_lsh(Assembler* assembler) { Label loop; __ Bind(&loop); __ movq(RAX, RDX); - __ movq(RDX, FieldAddress(RDI, R8, TIMES_8, TypedData::data_offset() - - 2 * Bigint::kBytesPerDigit)); + __ movq(RDX, + FieldAddress(RDI, R8, TIMES_8, + TypedData::data_offset() - 2 * Bigint::kBytesPerDigit)); __ shldq(RAX, RDX, RCX); __ movq(Address(RBX, R8, TIMES_8, 0), RAX); __ decq(R8); @@ -784,7 +744,6 @@ void Intrinsifier::Bigint_lsh(Assembler* assembler) { __ ret(); } - void Intrinsifier::Bigint_rsh(Assembler* assembler) { // static void _rsh(Uint32List x_digits, int x_used, int n, // Uint32List r_digits) @@ -821,7 +780,6 @@ void Intrinsifier::Bigint_rsh(Assembler* assembler) { __ ret(); } - void Intrinsifier::Bigint_absAdd(Assembler* assembler) { // static void _absAdd(Uint32List digits, int used, // Uint32List a_digits, int a_used, @@ -877,7 +835,6 @@ void Intrinsifier::Bigint_absAdd(Assembler* assembler) { __ ret(); } - void Intrinsifier::Bigint_absSub(Assembler* assembler) { // static void _absSub(Uint32List digits, int used, // Uint32List a_digits, int a_used, @@ -927,7 +884,6 @@ void Intrinsifier::Bigint_absSub(Assembler* assembler) { __ ret(); } - void Intrinsifier::Bigint_mulAdd(Assembler* assembler) { // Pseudo code: // static int _mulAdd(Uint32List x_digits, int xi, @@ -1035,7 +991,6 @@ void Intrinsifier::Bigint_mulAdd(Assembler* assembler) { __ ret(); } - void Intrinsifier::Bigint_sqrAdd(Assembler* assembler) { // Pseudo code: // static int _sqrAdd(Uint32List x_digits, int i, @@ -1155,7 +1110,6 @@ void Intrinsifier::Bigint_sqrAdd(Assembler* assembler) { __ ret(); } - void Intrinsifier::Bigint_estQuotientDigit(Assembler* assembler) { // Pseudo code: // static int _estQuotientDigit(Uint32List args, Uint32List digits, int i) { @@ -1212,7 +1166,6 @@ void Intrinsifier::Bigint_estQuotientDigit(Assembler* assembler) { __ ret(); } - void Intrinsifier::Montgomery_mulMod(Assembler* assembler) { // Pseudo code: // static int _mulMod(Uint32List args, Uint32List digits, int i) { @@ -1247,7 +1200,6 @@ void Intrinsifier::Montgomery_mulMod(Assembler* assembler) { __ ret(); } - // Check if the last argument is a double, jump to label 'is_smi' if smi // (easy to convert to double), otherwise jump to label 'not_double_smi', // Returns the last argument in RAX. @@ -1262,7 +1214,6 @@ static void TestLastArgumentIsDouble(Assembler* assembler, // Fall through if double. } - // Both arguments on stack, left argument is a double, right argument is of // unknown type. Return true or false object in RAX. Any NaN argument // returns false. Any non-double argument causes control flow to fall through @@ -1292,32 +1243,26 @@ static void CompareDoubles(Assembler* assembler, Condition true_condition) { __ Bind(&fall_through); } - void Intrinsifier::Double_greaterThan(Assembler* assembler) { CompareDoubles(assembler, ABOVE); } - void Intrinsifier::Double_greaterEqualThan(Assembler* assembler) { CompareDoubles(assembler, ABOVE_EQUAL); } - void Intrinsifier::Double_lessThan(Assembler* assembler) { CompareDoubles(assembler, BELOW); } - void Intrinsifier::Double_equal(Assembler* assembler) { CompareDoubles(assembler, EQUAL); } - void Intrinsifier::Double_lessEqualThan(Assembler* assembler) { CompareDoubles(assembler, BELOW_EQUAL); } - // Expects left argument to be double (receiver). Right argument is unknown. // Both arguments are on stack. static void DoubleArithmeticOperations(Assembler* assembler, Token::Kind kind) { @@ -1358,27 +1303,22 @@ static void DoubleArithmeticOperations(Assembler* assembler, Token::Kind kind) { __ Bind(&fall_through); } - void Intrinsifier::Double_add(Assembler* assembler) { DoubleArithmeticOperations(assembler, Token::kADD); } - void Intrinsifier::Double_mul(Assembler* assembler) { DoubleArithmeticOperations(assembler, Token::kMUL); } - void Intrinsifier::Double_sub(Assembler* assembler) { DoubleArithmeticOperations(assembler, Token::kSUB); } - void Intrinsifier::Double_div(Assembler* assembler) { DoubleArithmeticOperations(assembler, Token::kDIV); } - void Intrinsifier::Double_mulFromInteger(Assembler* assembler) { Label fall_through; // Only smis allowed. @@ -1401,7 +1341,6 @@ void Intrinsifier::Double_mulFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - // Left is double right is integer (Bigint, Mint or Smi) void Intrinsifier::DoubleFromInteger(Assembler* assembler) { Label fall_through; @@ -1421,7 +1360,6 @@ void Intrinsifier::DoubleFromInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::Double_getIsNaN(Assembler* assembler) { Label is_true; __ movq(RAX, Address(RSP, +1 * kWordSize)); @@ -1435,7 +1373,6 @@ void Intrinsifier::Double_getIsNaN(Assembler* assembler) { __ ret(); } - void Intrinsifier::Double_getIsInfinite(Assembler* assembler) { Label is_inf, done; __ movq(RAX, Address(RSP, +1 * kWordSize)); @@ -1455,7 +1392,6 @@ void Intrinsifier::Double_getIsInfinite(Assembler* assembler) { __ ret(); } - void Intrinsifier::Double_getIsNegative(Assembler* assembler) { Label is_false, is_true, is_zero; __ movq(RAX, Address(RSP, +1 * kWordSize)); @@ -1479,7 +1415,6 @@ void Intrinsifier::Double_getIsNegative(Assembler* assembler) { __ jmp(&is_false, Assembler::kNearJump); } - void Intrinsifier::DoubleToInteger(Assembler* assembler) { __ movq(RAX, Address(RSP, +1 * kWordSize)); __ movsd(XMM0, FieldAddress(RAX, Double::value_offset())); @@ -1495,7 +1430,6 @@ void Intrinsifier::DoubleToInteger(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::MathSqrt(Assembler* assembler) { Label fall_through, is_smi, double_op; TestLastArgumentIsDouble(assembler, &is_smi, &fall_through); @@ -1517,7 +1451,6 @@ void Intrinsifier::MathSqrt(Assembler* assembler) { __ Bind(&fall_through); } - // var state = ((_A * (_state[kSTATE_LO])) + _state[kSTATE_HI]) & _MASK_64; // _state[kSTATE_LO] = state & _MASK_32; // _state[kSTATE_HI] = state >> 32; @@ -1577,7 +1510,6 @@ void Intrinsifier::ObjectEquals(Assembler* assembler) { __ ret(); } - static void RangeCheck(Assembler* assembler, Register reg, intptr_t low, @@ -1589,35 +1521,29 @@ static void RangeCheck(Assembler* assembler, __ j(cc, target); } - const Condition kIfNotInRange = ABOVE; const Condition kIfInRange = BELOW_EQUAL; - static void JumpIfInteger(Assembler* assembler, Register cid, Label* target) { RangeCheck(assembler, cid, kSmiCid, kBigintCid, kIfInRange, target); } - static void JumpIfNotInteger(Assembler* assembler, Register cid, Label* target) { RangeCheck(assembler, cid, kSmiCid, kBigintCid, kIfNotInRange, target); } - static void JumpIfString(Assembler* assembler, Register cid, Label* target) { RangeCheck(assembler, cid, kOneByteStringCid, kExternalTwoByteStringCid, kIfInRange, target); } - static void JumpIfNotString(Assembler* assembler, Register cid, Label* target) { RangeCheck(assembler, cid, kOneByteStringCid, kExternalTwoByteStringCid, kIfNotInRange, target); } - // Return type quickly for simple types (not parameterized and not signature). void Intrinsifier::ObjectRuntimeType(Assembler* assembler) { Label fall_through, use_canonical_type, not_integer, not_double; @@ -1675,7 +1601,6 @@ void Intrinsifier::ObjectRuntimeType(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::ObjectHaveSameRuntimeType(Assembler* assembler) { Label fall_through, different_cids, equal, not_equal, not_integer; @@ -1739,7 +1664,6 @@ void Intrinsifier::ObjectHaveSameRuntimeType(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::String_getHashCode(Assembler* assembler) { Label fall_through; __ movq(RAX, Address(RSP, +1 * kWordSize)); // String object. @@ -1753,7 +1677,6 @@ void Intrinsifier::String_getHashCode(Assembler* assembler) { // Hash not yet computed. } - void Intrinsifier::Object_getHash(Assembler* assembler) { __ movq(RAX, Address(RSP, +1 * kWordSize)); // Object. __ movl(RAX, FieldAddress(RAX, String::hash_offset())); @@ -1761,7 +1684,6 @@ void Intrinsifier::Object_getHash(Assembler* assembler) { __ ret(); } - void Intrinsifier::Object_setHash(Assembler* assembler) { __ movq(RAX, Address(RSP, +2 * kWordSize)); // Object. __ movq(RDX, Address(RSP, +1 * kWordSize)); // Value. @@ -1770,7 +1692,6 @@ void Intrinsifier::Object_setHash(Assembler* assembler) { __ ret(); } - void GenerateSubstringMatchesSpecialization(Assembler* assembler, intptr_t receiver_cid, intptr_t other_cid, @@ -1833,7 +1754,6 @@ void GenerateSubstringMatchesSpecialization(Assembler* assembler, __ jmp(return_true); } - // bool _substringMatches(int start, String other) // This intrinsic handles a OneByteString or TwoByteString receiver with a // OneByteString other. @@ -1875,7 +1795,6 @@ void Intrinsifier::StringBaseSubstringMatches(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::StringBaseCharAt(Assembler* assembler) { Label fall_through, try_two_byte_string; __ movq(RCX, Address(RSP, +1 * kWordSize)); // Index. @@ -1912,7 +1831,6 @@ void Intrinsifier::StringBaseCharAt(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::StringBaseIsEmpty(Assembler* assembler) { Label is_true; // Get length. @@ -1927,7 +1845,6 @@ void Intrinsifier::StringBaseIsEmpty(Assembler* assembler) { __ ret(); } - void Intrinsifier::OneByteString_getHashCode(Assembler* assembler) { Label compute_hash; __ movq(RBX, Address(RSP, +1 * kWordSize)); // OneByteString object. @@ -1997,7 +1914,6 @@ void Intrinsifier::OneByteString_getHashCode(Assembler* assembler) { __ ret(); } - // Allocates one-byte string of length 'end - start'. The content is not // initialized. 'length-reg' contains tagged length. // Returns new string as tagged pointer in RAX. @@ -2010,7 +1926,7 @@ static void TryAllocateOnebyteString(Assembler* assembler, __ movq(RDI, length_reg); } Label pop_and_fail, not_zero_length; - __ pushq(RDI); // Preserve length. + __ pushq(RDI); // Preserve length. __ sarq(RDI, Immediate(kSmiTagShift)); // Untag length. // If the length is 0 then we have to make the allocated size a bit bigger, // otherwise the string takes up less space than an ExternalOneByteString, @@ -2079,7 +1995,6 @@ static void TryAllocateOnebyteString(Assembler* assembler, __ jmp(failure); } - // Arg0: OneByteString (receiver). // Arg1: Start index as Smi. // Arg2: End index as Smi. @@ -2128,7 +2043,6 @@ void Intrinsifier::OneByteString_substringUnchecked(Assembler* assembler) { __ Bind(&fall_through); } - void Intrinsifier::OneByteStringSetAt(Assembler* assembler) { __ movq(RCX, Address(RSP, +1 * kWordSize)); // Value. __ movq(RBX, Address(RSP, +2 * kWordSize)); // Index. @@ -2139,7 +2053,6 @@ void Intrinsifier::OneByteStringSetAt(Assembler* assembler) { __ ret(); } - void Intrinsifier::OneByteString_allocate(Assembler* assembler) { __ movq(RDI, Address(RSP, +1 * kWordSize)); // Length.v= Label fall_through, ok; @@ -2152,7 +2065,6 @@ void Intrinsifier::OneByteString_allocate(Assembler* assembler) { __ Bind(&fall_through); } - // TODO(srdjan): Add combinations (one-byte/two-byte/external strings). static void StringEquality(Assembler* assembler, intptr_t string_cid) { Label fall_through, is_true, is_false, loop; @@ -2209,17 +2121,14 @@ static void StringEquality(Assembler* assembler, intptr_t string_cid) { __ Bind(&fall_through); } - void Intrinsifier::OneByteString_equality(Assembler* assembler) { StringEquality(assembler, kOneByteStringCid); } - void Intrinsifier::TwoByteString_equality(Assembler* assembler) { StringEquality(assembler, kTwoByteStringCid); } - void Intrinsifier::IntrinsifyRegExpExecuteMatch(Assembler* assembler, bool sticky) { if (FLAG_interpret_irregexp) return; @@ -2239,8 +2148,9 @@ void Intrinsifier::IntrinsifyRegExpExecuteMatch(Assembler* assembler, __ movq(RDI, Address(RSP, kStringParamOffset)); __ LoadClassId(RDI, RDI); __ SubImmediate(RDI, Immediate(kOneByteStringCid)); - __ movq(RAX, FieldAddress(RBX, RDI, TIMES_8, RegExp::function_offset( - kOneByteStringCid, sticky))); + __ movq(RAX, + FieldAddress(RBX, RDI, TIMES_8, + RegExp::function_offset(kOneByteStringCid, sticky))); // Registers are now set up for the lazy compile stub. It expects the function // in RAX, the argument descriptor in R10, and IC-Data in RCX. @@ -2252,7 +2162,6 @@ void Intrinsifier::IntrinsifyRegExpExecuteMatch(Assembler* assembler, __ jmp(RDI); } - // On stack: user tag (+1), return-address (+0). void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { // RBX: Isolate. @@ -2270,21 +2179,18 @@ void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { __ ret(); } - void Intrinsifier::UserTag_defaultTag(Assembler* assembler) { __ LoadIsolate(RAX); __ movq(RAX, Address(RAX, Isolate::default_tag_offset())); __ ret(); } - void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { __ LoadIsolate(RAX); __ movq(RAX, Address(RAX, Isolate::current_tag_offset())); __ ret(); } - void Intrinsifier::Timeline_isDartStreamEnabled(Assembler* assembler) { if (!FLAG_support_timeline) { __ LoadObject(RAX, Bool::False()); @@ -2307,14 +2213,12 @@ void Intrinsifier::Timeline_isDartStreamEnabled(Assembler* assembler) { __ ret(); } - void Intrinsifier::ClearAsyncThreadStackTrace(Assembler* assembler) { __ LoadObject(RAX, Object::null_object()); __ movq(Address(THR, Thread::async_stack_trace_offset()), RAX); __ ret(); } - void Intrinsifier::SetAsyncThreadStackTrace(Assembler* assembler) { __ movq(Address(THR, Thread::async_stack_trace_offset()), RAX); __ LoadObject(RAX, Object::null_object()); diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc index 91b96648706..2d8bb4bfb63 100644 --- a/runtime/vm/isolate.cc +++ b/runtime/vm/isolate.cc @@ -24,9 +24,9 @@ #include "vm/lockers.h" #include "vm/log.h" #include "vm/message_handler.h" +#include "vm/object.h" #include "vm/object_id_ring.h" #include "vm/object_store.h" -#include "vm/object.h" #include "vm/os_thread.h" #include "vm/port.h" #include "vm/profiler.h" @@ -49,7 +49,6 @@ #include "vm/verifier.h" #include "vm/visitor.h" - namespace dart { DECLARE_FLAG(bool, print_metrics); @@ -63,7 +62,6 @@ DECLARE_FLAG(int, reload_every); DECLARE_FLAG(bool, reload_every_back_off); DECLARE_FLAG(bool, trace_reload); - #if !defined(PRODUCT) static void CheckedModeHandler(bool value) { FLAG_enable_asserts = value; @@ -79,7 +77,6 @@ DEFINE_FLAG_HANDLER(CheckedModeHandler, DEFINE_FLAG_HANDLER(CheckedModeHandler, checked, "Enable checked mode."); #endif // !defined(PRODUCT) - // Quick access to the locally defined thread() and isolate() methods. #define T (thread()) #define I (isolate()) @@ -99,7 +96,6 @@ class VerifyOriginId : public IsolateVisitor { }; #endif - static uint8_t* malloc_allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { @@ -111,7 +107,6 @@ static void malloc_deallocator(uint8_t* ptr) { free(reinterpret_cast(ptr)); } - static void SerializeObject(const Instance& obj, uint8_t** obj_data, intptr_t* obj_len, @@ -134,23 +129,19 @@ static Message* SerializeMessage(Dart_Port dest_port, const Instance& obj) { } } - bool IsolateVisitor::IsVMInternalIsolate(Isolate* isolate) const { return ((isolate == Dart::vm_isolate()) || ServiceIsolate::IsServiceIsolateDescendant(isolate)); } - NoOOBMessageScope::NoOOBMessageScope(Thread* thread) : StackResource(thread) { thread->DeferOOBMessageInterrupts(); } - NoOOBMessageScope::~NoOOBMessageScope() { thread()->RestoreOOBMessageInterrupts(); } - NoReloadScope::NoReloadScope(Isolate* isolate, Thread* thread) : StackResource(thread), isolate_(isolate) { ASSERT(isolate_ != NULL); @@ -159,14 +150,12 @@ NoReloadScope::NoReloadScope(Isolate* isolate, Thread* thread) 0); } - NoReloadScope::~NoReloadScope() { AtomicOperations::FetchAndDecrement(&(isolate_->no_reload_scope_depth_)); ASSERT(AtomicOperations::LoadRelaxed(&(isolate_->no_reload_scope_depth_)) >= 0); } - void Isolate::RegisterClass(const Class& cls) { #if !defined(PRODUCT) if (IsReloading()) { @@ -177,17 +166,14 @@ void Isolate::RegisterClass(const Class& cls) { class_table()->Register(cls); } - void Isolate::RegisterClassAt(intptr_t index, const Class& cls) { class_table()->RegisterAt(index, cls); } - void Isolate::ValidateClassTable() { class_table()->Validate(); } - void Isolate::SendInternalLibMessage(LibMsgId msg_id, uint64_t capability) { const Array& msg = Array::Handle(Array::New(3)); Object& element = Object::Handle(); @@ -207,7 +193,6 @@ void Isolate::SendInternalLibMessage(LibMsgId msg_id, uint64_t capability) { Message::kOOBPriority)); } - class IsolateMessageHandler : public MessageHandler { public: explicit IsolateMessageHandler(Isolate* isolate); @@ -237,18 +222,15 @@ class IsolateMessageHandler : public MessageHandler { Isolate* isolate_; }; - IsolateMessageHandler::IsolateMessageHandler(Isolate* isolate) : isolate_(isolate) {} - IsolateMessageHandler::~IsolateMessageHandler() {} const char* IsolateMessageHandler::name() const { return isolate_->name(); } - // Isolate library OOB messages are fixed sized arrays which have the // following format: // [ OOB dispatch, Isolate library dispatch, ] @@ -430,7 +412,6 @@ RawError* IsolateMessageHandler::HandleLibMessage(const Array& message) { return Error::null(); } - void IsolateMessageHandler::MessageNotify(Message::Priority priority) { if (priority >= Message::kOOBPriority) { // Handle out of band messages even if the mutator thread is busy. @@ -443,7 +424,6 @@ void IsolateMessageHandler::MessageNotify(Message::Priority priority) { } } - MessageHandler::MessageStatus IsolateMessageHandler::HandleMessage( Message* message) { ASSERT(IsCurrentIsolate()); @@ -589,7 +569,6 @@ MessageHandler::MessageStatus IsolateMessageHandler::HandleMessage( return status; } - #ifndef PRODUCT void IsolateMessageHandler::NotifyPauseOnStart() { if (!FLAG_support_service) { @@ -607,7 +586,6 @@ void IsolateMessageHandler::NotifyPauseOnStart() { } } - void IsolateMessageHandler::NotifyPauseOnExit() { if (!FLAG_support_service) { return; @@ -624,19 +602,16 @@ void IsolateMessageHandler::NotifyPauseOnExit() { } #endif // !PRODUCT - #if defined(DEBUG) void IsolateMessageHandler::CheckAccess() { ASSERT(IsCurrentIsolate()); } #endif - bool IsolateMessageHandler::IsCurrentIsolate() const { return (I == Isolate::Current()); } - static MessageHandler::MessageStatus StoreError(Thread* thread, const Error& error) { thread->set_sticky_error(error); @@ -649,7 +624,6 @@ static MessageHandler::MessageStatus StoreError(Thread* thread, return MessageHandler::kError; } - MessageHandler::MessageStatus IsolateMessageHandler::ProcessUnhandledException( const Error& result) { NoReloadScope no_reload_scope(T->isolate(), T); @@ -709,7 +683,6 @@ MessageHandler::MessageStatus IsolateMessageHandler::ProcessUnhandledException( return kOK; } - void Isolate::FlagsInitialize(Dart_IsolateFlags* api_flags) { api_flags->version = DART_FLAGS_CURRENT_VERSION; #define INIT_FROM_FLAG(name, isolate_flag, flag) api_flags->isolate_flag = flag; @@ -717,7 +690,6 @@ void Isolate::FlagsInitialize(Dart_IsolateFlags* api_flags) { #undef INIT_FROM_FLAG } - void Isolate::FlagsCopyTo(Dart_IsolateFlags* api_flags) const { api_flags->version = DART_FLAGS_CURRENT_VERSION; #define INIT_FROM_FIELD(name, isolate_flag, flag) \ @@ -726,7 +698,6 @@ void Isolate::FlagsCopyTo(Dart_IsolateFlags* api_flags) const { #undef INIT_FROM_FIELD } - #if !defined(PRODUCT) void Isolate::FlagsCopyFrom(const Dart_IsolateFlags& api_flags) { #define SET_FROM_FLAG(name, isolate_flag, flag) \ @@ -737,7 +708,6 @@ void Isolate::FlagsCopyFrom(const Dart_IsolateFlags& api_flags) { } #endif // !defined(PRODUCT) - #if defined(DEBUG) // static void BaseIsolate::AssertCurrent(BaseIsolate* isolate) { @@ -894,7 +864,6 @@ Isolate::~Isolate() { delete thread_registry_; } - void Isolate::InitOnce() { create_callback_ = NULL; isolates_list_monitor_ = new Monitor(); @@ -902,7 +871,6 @@ void Isolate::InitOnce() { EnableIsolateCreation(); } - Isolate* Isolate::Init(const char* name_prefix, const Dart_IsolateFlags& api_flags, bool is_vm_isolate) { @@ -982,20 +950,17 @@ Isolate* Isolate::Init(const char* name_prefix, return result; } - Thread* Isolate::mutator_thread() const { ASSERT(thread_registry() != NULL); return thread_registry()->mutator_thread(); } - void Isolate::SetupImagePage(const uint8_t* image_buffer, bool is_executable) { Image image(image_buffer); heap_->SetupImagePage(image.object_start(), image.object_size(), is_executable); } - void Isolate::ScheduleMessageInterrupts() { // We take the threads lock here to ensure that the mutator thread does not // exit the isolate while we are trying to schedule interrupts on it. @@ -1006,23 +971,19 @@ void Isolate::ScheduleMessageInterrupts() { } } - void Isolate::set_debugger_name(const char* name) { free(debugger_name_); debugger_name_ = strdup(name); } - int64_t Isolate::UptimeMicros() const { return OS::GetCurrentMonotonicMicros() - start_time_micros_; } - bool Isolate::IsPaused() const { return (debugger_ != NULL) && (debugger_->PauseEvent() != NULL); } - RawError* Isolate::PausePostRequest() { if (!FLAG_support_debugger) { return Error::null(); @@ -1043,7 +1004,6 @@ RawError* Isolate::PausePostRequest() { return Error::null(); } - void Isolate::BuildName(const char* name_prefix) { ASSERT(name_ == NULL); if (name_prefix == NULL) { @@ -1057,7 +1017,6 @@ void Isolate::BuildName(const char* name_prefix) { name_ = OS::SCreate(NULL, "%s-%" Pd64 "", name_prefix, main_port()); } - void Isolate::DoneLoading() { GrowableObjectArray& libs = GrowableObjectArray::Handle(current_zone(), object_store()->libraries()); @@ -1074,7 +1033,6 @@ void Isolate::DoneLoading() { TokenStream::CloseSharedTokenList(this); } - bool Isolate::CanReload() const { #ifndef PRODUCT return !ServiceIsolate::IsServiceIsolateDescendant(this) && is_runnable() && @@ -1086,7 +1044,6 @@ bool Isolate::CanReload() const { #endif } - #ifndef PRODUCT bool Isolate::ReloadSources(JSONStream* js, bool force_reload, @@ -1104,7 +1061,6 @@ bool Isolate::ReloadSources(JSONStream* js, return success; } - void Isolate::DeleteReloadContext() { // Another thread may be in the middle of GetClassForHeapWalkAt. Thread* thread = Thread::Current(); @@ -1115,7 +1071,6 @@ void Isolate::DeleteReloadContext() { } #endif // !PRODUCT - void Isolate::DoneFinalizing() { #if !defined(PRODUCT) if (IsReloading()) { @@ -1124,7 +1079,6 @@ void Isolate::DoneFinalizing() { #endif // !defined(PRODUCT) } - bool Isolate::MakeRunnable() { ASSERT(Isolate::Current() == NULL); @@ -1180,19 +1134,16 @@ bool Isolate::MakeRunnable() { return true; } - bool Isolate::VerifyPauseCapability(const Object& capability) const { return !capability.IsNull() && capability.IsCapability() && (pause_capability() == Capability::Cast(capability).Id()); } - bool Isolate::VerifyTerminateCapability(const Object& capability) const { return !capability.IsNull() && capability.IsCapability() && (terminate_capability() == Capability::Cast(capability).Id()); } - bool Isolate::AddResumeCapability(const Capability& capability) { // Ensure a limit for the number of resume capabilities remembered. static const intptr_t kMaxResumeCapabilities = kSmiMax / (6 * kWordSize); @@ -1225,7 +1176,6 @@ bool Isolate::AddResumeCapability(const Capability& capability) { return true; } - bool Isolate::RemoveResumeCapability(const Capability& capability) { const GrowableObjectArray& caps = GrowableObjectArray::Handle( current_zone(), object_store()->resume_capabilities()); @@ -1242,7 +1192,6 @@ bool Isolate::RemoveResumeCapability(const Capability& capability) { return false; } - // TODO(iposva): Remove duplicated code and start using some hash based // structure instead of these linear lookups. void Isolate::AddExitListener(const SendPort& listener, @@ -1280,7 +1229,6 @@ void Isolate::AddExitListener(const SendPort& listener, } } - void Isolate::RemoveExitListener(const SendPort& listener) { const GrowableObjectArray& listeners = GrowableObjectArray::Handle( current_zone(), object_store()->exit_listeners()); @@ -1297,7 +1245,6 @@ void Isolate::RemoveExitListener(const SendPort& listener) { } } - void Isolate::NotifyExitListeners() { const GrowableObjectArray& listeners = GrowableObjectArray::Handle( current_zone(), this->object_store()->exit_listeners()); @@ -1315,7 +1262,6 @@ void Isolate::NotifyExitListeners() { } } - void Isolate::AddErrorListener(const SendPort& listener) { // Ensure a limit for the number of listeners remembered. static const intptr_t kMaxListeners = kSmiMax / (6 * kWordSize); @@ -1347,7 +1293,6 @@ void Isolate::AddErrorListener(const SendPort& listener) { } } - void Isolate::RemoveErrorListener(const SendPort& listener) { const GrowableObjectArray& listeners = GrowableObjectArray::Handle( current_zone(), object_store()->error_listeners()); @@ -1363,7 +1308,6 @@ void Isolate::RemoveErrorListener(const SendPort& listener) { } } - bool Isolate::NotifyErrorListeners(const String& msg, const String& stacktrace) { const GrowableObjectArray& listeners = GrowableObjectArray::Handle( @@ -1384,7 +1328,6 @@ bool Isolate::NotifyErrorListeners(const String& msg, return listeners.Length() > 0; } - static MessageHandler::MessageStatus RunIsolate(uword parameter) { Isolate* isolate = reinterpret_cast(parameter); IsolateSpawnState* state = NULL; @@ -1416,7 +1359,6 @@ static MessageHandler::MessageStatus RunIsolate(uword parameter) { // Switch back to spawning isolate. - if (!ClassFinalizer::ProcessPendingClasses()) { // Error is in sticky error already. #if defined(DEBUG) @@ -1491,7 +1433,6 @@ static MessageHandler::MessageStatus RunIsolate(uword parameter) { return MessageHandler::kOK; } - static void ShutdownIsolate(uword parameter) { Isolate* isolate = reinterpret_cast(parameter); // We must wait for any outstanding spawn calls to complete before @@ -1526,7 +1467,6 @@ static void ShutdownIsolate(uword parameter) { Dart::ShutdownIsolate(isolate); } - void Isolate::SetStickyError(RawError* sticky_error) { ASSERT( ((sticky_error_ == Error::null()) || (sticky_error == Error::null())) && @@ -1534,13 +1474,11 @@ void Isolate::SetStickyError(RawError* sticky_error) { sticky_error_ = sticky_error; } - void Isolate::Run() { message_handler()->Run(Dart::thread_pool(), RunIsolate, ShutdownIsolate, reinterpret_cast(this)); } - void Isolate::AddClosureFunction(const Function& function) const { ASSERT(!Compiler::IsBackgroundCompilation()); GrowableObjectArray& closures = @@ -1550,7 +1488,6 @@ void Isolate::AddClosureFunction(const Function& function) const { closures.Add(function, Heap::kOld); } - // If the linear lookup turns out to be too expensive, the list // of closures could be maintained in a hash map, with the key // being the token position of the closure. There are almost no @@ -1574,7 +1511,6 @@ RawFunction* Isolate::LookupClosureFunction(const Function& parent, return Function::null(); } - intptr_t Isolate::FindClosureIndex(const Function& needle) const { const GrowableObjectArray& closures_array = GrowableObjectArray::Handle(object_store()->closure_functions()); @@ -1587,7 +1523,6 @@ intptr_t Isolate::FindClosureIndex(const Function& needle) const { return -1; } - RawFunction* Isolate::ClosureFunctionFromIndex(intptr_t idx) const { const GrowableObjectArray& closures_array = GrowableObjectArray::Handle(object_store()->closure_functions()); @@ -1597,7 +1532,6 @@ RawFunction* Isolate::ClosureFunctionFromIndex(intptr_t idx) const { return Function::RawCast(closures_array.At(idx)); } - class FinalizeWeakPersistentHandlesVisitor : public HandleVisitor { public: FinalizeWeakPersistentHandlesVisitor() : HandleVisitor(Thread::Current()) {} @@ -1612,7 +1546,6 @@ class FinalizeWeakPersistentHandlesVisitor : public HandleVisitor { DISALLOW_COPY_AND_ASSIGN(FinalizeWeakPersistentHandlesVisitor); }; - void Isolate::LowLevelShutdown() { // Ensure we have a zone and handle scope so that we can call VM functions, // but we no longer allocate new heap objects. @@ -1635,7 +1568,6 @@ void Isolate::LowLevelShutdown() { debugger()->Shutdown(); } - // Close all the ports owned by this isolate. PortMap::ClosePorts(message_handler()); @@ -1684,7 +1616,6 @@ void Isolate::LowLevelShutdown() { } } - void Isolate::StopBackgroundCompiler() { // Wait until all background compilation has finished. if (background_compiler_ != NULL) { @@ -1692,7 +1623,6 @@ void Isolate::StopBackgroundCompiler() { } } - void Isolate::MaybeIncreaseReloadEveryNStackOverflowChecks() { if (FLAG_reload_every_back_off) { if (reload_every_n_stack_overflow_checks_ < 5000) { @@ -1707,7 +1637,6 @@ void Isolate::MaybeIncreaseReloadEveryNStackOverflowChecks() { } } - void Isolate::Shutdown() { ASSERT(this == Isolate::Current()); StopBackgroundCompiler(); @@ -1783,7 +1712,6 @@ void Isolate::Shutdown() { } } - Dart_IsolateCreateCallback Isolate::create_callback_ = NULL; Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL; Dart_IsolateCleanupCallback Isolate::cleanup_callback_ = NULL; @@ -1798,14 +1726,12 @@ void Isolate::IterateObjectPointers(ObjectPointerVisitor* visitor, VisitObjectPointers(visitor, validate_frames); } - void Isolate::IterateStackPointers(ObjectPointerVisitor* visitor, bool validate_frames) { HeapIterationScope heap_iteration_scope; VisitStackPointers(visitor, validate_frames); } - void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor, bool validate_frames) { ASSERT(visitor != NULL); @@ -1882,26 +1808,22 @@ void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor, VisitStackPointers(visitor, validate_frames); } - void Isolate::VisitStackPointers(ObjectPointerVisitor* visitor, bool validate_frames) { // Visit objects in all threads (e.g., Dart stack, handles in zones). thread_registry()->VisitObjectPointers(visitor, validate_frames); } - void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor) { if (api_state() != NULL) { api_state()->VisitWeakHandles(visitor); } } - void Isolate::PrepareForGC() { thread_registry()->PrepareForGC(); } - RawClass* Isolate::GetClassForHeapWalkAt(intptr_t cid) { RawClass* raw_class = NULL; #ifndef PRODUCT @@ -1918,7 +1840,6 @@ RawClass* Isolate::GetClassForHeapWalkAt(intptr_t cid) { return raw_class; } - void Isolate::AddPendingDeopt(uword fp, uword pc) { // GrowableArray::Add is not atomic and may be interrupt by a profiler // stack walk. @@ -1937,7 +1858,6 @@ void Isolate::AddPendingDeopt(uword fp, uword pc) { delete old_pending_deopts; } - uword Isolate::FindPendingDeopt(uword fp) const { for (intptr_t i = 0; i < pending_deopts_->length(); i++) { if ((*pending_deopts_)[i].fp() == fp) { @@ -1948,7 +1868,6 @@ uword Isolate::FindPendingDeopt(uword fp) const { return 0; } - void Isolate::ClearPendingDeoptsAtOrBelow(uword fp) const { for (intptr_t i = pending_deopts_->length() - 1; i >= 0; i--) { if ((*pending_deopts_)[i].fp() <= fp) { @@ -1957,7 +1876,6 @@ void Isolate::ClearPendingDeoptsAtOrBelow(uword fp) const { } } - #ifndef PRODUCT static const char* ExceptionPauseInfoToServiceEnum(Dart_ExceptionPauseInfo pi) { switch (pi) { @@ -1973,7 +1891,6 @@ static const char* ExceptionPauseInfoToServiceEnum(Dart_ExceptionPauseInfo pi) { } } - void Isolate::PrintJSON(JSONStream* stream, bool ref) { if (!FLAG_support_service) { return; @@ -2108,12 +2025,10 @@ void Isolate::PrintJSON(JSONStream* stream, bool ref) { } #endif - void Isolate::set_tag_table(const GrowableObjectArray& value) { tag_table_ = value.raw(); } - void Isolate::set_current_tag(const UserTag& tag) { uword user_tag = tag.tag(); ASSERT(user_tag < kUwordMax); @@ -2121,7 +2036,6 @@ void Isolate::set_current_tag(const UserTag& tag) { current_tag_ = tag.raw(); } - void Isolate::set_default_tag(const UserTag& tag) { default_tag_ = tag.raw(); } @@ -2130,13 +2044,11 @@ void Isolate::set_ic_miss_code(const Code& code) { ic_miss_code_ = code.raw(); } - void Isolate::set_deoptimized_code_array(const GrowableObjectArray& value) { ASSERT(Thread::Current()->IsMutatorThread()); deoptimized_code_array_ = value.raw(); } - void Isolate::TrackDeoptimizedCode(const Code& code) { ASSERT(!code.IsNull()); const GrowableObjectArray& deoptimized_code = @@ -2150,24 +2062,20 @@ void Isolate::TrackDeoptimizedCode(const Code& code) { deoptimized_code.Add(code); } - void Isolate::clear_sticky_error() { sticky_error_ = Error::null(); } - void Isolate::set_pending_service_extension_calls( const GrowableObjectArray& value) { pending_service_extension_calls_ = value.raw(); } - void Isolate::set_registered_service_extension_handlers( const GrowableObjectArray& value) { registered_service_extension_handlers_ = value.raw(); } - void Isolate::AddDeoptimizingBoxedField(const Field& field) { ASSERT(Compiler::IsBackgroundCompilation()); ASSERT(!field.IsOriginal()); @@ -2182,7 +2090,6 @@ void Isolate::AddDeoptimizingBoxedField(const Field& field) { array.Add(Field::Handle(field.Original()), Heap::kOld); } - RawField* Isolate::GetDeoptimizingBoxedField() { ASSERT(Thread::Current()->IsMutatorThread()); SafepointMutexLocker ml(field_list_mutex_); @@ -2197,7 +2104,6 @@ RawField* Isolate::GetDeoptimizingBoxedField() { return Field::RawCast(array.RemoveLast()); } - #ifndef PRODUCT RawObject* Isolate::InvokePendingServiceExtensionCalls() { if (!FLAG_support_service) { @@ -2275,14 +2181,12 @@ RawObject* Isolate::InvokePendingServiceExtensionCalls() { return Object::null(); } - RawGrowableObjectArray* Isolate::GetAndClearPendingServiceExtensionCalls() { RawGrowableObjectArray* r = pending_service_extension_calls_; pending_service_extension_calls_ = GrowableObjectArray::null(); return r; } - void Isolate::AppendServiceExtensionCall(const Instance& closure, const String& method_name, const Array& parameter_keys, @@ -2314,7 +2218,6 @@ void Isolate::AppendServiceExtensionCall(const Instance& closure, calls.Add(id); } - // This function is written in C++ and not Dart because we must do this // operation atomically in the face of random OOB messages. Do not port // to Dart code unless you can ensure that the operations will can be @@ -2350,7 +2253,6 @@ void Isolate::RegisterServiceExtensionHandler(const String& name, } } - // This function is written in C++ and not Dart because we must do this // operation atomically in the face of random OOB messages. Do not port // to Dart code unless you can ensure that the operations will can be @@ -2376,14 +2278,12 @@ RawInstance* Isolate::LookupServiceExtensionHandler(const String& name) { } #endif // !PRODUCT - void Isolate::WakePauseEventHandler(Dart_Isolate isolate) { Isolate* iso = reinterpret_cast(isolate); MonitorLocker ml(iso->pause_loop_monitor_); ml.Notify(); } - void Isolate::PauseEventHandler() { // We are stealing a pause event (like a breakpoint) from the // embedder. We don't know what kind of thread we are on -- it @@ -2433,7 +2333,6 @@ void Isolate::PauseEventHandler() { Dart_ExitScope(); } - void Isolate::VisitIsolates(IsolateVisitor* visitor) { if (visitor == NULL) { return; @@ -2448,7 +2347,6 @@ void Isolate::VisitIsolates(IsolateVisitor* visitor) { } } - intptr_t Isolate::IsolateListLength() { MonitorLocker ml(isolates_list_monitor_); intptr_t count = 0; @@ -2460,7 +2358,6 @@ intptr_t Isolate::IsolateListLength() { return count; } - bool Isolate::AddIsolateToList(Isolate* isolate) { MonitorLocker ml(isolates_list_monitor_); if (!creation_enabled_) { @@ -2473,7 +2370,6 @@ bool Isolate::AddIsolateToList(Isolate* isolate) { return true; } - void Isolate::RemoveIsolateFromList(Isolate* isolate) { MonitorLocker ml(isolates_list_monitor_); ASSERT(isolate != NULL); @@ -2502,25 +2398,21 @@ void Isolate::RemoveIsolateFromList(Isolate* isolate) { ASSERT(!creation_enabled_); } - void Isolate::DisableIsolateCreation() { MonitorLocker ml(isolates_list_monitor_); creation_enabled_ = false; } - void Isolate::EnableIsolateCreation() { MonitorLocker ml(isolates_list_monitor_); creation_enabled_ = true; } - bool Isolate::IsolateCreationEnabled() { MonitorLocker ml(isolates_list_monitor_); return creation_enabled_; } - void Isolate::KillLocked(LibMsgId msg_id) { Dart_CObject kill_msg; Dart_CObject* list_values[4]; @@ -2561,7 +2453,6 @@ void Isolate::KillLocked(LibMsgId msg_id) { } } - class IsolateKillerVisitor : public IsolateVisitor { public: explicit IsolateKillerVisitor(Isolate::LibMsgId msg_id) @@ -2593,25 +2484,21 @@ class IsolateKillerVisitor : public IsolateVisitor { Isolate::LibMsgId msg_id_; }; - void Isolate::KillAllIsolates(LibMsgId msg_id) { IsolateKillerVisitor visitor(msg_id); VisitIsolates(&visitor); } - void Isolate::KillIfExists(Isolate* isolate, LibMsgId msg_id) { IsolateKillerVisitor visitor(isolate, msg_id); VisitIsolates(&visitor); } - void Isolate::IncrementSpawnCount() { MonitorLocker ml(spawn_count_monitor_); spawn_count_++; } - void Isolate::WaitForOutstandingSpawns() { MonitorLocker ml(spawn_count_monitor_); while (spawn_count_ > 0) { @@ -2619,12 +2506,10 @@ void Isolate::WaitForOutstandingSpawns() { } } - Monitor* Isolate::threads_lock() const { return thread_registry_->threads_lock(); } - Thread* Isolate::ScheduleThread(bool is_mutator, bool bypass_safepoint) { // Schedule the thread into the isolate by associating // a 'Thread' structure with it (this is done while we are holding @@ -2676,7 +2561,6 @@ Thread* Isolate::ScheduleThread(bool is_mutator, bool bypass_safepoint) { return thread; } - void Isolate::UnscheduleThread(Thread* thread, bool is_mutator, bool bypass_safepoint) { @@ -2721,7 +2605,6 @@ void Isolate::UnscheduleThread(Thread* thread, thread_registry()->ReturnThreadLocked(is_mutator, thread); } - static RawInstance* DeserializeObject(Thread* thread, uint8_t* obj_data, intptr_t obj_len) { @@ -2737,7 +2620,6 @@ static RawInstance* DeserializeObject(Thread* thread, return instance.raw(); } - static const char* NewConstChar(const char* chars) { size_t len = strlen(chars); char* mem = new char[len + 1]; @@ -2745,7 +2627,6 @@ static const char* NewConstChar(const char* chars) { return mem; } - IsolateSpawnState::IsolateSpawnState(Dart_Port parent_port, Dart_Port origin_id, void* init_data, @@ -2799,7 +2680,6 @@ IsolateSpawnState::IsolateSpawnState(Dart_Port parent_port, Isolate::Current()->FlagsCopyTo(isolate_flags()); } - IsolateSpawnState::IsolateSpawnState(Dart_Port parent_port, void* init_data, const char* script_url, @@ -2843,7 +2723,6 @@ IsolateSpawnState::IsolateSpawnState(Dart_Port parent_port, Isolate::Current()->FlagsCopyTo(isolate_flags()); } - IsolateSpawnState::~IsolateSpawnState() { delete[] script_url_; delete[] package_root_; @@ -2855,7 +2734,6 @@ IsolateSpawnState::~IsolateSpawnState() { free(serialized_message_); } - RawObject* IsolateSpawnState::ResolveFunction() { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -2933,18 +2811,15 @@ RawObject* IsolateSpawnState::ResolveFunction() { return func.raw(); } - RawInstance* IsolateSpawnState::BuildArgs(Thread* thread) { return DeserializeObject(thread, serialized_args_, serialized_args_len_); } - RawInstance* IsolateSpawnState::BuildMessage(Thread* thread) { return DeserializeObject(thread, serialized_message_, serialized_message_len_); } - void IsolateSpawnState::DecrementSpawnCount() { ASSERT(spawn_count_monitor_ != NULL); ASSERT(spawn_count_ != NULL); diff --git a/runtime/vm/isolate.h b/runtime/vm/isolate.h index f700bbc2ad2..8dc5c5c3867 100644 --- a/runtime/vm/isolate.h +++ b/runtime/vm/isolate.h @@ -12,16 +12,16 @@ #include "vm/class_table.h" #include "vm/exceptions.h" #include "vm/fixed_cache.h" +#include "vm/growable_array.h" #include "vm/handles.h" #include "vm/megamorphic_cache_table.h" #include "vm/metrics.h" +#include "vm/os_thread.h" #include "vm/random.h" #include "vm/tags.h" #include "vm/thread.h" -#include "vm/os_thread.h" #include "vm/timer.h" #include "vm/token_position.h" -#include "vm/growable_array.h" namespace dart { @@ -73,7 +73,6 @@ class StubCode; class ThreadRegistry; class UserTag; - class PendingLazyDeopt { public: PendingLazyDeopt(uword fp, uword pc) : fp_(fp), pc_(pc) {} @@ -86,7 +85,6 @@ class PendingLazyDeopt { uword pc_; }; - class IsolateVisitor { public: IsolateVisitor() {} @@ -102,7 +100,6 @@ class IsolateVisitor { DISALLOW_COPY_AND_ASSIGN(IsolateVisitor); }; - // Disallow OOB message handling within this scope. class NoOOBMessageScope : public StackResource { public: @@ -113,7 +110,6 @@ class NoOOBMessageScope : public StackResource { DISALLOW_COPY_AND_ASSIGN(NoOOBMessageScope); }; - // Disallow isolate reload. class NoReloadScope : public StackResource { public: @@ -125,7 +121,6 @@ class NoReloadScope : public StackResource { DISALLOW_COPY_AND_ASSIGN(NoReloadScope); }; - // Fixed cache for exception handler lookup. typedef FixedCache HandlerInfoCache; // Fixed cache for catch entry state lookup. @@ -420,7 +415,6 @@ class Isolate : public BaseIsolate { return cleanup_callback_; } - void set_object_id_ring(ObjectIdRing* ring) { object_id_ring_ = ring; } ObjectIdRing* object_id_ring() { return object_id_ring_; } @@ -653,7 +647,7 @@ class Isolate : public BaseIsolate { ISOLATE_FLAG_LIST(DECLARE_GETTER) #undef DECLARE_GETTER void set_use_osr(bool use_osr) { ASSERT(!use_osr); } -#else // defined(PRODUCT) +#else // defined(PRODUCT) #define DECLARE_GETTER(name, isolate_flag_name, flag_name) \ bool name() const { return name##_; } ISOLATE_FLAG_LIST(DECLARE_GETTER) @@ -900,18 +894,16 @@ class Isolate : public BaseIsolate { friend class Become; // VisitObjectPointers friend class GCMarker; // VisitObjectPointers friend class SafepointHandler; - friend class Scavenger; // VisitObjectPointers + friend class Scavenger; // VisitObjectPointers friend class ObjectGraph; // VisitObjectPointers friend class ServiceIsolate; friend class Thread; friend class Timeline; friend class NoReloadScope; // reload_block - DISALLOW_COPY_AND_ASSIGN(Isolate); }; - // When we need to execute code in an isolate, we use the // StartIsolateScope. class StartIsolateScope { @@ -953,7 +945,6 @@ class StartIsolateScope { DISALLOW_COPY_AND_ASSIGN(StartIsolateScope); }; - class IsolateSpawnState { public: IsolateSpawnState(Dart_Port parent_port, diff --git a/runtime/vm/isolate_reload.cc b/runtime/vm/isolate_reload.cc index 76882ec991a..5537b5adc9e 100644 --- a/runtime/vm/isolate_reload.cc +++ b/runtime/vm/isolate_reload.cc @@ -6,7 +6,6 @@ #include "vm/become.h" #include "vm/bit_vector.h" -#include "vm/runtime_entry.h" #include "vm/compiler.h" #include "vm/dart_api_impl.h" #include "vm/hash_table.h" @@ -15,6 +14,7 @@ #include "vm/object.h" #include "vm/object_store.h" #include "vm/parser.h" +#include "vm/runtime_entry.h" #include "vm/safepoint.h" #include "vm/service_event.h" #include "vm/stack_frame.h" @@ -53,7 +53,6 @@ DEFINE_FLAG(bool, TimelineDurationScope tds##name(Thread::Current(), \ Timeline::GetIsolateStream(), #name) - InstanceMorpher::InstanceMorpher(Zone* zone, const Class& from, const Class& to) : from_(Class::Handle(zone, from.raw())), to_(Class::Handle(zone, to.raw())), @@ -66,14 +65,12 @@ InstanceMorpher::InstanceMorpher(Zone* zone, const Class& from, const Class& to) ComputeMapping(); } - void InstanceMorpher::AddObject(RawObject* object) const { ASSERT(object->GetClassId() == cid()); const Instance& instance = Instance::Cast(Object::Handle(object)); before_->Add(&instance); } - void InstanceMorpher::ComputeMapping() { if (from_.NumTypeArguments()) { // Add copying of the optional type argument field. @@ -136,7 +133,6 @@ void InstanceMorpher::ComputeMapping() { } } - RawInstance* InstanceMorpher::Morph(const Instance& instance) const { const Instance& result = Instance::Handle(Instance::New(to_)); // Morph the context from instance to result using mapping_. @@ -152,7 +148,6 @@ RawInstance* InstanceMorpher::Morph(const Instance& instance) const { return result.raw(); } - void InstanceMorpher::RunNewFieldInitializers() const { if ((new_fields_->length() == 0) || (after_->length() == 0)) { return; @@ -194,7 +189,6 @@ void InstanceMorpher::RunNewFieldInitializers() const { } } - void InstanceMorpher::CreateMorphedCopies() const { for (intptr_t i = 0; i < before()->length(); i++) { const Instance& copy = Instance::Handle(Morph(*before()->At(i))); @@ -202,7 +196,6 @@ void InstanceMorpher::CreateMorphedCopies() const { } } - void InstanceMorpher::DumpFormatFor(const Class& cls) const { THR_Print("%s\n", cls.ToCString()); if (cls.NumTypeArguments()) { @@ -229,7 +222,6 @@ void InstanceMorpher::DumpFormatFor(const Class& cls) const { THR_Print("\n"); } - void InstanceMorpher::Dump() const { LogBlock blocker; THR_Print("Morphing from "); @@ -239,7 +231,6 @@ void InstanceMorpher::Dump() const { THR_Print("\n"); } - void InstanceMorpher::AppendTo(JSONArray* array) { JSONObject jsobj(array); jsobj.AddProperty("type", "ShapeChangeMapping"); @@ -253,26 +244,22 @@ void InstanceMorpher::AppendTo(JSONArray* array) { } } - void ReasonForCancelling::Report(IsolateReloadContext* context) { const Error& error = Error::Handle(ToError()); context->ReportError(error); } - RawError* ReasonForCancelling::ToError() { // By default create the error returned from ToString. const String& message = String::Handle(ToString()); return LanguageError::New(message); } - RawString* ReasonForCancelling::ToString() { UNREACHABLE(); return NULL; } - void ReasonForCancelling::AppendTo(JSONArray* array) { JSONObject jsobj(array); jsobj.AddProperty("type", "ReasonForCancelling"); @@ -280,7 +267,6 @@ void ReasonForCancelling::AppendTo(JSONArray* array) { jsobj.AddProperty("message", message.ToCString()); } - ClassReasonForCancelling::ClassReasonForCancelling(Zone* zone, const Class& from, const Class& to) @@ -288,7 +274,6 @@ ClassReasonForCancelling::ClassReasonForCancelling(Zone* zone, from_(Class::ZoneHandle(zone, from.raw())), to_(Class::ZoneHandle(zone, to.raw())) {} - void ClassReasonForCancelling::AppendTo(JSONArray* array) { JSONObject jsobj(array); jsobj.AddProperty("type", "ReasonForCancelling"); @@ -297,14 +282,12 @@ void ClassReasonForCancelling::AppendTo(JSONArray* array) { jsobj.AddProperty("message", message.ToCString()); } - RawError* IsolateReloadContext::error() const { ASSERT(reload_aborted()); // Report the first error to the surroundings. return reasons_to_cancel_reload_.At(0)->ToError(); } - class ScriptUrlSetTraits { public: static bool ReportStats() { return false; } @@ -321,7 +304,6 @@ class ScriptUrlSetTraits { static uword Hash(const Object& obj) { return String::Cast(obj).Hash(); } }; - class ClassMapTraits { public: static bool ReportStats() { return false; } @@ -339,7 +321,6 @@ class ClassMapTraits { } }; - class LibraryMapTraits { public: static bool ReportStats() { return false; } @@ -356,7 +337,6 @@ class LibraryMapTraits { static uword Hash(const Object& obj) { return Library::Cast(obj).UrlHash(); } }; - class BecomeMapTraits { public: static bool ReportStats() { return false; } @@ -383,7 +363,6 @@ class BecomeMapTraits { } }; - bool IsolateReloadContext::IsSameField(const Field& a, const Field& b) { if (a.is_static() != b.is_static()) { return false; @@ -401,7 +380,6 @@ bool IsolateReloadContext::IsSameField(const Field& a, const Field& b) { return a_name.Equals(b_name); } - bool IsolateReloadContext::IsSameClass(const Class& a, const Class& b) { if (a.is_patch() != b.is_patch()) { // TODO(johnmccutchan): Should we just check the class kind bits? @@ -427,7 +405,6 @@ bool IsolateReloadContext::IsSameClass(const Class& a, const Class& b) { return (a_lib.private_key() == b_lib.private_key()); } - bool IsolateReloadContext::IsSameLibrary(const Library& a_lib, const Library& b_lib) { const String& a_lib_url = @@ -437,7 +414,6 @@ bool IsolateReloadContext::IsSameLibrary(const Library& a_lib, return a_lib_url.Equals(b_lib_url); } - IsolateReloadContext::IsolateReloadContext(Isolate* isolate, JSONStream* js) : zone_(Thread::Current()->zone()), start_time_micros_(OS::GetCurrentMonotonicMicros()), @@ -472,12 +448,10 @@ IsolateReloadContext::IsolateReloadContext(Isolate* isolate, JSONStream* js) ASSERT(zone_ != NULL); } - IsolateReloadContext::~IsolateReloadContext() { ASSERT(saved_class_table_ == NULL); } - void IsolateReloadContext::ReportError(const Error& error) { if (FLAG_trace_reload) { THR_Print("ISO-RELOAD: Error: %s\n", error.ToErrorCString()); @@ -487,13 +461,11 @@ void IsolateReloadContext::ReportError(const Error& error) { Service::HandleEvent(&service_event); } - void IsolateReloadContext::ReportSuccess() { ServiceEvent service_event(I, ServiceEvent::kIsolateReload); Service::HandleEvent(&service_event); } - class Aborted : public ReasonForCancelling { public: Aborted(Zone* zone, const Error& error) @@ -509,7 +481,6 @@ class Aborted : public ReasonForCancelling { } }; - static intptr_t CommonSuffixLength(const char* a, const char* b) { const intptr_t a_length = strlen(a); const intptr_t b_length = strlen(b); @@ -528,7 +499,6 @@ static intptr_t CommonSuffixLength(const char* a, const char* b) { return (a_length - a_cursor); } - // NOTE: This function returns *after* FinalizeLoading is called. void IsolateReloadContext::Reload(bool force_reload, const char* root_script_url, @@ -660,7 +630,6 @@ void IsolateReloadContext::Reload(bool force_reload, } } - void IsolateReloadContext::RegisterClass(const Class& new_cls) { const Class& old_cls = Class::Handle(OldClassOrNull(new_cls)); if (old_cls.IsNull()) { @@ -687,7 +656,6 @@ void IsolateReloadContext::RegisterClass(const Class& new_cls) { AddClassMapping(new_cls, old_cls); } - // FinalizeLoading will be called *before* Reload() returns but will not be // called if the embedder fails to load sources. void IsolateReloadContext::FinalizeLoading() { @@ -712,7 +680,6 @@ void IsolateReloadContext::FinalizeLoading() { CommonFinalizeTail(); } - // FinalizeFailedLoad will be called *before* Reload() returns and will only // be called if the embedder fails to load sources. void IsolateReloadContext::FinalizeFailedLoad(const Error& error) { @@ -725,13 +692,11 @@ void IsolateReloadContext::FinalizeFailedLoad(const Error& error) { CommonFinalizeTail(); } - void IsolateReloadContext::CommonFinalizeTail() { ReportOnJSON(js_); reload_finalized_ = true; } - void IsolateReloadContext::ReportOnJSON(JSONStream* stream) { JSONObject jsobj(stream); jsobj.AddProperty("type", "ReloadReport"); @@ -771,7 +736,6 @@ void IsolateReloadContext::ReportOnJSON(JSONStream* stream) { } } - void IsolateReloadContext::EnsuredUnoptimizedCodeForStack() { TIMELINE_SCOPE(EnsuredUnoptimizedCodeForStack); StackFrameIterator it(StackFrameIterator::kDontValidateFrames, @@ -789,7 +753,6 @@ void IsolateReloadContext::EnsuredUnoptimizedCodeForStack() { } } - void IsolateReloadContext::DeoptimizeDependentCode() { TIMELINE_SCOPE(DeoptimizeDependentCode); ClassTable* class_table = I->class_table(); @@ -824,7 +787,6 @@ void IsolateReloadContext::DeoptimizeDependentCode() { // TODO(johnmccutchan): Also call LibraryPrefix::InvalidateDependentCode. } - void IsolateReloadContext::CheckpointClasses() { TIMELINE_SCOPE(CheckpointClasses); TIR_Print("---- CHECKPOINTING CLASSES\n"); @@ -865,10 +827,8 @@ void IsolateReloadContext::CheckpointClasses() { TIR_Print("---- System had %" Pd " classes\n", saved_num_cids_); } - Dart_FileModifiedCallback IsolateReloadContext::file_modified_callback_ = NULL; - bool IsolateReloadContext::ScriptModifiedSince(const Script& script, int64_t since) { if (file_modified_callback_ == NULL) { @@ -880,7 +840,6 @@ bool IsolateReloadContext::ScriptModifiedSince(const Script& script, return (*file_modified_callback_)(url_chars, since); } - static void PropagateLibraryModified( const ZoneGrowableArray*>* imported_by, intptr_t lib_index, @@ -895,7 +854,6 @@ static void PropagateLibraryModified( } } - BitVector* IsolateReloadContext::FindModifiedLibraries(bool force_reload) { Thread* thread = Thread::Current(); int64_t last_reload = I->last_reload_timestamp(); @@ -991,7 +949,6 @@ BitVector* IsolateReloadContext::FindModifiedLibraries(bool force_reload) { return modified_libs; } - void IsolateReloadContext::CheckpointLibraries() { TIMELINE_SCOPE(CheckpointLibraries); TIR_Print("---- CHECKPOINTING LIBRARIES\n"); @@ -1036,7 +993,6 @@ void IsolateReloadContext::CheckpointLibraries() { object_store()->set_root_library(Library::Handle()); } - // While reloading everything we do must be reversible so that we can abort // safely if the reload fails. This function stashes things to the side and // prepares the isolate for the reload attempt. @@ -1046,7 +1002,6 @@ void IsolateReloadContext::Checkpoint() { CheckpointLibraries(); } - void IsolateReloadContext::RollbackClasses() { TIR_Print("---- ROLLING BACK CLASS TABLE\n"); ASSERT(saved_num_cids_ > 0); @@ -1068,7 +1023,6 @@ void IsolateReloadContext::RollbackClasses() { class_table->AddOldTable(local_saved_class_table); } - void IsolateReloadContext::RollbackLibraries() { TIR_Print("---- ROLLING BACK LIBRARY CHANGES\n"); Thread* thread = Thread::Current(); @@ -1095,14 +1049,12 @@ void IsolateReloadContext::RollbackLibraries() { set_saved_libraries(GrowableObjectArray::Handle()); } - void IsolateReloadContext::Rollback() { TIR_Print("---- ROLLING BACK"); RollbackClasses(); RollbackLibraries(); } - #ifdef DEBUG void IsolateReloadContext::VerifyMaps() { TIMELINE_SCOPE(VerifyMaps); @@ -1139,7 +1091,6 @@ void IsolateReloadContext::VerifyMaps() { } #endif - void IsolateReloadContext::Commit() { TIMELINE_SCOPE(Commit); TIR_Print("---- COMMITTING RELOAD\n"); @@ -1307,7 +1258,6 @@ void IsolateReloadContext::Commit() { #endif // DEBUG } - void IsolateReloadContext::RehashConstants() { TIMELINE_SCOPE(RehashConstants); ClassTable* class_table = I->class_table(); @@ -1329,7 +1279,6 @@ void IsolateReloadContext::RehashConstants() { } } - bool IsolateReloadContext::IsDirty(const Library& lib) { const intptr_t index = lib.index(); if (index == static_cast(-1)) { @@ -1340,7 +1289,6 @@ bool IsolateReloadContext::IsDirty(const Library& lib) { return library_infos_[index].dirty; } - void IsolateReloadContext::PostCommit() { TIMELINE_SCOPE(PostCommit); set_saved_root_library(Library::Handle()); @@ -1349,19 +1297,16 @@ void IsolateReloadContext::PostCommit() { TIR_Print("---- DONE COMMIT\n"); } - void IsolateReloadContext::AddReasonForCancelling(ReasonForCancelling* reason) { reload_aborted_ = true; reasons_to_cancel_reload_.Add(reason); } - void IsolateReloadContext::AddInstanceMorpher(InstanceMorpher* morpher) { instance_morphers_.Add(morpher); cid_mapper_.Insert(morpher); } - void IsolateReloadContext::ReportReasonsForCancelling() { ASSERT(FLAG_reload_force_rollback || HasReasonsForCancelling()); for (int i = 0; i < reasons_to_cancel_reload_.length(); i++) { @@ -1369,7 +1314,6 @@ void IsolateReloadContext::ReportReasonsForCancelling() { } } - // The ObjectLocator is used for collecting instances that // needs to be morphed. class ObjectLocator : public ObjectVisitor { @@ -1394,7 +1338,6 @@ class ObjectLocator : public ObjectVisitor { intptr_t count_; }; - void IsolateReloadContext::MorphInstances() { TIMELINE_SCOPE(MorphInstances); ASSERT(HasInstanceMorphers()); @@ -1448,7 +1391,6 @@ void IsolateReloadContext::MorphInstances() { Become::ElementsForwardIdentity(before, after); } - void IsolateReloadContext::RunNewFieldInitializers() { // Run new field initializers on all instances. for (intptr_t i = 0; i < instance_morphers_.length(); i++) { @@ -1456,7 +1398,6 @@ void IsolateReloadContext::RunNewFieldInitializers() { } } - bool IsolateReloadContext::ValidateReload() { TIMELINE_SCOPE(ValidateReload); if (reload_aborted()) return false; @@ -1502,12 +1443,10 @@ bool IsolateReloadContext::ValidateReload() { return !FLAG_reload_force_rollback && !HasReasonsForCancelling(); } - RawClass* IsolateReloadContext::FindOriginalClass(const Class& cls) { return MappedClass(cls); } - RawClass* IsolateReloadContext::GetClassForHeapWalkAt(intptr_t cid) { RawClass** class_table = AtomicOperations::LoadRelaxed(&saved_class_table_); if (class_table != NULL) { @@ -1519,28 +1458,23 @@ RawClass* IsolateReloadContext::GetClassForHeapWalkAt(intptr_t cid) { } } - RawLibrary* IsolateReloadContext::saved_root_library() const { return saved_root_library_; } - void IsolateReloadContext::set_saved_root_library(const Library& value) { saved_root_library_ = value.raw(); } - RawGrowableObjectArray* IsolateReloadContext::saved_libraries() const { return saved_libraries_; } - void IsolateReloadContext::set_saved_libraries( const GrowableObjectArray& value) { saved_libraries_ = value.raw(); } - void IsolateReloadContext::VisitObjectPointers(ObjectPointerVisitor* visitor) { visitor->VisitPointers(from(), to()); if (saved_class_table_ != NULL) { @@ -1549,12 +1483,10 @@ void IsolateReloadContext::VisitObjectPointers(ObjectPointerVisitor* visitor) { } } - ObjectStore* IsolateReloadContext::object_store() { return isolate_->object_store(); } - void IsolateReloadContext::ResetUnoptimizedICsOnStack() { Thread* thread = Thread::Current(); StackZone stack_zone(thread); @@ -1582,7 +1514,6 @@ void IsolateReloadContext::ResetUnoptimizedICsOnStack() { } } - void IsolateReloadContext::ResetMegamorphicCaches() { object_store()->set_megamorphic_cache_table(GrowableObjectArray::Handle()); // Since any current optimized code will not make any more calls, it may be @@ -1591,7 +1522,6 @@ void IsolateReloadContext::ResetMegamorphicCaches() { // new ones. } - class MarkFunctionsForRecompilation : public ObjectVisitor { public: MarkFunctionsForRecompilation(Isolate* isolate, @@ -1676,7 +1606,6 @@ class MarkFunctionsForRecompilation : public ObjectVisitor { Zone* zone_; }; - void IsolateReloadContext::MarkAllFunctionsForRecompilation() { TIMELINE_SCOPE(MarkAllFunctionsForRecompilation); TIR_Print("---- MARKING ALL FUNCTIONS FOR RECOMPILATION\n"); @@ -1689,7 +1618,6 @@ void IsolateReloadContext::MarkAllFunctionsForRecompilation() { isolate_->heap()->VisitObjects(&visitor); } - void IsolateReloadContext::InvalidateWorld() { TIR_Print("---- INVALIDATING WORLD\n"); ResetMegamorphicCaches(); @@ -1698,7 +1626,6 @@ void IsolateReloadContext::InvalidateWorld() { MarkAllFunctionsForRecompilation(); } - RawClass* IsolateReloadContext::MappedClass(const Class& replacement_or_new) { UnorderedHashMap map(class_map_storage_); Class& cls = Class::Handle(); @@ -1708,13 +1635,11 @@ RawClass* IsolateReloadContext::MappedClass(const Class& replacement_or_new) { return cls.raw(); } - RawLibrary* IsolateReloadContext::MappedLibrary( const Library& replacement_or_new) { return Library::null(); } - RawClass* IsolateReloadContext::OldClassOrNull( const Class& replacement_or_new) { UnorderedHashSet old_classes_set(old_classes_set_storage_); @@ -1724,7 +1649,6 @@ RawClass* IsolateReloadContext::OldClassOrNull( return cls.raw(); } - RawString* IsolateReloadContext::FindLibraryPrivateKey( const Library& replacement_or_new) { const Library& old = Library::Handle(OldLibraryOrNull(replacement_or_new)); @@ -1739,7 +1663,6 @@ RawString* IsolateReloadContext::FindLibraryPrivateKey( return old.private_key(); } - RawLibrary* IsolateReloadContext::OldLibraryOrNull( const Library& replacement_or_new) { UnorderedHashSet old_libraries_set( @@ -1754,7 +1677,6 @@ RawLibrary* IsolateReloadContext::OldLibraryOrNull( return lib.raw(); } - // Attempt to find the pair to |replacement_or_new| with the knowledge that // the base url prefix has moved. RawLibrary* IsolateReloadContext::OldLibraryOrNullBaseMoved( @@ -1794,7 +1716,6 @@ RawLibrary* IsolateReloadContext::OldLibraryOrNullBaseMoved( return Library::null(); } - void IsolateReloadContext::BuildLibraryMapping() { const GrowableObjectArray& libs = GrowableObjectArray::Handle(object_store()->libraries()); @@ -1822,7 +1743,6 @@ void IsolateReloadContext::BuildLibraryMapping() { } } - void IsolateReloadContext::AddClassMapping(const Class& replacement_or_new, const Class& original) { UnorderedHashMap map(class_map_storage_); @@ -1833,7 +1753,6 @@ void IsolateReloadContext::AddClassMapping(const Class& replacement_or_new, class_map_storage_ = map.Release().raw(); } - void IsolateReloadContext::AddLibraryMapping(const Library& replacement_or_new, const Library& original) { UnorderedHashMap map(library_map_storage_); @@ -1844,7 +1763,6 @@ void IsolateReloadContext::AddLibraryMapping(const Library& replacement_or_new, library_map_storage_ = map.Release().raw(); } - void IsolateReloadContext::AddStaticFieldMapping(const Field& old_field, const Field& new_field) { ASSERT(old_field.is_static()); @@ -1853,7 +1771,6 @@ void IsolateReloadContext::AddStaticFieldMapping(const Field& old_field, AddBecomeMapping(old_field, new_field); } - void IsolateReloadContext::AddBecomeMapping(const Object& old, const Object& neu) { ASSERT(become_map_storage_ != Array::null()); @@ -1863,7 +1780,6 @@ void IsolateReloadContext::AddBecomeMapping(const Object& old, become_map_storage_ = become_map.Release().raw(); } - void IsolateReloadContext::AddEnumBecomeMapping(const Object& old, const Object& neu) { const GrowableObjectArray& become_enum_mappings = @@ -1873,7 +1789,6 @@ void IsolateReloadContext::AddEnumBecomeMapping(const Object& old, ASSERT((become_enum_mappings.Length() % 2) == 0); } - void IsolateReloadContext::RebuildDirectSubclasses() { ClassTable* class_table = I->class_table(); intptr_t num_cids = class_table->NumCids(); diff --git a/runtime/vm/isolate_reload.h b/runtime/vm/isolate_reload.h index 43d62b351bf..f8b68265ddb 100644 --- a/runtime/vm/isolate_reload.h +++ b/runtime/vm/isolate_reload.h @@ -50,7 +50,6 @@ class RawString; class Script; class UpdateClassesVisitor; - class InstanceMorpher : public ZoneAllocated { public: InstanceMorpher(Zone* zone, const Class& from, const Class& to); @@ -96,7 +95,6 @@ class InstanceMorpher : public ZoneAllocated { void DumpFormatFor(const Class& cls) const; }; - class ReasonForCancelling : public ZoneAllocated { public: explicit ReasonForCancelling(Zone* zone) {} @@ -119,7 +117,6 @@ class ReasonForCancelling : public ZoneAllocated { // Concrete subclasses must override either ToError or ToString. }; - // Abstract class for also capturing the from_ and to_ class. class ClassReasonForCancelling : public ReasonForCancelling { public: @@ -131,7 +128,6 @@ class ClassReasonForCancelling : public ReasonForCancelling { const Class& to_; }; - class IsolateReloadContext { public: explicit IsolateReloadContext(Isolate* isolate, JSONStream* js); diff --git a/runtime/vm/isolate_reload_test.cc b/runtime/vm/isolate_reload_test.cc index 218ecb142b2..574384e405f 100644 --- a/runtime/vm/isolate_reload_test.cc +++ b/runtime/vm/isolate_reload_test.cc @@ -31,7 +31,6 @@ int64_t SimpleInvoke(Dart_Handle lib, const char* method) { return integer_result; } - const char* SimpleInvokeStr(Dart_Handle lib, const char* method) { Dart_Handle result = Dart_Invoke(lib, NewString(method), 0, NULL); const char* result_str = NULL; @@ -40,14 +39,12 @@ const char* SimpleInvokeStr(Dart_Handle lib, const char* method) { return result_str; } - Dart_Handle SimpleInvokeError(Dart_Handle lib, const char* method) { Dart_Handle result = Dart_Invoke(lib, NewString(method), 0, NULL); EXPECT(Dart_IsError(result)); return result; } - TEST_CASE(IsolateReload_FunctionReplacement) { const char* kScript = "main() {\n" @@ -70,7 +67,6 @@ TEST_CASE(IsolateReload_FunctionReplacement) { EXPECT_EQ(10, SimpleInvoke(lib, "main")); } - TEST_CASE(IsolateReload_BadClass) { const char* kScript = "class Foo {\n" @@ -102,7 +98,6 @@ TEST_CASE(IsolateReload_BadClass) { EXPECT_EQ(4, SimpleInvoke(lib, "main")); } - TEST_CASE(IsolateReload_StaticValuePreserved) { const char* kScript = "init() => 'old value';\n" @@ -130,7 +125,6 @@ TEST_CASE(IsolateReload_StaticValuePreserved) { SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_SavedClosure) { // Create a closure in main which only exists in the original source. const char* kScript = @@ -165,7 +159,6 @@ TEST_CASE(IsolateReload_SavedClosure) { EXPECT_STREQ("postapocalyptic!", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_TopLevelFieldAdded) { const char* kScript = "var value1 = 10;\n" @@ -189,7 +182,6 @@ TEST_CASE(IsolateReload_TopLevelFieldAdded) { EXPECT_STREQ("value1=10,value2=20", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_ClassFieldAdded) { const char* kScript = "class Foo {\n" @@ -219,7 +211,6 @@ TEST_CASE(IsolateReload_ClassFieldAdded) { EXPECT_EQ(44, SimpleInvoke(lib, "main")); } - TEST_CASE(IsolateReload_ClassFieldAdded2) { const char* kScript = "class Foo {\n" @@ -251,7 +242,6 @@ TEST_CASE(IsolateReload_ClassFieldAdded2) { EXPECT_EQ(44, SimpleInvoke(lib, "main")); } - TEST_CASE(IsolateReload_ClassFieldRemoved) { const char* kScript = "class Foo {\n" @@ -281,7 +271,6 @@ TEST_CASE(IsolateReload_ClassFieldRemoved) { EXPECT_EQ(44, SimpleInvoke(lib, "main")); } - TEST_CASE(IsolateReload_ClassAdded) { const char* kScript = "main() {\n" @@ -306,7 +295,6 @@ TEST_CASE(IsolateReload_ClassAdded) { EXPECT_STREQ("hello from A", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_LibraryImportAdded) { const char* kScript = "main() {\n" @@ -328,7 +316,6 @@ TEST_CASE(IsolateReload_LibraryImportAdded) { EXPECT_EQ(4, SimpleInvoke(lib, "main")); } - TEST_CASE(IsolateReload_LibraryImportRemoved) { const char* kScript = "import 'dart:math';\n" @@ -351,7 +338,6 @@ TEST_CASE(IsolateReload_LibraryImportRemoved) { EXPECT_ERROR(SimpleInvokeError(lib, "main"), "max"); } - TEST_CASE(IsolateReload_LibraryDebuggable) { const char* kScript = "main() {\n" @@ -390,7 +376,6 @@ TEST_CASE(IsolateReload_LibraryDebuggable) { EXPECT_EQ(false, debuggable); } - TEST_CASE(IsolateReload_ImplicitConstructorChanged) { // Note that we are checking that the value 20 gets cleared from the // compile-time constants cache. To make this test work, "20" and @@ -424,7 +409,6 @@ TEST_CASE(IsolateReload_ImplicitConstructorChanged) { EXPECT_STREQ("saved:20 new:10", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_ConstructorChanged) { const char* kScript = "class A {\n" @@ -458,7 +442,6 @@ TEST_CASE(IsolateReload_ConstructorChanged) { EXPECT_STREQ("saved:20 new:10", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_SuperClassChanged) { const char* kScript = "class A {\n" @@ -490,7 +473,6 @@ TEST_CASE(IsolateReload_SuperClassChanged) { EXPECT_STREQ("(true/true, false/true)", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_Generics) { // Reload a program with generics without changing the source. We // do this to produce duplication TypeArguments and make sure that @@ -522,7 +504,6 @@ TEST_CASE(IsolateReload_Generics) { EXPECT_STREQ("Instance of 'B'", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_TypeIdentity) { const char* kScript = "import 'test:isolate_reload_helper';\n" @@ -554,7 +535,6 @@ TEST_CASE(IsolateReload_TypeIdentity) { EXPECT_STREQ("true", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_TypeIdentityGeneric) { const char* kScript = "import 'test:isolate_reload_helper';\n" @@ -586,7 +566,6 @@ TEST_CASE(IsolateReload_TypeIdentityGeneric) { EXPECT_STREQ("true", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_TypeIdentityParameter) { const char* kScript = "import 'dart:mirrors';\n" @@ -620,7 +599,6 @@ TEST_CASE(IsolateReload_TypeIdentityParameter) { EXPECT_STREQ("true", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_MixinChanged) { const char* kScript = "class Mixin1 {\n" @@ -663,7 +641,6 @@ TEST_CASE(IsolateReload_MixinChanged) { SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_ComplexInheritanceChange) { const char* kScript = "class A {\n" @@ -753,7 +730,6 @@ TEST_CASE(IsolateReload_ComplexInheritanceChange) { SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_LiveStack) { const char* kScript = "import 'test:isolate_reload_helper';\n" @@ -787,7 +763,6 @@ TEST_CASE(IsolateReload_LiveStack) { EXPECT_EQ(105, SimpleInvoke(lib, "main")); } - TEST_CASE(IsolateReload_LibraryLookup) { const char* kImportScript = "importedFunc() => 'a';\n"; TestCase::AddTestLib("test:lib1", kImportScript); @@ -829,7 +804,6 @@ TEST_CASE(IsolateReload_LibraryLookup) { EXPECT(Dart_IsError(result)); } - TEST_CASE(IsolateReload_LibraryHide) { const char* kImportScript = "importedFunc() => 'a';\n"; TestCase::AddTestLib("test:lib1", kImportScript); @@ -860,7 +834,6 @@ TEST_CASE(IsolateReload_LibraryHide) { EXPECT_STREQ("a", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_LibraryShow) { const char* kImportScript = "importedFunc() => 'a';\n" @@ -878,7 +851,6 @@ TEST_CASE(IsolateReload_LibraryShow) { " return importedIntFunc();\n" "}\n"; - Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); EXPECT_VALID(lib); @@ -907,7 +879,6 @@ TEST_CASE(IsolateReload_LibraryShow) { EXPECT_ERROR(SimpleInvokeError(lib, "mainInt"), "importedIntFunc"); } - // Verifies that we clear the ICs for the functions live on the stack in a way // that is compatible with the fast path smi stubs. TEST_CASE(IsolateReload_SmiFastPathStubs) { @@ -924,7 +895,6 @@ TEST_CASE(IsolateReload_SmiFastPathStubs) { " return x + y;\n" "}\n"; - Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); EXPECT_VALID(lib); @@ -934,7 +904,6 @@ TEST_CASE(IsolateReload_SmiFastPathStubs) { EXPECT_EQ(8, SimpleInvoke(lib, "main")); } - // Verifies that we assign the correct patch classes for imported // mixins when we reload. TEST_CASE(IsolateReload_ImportedMixinFunction) { @@ -972,7 +941,6 @@ TEST_CASE(IsolateReload_ImportedMixinFunction) { EXPECT_STREQ("mixin", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_TopLevelParseError) { const char* kScript = "main() {\n" @@ -993,7 +961,6 @@ TEST_CASE(IsolateReload_TopLevelParseError) { EXPECT_ERROR(lib, "unexpected token"); } - TEST_CASE(IsolateReload_PendingUnqualifiedCall_StaticToInstance) { const char* kScript = "import 'test:isolate_reload_helper';\n" @@ -1033,7 +1000,6 @@ TEST_CASE(IsolateReload_PendingUnqualifiedCall_StaticToInstance) { EXPECT_STREQ("instance", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_PendingUnqualifiedCall_InstanceToStatic) { const char* kScript = "import 'test:isolate_reload_helper';\n" @@ -1073,7 +1039,6 @@ TEST_CASE(IsolateReload_PendingUnqualifiedCall_InstanceToStatic) { EXPECT_STREQ("static", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_PendingConstructorCall_AbstractToConcrete) { const char* kScript = "import 'test:isolate_reload_helper';\n" @@ -1123,7 +1088,6 @@ TEST_CASE(IsolateReload_PendingConstructorCall_AbstractToConcrete) { EXPECT_STREQ("okay", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_PendingConstructorCall_ConcreteToAbstract) { const char* kScript = "import 'test:isolate_reload_helper';\n" @@ -1173,7 +1137,6 @@ TEST_CASE(IsolateReload_PendingConstructorCall_ConcreteToAbstract) { EXPECT_STREQ("exception", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_PendingStaticCall_DefinedToNSM) { const char* kScript = "import 'test:isolate_reload_helper';\n" @@ -1220,7 +1183,6 @@ TEST_CASE(IsolateReload_PendingStaticCall_DefinedToNSM) { EXPECT_STREQ("exception", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_PendingStaticCall_NSMToDefined) { const char* kScript = "import 'test:isolate_reload_helper';\n" @@ -1267,7 +1229,6 @@ TEST_CASE(IsolateReload_PendingStaticCall_NSMToDefined) { EXPECT_STREQ("static", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_PendingSuperCall) { const char* kScript = "import 'test:isolate_reload_helper';\n" @@ -1311,7 +1272,6 @@ TEST_CASE(IsolateReload_PendingSuperCall) { EXPECT_EQ(11, SimpleInvoke(lib, "main")); } - TEST_CASE(IsolateReload_TearOff_Instance_Equality) { const char* kScript = "import 'test:isolate_reload_helper';\n" @@ -1350,7 +1310,6 @@ TEST_CASE(IsolateReload_TearOff_Instance_Equality) { EXPECT_VALID(lib); } - TEST_CASE(IsolateReload_TearOff_Class_Identity) { const char* kScript = "import 'test:isolate_reload_helper';\n" @@ -1389,7 +1348,6 @@ TEST_CASE(IsolateReload_TearOff_Class_Identity) { EXPECT_VALID(lib); } - TEST_CASE(IsolateReload_TearOff_Library_Identity) { const char* kScript = "import 'test:isolate_reload_helper';\n" @@ -1424,7 +1382,6 @@ TEST_CASE(IsolateReload_TearOff_Library_Identity) { EXPECT_VALID(lib); } - TEST_CASE(IsolateReload_TearOff_List_Set) { const char* kScript = "import 'test:isolate_reload_helper';\n" @@ -1488,7 +1445,6 @@ TEST_CASE(IsolateReload_TearOff_List_Set) { EXPECT_VALID(lib); } - TEST_CASE(IsolateReload_DanglingGetter_Instance) { const char* kScript = "import 'test:isolate_reload_helper';\n" @@ -1547,7 +1503,6 @@ TEST_CASE(IsolateReload_DanglingGetter_Instance) { EXPECT_VALID(lib); } - TEST_CASE(IsolateReload_DanglingGetter_Class) { const char* kScript = "import 'test:isolate_reload_helper';\n" @@ -1608,7 +1563,6 @@ TEST_CASE(IsolateReload_DanglingGetter_Class) { EXPECT_VALID(lib); } - static void IsolateReload_DanlingGetter_LibraryReload( Dart_NativeArguments native_args) { const char* kImportScript2 = "var x;\n"; @@ -1617,7 +1571,6 @@ static void IsolateReload_DanlingGetter_LibraryReload( DART_CHECK_VALID(TestCase::TriggerReload()); } - static Dart_NativeFunction IsolateReload_DanlingGetter_LibraryNativeResolver( Dart_Handle name, int num_of_arguments, @@ -1625,7 +1578,6 @@ static Dart_NativeFunction IsolateReload_DanlingGetter_LibraryNativeResolver( return IsolateReload_DanlingGetter_LibraryReload; } - TEST_CASE(IsolateReload_DanglingGetter_Library) { const char* kImportScript = "var x;\n" @@ -1667,7 +1619,6 @@ TEST_CASE(IsolateReload_DanglingGetter_Library) { FLAG_support_deprecated_tearoff_syntax = false; } - TEST_CASE(IsolateReload_DanglingSetter_Instance) { const char* kScript = "import 'test:isolate_reload_helper';\n" @@ -1726,7 +1677,6 @@ TEST_CASE(IsolateReload_DanglingSetter_Instance) { FLAG_support_deprecated_tearoff_syntax = false; } - TEST_CASE(IsolateReload_DanglingSetter_Class) { const char* kScript = "import 'test:isolate_reload_helper';\n" @@ -1789,7 +1739,6 @@ TEST_CASE(IsolateReload_DanglingSetter_Class) { FLAG_support_deprecated_tearoff_syntax = false; } - static void IsolateReload_DanlingSetter_LibraryReload( Dart_NativeArguments native_args) { const char* kImportScript2 = "var x;\n"; @@ -1798,7 +1747,6 @@ static void IsolateReload_DanlingSetter_LibraryReload( DART_CHECK_VALID(TestCase::TriggerReload()); } - static Dart_NativeFunction IsolateReload_DanlingSetter_LibraryNativeResolver( Dart_Handle name, int num_of_arguments, @@ -1806,7 +1754,6 @@ static Dart_NativeFunction IsolateReload_DanlingSetter_LibraryNativeResolver( return IsolateReload_DanlingSetter_LibraryReload; } - TEST_CASE(IsolateReload_DanglingSetter_Library) { const char* kImportScript = "var x;\n" @@ -1848,7 +1795,6 @@ TEST_CASE(IsolateReload_DanglingSetter_Library) { FLAG_support_deprecated_tearoff_syntax = false; } - TEST_CASE(IsolateReload_TearOff_AddArguments) { const char* kScript = "import 'test:isolate_reload_helper';\n" @@ -1906,7 +1852,6 @@ TEST_CASE(IsolateReload_TearOff_AddArguments) { EXPECT_VALID(lib); } - TEST_CASE(IsolateReload_TearOff_AddArguments2) { const char* kScript = "import 'test:isolate_reload_helper';\n" @@ -1962,7 +1907,6 @@ TEST_CASE(IsolateReload_TearOff_AddArguments2) { EXPECT_VALID(lib); } - TEST_CASE(IsolateReload_EnumEquality) { const char* kScript = "enum Fruit {\n" @@ -1999,7 +1943,6 @@ TEST_CASE(IsolateReload_EnumEquality) { EXPECT_STREQ("yes", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_EnumIdentical) { const char* kScript = "enum Fruit {\n" @@ -2035,7 +1978,6 @@ TEST_CASE(IsolateReload_EnumIdentical) { EXPECT_STREQ("yes", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_EnumReorderIdentical) { const char* kScript = "enum Fruit {\n" @@ -2071,7 +2013,6 @@ TEST_CASE(IsolateReload_EnumReorderIdentical) { EXPECT_STREQ("yes", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_EnumAddition) { const char* kScript = "enum Fruit {\n" @@ -2107,7 +2048,6 @@ TEST_CASE(IsolateReload_EnumAddition) { SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_EnumToNotEnum) { const char* kScript = "enum Fruit {\n" @@ -2132,7 +2072,6 @@ TEST_CASE(IsolateReload_EnumToNotEnum) { EXPECT_ERROR(result, "Enum class cannot be redefined to be a non-enum class"); } - TEST_CASE(IsolateReload_NotEnumToEnum) { const char* kScript = "class Fruit {\n" @@ -2158,7 +2097,6 @@ TEST_CASE(IsolateReload_NotEnumToEnum) { EXPECT_ERROR(result, "Class cannot be redefined to be a enum class"); } - TEST_CASE(IsolateReload_EnumDelete) { const char* kScript = "enum Fruit {\n" @@ -2196,7 +2134,6 @@ TEST_CASE(IsolateReload_EnumDelete) { SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_EnumIdentityReload) { const char* kScript = "enum Fruit {\n" @@ -2255,7 +2192,6 @@ TEST_CASE(IsolateReload_EnumIdentityReload) { SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_ConstantIdentical) { const char* kScript = "class Fruit {\n" @@ -2293,7 +2229,6 @@ TEST_CASE(IsolateReload_ConstantIdentical) { EXPECT_STREQ("yes", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_EnumValuesToString) { const char* kScript = "enum Fruit {\n" @@ -2338,7 +2273,6 @@ TEST_CASE(IsolateReload_EnumValuesToString) { SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_DirectSubclasses_Success) { Object& new_subclass = Object::Handle(); String& name = String::Handle(); @@ -2395,7 +2329,6 @@ TEST_CASE(IsolateReload_DirectSubclasses_Success) { EXPECT_STREQ("BIterator", name.ToCString()); } - TEST_CASE(IsolateReload_DirectSubclasses_GhostSubclass) { Object& new_subclass = Object::Handle(); String& name = String::Handle(); @@ -2454,7 +2387,6 @@ TEST_CASE(IsolateReload_DirectSubclasses_GhostSubclass) { EXPECT_STREQ("BIterator", name.ToCString()); } - // Make sure that we restore the direct subclass info when we revert. TEST_CASE(IsolateReload_DirectSubclasses_Failure) { Object& new_subclass = Object::Handle(); @@ -2522,7 +2454,6 @@ TEST_CASE(IsolateReload_DirectSubclasses_Failure) { EXPECT_STREQ("AIterator", name.ToCString()); } - // Tests reload succeeds when instance format changes. // Change: Foo {a, b, c:42} -> Foo {c:42} // Validate: c keeps the value in the retained Foo object. @@ -2558,7 +2489,6 @@ TEST_CASE(IsolateReload_ChangeInstanceFormat0) { EXPECT_EQ(42, SimpleInvoke(lib, "main")); } - // Tests reload succeeds when instance format changes. // Change: Foo {} -> Foo {c:null} // Validate: c is initialized to null the retained Foo object. @@ -2626,7 +2556,6 @@ TEST_CASE(IsolateReload_ChangeInstanceFormat2) { EXPECT_EQ(24, SimpleInvoke(lib, "main")); } - // Tests reload succeeds when instance format changes. // Change: Foo {a, b, c:42, d} -> Foo {c:42, g} // Validate: c keeps the value in the retained Foo object. @@ -2667,7 +2596,6 @@ TEST_CASE(IsolateReload_ChangeInstanceFormat3) { EXPECT_EQ(3, SimpleInvoke(lib, "main")); } - // Tests reload succeeds when instance format changes. // Change: Bar {c:42}, Foo : Bar {d, e} -> Foo {c:42} // Validate: c keeps the value in the retained Foo object. @@ -2705,7 +2633,6 @@ TEST_CASE(IsolateReload_ChangeInstanceFormat4) { EXPECT_EQ(44, SimpleInvoke(lib, "main")); } - // Tests reload succeeds when instance format changes. // Change: Bar {a, b}, Foo : Bar {c:42} -> Bar {c:42}, Foo : Bar {} // Validate: c keeps the value in the retained Foo object. @@ -2745,7 +2672,6 @@ TEST_CASE(IsolateReload_ChangeInstanceFormat5) { EXPECT_EQ(44, SimpleInvoke(lib, "main")); } - // Tests reload fails when type parameters change. // Change: Foo {a, b} -> Foo {a} // Validate: the right error message is returned. @@ -2794,7 +2720,6 @@ TEST_CASE(IsolateReload_ChangeInstanceFormat7) { EXPECT_VALID(lib); } - // Regression for handle sharing bug: Change the shape of two classes and see // that their instances don't change class. TEST_CASE(IsolateReload_ChangeInstanceFormat8) { @@ -2833,7 +2758,6 @@ TEST_CASE(IsolateReload_ChangeInstanceFormat8) { EXPECT_STREQ("Instance of 'A' Instance of 'B'", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_ShapeChangeRetainsHash) { const char* kScript = "class A{\n" @@ -2865,7 +2789,6 @@ TEST_CASE(IsolateReload_ShapeChangeRetainsHash) { EXPECT_STREQ("true", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_StaticTearOffRetainsHash) { const char* kScript = "foo() {}\n" @@ -2892,12 +2815,10 @@ TEST_CASE(IsolateReload_StaticTearOffRetainsHash) { EXPECT_STREQ("true", SimpleInvokeStr(lib, "main")); } - static bool NothingModifiedCallback(const char* url, int64_t since) { return false; } - TEST_CASE(IsolateReload_NoLibsModified) { const char* kImportScript = "importedFunc() => 'fancy';"; TestCase::AddTestLib("test:lib1", kImportScript); @@ -2930,7 +2851,6 @@ TEST_CASE(IsolateReload_NoLibsModified) { EXPECT_STREQ("fancy feast", SimpleInvokeStr(lib, "main")); } - static bool MainModifiedCallback(const char* url, int64_t since) { if (strcmp(url, "test-lib") == 0) { return true; @@ -2938,7 +2858,6 @@ static bool MainModifiedCallback(const char* url, int64_t since) { return false; } - TEST_CASE(IsolateReload_MainLibModified) { const char* kImportScript = "importedFunc() => 'fancy';"; TestCase::AddTestLib("test:lib1", kImportScript); @@ -2971,7 +2890,6 @@ TEST_CASE(IsolateReload_MainLibModified) { EXPECT_STREQ("fancy pants", SimpleInvokeStr(lib, "main")); } - static bool ImportModifiedCallback(const char* url, int64_t since) { if (strcmp(url, "test:lib1") == 0) { return true; @@ -2979,7 +2897,6 @@ static bool ImportModifiedCallback(const char* url, int64_t since) { return false; } - TEST_CASE(IsolateReload_ImportedLibModified) { const char* kImportScript = "importedFunc() => 'fancy';"; TestCase::AddTestLib("test:lib1", kImportScript); @@ -3012,7 +2929,6 @@ TEST_CASE(IsolateReload_ImportedLibModified) { EXPECT_STREQ("bossy pants", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_PrefixImportedLibModified) { const char* kImportScript = "importedFunc() => 'fancy';"; TestCase::AddTestLib("test:lib1", kImportScript); @@ -3046,7 +2962,6 @@ TEST_CASE(IsolateReload_PrefixImportedLibModified) { EXPECT_STREQ("bossy pants", SimpleInvokeStr(lib, "main")); } - static bool ExportModifiedCallback(const char* url, int64_t since) { if (strcmp(url, "test:exportlib") == 0) { return true; @@ -3054,7 +2969,6 @@ static bool ExportModifiedCallback(const char* url, int64_t since) { return false; } - TEST_CASE(IsolateReload_ExportedLibModified) { const char* kImportScript = "export 'test:exportlib';"; TestCase::AddTestLib("test:importlib", kImportScript); @@ -3090,7 +3004,6 @@ TEST_CASE(IsolateReload_ExportedLibModified) { EXPECT_STREQ("bossy pants", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_SimpleConstFieldUpdate) { const char* kScript = "const value = 'a';\n" @@ -3113,7 +3026,6 @@ TEST_CASE(IsolateReload_SimpleConstFieldUpdate) { EXPECT_STREQ("value=b", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_ConstFieldUpdate) { const char* kScript = "const value = const Duration(seconds: 1);\n" @@ -3136,7 +3048,6 @@ TEST_CASE(IsolateReload_ConstFieldUpdate) { EXPECT_STREQ("value=0:00:02.000000", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_RunNewFieldInitializers) { const char* kScript = "class Foo {\n" @@ -3169,7 +3080,6 @@ TEST_CASE(IsolateReload_RunNewFieldInitializers) { EXPECT_EQ(7, SimpleInvoke(lib, "main")); } - TEST_CASE(IsolateReload_RunNewFieldInitializersReferenceStaticField) { const char* kScript = "int myInitialValue = 8 * 7;\n" @@ -3204,7 +3114,6 @@ TEST_CASE(IsolateReload_RunNewFieldInitializersReferenceStaticField) { EXPECT_EQ(56, SimpleInvoke(lib, "main")); } - TEST_CASE(IsolateReload_RunNewFieldInitializersMutateStaticField) { const char* kScript = "int myInitialValue = 8 * 7;\n" @@ -3243,7 +3152,6 @@ TEST_CASE(IsolateReload_RunNewFieldInitializersMutateStaticField) { EXPECT_EQ(58, SimpleInvoke(lib, "main")); } - // When an initializer expression throws, we leave the field as null. TEST_CASE(IsolateReload_RunNewFieldInitializersThrows) { const char* kScript = @@ -3277,7 +3185,6 @@ TEST_CASE(IsolateReload_RunNewFieldInitializersThrows) { EXPECT_STREQ("true", SimpleInvokeStr(lib, "main")); } - // When an initializer expression has a syntax error, we detect it at reload // time. TEST_CASE(IsolateReload_RunNewFieldInitializersSyntaxError) { @@ -3312,7 +3219,6 @@ TEST_CASE(IsolateReload_RunNewFieldInitializersSyntaxError) { EXPECT_ERROR(lib, "......"); } - // When an initializer expression has a syntax error, we detect it at reload // time. TEST_CASE(IsolateReload_RunNewFieldInitializersSyntaxError2) { @@ -3349,7 +3255,6 @@ TEST_CASE(IsolateReload_RunNewFieldInitializersSyntaxError2) { EXPECT_ERROR(lib, "......"); } - // When an initializer expression has a syntax error, we detect it at reload // time. TEST_CASE(IsolateReload_RunNewFieldInitializersSyntaxError3) { @@ -3386,7 +3291,6 @@ TEST_CASE(IsolateReload_RunNewFieldInitializersSyntaxError3) { EXPECT_ERROR(lib, "......"); } - TEST_CASE(IsolateReload_RunNewFieldInitialiazersSuperClass) { const char* kScript = "class Super {\n" @@ -3427,7 +3331,6 @@ TEST_CASE(IsolateReload_RunNewFieldInitialiazersSuperClass) { EXPECT_STREQ("right", SimpleInvokeStr(lib, "main")); } - TEST_CASE(IsolateReload_TypedefToNotTypedef) { const char* kScript = "typedef bool Predicate(dynamic x);\n" @@ -3452,7 +3355,6 @@ TEST_CASE(IsolateReload_TypedefToNotTypedef) { "Typedef class cannot be redefined to be a non-typedef class"); } - TEST_CASE(IsolateReload_NotTypedefToTypedef) { const char* kScript = "class Predicate {\n" @@ -3476,7 +3378,6 @@ TEST_CASE(IsolateReload_NotTypedefToTypedef) { EXPECT_ERROR(result, "Class cannot be redefined to be a typedef class"); } - TEST_CASE(IsolateReload_TypedefAddParameter) { const char* kScript = "typedef bool Predicate(dynamic x);\n" diff --git a/runtime/vm/isolate_test.cc b/runtime/vm/isolate_test.cc index 53b63e6ec80..8af39eacaf0 100644 --- a/runtime/vm/isolate_test.cc +++ b/runtime/vm/isolate_test.cc @@ -2,10 +2,10 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +#include "vm/isolate.h" #include "include/dart_api.h" #include "platform/assert.h" #include "vm/globals.h" -#include "vm/isolate.h" #include "vm/lockers.h" #include "vm/thread_barrier.h" #include "vm/thread_pool.h" @@ -22,7 +22,6 @@ VM_UNIT_TEST_CASE(IsolateCurrent) { EXPECT_EQ(reinterpret_cast(NULL), Dart_CurrentIsolate()); } - // Test to ensure that an exception is thrown if no isolate creation // callback has been set by the embedder when an isolate is spawned. TEST_CASE(IsolateSpawn) { @@ -71,7 +70,6 @@ TEST_CASE(IsolateSpawn) { DART_CHECK_VALID(Dart_Invoke( async_lib, NewString("_setScheduleImmediateClosure"), 1, args)); - result = Dart_Invoke(test_lib, NewString("testMain"), 0, NULL); EXPECT_VALID(result); // Run until all ports to isolate are closed. @@ -82,7 +80,6 @@ TEST_CASE(IsolateSpawn) { EXPECT_VALID(exception_result); } - class InterruptChecker : public ThreadPool::Task { public: static const intptr_t kTaskCount; @@ -116,7 +113,6 @@ class InterruptChecker : public ThreadPool::Task { ThreadBarrier* barrier_; }; - const intptr_t InterruptChecker::kTaskCount = 5; const intptr_t InterruptChecker::kIterations = 10; @@ -151,7 +147,6 @@ TEST_CASE(StackLimitInterrupts) { barrier.Exit(); } - class IsolateTestHelper { public: static uword GetStackLimit(Thread* thread) { return thread->stack_limit_; } @@ -166,7 +161,6 @@ class IsolateTestHelper { } }; - TEST_CASE(NoOOBMessageScope) { // EXPECT_EQ is picky about type agreement for its arguments. const uword kZero = 0; diff --git a/runtime/vm/jit_optimizer.cc b/runtime/vm/jit_optimizer.cc index 41c3341e422..61df7ea64f5 100644 --- a/runtime/vm/jit_optimizer.cc +++ b/runtime/vm/jit_optimizer.cc @@ -36,23 +36,19 @@ static bool ShouldInlineSimd() { return FlowGraphCompiler::SupportsUnboxedSimd128(); } - static bool CanUnboxDouble() { return FlowGraphCompiler::SupportsUnboxedDoubles(); } - static bool CanConvertUnboxedMintToDouble() { return FlowGraphCompiler::CanConvertUnboxedMintToDouble(); } - // Optimize instance calls using ICData. void JitOptimizer::ApplyICData() { VisitBlocks(); } - // Optimize instance calls using cid. This is called after optimizer // converted instance calls to instructions. Any remaining // instance calls are either megamorphic calls, cannot be optimized or @@ -83,13 +79,11 @@ void JitOptimizer::ApplyClassIds() { } } - // TODO(srdjan): Test/support other number types as well. static bool IsNumberCid(intptr_t cid) { return (cid == kSmiCid) || (cid == kDoubleCid); } - bool JitOptimizer::TryCreateICData(InstanceCallInstr* call) { ASSERT(call->HasICData()); if (call->ic_data()->NumberOfUsedChecks() > 0) { @@ -196,7 +190,6 @@ bool JitOptimizer::TryCreateICData(InstanceCallInstr* call) { return false; } - void JitOptimizer::SpecializePolymorphicInstanceCall( PolymorphicInstanceCallInstr* call) { if (!FLAG_polymorphic_with_deopt) { @@ -227,7 +220,6 @@ void JitOptimizer::SpecializePolymorphicInstanceCall( call->ReplaceWith(specialized, current_iterator()); } - static bool ClassIdIsOneOf(intptr_t class_id, const GrowableArray& class_ids) { for (intptr_t i = 0; i < class_ids.length(); i++) { @@ -239,7 +231,6 @@ static bool ClassIdIsOneOf(intptr_t class_id, return false; } - // Returns true if ICData tests two arguments and all ICData cids are in the // required sets 'receiver_class_ids' or 'argument_class_ids', respectively. static bool ICDataHasOnlyReceiverArgumentClassIds( @@ -264,7 +255,6 @@ static bool ICDataHasOnlyReceiverArgumentClassIds( return true; } - static bool ICDataHasReceiverArgumentClassIds(const ICData& ic_data, intptr_t receiver_class_id, intptr_t argument_class_id) { @@ -286,13 +276,11 @@ static bool ICDataHasReceiverArgumentClassIds(const ICData& ic_data, return false; } - static bool HasOnlyOneSmi(const ICData& ic_data) { return (ic_data.NumberOfUsedChecks() == 1) && ic_data.HasReceiverClassId(kSmiCid); } - static bool HasOnlySmiOrMint(const ICData& ic_data) { if (ic_data.NumberOfUsedChecks() == 1) { return ic_data.HasReceiverClassId(kSmiCid) || @@ -303,7 +291,6 @@ static bool HasOnlySmiOrMint(const ICData& ic_data) { ic_data.HasReceiverClassId(kMintCid); } - static bool HasOnlyTwoOf(const ICData& ic_data, intptr_t cid) { if (ic_data.NumberOfUsedChecks() != 1) { return false; @@ -331,7 +318,6 @@ static bool HasTwoMintOrSmi(const ICData& ic_data) { return true; } - // Returns false if the ICData contains anything other than the 4 combinations // of Double and Smi for the receiver and argument classes. static bool HasTwoDoubleOrSmi(const ICData& ic_data) { @@ -341,13 +327,11 @@ static bool HasTwoDoubleOrSmi(const ICData& ic_data) { return ICDataHasOnlyReceiverArgumentClassIds(ic_data, class_ids, class_ids); } - static bool HasOnlyOneDouble(const ICData& ic_data) { return (ic_data.NumberOfUsedChecks() == 1) && ic_data.HasReceiverClassId(kDoubleCid); } - static bool ShouldSpecializeForDouble(const ICData& ic_data) { // Don't specialize for double if we can't unbox them. if (!CanUnboxDouble()) { @@ -363,7 +347,6 @@ static bool ShouldSpecializeForDouble(const ICData& ic_data) { return HasTwoDoubleOrSmi(ic_data); } - void JitOptimizer::ReplaceCall(Definition* call, Definition* replacement) { // Remove the original push arguments. for (intptr_t i = 0; i < call->ArgumentCount(); ++i) { @@ -374,7 +357,6 @@ void JitOptimizer::ReplaceCall(Definition* call, Definition* replacement) { call->ReplaceWith(replacement, current_iterator()); } - void JitOptimizer::AddCheckSmi(Definition* to_check, intptr_t deopt_id, Environment* deopt_environment, @@ -387,7 +369,6 @@ void JitOptimizer::AddCheckSmi(Definition* to_check, } } - void JitOptimizer::AddCheckClass(Definition* to_check, const Cids& cids, intptr_t deopt_id, @@ -399,7 +380,6 @@ void JitOptimizer::AddCheckClass(Definition* to_check, InsertBefore(insert_before, check, deopt_environment, FlowGraph::kEffect); } - void JitOptimizer::AddChecksForArgNr(InstanceCallInstr* call, Definition* instr, int argument_number) { @@ -407,7 +387,6 @@ void JitOptimizer::AddChecksForArgNr(InstanceCallInstr* call, AddCheckClass(instr, *cids, call->deopt_id(), call->env(), call); } - static bool ArgIsAlways(intptr_t cid, const ICData& ic_data, intptr_t arg_number) { @@ -424,7 +403,6 @@ static bool ArgIsAlways(intptr_t cid, return true; } - bool JitOptimizer::TryReplaceWithIndexedOp(InstanceCallInstr* call) { // Check for monomorphic IC data. if (!call->HasICData()) return false; @@ -437,7 +415,6 @@ bool JitOptimizer::TryReplaceWithIndexedOp(InstanceCallInstr* call) { flow_graph_, current_iterator(), call); } - // Return true if d is a string of length one (a constant or result from // from string-from-char-code instruction. static bool IsLengthOneString(Definition* d) { @@ -453,7 +430,6 @@ static bool IsLengthOneString(Definition* d) { } } - // Returns true if the string comparison was converted into char-code // comparison. Conversion is only possible for strings of length one. // E.g., detect str[x] == "x"; and use an integer comparison of char-codes. @@ -534,7 +510,6 @@ bool JitOptimizer::TryStringLengthOneEquality(InstanceCallInstr* call, return false; } - static bool SmiFitsInDouble() { return kSmiBits < 53; } @@ -578,10 +553,11 @@ bool JitOptimizer::TryReplaceWithEqualityOp(InstanceCallInstr* call, // call. return false; } else { - InsertBefore(call, new (Z) CheckEitherNonSmiInstr(new (Z) Value(left), - new (Z) Value(right), - call->deopt_id()), - call->env(), FlowGraph::kEffect); + InsertBefore( + call, + new (Z) CheckEitherNonSmiInstr( + new (Z) Value(left), new (Z) Value(right), call->deopt_id()), + call->env(), FlowGraph::kEffect); cid = kDoubleCid; } } @@ -621,7 +597,6 @@ bool JitOptimizer::TryReplaceWithEqualityOp(InstanceCallInstr* call, return true; } - bool JitOptimizer::TryReplaceWithRelationalOp(InstanceCallInstr* call, Token::Kind op_kind) { const ICData& ic_data = *call->ic_data(); @@ -655,10 +630,11 @@ bool JitOptimizer::TryReplaceWithRelationalOp(InstanceCallInstr* call, // call. return false; } else { - InsertBefore(call, new (Z) CheckEitherNonSmiInstr(new (Z) Value(left), - new (Z) Value(right), - call->deopt_id()), - call->env(), FlowGraph::kEffect); + InsertBefore( + call, + new (Z) CheckEitherNonSmiInstr( + new (Z) Value(left), new (Z) Value(right), call->deopt_id()), + call->env(), FlowGraph::kEffect); cid = kDoubleCid; } } @@ -673,7 +649,6 @@ bool JitOptimizer::TryReplaceWithRelationalOp(InstanceCallInstr* call, return true; } - bool JitOptimizer::TryReplaceWithBinaryOp(InstanceCallInstr* call, Token::Kind op_kind) { intptr_t operands_type = kIllegalCid; @@ -787,10 +762,11 @@ bool JitOptimizer::TryReplaceWithBinaryOp(InstanceCallInstr* call, // binary operation with two smis is a smi not a double, except '/' which // returns a double for two smis. if (op_kind != Token::kDIV) { - InsertBefore(call, new (Z) CheckEitherNonSmiInstr(new (Z) Value(left), - new (Z) Value(right), - call->deopt_id()), - call->env(), FlowGraph::kEffect); + InsertBefore( + call, + new (Z) CheckEitherNonSmiInstr( + new (Z) Value(left), new (Z) Value(right), call->deopt_id()), + call->env(), FlowGraph::kEffect); } BinaryDoubleOpInstr* double_bin_op = new (Z) @@ -861,7 +837,6 @@ bool JitOptimizer::TryReplaceWithBinaryOp(InstanceCallInstr* call, return true; } - bool JitOptimizer::TryReplaceWithUnaryOp(InstanceCallInstr* call, Token::Kind op_kind) { ASSERT(call->ArgumentCount() == 1); @@ -892,7 +867,6 @@ bool JitOptimizer::TryReplaceWithUnaryOp(InstanceCallInstr* call, return true; } - // Using field class. RawField* JitOptimizer::GetField(intptr_t class_id, const String& field_name) { Class& cls = Class::Handle(Z, isolate()->class_table()->At(class_id)); @@ -912,7 +886,6 @@ RawField* JitOptimizer::GetField(intptr_t class_id, const String& field_name) { return Field::null(); } - bool JitOptimizer::InlineImplicitInstanceGetter(InstanceCallInstr* call) { ASSERT(call->HasICData()); const ICData& ic_data = *call->ic_data(); @@ -950,7 +923,6 @@ bool JitOptimizer::InlineImplicitInstanceGetter(InstanceCallInstr* call) { return true; } - bool JitOptimizer::InlineFloat32x4BinaryOp(InstanceCallInstr* call, Token::Kind op_kind) { if (!ShouldInlineSimd()) { @@ -970,7 +942,6 @@ bool JitOptimizer::InlineFloat32x4BinaryOp(InstanceCallInstr* call, return true; } - bool JitOptimizer::InlineInt32x4BinaryOp(InstanceCallInstr* call, Token::Kind op_kind) { if (!ShouldInlineSimd()) { @@ -989,7 +960,6 @@ bool JitOptimizer::InlineInt32x4BinaryOp(InstanceCallInstr* call, return true; } - bool JitOptimizer::InlineFloat64x2BinaryOp(InstanceCallInstr* call, Token::Kind op_kind) { if (!ShouldInlineSimd()) { @@ -1008,7 +978,6 @@ bool JitOptimizer::InlineFloat64x2BinaryOp(InstanceCallInstr* call, return true; } - // Only unique implicit instance getters can be currently handled. bool JitOptimizer::TryInlineInstanceGetter(InstanceCallInstr* call) { ASSERT(call->HasICData()); @@ -1033,7 +1002,6 @@ bool JitOptimizer::TryInlineInstanceGetter(InstanceCallInstr* call) { return InlineImplicitInstanceGetter(call); } - void JitOptimizer::ReplaceWithMathCFunction( InstanceCallInstr* call, MethodRecognizer::Kind recognized_kind) { @@ -1048,7 +1016,6 @@ void JitOptimizer::ReplaceWithMathCFunction( ReplaceCall(call, invoke); } - // Inline only simple, frequently called core library methods. bool JitOptimizer::TryInlineInstanceMethod(InstanceCallInstr* call) { ASSERT(call->HasICData()); @@ -1129,7 +1096,6 @@ bool JitOptimizer::TryInlineInstanceMethod(InstanceCallInstr* call) { flow_graph_, current_iterator(), call); } - // If type tests specified by 'ic_data' do not depend on type arguments, // return mapping cid->result in 'results' (i : cid; i + 1: result). // If all tests yield the same result, return it otherwise return Bool::null. @@ -1197,7 +1163,6 @@ RawBool* JitOptimizer::InstanceOfAsBool( return results_differ ? Bool::null() : prev.raw(); } - // Returns true if checking against this type is a direct class id comparison. bool JitOptimizer::TypeCheckAsClassEquality(const AbstractType& type) { ASSERT(type.IsFinalized() && !type.IsMalformedOrMalbounded()); @@ -1244,7 +1209,6 @@ bool JitOptimizer::TypeCheckAsClassEquality(const AbstractType& type) { return true; } - // TODO(srdjan): Use ICData to check if always true or false. void JitOptimizer::ReplaceWithInstanceOf(InstanceCallInstr* call) { ASSERT(Token::IsTypeTestOperator(call->token_kind())); @@ -1321,7 +1285,6 @@ void JitOptimizer::ReplaceWithInstanceOf(InstanceCallInstr* call) { ReplaceCall(call, instance_of); } - // TODO(srdjan): Apply optimizations as in ReplaceWithInstanceOf (TestCids). void JitOptimizer::ReplaceWithTypeCast(InstanceCallInstr* call) { ASSERT(Token::IsTypeCastOperator(call->token_kind())); @@ -1362,7 +1325,6 @@ void JitOptimizer::ReplaceWithTypeCast(InstanceCallInstr* call) { ReplaceCall(call, assert_as); } - // Tries to optimize instance call by replacing it with a faster instruction // (e.g, binary op, field load, ..). void JitOptimizer::VisitInstanceCall(InstanceCallInstr* instr) { @@ -1479,7 +1441,6 @@ void JitOptimizer::VisitInstanceCall(InstanceCallInstr* instr) { } } - void JitOptimizer::VisitStaticCall(StaticCallInstr* call) { MethodRecognizer::Kind recognized_kind = MethodRecognizer::RecognizeKind(call->function()); @@ -1562,7 +1523,6 @@ void JitOptimizer::VisitStaticCall(StaticCallInstr* call) { } } - void JitOptimizer::VisitStoreInstanceField(StoreInstanceFieldInstr* instr) { if (instr->IsUnboxedStore()) { // Determine if this field should be unboxed based on the usage of getter @@ -1616,7 +1576,6 @@ void JitOptimizer::VisitStoreInstanceField(StoreInstanceFieldInstr* instr) { } } - void JitOptimizer::VisitAllocateContext(AllocateContextInstr* instr) { // Replace generic allocation with a sequence of inlined allocation and // explicit initializing stores. @@ -1647,7 +1606,6 @@ void JitOptimizer::VisitAllocateContext(AllocateContextInstr* instr) { } } - void JitOptimizer::VisitLoadCodeUnits(LoadCodeUnitsInstr* instr) { // TODO(zerny): Use kUnboxedUint32 once it is fully supported/optimized. #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_ARM) @@ -1655,7 +1613,6 @@ void JitOptimizer::VisitLoadCodeUnits(LoadCodeUnitsInstr* instr) { #endif } - bool JitOptimizer::TryInlineInstanceSetter(InstanceCallInstr* instr, const ICData& unary_ic_data) { ASSERT(!unary_ic_data.NumberOfChecksIs(0) && @@ -1695,17 +1652,19 @@ bool JitOptimizer::TryInlineInstanceSetter(InstanceCallInstr* instr, } if (field.guarded_cid() != kDynamicCid) { ASSERT(I->use_field_guards()); - InsertBefore( - instr, new (Z) GuardFieldClassInstr(new (Z) Value(instr->ArgumentAt(1)), - field, instr->deopt_id()), - instr->env(), FlowGraph::kEffect); + InsertBefore(instr, + new (Z) + GuardFieldClassInstr(new (Z) Value(instr->ArgumentAt(1)), + field, instr->deopt_id()), + instr->env(), FlowGraph::kEffect); } if (field.needs_length_check()) { ASSERT(I->use_field_guards()); - InsertBefore(instr, new (Z) GuardFieldLengthInstr( - new (Z) Value(instr->ArgumentAt(1)), field, - instr->deopt_id()), + InsertBefore(instr, + new (Z) + GuardFieldLengthInstr(new (Z) Value(instr->ArgumentAt(1)), + field, instr->deopt_id()), instr->env(), FlowGraph::kEffect); } @@ -1726,6 +1685,5 @@ bool JitOptimizer::TryInlineInstanceSetter(InstanceCallInstr* instr, return true; } - } // namespace dart #endif // DART_PRECOMPILED_RUNTIME diff --git a/runtime/vm/jit_optimizer.h b/runtime/vm/jit_optimizer.h index c6e02419165..11ab0462b3f 100644 --- a/runtime/vm/jit_optimizer.h +++ b/runtime/vm/jit_optimizer.h @@ -5,8 +5,8 @@ #ifndef RUNTIME_VM_JIT_OPTIMIZER_H_ #define RUNTIME_VM_JIT_OPTIMIZER_H_ -#include "vm/intermediate_language.h" #include "vm/flow_graph.h" +#include "vm/intermediate_language.h" namespace dart { @@ -99,7 +99,6 @@ class JitOptimizer : public FlowGraphVisitor { void ReplaceCall(Definition* call, Definition* replacement); - bool InstanceCallNeedsClassCheck(InstanceCallInstr* call, RawFunction::Kind kind) const; @@ -130,7 +129,6 @@ class JitOptimizer : public FlowGraphVisitor { DISALLOW_COPY_AND_ASSIGN(JitOptimizer); }; - } // namespace dart #endif // RUNTIME_VM_JIT_OPTIMIZER_H_ diff --git a/runtime/vm/json_parser.h b/runtime/vm/json_parser.h index 83b9d6b171d..6b254d67a2c 100644 --- a/runtime/vm/json_parser.h +++ b/runtime/vm/json_parser.h @@ -6,8 +6,8 @@ #define RUNTIME_VM_JSON_PARSER_H_ #include "vm/allocation.h" -#include "vm/zone.h" #include "vm/growable_array.h" +#include "vm/zone.h" namespace dart { diff --git a/runtime/vm/json_stream.cc b/runtime/vm/json_stream.cc index 459d077dc62..8700dc787a4 100644 --- a/runtime/vm/json_stream.cc +++ b/runtime/vm/json_stream.cc @@ -18,7 +18,6 @@ #include "vm/timeline.h" #include "vm/unicode.h" - namespace dart { #ifndef PRODUCT @@ -44,7 +43,6 @@ class MaybeOnStackBuffer { char buffer_[kOnStackBufferCapacity]; }; - void AppendJSONStreamConsumer(Dart_StreamConsumer_State state, const char* stream_name, const uint8_t* buffer, @@ -61,7 +59,6 @@ void AppendJSONStreamConsumer(Dart_StreamConsumer_State state, js->AppendSerializedObject(buffer, buffer_length); } - DECLARE_FLAG(bool, trace_service); JSONStream::JSONStream(intptr_t buf_size) @@ -87,10 +84,8 @@ JSONStream::JSONStream(intptr_t buf_size) default_id_zone_.Init(ring, ObjectIdRing::kAllocateId); } - JSONStream::~JSONStream() {} - void JSONStream::Setup(Zone* zone, Dart_Port reply_port, const Instance& seq, @@ -135,13 +130,11 @@ void JSONStream::Setup(Zone* zone, buffer_.Printf("{\"jsonrpc\":\"2.0\", \"result\":"); } - void JSONStream::SetupError() { buffer_.Clear(); buffer_.Printf("{\"jsonrpc\":\"2.0\", \"error\":"); } - static const char* GetJSONRpcErrorMessage(intptr_t code) { switch (code) { case kParseError: @@ -179,7 +172,6 @@ static const char* GetJSONRpcErrorMessage(intptr_t code) { } } - static void PrintRequest(JSONObject* obj, JSONStream* js) { JSONObject jsobj(obj, "request"); jsobj.AddProperty("method", js->method()); @@ -191,7 +183,6 @@ static void PrintRequest(JSONObject* obj, JSONStream* js) { } } - void JSONStream::PrintError(intptr_t code, const char* details_format, ...) { SetupError(); JSONObject jsobj(this); @@ -217,20 +208,17 @@ void JSONStream::PrintError(intptr_t code, const char* details_format, ...) { } } - void JSONStream::PostNullReply(Dart_Port port) { PortMap::PostMessage( new Message(port, Object::null(), Message::kNormalPriority)); } - static void Finalizer(void* isolate_callback_data, Dart_WeakPersistentHandle handle, void* buffer) { free(buffer); } - void JSONStream::PostReply() { ASSERT(seq_ != NULL); Dart_Port port = reply_port(); @@ -307,7 +295,6 @@ void JSONStream::PostReply() { } } - const char* JSONStream::LookupParam(const char* key) const { for (int i = 0; i < num_params(); i++) { if (!strcmp(key, param_keys_[i])) { @@ -317,13 +304,11 @@ const char* JSONStream::LookupParam(const char* key) const { return NULL; } - bool JSONStream::HasParam(const char* key) const { ASSERT(key); return LookupParam(key) != NULL; } - bool JSONStream::ParamIs(const char* key, const char* value) const { ASSERT(key); ASSERT(value); @@ -331,7 +316,6 @@ bool JSONStream::ParamIs(const char* key, const char* value) const { return (key_value != NULL) && (strcmp(key_value, value) == 0); } - void JSONStream::ComputeOffsetAndCount(intptr_t length, intptr_t* offset, intptr_t* count) { @@ -348,13 +332,11 @@ void JSONStream::ComputeOffsetAndCount(intptr_t length, } } - void JSONStream::AppendSerializedObject(const char* serialized_object) { PrintCommaIfNeeded(); buffer_.AddString(serialized_object); } - void JSONStream::AppendSerializedObject(const uint8_t* buffer, intptr_t buffer_length) { buffer_.AddRaw(buffer, buffer_length); @@ -372,7 +354,6 @@ void JSONStream::Clear() { open_objects_ = 0; } - void JSONStream::OpenObject(const char* property_name) { PrintCommaIfNeeded(); open_objects_++; @@ -382,14 +363,12 @@ void JSONStream::OpenObject(const char* property_name) { buffer_.AddChar('{'); } - void JSONStream::CloseObject() { ASSERT(open_objects_ > 0); open_objects_--; buffer_.AddChar('}'); } - void JSONStream::OpenArray(const char* property_name) { PrintCommaIfNeeded(); if (property_name != NULL) { @@ -399,14 +378,12 @@ void JSONStream::OpenArray(const char* property_name) { buffer_.AddChar('['); } - void JSONStream::CloseArray() { ASSERT(open_objects_ > 0); open_objects_--; buffer_.AddChar(']'); } - void JSONStream::PrintValueNull() { PrintCommaIfNeeded(); buffer_.Printf("null"); @@ -417,44 +394,37 @@ void JSONStream::PrintValueBool(bool b) { buffer_.Printf("%s", b ? "true" : "false"); } - void JSONStream::PrintValue(intptr_t i) { EnsureIntegerIsRepresentableInJavaScript(static_cast(i)); PrintCommaIfNeeded(); buffer_.Printf("%" Pd "", i); } - void JSONStream::PrintValue64(int64_t i) { EnsureIntegerIsRepresentableInJavaScript(i); PrintCommaIfNeeded(); buffer_.Printf("%" Pd64 "", i); } - void JSONStream::PrintValueTimeMillis(int64_t millis) { EnsureIntegerIsRepresentableInJavaScript(millis); PrintValue64(millis); } - void JSONStream::PrintValueTimeMicros(int64_t micros) { EnsureIntegerIsRepresentableInJavaScript(micros); PrintValue64(micros); } - void JSONStream::PrintValue(double d) { PrintCommaIfNeeded(); buffer_.Printf("%f", d); } - static const char base64_digits[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; static const char base64_pad = '='; - void JSONStream::PrintValueBase64(const uint8_t* bytes, intptr_t length) { PrintCommaIfNeeded(); buffer_.AddChar('"'); @@ -485,7 +455,6 @@ void JSONStream::PrintValueBase64(const uint8_t* bytes, intptr_t length) { buffer_.AddChar('"'); } - void JSONStream::PrintValue(const char* s) { PrintCommaIfNeeded(); buffer_.AddChar('"'); @@ -493,7 +462,6 @@ void JSONStream::PrintValue(const char* s) { buffer_.AddChar('"'); } - bool JSONStream::PrintValueStr(const String& s, intptr_t offset, intptr_t count) { @@ -504,13 +472,11 @@ bool JSONStream::PrintValueStr(const String& s, return did_truncate; } - void JSONStream::PrintValueNoEscape(const char* s) { PrintCommaIfNeeded(); buffer_.Printf("%s", s); } - void JSONStream::PrintfValue(const char* format, ...) { PrintCommaIfNeeded(); @@ -529,125 +495,104 @@ void JSONStream::PrintfValue(const char* format, ...) { buffer_.AddChar('"'); } - void JSONStream::PrintValue(const Object& o, bool ref) { PrintCommaIfNeeded(); o.PrintJSON(this, ref); } - void JSONStream::PrintValue(Breakpoint* bpt) { PrintCommaIfNeeded(); bpt->PrintJSON(this); } - void JSONStream::PrintValue(TokenPosition tp) { PrintCommaIfNeeded(); PrintValue(tp.value()); } - void JSONStream::PrintValue(const ServiceEvent* event) { PrintCommaIfNeeded(); event->PrintJSON(this); } - void JSONStream::PrintValue(Metric* metric) { PrintCommaIfNeeded(); metric->PrintJSON(this); } - void JSONStream::PrintValue(MessageQueue* queue) { PrintCommaIfNeeded(); queue->PrintJSON(this); } - void JSONStream::PrintValue(Isolate* isolate, bool ref) { PrintCommaIfNeeded(); isolate->PrintJSON(this, ref); } - void JSONStream::PrintValue(ThreadRegistry* reg) { PrintCommaIfNeeded(); reg->PrintJSON(this); } - void JSONStream::PrintValue(Thread* thread) { PrintCommaIfNeeded(); thread->PrintJSON(this); } - void JSONStream::PrintValue(const TimelineEvent* timeline_event) { PrintCommaIfNeeded(); timeline_event->PrintJSON(this); } - void JSONStream::PrintValue(const TimelineEventBlock* timeline_event_block) { PrintCommaIfNeeded(); timeline_event_block->PrintJSON(this); } - void JSONStream::PrintValueVM(bool ref) { PrintCommaIfNeeded(); Service::PrintJSONForVM(this, ref); } - void JSONStream::PrintServiceId(const Object& o) { ASSERT(id_zone_ != NULL); PrintProperty("id", id_zone_->GetServiceId(o)); } - void JSONStream::PrintPropertyBool(const char* name, bool b) { PrintPropertyName(name); PrintValueBool(b); } - void JSONStream::PrintProperty(const char* name, intptr_t i) { PrintPropertyName(name); PrintValue(i); } - void JSONStream::PrintProperty64(const char* name, int64_t i) { PrintPropertyName(name); PrintValue64(i); } - void JSONStream::PrintPropertyTimeMillis(const char* name, int64_t millis) { PrintProperty64(name, millis); } - void JSONStream::PrintPropertyTimeMicros(const char* name, int64_t micros) { PrintProperty64(name, micros); } - void JSONStream::PrintProperty(const char* name, double d) { PrintPropertyName(name); PrintValue(d); } - void JSONStream::PrintProperty(const char* name, const char* s) { PrintPropertyName(name); PrintValue(s); } - void JSONStream::PrintPropertyBase64(const char* name, const uint8_t* b, intptr_t len) { @@ -655,7 +600,6 @@ void JSONStream::PrintPropertyBase64(const char* name, PrintValueBase64(b, len); } - bool JSONStream::PrintPropertyStr(const char* name, const String& s, intptr_t offset, @@ -664,75 +608,63 @@ bool JSONStream::PrintPropertyStr(const char* name, return PrintValueStr(s, offset, count); } - void JSONStream::PrintPropertyNoEscape(const char* name, const char* s) { PrintPropertyName(name); PrintValueNoEscape(s); } - void JSONStream::PrintProperty(const char* name, const ServiceEvent* event) { PrintPropertyName(name); PrintValue(event); } - void JSONStream::PrintProperty(const char* name, Breakpoint* bpt) { PrintPropertyName(name); PrintValue(bpt); } - void JSONStream::PrintProperty(const char* name, TokenPosition tp) { PrintPropertyName(name); PrintValue(tp); } - void JSONStream::PrintProperty(const char* name, Metric* metric) { PrintPropertyName(name); PrintValue(metric); } - void JSONStream::PrintProperty(const char* name, MessageQueue* queue) { PrintPropertyName(name); PrintValue(queue); } - void JSONStream::PrintProperty(const char* name, Isolate* isolate) { PrintPropertyName(name); PrintValue(isolate); } - void JSONStream::PrintProperty(const char* name, ThreadRegistry* reg) { PrintPropertyName(name); PrintValue(reg); } - void JSONStream::PrintProperty(const char* name, Thread* thread) { PrintPropertyName(name); PrintValue(thread); } - void JSONStream::PrintProperty(const char* name, const TimelineEvent* timeline_event) { PrintPropertyName(name); PrintValue(timeline_event); } - void JSONStream::PrintProperty(const char* name, const TimelineEventBlock* timeline_event_block) { PrintPropertyName(name); PrintValue(timeline_event_block); } - void JSONStream::PrintfProperty(const char* name, const char* format, ...) { PrintPropertyName(name); va_list args; @@ -750,7 +682,6 @@ void JSONStream::PrintfProperty(const char* name, const char* format, ...) { buffer_.AddChar('"'); } - void JSONStream::Steal(char** buffer, intptr_t* buffer_length) { ASSERT(buffer != NULL); ASSERT(buffer_length != NULL); @@ -758,12 +689,10 @@ void JSONStream::Steal(char** buffer, intptr_t* buffer_length) { *buffer = buffer_.Steal(); } - void JSONStream::set_reply_port(Dart_Port port) { reply_port_ = port; } - intptr_t JSONStream::NumObjectParameters() const { if (parameter_keys_ == NULL) { return 0; @@ -773,19 +702,16 @@ intptr_t JSONStream::NumObjectParameters() const { return parameter_keys_->Length(); } - RawObject* JSONStream::GetObjectParameterKey(intptr_t i) const { ASSERT((i >= 0) && (i < NumObjectParameters())); return parameter_keys_->At(i); } - RawObject* JSONStream::GetObjectParameterValue(intptr_t i) const { ASSERT((i >= 0) && (i < NumObjectParameters())); return parameter_values_->At(i); } - RawObject* JSONStream::LookupObjectParam(const char* c_key) const { const String& key = String::Handle(String::New(c_key)); Object& test = Object::Handle(); @@ -799,7 +725,6 @@ RawObject* JSONStream::LookupObjectParam(const char* c_key) const { return Object::null(); } - void JSONStream::SetParams(const char** param_keys, const char** param_values, intptr_t num_params) { @@ -808,19 +733,16 @@ void JSONStream::SetParams(const char** param_keys, num_params_ = num_params; } - void JSONStream::PrintProperty(const char* name, const Object& o, bool ref) { PrintPropertyName(name); PrintValue(o, ref); } - void JSONStream::PrintPropertyVM(const char* name, bool ref) { PrintPropertyName(name); PrintValueVM(ref); } - void JSONStream::PrintPropertyName(const char* name) { ASSERT(name != NULL); PrintCommaIfNeeded(); @@ -830,14 +752,12 @@ void JSONStream::PrintPropertyName(const char* name) { buffer_.AddChar(':'); } - void JSONStream::PrintCommaIfNeeded() { if (NeedComma()) { buffer_.AddChar(','); } } - bool JSONStream::NeedComma() { const char* buffer = buffer_.buf(); intptr_t length = buffer_.length(); @@ -848,7 +768,6 @@ bool JSONStream::NeedComma() { return (ch != '[') && (ch != '{') && (ch != ':') && (ch != ','); } - void JSONStream::EnsureIntegerIsRepresentableInJavaScript(int64_t i) { #ifdef DEBUG if (!Utils::IsJavascriptInt(i)) { @@ -861,7 +780,6 @@ void JSONStream::EnsureIntegerIsRepresentableInJavaScript(int64_t i) { #endif } - void JSONStream::AddEscapedUTF8String(const char* s) { if (s == NULL) { return; @@ -870,7 +788,6 @@ void JSONStream::AddEscapedUTF8String(const char* s) { AddEscapedUTF8String(s, len); } - void JSONStream::AddEscapedUTF8String(const char* s, intptr_t len) { if (s == NULL) { return; @@ -889,7 +806,6 @@ void JSONStream::AddEscapedUTF8String(const char* s, intptr_t len) { ASSERT(i == len); } - bool JSONStream::AddDartString(const String& s, intptr_t offset, intptr_t count) { @@ -927,12 +843,10 @@ bool JSONStream::AddDartString(const String& s, return (offset > 0) || (limit < length); } - JSONObject::JSONObject(const JSONArray* arr) : stream_(arr->stream_) { stream_->OpenObject(); } - void JSONObject::AddFixedServiceId(const char* format, ...) const { // Mark that this id is fixed. AddProperty("fixedId", true); @@ -953,7 +867,6 @@ void JSONObject::AddFixedServiceId(const char* format, ...) const { stream_->buffer_.AddChar('"'); } - void JSONObject::AddLocation(const Script& script, TokenPosition token_pos, TokenPosition end_token_pos) const { @@ -966,7 +879,6 @@ void JSONObject::AddLocation(const Script& script, } } - void JSONObject::AddLocation(const BreakpointLocation* bpt_loc) const { ASSERT(bpt_loc->IsResolved()); @@ -978,7 +890,6 @@ void JSONObject::AddLocation(const BreakpointLocation* bpt_loc) const { AddLocation(script, token_pos); } - void JSONObject::AddUnresolvedLocation( const BreakpointLocation* bpt_loc) const { ASSERT(!bpt_loc->IsResolved()); @@ -1009,7 +920,6 @@ void JSONObject::AddUnresolvedLocation( } } - void JSONObject::AddPropertyF(const char* name, const char* format, ...) const { stream_->PrintPropertyName(name); va_list args; @@ -1027,7 +937,6 @@ void JSONObject::AddPropertyF(const char* name, const char* format, ...) const { stream_->buffer_.AddChar('"'); } - void JSONArray::AddValueF(const char* format, ...) const { stream_->PrintCommaIfNeeded(); va_list args; diff --git a/runtime/vm/json_stream.h b/runtime/vm/json_stream.h index 6997b4e25a4..a33c7cb95a6 100644 --- a/runtime/vm/json_stream.h +++ b/runtime/vm/json_stream.h @@ -11,7 +11,6 @@ #include "vm/service.h" #include "vm/token_position.h" - namespace dart { class Array; @@ -34,7 +33,6 @@ class Thread; class ThreadRegistry; class Zone; - // Keep this enum in sync with: // // - runtime/vm/service/vmservice.dart @@ -255,7 +253,6 @@ class JSONStream : ValueObject { friend class JSONArray; }; - class JSONObject : public ValueObject { public: explicit JSONObject(JSONStream* stream) : stream_(stream) { @@ -369,7 +366,6 @@ class JSONObject : public ValueObject { DISALLOW_COPY_AND_ASSIGN(JSONObject); }; - class JSONArray : public ValueObject { public: explicit JSONArray(JSONStream* stream) : stream_(stream) { diff --git a/runtime/vm/json_test.cc b/runtime/vm/json_test.cc index 372ec2b5eb1..f53b40cc339 100644 --- a/runtime/vm/json_test.cc +++ b/runtime/vm/json_test.cc @@ -4,9 +4,9 @@ #include "platform/assert.h" #include "platform/text_buffer.h" +#include "vm/dart_api_impl.h" #include "vm/json_stream.h" #include "vm/unit_test.h" -#include "vm/dart_api_impl.h" namespace dart { @@ -20,7 +20,6 @@ TEST_CASE(JSON_TextBuffer) { EXPECT_STREQ("{ \"length\" : 175, \"command\" : \"stopIt\" }", w.buf()); } - TEST_CASE(JSON_JSONStream_Primitives) { { JSONStream js; @@ -82,7 +81,6 @@ TEST_CASE(JSON_JSONStream_Primitives) { } } - TEST_CASE(JSON_JSONStream_Array) { JSONStream js; { @@ -93,7 +91,6 @@ TEST_CASE(JSON_JSONStream_Array) { EXPECT_STREQ("[true,false]", js.ToCString()); } - TEST_CASE(JSON_JSONStream_Object) { JSONStream js; { @@ -114,7 +111,6 @@ TEST_CASE(JSON_JSONStream_NestedObject) { EXPECT_STREQ("{\"key\":{\"key1\":\"d\"}}", js.ToCString()); } - TEST_CASE(JSON_JSONStream_ObjectArray) { JSONStream js; { @@ -131,7 +127,6 @@ TEST_CASE(JSON_JSONStream_ObjectArray) { EXPECT_STREQ("[{\"key\":\"e\"},{\"yek\":\"f\"}]", js.ToCString()); } - TEST_CASE(JSON_JSONStream_ArrayArray) { JSONStream js; { @@ -148,7 +143,6 @@ TEST_CASE(JSON_JSONStream_ArrayArray) { EXPECT_STREQ("[[4],[false]]", js.ToCString()); } - TEST_CASE(JSON_JSONStream_Printf) { JSONStream js; { @@ -158,7 +152,6 @@ TEST_CASE(JSON_JSONStream_Printf) { EXPECT_STREQ("[\"2 hello\"]", js.ToCString()); } - TEST_CASE(JSON_JSONStream_ObjectPrintf) { JSONStream js; { @@ -168,7 +161,6 @@ TEST_CASE(JSON_JSONStream_ObjectPrintf) { EXPECT_STREQ("{\"key\":\"2 hello\"}", js.ToCString()); } - TEST_CASE(JSON_JSONStream_DartObject) { JSONStream js; { @@ -209,7 +201,6 @@ TEST_CASE(JSON_JSONStream_EscapedString) { EXPECT_STREQ("[\"Hel\\\"\\\"lo\\r\\n\\t\"]", js.ToCString()); } - TEST_CASE(JSON_JSONStream_DartString) { const char* kScriptChars = "var ascii = 'Hello, World!';\n" @@ -292,7 +283,6 @@ TEST_CASE(JSON_JSONStream_DartString) { EXPECT_STREQ("{\"wrongEncoding\":\"𝄞\\uD834𝄞\"}", js.ToCString()); } - { result = Dart_GetField(lib, NewString("nullInMiddle")); EXPECT_VALID(result); @@ -308,7 +298,6 @@ TEST_CASE(JSON_JSONStream_DartString) { } } - TEST_CASE(JSON_JSONStream_Params) { const char* param_keys[] = {"dog", "cat"}; const char* param_values[] = {"apple", "banana"}; @@ -324,7 +313,6 @@ TEST_CASE(JSON_JSONStream_Params) { EXPECT(!js.ParamIs("dog", "banana")); } - TEST_CASE(JSON_JSONStream_AppendJSONStreamConsumer) { JSONStream js; diff --git a/runtime/vm/kernel.cc b/runtime/vm/kernel.cc index 47defed9f4d..6e718444c48 100644 --- a/runtime/vm/kernel.cc +++ b/runtime/vm/kernel.cc @@ -7,10 +7,7 @@ #if !defined(DART_PRECOMPILED_RUNTIME) namespace dart { -namespace kernel { - - -} // namespace kernel +namespace kernel {} // namespace kernel } // namespace dart #endif // !defined(DART_PRECOMPILED_RUNTIME) diff --git a/runtime/vm/kernel.h b/runtime/vm/kernel.h index 6084a2ded96..aae1c28d338 100644 --- a/runtime/vm/kernel.h +++ b/runtime/vm/kernel.h @@ -12,7 +12,6 @@ #include "vm/growable_array.h" #include "vm/token_position.h" - namespace dart { class Field; @@ -21,10 +20,8 @@ class Zone; namespace kernel { - class Reader; - class StringIndex { public: StringIndex() : value_(-1) {} @@ -36,7 +33,6 @@ class StringIndex { int value_; }; - class NameIndex { public: NameIndex() : value_(-1) {} @@ -48,7 +44,6 @@ class NameIndex { int value_; }; - class Field { public: enum Flags { @@ -58,7 +53,6 @@ class Field { }; }; - class Constructor { public: enum Flags { @@ -67,7 +61,6 @@ class Constructor { }; }; - class Procedure { public: enum Flags { @@ -89,7 +82,6 @@ class Procedure { }; }; - class FunctionNode { public: enum AsyncMarker { @@ -117,13 +109,11 @@ class YieldStatement { }; }; - class LogicalExpression { public: enum Operator { kAnd, kOr }; }; - class Program { public: static Program* ReadFrom(Reader* reader); @@ -153,7 +143,6 @@ class Program { DISALLOW_COPY_AND_ASSIGN(Program); }; - ParsedFunction* ParseStaticFieldInitializer(Zone* zone, const dart::Field& field); @@ -162,7 +151,6 @@ ParsedFunction* ParseStaticFieldInitializer(Zone* zone, kernel::Program* ReadPrecompiledKernelFromBuffer(const uint8_t* buffer, intptr_t buffer_length); - } // namespace dart #endif // !defined(DART_PRECOMPILED_RUNTIME) diff --git a/runtime/vm/kernel_binary.cc b/runtime/vm/kernel_binary.cc index d9735b875da..c3f5c800ccb 100644 --- a/runtime/vm/kernel_binary.cc +++ b/runtime/vm/kernel_binary.cc @@ -11,10 +11,8 @@ #include "vm/kernel_to_il.h" #include "vm/os.h" - namespace dart { - namespace kernel { Program* Program::ReadFrom(Reader* reader) { @@ -37,16 +35,13 @@ Program* Program::ReadFrom(Reader* reader) { return program; } - } // namespace kernel - kernel::Program* ReadPrecompiledKernelFromBuffer(const uint8_t* buffer, intptr_t buffer_length) { kernel::Reader reader(buffer, buffer_length); return kernel::Program::ReadFrom(&reader); } - } // namespace dart #endif // !defined(DART_PRECOMPILED_RUNTIME) diff --git a/runtime/vm/kernel_binary.h b/runtime/vm/kernel_binary.h index ec3f758141a..bcc943425f2 100644 --- a/runtime/vm/kernel_binary.h +++ b/runtime/vm/kernel_binary.h @@ -16,10 +16,8 @@ namespace dart { namespace kernel { - static const uint32_t kMagicProgramFile = 0x90ABCDEFu; - // Keep in sync with package:dynamo/lib/binary/tag.dart enum Tag { kNothing = 0, @@ -134,10 +132,8 @@ enum Tag { kSpecialIntLiteral = 144, }; - static const int SpecializedIntLiteralBias = 3; - class Reader { public: Reader(const uint8_t* buffer, intptr_t size) @@ -297,7 +293,6 @@ class Reader { friend class Program; }; - // A helper class that resets the readers min and max positions both upon // initialization and upon destruction, i.e. when created the min an max // positions will be reset to "noSource", when destructing the min and max will diff --git a/runtime/vm/kernel_binary_flowgraph.cc b/runtime/vm/kernel_binary_flowgraph.cc index b862e439e1a..9b7cc9fa703 100644 --- a/runtime/vm/kernel_binary_flowgraph.cc +++ b/runtime/vm/kernel_binary_flowgraph.cc @@ -24,7 +24,6 @@ static bool IsStaticInitializer(const Function& function, Zone* zone) { .StartsWith(Symbols::InitPrefix()); } - StreamingScopeBuilder::StreamingScopeBuilder(ParsedFunction* parsed_function, intptr_t kernel_offset, const uint8_t* buffer, @@ -817,7 +816,7 @@ void StreamingScopeBuilder::VisitStatement() { } case kSwitchStatement: { AddSwitchVariable(); - VisitExpression(); // read condition. + VisitExpression(); // read condition. int case_count = builder_->ReadListLength(); // read number of cases. for (intptr_t i = 0; i < case_count; ++i) { int expression_count = @@ -1139,7 +1138,6 @@ void StreamingScopeBuilder::EnterScope(intptr_t kernel_offset) { result_->scopes.Insert(kernel_offset, scope_); } - void StreamingScopeBuilder::ExitScope(TokenPosition start_position, TokenPosition end_position) { scope_->set_begin_token_pos(start_position); @@ -1246,7 +1244,6 @@ void StreamingScopeBuilder::AddTryVariables() { ":saved_try_context_var", depth_.try_); } - void StreamingScopeBuilder::AddCatchVariables() { AddExceptionVariable(&result_->exception_variables, ":exception", depth_.catch_); @@ -1254,7 +1251,6 @@ void StreamingScopeBuilder::AddCatchVariables() { depth_.catch_); } - void StreamingScopeBuilder::AddIteratorVariable() { if (depth_.function_ > 0) return; if (result_->iterator_variables.length() >= depth_.for_in_) return; @@ -1365,7 +1361,6 @@ StreamingDartTypeTranslator::StreamingDartTypeTranslator( result_(AbstractType::Handle(translation_helper_.zone())), finalize_(finalize) {} - AbstractType& StreamingDartTypeTranslator::BuildType() { BuildTypeInternal(); @@ -1693,7 +1688,6 @@ StreamingDartTypeTranslator::BuildInstantiatedTypeArguments( return instantiated_type_arguments; } - const Type& StreamingDartTypeTranslator::ReceiverType( const dart::Class& klass) { ASSERT(!klass.IsNull()); @@ -1713,7 +1707,6 @@ const Type& StreamingDartTypeTranslator::ReceiverType( return type; } - StreamingConstantEvaluator::StreamingConstantEvaluator( StreamingFlowGraphBuilder* builder) : builder_(builder), @@ -1731,7 +1724,6 @@ StreamingConstantEvaluator::StreamingConstantEvaluator( : builder_->parsed_function()->function().script())), result_(Instance::Handle(zone_)) {} - Instance& StreamingConstantEvaluator::EvaluateExpression(intptr_t offset, bool reset_position) { if (!GetCachedConstant(offset, &result_)) { @@ -2233,7 +2225,7 @@ void StreamingConstantEvaluator::EvaluateLet() { // read variable declaration. VariableDeclarationHelper helper(builder_); helper.ReadUntilExcluding(VariableDeclarationHelper::kInitializer); - Tag tag = builder_->ReadTag(); // read (first part of) initializer. + Tag tag = builder_->ReadTag(); // read (first part of) initializer. if (tag == kNothing) { local->SetConstValue(Instance::ZoneHandle(Z, dart::Instance::null())); } else { @@ -2439,7 +2431,6 @@ bool StreamingConstantEvaluator::GetCachedConstant(intptr_t kernel_offset, return is_present; } - void StreamingConstantEvaluator::CacheConstantValue(intptr_t kernel_offset, const Instance& value) { ASSERT(Thread::Current()->IsMutatorThread()); @@ -3400,7 +3391,6 @@ FlowGraph* StreamingFlowGraphBuilder::BuildGraph(intptr_t kernel_offset) { return NULL; } - Fragment StreamingFlowGraphBuilder::BuildStatementAt(intptr_t kernel_offset) { SetOffset(kernel_offset); return BuildStatement(); // read statement. @@ -3707,8 +3697,8 @@ void StreamingFlowGraphBuilder::SkipInterfaceType(bool simple) { void StreamingFlowGraphBuilder::SkipFunctionType(bool simple) { if (!simple) { SkipTypeParametersList(); // read type_parameters. - ReadUInt(); // read required parameter count. - ReadUInt(); // read total parameter count. + ReadUInt(); // read required parameter count. + ReadUInt(); // read total parameter count. } SkipListOfDartTypes(); // read positional_parameters types. @@ -3857,8 +3847,8 @@ void StreamingFlowGraphBuilder::SkipExpression() { SkipOptionalDartType(); // read unused static type. return; case kStringConcatenation: - ReadPosition(); // read position. - SkipListOfExpressions(); // read list of expressions. + ReadPosition(); // read position. + SkipListOfExpressions(); // read list of expressions. return; case kIsExpression: ReadPosition(); // read position. @@ -3887,9 +3877,9 @@ void StreamingFlowGraphBuilder::SkipExpression() { return; case kListLiteral: case kConstListLiteral: - ReadPosition(); // read position. - SkipDartType(); // read type. - SkipListOfExpressions(); // read list of expressions. + ReadPosition(); // read position. + SkipDartType(); // read type. + SkipListOfExpressions(); // read list of expressions. return; case kMapLiteral: case kConstMapLiteral: { @@ -3982,12 +3972,12 @@ void StreamingFlowGraphBuilder::SkipStatement() { return; case kForStatement: { SkipListOfVariableDeclarations(); // read variables. - Tag tag = ReadTag(); // Read first part of condition. + Tag tag = ReadTag(); // Read first part of condition. if (tag == kSomething) { SkipExpression(); // read rest of condition. } SkipListOfExpressions(); // read updates. - SkipStatement(); // read body. + SkipStatement(); // read body. return; } case kForInStatement: @@ -3998,7 +3988,7 @@ void StreamingFlowGraphBuilder::SkipStatement() { SkipStatement(); // read body. return; case kSwitchStatement: { - SkipExpression(); // read condition. + SkipExpression(); // read condition. int case_count = ReadListLength(); // read number of cases. for (intptr_t i = 0; i < case_count; ++i) { int expression_count = ReadListLength(); // read number of expressions. @@ -4291,12 +4281,12 @@ intptr_t StreamingFlowGraphBuilder::PeekArgumentsCount() { intptr_t StreamingFlowGraphBuilder::PeekArgumentsTypeCount() { AlternativeReadingScope alt(reader_); - ReadUInt(); // read arguments count. - return ReadListLength(); // read length of types list. + ReadUInt(); // read arguments count. + return ReadListLength(); // read length of types list. } void StreamingFlowGraphBuilder::SkipArgumentsBeforeActualArguments() { - ReadUInt(); // read arguments count. + ReadUInt(); // read arguments count. SkipListOfDartTypes(); // read list of types. } @@ -5359,9 +5349,10 @@ Fragment StreamingFlowGraphBuilder::BuildIsExpression(TokenPosition* p) { if (dart::FlowGraphBuilder::SimpleInstanceOfType(type)) { instructions += Constant(type); instructions += PushArgument(); // Type. - instructions += InstanceCall(position, dart::Library::PrivateCoreLibName( - Symbols::_simpleInstanceOf()), - Token::kIS, 2, 2); // 2 checked arguments. + instructions += InstanceCall( + position, + dart::Library::PrivateCoreLibName(Symbols::_simpleInstanceOf()), + Token::kIS, 2, 2); // 2 checked arguments. return instructions; } @@ -5622,7 +5613,6 @@ Fragment StreamingFlowGraphBuilder::BuildMapLiteral(bool is_const, } instructions += PushArgument(); // The array. - const dart::Class& map_class = dart::Class::Handle(Z, dart::Library::LookupCoreClass(Symbols::Map())); const Function& factory_method = Function::ZoneHandle( @@ -5640,12 +5630,11 @@ Fragment StreamingFlowGraphBuilder::BuildFunctionExpression() { Fragment StreamingFlowGraphBuilder::BuildLet(TokenPosition* position) { if (position != NULL) *position = TokenPosition::kNoSource; - Fragment instructions = BuildVariableDeclaration(); // read variable. - instructions += BuildExpression(); // read body. + Fragment instructions = BuildVariableDeclaration(); // read variable. + instructions += BuildExpression(); // read body. return instructions; } - Fragment StreamingFlowGraphBuilder::BuildBigIntLiteral( TokenPosition* position) { if (position != NULL) *position = TokenPosition::kNoSource; @@ -5779,7 +5768,7 @@ Fragment StreamingFlowGraphBuilder::BuildAssertStatement() { otherwise_fragment += PushArgument(); // start otherwise_fragment += IntConstant(condition_end_offset.Pos()); otherwise_fragment += PushArgument(); // end - Tag tag = ReadTag(); // read (first part of) message. + Tag tag = ReadTag(); // read (first part of) message. if (tag == kSomething) { otherwise_fragment += BuildExpression(); // read (rest of) message. } else { @@ -5862,7 +5851,6 @@ Fragment StreamingFlowGraphBuilder::BuildWhileStatement() { entry = condition.entry; } - loop_depth_dec(); return Fragment(entry, loop_exit); } @@ -6019,7 +6007,7 @@ Fragment StreamingFlowGraphBuilder::BuildForInStatement(bool async) { Fragment StreamingFlowGraphBuilder::BuildSwitchStatement() { // We need the number of cases. So start by getting that, then go back. intptr_t offset = ReaderOffset(); - SkipExpression(); // temporarily skip condition + SkipExpression(); // temporarily skip condition int case_count = ReadListLength(); // read number of cases. SetOffset(offset); @@ -6432,7 +6420,6 @@ Fragment StreamingFlowGraphBuilder::BuildTryFinally() { // so creating a "TryFinallyBlock" with a kernel binary offset instead of an // AST node isn't a problem. - InlineBailout("kernel::FlowgraphBuilder::VisitTryFinally"); // There are 5 different cases where we need to execute the finally block: @@ -6584,7 +6571,6 @@ Fragment StreamingFlowGraphBuilder::BuildYieldStatement() { rethrow += RethrowException(position, CatchClauseNode::kInvalidTryIndex); Drop(); - continuation = Fragment(continuation.entry, no_error); } @@ -6598,8 +6584,8 @@ Fragment StreamingFlowGraphBuilder::BuildVariableDeclaration() { VariableDeclarationHelper helper(this); helper.ReadUntilExcluding(VariableDeclarationHelper::kType); dart::String& name = H.DartSymbol(helper.name_index_); - AbstractType& type = T.BuildType(); // read type. - Tag tag = ReadTag(); // read (first part of) initializer. + AbstractType& type = T.BuildType(); // read type. + Tag tag = ReadTag(); // read (first part of) initializer. Fragment instructions; if (tag == kNothing) { @@ -6768,7 +6754,6 @@ Fragment StreamingFlowGraphBuilder::BuildFunctionNode( return instructions; } - void StreamingFlowGraphBuilder::SetupFunctionParameters( const dart::Class& klass, const dart::Function& function, diff --git a/runtime/vm/kernel_binary_flowgraph.h b/runtime/vm/kernel_binary_flowgraph.h index 88d9a018817..f3d899be177 100644 --- a/runtime/vm/kernel_binary_flowgraph.h +++ b/runtime/vm/kernel_binary_flowgraph.h @@ -59,9 +59,7 @@ class StreamingDartTypeTranslator { translator_(translator) { translator_->type_parameter_scope_ = this; } - ~TypeParameterScope() { - translator_->type_parameter_scope_ = outer_; - } + ~TypeParameterScope() { translator_->type_parameter_scope_ = outer_; } TypeParameterScope* outer() const { return outer_; } intptr_t parameters_offset() const { return parameters_offset_; } @@ -90,7 +88,6 @@ class StreamingDartTypeTranslator { friend class KernelReader; }; - class StreamingScopeBuilder { public: StreamingScopeBuilder(ParsedFunction* parsed_function, @@ -201,7 +198,6 @@ class StreamingScopeBuilder { StreamingDartTypeTranslator type_translator_; }; - // There are several cases when we are compiling constant expressions: // // * constant field initializers: @@ -946,7 +942,6 @@ class FieldHelper { intptr_t next_read_; }; - // Helper class that reads a kernel Procedure from binary. // // Use ReadUntilExcluding to read up to but not including a field. diff --git a/runtime/vm/kernel_isolate.cc b/runtime/vm/kernel_isolate.cc index db3ebe75fc2..e66b58ba4ee 100644 --- a/runtime/vm/kernel_isolate.cc +++ b/runtime/vm/kernel_isolate.cc @@ -46,7 +46,6 @@ Isolate* KernelIsolate::isolate_ = NULL; bool KernelIsolate::initializing_ = true; Dart_Port KernelIsolate::kernel_port_ = ILLEGAL_PORT; - class RunKernelTask : public ThreadPool::Task { public: virtual void Run() { @@ -199,7 +198,6 @@ class RunKernelTask : public ThreadPool::Task { } }; - void KernelIsolate::Run() { if (!FLAG_use_dart_frontend) { return; @@ -210,7 +208,6 @@ void KernelIsolate::Run() { Dart::thread_pool()->Run(new RunKernelTask()); } - void KernelIsolate::InitCallback(Isolate* I) { Thread* T = Thread::Current(); ASSERT(I == T->isolate()); @@ -228,44 +225,37 @@ void KernelIsolate::InitCallback(Isolate* I) { SetKernelIsolate(I); } - bool KernelIsolate::IsKernelIsolate(const Isolate* isolate) { MonitorLocker ml(monitor_); return isolate == isolate_; } - bool KernelIsolate::IsRunning() { MonitorLocker ml(monitor_); return (kernel_port_ != ILLEGAL_PORT) && (isolate_ != NULL); } - bool KernelIsolate::Exists() { MonitorLocker ml(monitor_); return isolate_ != NULL; } - void KernelIsolate::SetKernelIsolate(Isolate* isolate) { MonitorLocker ml(monitor_); isolate_ = isolate; } - void KernelIsolate::SetLoadPort(Dart_Port port) { MonitorLocker ml(monitor_); kernel_port_ = port; } - void KernelIsolate::FinishedInitializing() { MonitorLocker ml(monitor_); initializing_ = false; ml.NotifyAll(); } - Dart_Port KernelIsolate::WaitForKernelPort() { if (!FLAG_use_dart_frontend) { return ILLEGAL_PORT; @@ -277,7 +267,6 @@ Dart_Port KernelIsolate::WaitForKernelPort() { return kernel_port_; } - class KernelCompilationRequest : public ValueObject { public: KernelCompilationRequest() @@ -485,7 +474,6 @@ Dart_KernelCompilationResult KernelIsolate::CompileToKernel( source_file_count, source_files); } - #endif // DART_PRECOMPILED_RUNTIME } // namespace dart diff --git a/runtime/vm/kernel_reader.cc b/runtime/vm/kernel_reader.cc index b17dc4a9107..6d9a944cf86 100644 --- a/runtime/vm/kernel_reader.cc +++ b/runtime/vm/kernel_reader.cc @@ -32,7 +32,6 @@ class SimpleExpressionConverter { simple_value_(NULL), builder_(builder) {} - bool IsSimple(intptr_t kernel_offset) { AlternativeReadingScope alt(builder_->reader_, kernel_offset); uint8_t payload = 0; @@ -98,7 +97,6 @@ class SimpleExpressionConverter { StreamingFlowGraphBuilder* builder_; }; - RawArray* KernelReader::MakeFunctionsArray() { const intptr_t len = functions_.length(); const Array& res = Array::Handle(zone_, Array::New(len, Heap::kOld)); @@ -108,18 +106,15 @@ RawArray* KernelReader::MakeFunctionsArray() { return res.raw(); } - RawLibrary* BuildingTranslationHelper::LookupLibraryByKernelLibrary( NameIndex library) { return reader_->LookupLibrary(library).raw(); } - RawClass* BuildingTranslationHelper::LookupClassByKernelClass(NameIndex klass) { return reader_->LookupClass(klass).raw(); } - KernelReader::KernelReader(Program* program) : program_(program), thread_(dart::Thread::Current()), @@ -173,7 +168,6 @@ KernelReader::KernelReader(Program* program) H.SetCanonicalNames(names); } - Object& KernelReader::ReadProgram() { LongJumpScope jump; if (setjmp(*jump.Set()) == 0) { @@ -212,7 +206,6 @@ Object& KernelReader::ReadProgram() { return error; } - void KernelReader::ReadLibrary(intptr_t kernel_offset) { builder_.SetOffset(kernel_offset); LibraryHelper library_helper(&builder_); @@ -302,7 +295,6 @@ void KernelReader::ReadLibrary(intptr_t kernel_offset) { classes.Add(toplevel_class, Heap::kOld); } - void KernelReader::ReadPreliminaryClass(dart::Class* klass, ClassHelper* class_helper, intptr_t type_parameter_count) { @@ -385,7 +377,6 @@ void KernelReader::ReadPreliminaryClass(dart::Class* klass, if (class_helper->is_abstract_) klass->set_is_abstract(); } - dart::Class& KernelReader::ReadClass(const dart::Library& library, const dart::Class& toplevel_class) { ClassHelper class_helper(&builder_); @@ -539,7 +530,6 @@ dart::Class& KernelReader::ReadClass(const dart::Library& library, return klass; } - void KernelReader::ReadProcedure(const dart::Library& library, const dart::Class& owner, bool in_class) { @@ -812,7 +802,6 @@ void KernelReader::GenerateFieldAccessors(const dart::Class& klass, } } - void KernelReader::SetupFieldAccessorFunction(const dart::Class& klass, const dart::Function& function) { bool is_setter = function.IsImplicitSetterFunction(); @@ -839,7 +828,6 @@ void KernelReader::SetupFieldAccessorFunction(const dart::Class& klass, } } - dart::Library& KernelReader::LookupLibrary(NameIndex library) { dart::Library* handle = NULL; if (!libraries_.Lookup(library, &handle)) { @@ -856,7 +844,6 @@ dart::Library& KernelReader::LookupLibrary(NameIndex library) { return *handle; } - dart::Class& KernelReader::LookupClass(NameIndex klass) { dart::Class* handle = NULL; if (!classes_.Lookup(klass, &handle)) { @@ -876,7 +863,6 @@ dart::Class& KernelReader::LookupClass(NameIndex klass) { return *handle; } - RawFunction::Kind KernelReader::GetFunctionType( Procedure::ProcedureKind procedure_kind) { intptr_t lookuptable[] = { @@ -895,7 +881,6 @@ RawFunction::Kind KernelReader::GetFunctionType( } } - ParsedFunction* ParseStaticFieldInitializer(Zone* zone, const dart::Field& field) { Thread* thread = Thread::Current(); @@ -922,7 +907,6 @@ ParsedFunction* ParseStaticFieldInitializer(Zone* zone, return new (zone) ParsedFunction(thread, initializer_fun); } - } // namespace kernel } // namespace dart #endif // !defined(DART_PRECOMPILED_RUNTIME) diff --git a/runtime/vm/kernel_to_il.cc b/runtime/vm/kernel_to_il.cc index 6991518178e..4ada7539e9a 100644 --- a/runtime/vm/kernel_to_il.cc +++ b/runtime/vm/kernel_to_il.cc @@ -8,8 +8,8 @@ #include "vm/compiler.h" #include "vm/intermediate_language.h" -#include "vm/kernel_reader.h" #include "vm/kernel_binary_flowgraph.h" +#include "vm/kernel_reader.h" #include "vm/longjump.h" #include "vm/method_recognizer.h" #include "vm/object_store.h" @@ -29,7 +29,6 @@ namespace kernel { #define T (type_translator_) #define I Isolate::Current() - Fragment& Fragment::operator+=(const Fragment& other) { if (entry == NULL) { entry = other.entry; @@ -41,7 +40,6 @@ Fragment& Fragment::operator+=(const Fragment& other) { return *this; } - Fragment& Fragment::operator<<=(Instruction* next) { if (entry == NULL) { entry = current = next; @@ -52,27 +50,23 @@ Fragment& Fragment::operator<<=(Instruction* next) { return *this; } - Fragment Fragment::closed() { ASSERT(entry != NULL); return Fragment(entry, NULL); } - Fragment operator+(const Fragment& first, const Fragment& second) { Fragment result = first; result += second; return result; } - Fragment operator<<(const Fragment& fragment, Instruction* next) { Fragment result = fragment; result <<= next; return result; } - TranslationHelper::TranslationHelper(Thread* thread) : thread_(thread), zone_(thread->zone()), @@ -82,42 +76,35 @@ TranslationHelper::TranslationHelper(Thread* thread) string_data_(TypedData::Handle(Z)), canonical_names_(TypedData::Handle(Z)) {} - void TranslationHelper::SetStringOffsets(const TypedData& string_offsets) { ASSERT(string_offsets_.IsNull()); string_offsets_ = string_offsets.raw(); } - void TranslationHelper::SetStringData(const TypedData& string_data) { ASSERT(string_data_.IsNull()); string_data_ = string_data.raw(); } - void TranslationHelper::SetCanonicalNames(const TypedData& canonical_names) { ASSERT(canonical_names_.IsNull()); canonical_names_ = canonical_names.raw(); } - intptr_t TranslationHelper::StringOffset(StringIndex index) const { return string_offsets_.GetUint32(index << 2); } - intptr_t TranslationHelper::StringSize(StringIndex index) const { return StringOffset(StringIndex(index + 1)) - StringOffset(index); } - uint8_t TranslationHelper::CharacterAt(StringIndex string_index, intptr_t index) { ASSERT(index < StringSize(string_index)); return string_data_.GetUint8(StringOffset(string_index) + index); } - bool TranslationHelper::StringEquals(StringIndex string_index, const char* other) { NoSafepointScope no_safepoint; @@ -127,7 +114,6 @@ bool TranslationHelper::StringEquals(StringIndex string_index, length) == 0); } - NameIndex TranslationHelper::CanonicalNameParent(NameIndex name) { // Canonical names are pairs of 4-byte parent and string indexes, so the size // of an entry is 8 bytes. The parent is biased: 0 represents the root name @@ -136,37 +122,31 @@ NameIndex TranslationHelper::CanonicalNameParent(NameIndex name) { 1); } - StringIndex TranslationHelper::CanonicalNameString(NameIndex name) { return StringIndex(canonical_names_.GetUint32((8 * name) + 4)); } - bool TranslationHelper::IsAdministrative(NameIndex name) { // Administrative names start with '@'. StringIndex name_string = CanonicalNameString(name); return (StringSize(name_string) > 0) && (CharacterAt(name_string, 0) == '@'); } - bool TranslationHelper::IsPrivate(NameIndex name) { // Private names start with '_'. StringIndex name_string = CanonicalNameString(name); return (StringSize(name_string) > 0) && (CharacterAt(name_string, 0) == '_'); } - bool TranslationHelper::IsRoot(NameIndex name) { return name == -1; } - bool TranslationHelper::IsLibrary(NameIndex name) { // Libraries are the only canonical names with the root as their parent. return !IsRoot(name) && IsRoot(CanonicalNameParent(name)); } - bool TranslationHelper::IsClass(NameIndex name) { // Classes have the library as their parent and are not an administrative // name starting with @. @@ -174,12 +154,10 @@ bool TranslationHelper::IsClass(NameIndex name) { IsLibrary(CanonicalNameParent(name)); } - bool TranslationHelper::IsMember(NameIndex name) { return IsConstructor(name) || IsField(name) || IsProcedure(name); } - bool TranslationHelper::IsField(NameIndex name) { // Fields with private names have the import URI of the library where they are // visible as the parent and the string "@fields" as the parent's parent. @@ -194,7 +172,6 @@ bool TranslationHelper::IsField(NameIndex name) { return StringEquals(CanonicalNameString(kind), "@fields"); } - bool TranslationHelper::IsConstructor(NameIndex name) { // Constructors with private names have the import URI of the library where // they are visible as the parent and the string "@constructors" as the @@ -210,12 +187,10 @@ bool TranslationHelper::IsConstructor(NameIndex name) { return StringEquals(CanonicalNameString(kind), "@constructors"); } - bool TranslationHelper::IsProcedure(NameIndex name) { return IsMethod(name) || IsGetter(name) || IsSetter(name) || IsFactory(name); } - bool TranslationHelper::IsMethod(NameIndex name) { // Methods with private names have the import URI of the library where they // are visible as the parent and the string "@methods" as the parent's parent. @@ -230,7 +205,6 @@ bool TranslationHelper::IsMethod(NameIndex name) { return StringEquals(CanonicalNameString(kind), "@methods"); } - bool TranslationHelper::IsGetter(NameIndex name) { // Getters with private names have the import URI of the library where they // are visible as the parent and the string "@getters" as the parent's parent. @@ -245,7 +219,6 @@ bool TranslationHelper::IsGetter(NameIndex name) { return StringEquals(CanonicalNameString(kind), "@getters"); } - bool TranslationHelper::IsSetter(NameIndex name) { // Setters with private names have the import URI of the library where they // are visible as the parent and the string "@setters" as the parent's parent. @@ -260,7 +233,6 @@ bool TranslationHelper::IsSetter(NameIndex name) { return StringEquals(CanonicalNameString(kind), "@setters"); } - bool TranslationHelper::IsFactory(NameIndex name) { // Factories with private names have the import URI of the library where they // are visible as the parent and the string "@factories" as the parent's @@ -276,7 +248,6 @@ bool TranslationHelper::IsFactory(NameIndex name) { return StringEquals(CanonicalNameString(kind), "@factories"); } - NameIndex TranslationHelper::EnclosingName(NameIndex name) { ASSERT(IsField(name) || IsConstructor(name) || IsProcedure(name)); NameIndex enclosing = CanonicalNameParent(CanonicalNameParent(name)); @@ -287,7 +258,6 @@ NameIndex TranslationHelper::EnclosingName(NameIndex name) { return enclosing; } - RawInstance* TranslationHelper::Canonicalize(const Instance& instance) { if (instance.IsNull()) return instance.raw(); @@ -299,13 +269,11 @@ RawInstance* TranslationHelper::Canonicalize(const Instance& instance) { return result; } - const dart::String& TranslationHelper::DartString(const char* content, Heap::Space space) { return dart::String::ZoneHandle(Z, dart::String::New(content, space)); } - dart::String& TranslationHelper::DartString(StringIndex string_index, Heap::Space space) { intptr_t length = StringSize(string_index); @@ -318,7 +286,6 @@ dart::String& TranslationHelper::DartString(StringIndex string_index, Z, dart::String::FromUTF8(buffer, length, space)); } - dart::String& TranslationHelper::DartString(const uint8_t* utf8_array, intptr_t len, Heap::Space space) { @@ -326,12 +293,10 @@ dart::String& TranslationHelper::DartString(const uint8_t* utf8_array, Z, dart::String::FromUTF8(utf8_array, len, space)); } - const dart::String& TranslationHelper::DartSymbol(const char* content) const { return dart::String::ZoneHandle(Z, Symbols::New(thread_, content)); } - dart::String& TranslationHelper::DartSymbol(StringIndex string_index) const { intptr_t length = StringSize(string_index); uint8_t* buffer = Z->Alloc(length); @@ -355,14 +320,12 @@ const dart::String& TranslationHelper::DartClassName(NameIndex kernel_class) { return ManglePrivateName(CanonicalNameParent(kernel_class), &name); } - const dart::String& TranslationHelper::DartConstructorName( NameIndex constructor) { ASSERT(IsConstructor(constructor)); return DartFactoryName(constructor); } - const dart::String& TranslationHelper::DartProcedureName(NameIndex procedure) { ASSERT(IsProcedure(procedure)); if (IsSetter(procedure)) { @@ -376,13 +339,11 @@ const dart::String& TranslationHelper::DartProcedureName(NameIndex procedure) { } } - const dart::String& TranslationHelper::DartSetterName(NameIndex setter) { return DartSetterName(CanonicalNameParent(setter), CanonicalNameString(setter)); } - const dart::String& TranslationHelper::DartSetterName(NameIndex parent, StringIndex setter) { // The names flowing into [setter] are coming from the Kernel file: @@ -410,13 +371,11 @@ const dart::String& TranslationHelper::DartSetterName(NameIndex parent, return name; } - const dart::String& TranslationHelper::DartGetterName(NameIndex getter) { return DartGetterName(CanonicalNameParent(getter), CanonicalNameString(getter)); } - const dart::String& TranslationHelper::DartGetterName(NameIndex parent, StringIndex getter) { dart::String& name = DartString(getter); @@ -425,27 +384,23 @@ const dart::String& TranslationHelper::DartGetterName(NameIndex parent, return name; } - const dart::String& TranslationHelper::DartFieldName(NameIndex parent, StringIndex field) { dart::String& name = DartString(field); return ManglePrivateName(parent, &name); } - const dart::String& TranslationHelper::DartMethodName(NameIndex method) { return DartMethodName(CanonicalNameParent(method), CanonicalNameString(method)); } - const dart::String& TranslationHelper::DartMethodName(NameIndex parent, StringIndex method) { dart::String& name = DartString(method); return ManglePrivateName(parent, &name); } - const dart::String& TranslationHelper::DartFactoryName(NameIndex factory) { ASSERT(IsConstructor(factory) || IsFactory(factory)); GrowableHandlePtrArray pieces(Z, 3); @@ -456,7 +411,6 @@ const dart::String& TranslationHelper::DartFactoryName(NameIndex factory) { return dart::String::ZoneHandle(Z, Symbols::FromConcatAll(thread_, pieces)); } - RawLibrary* TranslationHelper::LookupLibraryByKernelLibrary( NameIndex kernel_library) { // We only use the string and don't rely on having any particular parent. @@ -471,7 +425,6 @@ RawLibrary* TranslationHelper::LookupLibraryByKernelLibrary( return library; } - RawClass* TranslationHelper::LookupClassByKernelClass(NameIndex kernel_class) { ASSERT(IsClass(kernel_class)); const dart::String& class_name = DartClassName(kernel_class); @@ -484,7 +437,6 @@ RawClass* TranslationHelper::LookupClassByKernelClass(NameIndex kernel_class) { return klass; } - RawField* TranslationHelper::LookupFieldByKernelField(NameIndex kernel_field) { ASSERT(IsField(kernel_field)); NameIndex enclosing = EnclosingName(kernel_field); @@ -504,7 +456,6 @@ RawField* TranslationHelper::LookupFieldByKernelField(NameIndex kernel_field) { return field; } - RawFunction* TranslationHelper::LookupStaticMethodByKernelProcedure( NameIndex procedure) { const dart::String& procedure_name = DartProcedureName(procedure); @@ -536,7 +487,6 @@ RawFunction* TranslationHelper::LookupStaticMethodByKernelProcedure( } } - RawFunction* TranslationHelper::LookupConstructorByKernelConstructor( NameIndex constructor) { ASSERT(IsConstructor(constructor)); @@ -545,7 +495,6 @@ RawFunction* TranslationHelper::LookupConstructorByKernelConstructor( return LookupConstructorByKernelConstructor(klass, constructor); } - RawFunction* TranslationHelper::LookupConstructorByKernelConstructor( const dart::Class& owner, NameIndex constructor) { @@ -556,7 +505,6 @@ RawFunction* TranslationHelper::LookupConstructorByKernelConstructor( return function; } - dart::Type& TranslationHelper::GetCanonicalType(const dart::Class& klass) { ASSERT(!klass.IsNull()); // Note that if cls is _Closure, the returned type will be _Closure, @@ -575,7 +523,6 @@ dart::Type& TranslationHelper::GetCanonicalType(const dart::Class& klass) { return type; } - void TranslationHelper::ReportError(const char* format, ...) { const Script& null_script = Script::Handle(Z); @@ -587,7 +534,6 @@ void TranslationHelper::ReportError(const char* format, ...) { UNREACHABLE(); } - void TranslationHelper::ReportError(const Error& prev_error, const char* format, ...) { @@ -601,7 +547,6 @@ void TranslationHelper::ReportError(const Error& prev_error, UNREACHABLE(); } - dart::String& TranslationHelper::ManglePrivateName(NameIndex parent, dart::String* name_to_modify, bool symbolize) { @@ -615,7 +560,6 @@ dart::String& TranslationHelper::ManglePrivateName(NameIndex parent, return *name_to_modify; } - FlowGraphBuilder::FlowGraphBuilder( intptr_t kernel_offset, ParsedFunction* parsed_function, @@ -657,14 +601,12 @@ FlowGraphBuilder::FlowGraphBuilder( H.SetCanonicalNames(TypedData::Handle(Z, script.kernel_canonical_names())); } - FlowGraphBuilder::~FlowGraphBuilder() { if (streaming_flow_graph_builder_ != NULL) { delete streaming_flow_graph_builder_; } } - Fragment FlowGraphBuilder::TranslateFinallyFinalizers( TryFinallyBlock* outer_finally, intptr_t target_context_depth) { @@ -725,7 +667,6 @@ Fragment FlowGraphBuilder::TranslateFinallyFinalizers( return instructions; } - Fragment FlowGraphBuilder::EnterScope(intptr_t kernel_offset, bool* new_context) { Fragment instructions; @@ -741,7 +682,6 @@ Fragment FlowGraphBuilder::EnterScope(intptr_t kernel_offset, return instructions; } - Fragment FlowGraphBuilder::ExitScope(intptr_t kernel_offset) { Fragment instructions; const intptr_t context_size = @@ -752,7 +692,6 @@ Fragment FlowGraphBuilder::ExitScope(intptr_t kernel_offset) { return instructions; } - Fragment FlowGraphBuilder::LoadContextAt(int depth) { intptr_t delta = context_depth_ - depth; ASSERT(delta >= 0); @@ -763,7 +702,6 @@ Fragment FlowGraphBuilder::LoadContextAt(int depth) { return instructions; } - Fragment FlowGraphBuilder::AdjustContextTo(int depth) { ASSERT(depth <= context_depth_ && depth >= 0); Fragment instructions; @@ -777,7 +715,6 @@ Fragment FlowGraphBuilder::AdjustContextTo(int depth) { return instructions; } - Fragment FlowGraphBuilder::PushContext(int size) { ASSERT(size > 0); Fragment instructions = AllocateContext(size); @@ -792,12 +729,10 @@ Fragment FlowGraphBuilder::PushContext(int size) { return instructions; } - Fragment FlowGraphBuilder::PopContext() { return AdjustContextTo(context_depth_ - 1); } - Fragment FlowGraphBuilder::LoadInstantiatorTypeArguments() { // TODO(27590): We could use `active_class_->IsGeneric()`. Fragment instructions; @@ -826,13 +761,11 @@ Fragment FlowGraphBuilder::LoadInstantiatorTypeArguments() { return instructions; } - Fragment FlowGraphBuilder::LoadFunctionTypeArguments() { UNIMPLEMENTED(); // TODO(regis) return Fragment(NULL); } - Fragment FlowGraphBuilder::InstantiateType(const AbstractType& type) { Value* function_type_args = Pop(); Value* instantiator_type_args = Pop(); @@ -843,7 +776,6 @@ Fragment FlowGraphBuilder::InstantiateType(const AbstractType& type) { return Fragment(instr); } - Fragment FlowGraphBuilder::InstantiateTypeArguments( const TypeArguments& type_arguments) { Value* function_type_args = Pop(); @@ -855,7 +787,6 @@ Fragment FlowGraphBuilder::InstantiateTypeArguments( return Fragment(instr); } - Fragment FlowGraphBuilder::TranslateInstantiatedTypeArguments( const TypeArguments& type_arguments) { Fragment instructions; @@ -899,7 +830,6 @@ Fragment FlowGraphBuilder::TranslateInstantiatedTypeArguments( return instructions; } - Fragment FlowGraphBuilder::AllocateContext(int size) { AllocateContextInstr* allocate = new (Z) AllocateContextInstr(TokenPosition::kNoSource, size); @@ -907,7 +837,6 @@ Fragment FlowGraphBuilder::AllocateContext(int size) { return Fragment(allocate); } - Fragment FlowGraphBuilder::AllocateObject(TokenPosition position, const dart::Class& klass, intptr_t argument_count) { @@ -918,7 +847,6 @@ Fragment FlowGraphBuilder::AllocateObject(TokenPosition position, return Fragment(allocate); } - Fragment FlowGraphBuilder::AllocateObject(const dart::Class& klass, const Function& closure_function) { ArgumentArray arguments = new (Z) ZoneGrowableArray(Z, 0); @@ -929,14 +857,12 @@ Fragment FlowGraphBuilder::AllocateObject(const dart::Class& klass, return Fragment(allocate); } - Fragment FlowGraphBuilder::BooleanNegate() { BooleanNegateInstr* negate = new (Z) BooleanNegateInstr(Pop()); Push(negate); return Fragment(negate); } - Fragment FlowGraphBuilder::StrictCompare(Token::Kind kind, bool number_check /* = false */) { Value* right = Pop(); @@ -948,7 +874,6 @@ Fragment FlowGraphBuilder::StrictCompare(Token::Kind kind, return Fragment(compare); } - Fragment FlowGraphBuilder::BranchIfTrue(TargetEntryInstr** then_entry, TargetEntryInstr** otherwise_entry, bool negate) { @@ -956,7 +881,6 @@ Fragment FlowGraphBuilder::BranchIfTrue(TargetEntryInstr** then_entry, return instructions + BranchIfEqual(then_entry, otherwise_entry, negate); } - Fragment FlowGraphBuilder::BranchIfNull(TargetEntryInstr** then_entry, TargetEntryInstr** otherwise_entry, bool negate) { @@ -978,7 +902,6 @@ Fragment FlowGraphBuilder::BranchIfEqual(TargetEntryInstr** then_entry, return Fragment(branch).closed(); } - Fragment FlowGraphBuilder::BranchIfStrictEqual( TargetEntryInstr** then_entry, TargetEntryInstr** otherwise_entry) { @@ -993,7 +916,6 @@ Fragment FlowGraphBuilder::BranchIfStrictEqual( return Fragment(branch).closed(); } - Fragment FlowGraphBuilder::CatchBlockEntry(const Array& handler_types, intptr_t handler_index, bool needs_stacktrace) { @@ -1028,7 +950,6 @@ Fragment FlowGraphBuilder::CatchBlockEntry(const Array& handler_types, return instructions; } - Fragment FlowGraphBuilder::TryCatch(int try_handler_index) { // The body of the try needs to have it's own block in order to get a new try // index. @@ -1045,7 +966,6 @@ Fragment FlowGraphBuilder::TryCatch(int try_handler_index) { return Fragment(body.entry, entry); } - Fragment FlowGraphBuilder::CheckStackOverflowInPrologue() { if (IsInlining()) { // If we are inlining don't actually attach the stack check. We must still @@ -1056,13 +976,11 @@ Fragment FlowGraphBuilder::CheckStackOverflowInPrologue() { return CheckStackOverflow(); } - Fragment FlowGraphBuilder::CheckStackOverflow() { return Fragment(new (Z) CheckStackOverflowInstr( TokenPosition::kNoSource, loop_depth_, GetNextDeoptId())); } - Fragment FlowGraphBuilder::CloneContext() { LocalVariable* context_variable = parsed_function_->current_context_var(); @@ -1078,7 +996,6 @@ Fragment FlowGraphBuilder::CloneContext() { return instructions; } - Fragment FlowGraphBuilder::Constant(const Object& value) { ASSERT(value.IsNotTemporaryScopedHandle()); ConstantInstr* constant = new (Z) ConstantInstr(value); @@ -1086,7 +1003,6 @@ Fragment FlowGraphBuilder::Constant(const Object& value) { return Fragment(constant); } - Fragment FlowGraphBuilder::CreateArray() { Value* element_count = Pop(); CreateArrayInstr* array = @@ -1097,18 +1013,15 @@ Fragment FlowGraphBuilder::CreateArray() { return Fragment(array); } - Fragment FlowGraphBuilder::Goto(JoinEntryInstr* destination) { return Fragment(new (Z) GotoInstr(destination, GetNextDeoptId())).closed(); } - Fragment FlowGraphBuilder::IntConstant(int64_t value) { return Fragment( Constant(Integer::ZoneHandle(Z, Integer::New(value, Heap::kOld)))); } - Fragment FlowGraphBuilder::InstanceCall(TokenPosition position, const dart::String& name, Token::Kind kind, @@ -1119,7 +1032,6 @@ Fragment FlowGraphBuilder::InstanceCall(TokenPosition position, Array::null_array(), checked_argument_count); } - Fragment FlowGraphBuilder::InstanceCall(TokenPosition position, const dart::String& name, Token::Kind kind, @@ -1136,7 +1048,6 @@ Fragment FlowGraphBuilder::InstanceCall(TokenPosition position, return Fragment(call); } - Fragment FlowGraphBuilder::ClosureCall(intptr_t type_args_len, intptr_t argument_count, const Array& argument_names) { @@ -1150,7 +1061,6 @@ Fragment FlowGraphBuilder::ClosureCall(intptr_t type_args_len, return Fragment(call); } - Fragment FlowGraphBuilder::ThrowException(TokenPosition position) { Fragment instructions; instructions += Drop(); @@ -1165,7 +1075,6 @@ Fragment FlowGraphBuilder::ThrowException(TokenPosition position) { return instructions; } - Fragment FlowGraphBuilder::RethrowException(TokenPosition position, int catch_try_index) { Fragment instructions; @@ -1183,14 +1092,12 @@ Fragment FlowGraphBuilder::RethrowException(TokenPosition position, return instructions; } - Fragment FlowGraphBuilder::LoadClassId() { LoadClassIdInstr* load = new (Z) LoadClassIdInstr(Pop()); Push(load); return Fragment(load); } - const dart::Field& MayCloneField(Zone* zone, const dart::Field& field) { if ((Compiler::IsBackgroundCompilation() || FLAG_force_clone_compiler_objects) && @@ -1202,7 +1109,6 @@ const dart::Field& MayCloneField(Zone* zone, const dart::Field& field) { } } - Fragment FlowGraphBuilder::LoadField(const dart::Field& field) { LoadFieldInstr* load = new (Z) LoadFieldInstr(Pop(), &MayCloneField(Z, field), @@ -1212,7 +1118,6 @@ Fragment FlowGraphBuilder::LoadField(const dart::Field& field) { return Fragment(load); } - Fragment FlowGraphBuilder::LoadField(intptr_t offset, intptr_t class_id) { LoadFieldInstr* load = new (Z) LoadFieldInstr( Pop(), offset, AbstractType::ZoneHandle(Z), TokenPosition::kNoSource); @@ -1221,7 +1126,6 @@ Fragment FlowGraphBuilder::LoadField(intptr_t offset, intptr_t class_id) { return Fragment(load); } - Fragment FlowGraphBuilder::LoadNativeField(MethodRecognizer::Kind kind, intptr_t offset, const Type& type, @@ -1236,7 +1140,6 @@ Fragment FlowGraphBuilder::LoadNativeField(MethodRecognizer::Kind kind, return Fragment(load); } - Fragment FlowGraphBuilder::LoadLocal(LocalVariable* variable) { Fragment instructions; if (variable->is_captured()) { @@ -1251,14 +1154,12 @@ Fragment FlowGraphBuilder::LoadLocal(LocalVariable* variable) { return instructions; } - Fragment FlowGraphBuilder::InitStaticField(const dart::Field& field) { InitStaticFieldInstr* init = new (Z) InitStaticFieldInstr(Pop(), MayCloneField(Z, field), GetNextDeoptId()); return Fragment(init); } - Fragment FlowGraphBuilder::LoadStaticField() { LoadStaticFieldInstr* load = new (Z) LoadStaticFieldInstr(Pop(), TokenPosition::kNoSource); @@ -1266,12 +1167,10 @@ Fragment FlowGraphBuilder::LoadStaticField() { return Fragment(load); } - Fragment FlowGraphBuilder::NullConstant() { return Constant(Instance::ZoneHandle(Z, Instance::null())); } - Fragment FlowGraphBuilder::NativeCall(const dart::String* name, const Function* function) { InlineBailout("kernel::FlowGraphBuilder::NativeCall"); @@ -1281,7 +1180,6 @@ Fragment FlowGraphBuilder::NativeCall(const dart::String* name, return Fragment(call); } - Fragment FlowGraphBuilder::PushArgument() { PushArgumentInstr* argument = new (Z) PushArgumentInstr(Pop()); Push(argument); @@ -1292,7 +1190,6 @@ Fragment FlowGraphBuilder::PushArgument() { return Fragment(argument); } - Fragment FlowGraphBuilder::Return(TokenPosition position) { Fragment instructions; @@ -1326,14 +1223,12 @@ Fragment FlowGraphBuilder::Return(TokenPosition position) { return instructions.closed(); } - Fragment FlowGraphBuilder::StaticCall(TokenPosition position, const Function& target, intptr_t argument_count) { return StaticCall(position, target, argument_count, Array::null_array()); } - static intptr_t GetResultCidOfListFactory(Zone* zone, const Function& function, intptr_t argument_count) { @@ -1355,7 +1250,6 @@ static intptr_t GetResultCidOfListFactory(Zone* zone, return FactoryRecognizer::ResultCid(function); } - Fragment FlowGraphBuilder::StaticCall(TokenPosition position, const Function& target, intptr_t argument_count, @@ -1377,7 +1271,6 @@ Fragment FlowGraphBuilder::StaticCall(TokenPosition position, return Fragment(call); } - Fragment FlowGraphBuilder::StoreIndexed(intptr_t class_id) { Value* value = Pop(); Value* index = Pop(); @@ -1391,7 +1284,6 @@ Fragment FlowGraphBuilder::StoreIndexed(intptr_t class_id) { return Fragment(store); } - Fragment FlowGraphBuilder::StoreInstanceField( const dart::Field& field, bool is_initialization_store, @@ -1416,7 +1308,6 @@ Fragment FlowGraphBuilder::StoreInstanceField( return instructions; } - Fragment FlowGraphBuilder::StoreInstanceFieldGuarded( const dart::Field& field, bool is_initialization_store) { @@ -1433,7 +1324,6 @@ Fragment FlowGraphBuilder::StoreInstanceFieldGuarded( return instructions; } - Fragment FlowGraphBuilder::StoreInstanceField( TokenPosition position, intptr_t offset, @@ -1447,7 +1337,6 @@ Fragment FlowGraphBuilder::StoreInstanceField( return Fragment(store); } - Fragment FlowGraphBuilder::StoreLocal(TokenPosition position, LocalVariable* variable) { Fragment instructions; @@ -1467,14 +1356,12 @@ Fragment FlowGraphBuilder::StoreLocal(TokenPosition position, return instructions; } - Fragment FlowGraphBuilder::StoreStaticField(TokenPosition position, const dart::Field& field) { return Fragment( new (Z) StoreStaticFieldInstr(MayCloneField(Z, field), Pop(), position)); } - Fragment FlowGraphBuilder::StringInterpolate(TokenPosition position) { Value* array = Pop(); StringInterpolateInstr* interpolate = @@ -1483,7 +1370,6 @@ Fragment FlowGraphBuilder::StringInterpolate(TokenPosition position) { return Fragment(interpolate); } - Fragment FlowGraphBuilder::StringInterpolateSingle(TokenPosition position) { const int kTypeArgsLen = 0; const int kNumberOfArguments = 1; @@ -1502,7 +1388,6 @@ Fragment FlowGraphBuilder::StringInterpolateSingle(TokenPosition position) { return instructions; } - Fragment FlowGraphBuilder::ThrowTypeError() { const dart::Class& klass = dart::Class::ZoneHandle( Z, dart::Library::LookupCoreClass(Symbols::TypeError())); @@ -1548,7 +1433,6 @@ Fragment FlowGraphBuilder::ThrowTypeError() { return instructions; } - Fragment FlowGraphBuilder::ThrowNoSuchMethodError() { const dart::Class& klass = dart::Class::ZoneHandle( Z, dart::Library::LookupCoreClass(Symbols::NoSuchMethodError())); @@ -1585,7 +1469,6 @@ Fragment FlowGraphBuilder::ThrowNoSuchMethodError() { return instructions; } - RawFunction* FlowGraphBuilder::LookupMethodByMember( NameIndex target, const dart::String& method_name) { @@ -1598,7 +1481,6 @@ RawFunction* FlowGraphBuilder::LookupMethodByMember( return function; } - LocalVariable* FlowGraphBuilder::MakeTemporary() { char name[64]; intptr_t index = stack_->definition()->temp_index(); @@ -1620,7 +1502,6 @@ LocalVariable* FlowGraphBuilder::MakeTemporary() { return variable; } - intptr_t FlowGraphBuilder::CurrentTryIndex() { if (try_catch_block_ == NULL) { return CatchClauseNode::kInvalidTryIndex; @@ -1629,26 +1510,22 @@ intptr_t FlowGraphBuilder::CurrentTryIndex() { } } - dart::LocalVariable* FlowGraphBuilder::LookupVariable(intptr_t kernel_offset) { LocalVariable* local = scopes_->locals.Lookup(kernel_offset); ASSERT(local != NULL); return local; } - void FlowGraphBuilder::SetTempIndex(Definition* definition) { definition->set_temp_index( stack_ == NULL ? 0 : stack_->definition()->temp_index() + 1); } - void FlowGraphBuilder::Push(Definition* definition) { SetTempIndex(definition); Value::AddToList(new (Z) Value(definition), &stack_); } - Value* FlowGraphBuilder::Pop() { ASSERT(stack_ != NULL); Value* value = stack_; @@ -1661,7 +1538,6 @@ Value* FlowGraphBuilder::Pop() { return value; } - Fragment FlowGraphBuilder::Drop() { ASSERT(stack_ != NULL); Fragment instructions; @@ -1678,7 +1554,6 @@ Fragment FlowGraphBuilder::Drop() { return instructions; } - // TODO(27590): This method should be shared with // runtime/vm/object.cc:RecognizeArithmeticOp. Token::Kind FlowGraphBuilder::MethodKind(const dart::String& name) { @@ -1729,7 +1604,6 @@ Token::Kind FlowGraphBuilder::MethodKind(const dart::String& name) { return Token::kILLEGAL; } - void FlowGraphBuilder::InlineBailout(const char* reason) { bool is_inlining = exit_collector_ != NULL; if (is_inlining) { @@ -1738,7 +1612,6 @@ void FlowGraphBuilder::InlineBailout(const char* reason) { } } - FlowGraph* FlowGraphBuilder::BuildGraph() { const Function& function = parsed_function_->function(); @@ -1756,7 +1629,6 @@ FlowGraph* FlowGraphBuilder::BuildGraph() { return streaming_flow_graph_builder_->BuildGraph(kernel_offset_); } - Fragment FlowGraphBuilder::NativeFunctionBody(intptr_t first_positional_offset, const Function& function) { ASSERT(function.is_native()); @@ -1909,7 +1781,6 @@ Fragment FlowGraphBuilder::NativeFunctionBody(intptr_t first_positional_offset, return body + Return(TokenPosition::kNoSource); } - Fragment FlowGraphBuilder::BuildImplicitClosureCreation( const Function& target) { Fragment fragment; @@ -1955,19 +1826,16 @@ Fragment FlowGraphBuilder::BuildImplicitClosureCreation( return fragment; } - Fragment FlowGraphBuilder::GuardFieldLength(const dart::Field& field, intptr_t deopt_id) { return Fragment(new (Z) GuardFieldLengthInstr(Pop(), field, deopt_id)); } - Fragment FlowGraphBuilder::GuardFieldClass(const dart::Field& field, intptr_t deopt_id) { return Fragment(new (Z) GuardFieldClassInstr(Pop(), field, deopt_id)); } - Fragment FlowGraphBuilder::CheckVariableTypeInCheckedMode( const AbstractType& dst_type, const dart::String& name_symbol) { @@ -1980,14 +1848,12 @@ Fragment FlowGraphBuilder::CheckVariableTypeInCheckedMode( return Fragment(); } - bool FlowGraphBuilder::NeedsDebugStepCheck(const Function& function, TokenPosition position) { return FLAG_support_debugger && position.IsDebugPause() && !function.is_native() && function.is_debuggable(); } - bool FlowGraphBuilder::NeedsDebugStepCheck(Value* value, TokenPosition position) { if (!FLAG_support_debugger || !position.IsDebugPause()) return false; @@ -2005,7 +1871,6 @@ Fragment FlowGraphBuilder::DebugStepCheck(TokenPosition position) { position, RawPcDescriptors::kRuntimeCall, GetNextDeoptId())); } - Fragment FlowGraphBuilder::EvaluateAssertion() { const dart::Class& klass = dart::Class::ZoneHandle( Z, dart::Library::LookupCoreClass(Symbols::AssertionError())); @@ -2017,7 +1882,6 @@ Fragment FlowGraphBuilder::EvaluateAssertion() { return StaticCall(TokenPosition::kNoSource, target, 1); } - Fragment FlowGraphBuilder::CheckReturnTypeInCheckedMode() { if (I->type_checks()) { const AbstractType& return_type = @@ -2027,7 +1891,6 @@ Fragment FlowGraphBuilder::CheckReturnTypeInCheckedMode() { return Fragment(); } - Fragment FlowGraphBuilder::CheckBooleanInCheckedMode() { Fragment instructions; if (I->type_checks()) { @@ -2039,7 +1902,6 @@ Fragment FlowGraphBuilder::CheckBooleanInCheckedMode() { return instructions; } - Fragment FlowGraphBuilder::CheckAssignableInCheckedMode( const AbstractType& dst_type, const dart::String& dst_name) { @@ -2054,7 +1916,6 @@ Fragment FlowGraphBuilder::CheckAssignableInCheckedMode( return instructions; } - Fragment FlowGraphBuilder::AssertBool() { Value* value = Pop(); AssertBooleanInstr* instr = new (Z) @@ -2063,7 +1924,6 @@ Fragment FlowGraphBuilder::AssertBool() { return Fragment(instr); } - Fragment FlowGraphBuilder::AssertAssignable(const AbstractType& dst_type, const dart::String& dst_name) { Fragment instructions; @@ -2093,7 +1953,6 @@ Fragment FlowGraphBuilder::AssertAssignable(const AbstractType& dst_type, return instructions; } - FlowGraph* FlowGraphBuilder::BuildGraphOfMethodExtractor( const Function& method) { // A method extractor is the implicit getter for a method. @@ -2111,7 +1970,6 @@ FlowGraph* FlowGraphBuilder::BuildGraphOfMethodExtractor( return new (Z) FlowGraph(*parsed_function_, graph_entry_, next_block_id_ - 1); } - FlowGraph* FlowGraphBuilder::BuildGraphOfNoSuchMethodDispatcher( const Function& function) { // This function is specialized for a receiver class, a method name, and @@ -2215,7 +2073,6 @@ FlowGraph* FlowGraphBuilder::BuildGraphOfNoSuchMethodDispatcher( return new (Z) FlowGraph(*parsed_function_, graph_entry_, next_block_id_ - 1); } - FlowGraph* FlowGraphBuilder::BuildGraphOfInvokeFieldDispatcher( const Function& function) { // Find the name of the field we should dispatch to. @@ -2311,18 +2168,15 @@ FlowGraph* FlowGraphBuilder::BuildGraphOfInvokeFieldDispatcher( return new (Z) FlowGraph(*parsed_function_, graph_entry_, next_block_id_ - 1); } - TargetEntryInstr* FlowGraphBuilder::BuildTargetEntry() { return new (Z) TargetEntryInstr(AllocateBlockId(), CurrentTryIndex(), GetNextDeoptId()); } - JoinEntryInstr* FlowGraphBuilder::BuildJoinEntry(intptr_t try_index) { return new (Z) JoinEntryInstr(AllocateBlockId(), try_index, GetNextDeoptId()); } - JoinEntryInstr* FlowGraphBuilder::BuildJoinEntry() { return new (Z) JoinEntryInstr(AllocateBlockId(), CurrentTryIndex(), GetNextDeoptId()); @@ -2343,7 +2197,6 @@ ArgumentArray FlowGraphBuilder::GetArguments(int count) { return arguments; } - RawObject* EvaluateMetadata(const dart::Field& metadata_field) { LongJumpScope jump; if (setjmp(*jump.Set()) == 0) { @@ -2370,7 +2223,6 @@ RawObject* EvaluateMetadata(const dart::Field& metadata_field) { } } - RawObject* BuildParameterDescriptor(const Function& function) { LongJumpScope jump; if (setjmp(*jump.Set()) == 0) { diff --git a/runtime/vm/kernel_to_il.h b/runtime/vm/kernel_to_il.h index 2faba887936..1d60daf6b6a 100644 --- a/runtime/vm/kernel_to_il.h +++ b/runtime/vm/kernel_to_il.h @@ -51,7 +51,6 @@ class KernelConstMapKeyEqualsTraits { }; typedef UnorderedHashMap KernelConstantsMap; - template class Map : public DirectChainedHashMap > { public: @@ -79,7 +78,6 @@ class Map : public DirectChainedHashMap > { } }; - template class IntKeyRawPointerValueTrait { public: @@ -156,7 +154,6 @@ class MallocMap } }; - class BreakableBlock; class CatchBlock; class FlowGraphBuilder; @@ -191,7 +188,6 @@ Fragment operator<<(const Fragment& fragment, Instruction* next); typedef ZoneGrowableArray* ArgumentArray; - class ActiveClass { public: ActiveClass() @@ -219,7 +215,6 @@ class ActiveClass { intptr_t member_type_parameters_offset_start; }; - class ActiveClassScope { public: ActiveClassScope(ActiveClass* active_class, @@ -241,7 +236,6 @@ class ActiveClassScope { ActiveClass saved_; }; - class ActiveMemberScope { public: ActiveMemberScope(ActiveClass* active_class, @@ -265,7 +259,6 @@ class ActiveMemberScope { ActiveClass saved_; }; - class TranslationHelper { public: explicit TranslationHelper(dart::Thread* thread); @@ -384,7 +377,6 @@ class TranslationHelper { dart::String* name_to_modify, bool symbolize = true); - Thread* thread_; Zone* zone_; Isolate* isolate_; @@ -395,13 +387,11 @@ class TranslationHelper { TypedData& canonical_names_; }; - struct FunctionScope { intptr_t kernel_offset; LocalScope* scope; }; - class ScopeBuildingResult : public ZoneAllocated { public: ScopeBuildingResult() @@ -452,7 +442,6 @@ class ScopeBuildingResult : public ZoneAllocated { GrowableArray iterator_variables; }; - struct YieldContinuation { Instruction* entry; intptr_t try_index; @@ -693,7 +682,6 @@ class FlowGraphBuilder { return scopes_->catch_context_variables[try_depth_]; } - // A chained list of breakable blocks. Chaining and lookup is done by the // [BreakableBlock] class. BreakableBlock* breakable_block_; @@ -729,7 +717,6 @@ class FlowGraphBuilder { friend class TryFinallyBlock; }; - class SwitchBlock { public: SwitchBlock(FlowGraphBuilder* builder, intptr_t case_count) @@ -811,7 +798,6 @@ class SwitchBlock { intptr_t try_index_; }; - class TryCatchBlock { public: explicit TryCatchBlock(FlowGraphBuilder* builder, @@ -833,11 +819,9 @@ class TryCatchBlock { intptr_t try_index_; }; - class TryFinallyBlock { public: - TryFinallyBlock(FlowGraphBuilder* builder, - intptr_t finalizer_kernel_offset) + TryFinallyBlock(FlowGraphBuilder* builder, intptr_t finalizer_kernel_offset) : builder_(builder), outer_(builder->try_finally_block_), finalizer_kernel_offset_(finalizer_kernel_offset), @@ -866,7 +850,6 @@ class TryFinallyBlock { const intptr_t try_index_; }; - class BreakableBlock { public: explicit BreakableBlock(FlowGraphBuilder* builder) @@ -946,21 +929,19 @@ class CatchBlock { intptr_t catch_try_index_; }; - RawObject* EvaluateMetadata(const dart::Field& metadata_field); RawObject* BuildParameterDescriptor(const Function& function); void CollectTokenPositionsFor(const Script& script); String& GetSourceFor(const Script& script); Array& GetLineStartsFor(const Script& script); - } // namespace kernel } // namespace dart #else // !defined(DART_PRECOMPILED_RUNTIME) -#include "vm/object.h" #include "vm/kernel.h" +#include "vm/object.h" namespace dart { namespace kernel { diff --git a/runtime/vm/locations.cc b/runtime/vm/locations.cc index 51758199d4c..22480dd109f 100644 --- a/runtime/vm/locations.cc +++ b/runtime/vm/locations.cc @@ -21,7 +21,6 @@ intptr_t RegisterSet::RegisterCount(intptr_t registers) { return count; } - LocationSummary::LocationSummary(Zone* zone, intptr_t input_count, intptr_t temp_count, @@ -38,7 +37,6 @@ LocationSummary::LocationSummary(Zone* zone, temp_locations_ = zone->Alloc(num_temps_); } - LocationSummary* LocationSummary::Make( Zone* zone, intptr_t input_count, @@ -53,7 +51,6 @@ LocationSummary* LocationSummary::Make( return summary; } - Location Location::Pair(Location first, Location second) { PairLocation* pair_location = new PairLocation(); ASSERT((reinterpret_cast(pair_location) & kLocationTagMask) == 0); @@ -63,13 +60,11 @@ Location Location::Pair(Location first, Location second) { return loc; } - PairLocation* Location::AsPairLocation() const { ASSERT(IsPairLocation()); return reinterpret_cast(value_ & ~kLocationTagMask); } - Location Location::RegisterOrConstant(Value* value) { ConstantInstr* constant = value->definition()->AsConstant(); return ((constant != NULL) && Assembler::IsSafe(constant->value())) @@ -77,7 +72,6 @@ Location Location::RegisterOrConstant(Value* value) { : Location::RequiresRegister(); } - Location Location::RegisterOrSmiConstant(Value* value) { ConstantInstr* constant = value->definition()->AsConstant(); return ((constant != NULL) && Assembler::IsSafeSmi(constant->value())) @@ -85,7 +79,6 @@ Location Location::RegisterOrSmiConstant(Value* value) { : Location::RequiresRegister(); } - Location Location::WritableRegisterOrSmiConstant(Value* value) { ConstantInstr* constant = value->definition()->AsConstant(); return ((constant != NULL) && Assembler::IsSafeSmi(constant->value())) @@ -93,7 +86,6 @@ Location Location::WritableRegisterOrSmiConstant(Value* value) { : Location::WritableRegister(); } - Location Location::FixedRegisterOrConstant(Value* value, Register reg) { ConstantInstr* constant = value->definition()->AsConstant(); return ((constant != NULL) && Assembler::IsSafe(constant->value())) @@ -101,7 +93,6 @@ Location Location::FixedRegisterOrConstant(Value* value, Register reg) { : Location::RegisterLocation(reg); } - Location Location::FixedRegisterOrSmiConstant(Value* value, Register reg) { ConstantInstr* constant = value->definition()->AsConstant(); return ((constant != NULL) && Assembler::IsSafeSmi(constant->value())) @@ -109,7 +100,6 @@ Location Location::FixedRegisterOrSmiConstant(Value* value, Register reg) { : Location::RegisterLocation(reg); } - Location Location::AnyOrConstant(Value* value) { ConstantInstr* constant = value->definition()->AsConstant(); return ((constant != NULL) && Assembler::IsSafe(constant->value())) @@ -117,7 +107,6 @@ Location Location::AnyOrConstant(Value* value) { : Location::Any(); } - // DBC does not have an notion of 'address' in its instruction set. #if !defined(TARGET_ARCH_DBC) Address Location::ToStackSlotAddress() const { @@ -154,12 +143,10 @@ intptr_t Location::ToStackSlotOffset() const { } } - const Object& Location::constant() const { return constant_instruction()->value(); } - const char* Location::Name() const { switch (kind()) { case kInvalid: @@ -201,7 +188,6 @@ const char* Location::Name() const { return "?"; } - void Location::PrintTo(BufferFormatter* f) const { if (!FLAG_support_il_printer) { return; @@ -223,7 +209,6 @@ void Location::PrintTo(BufferFormatter* f) const { } } - const char* Location::ToCString() const { char buffer[1024]; BufferFormatter bf(buffer, 1024); @@ -231,7 +216,6 @@ const char* Location::ToCString() const { return Thread::Current()->zone()->MakeCopyOfString(buffer); } - void Location::Print() const { if (kind() == kStackSlot) { THR_Print("S%+" Pd "", stack_index()); @@ -240,7 +224,6 @@ void Location::Print() const { } } - Location Location::Copy() const { if (IsPairLocation()) { PairLocation* pair = AsPairLocation(); @@ -253,7 +236,6 @@ Location Location::Copy() const { } } - Location Location::RemapForSlowPath(Definition* def, intptr_t* cpu_reg_slots, intptr_t* fpu_reg_slots) const { @@ -306,7 +288,6 @@ Location Location::RemapForSlowPath(Definition* def, return *this; } - void LocationSummary::PrintTo(BufferFormatter* f) const { if (!FLAG_support_il_printer) { return; @@ -337,7 +318,6 @@ void LocationSummary::PrintTo(BufferFormatter* f) const { if (always_calls()) f->Print(" C"); } - #if defined(DEBUG) void LocationSummary::DiscoverWritableInputs() { if (!HasCallOnSlowPath()) { @@ -352,7 +332,6 @@ void LocationSummary::DiscoverWritableInputs() { } } - void LocationSummary::CheckWritableInputs() { ASSERT(HasCallOnSlowPath()); for (intptr_t i = 0; i < input_count(); i++) { diff --git a/runtime/vm/locations.h b/runtime/vm/locations.h index 4a1778f9f52..d6f14f807f2 100644 --- a/runtime/vm/locations.h +++ b/runtime/vm/locations.h @@ -12,14 +12,12 @@ namespace dart { - class BufferFormatter; class ConstantInstr; class Definition; class PairLocation; class Value; - enum Representation { kNoRepresentation, kTagged, @@ -35,7 +33,6 @@ enum Representation { kNumRepresentations }; - // Location objects are used to connect register allocator and code generator. // Instruction templates used by code generator have a corresponding // LocationSummary object which specifies expected location for every input @@ -389,7 +386,6 @@ class Location : public ValueObject { uword value_; }; - class PairLocation : public ZoneAllocated { public: PairLocation() { @@ -423,7 +419,6 @@ class PairLocation : public ZoneAllocated { Location locations_[kPairLength]; }; - template class SmallSet { public: @@ -450,7 +445,6 @@ class SmallSet { intptr_t data_; }; - class RegisterSet : public ValueObject { public: RegisterSet() @@ -459,7 +453,6 @@ class RegisterSet : public ValueObject { ASSERT(kNumberOfFpuRegisters <= (kWordSize * kBitsPerByte)); } - void Add(Location loc, Representation rep = kTagged) { if (loc.IsRegister()) { cpu_registers_.Add(loc.reg()); @@ -548,7 +541,6 @@ class RegisterSet : public ValueObject { DISALLOW_COPY_AND_ASSIGN(RegisterSet); }; - // Specification of locations for inputs and output. class LocationSummary : public ZoneAllocated { public: @@ -675,7 +667,6 @@ class LocationSummary : public ZoneAllocated { #endif }; - } // namespace dart #endif // RUNTIME_VM_LOCATIONS_H_ diff --git a/runtime/vm/lockers.cc b/runtime/vm/lockers.cc index 6b47e289625..533e3597bda 100644 --- a/runtime/vm/lockers.cc +++ b/runtime/vm/lockers.cc @@ -2,13 +2,12 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "platform/assert.h" #include "vm/lockers.h" +#include "platform/assert.h" #include "vm/safepoint.h" namespace dart { - static void updateThreadState(Thread* thread) { // First try a fast update of the thread state to indicate it is not at a // safepoint anymore. @@ -25,7 +24,6 @@ static void updateThreadState(Thread* thread) { thread->set_execution_state(Thread::kThreadInVM); } - Monitor::WaitResult MonitorLocker::WaitWithSafepointCheck(Thread* thread, int64_t millis) { ASSERT(thread == Thread::Current()); @@ -51,7 +49,6 @@ Monitor::WaitResult MonitorLocker::WaitWithSafepointCheck(Thread* thread, return result; } - SafepointMutexLocker::SafepointMutexLocker(Mutex* mutex) : mutex_(mutex) { ASSERT(mutex != NULL); if (!mutex_->TryLock()) { @@ -70,7 +67,6 @@ SafepointMutexLocker::SafepointMutexLocker(Mutex* mutex) : mutex_(mutex) { } } - SafepointMonitorLocker::SafepointMonitorLocker(Monitor* monitor) : monitor_(monitor) { ASSERT(monitor_ != NULL); @@ -90,7 +86,6 @@ SafepointMonitorLocker::SafepointMonitorLocker(Monitor* monitor) } } - Monitor::WaitResult SafepointMonitorLocker::Wait(int64_t millis) { Thread* thread = Thread::Current(); if (thread != NULL) { diff --git a/runtime/vm/lockers.h b/runtime/vm/lockers.h index d16c77e775c..e863d810d9a 100644 --- a/runtime/vm/lockers.h +++ b/runtime/vm/lockers.h @@ -250,5 +250,4 @@ class SafepointMonitorLocker : public ValueObject { } // namespace dart - #endif // RUNTIME_VM_LOCKERS_H_ diff --git a/runtime/vm/log.cc b/runtime/vm/log.cc index 28db12c77a1..9e941e3ef76 100644 --- a/runtime/vm/log.cc +++ b/runtime/vm/log.cc @@ -22,13 +22,11 @@ DEFINE_FLAG(charp, Log::Log(LogPrinter printer) : printer_(printer), manual_flush_(0), buffer_(0) {} - Log::~Log() { // Did someone enable manual flushing and then forgot to Flush? ASSERT(cursor() == 0); } - Log* Log::Current() { Thread* thread = Thread::Current(); if (thread == NULL) { @@ -46,7 +44,6 @@ Log* Log::Current() { } } - void Log::Print(const char* format, ...) { if (this == NoOpLog()) { return; @@ -58,7 +55,6 @@ void Log::Print(const char* format, ...) { va_end(args); } - void Log::VPrint(const char* format, va_list args) { if (this == NoOpLog()) { return; @@ -89,7 +85,6 @@ void Log::VPrint(const char* format, va_list args) { } } - void Log::Flush(const intptr_t cursor) { if (this == NoOpLog()) { return; @@ -107,7 +102,6 @@ void Log::Flush(const intptr_t cursor) { buffer_.TruncateTo(cursor); } - void Log::Clear() { if (this == NoOpLog()) { return; @@ -115,12 +109,10 @@ void Log::Clear() { buffer_.TruncateTo(0); } - intptr_t Log::cursor() const { return buffer_.length(); } - bool Log::ShouldLogForIsolate(const Isolate* isolate) { if (FLAG_isolate_log_filter == NULL) { if (isolate->is_service_isolate()) { @@ -138,13 +130,11 @@ bool Log::ShouldLogForIsolate(const Isolate* isolate) { return true; } - Log Log::noop_log_; Log* Log::NoOpLog() { return &noop_log_; } - void Log::TerminateString() { if (this == NoOpLog()) { return; @@ -152,7 +142,6 @@ void Log::TerminateString() { buffer_.Add('\0'); } - void Log::EnableManualFlush() { if (this == NoOpLog()) { return; @@ -160,7 +149,6 @@ void Log::EnableManualFlush() { manual_flush_++; } - void Log::DisableManualFlush() { if (this == NoOpLog()) { return; @@ -173,12 +161,10 @@ void Log::DisableManualFlush() { } } - void LogBlock::Initialize() { log_->EnableManualFlush(); } - LogBlock::~LogBlock() { log_->Flush(cursor_); log_->DisableManualFlush(); diff --git a/runtime/vm/log.h b/runtime/vm/log.h index c9cafc869a4..868e0ded476 100644 --- a/runtime/vm/log.h +++ b/runtime/vm/log.h @@ -67,7 +67,6 @@ class Log { DISALLOW_COPY_AND_ASSIGN(Log); }; - // Causes all log messages to be buffered until destructor is called. // Can be nested. class LogBlock : public StackResource { diff --git a/runtime/vm/log_test.cc b/runtime/vm/log_test.cc index aa95f094660..ea4670e6277 100644 --- a/runtime/vm/log_test.cc +++ b/runtime/vm/log_test.cc @@ -54,7 +54,6 @@ class LogTestHelper : public AllStatic { } }; - TEST_CASE(Log_Macro) { test_output_ = NULL; Log* log = Log::Current(); @@ -67,7 +66,6 @@ TEST_CASE(Log_Macro) { LogTestHelper::FreeTestOutput(); } - TEST_CASE(Log_Basic) { test_output_ = NULL; Log* log = new Log(TestPrinter); @@ -80,7 +78,6 @@ TEST_CASE(Log_Basic) { LogTestHelper::FreeTestOutput(); } - TEST_CASE(Log_Block) { test_output_ = NULL; Log* log = new Log(TestPrinter); diff --git a/runtime/vm/longjump.cc b/runtime/vm/longjump.cc index d79ee760dea..8ea1415dd5f 100644 --- a/runtime/vm/longjump.cc +++ b/runtime/vm/longjump.cc @@ -21,7 +21,6 @@ jmp_buf* LongJumpScope::Set() { return &environment_; } - bool LongJumpScope::IsSafeToJump() { // We do not want to jump past Dart frames. Note that this code // assumes the stack grows from high to low. @@ -44,7 +43,6 @@ bool LongJumpScope::IsSafeToJump() { return ((top_exit_frame_info == 0) || (jumpbuf_addr < top_exit_frame_info)); } - void LongJumpScope::Jump(int value, const Error& error) { // A zero is the default return value from setting up a LongJumpScope // using Set. diff --git a/runtime/vm/longjump_test.cc b/runtime/vm/longjump_test.cc index 5e35c0cce0b..2d62383c65d 100644 --- a/runtime/vm/longjump_test.cc +++ b/runtime/vm/longjump_test.cc @@ -15,7 +15,6 @@ static void LongJumpHelper(LongJumpScope* jump) { UNREACHABLE(); } - TEST_CASE(LongJump) { LongJumpScope* base = Thread::Current()->long_jump_base(); { diff --git a/runtime/vm/malloc_hooks_jemalloc.cc b/runtime/vm/malloc_hooks_jemalloc.cc index b2b5bff657e..7add5463de9 100644 --- a/runtime/vm/malloc_hooks_jemalloc.cc +++ b/runtime/vm/malloc_hooks_jemalloc.cc @@ -17,12 +17,10 @@ void MallocHooks::InitOnce() { // Do nothing. } - void MallocHooks::TearDown() { // Do nothing. } - void MallocHooks::PrintToJSONObject(JSONObject* jsobj) { // Here, we ignore the value of FLAG_profiler_native_memory because we can // gather this information cheaply without hooking into every call to the @@ -32,7 +30,6 @@ void MallocHooks::PrintToJSONObject(JSONObject* jsobj) { jsobj->AddProperty("_heapAllocationCount", allocation_count()); } - intptr_t MallocHooks::heap_allocated_memory_in_bytes() { uint64_t epoch = 1; size_t epoch_sz = sizeof(epoch); @@ -50,37 +47,30 @@ intptr_t MallocHooks::heap_allocated_memory_in_bytes() { return allocated; } - intptr_t MallocHooks::allocation_count() { return 0; } - bool MallocHooks::ProfilingEnabled() { return false; } - bool MallocHooks::stack_trace_collection_enabled() { return false; } - void MallocHooks::set_stack_trace_collection_enabled(bool enabled) { // Do nothing. } - void MallocHooks::ResetStats() { // Do nothing. } - bool MallocHooks::Active() { return false; } - Sample* MallocHooks::GetSample(const void* ptr) { return NULL; } diff --git a/runtime/vm/malloc_hooks_tcmalloc.cc b/runtime/vm/malloc_hooks_tcmalloc.cc index e5a1a23e02c..f0e8b2425c3 100644 --- a/runtime/vm/malloc_hooks_tcmalloc.cc +++ b/runtime/vm/malloc_hooks_tcmalloc.cc @@ -162,7 +162,6 @@ class AllocationInfo { intptr_t allocation_size_; }; - // Custom key/value trait specifically for address/size pairs. Unlike // RawPointerKeyValueTrait, the default value is -1 as 0 can be a valid entry. class AddressKeyValueTrait : public AllStatic { @@ -184,7 +183,6 @@ class AddressKeyValueTrait : public AllStatic { static bool IsKeyEqual(Pair kv, Key key) { return kv.key == key; } }; - // Map class that will be used to store mappings between ptr -> allocation size. class AddressMap : public MallocDirectChainedHashMap { public: @@ -222,7 +220,6 @@ class AddressMap : public MallocDirectChainedHashMap { } }; - // MallocHooks state / locks. bool MallocHooksState::active_ = false; bool MallocHooksState::stack_trace_collection_enabled_ = false; @@ -236,7 +233,6 @@ intptr_t MallocHooksState::allocation_count_ = 0; intptr_t MallocHooksState::heap_allocated_memory_in_bytes_ = 0; AddressMap* MallocHooksState::address_map_ = NULL; - void MallocHooksState::Init() { address_map_ = new AddressMap(); active_ = true; @@ -248,7 +244,6 @@ void MallocHooksState::Init() { original_pid_ = OS::ProcessId(); } - void MallocHooksState::ResetStats() { ASSERT(malloc_hook_mutex()->IsOwnedByCurrentThread()); allocation_count_ = 0; @@ -256,7 +251,6 @@ void MallocHooksState::ResetStats() { address_map_->Clear(); } - void MallocHooksState::TearDown() { ASSERT(malloc_hook_mutex()->IsOwnedByCurrentThread()); active_ = false; @@ -266,7 +260,6 @@ void MallocHooksState::TearDown() { address_map_ = NULL; } - void MallocHooks::InitOnce() { if (!FLAG_profiler_native_memory || MallocHooks::Active()) { return; @@ -285,7 +278,6 @@ void MallocHooks::InitOnce() { ASSERT(success); } - void MallocHooks::TearDown() { if (!FLAG_profiler_native_memory || !MallocHooks::Active()) { return; @@ -304,26 +296,22 @@ void MallocHooks::TearDown() { MallocHooksState::TearDown(); } - bool MallocHooks::ProfilingEnabled() { return MallocHooksState::ProfilingEnabled(); } - bool MallocHooks::stack_trace_collection_enabled() { MallocLocker ml(MallocHooksState::malloc_hook_mutex(), MallocHooksState::malloc_hook_mutex_owner()); return MallocHooksState::stack_trace_collection_enabled(); } - void MallocHooks::set_stack_trace_collection_enabled(bool enabled) { MallocLocker ml(MallocHooksState::malloc_hook_mutex(), MallocHooksState::malloc_hook_mutex_owner()); MallocHooksState::set_stack_trace_collection_enabled(enabled); } - void MallocHooks::ResetStats() { if (!FLAG_profiler_native_memory) { return; @@ -335,7 +323,6 @@ void MallocHooks::ResetStats() { } } - bool MallocHooks::Active() { if (!FLAG_profiler_native_memory) { return false; @@ -346,7 +333,6 @@ bool MallocHooks::Active() { return MallocHooksState::Active(); } - void MallocHooks::PrintToJSONObject(JSONObject* jsobj) { if (!FLAG_profiler_native_memory) { return; @@ -372,7 +358,6 @@ void MallocHooks::PrintToJSONObject(JSONObject* jsobj) { } } - intptr_t MallocHooks::allocation_count() { if (!FLAG_profiler_native_memory) { return 0; @@ -382,7 +367,6 @@ intptr_t MallocHooks::allocation_count() { return MallocHooksState::allocation_count(); } - intptr_t MallocHooks::heap_allocated_memory_in_bytes() { if (!FLAG_profiler_native_memory) { return 0; @@ -392,7 +376,6 @@ intptr_t MallocHooks::heap_allocated_memory_in_bytes() { return MallocHooksState::heap_allocated_memory_in_bytes(); } - Sample* MallocHooks::GetSample(const void* ptr) { MallocLocker ml(MallocHooksState::malloc_hook_mutex(), MallocHooksState::malloc_hook_mutex_owner()); @@ -409,7 +392,6 @@ Sample* MallocHooks::GetSample(const void* ptr) { return NULL; } - void MallocHooksState::RecordAllocHook(const void* ptr, size_t size) { if (MallocHooksState::IsLockHeldByCurrentThread() || !MallocHooksState::IsOriginalProcess()) { @@ -426,7 +408,6 @@ void MallocHooksState::RecordAllocHook(const void* ptr, size_t size) { } } - void MallocHooksState::RecordFreeHook(const void* ptr) { if (MallocHooksState::IsLockHeldByCurrentThread() || !MallocHooksState::IsOriginalProcess()) { diff --git a/runtime/vm/malloc_hooks_test.cc b/runtime/vm/malloc_hooks_test.cc index 38ed39555bf..e9d0e33f4fe 100644 --- a/runtime/vm/malloc_hooks_test.cc +++ b/runtime/vm/malloc_hooks_test.cc @@ -25,7 +25,6 @@ static void MallocHookTestBufferInitializer(volatile char* buffer, } } - UNIT_TEST_CASE(BasicMallocHookTest) { bool enable_malloc_hooks_saved = FLAG_profiler_native_memory; FLAG_profiler_native_memory = true; @@ -51,7 +50,6 @@ UNIT_TEST_CASE(BasicMallocHookTest) { FLAG_profiler_native_memory = enable_malloc_hooks_saved; } - UNIT_TEST_CASE(FreeUnseenMemoryMallocHookTest) { bool enable_malloc_hooks_saved = FLAG_profiler_native_memory; FLAG_profiler_native_memory = true; @@ -79,7 +77,6 @@ UNIT_TEST_CASE(FreeUnseenMemoryMallocHookTest) { EXPECT_EQ(static_cast(sizeof(char) * buffer_size), MallocHooks::heap_allocated_memory_in_bytes()); - delete[] buffer; EXPECT_EQ(0L, MallocHooks::allocation_count()); EXPECT_EQ(0L, MallocHooks::heap_allocated_memory_in_bytes()); @@ -88,7 +85,6 @@ UNIT_TEST_CASE(FreeUnseenMemoryMallocHookTest) { FLAG_profiler_native_memory = enable_malloc_hooks_saved; } - VM_UNIT_TEST_CASE(StackTraceMallocHookSimpleTest) { bool enable_malloc_hooks_saved = FLAG_profiler_native_memory; FLAG_profiler_native_memory = true; @@ -113,14 +109,12 @@ VM_UNIT_TEST_CASE(StackTraceMallocHookSimpleTest) { FLAG_profiler_native_memory = enable_malloc_hooks_saved; } - static char* DART_NOINLINE StackTraceLengthHelper(uintptr_t* end_address) { char* var = static_cast(malloc(16 * sizeof(char))); *end_address = OS::GetProgramCounter(); return var; } - VM_UNIT_TEST_CASE(StackTraceMallocHookLengthTest) { bool enable_malloc_hooks_saved = FLAG_profiler_native_memory; FLAG_profiler_native_memory = true; @@ -175,7 +169,6 @@ VM_UNIT_TEST_CASE(StackTraceMallocHookLengthTest) { FLAG_profiler_native_memory = enable_malloc_hooks_saved; } - ISOLATE_UNIT_TEST_CASE(StackTraceMallocHookSimpleJSONTest) { bool enable_malloc_hooks_saved = FLAG_profiler_native_memory; FLAG_profiler_native_memory = true; diff --git a/runtime/vm/malloc_hooks_unsupported.cc b/runtime/vm/malloc_hooks_unsupported.cc index 561a3aef035..a1e3634aec8 100644 --- a/runtime/vm/malloc_hooks_unsupported.cc +++ b/runtime/vm/malloc_hooks_unsupported.cc @@ -15,52 +15,42 @@ void MallocHooks::InitOnce() { // Do nothing. } - void MallocHooks::TearDown() { // Do nothing. } - bool MallocHooks::ProfilingEnabled() { return false; } - bool MallocHooks::stack_trace_collection_enabled() { return false; } - void MallocHooks::set_stack_trace_collection_enabled(bool enabled) { // Do nothing. } - void MallocHooks::ResetStats() { // Do nothing. } - bool MallocHooks::Active() { return false; } - void MallocHooks::PrintToJSONObject(JSONObject* jsobj) { // Do nothing. } - Sample* MallocHooks::GetSample(const void* ptr) { return NULL; } - intptr_t MallocHooks::allocation_count() { return 0; } - intptr_t MallocHooks::heap_allocated_memory_in_bytes() { return 0; } diff --git a/runtime/vm/megamorphic_cache_table.cc b/runtime/vm/megamorphic_cache_table.cc index 3008fae113c..514943f599d 100644 --- a/runtime/vm/megamorphic_cache_table.cc +++ b/runtime/vm/megamorphic_cache_table.cc @@ -42,14 +42,12 @@ RawMegamorphicCache* MegamorphicCacheTable::Lookup(Isolate* isolate, return cache.raw(); } - RawFunction* MegamorphicCacheTable::miss_handler(Isolate* isolate) { ASSERT(isolate->object_store()->megamorphic_miss_function() != Function::null()); return isolate->object_store()->megamorphic_miss_function(); } - void MegamorphicCacheTable::InitMissHandler(Isolate* isolate) { // The miss handler for a class ID not found in the table is invoked as a // normal Dart function. @@ -81,7 +79,6 @@ void MegamorphicCacheTable::InitMissHandler(Isolate* isolate) { isolate->object_store()->SetMegamorphicMissHandler(code, function); } - void MegamorphicCacheTable::PrintSizes(Isolate* isolate) { StackZone zone(Thread::Current()); intptr_t size = 0; diff --git a/runtime/vm/memory_region_test.cc b/runtime/vm/memory_region_test.cc index b0134a2cfc6..3bfc7aff29c 100644 --- a/runtime/vm/memory_region_test.cc +++ b/runtime/vm/memory_region_test.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "platform/assert.h" #include "vm/memory_region.h" +#include "platform/assert.h" #include "vm/unit_test.h" namespace dart { @@ -13,12 +13,10 @@ static void* NewRegion(uword size) { return pointer; } - static void DeleteRegion(const MemoryRegion& region) { delete[] reinterpret_cast(region.pointer()); } - VM_UNIT_TEST_CASE(NullRegion) { static const uword kSize = 512; MemoryRegion region(NULL, kSize); @@ -26,7 +24,6 @@ VM_UNIT_TEST_CASE(NullRegion) { EXPECT_EQ(kSize, region.size()); } - VM_UNIT_TEST_CASE(NewRegion) { static const uword kSize = 1024; MemoryRegion region(NewRegion(kSize), kSize); @@ -39,7 +36,6 @@ VM_UNIT_TEST_CASE(NewRegion) { DeleteRegion(region); } - VM_UNIT_TEST_CASE(Subregion) { static const uword kSize = 1024; static const uword kSubOffset = 128; @@ -59,7 +55,6 @@ VM_UNIT_TEST_CASE(Subregion) { DeleteRegion(region); } - VM_UNIT_TEST_CASE(ExtendedRegion) { static const uword kSize = 1024; static const uword kSubSize = 512; diff --git a/runtime/vm/message.cc b/runtime/vm/message.cc index 4d5fc31216e..305b4ebac5e 100644 --- a/runtime/vm/message.cc +++ b/runtime/vm/message.cc @@ -20,7 +20,6 @@ bool Message::RedirectToDeliveryFailurePort() { return true; } - intptr_t Message::Id() const { // Messages are allocated on the C heap. Use the raw address as the id. return reinterpret_cast(this); @@ -40,20 +39,17 @@ const char* Message::PriorityAsString(Priority priority) { } } - MessageQueue::MessageQueue() { head_ = NULL; tail_ = NULL; } - MessageQueue::~MessageQueue() { // Ensure that all pending messages have been released. Clear(); ASSERT(head_ == NULL); } - void MessageQueue::Enqueue(Message* msg, bool before_events) { // Make sure messages are not reused. ASSERT(msg->next_ == NULL); @@ -95,7 +91,6 @@ void MessageQueue::Enqueue(Message* msg, bool before_events) { } } - Message* MessageQueue::Dequeue() { Message* result = head_; if (result != NULL) { @@ -112,7 +107,6 @@ Message* MessageQueue::Dequeue() { return NULL; } - void MessageQueue::Clear() { Message* cur = head_; head_ = NULL; @@ -128,12 +122,10 @@ void MessageQueue::Clear() { } } - MessageQueue::Iterator::Iterator(const MessageQueue* queue) : next_(NULL) { Reset(queue); } - MessageQueue::Iterator::~Iterator() {} void MessageQueue::Iterator::Reset(const MessageQueue* queue) { @@ -153,7 +145,6 @@ Message* MessageQueue::Iterator::Next() { return current; } - intptr_t MessageQueue::Length() const { MessageQueue::Iterator it(this); intptr_t length = 0; @@ -164,7 +155,6 @@ intptr_t MessageQueue::Length() const { return length; } - Message* MessageQueue::FindMessageById(intptr_t id) { MessageQueue::Iterator it(this); while (it.HasNext()) { @@ -177,7 +167,6 @@ Message* MessageQueue::FindMessageById(intptr_t id) { return NULL; } - void MessageQueue::PrintJSON(JSONStream* stream) { #ifndef PRODUCT if (!FLAG_support_service) { diff --git a/runtime/vm/message_handler.cc b/runtime/vm/message_handler.cc index 4d3ab69c852..2a8d21f3944 100644 --- a/runtime/vm/message_handler.cc +++ b/runtime/vm/message_handler.cc @@ -12,7 +12,6 @@ #include "vm/port.h" #include "vm/thread_interrupter.h" - namespace dart { DECLARE_FLAG(bool, trace_service_pause_events); @@ -34,7 +33,6 @@ class MessageHandlerTask : public ThreadPool::Task { DISALLOW_COPY_AND_ASSIGN(MessageHandlerTask); }; - // static const char* MessageHandler::MessageStatusString(MessageStatus status) { switch (status) { @@ -52,7 +50,6 @@ const char* MessageHandler::MessageStatusString(MessageStatus status) { } } - MessageHandler::MessageHandler() : queue_(new MessageQueue()), oob_queue_(new MessageQueue()), @@ -74,7 +71,6 @@ MessageHandler::MessageHandler() ASSERT(oob_queue_ != NULL); } - MessageHandler::~MessageHandler() { delete queue_; delete oob_queue_; @@ -84,24 +80,20 @@ MessageHandler::~MessageHandler() { task_ = NULL; } - const char* MessageHandler::name() const { return ""; } - #if defined(DEBUG) void MessageHandler::CheckAccess() { // By default there is no checking. } #endif - void MessageHandler::MessageNotify(Message::Priority priority) { // By default, there is no custom message notification. } - void MessageHandler::Run(ThreadPool* pool, StartCallback start_callback, EndCallback end_callback, @@ -125,7 +117,6 @@ void MessageHandler::Run(ThreadPool* pool, ASSERT(task_running); } - void MessageHandler::PostMessage(Message* message, bool before_events) { Message::Priority saved_priority; bool task_running = true; @@ -167,7 +158,6 @@ void MessageHandler::PostMessage(Message* message, bool before_events) { MessageNotify(saved_priority); } - Message* MessageHandler::DequeueMessage(Message::Priority min_priority) { // TODO(turnidge): Add assert that monitor_ is held here. Message* message = oob_queue_->Dequeue(); @@ -177,12 +167,10 @@ Message* MessageHandler::DequeueMessage(Message::Priority min_priority) { return message; } - void MessageHandler::ClearOOBQueue() { oob_queue_->Clear(); } - MessageHandler::MessageStatus MessageHandler::HandleMessages( MonitorLocker* ml, bool allow_normal_messages, @@ -257,7 +245,6 @@ MessageHandler::MessageStatus MessageHandler::HandleMessages( return max_status; } - MessageHandler::MessageStatus MessageHandler::HandleNextMessage() { // We can only call HandleNextMessage when this handler is not // assigned to a thread pool. @@ -270,7 +257,6 @@ MessageHandler::MessageStatus MessageHandler::HandleNextMessage() { return HandleMessages(&ml, true, false); } - MessageHandler::MessageStatus MessageHandler::HandleAllMessages() { // We can only call HandleAllMessages when this handler is not // assigned to a thread pool. @@ -283,7 +269,6 @@ MessageHandler::MessageStatus MessageHandler::HandleAllMessages() { return HandleMessages(&ml, true, true); } - MessageHandler::MessageStatus MessageHandler::HandleOOBMessages() { if (!oob_message_handling_allowed_) { return kOK; @@ -296,7 +281,6 @@ MessageHandler::MessageStatus MessageHandler::HandleOOBMessages() { return HandleMessages(&ml, false, false); } - bool MessageHandler::ShouldPauseOnStart(MessageStatus status) const { Isolate* owning_isolate = isolate(); if (owning_isolate == NULL) { @@ -309,7 +293,6 @@ bool MessageHandler::ShouldPauseOnStart(MessageStatus status) const { should_pause_on_start() && owning_isolate->is_runnable(); } - bool MessageHandler::ShouldPauseOnExit(MessageStatus status) const { Isolate* owning_isolate = isolate(); if (owning_isolate == NULL) { @@ -320,13 +303,11 @@ bool MessageHandler::ShouldPauseOnExit(MessageStatus status) const { should_pause_on_exit() && owning_isolate->is_runnable(); } - bool MessageHandler::HasOOBMessages() { MonitorLocker ml(&monitor_); return !oob_queue_->IsEmpty(); } - void MessageHandler::TaskCallback() { ASSERT(Isolate::Current() == NULL); MessageStatus status = kOK; @@ -445,7 +426,6 @@ void MessageHandler::TaskCallback() { } } - void MessageHandler::ClosePort(Dart_Port port) { MonitorLocker ml(&monitor_); if (FLAG_trace_isolates) { @@ -459,7 +439,6 @@ void MessageHandler::ClosePort(Dart_Port port) { } } - void MessageHandler::CloseAllPorts() { MonitorLocker ml(&monitor_); if (FLAG_trace_isolates) { @@ -472,7 +451,6 @@ void MessageHandler::CloseAllPorts() { oob_queue_->Clear(); } - void MessageHandler::RequestDeletion() { ASSERT(OwnedByPortMap()); { @@ -488,7 +466,6 @@ void MessageHandler::RequestDeletion() { delete this; } - void MessageHandler::increment_live_ports() { MonitorLocker ml(&monitor_); #if defined(DEBUG) @@ -497,7 +474,6 @@ void MessageHandler::increment_live_ports() { live_ports_++; } - void MessageHandler::decrement_live_ports() { MonitorLocker ml(&monitor_); #if defined(DEBUG) @@ -506,18 +482,15 @@ void MessageHandler::decrement_live_ports() { live_ports_--; } - void MessageHandler::PausedOnStart(bool paused) { MonitorLocker ml(&monitor_); PausedOnStartLocked(&ml, paused); } - void MessageHandler::DebugDump() { PortMap::DebugDumpForMessageHandler(this); } - void MessageHandler::PausedOnStartLocked(MonitorLocker* ml, bool paused) { if (paused) { ASSERT(!is_paused_on_start_); @@ -545,13 +518,11 @@ void MessageHandler::PausedOnStartLocked(MonitorLocker* ml, bool paused) { } } - void MessageHandler::PausedOnExit(bool paused) { MonitorLocker ml(&monitor_); PausedOnExitLocked(&ml, paused); } - void MessageHandler::PausedOnExitLocked(MonitorLocker* ml, bool paused) { if (paused) { ASSERT(!is_paused_on_exit_); @@ -579,14 +550,12 @@ void MessageHandler::PausedOnExitLocked(MonitorLocker* ml, bool paused) { } } - MessageHandler::AcquiredQueues::AcquiredQueues(MessageHandler* handler) : handler_(handler), ml_(&handler->monitor_) { ASSERT(handler != NULL); handler_->oob_message_handling_allowed_ = false; } - MessageHandler::AcquiredQueues::~AcquiredQueues() { ASSERT(handler_ != NULL); handler_->oob_message_handling_allowed_ = true; diff --git a/runtime/vm/message_handler_test.cc b/runtime/vm/message_handler_test.cc index 926344bfb01..183453b5565 100644 --- a/runtime/vm/message_handler_test.cc +++ b/runtime/vm/message_handler_test.cc @@ -29,7 +29,6 @@ class MessageHandlerTestPeer { DISALLOW_COPY_AND_ASSIGN(MessageHandlerTestPeer); }; - class TestMessageHandler : public MessageHandler { public: TestMessageHandler() @@ -106,17 +105,14 @@ class TestMessageHandler : public MessageHandler { DISALLOW_COPY_AND_ASSIGN(TestMessageHandler); }; - MessageHandler::MessageStatus TestStartFunction(uword data) { return (reinterpret_cast(data))->Start(); } - void TestEndFunction(uword data) { return (reinterpret_cast(data))->End(); } - VM_UNIT_TEST_CASE(MessageHandler_PostMessage) { TestMessageHandler handler; MessageHandlerTestPeer handler_peer(&handler); @@ -147,7 +143,6 @@ VM_UNIT_TEST_CASE(MessageHandler_PostMessage) { delete message; } - VM_UNIT_TEST_CASE(MessageHandler_HasOOBMessages) { TestMessageHandler handler; MessageHandlerTestPeer handler_peer(&handler); @@ -180,7 +175,6 @@ VM_UNIT_TEST_CASE(MessageHandler_HasOOBMessages) { handler_peer.CloseAllPorts(); } - VM_UNIT_TEST_CASE(MessageHandler_ClosePort) { TestMessageHandler handler; MessageHandlerTestPeer handler_peer(&handler); @@ -198,7 +192,6 @@ VM_UNIT_TEST_CASE(MessageHandler_ClosePort) { delete message2; } - VM_UNIT_TEST_CASE(MessageHandler_CloseAllPorts) { TestMessageHandler handler; MessageHandlerTestPeer handler_peer(&handler); @@ -213,7 +206,6 @@ VM_UNIT_TEST_CASE(MessageHandler_CloseAllPorts) { EXPECT(NULL == handler_peer.queue()->Dequeue()); } - VM_UNIT_TEST_CASE(MessageHandler_HandleNextMessage) { TestMessageHandler handler; MessageHandlerTestPeer handler_peer(&handler); @@ -239,7 +231,6 @@ VM_UNIT_TEST_CASE(MessageHandler_HandleNextMessage) { PortMap::ClosePorts(&handler); } - VM_UNIT_TEST_CASE(MessageHandler_HandleNextMessage_ProcessOOBAfterError) { TestMessageHandler handler; MessageHandler::MessageStatus results[] = { @@ -269,7 +260,6 @@ VM_UNIT_TEST_CASE(MessageHandler_HandleNextMessage_ProcessOOBAfterError) { handler_peer.CloseAllPorts(); } - VM_UNIT_TEST_CASE(MessageHandler_HandleNextMessage_Shutdown) { TestMessageHandler handler; MessageHandler::MessageStatus results[] = { @@ -307,7 +297,6 @@ VM_UNIT_TEST_CASE(MessageHandler_HandleNextMessage_Shutdown) { handler_peer.CloseAllPorts(); } - VM_UNIT_TEST_CASE(MessageHandler_HandleOOBMessages) { TestMessageHandler handler; MessageHandlerTestPeer handler_peer(&handler); @@ -333,14 +322,12 @@ VM_UNIT_TEST_CASE(MessageHandler_HandleOOBMessages) { handler_peer.CloseAllPorts(); } - struct ThreadStartInfo { MessageHandler* handler; Dart_Port* ports; int count; }; - static void SendMessages(uword param) { ThreadStartInfo* info = reinterpret_cast(param); MessageHandler* handler = info->handler; @@ -352,7 +339,6 @@ static void SendMessages(uword param) { } } - VM_UNIT_TEST_CASE(MessageHandler_Run) { ThreadPool pool; TestMessageHandler handler; diff --git a/runtime/vm/message_test.cc b/runtime/vm/message_test.cc index d496a7b7878..24375fdab54 100644 --- a/runtime/vm/message_test.cc +++ b/runtime/vm/message_test.cc @@ -2,18 +2,16 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "platform/assert.h" #include "vm/message.h" +#include "platform/assert.h" #include "vm/unit_test.h" namespace dart { - static uint8_t* AllocMsg(const char* str) { return reinterpret_cast(strdup(str)); } - TEST_CASE(MessageQueue_BasicOperations) { MessageQueue queue; EXPECT(queue.IsEmpty()); @@ -124,7 +122,6 @@ TEST_CASE(MessageQueue_BasicOperations) { delete msg6; } - TEST_CASE(MessageQueue_Clear) { MessageQueue queue; Dart_Port port1 = 1; diff --git a/runtime/vm/method_recognizer.cc b/runtime/vm/method_recognizer.cc index 16d25bbf3b5..dc195c6cfda 100644 --- a/runtime/vm/method_recognizer.cc +++ b/runtime/vm/method_recognizer.cc @@ -14,17 +14,14 @@ MethodRecognizer::Kind MethodRecognizer::RecognizeKind( return function.recognized_kind(); } - bool MethodRecognizer::AlwaysInline(const Function& function) { return function.always_inline(); } - bool MethodRecognizer::PolymorphicTarget(const Function& function) { return function.is_polymorphic_target(); } - intptr_t MethodRecognizer::ResultCid(const Function& function) { switch (function.recognized_kind()) { #define DEFINE_CASE(cname, fname, ename, result_type, fingerprint) \ @@ -37,7 +34,6 @@ intptr_t MethodRecognizer::ResultCid(const Function& function) { } } - intptr_t MethodRecognizer::MethodKindToReceiverCid(Kind kind) { switch (kind) { case kImmutableArrayGetIndexed: @@ -118,7 +114,6 @@ intptr_t MethodRecognizer::MethodKindToReceiverCid(Kind kind) { return kIllegalCid; } - #define KIND_TO_STRING(class_name, function_name, enum_name, type, fp) \ #enum_name, static const char* recognized_list_method_name[] = { @@ -131,7 +126,6 @@ const char* MethodRecognizer::KindToCString(Kind kind) { return "?"; } - #if !defined(DART_PRECOMPILED_RUNTIME) void MethodRecognizer::InitializeState() { GrowableArray libs(3); @@ -185,5 +179,4 @@ void MethodRecognizer::InitializeState() { } #endif // !defined(DART_PRECOMPILED_RUNTIME) - } // namespace dart diff --git a/runtime/vm/method_recognizer.h b/runtime/vm/method_recognizer.h index 3962678696c..eafc641f39d 100644 --- a/runtime/vm/method_recognizer.h +++ b/runtime/vm/method_recognizer.h @@ -541,7 +541,6 @@ class MethodRecognizer : public AllStatic { #endif // !defined(DART_PRECOMPILED_RUNTIME) }; - #if !defined(DART_PRECOMPILED_RUNTIME) #define CHECK_FINGERPRINT2(f, p0, p1, fp) \ ASSERT(f.CheckSourceFingerprint(#p0 ", " #p1, fp)) @@ -550,7 +549,6 @@ class MethodRecognizer : public AllStatic { ASSERT(f.CheckSourceFingerprint(#p0 ", " #p1 ", " #p2, fp)) #endif // !defined(DART_PRECOMPILED_RUNTIME) - // clang-format off // List of recognized list factories: // (factory-name-symbol, class-name-string, constructor-name-string, diff --git a/runtime/vm/metrics.cc b/runtime/vm/metrics.cc index 3cf35f68fe3..5489823047c 100644 --- a/runtime/vm/metrics.cc +++ b/runtime/vm/metrics.cc @@ -6,10 +6,10 @@ #include "vm/isolate.h" #include "vm/json_stream.h" -#include "vm/native_entry.h" -#include "vm/runtime_entry.h" -#include "vm/object.h" #include "vm/log.h" +#include "vm/native_entry.h" +#include "vm/object.h" +#include "vm/runtime_entry.h" namespace dart { @@ -28,7 +28,6 @@ Metric::Metric() value_(0), next_(NULL) {} - void Metric::Init(Isolate* isolate, const char* name, const char* description, @@ -43,7 +42,6 @@ void Metric::Init(Isolate* isolate, RegisterWithIsolate(); } - void Metric::Init(const char* name, const char* description, Unit unit) { // Only called once. ASSERT(next_ == NULL); @@ -54,7 +52,6 @@ void Metric::Init(const char* name, const char* description, Unit unit) { RegisterWithVM(); } - Metric::~Metric() { // Only deregister metrics which had been registered. Metrics without a name // are from shallow copy isolates. @@ -67,7 +64,6 @@ Metric::~Metric() { } } - #ifndef PRODUCT static const char* UnitString(intptr_t unit) { switch (unit) { @@ -84,7 +80,6 @@ static const char* UnitString(intptr_t unit) { return NULL; } - void Metric::PrintJSON(JSONStream* stream) { if (!FLAG_support_service) { return; @@ -105,7 +100,6 @@ void Metric::PrintJSON(JSONStream* stream) { } #endif // !PRODUCT - char* Metric::ValueToString(int64_t value, Unit unit) { Thread* thread = Thread::Current(); ASSERT(thread != NULL); @@ -149,7 +143,6 @@ char* Metric::ValueToString(int64_t value, Unit unit) { } } - char* Metric::ToString() { Thread* thread = Thread::Current(); ASSERT(thread != NULL); @@ -158,7 +151,6 @@ char* Metric::ToString() { return zone->PrintToString("%s %s", name(), ValueToString(Value(), unit())); } - bool Metric::NameExists(Metric* head, const char* name) { ASSERT(name != NULL); while (head != NULL) { @@ -172,7 +164,6 @@ bool Metric::NameExists(Metric* head, const char* name) { return false; } - void Metric::RegisterWithIsolate() { ASSERT(isolate_ != NULL); ASSERT(next_ == NULL); @@ -185,7 +176,6 @@ void Metric::RegisterWithIsolate() { isolate_->set_metrics_list_head(this); } - void Metric::DeregisterWithIsolate() { Metric* head = isolate_->metrics_list_head(); ASSERT(head != NULL); @@ -214,7 +204,6 @@ void Metric::DeregisterWithIsolate() { UNREACHABLE(); } - void Metric::RegisterWithVM() { ASSERT(isolate_ == NULL); ASSERT(next_ == NULL); @@ -227,7 +216,6 @@ void Metric::RegisterWithVM() { vm_list_head_ = this; } - void Metric::DeregisterWithVM() { ASSERT(isolate_ == NULL); Metric* head = vm_list_head_; @@ -259,43 +247,36 @@ void Metric::DeregisterWithVM() { UNREACHABLE(); } - int64_t MetricHeapOldUsed::Value() const { ASSERT(isolate() == Isolate::Current()); return isolate()->heap()->UsedInWords(Heap::kOld) * kWordSize; } - int64_t MetricHeapOldCapacity::Value() const { ASSERT(isolate() == Isolate::Current()); return isolate()->heap()->CapacityInWords(Heap::kOld) * kWordSize; } - int64_t MetricHeapOldExternal::Value() const { ASSERT(isolate() == Isolate::Current()); return isolate()->heap()->ExternalInWords(Heap::kOld) * kWordSize; } - int64_t MetricHeapNewUsed::Value() const { ASSERT(isolate() == Isolate::Current()); return isolate()->heap()->UsedInWords(Heap::kNew) * kWordSize; } - int64_t MetricHeapNewCapacity::Value() const { ASSERT(isolate() == Isolate::Current()); return isolate()->heap()->CapacityInWords(Heap::kNew) * kWordSize; } - int64_t MetricHeapNewExternal::Value() const { ASSERT(isolate() == Isolate::Current()); return isolate()->heap()->ExternalInWords(Heap::kNew) * kWordSize; } - int64_t MetricHeapUsed::Value() const { ASSERT(isolate() == Isolate::Current()); return isolate()->heap()->UsedInWords(Heap::kNew) * kWordSize + @@ -306,7 +287,6 @@ int64_t MetricIsolateCount::Value() const { return Isolate::IsolateListLength(); } - int64_t MetricPeakRSS::Value() const { return OS::MaxRSS(); } @@ -316,7 +296,6 @@ int64_t MetricPeakRSS::Value() const { VM_METRIC_LIST(VM_METRIC_VARIABLE); #undef VM_METRIC_VARIABLE - void Metric::InitOnce() { #define VM_METRIC_INIT(type, variable, name, unit) \ vm_metric_##variable##_.Init(name, NULL, Metric::unit); @@ -338,24 +317,20 @@ void Metric::Cleanup() { } } - MaxMetric::MaxMetric() : Metric() { set_value(kMinInt64); } - void MaxMetric::SetValue(int64_t new_value) { if (new_value > value()) { set_value(new_value); } } - MinMetric::MinMetric() : Metric() { set_value(kMaxInt64); } - void MinMetric::SetValue(int64_t new_value) { if (new_value < value()) { set_value(new_value); diff --git a/runtime/vm/metrics.h b/runtime/vm/metrics.h index 6e96170ace9..87467ce5ee5 100644 --- a/runtime/vm/metrics.h +++ b/runtime/vm/metrics.h @@ -109,7 +109,6 @@ class Metric { DISALLOW_COPY_AND_ASSIGN(Metric); }; - // A Metric class that reports the maximum value observed. // Initial maximum is kMinInt64. class MaxMetric : public Metric { @@ -119,7 +118,6 @@ class MaxMetric : public Metric { void SetValue(int64_t new_value); }; - // A Metric class that reports the minimum value observed. // Initial minimum is kMaxInt64. class MinMetric : public Metric { @@ -129,55 +127,46 @@ class MinMetric : public Metric { void SetValue(int64_t new_value); }; - class MetricHeapOldUsed : public Metric { protected: virtual int64_t Value() const; }; - class MetricHeapOldCapacity : public Metric { protected: virtual int64_t Value() const; }; - class MetricHeapOldExternal : public Metric { protected: virtual int64_t Value() const; }; - class MetricHeapNewUsed : public Metric { protected: virtual int64_t Value() const; }; - class MetricHeapNewCapacity : public Metric { protected: virtual int64_t Value() const; }; - class MetricHeapNewExternal : public Metric { protected: virtual int64_t Value() const; }; - class MetricIsolateCount : public Metric { protected: virtual int64_t Value() const; }; - class MetricPeakRSS : public Metric { protected: virtual int64_t Value() const; }; - class MetricHeapUsed : public Metric { protected: virtual int64_t Value() const; diff --git a/runtime/vm/mirrors_api_impl.cc b/runtime/vm/mirrors_api_impl.cc index f367e3b5a41..fdbad3071c6 100644 --- a/runtime/vm/mirrors_api_impl.cc +++ b/runtime/vm/mirrors_api_impl.cc @@ -22,7 +22,6 @@ namespace dart { // Facilitate quick access to the current zone once we have the current thread. #define Z (T->zone()) - // --- Classes and Interfaces Reflection --- DART_EXPORT Dart_Handle Dart_TypeName(Dart_Handle object) { @@ -36,7 +35,6 @@ DART_EXPORT Dart_Handle Dart_TypeName(Dart_Handle object) { } } - DART_EXPORT Dart_Handle Dart_QualifiedTypeName(Dart_Handle object) { DARTSCOPE(Thread::Current()); const Object& obj = Object::Handle(Z, Api::UnwrapHandle(object)); @@ -55,7 +53,6 @@ DART_EXPORT Dart_Handle Dart_QualifiedTypeName(Dart_Handle object) { } } - // --- Function and Variable Reflection --- // Outside of the vm, we expose setter names with a trailing '='. @@ -63,13 +60,11 @@ static bool HasExternalSetterSuffix(const String& name) { return name.CharAt(name.Length() - 1) == '='; } - static RawString* RemoveExternalSetterSuffix(const String& name) { ASSERT(HasExternalSetterSuffix(name)); return String::SubString(name, 0, name.Length() - 1); } - DART_EXPORT Dart_Handle Dart_GetFunctionNames(Dart_Handle target) { DARTSCOPE(Thread::Current()); const Object& obj = Object::Handle(Z, Api::UnwrapHandle(target)); @@ -127,7 +122,6 @@ DART_EXPORT Dart_Handle Dart_GetFunctionNames(Dart_Handle target) { return Api::NewHandle(T, Array::MakeFixedLength(names)); } - DART_EXPORT Dart_Handle Dart_LookupFunction(Dart_Handle target, Dart_Handle function_name) { DARTSCOPE(Thread::Current()); @@ -207,7 +201,6 @@ DART_EXPORT Dart_Handle Dart_LookupFunction(Dart_Handle target, return Api::NewHandle(T, func.raw()); } - DART_EXPORT Dart_Handle Dart_FunctionName(Dart_Handle function) { DARTSCOPE(Thread::Current()); const Function& func = Api::UnwrapFunctionHandle(Z, function); @@ -217,7 +210,6 @@ DART_EXPORT Dart_Handle Dart_FunctionName(Dart_Handle function) { return Api::NewHandle(T, func.UserVisibleName()); } - DART_EXPORT Dart_Handle Dart_FunctionOwner(Dart_Handle function) { DARTSCOPE(Thread::Current()); const Function& func = Api::UnwrapFunctionHandle(Z, function); @@ -245,7 +237,6 @@ DART_EXPORT Dart_Handle Dart_FunctionOwner(Dart_Handle function) { } } - DART_EXPORT Dart_Handle Dart_FunctionIsStatic(Dart_Handle function, bool* is_static) { DARTSCOPE(Thread::Current()); @@ -260,7 +251,6 @@ DART_EXPORT Dart_Handle Dart_FunctionIsStatic(Dart_Handle function, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_FunctionIsConstructor(Dart_Handle function, bool* is_constructor) { DARTSCOPE(Thread::Current()); @@ -275,7 +265,6 @@ DART_EXPORT Dart_Handle Dart_FunctionIsConstructor(Dart_Handle function, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_FunctionIsGetter(Dart_Handle function, bool* is_getter) { DARTSCOPE(Thread::Current()); @@ -290,7 +279,6 @@ DART_EXPORT Dart_Handle Dart_FunctionIsGetter(Dart_Handle function, return Api::Success(); } - DART_EXPORT Dart_Handle Dart_FunctionIsSetter(Dart_Handle function, bool* is_setter) { DARTSCOPE(Thread::Current()); @@ -305,7 +293,6 @@ DART_EXPORT Dart_Handle Dart_FunctionIsSetter(Dart_Handle function, return Api::Success(); } - // --- Libraries Reflection --- DART_EXPORT Dart_Handle Dart_LibraryName(Dart_Handle library) { @@ -339,7 +326,6 @@ DART_EXPORT Dart_Handle Dart_LibraryGetClassNames(Dart_Handle library) { return Api::NewHandle(T, Array::MakeFixedLength(names)); } - // --- Closures Reflection --- DART_EXPORT Dart_Handle Dart_ClosureFunction(Dart_Handle closure) { diff --git a/runtime/vm/native_api_impl.cc b/runtime/vm/native_api_impl.cc index 4729375f4d5..53178ceb612 100644 --- a/runtime/vm/native_api_impl.cc +++ b/runtime/vm/native_api_impl.cc @@ -23,7 +23,6 @@ static uint8_t* malloc_allocator(uint8_t* ptr, return reinterpret_cast(new_ptr); } - class IsolateSaver { public: explicit IsolateSaver(Isolate* current_isolate) @@ -46,7 +45,6 @@ class IsolateSaver { DISALLOW_COPY_AND_ASSIGN(IsolateSaver); }; - static bool PostCObjectHelper(Dart_Port port_id, Dart_CObject* message) { uint8_t* buffer = NULL; ApiMessageWriter writer(&buffer, malloc_allocator); @@ -62,12 +60,10 @@ static bool PostCObjectHelper(Dart_Port port_id, Dart_CObject* message) { port_id, buffer, writer.BytesWritten(), Message::kNormalPriority)); } - DART_EXPORT bool Dart_PostCObject(Dart_Port port_id, Dart_CObject* message) { return PostCObjectHelper(port_id, message); } - DART_EXPORT bool Dart_PostInteger(Dart_Port port_id, int64_t message) { if (Smi::IsValid(message)) { return PortMap::PostMessage( @@ -79,7 +75,6 @@ DART_EXPORT bool Dart_PostInteger(Dart_Port port_id, int64_t message) { return PostCObjectHelper(port_id, &cobj); } - DART_EXPORT Dart_Port Dart_NewNativePort(const char* name, Dart_NativeMessageHandler handler, bool handle_concurrently) { @@ -101,7 +96,6 @@ DART_EXPORT Dart_Port Dart_NewNativePort(const char* name, return port_id; } - DART_EXPORT bool Dart_CloseNativePort(Dart_Port native_port_id) { // Close the native port without a current isolate. IsolateSaver saver(Isolate::Current()); @@ -110,7 +104,6 @@ DART_EXPORT bool Dart_CloseNativePort(Dart_Port native_port_id) { return PortMap::ClosePort(native_port_id); } - // --- Verification tools --- static void CompileAll(Thread* thread, Dart_Handle* result) { @@ -123,7 +116,6 @@ static void CompileAll(Thread* thread, Dart_Handle* result) { } } - DART_EXPORT Dart_Handle Dart_CompileAll() { DARTSCOPE(Thread::Current()); Dart_Handle result = Api::CheckAndFinalizePendingClasses(T); @@ -135,7 +127,6 @@ DART_EXPORT Dart_Handle Dart_CompileAll() { return result; } - static void ParseAll(Thread* thread, Dart_Handle* result) { ASSERT(thread != NULL); const Error& error = Error::Handle(thread->zone(), Library::ParseAll(thread)); @@ -146,7 +137,6 @@ static void ParseAll(Thread* thread, Dart_Handle* result) { } } - DART_EXPORT Dart_Handle Dart_ParseAll() { DARTSCOPE(Thread::Current()); Dart_Handle result = Api::CheckAndFinalizePendingClasses(T); diff --git a/runtime/vm/native_entry.cc b/runtime/vm/native_entry.cc index f89c9a050fa..a6f8ec27ccf 100644 --- a/runtime/vm/native_entry.cc +++ b/runtime/vm/native_entry.cc @@ -18,7 +18,6 @@ #include "vm/symbols.h" #include "vm/tags.h" - namespace dart { DEFINE_FLAG(bool, @@ -26,14 +25,12 @@ DEFINE_FLAG(bool, false, "Trace invocation of natives (debug mode only)"); - void DartNativeThrowArgumentException(const Instance& instance) { const Array& __args__ = Array::Handle(Array::New(1)); __args__.SetAt(0, instance); Exceptions::ThrowByType(Exceptions::kArgument, __args__); } - NativeFunction NativeEntry::ResolveNative(const Library& library, const String& function_name, int number_of_arguments, @@ -57,7 +54,6 @@ NativeFunction NativeEntry::ResolveNative(const Library& library, return reinterpret_cast(native_function); } - const uint8_t* NativeEntry::ResolveSymbolInLibrary(const Library& library, uword pc) { Dart_NativeEntrySymbol symbol_resolver = @@ -69,7 +65,6 @@ const uint8_t* NativeEntry::ResolveSymbolInLibrary(const Library& library, return symbol_resolver(reinterpret_cast(pc)); } - const uint8_t* NativeEntry::ResolveSymbol(uword pc) { Thread* thread = Thread::Current(); REUSABLE_GROWABLE_OBJECT_ARRAY_HANDLESCOPE(thread); @@ -90,14 +85,12 @@ const uint8_t* NativeEntry::ResolveSymbol(uword pc) { return NULL; } - bool NativeEntry::ReturnValueIsError(NativeArguments* arguments) { RawObject* retval = arguments->ReturnValue(); return (retval->IsHeapObject() && RawObject::IsErrorClassId(retval->GetClassId())); } - void NativeEntry::PropagateErrors(NativeArguments* arguments) { Thread* thread = arguments->thread(); thread->UnwindScopes(thread->top_exit_frame_info()); @@ -109,7 +102,6 @@ void NativeEntry::PropagateErrors(NativeArguments* arguments) { UNREACHABLE(); } - uword NativeEntry::NoScopeNativeCallWrapperEntry() { uword entry = reinterpret_cast(NativeEntry::NoScopeNativeCallWrapper); #if defined(USING_SIMULATOR) && !defined(TARGET_ARCH_DBC) @@ -120,14 +112,12 @@ uword NativeEntry::NoScopeNativeCallWrapperEntry() { return entry; } - void NativeEntry::NoScopeNativeCallWrapper(Dart_NativeArguments args, Dart_NativeFunction func) { CHECK_STACK_ALIGNMENT; NoScopeNativeCallWrapperNoStackCheck(args, func); } - void NativeEntry::NoScopeNativeCallWrapperNoStackCheck( Dart_NativeArguments args, Dart_NativeFunction func) { @@ -148,7 +138,6 @@ void NativeEntry::NoScopeNativeCallWrapperNoStackCheck( VERIFY_ON_TRANSITION; } - uword NativeEntry::AutoScopeNativeCallWrapperEntry() { uword entry = reinterpret_cast(NativeEntry::AutoScopeNativeCallWrapper); @@ -160,14 +149,12 @@ uword NativeEntry::AutoScopeNativeCallWrapperEntry() { return entry; } - void NativeEntry::AutoScopeNativeCallWrapper(Dart_NativeArguments args, Dart_NativeFunction func) { CHECK_STACK_ALIGNMENT; AutoScopeNativeCallWrapperNoStackCheck(args, func); } - void NativeEntry::AutoScopeNativeCallWrapperNoStackCheck( Dart_NativeArguments args, Dart_NativeFunction func) { @@ -215,7 +202,6 @@ void NativeEntry::AutoScopeNativeCallWrapperNoStackCheck( VERIFY_ON_TRANSITION; } - // DBC does not support lazy native call linking. #if !defined(TARGET_ARCH_DBC) static NativeFunction ResolveNativeFunction(Zone* zone, @@ -236,7 +222,6 @@ static NativeFunction ResolveNativeFunction(Zone* zone, is_auto_scope); } - uword NativeEntry::LinkNativeCallEntry() { uword entry = reinterpret_cast(NativeEntry::LinkNativeCall); #if defined(USING_SIMULATOR) @@ -246,7 +231,6 @@ uword NativeEntry::LinkNativeCallEntry() { return entry; } - void NativeEntry::LinkNativeCall(Dart_NativeArguments args) { CHECK_STACK_ALIGNMENT; VERIFY_ON_TRANSITION; @@ -344,5 +328,4 @@ void NativeEntry::LinkNativeCall(Dart_NativeArguments args) { } #endif // !defined(TARGET_ARCH_DBC) - } // namespace dart diff --git a/runtime/vm/native_entry.h b/runtime/vm/native_entry.h index 7a5be6e5801..9714c91b805 100644 --- a/runtime/vm/native_entry.h +++ b/runtime/vm/native_entry.h @@ -86,7 +86,6 @@ typedef void (*NativeFunction)(NativeArguments* arguments); static RawObject* DN_Helper##name(Isolate* isolate, Thread* thread, \ Zone* zone, NativeArguments* arguments) - // Helper that throws an argument exception. void DartNativeThrowArgumentException(const Instance& instance); @@ -100,7 +99,6 @@ void DartNativeThrowArgumentException(const Instance& instance); } \ const type& name = type::Cast(__##name##_instance__); - // Natives should throw an exception if an illegal argument is passed. // type name = value. #define GET_NATIVE_ARGUMENT(type, name, value) \ @@ -114,7 +112,6 @@ void DartNativeThrowArgumentException(const Instance& instance); } \ name ^= value; - // Helper class for resolving and handling native functions. class NativeEntry : public AllStatic { public: diff --git a/runtime/vm/native_entry_test.cc b/runtime/vm/native_entry_test.cc index eb012e0fe2f..600c3234905 100644 --- a/runtime/vm/native_entry_test.cc +++ b/runtime/vm/native_entry_test.cc @@ -15,7 +15,6 @@ namespace dart { - // A native call for test purposes. // Arg0: a smi. // Arg1: a smi. @@ -33,7 +32,6 @@ void TestSmiSub(Dart_NativeArguments args) { Dart_SetReturnValue(args, Dart_NewInteger(result)); } - // A native call for test purposes. // Arg0-4: 5 smis. // Result: a smi representing the sum of all arguments. @@ -51,7 +49,6 @@ void TestSmiSum(Dart_NativeArguments args) { Dart_SetReturnValue(args, Dart_NewInteger(result)); } - // Test for accepting null arguments in native function. // Arg0-4: 5 smis or null. // Result: a smi representing the sum of all non-null arguments. diff --git a/runtime/vm/native_message_handler.cc b/runtime/vm/native_message_handler.cc index 41fbd2cabc0..a09d77c793d 100644 --- a/runtime/vm/native_message_handler.cc +++ b/runtime/vm/native_message_handler.cc @@ -15,19 +15,16 @@ NativeMessageHandler::NativeMessageHandler(const char* name, Dart_NativeMessageHandler func) : name_(strdup(name)), func_(func) {} - NativeMessageHandler::~NativeMessageHandler() { free(name_); } - #if defined(DEBUG) void NativeMessageHandler::CheckAccess() { ASSERT(Isolate::Current() == NULL); } #endif - MessageHandler::MessageStatus NativeMessageHandler::HandleMessage( Message* message) { if (message->IsOOB()) { diff --git a/runtime/vm/native_symbol.h b/runtime/vm/native_symbol.h index 39ed0222988..4c5c754fca8 100644 --- a/runtime/vm/native_symbol.h +++ b/runtime/vm/native_symbol.h @@ -21,7 +21,6 @@ class NativeSymbolResolver : public AllStatic { static void FreeSymbolName(char* name); }; - } // namespace dart #endif // RUNTIME_VM_NATIVE_SYMBOL_H_ diff --git a/runtime/vm/native_symbol_android.cc b/runtime/vm/native_symbol_android.cc index d08c8ada3f4..a54e06159dc 100644 --- a/runtime/vm/native_symbol_android.cc +++ b/runtime/vm/native_symbol_android.cc @@ -14,10 +14,8 @@ namespace dart { void NativeSymbolResolver::InitOnce() {} - void NativeSymbolResolver::ShutdownOnce() {} - char* NativeSymbolResolver::LookupSymbolName(uintptr_t pc, uintptr_t* start) { Dl_info info; int r = dladdr(reinterpret_cast(pc), &info); @@ -40,12 +38,10 @@ char* NativeSymbolResolver::LookupSymbolName(uintptr_t pc, uintptr_t* start) { return strdup(info.dli_sname); } - void NativeSymbolResolver::FreeSymbolName(char* name) { free(name); } - bool NativeSymbolResolver::LookupSharedObject(uword pc, uword* dso_base, char** dso_name) { diff --git a/runtime/vm/native_symbol_fuchsia.cc b/runtime/vm/native_symbol_fuchsia.cc index 1c5c09745d5..56057626709 100644 --- a/runtime/vm/native_symbol_fuchsia.cc +++ b/runtime/vm/native_symbol_fuchsia.cc @@ -15,10 +15,8 @@ namespace dart { void NativeSymbolResolver::InitOnce() {} - void NativeSymbolResolver::ShutdownOnce() {} - char* NativeSymbolResolver::LookupSymbolName(uintptr_t pc, uintptr_t* start) { Dl_info info; int r = dladdr(reinterpret_cast(pc), &info); @@ -41,12 +39,10 @@ char* NativeSymbolResolver::LookupSymbolName(uintptr_t pc, uintptr_t* start) { return strdup(info.dli_sname); } - void NativeSymbolResolver::FreeSymbolName(char* name) { free(name); } - bool NativeSymbolResolver::LookupSharedObject(uword pc, uword* dso_base, char** dso_name) { diff --git a/runtime/vm/native_symbol_linux.cc b/runtime/vm/native_symbol_linux.cc index 4afcb4b716b..e1fc90fbca9 100644 --- a/runtime/vm/native_symbol_linux.cc +++ b/runtime/vm/native_symbol_linux.cc @@ -15,10 +15,8 @@ namespace dart { void NativeSymbolResolver::InitOnce() {} - void NativeSymbolResolver::ShutdownOnce() {} - char* NativeSymbolResolver::LookupSymbolName(uintptr_t pc, uintptr_t* start) { Dl_info info; int r = dladdr(reinterpret_cast(pc), &info); @@ -41,12 +39,10 @@ char* NativeSymbolResolver::LookupSymbolName(uintptr_t pc, uintptr_t* start) { return strdup(info.dli_sname); } - void NativeSymbolResolver::FreeSymbolName(char* name) { free(name); } - bool NativeSymbolResolver::LookupSharedObject(uword pc, uword* dso_base, char** dso_name) { diff --git a/runtime/vm/native_symbol_macos.cc b/runtime/vm/native_symbol_macos.cc index 6c6c4db46d3..e8ca487e838 100644 --- a/runtime/vm/native_symbol_macos.cc +++ b/runtime/vm/native_symbol_macos.cc @@ -14,10 +14,8 @@ namespace dart { void NativeSymbolResolver::InitOnce() {} - void NativeSymbolResolver::ShutdownOnce() {} - char* NativeSymbolResolver::LookupSymbolName(uintptr_t pc, uintptr_t* start) { Dl_info info; int r = dladdr(reinterpret_cast(pc), &info); @@ -38,12 +36,10 @@ char* NativeSymbolResolver::LookupSymbolName(uintptr_t pc, uintptr_t* start) { return strdup(info.dli_sname); } - void NativeSymbolResolver::FreeSymbolName(char* name) { free(name); } - bool NativeSymbolResolver::LookupSharedObject(uword pc, uword* dso_base, char** dso_name) { diff --git a/runtime/vm/native_symbol_win.cc b/runtime/vm/native_symbol_win.cc index 80cf3e0c290..d1f65c7aa18 100644 --- a/runtime/vm/native_symbol_win.cc +++ b/runtime/vm/native_symbol_win.cc @@ -29,7 +29,6 @@ void NativeSymbolResolver::InitOnce() { } } - void NativeSymbolResolver::ShutdownOnce() { MutexLocker lock(lock_); if (!running_) { @@ -43,7 +42,6 @@ void NativeSymbolResolver::ShutdownOnce() { } } - char* NativeSymbolResolver::LookupSymbolName(uintptr_t pc, uintptr_t* start) { static const intptr_t kMaxNameLength = 2048; static const intptr_t kSymbolInfoSize = sizeof(SYMBOL_INFO); // NOLINT. @@ -73,12 +71,10 @@ char* NativeSymbolResolver::LookupSymbolName(uintptr_t pc, uintptr_t* start) { return strdup(pSymbol->Name); } - void NativeSymbolResolver::FreeSymbolName(char* name) { free(name); } - bool NativeSymbolResolver::LookupSharedObject(uword pc, uword* dso_base, char** dso_name) { diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc index 6f5f9df86d8..339ade7e8fc 100644 --- a/runtime/vm/object.cc +++ b/runtime/vm/object.cc @@ -8,13 +8,13 @@ #include "platform/assert.h" #include "vm/assembler.h" #include "vm/become.h" -#include "vm/cpu.h" #include "vm/bit_vector.h" #include "vm/bootstrap.h" #include "vm/class_finalizer.h" #include "vm/code_observers.h" #include "vm/compiler.h" #include "vm/compiler_stats.h" +#include "vm/cpu.h" #include "vm/dart.h" #include "vm/dart_api_state.h" #include "vm/dart_entry.h" @@ -92,7 +92,6 @@ static const intptr_t kGetterPrefixLength = strlen(kGetterPrefix); static const char* const kSetterPrefix = "set:"; static const intptr_t kSetterPrefixLength = strlen(kSetterPrefix); - // A cache of VM heap allocated preinitialized empty ic data entry arrays. RawArray* ICData::cached_icdata_arrays_[kCachedICDataArrayCount]; @@ -183,10 +182,8 @@ RawClass* Object::unhandled_exception_class_ = reinterpret_cast(RAW_NULL); RawClass* Object::unwind_error_class_ = reinterpret_cast(RAW_NULL); - const double MegamorphicCache::kLoadFactor = 0.50; - static void AppendSubString(Zone* zone, GrowableArray* segments, const char* name, @@ -198,7 +195,6 @@ static void AppendSubString(Zone* zone, segments->Add(segment); } - static const char* MergeSubStrings(Zone* zone, const GrowableArray& segments, intptr_t alloc_len) { @@ -215,7 +211,6 @@ static const char* MergeSubStrings(Zone* zone, return result; } - // Remove private keys, but retain getter/setter/constructor/mixin manglings. RawString* String::RemovePrivateKey(const String& name) { ASSERT(name.IsOneByteString()); @@ -237,7 +232,6 @@ RawString* String::RemovePrivateKey(const String& name) { return String::FromLatin1(without_key.data(), without_key.length()); } - // Takes a vm internal name and makes it suitable for external user. // // Examples: @@ -371,7 +365,6 @@ RawString* String::ScrubName(const String& name) { return Symbols::New(thread, unmangled_name); } - RawString* String::ScrubNameRetainPrivate(const String& name) { #if !defined(DART_PRECOMPILED_RUNTIME) intptr_t len = name.Length(); @@ -420,7 +413,6 @@ RawString* String::ScrubNameRetainPrivate(const String& name) { return name.raw(); // In AOT, return argument unchanged. } - template static bool IsSpecialCharacter(type value) { return ((value == '"') || (value == '\n') || (value == '\f') || @@ -428,17 +420,14 @@ static bool IsSpecialCharacter(type value) { (value == '\r') || (value == '\\') || (value == '$')); } - static inline bool IsAsciiNonprintable(int32_t c) { return ((0 <= c) && (c < 32)) || (c == 127); } - static inline bool NeedsEscapeSequence(int32_t c) { return (c == '"') || (c == '\\') || (c == '$') || IsAsciiNonprintable(c); } - static int32_t EscapeOverhead(int32_t c) { if (IsSpecialCharacter(c)) { return 1; // 1 additional byte for the backslash. @@ -448,7 +437,6 @@ static int32_t EscapeOverhead(int32_t c) { return 0; } - template static type SpecialCharacter(type value) { if (value == '"') { @@ -474,7 +462,6 @@ static type SpecialCharacter(type value) { return '\0'; } - void Object::InitNull(Isolate* isolate) { // Should only be run by the vm isolate. ASSERT(isolate == Dart::vm_isolate()); @@ -495,7 +482,6 @@ void Object::InitNull(Isolate* isolate) { } } - void Object::InitOnce(Isolate* isolate) { // Should only be run by the vm isolate. ASSERT(isolate == Dart::vm_isolate()); @@ -990,7 +976,6 @@ void Object::InitOnce(Isolate* isolate) { ASSERT(vm_isolate_snapshot_object_table_->IsArray()); } - // An object visitor which will mark all visited objects. This is used to // premark all objects in the vm_isolate_ heap. Also precalculates hash // codes so that we can get the identity hash code of objects in the read- @@ -1043,7 +1028,6 @@ class FinalizeVMIsolateVisitor : public ObjectVisitor { #endif }; - #define SET_CLASS_NAME(class_name, name) \ cls = class_name##_class(); \ cls.set_name(Symbols::name()); @@ -1063,7 +1047,6 @@ void Object::FinalizeVMIsolate(Isolate* isolate) { ASSERT(!extractor_parameter_names_->IsSmi()); ASSERT(extractor_parameter_names_->IsArray()); - // Set up names for all VM singleton classes. Class& cls = Class::Handle(); @@ -1128,13 +1111,11 @@ void Object::FinalizeVMIsolate(Isolate* isolate) { } } - void Object::set_vm_isolate_snapshot_object_table(const Array& table) { ASSERT(Isolate::Current() == Dart::vm_isolate()); *vm_isolate_snapshot_object_table_ = table.raw(); } - // Make unused space in an object whose type has been transformed safe // for traversing during GC. // The unused part of the transformed object is marked as an TypedDataInt8Array @@ -1186,7 +1167,6 @@ void Object::MakeUnusedSpaceTraversable(const Object& obj, } } - void Object::VerifyBuiltinVtables() { #if defined(DEBUG) Thread* thread = Thread::Current(); @@ -1203,7 +1183,6 @@ void Object::VerifyBuiltinVtables() { #endif } - void Object::RegisterClass(const Class& cls, const String& name, const Library& lib) { @@ -1213,7 +1192,6 @@ void Object::RegisterClass(const Class& cls, lib.AddClass(cls); } - void Object::RegisterPrivateClass(const Class& cls, const String& public_class_name, const Library& lib) { @@ -1225,7 +1203,6 @@ void Object::RegisterPrivateClass(const Class& cls, lib.AddClass(cls); } - // Initialize a new isolate from source or from a snapshot. // // There are three possibilities: @@ -1867,7 +1844,6 @@ RawError* Object::Init(Isolate* isolate, kernel::Program* kernel_program) { return Error::null(); } - #if defined(DEBUG) bool Object::InVMHeap() const { if (FLAG_verify_handles && raw()->IsVMHeapObject()) { @@ -1878,17 +1854,14 @@ bool Object::InVMHeap() const { } #endif // DEBUG - void Object::Print() const { THR_Print("%s\n", ToCString()); } - RawString* Object::DictionaryName() const { return String::null(); } - void Object::InitializeObject(uword address, intptr_t class_id, intptr_t size, @@ -1914,7 +1887,6 @@ void Object::InitializeObject(uword address, ASSERT(is_vm_object == RawObject::IsVMHeapObject(tags)); } - void Object::CheckHandle() const { #if defined(DEBUG) if (raw_ != Object::null()) { @@ -1938,7 +1910,6 @@ void Object::CheckHandle() const { #endif } - RawObject* Object::Allocate(intptr_t cls_id, intptr_t size, Heap::Space space) { ASSERT(Utils::IsAligned(size, kObjectAlignment)); Thread* thread = Thread::Current(); @@ -1976,7 +1947,6 @@ RawObject* Object::Allocate(intptr_t cls_id, intptr_t size, Heap::Space space) { return raw_obj; } - class StoreBufferUpdateVisitor : public ObjectPointerVisitor { public: explicit StoreBufferUpdateVisitor(Thread* thread, RawObject* obj) @@ -2005,17 +1975,14 @@ class StoreBufferUpdateVisitor : public ObjectPointerVisitor { DISALLOW_COPY_AND_ASSIGN(StoreBufferUpdateVisitor); }; - bool Object::IsReadOnlyHandle() const { return Dart::IsReadOnlyHandle(reinterpret_cast(this)); } - bool Object::IsNotTemporaryScopedHandle() const { return (IsZoneHandle() || IsReadOnlyHandle()); } - RawObject* Object::Clone(const Object& orig, Heap::Space space) { const Class& cls = Class::Handle(orig.clazz()); intptr_t size = orig.raw()->Size(); @@ -2044,17 +2011,14 @@ RawObject* Object::Clone(const Object& orig, Heap::Space space) { return raw_clone; } - RawString* Class::Name() const { return raw_ptr()->name_; } - RawString* Class::ScrubbedName() const { return String::ScrubName(String::Handle(Name())); } - RawString* Class::UserVisibleName() const { #if !defined(PRODUCT) ASSERT(raw_ptr()->user_name_ != String::null()); @@ -2063,20 +2027,17 @@ RawString* Class::UserVisibleName() const { return GenerateUserVisibleName(); // No caching in PRODUCT, regenerate. } - bool Class::IsInFullSnapshot() const { NoSafepointScope no_safepoint; return raw_ptr()->library_->ptr()->is_in_fullsnapshot_; } - RawAbstractType* Class::RareType() const { const Type& type = Type::Handle(Type::New( *this, Object::null_type_arguments(), TokenPosition::kNoSource)); return ClassFinalizer::FinalizeType(*this, type); } - RawAbstractType* Class::DeclarationType() const { const TypeArguments& args = TypeArguments::Handle(type_parameters()); const Type& type = @@ -2084,7 +2045,6 @@ RawAbstractType* Class::DeclarationType() const { return ClassFinalizer::FinalizeType(*this, type); } - template RawClass* Class::New() { ASSERT(Object::class_class() != Class::null()); @@ -2121,7 +2081,6 @@ RawClass* Class::New() { return result.raw(); } - static void ReportTooManyTypeArguments(const Class& cls) { Report::MessageF(Report::kError, Script::Handle(cls.script()), cls.token_pos(), Report::AtLocation, @@ -2131,7 +2090,6 @@ static void ReportTooManyTypeArguments(const Class& cls) { UNREACHABLE(); } - void Class::set_num_type_arguments(intptr_t value) const { if (!Utils::IsInt(16, value)) { ReportTooManyTypeArguments(*this); @@ -2139,7 +2097,6 @@ void Class::set_num_type_arguments(intptr_t value) const { StoreNonPointer(&raw_ptr()->num_type_arguments_, value); } - void Class::set_num_own_type_arguments(intptr_t value) const { if (!Utils::IsInt(16, value)) { ReportTooManyTypeArguments(*this); @@ -2147,7 +2104,6 @@ void Class::set_num_own_type_arguments(intptr_t value) const { StoreNonPointer(&raw_ptr()->num_own_type_arguments_, value); } - // Initialize class fields of type Array with empty array. void Class::InitEmptyFields() { if (Object::empty_array().raw() == Array::null()) { @@ -2162,7 +2118,6 @@ void Class::InitEmptyFields() { Object::empty_array().raw()); } - RawArray* Class::OffsetToFieldMap(bool original_classes) const { Array& array = Array::Handle(raw_ptr()->offset_in_words_to_field_); if (array.IsNull()) { @@ -2187,7 +2142,6 @@ RawArray* Class::OffsetToFieldMap(bool original_classes) const { return array.raw(); } - bool Class::HasInstanceFields() const { const Array& field_array = Array::Handle(fields()); Field& field = Field::Handle(); @@ -2200,7 +2154,6 @@ bool Class::HasInstanceFields() const { return false; } - class FunctionName { public: FunctionName(const String& name, String* tmp_string) @@ -2220,7 +2173,6 @@ class FunctionName { String* tmp_string_; }; - // Traits for looking up Functions by name. class ClassFunctionsTraits { public: @@ -2243,7 +2195,6 @@ class ClassFunctionsTraits { }; typedef UnorderedHashSet ClassFunctionsSet; - void Class::SetFunctions(const Array& value) const { ASSERT(Thread::Current()->IsMutatorThread()); ASSERT(!value.IsNull()); @@ -2264,7 +2215,6 @@ void Class::SetFunctions(const Array& value) const { } } - void Class::AddFunction(const Function& function) const { ASSERT(Thread::Current()->IsMutatorThread()); const Array& arr = Array::Handle(functions()); @@ -2284,7 +2234,6 @@ void Class::AddFunction(const Function& function) const { } } - void Class::RemoveFunction(const Function& function) const { ASSERT(Thread::Current()->IsMutatorThread()); const Array& arr = Array::Handle(functions()); @@ -2299,7 +2248,6 @@ void Class::RemoveFunction(const Function& function) const { } } - RawFunction* Class::FunctionFromIndex(intptr_t idx) const { const Array& funcs = Array::Handle(functions()); if ((idx < 0) || (idx >= funcs.Length())) { @@ -2311,7 +2259,6 @@ RawFunction* Class::FunctionFromIndex(intptr_t idx) const { return func.raw(); } - RawFunction* Class::ImplicitClosureFunctionFromIndex(intptr_t idx) const { const Array& funcs = Array::Handle(functions()); if ((idx < 0) || (idx >= funcs.Length())) { @@ -2329,7 +2276,6 @@ RawFunction* Class::ImplicitClosureFunctionFromIndex(intptr_t idx) const { return closure_func.raw(); } - intptr_t Class::FindImplicitClosureFunctionIndex(const Function& needle) const { Thread* thread = Thread::Current(); if (EnsureIsFinalized(thread) != Error::null()) { @@ -2358,7 +2304,6 @@ intptr_t Class::FindImplicitClosureFunctionIndex(const Function& needle) const { return -1; } - intptr_t Class::FindInvocationDispatcherFunctionIndex( const Function& needle) const { Thread* thread = Thread::Current(); @@ -2386,7 +2331,6 @@ intptr_t Class::FindInvocationDispatcherFunctionIndex( return -1; } - RawFunction* Class::InvocationDispatcherFunctionFromIndex(intptr_t idx) const { Thread* thread = Thread::Current(); REUSABLE_ARRAY_HANDLESCOPE(thread); @@ -2401,28 +2345,23 @@ RawFunction* Class::InvocationDispatcherFunctionFromIndex(intptr_t idx) const { return Function::Cast(object).raw(); } - void Class::set_signature_function(const Function& value) const { ASSERT(value.IsClosureFunction() || value.IsSignatureFunction()); StorePointer(&raw_ptr()->signature_function_, value.raw()); } - void Class::set_state_bits(intptr_t bits) const { StoreNonPointer(&raw_ptr()->state_bits_, static_cast(bits)); } - void Class::set_library(const Library& value) const { StorePointer(&raw_ptr()->library_, value.raw()); } - void Class::set_type_parameters(const TypeArguments& value) const { StorePointer(&raw_ptr()->type_parameters_, value.raw()); } - intptr_t Class::NumTypeParameters(Thread* thread) const { if (IsMixinApplication() && !is_mixin_type_applied()) { ClassFinalizer::ApplyMixinType(*this); @@ -2441,7 +2380,6 @@ intptr_t Class::NumTypeParameters(Thread* thread) const { return type_params.Length(); } - intptr_t Class::NumOwnTypeArguments() const { // Return cached value if already calculated. if (num_own_type_arguments() != kUnknownNumTypeArguments) { @@ -2515,7 +2453,6 @@ intptr_t Class::NumOwnTypeArguments() const { return num_type_params; } - intptr_t Class::NumTypeArguments() const { // Return cached value if already calculated. if (num_type_arguments() != kUnknownNumTypeArguments) { @@ -2552,7 +2489,6 @@ intptr_t Class::NumTypeArguments() const { return num_type_args; } - RawClass* Class::SuperClass(bool original_classes) const { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -2569,14 +2505,12 @@ RawClass* Class::SuperClass(bool original_classes) const { } } - void Class::set_super_type(const AbstractType& value) const { ASSERT(value.IsNull() || (value.IsType() && !value.IsDynamicType()) || value.IsMixinAppType()); StorePointer(&raw_ptr()->super_type_, value.raw()); } - RawTypeParameter* Class::LookupTypeParameter(const String& type_name) const { ASSERT(!type_name.IsNull()); Thread* thread = Thread::Current(); @@ -2601,7 +2535,6 @@ RawTypeParameter* Class::LookupTypeParameter(const String& type_name) const { return TypeParameter::null(); } - void Class::CalculateFieldOffsets() const { Array& flds = Array::Handle(fields()); const Class& super = Class::Handle(SuperClass()); @@ -2649,7 +2582,6 @@ void Class::CalculateFieldOffsets() const { set_next_field_offset(offset); } - RawFunction* Class::GetInvocationDispatcher(const String& target_name, const Array& args_desc, RawFunction::Kind kind, @@ -2695,7 +2627,6 @@ RawFunction* Class::GetInvocationDispatcher(const String& target_name, return dispatcher.raw(); } - RawFunction* Class::CreateInvocationDispatcher(const String& target_name, const Array& args_desc, RawFunction::Kind kind) const { @@ -2754,7 +2685,6 @@ RawFunction* Class::CreateInvocationDispatcher(const String& target_name, return invocation.raw(); } - // Method extractors are used to create implicit closures from methods. // When an expression obj.M is evaluated for the first time and receiver obj // does not have a getter called M but has a method called M then an extractor @@ -2797,7 +2727,6 @@ RawFunction* Function::CreateMethodExtractor(const String& getter_name) const { return extractor.raw(); } - RawFunction* Function::GetMethodExtractor(const String& getter_name) const { ASSERT(Field::IsGetterName(getter_name)); const Function& closure_function = @@ -2811,17 +2740,14 @@ RawFunction* Function::GetMethodExtractor(const String& getter_name) const { return result.raw(); } - RawArray* Class::invocation_dispatcher_cache() const { return raw_ptr()->invocation_dispatcher_cache_; } - void Class::set_invocation_dispatcher_cache(const Array& cache) const { StorePointer(&raw_ptr()->invocation_dispatcher_cache_, cache.raw()); } - void Class::Finalize() const { ASSERT(Thread::Current()->IsMutatorThread()); ASSERT(!Isolate::Current()->all_classes_finalized()); @@ -2835,7 +2761,6 @@ void Class::Finalize() const { set_is_finalized(); } - class CHACodeArray : public WeakCodeReferences { public: explicit CHACodeArray(const Class& cls) @@ -2869,7 +2794,6 @@ class CHACodeArray : public WeakCodeReferences { DISALLOW_COPY_AND_ASSIGN(CHACodeArray); }; - #if defined(DEBUG) static bool IsMutatorOrAtSafepoint() { Thread* thread = Thread::Current(); @@ -2877,7 +2801,6 @@ static bool IsMutatorOrAtSafepoint() { } #endif - void Class::RegisterCHACode(const Code& code) { if (FLAG_trace_cha) { THR_Print("RegisterCHACode '%s' depends on class '%s'\n", @@ -2890,7 +2813,6 @@ void Class::RegisterCHACode(const Code& code) { a.Register(code); } - void Class::DisableCHAOptimizedCode(const Class& subclass) { ASSERT(Thread::Current()->IsMutatorThread()); CHACodeArray a(*this); @@ -2900,12 +2822,10 @@ void Class::DisableCHAOptimizedCode(const Class& subclass) { a.DisableCode(); } - void Class::DisableAllCHAOptimizedCode() { DisableCHAOptimizedCode(Class::Handle()); } - bool Class::TraceAllocation(Isolate* isolate) const { #ifndef PRODUCT ClassTable* class_table = isolate->class_table(); @@ -2915,7 +2835,6 @@ bool Class::TraceAllocation(Isolate* isolate) const { #endif } - void Class::SetTraceAllocation(bool trace_allocation) const { #ifndef PRODUCT Isolate* isolate = Isolate::Current(); @@ -2930,7 +2849,6 @@ void Class::SetTraceAllocation(bool trace_allocation) const { #endif } - bool Class::ValidatePostFinalizePatch(const Class& orig_class, Error* error) const { ASSERT(error != NULL); @@ -2992,12 +2910,10 @@ bool Class::ValidatePostFinalizePatch(const Class& orig_class, return true; } - void Class::set_dependent_code(const Array& array) const { StorePointer(&raw_ptr()->dependent_code_, array.raw()); } - // Apply the members from the patch class to the original class. bool Class::ApplyPatch(const Class& patch, Error* error) const { ASSERT(error != NULL); @@ -3111,7 +3027,6 @@ bool Class::ApplyPatch(const Class& patch, Error* error) const { return true; } - static RawString* BuildClosureSource(const Array& formal_params, const String& expr) { const GrowableObjectArray& src_pieces = @@ -3133,7 +3048,6 @@ static RawString* BuildClosureSource(const Array& formal_params, return String::ConcatAll(Array::Handle(Array::MakeFixedLength(src_pieces))); } - RawFunction* Function::EvaluateHelper(const Class& cls, const String& expr, const Array& param_names, @@ -3160,7 +3074,6 @@ RawFunction* Function::EvaluateHelper(const Class& cls, return func.raw(); } - RawObject* Class::Evaluate(const String& expr, const Array& param_names, const Array& param_values) const { @@ -3179,7 +3092,6 @@ RawObject* Class::Evaluate(const String& expr, return result.raw(); } - // Ensure that top level parsing of the class has been done. RawError* Class::EnsureIsFinalized(Thread* thread) const { // Finalized classes have already been parsed. @@ -3204,7 +3116,6 @@ RawError* Class::EnsureIsFinalized(Thread* thread) const { return error.raw(); } - void Class::SetFields(const Array& value) const { ASSERT(!value.IsNull()); #if defined(DEBUG) @@ -3221,7 +3132,6 @@ void Class::SetFields(const Array& value) const { StorePointer(&raw_ptr()->fields_, value.raw()); } - void Class::AddField(const Field& field) const { const Array& arr = Array::Handle(fields()); const Array& new_arr = Array::Handle(Array::Grow(arr, arr.Length() + 1)); @@ -3229,7 +3139,6 @@ void Class::AddField(const Field& field) const { SetFields(new_arr); } - void Class::AddFields(const GrowableArray& new_fields) const { const intptr_t num_new_fields = new_fields.length(); if (num_new_fields == 0) return; @@ -3243,7 +3152,6 @@ void Class::AddFields(const GrowableArray& new_fields) const { SetFields(new_arr); } - void Class::InjectCIDFields() const { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -3269,7 +3177,6 @@ void Class::InjectCIDFields() const { #undef CLASS_LIST_WITH_NULL } - template RawClass* Class::NewCommon(intptr_t index) { ASSERT(Object::class_class() != Class::null()); @@ -3296,7 +3203,6 @@ RawClass* Class::NewCommon(intptr_t index) { return result.raw(); } - template RawClass* Class::New(intptr_t index) { Class& result = Class::Handle(NewCommon(index)); @@ -3304,7 +3210,6 @@ RawClass* Class::New(intptr_t index) { return result.raw(); } - RawClass* Class::New(const Library& lib, const String& name, const Script& script, @@ -3318,12 +3223,10 @@ RawClass* Class::New(const Library& lib, return result.raw(); } - RawClass* Class::NewInstanceClass() { return Class::New(kIllegalCid); } - RawClass* Class::NewNativeWrapper(const Library& library, const String& name, int field_count) { @@ -3351,7 +3254,6 @@ RawClass* Class::NewNativeWrapper(const Library& library, } } - RawClass* Class::NewStringClass(intptr_t class_id) { intptr_t instance_size; if (class_id == kOneByteStringCid) { @@ -3371,7 +3273,6 @@ RawClass* Class::NewStringClass(intptr_t class_id) { return result.raw(); } - RawClass* Class::NewTypedDataClass(intptr_t class_id) { ASSERT(RawObject::IsTypedDataClassId(class_id)); intptr_t instance_size = TypedData::InstanceSize(); @@ -3382,7 +3283,6 @@ RawClass* Class::NewTypedDataClass(intptr_t class_id) { return result.raw(); } - RawClass* Class::NewTypedDataViewClass(intptr_t class_id) { ASSERT(RawObject::IsTypedDataViewClassId(class_id)); Class& result = Class::Handle(New(class_id)); @@ -3391,7 +3291,6 @@ RawClass* Class::NewTypedDataViewClass(intptr_t class_id) { return result.raw(); } - RawClass* Class::NewExternalTypedDataClass(intptr_t class_id) { ASSERT(RawObject::IsExternalTypedDataClassId(class_id)); intptr_t instance_size = ExternalTypedData::InstanceSize(); @@ -3402,7 +3301,6 @@ RawClass* Class::NewExternalTypedDataClass(intptr_t class_id) { return result.raw(); } - void Class::set_name(const String& value) const { ASSERT(raw_ptr()->name_ == String::null()); ASSERT(value.IsSymbol()); @@ -3418,14 +3316,12 @@ void Class::set_name(const String& value) const { #endif // !defined(PRODUCT) } - #if !defined(PRODUCT) void Class::set_user_name(const String& value) const { StorePointer(&raw_ptr()->user_name_, value.raw()); } #endif // !defined(PRODUCT) - RawString* Class::GenerateUserVisibleName() const { if (FLAG_show_internal_names) { return Name(); @@ -3573,18 +3469,15 @@ RawString* Class::GenerateUserVisibleName() const { return String::ScrubName(name); } - void Class::set_script(const Script& value) const { StorePointer(&raw_ptr()->script_, value.raw()); } - void Class::set_token_pos(TokenPosition token_pos) const { ASSERT(!token_pos.IsClassifying()); StoreNonPointer(&raw_ptr()->token_pos_, token_pos); } - TokenPosition Class::ComputeEndTokenPos() const { // Return the begin token for synthetic classes. if (is_synthesized_class() || IsMixinApplication() || IsTopLevel()) { @@ -3636,75 +3529,61 @@ TokenPosition Class::ComputeEndTokenPos() const { return TokenPosition::kNoSource; } - void Class::set_is_implemented() const { set_state_bits(ImplementedBit::update(true, raw_ptr()->state_bits_)); } - void Class::set_is_abstract() const { set_state_bits(AbstractBit::update(true, raw_ptr()->state_bits_)); } - void Class::set_is_type_finalized() const { set_state_bits(TypeFinalizedBit::update(true, raw_ptr()->state_bits_)); } - void Class::set_is_patch() const { set_state_bits(PatchBit::update(true, raw_ptr()->state_bits_)); } - void Class::set_is_synthesized_class() const { set_state_bits(SynthesizedClassBit::update(true, raw_ptr()->state_bits_)); } - void Class::set_is_enum_class() const { set_state_bits(EnumBit::update(true, raw_ptr()->state_bits_)); } - void Class::set_is_const() const { set_state_bits(ConstBit::update(true, raw_ptr()->state_bits_)); } - void Class::set_is_mixin_app_alias() const { set_state_bits(MixinAppAliasBit::update(true, raw_ptr()->state_bits_)); } - void Class::set_is_mixin_type_applied() const { set_state_bits(MixinTypeAppliedBit::update(true, raw_ptr()->state_bits_)); } - void Class::set_is_fields_marked_nullable() const { set_state_bits(FieldsMarkedNullableBit::update(true, raw_ptr()->state_bits_)); } - void Class::set_is_cycle_free() const { ASSERT(!is_cycle_free()); set_state_bits(CycleFreeBit::update(true, raw_ptr()->state_bits_)); } - void Class::set_is_allocated(bool value) const { set_state_bits(IsAllocatedBit::update(value, raw_ptr()->state_bits_)); } - void Class::set_is_finalized() const { ASSERT(!is_finalized()); set_state_bits( ClassFinalizedBits::update(RawClass::kFinalized, raw_ptr()->state_bits_)); } - void Class::SetRefinalizeAfterPatch() const { ASSERT(!IsTopLevel()); set_state_bits(ClassFinalizedBits::update(RawClass::kRefinalizeAfterPatch, @@ -3712,7 +3591,6 @@ void Class::SetRefinalizeAfterPatch() const { set_state_bits(TypeFinalizedBit::update(false, raw_ptr()->state_bits_)); } - void Class::ResetFinalization() const { ASSERT(IsTopLevel() || IsClosureClass()); set_state_bits( @@ -3720,47 +3598,39 @@ void Class::ResetFinalization() const { set_state_bits(TypeFinalizedBit::update(false, raw_ptr()->state_bits_)); } - void Class::set_is_prefinalized() const { ASSERT(!is_finalized()); set_state_bits(ClassFinalizedBits::update(RawClass::kPreFinalized, raw_ptr()->state_bits_)); } - void Class::set_is_marked_for_parsing() const { set_state_bits(MarkedForParsingBit::update(true, raw_ptr()->state_bits_)); } - void Class::reset_is_marked_for_parsing() const { set_state_bits(MarkedForParsingBit::update(false, raw_ptr()->state_bits_)); } - void Class::set_interfaces(const Array& value) const { ASSERT(!value.IsNull()); StorePointer(&raw_ptr()->interfaces_, value.raw()); } - void Class::set_mixin(const Type& value) const { ASSERT(!value.IsNull()); StorePointer(&raw_ptr()->mixin_, value.raw()); } - bool Class::IsMixinApplication() const { return mixin() != Type::null(); } - RawClass* Class::GetPatchClass() const { const Library& lib = Library::Handle(library()); return lib.GetPatchClass(String::Handle(Name())); } - void Class::AddDirectSubclass(const Class& subclass) const { ASSERT(!subclass.IsNull()); ASSERT(subclass.SuperClass() == raw()); @@ -3781,12 +3651,10 @@ void Class::AddDirectSubclass(const Class& subclass) const { direct_subclasses.Add(subclass, Heap::kOld); } - void Class::ClearDirectSubclasses() const { StorePointer(&raw_ptr()->direct_subclasses_, GrowableObjectArray::null()); } - RawArray* Class::constants() const { return raw_ptr()->constants_; } @@ -3796,30 +3664,25 @@ void Class::set_constants(const Array& value) const { StorePointer(&raw_ptr()->constants_, value.raw()); } - RawType* Class::canonical_type() const { return raw_ptr()->canonical_type_; } - void Class::set_canonical_type(const Type& value) const { ASSERT(!value.IsNull() && value.IsCanonical() && value.IsOld()); StorePointer(&raw_ptr()->canonical_type_, value.raw()); } - RawType* Class::CanonicalType() const { return raw_ptr()->canonical_type_; } - void Class::SetCanonicalType(const Type& type) const { ASSERT((canonical_type() == Object::null()) || (canonical_type() == type.raw())); // Set during own finalization. set_canonical_type(type); } - void Class::set_allocation_stub(const Code& value) const { // Never clear the stub as it may still be a target, but will be GC-d if // not referenced. @@ -3828,7 +3691,6 @@ void Class::set_allocation_stub(const Code& value) const { StorePointer(&raw_ptr()->allocation_stub_, value.raw()); } - void Class::DisableAllocationStub() const { const Code& existing_stub = Code::Handle(allocation_stub()); if (existing_stub.IsNull()) { @@ -3841,12 +3703,10 @@ void Class::DisableAllocationStub() const { StorePointer(&raw_ptr()->allocation_stub_, Code::null()); } - bool Class::IsDartFunctionClass() const { return raw() == Type::Handle(Type::DartFunctionType()).type_class(); } - // If test_kind == kIsSubtypeOf, checks if type S is a subtype of type T. // If test_kind == kIsMoreSpecificThan, checks if S is more specific than T. // Type S is specified by this class parameterized with 'type_arguments', and @@ -3994,7 +3854,6 @@ bool Class::TypeTestNonRecursive(const Class& cls, return false; } - // If test_kind == kIsSubtypeOf, checks if type S is a subtype of type T. // If test_kind == kIsMoreSpecificThan, checks if S is more specific than T. // Type S is specified by this class parameterized with 'type_arguments', and @@ -4013,74 +3872,60 @@ bool Class::TypeTest(TypeTestKind test_kind, space); } - bool Class::IsTopLevel() const { return Name() == Symbols::TopLevel().raw(); } - bool Class::IsPrivate() const { return Library::IsPrivate(String::Handle(Name())); } - RawFunction* Class::LookupDynamicFunction(const String& name) const { return LookupFunction(name, kInstance); } - RawFunction* Class::LookupDynamicFunctionAllowAbstract( const String& name) const { return LookupFunction(name, kInstanceAllowAbstract); } - RawFunction* Class::LookupDynamicFunctionAllowPrivate( const String& name) const { return LookupFunctionAllowPrivate(name, kInstance); } - RawFunction* Class::LookupStaticFunction(const String& name) const { return LookupFunction(name, kStatic); } - RawFunction* Class::LookupStaticFunctionAllowPrivate(const String& name) const { return LookupFunctionAllowPrivate(name, kStatic); } - RawFunction* Class::LookupConstructor(const String& name) const { return LookupFunction(name, kConstructor); } - RawFunction* Class::LookupConstructorAllowPrivate(const String& name) const { return LookupFunctionAllowPrivate(name, kConstructor); } - RawFunction* Class::LookupFactory(const String& name) const { return LookupFunction(name, kFactory); } - RawFunction* Class::LookupFactoryAllowPrivate(const String& name) const { return LookupFunctionAllowPrivate(name, kFactory); } - RawFunction* Class::LookupFunction(const String& name) const { return LookupFunction(name, kAny); } - RawFunction* Class::LookupFunctionAllowPrivate(const String& name) const { return LookupFunctionAllowPrivate(name, kAny); } - RawFunction* Class::LookupCallFunctionForTypeTest() const { // If this class is not compiled yet, it is too early to lookup a call // function. This case should only occur during bounds checking at compile @@ -4106,7 +3951,6 @@ RawFunction* Class::LookupCallFunctionForTypeTest() const { return call_function.raw(); } - // Returns true if 'prefix' and 'accessor_name' match 'name'. static bool MatchesAccessorName(const String& name, const char* prefix, @@ -4131,7 +3975,6 @@ static bool MatchesAccessorName(const String& name, return true; } - RawFunction* Class::CheckFunctionType(const Function& func, MemberKind kind) { if ((kind == kInstance) || (kind == kInstanceAllowAbstract)) { if (func.IsDynamicFunction(kind == kInstanceAllowAbstract)) { @@ -4157,7 +4000,6 @@ RawFunction* Class::CheckFunctionType(const Function& func, MemberKind kind) { return Function::null(); } - RawFunction* Class::LookupFunction(const String& name, MemberKind kind) const { Thread* thread = Thread::Current(); if (EnsureIsFinalized(thread) != Error::null()) { @@ -4208,7 +4050,6 @@ RawFunction* Class::LookupFunction(const String& name, MemberKind kind) const { return Function::null(); } - RawFunction* Class::LookupFunctionAllowPrivate(const String& name, MemberKind kind) const { Thread* thread = Thread::Current(); @@ -4235,17 +4076,14 @@ RawFunction* Class::LookupFunctionAllowPrivate(const String& name, return Function::null(); } - RawFunction* Class::LookupGetterFunction(const String& name) const { return LookupAccessorFunction(kGetterPrefix, kGetterPrefixLength, name); } - RawFunction* Class::LookupSetterFunction(const String& name) const { return LookupAccessorFunction(kSetterPrefix, kSetterPrefixLength, name); } - RawFunction* Class::LookupAccessorFunction(const char* prefix, intptr_t prefix_length, const String& name) const { @@ -4273,22 +4111,18 @@ RawFunction* Class::LookupAccessorFunction(const char* prefix, return Function::null(); } - RawField* Class::LookupInstanceField(const String& name) const { return LookupField(name, kInstance); } - RawField* Class::LookupStaticField(const String& name) const { return LookupField(name, kStatic); } - RawField* Class::LookupField(const String& name) const { return LookupField(name, kAny); } - RawField* Class::LookupField(const String& name, MemberKind kind) const { Thread* thread = Thread::Current(); if (EnsureIsFinalized(thread) != Error::null()) { @@ -4335,7 +4169,6 @@ RawField* Class::LookupField(const String& name, MemberKind kind) const { return Field::null(); } - RawField* Class::LookupFieldAllowPrivate(const String& name, bool instance_only) const { // Use slow string compare, ignoring privacy name mangling. @@ -4366,7 +4199,6 @@ RawField* Class::LookupFieldAllowPrivate(const String& name, return Field::null(); } - RawField* Class::LookupInstanceFieldAllowPrivate(const String& name) const { Field& field = Field::Handle(LookupFieldAllowPrivate(name, true)); if (!field.IsNull() && !field.is_static()) { @@ -4375,7 +4207,6 @@ RawField* Class::LookupInstanceFieldAllowPrivate(const String& name) const { return Field::null(); } - RawField* Class::LookupStaticFieldAllowPrivate(const String& name) const { Field& field = Field::Handle(LookupFieldAllowPrivate(name)); if (!field.IsNull() && field.is_static()) { @@ -4384,7 +4215,6 @@ RawField* Class::LookupStaticFieldAllowPrivate(const String& name) const { return Field::null(); } - RawLibraryPrefix* Class::LookupLibraryPrefix(const String& name) const { Zone* zone = Thread::Current()->zone(); const Library& lib = Library::Handle(zone, library()); @@ -4395,7 +4225,6 @@ RawLibraryPrefix* Class::LookupLibraryPrefix(const String& name) const { return LibraryPrefix::null(); } - const char* Class::ToCString() const { const Library& lib = Library::Handle(library()); const char* library_name = lib.IsNull() ? "" : lib.ToCString(); @@ -4405,7 +4234,6 @@ const char* Class::ToCString() const { patch_prefix, class_name); } - // Returns an instance of Double or Double::null(). // 'index' points to either: // - constants_list_ position of found element, or @@ -4433,7 +4261,6 @@ RawDouble* Class::LookupCanonicalDouble(Zone* zone, return Double::null(); } - RawMint* Class::LookupCanonicalMint(Zone* zone, int64_t value, intptr_t* index) const { @@ -4457,7 +4284,6 @@ RawMint* Class::LookupCanonicalMint(Zone* zone, return Mint::null(); } - RawBigint* Class::LookupCanonicalBigint(Zone* zone, const Bigint& value, intptr_t* index) const { @@ -4481,7 +4307,6 @@ RawBigint* Class::LookupCanonicalBigint(Zone* zone, return Bigint::null(); } - class CanonicalInstanceKey { public: explicit CanonicalInstanceKey(const Instance& key) : key_(key) { @@ -4502,7 +4327,6 @@ class CanonicalInstanceKey { DISALLOW_ALLOCATION(); }; - // Traits for looking up Canonical Instances based on a hash of the fields. class CanonicalInstanceTraits { public: @@ -4530,7 +4354,6 @@ class CanonicalInstanceTraits { }; typedef UnorderedHashSet CanonicalInstancesSet; - RawInstance* Class::LookupCanonicalInstance(Zone* zone, const Instance& value) const { ASSERT(this->raw() == value.clazz()); @@ -4544,7 +4367,6 @@ RawInstance* Class::LookupCanonicalInstance(Zone* zone, return canonical_value.raw(); } - RawInstance* Class::InsertCanonicalConstant(Zone* zone, const Instance& constant) const { ASSERT(this->raw() == constant.clazz()); @@ -4563,7 +4385,6 @@ RawInstance* Class::InsertCanonicalConstant(Zone* zone, return canonical_value.raw(); } - void Class::InsertCanonicalNumber(Zone* zone, intptr_t index, const Number& constant) const { @@ -4578,7 +4399,6 @@ void Class::InsertCanonicalNumber(Zone* zone, canonical_list.SetAt(index, constant); } - void Class::RehashConstants(Zone* zone) const { intptr_t cid = id(); if ((cid == kMintCid) || (cid == kBigintCid) || (cid == kDoubleCid)) { @@ -4602,7 +4422,6 @@ void Class::RehashConstants(Zone* zone) const { set.Release(); } - RawUnresolvedClass* UnresolvedClass::New(const Object& library_prefix, const String& ident, TokenPosition token_pos) { @@ -4613,7 +4432,6 @@ RawUnresolvedClass* UnresolvedClass::New(const Object& library_prefix, return type.raw(); } - RawUnresolvedClass* UnresolvedClass::New() { ASSERT(Object::unresolved_class_class() != Class::null()); RawObject* raw = Object::Allocate( @@ -4621,24 +4439,20 @@ RawUnresolvedClass* UnresolvedClass::New() { return reinterpret_cast(raw); } - void UnresolvedClass::set_token_pos(TokenPosition token_pos) const { ASSERT(!token_pos.IsClassifying()); StoreNonPointer(&raw_ptr()->token_pos_, token_pos); } - void UnresolvedClass::set_ident(const String& ident) const { StorePointer(&raw_ptr()->ident_, ident.raw()); } - void UnresolvedClass::set_library_or_library_prefix( const Object& library_prefix) const { StorePointer(&raw_ptr()->library_or_library_prefix_, library_prefix.raw()); } - RawString* UnresolvedClass::Name() const { if (library_or_library_prefix() != Object::null()) { Thread* thread = Thread::Current(); @@ -4661,13 +4475,11 @@ RawString* UnresolvedClass::Name() const { } } - const char* UnresolvedClass::ToCString() const { const char* cname = String::Handle(Name()).ToCString(); return OS::SCreate(Thread::Current()->zone(), "unresolved class '%s'", cname); } - static uint32_t CombineHashes(uint32_t hash, uint32_t other_hash) { hash += other_hash; hash += hash << 10; @@ -4675,7 +4487,6 @@ static uint32_t CombineHashes(uint32_t hash, uint32_t other_hash) { return hash; } - static uint32_t FinalizeHash(uint32_t hash, intptr_t hashbits) { hash += hash << 3; hash ^= hash >> 11; // Logical shift, unsigned hash. @@ -4687,7 +4498,6 @@ static uint32_t FinalizeHash(uint32_t hash, intptr_t hashbits) { return (hash == 0) ? 1 : hash; } - intptr_t TypeArguments::ComputeHash() const { if (IsNull()) return 0; const intptr_t num_types = Length(); @@ -4705,7 +4515,6 @@ intptr_t TypeArguments::ComputeHash() const { return result; } - RawString* TypeArguments::SubvectorName(intptr_t from_index, intptr_t len, NameVisibility name_visibility) const { @@ -4731,7 +4540,6 @@ RawString* TypeArguments::SubvectorName(intptr_t from_index, return Symbols::FromConcatAll(thread, pieces); } - bool TypeArguments::IsSubvectorEquivalent(const TypeArguments& other, intptr_t from_index, intptr_t len, @@ -4758,7 +4566,6 @@ bool TypeArguments::IsSubvectorEquivalent(const TypeArguments& other, return true; } - bool TypeArguments::IsRecursive() const { if (IsNull()) return false; const intptr_t num_types = Length(); @@ -4776,7 +4583,6 @@ bool TypeArguments::IsRecursive() const { return false; } - bool TypeArguments::IsDynamicTypes(bool raw_instantiated, intptr_t from_index, intptr_t len) const { @@ -4804,7 +4610,6 @@ bool TypeArguments::IsDynamicTypes(bool raw_instantiated, return true; } - bool TypeArguments::TypeTest(TypeTestKind test_kind, const TypeArguments& other, intptr_t from_index, @@ -4829,14 +4634,12 @@ bool TypeArguments::TypeTest(TypeTestKind test_kind, return true; } - bool TypeArguments::HasInstantiations() const { const Array& prior_instantiations = Array::Handle(instantiations()); ASSERT(prior_instantiations.Length() > 0); // Always at least a sentinel. return prior_instantiations.Length() > 1; } - intptr_t TypeArguments::NumInstantiations() const { const Array& prior_instantiations = Array::Handle(instantiations()); ASSERT(prior_instantiations.Length() > 0); // Always at least a sentinel. @@ -4849,18 +4652,15 @@ intptr_t TypeArguments::NumInstantiations() const { return num; } - RawArray* TypeArguments::instantiations() const { return raw_ptr()->instantiations_; } - void TypeArguments::set_instantiations(const Array& value) const { ASSERT(!value.IsNull()); StorePointer(&raw_ptr()->instantiations_, value.raw()); } - intptr_t TypeArguments::Length() const { if (IsNull()) { return 0; @@ -4868,18 +4668,15 @@ intptr_t TypeArguments::Length() const { return Smi::Value(raw_ptr()->length_); } - RawAbstractType* TypeArguments::TypeAt(intptr_t index) const { return *TypeAddr(index); } - void TypeArguments::SetTypeAt(intptr_t index, const AbstractType& value) const { ASSERT(!IsCanonical()); StorePointer(TypeAddr(index), value.raw()); } - bool TypeArguments::IsResolved() const { if (IsCanonical()) { return true; @@ -4895,7 +4692,6 @@ bool TypeArguments::IsResolved() const { return true; } - bool TypeArguments::IsSubvectorInstantiated(intptr_t from_index, intptr_t len, Genericity genericity, @@ -4919,7 +4715,6 @@ bool TypeArguments::IsSubvectorInstantiated(intptr_t from_index, return true; } - bool TypeArguments::IsUninstantiatedIdentity() const { AbstractType& type = AbstractType::Handle(); const intptr_t num_types = Length(); @@ -4955,7 +4750,6 @@ bool TypeArguments::IsUninstantiatedIdentity() const { // many different type parameters as it is long. } - // Return true if this uninstantiated type argument vector, once instantiated // at runtime, is a prefix of the type argument vector of its instantiator. bool TypeArguments::CanShareInstantiatorTypeArguments( @@ -5024,7 +4818,6 @@ bool TypeArguments::CanShareInstantiatorTypeArguments( return true; } - bool TypeArguments::IsFinalized() const { ASSERT(!IsNull()); AbstractType& type = AbstractType::Handle(); @@ -5038,7 +4831,6 @@ bool TypeArguments::IsFinalized() const { return true; } - bool TypeArguments::IsBounded() const { AbstractType& type = AbstractType::Handle(); const intptr_t num_types = Length(); @@ -5064,7 +4856,6 @@ bool TypeArguments::IsBounded() const { return false; } - RawTypeArguments* TypeArguments::InstantiateFrom( const TypeArguments& instantiator_type_arguments, const TypeArguments& function_type_arguments, @@ -5099,7 +4890,6 @@ RawTypeArguments* TypeArguments::InstantiateFrom( return instantiated_array.raw(); } - RawTypeArguments* TypeArguments::InstantiateAndCanonicalizeFrom( const TypeArguments& instantiator_type_arguments, const TypeArguments& function_type_arguments, @@ -5163,7 +4953,6 @@ RawTypeArguments* TypeArguments::InstantiateAndCanonicalizeFrom( return result.raw(); } - RawTypeArguments* TypeArguments::New(intptr_t len, Heap::Space space) { if (len < 0 || len > kMaxElements) { // This should be caught before we reach here. @@ -5186,13 +4975,11 @@ RawTypeArguments* TypeArguments::New(intptr_t len, Heap::Space space) { return result.raw(); } - RawAbstractType* const* TypeArguments::TypeAddr(intptr_t index) const { ASSERT((index >= 0) && (index < Length())); return &raw_ptr()->types()[index]; } - void TypeArguments::SetLength(intptr_t value) const { ASSERT(!IsCanonical()); // This is only safe because we create a new Smi, which does not cause @@ -5200,7 +4987,6 @@ void TypeArguments::SetLength(intptr_t value) const { StoreSmi(&raw_ptr()->length_, Smi::New(value)); } - RawTypeArguments* TypeArguments::CloneUnfinalized() const { if (IsNull() || IsFinalized()) { return raw(); @@ -5219,7 +5005,6 @@ RawTypeArguments* TypeArguments::CloneUnfinalized() const { return clone.raw(); } - RawTypeArguments* TypeArguments::CloneUninstantiated(const Class& new_owner, TrailPtr trail) const { ASSERT(!IsNull()); @@ -5240,7 +5025,6 @@ RawTypeArguments* TypeArguments::CloneUninstantiated(const Class& new_owner, return clone.raw(); } - RawTypeArguments* TypeArguments::Canonicalize(TrailPtr trail) const { if (IsNull() || IsCanonical()) { ASSERT(IsOld()); @@ -5309,7 +5093,6 @@ RawTypeArguments* TypeArguments::Canonicalize(TrailPtr trail) const { return result.raw(); } - RawString* TypeArguments::EnumerateURIs() const { if (IsNull()) { return Symbols::Empty().raw(); @@ -5326,7 +5109,6 @@ RawString* TypeArguments::EnumerateURIs() const { return String::ConcatAll(pieces); } - const char* TypeArguments::ToCString() const { if (IsNull()) { return "TypeArguments: null"; @@ -5343,14 +5125,12 @@ const char* TypeArguments::ToCString() const { return prev_cstr; } - const char* PatchClass::ToCString() const { const Class& cls = Class::Handle(patched_class()); const char* cls_name = cls.ToCString(); return OS::SCreate(Thread::Current()->zone(), "PatchClass for %s", cls_name); } - RawPatchClass* PatchClass::New(const Class& patched_class, const Class& origin_class) { const PatchClass& result = PatchClass::Handle(PatchClass::New()); @@ -5360,7 +5140,6 @@ RawPatchClass* PatchClass::New(const Class& patched_class, return result.raw(); } - RawPatchClass* PatchClass::New(const Class& patched_class, const Script& script) { const PatchClass& result = PatchClass::Handle(PatchClass::New()); @@ -5370,7 +5149,6 @@ RawPatchClass* PatchClass::New(const Class& patched_class, return result.raw(); } - RawPatchClass* PatchClass::New() { ASSERT(Object::patch_class_class() != Class::null()); RawObject* raw = Object::Allocate(PatchClass::kClassId, @@ -5378,27 +5156,22 @@ RawPatchClass* PatchClass::New() { return reinterpret_cast(raw); } - void PatchClass::set_patched_class(const Class& value) const { StorePointer(&raw_ptr()->patched_class_, value.raw()); } - void PatchClass::set_origin_class(const Class& value) const { StorePointer(&raw_ptr()->origin_class_, value.raw()); } - void PatchClass::set_script(const Script& value) const { StorePointer(&raw_ptr()->script_, value.raw()); } - intptr_t Function::Hash() const { return String::HashRawSymbol(name()); } - bool Function::HasBreakpoint() const { if (!FLAG_support_debugger) { return false; @@ -5407,7 +5180,6 @@ bool Function::HasBreakpoint() const { return thread->isolate()->debugger()->HasBreakpoint(*this, thread->zone()); } - void Function::InstallOptimizedCode(const Code& code) const { DEBUG_ASSERT(IsMutatorOrAtSafepoint()); // We may not have previous code if FLAG_precompile is set. @@ -5418,19 +5190,16 @@ void Function::InstallOptimizedCode(const Code& code) const { AttachCode(code); } - void Function::SetInstructions(const Code& value) const { DEBUG_ASSERT(IsMutatorOrAtSafepoint()); SetInstructionsSafe(value); } - void Function::SetInstructionsSafe(const Code& value) const { StorePointer(&raw_ptr()->code_, value.raw()); StoreNonPointer(&raw_ptr()->entry_point_, value.UncheckedEntryPoint()); } - void Function::AttachCode(const Code& value) const { DEBUG_ASSERT(IsMutatorOrAtSafepoint()); // Finish setting up code before activating it. @@ -5440,13 +5209,11 @@ void Function::AttachCode(const Code& value) const { (value.function() == this->raw())); } - bool Function::HasCode() const { ASSERT(raw_ptr()->code_ != Code::null()); return raw_ptr()->code_ != StubCode::LazyCompile_entry()->code(); } - void Function::ClearCode() const { #if defined(DART_PRECOMPILED_RUNTIME) UNREACHABLE(); @@ -5457,7 +5224,6 @@ void Function::ClearCode() const { #endif } - void Function::EnsureHasCompiledUnoptimizedCode() const { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -5470,7 +5236,6 @@ void Function::EnsureHasCompiledUnoptimizedCode() const { } } - void Function::SwitchToUnoptimizedCode() const { ASSERT(HasOptimizedCode()); Thread* thread = Thread::Current(); @@ -5495,7 +5260,6 @@ void Function::SwitchToUnoptimizedCode() const { isolate->TrackDeoptimizedCode(current_code); } - void Function::SwitchToLazyCompiledUnoptimizedCode() const { if (!HasOptimizedCode()) { return; @@ -5523,7 +5287,6 @@ void Function::SwitchToLazyCompiledUnoptimizedCode() const { unopt_code.Enable(); } - void Function::set_unoptimized_code(const Code& value) const { #if defined(DART_PRECOMPILED_RUNTIME) UNREACHABLE(); @@ -5534,7 +5297,6 @@ void Function::set_unoptimized_code(const Code& value) const { #endif } - RawContextScope* Function::context_scope() const { if (IsClosureFunction()) { const Object& obj = Object::Handle(raw_ptr()->data_); @@ -5544,7 +5306,6 @@ RawContextScope* Function::context_scope() const { return ContextScope::null(); } - void Function::set_context_scope(const ContextScope& value) const { if (IsClosureFunction()) { const Object& obj = Object::Handle(raw_ptr()->data_); @@ -5555,7 +5316,6 @@ void Function::set_context_scope(const ContextScope& value) const { UNREACHABLE(); } - RawInstance* Function::implicit_static_closure() const { if (IsImplicitStaticClosureFunction()) { const Object& obj = Object::Handle(raw_ptr()->data_); @@ -5565,7 +5325,6 @@ RawInstance* Function::implicit_static_closure() const { return Instance::null(); } - void Function::set_implicit_static_closure(const Instance& closure) const { if (IsImplicitStaticClosureFunction()) { const Object& obj = Object::Handle(raw_ptr()->data_); @@ -5576,7 +5335,6 @@ void Function::set_implicit_static_closure(const Instance& closure) const { UNREACHABLE(); } - RawScript* Function::eval_script() const { const Object& obj = Object::Handle(raw_ptr()->data_); if (obj.IsScript()) { @@ -5585,14 +5343,12 @@ RawScript* Function::eval_script() const { return Script::null(); } - void Function::set_eval_script(const Script& script) const { ASSERT(token_pos() == TokenPosition::kMinSource); ASSERT(raw_ptr()->data_ == Object::null()); set_data(script); } - RawFunction* Function::extracted_method_closure() const { ASSERT(kind() == RawFunction::kMethodExtractor); const Object& obj = Object::Handle(raw_ptr()->data_); @@ -5600,14 +5356,12 @@ RawFunction* Function::extracted_method_closure() const { return Function::Cast(obj).raw(); } - void Function::set_extracted_method_closure(const Function& value) const { ASSERT(kind() == RawFunction::kMethodExtractor); ASSERT(raw_ptr()->data_ == Object::null()); set_data(value); } - RawArray* Function::saved_args_desc() const { ASSERT(kind() == RawFunction::kNoSuchMethodDispatcher || kind() == RawFunction::kInvokeFieldDispatcher); @@ -5616,7 +5370,6 @@ RawArray* Function::saved_args_desc() const { return Array::Cast(obj).raw(); } - void Function::set_saved_args_desc(const Array& value) const { ASSERT(kind() == RawFunction::kNoSuchMethodDispatcher || kind() == RawFunction::kInvokeFieldDispatcher); @@ -5624,7 +5377,6 @@ void Function::set_saved_args_desc(const Array& value) const { set_data(value); } - RawField* Function::LookupImplicitGetterSetterField() const { ASSERT((kind() == RawFunction::kImplicitGetter) || (kind() == RawFunction::kImplicitSetter) || @@ -5644,7 +5396,6 @@ RawField* Function::LookupImplicitGetterSetterField() const { return Field::null(); } - RawFunction* Function::parent_function() const { if (IsClosureFunction() || IsSignatureFunction()) { const Object& obj = Object::Handle(raw_ptr()->data_); @@ -5658,7 +5409,6 @@ RawFunction* Function::parent_function() const { return Function::null(); } - void Function::set_parent_function(const Function& value) const { const Object& obj = Object::Handle(raw_ptr()->data_); ASSERT(!obj.IsNull()); @@ -5670,7 +5420,6 @@ void Function::set_parent_function(const Function& value) const { } } - bool Function::HasGenericParent() const { if (IsImplicitClosureFunction()) { // The parent function of an implicit closure function is not the enclosing @@ -5687,7 +5436,6 @@ bool Function::HasGenericParent() const { return false; } - RawFunction* Function::implicit_closure_function() const { if (IsClosureFunction() || IsSignatureFunction() || IsFactory()) { return Function::null(); @@ -5706,7 +5454,6 @@ RawFunction* Function::implicit_closure_function() const { return res.IsNull() ? Function::null() : Function::Cast(res).raw(); } - void Function::set_implicit_closure_function(const Function& value) const { ASSERT(!IsClosureFunction() && !IsSignatureFunction()); if (is_native()) { @@ -5720,7 +5467,6 @@ void Function::set_implicit_closure_function(const Function& value) const { } } - RawType* Function::ExistingSignatureType() const { const Object& obj = Object::Handle(raw_ptr()->data_); ASSERT(!obj.IsNull()); @@ -5732,7 +5478,6 @@ RawType* Function::ExistingSignatureType() const { } } - RawFunction* Function::CanonicalSignatureFunction(TrailPtr trail) const { ASSERT(!IsSignatureFunction()); Zone* zone = Thread::Current()->zone(); @@ -5770,7 +5515,6 @@ RawFunction* Function::CanonicalSignatureFunction(TrailPtr trail) const { return sig_fun.raw(); } - RawType* Function::SignatureType() const { Type& type = Type::Handle(ExistingSignatureType()); if (type.IsNull()) { @@ -5812,7 +5556,6 @@ RawType* Function::SignatureType() const { return type.raw(); } - void Function::SetSignatureType(const Type& value) const { const Object& obj = Object::Handle(raw_ptr()->data_); ASSERT(!obj.IsNull()); @@ -5825,7 +5568,6 @@ void Function::SetSignatureType(const Type& value) const { } } - bool Function::IsRedirectingFactory() const { if (!IsFactory() || !is_redirecting()) { return false; @@ -5834,7 +5576,6 @@ bool Function::IsRedirectingFactory() const { return true; } - RawType* Function::RedirectionType() const { ASSERT(IsRedirectingFactory()); ASSERT(!is_native()); @@ -5843,7 +5584,6 @@ RawType* Function::RedirectionType() const { return RedirectionData::Cast(obj).type(); } - const char* Function::KindToCString(RawFunction::Kind kind) { switch (kind) { case RawFunction::kRegularFunction: @@ -5891,7 +5631,6 @@ const char* Function::KindToCString(RawFunction::Kind kind) { } } - void Function::SetRedirectionType(const Type& type) const { ASSERT(IsFactory()); Object& obj = Object::Handle(raw_ptr()->data_); @@ -5902,7 +5641,6 @@ void Function::SetRedirectionType(const Type& type) const { RedirectionData::Cast(obj).set_type(type); } - RawString* Function::RedirectionIdentifier() const { ASSERT(IsRedirectingFactory()); const Object& obj = Object::Handle(raw_ptr()->data_); @@ -5910,7 +5648,6 @@ RawString* Function::RedirectionIdentifier() const { return RedirectionData::Cast(obj).identifier(); } - void Function::SetRedirectionIdentifier(const String& identifier) const { ASSERT(IsFactory()); Object& obj = Object::Handle(raw_ptr()->data_); @@ -5921,7 +5658,6 @@ void Function::SetRedirectionIdentifier(const String& identifier) const { RedirectionData::Cast(obj).set_identifier(identifier); } - RawFunction* Function::RedirectionTarget() const { ASSERT(IsRedirectingFactory()); const Object& obj = Object::Handle(raw_ptr()->data_); @@ -5929,7 +5665,6 @@ RawFunction* Function::RedirectionTarget() const { return RedirectionData::Cast(obj).target(); } - void Function::SetRedirectionTarget(const Function& target) const { ASSERT(IsFactory()); Object& obj = Object::Handle(raw_ptr()->data_); @@ -5940,7 +5675,6 @@ void Function::SetRedirectionTarget(const Function& target) const { RedirectionData::Cast(obj).set_target(target); } - // This field is heavily overloaded: // eval function: Script expression source // signature function: SignatureData @@ -5958,7 +5692,6 @@ void Function::set_data(const Object& value) const { StorePointer(&raw_ptr()->data_, value.raw()); } - bool Function::IsInFactoryScope() const { if (!IsLocalFunction()) { return IsFactory(); @@ -5970,45 +5703,38 @@ bool Function::IsInFactoryScope() const { return outer_function.IsFactory(); } - void Function::set_name(const String& value) const { ASSERT(value.IsSymbol()); StorePointer(&raw_ptr()->name_, value.raw()); } - void Function::set_owner(const Object& value) const { ASSERT(!value.IsNull() || IsSignatureFunction()); StorePointer(&raw_ptr()->owner_, value.raw()); } - RawRegExp* Function::regexp() const { ASSERT(kind() == RawFunction::kIrregexpFunction); const Array& pair = Array::Cast(Object::Handle(raw_ptr()->data_)); return RegExp::RawCast(pair.At(0)); } - class StickySpecialization : public BitField {}; class StringSpecializationCid : public BitField {}; - intptr_t Function::string_specialization_cid() const { ASSERT(kind() == RawFunction::kIrregexpFunction); const Array& pair = Array::Cast(Object::Handle(raw_ptr()->data_)); return StringSpecializationCid::decode(Smi::Value(Smi::RawCast(pair.At(1)))); } - bool Function::is_sticky_specialization() const { ASSERT(kind() == RawFunction::kIrregexpFunction); const Array& pair = Array::Cast(Object::Handle(raw_ptr()->data_)); return StickySpecialization::decode(Smi::Value(Smi::RawCast(pair.At(1)))); } - void Function::SetRegExpData(const RegExp& regexp, intptr_t string_specialization_cid, bool sticky) const { @@ -6023,7 +5749,6 @@ void Function::SetRegExpData(const RegExp& regexp, set_data(pair); } - RawString* Function::native_name() const { ASSERT(is_native()); const Object& obj = Object::Handle(raw_ptr()->data_); @@ -6031,7 +5756,6 @@ RawString* Function::native_name() const { return String::RawCast(Array::Cast(obj).At(0)); } - void Function::set_native_name(const String& value) const { ASSERT(is_native()); ASSERT(raw_ptr()->data_ == Object::null()); @@ -6041,7 +5765,6 @@ void Function::set_native_name(const String& value) const { set_data(pair); } - void Function::set_result_type(const AbstractType& value) const { ASSERT(!value.IsNull()); StorePointer(&raw_ptr()->result_type_, value.raw()); @@ -6054,13 +5777,11 @@ void Function::set_result_type(const AbstractType& value) const { } } - RawAbstractType* Function::ParameterTypeAt(intptr_t index) const { const Array& parameter_types = Array::Handle(raw_ptr()->parameter_types_); return AbstractType::RawCast(parameter_types.At(index)); } - void Function::SetParameterTypeAt(intptr_t index, const AbstractType& value) const { ASSERT(!value.IsNull()); @@ -6070,35 +5791,29 @@ void Function::SetParameterTypeAt(intptr_t index, parameter_types.SetAt(index, value); } - void Function::set_parameter_types(const Array& value) const { StorePointer(&raw_ptr()->parameter_types_, value.raw()); } - RawString* Function::ParameterNameAt(intptr_t index) const { const Array& parameter_names = Array::Handle(raw_ptr()->parameter_names_); return String::RawCast(parameter_names.At(index)); } - void Function::SetParameterNameAt(intptr_t index, const String& value) const { ASSERT(!value.IsNull() && value.IsSymbol()); const Array& parameter_names = Array::Handle(raw_ptr()->parameter_names_); parameter_names.SetAt(index, value); } - void Function::set_parameter_names(const Array& value) const { StorePointer(&raw_ptr()->parameter_names_, value.raw()); } - void Function::set_type_parameters(const TypeArguments& value) const { StorePointer(&raw_ptr()->type_parameters_, value.raw()); } - intptr_t Function::NumTypeParameters(Thread* thread) const { if (type_parameters() == TypeArguments::null()) { return 0; @@ -6111,7 +5826,6 @@ intptr_t Function::NumTypeParameters(Thread* thread) const { return type_params.Length(); } - intptr_t Function::NumParentTypeParameters() const { if (IsImplicitClosureFunction()) { return 0; @@ -6126,7 +5840,6 @@ intptr_t Function::NumParentTypeParameters() const { return num_parent_type_params; } - RawTypeParameter* Function::LookupTypeParameter( const String& type_name, intptr_t* function_level) const { @@ -6167,24 +5880,20 @@ RawTypeParameter* Function::LookupTypeParameter( return TypeParameter::null(); } - void Function::set_kind(RawFunction::Kind value) const { set_kind_tag(KindBits::update(value, raw_ptr()->kind_tag_)); } - void Function::set_modifier(RawFunction::AsyncModifier value) const { set_kind_tag(ModifierBits::update(value, raw_ptr()->kind_tag_)); } - void Function::set_recognized_kind(MethodRecognizer::Kind value) const { // Prevent multiple settings of kind. ASSERT((value == MethodRecognizer::kUnknown) || !IsRecognized()); set_kind_tag(RecognizedBits::update(value, raw_ptr()->kind_tag_)); } - void Function::set_token_pos(TokenPosition token_pos) const { #if defined(DART_PRECOMPILED_RUNTIME) UNREACHABLE(); @@ -6194,12 +5903,10 @@ void Function::set_token_pos(TokenPosition token_pos) const { #endif } - void Function::set_kind_tag(uint32_t value) const { StoreNonPointer(&raw_ptr()->kind_tag_, static_cast(value)); } - void Function::set_num_fixed_parameters(intptr_t value) const { ASSERT(value >= 0); ASSERT(Utils::IsInt(16, value)); @@ -6207,7 +5914,6 @@ void Function::set_num_fixed_parameters(intptr_t value) const { static_cast(value)); } - void Function::set_num_optional_parameters(intptr_t value) const { // A positive value indicates positional params, a negative one named params. ASSERT(Utils::IsInt(16, value)); @@ -6215,7 +5921,6 @@ void Function::set_num_optional_parameters(intptr_t value) const { static_cast(value)); } - void Function::SetNumOptionalParameters(intptr_t num_optional_parameters, bool are_optional_positional) const { ASSERT(num_optional_parameters >= 0); @@ -6224,7 +5929,6 @@ void Function::SetNumOptionalParameters(intptr_t num_optional_parameters, : -num_optional_parameters); } - bool Function::IsOptimizable() const { if (FLAG_precompiled_mode) { return true; @@ -6244,7 +5948,6 @@ bool Function::IsOptimizable() const { return false; } - void Function::SetIsOptimizable(bool value) const { ASSERT(!is_native()); set_is_optimizable(value); @@ -6254,7 +5957,6 @@ void Function::SetIsOptimizable(bool value) const { } } - bool Function::CanBeInlined() const { Thread* thread = Thread::Current(); return is_inlinable() && !is_external() && !is_generated_body() && @@ -6262,12 +5964,10 @@ bool Function::CanBeInlined() const { !thread->isolate()->debugger()->HasBreakpoint(*this, thread->zone())); } - intptr_t Function::NumParameters() const { return num_fixed_parameters() + NumOptionalParameters(); } - intptr_t Function::NumImplicitParameters() const { if (kind() == RawFunction::kConstructor) { // Type arguments for factory; instance for generative constructor. @@ -6288,7 +5988,6 @@ intptr_t Function::NumImplicitParameters() const { return 0; // No implicit parameters. } - bool Function::AreValidArgumentCounts(intptr_t num_type_arguments, intptr_t num_arguments, intptr_t num_named_arguments, @@ -6362,7 +6061,6 @@ bool Function::AreValidArgumentCounts(intptr_t num_type_arguments, return true; } - bool Function::AreValidArguments(intptr_t num_type_arguments, intptr_t num_arguments, const Array& argument_names, @@ -6408,7 +6106,6 @@ bool Function::AreValidArguments(intptr_t num_type_arguments, return true; } - bool Function::AreValidArguments(const ArgumentsDescriptor& args_desc, String* error_message) const { const intptr_t num_type_arguments = args_desc.TypeArgsLen(); @@ -6454,7 +6151,6 @@ bool Function::AreValidArguments(const ArgumentsDescriptor& args_desc, return true; } - // Helper allocating a C string buffer in the zone, printing the fully qualified // name of a function in it, and replacing ':' by '_' to make sure the // constructed name is a valid C++ identifier for debugging purpose. @@ -6465,7 +6161,6 @@ enum QualifiedFunctionLibKind { kQualifiedFunctionLibKindLibName }; - static intptr_t ConstructFunctionFullyQualifiedCString( const Function& function, char** chars, @@ -6525,7 +6220,6 @@ static intptr_t ConstructFunctionFullyQualifiedCString( return written; } - const char* Function::ToFullyQualifiedCString() const { char* chars = NULL; ConstructFunctionFullyQualifiedCString(*this, &chars, 0, true, @@ -6533,7 +6227,6 @@ const char* Function::ToFullyQualifiedCString() const { return chars; } - const char* Function::ToLibNamePrefixedQualifiedCString() const { char* chars = NULL; ConstructFunctionFullyQualifiedCString(*this, &chars, 0, true, @@ -6541,7 +6234,6 @@ const char* Function::ToLibNamePrefixedQualifiedCString() const { return chars; } - const char* Function::ToQualifiedCString() const { char* chars = NULL; ConstructFunctionFullyQualifiedCString(*this, &chars, 0, false, @@ -6549,7 +6241,6 @@ const char* Function::ToQualifiedCString() const { return chars; } - bool Function::HasCompatibleParametersWith(const Function& other, Error* bound_error) const { ASSERT(Isolate::Current()->error_on_bad_override()); @@ -6596,7 +6287,6 @@ bool Function::HasCompatibleParametersWith(const Function& other, return true; } - RawFunction* Function::InstantiateSignatureFrom( const TypeArguments& instantiator_type_arguments, const TypeArguments& function_type_arguments, @@ -6634,7 +6324,6 @@ RawFunction* Function::InstantiateSignatureFrom( return sig.raw(); } - // If test_kind == kIsSubtypeOf, checks if the type of the specified parameter // of this function is a subtype or a supertype of the type of the specified // parameter of the other function. @@ -6677,7 +6366,6 @@ bool Function::TestParameterType(TypeTestKind test_kind, return true; } - bool Function::HasSameTypeParametersAndBounds(const Function& other) const { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -6711,7 +6399,6 @@ bool Function::HasSameTypeParametersAndBounds(const Function& other) const { return true; } - bool Function::TypeTest(TypeTestKind test_kind, const Function& other, Error* bound_error, @@ -6816,7 +6503,6 @@ bool Function::TypeTest(TypeTestKind test_kind, return true; } - // The compiler generates an implicit constructor if a class definition // does not contain an explicit constructor or factory. The implicit // constructor has the same token position as the owner class. @@ -6824,7 +6510,6 @@ bool Function::IsImplicitConstructor() const { return IsGenerativeConstructor() && (token_pos() == end_token_pos()); } - bool Function::IsImplicitClosureFunction() const { if (!IsClosureFunction()) { return false; @@ -6833,7 +6518,6 @@ bool Function::IsImplicitClosureFunction() const { return (parent.implicit_closure_function() == raw()); } - bool Function::IsImplicitStaticClosureFunction(RawFunction* func) { NoSafepointScope no_safepoint; uint32_t kind_tag = func->ptr()->kind_tag_; @@ -6848,13 +6532,11 @@ bool Function::IsImplicitStaticClosureFunction(RawFunction* func) { return (parent_function->ptr()->data_ == reinterpret_cast(func)); } - bool Function::IsConstructorClosureFunction() const { return IsClosureFunction() && String::Handle(name()).StartsWith(Symbols::ConstructorClosurePrefix()); } - RawFunction* Function::New(Heap::Space space) { ASSERT(Object::function_class() != Class::null()); RawObject* raw = @@ -6862,7 +6544,6 @@ RawFunction* Function::New(Heap::Space space) { return reinterpret_cast(raw); } - RawFunction* Function::New(const String& name, RawFunction::Kind kind, bool is_static, @@ -6927,7 +6608,6 @@ RawFunction* Function::New(const String& name, return result.raw(); } - RawFunction* Function::Clone(const Class& new_owner) const { ASSERT(!IsGenerativeConstructor()); Thread* thread = Thread::Current(); @@ -6977,7 +6657,6 @@ RawFunction* Function::Clone(const Class& new_owner) const { return clone.raw(); } - RawFunction* Function::NewClosureFunction(const String& name, const Function& parent, TokenPosition token_pos) { @@ -6996,7 +6675,6 @@ RawFunction* Function::NewClosureFunction(const String& name, return result.raw(); } - RawFunction* Function::NewSignatureFunction(const Object& owner, const Function& parent, TokenPosition token_pos, @@ -7017,7 +6695,6 @@ RawFunction* Function::NewSignatureFunction(const Object& owner, return result.raw(); } - RawFunction* Function::NewEvalFunction(const Class& owner, const Script& script, bool is_static) { @@ -7114,7 +6791,6 @@ RawFunction* Function::ImplicitClosureFunction() const { return closure_function.raw(); } - void Function::DropUncompiledImplicitClosureFunction() const { if (implicit_closure_function() != Function::null()) { const Function& func = Function::Handle(implicit_closure_function()); @@ -7124,7 +6800,6 @@ void Function::DropUncompiledImplicitClosureFunction() const { } } - RawString* Function::UserVisibleFormalParameters() const { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -7135,7 +6810,6 @@ RawString* Function::UserVisibleFormalParameters() const { return Symbols::FromConcatAll(thread, pieces); } - void Function::BuildSignatureParameters( Thread* thread, Zone* zone, @@ -7194,7 +6868,6 @@ void Function::BuildSignatureParameters( } } - RawInstance* Function::ImplicitStaticClosure() const { if (implicit_static_closure() == Instance::null()) { Zone* zone = Thread::Current()->zone(); @@ -7212,7 +6885,6 @@ RawInstance* Function::ImplicitStaticClosure() const { return implicit_static_closure(); } - RawInstance* Function::ImplicitInstanceClosure(const Instance& receiver) const { ASSERT(IsImplicitClosureFunction()); Zone* zone = Thread::Current()->zone(); @@ -7230,7 +6902,6 @@ RawInstance* Function::ImplicitInstanceClosure(const Instance& receiver) const { *this, context); } - RawSmi* Function::GetClosureHashCode() const { ASSERT(IsClosureFunction()); const Object& obj = Object::Handle(raw_ptr()->data_); @@ -7252,7 +6923,6 @@ RawSmi* Function::GetClosureHashCode() const { return Smi::New(result); } - RawString* Function::BuildSignature(NameVisibility name_visibility) const { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -7293,7 +6963,6 @@ RawString* Function::BuildSignature(NameVisibility name_visibility) const { return Symbols::FromConcatAll(thread, pieces); } - bool Function::HasInstantiatedSignature(Genericity genericity, intptr_t num_free_fun_type_params, TrailPtr trail) const { @@ -7319,7 +6988,6 @@ bool Function::HasInstantiatedSignature(Genericity genericity, return true; } - RawClass* Function::Owner() const { if (raw_ptr()->owner_ == Object::null()) { ASSERT(IsSignatureFunction()); @@ -7333,7 +7001,6 @@ RawClass* Function::Owner() const { return PatchClass::Cast(obj).patched_class(); } - RawClass* Function::origin() const { if (raw_ptr()->owner_ == Object::null()) { ASSERT(IsSignatureFunction()); @@ -7347,7 +7014,6 @@ RawClass* Function::origin() const { return PatchClass::Cast(obj).origin_class(); } - RawScript* Function::script() const { // NOTE(turnidge): If you update this function, you probably want to // update Class::PatchFieldsAndFunctions() at the same time. @@ -7374,12 +7040,10 @@ RawScript* Function::script() const { return PatchClass::Cast(obj).script(); } - bool Function::HasOptimizedCode() const { return HasCode() && Code::Handle(CurrentCode()).is_optimized(); } - RawString* Function::UserVisibleName() const { if (FLAG_show_internal_names) { return name(); @@ -7387,7 +7051,6 @@ RawString* Function::UserVisibleName() const { return String::ScrubName(String::Handle(name())); } - RawString* Function::QualifiedName(NameVisibility name_visibility) const { ASSERT(name_visibility != kInternalName); // We never request it. // If |this| is the generated asynchronous body closure, use the @@ -7436,7 +7099,6 @@ RawString* Function::QualifiedName(NameVisibility name_visibility) const { return result.raw(); } - RawString* Function::GetSource() const { if (IsImplicitConstructor() || IsSignatureFunction()) { // We may need to handle more cases when the restrictions on mixins are @@ -7481,7 +7143,6 @@ RawString* Function::GetSource() const { return result.raw(); } - // Construct fingerprint from token stream. The token stream contains also // arguments. int32_t Function::SourceFingerprint() const { @@ -7489,7 +7150,6 @@ int32_t Function::SourceFingerprint() const { end_token_pos()); } - void Function::SaveICDataMap( const ZoneGrowableArray& deopt_id_to_ic_data, const Array& edge_counters_array) const { @@ -7513,7 +7173,6 @@ void Function::SaveICDataMap( set_ic_data_array(array); } - void Function::RestoreICDataMap( ZoneGrowableArray* deopt_id_to_ic_data, bool clone_ic_data) const { @@ -7551,22 +7210,18 @@ void Function::RestoreICDataMap( } } - void Function::set_ic_data_array(const Array& value) const { StorePointer(&raw_ptr()->ic_data_array_, value.raw()); } - RawArray* Function::ic_data_array() const { return raw_ptr()->ic_data_array_; } - void Function::ClearICDataArray() const { set_ic_data_array(Array::null_array()); } - void Function::SetDeoptReasonForAll(intptr_t deopt_id, ICData::DeoptReasonId reason) { const Array& array = Array::Handle(ic_data_array()); @@ -7579,7 +7234,6 @@ void Function::SetDeoptReasonForAll(intptr_t deopt_id, } } - bool Function::CheckSourceFingerprint(const char* prefix, int32_t fp) const { if ((kernel_offset() <= 0) && (SourceFingerprint() != fp)) { const bool recalculatingFingerprints = false; @@ -7599,7 +7253,6 @@ bool Function::CheckSourceFingerprint(const char* prefix, int32_t fp) const { return true; } - RawCode* Function::EnsureHasCode() const { if (HasCode()) return CurrentCode(); Thread* thread = Thread::Current(); @@ -7616,7 +7269,6 @@ RawCode* Function::EnsureHasCode() const { return CurrentCode(); } - const char* Function::ToCString() const { if (IsNull()) { return "Function: null"; @@ -7668,34 +7320,28 @@ const char* Function::ToCString() const { const_str); } - void ClosureData::set_context_scope(const ContextScope& value) const { StorePointer(&raw_ptr()->context_scope_, value.raw()); } - void ClosureData::set_implicit_static_closure(const Instance& closure) const { ASSERT(!closure.IsNull()); ASSERT(raw_ptr()->closure_ == Instance::null()); StorePointer(&raw_ptr()->closure_, closure.raw()); } - void ClosureData::set_hash(intptr_t value) const { StorePointer(&raw_ptr()->hash_, static_cast(Smi::New(value))); } - void ClosureData::set_parent_function(const Function& value) const { StorePointer(&raw_ptr()->parent_function_, value.raw()); } - void ClosureData::set_signature_type(const Type& value) const { StorePointer(&raw_ptr()->signature_type_, value.raw()); } - RawClosureData* ClosureData::New() { ASSERT(Object::closure_data_class() != Class::null()); RawObject* raw = Object::Allocate(ClosureData::kClassId, @@ -7703,7 +7349,6 @@ RawClosureData* ClosureData::New() { return reinterpret_cast(raw); } - const char* ClosureData::ToCString() const { if (IsNull()) { return "ClosureData: null"; @@ -7720,17 +7365,14 @@ const char* ClosureData::ToCString() const { reinterpret_cast(implicit_static_closure())); } - void SignatureData::set_parent_function(const Function& value) const { StorePointer(&raw_ptr()->parent_function_, value.raw()); } - void SignatureData::set_signature_type(const Type& value) const { StorePointer(&raw_ptr()->signature_type_, value.raw()); } - RawSignatureData* SignatureData::New(Heap::Space space) { ASSERT(Object::signature_data_class() != Class::null()); RawObject* raw = Object::Allocate(SignatureData::kClassId, @@ -7738,7 +7380,6 @@ RawSignatureData* SignatureData::New(Heap::Space space) { return reinterpret_cast(raw); } - const char* SignatureData::ToCString() const { if (IsNull()) { return "SignatureData: null"; @@ -7751,23 +7392,19 @@ const char* SignatureData::ToCString() const { type.IsNull() ? "null" : type.ToCString()); } - void RedirectionData::set_type(const Type& value) const { ASSERT(!value.IsNull()); StorePointer(&raw_ptr()->type_, value.raw()); } - void RedirectionData::set_identifier(const String& value) const { StorePointer(&raw_ptr()->identifier_, value.raw()); } - void RedirectionData::set_target(const Function& value) const { StorePointer(&raw_ptr()->target_, value.raw()); } - RawRedirectionData* RedirectionData::New() { ASSERT(Object::redirection_data_class() != Class::null()); RawObject* raw = Object::Allocate( @@ -7775,7 +7412,6 @@ RawRedirectionData* RedirectionData::New() { return reinterpret_cast(raw); } - const char* RedirectionData::ToCString() const { if (IsNull()) { return "RedirectionData: null"; @@ -7790,12 +7426,10 @@ const char* RedirectionData::ToCString() const { target_fun.IsNull() ? "null" : target_fun.ToCString()); } - RawField* Field::CloneFromOriginal() const { return this->Clone(*this); } - RawField* Field::Original() const { if (IsNull()) { return Field::null(); @@ -7808,73 +7442,60 @@ RawField* Field::Original() const { } } - void Field::SetOriginal(const Field& value) const { ASSERT(value.IsOriginal()); ASSERT(!value.IsNull()); StorePointer(&raw_ptr()->owner_, reinterpret_cast(value.raw())); } - RawString* Field::GetterName(const String& field_name) { return String::Concat(Symbols::GetterPrefix(), field_name); } - RawString* Field::GetterSymbol(const String& field_name) { return Symbols::FromGet(Thread::Current(), field_name); } - RawString* Field::LookupGetterSymbol(const String& field_name) { return Symbols::LookupFromGet(Thread::Current(), field_name); } - RawString* Field::SetterName(const String& field_name) { return String::Concat(Symbols::SetterPrefix(), field_name); } - RawString* Field::SetterSymbol(const String& field_name) { return Symbols::FromSet(Thread::Current(), field_name); } - RawString* Field::LookupSetterSymbol(const String& field_name) { return Symbols::LookupFromSet(Thread::Current(), field_name); } - RawString* Field::NameFromGetter(const String& getter_name) { return Symbols::New(Thread::Current(), getter_name, kGetterPrefixLength, getter_name.Length() - kGetterPrefixLength); } - RawString* Field::NameFromSetter(const String& setter_name) { return Symbols::New(Thread::Current(), setter_name, kSetterPrefixLength, setter_name.Length() - kSetterPrefixLength); } - bool Field::IsGetterName(const String& function_name) { return function_name.StartsWith(Symbols::GetterPrefix()); } - bool Field::IsSetterName(const String& function_name) { return function_name.StartsWith(Symbols::SetterPrefix()); } - void Field::set_name(const String& value) const { ASSERT(value.IsSymbol()); ASSERT(IsOriginal()); StorePointer(&raw_ptr()->name_, value.raw()); } - RawObject* Field::RawOwner() const { if (IsOriginal()) { return raw_ptr()->owner_; @@ -7886,7 +7507,6 @@ RawObject* Field::RawOwner() const { } } - RawClass* Field::Owner() const { const Field& field = Field::Handle(Original()); ASSERT(field.IsOriginal()); @@ -7898,7 +7518,6 @@ RawClass* Field::Owner() const { return PatchClass::Cast(obj).patched_class(); } - RawClass* Field::Origin() const { const Field& field = Field::Handle(Original()); ASSERT(field.IsOriginal()); @@ -7910,7 +7529,6 @@ RawClass* Field::Origin() const { return PatchClass::Cast(obj).origin_class(); } - RawScript* Field::Script() const { // NOTE(turnidge): If you update this function, you probably want to // update Class::PatchFieldsAndFunctions() at the same time. @@ -7924,7 +7542,6 @@ RawScript* Field::Script() const { return PatchClass::Cast(obj).script(); } - // Called at finalization time void Field::SetFieldType(const AbstractType& value) const { ASSERT(Thread::Current()->IsMutatorThread()); @@ -7935,7 +7552,6 @@ void Field::SetFieldType(const AbstractType& value) const { } } - RawField* Field::New() { ASSERT(Object::field_class() != Class::null()); RawObject* raw = @@ -7943,7 +7559,6 @@ RawField* Field::New() { return reinterpret_cast(raw); } - void Field::InitializeNew(const Field& result, const String& name, bool is_static, @@ -7985,7 +7600,6 @@ void Field::InitializeNew(const Field& result, } } - RawField* Field::New(const String& name, bool is_static, bool is_final, @@ -8002,7 +7616,6 @@ RawField* Field::New(const String& name, return result.raw(); } - RawField* Field::NewTopLevel(const String& name, bool is_final, bool is_const, @@ -8016,7 +7629,6 @@ RawField* Field::NewTopLevel(const String& name, return result.raw(); } - RawField* Field::Clone(const Class& new_owner) const { Field& clone = Field::Handle(); clone ^= Object::Clone(*this, Heap::kOld); @@ -8036,7 +7648,6 @@ RawField* Field::Clone(const Class& new_owner) const { return clone.raw(); } - RawField* Field::Clone(const Field& original) const { if (original.IsNull()) { return Field::null(); @@ -8049,7 +7660,6 @@ RawField* Field::Clone(const Field& original) const { return clone.raw(); } - RawString* Field::InitializingExpression() const { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -8079,7 +7689,6 @@ RawString* Field::InitializingExpression() const { return scr.GetSnippet(start_of_expression, end_of_expression); } - RawString* Field::UserVisibleName() const { if (FLAG_show_internal_names) { return name(); @@ -8087,24 +7696,20 @@ RawString* Field::UserVisibleName() const { return String::ScrubName(String::Handle(name())); } - intptr_t Field::guarded_list_length() const { return Smi::Value(raw_ptr()->guarded_list_length_); } - void Field::set_guarded_list_length(intptr_t list_length) const { ASSERT(Thread::Current()->IsMutatorThread()); ASSERT(IsOriginal()); StoreSmi(&raw_ptr()->guarded_list_length_, Smi::New(list_length)); } - intptr_t Field::guarded_list_length_in_object_offset() const { return raw_ptr()->guarded_list_length_in_object_offset_ + kHeapObjectTag; } - void Field::set_guarded_list_length_in_object_offset( intptr_t list_length_offset) const { ASSERT(Thread::Current()->IsMutatorThread()); @@ -8114,7 +7719,6 @@ void Field::set_guarded_list_length_in_object_offset( ASSERT(guarded_list_length_in_object_offset() == list_length_offset); } - const char* Field::ToCString() const { if (IsNull()) { return "Field: null"; @@ -8129,7 +7733,6 @@ const char* Field::ToCString() const { cls_name, field_name, kF0, kF1, kF2); } - // Build a closure object that gets (or sets) the contents of a static // field f and cache the closure in a newly created static field // named #f (or #f= in case of a setter). @@ -8188,28 +7791,23 @@ RawInstance* Field::AccessorClosure(bool make_setter) const { return Instance::RawCast(result.raw()); } - RawInstance* Field::GetterClosure() const { return AccessorClosure(false); } - RawInstance* Field::SetterClosure() const { return AccessorClosure(true); } - RawArray* Field::dependent_code() const { return raw_ptr()->dependent_code_; } - void Field::set_dependent_code(const Array& array) const { ASSERT(IsOriginal()); StorePointer(&raw_ptr()->dependent_code_, array.raw()); } - class FieldDependentArray : public WeakCodeReferences { public: explicit FieldDependentArray(const Field& field) @@ -8243,7 +7841,6 @@ class FieldDependentArray : public WeakCodeReferences { DISALLOW_COPY_AND_ASSIGN(FieldDependentArray); }; - void Field::RegisterDependentCode(const Code& code) const { ASSERT(IsOriginal()); DEBUG_ASSERT(IsMutatorOrAtSafepoint()); @@ -8252,7 +7849,6 @@ void Field::RegisterDependentCode(const Code& code) const { a.Register(code); } - void Field::DeoptimizeDependentCode() const { ASSERT(Thread::Current()->IsMutatorThread()); ASSERT(IsOriginal()); @@ -8260,7 +7856,6 @@ void Field::DeoptimizeDependentCode() const { a.DisableCode(); } - bool Field::IsConsistentWith(const Field& other) const { return (raw_ptr()->guarded_cid_ == other.raw_ptr()->guarded_cid_) && (raw_ptr()->is_nullable_ == other.raw_ptr()->is_nullable_) && @@ -8269,33 +7864,28 @@ bool Field::IsConsistentWith(const Field& other) const { (is_unboxing_candidate() == other.is_unboxing_candidate()); } - bool Field::IsUninitialized() const { const Instance& value = Instance::Handle(raw_ptr()->value_.static_value_); ASSERT(value.raw() != Object::transition_sentinel().raw()); return value.raw() == Object::sentinel().raw(); } - void Field::SetPrecompiledInitializer(const Function& initializer) const { ASSERT(IsOriginal()); StorePointer(&raw_ptr()->initializer_.precompiled_, initializer.raw()); } - bool Field::HasPrecompiledInitializer() const { return raw_ptr()->initializer_.precompiled_->IsHeapObject() && raw_ptr()->initializer_.precompiled_->IsFunction(); } - void Field::SetSavedInitialStaticValue(const Instance& value) const { ASSERT(IsOriginal()); ASSERT(!HasPrecompiledInitializer()); StorePointer(&raw_ptr()->initializer_.saved_value_, value.raw()); } - void Field::EvaluateInitializer() const { ASSERT(IsOriginal()); ASSERT(is_static()); @@ -8323,7 +7913,6 @@ void Field::EvaluateInitializer() const { UNREACHABLE(); } - static intptr_t GetListLength(const Object& value) { if (value.IsTypedData()) { const TypedData& list = TypedData::Cast(value); @@ -8344,7 +7933,6 @@ static intptr_t GetListLength(const Object& value) { return Field::kNoFixedLength; } - static intptr_t GetListLengthOffset(intptr_t cid) { if (RawObject::IsTypedDataClassId(cid)) { return TypedData::length_offset(); @@ -8363,7 +7951,6 @@ static intptr_t GetListLengthOffset(intptr_t cid) { return Field::kUnknownLengthOffset; } - const char* Field::GuardedPropertiesAsCString() const { if (guarded_cid() == kIllegalCid) { return ""; @@ -8391,7 +7978,6 @@ const char* Field::GuardedPropertiesAsCString() const { "<%s %s>", is_nullable() ? "nullable" : "not-nullable", class_name); } - bool Field::IsExternalizableCid(intptr_t cid) { if (FLAG_support_externalizable_strings) { return (cid == kOneByteStringCid) || (cid == kTwoByteStringCid); @@ -8400,7 +7986,6 @@ bool Field::IsExternalizableCid(intptr_t cid) { } } - void Field::InitializeGuardedListLengthInObjectOffset() const { ASSERT(IsOriginal()); if (needs_length_check() && @@ -8413,7 +7998,6 @@ void Field::InitializeGuardedListLengthInObjectOffset() const { } } - bool Field::UpdateGuardedCidAndLength(const Object& value) const { ASSERT(IsOriginal()); const intptr_t cid = value.GetClassId(); @@ -8481,7 +8065,6 @@ bool Field::UpdateGuardedCidAndLength(const Object& value) const { return true; } - void Field::RecordStore(const Object& value) const { ASSERT(IsOriginal()); if (!Isolate::Current()->use_field_guards()) { @@ -8502,7 +8085,6 @@ void Field::RecordStore(const Object& value) const { } } - void Field::ForceDynamicGuardedCidAndLength() const { // Assume nothing about this field. set_is_unboxing_candidate(false); @@ -8514,17 +8096,14 @@ void Field::ForceDynamicGuardedCidAndLength() const { DeoptimizeDependentCode(); } - void LiteralToken::set_literal(const String& literal) const { StorePointer(&raw_ptr()->literal_, literal.raw()); } - void LiteralToken::set_value(const Object& value) const { StorePointer(&raw_ptr()->value_, value.raw()); } - RawLiteralToken* LiteralToken::New() { ASSERT(Object::literal_token_class() != Class::null()); RawObject* raw = Object::Allocate(LiteralToken::kClassId, @@ -8532,7 +8111,6 @@ RawLiteralToken* LiteralToken::New() { return reinterpret_cast(raw); } - RawLiteralToken* LiteralToken::New(Token::Kind kind, const String& literal) { const LiteralToken& result = LiteralToken::Handle(LiteralToken::New()); result.set_kind(kind); @@ -8551,33 +8129,27 @@ RawLiteralToken* LiteralToken::New(Token::Kind kind, const String& literal) { return result.raw(); } - const char* LiteralToken::ToCString() const { const String& token = String::Handle(literal()); return token.ToCString(); } - RawGrowableObjectArray* TokenStream::TokenObjects() const { return raw_ptr()->token_objects_; } - void TokenStream::SetTokenObjects(const GrowableObjectArray& value) const { StorePointer(&raw_ptr()->token_objects_, value.raw()); } - RawExternalTypedData* TokenStream::GetStream() const { return raw_ptr()->stream_; } - void TokenStream::SetStream(const ExternalTypedData& value) const { StorePointer(&raw_ptr()->stream_, value.raw()); } - void TokenStream::DataFinalizer(void* isolate_callback_data, Dart_WeakPersistentHandle handle, void* peer) { @@ -8585,12 +8157,10 @@ void TokenStream::DataFinalizer(void* isolate_callback_data, ::free(peer); } - RawString* TokenStream::PrivateKey() const { return raw_ptr()->private_key_; } - void TokenStream::SetPrivateKey(const String& value) const { StorePointer(&raw_ptr()->private_key_, value.raw()); } @@ -8784,7 +8354,6 @@ RawString* TokenStream::GenerateSource(TokenPosition start_pos, return String::ConcatAll(source); } - intptr_t TokenStream::ComputeSourcePosition(TokenPosition tok_pos) const { Zone* zone = Thread::Current()->zone(); Iterator iterator(zone, *this, TokenPosition::kMinSource, @@ -8799,7 +8368,6 @@ intptr_t TokenStream::ComputeSourcePosition(TokenPosition tok_pos) const { return src_pos; } - RawTokenStream* TokenStream::New() { ASSERT(Object::token_stream_class() != Class::null()); RawObject* raw = Object::Allocate(TokenStream::kClassId, @@ -8807,7 +8375,6 @@ RawTokenStream* TokenStream::New() { return reinterpret_cast(raw); } - RawTokenStream* TokenStream::New(intptr_t len) { if (len < 0 || len > kMaxElements) { // This should be caught before we reach here. @@ -8825,7 +8392,6 @@ RawTokenStream* TokenStream::New(intptr_t len) { return result.raw(); } - // CompressedTokenMap maps String and LiteralToken keys to Smi values. // It also supports lookup by TokenDescriptor. class CompressedTokenTraits { @@ -8862,7 +8428,6 @@ class CompressedTokenTraits { }; typedef UnorderedHashMap CompressedTokenMap; - // Helper class for creation of compressed token stream data. class CompressedTokenStreamData : public Scanner::TokenCollector { public: @@ -8971,7 +8536,6 @@ class CompressedTokenStreamData : public Scanner::TokenCollector { DISALLOW_COPY_AND_ASSIGN(CompressedTokenStreamData); }; - RawTokenStream* TokenStream::New(const String& source, const String& private_key, bool use_shared_tokens) { @@ -9025,7 +8589,6 @@ RawTokenStream* TokenStream::New(const String& source, return result.raw(); } - void TokenStream::OpenSharedTokenList(Isolate* isolate) { const int kInitialSharedCapacity = 5 * 1024; ObjectStore* store = isolate->object_store(); @@ -9038,18 +8601,15 @@ void TokenStream::OpenSharedTokenList(Isolate* isolate) { store->set_token_objects_map(token_objects_map); } - void TokenStream::CloseSharedTokenList(Isolate* isolate) { isolate->object_store()->set_token_objects(GrowableObjectArray::Handle()); isolate->object_store()->set_token_objects_map(Array::null_array()); } - const char* TokenStream::ToCString() const { return "TokenStream"; } - TokenStream::Iterator::Iterator(Zone* zone, const TokenStream& tokens, TokenPosition token_pos, @@ -9071,7 +8631,6 @@ TokenStream::Iterator::Iterator(Zone* zone, } } - void TokenStream::Iterator::SetStream(const TokenStream& tokens, TokenPosition token_pos) { tokens_ = tokens.raw(); @@ -9086,12 +8645,10 @@ void TokenStream::Iterator::SetStream(const TokenStream& tokens, SetCurrentPosition(token_pos); } - bool TokenStream::Iterator::IsValid() const { return !tokens_.IsNull(); } - Token::Kind TokenStream::Iterator::LookaheadTokenKind(intptr_t num_tokens) { intptr_t saved_position = stream_.Position(); Token::Kind kind = Token::kILLEGAL; @@ -9121,18 +8678,15 @@ Token::Kind TokenStream::Iterator::LookaheadTokenKind(intptr_t num_tokens) { return kind; } - TokenPosition TokenStream::Iterator::CurrentPosition() const { return TokenPosition(cur_token_pos_); } - void TokenStream::Iterator::SetCurrentPosition(TokenPosition token_pos) { stream_.SetPosition(token_pos.value()); Advance(); } - void TokenStream::Iterator::Advance() { intptr_t value; do { @@ -9156,7 +8710,6 @@ void TokenStream::Iterator::Advance() { cur_token_kind_ = Token::kIDENT; } - RawObject* TokenStream::Iterator::CurrentToken() const { if (cur_token_obj_index_ != -1) { return token_objects_.At(cur_token_obj_index_); @@ -9165,13 +8718,11 @@ RawObject* TokenStream::Iterator::CurrentToken() const { } } - RawString* TokenStream::Iterator::CurrentLiteral() const { obj_ = CurrentToken(); return MakeLiteralToken(obj_); } - RawString* TokenStream::Iterator::MakeLiteralToken(const Object& obj) const { if (obj.IsString()) { return reinterpret_cast(obj.raw()); @@ -9187,7 +8738,6 @@ RawString* TokenStream::Iterator::MakeLiteralToken(const Object& obj) const { } } - bool Script::HasSource() const { #if !defined(DART_PRECOMPILED_RUNTIME) return kind() == RawScript::kKernelTag || @@ -9197,7 +8747,6 @@ bool Script::HasSource() const { #endif // !defined(DART_PRECOMPILED_RUNTIME) } - RawString* Script::Source() const { String& source = String::Handle(raw_ptr()->source_); if (source.IsNull()) { @@ -9206,7 +8755,6 @@ RawString* Script::Source() const { return raw_ptr()->source_; } - RawString* Script::GenerateSource() const { #if !defined(DART_PRECOMPILED_RUNTIME) if (kind() == RawScript::kKernelTag) { @@ -9227,42 +8775,34 @@ RawString* Script::GenerateSource() const { return token_stream.GenerateSource(); } - void Script::set_compile_time_constants(const Array& value) const { StorePointer(&raw_ptr()->compile_time_constants_, value.raw()); } - void Script::set_kernel_data(const uint8_t* kernel_data) const { StoreNonPointer(&raw_ptr()->kernel_data_, kernel_data); } - void Script::set_kernel_data_size(const intptr_t kernel_data_size) const { StoreNonPointer(&raw_ptr()->kernel_data_size_, kernel_data_size); } - void Script::set_kernel_script_index(const intptr_t kernel_script_index) const { StoreNonPointer(&raw_ptr()->kernel_script_index_, kernel_script_index); } - void Script::set_kernel_string_offsets(const TypedData& offsets) const { StorePointer(&raw_ptr()->kernel_string_offsets_, offsets.raw()); } - void Script::set_kernel_string_data(const TypedData& data) const { StorePointer(&raw_ptr()->kernel_string_data_, data.raw()); } - void Script::set_kernel_canonical_names(const TypedData& names) const { StorePointer(&raw_ptr()->kernel_canonical_names_, names.raw()); } - RawGrowableObjectArray* Script::GenerateLineNumberArray() const { Zone* zone = Thread::Current()->zone(); const GrowableObjectArray& info = @@ -9392,7 +8932,6 @@ RawGrowableObjectArray* Script::GenerateLineNumberArray() const { return info.raw(); } - const char* Script::GetKindAsCString() const { switch (kind()) { case RawScript::kScriptTag: @@ -9414,17 +8953,14 @@ const char* Script::GetKindAsCString() const { return NULL; } - void Script::set_url(const String& value) const { StorePointer(&raw_ptr()->url_, value.raw()); } - void Script::set_resolved_url(const String& value) const { StorePointer(&raw_ptr()->resolved_url_, value.raw()); } - void Script::set_source(const String& value) const { StorePointer(&raw_ptr()->source_, value.raw()); } @@ -9433,7 +8969,6 @@ void Script::set_line_starts(const Array& value) const { StorePointer(&raw_ptr()->line_starts_, value.raw()); } - void Script::set_debug_positions(const Array& value) const { StorePointer(&raw_ptr()->debug_positions_, value.raw()); } @@ -9453,7 +8988,6 @@ RawArray* Script::yield_positions() const { return raw_ptr()->yield_positions_; } - RawArray* Script::line_starts() const { #if !defined(DART_PRECOMPILED_RUNTIME) const Array& line_starts_array = Array::Handle(raw_ptr()->line_starts_); @@ -9465,7 +8999,6 @@ RawArray* Script::line_starts() const { return raw_ptr()->line_starts_; } - RawArray* Script::debug_positions() const { #if !defined(DART_PRECOMPILED_RUNTIME) Array& debug_positions_array = Array::Handle(raw_ptr()->debug_positions_); @@ -9481,17 +9014,14 @@ void Script::set_kind(RawScript::Kind value) const { StoreNonPointer(&raw_ptr()->kind_, value); } - void Script::set_load_timestamp(int64_t value) const { StoreNonPointer(&raw_ptr()->load_timestamp_, value); } - void Script::set_tokens(const TokenStream& value) const { StorePointer(&raw_ptr()->tokens_, value.raw()); } - void Script::Tokenize(const String& private_key, bool use_shared_tokens) const { if (kind() == RawScript::kKernelTag) { return; @@ -9514,7 +9044,6 @@ void Script::Tokenize(const String& private_key, bool use_shared_tokens) const { INC_STAT(thread, src_length, src.Length()); } - void Script::SetLocationOffset(intptr_t line_offset, intptr_t col_offset) const { ASSERT(line_offset >= 0); @@ -9523,7 +9052,6 @@ void Script::SetLocationOffset(intptr_t line_offset, StoreNonPointer(&raw_ptr()->col_offset_, col_offset); } - // Specialized for AOT compilation, which does this lookup for every token // position that could be part of a stack trace. intptr_t Script::GetTokenLineUsingLineStarts( @@ -9574,7 +9102,6 @@ intptr_t Script::GetTokenLineUsingLineStarts( return min + 1; // Line numbers start at 1. } - void Script::GetTokenLocation(TokenPosition token_pos, intptr_t* line, intptr_t* column, @@ -9680,7 +9207,6 @@ void Script::GetTokenLocation(TokenPosition token_pos, } } - void Script::TokenRangeAtLine(intptr_t line_number, TokenPosition* first_token_index, TokenPosition* last_token_index) const { @@ -9753,13 +9279,11 @@ void Script::TokenRangeAtLine(intptr_t line_number, *last_token_index = end_pos; } - int32_t Script::SourceFingerprint() const { return SourceFingerprint(TokenPosition(TokenPosition::kMinSourcePos), TokenPosition(TokenPosition::kMaxSourcePos)); } - int32_t Script::SourceFingerprint(TokenPosition start, TokenPosition end) const { uint32_t result = 0; @@ -9790,7 +9314,6 @@ int32_t Script::SourceFingerprint(TokenPosition start, return result; } - RawString* Script::GetLine(intptr_t line_number, Heap::Space space) const { const String& src = String::Handle(Source()); if (src.IsNull()) { @@ -9826,7 +9349,6 @@ RawString* Script::GetLine(intptr_t line_number, Heap::Space space) const { } } - RawString* Script::GetSnippet(TokenPosition from, TokenPosition to) const { intptr_t from_line; intptr_t from_column; @@ -9837,7 +9359,6 @@ RawString* Script::GetSnippet(TokenPosition from, TokenPosition to) const { return GetSnippet(from_line, from_column, to_line, to_column); } - RawString* Script::GetSnippet(intptr_t from_line, intptr_t from_column, intptr_t to_line, @@ -9892,7 +9413,6 @@ RawString* Script::GetSnippet(intptr_t from_line, return snippet.raw(); } - RawScript* Script::New() { ASSERT(Object::script_class() != Class::null()); RawObject* raw = @@ -9900,14 +9420,12 @@ RawScript* Script::New() { return reinterpret_cast(raw); } - RawScript* Script::New(const String& url, const String& source, RawScript::Kind kind) { return Script::New(url, url, source, kind); } - RawScript* Script::New(const String& url, const String& resolved_url, const String& source, @@ -9926,13 +9444,11 @@ RawScript* Script::New(const String& url, return result.raw(); } - const char* Script::ToCString() const { const String& name = String::Handle(url()); return OS::SCreate(Thread::Current()->zone(), "Script(%s)", name.ToCString()); } - RawLibrary* Script::FindLibrary() const { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -9953,7 +9469,6 @@ RawLibrary* Script::FindLibrary() const { return Library::null(); } - DictionaryIterator::DictionaryIterator(const Library& library) : array_(Array::Handle(library.dictionary())), // Last element in array is a Smi indicating the number of entries used. @@ -9962,7 +9477,6 @@ DictionaryIterator::DictionaryIterator(const Library& library) MoveToNextObject(); } - RawObject* DictionaryIterator::GetNext() { ASSERT(HasNext()); int ix = next_ix_++; @@ -9971,7 +9485,6 @@ RawObject* DictionaryIterator::GetNext() { return array_.At(ix); } - void DictionaryIterator::MoveToNextObject() { Object& obj = Object::Handle(array_.At(next_ix_)); while (obj.IsNull() && HasNext()) { @@ -9980,7 +9493,6 @@ void DictionaryIterator::MoveToNextObject() { } } - ClassDictionaryIterator::ClassDictionaryIterator(const Library& library, IterationKind kind) : DictionaryIterator(library), @@ -9990,7 +9502,6 @@ ClassDictionaryIterator::ClassDictionaryIterator(const Library& library, MoveToNextClass(); } - RawClass* ClassDictionaryIterator::GetNextClass() { ASSERT(HasNext()); Class& cls = Class::Handle(); @@ -10006,7 +9517,6 @@ RawClass* ClassDictionaryIterator::GetNextClass() { return cls.raw(); } - void ClassDictionaryIterator::MoveToNextClass() { Object& obj = Object::Handle(); while (next_ix_ < size_) { @@ -10018,13 +9528,11 @@ void ClassDictionaryIterator::MoveToNextClass() { } } - LibraryPrefixIterator::LibraryPrefixIterator(const Library& library) : DictionaryIterator(library) { Advance(); } - RawLibraryPrefix* LibraryPrefixIterator::GetNext() { ASSERT(HasNext()); int ix = next_ix_++; @@ -10033,7 +9541,6 @@ RawLibraryPrefix* LibraryPrefixIterator::GetNext() { return LibraryPrefix::Cast(obj).raw(); } - void LibraryPrefixIterator::Advance() { Object& obj = Object::Handle(array_.At(next_ix_)); while (!obj.IsLibraryPrefix() && HasNext()) { @@ -10042,7 +9549,6 @@ void LibraryPrefixIterator::Advance() { } } - static void ReportTooManyImports(const Library& lib) { const String& url = String::Handle(lib.url()); Report::MessageF(Report::kError, Script::Handle(lib.LookupScript(url)), @@ -10051,7 +9557,6 @@ static void ReportTooManyImports(const Library& lib) { UNREACHABLE(); } - void Library::set_num_imports(intptr_t value) const { if (!Utils::IsUint(16, value)) { ReportTooManyImports(*this); @@ -10059,7 +9564,6 @@ void Library::set_num_imports(intptr_t value) const { StoreNonPointer(&raw_ptr()->num_imports_, value); } - void Library::SetName(const String& name) const { // Only set name once. ASSERT(!Loaded()); @@ -10067,28 +9571,24 @@ void Library::SetName(const String& name) const { StorePointer(&raw_ptr()->name_, name.raw()); } - void Library::SetLoadInProgress() const { // Must not already be in the process of being loaded. ASSERT(raw_ptr()->load_state_ <= RawLibrary::kLoadRequested); StoreNonPointer(&raw_ptr()->load_state_, RawLibrary::kLoadInProgress); } - void Library::SetLoadRequested() const { // Must not be already loaded. ASSERT(raw_ptr()->load_state_ == RawLibrary::kAllocated); StoreNonPointer(&raw_ptr()->load_state_, RawLibrary::kLoadRequested); } - void Library::SetLoaded() const { // Should not be already loaded or just allocated. ASSERT(LoadInProgress() || LoadRequested()); StoreNonPointer(&raw_ptr()->load_state_, RawLibrary::kLoaded); } - void Library::SetLoadError(const Instance& error) const { // Should not be already successfully loaded or just allocated. ASSERT(LoadInProgress() || LoadRequested() || LoadFailed()); @@ -10096,7 +9596,6 @@ void Library::SetLoadError(const Instance& error) const { StorePointer(&raw_ptr()->load_error_, error.raw()); } - // Traits for looking up Libraries by url in a hash set. class LibraryUrlTraits { public: @@ -10113,7 +9612,6 @@ class LibraryUrlTraits { }; typedef UnorderedHashSet LibraryLoadErrorSet; - RawInstance* Library::TransitiveLoadError() const { if (LoadError() != Instance::null()) { return LoadError(); @@ -10145,7 +9643,6 @@ RawInstance* Library::TransitiveLoadError() const { return error.raw(); } - void Library::AddPatchClass(const Class& cls) const { ASSERT(Thread::Current()->IsMutatorThread()); ASSERT(cls.is_patch()); @@ -10155,7 +9652,6 @@ void Library::AddPatchClass(const Class& cls) const { patch_classes.Add(cls); } - RawClass* Library::GetPatchClass(const String& name) const { ASSERT(Thread::Current()->IsMutatorThread()); const GrowableObjectArray& patch_classes = @@ -10171,7 +9667,6 @@ RawClass* Library::GetPatchClass(const String& name) const { return Class::null(); } - void Library::RemovePatchClass(const Class& cls) const { ASSERT(Thread::Current()->IsMutatorThread()); ASSERT(cls.is_patch()); @@ -10192,7 +9687,6 @@ void Library::RemovePatchClass(const Class& cls) const { patch_classes.SetAt(i, patch_script); } - static RawString* MakeClassMetaName(Thread* thread, Zone* zone, const Class& cls) { @@ -10200,7 +9694,6 @@ static RawString* MakeClassMetaName(Thread* thread, String::Handle(zone, cls.Name())); } - static RawString* MakeFieldMetaName(Thread* thread, Zone* zone, const Field& field) { @@ -10214,7 +9707,6 @@ static RawString* MakeFieldMetaName(Thread* thread, return Symbols::FromConcatAll(thread, pieces); } - static RawString* MakeFunctionMetaName(Thread* thread, Zone* zone, const Function& func) { @@ -10228,7 +9720,6 @@ static RawString* MakeFunctionMetaName(Thread* thread, return Symbols::FromConcatAll(thread, pieces); } - static RawString* MakeTypeParameterMetaName(Thread* thread, Zone* zone, const TypeParameter& param) { @@ -10243,7 +9734,6 @@ static RawString* MakeTypeParameterMetaName(Thread* thread, return Symbols::FromConcatAll(thread, pieces); } - void Library::AddMetadata(const Object& owner, const String& name, TokenPosition token_pos, @@ -10266,7 +9756,6 @@ void Library::AddMetadata(const Object& owner, metadata.Add(field, Heap::kOld); } - void Library::AddClassMetadata(const Class& cls, const Object& tl_owner, TokenPosition token_pos, @@ -10280,7 +9769,6 @@ void Library::AddClassMetadata(const Class& cls, token_pos, kernel_offset); } - void Library::AddFieldMetadata(const Field& field, TokenPosition token_pos, intptr_t kernel_offset) const { @@ -10291,7 +9779,6 @@ void Library::AddFieldMetadata(const Field& field, token_pos, kernel_offset); } - void Library::AddFunctionMetadata(const Function& func, TokenPosition token_pos, intptr_t kernel_offset) const { @@ -10302,7 +9789,6 @@ void Library::AddFunctionMetadata(const Function& func, token_pos, kernel_offset); } - void Library::AddTypeParameterMetadata(const TypeParameter& param, TokenPosition token_pos) const { Thread* thread = Thread::Current(); @@ -10313,13 +9799,11 @@ void Library::AddTypeParameterMetadata(const TypeParameter& param, token_pos); } - void Library::AddLibraryMetadata(const Object& tl_owner, TokenPosition token_pos) const { AddMetadata(tl_owner, Symbols::TopLevel(), token_pos); } - RawString* Library::MakeMetadataName(const Object& obj) const { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -10338,7 +9822,6 @@ RawString* Library::MakeMetadataName(const Object& obj) const { return String::null(); } - RawField* Library::GetMetadataField(const String& metaname) const { ASSERT(Thread::Current()->IsMutatorThread()); const GrowableObjectArray& metadata = @@ -10356,7 +9839,6 @@ RawField* Library::GetMetadataField(const String& metaname) const { return Field::null(); } - RawObject* Library::GetMetadata(const Object& obj) const { #if defined(DART_PRECOMPILED_RUNTIME) return Object::empty_array().raw(); @@ -10388,7 +9870,6 @@ RawObject* Library::GetMetadata(const Object& obj) const { #endif // defined(DART_PRECOMPILED_RUNTIME) } - static bool ShouldBePrivate(const String& name) { return (name.Length() >= 1 && name.CharAt(0) == '_') || (name.Length() >= 5 && @@ -10398,7 +9879,6 @@ static bool ShouldBePrivate(const String& name) { name.CharAt(3) == ':')); } - RawObject* Library::ResolveName(const String& name) const { Object& obj = Object::Handle(); if (FLAG_use_lib_cache && LookupResolvedNamesCache(name, &obj)) { @@ -10427,7 +9907,6 @@ RawObject* Library::ResolveName(const String& name) const { return obj.raw(); } - class StringEqualsTraits { public: static const char* Name() { return "StringEqualsTraits"; } @@ -10440,7 +9919,6 @@ class StringEqualsTraits { }; typedef UnorderedHashMap ResolvedNamesMap; - // Returns true if the name is found in the cache, false no cache hit. // obj is set to the cached entry. It may be null, indicating that the // name does not resolve to anything in this library. @@ -10465,7 +9943,6 @@ bool Library::LookupResolvedNamesCache(const String& name, Object* obj) const { return present; } - // Add a name to the resolved name cache. This name resolves to the // given object in this library scope. obj may be null, which means // the name does not resolve to anything in this library scope. @@ -10482,7 +9959,6 @@ void Library::AddToResolvedNamesCache(const String& name, StorePointer(&raw_ptr()->resolved_names_, cache.Release().raw()); } - bool Library::LookupExportedNamesCache(const String& name, Object* obj) const { ASSERT(FLAG_use_exp_cache); if (exported_names() == Array::null()) { @@ -10518,7 +9994,6 @@ void Library::AddToExportedNamesCache(const String& name, StorePointer(&raw_ptr()->exported_names_, cache.Release().raw()); } - void Library::InvalidateResolvedName(const String& name) const { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -10542,7 +10017,6 @@ void Library::InvalidateResolvedName(const String& name) const { } } - // Invalidate all exported names caches in the isolate. void Library::InvalidateExportedNamesCaches() { GrowableObjectArray& libs = GrowableObjectArray::Handle( @@ -10555,7 +10029,6 @@ void Library::InvalidateExportedNamesCaches() { } } - void Library::RehashDictionary(const Array& old_dict, intptr_t new_dict_size) const { intptr_t old_dict_size = old_dict.Length() - 1; @@ -10591,7 +10064,6 @@ void Library::RehashDictionary(const Array& old_dict, StorePointer(&raw_ptr()->dictionary_, new_dict.raw()); } - void Library::AddObject(const Object& obj, const String& name) const { ASSERT(Thread::Current()->IsMutatorThread()); ASSERT(obj.IsClass() || obj.IsFunction() || obj.IsField() || @@ -10629,7 +10101,6 @@ void Library::AddObject(const Object& obj, const String& name) const { } } - // Lookup a name in the library's re-export namespace. // This lookup can occur from two different threads: background compiler and // mutator thread. @@ -10672,7 +10143,6 @@ RawObject* Library::LookupReExport(const String& name, return obj.raw(); } - RawObject* Library::LookupEntry(const String& name, intptr_t* index) const { Thread* thread = Thread::Current(); REUSABLE_ARRAY_HANDLESCOPE(thread); @@ -10698,7 +10168,6 @@ RawObject* Library::LookupEntry(const String& name, intptr_t* index) const { return Object::null(); } - void Library::ReplaceObject(const Object& obj, const String& name) const { ASSERT(!Compiler::IsBackgroundCompilation()); ASSERT(obj.IsClass() || obj.IsFunction() || obj.IsField()); @@ -10711,7 +10180,6 @@ void Library::ReplaceObject(const Object& obj, const String& name) const { dict.SetAt(index, obj); } - void Library::AddClass(const Class& cls) const { ASSERT(!Compiler::IsBackgroundCompilation()); const String& class_name = String::Handle(cls.Name()); @@ -10721,7 +10189,6 @@ void Library::AddClass(const Class& cls) const { InvalidateResolvedName(class_name); } - static void AddScriptIfUnique(const GrowableObjectArray& scripts, const Script& candidate) { if (candidate.IsNull()) { @@ -10740,7 +10207,6 @@ static void AddScriptIfUnique(const GrowableObjectArray& scripts, scripts.Add(candidate); } - RawArray* Library::LoadedScripts() const { ASSERT(Thread::Current()->IsMutatorThread()); // We compute the list of loaded scripts lazily. The result is @@ -10805,7 +10271,6 @@ RawArray* Library::LoadedScripts() const { return loaded_scripts(); } - // TODO(hausner): we might want to add a script dictionary to the // library class to make this lookup faster. RawScript* Library::LookupScript(const String& url) const { @@ -10836,13 +10301,11 @@ RawScript* Library::LookupScript(const String& url) const { return Script::null(); } - RawObject* Library::LookupLocalObject(const String& name) const { intptr_t index; return LookupEntry(name, &index); } - RawField* Library::LookupFieldAllowPrivate(const String& name) const { Object& obj = Object::Handle(LookupObjectAllowPrivate(name)); if (obj.IsField()) { @@ -10851,7 +10314,6 @@ RawField* Library::LookupFieldAllowPrivate(const String& name) const { return Field::null(); } - RawField* Library::LookupLocalField(const String& name) const { Object& obj = Object::Handle(LookupLocalObjectAllowPrivate(name)); if (obj.IsField()) { @@ -10860,7 +10322,6 @@ RawField* Library::LookupLocalField(const String& name) const { return Field::null(); } - RawFunction* Library::LookupFunctionAllowPrivate(const String& name) const { Object& obj = Object::Handle(LookupObjectAllowPrivate(name)); if (obj.IsFunction()) { @@ -10869,7 +10330,6 @@ RawFunction* Library::LookupFunctionAllowPrivate(const String& name) const { return Function::null(); } - RawFunction* Library::LookupLocalFunction(const String& name) const { Object& obj = Object::Handle(LookupLocalObjectAllowPrivate(name)); if (obj.IsFunction()) { @@ -10878,7 +10338,6 @@ RawFunction* Library::LookupLocalFunction(const String& name) const { return Function::null(); } - RawObject* Library::LookupLocalObjectAllowPrivate(const String& name) const { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -10891,7 +10350,6 @@ RawObject* Library::LookupLocalObjectAllowPrivate(const String& name) const { return obj.raw(); } - RawObject* Library::LookupObjectAllowPrivate(const String& name) const { // First check if name is found in the local scope of the library. Object& obj = Object::Handle(LookupLocalObjectAllowPrivate(name)); @@ -10908,7 +10366,6 @@ RawObject* Library::LookupObjectAllowPrivate(const String& name) const { return LookupImportedObject(name); } - RawObject* Library::LookupImportedObject(const String& name) const { Object& obj = Object::Handle(); Namespace& import = Namespace::Handle(); @@ -10970,7 +10427,6 @@ RawObject* Library::LookupImportedObject(const String& name) const { return found_obj.raw(); } - RawClass* Library::LookupClass(const String& name) const { Object& obj = Object::Handle(ResolveName(name)); if (obj.IsClass()) { @@ -10979,7 +10435,6 @@ RawClass* Library::LookupClass(const String& name) const { return Class::null(); } - RawClass* Library::LookupLocalClass(const String& name) const { Object& obj = Object::Handle(LookupLocalObject(name)); if (obj.IsClass()) { @@ -10988,7 +10443,6 @@ RawClass* Library::LookupLocalClass(const String& name) const { return Class::null(); } - RawClass* Library::LookupClassAllowPrivate(const String& name) const { // See if the class is available in this library or in the top level // scope of any imported library. @@ -11010,7 +10464,6 @@ RawClass* Library::LookupClassAllowPrivate(const String& name) const { return Class::null(); } - // Mixin applications can have multiple private keys from different libraries. RawClass* Library::SlowLookupClassAllowMultiPartPrivate( const String& name) const { @@ -11030,7 +10483,6 @@ RawClass* Library::SlowLookupClassAllowMultiPartPrivate( return Class::null(); } - RawLibraryPrefix* Library::LookupLocalLibraryPrefix(const String& name) const { const Object& obj = Object::Handle(LookupLocalObject(name)); if (obj.IsLibraryPrefix()) { @@ -11039,13 +10491,11 @@ RawLibraryPrefix* Library::LookupLocalLibraryPrefix(const String& name) const { return LibraryPrefix::null(); } - void Library::set_toplevel_class(const Class& value) const { ASSERT(raw_ptr()->toplevel_class_ == Class::null()); StorePointer(&raw_ptr()->toplevel_class_, value.raw()); } - RawLibrary* Library::ImportLibraryAt(intptr_t index) const { Namespace& import = Namespace::Handle(ImportAt(index)); if (import.IsNull()) { @@ -11054,7 +10504,6 @@ RawLibrary* Library::ImportLibraryAt(intptr_t index) const { return import.library(); } - RawNamespace* Library::ImportAt(intptr_t index) const { if ((index < 0) || index >= num_imports()) { return Namespace::null(); @@ -11063,7 +10512,6 @@ RawNamespace* Library::ImportAt(intptr_t index) const { return Namespace::RawCast(import_list.At(index)); } - bool Library::ImportsCorelib() const { Zone* zone = Thread::Current()->zone(); Library& imported = Library::Handle(zone); @@ -11089,7 +10537,6 @@ bool Library::ImportsCorelib() const { return false; } - void Library::DropDependenciesAndCaches() const { StorePointer(&raw_ptr()->imports_, Object::empty_array().raw()); StorePointer(&raw_ptr()->exports_, Object::empty_array().raw()); @@ -11099,7 +10546,6 @@ void Library::DropDependenciesAndCaches() const { StorePointer(&raw_ptr()->loaded_scripts_, Array::null()); } - void Library::AddImport(const Namespace& ns) const { Array& imports = Array::Handle(this->imports()); intptr_t capacity = imports.Length(); @@ -11113,14 +10559,12 @@ void Library::AddImport(const Namespace& ns) const { set_num_imports(index + 1); } - // Convenience function to determine whether the export list is // non-empty. bool Library::HasExports() const { return exports() != Object::empty_array().raw(); } - // We add one namespace at a time to the exports array and don't // pre-allocate any unused capacity. The assumption is that // re-exports are quite rare. @@ -11132,7 +10576,6 @@ void Library::AddExport(const Namespace& ns) const { exports.SetAt(num_exports, ns); } - static RawArray* NewDictionary(intptr_t initial_size) { const Array& dict = Array::Handle(Array::New(initial_size + 1, Heap::kOld)); // The last element of the dictionary specifies the number of in use slots. @@ -11140,38 +10583,32 @@ static RawArray* NewDictionary(intptr_t initial_size) { return dict.raw(); } - void Library::InitResolvedNamesCache() const { ASSERT(Thread::Current()->IsMutatorThread()); StorePointer(&raw_ptr()->resolved_names_, HashTables::New(64)); } - void Library::ClearResolvedNamesCache() const { ASSERT(Thread::Current()->IsMutatorThread()); StorePointer(&raw_ptr()->resolved_names_, Array::null()); } - void Library::InitExportedNamesCache() const { StorePointer(&raw_ptr()->exported_names_, HashTables::New(16)); } - void Library::ClearExportedNamesCache() const { StorePointer(&raw_ptr()->exported_names_, Array::null()); } - void Library::InitClassDictionary() const { // TODO(iposva): Find reasonable initial size. const int kInitialElementCount = 16; StorePointer(&raw_ptr()->dictionary_, NewDictionary(kInitialElementCount)); } - void Library::InitImportList() const { const Array& imports = Array::Handle(Array::New(kInitialImportsCapacity, Heap::kOld)); @@ -11179,7 +10616,6 @@ void Library::InitImportList() const { StoreNonPointer(&raw_ptr()->num_imports_, 0); } - RawLibrary* Library::New() { ASSERT(Object::library_class() != Class::null()); RawObject* raw = @@ -11187,7 +10623,6 @@ RawLibrary* Library::New() { return reinterpret_cast(raw); } - RawLibrary* Library::NewLibraryHelper(const String& url, bool import_core_lib) { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -11247,12 +10682,10 @@ RawLibrary* Library::NewLibraryHelper(const String& url, bool import_core_lib) { return result.raw(); } - RawLibrary* Library::New(const String& url) { return NewLibraryHelper(url, false); } - void Library::InitCoreLibrary(Isolate* isolate) { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -11271,7 +10704,6 @@ void Library::InitCoreLibrary(Isolate* isolate) { core_lib.AddObject(cls, String::Handle(zone, cls.Name())); } - RawObject* Library::Evaluate(const String& expr, const Array& param_names, const Array& param_values) const { @@ -11281,7 +10713,6 @@ RawObject* Library::Evaluate(const String& expr, return top_level_class.Evaluate(expr, param_names, param_values); } - void Library::InitNativeWrappersLibrary(Isolate* isolate, bool is_kernel) { static const int kNumNativeWrappersClasses = 4; COMPILE_ASSERT((kNumNativeWrappersClasses > 0) && @@ -11316,7 +10747,6 @@ void Library::InitNativeWrappersLibrary(Isolate* isolate, bool is_kernel) { } } - // LibraryLookupSet maps URIs to libraries. class LibraryLookupTraits { public: @@ -11337,7 +10767,6 @@ class LibraryLookupTraits { }; typedef UnorderedHashMap LibraryLookupMap; - // Returns library with given url in current isolate, or NULL. RawLibrary* Library::LookupLibrary(Thread* thread, const String& url) { Zone* zone = thread->zone(); @@ -11360,13 +10789,11 @@ RawLibrary* Library::LookupLibrary(Thread* thread, const String& url) { return lib.raw(); } - RawError* Library::Patch(const Script& script) const { ASSERT(script.kind() == RawScript::kPatchTag); return Compiler::Compile(*this, script); } - bool Library::IsPrivate(const String& name) { if (ShouldBePrivate(name)) return true; // Factory names: List._fromLiteral. @@ -11380,7 +10807,6 @@ bool Library::IsPrivate(const String& name) { return false; } - // Create a private key for this library. It is based on the hash of the // library URI and the sequence number of the library to guarantee unique // private keys without having to verify. @@ -11420,14 +10846,12 @@ void Library::AllocatePrivateKey() const { StorePointer(&raw_ptr()->private_key_, key.raw()); } - const String& Library::PrivateCoreLibName(const String& member) { const Library& core_lib = Library::Handle(Library::CoreLibrary()); const String& private_name = String::ZoneHandle(core_lib.PrivateName(member)); return private_name; } - RawClass* Library::LookupCoreClass(const String& class_name) { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -11441,7 +10865,6 @@ RawClass* Library::LookupCoreClass(const String& class_name) { return core_lib.LookupClass(name); } - // Cannot handle qualified names properly as it only appends private key to // the end (e.g. _Alfa.foo -> _Alfa.foo@...). RawString* Library::PrivateName(const String& name) const { @@ -11456,7 +10879,6 @@ RawString* Library::PrivateName(const String& name) const { return str.raw(); } - RawLibrary* Library::GetLibrary(intptr_t index) { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -11472,7 +10894,6 @@ RawLibrary* Library::GetLibrary(intptr_t index) { return Library::null(); } - void Library::Register(Thread* thread) const { Zone* zone = thread->zone(); Isolate* isolate = thread->isolate(); @@ -11501,7 +10922,6 @@ void Library::Register(Thread* thread) const { object_store->set_libraries_map(map.Release()); } - void Library::RegisterLibraries(Thread* thread, const GrowableObjectArray& libs) { Zone* zone = thread->zone(); @@ -11522,81 +10942,66 @@ void Library::RegisterLibraries(Thread* thread, isolate->object_store()->set_libraries_map(map.Release()); } - RawLibrary* Library::AsyncLibrary() { return Isolate::Current()->object_store()->async_library(); } - RawLibrary* Library::ConvertLibrary() { return Isolate::Current()->object_store()->convert_library(); } - RawLibrary* Library::CoreLibrary() { return Isolate::Current()->object_store()->core_library(); } - RawLibrary* Library::CollectionLibrary() { return Isolate::Current()->object_store()->collection_library(); } - RawLibrary* Library::DeveloperLibrary() { return Isolate::Current()->object_store()->developer_library(); } - RawLibrary* Library::InternalLibrary() { return Isolate::Current()->object_store()->_internal_library(); } - RawLibrary* Library::IsolateLibrary() { return Isolate::Current()->object_store()->isolate_library(); } - RawLibrary* Library::MathLibrary() { return Isolate::Current()->object_store()->math_library(); } - #if !defined(DART_PRECOMPILED_RUNTIME) RawLibrary* Library::MirrorsLibrary() { return Isolate::Current()->object_store()->mirrors_library(); } #endif - RawLibrary* Library::NativeWrappersLibrary() { return Isolate::Current()->object_store()->native_wrappers_library(); } - RawLibrary* Library::ProfilerLibrary() { return Isolate::Current()->object_store()->profiler_library(); } - RawLibrary* Library::TypedDataLibrary() { return Isolate::Current()->object_store()->typed_data_library(); } - RawLibrary* Library::VMServiceLibrary() { return Isolate::Current()->object_store()->_vmservice_library(); } - const char* Library::ToCString() const { const String& name = String::Handle(url()); return OS::SCreate(Thread::Current()->zone(), "Library:'%s'", name.ToCString()); } - RawLibrary* LibraryPrefix::GetLibrary(int index) const { if ((index >= 0) || (index < num_imports())) { const Array& imports = Array::Handle(this->imports()); @@ -11607,7 +11012,6 @@ RawLibrary* LibraryPrefix::GetLibrary(int index) const { return Library::null(); } - RawInstance* LibraryPrefix::LoadError() const { Thread* thread = Thread::Current(); Isolate* isolate = thread->isolate(); @@ -11633,7 +11037,6 @@ RawInstance* LibraryPrefix::LoadError() const { return error.raw(); } - bool LibraryPrefix::ContainsLibrary(const Library& library) const { int32_t num_current_imports = num_imports(); if (num_current_imports > 0) { @@ -11652,7 +11055,6 @@ bool LibraryPrefix::ContainsLibrary(const Library& library) const { return false; } - void LibraryPrefix::AddImport(const Namespace& import) const { intptr_t num_current_imports = num_imports(); @@ -11672,7 +11074,6 @@ void LibraryPrefix::AddImport(const Namespace& import) const { set_num_imports(num_current_imports + 1); } - RawObject* LibraryPrefix::LookupObject(const String& name) const { if (!is_loaded() && !FLAG_load_deferred_eagerly) { return Object::null(); @@ -11737,7 +11138,6 @@ RawObject* LibraryPrefix::LookupObject(const String& name) const { return found_obj.raw(); } - RawClass* LibraryPrefix::LookupClass(const String& class_name) const { const Object& obj = Object::Handle(LookupObject(class_name)); if (obj.IsClass()) { @@ -11746,12 +11146,10 @@ RawClass* LibraryPrefix::LookupClass(const String& class_name) const { return Class::null(); } - void LibraryPrefix::set_is_loaded() const { StoreNonPointer(&raw_ptr()->is_loaded_, true); } - bool LibraryPrefix::LoadLibrary() const { // Non-deferred prefixes are loaded. ASSERT(is_deferred_load() || is_loaded()); @@ -11805,17 +11203,14 @@ bool LibraryPrefix::LoadLibrary() const { return false; // Load request not yet completed. } - RawArray* LibraryPrefix::dependent_code() const { return raw_ptr()->dependent_code_; } - void LibraryPrefix::set_dependent_code(const Array& array) const { StorePointer(&raw_ptr()->dependent_code_, array.raw()); } - class PrefixDependentArray : public WeakCodeReferences { public: explicit PrefixDependentArray(const LibraryPrefix& prefix) @@ -11849,7 +11244,6 @@ class PrefixDependentArray : public WeakCodeReferences { DISALLOW_COPY_AND_ASSIGN(PrefixDependentArray); }; - void LibraryPrefix::RegisterDependentCode(const Code& code) const { ASSERT(is_deferred_load()); // In background compilation, a library can be loaded while we are compiling. @@ -11859,21 +11253,18 @@ void LibraryPrefix::RegisterDependentCode(const Code& code) const { a.Register(code); } - void LibraryPrefix::InvalidateDependentCode() const { PrefixDependentArray a(*this); a.DisableCode(); set_is_loaded(); } - RawLibraryPrefix* LibraryPrefix::New() { RawObject* raw = Object::Allocate(LibraryPrefix::kClassId, LibraryPrefix::InstanceSize(), Heap::kOld); return reinterpret_cast(raw); } - RawLibraryPrefix* LibraryPrefix::New(const String& name, const Namespace& import, bool deferred_load, @@ -11889,18 +11280,15 @@ RawLibraryPrefix* LibraryPrefix::New(const String& name, return result.raw(); } - void LibraryPrefix::set_name(const String& value) const { ASSERT(value.IsSymbol()); StorePointer(&raw_ptr()->name_, value.raw()); } - void LibraryPrefix::set_imports(const Array& value) const { StorePointer(&raw_ptr()->imports_, value.raw()); } - void LibraryPrefix::set_num_imports(intptr_t value) const { if (!Utils::IsUint(16, value)) { ReportTooManyImports(Library::Handle(importer())); @@ -11908,24 +11296,20 @@ void LibraryPrefix::set_num_imports(intptr_t value) const { StoreNonPointer(&raw_ptr()->num_imports_, value); } - void LibraryPrefix::set_importer(const Library& value) const { StorePointer(&raw_ptr()->importer_, value.raw()); } - const char* LibraryPrefix::ToCString() const { const String& prefix = String::Handle(name()); return OS::SCreate(Thread::Current()->zone(), "LibraryPrefix:'%s'", prefix.ToCString()); } - void Namespace::set_metadata_field(const Field& value) const { StorePointer(&raw_ptr()->metadata_field_, value.raw()); } - void Namespace::AddMetadata(const Object& owner, TokenPosition token_pos) { ASSERT(Field::Handle(metadata_field()).IsNull()); Field& field = Field::Handle(Field::NewTopLevel(Symbols::TopLevel(), @@ -11938,7 +11322,6 @@ void Namespace::AddMetadata(const Object& owner, TokenPosition token_pos) { set_metadata_field(field); } - RawObject* Namespace::GetMetadata() const { #if defined(DART_PRECOMPILED_RUNTIME) return Object::empty_array().raw(); @@ -11961,14 +11344,12 @@ RawObject* Namespace::GetMetadata() const { #endif // defined(DART_PRECOMPILED_RUNTIME) } - const char* Namespace::ToCString() const { const Library& lib = Library::Handle(library()); return OS::SCreate(Thread::Current()->zone(), "Namespace for library '%s'", lib.ToCString()); } - bool Namespace::HidesName(const String& name) const { // Quick check for common case with no combinators. if (hide_names() == show_names()) { @@ -12013,7 +11394,6 @@ bool Namespace::HidesName(const String& name) const { return false; } - // Look up object with given name in library and filter out hidden // names. Also look up getters and setters. RawObject* Namespace::Lookup(const String& name, @@ -12071,7 +11451,6 @@ RawObject* Namespace::Lookup(const String& name, return obj.raw(); } - RawNamespace* Namespace::New() { ASSERT(Object::namespace_class() != Class::null()); RawObject* raw = Object::Allocate(Namespace::kClassId, @@ -12079,7 +11458,6 @@ RawNamespace* Namespace::New() { return reinterpret_cast(raw); } - RawNamespace* Namespace::New(const Library& library, const Array& show_names, const Array& hide_names) { @@ -12092,7 +11470,6 @@ RawNamespace* Namespace::New(const Library& library, return result.raw(); } - RawError* Library::CompileAll() { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -12138,7 +11515,6 @@ RawError* Library::CompileAll() { return Error::null(); } - RawError* Library::ParseAll(Thread* thread) { Zone* zone = thread->zone(); Error& error = Error::Handle(zone); @@ -12183,7 +11559,6 @@ RawError* Library::ParseAll(Thread* thread) { return error.raw(); } - // Return Function::null() if function does not exist in libs. RawFunction* Library::GetFunction(const GrowableArray& libs, const char* class_name, @@ -12217,7 +11592,6 @@ RawFunction* Library::GetFunction(const GrowableArray& libs, return Function::null(); } - RawObject* Library::GetFunctionClosure(const String& name) const { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -12243,7 +11617,6 @@ RawObject* Library::GetFunctionClosure(const String& name) const { return func.ImplicitStaticClosure(); } - #if defined(DART_NO_SNAPSHOT) && !defined(PRODUCT) void Library::CheckFunctionFingerprints() { GrowableArray all_libs; @@ -12290,7 +11663,6 @@ void Library::CheckFunctionFingerprints() { #undef CHECK_FINGERPRINTS #undef CHECK_FINGERPRINTS2 - #define CHECK_FACTORY_FINGERPRINTS(symbol, class_name, factory_name, cid, fp) \ func = GetFunction(all_libs, #class_name, #factory_name); \ if (func.IsNull()) { \ @@ -12311,7 +11683,6 @@ void Library::CheckFunctionFingerprints() { } #endif // defined(DART_NO_SNAPSHOT) && !defined(PRODUCT). - RawInstructions* Instructions::New(intptr_t size, bool has_single_entry_point) { ASSERT(size >= 0); ASSERT(Object::instructions_class() != Class::null()); @@ -12332,12 +11703,10 @@ RawInstructions* Instructions::New(intptr_t size, bool has_single_entry_point) { return result.raw(); } - const char* Instructions::ToCString() const { return "Instructions"; } - // Encode integer |value| in SLEB128 format and store into |data|. static void EncodeSLEB128(GrowableArray* data, intptr_t value) { bool is_last_part = false; @@ -12354,7 +11723,6 @@ static void EncodeSLEB128(GrowableArray* data, intptr_t value) { } } - // Decode integer in SLEB128 format from |data| and update |byte_index|. static intptr_t DecodeSLEB128(const uint8_t* data, const intptr_t data_length, @@ -12375,14 +11743,12 @@ static intptr_t DecodeSLEB128(const uint8_t* data, return value; } - // Encode integer in SLEB128 format. void PcDescriptors::EncodeInteger(GrowableArray* data, intptr_t value) { return EncodeSLEB128(data, value); } - // Decode SLEB128 encoded integer. Update byte_index to the next integer. intptr_t PcDescriptors::DecodeInteger(intptr_t* byte_index) const { NoSafepointScope no_safepoint; @@ -12390,7 +11756,6 @@ intptr_t PcDescriptors::DecodeInteger(intptr_t* byte_index) const { return DecodeSLEB128(data, Length(), byte_index); } - RawObjectPool* ObjectPool::New(intptr_t len) { ASSERT(Object::object_pool_class() != Class::null()); if (len < 0 || len > kMaxElements) { @@ -12414,24 +11779,20 @@ RawObjectPool* ObjectPool::New(intptr_t len) { return result.raw(); } - void ObjectPool::set_info_array(const TypedData& info_array) const { StorePointer(&raw_ptr()->info_array_, info_array.raw()); } - ObjectPool::EntryType ObjectPool::InfoAt(intptr_t index) const { ObjectPoolInfo pool_info(*this); return pool_info.InfoAt(index); } - const char* ObjectPool::ToCString() const { Zone* zone = Thread::Current()->zone(); return zone->PrintToString("ObjectPool len:%" Pd, Length()); } - void ObjectPool::DebugPrint() const { THR_Print("Object Pool: 0x%" Px "{\n", reinterpret_cast(raw())); for (intptr_t i = 0; i < Length(); i++) { @@ -12450,17 +11811,14 @@ void ObjectPool::DebugPrint() const { THR_Print("}\n"); } - intptr_t PcDescriptors::Length() const { return raw_ptr()->length_; } - void PcDescriptors::SetLength(intptr_t value) const { StoreNonPointer(&raw_ptr()->length_, value); } - void PcDescriptors::CopyData(GrowableArray* delta_encoded_data) { NoSafepointScope no_safepoint; uint8_t* data = UnsafeMutableNonPointer(&raw_ptr()->data()[0]); @@ -12469,7 +11827,6 @@ void PcDescriptors::CopyData(GrowableArray* delta_encoded_data) { } } - RawPcDescriptors* PcDescriptors::New(GrowableArray* data) { ASSERT(Object::pc_descriptors_class() != Class::null()); Thread* thread = Thread::Current(); @@ -12488,7 +11845,6 @@ RawPcDescriptors* PcDescriptors::New(GrowableArray* data) { return result.raw(); } - RawPcDescriptors* PcDescriptors::New(intptr_t length) { ASSERT(Object::pc_descriptors_class() != Class::null()); Thread* thread = Thread::Current(); @@ -12506,7 +11862,6 @@ RawPcDescriptors* PcDescriptors::New(intptr_t length) { return result.raw(); } - const char* PcDescriptors::KindAsStr(RawPcDescriptors::Kind kind) { switch (kind) { case RawPcDescriptors::kDeopt: @@ -12531,7 +11886,6 @@ const char* PcDescriptors::KindAsStr(RawPcDescriptors::Kind kind) { return ""; } - void PcDescriptors::PrintHeaderString() { // 4 bits per hex digit + 2 for "0x". const int addr_width = (kBitsPerWord / 4) + 2; @@ -12540,7 +11894,6 @@ void PcDescriptors::PrintHeaderString() { THR_Print("%-*s\tkind \tdeopt-id\ttok-ix\ttry-ix\n", addr_width, "pc"); } - const char* PcDescriptors::ToCString() const { // "*" in a printf format specifier tells it to read the field width from // the printf argument list. @@ -12575,7 +11928,6 @@ const char* PcDescriptors::ToCString() const { #undef FORMAT } - // Verify assumptions (in debug mode only). // - No two deopt descriptors have the same deoptimization id. // - No two ic-call descriptors have the same deoptimization id (type feedback). @@ -12619,12 +11971,10 @@ void PcDescriptors::Verify(const Function& function) const { #endif // DEBUG } - void CodeSourceMap::SetLength(intptr_t value) const { StoreNonPointer(&raw_ptr()->length_, value); } - RawCodeSourceMap* CodeSourceMap::New(intptr_t length) { ASSERT(Object::code_source_map_class() != Class::null()); Thread* thread = Thread::Current(); @@ -12640,12 +11990,10 @@ RawCodeSourceMap* CodeSourceMap::New(intptr_t length) { return result.raw(); } - const char* CodeSourceMap::ToCString() const { return "CodeSourceMap"; } - bool StackMap::GetBit(intptr_t bit_index) const { ASSERT(InRange(bit_index)); int byte_index = bit_index >> kBitsPerByteLog2; @@ -12655,7 +12003,6 @@ bool StackMap::GetBit(intptr_t bit_index) const { return (byte & byte_mask); } - void StackMap::SetBit(intptr_t bit_index, bool value) const { ASSERT(InRange(bit_index)); int byte_index = bit_index >> kBitsPerByteLog2; @@ -12670,7 +12017,6 @@ void StackMap::SetBit(intptr_t bit_index, bool value) const { } } - RawStackMap* StackMap::New(intptr_t pc_offset, BitmapBuilder* bmap, intptr_t slow_path_bit_count) { @@ -12705,7 +12051,6 @@ RawStackMap* StackMap::New(intptr_t pc_offset, return result.raw(); } - RawStackMap* StackMap::New(intptr_t length, intptr_t slow_path_bit_count, intptr_t pc_offset) { @@ -12735,7 +12080,6 @@ RawStackMap* StackMap::New(intptr_t length, return result.raw(); } - const char* StackMap::ToCString() const { #define FORMAT "%#05x: " if (IsNull()) { @@ -12762,14 +12106,12 @@ const char* StackMap::ToCString() const { #undef FORMAT } - RawString* LocalVarDescriptors::GetName(intptr_t var_index) const { ASSERT(var_index < Length()); ASSERT(Object::Handle(*raw()->nameAddrAt(var_index)).IsString()); return *raw()->nameAddrAt(var_index); } - void LocalVarDescriptors::SetVar(intptr_t var_index, const String& name, RawLocalVarDescriptors::VarInfo* info) const { @@ -12779,14 +12121,12 @@ void LocalVarDescriptors::SetVar(intptr_t var_index, raw()->data()[var_index] = *info; } - void LocalVarDescriptors::GetInfo(intptr_t var_index, RawLocalVarDescriptors::VarInfo* info) const { ASSERT(var_index < Length()); *info = raw()->data()[var_index]; } - static int PrintVarInfo(char* buffer, int len, intptr_t i, @@ -12804,24 +12144,25 @@ static int PrintVarInfo(char* buffer, static_cast(info.end_pos.value())); } else if (kind == RawLocalVarDescriptors::kContextVar) { return OS::SNPrint( - buffer, len, "%2" Pd - " %-13s level=%-3d index=%-3d" - " begin=%-3d end=%-3d name=%s\n", + buffer, len, + "%2" Pd + " %-13s level=%-3d index=%-3d" + " begin=%-3d end=%-3d name=%s\n", i, LocalVarDescriptors::KindToCString(kind), info.scope_id, index, static_cast(info.begin_pos.Pos()), static_cast(info.end_pos.Pos()), var_name.ToCString()); } else { return OS::SNPrint( - buffer, len, "%2" Pd - " %-13s scope=%-3d index=%-3d" - " begin=%-3d end=%-3d name=%s\n", + buffer, len, + "%2" Pd + " %-13s scope=%-3d index=%-3d" + " begin=%-3d end=%-3d name=%s\n", i, LocalVarDescriptors::KindToCString(kind), info.scope_id, index, static_cast(info.begin_pos.Pos()), static_cast(info.end_pos.Pos()), var_name.ToCString()); } } - const char* LocalVarDescriptors::ToCString() const { if (IsNull()) { return "LocalVarDescriptors: null"; @@ -12850,7 +12191,6 @@ const char* LocalVarDescriptors::ToCString() const { return buffer; } - const char* LocalVarDescriptors::KindToCString( RawLocalVarDescriptors::VarInfoKind kind) { switch (kind) { @@ -12891,17 +12231,14 @@ RawLocalVarDescriptors* LocalVarDescriptors::New(intptr_t num_variables) { return result.raw(); } - intptr_t LocalVarDescriptors::Length() const { return raw_ptr()->num_entries_; } - intptr_t ExceptionHandlers::num_entries() const { return raw_ptr()->num_entries_; } - void ExceptionHandlers::SetHandlerInfo(intptr_t try_index, intptr_t outer_try_index, uword handler_pc_offset, @@ -12931,37 +12268,31 @@ void ExceptionHandlers::GetHandlerInfo(intptr_t try_index, *info = raw_ptr()->data()[try_index]; } - uword ExceptionHandlers::HandlerPCOffset(intptr_t try_index) const { ASSERT((try_index >= 0) && (try_index < num_entries())); return raw_ptr()->data()[try_index].handler_pc_offset; } - intptr_t ExceptionHandlers::OuterTryIndex(intptr_t try_index) const { ASSERT((try_index >= 0) && (try_index < num_entries())); return raw_ptr()->data()[try_index].outer_try_index; } - bool ExceptionHandlers::NeedsStackTrace(intptr_t try_index) const { ASSERT((try_index >= 0) && (try_index < num_entries())); return raw_ptr()->data()[try_index].needs_stacktrace; } - bool ExceptionHandlers::IsGenerated(intptr_t try_index) const { ASSERT((try_index >= 0) && (try_index < num_entries())); return raw_ptr()->data()[try_index].is_generated; } - bool ExceptionHandlers::HasCatchAll(intptr_t try_index) const { ASSERT((try_index >= 0) && (try_index < num_entries())); return raw_ptr()->data()[try_index].has_catch_all; } - void ExceptionHandlers::SetHandledTypes(intptr_t try_index, const Array& handled_types) const { ASSERT((try_index >= 0) && (try_index < num_entries())); @@ -12971,7 +12302,6 @@ void ExceptionHandlers::SetHandledTypes(intptr_t try_index, handled_types_data.SetAt(try_index, handled_types); } - RawArray* ExceptionHandlers::GetHandledTypes(intptr_t try_index) const { ASSERT((try_index >= 0) && (try_index < num_entries())); Array& array = Array::Handle(raw_ptr()->handled_types_data_); @@ -12979,12 +12309,10 @@ RawArray* ExceptionHandlers::GetHandledTypes(intptr_t try_index) const { return array.raw(); } - void ExceptionHandlers::set_handled_types_data(const Array& value) const { StorePointer(&raw_ptr()->handled_types_data_, value.raw()); } - RawExceptionHandlers* ExceptionHandlers::New(intptr_t num_handlers) { ASSERT(Object::exception_handlers_class() != Class::null()); if ((num_handlers < 0) || (num_handlers >= kMaxHandlers)) { @@ -13009,7 +12337,6 @@ RawExceptionHandlers* ExceptionHandlers::New(intptr_t num_handlers) { return result.raw(); } - RawExceptionHandlers* ExceptionHandlers::New(const Array& handled_types_data) { ASSERT(Object::exception_handlers_class() != Class::null()); const intptr_t num_handlers = handled_types_data.Length(); @@ -13032,7 +12359,6 @@ RawExceptionHandlers* ExceptionHandlers::New(const Array& handled_types_data) { return result.raw(); } - const char* ExceptionHandlers::ToCString() const { #define FORMAT1 "%" Pd " => %#x (%" Pd " types) (outer %d) %s\n" #define FORMAT2 " %d. %s\n" @@ -13082,17 +12408,14 @@ const char* ExceptionHandlers::ToCString() const { #undef FORMAT2 } - void SingleTargetCache::set_target(const Code& value) const { StorePointer(&raw_ptr()->target_, value.raw()); } - const char* SingleTargetCache::ToCString() const { return "SingleTargetCache"; } - RawSingleTargetCache* SingleTargetCache::New() { SingleTargetCache& result = SingleTargetCache::Handle(); { @@ -13110,35 +12433,29 @@ RawSingleTargetCache* SingleTargetCache::New() { return result.raw(); } - void UnlinkedCall::set_target_name(const String& value) const { StorePointer(&raw_ptr()->target_name_, value.raw()); } - void UnlinkedCall::set_args_descriptor(const Array& value) const { StorePointer(&raw_ptr()->args_descriptor_, value.raw()); } - const char* UnlinkedCall::ToCString() const { return "UnlinkedCall"; } - RawUnlinkedCall* UnlinkedCall::New() { RawObject* raw = Object::Allocate(UnlinkedCall::kClassId, UnlinkedCall::InstanceSize(), Heap::kOld); return reinterpret_cast(raw); } - void ICData::ResetSwitchable(Zone* zone) const { ASSERT(NumArgsTested() == 1); set_ic_data_array(Array::Handle(zone, CachedEmptyICDataArray(1))); } - const char* ICData::ToCString() const { const String& name = String::Handle(target_name()); const intptr_t num_args = NumArgsTested(); @@ -13150,7 +12467,6 @@ const char* ICData::ToCString() const { name.ToCString(), num_args, num_checks, type_args_len); } - RawFunction* ICData::Owner() const { Object& obj = Object::Handle(raw_ptr()->owner_); if (obj.IsNull()) { @@ -13165,7 +12481,6 @@ RawFunction* ICData::Owner() const { } } - RawICData* ICData::Original() const { if (IsNull()) { return ICData::null(); @@ -13178,31 +12493,26 @@ RawICData* ICData::Original() const { } } - void ICData::SetOriginal(const ICData& value) const { ASSERT(value.IsOriginal()); ASSERT(!value.IsNull()); StorePointer(&raw_ptr()->owner_, reinterpret_cast(value.raw())); } - void ICData::set_owner(const Function& value) const { StorePointer(&raw_ptr()->owner_, reinterpret_cast(value.raw())); } - void ICData::set_target_name(const String& value) const { ASSERT(!value.IsNull()); StorePointer(&raw_ptr()->target_name_, value.raw()); } - void ICData::set_arguments_descriptor(const Array& value) const { ASSERT(!value.IsNull()); StorePointer(&raw_ptr()->args_descriptor_, value.raw()); } - void ICData::set_deopt_id(intptr_t value) const { #if defined(DART_PRECOMPILED_RUNTIME) UNREACHABLE(); @@ -13212,13 +12522,11 @@ void ICData::set_deopt_id(intptr_t value) const { #endif } - void ICData::set_ic_data_array(const Array& value) const { ASSERT(!value.IsNull()); StorePointer(&raw_ptr()->ic_data_, value.raw()); } - #if defined(TAG_IC_DATA) void ICData::set_tag(intptr_t value) const { StoreNonPointer(&raw_ptr()->tag_, value); @@ -13229,75 +12537,62 @@ intptr_t ICData::NumArgsTested() const { return NumArgsTestedBits::decode(raw_ptr()->state_bits_); } - intptr_t ICData::TypeArgsLen() const { ArgumentsDescriptor args_desc(Array::Handle(arguments_descriptor())); return args_desc.TypeArgsLen(); } - void ICData::SetNumArgsTested(intptr_t value) const { ASSERT(Utils::IsUint(2, value)); StoreNonPointer(&raw_ptr()->state_bits_, NumArgsTestedBits::update(value, raw_ptr()->state_bits_)); } - uint32_t ICData::DeoptReasons() const { return DeoptReasonBits::decode(raw_ptr()->state_bits_); } - void ICData::SetDeoptReasons(uint32_t reasons) const { StoreNonPointer(&raw_ptr()->state_bits_, DeoptReasonBits::update(reasons, raw_ptr()->state_bits_)); } - bool ICData::HasDeoptReason(DeoptReasonId reason) const { ASSERT(reason <= kLastRecordedDeoptReason); return (DeoptReasons() & (1 << reason)) != 0; } - void ICData::AddDeoptReason(DeoptReasonId reason) const { if (reason <= kLastRecordedDeoptReason) { SetDeoptReasons(DeoptReasons() | (1 << reason)); } } - void ICData::SetIsStaticCall(bool static_call) const { StoreNonPointer(&raw_ptr()->state_bits_, StaticCallBit::update(static_call, raw_ptr()->state_bits_)); } - bool ICData::is_static_call() const { return StaticCallBit::decode(raw_ptr()->state_bits_); } - void ICData::set_state_bits(uint32_t bits) const { StoreNonPointer(&raw_ptr()->state_bits_, bits); } - intptr_t ICData::TestEntryLengthFor(intptr_t num_args) { return num_args + 1 /* target function*/ + 1 /* frequency */; } - intptr_t ICData::TestEntryLength() const { return TestEntryLengthFor(NumArgsTested()); } - intptr_t ICData::Length() const { return (Smi::Value(ic_data()->ptr()->length_) / TestEntryLength()); } - intptr_t ICData::NumberOfChecks() const { const intptr_t length = Length(); for (intptr_t i = 0; i < length; i++) { @@ -13309,7 +12604,6 @@ intptr_t ICData::NumberOfChecks() const { return -1; } - bool ICData::NumberOfChecksIs(intptr_t n) const { const intptr_t length = Length(); for (intptr_t i = 0; i < length; i++) { @@ -13322,7 +12616,6 @@ bool ICData::NumberOfChecksIs(intptr_t n) const { return n == length; } - // Discounts any checks with usage of zero. intptr_t ICData::NumberOfUsedChecks() const { intptr_t n = NumberOfChecks(); @@ -13338,7 +12631,6 @@ intptr_t ICData::NumberOfUsedChecks() const { return count; } - void ICData::WriteSentinel(const Array& data, intptr_t test_entry_length) { ASSERT(!data.IsNull()); for (intptr_t i = 1; i <= test_entry_length; i++) { @@ -13346,7 +12638,6 @@ void ICData::WriteSentinel(const Array& data, intptr_t test_entry_length) { } } - #if defined(DEBUG) // Used in asserts to verify that a check is not added twice. bool ICData::HasCheck(const GrowableArray& cids) const { @@ -13370,7 +12661,6 @@ bool ICData::HasCheck(const GrowableArray& cids) const { } #endif // DEBUG - void ICData::WriteSentinelAt(intptr_t index) const { const intptr_t len = Length(); ASSERT(index >= 0); @@ -13383,14 +12673,12 @@ void ICData::WriteSentinelAt(intptr_t index) const { } } - void ICData::ClearCountAt(intptr_t index) const { ASSERT(index >= 0); ASSERT(index < NumberOfChecks()); SetCountAt(index, 0); } - void ICData::ClearWithSentinel() const { if (IsImmutable()) { return; @@ -13430,7 +12718,6 @@ void ICData::ClearWithSentinel() const { WriteSentinelAt(0); } - void ICData::ClearAndSetStaticTarget(const Function& func) const { if (IsImmutable()) { return; @@ -13474,7 +12761,6 @@ void ICData::ClearAndSetStaticTarget(const Function& func) const { } } - // Add an initial Smi/Smi check with count 0. bool ICData::AddSmiSmiCheckForFastSmiStubs() const { bool is_smi_two_args_op = false; @@ -13505,7 +12791,6 @@ bool ICData::AddSmiSmiCheckForFastSmiStubs() const { return is_smi_two_args_op; } - // Used for unoptimized static calls when no class-ids are checked. void ICData::AddTarget(const Function& target) const { ASSERT(!target.IsNull()); @@ -13542,7 +12827,6 @@ void ICData::AddTarget(const Function& target) const { set_ic_data_array(data); } - bool ICData::ValidateInterceptor(const Function& target) const { ObjectStore* store = Isolate::Current()->object_store(); ASSERT((target.raw() == store->simple_instance_of_true_function()) || @@ -13606,7 +12890,6 @@ void ICData::AddCheck(const GrowableArray& class_ids, set_ic_data_array(data); } - RawArray* ICData::FindFreeIndex(intptr_t* index) const { // The final entry is always the sentinel value, don't consider it // when searching. @@ -13633,7 +12916,6 @@ RawArray* ICData::FindFreeIndex(intptr_t* index) const { return data.raw(); } - void ICData::DebugDump() const { const Function& owner = Function::Handle(Owner()); THR_Print("ICData::DebugDump\n"); @@ -13653,7 +12935,6 @@ void ICData::DebugDump() const { } } - void ICData::AddReceiverCheck(intptr_t receiver_class_id, const Function& target, intptr_t count) const { @@ -13696,7 +12977,6 @@ void ICData::AddReceiverCheck(intptr_t receiver_class_id, set_ic_data_array(data); } - void ICData::GetCheckAt(intptr_t index, GrowableArray* class_ids, Function* target) const { @@ -13712,7 +12992,6 @@ void ICData::GetCheckAt(intptr_t index, (*target) ^= data.At(data_pos++); } - bool ICData::IsSentinelAt(intptr_t index) const { ASSERT(index < Length()); const Array& data = Array::Handle(ic_data()); @@ -13727,7 +13006,6 @@ bool ICData::IsSentinelAt(intptr_t index) const { return true; } - void ICData::GetClassIdsAt(intptr_t index, GrowableArray* class_ids) const { ASSERT(index < Length()); @@ -13741,7 +13019,6 @@ void ICData::GetClassIdsAt(intptr_t index, } } - void ICData::GetOneClassCheckAt(intptr_t index, intptr_t* class_id, Function* target) const { @@ -13754,7 +13031,6 @@ void ICData::GetOneClassCheckAt(intptr_t index, *target ^= data.At(data_pos + 1); } - intptr_t ICData::GetCidAt(intptr_t index) const { ASSERT(NumArgsTested() == 1); const Array& data = Array::Handle(ic_data()); @@ -13762,14 +13038,12 @@ intptr_t ICData::GetCidAt(intptr_t index) const { return Smi::Value(Smi::RawCast(data.At(data_pos))); } - intptr_t ICData::GetClassIdAt(intptr_t index, intptr_t arg_nr) const { GrowableArray class_ids; GetClassIdsAt(index, &class_ids); return class_ids[arg_nr]; } - intptr_t ICData::GetReceiverClassIdAt(intptr_t index) const { ASSERT(index < Length()); ASSERT(!IsSentinelAt(index)); @@ -13779,7 +13053,6 @@ intptr_t ICData::GetReceiverClassIdAt(intptr_t index) const { return Smi::Value(Smi::RawCast(raw_data->ptr()->data()[data_pos])); } - RawFunction* ICData::GetTargetAt(intptr_t index) const { ASSERT(Isolate::Current()->compilation_allowed()); const intptr_t data_pos = index * TestEntryLength() + NumArgsTested(); @@ -13790,7 +13063,6 @@ RawFunction* ICData::GetTargetAt(intptr_t index) const { return reinterpret_cast(raw_data->ptr()->data()[data_pos]); } - RawObject* ICData::GetTargetOrCodeAt(intptr_t index) const { const intptr_t data_pos = index * TestEntryLength() + NumArgsTested(); @@ -13799,14 +13071,12 @@ RawObject* ICData::GetTargetOrCodeAt(intptr_t index) const { return raw_data->ptr()->data()[data_pos]; } - void ICData::IncrementCountAt(intptr_t index, intptr_t value) const { ASSERT(0 <= value); ASSERT(value <= Smi::kMaxValue); SetCountAt(index, Utils::Minimum(GetCountAt(index) + value, Smi::kMaxValue)); } - void ICData::SetCountAt(intptr_t index, intptr_t value) const { ASSERT(0 <= value); ASSERT(value <= Smi::kMaxValue); @@ -13817,7 +13087,6 @@ void ICData::SetCountAt(intptr_t index, intptr_t value) const { data.SetAt(data_pos, Smi::Handle(Smi::New(value))); } - intptr_t ICData::GetCountAt(intptr_t index) const { ASSERT(Isolate::Current()->compilation_allowed()); const Array& data = Array::Handle(ic_data()); @@ -13832,7 +13101,6 @@ intptr_t ICData::GetCountAt(intptr_t index) const { return 0; } - intptr_t ICData::AggregateCount() const { if (IsNull()) return 0; const intptr_t len = NumberOfChecks(); @@ -13843,7 +13111,6 @@ intptr_t ICData::AggregateCount() const { return count; } - void ICData::SetCodeAt(intptr_t index, const Code& value) const { ASSERT(!Isolate::Current()->compilation_allowed()); const Array& data = Array::Handle(ic_data()); @@ -13852,7 +13119,6 @@ void ICData::SetCodeAt(intptr_t index, const Code& value) const { data.SetAt(data_pos, value); } - void ICData::SetEntryPointAt(intptr_t index, const Smi& value) const { ASSERT(!Isolate::Current()->compilation_allowed()); const Array& data = Array::Handle(ic_data()); @@ -13861,7 +13127,6 @@ void ICData::SetEntryPointAt(intptr_t index, const Smi& value) const { data.SetAt(data_pos, value); } - RawFunction* ICData::GetTargetForReceiverClassId(intptr_t class_id, intptr_t* count_return) const { const intptr_t len = NumberOfChecks(); @@ -13874,7 +13139,6 @@ RawFunction* ICData::GetTargetForReceiverClassId(intptr_t class_id, return Function::null(); } - RawICData* ICData::AsUnaryClassChecksForCid(intptr_t cid, const Function& target) const { ASSERT(!IsNull()); @@ -13886,7 +13150,6 @@ RawICData* ICData::AsUnaryClassChecksForCid(intptr_t cid, return result.raw(); } - RawICData* ICData::AsUnaryClassChecksForArgNr(intptr_t arg_nr) const { ASSERT(!IsNull()); ASSERT(NumArgsTested() > arg_nr); @@ -13926,7 +13189,6 @@ RawICData* ICData::AsUnaryClassChecksForArgNr(intptr_t arg_nr) const { return result.raw(); } - // (cid, count) tuple used to sort ICData by count. struct CidCount { CidCount(intptr_t cid_, intptr_t count_, Function* f_) @@ -13939,7 +13201,6 @@ struct CidCount { Function* function; }; - int CidCount::HighestCountFirst(const CidCount* a, const CidCount* b) { if (a->count > b->count) { return -1; @@ -13947,7 +13208,6 @@ int CidCount::HighestCountFirst(const CidCount* a, const CidCount* b) { return (a->count < b->count) ? 1 : 0; } - RawICData* ICData::AsUnaryClassChecksSortedByCount() const { ASSERT(!IsNull()); const intptr_t kNumArgsTested = 1; @@ -14000,7 +13260,6 @@ RawICData* ICData::AsUnaryClassChecksSortedByCount() const { return result.raw(); } - bool ICData::AllTargetsHaveSameOwner(intptr_t owner_cid) const { if (NumberOfChecksIs(0)) return false; Class& cls = Class::Handle(); @@ -14016,7 +13275,6 @@ bool ICData::AllTargetsHaveSameOwner(intptr_t owner_cid) const { return true; } - bool ICData::HasReceiverClassId(intptr_t class_id) const { ASSERT(NumArgsTested() > 0); const intptr_t len = NumberOfChecks(); @@ -14031,7 +13289,6 @@ bool ICData::HasReceiverClassId(intptr_t class_id) const { return false; } - // Returns true if all targets are the same. // TODO(srdjan): if targets are native use their C_function to compare. bool ICData::HasOneTarget() const { @@ -14046,7 +13303,6 @@ bool ICData::HasOneTarget() const { return true; } - void ICData::GetUsedCidsForTwoArgs(GrowableArray* first, GrowableArray* second) const { ASSERT(NumArgsTested() == 2); @@ -14064,7 +13320,6 @@ void ICData::GetUsedCidsForTwoArgs(GrowableArray* first, } } - bool ICData::IsUsedAt(intptr_t i) const { if (GetCountAt(i) <= 0) { // Do not mistake unoptimized static call ICData for unused. @@ -14081,14 +13336,12 @@ bool ICData::IsUsedAt(intptr_t i) const { return true; } - void ICData::InitOnce() { for (int i = 0; i < kCachedICDataArrayCount; i++) { cached_icdata_arrays_[i] = ICData::NewNonCachedEmptyICDataArray(i); } } - RawArray* ICData::NewNonCachedEmptyICDataArray(intptr_t num_args_tested) { // IC data array must be null terminated (sentinel entry). const intptr_t len = TestEntryLengthFor(num_args_tested); @@ -14098,14 +13351,12 @@ RawArray* ICData::NewNonCachedEmptyICDataArray(intptr_t num_args_tested) { return array.raw(); } - RawArray* ICData::CachedEmptyICDataArray(intptr_t num_args_tested) { ASSERT(num_args_tested >= 0); ASSERT(num_args_tested < kCachedICDataArrayCount); return cached_icdata_arrays_[num_args_tested]; } - // Does not initialize ICData array. RawICData* ICData::NewDescriptor(Zone* zone, const Function& owner, @@ -14140,13 +13391,11 @@ RawICData* ICData::NewDescriptor(Zone* zone, return result.raw(); } - bool ICData::IsImmutable() const { const Array& data = Array::Handle(ic_data()); return data.IsImmutable(); } - RawICData* ICData::New() { ICData& result = ICData::Handle(); { @@ -14164,7 +13413,6 @@ RawICData* ICData::New() { return result.raw(); } - RawICData* ICData::New(const Function& owner, const String& target_name, const Array& arguments_descriptor, @@ -14180,7 +13428,6 @@ RawICData* ICData::New(const Function& owner, return result.raw(); } - RawICData* ICData::NewFrom(const ICData& from, intptr_t num_args_tested) { const ICData& result = ICData::Handle(ICData::New( Function::Handle(from.Owner()), String::Handle(from.target_name()), @@ -14191,7 +13438,6 @@ RawICData* ICData::NewFrom(const ICData& from, intptr_t num_args_tested) { return result.raw(); } - RawICData* ICData::Clone(const ICData& from) { Zone* zone = Thread::Current()->zone(); const ICData& result = ICData::Handle(ICData::NewDescriptor( @@ -14214,7 +13460,6 @@ RawICData* ICData::Clone(const ICData& from) { return result.raw(); } - Code::Comments& Code::Comments::New(intptr_t count) { Comments* comments; if (count < 0 || count > (kIntptrMax / kNumberOfEntries)) { @@ -14232,7 +13477,6 @@ Code::Comments& Code::Comments::New(intptr_t count) { return *comments; } - intptr_t Code::Comments::Length() const { if (comments_.IsNull()) { return 0; @@ -14240,32 +13484,26 @@ intptr_t Code::Comments::Length() const { return comments_.Length() / kNumberOfEntries; } - intptr_t Code::Comments::PCOffsetAt(intptr_t idx) const { return Smi::Value( Smi::RawCast(comments_.At(idx * kNumberOfEntries + kPCOffsetEntry))); } - void Code::Comments::SetPCOffsetAt(intptr_t idx, intptr_t pc) { comments_.SetAt(idx * kNumberOfEntries + kPCOffsetEntry, Smi::Handle(Smi::New(pc))); } - RawString* Code::Comments::CommentAt(intptr_t idx) const { return String::RawCast(comments_.At(idx * kNumberOfEntries + kCommentEntry)); } - void Code::Comments::SetCommentAt(intptr_t idx, const String& comment) { comments_.SetAt(idx * kNumberOfEntries + kCommentEntry, comment); } - Code::Comments::Comments(const Array& comments) : comments_(comments) {} - RawLocalVarDescriptors* Code::GetLocalVarDescriptors() const { const LocalVarDescriptors& v = LocalVarDescriptors::Handle(var_descriptors()); if (v.IsNull()) { @@ -14277,22 +13515,18 @@ RawLocalVarDescriptors* Code::GetLocalVarDescriptors() const { return var_descriptors(); } - void Code::set_state_bits(intptr_t bits) const { StoreNonPointer(&raw_ptr()->state_bits_, bits); } - void Code::set_is_optimized(bool value) const { set_state_bits(OptimizedBit::update(value, raw_ptr()->state_bits_)); } - void Code::set_is_alive(bool value) const { set_state_bits(AliveBit::update(value, raw_ptr()->state_bits_)); } - void Code::set_stackmaps(const Array& maps) const { ASSERT(maps.IsOld()); StorePointer(&raw_ptr()->stackmaps_, maps.raw()); @@ -14300,7 +13534,6 @@ void Code::set_stackmaps(const Array& maps) const { maps.IsNull() ? 0 : maps.Length() * sizeof(uword)); } - #if !defined(DART_PRECOMPILED_RUNTIME) && !defined(DART_PRECOMPILER) void Code::set_variables(const Smi& smi) const { StorePointer(&raw_ptr()->catch_entry_.variables_, smi.raw()); @@ -14311,7 +13544,6 @@ void Code::set_catch_entry_state_maps(const TypedData& maps) const { } #endif - void Code::set_deopt_info_array(const Array& array) const { #if defined(DART_PRECOMPILED_RUNTIME) UNREACHABLE(); @@ -14321,7 +13553,6 @@ void Code::set_deopt_info_array(const Array& array) const { #endif } - void Code::set_static_calls_target_table(const Array& value) const { #if defined(DART_PRECOMPILED_RUNTIME) UNREACHABLE(); @@ -14340,7 +13571,6 @@ void Code::set_static_calls_target_table(const Array& value) const { #endif // DEBUG } - bool Code::HasBreakpoint() const { if (!FLAG_support_debugger) { return false; @@ -14348,7 +13578,6 @@ bool Code::HasBreakpoint() const { return Isolate::Current()->debugger()->HasBreakpoint(*this); } - RawTypedData* Code::GetDeoptInfoAtPc(uword pc, ICData::DeoptReasonId* deopt_reason, uint32_t* deopt_flags) const { @@ -14383,7 +13612,6 @@ RawTypedData* Code::GetDeoptInfoAtPc(uword pc, #endif // defined(DART_PRECOMPILED_RUNTIME) } - intptr_t Code::BinarySearchInSCallTable(uword pc) const { #if defined(DART_PRECOMPILED_RUNTIME) UNREACHABLE(); @@ -14409,7 +13637,6 @@ intptr_t Code::BinarySearchInSCallTable(uword pc) const { return -1; } - RawFunction* Code::GetStaticCallTargetFunctionAt(uword pc) const { #if defined(DART_PRECOMPILED_RUNTIME) UNREACHABLE(); @@ -14426,7 +13653,6 @@ RawFunction* Code::GetStaticCallTargetFunctionAt(uword pc) const { #endif } - RawCode* Code::GetStaticCallTargetCodeAt(uword pc) const { #if defined(DART_PRECOMPILED_RUNTIME) UNREACHABLE(); @@ -14443,7 +13669,6 @@ RawCode* Code::GetStaticCallTargetCodeAt(uword pc) const { #endif } - void Code::SetStaticCallTargetCodeAt(uword pc, const Code& code) const { #if defined(DART_PRECOMPILED_RUNTIME) UNREACHABLE(); @@ -14457,7 +13682,6 @@ void Code::SetStaticCallTargetCodeAt(uword pc, const Code& code) const { #endif } - void Code::SetStubCallTargetCodeAt(uword pc, const Code& code) const { #if defined(DART_PRECOMPILED_RUNTIME) UNREACHABLE(); @@ -14477,7 +13701,6 @@ void Code::SetStubCallTargetCodeAt(uword pc, const Code& code) const { #endif } - void Code::Disassemble(DisassemblyFormatter* formatter) const { #ifndef PRODUCT if (!FLAG_support_disassembler) { @@ -14493,7 +13716,6 @@ void Code::Disassemble(DisassemblyFormatter* formatter) const { #endif } - const Code::Comments& Code::comments() const { #if defined(DART_PRECOMPILED_RUNTIME) Comments* comments = new Code::Comments(Array::Handle()); @@ -14503,7 +13725,6 @@ const Code::Comments& Code::comments() const { return *comments; } - void Code::set_comments(const Code::Comments& comments) const { #if defined(DART_PRECOMPILED_RUNTIME) UNREACHABLE(); @@ -14513,7 +13734,6 @@ void Code::set_comments(const Code::Comments& comments) const { #endif } - void Code::SetPrologueOffset(intptr_t offset) const { #if defined(DART_PRECOMPILED_RUNTIME) UNREACHABLE(); @@ -14525,7 +13745,6 @@ void Code::SetPrologueOffset(intptr_t offset) const { #endif } - intptr_t Code::GetPrologueOffset() const { #if defined(DART_PRECOMPILED_RUNTIME) return -1; @@ -14540,18 +13759,15 @@ intptr_t Code::GetPrologueOffset() const { #endif } - RawArray* Code::inlined_id_to_function() const { return raw_ptr()->inlined_id_to_function_; } - void Code::set_inlined_id_to_function(const Array& value) const { ASSERT(value.IsOld()); StorePointer(&raw_ptr()->inlined_id_to_function_, value.raw()); } - RawCode* Code::New(intptr_t pointer_offsets_length) { if (pointer_offsets_length < 0 || pointer_offsets_length > kMaxElements) { // This should be caught before we reach here. @@ -14575,7 +13791,6 @@ RawCode* Code::New(intptr_t pointer_offsets_length) { return result.raw(); } - RawCode* Code::FinalizeCode(const char* name, Assembler* assembler, bool optimized) { @@ -14663,7 +13878,6 @@ RawCode* Code::FinalizeCode(const char* name, return code.raw(); } - RawCode* Code::FinalizeCode(const Function& function, Assembler* assembler, bool optimized) { @@ -14678,12 +13892,10 @@ RawCode* Code::FinalizeCode(const Function& function, return FinalizeCode("", assembler, optimized); } - bool Code::SlowFindRawCodeVisitor::FindObject(RawObject* raw_obj) const { return RawCode::ContainsPC(raw_obj, pc_); } - RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) { ASSERT((isolate == Isolate::Current()) || (isolate == Dart::vm_isolate())); if (isolate->heap() == NULL) { @@ -14698,17 +13910,14 @@ RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) { return Code::null(); } - RawCode* Code::LookupCode(uword pc) { return LookupCodeInIsolate(Isolate::Current(), pc); } - RawCode* Code::LookupCodeInVmIsolate(uword pc) { return LookupCodeInIsolate(Dart::vm_isolate(), pc); } - // Given a pc and a timestamp, lookup the code. RawCode* Code::FindCode(uword pc, int64_t timestamp) { Code& code = Code::Handle(Code::LookupCode(pc)); @@ -14726,7 +13935,6 @@ RawCode* Code::FindCode(uword pc, int64_t timestamp) { return Code::null(); } - TokenPosition Code::GetTokenIndexOfPC(uword pc) const { uword pc_offset = pc - PayloadStart(); const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); @@ -14739,7 +13947,6 @@ TokenPosition Code::GetTokenIndexOfPC(uword pc) const { return TokenPosition::kNoSource; } - uword Code::GetPcForDeoptId(intptr_t deopt_id, RawPcDescriptors::Kind kind) const { const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); @@ -14755,7 +13962,6 @@ uword Code::GetPcForDeoptId(intptr_t deopt_id, return 0; } - intptr_t Code::GetDeoptIdForOsr(uword pc) const { uword pc_offset = pc - PayloadStart(); const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); @@ -14768,12 +13974,10 @@ intptr_t Code::GetDeoptIdForOsr(uword pc) const { return Thread::kNoDeoptId; } - const char* Code::ToCString() const { return Thread::Current()->zone()->PrintToString("Code(%s)", QualifiedName()); } - const char* Code::Name() const { Zone* zone = Thread::Current()->zone(); const Object& obj = Object::Handle(zone, owner()); @@ -14800,7 +14004,6 @@ const char* Code::Name() const { } } - const char* Code::QualifiedName() const { Zone* zone = Thread::Current()->zone(); const Object& obj = Object::Handle(zone, owner()); @@ -14814,25 +14017,21 @@ const char* Code::QualifiedName() const { return Name(); } - bool Code::IsAllocationStubCode() const { const Object& obj = Object::Handle(owner()); return obj.IsClass(); } - bool Code::IsStubCode() const { const Object& obj = Object::Handle(owner()); return obj.IsNull(); } - bool Code::IsFunctionCode() const { const Object& obj = Object::Handle(owner()); return obj.IsFunction(); } - void Code::DisableDartCode() const { DEBUG_ASSERT(IsMutatorOrAtSafepoint()); ASSERT(IsFunctionCode()); @@ -14842,7 +14041,6 @@ void Code::DisableDartCode() const { SetActiveInstructions(Instructions::Handle(new_code.instructions())); } - void Code::DisableStubCode() const { #if !defined(TARGET_ARCH_DBC) ASSERT(Thread::Current()->IsMutatorThread()); @@ -14857,7 +14055,6 @@ void Code::DisableStubCode() const { #endif // !defined(TARGET_ARCH_DBC) } - void Code::SetActiveInstructions(const Instructions& instructions) const { #if defined(DART_PRECOMPILED_RUNTIME) UNREACHABLE(); @@ -14873,7 +14070,6 @@ void Code::SetActiveInstructions(const Instructions& instructions) const { #endif } - RawStackMap* Code::GetStackMap(uint32_t pc_offset, Array* maps, StackMap* map) const { @@ -14905,7 +14101,6 @@ RawStackMap* Code::GetStackMap(uint32_t pc_offset, return StackMap::null(); } - void Code::GetInlinedFunctionsAtInstruction( intptr_t pc_offset, GrowableArray* functions, @@ -14921,7 +14116,6 @@ void Code::GetInlinedFunctionsAtInstruction( reader.GetInlinedFunctionsAt(pc_offset, functions, token_positions); } - #ifndef PRODUCT void Code::PrintJSONInlineIntervals(JSONObject* jsobj) const { if (!is_optimized()) { @@ -14935,7 +14129,6 @@ void Code::PrintJSONInlineIntervals(JSONObject* jsobj) const { } #endif - void Code::DumpInlineIntervals() const { const CodeSourceMap& map = CodeSourceMap::Handle(code_source_map()); if (map.IsNull()) { @@ -14948,7 +14141,6 @@ void Code::DumpInlineIntervals() const { reader.DumpInlineIntervals(PayloadStart()); } - void Code::DumpSourcePositions() const { const CodeSourceMap& map = CodeSourceMap::Handle(code_source_map()); if (map.IsNull()) { @@ -14961,7 +14153,6 @@ void Code::DumpSourcePositions() const { reader.DumpSourcePositions(PayloadStart()); } - RawArray* Code::await_token_positions() const { #if defined(DART_PRECOMPILED_RUNTIME) return Array::null(); @@ -14990,7 +14181,6 @@ RawContext* Context::New(intptr_t num_variables, Heap::Space space) { return result.raw(); } - const char* Context::ToCString() const { if (IsNull()) { return "Context: null"; @@ -15007,14 +14197,12 @@ const char* Context::ToCString() const { } } - static void IndentN(int count) { for (int i = 0; i < count; i++) { THR_Print(" "); } } - void Context::Dump(int indent) const { if (IsNull()) { IndentN(indent); @@ -15044,7 +14232,6 @@ void Context::Dump(int indent) const { THR_Print("}\n"); } - RawContextScope* ContextScope::New(intptr_t num_variables, bool is_implicit) { ASSERT(Object::context_scope_class() != Class::null()); if (num_variables < 0 || num_variables > kMaxElements) { @@ -15064,26 +14251,22 @@ RawContextScope* ContextScope::New(intptr_t num_variables, bool is_implicit) { return result.raw(); } - TokenPosition ContextScope::TokenIndexAt(intptr_t scope_index) const { return TokenPosition(Smi::Value(VariableDescAddr(scope_index)->token_pos)); } - void ContextScope::SetTokenIndexAt(intptr_t scope_index, TokenPosition token_pos) const { StoreSmi(&VariableDescAddr(scope_index)->token_pos, Smi::New(token_pos.value())); } - TokenPosition ContextScope::DeclarationTokenIndexAt( intptr_t scope_index) const { return TokenPosition( Smi::Value(VariableDescAddr(scope_index)->declaration_token_pos)); } - void ContextScope::SetDeclarationTokenIndexAt( intptr_t scope_index, TokenPosition declaration_token_pos) const { @@ -15091,88 +14274,73 @@ void ContextScope::SetDeclarationTokenIndexAt( Smi::New(declaration_token_pos.value())); } - RawString* ContextScope::NameAt(intptr_t scope_index) const { return VariableDescAddr(scope_index)->name; } - void ContextScope::SetNameAt(intptr_t scope_index, const String& name) const { StorePointer(&(VariableDescAddr(scope_index)->name), name.raw()); } - bool ContextScope::IsFinalAt(intptr_t scope_index) const { return Bool::Handle(VariableDescAddr(scope_index)->is_final).value(); } - void ContextScope::SetIsFinalAt(intptr_t scope_index, bool is_final) const { StorePointer(&(VariableDescAddr(scope_index)->is_final), Bool::Get(is_final).raw()); } - bool ContextScope::IsConstAt(intptr_t scope_index) const { return Bool::Handle(VariableDescAddr(scope_index)->is_const).value(); } - void ContextScope::SetIsConstAt(intptr_t scope_index, bool is_const) const { StorePointer(&(VariableDescAddr(scope_index)->is_const), Bool::Get(is_const).raw()); } - RawAbstractType* ContextScope::TypeAt(intptr_t scope_index) const { ASSERT(!IsConstAt(scope_index)); return VariableDescAddr(scope_index)->type; } - void ContextScope::SetTypeAt(intptr_t scope_index, const AbstractType& type) const { StorePointer(&(VariableDescAddr(scope_index)->type), type.raw()); } - RawInstance* ContextScope::ConstValueAt(intptr_t scope_index) const { ASSERT(IsConstAt(scope_index)); return VariableDescAddr(scope_index)->value; } - void ContextScope::SetConstValueAt(intptr_t scope_index, const Instance& value) const { ASSERT(IsConstAt(scope_index)); StorePointer(&(VariableDescAddr(scope_index)->value), value.raw()); } - intptr_t ContextScope::ContextIndexAt(intptr_t scope_index) const { return Smi::Value(VariableDescAddr(scope_index)->context_index); } - void ContextScope::SetContextIndexAt(intptr_t scope_index, intptr_t context_index) const { StoreSmi(&(VariableDescAddr(scope_index)->context_index), Smi::New(context_index)); } - intptr_t ContextScope::ContextLevelAt(intptr_t scope_index) const { return Smi::Value(VariableDescAddr(scope_index)->context_level); } - void ContextScope::SetContextLevelAt(intptr_t scope_index, intptr_t context_level) const { StoreSmi(&(VariableDescAddr(scope_index)->context_level), Smi::New(context_level)); } - const char* ContextScope::ToCString() const { const char* prev_cstr = "ContextScope:"; String& name = String::Handle(); @@ -15191,17 +14359,14 @@ const char* ContextScope::ToCString() const { return prev_cstr; } - RawArray* MegamorphicCache::buckets() const { return raw_ptr()->buckets_; } - void MegamorphicCache::set_buckets(const Array& buckets) const { StorePointer(&raw_ptr()->buckets_, buckets.raw()); } - // Class IDs in the table are smi-tagged, so we use a smi-tagged mask // and target class ID to avoid untagging (on each iteration of the // test loop) in generated code. @@ -15209,32 +14374,26 @@ intptr_t MegamorphicCache::mask() const { return Smi::Value(raw_ptr()->mask_); } - void MegamorphicCache::set_mask(intptr_t mask) const { StoreSmi(&raw_ptr()->mask_, Smi::New(mask)); } - intptr_t MegamorphicCache::filled_entry_count() const { return raw_ptr()->filled_entry_count_; } - void MegamorphicCache::set_filled_entry_count(intptr_t count) const { StoreNonPointer(&raw_ptr()->filled_entry_count_, count); } - void MegamorphicCache::set_target_name(const String& value) const { StorePointer(&raw_ptr()->target_name_, value.raw()); } - void MegamorphicCache::set_arguments_descriptor(const Array& value) const { StorePointer(&raw_ptr()->args_descriptor_, value.raw()); } - RawMegamorphicCache* MegamorphicCache::New() { MegamorphicCache& result = MegamorphicCache::Handle(); { @@ -15248,7 +14407,6 @@ RawMegamorphicCache* MegamorphicCache::New() { return result.raw(); } - RawMegamorphicCache* MegamorphicCache::New(const String& target_name, const Array& arguments_descriptor) { MegamorphicCache& result = MegamorphicCache::Handle(); @@ -15275,7 +14433,6 @@ RawMegamorphicCache* MegamorphicCache::New(const String& target_name, return result.raw(); } - void MegamorphicCache::EnsureCapacity() const { intptr_t old_capacity = mask() + 1; double load_limit = kLoadFactor * static_cast(old_capacity); @@ -15306,7 +14463,6 @@ void MegamorphicCache::EnsureCapacity() const { } } - void MegamorphicCache::Insert(const Smi& class_id, const Function& target) const { ASSERT(static_cast(filled_entry_count() + 1) <= @@ -15326,14 +14482,12 @@ void MegamorphicCache::Insert(const Smi& class_id, UNREACHABLE(); } - const char* MegamorphicCache::ToCString() const { const String& name = String::Handle(target_name()); return OS::SCreate(Thread::Current()->zone(), "MegamorphicCache(%s)", name.ToCString()); } - RawSubtypeTestCache* SubtypeTestCache::New() { ASSERT(Object::subtypetestcache_class() != Class::null()); SubtypeTestCache& result = SubtypeTestCache::Handle(); @@ -15351,19 +14505,16 @@ RawSubtypeTestCache* SubtypeTestCache::New() { return result.raw(); } - void SubtypeTestCache::set_cache(const Array& value) const { StorePointer(&raw_ptr()->cache_, value.raw()); } - intptr_t SubtypeTestCache::NumberOfChecks() const { NoSafepointScope no_safepoint; // Do not count the sentinel; return (Smi::Value(cache()->ptr()->length_) / kTestEntryLength) - 1; } - void SubtypeTestCache::AddCheck( const Object& instance_class_id_or_function, const TypeArguments& instance_type_arguments, @@ -15385,7 +14536,6 @@ void SubtypeTestCache::AddCheck( data.SetAt(data_pos + kTestResult, test_result); } - void SubtypeTestCache::GetCheck(intptr_t ix, Object* instance_class_id_or_function, TypeArguments* instance_type_arguments, @@ -15403,12 +14553,10 @@ void SubtypeTestCache::GetCheck(intptr_t ix, *test_result ^= data.At(data_pos + kTestResult); } - const char* SubtypeTestCache::ToCString() const { return "SubtypeTestCache"; } - const char* Error::ToErrorCString() const { if (IsNull()) { return "Error: null"; @@ -15417,7 +14565,6 @@ const char* Error::ToErrorCString() const { return "Error"; } - const char* Error::ToCString() const { if (IsNull()) { return "Error: null"; @@ -15427,7 +14574,6 @@ const char* Error::ToCString() const { return "Error"; } - RawApiError* ApiError::New() { ASSERT(Object::api_error_class() != Class::null()); RawObject* raw = Object::Allocate(ApiError::kClassId, @@ -15435,7 +14581,6 @@ RawApiError* ApiError::New() { return reinterpret_cast(raw); } - RawApiError* ApiError::New(const String& message, Heap::Space space) { #ifndef PRODUCT if (FLAG_print_stacktrace_at_api_error) { @@ -15456,23 +14601,19 @@ RawApiError* ApiError::New(const String& message, Heap::Space space) { return result.raw(); } - void ApiError::set_message(const String& message) const { StorePointer(&raw_ptr()->message_, message.raw()); } - const char* ApiError::ToErrorCString() const { const String& msg_str = String::Handle(message()); return msg_str.ToCString(); } - const char* ApiError::ToCString() const { return "ApiError"; } - RawLanguageError* LanguageError::New() { ASSERT(Object::language_error_class() != Class::null()); RawObject* raw = Object::Allocate(LanguageError::kClassId, @@ -15480,7 +14621,6 @@ RawLanguageError* LanguageError::New() { return reinterpret_cast(raw); } - RawLanguageError* LanguageError::NewFormattedV(const Error& prev_error, const Script& script, TokenPosition token_pos, @@ -15507,7 +14647,6 @@ RawLanguageError* LanguageError::NewFormattedV(const Error& prev_error, return result.raw(); } - RawLanguageError* LanguageError::NewFormatted(const Error& prev_error, const Script& script, TokenPosition token_pos, @@ -15526,7 +14665,6 @@ RawLanguageError* LanguageError::NewFormatted(const Error& prev_error, return result; } - RawLanguageError* LanguageError::New(const String& formatted_message, Report::Kind kind, Heap::Space space) { @@ -15543,43 +14681,35 @@ RawLanguageError* LanguageError::New(const String& formatted_message, return result.raw(); } - void LanguageError::set_previous_error(const Error& value) const { StorePointer(&raw_ptr()->previous_error_, value.raw()); } - void LanguageError::set_script(const Script& value) const { StorePointer(&raw_ptr()->script_, value.raw()); } - void LanguageError::set_token_pos(TokenPosition token_pos) const { ASSERT(!token_pos.IsClassifying()); StoreNonPointer(&raw_ptr()->token_pos_, token_pos); } - void LanguageError::set_report_after_token(bool value) { StoreNonPointer(&raw_ptr()->report_after_token_, value); } - void LanguageError::set_kind(uint8_t value) const { StoreNonPointer(&raw_ptr()->kind_, value); } - void LanguageError::set_message(const String& value) const { StorePointer(&raw_ptr()->message_, value.raw()); } - void LanguageError::set_formatted_message(const String& value) const { StorePointer(&raw_ptr()->formatted_message_, value.raw()); } - RawString* LanguageError::FormatMessage() const { if (formatted_message() != String::null()) { return formatted_message(); @@ -15597,7 +14727,6 @@ RawString* LanguageError::FormatMessage() const { return result.raw(); } - const char* LanguageError::ToErrorCString() const { Thread* thread = Thread::Current(); NoReloadScope no_reload_scope(thread->isolate(), thread); @@ -15605,12 +14734,10 @@ const char* LanguageError::ToErrorCString() const { return msg_str.ToCString(); } - const char* LanguageError::ToCString() const { return "LanguageError"; } - RawUnhandledException* UnhandledException::New(const Instance& exception, const Instance& stacktrace, Heap::Space space) { @@ -15628,7 +14755,6 @@ RawUnhandledException* UnhandledException::New(const Instance& exception, return result.raw(); } - RawUnhandledException* UnhandledException::New(Heap::Space space) { ASSERT(Object::unhandled_exception_class() != Class::null()); UnhandledException& result = UnhandledException::Handle(); @@ -15644,17 +14770,14 @@ RawUnhandledException* UnhandledException::New(Heap::Space space) { return result.raw(); } - void UnhandledException::set_exception(const Instance& exception) const { StorePointer(&raw_ptr()->exception_, exception.raw()); } - void UnhandledException::set_stacktrace(const Instance& stacktrace) const { StorePointer(&raw_ptr()->stacktrace_, stacktrace.raw()); } - const char* UnhandledException::ToErrorCString() const { Thread* thread = Thread::Current(); Isolate* isolate = thread->isolate(); @@ -15686,12 +14809,10 @@ const char* UnhandledException::ToErrorCString() const { stack_str); } - const char* UnhandledException::ToCString() const { return "UnhandledException"; } - RawUnwindError* UnwindError::New(const String& message, Heap::Space space) { ASSERT(Object::unwind_error_class() != Class::null()); UnwindError& result = UnwindError::Handle(); @@ -15706,28 +14827,23 @@ RawUnwindError* UnwindError::New(const String& message, Heap::Space space) { return result.raw(); } - void UnwindError::set_message(const String& message) const { StorePointer(&raw_ptr()->message_, message.raw()); } - void UnwindError::set_is_user_initiated(bool value) const { StoreNonPointer(&raw_ptr()->is_user_initiated_, value); } - const char* UnwindError::ToErrorCString() const { const String& msg_str = String::Handle(message()); return msg_str.ToCString(); } - const char* UnwindError::ToCString() const { return "UnwindError"; } - RawObject* Instance::Evaluate(const Class& method_cls, const String& expr, const Array& param_names, @@ -15744,14 +14860,12 @@ RawObject* Instance::Evaluate(const Class& method_cls, return DartEntry::InvokeFunction(eval_func, args); } - RawObject* Instance::HashCode() const { // TODO(koda): Optimize for all builtin classes and all classes // that do not override hashCode. return DartLibraryCalls::HashCode(*this); } - bool Instance::CanonicalizeEquals(const Instance& other) const { if (this->raw() == other.raw()) { return true; // "===". @@ -15784,7 +14898,6 @@ bool Instance::CanonicalizeEquals(const Instance& other) const { return true; } - uword Instance::ComputeCanonicalTableHash() const { ASSERT(!IsNull()); NoSafepointScope no_safepoint; @@ -15801,7 +14914,6 @@ uword Instance::ComputeCanonicalTableHash() const { return FinalizeHash(hash, (kBitsPerWord - 1)); } - #if defined(DEBUG) class CheckForPointers : public ObjectPointerVisitor { public: @@ -15823,7 +14935,6 @@ class CheckForPointers : public ObjectPointerVisitor { }; #endif // DEBUG - bool Instance::CheckAndCanonicalizeFields(Thread* thread, const char** error_str) const { if (GetClassId() >= kNumPredefinedCids) { @@ -15860,7 +14971,6 @@ bool Instance::CheckAndCanonicalizeFields(Thread* thread, return true; } - RawInstance* Instance::CheckAndCanonicalize(Thread* thread, const char** error_str) const { ASSERT(!IsNull()); @@ -15893,7 +15003,6 @@ RawInstance* Instance::CheckAndCanonicalize(Thread* thread, } } - #if defined(DEBUG) bool Instance::CheckIsCanonical(Thread* thread) const { Zone* zone = thread->zone(); @@ -15906,7 +15015,6 @@ bool Instance::CheckIsCanonical(Thread* thread) const { } #endif // DEBUG - RawAbstractType* Instance::GetType(Heap::Space space) const { if (IsNull()) { return Type::NullType(); @@ -15945,7 +15053,6 @@ RawAbstractType* Instance::GetType(Heap::Space space) const { return type.raw(); } - RawTypeArguments* Instance::GetTypeArguments() const { const Class& cls = Class::Handle(clazz()); intptr_t field_offset = cls.type_arguments_field_offset(); @@ -15955,7 +15062,6 @@ RawTypeArguments* Instance::GetTypeArguments() const { return type_arguments.raw(); } - void Instance::SetTypeArguments(const TypeArguments& value) const { ASSERT(value.IsNull() || value.IsCanonical()); const Class& cls = Class::Handle(clazz()); @@ -15964,7 +15070,6 @@ void Instance::SetTypeArguments(const TypeArguments& value) const { SetFieldAtOffset(field_offset, value); } - bool Instance::IsInstanceOf( const AbstractType& other, const TypeArguments& other_instantiator_type_arguments, @@ -16099,14 +15204,12 @@ bool Instance::IsInstanceOf( bound_error, NULL, Heap::kOld); } - bool Instance::OperatorEquals(const Instance& other) const { // TODO(koda): Optimize for all builtin classes and all classes // that do not override operator==. return DartLibraryCalls::Equals(*this, other) == Object::bool_true().raw(); } - bool Instance::IsIdenticalTo(const Instance& other) const { if (raw() == other.raw()) return true; if (IsInteger() && other.IsInteger()) { @@ -16119,7 +15222,6 @@ bool Instance::IsIdenticalTo(const Instance& other) const { return false; } - intptr_t* Instance::NativeFieldsDataAddr() const { ASSERT(Thread::Current()->no_safepoint_scope_depth() > 0); RawTypedData* native_fields = @@ -16130,7 +15232,6 @@ intptr_t* Instance::NativeFieldsDataAddr() const { return reinterpret_cast(native_fields->ptr()->data()); } - void Instance::SetNativeField(int index, intptr_t value) const { ASSERT(IsValidNativeIndex(index)); Object& native_fields = Object::Handle(*NativeFieldsAddr()); @@ -16143,7 +15244,6 @@ void Instance::SetNativeField(int index, intptr_t value) const { TypedData::Cast(native_fields).SetIntPtr(byte_offset, value); } - void Instance::SetNativeFields(uint16_t num_native_fields, const intptr_t* field_values) const { ASSERT(num_native_fields == NumNativeFields()); @@ -16160,7 +15260,6 @@ void Instance::SetNativeFields(uint16_t num_native_fields, } } - bool Instance::IsCallable(Function* function) const { Class& cls = Class::Handle(clazz()); if (cls.IsClosureClass()) { @@ -16184,7 +15283,6 @@ bool Instance::IsCallable(Function* function) const { return false; } - RawInstance* Instance::New(const Class& cls, Heap::Space space) { Thread* thread = Thread::Current(); if (cls.EnsureIsFinalized(thread) != Error::null()) { @@ -16196,7 +15294,6 @@ RawInstance* Instance::New(const Class& cls, Heap::Space space) { return reinterpret_cast(raw); } - bool Instance::IsValidFieldOffset(intptr_t offset) const { Thread* thread = Thread::Current(); REUSABLE_CLASS_HANDLESCOPE(thread); @@ -16205,7 +15302,6 @@ bool Instance::IsValidFieldOffset(intptr_t offset) const { return (offset >= 0 && offset <= (cls.instance_size() - kWordSize)); } - intptr_t Instance::ElementSizeFor(intptr_t cid) { if (RawObject::IsExternalTypedDataClassId(cid)) { return ExternalTypedData::ElementSizeInBytes(cid); @@ -16230,7 +15326,6 @@ intptr_t Instance::ElementSizeFor(intptr_t cid) { } } - intptr_t Instance::DataOffsetFor(intptr_t cid) { if (RawObject::IsExternalTypedDataClassId(cid) || RawObject::IsExternalStringClassId(cid)) { @@ -16254,7 +15349,6 @@ intptr_t Instance::DataOffsetFor(intptr_t cid) { } } - const char* Instance::ToCString() const { if (IsNull()) { return "null"; @@ -16287,55 +15381,47 @@ const char* Instance::ToCString() const { } } - bool AbstractType::IsResolved() const { // AbstractType is an abstract class. UNREACHABLE(); return false; } - void AbstractType::SetIsResolved() const { // AbstractType is an abstract class. UNREACHABLE(); } - bool AbstractType::HasResolvedTypeClass() const { // AbstractType is an abstract class. UNREACHABLE(); return false; } - classid_t AbstractType::type_class_id() const { // AbstractType is an abstract class. UNREACHABLE(); return kIllegalCid; } - RawClass* AbstractType::type_class() const { // AbstractType is an abstract class. UNREACHABLE(); return Class::null(); } - RawUnresolvedClass* AbstractType::unresolved_class() const { // AbstractType is an abstract class. UNREACHABLE(); return UnresolvedClass::null(); } - RawTypeArguments* AbstractType::arguments() const { // AbstractType is an abstract class. UNREACHABLE(); return NULL; } - void AbstractType::set_arguments(const TypeArguments& value) const { // AbstractType is an abstract class. UNREACHABLE(); @@ -16347,7 +15433,6 @@ TokenPosition AbstractType::token_pos() const { return TokenPosition::kNoSource; } - bool AbstractType::IsInstantiated(Genericity genericity, intptr_t num_free_fun_type_params, TrailPtr trail) const { @@ -16356,81 +15441,69 @@ bool AbstractType::IsInstantiated(Genericity genericity, return false; } - bool AbstractType::IsFinalized() const { // AbstractType is an abstract class. UNREACHABLE(); return false; } - void AbstractType::SetIsFinalized() const { // AbstractType is an abstract class. UNREACHABLE(); } - bool AbstractType::IsBeingFinalized() const { // AbstractType is an abstract class. UNREACHABLE(); return false; } - void AbstractType::SetIsBeingFinalized() const { // AbstractType is an abstract class. UNREACHABLE(); } - bool AbstractType::IsMalformed() const { // AbstractType is an abstract class. UNREACHABLE(); return false; } - bool AbstractType::IsMalbounded() const { // AbstractType is an abstract class. UNREACHABLE(); return false; } - bool AbstractType::IsMalformedOrMalbounded() const { // AbstractType is an abstract class. UNREACHABLE(); return false; } - RawLanguageError* AbstractType::error() const { // AbstractType is an abstract class. UNREACHABLE(); return LanguageError::null(); } - void AbstractType::set_error(const LanguageError& value) const { // AbstractType is an abstract class. UNREACHABLE(); } - bool AbstractType::IsEquivalent(const Instance& other, TrailPtr trail) const { // AbstractType is an abstract class. UNREACHABLE(); return false; } - bool AbstractType::IsRecursive() const { // AbstractType is an abstract class. UNREACHABLE(); return false; } - RawAbstractType* AbstractType::InstantiateFrom( const TypeArguments& instantiator_type_arguments, const TypeArguments& function_type_arguments, @@ -16443,14 +15516,12 @@ RawAbstractType* AbstractType::InstantiateFrom( return NULL; } - RawAbstractType* AbstractType::CloneUnfinalized() const { // AbstractType is an abstract class. UNREACHABLE(); return NULL; } - RawAbstractType* AbstractType::CloneUninstantiated(const Class& new_owner, TrailPtr trail) const { // AbstractType is an abstract class. @@ -16458,21 +15529,18 @@ RawAbstractType* AbstractType::CloneUninstantiated(const Class& new_owner, return NULL; } - RawAbstractType* AbstractType::Canonicalize(TrailPtr trail) const { // AbstractType is an abstract class. UNREACHABLE(); return NULL; } - RawString* AbstractType::EnumerateURIs() const { // AbstractType is an abstract class. UNREACHABLE(); return NULL; } - RawAbstractType* AbstractType::OnlyBuddyInTrail(TrailPtr trail) const { if (trail == NULL) { return AbstractType::null(); @@ -16490,7 +15558,6 @@ RawAbstractType* AbstractType::OnlyBuddyInTrail(TrailPtr trail) const { return AbstractType::null(); } - void AbstractType::AddOnlyBuddyToTrail(TrailPtr* trail, const AbstractType& buddy) const { if (*trail == NULL) { @@ -16502,7 +15569,6 @@ void AbstractType::AddOnlyBuddyToTrail(TrailPtr* trail, (*trail)->Add(buddy); } - bool AbstractType::TestAndAddToTrail(TrailPtr* trail) const { if (*trail == NULL) { *trail = new Trail(Thread::Current()->zone(), 4); @@ -16518,7 +15584,6 @@ bool AbstractType::TestAndAddToTrail(TrailPtr* trail) const { return false; } - bool AbstractType::TestAndAddBuddyToTrail(TrailPtr* trail, const AbstractType& buddy) const { if (*trail == NULL) { @@ -16545,7 +15610,6 @@ bool AbstractType::TestAndAddBuddyToTrail(TrailPtr* trail, return false; } - RawString* AbstractType::BuildName(NameVisibility name_visibility) const { ASSERT(name_visibility != kScrubbedName); Thread* thread = Thread::Current(); @@ -16667,7 +15731,6 @@ RawString* AbstractType::BuildName(NameVisibility name_visibility) const { return Symbols::FromConcatAll(thread, pieces); } - RawString* AbstractType::ClassName() const { ASSERT(!IsFunctionType()); if (HasResolvedTypeClass()) { @@ -16677,7 +15740,6 @@ RawString* AbstractType::ClassName() const { } } - bool AbstractType::IsDynamicType() const { if (IsCanonical()) { return raw() == Object::dynamic_type().raw(); @@ -16685,90 +15747,75 @@ bool AbstractType::IsDynamicType() const { return HasResolvedTypeClass() && (type_class() == Object::dynamic_class()); } - bool AbstractType::IsVoidType() const { return raw() == Object::void_type().raw(); } - bool AbstractType::IsNullType() const { return !IsFunctionType() && HasResolvedTypeClass() && (type_class() == Isolate::Current()->object_store()->null_class()); } - bool AbstractType::IsBoolType() const { return !IsFunctionType() && HasResolvedTypeClass() && (type_class() == Isolate::Current()->object_store()->bool_class()); } - bool AbstractType::IsIntType() const { return !IsFunctionType() && HasResolvedTypeClass() && (type_class() == Type::Handle(Type::IntType()).type_class()); } - bool AbstractType::IsInt64Type() const { return !IsFunctionType() && HasResolvedTypeClass() && (type_class() == Type::Handle(Type::Int64Type()).type_class()); } - bool AbstractType::IsDoubleType() const { return !IsFunctionType() && HasResolvedTypeClass() && (type_class() == Type::Handle(Type::Double()).type_class()); } - bool AbstractType::IsFloat32x4Type() const { return !IsFunctionType() && HasResolvedTypeClass() && (type_class() == Type::Handle(Type::Float32x4()).type_class()); } - bool AbstractType::IsFloat64x2Type() const { return !IsFunctionType() && HasResolvedTypeClass() && (type_class() == Type::Handle(Type::Float64x2()).type_class()); } - bool AbstractType::IsInt32x4Type() const { return !IsFunctionType() && HasResolvedTypeClass() && (type_class() == Type::Handle(Type::Int32x4()).type_class()); } - bool AbstractType::IsNumberType() const { return !IsFunctionType() && HasResolvedTypeClass() && (type_class() == Type::Handle(Type::Number()).type_class()); } - bool AbstractType::IsSmiType() const { return !IsFunctionType() && HasResolvedTypeClass() && (type_class() == Type::Handle(Type::SmiType()).type_class()); } - bool AbstractType::IsStringType() const { return !IsFunctionType() && HasResolvedTypeClass() && (type_class() == Type::Handle(Type::StringType()).type_class()); } - bool AbstractType::IsDartFunctionType() const { return !IsFunctionType() && HasResolvedTypeClass() && (type_class() == Type::Handle(Type::DartFunctionType()).type_class()); } - bool AbstractType::IsDartClosureType() const { return !IsFunctionType() && HasResolvedTypeClass() && (type_class() == Isolate::Current()->object_store()->closure_class()); } - bool AbstractType::TypeTest(TypeTestKind test_kind, const AbstractType& other, Error* bound_error, @@ -16939,14 +15986,12 @@ bool AbstractType::TypeTest(TypeTestKind test_kind, bound_error, bound_trail, space); } - intptr_t AbstractType::Hash() const { // AbstractType is an abstract class. UNREACHABLE(); return 0; } - const char* AbstractType::ToCString() const { if (IsNull()) { return "AbstractType: null"; @@ -16956,92 +16001,74 @@ const char* AbstractType::ToCString() const { return "AbstractType"; } - RawType* Type::NullType() { return Isolate::Current()->object_store()->null_type(); } - RawType* Type::DynamicType() { return Object::dynamic_type().raw(); } - RawType* Type::VoidType() { return Object::void_type().raw(); } - RawType* Type::ObjectType() { return Isolate::Current()->object_store()->object_type(); } - RawType* Type::BoolType() { return Isolate::Current()->object_store()->bool_type(); } - RawType* Type::IntType() { return Isolate::Current()->object_store()->int_type(); } - RawType* Type::Int64Type() { return Isolate::Current()->object_store()->int64_type(); } - RawType* Type::SmiType() { return Isolate::Current()->object_store()->smi_type(); } - RawType* Type::MintType() { return Isolate::Current()->object_store()->mint_type(); } - RawType* Type::Double() { return Isolate::Current()->object_store()->double_type(); } - RawType* Type::Float32x4() { return Isolate::Current()->object_store()->float32x4_type(); } - RawType* Type::Float64x2() { return Isolate::Current()->object_store()->float64x2_type(); } - RawType* Type::Int32x4() { return Isolate::Current()->object_store()->int32x4_type(); } - RawType* Type::Number() { return Isolate::Current()->object_store()->number_type(); } - RawType* Type::StringType() { return Isolate::Current()->object_store()->string_type(); } - RawType* Type::ArrayType() { return Isolate::Current()->object_store()->array_type(); } - RawType* Type::DartFunctionType() { return Isolate::Current()->object_store()->function_type(); } - RawType* Type::NewNonParameterizedType(const Class& type_class) { ASSERT(type_class.NumTypeArguments() == 0); Type& type = Type::Handle(type_class.CanonicalType()); @@ -17055,7 +16082,6 @@ RawType* Type::NewNonParameterizedType(const Class& type_class) { return type.raw(); } - void Type::SetIsFinalized() const { ASSERT(!IsFinalized()); if (IsInstantiated()) { @@ -17066,20 +16092,17 @@ void Type::SetIsFinalized() const { } } - void Type::ResetIsFinalized() const { ASSERT(IsFinalized()); set_type_state(RawType::kBeingFinalized); SetIsFinalized(); } - void Type::SetIsBeingFinalized() const { ASSERT(IsResolved() && !IsFinalized() && !IsBeingFinalized()); set_type_state(RawType::kBeingFinalized); } - bool Type::IsMalformed() const { if (raw_ptr()->sig_or_err_.error_ == LanguageError::null()) { return false; // Valid type, but not a function type. @@ -17092,7 +16115,6 @@ bool Type::IsMalformed() const { return type_error.kind() == Report::kMalformedType; } - bool Type::IsMalbounded() const { if (raw_ptr()->sig_or_err_.error_ == LanguageError::null()) { return false; // Valid type, but not a function type. @@ -17108,7 +16130,6 @@ bool Type::IsMalbounded() const { return type_error.kind() == Report::kMalboundedType; } - bool Type::IsMalformedOrMalbounded() const { if (raw_ptr()->sig_or_err_.error_ == LanguageError::null()) { return false; // Valid type, but not a function type. @@ -17124,7 +16145,6 @@ bool Type::IsMalformedOrMalbounded() const { return Isolate::Current()->type_checks(); } - RawLanguageError* Type::error() const { if (raw_ptr()->sig_or_err_.error_->IsLanguageError()) { return LanguageError::RawCast(raw_ptr()->sig_or_err_.error_); @@ -17132,12 +16152,10 @@ RawLanguageError* Type::error() const { return LanguageError::null(); } - void Type::set_error(const LanguageError& value) const { StorePointer(&raw_ptr()->sig_or_err_.error_, value.raw()); } - RawFunction* Type::signature() const { intptr_t cid = raw_ptr()->sig_or_err_.signature_->GetClassId(); if (cid == kNullCid) { @@ -17150,34 +16168,28 @@ RawFunction* Type::signature() const { return Function::null(); } - void Type::set_signature(const Function& value) const { StorePointer(&raw_ptr()->sig_or_err_.signature_, value.raw()); } - void Type::SetIsResolved() const { ASSERT(!IsResolved()); set_type_state(RawType::kResolved); } - bool Type::HasResolvedTypeClass() const { return !raw_ptr()->type_class_id_->IsHeapObject(); } - classid_t Type::type_class_id() const { ASSERT(HasResolvedTypeClass()); return Smi::Value(reinterpret_cast(raw_ptr()->type_class_id_)); } - RawClass* Type::type_class() const { return Isolate::Current()->class_table()->At(type_class_id()); } - RawUnresolvedClass* Type::unresolved_class() const { #ifdef DEBUG ASSERT(!HasResolvedTypeClass()); @@ -17192,7 +16204,6 @@ RawUnresolvedClass* Type::unresolved_class() const { #endif } - bool Type::IsInstantiated(Genericity genericity, intptr_t num_free_fun_type_params, TrailPtr trail) const { @@ -17240,7 +16251,6 @@ bool Type::IsInstantiated(Genericity genericity, num_free_fun_type_params, trail); } - RawAbstractType* Type::InstantiateFrom( const TypeArguments& instantiator_type_arguments, const TypeArguments& function_type_arguments, @@ -17311,7 +16321,6 @@ RawAbstractType* Type::InstantiateFrom( return instantiated_type.raw(); } - bool Type::IsEquivalent(const Instance& other, TrailPtr trail) const { ASSERT(!IsNull()); if (raw() == other.raw()) { @@ -17475,12 +16484,10 @@ bool Type::IsEquivalent(const Instance& other, TrailPtr trail) const { return true; } - bool Type::IsRecursive() const { return TypeArguments::Handle(arguments()).IsRecursive(); } - RawAbstractType* Type::CloneUnfinalized() const { ASSERT(IsResolved()); if (IsFinalized()) { @@ -17547,7 +16554,6 @@ RawAbstractType* Type::CloneUnfinalized() const { return clone.raw(); } - RawAbstractType* Type::CloneUninstantiated(const Class& new_owner, TrailPtr trail) const { ASSERT(IsFinalized()); @@ -17627,7 +16633,6 @@ RawAbstractType* Type::CloneUninstantiated(const Class& new_owner, return clone.raw(); } - RawAbstractType* Type::Canonicalize(TrailPtr trail) const { ASSERT(IsFinalized()); if (IsCanonical() || IsMalformed()) { @@ -17757,7 +16762,6 @@ RawAbstractType* Type::Canonicalize(TrailPtr trail) const { return type.raw(); } - #if defined(DEBUG) bool Type::CheckIsCanonical(Thread* thread) const { if (IsMalformed()) { @@ -17789,7 +16793,6 @@ bool Type::CheckIsCanonical(Thread* thread) const { } #endif // DEBUG - RawString* Type::EnumerateURIs() const { if (IsDynamicType() || IsVoidType()) { return Symbols::Empty().raw(); @@ -17826,7 +16829,6 @@ RawString* Type::EnumerateURIs() const { return Symbols::FromConcatAll(thread, pieces); } - intptr_t Type::ComputeHash() const { ASSERT(IsFinalized()); uint32_t result = 1; @@ -17856,33 +16858,28 @@ intptr_t Type::ComputeHash() const { return result; } - void Type::set_type_class(const Class& value) const { ASSERT(!value.IsNull()); StorePointer(&raw_ptr()->type_class_id_, reinterpret_cast(Smi::New(value.id()))); } - void Type::set_unresolved_class(const Object& value) const { ASSERT(!value.IsNull() && value.IsUnresolvedClass()); StorePointer(&raw_ptr()->type_class_id_, value.raw()); } - void Type::set_arguments(const TypeArguments& value) const { ASSERT(!IsCanonical()); StorePointer(&raw_ptr()->arguments_, value.raw()); } - RawType* Type::New(Heap::Space space) { RawObject* raw = Object::Allocate(Type::kClassId, Type::InstanceSize(), space); return reinterpret_cast(raw); } - RawType* Type::New(const Object& clazz, const TypeArguments& arguments, TokenPosition token_pos, @@ -17900,20 +16897,17 @@ RawType* Type::New(const Object& clazz, return result.raw(); } - void Type::set_token_pos(TokenPosition token_pos) const { ASSERT(!token_pos.IsClassifying()); StoreNonPointer(&raw_ptr()->token_pos_, token_pos); } - void Type::set_type_state(int8_t state) const { ASSERT((state >= RawType::kAllocated) && (state <= RawType::kFinalizedUninstantiated)); StoreNonPointer(&raw_ptr()->type_state_, state); } - const char* Type::ToCString() const { if (IsNull()) { return "Type: null"; @@ -17953,7 +16947,6 @@ const char* Type::ToCString() const { } } - bool TypeRef::IsInstantiated(Genericity genericity, intptr_t num_free_fun_type_params, TrailPtr trail) const { @@ -17965,7 +16958,6 @@ bool TypeRef::IsInstantiated(Genericity genericity, ref_type.IsInstantiated(genericity, num_free_fun_type_params, trail); } - bool TypeRef::IsEquivalent(const Instance& other, TrailPtr trail) const { if (raw() == other.raw()) { return true; @@ -17980,7 +16972,6 @@ bool TypeRef::IsEquivalent(const Instance& other, TrailPtr trail) const { return !ref_type.IsNull() && ref_type.IsEquivalent(other, trail); } - RawTypeRef* TypeRef::InstantiateFrom( const TypeArguments& instantiator_type_arguments, const TypeArguments& function_type_arguments, @@ -18007,7 +16998,6 @@ RawTypeRef* TypeRef::InstantiateFrom( return instantiated_type_ref.raw(); } - RawTypeRef* TypeRef::CloneUninstantiated(const Class& new_owner, TrailPtr trail) const { TypeRef& cloned_type_ref = TypeRef::Handle(); @@ -18026,14 +17016,12 @@ RawTypeRef* TypeRef::CloneUninstantiated(const Class& new_owner, return cloned_type_ref.raw(); } - void TypeRef::set_type(const AbstractType& value) const { ASSERT(value.IsFunctionType() || value.HasResolvedTypeClass()); ASSERT(!value.IsTypeRef()); StorePointer(&raw_ptr()->type_, value.raw()); } - // A TypeRef cannot be canonical by definition. Only its referenced type can be. // Consider the type Derived, where class Derived extends Base. // The first type argument of its flattened type argument vector is Derived, @@ -18051,7 +17039,6 @@ RawAbstractType* TypeRef::Canonicalize(TrailPtr trail) const { return raw(); } - #if defined(DEBUG) bool TypeRef::CheckIsCanonical(Thread* thread) const { AbstractType& ref_type = AbstractType::Handle(type()); @@ -18060,7 +17047,6 @@ bool TypeRef::CheckIsCanonical(Thread* thread) const { } #endif // DEBUG - RawString* TypeRef::EnumerateURIs() const { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -18079,7 +17065,6 @@ RawString* TypeRef::EnumerateURIs() const { return Symbols::FromConcatAll(thread, pieces); } - intptr_t TypeRef::Hash() const { // Do not calculate the hash of the referenced type to avoid divergence. const AbstractType& ref_type = AbstractType::Handle(type()); @@ -18088,21 +17073,18 @@ intptr_t TypeRef::Hash() const { return FinalizeHash(result, kHashBits); } - RawTypeRef* TypeRef::New() { RawObject* raw = Object::Allocate(TypeRef::kClassId, TypeRef::InstanceSize(), Heap::kOld); return reinterpret_cast(raw); } - RawTypeRef* TypeRef::New(const AbstractType& type) { const TypeRef& result = TypeRef::Handle(TypeRef::New()); result.set_type(type); return result.raw(); } - const char* TypeRef::ToCString() const { AbstractType& ref_type = AbstractType::Handle(type()); if (ref_type.IsNull()) { @@ -18121,13 +17103,11 @@ const char* TypeRef::ToCString() const { } } - void TypeParameter::SetIsFinalized() const { ASSERT(!IsFinalized()); set_type_state(RawTypeParameter::kFinalizedUninstantiated); } - bool TypeParameter::IsInstantiated(Genericity genericity, intptr_t num_free_fun_type_params, TrailPtr trail) const { @@ -18139,7 +17119,6 @@ bool TypeParameter::IsInstantiated(Genericity genericity, return (genericity == kCurrentClass) || (index() >= num_free_fun_type_params); } - bool TypeParameter::IsEquivalent(const Instance& other, TrailPtr trail) const { if (raw() == other.raw()) { return true; @@ -18168,7 +17147,6 @@ bool TypeParameter::IsEquivalent(const Instance& other, TrailPtr trail) const { return name() == other_type_param.name(); } - void TypeParameter::set_parameterized_class(const Class& value) const { // Set value may be null. classid_t cid = kFunctionCid; // Denotes a function type parameter. @@ -18178,12 +17156,10 @@ void TypeParameter::set_parameterized_class(const Class& value) const { StoreNonPointer(&raw_ptr()->parameterized_class_id_, cid); } - classid_t TypeParameter::parameterized_class_id() const { return raw_ptr()->parameterized_class_id_; } - RawClass* TypeParameter::parameterized_class() const { classid_t cid = parameterized_class_id(); if (cid == kFunctionCid) { @@ -18192,30 +17168,25 @@ RawClass* TypeParameter::parameterized_class() const { return Isolate::Current()->class_table()->At(cid); } - void TypeParameter::set_parameterized_function(const Function& value) const { StorePointer(&raw_ptr()->parameterized_function_, value.raw()); } - void TypeParameter::set_index(intptr_t value) const { ASSERT(value >= 0); ASSERT(Utils::IsInt(16, value)); StoreNonPointer(&raw_ptr()->index_, value); } - void TypeParameter::set_name(const String& value) const { ASSERT(value.IsSymbol()); StorePointer(&raw_ptr()->name_, value.raw()); } - void TypeParameter::set_bound(const AbstractType& value) const { StorePointer(&raw_ptr()->bound_, value.raw()); } - RawAbstractType* TypeParameter::InstantiateFrom( const TypeArguments& instantiator_type_arguments, const TypeArguments& function_type_arguments, @@ -18259,7 +17230,6 @@ RawAbstractType* TypeParameter::InstantiateFrom( // prolog). } - bool TypeParameter::CheckBound(const AbstractType& bounded_type, const AbstractType& upper_bound, Error* bound_error, @@ -18322,7 +17292,6 @@ bool TypeParameter::CheckBound(const AbstractType& bounded_type, return false; } - RawAbstractType* TypeParameter::CloneUnfinalized() const { if (IsFinalized()) { return raw(); @@ -18334,7 +17303,6 @@ RawAbstractType* TypeParameter::CloneUnfinalized() const { AbstractType::Handle(bound()), token_pos()); } - RawAbstractType* TypeParameter::CloneUninstantiated(const Class& new_owner, TrailPtr trail) const { ASSERT(IsFinalized()); @@ -18367,7 +17335,6 @@ RawAbstractType* TypeParameter::CloneUninstantiated(const Class& new_owner, return clone.raw(); } - RawString* TypeParameter::EnumerateURIs() const { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -18393,7 +17360,6 @@ RawString* TypeParameter::EnumerateURIs() const { return Symbols::FromConcatAll(thread, pieces); } - intptr_t TypeParameter::ComputeHash() const { ASSERT(IsFinalized()); uint32_t result; @@ -18410,14 +17376,12 @@ intptr_t TypeParameter::ComputeHash() const { return result; } - RawTypeParameter* TypeParameter::New() { RawObject* raw = Object::Allocate(TypeParameter::kClassId, TypeParameter::InstanceSize(), Heap::kOld); return reinterpret_cast(raw); } - RawTypeParameter* TypeParameter::New(const Class& parameterized_class, const Function& parameterized_function, intptr_t index, @@ -18438,13 +17402,11 @@ RawTypeParameter* TypeParameter::New(const Class& parameterized_class, return result.raw(); } - void TypeParameter::set_token_pos(TokenPosition token_pos) const { ASSERT(!token_pos.IsClassifying()); StoreNonPointer(&raw_ptr()->token_pos_, token_pos); } - void TypeParameter::set_type_state(int8_t state) const { ASSERT((state == RawTypeParameter::kAllocated) || (state == RawTypeParameter::kBeingFinalized) || @@ -18452,7 +17414,6 @@ void TypeParameter::set_type_state(int8_t state) const { StoreNonPointer(&raw_ptr()->type_state_, state); } - const char* TypeParameter::ToCString() const { const char* name_cstr = String::Handle(Name()).ToCString(); const AbstractType& upper_bound = AbstractType::Handle(bound()); @@ -18483,27 +17444,22 @@ const char* TypeParameter::ToCString() const { } } - bool BoundedType::IsMalformed() const { return AbstractType::Handle(type()).IsMalformed(); } - bool BoundedType::IsMalbounded() const { return AbstractType::Handle(type()).IsMalbounded(); } - bool BoundedType::IsMalformedOrMalbounded() const { return AbstractType::Handle(type()).IsMalformedOrMalbounded(); } - RawLanguageError* BoundedType::error() const { return AbstractType::Handle(type()).error(); } - bool BoundedType::IsEquivalent(const Instance& other, TrailPtr trail) const { // BoundedType are not canonicalized, because their bound may get finalized // after the BoundedType is created and initialized. @@ -18535,12 +17491,10 @@ bool BoundedType::IsEquivalent(const Instance& other, TrailPtr trail) const { this_bound.Equals(other_bound); // Different graph, do not pass trail. } - bool BoundedType::IsRecursive() const { return AbstractType::Handle(type()).IsRecursive(); } - void BoundedType::set_type(const AbstractType& value) const { ASSERT(value.IsFinalized() || value.IsBeingFinalized() || value.IsTypeParameter()); @@ -18548,7 +17502,6 @@ void BoundedType::set_type(const AbstractType& value) const { StorePointer(&raw_ptr()->type_, value.raw()); } - void BoundedType::set_bound(const AbstractType& value) const { // The bound may still be unfinalized because of legal cycles. // It must be finalized before it is checked at run time, though. @@ -18556,7 +17509,6 @@ void BoundedType::set_bound(const AbstractType& value) const { StorePointer(&raw_ptr()->bound_, value.raw()); } - void BoundedType::set_type_parameter(const TypeParameter& value) const { // A null type parameter is set when marking a type malformed because of a // bound error at compile time. @@ -18564,7 +17516,6 @@ void BoundedType::set_type_parameter(const TypeParameter& value) const { StorePointer(&raw_ptr()->type_parameter_, value.raw()); } - RawAbstractType* BoundedType::InstantiateFrom( const TypeArguments& instantiator_type_arguments, const TypeArguments& function_type_arguments, @@ -18639,7 +17590,6 @@ RawAbstractType* BoundedType::InstantiateFrom( return instantiated_bounded_type.raw(); } - RawAbstractType* BoundedType::CloneUnfinalized() const { if (IsFinalized()) { return raw(); @@ -18656,7 +17606,6 @@ RawAbstractType* BoundedType::CloneUnfinalized() const { TypeParameter::Handle(type_parameter())); } - RawAbstractType* BoundedType::CloneUninstantiated(const Class& new_owner, TrailPtr trail) const { if (IsInstantiated()) { @@ -18671,13 +17620,11 @@ RawAbstractType* BoundedType::CloneUninstantiated(const Class& new_owner, return BoundedType::New(bounded_type, upper_bound, type_param); } - RawString* BoundedType::EnumerateURIs() const { // The bound does not appear in the user visible name. return AbstractType::Handle(type()).EnumerateURIs(); } - intptr_t BoundedType::ComputeHash() const { uint32_t result = AbstractType::Handle(type()).Hash(); // No need to include the hash of the bound, since the bound is defined by the @@ -18689,14 +17636,12 @@ intptr_t BoundedType::ComputeHash() const { return result; } - RawBoundedType* BoundedType::New() { RawObject* raw = Object::Allocate(BoundedType::kClassId, BoundedType::InstanceSize(), Heap::kOld); return reinterpret_cast(raw); } - RawBoundedType* BoundedType::New(const AbstractType& type, const AbstractType& bound, const TypeParameter& type_parameter) { @@ -18708,7 +17653,6 @@ RawBoundedType* BoundedType::New(const AbstractType& type, return result.raw(); } - const char* BoundedType::ToCString() const { const char* format = "BoundedType: type %s; bound: %s; type param: %s of %s"; const char* type_cstr = @@ -18728,22 +17672,18 @@ const char* BoundedType::ToCString() const { return chars; } - TokenPosition MixinAppType::token_pos() const { return AbstractType::Handle(MixinTypeAt(0)).token_pos(); } - intptr_t MixinAppType::Depth() const { return Array::Handle(mixin_types()).Length(); } - RawString* MixinAppType::Name() const { return String::New("MixinAppType"); } - const char* MixinAppType::ToCString() const { const char* format = "MixinAppType: super type: %s; first mixin type: %s"; const char* super_type_cstr = @@ -18757,22 +17697,18 @@ const char* MixinAppType::ToCString() const { return chars; } - RawAbstractType* MixinAppType::MixinTypeAt(intptr_t depth) const { return AbstractType::RawCast(Array::Handle(mixin_types()).At(depth)); } - void MixinAppType::set_super_type(const AbstractType& value) const { StorePointer(&raw_ptr()->super_type_, value.raw()); } - void MixinAppType::set_mixin_types(const Array& value) const { StorePointer(&raw_ptr()->mixin_types_, value.raw()); } - RawMixinAppType* MixinAppType::New() { // MixinAppType objects do not survive finalization, so allocate // on new heap. @@ -18781,7 +17717,6 @@ RawMixinAppType* MixinAppType::New() { return reinterpret_cast(raw); } - RawMixinAppType* MixinAppType::New(const AbstractType& super_type, const Array& mixin_types) { const MixinAppType& result = MixinAppType::Handle(MixinAppType::New()); @@ -18790,7 +17725,6 @@ RawMixinAppType* MixinAppType::New(const AbstractType& super_type, return result.raw(); } - RawInstance* Number::CheckAndCanonicalize(Thread* thread, const char** error_str) const { intptr_t cid = GetClassId(); @@ -18845,7 +17779,6 @@ RawInstance* Number::CheckAndCanonicalize(Thread* thread, return Instance::null(); } - #if defined(DEBUG) bool Number::CheckIsCanonical(Thread* thread) const { intptr_t cid = GetClassId(); @@ -18877,21 +17810,18 @@ bool Number::CheckIsCanonical(Thread* thread) const { } #endif // DEBUG - const char* Number::ToCString() const { // Number is an interface. No instances of Number should exist. UNREACHABLE(); return "Number"; } - const char* Integer::ToCString() const { // Integer is an interface. No instances of Integer should exist except null. ASSERT(IsNull()); return "NULL Integer"; } - RawInteger* Integer::New(const String& str, Heap::Space space) { // We are not supposed to have integers represented as two byte strings. ASSERT(str.IsOneByteString()); @@ -18910,7 +17840,6 @@ RawInteger* Integer::New(const String& str, Heap::Space space) { return Integer::New(value, space); } - RawInteger* Integer::NewCanonical(const String& str) { // We are not supposed to have integers represented as two byte strings. ASSERT(str.IsOneByteString()); @@ -18931,7 +17860,6 @@ RawInteger* Integer::NewCanonical(const String& str) { return Mint::NewCanonical(value); } - RawInteger* Integer::New(int64_t value, Heap::Space space) { const bool is_smi = Smi::IsValid(value); if (is_smi) { @@ -18940,7 +17868,6 @@ RawInteger* Integer::New(int64_t value, Heap::Space space) { return Mint::New(value, space); } - RawInteger* Integer::NewFromUint64(uint64_t value, Heap::Space space) { if (value > static_cast(Mint::kMaxValue)) { if (FLAG_limit_ints_to_64_bits) { @@ -18954,63 +17881,54 @@ RawInteger* Integer::NewFromUint64(uint64_t value, Heap::Space space) { } } - bool Integer::Equals(const Instance& other) const { // Integer is an abstract class. UNREACHABLE(); return false; } - bool Integer::IsZero() const { // Integer is an abstract class. UNREACHABLE(); return false; } - bool Integer::IsNegative() const { // Integer is an abstract class. UNREACHABLE(); return false; } - double Integer::AsDoubleValue() const { // Integer is an abstract class. UNREACHABLE(); return 0.0; } - int64_t Integer::AsInt64Value() const { // Integer is an abstract class. UNREACHABLE(); return 0; } - uint32_t Integer::AsTruncatedUint32Value() const { // Integer is an abstract class. UNREACHABLE(); return 0; } - bool Integer::FitsIntoSmi() const { // Integer is an abstract class. UNREACHABLE(); return false; } - int Integer::CompareWith(const Integer& other) const { // Integer is an abstract class. UNREACHABLE(); return 0; } - RawInteger* Integer::AsValidInteger() const { if (IsSmi()) return raw(); if (IsMint()) { @@ -19034,7 +17952,6 @@ RawInteger* Integer::AsValidInteger() const { return raw(); } - RawInteger* Integer::ArithmeticOp(Token::Kind operation, const Integer& other, Heap::Space space) const { @@ -19160,12 +18077,10 @@ RawInteger* Integer::ArithmeticOp(Token::Kind operation, return Integer::null(); // Notify caller that a bigint operation is required. } - static bool Are64bitOperands(const Integer& op1, const Integer& op2) { return !op1.IsBigint() && !op2.IsBigint(); } - RawInteger* Integer::BitOp(Token::Kind kind, const Integer& other, Heap::Space space) const { @@ -19206,7 +18121,6 @@ RawInteger* Integer::BitOp(Token::Kind kind, return Integer::null(); // Notify caller that a bigint operation is required. } - // TODO(srdjan): Clarify handling of negative right operand in a shift op. RawInteger* Smi::ShiftOp(Token::Kind kind, const Smi& other, @@ -19253,7 +18167,6 @@ RawInteger* Smi::ShiftOp(Token::Kind kind, return Smi::New(result); } - bool Smi::Equals(const Instance& other) const { if (other.IsNull() || !other.IsSmi()) { return false; @@ -19261,22 +18174,18 @@ bool Smi::Equals(const Instance& other) const { return (this->Value() == Smi::Cast(other).Value()); } - double Smi::AsDoubleValue() const { return static_cast(this->Value()); } - int64_t Smi::AsInt64Value() const { return this->Value(); } - uint32_t Smi::AsTruncatedUint32Value() const { return this->Value() & 0xFFFFFFFF; } - int Smi::CompareWith(const Integer& other) const { if (other.IsSmi()) { const Smi& other_smi = Smi::Cast(other); @@ -19299,22 +18208,18 @@ int Smi::CompareWith(const Integer& other) const { return 0; } - const char* Smi::ToCString() const { return OS::SCreate(Thread::Current()->zone(), "%" Pd "", Value()); } - RawClass* Smi::Class() { return Isolate::Current()->object_store()->smi_class(); } - void Mint::set_value(int64_t value) const { StoreNonPointer(&raw_ptr()->value_, value); } - RawMint* Mint::New(int64_t val, Heap::Space space) { // Do not allocate a Mint if Smi would do. ASSERT(!Smi::IsValid(val)); @@ -19330,7 +18235,6 @@ RawMint* Mint::New(int64_t val, Heap::Space space) { return result.raw(); } - RawMint* Mint::NewCanonical(int64_t value) { // Do not allocate a Mint if Smi would do. ASSERT(!Smi::IsValid(value)); @@ -19362,7 +18266,6 @@ RawMint* Mint::NewCanonical(int64_t value) { } } - bool Mint::Equals(const Instance& other) const { if (this->raw() == other.raw()) { // Both handles point to the same raw instance. @@ -19374,27 +18277,22 @@ bool Mint::Equals(const Instance& other) const { return value() == Mint::Cast(other).value(); } - double Mint::AsDoubleValue() const { return static_cast(this->value()); } - int64_t Mint::AsInt64Value() const { return this->value(); } - uint32_t Mint::AsTruncatedUint32Value() const { return this->value() & 0xFFFFFFFF; } - bool Mint::FitsIntoSmi() const { return Smi::IsValid(AsInt64Value()); } - int Mint::CompareWith(const Integer& other) const { ASSERT(!FitsIntoSmi()); if (other.IsMint() || other.IsSmi()) { @@ -19416,17 +18314,14 @@ int Mint::CompareWith(const Integer& other) const { return this->IsNegative() ? -1 : 1; } - const char* Mint::ToCString() const { return OS::SCreate(Thread::Current()->zone(), "%" Pd64 "", value()); } - void Double::set_value(double value) const { StoreNonPointer(&raw_ptr()->value_, value); } - bool Double::BitwiseEqualsToDouble(double value) const { intptr_t value_offset = Double::value_offset(); void* this_addr = reinterpret_cast( @@ -19435,7 +18330,6 @@ bool Double::BitwiseEqualsToDouble(double value) const { return (memcmp(this_addr, other_addr, sizeof(value)) == 0); } - bool Double::OperatorEquals(const Instance& other) const { if (this->IsNull() || other.IsNull()) { return (this->IsNull() && other.IsNull()); @@ -19446,7 +18340,6 @@ bool Double::OperatorEquals(const Instance& other) const { return this->value() == Double::Cast(other).value(); } - bool Double::CanonicalizeEquals(const Instance& other) const { if (this->raw() == other.raw()) { return true; // "===". @@ -19457,7 +18350,6 @@ bool Double::CanonicalizeEquals(const Instance& other) const { return BitwiseEqualsToDouble(Double::Cast(other).value()); } - RawDouble* Double::New(double d, Heap::Space space) { ASSERT(Isolate::Current()->object_store()->double_class() != Class::null()); Double& result = Double::Handle(); @@ -19471,7 +18363,6 @@ RawDouble* Double::New(double d, Heap::Space space) { return result.raw(); } - RawDouble* Double::New(const String& str, Heap::Space space) { double double_value; if (!CStringToDouble(str.ToCString(), str.Length(), &double_value)) { @@ -19480,7 +18371,6 @@ RawDouble* Double::New(const String& str, Heap::Space space) { return New(double_value, space); } - RawDouble* Double::NewCanonical(double value) { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -19513,7 +18403,6 @@ RawDouble* Double::NewCanonical(double value) { } } - RawDouble* Double::NewCanonical(const String& str) { double double_value; if (!CStringToDouble(str.ToCString(), str.Length(), &double_value)) { @@ -19522,7 +18411,6 @@ RawDouble* Double::NewCanonical(const String& str) { return NewCanonical(double_value); } - RawString* Number::ToString(Heap::Space space) const { // Refactoring can avoid Zone::Alloc and strlen, but gains are insignificant. const char* cstr = ToCString(); @@ -19537,7 +18425,6 @@ RawString* Number::ToString(Heap::Space space) const { return String::FromLatin1(reinterpret_cast(cstr), len, space); } - const char* Double::ToCString() const { if (isnan(value())) { return "NaN"; @@ -19552,59 +18439,49 @@ const char* Double::ToCString() const { return buffer; } - bool Bigint::Neg() const { return Bool::Handle(neg()).value(); } - void Bigint::SetNeg(bool value) const { StorePointer(&raw_ptr()->neg_, Bool::Get(value).raw()); } - intptr_t Bigint::Used() const { return Smi::Value(used()); } - void Bigint::SetUsed(intptr_t value) const { StoreSmi(&raw_ptr()->used_, Smi::New(value)); } - uint32_t Bigint::DigitAt(intptr_t index) const { const TypedData& typed_data = TypedData::Handle(digits()); return typed_data.GetUint32(index << 2); } - void Bigint::set_digits(const TypedData& value) const { // The VM expects digits_ to be a Uint32List (not null). ASSERT(!value.IsNull() && (value.GetClassId() == kTypedDataUint32ArrayCid)); StorePointer(&raw_ptr()->digits_, value.raw()); } - RawTypedData* Bigint::NewDigits(intptr_t length, Heap::Space space) { ASSERT(length > 0); // Account for leading zero for 64-bit processing. return TypedData::New(kTypedDataUint32ArrayCid, length + 1, space); } - uint32_t Bigint::DigitAt(const TypedData& digits, intptr_t index) { return digits.GetUint32(index << 2); } - void Bigint::SetDigitAt(const TypedData& digits, intptr_t index, uint32_t value) { digits.SetUint32(index << 2, value); } - bool Bigint::Equals(const Instance& other) const { if (this->raw() == other.raw()) { // Both handles point to the same raw instance. @@ -19634,7 +18511,6 @@ bool Bigint::Equals(const Instance& other) const { return true; } - bool Bigint::CheckAndCanonicalizeFields(Thread* thread, const char** error_str) const { Zone* zone = thread->zone(); @@ -19653,7 +18529,6 @@ bool Bigint::CheckAndCanonicalizeFields(Thread* thread, return true; } - RawBigint* Bigint::New(Heap::Space space) { // TODO(alexmarkov): Throw error or assert in --limit-ints-to-64-bits mode. Thread* thread = Thread::Current(); @@ -19674,7 +18549,6 @@ RawBigint* Bigint::New(Heap::Space space) { return result.raw(); } - RawBigint* Bigint::New(bool neg, intptr_t used, const TypedData& digits, @@ -19715,7 +18589,6 @@ RawBigint* Bigint::New(bool neg, return result.raw(); } - RawBigint* Bigint::NewFromInt64(int64_t value, Heap::Space space) { // Currently only used to convert Smi or Mint to hex String, therefore do // not throw RangeError if --limit-ints-to-64-bits. @@ -19735,7 +18608,6 @@ RawBigint* Bigint::NewFromInt64(int64_t value, Heap::Space space) { return New(neg, 2, digits, space); } - RawBigint* Bigint::NewFromUint64(uint64_t value, Heap::Space space) { // TODO(alexmarkov): Revise this assertion if this factory method is used // to explicitly allocate Bigint objects in --limit-ints-to-64-bits mode. @@ -19746,7 +18618,6 @@ RawBigint* Bigint::NewFromUint64(uint64_t value, Heap::Space space) { return New(false, 2, digits, space); } - RawBigint* Bigint::NewFromShiftedInt64(int64_t value, intptr_t shift, Heap::Space space) { @@ -19776,12 +18647,12 @@ RawBigint* Bigint::NewFromShiftedInt64(int64_t value, SetDigitAt(digits, 1 + digit_shift, static_cast(abs_value >> (32 - bit_shift))); SetDigitAt(digits, 2 + digit_shift, - (bit_shift == 0) ? 0 : static_cast(abs_value >> - (64 - bit_shift))); + (bit_shift == 0) + ? 0 + : static_cast(abs_value >> (64 - bit_shift))); return New(neg, used, digits, space); } - RawBigint* Bigint::NewFromCString(const char* str, Heap::Space space) { // Allow parser to scan Bigint literal, even with --limit-ints-to-64-bits. // TODO(alexmarkov): Throw error or assert in --limit-ints-to-64-bits mode. @@ -19804,7 +18675,6 @@ RawBigint* Bigint::NewFromCString(const char* str, Heap::Space space) { return New(neg, used, digits, space); } - RawBigint* Bigint::NewCanonical(const String& str) { // Allow parser to scan Bigint literal, even with --limit-ints-to-64-bits. // TODO(alexmarkov): Throw error or assert in --limit-ints-to-64-bits mode. @@ -19838,7 +18708,6 @@ RawBigint* Bigint::NewCanonical(const String& str) { } } - RawTypedData* Bigint::NewDigitsFromHexCString(const char* str, intptr_t* used, Heap::Space space) { @@ -19870,7 +18739,6 @@ RawTypedData* Bigint::NewDigitsFromHexCString(const char* str, return digits.raw(); } - RawTypedData* Bigint::NewDigitsFromDecCString(const char* str, intptr_t* used, Heap::Space space) { @@ -19925,7 +18793,6 @@ RawTypedData* Bigint::NewDigitsFromDecCString(const char* str, return digits.raw(); } - static double Uint64ToDouble(uint64_t x) { #if _WIN64 // For static_cast(x) MSVC x64 generates @@ -19969,7 +18836,6 @@ static double Uint64ToDouble(uint64_t x) { #endif } - double Bigint::AsDoubleValue() const { ASSERT(kBitsPerDigit == 32); const intptr_t used = Used(); @@ -20104,12 +18970,10 @@ double Bigint::AsDoubleValue() const { return Neg() ? -value : value; } - bool Bigint::FitsIntoSmi() const { return FitsIntoInt64() && Smi::IsValid(AsInt64Value()); } - bool Bigint::FitsIntoInt64() const { ASSERT(Bigint::kBitsPerDigit == 32); const intptr_t used = Used(); @@ -20124,7 +18988,6 @@ bool Bigint::FitsIntoInt64() const { return value <= limit; } - int64_t Bigint::AsTruncatedInt64Value() const { const intptr_t used = Used(); if (used == 0) return 0; @@ -20133,19 +18996,16 @@ int64_t Bigint::AsTruncatedInt64Value() const { return Neg() ? -value : value; } - int64_t Bigint::AsInt64Value() const { ASSERT(FitsIntoInt64()); return AsTruncatedInt64Value(); } - bool Bigint::FitsIntoUint64() const { ASSERT(Bigint::kBitsPerDigit == 32); return !Neg() && (Used() <= 2); } - uint64_t Bigint::AsUint64Value() const { ASSERT(FitsIntoUint64()); const intptr_t used = Used(); @@ -20154,7 +19014,6 @@ uint64_t Bigint::AsUint64Value() const { return (digit1 << 32) + DigitAt(0); } - uint32_t Bigint::AsTruncatedUint32Value() const { // Note: the previous implementation of Bigint returned the absolute value // truncated to 32 bits, which is not consistent with Smi and Mint behavior. @@ -20165,7 +19024,6 @@ uint32_t Bigint::AsTruncatedUint32Value() const { return Neg() ? static_cast(-static_cast(digit0)) : digit0; } - // For positive values: Smi < Mint < Bigint. int Bigint::CompareWith(const Integer& other) const { ASSERT(!FitsIntoSmi()); @@ -20188,7 +19046,6 @@ int Bigint::CompareWith(const Integer& other) const { return this->IsNegative() ? -1 : 1; } - const char* Bigint::ToDecCString(Zone* zone) const { // log10(2) ~= 0.30102999566398114. const intptr_t kLog2Dividend = 30103; @@ -20260,7 +19117,6 @@ const char* Bigint::ToDecCString(Zone* zone) const { return chars; } - const char* Bigint::ToHexCString(Zone* zone) const { const intptr_t used = Used(); if (used == 0) { @@ -20311,12 +19167,10 @@ const char* Bigint::ToHexCString(Zone* zone) const { return chars; } - const char* Bigint::ToCString() const { return ToDecCString(Thread::Current()->zone()); } - // Synchronize with implementation in compiler (intrinsifier). class StringHasher : ValueObject { public: @@ -20336,7 +19190,6 @@ class StringHasher : ValueObject { uint32_t hash_; }; - void StringHasher::Add(const String& str, intptr_t begin_index, intptr_t len) { ASSERT(begin_index >= 0); ASSERT(len >= 0); @@ -20359,14 +19212,12 @@ void StringHasher::Add(const String& str, intptr_t begin_index, intptr_t len) { } } - intptr_t String::Hash(const String& str, intptr_t begin_index, intptr_t len) { StringHasher hasher; hasher.Add(str, begin_index, len); return hasher.Finalize(kHashBits); } - intptr_t String::HashConcat(const String& str1, const String& str2) { intptr_t len1 = str1.Length(); // Since String::Hash works at the code point (rune) level, a surrogate pair @@ -20382,7 +19233,6 @@ intptr_t String::HashConcat(const String& str1, const String& str2) { } } - template static intptr_t HashImpl(const T* characters, intptr_t len) { ASSERT(len >= 0); @@ -20393,7 +19243,6 @@ static intptr_t HashImpl(const T* characters, intptr_t len) { return hasher.Finalize(String::kHashBits); } - intptr_t String::Hash(RawString* raw) { StringHasher hasher; uword length = Smi::Value(raw->ptr()->length_); @@ -20422,17 +19271,14 @@ intptr_t String::Hash(RawString* raw) { } } - intptr_t String::Hash(const char* characters, intptr_t len) { return HashImpl(characters, len); } - intptr_t String::Hash(const uint8_t* characters, intptr_t len) { return HashImpl(characters, len); } - intptr_t String::Hash(const uint16_t* characters, intptr_t len) { StringHasher hasher; intptr_t i = 0; @@ -20442,12 +19288,10 @@ intptr_t String::Hash(const uint16_t* characters, intptr_t len) { return hasher.Finalize(kHashBits); } - intptr_t String::Hash(const int32_t* characters, intptr_t len) { return HashImpl(characters, len); } - uint16_t String::CharAt(intptr_t index) const { intptr_t class_id = raw()->GetClassId(); ASSERT(RawObject::IsStringClassId(class_id)); @@ -20464,7 +19308,6 @@ uint16_t String::CharAt(intptr_t index) const { return ExternalTwoByteString::CharAt(*this, index); } - Scanner::CharAtFunc String::CharAtFunc() const { intptr_t class_id = raw()->GetClassId(); ASSERT(RawObject::IsStringClassId(class_id)); @@ -20481,7 +19324,6 @@ Scanner::CharAtFunc String::CharAtFunc() const { return &ExternalTwoByteString::CharAt; } - intptr_t String::CharSize() const { intptr_t class_id = raw()->GetClassId(); if (class_id == kOneByteStringCid || class_id == kExternalOneByteStringCid) { @@ -20492,7 +19334,6 @@ intptr_t String::CharSize() const { return kTwoByteChar; } - void* String::GetPeer() const { intptr_t class_id = raw()->GetClassId(); if (class_id == kExternalOneByteStringCid) { @@ -20502,7 +19343,6 @@ void* String::GetPeer() const { return ExternalTwoByteString::GetPeer(*this); } - bool String::Equals(const Instance& other) const { if (this->raw() == other.raw()) { // Both handles point to the same raw instance. @@ -20517,7 +19357,6 @@ bool String::Equals(const Instance& other) const { return Equals(other_string); } - bool String::Equals(const String& str, intptr_t begin_index, intptr_t len) const { @@ -20540,7 +19379,6 @@ bool String::Equals(const String& str, return true; } - bool String::Equals(const char* cstr) const { ASSERT(cstr != NULL); CodePointIterator it(*this); @@ -20562,7 +19400,6 @@ bool String::Equals(const char* cstr) const { return *cstr == '\0'; } - bool String::Equals(const uint8_t* latin1_array, intptr_t len) const { if (len != this->Length()) { // Lengths don't match. @@ -20577,7 +19414,6 @@ bool String::Equals(const uint8_t* latin1_array, intptr_t len) const { return true; } - bool String::Equals(const uint16_t* utf16_array, intptr_t len) const { if (len != this->Length()) { // Lengths don't match. @@ -20592,7 +19428,6 @@ bool String::Equals(const uint16_t* utf16_array, intptr_t len) const { return true; } - bool String::Equals(const int32_t* utf32_array, intptr_t len) const { if (len < 0) return false; intptr_t j = 0; @@ -20611,14 +19446,12 @@ bool String::Equals(const int32_t* utf32_array, intptr_t len) const { return j == Length(); } - bool String::EqualsConcat(const String& str1, const String& str2) const { return (Length() == str1.Length() + str2.Length()) && str1.Equals(*this, 0, str1.Length()) && str2.Equals(*this, str1.Length(), str2.Length()); } - intptr_t String::CompareTo(const String& other) const { const intptr_t this_len = this->Length(); const intptr_t other_len = other.IsNull() ? 0 : other.Length(); @@ -20638,7 +19471,6 @@ intptr_t String::CompareTo(const String& other) const { return 0; } - bool String::StartsWith(const String& other) const { if (other.IsNull() || (other.Length() > this->Length())) { return false; @@ -20652,7 +19484,6 @@ bool String::StartsWith(const String& other) const { return true; } - RawInstance* String::CheckAndCanonicalize(Thread* thread, const char** error_str) const { if (IsCanonical()) { @@ -20661,7 +19492,6 @@ RawInstance* String::CheckAndCanonicalize(Thread* thread, return Symbols::New(Thread::Current(), *this); } - #if defined(DEBUG) bool String::CheckIsCanonical(Thread* thread) const { Zone* zone = thread->zone(); @@ -20670,7 +19500,6 @@ bool String::CheckIsCanonical(Thread* thread) const { } #endif // DEBUG - RawString* String::New(const char* cstr, Heap::Space space) { ASSERT(cstr != NULL); intptr_t array_len = strlen(cstr); @@ -20678,7 +19507,6 @@ RawString* String::New(const char* cstr, Heap::Space space) { return String::FromUTF8(utf8_array, array_len, space); } - RawString* String::FromUTF8(const uint8_t* utf8_array, intptr_t array_len, Heap::Space space) { @@ -20701,14 +19529,12 @@ RawString* String::FromUTF8(const uint8_t* utf8_array, return strobj.raw(); } - RawString* String::FromLatin1(const uint8_t* latin1_array, intptr_t array_len, Heap::Space space) { return OneByteString::New(latin1_array, array_len, space); } - RawString* String::FromUTF16(const uint16_t* utf16_array, intptr_t array_len, Heap::Space space) { @@ -20725,7 +19551,6 @@ RawString* String::FromUTF16(const uint16_t* utf16_array, return TwoByteString::New(utf16_array, array_len, space); } - RawString* String::FromUTF32(const int32_t* utf32_array, intptr_t array_len, Heap::Space space) { @@ -20745,7 +19570,6 @@ RawString* String::FromUTF32(const int32_t* utf32_array, return TwoByteString::New(utf16_len, utf32_array, array_len, space); } - RawString* String::New(const String& str, Heap::Space space) { // Currently this just creates a copy of the string in the correct space. // Once we have external string support, this will also create a heap copy of @@ -20764,7 +19588,6 @@ RawString* String::New(const String& str, Heap::Space space) { return result.raw(); } - RawString* String::NewExternal(const uint8_t* characters, intptr_t len, void* peer, @@ -20773,7 +19596,6 @@ RawString* String::NewExternal(const uint8_t* characters, return ExternalOneByteString::New(characters, len, peer, callback, space); } - RawString* String::NewExternal(const uint16_t* characters, intptr_t len, void* peer, @@ -20782,7 +19604,6 @@ RawString* String::NewExternal(const uint16_t* characters, return ExternalTwoByteString::New(characters, len, peer, callback, space); } - void String::Copy(const String& dst, intptr_t dst_offset, const uint8_t* characters, @@ -20802,7 +19623,6 @@ void String::Copy(const String& dst, } } - void String::Copy(const String& dst, intptr_t dst_offset, const uint16_t* utf16_array, @@ -20826,7 +19646,6 @@ void String::Copy(const String& dst, } } - void String::Copy(const String& dst, intptr_t dst_offset, const String& src, @@ -20866,7 +19685,6 @@ void String::Copy(const String& dst, } } - RawString* String::EscapeSpecialCharacters(const String& str) { if (str.IsOneByteString()) { return OneByteString::EscapeSpecialCharacters(str); @@ -20885,12 +19703,10 @@ RawString* String::EscapeSpecialCharacters(const String& str) { String::Handle(TwoByteString::New(str, Heap::kNew))); } - static bool IsPercent(int32_t c) { return c == '%'; } - static bool IsHexCharacter(int32_t c) { if (c >= '0' && c <= '9') { return true; @@ -20901,7 +19717,6 @@ static bool IsHexCharacter(int32_t c) { return false; } - static bool IsURISafeCharacter(int32_t c) { if ((c >= '0') && (c <= '9')) { return true; @@ -20915,7 +19730,6 @@ static bool IsURISafeCharacter(int32_t c) { return (c == '-') || (c == '_') || (c == '.') || (c == '~'); } - static int32_t GetHexCharacter(int32_t c) { ASSERT(c >= 0); ASSERT(c < 16); @@ -20923,7 +19737,6 @@ static int32_t GetHexCharacter(int32_t c) { return hex[c]; } - static int32_t GetHexValue(int32_t c) { if (c >= '0' && c <= '9') { return c - '0'; @@ -20935,12 +19748,10 @@ static int32_t GetHexValue(int32_t c) { return 0; } - static int32_t MergeHexCharacters(int32_t c1, int32_t c2) { return GetHexValue(c1) << 4 | GetHexValue(c2); } - const char* String::EncodeIRI(const String& str) { const intptr_t len = Utf8::Length(str); Zone* zone = Thread::Current()->zone(); @@ -20971,7 +19782,6 @@ const char* String::EncodeIRI(const String& str) { return cstr; } - RawString* String::DecodeIRI(const String& str) { CodePointIterator cpi(str); intptr_t num_escapes = 0; @@ -21028,7 +19838,6 @@ RawString* String::DecodeIRI(const String& str) { return FromUTF8(utf8, utf8_len); } - RawString* String::NewFormatted(const char* format, ...) { va_list args; va_start(args, format); @@ -21038,7 +19847,6 @@ RawString* String::NewFormatted(const char* format, ...) { return result; } - RawString* String::NewFormatted(Heap::Space space, const char* format, ...) { va_list args; va_start(args, format); @@ -21048,7 +19856,6 @@ RawString* String::NewFormatted(Heap::Space space, const char* format, ...) { return result; } - RawString* String::NewFormattedV(const char* format, va_list args, Heap::Space space) { @@ -21064,7 +19871,6 @@ RawString* String::NewFormattedV(const char* format, return String::New(buffer, space); } - RawString* String::Concat(const String& str1, const String& str2, Heap::Space space) { @@ -21076,12 +19882,10 @@ RawString* String::Concat(const String& str1, return OneByteString::Concat(str1, str2, space); } - RawString* String::ConcatAll(const Array& strings, Heap::Space space) { return ConcatAllRange(strings, 0, strings.Length(), space); } - RawString* String::ConcatAllRange(const Array& strings, intptr_t start, intptr_t end, @@ -21110,7 +19914,6 @@ RawString* String::ConcatAllRange(const Array& strings, return TwoByteString::ConcatAll(strings, start, end, result_len, space); } - RawString* String::SubString(const String& str, intptr_t begin_index, Heap::Space space) { @@ -21122,7 +19925,6 @@ RawString* String::SubString(const String& str, space); } - RawString* String::SubString(Thread* thread, const String& str, intptr_t begin_index, @@ -21158,7 +19960,6 @@ RawString* String::SubString(Thread* thread, return result.raw(); } - const char* String::ToCString() const { if (IsOneByteString()) { // Quick conversion if OneByteString contains only ASCII characters. @@ -21191,13 +19992,11 @@ const char* String::ToCString() const { return reinterpret_cast(result); } - void String::ToUTF8(uint8_t* utf8_array, intptr_t array_len) const { ASSERT(array_len >= Utf8::Length(*this)); Utf8::Encode(*this, reinterpret_cast(utf8_array), array_len); } - static FinalizablePersistentHandle* AddFinalizer( const Object& referent, void* peer, @@ -21209,7 +20008,6 @@ static FinalizablePersistentHandle* AddFinalizer( callback, external_size); } - RawString* String::MakeExternal(void* array, intptr_t external_size, void* peer, @@ -21304,7 +20102,6 @@ RawString* String::MakeExternal(void* array, return this->raw(); } - RawString* String::Transform(int32_t (*mapping)(int32_t ch), const String& str, Heap::Space space) { @@ -21330,13 +20127,11 @@ RawString* String::Transform(int32_t (*mapping)(int32_t ch), return TwoByteString::Transform(mapping, str, space); } - RawString* String::ToUpperCase(const String& str, Heap::Space space) { // TODO(cshapiro): create a fast-path for OneByteString instances. return Transform(CaseMapping::ToUpper, str, space); } - RawString* String::ToLowerCase(const String& str, Heap::Space space) { // TODO(cshapiro): create a fast-path for OneByteString instances. return Transform(CaseMapping::ToLower, str, space); @@ -21373,7 +20168,6 @@ bool String::ParseDouble(const String& str, result); } - // Check to see if 'str1' matches 'str2' as is or // once the private key separator is stripped from str2. // @@ -21426,7 +20220,6 @@ static bool EqualsIgnoringPrivateKey(const String& str1, const String& str2) { return (str2_pos == str2_len); } - #define EQUALS_IGNORING_PRIVATE_KEY(class_id, type, str1, str2) \ switch (class_id) { \ case kOneByteStringCid: \ @@ -21442,7 +20235,6 @@ static bool EqualsIgnoringPrivateKey(const String& str1, const String& str2) { } \ UNREACHABLE(); - bool String::EqualsIgnoringPrivateKey(const String& str1, const String& str2) { if (str1.raw() == str2.raw()) { return true; // Both handles point to the same raw instance. @@ -21470,7 +20262,6 @@ bool String::EqualsIgnoringPrivateKey(const String& str1, const String& str2) { return false; } - bool String::CodePointIterator::Next() { ASSERT(index_ >= -1); intptr_t length = Utf16::Length(ch_); @@ -21489,7 +20280,6 @@ bool String::CodePointIterator::Next() { return false; } - RawOneByteString* OneByteString::EscapeSpecialCharacters(const String& str) { intptr_t len = str.Length(); if (len > 0) { @@ -21522,7 +20312,6 @@ RawOneByteString* OneByteString::EscapeSpecialCharacters(const String& str) { return OneByteString::raw(Symbols::Empty()); } - RawOneByteString* ExternalOneByteString::EscapeSpecialCharacters( const String& str) { intptr_t len = str.Length(); @@ -21556,7 +20345,6 @@ RawOneByteString* ExternalOneByteString::EscapeSpecialCharacters( return OneByteString::raw(Symbols::Empty()); } - RawOneByteString* OneByteString::New(intptr_t len, Heap::Space space) { ASSERT((Isolate::Current() == Dart::vm_isolate()) || ((Isolate::Current()->object_store() != NULL) && @@ -21579,7 +20367,6 @@ RawOneByteString* OneByteString::New(intptr_t len, Heap::Space space) { } } - RawOneByteString* OneByteString::New(const uint8_t* characters, intptr_t len, Heap::Space space) { @@ -21591,7 +20378,6 @@ RawOneByteString* OneByteString::New(const uint8_t* characters, return OneByteString::raw(result); } - RawOneByteString* OneByteString::New(const uint16_t* characters, intptr_t len, Heap::Space space) { @@ -21604,7 +20390,6 @@ RawOneByteString* OneByteString::New(const uint16_t* characters, return OneByteString::raw(result); } - RawOneByteString* OneByteString::New(const int32_t* characters, intptr_t len, Heap::Space space) { @@ -21617,7 +20402,6 @@ RawOneByteString* OneByteString::New(const int32_t* characters, return OneByteString::raw(result); } - RawOneByteString* OneByteString::New(const String& str, Heap::Space space) { intptr_t len = str.Length(); const String& result = String::Handle(OneByteString::New(len, space)); @@ -21625,7 +20409,6 @@ RawOneByteString* OneByteString::New(const String& str, Heap::Space space) { return OneByteString::raw(result); } - RawOneByteString* OneByteString::New(const String& other_one_byte_string, intptr_t other_start_index, intptr_t other_len, @@ -21641,7 +20424,6 @@ RawOneByteString* OneByteString::New(const String& other_one_byte_string, return OneByteString::raw(result); } - RawOneByteString* OneByteString::New(const TypedData& other_typed_data, intptr_t other_start_index, intptr_t other_len, @@ -21656,7 +20438,6 @@ RawOneByteString* OneByteString::New(const TypedData& other_typed_data, return OneByteString::raw(result); } - RawOneByteString* OneByteString::New(const ExternalTypedData& other_typed_data, intptr_t other_start_index, intptr_t other_len, @@ -21671,7 +20452,6 @@ RawOneByteString* OneByteString::New(const ExternalTypedData& other_typed_data, return OneByteString::raw(result); } - RawOneByteString* OneByteString::Concat(const String& str1, const String& str2, Heap::Space space) { @@ -21684,7 +20464,6 @@ RawOneByteString* OneByteString::Concat(const String& str1, return OneByteString::raw(result); } - RawOneByteString* OneByteString::ConcatAll(const Array& strings, intptr_t start, intptr_t end, @@ -21706,7 +20485,6 @@ RawOneByteString* OneByteString::ConcatAll(const Array& strings, return OneByteString::raw(result); } - RawOneByteString* OneByteString::Transform(int32_t (*mapping)(int32_t ch), const String& str, Heap::Space space) { @@ -21722,7 +20500,6 @@ RawOneByteString* OneByteString::Transform(int32_t (*mapping)(int32_t ch), return OneByteString::raw(result); } - RawOneByteString* OneByteString::SubStringUnchecked(const String& str, intptr_t begin_index, intptr_t length, @@ -21744,7 +20521,6 @@ RawOneByteString* OneByteString::SubStringUnchecked(const String& str, return result; } - void OneByteString::SetPeer(const String& str, intptr_t external_size, void* peer, @@ -21757,14 +20533,12 @@ void OneByteString::SetPeer(const String& str, Isolate::Current()->heap()->SetPeer(str.raw(), peer); } - void OneByteString::Finalize(void* isolate_callback_data, Dart_WeakPersistentHandle handle, void* peer) { delete reinterpret_cast*>(peer); } - RawTwoByteString* TwoByteString::EscapeSpecialCharacters(const String& str) { intptr_t len = str.Length(); if (len > 0) { @@ -21797,7 +20571,6 @@ RawTwoByteString* TwoByteString::EscapeSpecialCharacters(const String& str) { return TwoByteString::New(0, Heap::kNew); } - RawTwoByteString* TwoByteString::New(intptr_t len, Heap::Space space) { ASSERT(Isolate::Current()->object_store()->two_byte_string_class()); if (len < 0 || len > kMaxElements) { @@ -21816,7 +20589,6 @@ RawTwoByteString* TwoByteString::New(intptr_t len, Heap::Space space) { return TwoByteString::raw(result); } - RawTwoByteString* TwoByteString::New(const uint16_t* utf16_array, intptr_t array_len, Heap::Space space) { @@ -21829,7 +20601,6 @@ RawTwoByteString* TwoByteString::New(const uint16_t* utf16_array, return TwoByteString::raw(result); } - RawTwoByteString* TwoByteString::New(intptr_t utf16_len, const int32_t* utf32_array, intptr_t array_len, @@ -21854,7 +20625,6 @@ RawTwoByteString* TwoByteString::New(intptr_t utf16_len, return TwoByteString::raw(result); } - RawTwoByteString* TwoByteString::New(const String& str, Heap::Space space) { intptr_t len = str.Length(); const String& result = String::Handle(TwoByteString::New(len, space)); @@ -21862,7 +20632,6 @@ RawTwoByteString* TwoByteString::New(const String& str, Heap::Space space) { return TwoByteString::raw(result); } - RawTwoByteString* TwoByteString::New(const TypedData& other_typed_data, intptr_t other_start_index, intptr_t other_len, @@ -21877,7 +20646,6 @@ RawTwoByteString* TwoByteString::New(const TypedData& other_typed_data, return TwoByteString::raw(result); } - RawTwoByteString* TwoByteString::New(const ExternalTypedData& other_typed_data, intptr_t other_start_index, intptr_t other_len, @@ -21892,7 +20660,6 @@ RawTwoByteString* TwoByteString::New(const ExternalTypedData& other_typed_data, return TwoByteString::raw(result); } - RawTwoByteString* TwoByteString::Concat(const String& str1, const String& str2, Heap::Space space) { @@ -21905,7 +20672,6 @@ RawTwoByteString* TwoByteString::Concat(const String& str1, return TwoByteString::raw(result); } - RawTwoByteString* TwoByteString::ConcatAll(const Array& strings, intptr_t start, intptr_t end, @@ -21927,7 +20693,6 @@ RawTwoByteString* TwoByteString::ConcatAll(const Array& strings, return TwoByteString::raw(result); } - RawTwoByteString* TwoByteString::Transform(int32_t (*mapping)(int32_t ch), const String& str, Heap::Space space) { @@ -21953,7 +20718,6 @@ RawTwoByteString* TwoByteString::Transform(int32_t (*mapping)(int32_t ch), return TwoByteString::raw(result); } - void TwoByteString::SetPeer(const String& str, intptr_t external_size, void* peer, @@ -21966,14 +20730,12 @@ void TwoByteString::SetPeer(const String& str, Isolate::Current()->heap()->SetPeer(str.raw(), peer); } - void TwoByteString::Finalize(void* isolate_callback_data, Dart_WeakPersistentHandle handle, void* peer) { delete reinterpret_cast*>(peer); } - RawExternalOneByteString* ExternalOneByteString::New( const uint8_t* data, intptr_t len, @@ -22006,14 +20768,12 @@ RawExternalOneByteString* ExternalOneByteString::New( return ExternalOneByteString::raw(result); } - void ExternalOneByteString::Finalize(void* isolate_callback_data, Dart_WeakPersistentHandle handle, void* peer) { delete reinterpret_cast*>(peer); } - RawExternalTwoByteString* ExternalTwoByteString::New( const uint16_t* data, intptr_t len, @@ -22046,14 +20806,12 @@ RawExternalTwoByteString* ExternalTwoByteString::New( return ExternalTwoByteString::raw(result); } - void ExternalTwoByteString::Finalize(void* isolate_callback_data, Dart_WeakPersistentHandle handle, void* peer) { delete reinterpret_cast*>(peer); } - RawBool* Bool::New(bool value) { ASSERT(Isolate::Current()->object_store()->bool_class() != Class::null()); Bool& result = Bool::Handle(); @@ -22070,12 +20828,10 @@ RawBool* Bool::New(bool value) { return result.raw(); } - const char* Bool::ToCString() const { return value() ? "true" : "false"; } - bool Array::CanonicalizeEquals(const Instance& other) const { if (this->raw() == other.raw()) { // Both handles point to the same raw instance. @@ -22114,7 +20870,6 @@ bool Array::CanonicalizeEquals(const Instance& other) const { return true; } - uword Array::ComputeCanonicalTableHash() const { ASSERT(!IsNull()); NoSafepointScope no_safepoint; @@ -22129,13 +20884,11 @@ uword Array::ComputeCanonicalTableHash() const { return FinalizeHash(hash, kHashBits); } - RawArray* Array::New(intptr_t len, Heap::Space space) { ASSERT(Isolate::Current()->object_store()->array_class() != Class::null()); return New(kClassId, len, space); } - RawArray* Array::New(intptr_t class_id, intptr_t len, Heap::Space space) { if ((len < 0) || (len > Array::kMaxElements)) { // This should be caught before we reach here. @@ -22150,7 +20903,6 @@ RawArray* Array::New(intptr_t class_id, intptr_t len, Heap::Space space) { } } - RawArray* Array::Slice(intptr_t start, intptr_t count, bool with_type_argument) const { @@ -22167,7 +20919,6 @@ RawArray* Array::Slice(intptr_t start, return dest.raw(); } - void Array::MakeImmutable() const { if (IsImmutable()) return; ASSERT(!IsCanonical()); @@ -22182,7 +20933,6 @@ void Array::MakeImmutable() const { } while (tags != old_tags); } - const char* Array::ToCString() const { if (IsNull()) { return IsImmutable() ? "_ImmutableList NULL" : "_List NULL"; @@ -22193,7 +20943,6 @@ const char* Array::ToCString() const { return zone->PrintToString(format, Length()); } - RawArray* Array::Grow(const Array& source, intptr_t new_length, Heap::Space space) { @@ -22215,7 +20964,6 @@ RawArray* Array::Grow(const Array& source, return result.raw(); } - RawArray* Array::MakeFixedLength(const GrowableObjectArray& growable_array, bool unique) { ASSERT(!growable_array.IsNull()); @@ -22279,7 +21027,6 @@ RawArray* Array::MakeFixedLength(const GrowableObjectArray& growable_array, return array.raw(); } - bool Array::CheckAndCanonicalizeFields(Thread* thread, const char** error_str) const { intptr_t len = Length(); @@ -22308,14 +21055,12 @@ bool Array::CheckAndCanonicalizeFields(Thread* thread, return true; } - RawImmutableArray* ImmutableArray::New(intptr_t len, Heap::Space space) { ASSERT(Isolate::Current()->object_store()->immutable_array_class() != Class::null()); return reinterpret_cast(Array::New(kClassId, len, space)); } - void GrowableObjectArray::Add(const Object& value, Heap::Space space) const { ASSERT(!IsNull()); if (Length() == Capacity()) { @@ -22333,7 +21078,6 @@ void GrowableObjectArray::Add(const Object& value, Heap::Space space) const { SetAt(index, value); } - void GrowableObjectArray::Grow(intptr_t new_capacity, Heap::Space space) const { ASSERT(new_capacity > Capacity()); const Array& contents = Array::Handle(data()); @@ -22342,7 +21086,6 @@ void GrowableObjectArray::Grow(intptr_t new_capacity, Heap::Space space) const { StorePointer(&(raw_ptr()->data_), new_contents.raw()); } - RawObject* GrowableObjectArray::RemoveLast() const { ASSERT(!IsNull()); ASSERT(Length() > 0); @@ -22354,7 +21097,6 @@ RawObject* GrowableObjectArray::RemoveLast() const { return obj.raw(); } - RawGrowableObjectArray* GrowableObjectArray::New(intptr_t capacity, Heap::Space space) { RawArray* raw_data = (capacity == 0) ? Object::empty_array().raw() @@ -22363,7 +21105,6 @@ RawGrowableObjectArray* GrowableObjectArray::New(intptr_t capacity, return New(data, space); } - RawGrowableObjectArray* GrowableObjectArray::New(const Array& array, Heap::Space space) { ASSERT(Isolate::Current()->object_store()->growable_object_array_class() != @@ -22381,7 +21122,6 @@ RawGrowableObjectArray* GrowableObjectArray::New(const Array& array, return result.raw(); } - const char* GrowableObjectArray::ToCString() const { if (IsNull()) { return "_GrowableList: null"; @@ -22390,7 +21130,6 @@ const char* GrowableObjectArray::ToCString() const { "Instance(length:%" Pd ") of '_GrowableList'", Length()); } - // Equivalent to Dart's operator "==" and hashCode. class DefaultHashTraits { public: @@ -22426,7 +21165,6 @@ class DefaultHashTraits { } }; - RawLinkedHashMap* LinkedHashMap::NewDefault(Heap::Space space) { const Array& data = Array::Handle(Array::New(kInitialIndexSize, space)); const TypedData& index = TypedData::Handle( @@ -22438,7 +21176,6 @@ RawLinkedHashMap* LinkedHashMap::NewDefault(Heap::Space space) { return LinkedHashMap::New(data, index, kInitialHashMask, 0, 0, space); } - RawLinkedHashMap* LinkedHashMap::New(const Array& data, const TypedData& index, intptr_t hash_mask, @@ -22457,7 +21194,6 @@ RawLinkedHashMap* LinkedHashMap::New(const Array& data, return result.raw(); } - RawLinkedHashMap* LinkedHashMap::NewUninitialized(Heap::Space space) { ASSERT(Isolate::Current()->object_store()->linked_hash_map_class() != Class::null()); @@ -22471,13 +21207,11 @@ RawLinkedHashMap* LinkedHashMap::NewUninitialized(Heap::Space space) { return result.raw(); } - const char* LinkedHashMap::ToCString() const { Zone* zone = Thread::Current()->zone(); return zone->PrintToString("_LinkedHashMap len:%" Pd, Length()); } - RawFloat32x4* Float32x4::New(float v0, float v1, float v2, @@ -22499,7 +21233,6 @@ RawFloat32x4* Float32x4::New(float v0, return result.raw(); } - RawFloat32x4* Float32x4::New(simd128_value_t value, Heap::Space space) { ASSERT(Isolate::Current()->object_store()->float32x4_class() != Class::null()); @@ -22514,59 +21247,48 @@ RawFloat32x4* Float32x4::New(simd128_value_t value, Heap::Space space) { return result.raw(); } - simd128_value_t Float32x4::value() const { return ReadUnaligned( reinterpret_cast(&raw_ptr()->value_)); } - void Float32x4::set_value(simd128_value_t value) const { StoreUnaligned(reinterpret_cast(&raw()->ptr()->value_), value); } - void Float32x4::set_x(float value) const { StoreNonPointer(&raw_ptr()->value_[0], value); } - void Float32x4::set_y(float value) const { StoreNonPointer(&raw_ptr()->value_[1], value); } - void Float32x4::set_z(float value) const { StoreNonPointer(&raw_ptr()->value_[2], value); } - void Float32x4::set_w(float value) const { StoreNonPointer(&raw_ptr()->value_[3], value); } - float Float32x4::x() const { return raw_ptr()->value_[0]; } - float Float32x4::y() const { return raw_ptr()->value_[1]; } - float Float32x4::z() const { return raw_ptr()->value_[2]; } - float Float32x4::w() const { return raw_ptr()->value_[3]; } - const char* Float32x4::ToCString() const { float _x = x(); float _y = y(); @@ -22576,7 +21298,6 @@ const char* Float32x4::ToCString() const { _w); } - RawInt32x4* Int32x4::New(int32_t v0, int32_t v1, int32_t v2, @@ -22597,7 +21318,6 @@ RawInt32x4* Int32x4::New(int32_t v0, return result.raw(); } - RawInt32x4* Int32x4::New(simd128_value_t value, Heap::Space space) { ASSERT(Isolate::Current()->object_store()->int32x4_class() != Class::null()); Int32x4& result = Int32x4::Handle(); @@ -22611,59 +21331,48 @@ RawInt32x4* Int32x4::New(simd128_value_t value, Heap::Space space) { return result.raw(); } - void Int32x4::set_x(int32_t value) const { StoreNonPointer(&raw_ptr()->value_[0], value); } - void Int32x4::set_y(int32_t value) const { StoreNonPointer(&raw_ptr()->value_[1], value); } - void Int32x4::set_z(int32_t value) const { StoreNonPointer(&raw_ptr()->value_[2], value); } - void Int32x4::set_w(int32_t value) const { StoreNonPointer(&raw_ptr()->value_[3], value); } - int32_t Int32x4::x() const { return raw_ptr()->value_[0]; } - int32_t Int32x4::y() const { return raw_ptr()->value_[1]; } - int32_t Int32x4::z() const { return raw_ptr()->value_[2]; } - int32_t Int32x4::w() const { return raw_ptr()->value_[3]; } - simd128_value_t Int32x4::value() const { return ReadUnaligned( reinterpret_cast(&raw_ptr()->value_)); } - void Int32x4::set_value(simd128_value_t value) const { StoreUnaligned(reinterpret_cast(&raw()->ptr()->value_), value); } - const char* Int32x4::ToCString() const { int32_t _x = x(); int32_t _y = y(); @@ -22673,7 +21382,6 @@ const char* Int32x4::ToCString() const { _y, _z, _w); } - RawFloat64x2* Float64x2::New(double value0, double value1, Heap::Space space) { ASSERT(Isolate::Current()->object_store()->float64x2_class() != Class::null()); @@ -22689,7 +21397,6 @@ RawFloat64x2* Float64x2::New(double value0, double value1, Heap::Space space) { return result.raw(); } - RawFloat64x2* Float64x2::New(simd128_value_t value, Heap::Space space) { ASSERT(Isolate::Current()->object_store()->float64x2_class() != Class::null()); @@ -22704,44 +21411,36 @@ RawFloat64x2* Float64x2::New(simd128_value_t value, Heap::Space space) { return result.raw(); } - double Float64x2::x() const { return raw_ptr()->value_[0]; } - double Float64x2::y() const { return raw_ptr()->value_[1]; } - void Float64x2::set_x(double x) const { StoreNonPointer(&raw_ptr()->value_[0], x); } - void Float64x2::set_y(double y) const { StoreNonPointer(&raw_ptr()->value_[1], y); } - simd128_value_t Float64x2::value() const { return simd128_value_t().readFrom(&raw_ptr()->value_[0]); } - void Float64x2::set_value(simd128_value_t value) const { StoreSimd128(&raw_ptr()->value_[0], value); } - const char* Float64x2::ToCString() const { double _x = x(); double _y = y(); return OS::SCreate(Thread::Current()->zone(), "[%f, %f]", _x, _y); } - const intptr_t TypedData::element_size_table[TypedData::kNumElementSizes] = { 1, // kTypedDataInt8ArrayCid. 1, // kTypedDataUint8ArrayCid. @@ -22759,7 +21458,6 @@ const intptr_t TypedData::element_size_table[TypedData::kNumElementSizes] = { 16, // kTypedDataFloat64x2ArrayCid, }; - bool TypedData::CanonicalizeEquals(const Instance& other) const { if (this->raw() == other.raw()) { // Both handles point to the same raw instance. @@ -22785,7 +21483,6 @@ bool TypedData::CanonicalizeEquals(const Instance& other) const { (memcmp(DataAddr(0), other_typed_data.DataAddr(0), len) == 0); } - uword TypedData::ComputeCanonicalTableHash() const { const intptr_t len = this->LengthInBytes(); ASSERT(len != 0); @@ -22796,7 +21493,6 @@ uword TypedData::ComputeCanonicalTableHash() const { return FinalizeHash(hash, kHashBits); } - RawTypedData* TypedData::New(intptr_t class_id, intptr_t len, Heap::Space space) { @@ -22818,7 +21514,6 @@ RawTypedData* TypedData::New(intptr_t class_id, return result.raw(); } - RawTypedData* TypedData::EmptyUint32Array(Thread* thread) { ASSERT(thread != NULL); Isolate* isolate = thread->isolate(); @@ -22834,7 +21529,6 @@ RawTypedData* TypedData::EmptyUint32Array(Thread* thread) { return array.raw(); } - const char* TypedData::ToCString() const { switch (GetClassId()) { #define CASE_TYPED_DATA_CLASS(clazz) \ @@ -22846,7 +21540,6 @@ const char* TypedData::ToCString() const { return "TypedData"; } - FinalizablePersistentHandle* ExternalTypedData::AddFinalizer( void* peer, Dart_WeakPersistentHandleFinalizer callback, @@ -22854,7 +21547,6 @@ FinalizablePersistentHandle* ExternalTypedData::AddFinalizer( return dart::AddFinalizer(*this, peer, callback, external_size); } - RawExternalTypedData* ExternalTypedData::New(intptr_t class_id, uint8_t* data, intptr_t len, @@ -22871,12 +21563,10 @@ RawExternalTypedData* ExternalTypedData::New(intptr_t class_id, return result.raw(); } - const char* ExternalTypedData::ToCString() const { return "ExternalTypedData"; } - RawCapability* Capability::New(uint64_t id, Heap::Space space) { Capability& result = Capability::Handle(); { @@ -22889,12 +21579,10 @@ RawCapability* Capability::New(uint64_t id, Heap::Space space) { return result.raw(); } - const char* Capability::ToCString() const { return "Capability"; } - RawReceivePort* ReceivePort::New(Dart_Port id, bool is_control_port, Heap::Space space) { @@ -22920,17 +21608,14 @@ RawReceivePort* ReceivePort::New(Dart_Port id, return result.raw(); } - const char* ReceivePort::ToCString() const { return "ReceivePort"; } - RawSendPort* SendPort::New(Dart_Port id, Heap::Space space) { return New(id, Isolate::Current()->origin_id(), space); } - RawSendPort* SendPort::New(Dart_Port id, Dart_Port origin_id, Heap::Space space) { @@ -22947,12 +21632,10 @@ RawSendPort* SendPort::New(Dart_Port id, return result.raw(); } - const char* SendPort::ToCString() const { return "SendPort"; } - const char* Closure::ToCString() const { const Function& fun = Function::Handle(function()); const bool is_implicit_closure = fun.IsImplicitClosureFunction(); @@ -22963,7 +21646,6 @@ const char* Closure::ToCString() const { from, fun_desc); } - RawClosure* Closure::New(const TypeArguments& instantiator_type_arguments, const TypeArguments& function_type_arguments, const Function& function, @@ -22985,70 +21667,58 @@ RawClosure* Closure::New(const TypeArguments& instantiator_type_arguments, return result.raw(); } - RawClosure* Closure::New() { RawObject* raw = Object::Allocate(Closure::kClassId, Closure::InstanceSize(), Heap::kOld); return reinterpret_cast(raw); } - intptr_t StackTrace::Length() const { const Array& code_array = Array::Handle(raw_ptr()->code_array_); return code_array.Length(); } - RawCode* StackTrace::CodeAtFrame(intptr_t frame_index) const { const Array& code_array = Array::Handle(raw_ptr()->code_array_); return reinterpret_cast(code_array.At(frame_index)); } - void StackTrace::SetCodeAtFrame(intptr_t frame_index, const Code& code) const { const Array& code_array = Array::Handle(raw_ptr()->code_array_); code_array.SetAt(frame_index, code); } - RawSmi* StackTrace::PcOffsetAtFrame(intptr_t frame_index) const { const Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_); return reinterpret_cast(pc_offset_array.At(frame_index)); } - void StackTrace::SetPcOffsetAtFrame(intptr_t frame_index, const Smi& pc_offset) const { const Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_); pc_offset_array.SetAt(frame_index, pc_offset); } - void StackTrace::set_async_link(const StackTrace& async_link) const { StorePointer(&raw_ptr()->async_link_, async_link.raw()); } - void StackTrace::set_code_array(const Array& code_array) const { StorePointer(&raw_ptr()->code_array_, code_array.raw()); } - void StackTrace::set_pc_offset_array(const Array& pc_offset_array) const { StorePointer(&raw_ptr()->pc_offset_array_, pc_offset_array.raw()); } - void StackTrace::set_expand_inlined(bool value) const { StoreNonPointer(&raw_ptr()->expand_inlined_, value); } - bool StackTrace::expand_inlined() const { return raw_ptr()->expand_inlined_; } - RawStackTrace* StackTrace::New(const Array& code_array, const Array& pc_offset_array, Heap::Space space) { @@ -23065,7 +21735,6 @@ RawStackTrace* StackTrace::New(const Array& code_array, return result.raw(); } - RawStackTrace* StackTrace::New(const Array& code_array, const Array& pc_offset_array, const StackTrace& async_link, @@ -23084,7 +21753,6 @@ RawStackTrace* StackTrace::New(const Array& code_array, return result.raw(); } - static void PrintStackTraceFrame(Zone* zone, ZoneTextBuffer* buffer, const Function& function, @@ -23120,7 +21788,6 @@ static void PrintStackTraceFrame(Zone* zone, } } - const char* StackTrace::ToDartCString(const StackTrace& stack_trace_in) { Zone* zone = Thread::Current()->zone(); StackTrace& stack_trace = StackTrace::Handle(zone, stack_trace_in.raw()); @@ -23188,7 +21855,6 @@ const char* StackTrace::ToDartCString(const StackTrace& stack_trace_in) { return buffer.buffer(); } - const char* StackTrace::ToDwarfCString(const StackTrace& stack_trace_in) { #if defined(DART_PRECOMPILER) || defined(DART_PRECOMPILED_RUNTIME) Zone* zone = Thread::Current()->zone(); @@ -23262,7 +21928,6 @@ const char* StackTrace::ToDwarfCString(const StackTrace& stack_trace_in) { #endif // defined(DART_PRECOMPILER) || defined(DART_PRECOMPILED_RUNTIME) } - const char* StackTrace::ToCString() const { #if defined(DART_PRECOMPILER) || defined(DART_PRECOMPILED_RUNTIME) if (FLAG_dwarf_stack_traces) { @@ -23272,19 +21937,16 @@ const char* StackTrace::ToCString() const { return ToDartCString(*this); } - void RegExp::set_pattern(const String& pattern) const { StorePointer(&raw_ptr()->pattern_, pattern.raw()); } - void RegExp::set_function(intptr_t cid, bool sticky, const Function& value) const { StorePointer(FunctionAddr(cid, sticky), value.raw()); } - void RegExp::set_bytecode(bool is_one_byte, bool sticky, const TypedData& bytecode) const { @@ -23303,12 +21965,10 @@ void RegExp::set_bytecode(bool is_one_byte, } } - void RegExp::set_num_bracket_expressions(intptr_t value) const { StoreSmi(&raw_ptr()->num_bracket_expressions_, Smi::New(value)); } - RawRegExp* RegExp::New(Heap::Space space) { RegExp& result = RegExp::Handle(); { @@ -23323,13 +21983,11 @@ RawRegExp* RegExp::New(Heap::Space space) { return result.raw(); } - void* RegExp::GetDataStartAddress() const { intptr_t addr = reinterpret_cast(raw_ptr()); return reinterpret_cast(addr + sizeof(RawRegExp)); } - RawRegExp* RegExp::FromDataStartAddress(void* data) { RegExp& regexp = RegExp::Handle(); intptr_t addr = reinterpret_cast(data) - sizeof(RawRegExp); @@ -23337,7 +21995,6 @@ RawRegExp* RegExp::FromDataStartAddress(void* data) { return regexp.raw(); } - const char* RegExp::Flags() const { switch (flags()) { case kGlobal | kIgnoreCase | kMultiLine: @@ -23355,7 +22012,6 @@ const char* RegExp::Flags() const { return ""; } - bool RegExp::CanonicalizeEquals(const Instance& other) const { if (this->raw() == other.raw()) { return true; // "===". @@ -23379,14 +22035,12 @@ bool RegExp::CanonicalizeEquals(const Instance& other) const { return true; } - const char* RegExp::ToCString() const { const String& str = String::Handle(pattern()); return OS::SCreate(Thread::Current()->zone(), "RegExp: pattern=%s flags=%s", str.ToCString(), Flags()); } - RawWeakProperty* WeakProperty::New(Heap::Space space) { ASSERT(Isolate::Current()->object_store()->weak_property_class() != Class::null()); @@ -23397,48 +22051,40 @@ RawWeakProperty* WeakProperty::New(Heap::Space space) { return result; } - const char* WeakProperty::ToCString() const { return "_WeakProperty"; } - RawAbstractType* MirrorReference::GetAbstractTypeReferent() const { ASSERT(Object::Handle(referent()).IsAbstractType()); return AbstractType::Cast(Object::Handle(referent())).raw(); } - RawClass* MirrorReference::GetClassReferent() const { ASSERT(Object::Handle(referent()).IsClass()); return Class::Cast(Object::Handle(referent())).raw(); } - RawField* MirrorReference::GetFieldReferent() const { ASSERT(Object::Handle(referent()).IsField()); return Field::Cast(Object::Handle(referent())).raw(); } - RawFunction* MirrorReference::GetFunctionReferent() const { ASSERT(Object::Handle(referent()).IsFunction()); return Function::Cast(Object::Handle(referent())).raw(); } - RawLibrary* MirrorReference::GetLibraryReferent() const { ASSERT(Object::Handle(referent()).IsLibrary()); return Library::Cast(Object::Handle(referent())).raw(); } - RawTypeParameter* MirrorReference::GetTypeParameterReferent() const { ASSERT(Object::Handle(referent()).IsTypeParameter()); return TypeParameter::Cast(Object::Handle(referent())).raw(); } - RawMirrorReference* MirrorReference::New(const Object& referent, Heap::Space space) { MirrorReference& result = MirrorReference::Handle(); @@ -23452,19 +22098,16 @@ RawMirrorReference* MirrorReference::New(const Object& referent, return result.raw(); } - const char* MirrorReference::ToCString() const { return "_MirrorReference"; } - void UserTag::MakeActive() const { Isolate* isolate = Isolate::Current(); ASSERT(isolate != NULL); isolate->set_current_tag(*this); } - RawUserTag* UserTag::New(const String& label, Heap::Space space) { Thread* thread = Thread::Current(); Isolate* isolate = thread->isolate(); @@ -23494,7 +22137,6 @@ RawUserTag* UserTag::New(const String& label, Heap::Space space) { return result.raw(); } - RawUserTag* UserTag::DefaultTag() { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -23512,7 +22154,6 @@ RawUserTag* UserTag::DefaultTag() { return result.raw(); } - RawUserTag* UserTag::FindTagInIsolate(Thread* thread, const String& label) { Isolate* isolate = thread->isolate(); Zone* zone = thread->zone(); @@ -23533,7 +22174,6 @@ RawUserTag* UserTag::FindTagInIsolate(Thread* thread, const String& label) { return UserTag::null(); } - void UserTag::AddTagToIsolate(Thread* thread, const UserTag& tag) { Isolate* isolate = thread->isolate(); Zone* zone = thread->zone(); @@ -23559,7 +22199,6 @@ void UserTag::AddTagToIsolate(Thread* thread, const UserTag& tag) { tag_table.Add(tag); } - bool UserTag::TagTableIsFull(Thread* thread) { Isolate* isolate = thread->isolate(); ASSERT(isolate->tag_table() != GrowableObjectArray::null()); @@ -23569,7 +22208,6 @@ bool UserTag::TagTableIsFull(Thread* thread) { return tag_table.Length() == UserTags::kMaxUserTags; } - RawUserTag* UserTag::FindTagById(uword tag_id) { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -23587,7 +22225,6 @@ RawUserTag* UserTag::FindTagById(uword tag_id) { return UserTag::null(); } - const char* UserTag::ToCString() const { const String& tag_label = String::Handle(label()); return tag_label.ToCString(); diff --git a/runtime/vm/object.h b/runtime/vm/object.h index 79b5d1f763b..cf0910416c0 100644 --- a/runtime/vm/object.h +++ b/runtime/vm/object.h @@ -8,7 +8,6 @@ #include "include/dart_api.h" #include "platform/assert.h" #include "platform/utils.h" -#include "vm/json_stream.h" #include "vm/bitmap.h" #include "vm/dart.h" #include "vm/flags.h" @@ -17,6 +16,7 @@ #include "vm/handles.h" #include "vm/heap.h" #include "vm/isolate.h" +#include "vm/json_stream.h" #include "vm/method_recognizer.h" #include "vm/os.h" #include "vm/raw_object.h" @@ -32,7 +32,7 @@ namespace dart { namespace kernel { class Program; class TreeNode; -} +} // namespace kernel #define DEFINE_FORWARD_DECLARATION(clazz) class clazz; CLASS_LIST(DEFINE_FORWARD_DECLARATION) @@ -848,7 +848,6 @@ class Object { DISALLOW_COPY_AND_ASSIGN(Object); }; - class PassiveObject : public Object { public: void operator=(RawObject* value) { raw_ = value; } @@ -893,11 +892,9 @@ class PassiveObject : public Object { DISALLOW_COPY_AND_ASSIGN(PassiveObject); }; - typedef ZoneGrowableHandlePtrArray Trail; typedef ZoneGrowableHandlePtrArray* TrailPtr; - class Class : public Object { public: intptr_t instance_size() const { @@ -1536,7 +1533,6 @@ class Class : public Object { friend class ProgramVisitor; }; - // Unresolved class is used for storing unresolved names which will be resolved // to a class after all classes have been loaded and finalized. class UnresolvedClass : public Object { @@ -1568,15 +1564,13 @@ class UnresolvedClass : public Object { friend class Class; }; - // Classification of type genericity according to type parameter owners. enum Genericity { - kAny, // Consider type params of current class and functions. - kCurrentClass, // Consider type params of current class only. - kFunctions, // Consider type params of current and parent functions. + kAny, // Consider type params of current class and functions. + kCurrentClass, // Consider type params of current class only. + kFunctions, // Consider type params of current and parent functions. }; - // A TypeArguments is an array of AbstractType. class TypeArguments : public Object { public: @@ -1791,7 +1785,6 @@ class TypeArguments : public Object { friend class Object; }; - class PatchClass : public Object { public: RawClass* patched_class() const { return raw_ptr()->patched_class_; } @@ -1822,7 +1815,6 @@ class PatchClass : public Object { friend class Class; }; - class SingleTargetCache : public Object { public: RawCode* target() const { return raw_ptr()->target_; } @@ -1856,7 +1848,6 @@ class SingleTargetCache : public Object { friend class Class; }; - class UnlinkedCall : public Object { public: RawString* target_name() const { return raw_ptr()->target_name_; } @@ -1875,7 +1866,6 @@ class UnlinkedCall : public Object { friend class Class; }; - // Object holding information about an IC: test classes and their // corresponding targets. The owner of the ICData can be either the function // or the original ICData object. In case of background compilation we @@ -2197,7 +2187,6 @@ class ICData : public Object { friend class Deserializer; }; - class Function : public Object { public: RawString* name() const { return raw_ptr()->name_; } @@ -3062,7 +3051,6 @@ class Function : public Object { friend class ClassFinalizer; // To reset parent_function. }; - class ClosureData : public Object { public: static intptr_t InstanceSize() { @@ -3095,7 +3083,6 @@ class ClosureData : public Object { friend class HeapProfiler; }; - class SignatureData : public Object { public: static intptr_t InstanceSize() { @@ -3119,7 +3106,6 @@ class SignatureData : public Object { friend class HeapProfiler; }; - class RedirectionData : public Object { public: static intptr_t InstanceSize() { @@ -3147,7 +3133,6 @@ class RedirectionData : public Object { friend class HeapProfiler; }; - class Field : public Object { public: RawField* Original() const; @@ -3204,7 +3189,6 @@ class Field : public Object { #endif } - inline intptr_t Offset() const; // Called during class finalization. inline void SetOffset(intptr_t offset_in_bytes) const; @@ -3474,7 +3458,6 @@ class Field : public Object { friend class FieldSerializationCluster; }; - class LiteralToken : public Object { public: Token::Kind kind() const { return raw_ptr()->kind_; } @@ -3499,7 +3482,6 @@ class LiteralToken : public Object { friend class Class; }; - class TokenStream : public Object { public: RawGrowableObjectArray* TokenObjects() const; @@ -3588,7 +3570,6 @@ class TokenStream : public Object { friend class Class; }; - class Script : public Object { public: RawString* url() const { return raw_ptr()->url_; } @@ -3711,7 +3692,6 @@ class Script : public Object { friend class Precompiler; }; - class DictionaryIterator : public ValueObject { public: explicit DictionaryIterator(const Library& library); @@ -3733,7 +3713,6 @@ class DictionaryIterator : public ValueObject { DISALLOW_COPY_AND_ASSIGN(DictionaryIterator); }; - class ClassDictionaryIterator : public DictionaryIterator { public: enum IterationKind { @@ -3761,7 +3740,6 @@ class ClassDictionaryIterator : public DictionaryIterator { DISALLOW_COPY_AND_ASSIGN(ClassDictionaryIterator); }; - class LibraryPrefixIterator : public DictionaryIterator { public: explicit LibraryPrefixIterator(const Library& library); @@ -3772,7 +3750,6 @@ class LibraryPrefixIterator : public DictionaryIterator { DISALLOW_COPY_AND_ASSIGN(LibraryPrefixIterator); }; - class Library : public Object { public: RawString* name() const { return raw_ptr()->name_; } @@ -3979,7 +3956,6 @@ class Library : public Object { // helper methods and classes. Allow look up of private classes. static RawClass* LookupCoreClass(const String& class_name); - // Return Function::null() if function does not exist in libs. static RawFunction* GetFunction(const GrowableArray& libs, const char* class_name, @@ -4028,7 +4004,6 @@ class Library : public Object { void ClearExportedNamesCache() const; static void InvalidateExportedNamesCaches(); - void InitImportList() const; void RehashDictionary(const Array& old_dict, intptr_t new_dict_size) const; static RawLibrary* NewLibraryHelper(const String& url, bool import_core_lib); @@ -4056,7 +4031,6 @@ class Library : public Object { friend class Precompiler; }; - // A Namespace contains the names in a library dictionary, filtered by // the show/hide combinators. class Namespace : public Object { @@ -4090,7 +4064,6 @@ class Namespace : public Object { friend class Class; }; - // ObjectPool contains constants, immediates and addresses embedded in code // and deoptimization infos. Each entry has an type-info associated with it // which is stored in a typed data array (info_array). @@ -4195,7 +4168,6 @@ class ObjectPool : public Object { friend class RawObjectPool; }; - class Instructions : public Object { public: enum { @@ -4323,7 +4295,6 @@ class Instructions : public Object { friend class BlobImageWriter; }; - class LocalVarDescriptors : public Object { public: intptr_t Length() const; @@ -4363,7 +4334,6 @@ class LocalVarDescriptors : public Object { friend class Object; }; - class PcDescriptors : public Object { public: static const intptr_t kBytesPerElement = 1; @@ -4486,7 +4456,6 @@ class PcDescriptors : public Object { friend class Object; }; - class CodeSourceMap : public Object { public: static const intptr_t kBytesPerElement = 1; @@ -4527,7 +4496,6 @@ class CodeSourceMap : public Object { friend class Object; }; - class StackMap : public Object { public: static const intptr_t kNoMaximum = -1; @@ -4595,7 +4563,6 @@ class StackMap : public Object { friend class Class; }; - class ExceptionHandlers : public Object { public: static const intptr_t kInvalidPcOffset = 0; @@ -4650,7 +4617,6 @@ class ExceptionHandlers : public Object { friend class Object; }; - class Code : public Object { public: RawInstructions* active_instructions() const { @@ -4824,7 +4790,6 @@ class Code : public Object { DISALLOW_COPY_AND_ASSIGN(Comments); }; - const Comments& comments() const; void set_comments(const Comments& comments) const; @@ -5066,14 +5031,13 @@ class Code : public Object { friend class SnapshotWriter; friend class FunctionSerializationCluster; friend class CodeSerializationCluster; - friend class CodePatcher; // for set_instructions + friend class CodePatcher; // for set_instructions friend class ProgramVisitor; // for set_instructions // So that the RawFunction pointer visitor can determine whether code the // function points to is optimized. friend class RawFunction; }; - class Context : public Object { public: RawContext* parent() const { return raw_ptr()->parent_; } @@ -5130,7 +5094,6 @@ class Context : public Object { friend class Object; }; - // The ContextScope class makes it possible to delay the compilation of a local // function until it is invoked. A ContextScope instance collects the local // variables that are referenced by the local function to be compiled and that @@ -5210,7 +5173,6 @@ class ContextScope : public Object { friend class Object; }; - class MegamorphicCache : public Object { public: static const intptr_t kInitialCapacity = 16; @@ -5279,7 +5241,6 @@ class MegamorphicCache : public Object { FINAL_HEAP_OBJECT_IMPLEMENTATION(MegamorphicCache, Object); }; - class SubtypeTestCache : public Object { public: enum Entries { @@ -5325,7 +5286,6 @@ class SubtypeTestCache : public Object { friend class Class; }; - class Error : public Object { public: virtual const char* ToErrorCString() const; @@ -5334,7 +5294,6 @@ class Error : public Object { HEAP_OBJECT_IMPLEMENTATION(Error, Object); }; - class ApiError : public Error { public: RawString* message() const { return raw_ptr()->message_; } @@ -5357,7 +5316,6 @@ class ApiError : public Error { friend class Class; }; - class LanguageError : public Error { public: Report::Kind kind() const { @@ -5424,7 +5382,6 @@ class LanguageError : public Error { friend class Class; }; - class UnhandledException : public Error { public: RawInstance* exception() const { return raw_ptr()->exception_; } @@ -5458,7 +5415,6 @@ class UnhandledException : public Error { friend class ObjectStore; }; - class UnwindError : public Error { public: bool is_user_initiated() const { return raw_ptr()->is_user_initiated_; } @@ -5482,7 +5438,6 @@ class UnwindError : public Error { friend class Class; }; - // Instance is the base class for all instance objects (aka the Object class // in Dart source code. class Instance : public Object { @@ -5638,7 +5593,6 @@ class Instance : public Object { friend class InstanceMorpher; }; - class LibraryPrefix : public Instance { public: RawString* name() const { return raw_ptr()->name_; } @@ -5695,7 +5649,6 @@ class LibraryPrefix : public Instance { friend class Class; }; - // AbstractType is an abstract superclass. // Subclasses of AbstractType are Type and TypeParameter. class AbstractType : public Instance { @@ -5904,7 +5857,6 @@ class AbstractType : public Instance { friend class TypeArguments; }; - // A Type consists of a class, possibly parameterized with type // arguments. Example: C. // An unresolved class is a String specifying the class name. @@ -6056,7 +6008,6 @@ class Type : public AbstractType { friend class ClearTypeHashVisitor; }; - // A TypeRef is used to break cycles in the representation of recursive types. // Its only field is the recursive AbstractType it refers to, which can // temporarily be null during finalization. @@ -6131,7 +6082,6 @@ class TypeRef : public AbstractType { friend class Class; }; - // A TypeParameter represents a type parameter of a parameterized class. // It specifies its index (and its name for debugging purposes), as well as its // upper bound. @@ -6236,7 +6186,6 @@ class TypeParameter : public AbstractType { friend class ClearTypeHashVisitor; }; - // A BoundedType represents a type instantiated at compile time from a type // parameter specifying a bound that either cannot be checked at compile time // because the type or the bound are still uninstantiated or can be checked and @@ -6332,7 +6281,6 @@ class BoundedType : public AbstractType { friend class ClearTypeHashVisitor; }; - // A MixinAppType represents a parsed mixin application clause, e.g. // "S with M, N". // MixinAppType objects do not survive finalization, so they do not @@ -6384,7 +6332,6 @@ class MixinAppType : public AbstractType { friend class Class; }; - class Number : public Instance { public: // TODO(iposva): Add more useful Number methods. @@ -6405,7 +6352,6 @@ class Number : public Instance { friend class Class; }; - class Integer : public Number { public: static RawInteger* New(const String& str, Heap::Space space = Heap::kNew); @@ -6460,7 +6406,6 @@ class Integer : public Number { friend class Class; }; - class Smi : public Integer { public: static const intptr_t kBits = kSmiBits; @@ -6545,7 +6490,6 @@ class Smi : public Integer { friend class Thread; }; - class Mint : public Integer { public: static const intptr_t kBits = 63; // 64-th bit is sign. @@ -6590,7 +6534,6 @@ class Mint : public Integer { friend class Number; }; - class Bigint : public Integer { public: virtual bool IsZero() const { return Used() == 0; } @@ -6688,7 +6631,6 @@ class Bigint : public Integer { friend class Class; }; - // Class Double represents class Double in corelib_impl, which implements // abstract class double in corelib. class Double : public Number { @@ -6729,7 +6671,6 @@ class Double : public Number { friend class Number; }; - // String may not be '\0' terminated. class String : public Instance { public: @@ -6741,9 +6682,9 @@ class String : public Instance { static const intptr_t kOneByteChar = 1; static const intptr_t kTwoByteChar = 2; - // All strings share the same maximum element count to keep things - // simple. We choose a value that will prevent integer overflow for - // 2 byte strings, since it is the worst case. +// All strings share the same maximum element count to keep things +// simple. We choose a value that will prevent integer overflow for +// 2 byte strings, since it is the worst case. #if defined(HASH_IN_OBJECT_HEADER) static const intptr_t kSizeofRawString = sizeof(RawInstance) + kWordSize; #else @@ -7077,7 +7018,6 @@ class String : public Instance { friend class RODataSerializationCluster; // SetHash }; - class OneByteString : public AllStatic { public: static uint16_t CharAt(const String& str, intptr_t index) { @@ -7214,7 +7154,6 @@ class OneByteString : public AllStatic { friend class StringHasher; }; - class TwoByteString : public AllStatic { public: static uint16_t CharAt(const String& str, intptr_t index) { @@ -7301,7 +7240,6 @@ class TwoByteString : public AllStatic { return reinterpret_cast(Object::null()); } - static const ClassId kClassId = kTwoByteStringCid; private: @@ -7331,7 +7269,6 @@ class TwoByteString : public AllStatic { friend class Symbols; }; - class ExternalOneByteString : public AllStatic { public: static uint16_t CharAt(const String& str, intptr_t index) { @@ -7415,7 +7352,6 @@ class ExternalOneByteString : public AllStatic { friend class Symbols; }; - class ExternalTwoByteString : public AllStatic { public: static uint16_t CharAt(const String& str, intptr_t index) { @@ -7495,7 +7431,6 @@ class ExternalTwoByteString : public AllStatic { friend class Symbols; }; - // Class Bool implements Dart core class bool. class Bool : public Instance { public: @@ -7526,7 +7461,6 @@ class Bool : public Instance { friend class Object; // To initialize the true and false values. }; - class Array : public Instance { public: // We use 30 bits for the hash code so hashes in a snapshot taken on a @@ -7650,7 +7584,6 @@ class Array : public Instance { friend class String; }; - class ImmutableArray : public AllStatic { public: static RawImmutableArray* New(intptr_t len, Heap::Space space = Heap::kNew); @@ -7682,7 +7615,6 @@ class ImmutableArray : public AllStatic { friend class Class; }; - class GrowableObjectArray : public Instance { public: intptr_t Capacity() const { @@ -7790,7 +7722,6 @@ class GrowableObjectArray : public Instance { friend class Class; }; - class Float32x4 : public Instance { public: static RawFloat32x4* New(float value0, @@ -7825,7 +7756,6 @@ class Float32x4 : public Instance { friend class Class; }; - class Int32x4 : public Instance { public: static RawInt32x4* New(int32_t value0, @@ -7859,7 +7789,6 @@ class Int32x4 : public Instance { friend class Class; }; - class Float64x2 : public Instance { public: static RawFloat64x2* New(double value0, @@ -7888,7 +7817,6 @@ class Float64x2 : public Instance { friend class Class; }; - class TypedData : public Instance { public: // We use 30 bits for the hash code so hashes in a snapshot taken on a @@ -8007,7 +7935,6 @@ class TypedData : public Instance { } } - template static void ClampedCopy(const DstType& dst, intptr_t dst_offset_in_bytes, @@ -8066,7 +7993,6 @@ class TypedData : public Instance { friend class TypedDataView; }; - class ExternalTypedData : public Instance { public: intptr_t Length() const { @@ -8178,7 +8104,6 @@ class ExternalTypedData : public Instance { friend class Class; }; - class TypedDataView : public AllStatic { public: static intptr_t ElementSizeInBytes(const Instance& view_obj) { @@ -8238,7 +8163,6 @@ class TypedDataView : public AllStatic { }; }; - class ByteBuffer : public AllStatic { public: static RawInstance* Data(const Instance& view_obj) { @@ -8257,7 +8181,6 @@ class ByteBuffer : public AllStatic { }; }; - // Corresponds to // - "new Map()", // - non-const map literals, and @@ -8391,7 +8314,6 @@ class LinkedHashMap : public Instance { friend class LinkedHashMapDeserializationCluster; }; - class Closure : public Instance { public: RawTypeArguments* instantiator_type_arguments() const { @@ -8438,7 +8360,6 @@ class Closure : public Instance { friend class Class; }; - class Capability : public Instance { public: uint64_t Id() const { return raw_ptr()->id_; } @@ -8453,7 +8374,6 @@ class Capability : public Instance { friend class Class; }; - class ReceivePort : public Instance { public: RawSendPort* send_port() const { return raw_ptr()->send_port_; } @@ -8474,7 +8394,6 @@ class ReceivePort : public Instance { friend class Class; }; - class SendPort : public Instance { public: Dart_Port Id() const { return raw_ptr()->id_; } @@ -8498,7 +8417,6 @@ class SendPort : public Instance { friend class Class; }; - // Internal stacktrace object used in exceptions for printing stack traces. class StackTrace : public Instance { public: @@ -8543,7 +8461,6 @@ class StackTrace : public Instance { friend class Debugger; }; - // Internal JavaScript regular expression object. class RegExp : public Instance { public: @@ -8684,7 +8601,6 @@ class RegExp : public Instance { friend class Class; }; - class WeakProperty : public Instance { public: RawObject* key() const { return raw_ptr()->key_; } @@ -8716,7 +8632,6 @@ class WeakProperty : public Instance { friend class Class; }; - class MirrorReference : public Instance { public: RawObject* referent() const { return raw_ptr()->referent_; } @@ -8749,7 +8664,6 @@ class MirrorReference : public Instance { friend class Class; }; - class UserTag : public Instance { public: uword tag() const { return raw_ptr()->tag(); } @@ -8786,7 +8700,6 @@ class UserTag : public Instance { friend class Class; }; - class ObjectPoolInfo : public ValueObject { public: explicit ObjectPoolInfo(const ObjectPool& pool) @@ -8806,7 +8719,6 @@ class ObjectPoolInfo : public ValueObject { const TypedData& array_; }; - // Breaking cycles and loops. RawClass* Object::clazz() const { uword raw_value = reinterpret_cast(raw_); @@ -8816,7 +8728,6 @@ RawClass* Object::clazz() const { return Isolate::Current()->class_table()->At(raw()->GetClassId()); } - DART_FORCE_INLINE void Object::SetRaw(RawObject* value) { NoSafepointScope no_safepoint_scope; raw_ = value; @@ -8843,14 +8754,12 @@ DART_FORCE_INLINE void Object::SetRaw(RawObject* value) { #endif } - intptr_t Field::Offset() const { ASSERT(is_instance()); // Valid only for dart instance fields. intptr_t value = Smi::Value(raw_ptr()->value_.offset_); return (value * kWordSize); } - void Field::SetOffset(intptr_t offset_in_bytes) const { ASSERT(is_instance()); // Valid only for dart instance fields. ASSERT(kWordSize != 0); @@ -8858,13 +8767,11 @@ void Field::SetOffset(intptr_t offset_in_bytes) const { Smi::New(offset_in_bytes / kWordSize)); } - RawInstance* Field::StaticValue() const { ASSERT(is_static()); // Valid only for static dart fields. return raw_ptr()->value_.static_value_; } - void Field::SetStaticValue(const Instance& value, bool save_initial_value) const { ASSERT(Thread::Current()->IsMutatorThread()); @@ -8876,12 +8783,10 @@ void Field::SetStaticValue(const Instance& value, } } - void Context::SetAt(intptr_t index, const Object& value) const { StorePointer(ObjectAddr(index), value.raw()); } - intptr_t Instance::GetNativeField(int index) const { ASSERT(IsValidNativeIndex(index)); NoSafepointScope no_safepoint; @@ -8893,7 +8798,6 @@ intptr_t Instance::GetNativeField(int index) const { return reinterpret_cast(native_fields->ptr()->data())[index]; } - void Instance::GetNativeFields(uint16_t num_fields, intptr_t* field_values) const { NoSafepointScope no_safepoint; @@ -8912,7 +8816,6 @@ void Instance::GetNativeFields(uint16_t num_fields, } } - bool String::Equals(const String& str) const { if (raw() == str.raw()) { return true; // Both handles point to the same raw instance. @@ -8929,14 +8832,12 @@ bool String::Equals(const String& str) const { return Equals(str, 0, str.Length()); } - intptr_t Library::UrlHash() const { intptr_t result = String::GetCachedHash(url()); ASSERT(result != 0); return result; } - void MegamorphicCache::SetEntry(const Array& array, intptr_t index, const Smi& class_id, @@ -8945,18 +8846,15 @@ void MegamorphicCache::SetEntry(const Array& array, array.SetAt((index * kEntryLength) + kTargetFunctionIndex, target); } - RawObject* MegamorphicCache::GetClassId(const Array& array, intptr_t index) { return array.At((index * kEntryLength) + kClassIdIndex); } - RawObject* MegamorphicCache::GetTargetFunction(const Array& array, intptr_t index) { return array.At((index * kEntryLength) + kTargetFunctionIndex); } - inline intptr_t Type::Hash() const { intptr_t result = Smi::Value(raw_ptr()->hash_); if (result != 0) { @@ -8965,14 +8863,12 @@ inline intptr_t Type::Hash() const { return ComputeHash(); } - inline void Type::SetHash(intptr_t value) const { // This is only safe because we create a new Smi, which does not cause // heap allocation. StoreSmi(&raw_ptr()->hash_, Smi::New(value)); } - inline intptr_t TypeParameter::Hash() const { ASSERT(IsFinalized()); intptr_t result = Smi::Value(raw_ptr()->hash_); @@ -8982,14 +8878,12 @@ inline intptr_t TypeParameter::Hash() const { return ComputeHash(); } - inline void TypeParameter::SetHash(intptr_t value) const { // This is only safe because we create a new Smi, which does not cause // heap allocation. StoreSmi(&raw_ptr()->hash_, Smi::New(value)); } - inline intptr_t BoundedType::Hash() const { intptr_t result = Smi::Value(raw_ptr()->hash_); if (result != 0) { @@ -8998,14 +8892,12 @@ inline intptr_t BoundedType::Hash() const { return ComputeHash(); } - inline void BoundedType::SetHash(intptr_t value) const { // This is only safe because we create a new Smi, which does not cause // heap allocation. StoreSmi(&raw_ptr()->hash_, Smi::New(value)); } - inline intptr_t TypeArguments::Hash() const { if (IsNull()) return 0; intptr_t result = Smi::Value(raw_ptr()->hash_); @@ -9015,7 +8907,6 @@ inline intptr_t TypeArguments::Hash() const { return ComputeHash(); } - inline void TypeArguments::SetHash(intptr_t value) const { // This is only safe because we create a new Smi, which does not cause // heap allocation. diff --git a/runtime/vm/object_arm64_test.cc b/runtime/vm/object_arm64_test.cc index a88360951b8..5f8635ab725 100644 --- a/runtime/vm/object_arm64_test.cc +++ b/runtime/vm/object_arm64_test.cc @@ -30,7 +30,6 @@ void GenerateIncrement(Assembler* assembler) { __ ret(); } - // Generate a dart code sequence that embeds a string object in it. // This is used to test Embedded String objects in the instructions. void GenerateEmbedStringInCode(Assembler* assembler, const char* str) { @@ -42,7 +41,6 @@ void GenerateEmbedStringInCode(Assembler* assembler, const char* str) { __ ret(); } - // Generate a dart code sequence that embeds a smi object in it. // This is used to test Embedded Smi objects in the instructions. void GenerateEmbedSmiInCode(Assembler* assembler, intptr_t value) { diff --git a/runtime/vm/object_arm_test.cc b/runtime/vm/object_arm_test.cc index c01e166f411..a0f1f9ac966 100644 --- a/runtime/vm/object_arm_test.cc +++ b/runtime/vm/object_arm_test.cc @@ -14,7 +14,6 @@ namespace dart { #define __ assembler-> - // Generate a simple dart code sequence. // This is used to test Code and Instruction object creation. void GenerateIncrement(Assembler* assembler) { @@ -30,7 +29,6 @@ void GenerateIncrement(Assembler* assembler) { __ Ret(); } - // Generate a dart code sequence that embeds a string object in it. // This is used to test Embedded String objects in the instructions. void GenerateEmbedStringInCode(Assembler* assembler, const char* str) { @@ -42,7 +40,6 @@ void GenerateEmbedStringInCode(Assembler* assembler, const char* str) { __ Ret(); } - // Generate a dart code sequence that embeds a smi object in it. // This is used to test Embedded Smi objects in the instructions. void GenerateEmbedSmiInCode(Assembler* assembler, intptr_t value) { diff --git a/runtime/vm/object_dbc_test.cc b/runtime/vm/object_dbc_test.cc index ecb1fa08647..688324c4f51 100644 --- a/runtime/vm/object_dbc_test.cc +++ b/runtime/vm/object_dbc_test.cc @@ -25,7 +25,6 @@ void GenerateIncrement(Assembler* assembler) { __ Return(0); } - // Generate a dart code sequence that embeds a string object in it. // This is used to test Embedded String objects in the instructions. void GenerateEmbedStringInCode(Assembler* assembler, const char* str) { @@ -35,7 +34,6 @@ void GenerateEmbedStringInCode(Assembler* assembler, const char* str) { __ ReturnTOS(); } - // Generate a dart code sequence that embeds a smi object in it. // This is used to test Embedded Smi objects in the instructions. void GenerateEmbedSmiInCode(Assembler* assembler, intptr_t value) { diff --git a/runtime/vm/object_graph.cc b/runtime/vm/object_graph.cc index ae3678abf7b..1c3373f4200 100644 --- a/runtime/vm/object_graph.cc +++ b/runtime/vm/object_graph.cc @@ -94,15 +94,12 @@ class ObjectGraph::Stack : public ObjectPointerVisitor { DISALLOW_COPY_AND_ASSIGN(Stack); }; - RawObject** const ObjectGraph::Stack::kSentinel = NULL; - RawObject* ObjectGraph::StackIterator::Get() const { return stack_->data_[index_].obj; } - bool ObjectGraph::StackIterator::MoveToParent() { intptr_t parent = stack_->Parent(index_); if (parent == Stack::kNoParent) { @@ -113,7 +110,6 @@ bool ObjectGraph::StackIterator::MoveToParent() { } } - intptr_t ObjectGraph::StackIterator::OffsetFromParentInWords() const { intptr_t parent_index = stack_->Parent(index_); if (parent_index == Stack::kNoParent) { @@ -136,7 +132,6 @@ intptr_t ObjectGraph::StackIterator::OffsetFromParentInWords() const { } } - class Unmarker : public ObjectVisitor { public: Unmarker() {} @@ -156,17 +151,14 @@ class Unmarker : public ObjectVisitor { DISALLOW_COPY_AND_ASSIGN(Unmarker); }; - ObjectGraph::ObjectGraph(Thread* thread) : StackResource(thread) { // The VM isolate has all its objects pre-marked, so iterating over it // would be a no-op. ASSERT(thread->isolate() != Dart::vm_isolate()); } - ObjectGraph::~ObjectGraph() {} - void ObjectGraph::IterateObjects(ObjectGraph::Visitor* visitor) { NoSafepointScope no_safepoint_scope_; Stack stack(isolate()); @@ -175,7 +167,6 @@ void ObjectGraph::IterateObjects(ObjectGraph::Visitor* visitor) { Unmarker::UnmarkAll(isolate()); } - void ObjectGraph::IterateObjectsFrom(const Object& root, ObjectGraph::Visitor* visitor) { NoSafepointScope no_safepoint_scope_; @@ -186,7 +177,6 @@ void ObjectGraph::IterateObjectsFrom(const Object& root, Unmarker::UnmarkAll(isolate()); } - class InstanceAccumulator : public ObjectVisitor { public: InstanceAccumulator(ObjectGraph::Stack* stack, intptr_t class_id) @@ -206,7 +196,6 @@ class InstanceAccumulator : public ObjectVisitor { DISALLOW_COPY_AND_ASSIGN(InstanceAccumulator); }; - void ObjectGraph::IterateObjectsFrom(intptr_t class_id, ObjectGraph::Visitor* visitor) { NoSafepointScope no_safepoint_scope_; @@ -219,7 +208,6 @@ void ObjectGraph::IterateObjectsFrom(intptr_t class_id, Unmarker::UnmarkAll(isolate()); } - class SizeVisitor : public ObjectGraph::Visitor { public: SizeVisitor() : size_(0) {} @@ -238,7 +226,6 @@ class SizeVisitor : public ObjectGraph::Visitor { intptr_t size_; }; - class SizeExcludingObjectVisitor : public SizeVisitor { public: explicit SizeExcludingObjectVisitor(const Object& skip) : skip_(skip) {} @@ -248,7 +235,6 @@ class SizeExcludingObjectVisitor : public SizeVisitor { const Object& skip_; }; - class SizeExcludingClassVisitor : public SizeVisitor { public: explicit SizeExcludingClassVisitor(intptr_t skip) : skip_(skip) {} @@ -260,7 +246,6 @@ class SizeExcludingClassVisitor : public SizeVisitor { const intptr_t skip_; }; - intptr_t ObjectGraph::SizeRetainedByInstance(const Object& obj) { HeapIterationScope iteration_scope(true); SizeVisitor total; @@ -272,7 +257,6 @@ intptr_t ObjectGraph::SizeRetainedByInstance(const Object& obj) { return size_total - size_excluding_obj; } - intptr_t ObjectGraph::SizeReachableByInstance(const Object& obj) { HeapIterationScope iteration_scope(true); SizeVisitor total; @@ -280,7 +264,6 @@ intptr_t ObjectGraph::SizeReachableByInstance(const Object& obj) { return total.size(); } - intptr_t ObjectGraph::SizeRetainedByClass(intptr_t class_id) { HeapIterationScope iteration_scope(true); SizeVisitor total; @@ -292,7 +275,6 @@ intptr_t ObjectGraph::SizeRetainedByClass(intptr_t class_id) { return size_total - size_excluding_class; } - intptr_t ObjectGraph::SizeReachableByClass(intptr_t class_id) { HeapIterationScope iteration_scope(true); SizeVisitor total; @@ -300,7 +282,6 @@ intptr_t ObjectGraph::SizeReachableByClass(intptr_t class_id) { return total.size(); } - class RetainingPathVisitor : public ObjectGraph::Visitor { public: // We cannot use a GrowableObjectArray, since we must not trigger GC. @@ -388,7 +369,6 @@ class RetainingPathVisitor : public ObjectGraph::Visitor { bool was_last_array_; }; - intptr_t ObjectGraph::RetainingPath(Object* obj, const Array& path) { NoSafepointScope no_safepoint_scope_; HeapIterationScope iteration_scope(true); @@ -402,7 +382,6 @@ intptr_t ObjectGraph::RetainingPath(Object* obj, const Array& path) { return visitor.length(); } - class InboundReferencesVisitor : public ObjectVisitor, public ObjectPointerVisitor { public: @@ -466,7 +445,6 @@ class InboundReferencesVisitor : public ObjectVisitor, intptr_t length_; }; - intptr_t ObjectGraph::InboundReferences(Object* obj, const Array& references) { Object& scratch = Object::Handle(); NoSafepointScope no_safepoint_scope; @@ -475,7 +453,6 @@ intptr_t ObjectGraph::InboundReferences(Object* obj, const Array& references) { return visitor.length(); } - static void WritePtr(RawObject* raw, WriteStream* stream) { ASSERT(raw->IsHeapObject()); ASSERT(raw->IsOldObject()); @@ -487,7 +464,6 @@ static void WritePtr(RawObject* raw, WriteStream* stream) { stream->WriteUnsigned(addr / kObjectAlignment); } - class WritePointerVisitor : public ObjectPointerVisitor { public: WritePointerVisitor(Isolate* isolate, @@ -522,7 +498,6 @@ class WritePointerVisitor : public ObjectPointerVisitor { intptr_t count_; }; - static void WriteHeader(RawObject* raw, intptr_t size, intptr_t cid, @@ -533,7 +508,6 @@ static void WriteHeader(RawObject* raw, stream->WriteUnsigned(cid); } - class WriteGraphVisitor : public ObjectGraph::Visitor { public: WriteGraphVisitor(Isolate* isolate, @@ -570,7 +544,6 @@ class WriteGraphVisitor : public ObjectGraph::Visitor { intptr_t count_; }; - static void IterateUserFields(ObjectPointerVisitor* visitor) { Thread* thread = Thread::Current(); // Scope to prevent handles create here from appearing as stack references. @@ -605,7 +578,6 @@ static void IterateUserFields(ObjectPointerVisitor* visitor) { } } - intptr_t ObjectGraph::Serialize(WriteStream* stream, SnapshotRoots roots, bool collect_garbage) { diff --git a/runtime/vm/object_graph_test.cc b/runtime/vm/object_graph_test.cc index 0056bee1d41..fb232908995 100644 --- a/runtime/vm/object_graph_test.cc +++ b/runtime/vm/object_graph_test.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "platform/assert.h" #include "vm/object_graph.h" +#include "platform/assert.h" #include "vm/unit_test.h" namespace dart { @@ -37,7 +37,6 @@ class CounterVisitor : public ObjectGraph::Visitor { RawObject* expected_parent_; }; - ISOLATE_UNIT_TEST_CASE(ObjectGraph) { Isolate* isolate = thread->isolate(); // Create a simple object graph with objects a, b, c, d: diff --git a/runtime/vm/object_ia32_test.cc b/runtime/vm/object_ia32_test.cc index 2c28cc1b57a..907efd8570f 100644 --- a/runtime/vm/object_ia32_test.cc +++ b/runtime/vm/object_ia32_test.cc @@ -14,7 +14,6 @@ namespace dart { #define __ assembler-> - // Generate a simple dart code sequence. // This is used to test Code and Instruction object creation. void GenerateIncrement(Assembler* assembler) { @@ -28,7 +27,6 @@ void GenerateIncrement(Assembler* assembler) { __ ret(); } - // Generate a dart code sequence that embeds a string object in it. // This is used to test Embedded String objects in the instructions. void GenerateEmbedStringInCode(Assembler* assembler, const char* str) { @@ -38,7 +36,6 @@ void GenerateEmbedStringInCode(Assembler* assembler, const char* str) { __ ret(); } - // Generate a dart code sequence that embeds a smi object in it. // This is used to test Embedded Smi objects in the instructions. void GenerateEmbedSmiInCode(Assembler* assembler, intptr_t value) { diff --git a/runtime/vm/object_id_ring.cc b/runtime/vm/object_id_ring.cc index d01d8bd2960..aba613abc58 100644 --- a/runtime/vm/object_id_ring.cc +++ b/runtime/vm/object_id_ring.cc @@ -2,10 +2,11 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +#include "vm/object_id_ring.h" + #include "platform/assert.h" #include "vm/dart_api_state.h" #include "vm/json_stream.h" -#include "vm/object_id_ring.h" namespace dart { @@ -16,7 +17,6 @@ void ObjectIdRing::Init(Isolate* isolate, int32_t capacity) { isolate->set_object_id_ring(ring); } - ObjectIdRing::~ObjectIdRing() { ASSERT(table_ != NULL); free(table_); @@ -27,7 +27,6 @@ ObjectIdRing::~ObjectIdRing() { } } - int32_t ObjectIdRing::GetIdForObject(RawObject* object, IdPolicy policy) { // We do not allow inserting null because null is how we detect as entry was // reclaimed by the GC. @@ -44,7 +43,6 @@ int32_t ObjectIdRing::GetIdForObject(RawObject* object, IdPolicy policy) { return AllocateNewId(object); } - int32_t ObjectIdRing::FindExistingIdForObject(RawObject* raw_obj) { for (int32_t i = 0; i < capacity_; i++) { if (table_[i] == raw_obj) { @@ -54,7 +52,6 @@ int32_t ObjectIdRing::FindExistingIdForObject(RawObject* raw_obj) { return kInvalidId; } - RawObject* ObjectIdRing::GetObjectForId(int32_t id, LookupResult* kind) { int32_t index = IndexOfId(id); if (index == kInvalidId) { @@ -72,13 +69,11 @@ RawObject* ObjectIdRing::GetObjectForId(int32_t id, LookupResult* kind) { return table_[index]; } - void ObjectIdRing::VisitPointers(ObjectPointerVisitor* visitor) { ASSERT(table_ != NULL); visitor->VisitPointers(table_, capacity_); } - void ObjectIdRing::PrintJSON(JSONStream* js) { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -100,7 +95,6 @@ void ObjectIdRing::PrintJSON(JSONStream* js) { } } - ObjectIdRing::ObjectIdRing(Isolate* isolate, int32_t capacity) { ASSERT(capacity > 0); isolate_ = isolate; @@ -110,7 +104,6 @@ ObjectIdRing::ObjectIdRing(Isolate* isolate, int32_t capacity) { SetCapacityAndMaxSerial(capacity, kMaxId); } - void ObjectIdRing::SetCapacityAndMaxSerial(int32_t capacity, int32_t max_serial) { ASSERT(max_serial <= kMaxId); @@ -127,7 +120,6 @@ void ObjectIdRing::SetCapacityAndMaxSerial(int32_t capacity, max_serial_ = max_serial - (max_serial % capacity_); } - int32_t ObjectIdRing::NextSerial() { int32_t r = serial_num_; serial_num_++; @@ -138,7 +130,6 @@ int32_t ObjectIdRing::NextSerial() { return r; } - int32_t ObjectIdRing::AllocateNewId(RawObject* raw_obj) { ASSERT(raw_obj->IsHeapObject()); int32_t id = NextSerial(); @@ -149,7 +140,6 @@ int32_t ObjectIdRing::AllocateNewId(RawObject* raw_obj) { return id; } - int32_t ObjectIdRing::IndexOfId(int32_t id) { if (!IsValidId(id)) { return kInvalidId; @@ -158,7 +148,6 @@ int32_t ObjectIdRing::IndexOfId(int32_t id) { return id % capacity_; } - int32_t ObjectIdRing::IdOfIndex(int32_t index) { if (index < 0) { return kInvalidId; @@ -200,7 +189,6 @@ int32_t ObjectIdRing::IdOfIndex(int32_t index) { return id; } - bool ObjectIdRing::IsValidContiguous(int32_t id) { ASSERT(id != kInvalidId); ASSERT((id >= 0) && (id < max_serial_)); @@ -215,7 +203,6 @@ bool ObjectIdRing::IsValidContiguous(int32_t id) { return id >= bottom; } - bool ObjectIdRing::IsValidId(int32_t id) { if (id == kInvalidId) { return false; diff --git a/runtime/vm/object_id_ring.h b/runtime/vm/object_id_ring.h index 4936316ad68..faa25b0cbf5 100644 --- a/runtime/vm/object_id_ring.h +++ b/runtime/vm/object_id_ring.h @@ -5,6 +5,8 @@ #ifndef RUNTIME_VM_OBJECT_ID_RING_H_ #define RUNTIME_VM_OBJECT_ID_RING_H_ +#include "platform/globals.h" + namespace dart { // Forward declarations. diff --git a/runtime/vm/object_id_ring_test.cc b/runtime/vm/object_id_ring_test.cc index f3081b4ba6a..84bd73f738f 100644 --- a/runtime/vm/object_id_ring_test.cc +++ b/runtime/vm/object_id_ring_test.cc @@ -2,12 +2,12 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "platform/assert.h" -#include "vm/globals.h" #include "vm/object_id_ring.h" -#include "vm/unit_test.h" +#include "platform/assert.h" #include "vm/dart_api_impl.h" #include "vm/dart_api_state.h" +#include "vm/globals.h" +#include "vm/unit_test.h" namespace dart { @@ -48,7 +48,6 @@ class ObjectIdRingTestHelper { } }; - // Test that serial number wrapping works. ISOLATE_UNIT_TEST_CASE(ObjectIdRingSerialWrapTest) { Isolate* isolate = Isolate::Current(); @@ -120,7 +119,6 @@ ISOLATE_UNIT_TEST_CASE(ObjectIdRingSerialWrapTest) { ObjectIdRingTestHelper::ExpectIdIsInvalid(ring, 3); } - // Test that the ring table is updated when the scavenger moves an object. TEST_CASE(ObjectIdRingScavengeMoveTest) { const char* kScriptChars = @@ -188,7 +186,6 @@ TEST_CASE(ObjectIdRingScavengeMoveTest) { ring->GetIdForObject(raw_object_moved1, ObjectIdRing::kReuseId)); } - // Test that the ring table is updated with nulls when the old GC collects. ISOLATE_UNIT_TEST_CASE(ObjectIdRingOldGCTest) { Isolate* isolate = thread->isolate(); @@ -241,7 +238,6 @@ ISOLATE_UNIT_TEST_CASE(ObjectIdRingOldGCTest) { EXPECT_EQ(Object::null(), raw_object_moved2); } - // Test that the ring table correctly reports an entry as expired when it is // overridden by new entries. ISOLATE_UNIT_TEST_CASE(ObjectIdRingExpiredEntryTest) { diff --git a/runtime/vm/object_reload.cc b/runtime/vm/object_reload.cc index cd065f7d1fe..1a5f1cb8774 100644 --- a/runtime/vm/object_reload.cc +++ b/runtime/vm/object_reload.cc @@ -18,7 +18,6 @@ DECLARE_FLAG(bool, trace_reload); DECLARE_FLAG(bool, trace_reload_verbose); DECLARE_FLAG(bool, two_args_smi_icd); - class ObjectReloadUtils : public AllStatic { static void DumpLibraryDictionary(const Library& lib) { DictionaryIterator it(lib); @@ -33,12 +32,10 @@ class ObjectReloadUtils : public AllStatic { } }; - void Function::Reparent(const Class& new_cls) const { set_owner(new_cls); } - void Function::ZeroEdgeCounters() const { const Array& saved_ic_data = Array::Handle(ic_data_array()); if (saved_ic_data.IsNull()) { @@ -56,7 +53,6 @@ void Function::ZeroEdgeCounters() const { } } - void Code::ResetICDatas(Zone* zone) const { // Iterate over the Code's object pool and reset all ICDatas. #ifdef TARGET_ARCH_IA32 @@ -101,7 +97,6 @@ void Code::ResetICDatas(Zone* zone) const { #endif } - void Class::CopyStaticFieldValues(const Class& old_cls) const { // We only update values for non-enum classes. const bool update_values = !is_enum_class(); @@ -141,7 +136,6 @@ void Class::CopyStaticFieldValues(const Class& old_cls) const { } } - void Class::CopyCanonicalConstants(const Class& old_cls) const { if (is_enum_class()) { // We do not copy enum classes's canonical constants because we explicitly @@ -165,7 +159,6 @@ void Class::CopyCanonicalConstants(const Class& old_cls) const { set_constants(old_constants); } - void Class::CopyCanonicalType(const Class& old_cls) const { const Type& old_canonical_type = Type::Handle(old_cls.canonical_type()); if (old_canonical_type.IsNull()) { @@ -174,7 +167,6 @@ void Class::CopyCanonicalType(const Class& old_cls) const { set_canonical_type(old_canonical_type); } - class EnumMapTraits { public: static bool ReportStats() { return false; } @@ -190,7 +182,6 @@ class EnumMapTraits { } }; - // Given an old enum class, add become mappings from old values to new values. // Some notes about how we reload enums below: // @@ -347,7 +338,6 @@ void Class::ReplaceEnum(const Class& old_enum) const { } } - void Class::PatchFieldsAndFunctions() const { // Move all old functions and fields to a patch class so that they // still refer to their original script. @@ -392,7 +382,6 @@ void Class::PatchFieldsAndFunctions() const { } } - void Class::MigrateImplicitStaticClosures(IsolateReloadContext* irc, const Class& new_cls) const { const Array& funcs = Array::Handle(functions()); @@ -420,7 +409,6 @@ void Class::MigrateImplicitStaticClosures(IsolateReloadContext* irc, } } - class EnumClassConflict : public ClassReasonForCancelling { public: EnumClassConflict(Zone* zone, const Class& from, const Class& to) @@ -435,7 +423,6 @@ class EnumClassConflict : public ClassReasonForCancelling { } }; - class TypedefClassConflict : public ClassReasonForCancelling { public: TypedefClassConflict(Zone* zone, const Class& from, const Class& to) @@ -450,7 +437,6 @@ class TypedefClassConflict : public ClassReasonForCancelling { } }; - class EnsureFinalizedError : public ClassReasonForCancelling { public: EnsureFinalizedError(Zone* zone, @@ -467,7 +453,6 @@ class EnsureFinalizedError : public ClassReasonForCancelling { RawString* ToString() { return String::New(error_.ToErrorCString()); } }; - class NativeFieldsConflict : public ClassReasonForCancelling { public: NativeFieldsConflict(Zone* zone, const Class& from, const Class& to) @@ -480,7 +465,6 @@ class NativeFieldsConflict : public ClassReasonForCancelling { } }; - class TypeParametersChanged : public ClassReasonForCancelling { public: TypeParametersChanged(Zone* zone, const Class& from, const Class& to) @@ -502,7 +486,6 @@ class TypeParametersChanged : public ClassReasonForCancelling { } }; - class PreFinalizedConflict : public ClassReasonForCancelling { public: PreFinalizedConflict(Zone* zone, const Class& from, const Class& to) @@ -517,7 +500,6 @@ class PreFinalizedConflict : public ClassReasonForCancelling { } }; - class InstanceSizeConflict : public ClassReasonForCancelling { public: InstanceSizeConflict(Zone* zone, const Class& from, const Class& to) @@ -533,7 +515,6 @@ class InstanceSizeConflict : public ClassReasonForCancelling { } }; - class UnimplementedDeferredLibrary : public ReasonForCancelling { public: UnimplementedDeferredLibrary(Zone* zone, @@ -557,7 +538,6 @@ class UnimplementedDeferredLibrary : public ReasonForCancelling { } }; - // This is executed before iterating over the instances. void Class::CheckReload(const Class& replacement, IsolateReloadContext* context) const { @@ -613,7 +593,6 @@ void Class::CheckReload(const Class& replacement, id(), replacement.id()); } - bool Class::RequiresInstanceMorphing(const Class& replacement) const { // Get the field maps for both classes. These field maps walk the class // hierarchy. @@ -650,7 +629,6 @@ bool Class::RequiresInstanceMorphing(const Class& replacement) const { return false; } - bool Class::CanReloadFinalized(const Class& replacement, IsolateReloadContext* context) const { // Make sure the declaration types matches for the two classes. @@ -671,7 +649,6 @@ bool Class::CanReloadFinalized(const Class& replacement, return true; } - bool Class::CanReloadPreFinalized(const Class& replacement, IsolateReloadContext* context) const { // The replacement class must also prefinalized. @@ -689,7 +666,6 @@ bool Class::CanReloadPreFinalized(const Class& replacement, return true; } - void Library::CheckReload(const Library& replacement, IsolateReloadContext* context) const { // TODO(26878): If the replacement library uses deferred loading, @@ -708,10 +684,8 @@ void Library::CheckReload(const Library& replacement, } } - static const Function* static_call_target = NULL; - void ICData::Reset(Zone* zone) const { if (is_static_call()) { const Function& old_target = Function::Handle(zone, GetTargetAt(0)); diff --git a/runtime/vm/object_service.cc b/runtime/vm/object_service.cc index ca83ef1a870..ba23b24e30c 100644 --- a/runtime/vm/object_service.cc +++ b/runtime/vm/object_service.cc @@ -23,7 +23,6 @@ static void AddNameProperties(JSONObject* jsobj, } } - void Object::AddCommonObjectProperties(JSONObject* jsobj, const char* protocol_type, bool ref) const { @@ -51,7 +50,6 @@ void Object::AddCommonObjectProperties(JSONObject* jsobj, } } - void Object::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); AddCommonObjectProperties(&jsobj, "Object", ref); @@ -61,7 +59,6 @@ void Object::PrintJSONImpl(JSONStream* stream, bool ref) const { } } - void Object::PrintJSON(JSONStream* stream, bool ref) const { if (IsNull()) { JSONObject jsobj(stream); @@ -74,7 +71,6 @@ void Object::PrintJSON(JSONStream* stream, bool ref) const { } } - void Class::PrintJSONImpl(JSONStream* stream, bool ref) const { Isolate* isolate = Isolate::Current(); JSONObject jsobj(stream); @@ -177,12 +173,10 @@ void Class::PrintJSONImpl(JSONStream* stream, bool ref) const { } } - void UnresolvedClass::PrintJSONImpl(JSONStream* stream, bool ref) const { Object::PrintJSONImpl(stream, ref); } - void TypeArguments::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); // The index in the canonical_type_arguments table cannot be used as part of @@ -233,12 +227,10 @@ void TypeArguments::PrintJSONImpl(JSONStream* stream, bool ref) const { } } - void PatchClass::PrintJSONImpl(JSONStream* stream, bool ref) const { Object::PrintJSONImpl(stream, ref); } - static void AddFunctionServiceId(const JSONObject& jsobj, const Function& f, const Class& cls) { @@ -280,7 +272,6 @@ static void AddFunctionServiceId(const JSONObject& jsobj, jsobj.AddServiceId(f); } - void Function::PrintJSONImpl(JSONStream* stream, bool ref) const { Class& cls = Class::Handle(Owner()); if (!cls.IsNull()) { @@ -351,12 +342,10 @@ void Function::PrintJSONImpl(JSONStream* stream, bool ref) const { } } - void RedirectionData::PrintJSONImpl(JSONStream* stream, bool ref) const { Object::PrintJSONImpl(stream, ref); } - void Field::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); Class& cls = Class::Handle(Owner()); @@ -413,12 +402,10 @@ void Field::PrintJSONImpl(JSONStream* stream, bool ref) const { } } - void LiteralToken::PrintJSONImpl(JSONStream* stream, bool ref) const { Object::PrintJSONImpl(stream, ref); } - void TokenStream::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); AddCommonObjectProperties(&jsobj, "Object", ref); @@ -435,7 +422,6 @@ void TokenStream::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONArray members(&jsobj, "members"); } - // See also Dart_ScriptGetTokenInfo. void Script::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); @@ -497,7 +483,6 @@ void Script::PrintJSONImpl(JSONStream* stream, bool ref) const { } } - void Library::PrintJSONImpl(JSONStream* stream, bool ref) const { const String& id = String::Handle(private_key()); JSONObject jsobj(stream); @@ -624,17 +609,14 @@ void Library::PrintJSONImpl(JSONStream* stream, bool ref) const { } } - void LibraryPrefix::PrintJSONImpl(JSONStream* stream, bool ref) const { Object::PrintJSONImpl(stream, ref); } - void Namespace::PrintJSONImpl(JSONStream* stream, bool ref) const { Object::PrintJSONImpl(stream, ref); } - void Instructions::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); AddCommonObjectProperties(&jsobj, "Object", ref); @@ -644,7 +626,6 @@ void Instructions::PrintJSONImpl(JSONStream* stream, bool ref) const { } } - void ObjectPool::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); AddCommonObjectProperties(&jsobj, "Object", ref); @@ -684,7 +665,6 @@ void ObjectPool::PrintJSONImpl(JSONStream* stream, bool ref) const { } } - void PcDescriptors::PrintToJSONObject(JSONObject* jsobj, bool ref) const { AddCommonObjectProperties(jsobj, "Object", ref); // TODO(johnmccutchan): Generate a stable id. PcDescriptors hang off a Code @@ -706,23 +686,19 @@ void PcDescriptors::PrintToJSONObject(JSONObject* jsobj, bool ref) const { } } - void PcDescriptors::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); PrintToJSONObject(&jsobj, ref); } - void CodeSourceMap::PrintJSONImpl(JSONStream* stream, bool ref) const { Object::PrintJSONImpl(stream, ref); } - void StackMap::PrintJSONImpl(JSONStream* stream, bool ref) const { Object::PrintJSONImpl(stream, ref); } - void LocalVarDescriptors::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); AddCommonObjectProperties(&jsobj, "Object", ref); @@ -749,12 +725,10 @@ void LocalVarDescriptors::PrintJSONImpl(JSONStream* stream, bool ref) const { } } - void ExceptionHandlers::PrintJSONImpl(JSONStream* stream, bool ref) const { Object::PrintJSONImpl(stream, ref); } - void SingleTargetCache::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); AddCommonObjectProperties(&jsobj, "Object", ref); @@ -767,7 +741,6 @@ void SingleTargetCache::PrintJSONImpl(JSONStream* stream, bool ref) const { jsobj.AddProperty("_upperLimit", upper_limit()); } - void UnlinkedCall::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); AddCommonObjectProperties(&jsobj, "Object", ref); @@ -779,7 +752,6 @@ void UnlinkedCall::PrintJSONImpl(JSONStream* stream, bool ref) const { jsobj.AddProperty("_argumentsDescriptor", Array::Handle(args_descriptor())); } - void ICData::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); AddCommonObjectProperties(&jsobj, "Object", ref); @@ -794,7 +766,6 @@ void ICData::PrintJSONImpl(JSONStream* stream, bool ref) const { jsobj.AddProperty("_entries", Object::Handle(ic_data())); } - void ICData::PrintToJSONArray(const JSONArray& jsarray, TokenPosition token_pos) const { Isolate* isolate = Isolate::Current(); @@ -822,7 +793,6 @@ void ICData::PrintToJSONArray(const JSONArray& jsarray, } } - void Code::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); AddCommonObjectProperties(&jsobj, "Code", ref); @@ -883,14 +853,12 @@ void Code::PrintJSONImpl(JSONStream* stream, bool ref) const { PrintJSONInlineIntervals(&jsobj); } - void Code::set_await_token_positions(const Array& await_token_positions) const { #if !defined(DART_PRECOMPILED_RUNTIME) StorePointer(&raw_ptr()->await_token_positions_, await_token_positions.raw()); #endif } - void Context::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); // TODO(turnidge): Should the user level type for Context be Context @@ -918,12 +886,10 @@ void Context::PrintJSONImpl(JSONStream* stream, bool ref) const { } } - void ContextScope::PrintJSONImpl(JSONStream* stream, bool ref) const { Object::PrintJSONImpl(stream, ref); } - void MegamorphicCache::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); AddCommonObjectProperties(&jsobj, "Object", ref); @@ -938,7 +904,6 @@ void MegamorphicCache::PrintJSONImpl(JSONStream* stream, bool ref) const { Object::Handle(arguments_descriptor())); } - void SubtypeTestCache::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); AddCommonObjectProperties(&jsobj, "Object", ref); @@ -949,12 +914,10 @@ void SubtypeTestCache::PrintJSONImpl(JSONStream* stream, bool ref) const { jsobj.AddProperty("_cache", Array::Handle(cache())); } - void Error::PrintJSONImpl(JSONStream* stream, bool ref) const { UNREACHABLE(); } - void ApiError::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); AddCommonObjectProperties(&jsobj, "Error", ref); @@ -963,7 +926,6 @@ void ApiError::PrintJSONImpl(JSONStream* stream, bool ref) const { jsobj.AddProperty("message", ToErrorCString()); } - void LanguageError::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); AddCommonObjectProperties(&jsobj, "Error", ref); @@ -972,7 +934,6 @@ void LanguageError::PrintJSONImpl(JSONStream* stream, bool ref) const { jsobj.AddProperty("message", ToErrorCString()); } - void UnhandledException::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); AddCommonObjectProperties(&jsobj, "Error", ref); @@ -989,7 +950,6 @@ void UnhandledException::PrintJSONImpl(JSONStream* stream, bool ref) const { jsobj.AddProperty("stacktrace", instance); } - void UnwindError::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); AddCommonObjectProperties(&jsobj, "Error", ref); @@ -999,7 +959,6 @@ void UnwindError::PrintJSONImpl(JSONStream* stream, bool ref) const { jsobj.AddProperty("_is_user_initiated", is_user_initiated()); } - void Instance::PrintSharedInstanceJSON(JSONObject* jsobj, bool ref) const { AddCommonObjectProperties(jsobj, "Instance", ref); if (ref) { @@ -1051,7 +1010,6 @@ void Instance::PrintSharedInstanceJSON(JSONObject* jsobj, bool ref) const { } } - void Instance::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); @@ -1096,12 +1054,10 @@ void Instance::PrintJSONImpl(JSONStream* stream, bool ref) const { } } - void AbstractType::PrintJSONImpl(JSONStream* stream, bool ref) const { UNREACHABLE(); } - void Type::PrintJSONImpl(JSONStream* stream, bool ref) const { // TODO(regis): Function types are not handled properly. JSONObject jsobj(stream); @@ -1131,7 +1087,6 @@ void Type::PrintJSONImpl(JSONStream* stream, bool ref) const { } } - void TypeRef::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); PrintSharedInstanceJSON(&jsobj, ref); @@ -1146,7 +1101,6 @@ void TypeRef::PrintJSONImpl(JSONStream* stream, bool ref) const { jsobj.AddProperty("targetType", AbstractType::Handle(type())); } - void TypeParameter::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); PrintSharedInstanceJSON(&jsobj, ref); @@ -1165,7 +1119,6 @@ void TypeParameter::PrintJSONImpl(JSONStream* stream, bool ref) const { jsobj.AddProperty("bound", upper_bound); } - void BoundedType::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); PrintSharedInstanceJSON(&jsobj, ref); @@ -1181,17 +1134,14 @@ void BoundedType::PrintJSONImpl(JSONStream* stream, bool ref) const { jsobj.AddProperty("bound", AbstractType::Handle(bound())); } - void MixinAppType::PrintJSONImpl(JSONStream* stream, bool ref) const { UNREACHABLE(); } - void Number::PrintJSONImpl(JSONStream* stream, bool ref) const { UNREACHABLE(); } - void Integer::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); PrintSharedInstanceJSON(&jsobj, ref); @@ -1200,7 +1150,6 @@ void Integer::PrintJSONImpl(JSONStream* stream, bool ref) const { jsobj.AddProperty("valueAsString", ToCString()); } - void Smi::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); PrintSharedInstanceJSON(&jsobj, ref); @@ -1209,12 +1158,10 @@ void Smi::PrintJSONImpl(JSONStream* stream, bool ref) const { jsobj.AddPropertyF("valueAsString", "%" Pd "", Value()); } - void Mint::PrintJSONImpl(JSONStream* stream, bool ref) const { Integer::PrintJSONImpl(stream, ref); } - void Double::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); PrintSharedInstanceJSON(&jsobj, ref); @@ -1223,12 +1170,10 @@ void Double::PrintJSONImpl(JSONStream* stream, bool ref) const { jsobj.AddProperty("valueAsString", ToCString()); } - void Bigint::PrintJSONImpl(JSONStream* stream, bool ref) const { Integer::PrintJSONImpl(stream, ref); } - void String::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); if (raw() == Symbols::OptimizedOut().raw()) { @@ -1266,7 +1211,6 @@ void String::PrintJSONImpl(JSONStream* stream, bool ref) const { jsobj.AddPropertyStr("valueAsString", *this, offset, count); } - void Bool::PrintJSONImpl(JSONStream* stream, bool ref) const { const char* str = ToCString(); JSONObject jsobj(stream); @@ -1276,7 +1220,6 @@ void Bool::PrintJSONImpl(JSONStream* stream, bool ref) const { jsobj.AddPropertyF("valueAsString", "%s", str); } - void Array::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); PrintSharedInstanceJSON(&jsobj, ref); @@ -1307,7 +1250,6 @@ void Array::PrintJSONImpl(JSONStream* stream, bool ref) const { } } - void GrowableObjectArray::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); PrintSharedInstanceJSON(&jsobj, ref); @@ -1338,7 +1280,6 @@ void GrowableObjectArray::PrintJSONImpl(JSONStream* stream, bool ref) const { } } - void LinkedHashMap::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); PrintSharedInstanceJSON(&jsobj, ref); @@ -1377,7 +1318,6 @@ void LinkedHashMap::PrintJSONImpl(JSONStream* stream, bool ref) const { } } - void Float32x4::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); PrintSharedInstanceJSON(&jsobj, ref); @@ -1386,7 +1326,6 @@ void Float32x4::PrintJSONImpl(JSONStream* stream, bool ref) const { jsobj.AddProperty("valueAsString", ToCString()); } - void Int32x4::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); PrintSharedInstanceJSON(&jsobj, ref); @@ -1395,7 +1334,6 @@ void Int32x4::PrintJSONImpl(JSONStream* stream, bool ref) const { jsobj.AddProperty("valueAsString", ToCString()); } - void Float64x2::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); PrintSharedInstanceJSON(&jsobj, ref); @@ -1404,7 +1342,6 @@ void Float64x2::PrintJSONImpl(JSONStream* stream, bool ref) const { jsobj.AddProperty("valueAsString", ToCString()); } - void TypedData::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); PrintSharedInstanceJSON(&jsobj, ref); @@ -1429,13 +1366,13 @@ void TypedData::PrintJSONImpl(JSONStream* stream, bool ref) const { jsobj.AddProperty("bytes", ""); } else { NoSafepointScope no_safepoint; - jsobj.AddPropertyBase64("bytes", reinterpret_cast(DataAddr( - offset * ElementSizeInBytes())), + jsobj.AddPropertyBase64("bytes", + reinterpret_cast( + DataAddr(offset * ElementSizeInBytes())), count * ElementSizeInBytes()); } } - void ExternalTypedData::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); PrintSharedInstanceJSON(&jsobj, ref); @@ -1460,43 +1397,37 @@ void ExternalTypedData::PrintJSONImpl(JSONStream* stream, bool ref) const { jsobj.AddProperty("bytes", ""); } else { NoSafepointScope no_safepoint; - jsobj.AddPropertyBase64("bytes", reinterpret_cast(DataAddr( - offset * ElementSizeInBytes())), + jsobj.AddPropertyBase64("bytes", + reinterpret_cast( + DataAddr(offset * ElementSizeInBytes())), count * ElementSizeInBytes()); } } - void Capability::PrintJSONImpl(JSONStream* stream, bool ref) const { Instance::PrintJSONImpl(stream, ref); } - void ReceivePort::PrintJSONImpl(JSONStream* stream, bool ref) const { Instance::PrintJSONImpl(stream, ref); } - void SendPort::PrintJSONImpl(JSONStream* stream, bool ref) const { Instance::PrintJSONImpl(stream, ref); } - void ClosureData::PrintJSONImpl(JSONStream* stream, bool ref) const { Object::PrintJSONImpl(stream, ref); } - void SignatureData::PrintJSONImpl(JSONStream* stream, bool ref) const { Object::PrintJSONImpl(stream, ref); } - void Closure::PrintJSONImpl(JSONStream* stream, bool ref) const { Instance::PrintJSONImpl(stream, ref); } - void StackTrace::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); PrintSharedInstanceJSON(&jsobj, ref); @@ -1505,7 +1436,6 @@ void StackTrace::PrintJSONImpl(JSONStream* stream, bool ref) const { jsobj.AddProperty("valueAsString", ToCString()); } - void RegExp::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); PrintSharedInstanceJSON(&jsobj, ref); @@ -1552,7 +1482,6 @@ void RegExp::PrintJSONImpl(JSONStream* stream, bool ref) const { } } - void WeakProperty::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); PrintSharedInstanceJSON(&jsobj, ref); @@ -1568,7 +1497,6 @@ void WeakProperty::PrintJSONImpl(JSONStream* stream, bool ref) const { jsobj.AddProperty("propertyValue", value_handle); } - void MirrorReference::PrintJSONImpl(JSONStream* stream, bool ref) const { JSONObject jsobj(stream); PrintSharedInstanceJSON(&jsobj, ref); diff --git a/runtime/vm/object_store.cc b/runtime/vm/object_store.cc index 274c8bd6253..77672c9d25b 100644 --- a/runtime/vm/object_store.cc +++ b/runtime/vm/object_store.cc @@ -4,8 +4,8 @@ #include "vm/object_store.h" -#include "vm/exceptions.h" #include "vm/dart_entry.h" +#include "vm/exceptions.h" #include "vm/isolate.h" #include "vm/object.h" #include "vm/raw_object.h" @@ -111,23 +111,19 @@ ObjectStore::ObjectStore() } } - ObjectStore::~ObjectStore() {} - void ObjectStore::VisitObjectPointers(ObjectPointerVisitor* visitor) { ASSERT(visitor != NULL); visitor->VisitPointers(from(), to()); } - void ObjectStore::Init(Isolate* isolate) { ASSERT(isolate->object_store() == NULL); ObjectStore* store = new ObjectStore(); isolate->set_object_store(store); } - #ifndef PRODUCT void ObjectStore::PrintToJSONObject(JSONObject* jsobj) { if (!FLAG_support_service) { @@ -147,7 +143,6 @@ void ObjectStore::PrintToJSONObject(JSONObject* jsobj) { } #endif // !PRODUCT - RawError* ObjectStore::PreallocateObjects() { Thread* thread = Thread::Current(); Isolate* isolate = thread->isolate(); @@ -209,7 +204,6 @@ RawError* ObjectStore::PreallocateObjects() { return Error::null(); } - RawFunction* ObjectStore::PrivateObjectLookup(const String& name) { const Library& core_lib = Library::Handle(core_library()); const String& mangled = String::ZoneHandle(core_lib.PrivateName(name)); @@ -219,7 +213,6 @@ RawFunction* ObjectStore::PrivateObjectLookup(const String& name) { return result.raw(); } - void ObjectStore::InitKnownObjects() { #ifdef DART_PRECOMPILED_RUNTIME // These objects are only needed for code generation. @@ -261,7 +254,6 @@ void ObjectStore::InitKnownObjects() { ASSERT(!function.IsNull()); set_async_clear_thread_stack_trace(function); - function_name ^= async_lib.PrivateName(Symbols::AsyncStarMoveNextHelper()); ASSERT(!function_name.IsNull()); function ^= diff --git a/runtime/vm/object_test.cc b/runtime/vm/object_test.cc index 3a78c140ee2..e8e04b106c3 100644 --- a/runtime/vm/object_test.cc +++ b/runtime/vm/object_test.cc @@ -6,6 +6,7 @@ #include "vm/assembler.h" #include "vm/class_finalizer.h" +#include "vm/code_descriptors.h" #include "vm/dart_api_impl.h" #include "vm/dart_entry.h" #include "vm/debugger.h" @@ -16,13 +17,11 @@ #include "vm/simulator.h" #include "vm/symbols.h" #include "vm/unit_test.h" -#include "vm/code_descriptors.h" namespace dart { DECLARE_FLAG(bool, write_protect_code); - static RawClass* CreateDummyClass(const String& class_name, const Script& script) { const Class& cls = Class::Handle(Class::New( @@ -31,7 +30,6 @@ static RawClass* CreateDummyClass(const String& class_name, return cls.raw(); } - ISOLATE_UNIT_TEST_CASE(Class) { // Allocate the class first. const String& class_name = String::Handle(Symbols::New(thread, "MyClass")); @@ -139,7 +137,6 @@ ISOLATE_UNIT_TEST_CASE(Class) { EXPECT_EQ(kNumOptionalParameters, function.NumOptionalParameters()); } - ISOLATE_UNIT_TEST_CASE(TypeArguments) { const Type& type1 = Type::Handle(Type::Double()); const Type& type2 = Type::Handle(Type::StringType()); @@ -161,7 +158,6 @@ ISOLATE_UNIT_TEST_CASE(TypeArguments) { EXPECT_EQ(type_arguments1.raw(), type_arguments3.raw()); } - ISOLATE_UNIT_TEST_CASE(TokenStream) { Zone* zone = Thread::Current()->zone(); String& source = String::Handle(zone, String::New("= ( 9 , .")); @@ -179,7 +175,6 @@ ISOLATE_UNIT_TEST_CASE(TokenStream) { EXPECT_EQ(Token::kEOS, iterator.CurrentTokenKind()); } - ISOLATE_UNIT_TEST_CASE(GenerateExactSource) { // Verify the exact formatting of generated sources. const char* kScriptChars = @@ -218,7 +213,6 @@ ISOLATE_UNIT_TEST_CASE(GenerateExactSource) { EXPECT_STREQ(source.ToCString(), gen_source.ToCString()); } - TEST_CASE(Class_ComputeEndTokenPos) { const char* kScript = "\n" @@ -247,7 +241,6 @@ TEST_CASE(Class_ComputeEndTokenPos) { EXPECT(line == 10 && col == 1); } - ISOLATE_UNIT_TEST_CASE(InstanceClass) { // Allocate the class first. String& class_name = String::Handle(Symbols::New(thread, "EmptyClass")); @@ -293,7 +286,6 @@ ISOLATE_UNIT_TEST_CASE(InstanceClass) { EXPECT(one_field_class.is_implemented()); } - ISOLATE_UNIT_TEST_CASE(Smi) { const Smi& smi = Smi::Handle(Smi::New(5)); Object& smi_object = Object::Handle(smi.raw()); @@ -354,7 +346,6 @@ ISOLATE_UNIT_TEST_CASE(Smi) { EXPECT_EQ(1, c.CompareWith(big2)); } - ISOLATE_UNIT_TEST_CASE(StringCompareTo) { const String& abcd = String::Handle(String::New("abcd")); const String& abce = String::Handle(String::New("abce")); @@ -397,7 +388,6 @@ ISOLATE_UNIT_TEST_CASE(StringCompareTo) { EXPECT(monkey_face.CompareTo(abce) > 0); } - ISOLATE_UNIT_TEST_CASE(StringEncodeIRI) { const char* kInput = "file:///usr/local/johnmccutchan/workspace/dart-repo/dart/test.dart"; @@ -409,7 +399,6 @@ ISOLATE_UNIT_TEST_CASE(StringEncodeIRI) { EXPECT(strcmp(encoded, kOutput) == 0); } - ISOLATE_UNIT_TEST_CASE(StringDecodeIRI) { const char* kOutput = "file:///usr/local/johnmccutchan/workspace/dart-repo/dart/test.dart"; @@ -422,7 +411,6 @@ ISOLATE_UNIT_TEST_CASE(StringDecodeIRI) { EXPECT(output.Equals(decoded)); } - ISOLATE_UNIT_TEST_CASE(StringDecodeIRIInvalid) { String& input = String::Handle(); input = String::New("file%"); @@ -437,7 +425,6 @@ ISOLATE_UNIT_TEST_CASE(StringDecodeIRIInvalid) { EXPECT(decoded.IsNull()); } - ISOLATE_UNIT_TEST_CASE(StringIRITwoByte) { const intptr_t kInputLen = 3; const uint16_t kInput[kInputLen] = {'x', '/', 256}; @@ -452,7 +439,6 @@ ISOLATE_UNIT_TEST_CASE(StringIRITwoByte) { EXPECT(input.Equals(decoded)); } - ISOLATE_UNIT_TEST_CASE(Mint) { // On 64-bit architectures a Smi is stored in a 64 bit word. A Midint cannot // be allocated if it does fit into a Smi. @@ -526,7 +512,6 @@ ISOLATE_UNIT_TEST_CASE(Mint) { #endif } - ISOLATE_UNIT_TEST_CASE(Double) { { const double dbl_const = 5.0; @@ -610,7 +595,6 @@ ISOLATE_UNIT_TEST_CASE(Double) { } } - ISOLATE_UNIT_TEST_CASE(Bigint) { Bigint& b = Bigint::Handle(); EXPECT(b.IsNull()); @@ -649,7 +633,6 @@ ISOLATE_UNIT_TEST_CASE(Bigint) { EXPECT_EQ(1, smi2.CompareWith(big3)); } - ISOLATE_UNIT_TEST_CASE(Integer) { Integer& i = Integer::Handle(); i = Integer::NewCanonical(String::Handle(String::New("12"))); @@ -666,7 +649,6 @@ ISOLATE_UNIT_TEST_CASE(Integer) { EXPECT(i.IsBigint()); } - ISOLATE_UNIT_TEST_CASE(String) { const char* kHello = "Hello World!"; int32_t hello_len = strlen(kHello); @@ -813,7 +795,6 @@ ISOLATE_UNIT_TEST_CASE(String) { } } - ISOLATE_UNIT_TEST_CASE(StringFormat) { const char* hello_str = "Hello World!"; const String& str = @@ -826,7 +807,6 @@ ISOLATE_UNIT_TEST_CASE(StringFormat) { EXPECT(str.Equals(hello_str)); } - ISOLATE_UNIT_TEST_CASE(StringConcat) { // Create strings from concatenated 1-byte empty strings. { @@ -1357,7 +1337,6 @@ ISOLATE_UNIT_TEST_CASE(StringConcat) { } } - ISOLATE_UNIT_TEST_CASE(StringHashConcat) { EXPECT_EQ(String::Handle(String::New("onebyte")).Hash(), String::HashConcat(String::Handle(String::New("one")), @@ -1373,7 +1352,6 @@ ISOLATE_UNIT_TEST_CASE(StringHashConcat) { String::Handle(String::FromUTF16(clef_utf16 + 1, 1)))); } - ISOLATE_UNIT_TEST_CASE(StringSubStringDifferentWidth) { // Create 1-byte substring from a 1-byte source string. const char* onechars = "\xC3\xB6\xC3\xB1\xC3\xA9"; @@ -1434,7 +1412,6 @@ ISOLATE_UNIT_TEST_CASE(StringSubStringDifferentWidth) { EXPECT(foursub4.IsTwoByteString()); } - ISOLATE_UNIT_TEST_CASE(StringFromUtf8Literal) { // Create a 1-byte string from a UTF-8 encoded string literal. { @@ -1594,7 +1571,6 @@ ISOLATE_UNIT_TEST_CASE(StringFromUtf8Literal) { } } - ISOLATE_UNIT_TEST_CASE(StringEqualsUtf8) { const char* onesrc = "abc"; const String& onestr = String::Handle(String::New(onesrc)); @@ -1626,7 +1602,6 @@ ISOLATE_UNIT_TEST_CASE(StringEqualsUtf8) { "\xF0\x90\x8E\xA2\xF0\x90\x8E\xA3")); } - ISOLATE_UNIT_TEST_CASE(StringEqualsUTF32) { const String& empty = String::Handle(String::New("")); const String& t_str = String::Handle(String::New("t")); @@ -1643,7 +1618,6 @@ ISOLATE_UNIT_TEST_CASE(StringEqualsUTF32) { EXPECT(!th_str.Equals(chars, 3)); } - ISOLATE_UNIT_TEST_CASE(ExternalOneByteString) { uint8_t characters[] = {0xF6, 0xF1, 0xE9}; intptr_t len = ARRAY_SIZE(characters); @@ -1674,7 +1648,6 @@ ISOLATE_UNIT_TEST_CASE(ExternalOneByteString) { EXPECT(substr.Equals("\xC3\xB1")); } - ISOLATE_UNIT_TEST_CASE(EscapeSpecialCharactersOneByteString) { uint8_t characters[] = {'a', '\n', '\f', '\b', '\t', '\v', '\r', '\\', '$', 'z'}; @@ -1694,7 +1667,6 @@ ISOLATE_UNIT_TEST_CASE(EscapeSpecialCharactersOneByteString) { EXPECT_EQ(escaped_empty_str.Length(), 0); } - ISOLATE_UNIT_TEST_CASE(EscapeSpecialCharactersExternalOneByteString) { uint8_t characters[] = {'a', '\n', '\f', '\b', '\t', '\v', '\r', '\\', '$', 'z'}; @@ -1740,7 +1712,6 @@ ISOLATE_UNIT_TEST_CASE(EscapeSpecialCharactersTwoByteString) { EXPECT_EQ(escaped_empty_str.Length(), 0); } - ISOLATE_UNIT_TEST_CASE(EscapeSpecialCharactersExternalTwoByteString) { uint16_t characters[] = {'a', '\n', '\f', '\b', '\t', '\v', '\r', '\\', '$', 'z'}; @@ -1763,7 +1734,6 @@ ISOLATE_UNIT_TEST_CASE(EscapeSpecialCharactersExternalTwoByteString) { EXPECT_EQ(escaped_empty_str.Length(), 0); } - ISOLATE_UNIT_TEST_CASE(ExternalTwoByteString) { uint16_t characters[] = {0x1E6B, 0x1E85, 0x1E53}; intptr_t len = ARRAY_SIZE(characters); @@ -1796,7 +1766,6 @@ ISOLATE_UNIT_TEST_CASE(ExternalTwoByteString) { EXPECT(substr.Equals("\xE1\xBA\x85")); } - ISOLATE_UNIT_TEST_CASE(Symbol) { const String& one = String::Handle(Symbols::New(thread, "Eins")); EXPECT(one.IsSymbol()); @@ -1858,7 +1827,6 @@ ISOLATE_UNIT_TEST_CASE(Symbol) { EXPECT_EQ(elf2.raw(), Symbols::New(thread, "Elf")); } - ISOLATE_UNIT_TEST_CASE(SymbolUnicode) { uint16_t monkey_utf16[] = {0xd83d, 0xdc35}; // Unicode Monkey Face. String& monkey = String::Handle(Symbols::FromUTF16(thread, monkey_utf16, 2)); @@ -1881,13 +1849,11 @@ ISOLATE_UNIT_TEST_CASE(SymbolUnicode) { EXPECT_EQ(cat2.raw(), cat.raw()); } - ISOLATE_UNIT_TEST_CASE(Bool) { EXPECT(Bool::True().value()); EXPECT(!Bool::False().value()); } - ISOLATE_UNIT_TEST_CASE(Array) { const int kArrayLen = 5; const Array& array = Array::Handle(Array::New(kArrayLen)); @@ -1931,7 +1897,6 @@ ISOLATE_UNIT_TEST_CASE(Array) { EXPECT(obj.IsArray()); } - static void TestIllegalArrayLength(intptr_t length) { char buffer[1024]; OS::SNPrint(buffer, sizeof(buffer), @@ -1951,7 +1916,6 @@ static void TestIllegalArrayLength(intptr_t length) { EXPECT_ERROR(result, buffer); } - TEST_CASE(ArrayLengthNegativeOne) { TestIllegalArrayLength(-1); } @@ -1964,7 +1928,6 @@ TEST_CASE(ArrayLengthOneTooMany) { TestIllegalArrayLength(kOneTooMany); } - TEST_CASE(ArrayLengthMaxElements) { char buffer[1024]; OS::SNPrint(buffer, sizeof(buffer), @@ -1986,7 +1949,6 @@ TEST_CASE(ArrayLengthMaxElements) { } } - static void TestIllegalTypedDataLength(const char* class_name, intptr_t length) { char buffer[1024]; @@ -2005,7 +1967,6 @@ static void TestIllegalTypedDataLength(const char* class_name, EXPECT_ERROR(result, buffer); } - TEST_CASE(Int8ListLengthNegativeOne) { TestIllegalTypedDataLength("Int8List", -1); } @@ -2019,7 +1980,6 @@ TEST_CASE(Int8ListLengthOneTooMany) { TestIllegalTypedDataLength("Int8List", kOneTooMany); } - TEST_CASE(Int8ListLengthMaxElements) { const intptr_t max_elements = TypedData::MaxElements(kTypedDataInt8ArrayCid); char buffer[1024]; @@ -2042,7 +2002,6 @@ TEST_CASE(Int8ListLengthMaxElements) { } } - ISOLATE_UNIT_TEST_CASE(StringCodePointIterator) { const String& str0 = String::Handle(String::New("")); String::CodePointIterator it0(str0); @@ -2099,7 +2058,6 @@ ISOLATE_UNIT_TEST_CASE(StringCodePointIterator) { EXPECT(!it3.Next()); } - ISOLATE_UNIT_TEST_CASE(StringCodePointIteratorRange) { const String& str = String::Handle(String::New("foo bar baz")); @@ -2116,7 +2074,6 @@ ISOLATE_UNIT_TEST_CASE(StringCodePointIteratorRange) { EXPECT(!it1.Next()); } - ISOLATE_UNIT_TEST_CASE(GrowableObjectArray) { const int kArrayLen = 5; Smi& value = Smi::Handle(); @@ -2238,7 +2195,6 @@ ISOLATE_UNIT_TEST_CASE(GrowableObjectArray) { EXPECT_EQ(1, new_array.Length()); } - ISOLATE_UNIT_TEST_CASE(InternalTypedData) { uint8_t data[] = {253, 254, 255, 0, 1, 2, 3, 4}; intptr_t data_length = ARRAY_SIZE(data); @@ -2294,7 +2250,6 @@ ISOLATE_UNIT_TEST_CASE(InternalTypedData) { } } - ISOLATE_UNIT_TEST_CASE(ExternalTypedData) { uint8_t data[] = {253, 254, 255, 0, 1, 2, 3, 4}; intptr_t data_length = ARRAY_SIZE(data); @@ -2357,7 +2312,6 @@ ISOLATE_UNIT_TEST_CASE(ExternalTypedData) { } } - TEST_CASE(Script) { const char* url_chars = "builtin:test-case"; const char* source_chars = "This will not compile."; @@ -2388,7 +2342,6 @@ TEST_CASE(Script) { EXPECT_VALID(result); } - ISOLATE_UNIT_TEST_CASE(EmbeddedScript) { const char* url_chars = "builtin:test-case"; const char* text = @@ -2490,7 +2443,6 @@ ISOLATE_UNIT_TEST_CASE(EmbeddedScript) { free(src_chars); } - ISOLATE_UNIT_TEST_CASE(Context) { const int kNumVariables = 5; const Context& parent_context = Context::Handle(Context::New(0)); @@ -2513,7 +2465,6 @@ ISOLATE_UNIT_TEST_CASE(Context) { EXPECT_EQ(3, smi.Value()); } - ISOLATE_UNIT_TEST_CASE(ContextScope) { const intptr_t parent_scope_function_level = 0; LocalScope* parent_scope = @@ -2616,7 +2567,6 @@ ISOLATE_UNIT_TEST_CASE(ContextScope) { var_c->owner()->context_level()); // Adjusted context level. } - ISOLATE_UNIT_TEST_CASE(Closure) { // Allocate the class first. const String& class_name = String::Handle(Symbols::New(thread, "MyClass")); @@ -2648,7 +2598,6 @@ ISOLATE_UNIT_TEST_CASE(Closure) { EXPECT_EQ(closure_context.raw(), context.raw()); } - ISOLATE_UNIT_TEST_CASE(ObjectPrinting) { // Simple Smis. EXPECT_STREQ("2", Smi::Handle(Smi::New(2)).ToCString()); @@ -2666,7 +2615,6 @@ ISOLATE_UNIT_TEST_CASE(ObjectPrinting) { String::Handle(String::New("Sugarbowl")).ToCString()); } - ISOLATE_UNIT_TEST_CASE(CheckedHandle) { // Ensure that null handles have the correct C++ vtable setup. const String& str1 = String::Handle(); @@ -2688,12 +2636,10 @@ ISOLATE_UNIT_TEST_CASE(CheckedHandle) { EXPECT(!str3.IsOneByteString()); } - static RawLibrary* CreateDummyLibrary(const String& library_name) { return Library::New(library_name); } - static RawFunction* CreateFunction(const char* name) { Thread* thread = Thread::Current(); const String& class_name = String::Handle(Symbols::New(thread, "ownerClass")); @@ -2709,7 +2655,6 @@ static RawFunction* CreateFunction(const char* name) { TokenPosition::kMinSource); } - // Test for Code and Instruction object creation. ISOLATE_UNIT_TEST_CASE(Code) { extern void GenerateIncrement(Assembler * assembler); @@ -2726,7 +2671,6 @@ ISOLATE_UNIT_TEST_CASE(Code) { EXPECT_EQ(1, Smi::Cast(result).Value()); } - // Test for immutability of generated instructions. The test crashes with a // segmentation fault when writing into it. ISOLATE_UNIT_TEST_CASE(CodeImmutability) { @@ -2754,7 +2698,6 @@ ISOLATE_UNIT_TEST_CASE(CodeImmutability) { stack_trace_collection_enabled); } - // Test for Embedded String object in the instructions. ISOLATE_UNIT_TEST_CASE(EmbedStringInCode) { extern void GenerateEmbedStringInCode(Assembler * assembler, const char* str); @@ -2777,7 +2720,6 @@ ISOLATE_UNIT_TEST_CASE(EmbedStringInCode) { } } - // Test for Embedded Smi object in the instructions. ISOLATE_UNIT_TEST_CASE(EmbedSmiInCode) { extern void GenerateEmbedSmiInCode(Assembler * assembler, intptr_t value); @@ -2793,7 +2735,6 @@ ISOLATE_UNIT_TEST_CASE(EmbedSmiInCode) { EXPECT(Smi::Cast(result).Value() == kSmiTestValue); } - #if defined(ARCH_IS_64_BIT) // Test for Embedded Smi object in the instructions. ISOLATE_UNIT_TEST_CASE(EmbedSmiIn64BitCode) { @@ -2811,7 +2752,6 @@ ISOLATE_UNIT_TEST_CASE(EmbedSmiIn64BitCode) { } #endif // ARCH_IS_64_BIT - ISOLATE_UNIT_TEST_CASE(ExceptionHandlers) { const int kNumEntries = 4; // Add an exception handler table to the code. @@ -2853,7 +2793,6 @@ ISOLATE_UNIT_TEST_CASE(ExceptionHandlers) { EXPECT(handlers.HasCatchAll(3)); } - ISOLATE_UNIT_TEST_CASE(PcDescriptors) { DescriptorList* builder = new DescriptorList(0); @@ -2911,7 +2850,6 @@ ISOLATE_UNIT_TEST_CASE(PcDescriptors) { EXPECT_EQ(false, iter.MoveNext()); } - ISOLATE_UNIT_TEST_CASE(PcDescriptorsLargeDeltas) { DescriptorList* builder = new DescriptorList(0); @@ -2973,7 +2911,6 @@ ISOLATE_UNIT_TEST_CASE(PcDescriptorsLargeDeltas) { EXPECT_EQ(false, iter.MoveNext()); } - static RawClass* CreateTestClass(const char* name) { const String& class_name = String::Handle(Symbols::New(Thread::Current(), name)); @@ -2982,7 +2919,6 @@ static RawClass* CreateTestClass(const char* name) { return cls.raw(); } - static RawField* CreateTestField(const char* name) { const Class& cls = Class::Handle(CreateTestClass("global:")); const String& field_name = @@ -2993,7 +2929,6 @@ static RawField* CreateTestField(const char* name) { return field.raw(); } - ISOLATE_UNIT_TEST_CASE(ClassDictionaryIterator) { Class& ae66 = Class::ZoneHandle(CreateTestClass("Ae6/6")); Class& re44 = Class::ZoneHandle(CreateTestClass("Re4/4")); @@ -3016,7 +2951,6 @@ ISOLATE_UNIT_TEST_CASE(ClassDictionaryIterator) { EXPECT(count == 2); } - static RawFunction* GetDummyTarget(const char* name) { const String& function_name = String::Handle(Symbols::New(Thread::Current(), name)); @@ -3032,7 +2966,6 @@ static RawFunction* GetDummyTarget(const char* name) { TokenPosition::kMinSource); } - ISOLATE_UNIT_TEST_CASE(ICData) { Function& function = Function::Handle(GetDummyTarget("Bern")); const intptr_t id = 12; @@ -3107,7 +3040,6 @@ ISOLATE_UNIT_TEST_CASE(ICData) { EXPECT_EQ(target1.raw(), scall_icdata.GetTargetAt(0)); } - ISOLATE_UNIT_TEST_CASE(SubtypeTestCache) { String& class_name = String::Handle(Symbols::New(thread, "EmptyClass")); Script& script = Script::Handle(); @@ -3136,7 +3068,6 @@ ISOLATE_UNIT_TEST_CASE(SubtypeTestCache) { EXPECT_EQ(Bool::True().raw(), test_result.raw()); } - ISOLATE_UNIT_TEST_CASE(FieldTests) { const String& f = String::Handle(String::New("oneField")); const String& getter_f = String::Handle(Field::GetterName(f)); @@ -3153,11 +3084,9 @@ ISOLATE_UNIT_TEST_CASE(FieldTests) { String::Handle(Field::NameFromSetter(setter_f)).ToCString()); } - // Expose helper function from object.cc for testing. bool EqualsIgnoringPrivate(const String& name, const String& private_name); - ISOLATE_UNIT_TEST_CASE(EqualsIgnoringPrivate) { String& mangled_name = String::Handle(); String& bare_name = String::Handle(); @@ -3300,12 +3229,10 @@ ISOLATE_UNIT_TEST_CASE(EqualsIgnoringPrivate) { !String::EqualsIgnoringPrivateKey(ext_mangled_name, ext_bad_bare_name)); } - ISOLATE_UNIT_TEST_CASE(ArrayNew_Overflow_Crash) { Array::Handle(Array::New(Array::kMaxElements + 1)); } - TEST_CASE(StackTraceFormat) { const char* kScriptChars = "void baz() {\n" @@ -3365,7 +3292,6 @@ TEST_CASE(StackTraceFormat) { "#10 main (test-lib:37:24)"); } - ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveCrossGen) { Isolate* isolate = Isolate::Current(); WeakProperty& weak = WeakProperty::Handle(); @@ -3481,7 +3407,6 @@ ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveCrossGen) { EXPECT(weak.value() != Object::null()); } - ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveRecurse) { // This used to end in an infinite recursion. Caused by scavenging the weak // property before scavenging the key. @@ -3504,7 +3429,6 @@ ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveRecurse) { EXPECT(weak.value() != Object::null()); } - ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveOne_NewSpace) { Isolate* isolate = Isolate::Current(); WeakProperty& weak = WeakProperty::Handle(); @@ -3523,7 +3447,6 @@ ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveOne_NewSpace) { EXPECT(weak.value() != Object::null()); } - ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveTwo_NewSpace) { Isolate* isolate = Isolate::Current(); WeakProperty& weak1 = WeakProperty::Handle(); @@ -3552,7 +3475,6 @@ ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveTwo_NewSpace) { EXPECT(weak2.value() != Object::null()); } - ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveTwoShared_NewSpace) { Isolate* isolate = Isolate::Current(); WeakProperty& weak1 = WeakProperty::Handle(); @@ -3579,7 +3501,6 @@ ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveTwoShared_NewSpace) { EXPECT(weak2.value() != Object::null()); } - ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveOne_OldSpace) { Isolate* isolate = Isolate::Current(); WeakProperty& weak = WeakProperty::Handle(); @@ -3598,7 +3519,6 @@ ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveOne_OldSpace) { EXPECT(weak.value() != Object::null()); } - ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveTwo_OldSpace) { Isolate* isolate = Isolate::Current(); WeakProperty& weak1 = WeakProperty::Handle(); @@ -3627,7 +3547,6 @@ ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveTwo_OldSpace) { EXPECT(weak2.value() != Object::null()); } - ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveTwoShared_OldSpace) { Isolate* isolate = Isolate::Current(); WeakProperty& weak1 = WeakProperty::Handle(); @@ -3654,7 +3573,6 @@ ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveTwoShared_OldSpace) { EXPECT(weak2.value() != Object::null()); } - ISOLATE_UNIT_TEST_CASE(WeakProperty_ClearOne_NewSpace) { Isolate* isolate = Isolate::Current(); WeakProperty& weak = WeakProperty::Handle(); @@ -3675,7 +3593,6 @@ ISOLATE_UNIT_TEST_CASE(WeakProperty_ClearOne_NewSpace) { EXPECT(weak.value() == Object::null()); } - ISOLATE_UNIT_TEST_CASE(WeakProperty_ClearTwoShared_NewSpace) { Isolate* isolate = Isolate::Current(); WeakProperty& weak1 = WeakProperty::Handle(); @@ -3702,7 +3619,6 @@ ISOLATE_UNIT_TEST_CASE(WeakProperty_ClearTwoShared_NewSpace) { EXPECT(weak2.value() == Object::null()); } - ISOLATE_UNIT_TEST_CASE(WeakProperty_ClearOne_OldSpace) { Isolate* isolate = Isolate::Current(); WeakProperty& weak = WeakProperty::Handle(); @@ -3723,7 +3639,6 @@ ISOLATE_UNIT_TEST_CASE(WeakProperty_ClearOne_OldSpace) { EXPECT(weak.value() == Object::null()); } - ISOLATE_UNIT_TEST_CASE(WeakProperty_ClearTwoShared_OldSpace) { Isolate* isolate = Isolate::Current(); WeakProperty& weak1 = WeakProperty::Handle(); @@ -3750,7 +3665,6 @@ ISOLATE_UNIT_TEST_CASE(WeakProperty_ClearTwoShared_OldSpace) { EXPECT(weak2.value() == Object::null()); } - ISOLATE_UNIT_TEST_CASE(MirrorReference) { const MirrorReference& reference = MirrorReference::Handle(MirrorReference::New(Object::Handle())); @@ -3776,7 +3690,6 @@ ISOLATE_UNIT_TEST_CASE(MirrorReference) { EXPECT(obj.IsMirrorReference()); } - static RawFunction* GetFunction(const Class& cls, const char* name) { const Function& result = Function::Handle( cls.LookupDynamicFunction(String::Handle(String::New(name)))); @@ -3784,7 +3697,6 @@ static RawFunction* GetFunction(const Class& cls, const char* name) { return result.raw(); } - static RawFunction* GetStaticFunction(const Class& cls, const char* name) { const Function& result = Function::Handle( cls.LookupStaticFunction(String::Handle(String::New(name)))); @@ -3792,7 +3704,6 @@ static RawFunction* GetStaticFunction(const Class& cls, const char* name) { return result.raw(); } - static RawField* GetField(const Class& cls, const char* name) { const Field& field = Field::Handle(cls.LookupField(String::Handle(String::New(name)))); @@ -3800,7 +3711,6 @@ static RawField* GetField(const Class& cls, const char* name) { return field.raw(); } - static RawClass* GetClass(const Library& lib, const char* name) { const Class& cls = Class::Handle( lib.LookupClass(String::Handle(Symbols::New(Thread::Current(), name)))); @@ -3808,7 +3718,6 @@ static RawClass* GetClass(const Library& lib, const char* name) { return cls.raw(); } - ISOLATE_UNIT_TEST_CASE(FindClosureIndex) { // Allocate the class first. const String& class_name = String::Handle(Symbols::New(thread, "MyClass")); @@ -3846,7 +3755,6 @@ ISOLATE_UNIT_TEST_CASE(FindClosureIndex) { EXPECT_EQ(func_from_index.raw(), function.raw()); } - ISOLATE_UNIT_TEST_CASE(FindInvocationDispatcherFunctionIndex) { const String& class_name = String::Handle(Symbols::New(thread, "MyClass")); const Script& script = Script::Handle(); @@ -3891,7 +3799,6 @@ ISOLATE_UNIT_TEST_CASE(FindInvocationDispatcherFunctionIndex) { EXPECT_EQ(bad_invocation_dispatcher_index, -1); } - static void PrintMetadata(const char* name, const Object& data) { if (data.IsError()) { OS::Print("Error in metadata evaluation for %s: '%s'\n", name, @@ -3907,7 +3814,6 @@ static void PrintMetadata(const char* name, const Object& data) { } } - TEST_CASE(Metadata) { const char* kScriptChars = "@metafoo \n" @@ -3981,7 +3887,6 @@ TEST_CASE(Metadata) { PrintMetadata("gVar", res); } - TEST_CASE(FunctionSourceFingerprint) { const char* kScriptChars = "class A {\n" @@ -4060,7 +3965,6 @@ TEST_CASE(FunctionSourceFingerprint) { EXPECT_EQ(a_test6.SourceFingerprint(), b_test6.SourceFingerprint()); } - TEST_CASE(FunctionWithBreakpointNotInlined) { if (!FLAG_support_debugger) { return; @@ -4099,7 +4003,6 @@ TEST_CASE(FunctionWithBreakpointNotInlined) { EXPECT(!func_b.CanBeInlined()); } - ISOLATE_UNIT_TEST_CASE(SpecialClassesHaveEmptyArrays) { ObjectStore* object_store = Isolate::Current()->object_store(); Class& cls = Class::Handle(); @@ -4130,10 +4033,8 @@ ISOLATE_UNIT_TEST_CASE(SpecialClassesHaveEmptyArrays) { EXPECT(array.IsArray()); } - #ifndef PRODUCT - class ObjectAccumulator : public ObjectVisitor { public: explicit ObjectAccumulator(GrowableArray* objects) @@ -4155,7 +4056,6 @@ class ObjectAccumulator : public ObjectVisitor { GrowableArray* objects_; }; - ISOLATE_UNIT_TEST_CASE(PrintJSON) { Heap* heap = Isolate::Current()->heap(); heap->CollectAllGarbage(); @@ -4169,7 +4069,6 @@ ISOLATE_UNIT_TEST_CASE(PrintJSON) { } } - ISOLATE_UNIT_TEST_CASE(PrintJSONPrimitives) { char buffer[1024]; Isolate* isolate = Isolate::Current(); @@ -4459,10 +4358,8 @@ ISOLATE_UNIT_TEST_CASE(PrintJSONPrimitives) { } } - #endif // !PRODUCT - TEST_CASE(InstanceEquality) { // Test that Instance::OperatorEquals can call a user-defined operator==. const char* kScript = @@ -4491,7 +4388,6 @@ TEST_CASE(InstanceEquality) { EXPECT(!a0.IsIdenticalTo(a1)); } - TEST_CASE(HashCode) { // Ensure C++ overrides of Instance::HashCode match the Dart implementations. const char* kScript = @@ -4514,7 +4410,6 @@ TEST_CASE(HashCode) { EXPECT(result.IsIdenticalTo(expected)); } - static void CheckIdenticalHashStructure(const Instance& a, const Instance& b) { const char* kScript = "(a, b) {\n" @@ -4553,7 +4448,6 @@ static void CheckIdenticalHashStructure(const Instance& a, const Instance& b) { EXPECT(lib.Evaluate(name, param_names, param_values) == Bool::True().raw()); } - TEST_CASE(LinkedHashMap) { // Check that initial index size and hash mask match in Dart vs. C++. // 1. Create an empty custom linked hash map in Dart. @@ -4581,7 +4475,6 @@ TEST_CASE(LinkedHashMap) { CheckIdenticalHashStructure(dart_map, cc_map); } - TEST_CASE(LinkedHashMap_iteration) { const char* kScript = "makeMap() {\n" @@ -4623,7 +4516,6 @@ TEST_CASE(LinkedHashMap_iteration) { EXPECT(!iterator.MoveNext()); } - static void CheckConcatAll(const String* data[], intptr_t n) { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -4639,7 +4531,6 @@ static void CheckConcatAll(const String* data[], intptr_t n) { EXPECT(res1.Equals(res2)); } - ISOLATE_UNIT_TEST_CASE(Symbols_FromConcatAll) { { const String* data[3] = {&Symbols::FallThroughError(), &Symbols::Dot(), @@ -4703,13 +4594,11 @@ ISOLATE_UNIT_TEST_CASE(Symbols_FromConcatAll) { } } - struct TestResult { const char* in; const char* out; }; - ISOLATE_UNIT_TEST_CASE(String_ScrubName) { TestResult tests[] = { {"(dynamic, dynamic) => void", "(dynamic, dynamic) => void"}, @@ -4736,7 +4625,6 @@ ISOLATE_UNIT_TEST_CASE(String_ScrubName) { } } - ISOLATE_UNIT_TEST_CASE(String_EqualsUTF32) { // Regression test for Issue 27433. Checks that comparisons between Strings // and utf32 arrays happens after conversion to utf16 instead of utf32, as diff --git a/runtime/vm/object_x64_test.cc b/runtime/vm/object_x64_test.cc index e5b1033ee83..8c016cecb5b 100644 --- a/runtime/vm/object_x64_test.cc +++ b/runtime/vm/object_x64_test.cc @@ -14,7 +14,6 @@ namespace dart { #define __ assembler-> - // Generate a simple dart code sequence. // This is used to test Code and Instruction object creation. void GenerateIncrement(Assembler* assembler) { @@ -28,7 +27,6 @@ void GenerateIncrement(Assembler* assembler) { __ ret(); } - // Generate a dart code sequence that embeds a string object in it. // This is used to test Embedded String objects in the instructions. void GenerateEmbedStringInCode(Assembler* assembler, const char* str) { @@ -40,7 +38,6 @@ void GenerateEmbedStringInCode(Assembler* assembler, const char* str) { __ ret(); } - // Generate a dart code sequence that embeds a smi object in it. // This is used to test Embedded Smi objects in the instructions. void GenerateEmbedSmiInCode(Assembler* assembler, intptr_t value) { diff --git a/runtime/vm/optimizer.cc b/runtime/vm/optimizer.cc index 24f5e058009..302996ab12e 100644 --- a/runtime/vm/optimizer.cc +++ b/runtime/vm/optimizer.cc @@ -17,7 +17,6 @@ static bool CidTestResultsContains(const ZoneGrowableArray& results, return false; } - static void TryAddTest(ZoneGrowableArray* results, intptr_t test_cid, bool result) { @@ -27,7 +26,6 @@ static void TryAddTest(ZoneGrowableArray* results, } } - // Used when we only need the positive result because we return false by // default. static void PurgeNegativeTestCidsEntries(ZoneGrowableArray* results) { @@ -43,7 +41,6 @@ static void PurgeNegativeTestCidsEntries(ZoneGrowableArray* results) { results->SetLength(dest); } - bool Optimizer::SpecializeTestCidsForNumericTypes( ZoneGrowableArray* results, const AbstractType& type) { diff --git a/runtime/vm/os_android.cc b/runtime/vm/os_android.cc index e2a7b33097a..d9da8d46fb3 100644 --- a/runtime/vm/os_android.cc +++ b/runtime/vm/os_android.cc @@ -12,10 +12,10 @@ #include // NOLINT #include // NOLINT #include // NOLINT -#include // NOLINT #include // NOLINT #include // NOLINT #include // NOLINT +#include // NOLINT #include // NOLINT #include "platform/utils.h" @@ -24,7 +24,6 @@ #include "vm/isolate.h" #include "vm/zone.h" - namespace dart { // Android CodeObservers. @@ -89,12 +88,10 @@ const char* OS::Name() { return "android"; } - intptr_t OS::ProcessId() { return static_cast(getpid()); } - static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) { time_t seconds = static_cast(seconds_since_epoch); if (seconds != seconds_since_epoch) return false; @@ -102,7 +99,6 @@ static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) { return error_code != NULL; } - const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) { tm decomposed; bool succeeded = LocalTime(seconds_since_epoch, &decomposed); @@ -110,7 +106,6 @@ const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) { return (succeeded && (decomposed.tm_zone != NULL)) ? decomposed.tm_zone : ""; } - int OS::GetTimeZoneOffsetInSeconds(int64_t seconds_since_epoch) { tm decomposed; bool succeeded = LocalTime(seconds_since_epoch, &decomposed); @@ -119,7 +114,6 @@ int OS::GetTimeZoneOffsetInSeconds(int64_t seconds_since_epoch) { return succeeded ? static_cast(decomposed.tm_gmtoff) : 0; } - int OS::GetLocalTimeZoneAdjustmentInSeconds() { // TODO(floitsch): avoid excessive calls to tzset? tzset(); @@ -128,12 +122,10 @@ int OS::GetLocalTimeZoneAdjustmentInSeconds() { return static_cast(-timezone); } - int64_t OS::GetCurrentTimeMillis() { return GetCurrentTimeMicros() / 1000; } - int64_t OS::GetCurrentTimeMicros() { // gettimeofday has microsecond resolution. struct timeval tv; @@ -144,7 +136,6 @@ int64_t OS::GetCurrentTimeMicros() { return (static_cast(tv.tv_sec) * 1000000) + tv.tv_usec; } - int64_t OS::GetCurrentMonotonicTicks() { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) { @@ -158,19 +149,16 @@ int64_t OS::GetCurrentMonotonicTicks() { return result; } - int64_t OS::GetCurrentMonotonicFrequency() { return kNanosecondsPerSecond; } - int64_t OS::GetCurrentMonotonicMicros() { int64_t ticks = GetCurrentMonotonicTicks(); ASSERT(GetCurrentMonotonicFrequency() == kNanosecondsPerSecond); return ticks / kNanosecondsPerMicrosecond; } - int64_t OS::GetCurrentThreadCPUMicros() { struct timespec ts; if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) != 0) { @@ -183,7 +171,6 @@ int64_t OS::GetCurrentThreadCPUMicros() { return result; } - // TODO(5411554): May need to hoist these architecture dependent code // into a architecture specific file e.g: os_ia32_linux.cc intptr_t OS::ActivationFrameAlignment() { @@ -204,7 +191,6 @@ intptr_t OS::ActivationFrameAlignment() { return alignment; } - intptr_t OS::PreferredCodeAlignment() { #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \ defined(TARGET_ARCH_ARM64) || defined(TARGET_ARCH_DBC) @@ -224,12 +210,10 @@ intptr_t OS::PreferredCodeAlignment() { return alignment; } - int OS::NumberOfAvailableProcessors() { return sysconf(_SC_NPROCESSORS_ONLN); } - uintptr_t OS::MaxRSS() { struct rusage usage; usage.ru_maxrss = 0; @@ -238,13 +222,11 @@ uintptr_t OS::MaxRSS() { return usage.ru_maxrss * KB; } - void OS::Sleep(int64_t millis) { int64_t micros = millis * kMicrosecondsPerMillisecond; SleepMicros(micros); } - void OS::SleepMicros(int64_t micros) { struct timespec req; // requested. struct timespec rem; // remainder. @@ -265,58 +247,47 @@ void OS::SleepMicros(int64_t micros) { } } - void OS::DebugBreak() { __builtin_trap(); } - uintptr_t DART_NOINLINE OS::GetProgramCounter() { return reinterpret_cast( __builtin_extract_return_addr(__builtin_return_address(0))); } - char* OS::StrNDup(const char* s, intptr_t n) { return strndup(s, n); } - intptr_t OS::StrNLen(const char* s, intptr_t n) { return strnlen(s, n); } - uint16_t HostToBigEndian16(uint16_t value) { return htobe16(value); } - uint32_t HostToBigEndian32(uint32_t value) { return htobe32(value); } - uint64_t HostToBigEndian64(uint64_t value) { return htobe64(value); } - uint16_t HostToLittleEndian16(uint16_t value) { return htole16(value); } - uint32_t HostToLittleEndian32(uint32_t value) { return htole32(value); } - uint64_t HostToLittleEndian64(uint64_t value) { return htole64(value); } - void OS::Print(const char* format, ...) { va_list args; va_start(args, format); @@ -326,13 +297,11 @@ void OS::Print(const char* format, ...) { va_end(args); } - void OS::VFPrint(FILE* stream, const char* format, va_list args) { vfprintf(stream, format, args); fflush(stream); } - int OS::SNPrint(char* str, size_t size, const char* format, ...) { va_list args; va_start(args, format); @@ -341,7 +310,6 @@ int OS::SNPrint(char* str, size_t size, const char* format, ...) { return retval; } - int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) { int retval = vsnprintf(str, size, format, args); if (retval < 0) { @@ -350,7 +318,6 @@ int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) { return retval; } - char* OS::SCreate(Zone* zone, const char* format, ...) { va_list args; va_start(args, format); @@ -359,7 +326,6 @@ char* OS::SCreate(Zone* zone, const char* format, ...) { return buffer; } - char* OS::VSCreate(Zone* zone, const char* format, va_list args) { // Measure. va_list measure_args; @@ -383,7 +349,6 @@ char* OS::VSCreate(Zone* zone, const char* format, va_list args) { return buffer; } - bool OS::StringToInt64(const char* str, int64_t* value) { ASSERT(str != NULL && strlen(str) > 0 && value != NULL); int32_t base = 10; @@ -401,7 +366,6 @@ bool OS::StringToInt64(const char* str, int64_t* value) { return ((errno == 0) && (endptr != str) && (*endptr == 0)); } - void OS::RegisterCodeObservers() { #ifndef PRODUCT if (FLAG_generate_perf_events_symbols) { @@ -410,7 +374,6 @@ void OS::RegisterCodeObservers() { #endif // !PRODUCT } - void OS::PrintErr(const char* format, ...) { va_list args; va_start(args, format); @@ -420,7 +383,6 @@ void OS::PrintErr(const char* format, ...) { va_end(args); } - void OS::InitOnce() { // TODO(5411554): For now we check that initonce is called only once, // Once there is more formal mechanism to call InitOnce we can move @@ -430,15 +392,12 @@ void OS::InitOnce() { init_once_called = true; } - void OS::Shutdown() {} - void OS::Abort() { abort(); } - void OS::Exit(int code) { exit(code); } diff --git a/runtime/vm/os_fuchsia.cc b/runtime/vm/os_fuchsia.cc index 46f0bc5af45..3781f029ba2 100644 --- a/runtime/vm/os_fuchsia.cc +++ b/runtime/vm/os_fuchsia.cc @@ -31,12 +31,10 @@ const char* OS::Name() { return "fuchsia"; } - intptr_t OS::ProcessId() { return static_cast(getpid()); } - static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) { time_t seconds = static_cast(seconds_since_epoch); if (seconds != seconds_since_epoch) { @@ -46,7 +44,6 @@ static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) { return error_code != NULL; } - const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) { tm decomposed; bool succeeded = LocalTime(seconds_since_epoch, &decomposed); @@ -54,7 +51,6 @@ const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) { return (succeeded && (decomposed.tm_zone != NULL)) ? decomposed.tm_zone : ""; } - int OS::GetTimeZoneOffsetInSeconds(int64_t seconds_since_epoch) { tm decomposed; bool succeeded = LocalTime(seconds_since_epoch, &decomposed); @@ -63,7 +59,6 @@ int OS::GetTimeZoneOffsetInSeconds(int64_t seconds_since_epoch) { return succeeded ? static_cast(decomposed.tm_gmtoff) : 0; } - int OS::GetLocalTimeZoneAdjustmentInSeconds() { // TODO(floitsch): avoid excessive calls to tzset? tzset(); @@ -72,39 +67,32 @@ int OS::GetLocalTimeZoneAdjustmentInSeconds() { return static_cast(-timezone); } - int64_t OS::GetCurrentTimeMillis() { return GetCurrentTimeMicros() / 1000; } - int64_t OS::GetCurrentTimeMicros() { return mx_time_get(MX_CLOCK_UTC) / kNanosecondsPerMicrosecond; } - int64_t OS::GetCurrentMonotonicTicks() { return mx_time_get(MX_CLOCK_MONOTONIC); } - int64_t OS::GetCurrentMonotonicFrequency() { return kNanosecondsPerSecond; } - int64_t OS::GetCurrentMonotonicMicros() { int64_t ticks = GetCurrentMonotonicTicks(); ASSERT(GetCurrentMonotonicFrequency() == kNanosecondsPerSecond); return ticks / kNanosecondsPerMicrosecond; } - int64_t OS::GetCurrentThreadCPUMicros() { return mx_time_get(MX_CLOCK_THREAD) / kNanosecondsPerMicrosecond; } - // TODO(5411554): May need to hoist these architecture dependent code // into a architecture specific file e.g: os_ia32_fuchsia.cc intptr_t OS::ActivationFrameAlignment() { @@ -125,7 +113,6 @@ intptr_t OS::ActivationFrameAlignment() { return alignment; } - intptr_t OS::PreferredCodeAlignment() { #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \ defined(TARGET_ARCH_ARM64) || defined(TARGET_ARCH_DBC) @@ -145,12 +132,10 @@ intptr_t OS::PreferredCodeAlignment() { return alignment; } - int OS::NumberOfAvailableProcessors() { return sysconf(_SC_NPROCESSORS_CONF); } - uintptr_t OS::MaxRSS() { mx_info_task_stats_t task_stats; mx_handle_t process = mx_process_self(); @@ -161,38 +146,31 @@ uintptr_t OS::MaxRSS() { : 0; } - void OS::Sleep(int64_t millis) { SleepMicros(millis * kMicrosecondsPerMillisecond); } - void OS::SleepMicros(int64_t micros) { mx_nanosleep(mx_deadline_after(micros * kNanosecondsPerMicrosecond)); } - void OS::DebugBreak() { UNIMPLEMENTED(); } - uintptr_t DART_NOINLINE OS::GetProgramCounter() { return reinterpret_cast( __builtin_extract_return_addr(__builtin_return_address(0))); } - char* OS::StrNDup(const char* s, intptr_t n) { return strndup(s, n); } - intptr_t OS::StrNLen(const char* s, intptr_t n) { return strnlen(s, n); } - void OS::Print(const char* format, ...) { va_list args; va_start(args, format); @@ -200,13 +178,11 @@ void OS::Print(const char* format, ...) { va_end(args); } - void OS::VFPrint(FILE* stream, const char* format, va_list args) { vfprintf(stream, format, args); fflush(stream); } - int OS::SNPrint(char* str, size_t size, const char* format, ...) { va_list args; va_start(args, format); @@ -215,7 +191,6 @@ int OS::SNPrint(char* str, size_t size, const char* format, ...) { return retval; } - int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) { int retval = vsnprintf(str, size, format, args); if (retval < 0) { @@ -224,7 +199,6 @@ int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) { return retval; } - char* OS::SCreate(Zone* zone, const char* format, ...) { va_list args; va_start(args, format); @@ -233,7 +207,6 @@ char* OS::SCreate(Zone* zone, const char* format, ...) { return buffer; } - char* OS::VSCreate(Zone* zone, const char* format, va_list args) { // Measure. va_list measure_args; @@ -257,7 +230,6 @@ char* OS::VSCreate(Zone* zone, const char* format, va_list args) { return buffer; } - bool OS::StringToInt64(const char* str, int64_t* value) { ASSERT(str != NULL && strlen(str) > 0 && value != NULL); int32_t base = 10; @@ -275,7 +247,6 @@ bool OS::StringToInt64(const char* str, int64_t* value) { return ((errno == 0) && (endptr != str) && (*endptr == 0)); } - void OS::RegisterCodeObservers() { #ifndef PRODUCT if (FLAG_generate_perf_events_symbols) { @@ -284,7 +255,6 @@ void OS::RegisterCodeObservers() { #endif // !PRODUCT } - void OS::PrintErr(const char* format, ...) { va_list args; va_start(args, format); @@ -292,7 +262,6 @@ void OS::PrintErr(const char* format, ...) { va_end(args); } - void OS::InitOnce() { // TODO(5411554): For now we check that initonce is called only once, // Once there is more formal mechanism to call InitOnce we can move @@ -302,15 +271,12 @@ void OS::InitOnce() { init_once_called = true; } - void OS::Shutdown() {} - void OS::Abort() { abort(); } - void OS::Exit(int code) { UNIMPLEMENTED(); } diff --git a/runtime/vm/os_linux.cc b/runtime/vm/os_linux.cc index c0f5b8b841c..ccbc7e51e4f 100644 --- a/runtime/vm/os_linux.cc +++ b/runtime/vm/os_linux.cc @@ -8,15 +8,15 @@ #include "vm/os.h" #include // NOLINT +#include // NOLINT #include // NOLINT #include // NOLINT -#include // NOLINT #include // NOLINT +#include // NOLINT +#include // NOLINT #include // NOLINT #include // NOLINT -#include // NOLINT -#include // NOLINT -#include // NOLINT +#include // NOLINT #include // NOLINT #include "platform/memory_sanitizer.h" @@ -29,7 +29,6 @@ #include "vm/os_thread.h" #include "vm/zone.h" - namespace dart { #ifndef PRODUCT @@ -90,19 +89,16 @@ class PerfCodeObserver : public CodeObserver { DISALLOW_COPY_AND_ASSIGN(PerfCodeObserver); }; - #endif // !PRODUCT const char* OS::Name() { return "linux"; } - intptr_t OS::ProcessId() { return static_cast(getpid()); } - static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) { time_t seconds = static_cast(seconds_since_epoch); if (seconds != seconds_since_epoch) return false; @@ -110,7 +106,6 @@ static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) { return error_code != NULL; } - const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) { tm decomposed; bool succeeded = LocalTime(seconds_since_epoch, &decomposed); @@ -118,7 +113,6 @@ const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) { return (succeeded && (decomposed.tm_zone != NULL)) ? decomposed.tm_zone : ""; } - int OS::GetTimeZoneOffsetInSeconds(int64_t seconds_since_epoch) { tm decomposed; bool succeeded = LocalTime(seconds_since_epoch, &decomposed); @@ -127,7 +121,6 @@ int OS::GetTimeZoneOffsetInSeconds(int64_t seconds_since_epoch) { return succeeded ? static_cast(decomposed.tm_gmtoff) : 0; } - int OS::GetLocalTimeZoneAdjustmentInSeconds() { // TODO(floitsch): avoid excessive calls to tzset? tzset(); @@ -136,12 +129,10 @@ int OS::GetLocalTimeZoneAdjustmentInSeconds() { return static_cast(-timezone); } - int64_t OS::GetCurrentTimeMillis() { return GetCurrentTimeMicros() / 1000; } - int64_t OS::GetCurrentTimeMicros() { // gettimeofday has microsecond resolution. struct timeval tv; @@ -152,7 +143,6 @@ int64_t OS::GetCurrentTimeMicros() { return (static_cast(tv.tv_sec) * 1000000) + tv.tv_usec; } - int64_t OS::GetCurrentMonotonicTicks() { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) { @@ -166,19 +156,16 @@ int64_t OS::GetCurrentMonotonicTicks() { return result; } - int64_t OS::GetCurrentMonotonicFrequency() { return kNanosecondsPerSecond; } - int64_t OS::GetCurrentMonotonicMicros() { int64_t ticks = GetCurrentMonotonicTicks(); ASSERT(GetCurrentMonotonicFrequency() == kNanosecondsPerSecond); return ticks / kNanosecondsPerMicrosecond; } - int64_t OS::GetCurrentThreadCPUMicros() { struct timespec ts; if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) != 0) { @@ -191,7 +178,6 @@ int64_t OS::GetCurrentThreadCPUMicros() { return result; } - // TODO(5411554): May need to hoist these architecture dependent code // into a architecture specific file e.g: os_ia32_linux.cc intptr_t OS::ActivationFrameAlignment() { @@ -212,7 +198,6 @@ intptr_t OS::ActivationFrameAlignment() { return alignment; } - intptr_t OS::PreferredCodeAlignment() { #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \ defined(TARGET_ARCH_ARM64) || defined(TARGET_ARCH_DBC) @@ -232,12 +217,10 @@ intptr_t OS::PreferredCodeAlignment() { return alignment; } - int OS::NumberOfAvailableProcessors() { return sysconf(_SC_NPROCESSORS_ONLN); } - uintptr_t OS::MaxRSS() { struct rusage usage; usage.ru_maxrss = 0; @@ -246,13 +229,11 @@ uintptr_t OS::MaxRSS() { return usage.ru_maxrss * KB; } - void OS::Sleep(int64_t millis) { int64_t micros = millis * kMicrosecondsPerMillisecond; SleepMicros(micros); } - void OS::SleepMicros(int64_t micros) { struct timespec req; // requested. struct timespec rem; // remainder. @@ -273,7 +254,6 @@ void OS::SleepMicros(int64_t micros) { } } - // TODO(regis, iposva): When this function is no longer called from the // CodeImmutability test in object_test.cc, it will be called only from the // simulator, which means that only the Intel implementation is needed. @@ -281,23 +261,19 @@ void OS::DebugBreak() { __builtin_trap(); } - uintptr_t DART_NOINLINE OS::GetProgramCounter() { return reinterpret_cast( __builtin_extract_return_addr(__builtin_return_address(0))); } - char* OS::StrNDup(const char* s, intptr_t n) { return strndup(s, n); } - intptr_t OS::StrNLen(const char* s, intptr_t n) { return strnlen(s, n); } - void OS::Print(const char* format, ...) { va_list args; va_start(args, format); @@ -305,13 +281,11 @@ void OS::Print(const char* format, ...) { va_end(args); } - void OS::VFPrint(FILE* stream, const char* format, va_list args) { vfprintf(stream, format, args); fflush(stream); } - int OS::SNPrint(char* str, size_t size, const char* format, ...) { va_list args; va_start(args, format); @@ -320,7 +294,6 @@ int OS::SNPrint(char* str, size_t size, const char* format, ...) { return retval; } - int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) { MSAN_UNPOISON(str, size); int retval = vsnprintf(str, size, format, args); @@ -330,7 +303,6 @@ int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) { return retval; } - char* OS::SCreate(Zone* zone, const char* format, ...) { va_list args; va_start(args, format); @@ -339,7 +311,6 @@ char* OS::SCreate(Zone* zone, const char* format, ...) { return buffer; } - char* OS::VSCreate(Zone* zone, const char* format, va_list args) { // Measure. va_list measure_args; @@ -363,7 +334,6 @@ char* OS::VSCreate(Zone* zone, const char* format, va_list args) { return buffer; } - bool OS::StringToInt64(const char* str, int64_t* value) { ASSERT(str != NULL && strlen(str) > 0 && value != NULL); int32_t base = 10; @@ -381,7 +351,6 @@ bool OS::StringToInt64(const char* str, int64_t* value) { return ((errno == 0) && (endptr != str) && (*endptr == 0)); } - void OS::RegisterCodeObservers() { #ifndef PRODUCT if (FLAG_generate_perf_events_symbols) { @@ -390,7 +359,6 @@ void OS::RegisterCodeObservers() { #endif // !PRODUCT } - void OS::PrintErr(const char* format, ...) { va_list args; va_start(args, format); @@ -398,7 +366,6 @@ void OS::PrintErr(const char* format, ...) { va_end(args); } - void OS::InitOnce() { // TODO(5411554): For now we check that initonce is called only once, // Once there is more formal mechanism to call InitOnce we can move @@ -408,15 +375,12 @@ void OS::InitOnce() { init_once_called = true; } - void OS::Shutdown() {} - void OS::Abort() { abort(); } - void OS::Exit(int code) { exit(code); } diff --git a/runtime/vm/os_macos.cc b/runtime/vm/os_macos.cc index a358609af28..25e36162a16 100644 --- a/runtime/vm/os_macos.cc +++ b/runtime/vm/os_macos.cc @@ -9,11 +9,11 @@ #include // NOLINT #include // NOLINT -#include // NOLINT #include // NOLINT +#include // NOLINT #include // NOLINT -#include // NOLINT #include // NOLINT +#include // NOLINT #include // NOLINT #if HOST_OS_IOS #include // NOLINT @@ -34,12 +34,10 @@ const char* OS::Name() { #endif } - intptr_t OS::ProcessId() { return static_cast(getpid()); } - static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) { time_t seconds = static_cast(seconds_since_epoch); if (seconds != seconds_since_epoch) return false; @@ -47,7 +45,6 @@ static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) { return error_code != NULL; } - const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) { tm decomposed; bool succeeded = LocalTime(seconds_since_epoch, &decomposed); @@ -55,7 +52,6 @@ const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) { return (succeeded && (decomposed.tm_zone != NULL)) ? decomposed.tm_zone : ""; } - int OS::GetTimeZoneOffsetInSeconds(int64_t seconds_since_epoch) { tm decomposed; bool succeeded = LocalTime(seconds_since_epoch, &decomposed); @@ -64,7 +60,6 @@ int OS::GetTimeZoneOffsetInSeconds(int64_t seconds_since_epoch) { return succeeded ? static_cast(decomposed.tm_gmtoff) : 0; } - int OS::GetLocalTimeZoneAdjustmentInSeconds() { // TODO(floitsch): avoid excessive calls to tzset? tzset(); @@ -73,12 +68,10 @@ int OS::GetLocalTimeZoneAdjustmentInSeconds() { return static_cast(-timezone); } - int64_t OS::GetCurrentTimeMillis() { return GetCurrentTimeMicros() / 1000; } - int64_t OS::GetCurrentTimeMicros() { // gettimeofday has microsecond resolution. struct timeval tv; @@ -89,12 +82,10 @@ int64_t OS::GetCurrentTimeMicros() { return (static_cast(tv.tv_sec) * 1000000) + tv.tv_usec; } - #if !HOST_OS_IOS static mach_timebase_info_data_t timebase_info; #endif - int64_t OS::GetCurrentMonotonicTicks() { #if HOST_OS_IOS // On iOS mach_absolute_time stops while the device is sleeping. Instead use @@ -124,7 +115,6 @@ int64_t OS::GetCurrentMonotonicTicks() { #endif // HOST_OS_IOS } - int64_t OS::GetCurrentMonotonicFrequency() { #if HOST_OS_IOS return kMicrosecondsPerSecond; @@ -133,7 +123,6 @@ int64_t OS::GetCurrentMonotonicFrequency() { #endif // HOST_OS_IOS } - int64_t OS::GetCurrentMonotonicMicros() { #if HOST_OS_IOS ASSERT(GetCurrentMonotonicFrequency() == kMicrosecondsPerSecond); @@ -144,7 +133,6 @@ int64_t OS::GetCurrentMonotonicMicros() { #endif // HOST_OS_IOS } - int64_t OS::GetCurrentThreadCPUMicros() { mach_msg_type_number_t count = THREAD_BASIC_INFO_COUNT; thread_basic_info_data_t info_data; @@ -165,7 +153,6 @@ int64_t OS::GetCurrentThreadCPUMicros() { return thread_cpu_micros; } - intptr_t OS::ActivationFrameAlignment() { #if HOST_OS_IOS #if TARGET_ARCH_ARM @@ -190,7 +177,6 @@ intptr_t OS::ActivationFrameAlignment() { #endif // HOST_OS_IOS } - intptr_t OS::PreferredCodeAlignment() { #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \ defined(TARGET_ARCH_ARM64) || defined(TARGET_ARCH_DBC) @@ -210,12 +196,10 @@ intptr_t OS::PreferredCodeAlignment() { return alignment; } - int OS::NumberOfAvailableProcessors() { return sysconf(_SC_NPROCESSORS_ONLN); } - uintptr_t OS::MaxRSS() { struct rusage usage; usage.ru_maxrss = 0; @@ -224,13 +208,11 @@ uintptr_t OS::MaxRSS() { return usage.ru_maxrss; } - void OS::Sleep(int64_t millis) { int64_t micros = millis * kMicrosecondsPerMillisecond; SleepMicros(micros); } - void OS::SleepMicros(int64_t micros) { struct timespec req; // requested. struct timespec rem; // remainder. @@ -255,18 +237,15 @@ void OS::SleepMicros(int64_t micros) { } } - void OS::DebugBreak() { __builtin_trap(); } - uintptr_t DART_NOINLINE OS::GetProgramCounter() { return reinterpret_cast( __builtin_extract_return_addr(__builtin_return_address(0))); } - char* OS::StrNDup(const char* s, intptr_t n) { // strndup has only been added to Mac OS X in 10.7. We are supplying // our own copy here if needed. @@ -290,7 +269,6 @@ char* OS::StrNDup(const char* s, intptr_t n) { #endif // !defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || ... } - intptr_t OS::StrNLen(const char* s, intptr_t n) { // strnlen has only been added to Mac OS X in 10.7. We are supplying // our own copy here if needed. @@ -307,7 +285,6 @@ intptr_t OS::StrNLen(const char* s, intptr_t n) { #endif // !defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || ... } - void OS::Print(const char* format, ...) { #if HOST_OS_IOS va_list args; @@ -322,13 +299,11 @@ void OS::Print(const char* format, ...) { #endif } - void OS::VFPrint(FILE* stream, const char* format, va_list args) { vfprintf(stream, format, args); fflush(stream); } - int OS::SNPrint(char* str, size_t size, const char* format, ...) { va_list args; va_start(args, format); @@ -337,7 +312,6 @@ int OS::SNPrint(char* str, size_t size, const char* format, ...) { return retval; } - int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) { int retval = vsnprintf(str, size, format, args); if (retval < 0) { @@ -346,7 +320,6 @@ int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) { return retval; } - char* OS::SCreate(Zone* zone, const char* format, ...) { va_list args; va_start(args, format); @@ -355,7 +328,6 @@ char* OS::SCreate(Zone* zone, const char* format, ...) { return buffer; } - char* OS::VSCreate(Zone* zone, const char* format, va_list args) { // Measure. va_list measure_args; @@ -379,7 +351,6 @@ char* OS::VSCreate(Zone* zone, const char* format, va_list args) { return buffer; } - bool OS::StringToInt64(const char* str, int64_t* value) { ASSERT(str != NULL && strlen(str) > 0 && value != NULL); int32_t base = 10; @@ -397,10 +368,8 @@ bool OS::StringToInt64(const char* str, int64_t* value) { return ((errno == 0) && (endptr != str) && (*endptr == 0)); } - void OS::RegisterCodeObservers() {} - void OS::PrintErr(const char* format, ...) { #if HOST_OS_IOS va_list args; @@ -415,7 +384,6 @@ void OS::PrintErr(const char* format, ...) { #endif } - void OS::InitOnce() { // TODO(5411554): For now we check that initonce is called only once, // Once there is more formal mechanism to call InitOnce we can move @@ -440,15 +408,12 @@ void OS::InitOnce() { } } - void OS::Shutdown() {} - void OS::Abort() { abort(); } - void OS::Exit(int code) { exit(code); } diff --git a/runtime/vm/os_test.cc b/runtime/vm/os_test.cc index 2c314176d0d..3967bf0911a 100644 --- a/runtime/vm/os_test.cc +++ b/runtime/vm/os_test.cc @@ -2,10 +2,10 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +#include "vm/os.h" #include "platform/assert.h" #include "platform/utils.h" #include "vm/globals.h" -#include "vm/os.h" #include "vm/unit_test.h" namespace dart { @@ -21,7 +21,6 @@ VM_UNIT_TEST_CASE(Sleep) { EXPECT_LE(delta, sleep_time + kAcceptableSleepWakeupJitter); } - VM_UNIT_TEST_CASE(SNPrint) { char buffer[256]; int length; @@ -38,7 +37,6 @@ VM_UNIT_TEST_CASE(SNPrint) { EXPECT_EQ(3, length); } - // This test is expected to crash when it runs. VM_UNIT_TEST_CASE(SNPrint_BadArgs) { int width = kMaxInt32; @@ -46,7 +44,6 @@ VM_UNIT_TEST_CASE(SNPrint_BadArgs) { OS::SNPrint(NULL, 0, "%*d%*d", width, num, width, num); } - VM_UNIT_TEST_CASE(OsFuncs) { EXPECT(Utils::IsPowerOfTwo(OS::ActivationFrameAlignment())); EXPECT(Utils::IsPowerOfTwo(OS::PreferredCodeAlignment())); diff --git a/runtime/vm/os_thread.cc b/runtime/vm/os_thread.cc index f5818a25444..ca4486af23c 100644 --- a/runtime/vm/os_thread.cc +++ b/runtime/vm/os_thread.cc @@ -19,7 +19,6 @@ OSThread* OSThread::thread_list_head_ = NULL; Mutex* OSThread::thread_list_lock_ = NULL; bool OSThread::creation_enabled_ = false; - OSThread::OSThread() : BaseThread(true), id_(OSThread::GetCurrentThreadId()), @@ -39,7 +38,6 @@ OSThread::OSThread() thread_(NULL) { } - OSThread* OSThread::CreateOSThread() { ASSERT(thread_list_lock_ != NULL); MutexLocker ml(thread_list_lock_); @@ -51,7 +49,6 @@ OSThread* OSThread::CreateOSThread() { return os_thread; } - OSThread::~OSThread() { RemoveThreadFromList(this); delete log_; @@ -66,7 +63,6 @@ OSThread::~OSThread() { free(name_); } - void OSThread::SetName(const char* name) { MutexLocker ml(thread_list_lock_); // Clear the old thread name. @@ -77,13 +73,11 @@ void OSThread::SetName(const char* name) { set_name(name); } - void OSThread::DisableThreadInterrupts() { ASSERT(OSThread::Current() == this); AtomicOperations::FetchAndIncrement(&thread_interrupt_disabled_); } - void OSThread::EnableThreadInterrupts() { ASSERT(OSThread::Current() == this); uintptr_t old = @@ -100,17 +94,14 @@ void OSThread::EnableThreadInterrupts() { } } - bool OSThread::ThreadInterruptsEnabled() { return AtomicOperations::LoadRelaxed(&thread_interrupt_disabled_) == 0; } - static void DeleteThread(void* thread) { delete reinterpret_cast(thread); } - void OSThread::InitOnce() { // Allocate the global OSThread lock. ASSERT(thread_list_lock_ == NULL); @@ -132,7 +123,6 @@ void OSThread::InitOnce() { os_thread->set_name("Dart_Initialize"); } - void OSThread::Cleanup() { // We cannot delete the thread local key and thread list lock, yet. // See the note on thread_list_lock_ in os_thread.h. @@ -151,7 +141,6 @@ void OSThread::Cleanup() { #endif } - OSThread* OSThread::CreateAndSetUnknownThread() { ASSERT(OSThread::GetCurrentTLS() == NULL); OSThread* os_thread = CreateOSThread(); @@ -162,7 +151,6 @@ OSThread* OSThread::CreateAndSetUnknownThread() { return os_thread; } - bool OSThread::IsThreadInList(ThreadId id) { if (id == OSThread::kInvalidThreadId) { return false; @@ -180,25 +168,21 @@ bool OSThread::IsThreadInList(ThreadId id) { return false; } - void OSThread::DisableOSThreadCreation() { MutexLocker ml(thread_list_lock_); creation_enabled_ = false; } - void OSThread::EnableOSThreadCreation() { MutexLocker ml(thread_list_lock_); creation_enabled_ = true; } - OSThread* OSThread::GetOSThreadFromThread(Thread* thread) { ASSERT(thread->os_thread() != NULL); return thread->os_thread(); } - void OSThread::AddThreadToListLocked(OSThread* thread) { ASSERT(thread != NULL); ASSERT(thread_list_lock_ != NULL); @@ -222,7 +206,6 @@ void OSThread::AddThreadToListLocked(OSThread* thread) { thread_list_head_ = thread; } - void OSThread::RemoveThreadFromList(OSThread* thread) { bool final_thread = false; { @@ -256,12 +239,10 @@ void OSThread::RemoveThreadFromList(OSThread* thread) { } } - void OSThread::SetCurrent(OSThread* current) { OSThread::SetThreadLocal(thread_key_, reinterpret_cast(current)); } - OSThreadIterator::OSThreadIterator() { ASSERT(OSThread::thread_list_lock_ != NULL); // Lock the thread list while iterating. @@ -269,21 +250,18 @@ OSThreadIterator::OSThreadIterator() { next_ = OSThread::thread_list_head_; } - OSThreadIterator::~OSThreadIterator() { ASSERT(OSThread::thread_list_lock_ != NULL); // Unlock the thread list when done. OSThread::thread_list_lock_->Unlock(); } - bool OSThreadIterator::HasNext() const { ASSERT(OSThread::thread_list_lock_ != NULL); ASSERT(OSThread::thread_list_lock_->IsOwnedByCurrentThread()); return next_ != NULL; } - OSThread* OSThreadIterator::Next() { ASSERT(OSThread::thread_list_lock_ != NULL); ASSERT(OSThread::thread_list_lock_->IsOwnedByCurrentThread()); diff --git a/runtime/vm/os_thread.h b/runtime/vm/os_thread.h index 48d3b0c0e85..b7f70d0a035 100644 --- a/runtime/vm/os_thread.h +++ b/runtime/vm/os_thread.h @@ -48,7 +48,6 @@ class BaseThread { DISALLOW_IMPLICIT_CONSTRUCTORS(BaseThread); }; - // Low-level operations on OS platform threads. class OSThread : public BaseThread { public: @@ -255,7 +254,6 @@ class OSThread : public BaseThread { friend class ThreadInterrupterFuchsia; }; - // Note that this takes the thread list lock, prohibiting threads from coming // on- or off-line. class OSThreadIterator : public ValueObject { @@ -273,7 +271,6 @@ class OSThreadIterator : public ValueObject { OSThread* next_; }; - class Mutex { public: Mutex(); @@ -311,7 +308,6 @@ class Mutex { DISALLOW_COPY_AND_ASSIGN(Mutex); }; - class Monitor { public: enum WaitResult { kNotified, kTimedOut }; @@ -356,8 +352,6 @@ class Monitor { DISALLOW_COPY_AND_ASSIGN(Monitor); }; - } // namespace dart - #endif // RUNTIME_VM_OS_THREAD_H_ diff --git a/runtime/vm/os_thread_android.cc b/runtime/vm/os_thread_android.cc index 36f910bf7da..dc09b5eea93 100644 --- a/runtime/vm/os_thread_android.cc +++ b/runtime/vm/os_thread_android.cc @@ -4,7 +4,6 @@ #include "platform/globals.h" // NOLINT - #if defined(HOST_OS_ANDROID) #include "vm/os_thread.h" @@ -29,7 +28,6 @@ namespace dart { FATAL2("pthread error: %d (%s)", result, error_message); \ } - #if defined(DEBUG) #define ASSERT_PTHREAD_SUCCESS(result) VALIDATE_PTHREAD_RESULT(result) #else @@ -37,7 +35,6 @@ namespace dart { #define ASSERT_PTHREAD_SUCCESS(result) ASSERT(result == 0) #endif - #ifdef DEBUG #define RETURN_ON_PTHREAD_FAILURE(result) \ if (result != 0) { \ @@ -53,7 +50,6 @@ namespace dart { if (result != 0) return result; #endif - static void ComputeTimeSpecMicros(struct timespec* ts, int64_t micros) { struct timeval tv; int64_t secs = micros / kMicrosecondsPerSecond; @@ -68,7 +64,6 @@ static void ComputeTimeSpecMicros(struct timespec* ts, int64_t micros) { } } - class ThreadStartData { public: ThreadStartData(const char* name, @@ -88,7 +83,6 @@ class ThreadStartData { DISALLOW_COPY_AND_ASSIGN(ThreadStartData); }; - // Spawned threads inherit their spawner's signal mask. We sometimes spawn // threads for running Dart code from a thread that is blocking SIGPROF. // This function explicitly unblocks SIGPROF so the profiler continues to @@ -103,7 +97,6 @@ static void UnblockSIGPROF() { ASSERT(!CHECK_IS_BLOCKING(SIGPROF)); } - // Dispatch to the thread start function provided by the caller. This trampoline // is used to ensure that the thread is properly destroyed if the thread just // exits. @@ -128,7 +121,6 @@ static void* ThreadStart(void* data_ptr) { return NULL; } - int OSThread::Start(const char* name, ThreadStartFunction function, uword parameter) { @@ -151,12 +143,10 @@ int OSThread::Start(const char* name, return 0; } - const ThreadId OSThread::kInvalidThreadId = static_cast(0); const ThreadJoinId OSThread::kInvalidThreadJoinId = static_cast(0); - ThreadLocalKey OSThread::CreateThreadLocal(ThreadDestructor destructor) { pthread_key_t key = kUnsetThreadLocalKey; int result = pthread_key_create(&key, destructor); @@ -165,39 +155,33 @@ ThreadLocalKey OSThread::CreateThreadLocal(ThreadDestructor destructor) { return key; } - void OSThread::DeleteThreadLocal(ThreadLocalKey key) { ASSERT(key != kUnsetThreadLocalKey); int result = pthread_key_delete(key); VALIDATE_PTHREAD_RESULT(result); } - void OSThread::SetThreadLocal(ThreadLocalKey key, uword value) { ASSERT(key != kUnsetThreadLocalKey); int result = pthread_setspecific(key, reinterpret_cast(value)); VALIDATE_PTHREAD_RESULT(result); } - intptr_t OSThread::GetMaxStackSize() { const int kStackSize = (128 * kWordSize * KB); return kStackSize; } - ThreadId OSThread::GetCurrentThreadId() { return gettid(); } - #ifndef PRODUCT ThreadId OSThread::GetCurrentThreadTraceId() { return GetCurrentThreadId(); } #endif // PRODUCT - ThreadJoinId OSThread::GetCurrentThreadJoinId(OSThread* thread) { ASSERT(thread != NULL); // Make sure we're filling in the join id for the current thread. @@ -211,29 +195,24 @@ ThreadJoinId OSThread::GetCurrentThreadJoinId(OSThread* thread) { return id; } - void OSThread::Join(ThreadJoinId id) { int result = pthread_join(id, NULL); ASSERT(result == 0); } - intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) { ASSERT(sizeof(id) == sizeof(intptr_t)); return static_cast(id); } - ThreadId OSThread::ThreadIdFromIntPtr(intptr_t id) { return static_cast(id); } - bool OSThread::Compare(ThreadId a, ThreadId b) { return a == b; } - bool OSThread::GetCurrentStackBounds(uword* lower, uword* upper) { pthread_attr_t attr; if (pthread_getattr_np(pthread_self(), &attr)) { @@ -253,7 +232,6 @@ bool OSThread::GetCurrentStackBounds(uword* lower, uword* upper) { return true; } - Mutex::Mutex() { pthread_mutexattr_t attr; int result = pthread_mutexattr_init(&attr); @@ -277,7 +255,6 @@ Mutex::Mutex() { #endif // defined(DEBUG) } - Mutex::~Mutex() { int result = pthread_mutex_destroy(data_.mutex()); // Verify that the pthread_mutex was destroyed. @@ -289,7 +266,6 @@ Mutex::~Mutex() { #endif // defined(DEBUG) } - void Mutex::Lock() { int result = pthread_mutex_lock(data_.mutex()); // Specifically check for dead lock to help debugging. @@ -301,7 +277,6 @@ void Mutex::Lock() { #endif // defined(DEBUG) } - bool Mutex::TryLock() { int result = pthread_mutex_trylock(data_.mutex()); // Return false if the lock is busy and locking failed. @@ -316,7 +291,6 @@ bool Mutex::TryLock() { return true; } - void Mutex::Unlock() { #if defined(DEBUG) // When running with assertions enabled we do track the owner. @@ -329,7 +303,6 @@ void Mutex::Unlock() { ASSERT_PTHREAD_SUCCESS(result); // Verify no other errors. } - Monitor::Monitor() { pthread_mutexattr_t mutex_attr; int result = pthread_mutexattr_init(&mutex_attr); @@ -362,7 +335,6 @@ Monitor::Monitor() { #endif // defined(DEBUG) } - Monitor::~Monitor() { #if defined(DEBUG) // When running with assertions enabled we track the owner. @@ -376,7 +348,6 @@ Monitor::~Monitor() { VALIDATE_PTHREAD_RESULT(result); } - bool Monitor::TryEnter() { int result = pthread_mutex_trylock(data_.mutex()); // Return false if the lock is busy and locking failed. @@ -392,7 +363,6 @@ bool Monitor::TryEnter() { return true; } - void Monitor::Enter() { int result = pthread_mutex_lock(data_.mutex()); VALIDATE_PTHREAD_RESULT(result); @@ -404,7 +374,6 @@ void Monitor::Enter() { #endif // defined(DEBUG) } - void Monitor::Exit() { #if defined(DEBUG) // When running with assertions enabled we track the owner. @@ -416,12 +385,10 @@ void Monitor::Exit() { VALIDATE_PTHREAD_RESULT(result); } - Monitor::WaitResult Monitor::Wait(int64_t millis) { return WaitMicros(millis * kMicrosecondsPerMillisecond); } - Monitor::WaitResult Monitor::WaitMicros(int64_t micros) { #if defined(DEBUG) // When running with assertions enabled we track the owner. @@ -454,7 +421,6 @@ Monitor::WaitResult Monitor::WaitMicros(int64_t micros) { return retval; } - void Monitor::Notify() { // When running with assertions enabled we track the owner. ASSERT(IsOwnedByCurrentThread()); @@ -462,7 +428,6 @@ void Monitor::Notify() { VALIDATE_PTHREAD_RESULT(result); } - void Monitor::NotifyAll() { // When running with assertions enabled we track the owner. ASSERT(IsOwnedByCurrentThread()); diff --git a/runtime/vm/os_thread_android.h b/runtime/vm/os_thread_android.h index 095471226d5..9e2e0d04a8a 100644 --- a/runtime/vm/os_thread_android.h +++ b/runtime/vm/os_thread_android.h @@ -20,11 +20,9 @@ typedef pthread_key_t ThreadLocalKey; typedef pid_t ThreadId; typedef pthread_t ThreadJoinId; - static const ThreadLocalKey kUnsetThreadLocalKey = static_cast(-1); - class ThreadInlineImpl { private: ThreadInlineImpl() {} @@ -41,7 +39,6 @@ class ThreadInlineImpl { DISALLOW_COPY_AND_ASSIGN(ThreadInlineImpl); }; - class MutexData { private: MutexData() {} @@ -57,7 +54,6 @@ class MutexData { DISALLOW_COPY_AND_ASSIGN(MutexData); }; - class MonitorData { private: MonitorData() {} diff --git a/runtime/vm/os_thread_fuchsia.cc b/runtime/vm/os_thread_fuchsia.cc index 5a94f4752e9..2deaa933b0b 100644 --- a/runtime/vm/os_thread_fuchsia.cc +++ b/runtime/vm/os_thread_fuchsia.cc @@ -25,7 +25,6 @@ namespace dart { FATAL1("pthread error: %d", result); \ } - #if defined(DEBUG) #define ASSERT_PTHREAD_SUCCESS(result) VALIDATE_PTHREAD_RESULT(result) #else @@ -33,7 +32,6 @@ namespace dart { #define ASSERT_PTHREAD_SUCCESS(result) ASSERT(result == 0) #endif - #ifdef DEBUG #define RETURN_ON_PTHREAD_FAILURE(result) \ if (result != 0) { \ @@ -45,7 +43,6 @@ namespace dart { if (result != 0) return result; #endif - static void ComputeTimeSpecMicros(struct timespec* ts, int64_t micros) { // time in nanoseconds. mx_time_t now = mx_time_get(MX_CLOCK_MONOTONIC); @@ -57,7 +54,6 @@ static void ComputeTimeSpecMicros(struct timespec* ts, int64_t micros) { ts->tv_nsec = nanos; } - class ThreadStartData { public: ThreadStartData(const char* name, @@ -77,7 +73,6 @@ class ThreadStartData { DISALLOW_COPY_AND_ASSIGN(ThreadStartData); }; - // Dispatch to the thread start function provided by the caller. This trampoline // is used to ensure that the thread is properly destroyed if the thread just // exits. @@ -101,7 +96,6 @@ static void* ThreadStart(void* data_ptr) { return NULL; } - int OSThread::Start(const char* name, ThreadStartFunction function, uword parameter) { @@ -124,12 +118,10 @@ int OSThread::Start(const char* name, return 0; } - const ThreadId OSThread::kInvalidThreadId = MX_KOID_INVALID; const ThreadJoinId OSThread::kInvalidThreadJoinId = static_cast(0); - ThreadLocalKey OSThread::CreateThreadLocal(ThreadDestructor destructor) { pthread_key_t key = kUnsetThreadLocalKey; int result = pthread_key_create(&key, destructor); @@ -138,27 +130,23 @@ ThreadLocalKey OSThread::CreateThreadLocal(ThreadDestructor destructor) { return key; } - void OSThread::DeleteThreadLocal(ThreadLocalKey key) { ASSERT(key != kUnsetThreadLocalKey); int result = pthread_key_delete(key); VALIDATE_PTHREAD_RESULT(result); } - void OSThread::SetThreadLocal(ThreadLocalKey key, uword value) { ASSERT(key != kUnsetThreadLocalKey); int result = pthread_setspecific(key, reinterpret_cast(value)); VALIDATE_PTHREAD_RESULT(result); } - intptr_t OSThread::GetMaxStackSize() { const int kStackSize = (128 * kWordSize * KB); return kStackSize; } - ThreadId OSThread::GetCurrentThreadId() { mx_info_handle_basic_t info; mx_handle_t thread_handle = thrd_get_mx_handle(thrd_current()); @@ -171,14 +159,12 @@ ThreadId OSThread::GetCurrentThreadId() { return info.koid; } - #ifndef PRODUCT ThreadId OSThread::GetCurrentThreadTraceId() { return pthread_self(); } #endif // PRODUCT - ThreadJoinId OSThread::GetCurrentThreadJoinId(OSThread* thread) { ASSERT(thread != NULL); // Make sure we're filling in the join id for the current thread. @@ -192,34 +178,28 @@ ThreadJoinId OSThread::GetCurrentThreadJoinId(OSThread* thread) { return id; } - void OSThread::Join(ThreadJoinId id) { int result = pthread_join(id, NULL); ASSERT(result == 0); } - intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) { ASSERT(sizeof(id) == sizeof(intptr_t)); return static_cast(id); } - ThreadId OSThread::ThreadIdFromIntPtr(intptr_t id) { return static_cast(id); } - bool OSThread::Compare(ThreadId a, ThreadId b) { return pthread_equal(a, b) != 0; } - bool OSThread::GetCurrentStackBounds(uword* lower, uword* upper) { return false; } - Mutex::Mutex() { pthread_mutexattr_t attr; int result = pthread_mutexattr_init(&attr); @@ -243,7 +223,6 @@ Mutex::Mutex() { #endif // defined(DEBUG) } - Mutex::~Mutex() { int result = pthread_mutex_destroy(data_.mutex()); // Verify that the pthread_mutex was destroyed. @@ -255,7 +234,6 @@ Mutex::~Mutex() { #endif // defined(DEBUG) } - void Mutex::Lock() { int result = pthread_mutex_lock(data_.mutex()); // Specifically check for dead lock to help debugging. @@ -267,7 +245,6 @@ void Mutex::Lock() { #endif // defined(DEBUG) } - bool Mutex::TryLock() { int result = pthread_mutex_trylock(data_.mutex()); // Return false if the lock is busy and locking failed. @@ -282,7 +259,6 @@ bool Mutex::TryLock() { return true; } - void Mutex::Unlock() { #if defined(DEBUG) // When running with assertions enabled we track the owner. @@ -295,7 +271,6 @@ void Mutex::Unlock() { ASSERT_PTHREAD_SUCCESS(result); // Verify no other errors. } - Monitor::Monitor() { pthread_mutexattr_t mutex_attr; int result = pthread_mutexattr_init(&mutex_attr); @@ -331,7 +306,6 @@ Monitor::Monitor() { #endif // defined(DEBUG) } - Monitor::~Monitor() { #if defined(DEBUG) // When running with assertions enabled we track the owner. @@ -345,7 +319,6 @@ Monitor::~Monitor() { VALIDATE_PTHREAD_RESULT(result); } - bool Monitor::TryEnter() { int result = pthread_mutex_trylock(data_.mutex()); // Return false if the lock is busy and locking failed. @@ -361,7 +334,6 @@ bool Monitor::TryEnter() { return true; } - void Monitor::Enter() { int result = pthread_mutex_lock(data_.mutex()); VALIDATE_PTHREAD_RESULT(result); @@ -373,7 +345,6 @@ void Monitor::Enter() { #endif // defined(DEBUG) } - void Monitor::Exit() { #if defined(DEBUG) // When running with assertions enabled we track the owner. @@ -385,13 +356,11 @@ void Monitor::Exit() { VALIDATE_PTHREAD_RESULT(result); } - Monitor::WaitResult Monitor::Wait(int64_t millis) { Monitor::WaitResult retval = WaitMicros(millis * kMicrosecondsPerMillisecond); return retval; } - Monitor::WaitResult Monitor::WaitMicros(int64_t micros) { #if defined(DEBUG) // When running with assertions enabled we track the owner. @@ -424,7 +393,6 @@ Monitor::WaitResult Monitor::WaitMicros(int64_t micros) { return retval; } - void Monitor::Notify() { // When running with assertions enabled we track the owner. ASSERT(IsOwnedByCurrentThread()); @@ -432,7 +400,6 @@ void Monitor::Notify() { VALIDATE_PTHREAD_RESULT(result); } - void Monitor::NotifyAll() { // When running with assertions enabled we track the owner. ASSERT(IsOwnedByCurrentThread()); diff --git a/runtime/vm/os_thread_fuchsia.h b/runtime/vm/os_thread_fuchsia.h index 713e08ab002..5a50bc4160c 100644 --- a/runtime/vm/os_thread_fuchsia.h +++ b/runtime/vm/os_thread_fuchsia.h @@ -21,11 +21,9 @@ typedef pthread_key_t ThreadLocalKey; typedef mx_koid_t ThreadId; typedef pthread_t ThreadJoinId; - static const ThreadLocalKey kUnsetThreadLocalKey = static_cast(-1); - class ThreadInlineImpl { private: ThreadInlineImpl() {} @@ -42,7 +40,6 @@ class ThreadInlineImpl { DISALLOW_COPY_AND_ASSIGN(ThreadInlineImpl); }; - class MutexData { private: MutexData() {} @@ -58,7 +55,6 @@ class MutexData { DISALLOW_COPY_AND_ASSIGN(MutexData); }; - class MonitorData { private: MonitorData() {} diff --git a/runtime/vm/os_thread_linux.cc b/runtime/vm/os_thread_linux.cc index 60e33229ce4..3b5239da5f6 100644 --- a/runtime/vm/os_thread_linux.cc +++ b/runtime/vm/os_thread_linux.cc @@ -30,7 +30,6 @@ namespace dart { Utils::StrError(result, error_buf, kBufferSize)); \ } - #if defined(DEBUG) #define ASSERT_PTHREAD_SUCCESS(result) VALIDATE_PTHREAD_RESULT(result) #else @@ -38,7 +37,6 @@ namespace dart { #define ASSERT_PTHREAD_SUCCESS(result) ASSERT(result == 0) #endif - #ifdef DEBUG #define RETURN_ON_PTHREAD_FAILURE(result) \ if (result != 0) { \ @@ -53,7 +51,6 @@ namespace dart { if (result != 0) return result; #endif - static void ComputeTimeSpecMicros(struct timespec* ts, int64_t micros) { int64_t secs = micros / kMicrosecondsPerSecond; int64_t nanos = @@ -68,7 +65,6 @@ static void ComputeTimeSpecMicros(struct timespec* ts, int64_t micros) { } } - class ThreadStartData { public: ThreadStartData(const char* name, @@ -88,7 +84,6 @@ class ThreadStartData { DISALLOW_COPY_AND_ASSIGN(ThreadStartData); }; - // Spawned threads inherit their spawner's signal mask. We sometimes spawn // threads for running Dart code from a thread that is blocking SIGPROF. // This function explicitly unblocks SIGPROF so the profiler continues to @@ -103,7 +98,6 @@ static void UnblockSIGPROF() { ASSERT(!CHECK_IS_BLOCKING(SIGPROF)); } - // Dispatch to the thread start function provided by the caller. This trampoline // is used to ensure that the thread is properly destroyed if the thread just // exits. @@ -128,7 +122,6 @@ static void* ThreadStart(void* data_ptr) { return NULL; } - int OSThread::Start(const char* name, ThreadStartFunction function, uword parameter) { @@ -151,12 +144,10 @@ int OSThread::Start(const char* name, return 0; } - const ThreadId OSThread::kInvalidThreadId = static_cast(0); const ThreadJoinId OSThread::kInvalidThreadJoinId = static_cast(0); - ThreadLocalKey OSThread::CreateThreadLocal(ThreadDestructor destructor) { pthread_key_t key = kUnsetThreadLocalKey; int result = pthread_key_create(&key, destructor); @@ -165,39 +156,33 @@ ThreadLocalKey OSThread::CreateThreadLocal(ThreadDestructor destructor) { return key; } - void OSThread::DeleteThreadLocal(ThreadLocalKey key) { ASSERT(key != kUnsetThreadLocalKey); int result = pthread_key_delete(key); VALIDATE_PTHREAD_RESULT(result); } - void OSThread::SetThreadLocal(ThreadLocalKey key, uword value) { ASSERT(key != kUnsetThreadLocalKey); int result = pthread_setspecific(key, reinterpret_cast(value)); VALIDATE_PTHREAD_RESULT(result); } - intptr_t OSThread::GetMaxStackSize() { const int kStackSize = (128 * kWordSize * KB); return kStackSize; } - ThreadId OSThread::GetCurrentThreadId() { return pthread_self(); } - #ifndef PRODUCT ThreadId OSThread::GetCurrentThreadTraceId() { return syscall(__NR_gettid); } #endif // PRODUCT - ThreadJoinId OSThread::GetCurrentThreadJoinId(OSThread* thread) { ASSERT(thread != NULL); // Make sure we're filling in the join id for the current thread. @@ -211,29 +196,24 @@ ThreadJoinId OSThread::GetCurrentThreadJoinId(OSThread* thread) { return id; } - void OSThread::Join(ThreadJoinId id) { int result = pthread_join(id, NULL); ASSERT(result == 0); } - intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) { ASSERT(sizeof(id) == sizeof(intptr_t)); return static_cast(id); } - ThreadId OSThread::ThreadIdFromIntPtr(intptr_t id) { return static_cast(id); } - bool OSThread::Compare(ThreadId a, ThreadId b) { return pthread_equal(a, b) != 0; } - bool OSThread::GetCurrentStackBounds(uword* lower, uword* upper) { pthread_attr_t attr; if (pthread_getattr_np(pthread_self(), &attr)) { @@ -253,7 +233,6 @@ bool OSThread::GetCurrentStackBounds(uword* lower, uword* upper) { return true; } - Mutex::Mutex() { pthread_mutexattr_t attr; int result = pthread_mutexattr_init(&attr); @@ -277,7 +256,6 @@ Mutex::Mutex() { #endif // defined(DEBUG) } - Mutex::~Mutex() { int result = pthread_mutex_destroy(data_.mutex()); // Verify that the pthread_mutex was destroyed. @@ -289,7 +267,6 @@ Mutex::~Mutex() { #endif // defined(DEBUG) } - void Mutex::Lock() { int result = pthread_mutex_lock(data_.mutex()); // Specifically check for dead lock to help debugging. @@ -301,7 +278,6 @@ void Mutex::Lock() { #endif // defined(DEBUG) } - bool Mutex::TryLock() { int result = pthread_mutex_trylock(data_.mutex()); // Return false if the lock is busy and locking failed. @@ -316,7 +292,6 @@ bool Mutex::TryLock() { return true; } - void Mutex::Unlock() { #if defined(DEBUG) // When running with assertions enabled we track the owner. @@ -329,7 +304,6 @@ void Mutex::Unlock() { ASSERT_PTHREAD_SUCCESS(result); // Verify no other errors. } - Monitor::Monitor() { pthread_mutexattr_t mutex_attr; int result = pthread_mutexattr_init(&mutex_attr); @@ -365,7 +339,6 @@ Monitor::Monitor() { #endif // defined(DEBUG) } - Monitor::~Monitor() { #if defined(DEBUG) // When running with assertions enabled we track the owner. @@ -379,7 +352,6 @@ Monitor::~Monitor() { VALIDATE_PTHREAD_RESULT(result); } - bool Monitor::TryEnter() { int result = pthread_mutex_trylock(data_.mutex()); // Return false if the lock is busy and locking failed. @@ -395,7 +367,6 @@ bool Monitor::TryEnter() { return true; } - void Monitor::Enter() { int result = pthread_mutex_lock(data_.mutex()); VALIDATE_PTHREAD_RESULT(result); @@ -407,7 +378,6 @@ void Monitor::Enter() { #endif // defined(DEBUG) } - void Monitor::Exit() { #if defined(DEBUG) // When running with assertions enabled we track the owner. @@ -419,13 +389,11 @@ void Monitor::Exit() { VALIDATE_PTHREAD_RESULT(result); } - Monitor::WaitResult Monitor::Wait(int64_t millis) { Monitor::WaitResult retval = WaitMicros(millis * kMicrosecondsPerMillisecond); return retval; } - Monitor::WaitResult Monitor::WaitMicros(int64_t micros) { #if defined(DEBUG) // When running with assertions enabled we track the owner. @@ -458,7 +426,6 @@ Monitor::WaitResult Monitor::WaitMicros(int64_t micros) { return retval; } - void Monitor::Notify() { // When running with assertions enabled we track the owner. ASSERT(IsOwnedByCurrentThread()); @@ -466,7 +433,6 @@ void Monitor::Notify() { VALIDATE_PTHREAD_RESULT(result); } - void Monitor::NotifyAll() { // When running with assertions enabled we track the owner. ASSERT(IsOwnedByCurrentThread()); diff --git a/runtime/vm/os_thread_linux.h b/runtime/vm/os_thread_linux.h index 4ee247351b8..9acc2e394fd 100644 --- a/runtime/vm/os_thread_linux.h +++ b/runtime/vm/os_thread_linux.h @@ -20,11 +20,9 @@ typedef pthread_key_t ThreadLocalKey; typedef pthread_t ThreadId; typedef pthread_t ThreadJoinId; - static const ThreadLocalKey kUnsetThreadLocalKey = static_cast(-1); - class ThreadInlineImpl { private: ThreadInlineImpl() {} @@ -41,7 +39,6 @@ class ThreadInlineImpl { DISALLOW_COPY_AND_ASSIGN(ThreadInlineImpl); }; - class MutexData { private: MutexData() {} @@ -57,7 +54,6 @@ class MutexData { DISALLOW_COPY_AND_ASSIGN(MutexData); }; - class MonitorData { private: MonitorData() {} diff --git a/runtime/vm/os_thread_macos.cc b/runtime/vm/os_thread_macos.cc index 67b18513c38..ec7b3942fa9 100644 --- a/runtime/vm/os_thread_macos.cc +++ b/runtime/vm/os_thread_macos.cc @@ -7,16 +7,16 @@ #include "vm/os_thread.h" -#include // NOLINT -#include // NOLINT -#include // NOLINT -#include // NOLINT #include // NOLINT +#include // NOLINT #include // NOLINT #include // NOLINT #include // NOLINT -#include // NOLINT #include // NOLINT +#include // NOLINT +#include // NOLINT +#include // NOLINT +#include // NOLINT #include "platform/assert.h" #include "platform/utils.h" @@ -34,7 +34,6 @@ namespace dart { FATAL2("pthread error: %d (%s)", result, error_message); \ } - #if defined(DEBUG) #define ASSERT_PTHREAD_SUCCESS(result) VALIDATE_PTHREAD_RESULT(result) #else @@ -42,7 +41,6 @@ namespace dart { #define ASSERT_PTHREAD_SUCCESS(result) ASSERT(result == 0) #endif - #ifdef DEBUG #define RETURN_ON_PTHREAD_FAILURE(result) \ if (result != 0) { \ @@ -58,7 +56,6 @@ namespace dart { if (result != 0) return result; #endif - class ThreadStartData { public: ThreadStartData(const char* name, @@ -78,7 +75,6 @@ class ThreadStartData { DISALLOW_COPY_AND_ASSIGN(ThreadStartData); }; - // Dispatch to the thread start function provided by the caller. This trampoline // is used to ensure that the thread is properly destroyed if the thread just // exits. @@ -103,7 +99,6 @@ static void* ThreadStart(void* data_ptr) { return NULL; } - int OSThread::Start(const char* name, ThreadStartFunction function, uword parameter) { @@ -126,12 +121,10 @@ int OSThread::Start(const char* name, return 0; } - const ThreadId OSThread::kInvalidThreadId = reinterpret_cast(NULL); const ThreadJoinId OSThread::kInvalidThreadJoinId = reinterpret_cast(NULL); - ThreadLocalKey OSThread::CreateThreadLocal(ThreadDestructor destructor) { pthread_key_t key = kUnsetThreadLocalKey; int result = pthread_key_create(&key, destructor); @@ -140,39 +133,33 @@ ThreadLocalKey OSThread::CreateThreadLocal(ThreadDestructor destructor) { return key; } - void OSThread::DeleteThreadLocal(ThreadLocalKey key) { ASSERT(key != kUnsetThreadLocalKey); int result = pthread_key_delete(key); VALIDATE_PTHREAD_RESULT(result); } - void OSThread::SetThreadLocal(ThreadLocalKey key, uword value) { ASSERT(key != kUnsetThreadLocalKey); int result = pthread_setspecific(key, reinterpret_cast(value)); VALIDATE_PTHREAD_RESULT(result); } - intptr_t OSThread::GetMaxStackSize() { const int kStackSize = (128 * kWordSize * KB); return kStackSize; } - ThreadId OSThread::GetCurrentThreadId() { return pthread_self(); } - #ifndef PRODUCT ThreadId OSThread::GetCurrentThreadTraceId() { return ThreadIdFromIntPtr(pthread_mach_thread_np(pthread_self())); } #endif // PRODUCT - ThreadJoinId OSThread::GetCurrentThreadJoinId(OSThread* thread) { ASSERT(thread != NULL); // Make sure we're filling in the join id for the current thread. @@ -186,36 +173,30 @@ ThreadJoinId OSThread::GetCurrentThreadJoinId(OSThread* thread) { return id; } - void OSThread::Join(ThreadJoinId id) { int result = pthread_join(id, NULL); ASSERT(result == 0); } - intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) { ASSERT(sizeof(id) == sizeof(intptr_t)); return reinterpret_cast(id); } - ThreadId OSThread::ThreadIdFromIntPtr(intptr_t id) { return reinterpret_cast(id); } - bool OSThread::Compare(ThreadId a, ThreadId b) { return pthread_equal(a, b) != 0; } - bool OSThread::GetCurrentStackBounds(uword* lower, uword* upper) { *upper = reinterpret_cast(pthread_get_stackaddr_np(pthread_self())); *lower = *upper - pthread_get_stacksize_np(pthread_self()); return true; } - Mutex::Mutex() { pthread_mutexattr_t attr; int result = pthread_mutexattr_init(&attr); @@ -239,7 +220,6 @@ Mutex::Mutex() { #endif // defined(DEBUG) } - Mutex::~Mutex() { int result = pthread_mutex_destroy(data_.mutex()); // Verify that the pthread_mutex was destroyed. @@ -251,7 +231,6 @@ Mutex::~Mutex() { #endif // defined(DEBUG) } - void Mutex::Lock() { int result = pthread_mutex_lock(data_.mutex()); // Specifically check for dead lock to help debugging. @@ -263,7 +242,6 @@ void Mutex::Lock() { #endif // defined(DEBUG) } - bool Mutex::TryLock() { int result = pthread_mutex_trylock(data_.mutex()); // Return false if the lock is busy and locking failed. @@ -278,7 +256,6 @@ bool Mutex::TryLock() { return true; } - void Mutex::Unlock() { #if defined(DEBUG) // When running with assertions enabled we do track the owner. @@ -291,7 +268,6 @@ void Mutex::Unlock() { ASSERT_PTHREAD_SUCCESS(result); // Verify no other errors. } - Monitor::Monitor() { pthread_mutexattr_t attr; int result = pthread_mutexattr_init(&attr); @@ -317,7 +293,6 @@ Monitor::Monitor() { #endif // defined(DEBUG) } - Monitor::~Monitor() { #if defined(DEBUG) // When running with assertions enabled we track the owner. @@ -331,7 +306,6 @@ Monitor::~Monitor() { VALIDATE_PTHREAD_RESULT(result); } - bool Monitor::TryEnter() { int result = pthread_mutex_trylock(data_.mutex()); // Return false if the lock is busy and locking failed. @@ -347,7 +321,6 @@ bool Monitor::TryEnter() { return true; } - void Monitor::Enter() { int result = pthread_mutex_lock(data_.mutex()); VALIDATE_PTHREAD_RESULT(result); @@ -359,7 +332,6 @@ void Monitor::Enter() { #endif // defined(DEBUG) } - void Monitor::Exit() { #if defined(DEBUG) // When running with assertions enabled we track the owner. @@ -371,12 +343,10 @@ void Monitor::Exit() { VALIDATE_PTHREAD_RESULT(result); } - Monitor::WaitResult Monitor::Wait(int64_t millis) { return WaitMicros(millis * kMicrosecondsPerMillisecond); } - Monitor::WaitResult Monitor::WaitMicros(int64_t micros) { #if defined(DEBUG) // When running with assertions enabled we track the owner. @@ -418,7 +388,6 @@ Monitor::WaitResult Monitor::WaitMicros(int64_t micros) { return retval; } - void Monitor::Notify() { // When running with assertions enabled we track the owner. ASSERT(IsOwnedByCurrentThread()); @@ -426,7 +395,6 @@ void Monitor::Notify() { VALIDATE_PTHREAD_RESULT(result); } - void Monitor::NotifyAll() { // When running with assertions enabled we track the owner. ASSERT(IsOwnedByCurrentThread()); diff --git a/runtime/vm/os_thread_macos.h b/runtime/vm/os_thread_macos.h index 2a2fcf5be10..9b053d0a32b 100644 --- a/runtime/vm/os_thread_macos.h +++ b/runtime/vm/os_thread_macos.h @@ -20,11 +20,9 @@ typedef pthread_key_t ThreadLocalKey; typedef pthread_t ThreadId; typedef pthread_t ThreadJoinId; - static const ThreadLocalKey kUnsetThreadLocalKey = static_cast(-1); - class ThreadInlineImpl { private: ThreadInlineImpl() {} @@ -42,7 +40,6 @@ class ThreadInlineImpl { DISALLOW_COPY_AND_ASSIGN(ThreadInlineImpl); }; - class MutexData { private: MutexData() {} @@ -58,7 +55,6 @@ class MutexData { DISALLOW_COPY_AND_ASSIGN(MutexData); }; - class MonitorData { private: MonitorData() {} diff --git a/runtime/vm/os_thread_win.cc b/runtime/vm/os_thread_win.cc index 1c158352135..dcd44eabe77 100644 --- a/runtime/vm/os_thread_win.cc +++ b/runtime/vm/os_thread_win.cc @@ -38,7 +38,6 @@ class ThreadStartData { DISALLOW_COPY_AND_ASSIGN(ThreadStartData); }; - // Dispatch to the thread start function provided by the caller. This trampoline // is used to ensure that the thread is properly destroyed if the thread just // exits. @@ -68,7 +67,6 @@ static unsigned int __stdcall ThreadEntry(void* data_ptr) { return 0; } - int OSThread::Start(const char* name, ThreadStartFunction function, uword parameter) { @@ -89,11 +87,9 @@ int OSThread::Start(const char* name, return 0; } - const ThreadId OSThread::kInvalidThreadId = 0; const ThreadJoinId OSThread::kInvalidThreadJoinId = NULL; - ThreadLocalKey OSThread::CreateThreadLocal(ThreadDestructor destructor) { ThreadLocalKey key = TlsAlloc(); if (key == kUnsetThreadLocalKey) { @@ -103,7 +99,6 @@ ThreadLocalKey OSThread::CreateThreadLocal(ThreadDestructor destructor) { return key; } - void OSThread::DeleteThreadLocal(ThreadLocalKey key) { ASSERT(key != kUnsetThreadLocalKey); BOOL result = TlsFree(key); @@ -113,25 +108,21 @@ void OSThread::DeleteThreadLocal(ThreadLocalKey key) { ThreadLocalData::RemoveThreadLocal(key); } - intptr_t OSThread::GetMaxStackSize() { const int kStackSize = (128 * kWordSize * KB); return kStackSize; } - ThreadId OSThread::GetCurrentThreadId() { return ::GetCurrentThreadId(); } - #ifndef PRODUCT ThreadId OSThread::GetCurrentThreadTraceId() { return ::GetCurrentThreadId(); } #endif // PRODUCT - ThreadJoinId OSThread::GetCurrentThreadJoinId(OSThread* thread) { ASSERT(thread != NULL); // Make sure we're filling in the join id for the current thread. @@ -147,7 +138,6 @@ ThreadJoinId OSThread::GetCurrentThreadJoinId(OSThread* thread) { return handle; } - void OSThread::Join(ThreadJoinId id) { HANDLE handle = static_cast(id); ASSERT(handle != NULL); @@ -156,23 +146,19 @@ void OSThread::Join(ThreadJoinId id) { ASSERT(res == WAIT_OBJECT_0); } - intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) { ASSERT(sizeof(id) <= sizeof(intptr_t)); return static_cast(id); } - ThreadId OSThread::ThreadIdFromIntPtr(intptr_t id) { return static_cast(id); } - bool OSThread::Compare(ThreadId a, ThreadId b) { return a == b; } - bool OSThread::GetCurrentStackBounds(uword* lower, uword* upper) { // On Windows stack limits for the current thread are available in // the thread information block (TIB). Its fields can be accessed through @@ -187,7 +173,6 @@ bool OSThread::GetCurrentStackBounds(uword* lower, uword* upper) { return true; } - void OSThread::SetThreadLocal(ThreadLocalKey key, uword value) { ASSERT(key != kUnsetThreadLocalKey); BOOL result = TlsSetValue(key, reinterpret_cast(value)); @@ -196,7 +181,6 @@ void OSThread::SetThreadLocal(ThreadLocalKey key, uword value) { } } - Mutex::Mutex() { // Allocate unnamed semaphore with initial count 1 and max count 1. data_.semaphore_ = CreateSemaphore(NULL, 1, 1, NULL); @@ -209,7 +193,6 @@ Mutex::Mutex() { #endif // defined(DEBUG) } - Mutex::~Mutex() { CloseHandle(data_.semaphore_); #if defined(DEBUG) @@ -218,7 +201,6 @@ Mutex::~Mutex() { #endif // defined(DEBUG) } - void Mutex::Lock() { DWORD result = WaitForSingleObject(data_.semaphore_, INFINITE); if (result != WAIT_OBJECT_0) { @@ -230,7 +212,6 @@ void Mutex::Lock() { #endif // defined(DEBUG) } - bool Mutex::TryLock() { // Attempt to pass the semaphore but return immediately. DWORD result = WaitForSingleObject(data_.semaphore_, 0); @@ -248,7 +229,6 @@ bool Mutex::TryLock() { return false; } - void Mutex::Unlock() { #if defined(DEBUG) // When running with assertions enabled we do track the owner. @@ -261,10 +241,8 @@ void Mutex::Unlock() { } } - ThreadLocalKey MonitorWaitData::monitor_wait_data_key_ = kUnsetThreadLocalKey; - Monitor::Monitor() { InitializeCriticalSection(&data_.cs_); InitializeCriticalSection(&data_.waiters_cs_); @@ -277,7 +255,6 @@ Monitor::Monitor() { #endif // defined(DEBUG) } - Monitor::~Monitor() { #if defined(DEBUG) // When running with assertions enabled we track the owner. @@ -288,7 +265,6 @@ Monitor::~Monitor() { DeleteCriticalSection(&data_.waiters_cs_); } - bool Monitor::TryEnter() { // Attempt to pass the semaphore but return immediately. BOOL result = TryEnterCriticalSection(&data_.cs_); @@ -303,7 +279,6 @@ bool Monitor::TryEnter() { return true; } - void Monitor::Enter() { EnterCriticalSection(&data_.cs_); @@ -314,7 +289,6 @@ void Monitor::Enter() { #endif // defined(DEBUG) } - void Monitor::Exit() { #if defined(DEBUG) // When running with assertions enabled we track the owner. @@ -325,7 +299,6 @@ void Monitor::Exit() { LeaveCriticalSection(&data_.cs_); } - void MonitorWaitData::ThreadExit() { if (MonitorWaitData::monitor_wait_data_key_ != kUnsetThreadLocalKey) { uword raw_wait_data = @@ -340,7 +313,6 @@ void MonitorWaitData::ThreadExit() { } } - void MonitorData::AddWaiter(MonitorWaitData* wait_data) { // Add the MonitorWaitData object to the list of objects waiting for // this monitor. @@ -355,7 +327,6 @@ void MonitorData::AddWaiter(MonitorWaitData* wait_data) { LeaveCriticalSection(&waiters_cs_); } - void MonitorData::RemoveWaiter(MonitorWaitData* wait_data) { // Remove the MonitorWaitData object from the list of objects // waiting for this monitor. @@ -386,7 +357,6 @@ void MonitorData::RemoveWaiter(MonitorWaitData* wait_data) { LeaveCriticalSection(&waiters_cs_); } - void MonitorData::SignalAndRemoveFirstWaiter() { EnterCriticalSection(&waiters_cs_); MonitorWaitData* first = waiters_head_; @@ -408,7 +378,6 @@ void MonitorData::SignalAndRemoveFirstWaiter() { LeaveCriticalSection(&waiters_cs_); } - void MonitorData::SignalAndRemoveAllWaiters() { EnterCriticalSection(&waiters_cs_); // Extract list to signal. @@ -431,7 +400,6 @@ void MonitorData::SignalAndRemoveAllWaiters() { LeaveCriticalSection(&waiters_cs_); } - MonitorWaitData* MonitorData::GetMonitorWaitDataForThread() { // Ensure that the thread local key for monitor wait data objects is // initialized. @@ -454,7 +422,6 @@ MonitorWaitData* MonitorData::GetMonitorWaitDataForThread() { return wait_data; } - Monitor::WaitResult Monitor::Wait(int64_t millis) { #if defined(DEBUG) // When running with assertions enabled we track the owner. @@ -509,7 +476,6 @@ Monitor::WaitResult Monitor::Wait(int64_t millis) { return retval; } - Monitor::WaitResult Monitor::WaitMicros(int64_t micros) { // TODO(johnmccutchan): Investigate sub-millisecond sleep times on Windows. int64_t millis = micros / kMicrosecondsPerMillisecond; @@ -522,14 +488,12 @@ Monitor::WaitResult Monitor::WaitMicros(int64_t micros) { return Wait(millis); } - void Monitor::Notify() { // When running with assertions enabled we track the owner. ASSERT(IsOwnedByCurrentThread()); data_.SignalAndRemoveFirstWaiter(); } - void Monitor::NotifyAll() { // When running with assertions enabled we track the owner. ASSERT(IsOwnedByCurrentThread()); @@ -541,7 +505,6 @@ void Monitor::NotifyAll() { data_.SignalAndRemoveAllWaiters(); } - void ThreadLocalData::AddThreadLocal(ThreadLocalKey key, ThreadDestructor destructor) { ASSERT(thread_locals_ != NULL); @@ -561,7 +524,6 @@ void ThreadLocalData::AddThreadLocal(ThreadLocalKey key, thread_locals_->Add(ThreadLocalEntry(key, destructor)); } - void ThreadLocalData::RemoveThreadLocal(ThreadLocalKey key) { ASSERT(thread_locals_ != NULL); MutexLocker ml(mutex_, false); @@ -579,7 +541,6 @@ void ThreadLocalData::RemoveThreadLocal(ThreadLocalKey key) { thread_locals_->RemoveAt(i); } - // This function is executed on the thread that is exiting. It is invoked // by |OnDartThreadExit| (see below for notes on TLS destructors on Windows). void ThreadLocalData::RunDestructors() { @@ -595,17 +556,14 @@ void ThreadLocalData::RunDestructors() { } } - Mutex* ThreadLocalData::mutex_ = NULL; MallocGrowableArray* ThreadLocalData::thread_locals_ = NULL; - void ThreadLocalData::InitOnce() { mutex_ = new Mutex(); thread_locals_ = new MallocGrowableArray(); } - void ThreadLocalData::Shutdown() { if (mutex_ != NULL) { delete mutex_; @@ -617,7 +575,6 @@ void ThreadLocalData::Shutdown() { } } - } // namespace dart // The following was adapted from Chromium: diff --git a/runtime/vm/os_thread_win.h b/runtime/vm/os_thread_win.h index 36205705ca4..594b445d1be 100644 --- a/runtime/vm/os_thread_win.h +++ b/runtime/vm/os_thread_win.h @@ -20,10 +20,8 @@ typedef DWORD ThreadLocalKey; typedef DWORD ThreadId; typedef HANDLE ThreadJoinId; - static const ThreadLocalKey kUnsetThreadLocalKey = TLS_OUT_OF_INDEXES; - class ThreadInlineImpl { private: ThreadInlineImpl() {} @@ -41,7 +39,6 @@ class ThreadInlineImpl { DISALLOW_COPY_AND_ASSIGN(ThreadInlineImpl); }; - class MutexData { private: MutexData() {} @@ -55,7 +52,6 @@ class MutexData { DISALLOW_COPY_AND_ASSIGN(MutexData); }; - class MonitorWaitData { public: static void ThreadExit(); @@ -80,11 +76,9 @@ class MonitorWaitData { friend class MonitorData; friend class OS; - DISALLOW_COPY_AND_ASSIGN(MonitorWaitData); }; - class MonitorData { private: MonitorData() {} @@ -121,10 +115,8 @@ class MonitorData { DISALLOW_COPY_AND_ASSIGN(MonitorData); }; - typedef void (*ThreadDestructor)(void* parameter); - class ThreadLocalEntry { public: ThreadLocalEntry(ThreadLocalKey key, ThreadDestructor destructor) @@ -132,7 +124,6 @@ class ThreadLocalEntry { ThreadLocalKey key() const { return key_; } - ThreadDestructor destructor() const { return destructor_; } private: @@ -142,11 +133,9 @@ class ThreadLocalEntry { DISALLOW_ALLOCATION(); }; - template class MallocGrowableArray; - class ThreadLocalData : public AllStatic { public: static void RunDestructors(); diff --git a/runtime/vm/os_win.cc b/runtime/vm/os_win.cc index e301627eeae..aa7e774713c 100644 --- a/runtime/vm/os_win.cc +++ b/runtime/vm/os_win.cc @@ -12,8 +12,8 @@ #include // NOLINT #include // NOLINT -#include "platform/utils.h" #include "platform/assert.h" +#include "platform/utils.h" #include "vm/os_thread.h" #include "vm/zone.h" @@ -26,12 +26,10 @@ const char* OS::Name() { return "windows"; } - intptr_t OS::ProcessId() { return static_cast(GetCurrentProcessId()); } - // As a side-effect sets the globals _timezone, _daylight and _tzname. static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) { time_t seconds = static_cast(seconds_since_epoch); @@ -43,7 +41,6 @@ static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) { return error_code == 0; } - static int GetDaylightSavingBiasInSeconds() { TIME_ZONE_INFORMATION zone_information; memset(&zone_information, 0, sizeof(zone_information)); @@ -55,7 +52,6 @@ static int GetDaylightSavingBiasInSeconds() { } } - const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) { TIME_ZONE_INFORMATION zone_information; memset(&zone_information, 0, sizeof(zone_information)); @@ -89,7 +85,6 @@ const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) { return name; } - int OS::GetTimeZoneOffsetInSeconds(int64_t seconds_since_epoch) { tm decomposed; // LocalTime will set _timezone. @@ -111,7 +106,6 @@ int OS::GetTimeZoneOffsetInSeconds(int64_t seconds_since_epoch) { } } - int OS::GetLocalTimeZoneAdjustmentInSeconds() { // TODO(floitsch): avoid excessive calls to _tzset? _tzset(); @@ -119,12 +113,10 @@ int OS::GetLocalTimeZoneAdjustmentInSeconds() { return static_cast(-_timezone); } - int64_t OS::GetCurrentTimeMillis() { return GetCurrentTimeMicros() / 1000; } - int64_t OS::GetCurrentTimeMicros() { static const int64_t kTimeEpoc = 116444736000000000LL; static const int64_t kTimeScaler = 10; // 100 ns to us. @@ -144,10 +136,8 @@ int64_t OS::GetCurrentTimeMicros() { return (time.t_ - kTimeEpoc) / kTimeScaler; } - static int64_t qpc_ticks_per_second = 0; - int64_t OS::GetCurrentMonotonicTicks() { if (qpc_ticks_per_second == 0) { // QueryPerformanceCounter not supported, fallback. @@ -159,7 +149,6 @@ int64_t OS::GetCurrentMonotonicTicks() { return static_cast(now.QuadPart); } - int64_t OS::GetCurrentMonotonicFrequency() { if (qpc_ticks_per_second == 0) { // QueryPerformanceCounter not supported, fallback. @@ -168,7 +157,6 @@ int64_t OS::GetCurrentMonotonicFrequency() { return qpc_ticks_per_second; } - int64_t OS::GetCurrentMonotonicMicros() { int64_t ticks = GetCurrentMonotonicTicks(); int64_t frequency = GetCurrentMonotonicFrequency(); @@ -181,13 +169,11 @@ int64_t OS::GetCurrentMonotonicMicros() { return result; } - int64_t OS::GetCurrentThreadCPUMicros() { // TODO(johnmccutchan): Implement. See base/time_win.cc for details. return -1; } - intptr_t OS::ActivationFrameAlignment() { #if defined(TARGET_ARCH_ARM64) return 16; @@ -202,7 +188,6 @@ intptr_t OS::ActivationFrameAlignment() { #endif } - intptr_t OS::PreferredCodeAlignment() { ASSERT(32 <= OS::kMaxPreferredCodeAlignment); #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \ @@ -215,26 +200,22 @@ intptr_t OS::PreferredCodeAlignment() { #endif } - int OS::NumberOfAvailableProcessors() { SYSTEM_INFO info; GetSystemInfo(&info); return info.dwNumberOfProcessors; } - uintptr_t OS::MaxRSS() { PROCESS_MEMORY_COUNTERS pmc; GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc)); return pmc.PeakWorkingSetSize; } - void OS::Sleep(int64_t millis) { ::Sleep(millis); } - void OS::SleepMicros(int64_t micros) { // Windows only supports millisecond sleeps. if (micros < kMicrosecondsPerMillisecond) { @@ -244,7 +225,6 @@ void OS::SleepMicros(int64_t micros) { OS::Sleep(micros / kMicrosecondsPerMillisecond); } - void OS::DebugBreak() { #if defined(_MSC_VER) // Microsoft Visual C/C++ or drop-in replacement. @@ -259,12 +239,10 @@ void OS::DebugBreak() { #endif } - DART_NOINLINE uintptr_t OS::GetProgramCounter() { return reinterpret_cast(_ReturnAddress()); } - char* OS::StrNDup(const char* s, intptr_t n) { intptr_t len = strlen(s); if ((n < 0) || (len < 0)) { @@ -281,12 +259,10 @@ char* OS::StrNDup(const char* s, intptr_t n) { return reinterpret_cast(memmove(result, s, len)); } - intptr_t OS::StrNLen(const char* s, intptr_t n) { return strnlen(s, n); } - void OS::Print(const char* format, ...) { va_list args; va_start(args, format); @@ -294,13 +270,11 @@ void OS::Print(const char* format, ...) { va_end(args); } - void OS::VFPrint(FILE* stream, const char* format, va_list args) { vfprintf(stream, format, args); fflush(stream); } - int OS::SNPrint(char* str, size_t size, const char* format, ...) { va_list args; va_start(args, format); @@ -309,7 +283,6 @@ int OS::SNPrint(char* str, size_t size, const char* format, ...) { return retval; } - int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) { if (str == NULL || size == 0) { int retval = _vscprintf(format, args); @@ -344,7 +317,6 @@ int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) { return written; } - char* OS::SCreate(Zone* zone, const char* format, ...) { va_list args; va_start(args, format); @@ -353,7 +325,6 @@ char* OS::SCreate(Zone* zone, const char* format, ...) { return buffer; } - char* OS::VSCreate(Zone* zone, const char* format, va_list args) { // Measure. va_list measure_args; @@ -377,7 +348,6 @@ char* OS::VSCreate(Zone* zone, const char* format, va_list args) { return buffer; } - bool OS::StringToInt64(const char* str, int64_t* value) { ASSERT(str != NULL && strlen(str) > 0 && value != NULL); int32_t base = 10; @@ -395,10 +365,8 @@ bool OS::StringToInt64(const char* str, int64_t* value) { return ((errno == 0) && (endptr != str) && (*endptr == 0)); } - void OS::RegisterCodeObservers() {} - void OS::PrintErr(const char* format, ...) { va_list args; va_start(args, format); @@ -406,7 +374,6 @@ void OS::PrintErr(const char* format, ...) { va_end(args); } - void OS::InitOnce() { // TODO(5411554): For now we check that initonce is called only once, // Once there is more formal mechanism to call InitOnce we can move @@ -427,20 +394,17 @@ void OS::InitOnce() { } } - void OS::Shutdown() { // TODO(zra): Enable once VM can shutdown cleanly. // ThreadLocalData::Shutdown(); } - void OS::Abort() { // TODO(zra): Remove once VM shuts down cleanly. private_flag_windows_run_tls_destructors = false; abort(); } - void OS::Exit(int code) { // TODO(zra): Remove once VM shuts down cleanly. private_flag_windows_run_tls_destructors = false; diff --git a/runtime/vm/pages.cc b/runtime/vm/pages.cc index 344ec189fda..afda7bb6090 100644 --- a/runtime/vm/pages.cc +++ b/runtime/vm/pages.cc @@ -78,7 +78,6 @@ HeapPage* HeapPage::Initialize(VirtualMemory* memory, return result; } - HeapPage* HeapPage::Allocate(intptr_t size_in_words, PageType type, const char* name) { @@ -95,7 +94,6 @@ HeapPage* HeapPage::Allocate(intptr_t size_in_words, return result; } - void HeapPage::Deallocate() { bool image_page = is_image_page(); @@ -114,7 +112,6 @@ void HeapPage::Deallocate() { } } - void HeapPage::VisitObjects(ObjectVisitor* visitor) const { NoSafepointScope no_safepoint; uword obj_addr = object_start(); @@ -127,7 +124,6 @@ void HeapPage::VisitObjects(ObjectVisitor* visitor) const { ASSERT(obj_addr == end_addr); } - void HeapPage::VisitObjectPointers(ObjectPointerVisitor* visitor) const { NoSafepointScope no_safepoint; uword obj_addr = object_start(); @@ -139,7 +135,6 @@ void HeapPage::VisitObjectPointers(ObjectPointerVisitor* visitor) const { ASSERT(obj_addr == end_addr); } - RawObject* HeapPage::FindObject(FindObjectVisitor* visitor) const { uword obj_addr = object_start(); uword end_addr = object_end(); @@ -158,7 +153,6 @@ RawObject* HeapPage::FindObject(FindObjectVisitor* visitor) const { return Object::null(); } - void HeapPage::WriteProtect(bool read_only) { ASSERT(!is_image_page()); @@ -176,7 +170,6 @@ void HeapPage::WriteProtect(bool read_only) { ASSERT(status); } - PageSpace::PageSpace(Heap* heap, intptr_t max_capacity_in_words, intptr_t max_external_in_words) @@ -208,7 +201,6 @@ PageSpace::PageSpace(Heap* heap, UpdateMaxUsed(); } - PageSpace::~PageSpace() { { MonitorLocker ml(tasks_lock()); @@ -223,14 +215,12 @@ PageSpace::~PageSpace() { delete tasks_lock_; } - intptr_t PageSpace::LargePageSizeInWordsFor(intptr_t size) { intptr_t page_size = Utils::RoundUp(size + HeapPage::ObjectStartOffset(), VirtualMemory::PageSize()); return page_size >> kWordSizeLog2; } - HeapPage* PageSpace::AllocatePage(HeapPage::PageType type) { const bool is_exec = (type == HeapPage::kExecutable); const intptr_t kVmNameSize = 128; @@ -273,7 +263,6 @@ HeapPage* PageSpace::AllocatePage(HeapPage::PageType type) { return page; } - HeapPage* PageSpace::AllocateLargePage(intptr_t size, HeapPage::PageType type) { const bool is_exec = (type == HeapPage::kExecutable); const intptr_t page_size_in_words = LargePageSizeInWordsFor(size); @@ -294,7 +283,6 @@ HeapPage* PageSpace::AllocateLargePage(intptr_t size, HeapPage::PageType type) { return page; } - void PageSpace::TruncateLargePage(HeapPage* page, intptr_t new_object_size_in_bytes) { const intptr_t old_object_size_in_bytes = @@ -311,7 +299,6 @@ void PageSpace::TruncateLargePage(HeapPage* page, } } - void PageSpace::FreePage(HeapPage* page, HeapPage* previous_page) { bool is_exec = (page->type() == HeapPage::kExecutable); { @@ -343,7 +330,6 @@ void PageSpace::FreePage(HeapPage* page, HeapPage* previous_page) { page->Deallocate(); } - void PageSpace::FreeLargePage(HeapPage* page, HeapPage* previous_page) { IncreaseCapacityInWords(-(page->memory_->size() >> kWordSizeLog2)); // Remove the page from the list. @@ -355,7 +341,6 @@ void PageSpace::FreeLargePage(HeapPage* page, HeapPage* previous_page) { page->Deallocate(); } - void PageSpace::FreePages(HeapPage* pages) { HeapPage* page = pages; while (page != NULL) { @@ -365,7 +350,6 @@ void PageSpace::FreePages(HeapPage* pages) { } } - uword PageSpace::TryAllocateInFreshPage(intptr_t size, HeapPage::PageType type, GrowthPolicy growth_policy, @@ -402,7 +386,6 @@ uword PageSpace::TryAllocateInFreshPage(intptr_t size, return result; } - uword PageSpace::TryAllocateInternal(intptr_t size, HeapPage::PageType type, GrowthPolicy growth_policy, @@ -450,30 +433,25 @@ uword PageSpace::TryAllocateInternal(intptr_t size, return result; } - void PageSpace::AcquireDataLock() { freelist_[HeapPage::kData].mutex()->Lock(); } - void PageSpace::ReleaseDataLock() { freelist_[HeapPage::kData].mutex()->Unlock(); } - void PageSpace::AllocateExternal(intptr_t size) { intptr_t size_in_words = size >> kWordSizeLog2; AtomicOperations::IncrementBy(&(usage_.external_in_words), size_in_words); // TODO(koda): Control growth. } - void PageSpace::FreeExternal(intptr_t size) { intptr_t size_in_words = size >> kWordSizeLog2; AtomicOperations::DecrementBy(&(usage_.external_in_words), size_in_words); } - // Provides exclusive access to all pages, and ensures they are walkable. class ExclusivePageIterator : ValueObject { public: @@ -502,7 +480,6 @@ class ExclusivePageIterator : ValueObject { HeapPage* page_; }; - // Provides exclusive access to code pages, and ensures they are walkable. // NOTE: This does not iterate over large pages which can contain code. class ExclusiveCodePageIterator : ValueObject { @@ -526,7 +503,6 @@ class ExclusiveCodePageIterator : ValueObject { HeapPage* page_; }; - // Provides exclusive access to large pages, and ensures they are walkable. class ExclusiveLargePageIterator : ValueObject { public: @@ -549,7 +525,6 @@ class ExclusiveLargePageIterator : ValueObject { HeapPage* page_; }; - void PageSpace::MakeIterable() const { // Assert not called from concurrent sweeper task. // TODO(koda): Use thread/task identity when implemented. @@ -559,7 +534,6 @@ void PageSpace::MakeIterable() const { } } - void PageSpace::AbandonBumpAllocation() { if (bump_top_ < bump_end_) { freelist_[HeapPage::kData].Free(bump_top_, bump_end_ - bump_top_); @@ -568,7 +542,6 @@ void PageSpace::AbandonBumpAllocation() { } } - void PageSpace::UpdateMaxCapacityLocked() { if (heap_ == NULL) { // Some unit tests. @@ -581,7 +554,6 @@ void PageSpace::UpdateMaxCapacityLocked() { static_cast(usage_.capacity_in_words) * kWordSize); } - void PageSpace::UpdateMaxUsed() { if (heap_ == NULL) { // Some unit tests. @@ -593,7 +565,6 @@ void PageSpace::UpdateMaxUsed() { isolate->GetHeapOldUsedMaxMetric()->SetValue(UsedInWords() * kWordSize); } - bool PageSpace::Contains(uword addr) const { for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { if (it.page()->Contains(addr)) { @@ -603,7 +574,6 @@ bool PageSpace::Contains(uword addr) const { return false; } - bool PageSpace::Contains(uword addr, HeapPage::PageType type) const { if (type == HeapPage::kExecutable) { // Fast path executable pages. @@ -628,7 +598,6 @@ bool PageSpace::Contains(uword addr, HeapPage::PageType type) const { return false; } - bool PageSpace::DataContains(uword addr) const { for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { if ((it.page()->type() != HeapPage::kExecutable) && @@ -639,7 +608,6 @@ bool PageSpace::DataContains(uword addr) const { return false; } - void PageSpace::AddRegionsToObjectSet(ObjectSet* set) const { ASSERT((pages_ != NULL) || (exec_pages_ != NULL) || (large_pages_ != NULL)); for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { @@ -647,14 +615,12 @@ void PageSpace::AddRegionsToObjectSet(ObjectSet* set) const { } } - void PageSpace::VisitObjects(ObjectVisitor* visitor) const { for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { it.page()->VisitObjects(visitor); } } - void PageSpace::VisitObjectsNoImagePages(ObjectVisitor* visitor) const { for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { if (!it.page()->is_image_page()) { @@ -663,7 +629,6 @@ void PageSpace::VisitObjectsNoImagePages(ObjectVisitor* visitor) const { } } - void PageSpace::VisitObjectsImagePages(ObjectVisitor* visitor) const { for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { if (it.page()->is_image_page()) { @@ -672,14 +637,12 @@ void PageSpace::VisitObjectsImagePages(ObjectVisitor* visitor) const { } } - void PageSpace::VisitObjectPointers(ObjectPointerVisitor* visitor) const { for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { it.page()->VisitObjectPointers(visitor); } } - RawObject* PageSpace::FindObject(FindObjectVisitor* visitor, HeapPage::PageType type) const { if (type == HeapPage::kExecutable) { @@ -713,7 +676,6 @@ RawObject* PageSpace::FindObject(FindObjectVisitor* visitor, return Object::null(); } - void PageSpace::WriteProtect(bool read_only) { if (read_only) { // Avoid MakeIterable trying to write to the heap. @@ -726,7 +688,6 @@ void PageSpace::WriteProtect(bool read_only) { } } - #ifndef PRODUCT void PageSpace::PrintToJSONObject(JSONObject* object) const { if (!FLAG_support_service) { @@ -756,7 +717,6 @@ void PageSpace::PrintToJSONObject(JSONObject* object) const { } } - class HeapMapAsJSONVisitor : public ObjectVisitor { public: explicit HeapMapAsJSONVisitor(JSONArray* array) : array_(array) {} @@ -769,7 +729,6 @@ class HeapMapAsJSONVisitor : public ObjectVisitor { JSONArray* array_; }; - void PageSpace::PrintHeapMapToJSONStream(Isolate* isolate, JSONStream* stream) const { if (!FLAG_support_service) { @@ -813,7 +772,6 @@ void PageSpace::PrintHeapMapToJSONStream(Isolate* isolate, } #endif // PRODUCT - bool PageSpace::ShouldCollectCode() { // Try to collect code if enough time has passed since the last attempt. const int64_t start = OS::GetCurrentMonotonicMicros(); @@ -831,7 +789,6 @@ bool PageSpace::ShouldCollectCode() { return false; } - void PageSpace::WriteProtectCode(bool read_only) { if (FLAG_write_protect_code) { MutexLocker ml(pages_lock_); @@ -855,7 +812,6 @@ void PageSpace::WriteProtectCode(bool read_only) { } } - void PageSpace::MarkSweep(bool invoke_api_callbacks) { Thread* thread = Thread::Current(); Isolate* isolate = heap_->isolate(); @@ -1036,7 +992,6 @@ void PageSpace::MarkSweep(bool invoke_api_callbacks) { } } - uword PageSpace::TryAllocateDataBumpInternal(intptr_t size, GrowthPolicy growth_policy, bool is_locked) { @@ -1088,19 +1043,16 @@ uword PageSpace::TryAllocateDataBumpInternal(intptr_t size, return result; } - uword PageSpace::TryAllocateDataBump(intptr_t size, GrowthPolicy growth_policy) { return TryAllocateDataBumpInternal(size, growth_policy, false); } - uword PageSpace::TryAllocateDataBumpLocked(intptr_t size, GrowthPolicy growth_policy) { return TryAllocateDataBumpInternal(size, growth_policy, true); } - uword PageSpace::TryAllocatePromoLocked(intptr_t size, GrowthPolicy growth_policy) { FreeList* freelist = &freelist_[HeapPage::kData]; @@ -1115,7 +1067,6 @@ uword PageSpace::TryAllocatePromoLocked(intptr_t size, return TryAllocateDataLocked(size, growth_policy); } - void PageSpace::SetupImagePage(void* pointer, uword size, bool is_executable) { // Setup a HeapPage so precompiled Instructions can be traversed. // Instructions are contiguous at [pointer, pointer + size). HeapPage @@ -1158,7 +1109,6 @@ void PageSpace::SetupImagePage(void* pointer, uword size, bool is_executable) { (*tail) = page; } - PageSpaceController::PageSpaceController(Heap* heap, int heap_growth_ratio, int heap_growth_max, @@ -1172,10 +1122,8 @@ PageSpaceController::PageSpaceController(Heap* heap, garbage_collection_time_ratio_(garbage_collection_time_ratio), last_code_collection_in_us_(OS::GetCurrentMonotonicMicros()) {} - PageSpaceController::~PageSpaceController() {} - bool PageSpaceController::NeedsGarbageCollection(SpaceUsage after) const { if (!is_enabled_) { return false; @@ -1212,7 +1160,6 @@ bool PageSpaceController::NeedsGarbageCollection(SpaceUsage after) const { return needs_gc; } - void PageSpaceController::EvaluateGarbageCollection(SpaceUsage before, SpaceUsage after, int64_t start, @@ -1296,7 +1243,6 @@ void PageSpaceController::EvaluateGarbageCollection(SpaceUsage before, last_usage_ = after; } - void PageSpaceGarbageCollectionHistory::AddGarbageCollectionTime(int64_t start, int64_t end) { Entry entry; @@ -1305,7 +1251,6 @@ void PageSpaceGarbageCollectionHistory::AddGarbageCollectionTime(int64_t start, history_.Add(entry); } - int PageSpaceGarbageCollectionHistory::GarbageCollectionTimeFraction() { int64_t gc_time = 0; int64_t total_time = 0; diff --git a/runtime/vm/pages.h b/runtime/vm/pages.h index aaa675e2155..926acd33227 100644 --- a/runtime/vm/pages.h +++ b/runtime/vm/pages.h @@ -82,7 +82,6 @@ class HeapPage { DISALLOW_IMPLICIT_CONSTRUCTORS(HeapPage); }; - // The history holds the timing information of the last garbage collection // runs. class PageSpaceGarbageCollectionHistory { @@ -108,7 +107,6 @@ class PageSpaceGarbageCollectionHistory { DISALLOW_COPY_AND_ASSIGN(PageSpaceGarbageCollectionHistory); }; - // PageSpaceController controls the heap size. class PageSpaceController { public: @@ -177,7 +175,6 @@ class PageSpaceController { DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpaceController); }; - class PageSpace { public: // TODO(iposva): Determine heap sizes and tune the page size accordingly. diff --git a/runtime/vm/pages_test.cc b/runtime/vm/pages_test.cc index 131b2e6bb3f..82321b3a0e5 100644 --- a/runtime/vm/pages_test.cc +++ b/runtime/vm/pages_test.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "platform/assert.h" #include "vm/pages.h" +#include "platform/assert.h" #include "vm/unit_test.h" namespace dart { diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc index bd6eec97343..36c5a33d919 100644 --- a/runtime/vm/parser.cc +++ b/runtime/vm/parser.cc @@ -124,7 +124,6 @@ class TraceParser : public ValueObject { intptr_t* indent_; }; - #define TRACE_PARSER(s) \ TraceParser __p__(this->TokenPos(), this->script_, &this->trace_indent_, s) @@ -132,7 +131,6 @@ class TraceParser : public ValueObject { #define TRACE_PARSER(s) #endif // DEBUG - class BoolScope : public ValueObject { public: BoolScope(bool* addr, bool new_value) : _addr(addr), _saved_value(*addr) { @@ -145,7 +143,6 @@ class BoolScope : public ValueObject { bool _saved_value; }; - // Helper class to save and restore token position. class Parser::TokenPosScope : public ValueObject { public: @@ -159,7 +156,6 @@ class Parser::TokenPosScope : public ValueObject { DISALLOW_COPY_AND_ASSIGN(TokenPosScope); }; - class RecursionChecker : public ValueObject { public: explicit RecursionChecker(Parser* p) : parser_(p) { @@ -178,7 +174,6 @@ class RecursionChecker : public ValueObject { Parser* parser_; }; - static RawTypeArguments* NewTypeArguments( const GrowableArray& objs) { const TypeArguments& a = @@ -191,7 +186,6 @@ static RawTypeArguments* NewTypeArguments( return a.raw(); } - void ParsedFunction::AddToGuardedFields(const Field* field) const { if ((field->guarded_cid() == kDynamicCid) || (field->guarded_cid() == kIllegalCid)) { @@ -223,7 +217,6 @@ void ParsedFunction::AddToGuardedFields(const Field* field) const { guarded_fields_->Add(&Field::ZoneHandle(Z, field->raw())); } - void ParsedFunction::Bailout(const char* origin, const char* reason) const { Report::MessageF(Report::kBailout, Script::Handle(function_.script()), function_.token_pos(), Report::AtLocation, @@ -232,7 +225,6 @@ void ParsedFunction::Bailout(const char* origin, const char* reason) const { UNREACHABLE(); } - kernel::ScopeBuildingResult* ParsedFunction::EnsureKernelScopes() { if (kernel_scopes_ == NULL) { intptr_t kernel_offset = function().kernel_offset(); @@ -244,7 +236,6 @@ kernel::ScopeBuildingResult* ParsedFunction::EnsureKernelScopes() { return kernel_scopes_; } - LocalVariable* ParsedFunction::EnsureExpressionTemp() { if (!has_expression_temp_var()) { LocalVariable* temp = @@ -257,7 +248,6 @@ LocalVariable* ParsedFunction::EnsureExpressionTemp() { return expression_temp_var(); } - void ParsedFunction::EnsureFinallyReturnTemp(bool is_async) { if (!has_finally_return_temp_var()) { LocalVariable* temp = @@ -273,14 +263,12 @@ void ParsedFunction::EnsureFinallyReturnTemp(bool is_async) { ASSERT(has_finally_return_temp_var()); } - void ParsedFunction::SetNodeSequence(SequenceNode* node_sequence) { ASSERT(node_sequence_ == NULL); ASSERT(node_sequence != NULL); node_sequence_ = node_sequence; } - void ParsedFunction::SetRegExpCompileData( RegExpCompileData* regexp_compile_data) { ASSERT(regexp_compile_data_ == NULL); @@ -288,7 +276,6 @@ void ParsedFunction::SetRegExpCompileData( regexp_compile_data_ = regexp_compile_data; } - void ParsedFunction::AddDeferredPrefix(const LibraryPrefix& prefix) { // 'deferred_prefixes_' are used to invalidate code, but no invalidation is // needed if --load_deferred_eagerly. @@ -303,7 +290,6 @@ void ParsedFunction::AddDeferredPrefix(const LibraryPrefix& prefix) { deferred_prefixes_->Add(&LibraryPrefix::ZoneHandle(Z, prefix.raw())); } - void ParsedFunction::AllocateVariables() { ASSERT(!function().IsIrregexpFunction()); LocalScope* scope = node_sequence()->scope(); @@ -338,7 +324,6 @@ void ParsedFunction::AllocateVariables() { num_stack_locals_ = first_stack_local_index_ - next_free_frame_index; } - struct CatchParamDesc { CatchParamDesc() : token_pos(TokenPosition::kNoSource), @@ -351,7 +336,6 @@ struct CatchParamDesc { LocalVariable* var; }; - void ParsedFunction::AllocateIrregexpVariables(intptr_t num_stack_locals) { ASSERT(function().IsIrregexpFunction()); ASSERT(function().NumOptionalParameters() == 0); @@ -369,7 +353,6 @@ void ParsedFunction::AllocateIrregexpVariables(intptr_t num_stack_locals) { num_stack_locals_ = num_stack_locals; } - struct Parser::Block : public ZoneAllocated { Block(Block* outer_block, LocalScope* local_scope, SequenceNode* seq) : parent(outer_block), scope(local_scope), statements(seq) { @@ -381,7 +364,6 @@ struct Parser::Block : public ZoneAllocated { SequenceNode* statements; }; - // Class which describes an inlined finally block which is used to generate // inlined code for the finally blocks when there is an exit from a try // block using 'return', 'break' or 'continue'. @@ -425,12 +407,10 @@ class Parser::TryStack : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(TryStack); }; - void Parser::TryStack::AddNodeForFinallyInlining(AstNode* node) { inlined_finally_nodes_.Add(node); } - void Parser::TryStack::RemoveJumpToLabel(SourceLabel* label) { int i = 0; while (i < inlined_finally_nodes_.length()) { @@ -449,7 +429,6 @@ void Parser::TryStack::RemoveJumpToLabel(SourceLabel* label) { } } - // For parsing a compilation unit. Parser::Parser(const Script& script, const Library& library, @@ -482,7 +461,6 @@ Parser::Parser(const Script& script, ASSERT(!library.IsNull()); } - // For parsing a function. Parser::Parser(const Script& script, ParsedFunction* parsed_function, @@ -521,7 +499,6 @@ Parser::Parser(const Script& script, EnsureExpressionTemp(); } - Parser::~Parser() { if (unregister_pending_function_) { const GrowableObjectArray& pending_functions = @@ -534,7 +511,6 @@ Parser::~Parser() { } } - // Each try in this function gets its own try index. // See definition of RawPcDescriptors::PcDescriptor. int16_t Parser::AllocateTryIndex() { @@ -544,7 +520,6 @@ int16_t Parser::AllocateTryIndex() { return last_used_try_index_++; } - void Parser::SetScript(const Script& script, TokenPosition token_pos) { script_ = script.raw(); tokens_iterator_.SetStream(TokenStream::Handle(Z, script.tokens()), @@ -552,25 +527,21 @@ void Parser::SetScript(const Script& script, TokenPosition token_pos) { token_kind_ = Token::kILLEGAL; } - bool Parser::SetAllowFunctionLiterals(bool value) { bool current_value = allow_function_literals_; allow_function_literals_ = value; return current_value; } - const Function& Parser::current_function() const { ASSERT(parsed_function() != NULL); return parsed_function()->function(); } - const Function& Parser::innermost_function() const { return innermost_function_; } - int Parser::FunctionLevel() const { if (current_block_ != NULL) { return current_block_->scope->function_level(); @@ -578,24 +549,20 @@ int Parser::FunctionLevel() const { return 0; } - const Class& Parser::current_class() const { return current_class_; } - void Parser::set_current_class(const Class& value) { current_class_ = value.raw(); } - void Parser::SetPosition(TokenPosition position) { tokens_iterator_.SetCurrentPosition(position); token_kind_ = Token::kILLEGAL; prev_token_pos_ = position; } - // Set state and increments generational count so that thge background compiler // can detect if loading/top-level-parsing occured during compilation. class TopLevelParsingScope : public StackResource { @@ -609,7 +576,6 @@ class TopLevelParsingScope : public StackResource { } }; - void Parser::ParseCompilationUnit(const Library& library, const Script& script) { Thread* thread = Thread::Current(); @@ -630,7 +596,6 @@ void Parser::ParseCompilationUnit(const Library& library, parser.ParseTopLevel(); } - void Parser::ComputeCurrentToken() { ASSERT(token_kind_ == Token::kILLEGAL); token_kind_ = tokens_iterator_.CurrentTokenKind(); @@ -639,25 +604,21 @@ void Parser::ComputeCurrentToken() { } } - Token::Kind Parser::LookaheadToken(int num_tokens) { return tokens_iterator_.LookaheadTokenKind(num_tokens); } - String* Parser::CurrentLiteral() const { String& result = String::ZoneHandle(Z, tokens_iterator_.CurrentLiteral()); return &result; } - RawDouble* Parser::CurrentDoubleLiteral() const { literal_token_ ^= tokens_iterator_.CurrentToken(); ASSERT(literal_token_.kind() == Token::kDOUBLE); return Double::RawCast(literal_token_.value()); } - RawInteger* Parser::CurrentIntegerLiteral() const { literal_token_ ^= tokens_iterator_.CurrentToken(); ASSERT(literal_token_.kind() == Token::kINTEGER); @@ -665,7 +626,6 @@ RawInteger* Parser::CurrentIntegerLiteral() const { return ri; } - struct ParamDesc { ParamDesc() : type(NULL), @@ -690,7 +650,6 @@ struct ParamDesc { bool is_covariant; }; - struct ParamList { ParamList() { Clear(); } @@ -769,7 +728,6 @@ struct ParamList { ZoneGrowableArray* parameters; }; - struct MemberDesc { MemberDesc() { Clear(); } @@ -852,7 +810,6 @@ struct MemberDesc { Field* field_; }; - class ClassDesc : public ValueObject { public: ClassDesc(Zone* zone, @@ -927,7 +884,6 @@ class ClassDesc : public ValueObject { GrowableArray members_; }; - class TopLevel : public ValueObject { public: explicit TopLevel(Zone* zone) @@ -951,7 +907,6 @@ class TopLevel : public ValueObject { GrowableArray functions_; }; - void Parser::ParseClass(const Class& cls) { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -983,7 +938,6 @@ void Parser::ParseClass(const Class& cls) { INC_STAT(thread, num_class_tokens, num_tokes_after - num_tokes_before); } - bool Parser::FieldHasFunctionLiteralInitializer(const Field& field, TokenPosition* start, TokenPosition* end) { @@ -1020,7 +974,6 @@ bool Parser::GetFunctionLiteralInitializerRange(const Field& field, return false; } - RawObject* Parser::ParseFunctionParameters(const Function& func) { ASSERT(!func.IsNull()); LongJumpScope jump; @@ -1075,7 +1028,6 @@ RawObject* Parser::ParseFunctionParameters(const Function& func) { return Object::null(); } - bool Parser::ParseFormalParameters(const Function& func, ParamList* params) { ASSERT(!func.IsNull()); // This is currently only used for constructors. To handle all kinds @@ -1112,7 +1064,6 @@ bool Parser::ParseFormalParameters(const Function& func, ParamList* params) { return false; } - void Parser::ParseFunction(ParsedFunction* parsed_function) { Thread* thread = parsed_function->thread(); ASSERT(thread == Thread::Current()); @@ -1221,7 +1172,6 @@ void Parser::ParseFunction(ParsedFunction* parsed_function) { (parsed_function->function_type_arguments() != NULL)); } - RawObject* Parser::ParseMetadata(const Field& meta_data) { LongJumpScope jump; if (setjmp(*jump.Set()) == 0) { @@ -1265,7 +1215,6 @@ RawObject* Parser::ParseMetadata(const Field& meta_data) { return Object::null(); } - RawArray* Parser::EvaluateMetadata() { CheckToken(Token::kAT, "Metadata character '@' expected"); GrowableObjectArray& meta_values = @@ -1339,7 +1288,6 @@ RawArray* Parser::EvaluateMetadata() { return Array::MakeFixedLength(meta_values); } - SequenceNode* Parser::ParseStaticInitializer() { ExpectIdentifier("field name expected"); CheckToken(Token::kASSIGN, "field initialier expected"); @@ -1352,7 +1300,6 @@ SequenceNode* Parser::ParseStaticInitializer() { return CloseBlock(); } - ParsedFunction* Parser::ParseStaticFieldInitializer(const Field& field) { ASSERT(field.is_static()); Thread* thread = Thread::Current(); @@ -1409,7 +1356,6 @@ ParsedFunction* Parser::ParseStaticFieldInitializer(const Field& field) { return parsed_function; } - SequenceNode* Parser::ParseStaticFinalGetter(const Function& func) { TRACE_PARSER("ParseStaticFinalGetter"); ASSERT(func.num_fixed_parameters() == 0); // static. @@ -1454,7 +1400,6 @@ SequenceNode* Parser::ParseStaticFinalGetter(const Function& func) { return CloseBlock(); } - // Create AstNodes for an implicit instance getter method: // LoadLocalNode 0 ('this'); // LoadInstanceFieldNode (field_name); @@ -1493,7 +1438,6 @@ SequenceNode* Parser::ParseInstanceGetter(const Function& func) { return CloseBlock(); } - // Create AstNodes for an implicit instance setter method: // LoadLocalNode 0 ('this') // LoadLocalNode 1 ('value') @@ -1535,7 +1479,6 @@ SequenceNode* Parser::ParseInstanceSetter(const Function& func) { return CloseBlock(); } - SequenceNode* Parser::ParseConstructorClosure(const Function& func) { TRACE_PARSER("ParseConstructorClosure"); const TokenPosition token_pos = func.token_pos(); @@ -1588,7 +1531,6 @@ SequenceNode* Parser::ParseConstructorClosure(const Function& func) { return CloseBlock(); } - SequenceNode* Parser::ParseImplicitClosure(const Function& func) { TRACE_PARSER("ParseImplicitClosure"); TokenPosition token_pos = func.token_pos(); @@ -1735,7 +1677,6 @@ SequenceNode* Parser::ParseImplicitClosure(const Function& func) { return CloseBlock(); } - SequenceNode* Parser::ParseMethodExtractor(const Function& func) { TRACE_PARSER("ParseMethodExtractor"); @@ -1765,7 +1706,6 @@ SequenceNode* Parser::ParseMethodExtractor(const Function& func) { return CloseBlock(); } - void Parser::BuildDispatcherScope(const Function& func, const ArgumentsDescriptor& desc) { ParamList params; @@ -1816,7 +1756,6 @@ void Parser::BuildDispatcherScope(const Function& func, } } - SequenceNode* Parser::ParseNoSuchMethodDispatcher(const Function& func) { TRACE_PARSER("ParseNoSuchMethodDispatcher"); ASSERT(FLAG_lazy_dispatchers); @@ -1874,7 +1813,6 @@ SequenceNode* Parser::ParseNoSuchMethodDispatcher(const Function& func) { return CloseBlock(); } - SequenceNode* Parser::ParseInvokeFieldDispatcher(const Function& func) { TRACE_PARSER("ParseInvokeFieldDispatcher"); ASSERT(func.IsInvokeFieldDispatcher()); @@ -1942,14 +1880,12 @@ SequenceNode* Parser::ParseInvokeFieldDispatcher(const Function& func) { return CloseBlock(); } - AstNode* Parser::BuildClosureCall(TokenPosition token_pos, AstNode* closure, ArgumentListNode* arguments) { return new InstanceCallNode(token_pos, closure, Symbols::Call(), arguments); } - void Parser::SkipToMatching() { Token::Kind opening_token = CurrentToken(); ASSERT((opening_token == Token::kLBRACE) || @@ -2014,13 +1950,11 @@ void Parser::SkipToMatching() { } } - void Parser::SkipBlock() { ASSERT(CurrentToken() == Token::kLBRACE); SkipToMatching(); } - // Skips tokens up to and including matching closing parenthesis. void Parser::SkipToMatchingParenthesis() { ASSERT(CurrentToken() == Token::kLPAREN); @@ -2029,7 +1963,6 @@ void Parser::SkipToMatchingParenthesis() { ConsumeToken(); } - // Parses a parameter type as defined by the 'parameterTypeList' production. void Parser::ParseParameterType(ParamList* params) { TRACE_PARSER("ParseParameterType"); @@ -2100,7 +2033,6 @@ void Parser::ParseParameterType(ParamList* params) { } } - // Parses a formal parameter as defined by the 'formalParameterList' production. void Parser::ParseFormalParameter(bool allow_explicit_default_value, bool evaluate_metadata, @@ -2331,7 +2263,6 @@ void Parser::ParseFormalParameter(bool allow_explicit_default_value, } } - // Parses a sequence of normal or optional formal parameters. void Parser::ParseFormalParameters(bool use_function_type_syntax, bool allow_explicit_default_values, @@ -2377,7 +2308,6 @@ void Parser::ParseFormalParameters(bool use_function_type_syntax, } while (CurrentToken() == Token::kCOMMA); } - void Parser::ParseFormalParameterList(bool use_function_type_syntax, bool allow_explicit_default_values, bool evaluate_metadata, @@ -2414,7 +2344,6 @@ void Parser::ParseFormalParameterList(bool use_function_type_syntax, ExpectToken(Token::kRPAREN); } - String& Parser::ParseNativeDeclaration() { TRACE_PARSER("ParseNativeDeclaration"); ASSERT(IsSymbol(Symbols::Native())); @@ -2425,7 +2354,6 @@ String& Parser::ParseNativeDeclaration() { return native_name; } - // Resolve and return the dynamic function of the given name in the superclass. // If it is not found, and resolve_getter is true, try to resolve a getter of // the same name. If it is still not found, return noSuchMethod and @@ -2467,7 +2395,6 @@ RawFunction* Parser::GetSuperFunction(TokenPosition token_pos, return super_func.raw(); } - StaticCallNode* Parser::BuildInvocationMirrorAllocation( TokenPosition call_pos, const String& function_name, @@ -2521,7 +2448,6 @@ StaticCallNode* Parser::BuildInvocationMirrorAllocation( return new StaticCallNode(call_pos, allocation_function, arguments); } - ArgumentListNode* Parser::BuildNoSuchMethodArguments( TokenPosition call_pos, const String& function_name, @@ -2539,7 +2465,6 @@ ArgumentListNode* Parser::BuildNoSuchMethodArguments( return arguments; } - AstNode* Parser::ParseSuperCall(const String& function_name, const TypeArguments& func_type_args) { TRACE_PARSER("ParseSuperCall"); @@ -2579,13 +2504,11 @@ AstNode* Parser::ParseSuperCall(const String& function_name, return new StaticCallNode(supercall_pos, super_function, arguments); } - // Simple test if a node is side effect free. static bool IsSimpleLocalOrLiteralNode(AstNode* node) { return node->IsLiteralNode() || node->IsLoadLocalNode(); } - AstNode* Parser::BuildUnarySuperOperator(Token::Kind op, PrimaryNode* super) { ASSERT(super->IsSuper()); AstNode* super_op = NULL; @@ -2612,7 +2535,6 @@ AstNode* Parser::BuildUnarySuperOperator(Token::Kind op, PrimaryNode* super) { return super_op; } - AstNode* Parser::ParseSuperOperator() { TRACE_PARSER("ParseSuperOperator"); AstNode* super_op = NULL; @@ -2667,7 +2589,6 @@ AstNode* Parser::ParseSuperOperator() { return super_op; } - ClosureNode* Parser::CreateImplicitClosureNode(const Function& func, TokenPosition token_pos, AstNode* receiver) { @@ -2676,7 +2597,6 @@ ClosureNode* Parser::CreateImplicitClosureNode(const Function& func, return new ClosureNode(token_pos, implicit_closure_function, receiver, NULL); } - AstNode* Parser::ParseSuperFieldAccess(const String& field_name, TokenPosition field_pos) { TRACE_PARSER("ParseSuperFieldAccess"); @@ -2722,7 +2642,6 @@ AstNode* Parser::ParseSuperFieldAccess(const String& field_name, StaticGetterNode(field_pos, implicit_argument, super_class, field_name); } - StaticCallNode* Parser::GenerateSuperConstructorCall( const Class& cls, TokenPosition supercall_pos, @@ -2792,7 +2711,6 @@ StaticCallNode* Parser::GenerateSuperConstructorCall( return new StaticCallNode(supercall_pos, super_ctor, arguments); } - StaticCallNode* Parser::ParseSuperInitializer(const Class& cls, LocalVariable* receiver) { TRACE_PARSER("ParseSuperInitializer"); @@ -2847,7 +2765,6 @@ StaticCallNode* Parser::ParseSuperInitializer(const Class& cls, return new StaticCallNode(supercall_pos, super_ctor, arguments); } - AstNode* Parser::ParseInitializer(const Class& cls, LocalVariable* receiver, GrowableArray* initialized_fields) { @@ -2901,7 +2818,6 @@ AstNode* Parser::ParseInitializer(const Class& cls, return initializer; } - void Parser::CheckFieldsInitialized(const Class& cls) { const Array& fields = Array::Handle(Z, cls.fields()); Field& field = Field::Handle(Z); @@ -2932,7 +2848,6 @@ void Parser::CheckFieldsInitialized(const Class& cls) { } } - AstNode* Parser::ParseExternalInitializedField(const Field& field) { // Only use this function if the initialized field originates // from a different class. We need to save and restore the @@ -2966,7 +2881,6 @@ AstNode* Parser::ParseExternalInitializedField(const Field& field) { return init_expr; } - void Parser::ParseInitializedInstanceFields( const Class& cls, LocalVariable* receiver, @@ -3019,7 +2933,6 @@ void Parser::ParseInitializedInstanceFields( SetPosition(saved_pos); } - AstNode* Parser::CheckDuplicateFieldInit( TokenPosition init_pos, GrowableArray* initialized_fields, @@ -3122,7 +3035,6 @@ AstNode* Parser::CheckDuplicateFieldInit( return result; } - void Parser::ParseInitializers(const Class& cls, LocalVariable* receiver, GrowableArray* initialized_fields) { @@ -3194,7 +3106,6 @@ void Parser::ParseInitializers(const Class& cls, CheckFieldsInitialized(cls); } - void Parser::ParseConstructorRedirection(const Class& cls, LocalVariable* receiver) { TRACE_PARSER("ParseConstructorRedirection"); @@ -3249,7 +3160,6 @@ void Parser::ParseConstructorRedirection(const Class& cls, new StaticCallNode(call_pos, redirect_ctor, arguments)); } - SequenceNode* Parser::MakeImplicitConstructor(const Function& func) { ASSERT(func.IsGenerativeConstructor()); ASSERT(func.Owner() == current_class().raw()); @@ -3325,7 +3235,6 @@ SequenceNode* Parser::MakeImplicitConstructor(const Function& func) { return statements; } - // Returns a zone allocated string. static char* DumpPendingFunctions( Zone* zone, @@ -3341,7 +3250,6 @@ static char* DumpPendingFunctions( return result; } - void Parser::CheckRecursiveInvocation() { const GrowableObjectArray& pending_functions = GrowableObjectArray::Handle(Z, T->pending_functions()); @@ -3366,7 +3274,6 @@ void Parser::CheckRecursiveInvocation() { unregister_pending_function_ = true; } - // Parser is at the opening parenthesis of the formal parameter declaration // of function. Parse the formal parameters, initializers and code. SequenceNode* Parser::ParseConstructor(const Function& func) { @@ -3541,7 +3448,6 @@ SequenceNode* Parser::ParseConstructor(const Function& func) { return statements; } - // Parser is at the opening parenthesis of the formal parameter // declaration of the function or constructor. // Parse the formal parameters and code. @@ -3845,7 +3751,6 @@ SequenceNode* Parser::ParseFunc(const Function& func, bool check_semicolon) { return CloseBlock(); } - void Parser::AddEqualityNullCheck() { AstNode* argument = new LoadLocalNode( TokenPosition::kNoSource, current_block_->scope->parent()->VariableAt(1)); @@ -3864,14 +3769,12 @@ void Parser::AddEqualityNullCheck() { current_block_->statements->Add(if_arg_null); } - void Parser::SkipIf(Token::Kind token) { if (CurrentToken() == token) { ConsumeToken(); } } - void Parser::SkipInitializers() { ASSERT(CurrentToken() == Token::kCOLON); do { @@ -3900,7 +3803,6 @@ void Parser::SkipInitializers() { } while (CurrentToken() == Token::kCOMMA); } - // If the current identifier is a library prefix followed by a period, // consume the identifier and period, and return the resolved library // prefix. @@ -3947,7 +3849,6 @@ RawLibraryPrefix* Parser::ParsePrefix() { return prefix.raw(); } - void Parser::ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method) { TRACE_PARSER("ParseMethodOrConstructor"); // We are at the beginning of the formal parameters list. @@ -4309,7 +4210,6 @@ void Parser::ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method) { members->AddFunction(func); } - void Parser::ParseFieldDefinition(ClassDesc* members, MemberDesc* field) { TRACE_PARSER("ParseFieldDefinition"); // The parser has read the first field name and is now at the token @@ -4482,7 +4382,6 @@ void Parser::ParseFieldDefinition(ClassDesc* members, MemberDesc* field) { ExpectSemicolon(); } - void Parser::CheckOperatorArity(const MemberDesc& member) { intptr_t expected_num_parameters; // Includes receiver. Token::Kind op = member.operator_token; @@ -4503,7 +4402,6 @@ void Parser::CheckOperatorArity(const MemberDesc& member) { } } - void Parser::CheckMemberNameConflict(ClassDesc* members, MemberDesc* member) { const String& name = *member->DictName(); if (name.Equals(members->class_name())) { @@ -4524,7 +4422,6 @@ void Parser::CheckMemberNameConflict(ClassDesc* members, MemberDesc* member) { } } - void Parser::ParseClassMemberDefinition(ClassDesc* members, TokenPosition metadata_pos) { TRACE_PARSER("ParseClassMemberDefinition"); @@ -4740,7 +4637,6 @@ void Parser::ParseClassMemberDefinition(ClassDesc* members, members->AddMember(member); } - void Parser::ParseEnumDeclaration(const GrowableObjectArray& pending_classes, const Object& tl_owner, TokenPosition metadata_pos) { @@ -4789,7 +4685,6 @@ void Parser::ParseEnumDeclaration(const GrowableObjectArray& pending_classes, pending_classes.Add(cls, Heap::kOld); } - void Parser::ParseClassDeclaration(const GrowableObjectArray& pending_classes, const Object& tl_owner, TokenPosition metadata_pos) { @@ -4975,7 +4870,6 @@ void Parser::ParseClassDeclaration(const GrowableObjectArray& pending_classes, } } - void Parser::ParseClassDefinition(const Class& cls) { TRACE_PARSER("ParseClassDefinition"); INC_STAT(thread(), num_classes_parsed, 1); @@ -5043,7 +4937,6 @@ void Parser::ParseClassDefinition(const Class& cls) { } } - void Parser::ParseEnumDefinition(const Class& cls) { TRACE_PARSER("ParseEnumDefinition"); INC_STAT(thread(), num_classes_parsed, 1); @@ -5234,7 +5127,6 @@ void Parser::ParseEnumDefinition(const Class& cls) { cls.SetFunctions(functions); } - // Add an implicit constructor to the given class. void Parser::AddImplicitConstructor(const Class& cls) { // The implicit constructor is unnamed, has no explicit parameter. @@ -5270,7 +5162,6 @@ void Parser::AddImplicitConstructor(const Class& cls) { cls.AddFunction(ctor); } - void Parser::CheckFinalInitializationConflicts(const ClassDesc* class_desc, const MemberDesc* member) { const ParamList* params = &member->params; @@ -5305,7 +5196,6 @@ void Parser::CheckFinalInitializationConflicts(const ClassDesc* class_desc, } } - // Check for cycles in constructor redirection. void Parser::CheckConstructors(ClassDesc* class_desc) { // Check for cycles in constructor redirection. @@ -5341,7 +5231,6 @@ void Parser::CheckConstructors(ClassDesc* class_desc) { } } - void Parser::ParseMixinAppAlias(const GrowableObjectArray& pending_classes, const Object& tl_owner, TokenPosition metadata_pos) { @@ -5399,7 +5288,6 @@ void Parser::ParseMixinAppAlias(const GrowableObjectArray& pending_classes, } } - // Look ahead to detect if we are seeing ident [ TypeParameters ] ("(" | "="). // We need this lookahead to distinguish between the optional return type // and the alias name of a function type alias. @@ -5427,7 +5315,6 @@ bool Parser::IsFunctionTypeAliasName(bool* use_function_type_syntax) { return false; } - void Parser::ParseTypedef(const GrowableObjectArray& pending_classes, const Object& tl_owner, TokenPosition metadata_pos) { @@ -5546,7 +5433,6 @@ void Parser::ParseTypedef(const GrowableObjectArray& pending_classes, } } - // Consumes exactly one right angle bracket. If the current token is // a single bracket token, it is consumed normally. However, if it is // a double bracket, it is replaced by a single bracket token without @@ -5561,7 +5447,6 @@ void Parser::ConsumeRightAngleBracket() { } } - bool Parser::IsPatchAnnotation(TokenPosition pos) { if (pos == TokenPosition::kNoSource) { return false; @@ -5572,7 +5457,6 @@ bool Parser::IsPatchAnnotation(TokenPosition pos) { return IsSymbol(Symbols::Patch()); } - TokenPosition Parser::SkipMetadata() { if (CurrentToken() != Token::kAT) { return TokenPosition::kNoSource; @@ -5596,7 +5480,6 @@ TokenPosition Parser::SkipMetadata() { return metadata_pos; } - void Parser::SkipTypeArguments() { if (CurrentToken() == Token::kLT) { do { @@ -5612,7 +5495,6 @@ void Parser::SkipTypeArguments() { } } - void Parser::SkipTypeParameters() { // Function already parsed, no need to check FLAG_generic_method_syntax. if (IsTypeParameters()) { @@ -5621,7 +5503,6 @@ void Parser::SkipTypeParameters() { } } - void Parser::SkipType(bool allow_void) { if (CurrentToken() == Token::kVOID) { if (!allow_void) { @@ -5638,7 +5519,6 @@ void Parser::SkipType(bool allow_void) { } } - void Parser::SkipTypeOrFunctionType(bool allow_void) { if (CurrentToken() == Token::kVOID) { TokenPosition void_pos = TokenPos(); @@ -5662,7 +5542,6 @@ void Parser::SkipTypeOrFunctionType(bool allow_void) { } } - void Parser::ParseTypeParameters(bool parameterizing_class) { TRACE_PARSER("ParseTypeParameters"); if (CurrentToken() == Token::kLT) { @@ -5747,7 +5626,6 @@ void Parser::ParseTypeParameters(bool parameterizing_class) { } } - RawTypeArguments* Parser::ParseTypeArguments( ClassFinalizer::FinalizationKind finalization) { TRACE_PARSER("ParseTypeArguments"); @@ -5780,7 +5658,6 @@ RawTypeArguments* Parser::ParseTypeArguments( return TypeArguments::null(); } - // Parse interface list and add to class cls. void Parser::ParseInterfaceList(const Class& cls) { TRACE_PARSER("ParseInterfaceList"); @@ -5810,7 +5687,6 @@ void Parser::ParseInterfaceList(const Class& cls) { cls.set_interfaces(cls_interfaces); } - RawAbstractType* Parser::ParseMixins(const AbstractType& super_type) { TRACE_PARSER("ParseMixins"); ASSERT(CurrentToken() == Token::kWITH); @@ -5836,7 +5712,6 @@ RawAbstractType* Parser::ParseMixins(const AbstractType& super_type) { super_type, Array::Handle(Z, Array::MakeFixedLength(mixin_types))); } - void Parser::ParseTopLevelVariable(TopLevel* top_level, const Object& owner, TokenPosition metadata_pos) { @@ -5927,7 +5802,6 @@ void Parser::ParseTopLevelVariable(TopLevel* top_level, } } - RawFunction::AsyncModifier Parser::ParseFunctionModifier() { if (IsSymbol(Symbols::Async())) { ConsumeToken(); @@ -5953,7 +5827,6 @@ RawFunction::AsyncModifier Parser::ParseFunctionModifier() { return RawFunction::kNoModifier; } - void Parser::ParseTopLevelFunction(TopLevel* top_level, const Object& owner, TokenPosition metadata_pos) { @@ -6086,7 +5959,6 @@ void Parser::ParseTopLevelFunction(TopLevel* top_level, } } - void Parser::ParseTopLevelAccessor(TopLevel* top_level, const Object& owner, TokenPosition metadata_pos) { @@ -6206,8 +6078,9 @@ void Parser::ParseTopLevelAccessor(TopLevel* top_level, ReportError("function block expected"); } Function& func = Function::Handle( - Z, Function::New(accessor_name, is_getter ? RawFunction::kGetterFunction - : RawFunction::kSetterFunction, + Z, Function::New(accessor_name, + is_getter ? RawFunction::kGetterFunction + : RawFunction::kSetterFunction, is_static, /* is_const = */ false, /* is_abstract = */ false, is_external, is_native, owner, @@ -6243,7 +6116,6 @@ void Parser::ParseTopLevelAccessor(TopLevel* top_level, } } - RawObject* Parser::CallLibraryTagHandler(Dart_LibraryTag tag, TokenPosition token_pos, const String& url) { @@ -6283,7 +6155,6 @@ RawObject* Parser::CallLibraryTagHandler(Dart_LibraryTag tag, return result.raw(); } - void Parser::ParseLibraryName() { ASSERT(CurrentToken() == Token::kLIBRARY); ConsumeToken(); @@ -6302,7 +6173,6 @@ void Parser::ParseLibraryName() { ExpectSemicolon(); } - void Parser::ParseIdentList(GrowableObjectArray* names) { if (!IsIdentifier()) { ReportError("identifier expected"); @@ -6317,7 +6187,6 @@ void Parser::ParseIdentList(GrowableObjectArray* names) { } } - void Parser::ParseLibraryImportExport(const Object& tl_owner, TokenPosition metadata_pos) { ASSERT(Thread::Current()->IsMutatorThread()); @@ -6499,7 +6368,6 @@ void Parser::ParseLibraryImportExport(const Object& tl_owner, } } - void Parser::ParseLibraryPart() { const TokenPosition source_pos = TokenPos(); ConsumeToken(); // Consume "part". @@ -6517,7 +6385,6 @@ void Parser::ParseLibraryPart() { CallLibraryTagHandler(Dart_kSourceTag, source_pos, canon_url); } - void Parser::ParseLibraryDefinition(const Object& tl_owner) { TRACE_PARSER("ParseLibraryDefinition"); @@ -6570,7 +6437,6 @@ void Parser::ParseLibraryDefinition(const Object& tl_owner) { SetPosition(rewind_pos); } - void Parser::ParsePartHeader() { SkipMetadata(); CheckToken(Token::kPART, "'part of' expected"); @@ -6593,7 +6459,6 @@ void Parser::ParsePartHeader() { ExpectSemicolon(); } - void Parser::ParseTopLevel() { TRACE_PARSER("ParseTopLevel"); // Collect the classes found at the top level in this growable array. @@ -6668,7 +6533,6 @@ void Parser::ParseTopLevel() { pending_classes.Add(toplevel_class, Heap::kOld); } - void Parser::CheckStack() { volatile uword c_stack_pos = Thread::GetCurrentStackPointer(); volatile uword c_stack_base = OSThread::Current()->stack_base(); @@ -6680,14 +6544,12 @@ void Parser::CheckStack() { } } - void Parser::ChainNewBlock(LocalScope* outer_scope) { Block* block = new (Z) Block(current_block_, outer_scope, new (Z) SequenceNode(TokenPos(), outer_scope)); current_block_ = block; } - void Parser::OpenBlock() { ASSERT(current_block_ != NULL); LocalScope* outer_scope = current_block_->scope; @@ -6695,7 +6557,6 @@ void Parser::OpenBlock() { outer_scope->loop_level())); } - void Parser::OpenLoopBlock() { ASSERT(current_block_ != NULL); LocalScope* outer_scope = current_block_->scope; @@ -6703,7 +6564,6 @@ void Parser::OpenLoopBlock() { outer_scope->loop_level() + 1)); } - void Parser::OpenFunctionBlock(const Function& func) { LocalScope* outer_scope; if (current_block_ == NULL) { @@ -6727,14 +6587,12 @@ void Parser::OpenFunctionBlock(const Function& func) { ChainNewBlock(outer_scope); } - void Parser::OpenAsyncClosure() { TRACE_PARSER("OpenAsyncClosure"); async_temp_scope_ = current_block_->scope; OpenAsyncTryBlock(); } - SequenceNode* Parser::CloseAsyncGeneratorTryBlock(SequenceNode* body) { TRACE_PARSER("CloseAsyncGeneratorTryBlock"); // The generated try-catch-finally that wraps the async generator function @@ -6890,7 +6748,6 @@ SequenceNode* Parser::CloseAsyncGeneratorTryBlock(SequenceNode* body) { return CloseBlock(); } - SequenceNode* Parser::CloseAsyncTryBlock(SequenceNode* try_block, TokenPosition func_end_pos) { // This is the outermost try-catch of the function. @@ -6991,7 +6848,6 @@ SequenceNode* Parser::CloseAsyncTryBlock(SequenceNode* try_block, return CloseBlock(); } - // Wrap the body of the async or async* closure in a try/catch block. void Parser::OpenAsyncTryBlock() { ASSERT(innermost_function().IsAsyncClosure() || @@ -7016,7 +6872,6 @@ void Parser::OpenAsyncTryBlock() { SetupSavedTryContext(context_var); } - void Parser::AddSyncGenClosureParameters(ParamList* params) { // Create the parameter list for the body closure of a sync generator: // 1) Implicit closure parameter; @@ -7034,14 +6889,12 @@ void Parser::AddSyncGenClosureParameters(ParamList* params) { params->num_fixed_parameters++; } - void Parser::AddAsyncGenClosureParameters(ParamList* params) { // Create the parameter list for the body closure of an async generator. // The closure has the same parameters as an asynchronous non-generator. AddAsyncClosureParameters(params); } - RawFunction* Parser::OpenSyncGeneratorFunction(TokenPosition func_pos) { Function& body = Function::Handle(Z); String& body_closure_name = String::Handle(Z); @@ -7137,7 +6990,6 @@ SequenceNode* Parser::CloseSyncGenFunction(const Function& closure, return CloseBlock(); } - void Parser::AddAsyncClosureParameters(ParamList* params) { // Async closures have three optional parameters: // * A continuation result. @@ -7169,7 +7021,6 @@ void Parser::AddAsyncClosureParameters(ParamList* params) { params->num_optional_parameters += 3; } - RawFunction* Parser::OpenAsyncFunction(TokenPosition async_func_pos) { TRACE_PARSER("OpenAsyncFunction"); AddContinuationVariables(); @@ -7220,7 +7071,6 @@ RawFunction* Parser::OpenAsyncFunction(TokenPosition async_func_pos) { return closure.raw(); } - void Parser::AddContinuationVariables() { // Add to current block's scope: // var :await_jump_var; @@ -7235,7 +7085,6 @@ void Parser::AddContinuationVariables() { current_block_->scope->AddVariable(await_ctx_var); } - void Parser::AddAsyncClosureVariables() { // Add to current block's scope: // var :async_op; @@ -7265,7 +7114,6 @@ void Parser::AddAsyncClosureVariables() { current_block_->scope->AddVariable(async_stack_trace); } - void Parser::AddAsyncGeneratorVariables() { // Add to current block's scope: // var :controller; @@ -7305,7 +7153,6 @@ void Parser::AddAsyncGeneratorVariables() { current_block_->scope->AddVariable(controller_stream); } - RawFunction* Parser::OpenAsyncGeneratorFunction(TokenPosition async_func_pos) { TRACE_PARSER("OpenAsyncGeneratorFunction"); AddContinuationVariables(); @@ -7359,7 +7206,6 @@ RawFunction* Parser::OpenAsyncGeneratorFunction(TokenPosition async_func_pos) { return closure.raw(); } - // Generate the Ast nodes for the implicit code of the async* function. // // f(...) async* { @@ -7429,7 +7275,6 @@ SequenceNode* Parser::CloseAsyncGeneratorFunction(const Function& closure_func, TokenPosition token_pos = TokenPosition::kNoSource; - // Add to AST: // :async_op = ; (containing the original body) LocalVariable* async_op_var = @@ -7544,13 +7389,11 @@ SequenceNode* Parser::CloseAsyncGeneratorFunction(const Function& closure_func, return CloseBlock(); } - void Parser::OpenAsyncGeneratorClosure() { async_temp_scope_ = current_block_->scope; OpenAsyncTryBlock(); } - SequenceNode* Parser::CloseAsyncGeneratorClosure(SequenceNode* body) { // We need a temporary expression to store intermediate return values. parsed_function()->EnsureExpressionTemp(); @@ -7561,7 +7404,6 @@ SequenceNode* Parser::CloseAsyncGeneratorClosure(SequenceNode* body) { return new_body; } - // Add a return node to the sequence if necessary. void Parser::EnsureHasReturnStatement(SequenceNode* seq, TokenPosition return_pos) { @@ -7578,7 +7420,6 @@ void Parser::EnsureHasReturnStatement(SequenceNode* seq, } } - SequenceNode* Parser::CloseBlock() { SequenceNode* statements = current_block_->statements; if (current_block_->scope != NULL) { @@ -7591,7 +7432,6 @@ SequenceNode* Parser::CloseBlock() { return statements; } - SequenceNode* Parser::CloseAsyncFunction(const Function& closure, SequenceNode* closure_body) { TRACE_PARSER("CloseAsyncFunction"); @@ -7744,7 +7584,6 @@ SequenceNode* Parser::CloseAsyncFunction(const Function& closure, return CloseBlock(); } - SequenceNode* Parser::CloseAsyncClosure(SequenceNode* body, TokenPosition func_end_pos) { // We need a temporary expression to store intermediate return values. @@ -7756,7 +7595,6 @@ SequenceNode* Parser::CloseAsyncClosure(SequenceNode* body, return new_body; } - // Set up default values for all optional parameters to the function. void Parser::SetupDefaultsForOptionalParams(const ParamList& params) { if ((current_function().raw() == innermost_function().raw()) && @@ -7776,7 +7614,6 @@ void Parser::SetupDefaultsForOptionalParams(const ParamList& params) { } } - void Parser::FinalizeFormalParameterTypes(const ParamList* params) { ASSERT((params != NULL) && (params->parameters != NULL)); const int num_parameters = params->parameters->length(); @@ -7792,7 +7629,6 @@ void Parser::FinalizeFormalParameterTypes(const ParamList* params) { } } - // Populate the parameter type array and parameter name array of the function // with the formal parameter types and names. void Parser::AddFormalParamsToFunction(const ParamList* params, @@ -7838,7 +7674,6 @@ void Parser::AddFormalParamsToFunction(const ParamList* params, } } - // Populate local scope with the formal parameters. void Parser::AddFormalParamsToScope(const ParamList* params, LocalScope* scope) { @@ -7867,7 +7702,6 @@ void Parser::AddFormalParamsToScope(const ParamList* params, } } - // Builds ReturnNode/NativeBodyNode for a native function. void Parser::ParseNativeFunctionBlock(const ParamList* params, const Function& func) { @@ -7886,13 +7720,11 @@ void Parser::ParseNativeFunctionBlock(const ParamList* params, FLAG_link_natives_lazily))); } - LocalVariable* Parser::LookupReceiver(LocalScope* from_scope, bool test_only) { ASSERT(!current_function().is_static()); return from_scope->LookupVariable(Symbols::This(), test_only); } - LocalVariable* Parser::LookupTypeArgumentsParameter(LocalScope* from_scope, bool test_only) { ASSERT(current_function().IsInFactoryScope()); @@ -7900,7 +7732,6 @@ LocalVariable* Parser::LookupTypeArgumentsParameter(LocalScope* from_scope, test_only); } - void Parser::CaptureInstantiator() { ASSERT(FunctionLevel() > 0); const String* variable_name = current_function().IsInFactoryScope() @@ -7910,7 +7741,6 @@ void Parser::CaptureInstantiator() { current_block_->scope->LookupVariable(*variable_name, true)); } - void Parser::CaptureFunctionTypeArguments() { ASSERT(InGenericFunctionScope()); ASSERT(FunctionLevel() > 0); @@ -7922,7 +7752,6 @@ void Parser::CaptureFunctionTypeArguments() { current_block_->scope->LookupVariable(*variable_name, true)); } - void Parser::CaptureAllInstantiators() { if (IsInstantiatorRequired()) { CaptureInstantiator(); @@ -7932,7 +7761,6 @@ void Parser::CaptureAllInstantiators() { } } - AstNode* Parser::LoadReceiver(TokenPosition token_pos) { // A nested function may access 'this', referring to the receiver of the // outermost enclosing function. @@ -7944,14 +7772,12 @@ AstNode* Parser::LoadReceiver(TokenPosition token_pos) { return new (Z) LoadLocalNode(TokenPos(), receiver); } - InstanceGetterNode* Parser::CallGetter(TokenPosition token_pos, AstNode* object, const String& name) { return new (Z) InstanceGetterNode(token_pos, object, name); } - // Returns ast nodes of the variable initialization. AstNode* Parser::ParseVariableDeclaration(const AbstractType& type, bool is_final, @@ -8022,7 +7848,6 @@ AstNode* Parser::ParseVariableDeclaration(const AbstractType& type, return initialization; } - // Parses ('var' | 'final' [type] | 'const' [type] | type). // The presence of 'final' or 'const' must be detected and remembered // before the call. If a type is parsed, it may be resolved and finalized @@ -8063,7 +7888,6 @@ RawAbstractType* Parser::ParseConstFinalVarOrType( return ParseTypeOrFunctionType(false, finalization); } - // Returns ast nodes of the variable initialization. Variables without an // explicit initializer are initialized to null. If several variables are // declared, the individual initializers are collected in a sequence node. @@ -8109,7 +7933,6 @@ AstNode* Parser::ParseVariableDeclarationList() { return initializers; } - AstNode* Parser::ParseFunctionStatement(bool is_literal) { TRACE_PARSER("ParseFunctionStatement"); AbstractType& result_type = AbstractType::Handle(Z, Type::DynamicType()); @@ -8316,11 +8139,11 @@ AstNode* Parser::ParseFunctionStatement(bool is_literal) { ASSERT(innermost_function_.raw() == function.raw()); innermost_function_ = function.parent_function(); - return is_literal ? closure : new (Z) StoreLocalNode( - function_pos, function_variable, closure); + return is_literal + ? closure + : new (Z) StoreLocalNode(function_pos, function_variable, closure); } - // Returns true if the current and next tokens can be parsed as type // parameters. Current token position is not saved and restored. bool Parser::TryParseTypeParameters() { @@ -8353,7 +8176,6 @@ bool Parser::TryParseTypeParameters() { return true; } - // Returns true if the next tokens can be parsed as type parameters. bool Parser::IsTypeParameters() { if (CurrentToken() == Token::kLT) { @@ -8366,7 +8188,6 @@ bool Parser::IsTypeParameters() { return false; } - // Returns true if the next tokens are [ typeParameters ] '('. bool Parser::IsParameterPart() { if (CurrentToken() == Token::kLPAREN) { @@ -8382,7 +8203,6 @@ bool Parser::IsParameterPart() { return false; } - // Returns true if the current and next tokens can be parsed as type // arguments. Current token position is not saved and restored. bool Parser::TryParseTypeArguments() { @@ -8420,7 +8240,6 @@ bool Parser::TryParseTypeArguments() { return true; } - // Returns true if the next tokens are [ typeArguments ] '('. bool Parser::IsArgumentPart() { if (CurrentToken() == Token::kLPAREN) { @@ -8436,7 +8255,6 @@ bool Parser::IsArgumentPart() { return false; } - bool Parser::IsSimpleLiteral(const AbstractType& type, Instance* value) { // Assigning null never causes a type error. if (CurrentToken() == Token::kNULL) { @@ -8476,7 +8294,6 @@ bool Parser::IsSimpleLiteral(const AbstractType& type, Instance* value) { return false; } - // Returns true if the current token is kIDENT or a pseudo-keyword. bool Parser::IsIdentifier() { return Token::IsIdentifier(CurrentToken()) && @@ -8486,13 +8303,11 @@ bool Parser::IsIdentifier() { (CurrentLiteral()->raw() == Symbols::YieldKw().raw()))); } - bool Parser::IsSymbol(const String& symbol) { return (CurrentLiteral()->raw() == symbol.raw()) && (CurrentToken() == Token::kIDENT); } - // Returns true if the current token is 'Function' followed by '<' or '('. // 'Function' not followed by '<' or '(' denotes the Function class. bool Parser::IsFunctionTypeSymbol() { @@ -8501,7 +8316,6 @@ bool Parser::IsFunctionTypeSymbol() { (LookaheadToken(1) == Token::kLT)); } - // Returns true if the next tokens can be parsed as a an optionally // qualified identifier: [ident '.'] ident. // Current token position is not restored. @@ -8520,7 +8334,6 @@ bool Parser::TryParseQualIdent() { return true; } - // Returns true if the next tokens can be parsed as a type with optional // type parameters. Current token position is not restored. // Allow 'void' as type if 'allow_void' is true. @@ -8560,7 +8373,6 @@ bool Parser::TryParseType(bool allow_void) { return found; } - // Look ahead to detect whether the next tokens should be parsed as // a variable declaration. Ignores optional metadata. // Returns true if we detect the token pattern: @@ -8624,7 +8436,6 @@ bool Parser::IsVariableDeclaration() { return is_var_decl; } - // Look ahead to see if the following tokens are a return type followed // by an identifier. bool Parser::IsFunctionReturnType() { @@ -8638,7 +8449,6 @@ bool Parser::IsFunctionReturnType() { return false; } - // Look ahead to detect whether the next tokens should be parsed as // a function declaration. Token position remains unchanged. bool Parser::IsFunctionDeclaration() { @@ -8682,7 +8492,6 @@ bool Parser::IsFunctionDeclaration() { return false; } - bool Parser::IsTopLevelAccessor() { const TokenPosScope saved_pos(this); if (CurrentToken() == Token::kEXTERNAL) { @@ -8701,7 +8510,6 @@ bool Parser::IsTopLevelAccessor() { return false; } - bool Parser::IsFunctionLiteral() { if (!allow_function_literals_) { return false; @@ -8724,7 +8532,6 @@ bool Parser::IsFunctionLiteral() { return false; } - // Current token position is the token after the opening ( of the for // statement. Returns true if we recognize a for ( .. in expr) // statement. @@ -8750,7 +8557,6 @@ bool Parser::IsForInStatement() { return false; } - static bool ContainsAbruptCompletingStatement(SequenceNode* seq); static bool IsAbruptCompleting(AstNode* statement) { @@ -8760,7 +8566,6 @@ static bool IsAbruptCompleting(AstNode* statement) { ContainsAbruptCompletingStatement(statement->AsSequenceNode())); } - static bool ContainsAbruptCompletingStatement(SequenceNode* seq) { for (int i = 0; i < seq->length(); i++) { if (IsAbruptCompleting(seq->NodeAt(i))) { @@ -8770,7 +8575,6 @@ static bool ContainsAbruptCompletingStatement(SequenceNode* seq) { return false; } - void Parser::ParseStatementSequence() { TRACE_PARSER("ParseStatementSequence"); const bool dead_code_allowed = true; @@ -8795,7 +8599,6 @@ void Parser::ParseStatementSequence() { } } - // Parse nested statement of if, while, for, etc. We automatically generate // a sequence of one statement if there are no curly braces. // The argument 'parsing_loop_body' indicates the parsing of a loop statement. @@ -8825,7 +8628,6 @@ SequenceNode* Parser::ParseNestedStatement(bool parsing_loop_body, return sequence; } - AstNode* Parser::ParseIfStatement(String* label_name) { TRACE_PARSER("ParseIfStatement"); ASSERT(CurrentToken() == Token::kIF); @@ -8858,7 +8660,6 @@ AstNode* Parser::ParseIfStatement(String* label_name) { return if_node; } - // Return true if the type class of the given value implements the // == operator. static bool ImplementsEqualOperator(Zone* zone, const Instance& value) { @@ -8871,7 +8672,6 @@ static bool ImplementsEqualOperator(Zone* zone, const Instance& value) { return !cls.IsObjectClass(); } - // Check that all case expressions are of the same type, either int, String, // or any other class that does not override the == operator. // The expressions are compile-time constants and are thus in the form @@ -8927,7 +8727,6 @@ RawClass* Parser::CheckCaseExpressions( return first_value.clazz(); } - CaseNode* Parser::ParseCaseClause(LocalVariable* switch_expr_value, GrowableArray* case_expr_values, SourceLabel* case_label) { @@ -9005,7 +8804,6 @@ CaseNode* Parser::ParseCaseClause(LocalVariable* switch_expr_value, switch_expr_value, statements); } - AstNode* Parser::ParseSwitchStatement(String* label_name) { TRACE_PARSER("ParseSwitchStatement"); ASSERT(CurrentToken() == Token::kSWITCH); @@ -9104,7 +8902,6 @@ AstNode* Parser::ParseSwitchStatement(String* label_name) { return new (Z) SwitchNode(switch_pos, label, switch_body); } - AstNode* Parser::ParseWhileStatement(String* label_name) { TRACE_PARSER("ParseWhileStatement"); const TokenPosition while_pos = TokenPos(); @@ -9123,7 +8920,6 @@ AstNode* Parser::ParseWhileStatement(String* label_name) { return while_node; } - AstNode* Parser::ParseDoWhileStatement(String* label_name) { TRACE_PARSER("ParseDoWhileStatement"); const TokenPosition do_pos = TokenPos(); @@ -9150,7 +8946,6 @@ AstNode* Parser::ParseDoWhileStatement(String* label_name) { return new (Z) DoWhileNode(do_pos, label, cond_expr, dowhile_body); } - static LocalVariable* LookupSavedTryContextVar(LocalScope* scope) { LocalVariable* var = scope->LocalLookupVariable(Symbols::SavedTryContextVar()); @@ -9158,7 +8953,6 @@ static LocalVariable* LookupSavedTryContextVar(LocalScope* scope) { return var; } - static LocalVariable* LookupAsyncSavedTryContextVar(Thread* thread, LocalScope* scope, uint16_t try_index) { @@ -9172,7 +8966,6 @@ static LocalVariable* LookupAsyncSavedTryContextVar(Thread* thread, return var; } - // If the await or yield being parsed is in a try block, the continuation code // needs to restore the corresponding stack-based variable :saved_try_ctx_var, // and the stack-based variable :saved_try_ctx_var of the outer try block. @@ -9228,7 +9021,6 @@ void Parser::CheckAsyncOpInTryBlock( innermost_function().IsSyncGenerator()); } - // Build an AST node for static call to Dart function print(str). // Used during debugging to insert print in generated dart code. AstNode* Parser::DartPrint(const char* str) { @@ -9245,7 +9037,6 @@ AstNode* Parser::DartPrint(const char* str) { return print_call; } - AstNode* Parser::ParseAwaitForStatement(String* label_name) { TRACE_PARSER("ParseAwaitForStatement"); ASSERT(IsAwaitKeyword()); @@ -9563,7 +9354,6 @@ AstNode* Parser::ParseAwaitForStatement(String* label_name) { return CloseBlock(); // Implicit block around while loop. } - AstNode* Parser::ParseForInStatement(TokenPosition forin_pos, SourceLabel* label) { TRACE_PARSER("ParseForInStatement"); @@ -9684,7 +9474,6 @@ AstNode* Parser::ParseForInStatement(TokenPosition forin_pos, return CloseBlock(); // Implicit block around while loop. } - AstNode* Parser::ParseForStatement(String* label_name) { TRACE_PARSER("ParseForStatement"); const TokenPosition for_pos = TokenPos(); @@ -9748,7 +9537,6 @@ AstNode* Parser::ParseForStatement(String* label_name) { return CloseBlock(); } - // Calling VM-internal helpers, uses implementation core library. AstNode* Parser::MakeStaticCall(const String& cls_name, const String& func_name, @@ -9763,7 +9551,6 @@ AstNode* Parser::MakeStaticCall(const String& cls_name, return new (Z) StaticCallNode(arguments->token_pos(), func, arguments); } - AstNode* Parser::ParseAssertStatement(bool is_const) { TRACE_PARSER("ParseAssertStatement"); ConsumeToken(); // Consume assert keyword. @@ -9870,7 +9657,6 @@ AstNode* Parser::ParseAssertStatement(bool is_const) { return assertion_check; } - // Populate local scope of the catch block with the catch parameters. void Parser::AddCatchParamsToScope(CatchParamDesc* exception_param, CatchParamDesc* stack_trace_param, @@ -9900,7 +9686,6 @@ void Parser::AddCatchParamsToScope(CatchParamDesc* exception_param, } } - // Generate code to load the exception object (:exception_var) into // the saved exception variable (:saved_exception_var) used to rethrow. // Generate code to load the stack trace object (:stack_trace_var) into @@ -9930,7 +9715,6 @@ void Parser::SaveExceptionAndStackTrace(SequenceNode* statements, new (Z) LoadLocalNode(TokenPosition::kNoSource, stack_trace_var))); } - SequenceNode* Parser::EnsureFinallyClause( bool parse, bool is_async, @@ -9994,20 +9778,17 @@ SequenceNode* Parser::EnsureFinallyClause( return finally_clause; } - void Parser::PushTry(Block* try_block) { intptr_t try_index = AllocateTryIndex(); try_stack_ = new (Z) TryStack(try_block, try_stack_, try_index); } - Parser::TryStack* Parser::PopTry() { TryStack* innermost_try = try_stack_; try_stack_ = try_stack_->outer_try(); return innermost_try; } - void Parser::AddNodeForFinallyInlining(AstNode* node) { if (node == NULL) { return; @@ -10041,7 +9822,6 @@ void Parser::AddNodeForFinallyInlining(AstNode* node) { } } - void Parser::RemoveNodesForFinallyInlining(SourceLabel* label) { TryStack* iterator = try_stack_; const intptr_t func_level = FunctionLevel(); @@ -10052,7 +9832,6 @@ void Parser::RemoveNodesForFinallyInlining(SourceLabel* label) { } } - // Add the inlined finally clause to the specified node. void Parser::AddFinallyClauseToNode(bool is_async, AstNode* node, @@ -10070,7 +9849,6 @@ void Parser::AddFinallyClauseToNode(bool is_async, jump_node->AddInlinedFinallyNode(finally_clause); } - SequenceNode* Parser::ParseCatchClauses( TokenPosition handler_pos, bool is_async, @@ -10272,7 +10050,6 @@ SequenceNode* Parser::ParseCatchClauses( return current; } - void Parser::SetupSavedTryContext(LocalVariable* saved_try_context) { const String& async_saved_try_ctx_name = String::ZoneHandle( Z, Symbols::NewFormatted(T, "%s%d", @@ -10289,7 +10066,6 @@ void Parser::SetupSavedTryContext(LocalVariable* saved_try_context) { new (Z) LoadLocalNode(TokenPosition::kNoSource, saved_try_context))); } - // We create three variables for exceptions: // ':saved_try_context_var' - Used to save the context before the start of // the try block. The context register is @@ -10356,7 +10132,6 @@ void Parser::SetupExceptionVariables(LocalScope* try_scope, } } - AstNode* Parser::ParseTryStatement(String* label_name) { TRACE_PARSER("ParseTryStatement"); @@ -10494,7 +10269,6 @@ AstNode* Parser::ParseTryStatement(String* label_name) { return try_catch_node; } - AstNode* Parser::ParseJump(String* label_name) { TRACE_PARSER("ParseJump"); ASSERT(CurrentToken() == Token::kBREAK || CurrentToken() == Token::kCONTINUE); @@ -10561,7 +10335,6 @@ AstNode* Parser::ParseJump(String* label_name) { return new (Z) JumpNode(jump_pos, jump_kind, target); } - AstNode* Parser::ParseYieldStatement() { bool is_yield_each = false; const TokenPosition yield_pos = TokenPos(); @@ -10700,7 +10473,6 @@ AstNode* Parser::ParseYieldStatement() { return yield; } - AstNode* Parser::ParseStatement() { TRACE_PARSER("ParseStatement"); AstNode* statement = NULL; @@ -10888,13 +10660,11 @@ AstNode* Parser::ParseStatement() { return statement; } - void Parser::ReportError(const Error& error) { Report::LongJump(error); UNREACHABLE(); } - void Parser::ReportErrors(const Error& prev_error, const Script& script, TokenPosition token_pos, @@ -10907,7 +10677,6 @@ void Parser::ReportErrors(const Error& prev_error, UNREACHABLE(); } - void Parser::ReportError(TokenPosition token_pos, const char* format, ...) const { @@ -10919,7 +10688,6 @@ void Parser::ReportError(TokenPosition token_pos, UNREACHABLE(); } - void Parser::ReportErrorBefore(const char* format, ...) { va_list args; va_start(args, format); @@ -10929,7 +10697,6 @@ void Parser::ReportErrorBefore(const char* format, ...) { UNREACHABLE(); } - void Parser::ReportError(const char* format, ...) const { va_list args; va_start(args, format); @@ -10939,7 +10706,6 @@ void Parser::ReportError(const char* format, ...) const { UNREACHABLE(); } - void Parser::ReportWarning(TokenPosition token_pos, const char* format, ...) const { @@ -10950,7 +10716,6 @@ void Parser::ReportWarning(TokenPosition token_pos, va_end(args); } - void Parser::ReportWarning(const char* format, ...) const { va_list args; va_start(args, format); @@ -10959,7 +10724,6 @@ void Parser::ReportWarning(const char* format, ...) const { va_end(args); } - void Parser::CheckToken(Token::Kind token_expected, const char* msg) { if (CurrentToken() != token_expected) { if (msg != NULL) { @@ -10970,7 +10734,6 @@ void Parser::CheckToken(Token::Kind token_expected, const char* msg) { } } - void Parser::ExpectToken(Token::Kind token_expected) { if (CurrentToken() != token_expected) { ReportError("'%s' expected", Token::Str(token_expected)); @@ -10978,7 +10741,6 @@ void Parser::ExpectToken(Token::Kind token_expected) { ConsumeToken(); } - void Parser::ExpectSemicolon() { if (CurrentToken() != Token::kSEMICOLON) { ReportErrorBefore("semicolon expected"); @@ -10986,14 +10748,12 @@ void Parser::ExpectSemicolon() { ConsumeToken(); } - void Parser::UnexpectedToken() { ReportError("unexpected token '%s'", CurrentToken() == Token::kIDENT ? CurrentLiteral()->ToCString() : Token::Str(CurrentToken())); } - String* Parser::ExpectUserDefinedTypeIdentifier(const char* msg) { if (CurrentToken() != Token::kIDENT) { ReportError("%s", msg); @@ -11006,7 +10766,6 @@ String* Parser::ExpectUserDefinedTypeIdentifier(const char* msg) { return ident; } - // Check whether current token is an identifier or a built-in identifier. String* Parser::ExpectIdentifier(const char* msg) { if (!IsIdentifier()) { @@ -11017,30 +10776,25 @@ String* Parser::ExpectIdentifier(const char* msg) { return ident; } - bool Parser::IsAwaitKeyword() { return (FLAG_await_is_keyword || await_is_keyword_) && IsSymbol(Symbols::Await()); } - bool Parser::IsYieldKeyword() { return (FLAG_await_is_keyword || await_is_keyword_) && IsSymbol(Symbols::YieldKw()); } - static bool IsIncrementOperator(Token::Kind token) { return token == Token::kINCR || token == Token::kDECR; } - static bool IsPrefixOperator(Token::Kind token) { return (token == Token::kSUB) || (token == Token::kNOT) || (token == Token::kBIT_NOT); } - SequenceNode* Parser::NodeAsSequenceNode(TokenPosition sequence_pos, AstNode* node, LocalScope* scope) { @@ -11054,7 +10808,6 @@ SequenceNode* Parser::NodeAsSequenceNode(TokenPosition sequence_pos, return node->AsSequenceNode(); } - // Call _throwNewIfNotLoaded if prefix is not NULL, otherwise call _throwNew. AstNode* Parser::ThrowTypeError(TokenPosition type_pos, const AbstractType& type, @@ -11084,7 +10837,6 @@ AstNode* Parser::ThrowTypeError(TokenPosition type_pos, return MakeStaticCall(Symbols::TypeError(), method_name, arguments); } - // Call _throwNewIfNotLoaded if prefix is not NULL, otherwise call _throwNew. AstNode* Parser::ThrowNoSuchMethodError(TokenPosition call_pos, const Class& cls, @@ -11178,7 +10930,6 @@ AstNode* Parser::ThrowNoSuchMethodError(TokenPosition call_pos, return MakeStaticCall(Symbols::NoSuchMethodError(), method_name, arguments); } - AstNode* Parser::ParseBinaryExpr(int min_preced) { TRACE_PARSER("ParseBinaryExpr"); ASSERT(min_preced >= Token::Precedence(Token::kIFNULL)); @@ -11241,7 +10992,6 @@ AstNode* Parser::ParseBinaryExpr(int min_preced) { return left_operand; } - AstNode* Parser::ParseAwaitableExprList() { TRACE_PARSER("ParseAwaitableExprList"); SequenceNode* preamble = NULL; @@ -11270,13 +11020,11 @@ AstNode* Parser::ParseAwaitableExprList() { return expressions; } - void Parser::EnsureExpressionTemp() { // Temporary used later by the flow_graph_builder. parsed_function()->EnsureExpressionTemp(); } - LocalVariable* Parser::CreateTempConstVariable(TokenPosition token_pos, const char* s) { char name[64]; @@ -11289,7 +11037,6 @@ LocalVariable* Parser::CreateTempConstVariable(TokenPosition token_pos, return temp; } - AstNode* Parser::OptimizeBinaryOpNode(TokenPosition op_pos, Token::Kind binary_op, AstNode* lhs, @@ -11344,7 +11091,6 @@ AstNode* Parser::OptimizeBinaryOpNode(TokenPosition op_pos, return new (Z) BinaryOpNode(op_pos, binary_op, lhs, rhs); } - AstNode* Parser::ExpandAssignableOp(TokenPosition op_pos, Token::Kind assignment_op, AstNode* lhs, @@ -11386,7 +11132,6 @@ AstNode* Parser::ExpandAssignableOp(TokenPosition op_pos, } } - // Evaluates the value of the compile time constant expression // and returns a literal node for the value. LiteralNode* Parser::FoldConstExpr(TokenPosition expr_pos, AstNode* expr) { @@ -11399,7 +11144,6 @@ LiteralNode* Parser::FoldConstExpr(TokenPosition expr_pos, AstNode* expr) { return new (Z) LiteralNode(expr_pos, EvaluateConstExpr(expr_pos, expr)); } - LetNode* Parser::PrepareCompoundAssignmentNodes(AstNode** expr) { AstNode* node = *expr; TokenPosition token_pos = node->token_pos(); @@ -11434,7 +11178,6 @@ LetNode* Parser::PrepareCompoundAssignmentNodes(AstNode** expr) { return result; } - // Check whether the syntax of expression expr is a grammatically legal // assignable expression. This check is used to detect situations where // the expression itself is assignable, but the source is grammatically @@ -11456,7 +11199,6 @@ bool Parser::IsLegalAssignableSyntax(AstNode* expr, TokenPosition end_pos) { return Token::IsIdentifier(token) || (token == Token::kRBRACK); } - AstNode* Parser::CreateAssignmentNode(AstNode* original, AstNode* rhs, const String* left_ident, @@ -11507,7 +11249,6 @@ AstNode* Parser::CreateAssignmentNode(AstNode* original, return result; } - AstNode* Parser::ParseCascades(AstNode* expr) { TokenPosition cascade_pos = TokenPos(); LetNode* cascade = new (Z) LetNode(cascade_pos); @@ -11564,7 +11305,6 @@ AstNode* Parser::ParseCascades(AstNode* expr) { return cascade; } - // Convert loading of a static const field into a literal node. static AstNode* LiteralIfStaticConst(Zone* zone, AstNode* expr) { if (expr->IsLoadStaticFieldNode()) { @@ -11580,7 +11320,6 @@ static AstNode* LiteralIfStaticConst(Zone* zone, AstNode* expr) { return expr; } - AstNode* Parser::ParseAwaitableExpr(bool require_compiletime_const, bool consume_cascades, SequenceNode** await_preamble) { @@ -11606,7 +11345,6 @@ AstNode* Parser::ParseAwaitableExpr(bool require_compiletime_const, return expr; } - AstNode* Parser::ParseExpr(bool require_compiletime_const, bool consume_cascades) { TRACE_PARSER("ParseExpr"); @@ -11681,7 +11419,6 @@ AstNode* Parser::ParseExpr(bool require_compiletime_const, } } - LiteralNode* Parser::ParseConstExpr() { TRACE_PARSER("ParseConstExpr"); TokenPosition expr_pos = TokenPos(); @@ -11692,7 +11429,6 @@ LiteralNode* Parser::ParseConstExpr() { return expr->AsLiteralNode(); } - AstNode* Parser::ParseConditionalExpr() { TRACE_PARSER("ParseConditionalExpr"); const TokenPosition expr_pos = TokenPos(); @@ -11708,7 +11444,6 @@ AstNode* Parser::ParseConditionalExpr() { return expr; } - AstNode* Parser::ParseUnaryExpr() { TRACE_PARSER("ParseUnaryExpr"); AstNode* expr = NULL; @@ -11773,7 +11508,6 @@ AstNode* Parser::ParseUnaryExpr() { return expr; } - ArgumentListNode* Parser::ParseActualParameters( ArgumentListNode* implicit_arguments, const TypeArguments& func_type_args, @@ -11835,7 +11569,6 @@ ArgumentListNode* Parser::ParseActualParameters( return arguments; } - AstNode* Parser::ParseStaticCall(const Class& cls, const String& func_name, TokenPosition ident_pos, @@ -11914,7 +11647,6 @@ AstNode* Parser::ParseStaticCall(const Class& cls, return new (Z) StaticCallNode(ident_pos, func, arguments); } - AstNode* Parser::ParseInstanceCall(AstNode* receiver, const String& func_name, TokenPosition ident_pos, @@ -11928,7 +11660,6 @@ AstNode* Parser::ParseInstanceCall(AstNode* receiver, is_conditional); } - AstNode* Parser::ParseClosureCall(AstNode* closure, const TypeArguments& func_type_args) { TRACE_PARSER("ParseClosureCall"); @@ -11939,7 +11670,6 @@ AstNode* Parser::ParseClosureCall(AstNode* closure, return BuildClosureCall(call_pos, closure, arguments); } - AstNode* Parser::GenerateStaticFieldLookup(const Field& field, TokenPosition ident_pos) { // If the static field has an initializer, initialize the field at compile @@ -11970,7 +11700,6 @@ AstNode* Parser::GenerateStaticFieldLookup(const Field& field, } } - // Reference to 'field_name' with explicit class as primary. AstNode* Parser::GenerateStaticFieldAccess(const Class& cls, const String& field_name, @@ -12007,7 +11736,6 @@ AstNode* Parser::GenerateStaticFieldAccess(const Class& cls, return access; } - AstNode* Parser::LoadFieldIfUnresolved(AstNode* node) { if (!node->IsPrimaryNode()) { return node; @@ -12046,7 +11774,6 @@ AstNode* Parser::LoadFieldIfUnresolved(AstNode* node) { return primary; } - AstNode* Parser::LoadClosure(PrimaryNode* primary) { ASSERT(primary->primary().IsFunction()); const Function& func = @@ -12073,7 +11800,6 @@ AstNode* Parser::LoadClosure(PrimaryNode* primary) { return NULL; } - AstNode* Parser::LoadTypeParameter(PrimaryNode* primary) { const TokenPosition primary_pos = primary->token_pos(); TypeParameter& type_parameter = TypeParameter::ZoneHandle(Z); @@ -12107,7 +11833,6 @@ AstNode* Parser::LoadTypeParameter(PrimaryNode* primary) { return new (Z) TypeNode(primary_pos, type_parameter); } - AstNode* Parser::ParseSelectors(AstNode* primary, bool is_cascade) { AstNode* left = primary; while (true) { @@ -12355,7 +12080,6 @@ AstNode* Parser::ParseSelectors(AstNode* primary, bool is_cascade) { } } - // Closurization e#m of getter, setter, method or operator. AstNode* Parser::ParseClosurization(AstNode* primary) { if (!FLAG_support_deprecated_tearoff_syntax) { @@ -12511,7 +12235,6 @@ AstNode* Parser::ParseClosurization(AstNode* primary) { return new (Z) InstanceGetterNode(property_pos, primary, extractor_name); } - AstNode* Parser::ParsePostfixExpr() { TRACE_PARSER("ParsePostfixExpr"); String* expr_ident = @@ -12552,7 +12275,6 @@ AstNode* Parser::ParsePostfixExpr() { return expr; } - // Resolve the type parameters that may appear in the given signature from the // signature function and current class. // Unresolved type classes get resolved later by the class finalizer. @@ -12588,7 +12310,6 @@ void Parser::ResolveSignature(const Function& signature) { innermost_function_ = saved_innermost_function.raw(); } - // Resolve the type parameters that may appear in the given type and in its type // arguments from the current function and current class. // Unresolved type classes get resolved later by the class finalizer. @@ -12688,7 +12409,6 @@ void Parser::ResolveType(AbstractType* type) { } } - RawAbstractType* Parser::CanonicalizeType(const AbstractType& type) { // If the current class is the result of a mixin application, we must // use the class scope of the class from which the function originates. @@ -12699,7 +12419,6 @@ RawAbstractType* Parser::CanonicalizeType(const AbstractType& type) { return ClassFinalizer::FinalizeType(current_class(), type); } - LocalVariable* Parser::LookupLocalScope(const String& ident) { if (current_block_ == NULL) { return NULL; @@ -12709,7 +12428,6 @@ LocalVariable* Parser::LookupLocalScope(const String& ident) { return current_block_->scope->LookupVariable(ident, kTestOnly); } - void Parser::CheckInstanceFieldAccess(TokenPosition field_pos, const String& field_name) { // Fields are not accessible from a static function, except from a @@ -12721,7 +12439,6 @@ void Parser::CheckInstanceFieldAccess(TokenPosition field_pos, } } - bool Parser::ParsingStaticMember() const { if (is_top_level_) { return (current_member_ != NULL) && current_member_->has_static && @@ -12732,7 +12449,6 @@ bool Parser::ParsingStaticMember() const { !current_function().IsInFactoryScope(); } - const AbstractType* Parser::ReceiverType(const Class& cls) { ASSERT(!cls.IsNull()); ASSERT(!cls.IsTypedefClass()); @@ -12752,7 +12468,6 @@ const AbstractType* Parser::ReceiverType(const Class& cls) { return &type; } - bool Parser::IsInstantiatorRequired() const { ASSERT(!current_function().IsNull()); if (current_function().is_static() && @@ -12762,7 +12477,6 @@ bool Parser::IsInstantiatorRequired() const { return current_class().IsGeneric(); } - bool Parser::InGenericFunctionScope() const { if (!innermost_function().IsNull()) { // With one more free tag bit in Function, we could cache this information. @@ -12774,7 +12488,6 @@ bool Parser::InGenericFunctionScope() const { return false; } - void Parser::InsertCachedConstantValue(const Script& script, TokenPosition token_pos, const Instance& value) { @@ -12791,7 +12504,6 @@ void Parser::InsertCachedConstantValue(const Script& script, script.set_compile_time_constants(constants.Release()); } - void Parser::CacheConstantValue(TokenPosition token_pos, const Instance& value) { if (current_function().kind() == RawFunction::kImplicitStaticFinalGetter) { @@ -12803,7 +12515,6 @@ void Parser::CacheConstantValue(TokenPosition token_pos, INC_STAT(thread_, num_cached_consts, 1); } - bool Parser::GetCachedConstant(TokenPosition token_pos, Instance* value) { bool is_present = false; ASSERT(!script_.InVMHeap()); @@ -12822,7 +12533,6 @@ bool Parser::GetCachedConstant(TokenPosition token_pos, Instance* value) { return is_present; } - RawInstance* Parser::TryCanonicalize(const Instance& instance, TokenPosition token_pos) { if (instance.IsNull()) { @@ -12837,7 +12547,6 @@ RawInstance* Parser::TryCanonicalize(const Instance& instance, return result.raw(); } - // If the field is already initialized, return no ast (NULL). // Otherwise, if the field is constant, initialize the field and return no ast. // If the field is not initialized and not const, return the ast for the getter. @@ -12916,7 +12625,6 @@ StaticGetterNode* Parser::RunStaticFieldInitializer( return new (Z) StaticGetterNode(field_ref_pos, NULL, field_owner, field_name); } - RawObject* Parser::EvaluateConstConstructorCall( const Class& type_class, const TypeArguments& type_arguments, @@ -12980,7 +12688,6 @@ RawObject* Parser::EvaluateConstConstructorCall( } } - // Do a lookup for the identifier in the block scope and the class scope // return true if the identifier is found, false otherwise. // If node is non NULL return an AST node corresponding to the identifier. @@ -13088,7 +12795,6 @@ bool Parser::ResolveIdentInLocalScope(TokenPosition ident_pos, return false; } - // Resolve an identifier by checking the global scope of the current // library. If not found in the current library, then look in the scopes // of all libraries that are imported without a library prefix. @@ -13132,7 +12838,6 @@ AstNode* Parser::ResolveIdentInCurrentLibraryScope(TokenPosition ident_pos, return new (Z) PrimaryNode(ident_pos, ident); } - // Do a lookup for the identifier in the scope of the specified // library prefix. This means trying to resolve it locally in all of the // libraries present in the library prefix. @@ -13211,7 +12916,6 @@ AstNode* Parser::ResolveIdentInPrefixScope(TokenPosition ident_pos, return NULL; } - // Resolve identifier. Issue an error message if // the ident refers to a method and allow_closure_names is false. // If the name cannot be resolved, turn it into an instance field access @@ -13302,7 +13006,6 @@ AstNode* Parser::ResolveIdent(TokenPosition ident_pos, return resolved; } - RawAbstractType* Parser::ParseType( ClassFinalizer::FinalizationKind finalization, bool allow_deferred_type, @@ -13312,7 +13015,6 @@ RawAbstractType* Parser::ParseType( &prefix); } - // Parses and returns a type or a function type. RawAbstractType* Parser::ParseTypeOrFunctionType( bool allow_void, @@ -13353,7 +13055,6 @@ RawAbstractType* Parser::ParseTypeOrFunctionType( return type.raw(); } - // Parses and returns a function type. // If 'result_type' is not null, parsing of the result type is skipped. RawType* Parser::ParseFunctionType( @@ -13430,7 +13131,6 @@ RawType* Parser::ParseFunctionType( return Type::RawCast(type.raw()); } - // Parses type = [ident "."] ident ["<" type { "," type } ">"], then resolve and // finalize it according to the given type finalization mode. // Returns type and sets prefix. @@ -13517,9 +13217,10 @@ RawAbstractType* Parser::ParseType( ParseTypeArguments(ClassFinalizer::kIgnore); return ClassFinalizer::NewFinalizedMalformedType( Error::Handle(Z), // No previous error. - script_, ident_pos, !prefix->is_loaded() && allow_deferred_type - ? "deferred type '%s.%s' is not yet loaded" - : "using deferred type '%s.%s' is invalid", + script_, ident_pos, + !prefix->is_loaded() && allow_deferred_type + ? "deferred type '%s.%s' is not yet loaded" + : "using deferred type '%s.%s' is invalid", String::Handle(Z, prefix->name()).ToCString(), type_name.ToCString()); } @@ -13546,7 +13247,6 @@ RawAbstractType* Parser::ParseType( return type.raw(); } - void Parser::CheckConstructorCallTypeArguments( TokenPosition pos, const Function& constructor, @@ -13564,7 +13264,6 @@ void Parser::CheckConstructorCallTypeArguments( } } - // Parse "[" [ expr { "," expr } ["," ] "]". // Note: if the list literal is empty and the brackets have no whitespace // between them, the scanner recognizes the opening and closing bracket @@ -13727,7 +13426,6 @@ AstNode* Parser::ParseListLiteral(TokenPosition type_pos, } } - ConstructorCallNode* Parser::CreateConstructorCallNode( TokenPosition token_pos, const TypeArguments& type_arguments, @@ -13740,7 +13438,6 @@ ConstructorCallNode* Parser::CreateConstructorCallNode( ConstructorCallNode(token_pos, type_arguments, constructor, arguments); } - static void AddKeyValuePair(GrowableArray* pairs, bool is_const, AstNode* key, @@ -13765,7 +13462,6 @@ static void AddKeyValuePair(GrowableArray* pairs, pairs->Add(value); } - AstNode* Parser::ParseMapLiteral(TokenPosition type_pos, bool is_const, const TypeArguments& type_arguments) { @@ -13985,7 +13681,6 @@ AstNode* Parser::ParseMapLiteral(TokenPosition type_pos, return NULL; } - AstNode* Parser::ParseCompoundLiteral() { TRACE_PARSER("ParseCompoundLiteral"); bool is_const = false; @@ -14011,7 +13706,6 @@ AstNode* Parser::ParseCompoundLiteral() { return primary; } - AstNode* Parser::ParseSymbolLiteral() { ASSERT(CurrentToken() == Token::kHASH); ConsumeToken(); @@ -14061,7 +13755,6 @@ AstNode* Parser::ParseSymbolLiteral() { return new (Z) LiteralNode(symbol_pos, symbol_instance); } - RawFunction* Parser::BuildConstructorClosureFunction(const Function& ctr, TokenPosition token_pos) { ASSERT(ctr.kind() == RawFunction::kConstructor); @@ -14104,7 +13797,6 @@ RawFunction* Parser::BuildConstructorClosureFunction(const Function& ctr, return closure.raw(); } - static String& BuildConstructorName(Thread* thread, const String& type_class_name, const String* named_constructor) { @@ -14122,7 +13814,6 @@ static String& BuildConstructorName(Thread* thread, return constructor_name; } - // Parse a primary expression of the form new T# or new T#m. // Current token position is after the keyword new. Extracts the // anonymous or named constructor and type arguments. @@ -14185,7 +13876,6 @@ void Parser::ParseConstructorClosurization(Function* constructor, } } - AstNode* Parser::ParseNewOperator(Token::Kind op_kind) { TRACE_PARSER("ParseNewOperator"); const TokenPosition new_pos = TokenPos(); @@ -14539,7 +14229,6 @@ AstNode* Parser::ParseNewOperator(Token::Kind op_kind) { return new_object; } - String& Parser::Interpolate(const GrowableArray& values) { NoReloadScope no_reload_scope(isolate(), thread()); NoOOBMessageScope no_msg_scope(thread()); @@ -14575,7 +14264,6 @@ String& Parser::Interpolate(const GrowableArray& values) { return concatenated; } - // A string literal consists of the concatenation of the next n tokens // that satisfy the EBNF grammar: // literal = kSTRING {{ interpol } kSTRING } @@ -14680,7 +14368,6 @@ AstNode* Parser::ParseStringLiteral(bool allow_interpolation) { return primary; } - AstNode* Parser::ParsePrimary() { TRACE_PARSER("ParsePrimary"); ASSERT(!is_top_level_); @@ -14893,7 +14580,6 @@ AstNode* Parser::ParsePrimary() { return primary; } - // Evaluate expression in expr and return the value. The expression must // be a compile time constant. const Instance& Parser::EvaluateConstExpr(TokenPosition expr_pos, @@ -14951,7 +14637,6 @@ const Instance& Parser::EvaluateConstExpr(TokenPosition expr_pos, } } - void Parser::SkipFunctionLiteral() { if (IsIdentifier()) { if (LookaheadToken(1) != Token::kLPAREN) { @@ -14974,7 +14659,6 @@ void Parser::SkipFunctionLiteral() { } } - // Skips function/method/constructor/getter/setter preambles until the formal // parameter list. It is enough to skip the tokens, since we have already // previously parsed the function. @@ -15011,7 +14695,6 @@ void Parser::SkipFunctionPreamble() { } } - void Parser::SkipListLiteral() { if (CurrentToken() == Token::kINDEX) { // Empty list literal. @@ -15030,7 +14713,6 @@ void Parser::SkipListLiteral() { ExpectToken(Token::kRBRACK); } - void Parser::SkipMapLiteral() { ExpectToken(Token::kLBRACE); while (CurrentToken() != Token::kRBRACE) { @@ -15046,7 +14728,6 @@ void Parser::SkipMapLiteral() { ExpectToken(Token::kRBRACE); } - void Parser::SkipActualParameters() { if (CurrentToken() == Token::kLT) { SkipTypeArguments(); @@ -15066,7 +14747,6 @@ void Parser::SkipActualParameters() { ExpectToken(Token::kRPAREN); } - void Parser::SkipCompoundLiteral() { if (CurrentToken() == Token::kLT) { SkipTypeArguments(); @@ -15078,7 +14758,6 @@ void Parser::SkipCompoundLiteral() { } } - void Parser::SkipSymbolLiteral() { ConsumeToken(); // Hash sign. if (IsIdentifier()) { @@ -15094,7 +14773,6 @@ void Parser::SkipSymbolLiteral() { } } - void Parser::SkipNewOperator() { ConsumeToken(); // Skip new or const keyword. if (IsIdentifier()) { @@ -15116,7 +14794,6 @@ void Parser::SkipNewOperator() { } } - void Parser::SkipStringLiteral() { ASSERT(CurrentToken() == Token::kSTRING); while (CurrentToken() == Token::kSTRING) { @@ -15137,7 +14814,6 @@ void Parser::SkipStringLiteral() { } } - void Parser::SkipPrimary() { if (IsFunctionLiteral()) { SkipFunctionLiteral(); @@ -15198,7 +14874,6 @@ void Parser::SkipPrimary() { } } - void Parser::SkipSelectors() { while (true) { const Token::Kind current_token = CurrentToken(); @@ -15244,7 +14919,6 @@ void Parser::SkipPostfixExpr() { } } - void Parser::SkipUnaryExpr() { if (IsPrefixOperator(CurrentToken()) || IsIncrementOperator(CurrentToken()) || IsAwaitKeyword()) { @@ -15255,7 +14929,6 @@ void Parser::SkipUnaryExpr() { } } - void Parser::SkipBinaryExpr() { SkipUnaryExpr(); const int min_prec = Token::Precedence(Token::kIFNULL); @@ -15278,7 +14951,6 @@ void Parser::SkipBinaryExpr() { } } - void Parser::SkipConditionalExpr() { SkipBinaryExpr(); if (CurrentToken() == Token::kCONDITIONAL) { @@ -15289,7 +14961,6 @@ void Parser::SkipConditionalExpr() { } } - void Parser::SkipExpr() { while (CurrentToken() == Token::kTHROW) { ConsumeToken(); @@ -15304,14 +14975,12 @@ void Parser::SkipExpr() { } } - void Parser::SkipNestedExpr() { const bool saved_mode = SetAllowFunctionLiterals(true); SkipExpr(); SetAllowFunctionLiterals(saved_mode); } - void Parser::SkipQualIdent() { ASSERT(IsIdentifier()); ConsumeToken(); @@ -15323,96 +14992,79 @@ void Parser::SkipQualIdent() { } // namespace dart - #else // DART_PRECOMPILED_RUNTIME - namespace dart { void ParsedFunction::AddToGuardedFields(const Field* field) const { UNREACHABLE(); } - kernel::ScopeBuildingResult* ParsedFunction::EnsureKernelScopes() { UNREACHABLE(); return NULL; } - LocalVariable* ParsedFunction::EnsureExpressionTemp() { UNREACHABLE(); return NULL; } - void ParsedFunction::SetNodeSequence(SequenceNode* node_sequence) { UNREACHABLE(); } - void ParsedFunction::SetRegExpCompileData( RegExpCompileData* regexp_compile_data) { UNREACHABLE(); } - void ParsedFunction::AllocateVariables() { UNREACHABLE(); } - void ParsedFunction::AllocateIrregexpVariables(intptr_t num_stack_locals) { UNREACHABLE(); } - void ParsedFunction::Bailout(const char* origin, const char* reason) const { UNREACHABLE(); } - void Parser::ParseCompilationUnit(const Library& library, const Script& script) { UNREACHABLE(); } - void Parser::ParseClass(const Class& cls) { UNREACHABLE(); } - RawObject* Parser::ParseFunctionParameters(const Function& func) { UNREACHABLE(); return Object::null(); } - void Parser::ParseFunction(ParsedFunction* parsed_function) { UNREACHABLE(); } - RawObject* Parser::ParseMetadata(const Field& meta_data) { UNREACHABLE(); return Object::null(); } - ParsedFunction* Parser::ParseStaticFieldInitializer(const Field& field) { UNREACHABLE(); return NULL; } - void Parser::InsertCachedConstantValue(const Script& script, TokenPosition token_pos, const Instance& value) { UNREACHABLE(); } - ArgumentListNode* Parser::BuildNoSuchMethodArguments( TokenPosition call_pos, const String& function_name, @@ -15430,7 +15082,6 @@ bool Parser::FieldHasFunctionLiteralInitializer(const Field& field, return false; } - } // namespace dart #endif // DART_PRECOMPILED_RUNTIME diff --git a/runtime/vm/parser.h b/runtime/vm/parser.h index 3dd35dc5086..7bdc5389d3a 100644 --- a/runtime/vm/parser.h +++ b/runtime/vm/parser.h @@ -7,15 +7,15 @@ #include "include/dart_api.h" +#include "lib/invocation_mirror.h" #include "platform/assert.h" #include "platform/globals.h" -#include "lib/invocation_mirror.h" #include "vm/allocation.h" #include "vm/ast.h" #include "vm/class_finalizer.h" #include "vm/compiler_stats.h" -#include "vm/kernel.h" #include "vm/hash_table.h" +#include "vm/kernel.h" #include "vm/object.h" #include "vm/raw_object.h" #include "vm/token.h" @@ -28,7 +28,7 @@ namespace kernel { class ScopeBuildingResult; -} // kernel +} // namespace kernel class ArgumentsDescriptor; class Isolate; @@ -160,7 +160,6 @@ class ParsedFunction : public ZoneAllocated { #endif } - const Instance& DefaultParameterValueAt(intptr_t i) const { ASSERT(default_parameter_values_ != NULL); return *default_parameter_values_->At(i); @@ -261,7 +260,6 @@ class ParsedFunction : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(ParsedFunction); }; - class Parser : public ValueObject { public: // Parse the top level of a whole script file and register declared classes diff --git a/runtime/vm/parser_test.cc b/runtime/vm/parser_test.cc index f540eca5228..b6490593993 100644 --- a/runtime/vm/parser_test.cc +++ b/runtime/vm/parser_test.cc @@ -2,13 +2,12 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. - +#include "vm/parser.h" #include "vm/ast_printer.h" #include "vm/class_finalizer.h" #include "vm/debugger.h" #include "vm/longjump.h" #include "vm/object.h" -#include "vm/parser.h" #include "vm/symbols.h" #include "vm/thread.h" #include "vm/unit_test.h" @@ -17,7 +16,6 @@ namespace dart { DECLARE_FLAG(bool, show_invisible_frames); - static void DumpFunction(const Library& lib, const char* cname, const char* fname) { @@ -52,7 +50,6 @@ static void DumpFunction(const Library& lib, EXPECT(retval); } - void CheckField(const Library& lib, const char* class_name, const char* field_name, @@ -89,7 +86,6 @@ void CheckField(const Library& lib, EXPECT_EQ(field.is_static(), expect_static); } - void CheckFunction(const Library& lib, const char* class_name, const char* function_name, @@ -109,7 +105,6 @@ void CheckFunction(const Library& lib, EXPECT(!function.IsNull()); } - TEST_CASE(ParseClassDefinition) { const char* script_chars = "class C { } \n" @@ -145,7 +140,6 @@ TEST_CASE(ParseClassDefinition) { CheckFunction(lib, "A", "foo", true); } - TEST_CASE(Parser_TopLevel) { const char* script_chars = "class A extends B { \n" @@ -175,13 +169,10 @@ TEST_CASE(Parser_TopLevel) { DumpFunction(lib, "B", "bam"); } - #ifndef PRODUCT - static char* saved_vars = NULL; - static char* SkipIndex(const char* input) { char* output_buffer = new char[strlen(input)]; char* output = output_buffer; @@ -210,7 +201,6 @@ static char* SkipIndex(const char* input) { return output_buffer; } - // Saves the var descriptors for all frames on the stack as a string. static void SaveVars(Dart_IsolateId isolate_id, intptr_t bp_id, @@ -239,7 +229,6 @@ static void SaveVars(Dart_IsolateId isolate_id, saved_vars = buffer; } - // Uses the debugger to pause the program and capture the variable // descriptors for all frames on the stack. static char* CaptureVarsAtLine(Dart_Handle lib, const char* entry, int line) { @@ -256,7 +245,6 @@ static char* CaptureVarsAtLine(Dart_Handle lib, const char* entry, int line) { return tmp; } - TEST_CASE(Parser_AllocateVariables_CapturedVar) { const char* kScriptChars = "int main() {\n" @@ -294,7 +282,6 @@ TEST_CASE(Parser_AllocateVariables_CapturedVar) { free(vars); } - TEST_CASE(Parser_AllocateVariables_NestedCapturedVar) { const char* kScriptChars = "int a() {\n" @@ -350,7 +337,6 @@ TEST_CASE(Parser_AllocateVariables_NestedCapturedVar) { free(vars); } - TEST_CASE(Parser_AllocateVariables_TwoChains) { const char* kScriptChars = "int a() {\n" @@ -430,7 +416,6 @@ TEST_CASE(Parser_AllocateVariables_TwoChains) { free(vars); } - TEST_CASE(Parser_AllocateVariables_Issue7681) { // This is a distilled version of the program from Issue 7681. // @@ -488,7 +473,6 @@ TEST_CASE(Parser_AllocateVariables_Issue7681) { free(vars); } - TEST_CASE(Parser_AllocateVariables_CaptureLoopVar) { // This test verifies that... // diff --git a/runtime/vm/port.cc b/runtime/vm/port.cc index 20a142dd826..3bc03701fa6 100644 --- a/runtime/vm/port.cc +++ b/runtime/vm/port.cc @@ -4,9 +4,9 @@ #include "vm/port.h" -#include "vm/dart_entry.h" #include "platform/utils.h" #include "vm/dart_api_impl.h" +#include "vm/dart_entry.h" #include "vm/isolate.h" #include "vm/lockers.h" #include "vm/message_handler.h" @@ -22,7 +22,6 @@ intptr_t PortMap::used_ = 0; intptr_t PortMap::deleted_ = 0; Random* PortMap::prng_ = NULL; - intptr_t PortMap::FindPort(Dart_Port port) { // ILLEGAL_PORT (0) is used as a sentinel value in Entry.port. The loop below // could return the index to a deleted port when we are searching for @@ -47,7 +46,6 @@ intptr_t PortMap::FindPort(Dart_Port port) { return -1; } - void PortMap::Rehash(intptr_t new_capacity) { Entry* new_ports = new Entry[new_capacity]; memset(new_ports, 0, new_capacity * sizeof(Entry)); @@ -69,7 +67,6 @@ void PortMap::Rehash(intptr_t new_capacity) { deleted_ = 0; } - const char* PortMap::PortStateString(PortState kind) { switch (kind) { case kNewPort: @@ -84,7 +81,6 @@ const char* PortMap::PortStateString(PortState kind) { } } - Dart_Port PortMap::AllocatePort() { const Dart_Port kMASK = 0x3fffffff; Dart_Port result = prng_->NextUInt32() & kMASK; @@ -100,7 +96,6 @@ Dart_Port PortMap::AllocatePort() { return result; } - void PortMap::SetPortState(Dart_Port port, PortState state) { MutexLocker ml(mutex_); intptr_t index = FindPort(port); @@ -121,7 +116,6 @@ void PortMap::SetPortState(Dart_Port port, PortState state) { } } - void PortMap::MaintainInvariants() { intptr_t empty = capacity_ - used_ - deleted_; if (used_ > ((capacity_ / 4) * 3)) { @@ -134,7 +128,6 @@ void PortMap::MaintainInvariants() { } } - Dart_Port PortMap::CreatePort(MessageHandler* handler) { ASSERT(handler != NULL); MutexLocker ml(mutex_); @@ -185,7 +178,6 @@ Dart_Port PortMap::CreatePort(MessageHandler* handler) { return entry.port; } - bool PortMap::ClosePort(Dart_Port port) { MessageHandler* handler = NULL; { @@ -224,7 +216,6 @@ bool PortMap::ClosePort(Dart_Port port) { return true; } - void PortMap::ClosePorts(MessageHandler* handler) { { MutexLocker ml(mutex_); @@ -245,7 +236,6 @@ void PortMap::ClosePorts(MessageHandler* handler) { handler->CloseAllPorts(); } - bool PortMap::PostMessage(Message* message) { MutexLocker ml(mutex_); intptr_t index = FindPort(message->dest_port()); @@ -262,7 +252,6 @@ bool PortMap::PostMessage(Message* message) { return true; } - bool PortMap::IsLocalPort(Dart_Port id) { MutexLocker ml(mutex_); intptr_t index = FindPort(id); @@ -275,7 +264,6 @@ bool PortMap::IsLocalPort(Dart_Port id) { return handler->IsCurrentIsolate(); } - Isolate* PortMap::GetIsolate(Dart_Port id) { MutexLocker ml(mutex_); intptr_t index = FindPort(id); @@ -288,7 +276,6 @@ Isolate* PortMap::GetIsolate(Dart_Port id) { return handler->isolate(); } - void PortMap::InitOnce() { mutex_ = new Mutex(); prng_ = new Random(); @@ -303,7 +290,6 @@ void PortMap::InitOnce() { deleted_ = 0; } - void PortMap::PrintPortsForMessageHandler(MessageHandler* handler, JSONStream* stream) { #ifndef PRODUCT @@ -331,7 +317,6 @@ void PortMap::PrintPortsForMessageHandler(MessageHandler* handler, #endif } - void PortMap::DebugDumpForMessageHandler(MessageHandler* handler) { SafepointMutexLocker ml(mutex_); Object& msg_handler = Object::Handle(); @@ -346,5 +331,4 @@ void PortMap::DebugDumpForMessageHandler(MessageHandler* handler) { } } - } // namespace dart diff --git a/runtime/vm/port_test.cc b/runtime/vm/port_test.cc index d42a3e6249b..68fdb63bc45 100644 --- a/runtime/vm/port_test.cc +++ b/runtime/vm/port_test.cc @@ -2,11 +2,11 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +#include "vm/port.h" #include "platform/assert.h" #include "vm/lockers.h" #include "vm/message_handler.h" #include "vm/os.h" -#include "vm/port.h" #include "vm/unit_test.h" namespace dart { @@ -29,7 +29,6 @@ class PortMapTestPeer { } }; - class PortTestMessageHandler : public MessageHandler { public: PortTestMessageHandler() : notify_count(0) {} @@ -41,7 +40,6 @@ class PortTestMessageHandler : public MessageHandler { int notify_count; }; - TEST_CASE(PortMap_CreateAndCloseOnePort) { PortTestMessageHandler handler; Dart_Port port = PortMap::CreatePort(&handler); @@ -52,7 +50,6 @@ TEST_CASE(PortMap_CreateAndCloseOnePort) { EXPECT(!PortMapTestPeer::IsActivePort(port)); } - TEST_CASE(PortMap_CreateAndCloseTwoPorts) { PortTestMessageHandler handler; Dart_Port port1 = PortMap::CreatePort(&handler); @@ -72,7 +69,6 @@ TEST_CASE(PortMap_CreateAndCloseTwoPorts) { EXPECT(!PortMapTestPeer::IsActivePort(port2)); } - TEST_CASE(PortMap_ClosePorts) { PortTestMessageHandler handler; Dart_Port port1 = PortMap::CreatePort(&handler); @@ -86,7 +82,6 @@ TEST_CASE(PortMap_ClosePorts) { EXPECT(!PortMapTestPeer::IsActivePort(port2)); } - TEST_CASE(PortMap_CreateManyPorts) { PortTestMessageHandler handler; for (int i = 0; i < 32; i++) { @@ -97,7 +92,6 @@ TEST_CASE(PortMap_CreateManyPorts) { } } - TEST_CASE(PortMap_SetPortState) { PortTestMessageHandler handler; @@ -130,7 +124,6 @@ TEST_CASE(PortMap_SetPortState) { EXPECT(!PortMapTestPeer::IsLivePort(port)); } - TEST_CASE(PortMap_PostMessage) { PortTestMessageHandler handler; Dart_Port port = PortMap::CreatePort(&handler); @@ -148,7 +141,6 @@ TEST_CASE(PortMap_PostMessage) { PortMap::ClosePorts(&handler); } - TEST_CASE(PortMap_PostIntegerMessage) { PortTestMessageHandler handler; Dart_Port port = PortMap::CreatePort(&handler); @@ -162,7 +154,6 @@ TEST_CASE(PortMap_PostIntegerMessage) { PortMap::ClosePorts(&handler); } - TEST_CASE(PortMap_PostNullMessage) { PortTestMessageHandler handler; Dart_Port port = PortMap::CreatePort(&handler); @@ -176,7 +167,6 @@ TEST_CASE(PortMap_PostNullMessage) { PortMap::ClosePorts(&handler); } - TEST_CASE(PortMap_PostMessageClosedPort) { // Create a port id and make it invalid. PortTestMessageHandler handler; diff --git a/runtime/vm/precompiler.cc b/runtime/vm/precompiler.cc index 30b3e047b4e..55c56a8ebfa 100644 --- a/runtime/vm/precompiler.cc +++ b/runtime/vm/precompiler.cc @@ -53,7 +53,6 @@ namespace dart { #define I (isolate()) #define Z (zone()) - DEFINE_FLAG(bool, print_unique_targets, false, "Print unique dynamic targets"); DEFINE_FLAG(bool, trace_precompiler, false, "Trace precompiler."); DEFINE_FLAG( @@ -87,7 +86,6 @@ DECLARE_FLAG(int, inlining_caller_size_threshold); DECLARE_FLAG(int, inlining_constant_arguments_max_size_threshold); DECLARE_FLAG(int, inlining_constant_arguments_min_size_threshold); - #ifdef DART_PRECOMPILER class DartPrecompilationPipeline : public DartCompilationPipeline { @@ -167,7 +165,6 @@ class DartPrecompilationPipeline : public DartCompilationPipeline { FieldTypeMap* field_map_; }; - class PrecompileParsedFunctionHelper : public ValueObject { public: PrecompileParsedFunctionHelper(Precompiler* precompiler, @@ -198,12 +195,10 @@ class PrecompileParsedFunctionHelper : public ValueObject { DISALLOW_COPY_AND_ASSIGN(PrecompileParsedFunctionHelper); }; - static void Jump(const Error& error) { Thread::Current()->long_jump_base()->Jump(1, error); } - TypeRangeCache::TypeRangeCache(Precompiler* precompiler, Thread* thread, intptr_t num_cids) @@ -219,13 +214,11 @@ TypeRangeCache::TypeRangeCache(Precompiler* precompiler, precompiler->set_type_range_cache(this); } - TypeRangeCache::~TypeRangeCache() { ASSERT(precompiler_->type_range_cache() == this); precompiler_->set_type_range_cache(NULL); } - RawError* Precompiler::CompileAll( Dart_QualifiedFunctionName embedder_entry_points[], uint8_t* jit_feedback, @@ -244,7 +237,6 @@ RawError* Precompiler::CompileAll( } } - bool TypeRangeCache::InstanceOfHasClassRange(const AbstractType& type, intptr_t* lower_limit, intptr_t* upper_limit) { @@ -261,7 +253,6 @@ bool TypeRangeCache::InstanceOfHasClassRange(const AbstractType& type, !type_arguments.IsRaw(0, type_arguments.Length())) return false; - intptr_t type_cid = type.type_class_id(); if (lower_limits_[type_cid] == kNotContiguous) return false; if (lower_limits_[type_cid] != kNotComputed) { @@ -270,7 +261,6 @@ bool TypeRangeCache::InstanceOfHasClassRange(const AbstractType& type, return true; } - *lower_limit = -1; *upper_limit = -1; intptr_t last_matching_cid = -1; @@ -338,7 +328,6 @@ bool TypeRangeCache::InstanceOfHasClassRange(const AbstractType& type, return true; } - Precompiler::Precompiler(Thread* thread) : thread_(thread), zone_(NULL), @@ -371,7 +360,6 @@ Precompiler::Precompiler(Thread* thread) error_(Error::Handle()), get_runtime_type_is_unique_(false) {} - void Precompiler::LoadFeedback(uint8_t* buffer, intptr_t length) { if (buffer == NULL) { if (FLAG_trace_precompiler) { @@ -412,7 +400,6 @@ void Precompiler::LoadFeedback(uint8_t* buffer, intptr_t length) { } } - void Precompiler::DoCompileAll( Dart_QualifiedFunctionName embedder_entry_points[]) { ASSERT(I->compilation_allowed()); @@ -533,7 +520,6 @@ void Precompiler::DoCompileAll( } } - static void CompileStaticInitializerIgnoreErrors(const Field& field) { LongJumpScope jump; if (setjmp(*jump.Set()) == 0) { @@ -544,7 +530,6 @@ static void CompileStaticInitializerIgnoreErrors(const Field& field) { } } - void Precompiler::PrecompileStaticInitializers() { class StaticInitializerVisitor : public ClassVisitor { public: @@ -577,7 +562,6 @@ void Precompiler::PrecompileStaticInitializers() { ProgramVisitor::VisitClasses(&visitor); } - void Precompiler::PrecompileConstructors() { class ConstructorVisitor : public FunctionVisitor { public: @@ -620,7 +604,6 @@ void Precompiler::PrecompileConstructors() { } } - void Precompiler::AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]) { // Note that .main is not a root. The appropriate main will be // discovered through _getMainClosure. @@ -712,7 +695,6 @@ void Precompiler::AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]) { } } - void Precompiler::AddEntryPoints(Dart_QualifiedFunctionName entry_points[]) { Library& lib = Library::Handle(Z); Class& cls = Class::Handle(Z); @@ -792,7 +774,6 @@ void Precompiler::AddEntryPoints(Dart_QualifiedFunctionName entry_points[]) { } } - void Precompiler::Iterate() { Function& function = Function::Handle(Z); @@ -812,7 +793,6 @@ void Precompiler::Iterate() { } } - void Precompiler::CollectCallbackFields() { Library& lib = Library::Handle(Z); Class& cls = Class::Handle(Z); @@ -874,7 +854,6 @@ void Precompiler::CollectCallbackFields() { } } - void Precompiler::ProcessFunction(const Function& function) { if (!function.HasCode()) { function_count_++; @@ -910,7 +889,6 @@ void Precompiler::ProcessFunction(const Function& function) { AddCalleesOf(function); } - void Precompiler::AddCalleesOf(const Function& function) { ASSERT(function.HasCode()); @@ -1002,7 +980,6 @@ void Precompiler::AddCalleesOf(const Function& function) { } } - void Precompiler::AddTypesOf(const Class& cls) { if (cls.IsNull()) return; if (classes_to_retain_.HasKey(&cls)) return; @@ -1028,7 +1005,6 @@ void Precompiler::AddTypesOf(const Class& cls) { } } - void Precompiler::AddTypesOf(const Function& function) { if (function.IsNull()) return; if (functions_to_retain_.HasKey(&function)) return; @@ -1078,7 +1054,6 @@ void Precompiler::AddTypesOf(const Function& function) { AddTypesOf(owner); } - void Precompiler::AddType(const AbstractType& abstype) { if (abstype.IsNull()) return; @@ -1115,7 +1090,6 @@ void Precompiler::AddType(const AbstractType& abstype) { } } - void Precompiler::AddTypeArguments(const TypeArguments& args) { if (args.IsNull()) return; @@ -1129,7 +1103,6 @@ void Precompiler::AddTypeArguments(const TypeArguments& args) { } } - void Precompiler::AddConstObject(const Instance& instance) { const Class& cls = Class::Handle(Z, instance.clazz()); AddInstantiatedClass(cls); @@ -1189,7 +1162,6 @@ void Precompiler::AddConstObject(const Instance& instance) { instance.raw()->VisitPointers(&visitor); } - void Precompiler::AddClosureCall(const Array& arguments_descriptor) { const Class& cache_class = Class::Handle(Z, I->object_store()->closure_class()); @@ -1200,7 +1172,6 @@ void Precompiler::AddClosureCall(const Array& arguments_descriptor) { AddFunction(dispatcher); } - void Precompiler::AddField(const Field& field) { if (fields_to_retain_.HasKey(&field)) return; @@ -1232,7 +1203,6 @@ void Precompiler::AddField(const Field& field) { } } - RawFunction* Precompiler::CompileStaticInitializer(const Field& field, bool compute_type) { ASSERT(field.is_static()); @@ -1249,7 +1219,6 @@ RawFunction* Precompiler::CompileStaticInitializer(const Field& field, parsed_function->AllocateVariables(); } - DartPrecompilationPipeline pipeline(zone); PrecompileParsedFunctionHelper helper(/* precompiler = */ NULL, parsed_function, @@ -1279,7 +1248,6 @@ RawFunction* Precompiler::CompileStaticInitializer(const Field& field, return parsed_function->function().raw(); } - RawObject* Precompiler::EvaluateStaticInitializer(const Field& field) { ASSERT(field.is_static()); // The VM sets the field's value to transiton_sentinel prior to @@ -1310,7 +1278,6 @@ RawObject* Precompiler::EvaluateStaticInitializer(const Field& field) { return Object::null(); } - RawObject* Precompiler::ExecuteOnce(SequenceNode* fragment) { LongJumpScope jump; if (setjmp(*jump.Set()) == 0) { @@ -1374,7 +1341,6 @@ RawObject* Precompiler::ExecuteOnce(SequenceNode* fragment) { return Object::null(); } - void Precompiler::AddFunction(const Function& function) { if (enqueued_functions_.HasKey(&function)) return; @@ -1383,7 +1349,6 @@ void Precompiler::AddFunction(const Function& function) { changed_ = true; } - bool Precompiler::IsSent(const String& selector) { if (selector.IsNull()) { return false; @@ -1391,7 +1356,6 @@ bool Precompiler::IsSent(const String& selector) { return sent_selectors_.HasKey(&selector); } - void Precompiler::AddSelector(const String& selector) { ASSERT(!selector.IsNull()); @@ -1407,7 +1371,6 @@ void Precompiler::AddSelector(const String& selector) { } } - void Precompiler::AddInstantiatedClass(const Class& cls) { if (cls.is_allocated()) return; @@ -1430,7 +1393,6 @@ void Precompiler::AddInstantiatedClass(const Class& cls) { } } - void Precompiler::CheckForNewDynamicFunctions() { Library& lib = Library::Handle(Z); Class& cls = Class::Handle(Z); @@ -1532,7 +1494,6 @@ void Precompiler::CheckForNewDynamicFunctions() { } } - class NameFunctionsTraits { public: static const char* Name() { return "NameFunctionsTraits"; } @@ -1548,7 +1509,6 @@ class NameFunctionsTraits { typedef UnorderedHashMap Table; - static void AddNameToFunctionsTable(Zone* zone, Table* table, const String& fname, @@ -1560,7 +1520,6 @@ static void AddNameToFunctionsTable(Zone* zone, table->UpdateValue(fname, farray); } - void Precompiler::CollectDynamicFunctionNames() { if (!FLAG_collect_dynamic_function_names) { return; @@ -1645,7 +1604,6 @@ void Precompiler::CollectDynamicFunctionNames() { table.Release(); } - void Precompiler::TraceConstFunctions() { // Compilation of const accessors happens outside of the treeshakers // queue, so we haven't previously scanned its literal pool. @@ -1675,7 +1633,6 @@ void Precompiler::TraceConstFunctions() { } } - void Precompiler::TraceForRetainedFunctions() { Library& lib = Library::Handle(Z); Class& cls = Class::Handle(Z); @@ -1735,7 +1692,6 @@ void Precompiler::TraceForRetainedFunctions() { } } - void Precompiler::DropFunctions() { Library& lib = Library::Handle(Z); Class& cls = Class::Handle(Z); @@ -1797,7 +1753,6 @@ void Precompiler::DropFunctions() { isolate()->object_store()->set_closure_functions(retained_functions); } - void Precompiler::DropFields() { Library& lib = Library::Handle(Z); Class& cls = Class::Handle(Z); @@ -1842,7 +1797,6 @@ void Precompiler::DropFields() { } } - void Precompiler::DropTypes() { ObjectStore* object_store = I->object_store(); GrowableObjectArray& retained_types = @@ -1879,7 +1833,6 @@ void Precompiler::DropTypes() { object_store->set_canonical_types(types_table.Release()); } - void Precompiler::DropTypeArguments() { ObjectStore* object_store = I->object_store(); Array& typeargs_array = Array::Handle(Z); @@ -1918,7 +1871,6 @@ void Precompiler::DropTypeArguments() { object_store->set_canonical_type_arguments(typeargs_table.Release()); } - void Precompiler::DropScriptData() { Library& lib = Library::Handle(Z); Array& scripts = Array::Handle(Z); @@ -1936,7 +1888,6 @@ void Precompiler::DropScriptData() { } } - void Precompiler::TraceTypesFromRetainedClasses() { Library& lib = Library::Handle(Z); Class& cls = Class::Handle(Z); @@ -2010,7 +1961,6 @@ void Precompiler::TraceTypesFromRetainedClasses() { } } - void Precompiler::DropLibraryEntries() { Library& lib = Library::Handle(Z); Array& dict = Array::Handle(Z); @@ -2056,7 +2006,6 @@ void Precompiler::DropLibraryEntries() { } } - void Precompiler::DropClasses() { Class& cls = Class::Handle(Z); Array& constants = Array::Handle(Z); @@ -2119,7 +2068,6 @@ void Precompiler::DropClasses() { } } - void Precompiler::DropLibraries() { const GrowableObjectArray& retained_libraries = GrowableObjectArray::Handle(Z, GrowableObjectArray::New()); @@ -2178,7 +2126,6 @@ void Precompiler::DropLibraries() { libraries_ = retained_libraries.raw(); } - void Precompiler::BindStaticCalls() { class BindStaticCallsVisitor : public FunctionVisitor { public: @@ -2235,7 +2182,6 @@ void Precompiler::BindStaticCalls() { ProgramVisitor::VisitFunctions(&visitor); } - void Precompiler::SwitchICCalls() { #if !defined(TARGET_ARCH_DBC) // Now that all functions have been compiled, we can switch to an instance @@ -2325,7 +2271,6 @@ void Precompiler::SwitchICCalls() { #endif } - void Precompiler::FinalizeAllClasses() { Library& lib = Library::Handle(Z); Class& cls = Class::Handle(Z); @@ -2357,8 +2302,6 @@ void Precompiler::FinalizeAllClasses() { I->set_all_classes_finalized(true); } - - void Precompiler::VerifyJITFeedback() { if (jit_feedback_ == NULL) return; @@ -2489,7 +2432,6 @@ void Precompiler::VerifyJITFeedback() { ProgramVisitor::VisitFunctions(&visitor); } - ParsedJSONObject* Precompiler::LookupFeedback(const Function& function) { const Class& owner = Class::Handle(Z, function.Owner()); @@ -2502,7 +2444,6 @@ ParsedJSONObject* Precompiler::LookupFeedback(const Function& function) { return pair->value_; } - RawScript* Precompiler::LookupScript(const char* uri) { String& dart_uri = String::Handle(Z, String::New(uri)); Library& lib = Library::Handle(Z); @@ -2517,7 +2458,6 @@ RawScript* Precompiler::LookupScript(const char* uri) { return Script::null(); } - intptr_t Precompiler::MapCid(intptr_t feedback_cid) { if (feedback_cid < kNumPredefinedCids) { return feedback_cid; @@ -2527,7 +2467,6 @@ intptr_t Precompiler::MapCid(intptr_t feedback_cid) { return pair->value_; } - void Precompiler::PopulateWithICData(const Function& function, FlowGraph* graph) { Zone* zone = Thread::Current()->zone(); @@ -2578,7 +2517,6 @@ void Precompiler::PopulateWithICData(const Function& function, } } - void Precompiler::TryApplyFeedback(const Function& function, FlowGraph* graph) { ParsedJSONObject* js_function = LookupFeedback(function); if (js_function == NULL) { @@ -2608,7 +2546,6 @@ void Precompiler::TryApplyFeedback(const Function& function, FlowGraph* graph) { } } - void Precompiler::TryApplyFeedback(ParsedJSONArray* js_icdatas, const ICData& ic) { for (intptr_t j = 0; j < js_icdatas->Length(); j++) { @@ -2692,7 +2629,6 @@ void Precompiler::TryApplyFeedback(ParsedJSONArray* js_icdatas, } } - void Precompiler::ResetPrecompilerState() { changed_ = false; function_count_ = 0; @@ -2727,7 +2663,6 @@ void Precompiler::ResetPrecompilerState() { } } - void PrecompileParsedFunctionHelper::FinalizeCompilation( Assembler* assembler, FlowGraphCompiler* graph_compiler, @@ -2776,7 +2711,6 @@ void PrecompileParsedFunctionHelper::FinalizeCompilation( ASSERT(FLAG_load_deferred_eagerly); } - // Return false if bailed out. // If optimized_result_code is not NULL then it is caller's responsibility // to install code. @@ -3287,7 +3221,6 @@ bool PrecompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) { return is_compiled; } - static RawError* PrecompileFunctionHelper(Precompiler* precompiler, CompilationPipeline* pipeline, const Function& function, @@ -3376,7 +3309,6 @@ static RawError* PrecompileFunctionHelper(Precompiler* precompiler, return Error::null(); } - RawError* Precompiler::CompileFunction(Precompiler* precompiler, Thread* thread, Zone* zone, diff --git a/runtime/vm/precompiler.h b/runtime/vm/precompiler.h index eb3a6ca1913..2aff2a4d0ca 100644 --- a/runtime/vm/precompiler.h +++ b/runtime/vm/precompiler.h @@ -45,7 +45,6 @@ class TypeRangeCache : public ValueObject { intptr_t* upper_limits_; }; - class SymbolKeyValueTrait { public: // Typedefs needed for the DirectChainedHashMap template. @@ -66,7 +65,6 @@ class SymbolKeyValueTrait { typedef DirectChainedHashMap SymbolSet; - class UnlinkedCallKeyValueTrait { public: // Typedefs needed for the DirectChainedHashMap template. @@ -122,7 +120,6 @@ class FunctionKeyValueTrait { typedef DirectChainedHashMap FunctionSet; - class FieldKeyValueTrait { public: // Typedefs needed for the DirectChainedHashMap template. @@ -151,7 +148,6 @@ class FieldKeyValueTrait { typedef DirectChainedHashMap FieldSet; - class ClassKeyValueTrait { public: // Typedefs needed for the DirectChainedHashMap template. @@ -172,7 +168,6 @@ class ClassKeyValueTrait { typedef DirectChainedHashMap ClassSet; - class AbstractTypeKeyValueTrait { public: // Typedefs needed for the DirectChainedHashMap template. @@ -193,7 +188,6 @@ class AbstractTypeKeyValueTrait { typedef DirectChainedHashMap AbstractTypeSet; - class TypeArgumentsKeyValueTrait { public: // Typedefs needed for the DirectChainedHashMap template. @@ -214,7 +208,6 @@ class TypeArgumentsKeyValueTrait { typedef DirectChainedHashMap TypeArgumentsSet; - class InstanceKeyValueTrait { public: // Typedefs needed for the DirectChainedHashMap template. @@ -235,7 +228,6 @@ class InstanceKeyValueTrait { typedef DirectChainedHashMap InstanceSet; - struct FieldTypePair { // Typedefs needed for the DirectChainedHashMap template. typedef const Field* Key; @@ -264,7 +256,6 @@ struct FieldTypePair { typedef DirectChainedHashMap FieldTypeMap; - struct IntptrPair { // Typedefs needed for the DirectChainedHashMap template. typedef intptr_t Key; @@ -289,7 +280,6 @@ struct IntptrPair { typedef DirectChainedHashMap CidMap; - struct FunctionFeedbackKey { FunctionFeedbackKey() : owner_cid_(kIllegalCid), token_(0), kind_(0) {} FunctionFeedbackKey(intptr_t owner_cid, intptr_t token, intptr_t kind) @@ -300,7 +290,6 @@ struct FunctionFeedbackKey { intptr_t kind_; }; - struct FunctionFeedbackPair { // Typedefs needed for the DirectChainedHashMap template. typedef FunctionFeedbackKey Key; @@ -330,7 +319,6 @@ struct FunctionFeedbackPair { typedef DirectChainedHashMap FunctionFeedbackMap; - class Precompiler : public ValueObject { public: static RawError* CompileAll( @@ -461,7 +449,6 @@ class Precompiler : public ValueObject { bool get_runtime_type_is_unique_; }; - class FunctionsTraits { public: static const char* Name() { return "FunctionsTraits"; } @@ -489,7 +476,6 @@ class FunctionsTraits { typedef UnorderedHashSet UniqueFunctionsSet; - } // namespace dart #endif // RUNTIME_VM_PRECOMPILER_H_ diff --git a/runtime/vm/proccpuinfo.cc b/runtime/vm/proccpuinfo.cc index 5bb402dd743..e74175eb8d9 100644 --- a/runtime/vm/proccpuinfo.cc +++ b/runtime/vm/proccpuinfo.cc @@ -14,11 +14,9 @@ namespace dart { - char* ProcCpuInfo::data_ = NULL; intptr_t ProcCpuInfo::datalen_ = 0; - void ProcCpuInfo::InitOnce() { // Get the size of the cpuinfo file by reading it until the end. This is // required because files under /proc do not always return a valid size @@ -55,14 +53,12 @@ void ProcCpuInfo::InitOnce() { data_[datalen_] = '\0'; } - void ProcCpuInfo::Cleanup() { ASSERT(data_); free(data_); data_ = NULL; } - char* ProcCpuInfo::FieldStart(const char* field) { // Look for first field occurrence, and ensure it starts the line. size_t fieldlen = strlen(field); @@ -88,7 +84,6 @@ char* ProcCpuInfo::FieldStart(const char* field) { return p; } - bool ProcCpuInfo::FieldContains(const char* field, const char* search_string) { ASSERT(data_ != NULL); ASSERT(search_string != NULL); @@ -112,7 +107,6 @@ bool ProcCpuInfo::FieldContains(const char* field, const char* search_string) { return ret; } - // Extract the content of a the first occurrence of a given field in // the content of the cpuinfo file and return it as a heap-allocated // string that must be freed by the caller using free. @@ -144,7 +138,6 @@ const char* ProcCpuInfo::ExtractField(const char* field) { return result; } - bool ProcCpuInfo::HasField(const char* field) { ASSERT(field != NULL); ASSERT(data_ != NULL); diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc index 840f438359b..7b8c6e70c01 100644 --- a/runtime/vm/profiler.cc +++ b/runtime/vm/profiler.cc @@ -79,7 +79,6 @@ void Profiler::InitOnce() { initialized_ = true; } - void Profiler::InitAllocationSampleBuffer() { if (FLAG_profiler_native_memory && (Profiler::allocation_sample_buffer_ == NULL)) { @@ -87,7 +86,6 @@ void Profiler::InitAllocationSampleBuffer() { } } - void Profiler::Shutdown() { if (!FLAG_profiler) { return; @@ -97,7 +95,6 @@ void Profiler::Shutdown() { NativeSymbolResolver::ShutdownOnce(); } - void Profiler::SetSampleDepth(intptr_t depth) { const int kMinimumDepth = 2; const int kMaximumDepth = 255; @@ -110,7 +107,6 @@ void Profiler::SetSampleDepth(intptr_t depth) { } } - void Profiler::SetSamplePeriod(intptr_t period) { const int kMinimumProfilePeriod = 50; if (period < kMinimumProfilePeriod) { @@ -120,23 +116,19 @@ void Profiler::SetSamplePeriod(intptr_t period) { } } - intptr_t Sample::pcs_length_ = 0; intptr_t Sample::instance_size_ = 0; - void Sample::InitOnce() { pcs_length_ = kSampleSize; instance_size_ = sizeof(Sample) + (sizeof(uword) * pcs_length_); // NOLINT. } - uword* Sample::GetPCArray() const { return reinterpret_cast(reinterpret_cast(this) + sizeof(*this)); } - SampleBuffer::SampleBuffer(intptr_t capacity) { ASSERT(Sample::instance_size() > 0); @@ -159,21 +151,17 @@ SampleBuffer::SampleBuffer(intptr_t capacity) { } } - AllocationSampleBuffer::AllocationSampleBuffer(intptr_t capacity) : SampleBuffer(capacity), mutex_(new Mutex()) {} - SampleBuffer::~SampleBuffer() { delete memory_; } - AllocationSampleBuffer::~AllocationSampleBuffer() { delete mutex_; } - Sample* SampleBuffer::At(intptr_t idx) const { ASSERT(idx >= 0); ASSERT(idx < capacity_); @@ -182,7 +170,6 @@ Sample* SampleBuffer::At(intptr_t idx) const { return reinterpret_cast(samples + offset); } - intptr_t SampleBuffer::ReserveSampleSlot() { ASSERT(samples_ != NULL); uintptr_t cursor = AtomicOperations::FetchAndIncrement(&cursor_); @@ -191,12 +178,10 @@ intptr_t SampleBuffer::ReserveSampleSlot() { return cursor; } - Sample* SampleBuffer::ReserveSample() { return At(ReserveSampleSlot()); } - Sample* SampleBuffer::ReserveSampleAndLink(Sample* previous) { ASSERT(previous != NULL); intptr_t next_index = ReserveSampleSlot(); @@ -208,7 +193,6 @@ Sample* SampleBuffer::ReserveSampleAndLink(Sample* previous) { return next; } - void AllocationSampleBuffer::FreeAllocationSample(Sample* sample) { MutexLocker ml(mutex_); while (sample != NULL) { @@ -228,7 +212,6 @@ void AllocationSampleBuffer::FreeAllocationSample(Sample* sample) { } } - intptr_t AllocationSampleBuffer::ReserveSampleSlotLocked() { if (free_sample_list_ != NULL) { Sample* free_sample = free_sample_list_; @@ -245,7 +228,6 @@ intptr_t AllocationSampleBuffer::ReserveSampleSlotLocked() { } } - Sample* AllocationSampleBuffer::ReserveSampleAndLink(Sample* previous) { MutexLocker ml(mutex_); ASSERT(previous != NULL); @@ -265,7 +247,6 @@ Sample* AllocationSampleBuffer::ReserveSampleAndLink(Sample* previous) { return next; } - Sample* AllocationSampleBuffer::ReserveSample() { MutexLocker ml(mutex_); intptr_t index = ReserveSampleSlotLocked(); @@ -275,7 +256,6 @@ Sample* AllocationSampleBuffer::ReserveSample() { return At(index); } - // Attempts to find the true return address when a Dart frame is being setup // or torn down. // NOTE: Architecture specific implementations below. @@ -328,7 +308,6 @@ class ReturnAddressLocator : public ValueObject { const Code& code_; }; - #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) bool ReturnAddressLocator::LocateReturnAddress(uword* return_address) { ASSERT(return_address != NULL); @@ -397,7 +376,6 @@ bool ReturnAddressLocator::LocateReturnAddress(uword* return_address) { #error ReturnAddressLocator implementation missing for this architecture. #endif - bool SampleFilter::TimeFilterSample(Sample* sample) { if ((time_origin_micros_ == -1) || (time_extent_micros_ == -1)) { // No time filter passed in, always pass. @@ -408,7 +386,6 @@ bool SampleFilter::TimeFilterSample(Sample* sample) { return (delta >= 0) && (delta <= time_extent_micros_); } - bool SampleFilter::TaskFilterSample(Sample* sample) { const intptr_t task = static_cast(sample->thread_task()); if (thread_task_mask_ == kNoTaskFilter) { @@ -417,16 +394,13 @@ bool SampleFilter::TaskFilterSample(Sample* sample) { return (task & thread_task_mask_) != 0; } - ClearProfileVisitor::ClearProfileVisitor(Isolate* isolate) : SampleVisitor(isolate->main_port()) {} - void ClearProfileVisitor::VisitSample(Sample* sample) { sample->Clear(); } - static void DumpStackFrame(intptr_t frame_index, uword pc) { Isolate* isolate = Isolate::Current(); if ((isolate != NULL) && isolate->is_runnable()) { @@ -452,7 +426,6 @@ static void DumpStackFrame(intptr_t frame_index, uword pc) { } } - class ProfilerStackWalker : public ValueObject { public: ProfilerStackWalker(Dart_Port port_id, @@ -518,7 +491,6 @@ class ProfilerStackWalker : public ValueObject { intptr_t total_frames_; }; - // Executing Dart code, walk the stack. class ProfilerDartStackWalker : public ProfilerStackWalker { public: @@ -712,7 +684,6 @@ class ProfilerDartStackWalker : public ProfilerStackWalker { bool has_exit_frame_; }; - // If the VM is compiled without frame pointers (which is the default on // recent GCC versions with optimizing enabled) the stack walking code may // fail. @@ -825,7 +796,6 @@ class ProfilerNativeStackWalker : public ProfilerStackWalker { uword lower_bound_; }; - static void CopyStackBuffer(Sample* sample, uword sp_addr) { ASSERT(sample != NULL); uword* sp = reinterpret_cast(sp_addr); @@ -840,7 +810,6 @@ static void CopyStackBuffer(Sample* sample, uword sp_addr) { } } - #if defined(HOST_OS_WINDOWS) // On Windows this code is synchronously executed from the thread interrupter // thread. This means we can safely have a static fault_address. @@ -919,7 +888,6 @@ static void CollectSample(Isolate* isolate, #endif } - static bool ValidateThreadStackBounds(uintptr_t fp, uintptr_t sp, uword stack_lower, @@ -942,7 +910,6 @@ static bool ValidateThreadStackBounds(uintptr_t fp, return true; } - // Get |isolate|'s stack boundary and verify that |sp| and |fp| are within // it. If |get_os_thread_bounds| is true then if |isolate| stackbounds are // not available we fallback to using underlying OS thread bounds. This only @@ -998,7 +965,6 @@ static bool GetAndValidateThreadStackBounds(Thread* thread, return ValidateThreadStackBounds(fp, sp, *stack_lower, *stack_upper); } - // Some simple sanity checking of |pc|, |fp|, and |sp|. static bool InitialRegisterCheck(uintptr_t pc, uintptr_t fp, uintptr_t sp) { if ((sp == 0) || (fp == 0) || (pc == 0)) { @@ -1015,7 +981,6 @@ static bool InitialRegisterCheck(uintptr_t pc, uintptr_t fp, uintptr_t sp) { return true; } - static Sample* SetupSample(Thread* thread, SampleBuffer* sample_buffer, ThreadId tid) { @@ -1040,7 +1005,6 @@ static Sample* SetupSample(Thread* thread, return sample; } - static Sample* SetupSampleNative(SampleBuffer* sample_buffer, ThreadId tid) { Sample* sample = sample_buffer->ReserveSample(); if (sample == NULL) { @@ -1058,7 +1022,6 @@ static Sample* SetupSampleNative(SampleBuffer* sample_buffer, ThreadId tid) { return sample; } - static bool CheckIsolate(Isolate* isolate) { if ((isolate == NULL) || (Dart::vm_isolate() == NULL)) { // No isolate. @@ -1067,7 +1030,6 @@ static bool CheckIsolate(Isolate* isolate) { return isolate != Dart::vm_isolate(); } - void Profiler::DumpStackTrace(void* context) { #if defined(HOST_OS_LINUX) || defined(HOST_OS_MACOS) ucontext_t* ucontext = reinterpret_cast(context); @@ -1082,7 +1044,6 @@ void Profiler::DumpStackTrace(void* context) { #endif } - void Profiler::DumpStackTrace(bool for_crash) { uintptr_t sp = Thread::GetCurrentStackPointer(); uintptr_t fp = 0; @@ -1093,7 +1054,6 @@ void Profiler::DumpStackTrace(bool for_crash) { DumpStackTrace(sp, fp, pc, for_crash); } - void Profiler::DumpStackTrace(uword sp, uword fp, uword pc, bool for_crash) { if (for_crash) { // Allow only one stack trace to prevent recursively printing stack traces @@ -1142,7 +1102,6 @@ void Profiler::DumpStackTrace(uword sp, uword fp, uword pc, bool for_crash) { OS::PrintErr("-- End of DumpStackTrace\n"); } - void Profiler::SampleAllocation(Thread* thread, intptr_t cid) { ASSERT(thread != NULL); OSThread* os_thread = thread->os_thread(); @@ -1201,7 +1160,6 @@ void Profiler::SampleAllocation(Thread* thread, intptr_t cid) { } } - Sample* Profiler::SampleNativeAllocation(intptr_t skip_count, uword address, uintptr_t allocation_size) { @@ -1256,7 +1214,6 @@ Sample* Profiler::SampleNativeAllocation(intptr_t skip_count, return sample; } - void Profiler::SampleThreadSingleFrame(Thread* thread, uintptr_t pc) { ASSERT(thread != NULL); OSThread* os_thread = thread->os_thread(); @@ -1282,7 +1239,6 @@ void Profiler::SampleThreadSingleFrame(Thread* thread, uintptr_t pc) { sample->SetAt(0, pc); } - void Profiler::SampleThread(Thread* thread, const InterruptedThreadState& state) { ASSERT(thread != NULL); @@ -1395,32 +1351,26 @@ void Profiler::SampleThread(Thread* thread, &counters_); } - CodeDescriptor::CodeDescriptor(const Code& code) : code_(code) { ASSERT(!code_.IsNull()); } - uword CodeDescriptor::Start() const { return code_.PayloadStart(); } - uword CodeDescriptor::Size() const { return code_.Size(); } - int64_t CodeDescriptor::CompileTimestamp() const { return code_.compile_timestamp(); } - CodeLookupTable::CodeLookupTable(Thread* thread) { Build(thread); } - class CodeLookupTableBuilder : public ObjectVisitor { public: explicit CodeLookupTableBuilder(CodeLookupTable* table) : table_(table) { @@ -1446,7 +1396,6 @@ class CodeLookupTableBuilder : public ObjectVisitor { CodeLookupTable* table_; }; - void CodeLookupTable::Build(Thread* thread) { ASSERT(thread != NULL); Isolate* isolate = thread->isolate(); @@ -1485,14 +1434,12 @@ void CodeLookupTable::Build(Thread* thread) { #endif } - void CodeLookupTable::Add(const Code& code) { ASSERT(!code.IsNull()); CodeDescriptor* cd = new CodeDescriptor(code); code_objects_.Add(cd); } - const CodeDescriptor* CodeLookupTable::FindCode(uword pc) const { intptr_t first = 0; intptr_t count = length(); @@ -1523,7 +1470,6 @@ const CodeDescriptor* CodeLookupTable::FindCode(uword pc) const { return NULL; } - ProcessedSampleBuffer* SampleBuffer::BuildProcessedSampleBuffer( SampleFilter* filter) { ASSERT(filter != NULL); @@ -1574,7 +1520,6 @@ ProcessedSampleBuffer* SampleBuffer::BuildProcessedSampleBuffer( return buffer; } - ProcessedSample* SampleBuffer::BuildProcessedSample( Sample* sample, const CodeLookupTable& clt) { @@ -1619,7 +1564,6 @@ ProcessedSample* SampleBuffer::BuildProcessedSample( return processed_sample; } - Sample* SampleBuffer::Next(Sample* sample) { if (!sample->is_continuation_sample()) return NULL; Sample* next_sample = At(sample->continuation_index()); @@ -1638,7 +1582,6 @@ Sample* SampleBuffer::Next(Sample* sample) { return next_sample; } - ProcessedSample::ProcessedSample() : pcs_(kSampleSize), timestamp_(0), @@ -1648,7 +1591,6 @@ ProcessedSample::ProcessedSample() truncated_(false), timeline_trie_(NULL) {} - void ProcessedSample::FixupCaller(const CodeLookupTable& clt, uword pc_marker, uword* stack_buffer) { @@ -1664,7 +1606,6 @@ void ProcessedSample::FixupCaller(const CodeLookupTable& clt, CheckForMissingDartFrame(clt, cd, pc_marker, stack_buffer); } - void ProcessedSample::CheckForMissingDartFrame(const CodeLookupTable& clt, const CodeDescriptor* cd, uword pc_marker, @@ -1719,7 +1660,6 @@ void ProcessedSample::CheckForMissingDartFrame(const CodeLookupTable& clt, } } - ProcessedSampleBuffer::ProcessedSampleBuffer() : code_lookup_table_(new CodeLookupTable(Thread::Current())) { ASSERT(code_lookup_table_ != NULL); diff --git a/runtime/vm/profiler.h b/runtime/vm/profiler.h index 75d4515e3de..8ffa4ecd097 100644 --- a/runtime/vm/profiler.h +++ b/runtime/vm/profiler.h @@ -48,7 +48,6 @@ struct ProfilerCounters { int64_t failure_native_allocation_sample; }; - class Profiler : public AllStatic { public: static void InitOnce(); @@ -101,7 +100,6 @@ class Profiler : public AllStatic { friend class Thread; }; - class SampleVisitor : public ValueObject { public: explicit SampleVisitor(Dart_Port port) : port_(port), visited_(0) {} @@ -122,7 +120,6 @@ class SampleVisitor : public ValueObject { DISALLOW_IMPLICIT_CONSTRUCTORS(SampleVisitor); }; - class SampleFilter : public ValueObject { public: SampleFilter(Dart_Port port, @@ -160,7 +157,6 @@ class SampleFilter : public ValueObject { int64_t time_extent_micros_; }; - class ClearProfileVisitor : public SampleVisitor { public: explicit ClearProfileVisitor(Isolate* isolate); @@ -168,7 +164,6 @@ class ClearProfileVisitor : public SampleVisitor { virtual void VisitSample(Sample* sample); }; - // Each Sample holds a stack trace from an isolate. class Sample { public: @@ -418,7 +413,6 @@ class Sample { DISALLOW_COPY_AND_ASSIGN(Sample); }; - class NativeAllocationSampleFilter : public SampleFilter { public: NativeAllocationSampleFilter(int64_t time_origin_micros, @@ -440,7 +434,6 @@ class NativeAllocationSampleFilter : public SampleFilter { } }; - // A Code object descriptor. class CodeDescriptor : public ZoneAllocated { public: @@ -483,7 +476,6 @@ class CodeDescriptor : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(CodeDescriptor); }; - // Fast lookup of Dart code objects. class CodeLookupTable : public ZoneAllocated { public: @@ -510,7 +502,6 @@ class CodeLookupTable : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(CodeLookupTable); }; - // Ring buffer of Samples that is (usually) shared by many isolates. class SampleBuffer { public: @@ -572,7 +563,6 @@ class SampleBuffer { DISALLOW_COPY_AND_ASSIGN(SampleBuffer); }; - class AllocationSampleBuffer : public SampleBuffer { public: explicit AllocationSampleBuffer(intptr_t capacity = kDefaultBufferCapacity); @@ -590,7 +580,6 @@ class AllocationSampleBuffer : public SampleBuffer { DISALLOW_COPY_AND_ASSIGN(AllocationSampleBuffer); }; - // A |ProcessedSample| is a combination of 1 (or more) |Sample|(s) that have // been merged into a logical sample. The raw data may have been processed to // improve the quality of the stack trace. @@ -688,7 +677,6 @@ class ProcessedSample : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(ProcessedSample); }; - // A collection of |ProcessedSample|s. class ProcessedSampleBuffer : public ZoneAllocated { public: diff --git a/runtime/vm/profiler_service.cc b/runtime/vm/profiler_service.cc index f7b877d3231..59578b135bf 100644 --- a/runtime/vm/profiler_service.cc +++ b/runtime/vm/profiler_service.cc @@ -91,12 +91,10 @@ class DeoptimizedCodeSet : public ZoneAllocated { const GrowableObjectArray& current_; }; - ProfileFunctionSourcePosition::ProfileFunctionSourcePosition( TokenPosition token_pos) : token_pos_(token_pos), exclusive_ticks_(0), inclusive_ticks_(0) {} - void ProfileFunctionSourcePosition::Tick(bool exclusive) { if (exclusive) { exclusive_ticks_++; @@ -105,7 +103,6 @@ void ProfileFunctionSourcePosition::Tick(bool exclusive) { } } - ProfileFunction::ProfileFunction(Kind kind, const char* name, const Function& function, @@ -124,7 +121,6 @@ ProfileFunction::ProfileFunction(Kind kind, ASSERT(profile_codes_.length() == 0); } - const char* ProfileFunction::Name() const { if (name_ != NULL) { return name_; @@ -135,7 +131,6 @@ const char* ProfileFunction::Name() const { return func_name.ToCString(); } - bool ProfileFunction::is_visible() const { if (function_.IsNull()) { // Some synthetic function. @@ -144,7 +139,6 @@ bool ProfileFunction::is_visible() const { return FLAG_show_invisible_frames || function_.is_visible(); } - void ProfileFunction::Tick(bool exclusive, intptr_t inclusive_serial, TokenPosition token_position) { @@ -162,7 +156,6 @@ void ProfileFunction::Tick(bool exclusive, TickSourcePosition(token_position, false); } - void ProfileFunction::TickSourcePosition(TokenPosition token_position, bool exclusive) { intptr_t i = 0; @@ -199,7 +192,6 @@ void ProfileFunction::TickSourcePosition(TokenPosition token_position, } } - const char* ProfileFunction::KindToCString(Kind kind) { switch (kind) { case kDartFunction: @@ -218,14 +210,12 @@ const char* ProfileFunction::KindToCString(Kind kind) { } } - void ProfileFunction::PrintToJSONObject(JSONObject* func) { func->AddProperty("type", "@Function"); func->AddProperty("name", name()); func->AddProperty("_kind", KindToCString(kind())); } - void ProfileFunction::PrintToJSONArray(JSONArray* functions) { JSONObject obj(functions); obj.AddProperty("kind", KindToCString(kind())); @@ -247,7 +237,6 @@ void ProfileFunction::PrintToJSONArray(JSONArray* functions) { } } - void ProfileFunction::AddProfileCode(intptr_t code_table_index) { for (intptr_t i = 0; i < profile_codes_.length(); i++) { if (profile_codes_[i] == code_table_index) { @@ -257,7 +246,6 @@ void ProfileFunction::AddProfileCode(intptr_t code_table_index) { profile_codes_.Add(code_table_index); } - bool ProfileFunction::GetSinglePosition(ProfileFunctionSourcePosition* pfsp) { if (pfsp == NULL) { return false; @@ -269,11 +257,9 @@ bool ProfileFunction::GetSinglePosition(ProfileFunctionSourcePosition* pfsp) { return true; } - ProfileCodeAddress::ProfileCodeAddress(uword pc) : pc_(pc), exclusive_ticks_(0), inclusive_ticks_(0) {} - void ProfileCodeAddress::Tick(bool exclusive) { if (exclusive) { exclusive_ticks_++; @@ -282,7 +268,6 @@ void ProfileCodeAddress::Tick(bool exclusive) { } } - ProfileCode::ProfileCode(Kind kind, uword start, uword end, @@ -301,7 +286,6 @@ ProfileCode::ProfileCode(Kind kind, code_table_index_(-1), address_ticks_(0) {} - void ProfileCode::TruncateLower(uword start) { if (start > start_) { start_ = start; @@ -309,7 +293,6 @@ void ProfileCode::TruncateLower(uword start) { ASSERT(start_ < end_); } - void ProfileCode::TruncateUpper(uword end) { if (end < end_) { end_ = end; @@ -317,7 +300,6 @@ void ProfileCode::TruncateUpper(uword end) { ASSERT(start_ < end_); } - void ProfileCode::ExpandLower(uword start) { if (start < start_) { start_ = start; @@ -325,7 +307,6 @@ void ProfileCode::ExpandLower(uword start) { ASSERT(start_ < end_); } - void ProfileCode::ExpandUpper(uword end) { if (end > end_) { end_ = end; @@ -333,19 +314,16 @@ void ProfileCode::ExpandUpper(uword end) { ASSERT(start_ < end_); } - bool ProfileCode::Overlaps(const ProfileCode* other) const { ASSERT(other != NULL); return other->Contains(start_) || other->Contains(end_ - 1) || Contains(other->start()) || Contains(other->end() - 1); } - bool ProfileCode::IsOptimizedDart() const { return !code_.IsNull() && code_.is_optimized(); } - void ProfileCode::SetName(const char* name) { if (name == NULL) { name_ = NULL; @@ -356,7 +334,6 @@ void ProfileCode::SetName(const char* name) { name_[len] = '\0'; } - void ProfileCode::GenerateAndSetSymbolName(const char* prefix) { const intptr_t kBuffSize = 512; char buff[kBuffSize]; @@ -365,7 +342,6 @@ void ProfileCode::GenerateAndSetSymbolName(const char* prefix) { SetName(buff); } - void ProfileCode::Tick(uword pc, bool exclusive, intptr_t serial) { // If exclusive is set, tick it. if (exclusive) { @@ -382,7 +358,6 @@ void ProfileCode::Tick(uword pc, bool exclusive, intptr_t serial) { TickAddress(pc, false); } - void ProfileCode::TickAddress(uword pc, bool exclusive) { const intptr_t length = address_ticks_.length(); @@ -413,7 +388,6 @@ void ProfileCode::TickAddress(uword pc, bool exclusive) { } } - void ProfileCode::PrintNativeCode(JSONObject* profile_code_obj) { ASSERT(kind() == kNativeCode); JSONObject obj(profile_code_obj, "code"); @@ -431,7 +405,6 @@ void ProfileCode::PrintNativeCode(JSONObject* profile_code_obj) { } } - void ProfileCode::PrintCollectedCode(JSONObject* profile_code_obj) { ASSERT(kind() == kCollectedCode); JSONObject obj(profile_code_obj, "code"); @@ -449,7 +422,6 @@ void ProfileCode::PrintCollectedCode(JSONObject* profile_code_obj) { } } - void ProfileCode::PrintOverwrittenCode(JSONObject* profile_code_obj) { ASSERT(kind() == kReusedCode); JSONObject obj(profile_code_obj, "code"); @@ -467,7 +439,6 @@ void ProfileCode::PrintOverwrittenCode(JSONObject* profile_code_obj) { } } - void ProfileCode::PrintTagCode(JSONObject* profile_code_obj) { ASSERT(kind() == kTagCode); JSONObject obj(profile_code_obj, "code"); @@ -485,7 +456,6 @@ void ProfileCode::PrintTagCode(JSONObject* profile_code_obj) { } } - const char* ProfileCode::KindToCString(Kind kind) { switch (kind) { case kDartCode: @@ -503,7 +473,6 @@ const char* ProfileCode::KindToCString(Kind kind) { return NULL; } - void ProfileCode::PrintToJSONArray(JSONArray* codes) { JSONObject obj(codes); obj.AddProperty("kind", ProfileCode::KindToCString(kind())); @@ -533,7 +502,6 @@ void ProfileCode::PrintToJSONArray(JSONArray* codes) { } } - class ProfileFunctionTable : public ZoneAllocated { public: ProfileFunctionTable() @@ -631,7 +599,6 @@ class ProfileFunctionTable : public ZoneAllocated { DirectChainedHashMap function_hash_; }; - ProfileFunction* ProfileCode::SetFunctionAndName(ProfileFunctionTable* table) { ASSERT(function_ == NULL); @@ -715,7 +682,6 @@ ProfileFunction* ProfileCode::SetFunctionAndName(ProfileFunctionTable* table) { return function_; } - intptr_t ProfileCodeTable::FindCodeIndexForPC(uword pc) const { intptr_t length = table_.length(); if (length == 0) { @@ -739,7 +705,6 @@ intptr_t ProfileCodeTable::FindCodeIndexForPC(uword pc) const { return -1; } - intptr_t ProfileCodeTable::InsertCode(ProfileCode* new_code) { const intptr_t length = table_.length(); if (length == 0) { @@ -799,7 +764,6 @@ intptr_t ProfileCodeTable::InsertCode(ProfileCode* new_code) { return insert; } - void ProfileCodeTable::FindNeighbors(uword pc, intptr_t* lo, intptr_t* hi, @@ -848,7 +812,6 @@ void ProfileCodeTable::FindNeighbors(uword pc, } } - void ProfileCodeTable::VerifyOrder() { const intptr_t length = table_.length(); if (length == 0) { @@ -874,7 +837,6 @@ void ProfileCodeTable::VerifyOverlap() { } } - ProfileTrieNode::ProfileTrieNode(intptr_t table_index) : table_index_(table_index), count_(0), @@ -885,16 +847,13 @@ ProfileTrieNode::ProfileTrieNode(intptr_t table_index) ASSERT(table_index_ >= 0); } - ProfileTrieNode::~ProfileTrieNode() {} - void ProfileTrieNode::Tick(ProcessedSample* sample, bool exclusive) { count_++; IncrementAllocation(sample->native_allocation_size_bytes(), exclusive); } - void ProfileTrieNode::SortChildren() { children_.Sort(ProfileTrieNodeCompare); // Recurse. @@ -903,7 +862,6 @@ void ProfileTrieNode::SortChildren() { } } - intptr_t ProfileTrieNode::IndexOf(ProfileTrieNode* node) { for (intptr_t i = 0; i < children_.length(); i++) { if (children_[i] == node) { @@ -913,7 +871,6 @@ intptr_t ProfileTrieNode::IndexOf(ProfileTrieNode* node) { return -1; } - class ProfileCodeTrieNode : public ProfileTrieNode { public: explicit ProfileCodeTrieNode(intptr_t table_index) @@ -964,7 +921,6 @@ class ProfileCodeTrieNode : public ProfileTrieNode { } }; - class ProfileFunctionTrieNodeCode { public: explicit ProfileFunctionTrieNodeCode(intptr_t index) @@ -981,7 +937,6 @@ class ProfileFunctionTrieNodeCode { intptr_t ticks_; }; - class ProfileFunctionTrieNode : public ProfileTrieNode { public: explicit ProfileFunctionTrieNode(intptr_t table_index) @@ -1057,7 +1012,6 @@ class ProfileFunctionTrieNode : public ProfileTrieNode { ZoneGrowableArray code_objects_; }; - class ProfileCodeInlinedFunctionsCache : public ValueObject { public: ProfileCodeInlinedFunctionsCache() : cache_cursor_(0), last_hit_(0) { @@ -1202,7 +1156,6 @@ class ProfileCodeInlinedFunctionsCache : public ValueObject { intptr_t cache_hit_; }; - class ProfileBuilder : public ValueObject { public: enum ProfileInfoKind { @@ -1778,7 +1731,6 @@ class ProfileBuilder : public ValueObject { function->IncInclusiveTicks(); } - // Tag append functions are overloaded for |ProfileCodeTrieNode| and // |ProfileFunctionTrieNode| types. @@ -2225,7 +2177,6 @@ class ProfileBuilder : public ValueObject { thread_->isolate()->heap()->CodeContains(pc); } - ProfileCode* FindOrRegisterNativeProfileCode(uword pc) { // Check if |pc| is already known in the live code table. ProfileCodeTable* live_table = profile_->live_code_; @@ -2345,7 +2296,6 @@ class ProfileBuilder : public ValueObject { ProfileInfoKind info_kind_; }; // ProfileBuilder. - Profile::Profile(Isolate* isolate) : isolate_(isolate), zone_(Thread::Current()->zone()), @@ -2364,7 +2314,6 @@ Profile::Profile(Isolate* isolate) } } - void Profile::Build(Thread* thread, SampleFilter* filter, SampleBuffer* sample_buffer, @@ -2375,7 +2324,6 @@ void Profile::Build(Thread* thread, builder.Build(); } - intptr_t Profile::NumFunctions() const { return functions_->length(); } @@ -2385,7 +2333,6 @@ ProfileFunction* Profile::GetFunction(intptr_t index) { return functions_->At(index); } - ProfileCode* Profile::GetCode(intptr_t index) { ASSERT(live_code_ != NULL); ASSERT(dead_code_ != NULL); @@ -2411,12 +2358,10 @@ ProfileCode* Profile::GetCode(intptr_t index) { return tag_code_->At(index); } - ProfileTrieNode* Profile::GetTrieRoot(TrieKind trie_kind) { return roots_[static_cast(trie_kind)]; } - void Profile::PrintHeaderJSON(JSONObject* obj) { obj->AddProperty("samplePeriod", static_cast(FLAG_profile_period)); obj->AddProperty("stackDepth", static_cast(FLAG_max_profile_depth)); @@ -2449,7 +2394,6 @@ void Profile::PrintHeaderJSON(JSONObject* obj) { } } - void Profile::PrintTimelineFrameJSON(JSONObject* frames, ProfileTrieNode* current, ProfileTrieNode* parent, @@ -2483,7 +2427,6 @@ void Profile::PrintTimelineFrameJSON(JSONObject* frames, } } - void Profile::PrintTimelineJSON(JSONStream* stream) { ScopeTimer sw("Profile::PrintTimelineJSON", FLAG_trace_profiler); JSONObject obj(stream); @@ -2518,12 +2461,10 @@ void Profile::PrintTimelineJSON(JSONStream* stream) { } } - ProfileFunction* Profile::FindFunction(const Function& function) { return (functions_ != NULL) ? functions_->Lookup(function) : NULL; } - void Profile::PrintProfileJSON(JSONStream* stream) { ScopeTimer sw("Profile::PrintProfileJSON", FLAG_trace_profiler); JSONObject obj(stream); @@ -2582,7 +2523,6 @@ void Profile::PrintProfileJSON(JSONStream* stream) { } } - void ProfileTrieWalker::Reset(Profile::TrieKind trie_kind) { code_trie_ = Profile::IsCodeTrie(trie_kind); parent_ = NULL; @@ -2590,7 +2530,6 @@ void ProfileTrieWalker::Reset(Profile::TrieKind trie_kind) { ASSERT(current_ != NULL); } - const char* ProfileTrieWalker::CurrentName() { if (current_ == NULL) { return NULL; @@ -2606,7 +2545,6 @@ const char* ProfileTrieWalker::CurrentName() { return NULL; } - intptr_t ProfileTrieWalker::CurrentNodeTickCount() { if (current_ == NULL) { return -1; @@ -2614,7 +2552,6 @@ intptr_t ProfileTrieWalker::CurrentNodeTickCount() { return current_->count(); } - intptr_t ProfileTrieWalker::CurrentInclusiveTicks() { if (current_ == NULL) { return -1; @@ -2630,7 +2567,6 @@ intptr_t ProfileTrieWalker::CurrentInclusiveTicks() { return -1; } - intptr_t ProfileTrieWalker::CurrentExclusiveTicks() { if (current_ == NULL) { return -1; @@ -2646,7 +2582,6 @@ intptr_t ProfileTrieWalker::CurrentExclusiveTicks() { return -1; } - intptr_t ProfileTrieWalker::CurrentInclusiveAllocations() { if (current_ == NULL) { return -1; @@ -2654,7 +2589,6 @@ intptr_t ProfileTrieWalker::CurrentInclusiveAllocations() { return current_->inclusive_allocations(); } - intptr_t ProfileTrieWalker::CurrentExclusiveAllocations() { if (current_ == NULL) { return -1; @@ -2662,7 +2596,6 @@ intptr_t ProfileTrieWalker::CurrentExclusiveAllocations() { return current_->exclusive_allocations(); } - const char* ProfileTrieWalker::CurrentToken() { if (current_ == NULL) { return NULL; @@ -2723,7 +2656,6 @@ bool ProfileTrieWalker::Down() { return true; } - bool ProfileTrieWalker::NextSibling() { if (parent_ == NULL) { return false; @@ -2740,13 +2672,11 @@ bool ProfileTrieWalker::NextSibling() { return true; } - intptr_t ProfileTrieWalker::SiblingCount() { ASSERT(parent_ != NULL); return parent_->NumChildren(); } - void ProfilerService::PrintJSONImpl(Thread* thread, JSONStream* stream, Profile::TagOrder tag_order, @@ -2776,7 +2706,6 @@ void ProfilerService::PrintJSONImpl(Thread* thread, } } - class NoAllocationSampleFilter : public SampleFilter { public: NoAllocationSampleFilter(Dart_Port port, @@ -2791,7 +2720,6 @@ class NoAllocationSampleFilter : public SampleFilter { bool FilterSample(Sample* sample) { return !sample->is_allocation_sample(); } }; - void ProfilerService::PrintJSON(JSONStream* stream, Profile::TagOrder tag_order, intptr_t extra_tags, @@ -2806,7 +2734,6 @@ void ProfilerService::PrintJSON(JSONStream* stream, Profiler::sample_buffer(), as_timeline); } - class ClassAllocationSampleFilter : public SampleFilter { public: ClassAllocationSampleFilter(Dart_Port port, @@ -2831,7 +2758,6 @@ class ClassAllocationSampleFilter : public SampleFilter { const Class& cls_; }; - void ProfilerService::PrintAllocationJSON(JSONStream* stream, Profile::TagOrder tag_order, const Class& cls, @@ -2847,7 +2773,6 @@ void ProfilerService::PrintAllocationJSON(JSONStream* stream, Profiler::sample_buffer(), as_timeline); } - void ProfilerService::PrintNativeAllocationJSON(JSONStream* stream, Profile::TagOrder tag_order, int64_t time_origin_micros, @@ -2859,7 +2784,6 @@ void ProfilerService::PrintNativeAllocationJSON(JSONStream* stream, Profiler::allocation_sample_buffer(), as_timeline); } - void ProfilerService::PrintTimelineJSON(JSONStream* stream, Profile::TagOrder tag_order, int64_t time_origin_micros, @@ -2876,7 +2800,6 @@ void ProfilerService::PrintTimelineJSON(JSONStream* stream, Profiler::sample_buffer(), as_timeline); } - void ProfilerService::ClearSamples() { SampleBuffer* sample_buffer = Profiler::sample_buffer(); if (sample_buffer == NULL) { diff --git a/runtime/vm/profiler_service.h b/runtime/vm/profiler_service.h index 55e1742e4c3..ba1981ace39 100644 --- a/runtime/vm/profiler_service.h +++ b/runtime/vm/profiler_service.h @@ -50,7 +50,6 @@ class ProfileFunctionSourcePosition { DISALLOW_ALLOCATION(); }; - // Profile data related to a |Function|. class ProfileFunction : public ZoneAllocated { public: @@ -128,7 +127,6 @@ class ProfileFunction : public ZoneAllocated { friend class ProfileBuilder; }; - class ProfileCodeAddress { public: explicit ProfileCodeAddress(uword pc); @@ -145,7 +143,6 @@ class ProfileCodeAddress { intptr_t inclusive_ticks_; }; - // Profile data related to a |Code|. class ProfileCode : public ZoneAllocated { public: @@ -241,7 +238,6 @@ class ProfileCode : public ZoneAllocated { friend class ProfileBuilder; }; - class ProfileCodeTable : public ZoneAllocated { public: ProfileCodeTable() : table_(8) {} @@ -283,7 +279,6 @@ class ProfileCodeTable : public ZoneAllocated { ZoneGrowableArray table_; }; - // Stack traces are organized in a trie. This holds information about one node // in the trie. A node in a tree represents a stack frame and a path in the tree // represents a stack trace. Each unique stack trace appears in the tree once @@ -338,7 +333,6 @@ class ProfileTrieNode : public ZoneAllocated { return (*b)->count() - (*a)->count(); } - intptr_t table_index_; intptr_t count_; intptr_t exclusive_allocations_; @@ -349,7 +343,6 @@ class ProfileTrieNode : public ZoneAllocated { friend class ProfileBuilder; }; - // The model for a profile. Most of the model is zone allocated, therefore // a zone must be created that lives longer than this object. class Profile : public ValueObject { @@ -423,7 +416,6 @@ class Profile : public ValueObject { friend class ProfileBuilder; }; - class ProfileTrieWalker : public ValueObject { public: explicit ProfileTrieWalker(Profile* profile) @@ -463,7 +455,6 @@ class ProfileTrieWalker : public ValueObject { bool code_trie_; }; - class ProfilerService : public AllStatic { public: enum { diff --git a/runtime/vm/profiler_test.cc b/runtime/vm/profiler_test.cc index c953f21cfce..c431944674f 100644 --- a/runtime/vm/profiler_test.cc +++ b/runtime/vm/profiler_test.cc @@ -34,7 +34,6 @@ class DisableNativeProfileScope : public ValueObject { const bool FLAG_profile_vm_; }; - class DisableBackgroundCompilationScope : public ValueObject { public: DisableBackgroundCompilationScope() @@ -50,7 +49,6 @@ class DisableBackgroundCompilationScope : public ValueObject { const bool FLAG_background_compilation_; }; - // Temporarily adjust the maximum profile depth. class MaxProfileDepthScope : public ValueObject { public: @@ -65,7 +63,6 @@ class MaxProfileDepthScope : public ValueObject { const intptr_t FLAG_max_profile_depth_; }; - class ProfileSampleBufferTestHelper { public: static intptr_t IterateCount(const Dart_Port port, @@ -81,7 +78,6 @@ class ProfileSampleBufferTestHelper { return c; } - static intptr_t IterateSumPC(const Dart_Port port, const SampleBuffer& sample_buffer) { intptr_t c = 0; @@ -96,7 +92,6 @@ class ProfileSampleBufferTestHelper { } }; - TEST_CASE(Profiler_SampleBufferWrapTest) { SampleBuffer* sample_buffer = new SampleBuffer(3); Dart_Port i = 123; @@ -121,7 +116,6 @@ TEST_CASE(Profiler_SampleBufferWrapTest) { delete sample_buffer; } - TEST_CASE(Profiler_SampleBufferIterateTest) { SampleBuffer* sample_buffer = new SampleBuffer(3); Dart_Port i = 123; @@ -142,7 +136,6 @@ TEST_CASE(Profiler_SampleBufferIterateTest) { delete sample_buffer; } - TEST_CASE(Profiler_AllocationSampleTest) { Isolate* isolate = Isolate::Current(); SampleBuffer* sample_buffer = new SampleBuffer(3); @@ -154,7 +147,6 @@ TEST_CASE(Profiler_AllocationSampleTest) { delete sample_buffer; } - static RawClass* GetClass(const Library& lib, const char* name) { const Class& cls = Class::Handle(lib.LookupClassAllowPrivate( String::Handle(Symbols::New(Thread::Current(), name)))); @@ -162,7 +154,6 @@ static RawClass* GetClass(const Library& lib, const char* name) { return cls.raw(); } - static RawFunction* GetFunction(const Library& lib, const char* name) { const Function& func = Function::Handle(lib.LookupFunctionAllowPrivate( String::Handle(Symbols::New(Thread::Current(), name)))); @@ -170,7 +161,6 @@ static RawFunction* GetFunction(const Library& lib, const char* name) { return func.raw(); } - class AllocationFilter : public SampleFilter { public: AllocationFilter(Dart_Port port, @@ -199,7 +189,6 @@ class AllocationFilter : public SampleFilter { bool enable_vm_ticks_; }; - TEST_CASE(Profiler_TrivialRecordAllocation) { DisableNativeProfileScope dnps; const char* kScript = @@ -324,7 +313,6 @@ DART_NOINLINE static void NativeAllocationSampleHelper(char** result) { *result = static_cast(malloc(sizeof(char) * 1024)); } - ISOLATE_UNIT_TEST_CASE(Profiler_NativeAllocation) { bool enable_malloc_hooks_saved = FLAG_profiler_native_memory; FLAG_profiler_native_memory = true; @@ -527,7 +515,6 @@ ISOLATE_UNIT_TEST_CASE(Profiler_NativeAllocation) { #endif // defined(DART_USE_TCMALLOC) && !defined(PRODUCT) && // !defined(TARGET_ARCH_DBC) && !defined(HOST_OS_FUCHSIA) - TEST_CASE(Profiler_ToggleRecordAllocation) { DisableNativeProfileScope dnps; const char* kScript = @@ -555,7 +542,6 @@ TEST_CASE(Profiler_ToggleRecordAllocation) { Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); EXPECT_VALID(result); - { Thread* thread = Thread::Current(); Isolate* isolate = thread->isolate(); @@ -658,7 +644,6 @@ TEST_CASE(Profiler_ToggleRecordAllocation) { } } - TEST_CASE(Profiler_CodeTicks) { DisableNativeProfileScope dnps; const char* kScript = @@ -761,7 +746,6 @@ TEST_CASE(Profiler_CodeTicks) { } } - TEST_CASE(Profiler_FunctionTicks) { DisableNativeProfileScope dnps; const char* kScript = @@ -864,7 +848,6 @@ TEST_CASE(Profiler_FunctionTicks) { } } - TEST_CASE(Profiler_IntrinsicAllocation) { DisableNativeProfileScope dnps; const char* kScript = "double foo(double a, double b) => a + b;"; @@ -936,7 +919,6 @@ TEST_CASE(Profiler_IntrinsicAllocation) { } } - TEST_CASE(Profiler_ArrayAllocation) { DisableNativeProfileScope dnps; const char* kScript = @@ -1033,7 +1015,6 @@ TEST_CASE(Profiler_ArrayAllocation) { } } - TEST_CASE(Profiler_ContextAllocation) { DisableNativeProfileScope dnps; const char* kScript = @@ -1103,7 +1084,6 @@ TEST_CASE(Profiler_ContextAllocation) { } } - TEST_CASE(Profiler_ClosureAllocation) { DisableNativeProfileScope dnps; const char* kScript = @@ -1175,7 +1155,6 @@ TEST_CASE(Profiler_ClosureAllocation) { } } - TEST_CASE(Profiler_TypedArrayAllocation) { DisableNativeProfileScope dnps; const char* kScript = @@ -1260,7 +1239,6 @@ TEST_CASE(Profiler_TypedArrayAllocation) { } } - TEST_CASE(Profiler_StringAllocation) { DisableNativeProfileScope dnps; const char* kScript = "String foo(String a, String b) => a + b;"; @@ -1346,7 +1324,6 @@ TEST_CASE(Profiler_StringAllocation) { } } - TEST_CASE(Profiler_StringInterpolation) { DisableNativeProfileScope dnps; DisableBackgroundCompilationScope dbcs; @@ -1435,7 +1412,6 @@ TEST_CASE(Profiler_StringInterpolation) { } } - TEST_CASE(Profiler_FunctionInline) { DisableNativeProfileScope dnps; DisableBackgroundCompilationScope dbcs; @@ -1720,7 +1696,6 @@ TEST_CASE(Profiler_FunctionInline) { } } - TEST_CASE(Profiler_InliningIntervalBoundry) { // The PC of frames below the top frame is a call's return address, // which can belong to a different inlining interval than the call. @@ -1857,7 +1832,6 @@ TEST_CASE(Profiler_InliningIntervalBoundry) { } } - TEST_CASE(Profiler_ChainedSamples) { MaxProfileDepthScope mpds(32); DisableNativeProfileScope dnps; @@ -1908,7 +1882,6 @@ TEST_CASE(Profiler_ChainedSamples) { Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); EXPECT_VALID(result); - { Thread* thread = Thread::Current(); Isolate* isolate = thread->isolate(); @@ -1971,7 +1944,6 @@ TEST_CASE(Profiler_ChainedSamples) { } } - TEST_CASE(Profiler_BasicSourcePosition) { DisableNativeProfileScope dnps; DisableBackgroundCompilationScope dbcs; @@ -2046,7 +2018,6 @@ TEST_CASE(Profiler_BasicSourcePosition) { } } - TEST_CASE(Profiler_BasicSourcePositionOptimized) { DisableNativeProfileScope dnps; DisableBackgroundCompilationScope dbcs; @@ -2140,7 +2111,6 @@ TEST_CASE(Profiler_BasicSourcePositionOptimized) { } } - TEST_CASE(Profiler_SourcePosition) { DisableNativeProfileScope dnps; DisableBackgroundCompilationScope dbcs; @@ -2245,7 +2215,6 @@ TEST_CASE(Profiler_SourcePosition) { } } - TEST_CASE(Profiler_SourcePositionOptimized) { DisableNativeProfileScope dnps; DisableBackgroundCompilationScope dbcs; @@ -2370,7 +2339,6 @@ TEST_CASE(Profiler_SourcePositionOptimized) { } } - TEST_CASE(Profiler_BinaryOperatorSourcePosition) { DisableNativeProfileScope dnps; DisableBackgroundCompilationScope dbcs; @@ -2484,7 +2452,6 @@ TEST_CASE(Profiler_BinaryOperatorSourcePosition) { } } - TEST_CASE(Profiler_BinaryOperatorSourcePositionOptimized) { DisableNativeProfileScope dnps; DisableBackgroundCompilationScope dbcs; @@ -2618,7 +2585,6 @@ TEST_CASE(Profiler_BinaryOperatorSourcePositionOptimized) { } } - static void InsertFakeSample(SampleBuffer* sample_buffer, uword* pc_offsets) { ASSERT(sample_buffer != NULL); Isolate* isolate = Isolate::Current(); @@ -2644,9 +2610,7 @@ static void InsertFakeSample(SampleBuffer* sample_buffer, uword* pc_offsets) { sample->SetAt(i, 0); } - -static uword FindPCForTokenPosition(const Code& code, - TokenPosition tp) { +static uword FindPCForTokenPosition(const Code& code, TokenPosition tp) { GrowableArray functions; GrowableArray token_positions; for (intptr_t pc_offset = 0; pc_offset < code.Size(); pc_offset++) { @@ -2660,7 +2624,6 @@ static uword FindPCForTokenPosition(const Code& code, return 0; } - TEST_CASE(Profiler_GetSourceReport) { const char* kScript = "doWork(i) => i * i;\n" @@ -2794,7 +2757,6 @@ TEST_CASE(Profiler_GetSourceReport) { EXPECT_SUBSTRING("\"inclusiveTicks\":[1,2]", js.ToCString()); } - TEST_CASE(Profiler_ProfileCodeTableTest) { Zone* Z = Thread::Current()->zone(); diff --git a/runtime/vm/program_visitor.cc b/runtime/vm/program_visitor.cc index 61288b545eb..256c9db84f5 100644 --- a/runtime/vm/program_visitor.cc +++ b/runtime/vm/program_visitor.cc @@ -5,9 +5,9 @@ #include "vm/program_visitor.h" #include "vm/deopt_instructions.h" +#include "vm/hash_map.h" #include "vm/object.h" #include "vm/object_store.h" -#include "vm/hash_map.h" #include "vm/symbols.h" namespace dart { @@ -34,7 +34,6 @@ void ProgramVisitor::VisitClasses(ClassVisitor* visitor) { } } - void ProgramVisitor::VisitFunctions(FunctionVisitor* visitor) { Thread* thread = Thread::Current(); Isolate* isolate = thread->isolate(); @@ -95,7 +94,6 @@ void ProgramVisitor::VisitFunctions(FunctionVisitor* visitor) { } } - void ProgramVisitor::ShareMegamorphicBuckets() { Thread* thread = Thread::Current(); Isolate* isolate = thread->isolate(); @@ -122,7 +120,6 @@ void ProgramVisitor::ShareMegamorphicBuckets() { } } - class StackMapKeyValueTrait { public: // Typedefs needed for the DirectChainedHashMap template. @@ -143,7 +140,6 @@ class StackMapKeyValueTrait { typedef DirectChainedHashMap StackMapSet; - void ProgramVisitor::DedupStackMaps() { class DedupStackMapsVisitor : public FunctionVisitor { public: @@ -192,7 +188,6 @@ void ProgramVisitor::DedupStackMaps() { ProgramVisitor::VisitFunctions(&visitor); } - class PcDescriptorsKeyValueTrait { public: // Typedefs needed for the DirectChainedHashMap template. @@ -213,7 +208,6 @@ class PcDescriptorsKeyValueTrait { typedef DirectChainedHashMap PcDescriptorsSet; - void ProgramVisitor::DedupPcDescriptors() { class DedupPcDescriptorsVisitor : public FunctionVisitor { public: @@ -257,7 +251,6 @@ void ProgramVisitor::DedupPcDescriptors() { ProgramVisitor::VisitFunctions(&visitor); } - class TypedDataKeyValueTrait { public: // Typedefs needed for the DirectChainedHashMap template. @@ -280,7 +273,6 @@ class TypedDataKeyValueTrait { typedef DirectChainedHashMap TypedDataSet; - #if !defined(DART_PRECOMPILED_RUNTIME) void ProgramVisitor::DedupDeoptEntries() { class DedupDeoptEntriesVisitor : public FunctionVisitor { @@ -340,7 +332,6 @@ void ProgramVisitor::DedupDeoptEntries() { } #endif // !defined(DART_PRECOMPILED_RUNTIME) - class CodeSourceMapKeyValueTrait { public: // Typedefs needed for the DirectChainedHashMap template. @@ -361,7 +352,6 @@ class CodeSourceMapKeyValueTrait { typedef DirectChainedHashMap CodeSourceMapSet; - void ProgramVisitor::DedupCodeSourceMaps() { class DedupCodeSourceMapsVisitor : public FunctionVisitor { public: @@ -405,7 +395,6 @@ void ProgramVisitor::DedupCodeSourceMaps() { ProgramVisitor::VisitFunctions(&visitor); } - class ArrayKeyValueTrait { public: // Typedefs needed for the DirectChainedHashMap template. @@ -434,7 +423,6 @@ class ArrayKeyValueTrait { typedef DirectChainedHashMap ArraySet; - void ProgramVisitor::DedupLists() { class DedupListsVisitor : public FunctionVisitor { public: @@ -532,7 +520,6 @@ void ProgramVisitor::DedupLists() { ProgramVisitor::VisitFunctions(&visitor); } - class InstructionsKeyValueTrait { public: // Typedefs needed for the DirectChainedHashMap template. @@ -553,7 +540,6 @@ class InstructionsKeyValueTrait { typedef DirectChainedHashMap InstructionsSet; - void ProgramVisitor::DedupInstructions() { class DedupInstructionsVisitor : public FunctionVisitor { public: @@ -598,7 +584,6 @@ void ProgramVisitor::DedupInstructions() { ProgramVisitor::VisitFunctions(&visitor); } - void ProgramVisitor::Dedup() { Thread* thread = Thread::Current(); StackZone stack_zone(thread); diff --git a/runtime/vm/random.cc b/runtime/vm/random.cc index 5153ffe21f0..3fd8db7a147 100644 --- a/runtime/vm/random.cc +++ b/runtime/vm/random.cc @@ -29,7 +29,6 @@ Random::Random() { Initialize(seed); } - void Random::Initialize(uint64_t seed) { ASSERT(seed != 0); // Crank the next state a couple of times. @@ -40,12 +39,10 @@ void Random::Initialize(uint64_t seed) { NextState(); } - Random::Random(uint64_t seed) { Initialize(seed); } - Random::~Random() { // Nothing to be done here. } @@ -62,7 +59,6 @@ void Random::NextState() { _state = (A * state_lo) + state_hi; } - uint32_t Random::NextUInt32() { const uint64_t MASK_32 = 0xffffffff; NextState(); diff --git a/runtime/vm/random.h b/runtime/vm/random.h index 2af1fa78a00..b79f9c8f105 100644 --- a/runtime/vm/random.h +++ b/runtime/vm/random.h @@ -5,8 +5,8 @@ #ifndef RUNTIME_VM_RANDOM_H_ #define RUNTIME_VM_RANDOM_H_ -#include "vm/globals.h" #include "vm/allocation.h" +#include "vm/globals.h" namespace dart { diff --git a/runtime/vm/raw_object.cc b/runtime/vm/raw_object.cc index 3a0a5a6f864..84949fbbc7e 100644 --- a/runtime/vm/raw_object.cc +++ b/runtime/vm/raw_object.cc @@ -12,7 +12,6 @@ #include "vm/object.h" #include "vm/visitor.h" - namespace dart { void RawObject::Validate(Isolate* isolate) const { @@ -50,7 +49,6 @@ void RawObject::Validate(Isolate* isolate) const { } } - intptr_t RawObject::SizeFromClass() const { // Only reasonable to be called on heap objects. ASSERT(IsHeapObject()); @@ -218,7 +216,6 @@ intptr_t RawObject::SizeFromClass() const { return instance_size; } - intptr_t RawObject::VisitPointersPredefined(ObjectPointerVisitor* visitor, intptr_t class_id) { ASSERT(class_id < kNumPredefinedCids); @@ -288,20 +285,17 @@ intptr_t RawObject::VisitPointersPredefined(ObjectPointerVisitor* visitor, return size; } - bool RawObject::FindObject(FindObjectVisitor* visitor) { ASSERT(visitor != NULL); return visitor->FindObject(this); } - intptr_t RawClass::VisitClassPointers(RawClass* raw_obj, ObjectPointerVisitor* visitor) { visitor->VisitPointers(raw_obj->from(), raw_obj->to()); return Class::InstanceSize(); } - intptr_t RawUnresolvedClass::VisitUnresolvedClassPointers( RawUnresolvedClass* raw_obj, ObjectPointerVisitor* visitor) { @@ -309,7 +303,6 @@ intptr_t RawUnresolvedClass::VisitUnresolvedClassPointers( return UnresolvedClass::InstanceSize(); } - intptr_t RawAbstractType::VisitAbstractTypePointers( RawAbstractType* raw_obj, ObjectPointerVisitor* visitor) { @@ -318,21 +311,18 @@ intptr_t RawAbstractType::VisitAbstractTypePointers( return 0; } - intptr_t RawType::VisitTypePointers(RawType* raw_obj, ObjectPointerVisitor* visitor) { visitor->VisitPointers(raw_obj->from(), raw_obj->to()); return Type::InstanceSize(); } - intptr_t RawTypeRef::VisitTypeRefPointers(RawTypeRef* raw_obj, ObjectPointerVisitor* visitor) { visitor->VisitPointers(raw_obj->from(), raw_obj->to()); return TypeRef::InstanceSize(); } - intptr_t RawTypeParameter::VisitTypeParameterPointers( RawTypeParameter* raw_obj, ObjectPointerVisitor* visitor) { @@ -340,7 +330,6 @@ intptr_t RawTypeParameter::VisitTypeParameterPointers( return TypeParameter::InstanceSize(); } - intptr_t RawBoundedType::VisitBoundedTypePointers( RawBoundedType* raw_obj, ObjectPointerVisitor* visitor) { @@ -348,7 +337,6 @@ intptr_t RawBoundedType::VisitBoundedTypePointers( return BoundedType::InstanceSize(); } - intptr_t RawMixinAppType::VisitMixinAppTypePointers( RawMixinAppType* raw_obj, ObjectPointerVisitor* visitor) { @@ -356,7 +344,6 @@ intptr_t RawMixinAppType::VisitMixinAppTypePointers( return MixinAppType::InstanceSize(); } - intptr_t RawTypeArguments::VisitTypeArgumentsPointers( RawTypeArguments* raw_obj, ObjectPointerVisitor* visitor) { @@ -365,21 +352,18 @@ intptr_t RawTypeArguments::VisitTypeArgumentsPointers( return TypeArguments::InstanceSize(length); } - intptr_t RawPatchClass::VisitPatchClassPointers(RawPatchClass* raw_obj, ObjectPointerVisitor* visitor) { visitor->VisitPointers(raw_obj->from(), raw_obj->to()); return PatchClass::InstanceSize(); } - intptr_t RawClosure::VisitClosurePointers(RawClosure* raw_obj, ObjectPointerVisitor* visitor) { visitor->VisitPointers(raw_obj->from(), raw_obj->to()); return Closure::InstanceSize(); } - intptr_t RawClosureData::VisitClosureDataPointers( RawClosureData* raw_obj, ObjectPointerVisitor* visitor) { @@ -387,7 +371,6 @@ intptr_t RawClosureData::VisitClosureDataPointers( return ClosureData::InstanceSize(); } - intptr_t RawSignatureData::VisitSignatureDataPointers( RawSignatureData* raw_obj, ObjectPointerVisitor* visitor) { @@ -395,7 +378,6 @@ intptr_t RawSignatureData::VisitSignatureDataPointers( return SignatureData::InstanceSize(); } - intptr_t RawRedirectionData::VisitRedirectionDataPointers( RawRedirectionData* raw_obj, ObjectPointerVisitor* visitor) { @@ -403,7 +385,6 @@ intptr_t RawRedirectionData::VisitRedirectionDataPointers( return RedirectionData::InstanceSize(); } - bool RawFunction::CheckUsageCounter(RawFunction* raw_fun) { // NOTE: This code runs while GC is in progress and runs within // a NoHandleScope block. Hence it is not okay to use regular Zone or @@ -425,7 +406,6 @@ bool RawFunction::CheckUsageCounter(RawFunction* raw_fun) { return FLAG_always_drop_code || (fn.usage_counter() == 0); } - bool RawFunction::ShouldVisitCode(RawCode* raw_code) { // NOTE: This code runs while GC is in progress and runs within // a NoHandleScope block. Hence it is not okay to use regular Zone or @@ -441,7 +421,6 @@ bool RawFunction::ShouldVisitCode(RawCode* raw_code) { return false; } - intptr_t RawFunction::VisitFunctionPointers(RawFunction* raw_obj, ObjectPointerVisitor* visitor) { if (visitor->visit_function_code() || !CheckUsageCounter(raw_obj)) { @@ -470,14 +449,12 @@ intptr_t RawFunction::VisitFunctionPointers(RawFunction* raw_obj, return Function::InstanceSize(); } - intptr_t RawField::VisitFieldPointers(RawField* raw_obj, ObjectPointerVisitor* visitor) { visitor->VisitPointers(raw_obj->from(), raw_obj->to()); return Field::InstanceSize(); } - intptr_t RawLiteralToken::VisitLiteralTokenPointers( RawLiteralToken* raw_obj, ObjectPointerVisitor* visitor) { @@ -485,7 +462,6 @@ intptr_t RawLiteralToken::VisitLiteralTokenPointers( return LiteralToken::InstanceSize(); } - intptr_t RawTokenStream::VisitTokenStreamPointers( RawTokenStream* raw_obj, ObjectPointerVisitor* visitor) { @@ -493,21 +469,18 @@ intptr_t RawTokenStream::VisitTokenStreamPointers( return TokenStream::InstanceSize(); } - intptr_t RawScript::VisitScriptPointers(RawScript* raw_obj, ObjectPointerVisitor* visitor) { visitor->VisitPointers(raw_obj->from(), raw_obj->to()); return Script::InstanceSize(); } - intptr_t RawLibrary::VisitLibraryPointers(RawLibrary* raw_obj, ObjectPointerVisitor* visitor) { visitor->VisitPointers(raw_obj->from(), raw_obj->to()); return Library::InstanceSize(); } - intptr_t RawLibraryPrefix::VisitLibraryPrefixPointers( RawLibraryPrefix* raw_obj, ObjectPointerVisitor* visitor) { @@ -515,14 +488,12 @@ intptr_t RawLibraryPrefix::VisitLibraryPrefixPointers( return LibraryPrefix::InstanceSize(); } - intptr_t RawNamespace::VisitNamespacePointers(RawNamespace* raw_obj, ObjectPointerVisitor* visitor) { visitor->VisitPointers(raw_obj->from(), raw_obj->to()); return Namespace::InstanceSize(); } - bool RawCode::ContainsPC(RawObject* raw_obj, uword pc) { uint32_t tags = raw_obj->ptr()->tags_; if (RawObject::ClassIdTag::decode(tags) == kCodeCid) { @@ -532,7 +503,6 @@ bool RawCode::ContainsPC(RawObject* raw_obj, uword pc) { return false; } - intptr_t RawCode::VisitCodePointers(RawCode* raw_obj, ObjectPointerVisitor* visitor) { visitor->VisitPointers(raw_obj->from(), raw_obj->to()); @@ -561,7 +531,6 @@ intptr_t RawCode::VisitCodePointers(RawCode* raw_obj, #endif } - intptr_t RawObjectPool::VisitObjectPoolPointers(RawObjectPool* raw_obj, ObjectPointerVisitor* visitor) { visitor->VisitPointer( @@ -579,14 +548,12 @@ intptr_t RawObjectPool::VisitObjectPoolPointers(RawObjectPool* raw_obj, return ObjectPool::InstanceSize(raw_obj->ptr()->length_); } - intptr_t RawInstructions::VisitInstructionsPointers( RawInstructions* raw_obj, ObjectPointerVisitor* visitor) { return Instructions::InstanceSize(Instructions::Size(raw_obj)); } - bool RawInstructions::ContainsPC(RawInstructions* raw_instr, uword pc) { uword start_pc = reinterpret_cast(raw_instr->ptr()) + Instructions::HeaderSize(); @@ -595,27 +562,23 @@ bool RawInstructions::ContainsPC(RawInstructions* raw_instr, uword pc) { return (pc >= start_pc) && (pc < end_pc); } - intptr_t RawPcDescriptors::VisitPcDescriptorsPointers( RawPcDescriptors* raw_obj, ObjectPointerVisitor* visitor) { return PcDescriptors::InstanceSize(raw_obj->ptr()->length_); } - intptr_t RawCodeSourceMap::VisitCodeSourceMapPointers( RawCodeSourceMap* raw_obj, ObjectPointerVisitor* visitor) { return CodeSourceMap::InstanceSize(raw_obj->ptr()->length_); } - intptr_t RawStackMap::VisitStackMapPointers(RawStackMap* raw_obj, ObjectPointerVisitor* visitor) { return StackMap::InstanceSize(raw_obj->ptr()->length_); } - intptr_t RawLocalVarDescriptors::VisitLocalVarDescriptorsPointers( RawLocalVarDescriptors* raw_obj, ObjectPointerVisitor* visitor) { @@ -624,7 +587,6 @@ intptr_t RawLocalVarDescriptors::VisitLocalVarDescriptorsPointers( return LocalVarDescriptors::InstanceSize(num_entries); } - intptr_t RawExceptionHandlers::VisitExceptionHandlersPointers( RawExceptionHandlers* raw_obj, ObjectPointerVisitor* visitor) { @@ -635,7 +597,6 @@ intptr_t RawExceptionHandlers::VisitExceptionHandlersPointers( return ExceptionHandlers::InstanceSize(len); } - intptr_t RawContext::VisitContextPointers(RawContext* raw_obj, ObjectPointerVisitor* visitor) { intptr_t num_variables = raw_obj->ptr()->num_variables_; @@ -643,7 +604,6 @@ intptr_t RawContext::VisitContextPointers(RawContext* raw_obj, return Context::InstanceSize(num_variables); } - intptr_t RawContextScope::VisitContextScopePointers( RawContextScope* raw_obj, ObjectPointerVisitor* visitor) { @@ -652,7 +612,6 @@ intptr_t RawContextScope::VisitContextScopePointers( return ContextScope::InstanceSize(num_variables); } - intptr_t RawSingleTargetCache::VisitSingleTargetCachePointers( RawSingleTargetCache* raw_obj, ObjectPointerVisitor* visitor) { @@ -660,7 +619,6 @@ intptr_t RawSingleTargetCache::VisitSingleTargetCachePointers( return SingleTargetCache::InstanceSize(); } - intptr_t RawUnlinkedCall::VisitUnlinkedCallPointers( RawUnlinkedCall* raw_obj, ObjectPointerVisitor* visitor) { @@ -668,14 +626,12 @@ intptr_t RawUnlinkedCall::VisitUnlinkedCallPointers( return UnlinkedCall::InstanceSize(); } - intptr_t RawICData::VisitICDataPointers(RawICData* raw_obj, ObjectPointerVisitor* visitor) { visitor->VisitPointers(raw_obj->from(), raw_obj->to()); return ICData::InstanceSize(); } - intptr_t RawMegamorphicCache::VisitMegamorphicCachePointers( RawMegamorphicCache* raw_obj, ObjectPointerVisitor* visitor) { @@ -683,7 +639,6 @@ intptr_t RawMegamorphicCache::VisitMegamorphicCachePointers( return MegamorphicCache::InstanceSize(); } - intptr_t RawSubtypeTestCache::VisitSubtypeTestCachePointers( RawSubtypeTestCache* raw_obj, ObjectPointerVisitor* visitor) { @@ -693,7 +648,6 @@ intptr_t RawSubtypeTestCache::VisitSubtypeTestCachePointers( return SubtypeTestCache::InstanceSize(); } - intptr_t RawError::VisitErrorPointers(RawError* raw_obj, ObjectPointerVisitor* visitor) { // Error is an abstract class. @@ -701,14 +655,12 @@ intptr_t RawError::VisitErrorPointers(RawError* raw_obj, return 0; } - intptr_t RawApiError::VisitApiErrorPointers(RawApiError* raw_obj, ObjectPointerVisitor* visitor) { visitor->VisitPointers(raw_obj->from(), raw_obj->to()); return ApiError::InstanceSize(); } - intptr_t RawLanguageError::VisitLanguageErrorPointers( RawLanguageError* raw_obj, ObjectPointerVisitor* visitor) { @@ -716,7 +668,6 @@ intptr_t RawLanguageError::VisitLanguageErrorPointers( return LanguageError::InstanceSize(); } - intptr_t RawUnhandledException::VisitUnhandledExceptionPointers( RawUnhandledException* raw_obj, ObjectPointerVisitor* visitor) { @@ -724,7 +675,6 @@ intptr_t RawUnhandledException::VisitUnhandledExceptionPointers( return UnhandledException::InstanceSize(); } - intptr_t RawUnwindError::VisitUnwindErrorPointers( RawUnwindError* raw_obj, ObjectPointerVisitor* visitor) { @@ -732,7 +682,6 @@ intptr_t RawUnwindError::VisitUnwindErrorPointers( return UnwindError::InstanceSize(); } - intptr_t RawInstance::VisitInstancePointers(RawInstance* raw_obj, ObjectPointerVisitor* visitor) { // Make sure that we got here with the tagged pointer as this. @@ -754,7 +703,6 @@ intptr_t RawInstance::VisitInstancePointers(RawInstance* raw_obj, return instance_size; } - intptr_t RawNumber::VisitNumberPointers(RawNumber* raw_obj, ObjectPointerVisitor* visitor) { // Number is an abstract class. @@ -762,7 +710,6 @@ intptr_t RawNumber::VisitNumberPointers(RawNumber* raw_obj, return 0; } - intptr_t RawInteger::VisitIntegerPointers(RawInteger* raw_obj, ObjectPointerVisitor* visitor) { // Integer is an abstract class. @@ -770,7 +717,6 @@ intptr_t RawInteger::VisitIntegerPointers(RawInteger* raw_obj, return 0; } - intptr_t RawSmi::VisitSmiPointers(RawSmi* raw_obj, ObjectPointerVisitor* visitor) { // Smi does not have a heap representation. @@ -778,7 +724,6 @@ intptr_t RawSmi::VisitSmiPointers(RawSmi* raw_obj, return 0; } - intptr_t RawMint::VisitMintPointers(RawMint* raw_obj, ObjectPointerVisitor* visitor) { // Make sure that we got here with the tagged pointer as this. @@ -786,7 +731,6 @@ intptr_t RawMint::VisitMintPointers(RawMint* raw_obj, return Mint::InstanceSize(); } - intptr_t RawBigint::VisitBigintPointers(RawBigint* raw_obj, ObjectPointerVisitor* visitor) { // Make sure that we got here with the tagged pointer as this. @@ -795,7 +739,6 @@ intptr_t RawBigint::VisitBigintPointers(RawBigint* raw_obj, return Bigint::InstanceSize(); } - intptr_t RawDouble::VisitDoublePointers(RawDouble* raw_obj, ObjectPointerVisitor* visitor) { // Make sure that we got here with the tagged pointer as this. @@ -803,7 +746,6 @@ intptr_t RawDouble::VisitDoublePointers(RawDouble* raw_obj, return Double::InstanceSize(); } - intptr_t RawString::VisitStringPointers(RawString* raw_obj, ObjectPointerVisitor* visitor) { // String is an abstract class. @@ -811,7 +753,6 @@ intptr_t RawString::VisitStringPointers(RawString* raw_obj, return 0; } - intptr_t RawOneByteString::VisitOneByteStringPointers( RawOneByteString* raw_obj, ObjectPointerVisitor* visitor) { @@ -823,7 +764,6 @@ intptr_t RawOneByteString::VisitOneByteStringPointers( return OneByteString::InstanceSize(length); } - intptr_t RawTwoByteString::VisitTwoByteStringPointers( RawTwoByteString* raw_obj, ObjectPointerVisitor* visitor) { @@ -835,7 +775,6 @@ intptr_t RawTwoByteString::VisitTwoByteStringPointers( return TwoByteString::InstanceSize(length); } - intptr_t RawExternalOneByteString::VisitExternalOneByteStringPointers( RawExternalOneByteString* raw_obj, ObjectPointerVisitor* visitor) { @@ -845,7 +784,6 @@ intptr_t RawExternalOneByteString::VisitExternalOneByteStringPointers( return ExternalOneByteString::InstanceSize(); } - intptr_t RawExternalTwoByteString::VisitExternalTwoByteStringPointers( RawExternalTwoByteString* raw_obj, ObjectPointerVisitor* visitor) { @@ -855,7 +793,6 @@ intptr_t RawExternalTwoByteString::VisitExternalTwoByteStringPointers( return ExternalTwoByteString::InstanceSize(); } - intptr_t RawBool::VisitBoolPointers(RawBool* raw_obj, ObjectPointerVisitor* visitor) { // Make sure that we got here with the tagged pointer as this. @@ -863,7 +800,6 @@ intptr_t RawBool::VisitBoolPointers(RawBool* raw_obj, return Bool::InstanceSize(); } - intptr_t RawArray::VisitArrayPointers(RawArray* raw_obj, ObjectPointerVisitor* visitor) { intptr_t length = Smi::Value(raw_obj->ptr()->length_); @@ -871,14 +807,12 @@ intptr_t RawArray::VisitArrayPointers(RawArray* raw_obj, return Array::InstanceSize(length); } - intptr_t RawImmutableArray::VisitImmutableArrayPointers( RawImmutableArray* raw_obj, ObjectPointerVisitor* visitor) { return RawArray::VisitArrayPointers(raw_obj, visitor); } - intptr_t RawGrowableObjectArray::VisitGrowableObjectArrayPointers( RawGrowableObjectArray* raw_obj, ObjectPointerVisitor* visitor) { @@ -886,7 +820,6 @@ intptr_t RawGrowableObjectArray::VisitGrowableObjectArrayPointers( return GrowableObjectArray::InstanceSize(); } - intptr_t RawLinkedHashMap::VisitLinkedHashMapPointers( RawLinkedHashMap* raw_obj, ObjectPointerVisitor* visitor) { @@ -894,21 +827,18 @@ intptr_t RawLinkedHashMap::VisitLinkedHashMapPointers( return LinkedHashMap::InstanceSize(); } - intptr_t RawFloat32x4::VisitFloat32x4Pointers(RawFloat32x4* raw_obj, ObjectPointerVisitor* visitor) { ASSERT(raw_obj->IsHeapObject()); return Float32x4::InstanceSize(); } - intptr_t RawInt32x4::VisitInt32x4Pointers(RawInt32x4* raw_obj, ObjectPointerVisitor* visitor) { ASSERT(raw_obj->IsHeapObject()); return Int32x4::InstanceSize(); } - intptr_t RawFloat64x2::VisitFloat64x2Pointers(RawFloat64x2* raw_obj, ObjectPointerVisitor* visitor) { ASSERT(raw_obj->IsHeapObject()); @@ -926,7 +856,6 @@ intptr_t RawTypedData::VisitTypedDataPointers(RawTypedData* raw_obj, return TypedData::InstanceSize(lengthInBytes); } - intptr_t RawExternalTypedData::VisitExternalTypedDataPointers( RawExternalTypedData* raw_obj, ObjectPointerVisitor* visitor) { @@ -943,7 +872,6 @@ intptr_t RawCapability::VisitCapabilityPointers(RawCapability* raw_obj, return Capability::InstanceSize(); } - intptr_t RawReceivePort::VisitReceivePortPointers( RawReceivePort* raw_obj, ObjectPointerVisitor* visitor) { @@ -953,7 +881,6 @@ intptr_t RawReceivePort::VisitReceivePortPointers( return ReceivePort::InstanceSize(); } - intptr_t RawSendPort::VisitSendPortPointers(RawSendPort* raw_obj, ObjectPointerVisitor* visitor) { // Make sure that we got here with the tagged pointer as this. @@ -961,7 +888,6 @@ intptr_t RawSendPort::VisitSendPortPointers(RawSendPort* raw_obj, return SendPort::InstanceSize(); } - intptr_t RawStackTrace::VisitStackTracePointers(RawStackTrace* raw_obj, ObjectPointerVisitor* visitor) { // Make sure that we got here with the tagged pointer as this. @@ -970,7 +896,6 @@ intptr_t RawStackTrace::VisitStackTracePointers(RawStackTrace* raw_obj, return StackTrace::InstanceSize(); } - intptr_t RawRegExp::VisitRegExpPointers(RawRegExp* raw_obj, ObjectPointerVisitor* visitor) { // Make sure that we got here with the tagged pointer as this. @@ -979,7 +904,6 @@ intptr_t RawRegExp::VisitRegExpPointers(RawRegExp* raw_obj, return RegExp::InstanceSize(); } - intptr_t RawWeakProperty::VisitWeakPropertyPointers( RawWeakProperty* raw_obj, ObjectPointerVisitor* visitor) { @@ -989,7 +913,6 @@ intptr_t RawWeakProperty::VisitWeakPropertyPointers( return WeakProperty::InstanceSize(); } - intptr_t RawMirrorReference::VisitMirrorReferencePointers( RawMirrorReference* raw_obj, ObjectPointerVisitor* visitor) { @@ -999,7 +922,6 @@ intptr_t RawMirrorReference::VisitMirrorReferencePointers( return MirrorReference::InstanceSize(); } - intptr_t RawUserTag::VisitUserTagPointers(RawUserTag* raw_obj, ObjectPointerVisitor* visitor) { // Make sure that we got here with the tagged pointer as this. @@ -1008,5 +930,4 @@ intptr_t RawUserTag::VisitUserTagPointers(RawUserTag* raw_obj, return UserTag::InstanceSize(); } - } // namespace dart diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h index 1a6370ffdba..4362f59279b 100644 --- a/runtime/vm/raw_object.h +++ b/runtime/vm/raw_object.h @@ -140,14 +140,12 @@ namespace dart { V(Object) \ CLASS_LIST_NO_OBJECT(V) - // Forward declarations. class Isolate; #define DEFINE_FORWARD_DECLARATION(clazz) class Raw##clazz; CLASS_LIST(DEFINE_FORWARD_DECLARATION) #undef DEFINE_FORWARD_DECLARATION - enum ClassId { // Illegal class id. kIllegalCid = 0, @@ -694,7 +692,6 @@ class RawObject { DISALLOW_IMPLICIT_CONSTRUCTORS(RawObject); }; - class RawClass : public RawObject { public: enum ClassFinalizedState { @@ -768,7 +765,6 @@ class RawClass : public RawObject { friend class CidRewriteVisitor; }; - class RawUnresolvedClass : public RawObject { RAW_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass); @@ -782,7 +778,6 @@ class RawUnresolvedClass : public RawObject { TokenPosition token_pos_; }; - class RawTypeArguments : public RawObject { private: RAW_HEAP_OBJECT_IMPLEMENTATION(TypeArguments); @@ -814,7 +809,6 @@ class RawTypeArguments : public RawObject { friend class SnapshotReader; }; - class RawPatchClass : public RawObject { private: RAW_HEAP_OBJECT_IMPLEMENTATION(PatchClass); @@ -830,7 +824,6 @@ class RawPatchClass : public RawObject { friend class Function; }; - class RawFunction : public RawObject { public: enum Kind { @@ -912,7 +905,6 @@ class RawFunction : public RawObject { NOT_IN_PRECOMPILED(int8_t was_compiled_); }; - class RawClosureData : public RawObject { private: RAW_HEAP_OBJECT_IMPLEMENTATION(ClosureData); @@ -933,7 +925,6 @@ class RawClosureData : public RawObject { friend class Function; }; - class RawSignatureData : public RawObject { private: RAW_HEAP_OBJECT_IMPLEMENTATION(SignatureData); @@ -950,7 +941,6 @@ class RawSignatureData : public RawObject { friend class Function; }; - class RawRedirectionData : public RawObject { private: RAW_HEAP_OBJECT_IMPLEMENTATION(RedirectionData); @@ -962,7 +952,6 @@ class RawRedirectionData : public RawObject { RawObject** to() { return reinterpret_cast(&ptr()->target_); } }; - class RawField : public RawObject { RAW_HEAP_OBJECT_IMPLEMENTATION(Field); @@ -1022,7 +1011,6 @@ class RawField : public RawObject { friend class CidRewriteVisitor; }; - class RawLiteralToken : public RawObject { RAW_HEAP_OBJECT_IMPLEMENTATION(LiteralToken); @@ -1035,7 +1023,6 @@ class RawLiteralToken : public RawObject { friend class SnapshotReader; }; - class RawTokenStream : public RawObject { RAW_HEAP_OBJECT_IMPLEMENTATION(TokenStream); @@ -1050,7 +1037,6 @@ class RawTokenStream : public RawObject { friend class SnapshotReader; }; - class RawScript : public RawObject { public: enum Kind { @@ -1104,7 +1090,6 @@ class RawScript : public RawObject { intptr_t kernel_script_index_; }; - class RawLibrary : public RawObject { enum LibraryState { kAllocated, // Initial state. @@ -1151,7 +1136,6 @@ class RawLibrary : public RawObject { friend class Isolate; }; - class RawNamespace : public RawObject { RAW_HEAP_OBJECT_IMPLEMENTATION(Namespace); @@ -1166,7 +1150,6 @@ class RawNamespace : public RawObject { } }; - class RawCode : public RawObject { RAW_HEAP_OBJECT_IMPLEMENTATION(Code); @@ -1233,7 +1216,6 @@ class RawCode : public RawObject { friend class FunctionDeserializationCluster; }; - class RawObjectPool : public RawObject { RAW_HEAP_OBJECT_IMPLEMENTATION(ObjectPool); @@ -1254,7 +1236,6 @@ class RawObjectPool : public RawObject { friend class Object; }; - class RawInstructions : public RawObject { RAW_HEAP_OBJECT_IMPLEMENTATION(Instructions); @@ -1282,7 +1263,6 @@ class RawInstructions : public RawObject { friend class ImageWriter; }; - class RawPcDescriptors : public RawObject { public: enum Kind { @@ -1343,7 +1323,6 @@ class RawPcDescriptors : public RawObject { friend class Object; }; - // CodeSourceMap encodes a mapping from code PC ranges to source token // positions and the stack of inlined functions. class RawCodeSourceMap : public RawObject { @@ -1361,7 +1340,6 @@ class RawCodeSourceMap : public RawObject { friend class Object; }; - // StackMap is an immutable representation of the layout of the stack at a // PC. The stack map representation consists of a bit map which marks each // live object index starting from the base of the frame. @@ -1388,7 +1366,6 @@ class RawStackMap : public RawObject { const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, uint8_t); } }; - class RawLocalVarDescriptors : public RawObject { public: enum VarInfoKind { @@ -1461,7 +1438,6 @@ class RawLocalVarDescriptors : public RawObject { friend class Object; }; - class RawExceptionHandlers : public RawObject { private: RAW_HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers); @@ -1484,7 +1460,6 @@ class RawExceptionHandlers : public RawObject { friend class Object; }; - class RawContext : public RawObject { RAW_HEAP_OBJECT_IMPLEMENTATION(Context); @@ -1504,7 +1479,6 @@ class RawContext : public RawObject { friend class SnapshotReader; }; - class RawContextScope : public RawObject { RAW_HEAP_OBJECT_IMPLEMENTATION(ContextScope); @@ -1549,7 +1523,6 @@ class RawContextScope : public RawObject { friend class SnapshotReader; }; - class RawSingleTargetCache : public RawObject { RAW_HEAP_OBJECT_IMPLEMENTATION(SingleTargetCache); RawObject** from() { return reinterpret_cast(&ptr()->target_); } @@ -1560,7 +1533,6 @@ class RawSingleTargetCache : public RawObject { classid_t upper_limit_; }; - class RawUnlinkedCall : public RawObject { RAW_HEAP_OBJECT_IMPLEMENTATION(UnlinkedCall); RawObject** from() { @@ -1573,7 +1545,6 @@ class RawUnlinkedCall : public RawObject { } }; - class RawICData : public RawObject { RAW_HEAP_OBJECT_IMPLEMENTATION(ICData); @@ -1607,7 +1578,6 @@ class RawICData : public RawObject { #endif }; - class RawMegamorphicCache : public RawObject { RAW_HEAP_OBJECT_IMPLEMENTATION(MegamorphicCache); @@ -1623,18 +1593,15 @@ class RawMegamorphicCache : public RawObject { int32_t filled_entry_count_; }; - class RawSubtypeTestCache : public RawObject { RAW_HEAP_OBJECT_IMPLEMENTATION(SubtypeTestCache); RawArray* cache_; }; - class RawError : public RawObject { RAW_HEAP_OBJECT_IMPLEMENTATION(Error); }; - class RawApiError : public RawError { RAW_HEAP_OBJECT_IMPLEMENTATION(ApiError); @@ -1643,7 +1610,6 @@ class RawApiError : public RawError { RawObject** to() { return reinterpret_cast(&ptr()->message_); } }; - class RawLanguageError : public RawError { RAW_HEAP_OBJECT_IMPLEMENTATION(LanguageError); @@ -1662,7 +1628,6 @@ class RawLanguageError : public RawError { int8_t kind_; // Of type Report::Kind. }; - class RawUnhandledException : public RawError { RAW_HEAP_OBJECT_IMPLEMENTATION(UnhandledException); @@ -1676,7 +1641,6 @@ class RawUnhandledException : public RawError { } }; - class RawUnwindError : public RawError { RAW_HEAP_OBJECT_IMPLEMENTATION(UnwindError); @@ -1686,12 +1650,10 @@ class RawUnwindError : public RawError { bool is_user_initiated_; }; - class RawInstance : public RawObject { RAW_HEAP_OBJECT_IMPLEMENTATION(Instance); }; - class RawLibraryPrefix : public RawInstance { RAW_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix); @@ -1725,7 +1687,6 @@ class RawLibraryPrefix : public RawInstance { bool is_loaded_; }; - class RawAbstractType : public RawInstance { protected: enum TypeState { @@ -1742,7 +1703,6 @@ class RawAbstractType : public RawInstance { friend class ObjectStore; }; - class RawType : public RawAbstractType { private: RAW_HEAP_OBJECT_IMPLEMENTATION(Type); @@ -1774,7 +1734,6 @@ class RawType : public RawAbstractType { friend class RawTypeArguments; }; - class RawTypeRef : public RawAbstractType { private: RAW_HEAP_OBJECT_IMPLEMENTATION(TypeRef); @@ -1784,7 +1743,6 @@ class RawTypeRef : public RawAbstractType { RawObject** to() { return reinterpret_cast(&ptr()->type_); } }; - class RawTypeParameter : public RawAbstractType { private: RAW_HEAP_OBJECT_IMPLEMENTATION(TypeParameter); @@ -1805,7 +1763,6 @@ class RawTypeParameter : public RawAbstractType { friend class CidRewriteVisitor; }; - class RawBoundedType : public RawAbstractType { private: RAW_HEAP_OBJECT_IMPLEMENTATION(BoundedType); @@ -1820,7 +1777,6 @@ class RawBoundedType : public RawAbstractType { } }; - class RawMixinAppType : public RawAbstractType { private: RAW_HEAP_OBJECT_IMPLEMENTATION(MixinAppType); @@ -1835,7 +1791,6 @@ class RawMixinAppType : public RawAbstractType { } }; - class RawClosure : public RawInstance { private: RAW_HEAP_OBJECT_IMPLEMENTATION(Closure); @@ -1866,22 +1821,18 @@ class RawClosure : public RawInstance { // arguments of the parent that are found in the context_. }; - class RawNumber : public RawInstance { RAW_OBJECT_IMPLEMENTATION(Number); }; - class RawInteger : public RawNumber { RAW_OBJECT_IMPLEMENTATION(Integer); }; - class RawSmi : public RawInteger { RAW_OBJECT_IMPLEMENTATION(Smi); }; - class RawMint : public RawInteger { RAW_HEAP_OBJECT_IMPLEMENTATION(Mint); @@ -1892,7 +1843,6 @@ class RawMint : public RawInteger { }; COMPILE_ASSERT(sizeof(RawMint) == 16); - class RawBigint : public RawInteger { RAW_HEAP_OBJECT_IMPLEMENTATION(Bigint); @@ -1903,7 +1853,6 @@ class RawBigint : public RawInteger { RawObject** to() { return reinterpret_cast(&ptr()->digits_); } }; - class RawDouble : public RawNumber { RAW_HEAP_OBJECT_IMPLEMENTATION(Double); @@ -1914,7 +1863,6 @@ class RawDouble : public RawNumber { }; COMPILE_ASSERT(sizeof(RawDouble) == 16); - class RawString : public RawInstance { RAW_HEAP_OBJECT_IMPLEMENTATION(String); @@ -1937,7 +1885,6 @@ class RawString : public RawInstance { friend class RODataSerializationCluster; }; - class RawOneByteString : public RawString { RAW_HEAP_OBJECT_IMPLEMENTATION(OneByteString); @@ -1951,7 +1898,6 @@ class RawOneByteString : public RawString { friend class String; }; - class RawTwoByteString : public RawString { RAW_HEAP_OBJECT_IMPLEMENTATION(TwoByteString); @@ -1964,7 +1910,6 @@ class RawTwoByteString : public RawString { friend class String; }; - template class ExternalStringData { public: @@ -1987,7 +1932,6 @@ class ExternalStringData { Dart_PeerFinalizer callback_; }; - class RawExternalOneByteString : public RawString { RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalOneByteString); @@ -2000,7 +1944,6 @@ class RawExternalOneByteString : public RawString { friend class String; }; - class RawExternalTwoByteString : public RawString { RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalTwoByteString); @@ -2013,14 +1956,12 @@ class RawExternalTwoByteString : public RawString { friend class String; }; - class RawBool : public RawInstance { RAW_HEAP_OBJECT_IMPLEMENTATION(Bool); bool value_; }; - class RawArray : public RawInstance { RAW_HEAP_OBJECT_IMPLEMENTATION(Array); @@ -2050,14 +1991,12 @@ class RawArray : public RawInstance { friend class SubtypeTestCache; // For high performance access. }; - class RawImmutableArray : public RawArray { RAW_HEAP_OBJECT_IMPLEMENTATION(ImmutableArray); friend class SnapshotReader; }; - class RawGrowableObjectArray : public RawInstance { RAW_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray); @@ -2072,7 +2011,6 @@ class RawGrowableObjectArray : public RawInstance { friend class SnapshotReader; }; - class RawLinkedHashMap : public RawInstance { RAW_HEAP_OBJECT_IMPLEMENTATION(LinkedHashMap); @@ -2092,7 +2030,6 @@ class RawLinkedHashMap : public RawInstance { friend class SnapshotReader; }; - class RawFloat32x4 : public RawInstance { RAW_HEAP_OBJECT_IMPLEMENTATION(Float32x4); @@ -2108,7 +2045,6 @@ class RawFloat32x4 : public RawInstance { }; COMPILE_ASSERT(sizeof(RawFloat32x4) == 24); - class RawInt32x4 : public RawInstance { RAW_HEAP_OBJECT_IMPLEMENTATION(Int32x4); @@ -2124,7 +2060,6 @@ class RawInt32x4 : public RawInstance { }; COMPILE_ASSERT(sizeof(RawInt32x4) == 24); - class RawFloat64x2 : public RawInstance { RAW_HEAP_OBJECT_IMPLEMENTATION(Float64x2); @@ -2138,7 +2073,6 @@ class RawFloat64x2 : public RawInstance { }; COMPILE_ASSERT(sizeof(RawFloat64x2) == 24); - // Define an aliases for intptr_t. #if defined(ARCH_IS_32_BIT) #define kIntPtrCid kTypedDataInt32ArrayCid @@ -2150,7 +2084,6 @@ COMPILE_ASSERT(sizeof(RawFloat64x2) == 24); #error Architecture is not 32-bit or 64-bit. #endif // ARCH_IS_32_BIT - class RawTypedData : public RawInstance { RAW_HEAP_OBJECT_IMPLEMENTATION(TypedData); @@ -2172,7 +2105,6 @@ class RawTypedData : public RawInstance { friend class ObjectPoolDeserializationCluster; }; - class RawExternalTypedData : public RawInstance { RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalTypedData); @@ -2193,7 +2125,6 @@ class RawCapability : public RawInstance { uint64_t id_; }; - class RawSendPort : public RawInstance { RAW_HEAP_OBJECT_IMPLEMENTATION(SendPort); Dart_Port id_; @@ -2202,7 +2133,6 @@ class RawSendPort : public RawInstance { friend class ReceivePort; }; - class RawReceivePort : public RawInstance { RAW_HEAP_OBJECT_IMPLEMENTATION(ReceivePort); @@ -2214,7 +2144,6 @@ class RawReceivePort : public RawInstance { RawObject** to() { return reinterpret_cast(&ptr()->handler_); } }; - // VM type for capturing stacktraces when exceptions are thrown, // Currently we don't have any interface that this object is supposed // to implement so we just support the 'toString' method which @@ -2235,7 +2164,6 @@ class RawStackTrace : public RawInstance { bool expand_inlined_; }; - // VM type for capturing JS regular expressions. class RawRegExp : public RawInstance { RAW_HEAP_OBJECT_IMPLEMENTATION(RegExp); @@ -2278,7 +2206,6 @@ class RawRegExp : public RawInstance { int8_t type_flags_; }; - class RawWeakProperty : public RawInstance { RAW_HEAP_OBJECT_IMPLEMENTATION(WeakProperty); @@ -2310,7 +2237,6 @@ class RawMirrorReference : public RawInstance { RawObject** to() { return reinterpret_cast(&ptr()->referent_); } }; - // UserTag are used by the profiler to track Dart script state. class RawUserTag : public RawInstance { RAW_HEAP_OBJECT_IMPLEMENTATION(UserTag); @@ -2342,7 +2268,6 @@ inline bool RawObject::IsErrorClassId(intptr_t index) { return (index >= kErrorCid && index < kInstanceCid); } - inline bool RawObject::IsNumberClassId(intptr_t index) { // Make sure this function is updated when new Number types are added. COMPILE_ASSERT(kIntegerCid == kNumberCid + 1 && kSmiCid == kNumberCid + 2 && @@ -2351,7 +2276,6 @@ inline bool RawObject::IsNumberClassId(intptr_t index) { return (index >= kNumberCid && index < kBoolCid); } - inline bool RawObject::IsIntegerClassId(intptr_t index) { // Make sure this function is updated when new Integer types are added. COMPILE_ASSERT(kSmiCid == kIntegerCid + 1 && kMintCid == kIntegerCid + 2 && @@ -2360,7 +2284,6 @@ inline bool RawObject::IsIntegerClassId(intptr_t index) { return (index >= kIntegerCid && index < kDoubleCid); } - inline bool RawObject::IsStringClassId(intptr_t index) { // Make sure this function is updated when new StringCid types are added. COMPILE_ASSERT(kOneByteStringCid == kStringCid + 1 && @@ -2370,7 +2293,6 @@ inline bool RawObject::IsStringClassId(intptr_t index) { return (index >= kStringCid && index <= kExternalTwoByteStringCid); } - inline bool RawObject::IsOneByteStringClassId(intptr_t index) { // Make sure this function is updated when new StringCid types are added. COMPILE_ASSERT(kOneByteStringCid == kStringCid + 1 && @@ -2380,7 +2302,6 @@ inline bool RawObject::IsOneByteStringClassId(intptr_t index) { return (index == kOneByteStringCid || index == kExternalOneByteStringCid); } - inline bool RawObject::IsTwoByteStringClassId(intptr_t index) { // Make sure this function is updated when new StringCid types are added. COMPILE_ASSERT(kOneByteStringCid == kStringCid + 1 && @@ -2390,7 +2311,6 @@ inline bool RawObject::IsTwoByteStringClassId(intptr_t index) { return (index == kTwoByteStringCid || index == kExternalTwoByteStringCid); } - inline bool RawObject::IsExternalStringClassId(intptr_t index) { // Make sure this function is updated when new StringCid types are added. COMPILE_ASSERT(kOneByteStringCid == kStringCid + 1 && @@ -2401,7 +2321,6 @@ inline bool RawObject::IsExternalStringClassId(intptr_t index) { index == kExternalTwoByteStringCid); } - inline bool RawObject::IsBuiltinListClassId(intptr_t index) { // Make sure this function is updated when new builtin List types are added. COMPILE_ASSERT(kImmutableArrayCid == kArrayCid + 1); @@ -2411,7 +2330,6 @@ inline bool RawObject::IsBuiltinListClassId(intptr_t index) { (index == kByteBufferCid)); } - inline bool RawObject::IsTypedDataClassId(intptr_t index) { // Make sure this is updated when new TypedData types are added. COMPILE_ASSERT(kTypedDataUint8ArrayCid == kTypedDataInt8ArrayCid + 1 && @@ -2432,7 +2350,6 @@ inline bool RawObject::IsTypedDataClassId(intptr_t index) { index <= kTypedDataFloat64x2ArrayCid); } - inline bool RawObject::IsTypedDataViewClassId(intptr_t index) { // Make sure this is updated when new TypedData types are added. COMPILE_ASSERT( @@ -2454,7 +2371,6 @@ inline bool RawObject::IsTypedDataViewClassId(intptr_t index) { return (index >= kTypedDataInt8ArrayViewCid && index <= kByteDataViewCid); } - inline bool RawObject::IsExternalTypedDataClassId(intptr_t index) { // Make sure this is updated when new ExternalTypedData types are added. COMPILE_ASSERT( @@ -2485,13 +2401,11 @@ inline bool RawObject::IsExternalTypedDataClassId(intptr_t index) { index <= kExternalTypedDataFloat64x2ArrayCid); } - inline bool RawObject::IsInternalVMdefinedClassId(intptr_t index) { return ((index < kNumPredefinedCids) && !RawObject::IsImplicitFieldClassId(index)); } - inline bool RawObject::IsVariableSizeClassId(intptr_t index) { return (index == kArrayCid) || (index == kImmutableArrayCid) || RawObject::IsOneByteStringClassId(index) || @@ -2506,7 +2420,6 @@ inline bool RawObject::IsVariableSizeClassId(intptr_t index) { (index == kRegExpCid); } - // This is a set of classes that are not Dart classes whose representation // is defined by the VM but are used in the VM code by computing the // implicit field offsets of the various fields in the dart object. @@ -2514,7 +2427,6 @@ inline bool RawObject::IsImplicitFieldClassId(intptr_t index) { return (IsTypedDataViewClassId(index) || index == kByteBufferCid); } - inline intptr_t RawObject::NumberOfTypedDataClasses() { // Make sure this is updated when new TypedData types are added. COMPILE_ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); @@ -2525,7 +2437,6 @@ inline intptr_t RawObject::NumberOfTypedDataClasses() { return (kNullCid - kTypedDataInt8ArrayCid); } - } // namespace dart #endif // RUNTIME_VM_RAW_OBJECT_H_ diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc index 6317a72d021..d57e7c5b78b 100644 --- a/runtime/vm/raw_object_snapshot.cc +++ b/runtime/vm/raw_object_snapshot.cc @@ -75,7 +75,6 @@ RawClass* Class::ReadFrom(SnapshotReader* reader, return cls.raw(); } - void RawClass::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -131,7 +130,6 @@ void RawClass::WriteTo(SnapshotWriter* writer, } } - RawUnresolvedClass* UnresolvedClass::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -155,7 +153,6 @@ RawUnresolvedClass* UnresolvedClass::ReadFrom(SnapshotReader* reader, return unresolved_class.raw(); } - void RawUnresolvedClass::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -177,7 +174,6 @@ void RawUnresolvedClass::WriteTo(SnapshotWriter* writer, visitor.VisitPointers(from(), to()); } - RawAbstractType* AbstractType::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -187,7 +183,6 @@ RawAbstractType* AbstractType::ReadFrom(SnapshotReader* reader, return NULL; } - void RawAbstractType::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -195,7 +190,6 @@ void RawAbstractType::WriteTo(SnapshotWriter* writer, UNREACHABLE(); // AbstractType is an abstract class. } - RawType* Type::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -235,7 +229,6 @@ RawType* Type::ReadFrom(SnapshotReader* reader, return type.raw(); } - void RawType::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -285,7 +278,6 @@ void RawType::WriteTo(SnapshotWriter* writer, writer->WriteObjectImpl(type_class, kAsReference); } - RawTypeRef* TypeRef::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -304,7 +296,6 @@ RawTypeRef* TypeRef::ReadFrom(SnapshotReader* reader, return type_ref.raw(); } - void RawTypeRef::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -323,7 +314,6 @@ void RawTypeRef::WriteTo(SnapshotWriter* writer, visitor.VisitPointers(from(), to()); } - RawTypeParameter* TypeParameter::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -354,7 +344,6 @@ RawTypeParameter* TypeParameter::ReadFrom(SnapshotReader* reader, return type_parameter.raw(); } - void RawTypeParameter::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -386,7 +375,6 @@ void RawTypeParameter::WriteTo(SnapshotWriter* writer, writer->WriteObjectImpl(param_class, kAsReference); } - RawBoundedType* BoundedType::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -406,7 +394,6 @@ RawBoundedType* BoundedType::ReadFrom(SnapshotReader* reader, return bounded_type.raw(); } - void RawBoundedType::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -425,7 +412,6 @@ void RawBoundedType::WriteTo(SnapshotWriter* writer, visitor.VisitPointers(from(), to()); } - RawMixinAppType* MixinAppType::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -435,7 +421,6 @@ RawMixinAppType* MixinAppType::ReadFrom(SnapshotReader* reader, return MixinAppType::null(); } - void RawMixinAppType::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -443,7 +428,6 @@ void RawMixinAppType::WriteTo(SnapshotWriter* writer, UNREACHABLE(); // MixinAppType objects do not survive finalization. } - RawTypeArguments* TypeArguments::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -482,7 +466,6 @@ RawTypeArguments* TypeArguments::ReadFrom(SnapshotReader* reader, return type_arguments.raw(); } - void RawTypeArguments::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -524,7 +507,6 @@ void RawTypeArguments::WriteTo(SnapshotWriter* writer, } } - RawPatchClass* PatchClass::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -543,7 +525,6 @@ RawPatchClass* PatchClass::ReadFrom(SnapshotReader* reader, return cls.raw(); } - void RawPatchClass::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -562,7 +543,6 @@ void RawPatchClass::WriteTo(SnapshotWriter* writer, visitor.VisitPointers(from(), to()); } - RawClosure* Closure::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -572,7 +552,6 @@ RawClosure* Closure::ReadFrom(SnapshotReader* reader, return Closure::null(); } - void RawClosure::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -591,7 +570,6 @@ void RawClosure::WriteTo(SnapshotWriter* writer, UNREACHABLE(); } - RawClosureData* ClosureData::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -613,7 +591,6 @@ RawClosureData* ClosureData::ReadFrom(SnapshotReader* reader, return data.raw(); } - void RawClosureData::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -648,7 +625,6 @@ void RawClosureData::WriteTo(SnapshotWriter* writer, writer->WriteObjectImpl(ptr()->closure_, kAsInlinedObject); } - RawSignatureData* SignatureData::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -669,7 +645,6 @@ RawSignatureData* SignatureData::ReadFrom(SnapshotReader* reader, return data.raw(); } - void RawSignatureData::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -689,7 +664,6 @@ void RawSignatureData::WriteTo(SnapshotWriter* writer, visitor.VisitPointers(from(), to()); } - RawRedirectionData* RedirectionData::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -709,7 +683,6 @@ RawRedirectionData* RedirectionData::ReadFrom(SnapshotReader* reader, return data.raw(); } - void RawRedirectionData::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -729,7 +702,6 @@ void RawRedirectionData::WriteTo(SnapshotWriter* writer, visitor.VisitPointers(from(), to()); } - RawFunction* Function::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -779,7 +751,6 @@ RawFunction* Function::ReadFrom(SnapshotReader* reader, } } - void RawFunction::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -845,7 +816,6 @@ void RawFunction::WriteTo(SnapshotWriter* writer, } } - RawField* Field::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -882,7 +852,6 @@ RawField* Field::ReadFrom(SnapshotReader* reader, return field.raw(); } - void RawField::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -927,7 +896,6 @@ void RawField::WriteTo(SnapshotWriter* writer, writer->WriteObjectImpl(ptr()->guarded_list_length_, kAsReference); } - RawLiteralToken* LiteralToken::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -952,7 +920,6 @@ RawLiteralToken* LiteralToken::ReadFrom(SnapshotReader* reader, return literal_token.raw(); } - void RawLiteralToken::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -975,7 +942,6 @@ void RawLiteralToken::WriteTo(SnapshotWriter* writer, visitor.VisitPointers(from(), to()); } - RawTokenStream* TokenStream::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1010,7 +976,6 @@ RawTokenStream* TokenStream::ReadFrom(SnapshotReader* reader, return token_stream.raw(); } - void RawTokenStream::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1037,7 +1002,6 @@ void RawTokenStream::WriteTo(SnapshotWriter* writer, writer->WriteObjectImpl(ptr()->private_key_, kAsInlinedObject); } - RawScript* Script::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1077,7 +1041,6 @@ RawScript* Script::ReadFrom(SnapshotReader* reader, return script.raw(); } - void RawScript::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1103,7 +1066,6 @@ void RawScript::WriteTo(SnapshotWriter* writer, visitor.VisitPointers(from(), to_snapshot(kind)); } - RawLibrary* Library::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1162,7 +1124,6 @@ RawLibrary* Library::ReadFrom(SnapshotReader* reader, return library.raw(); } - void RawLibrary::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1207,7 +1168,6 @@ void RawLibrary::WriteTo(SnapshotWriter* writer, } } - RawLibraryPrefix* LibraryPrefix::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1237,7 +1197,6 @@ RawLibraryPrefix* LibraryPrefix::ReadFrom(SnapshotReader* reader, return prefix.raw(); } - void RawLibraryPrefix::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1261,7 +1220,6 @@ void RawLibraryPrefix::WriteTo(SnapshotWriter* writer, visitor.VisitPointers(from(), to_snapshot(kind)); } - RawNamespace* Namespace::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1280,7 +1238,6 @@ RawNamespace* Namespace::ReadFrom(SnapshotReader* reader, return ns.raw(); } - void RawNamespace::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1300,7 +1257,6 @@ void RawNamespace::WriteTo(SnapshotWriter* writer, visitor.VisitPointers(from(), to()); } - RawCode* Code::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1310,7 +1266,6 @@ RawCode* Code::ReadFrom(SnapshotReader* reader, return Code::null(); } - void RawCode::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1318,7 +1273,6 @@ void RawCode::WriteTo(SnapshotWriter* writer, UNREACHABLE(); } - RawInstructions* Instructions::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1328,7 +1282,6 @@ RawInstructions* Instructions::ReadFrom(SnapshotReader* reader, return Instructions::null(); } - void RawInstructions::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1336,7 +1289,6 @@ void RawInstructions::WriteTo(SnapshotWriter* writer, UNREACHABLE(); } - RawObjectPool* ObjectPool::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1346,7 +1298,6 @@ RawObjectPool* ObjectPool::ReadFrom(SnapshotReader* reader, return ObjectPool::null(); } - void RawObjectPool::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1354,7 +1305,6 @@ void RawObjectPool::WriteTo(SnapshotWriter* writer, UNREACHABLE(); } - RawPcDescriptors* PcDescriptors::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1364,7 +1314,6 @@ RawPcDescriptors* PcDescriptors::ReadFrom(SnapshotReader* reader, return PcDescriptors::null(); } - void RawPcDescriptors::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1372,7 +1321,6 @@ void RawPcDescriptors::WriteTo(SnapshotWriter* writer, UNREACHABLE(); } - RawCodeSourceMap* CodeSourceMap::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1382,7 +1330,6 @@ RawCodeSourceMap* CodeSourceMap::ReadFrom(SnapshotReader* reader, return CodeSourceMap::null(); } - void RawCodeSourceMap::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1390,7 +1337,6 @@ void RawCodeSourceMap::WriteTo(SnapshotWriter* writer, UNREACHABLE(); } - RawStackMap* StackMap::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1400,7 +1346,6 @@ RawStackMap* StackMap::ReadFrom(SnapshotReader* reader, return StackMap::null(); } - void RawStackMap::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1408,7 +1353,6 @@ void RawStackMap::WriteTo(SnapshotWriter* writer, UNREACHABLE(); } - RawLocalVarDescriptors* LocalVarDescriptors::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1418,7 +1362,6 @@ RawLocalVarDescriptors* LocalVarDescriptors::ReadFrom(SnapshotReader* reader, return LocalVarDescriptors::null(); } - void RawLocalVarDescriptors::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1426,7 +1369,6 @@ void RawLocalVarDescriptors::WriteTo(SnapshotWriter* writer, UNREACHABLE(); } - RawExceptionHandlers* ExceptionHandlers::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1436,7 +1378,6 @@ RawExceptionHandlers* ExceptionHandlers::ReadFrom(SnapshotReader* reader, return ExceptionHandlers::null(); } - void RawExceptionHandlers::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1444,7 +1385,6 @@ void RawExceptionHandlers::WriteTo(SnapshotWriter* writer, UNREACHABLE(); } - RawContext* Context::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1474,7 +1414,6 @@ RawContext* Context::ReadFrom(SnapshotReader* reader, return context.raw(); } - void RawContext::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1498,7 +1437,6 @@ void RawContext::WriteTo(SnapshotWriter* writer, } } - RawContextScope* ContextScope::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1530,7 +1468,6 @@ RawContextScope* ContextScope::ReadFrom(SnapshotReader* reader, return NULL; } - void RawContextScope::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1559,7 +1496,6 @@ void RawContextScope::WriteTo(SnapshotWriter* writer, UNREACHABLE(); } - RawSingleTargetCache* SingleTargetCache::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1569,7 +1505,6 @@ RawSingleTargetCache* SingleTargetCache::ReadFrom(SnapshotReader* reader, return SingleTargetCache::null(); } - void RawSingleTargetCache::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1577,7 +1512,6 @@ void RawSingleTargetCache::WriteTo(SnapshotWriter* writer, UNREACHABLE(); } - RawUnlinkedCall* UnlinkedCall::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1587,7 +1521,6 @@ RawUnlinkedCall* UnlinkedCall::ReadFrom(SnapshotReader* reader, return UnlinkedCall::null(); } - void RawUnlinkedCall::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1595,7 +1528,6 @@ void RawUnlinkedCall::WriteTo(SnapshotWriter* writer, UNREACHABLE(); } - RawICData* ICData::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1619,7 +1551,6 @@ RawICData* ICData::ReadFrom(SnapshotReader* reader, return result.raw(); } - void RawICData::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1647,7 +1578,6 @@ void RawICData::WriteTo(SnapshotWriter* writer, visitor.VisitPointers(from(), to_snapshot(kind)); } - RawMegamorphicCache* MegamorphicCache::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1657,7 +1587,6 @@ RawMegamorphicCache* MegamorphicCache::ReadFrom(SnapshotReader* reader, return MegamorphicCache::null(); } - void RawMegamorphicCache::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1665,7 +1594,6 @@ void RawMegamorphicCache::WriteTo(SnapshotWriter* writer, UNREACHABLE(); } - RawSubtypeTestCache* SubtypeTestCache::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1675,7 +1603,6 @@ RawSubtypeTestCache* SubtypeTestCache::ReadFrom(SnapshotReader* reader, return SubtypeTestCache::null(); } - void RawSubtypeTestCache::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1683,7 +1610,6 @@ void RawSubtypeTestCache::WriteTo(SnapshotWriter* writer, UNREACHABLE(); } - RawError* Error::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1693,7 +1619,6 @@ RawError* Error::ReadFrom(SnapshotReader* reader, return Error::null(); // Error is an abstract class. } - void RawError::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1701,7 +1626,6 @@ void RawError::WriteTo(SnapshotWriter* writer, UNREACHABLE(); // Error is an abstract class. } - RawApiError* ApiError::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1720,7 +1644,6 @@ RawApiError* ApiError::ReadFrom(SnapshotReader* reader, return api_error.raw(); } - void RawApiError::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1739,7 +1662,6 @@ void RawApiError::WriteTo(SnapshotWriter* writer, visitor.VisitPointers(from(), to()); } - RawLanguageError* LanguageError::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1765,7 +1687,6 @@ RawLanguageError* LanguageError::ReadFrom(SnapshotReader* reader, return language_error.raw(); } - void RawLanguageError::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1789,7 +1710,6 @@ void RawLanguageError::WriteTo(SnapshotWriter* writer, visitor.VisitPointers(from(), to()); } - RawUnhandledException* UnhandledException::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1806,7 +1726,6 @@ RawUnhandledException* UnhandledException::ReadFrom(SnapshotReader* reader, return result.raw(); } - void RawUnhandledException::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1822,7 +1741,6 @@ void RawUnhandledException::WriteTo(SnapshotWriter* writer, visitor.VisitPointers(from(), to()); } - RawUnwindError* UnwindError::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1832,7 +1750,6 @@ RawUnwindError* UnwindError::ReadFrom(SnapshotReader* reader, return UnwindError::null(); } - void RawUnwindError::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1840,7 +1757,6 @@ void RawUnwindError::WriteTo(SnapshotWriter* writer, UNREACHABLE(); } - RawInstance* Instance::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1861,7 +1777,6 @@ RawInstance* Instance::ReadFrom(SnapshotReader* reader, return obj.raw(); } - void RawInstance::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1876,7 +1791,6 @@ void RawInstance::WriteTo(SnapshotWriter* writer, writer->WriteTags(writer->GetObjectTags(this)); } - RawInteger* Mint::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1913,7 +1827,6 @@ RawInteger* Mint::ReadFrom(SnapshotReader* reader, return mint.raw(); } - void RawMint::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1931,7 +1844,6 @@ void RawMint::WriteTo(SnapshotWriter* writer, writer->Write(ptr()->value_); } - RawBigint* Bigint::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -1959,7 +1871,6 @@ RawBigint* Bigint::ReadFrom(SnapshotReader* reader, return obj.raw(); } - void RawBigint::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -1978,7 +1889,6 @@ void RawBigint::WriteTo(SnapshotWriter* writer, visitor.VisitPointers(from(), to()); } - RawDouble* Double::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -2005,7 +1915,6 @@ RawDouble* Double::ReadFrom(SnapshotReader* reader, return dbl.raw(); } - void RawDouble::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -2023,7 +1932,6 @@ void RawDouble::WriteTo(SnapshotWriter* writer, writer->WriteDouble(ptr()->value_); } - RawString* String::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -2033,7 +1941,6 @@ RawString* String::ReadFrom(SnapshotReader* reader, return String::null(); } - void RawString::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -2041,7 +1948,6 @@ void RawString::WriteTo(SnapshotWriter* writer, UNREACHABLE(); // String is an abstract class. } - template void String::ReadFromImpl(SnapshotReader* reader, String* str_obj, @@ -2074,7 +1980,6 @@ void String::ReadFromImpl(SnapshotReader* reader, } } - RawOneByteString* OneByteString::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -2091,7 +1996,6 @@ RawOneByteString* OneByteString::ReadFrom(SnapshotReader* reader, return raw(str_obj); } - RawTwoByteString* TwoByteString::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -2108,7 +2012,6 @@ RawTwoByteString* TwoByteString::ReadFrom(SnapshotReader* reader, return raw(str_obj); } - template static void StringWriteTo(SnapshotWriter* writer, intptr_t object_id, @@ -2142,7 +2045,6 @@ static void StringWriteTo(SnapshotWriter* writer, } } - void RawOneByteString::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -2151,7 +2053,6 @@ void RawOneByteString::WriteTo(SnapshotWriter* writer, writer->GetObjectTags(this), ptr()->length_, ptr()->data()); } - void RawTwoByteString::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -2160,7 +2061,6 @@ void RawTwoByteString::WriteTo(SnapshotWriter* writer, writer->GetObjectTags(this), ptr()->length_, ptr()->data()); } - RawExternalOneByteString* ExternalOneByteString::ReadFrom( SnapshotReader* reader, intptr_t object_id, @@ -2171,7 +2071,6 @@ RawExternalOneByteString* ExternalOneByteString::ReadFrom( return ExternalOneByteString::null(); } - RawExternalTwoByteString* ExternalTwoByteString::ReadFrom( SnapshotReader* reader, intptr_t object_id, @@ -2182,7 +2081,6 @@ RawExternalTwoByteString* ExternalTwoByteString::ReadFrom( return ExternalTwoByteString::null(); } - void RawExternalOneByteString::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -2193,7 +2091,6 @@ void RawExternalOneByteString::WriteTo(SnapshotWriter* writer, ptr()->external_data_->data()); } - void RawExternalTwoByteString::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -2204,7 +2101,6 @@ void RawExternalTwoByteString::WriteTo(SnapshotWriter* writer, ptr()->external_data_->data()); } - RawBool* Bool::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -2214,7 +2110,6 @@ RawBool* Bool::ReadFrom(SnapshotReader* reader, return Bool::null(); } - void RawBool::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -2222,7 +2117,6 @@ void RawBool::WriteTo(SnapshotWriter* writer, UNREACHABLE(); } - RawArray* Array::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -2253,7 +2147,6 @@ RawArray* Array::ReadFrom(SnapshotReader* reader, return array->raw(); } - RawImmutableArray* ImmutableArray::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -2286,7 +2179,6 @@ RawImmutableArray* ImmutableArray::ReadFrom(SnapshotReader* reader, return raw(*array); } - void RawArray::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -2297,7 +2189,6 @@ void RawArray::WriteTo(SnapshotWriter* writer, as_reference); } - void RawImmutableArray::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -2307,7 +2198,6 @@ void RawImmutableArray::WriteTo(SnapshotWriter* writer, ptr()->type_arguments_, ptr()->data(), as_reference); } - RawGrowableObjectArray* GrowableObjectArray::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -2339,7 +2229,6 @@ RawGrowableObjectArray* GrowableObjectArray::ReadFrom(SnapshotReader* reader, return array.raw(); } - void RawGrowableObjectArray::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -2363,7 +2252,6 @@ void RawGrowableObjectArray::WriteTo(SnapshotWriter* writer, writer->WriteObjectImpl(ptr()->data_, kAsReference); } - RawLinkedHashMap* LinkedHashMap::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -2420,7 +2308,6 @@ RawLinkedHashMap* LinkedHashMap::ReadFrom(SnapshotReader* reader, return map.raw(); } - void RawLinkedHashMap::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -2471,7 +2358,6 @@ void RawLinkedHashMap::WriteTo(SnapshotWriter* writer, DEBUG_ASSERT(deleted_keys_found == deleted_keys); } - RawFloat32x4* Float32x4::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -2491,7 +2377,6 @@ RawFloat32x4* Float32x4::ReadFrom(SnapshotReader* reader, return simd.raw(); } - void RawFloat32x4::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -2512,7 +2397,6 @@ void RawFloat32x4::WriteTo(SnapshotWriter* writer, writer->Write(ptr()->value_[3]); } - RawInt32x4* Int32x4::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -2532,7 +2416,6 @@ RawInt32x4* Int32x4::ReadFrom(SnapshotReader* reader, return simd.raw(); } - void RawInt32x4::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -2553,7 +2436,6 @@ void RawInt32x4::WriteTo(SnapshotWriter* writer, writer->Write(ptr()->value_[3]); } - RawFloat64x2* Float64x2::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -2571,7 +2453,6 @@ RawFloat64x2* Float64x2::ReadFrom(SnapshotReader* reader, return simd.raw(); } - void RawFloat64x2::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -2590,13 +2471,11 @@ void RawFloat64x2::WriteTo(SnapshotWriter* writer, writer->Write(ptr()->value_[1]); } - #define TYPED_DATA_READ(setter, type) \ for (intptr_t i = 0; i < length_in_bytes; i += element_size) { \ result.Set##setter(i, reader->Read()); \ } - RawTypedData* TypedData::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -2663,7 +2542,6 @@ RawTypedData* TypedData::ReadFrom(SnapshotReader* reader, } #undef TYPED_DATA_READ - RawExternalTypedData* ExternalTypedData::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -2685,7 +2563,6 @@ RawExternalTypedData* ExternalTypedData::ReadFrom(SnapshotReader* reader, return obj.raw(); } - #define TYPED_DATA_WRITE(type) \ { \ type* data = reinterpret_cast(ptr()->data()); \ @@ -2694,7 +2571,6 @@ RawExternalTypedData* ExternalTypedData::ReadFrom(SnapshotReader* reader, } \ } - void RawTypedData::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -2751,7 +2627,6 @@ void RawTypedData::WriteTo(SnapshotWriter* writer, } } - #define TYPED_EXT_DATA_WRITE(type) \ { \ type* data = reinterpret_cast(ptr()->data_); \ @@ -2760,14 +2635,12 @@ void RawTypedData::WriteTo(SnapshotWriter* writer, } \ } - #define EXT_TYPED_DATA_WRITE(cid, type) \ writer->WriteIndexedObject(cid); \ writer->WriteTags(writer->GetObjectTags(this)); \ writer->Write(ptr()->length_); \ TYPED_EXT_DATA_WRITE(type) - void RawExternalTypedData::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -2820,7 +2693,6 @@ void RawExternalTypedData::WriteTo(SnapshotWriter* writer, #undef TYPED_DATA_WRITE #undef EXT_TYPED_DATA_WRITE - RawCapability* Capability::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -2834,7 +2706,6 @@ RawCapability* Capability::ReadFrom(SnapshotReader* reader, return result.raw(); } - void RawCapability::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -2849,7 +2720,6 @@ void RawCapability::WriteTo(SnapshotWriter* writer, writer->Write(ptr()->id_); } - RawReceivePort* ReceivePort::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -2859,7 +2729,6 @@ RawReceivePort* ReceivePort::ReadFrom(SnapshotReader* reader, return ReceivePort::null(); } - void RawReceivePort::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -2874,7 +2743,6 @@ void RawReceivePort::WriteTo(SnapshotWriter* writer, } } - RawSendPort* SendPort::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -2891,7 +2759,6 @@ RawSendPort* SendPort::ReadFrom(SnapshotReader* reader, return result.raw(); } - void RawSendPort::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -2907,7 +2774,6 @@ void RawSendPort::WriteTo(SnapshotWriter* writer, writer->Write(ptr()->origin_id_); } - RawStackTrace* StackTrace::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -2917,7 +2783,6 @@ RawStackTrace* StackTrace::ReadFrom(SnapshotReader* reader, return StackTrace::null(); } - void RawStackTrace::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -2928,7 +2793,6 @@ void RawStackTrace::WriteTo(SnapshotWriter* writer, " : (object is a stacktrace)"); } - RawRegExp* RegExp::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -2959,7 +2823,6 @@ RawRegExp* RegExp::ReadFrom(SnapshotReader* reader, return regex.raw(); } - void RawRegExp::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -2980,7 +2843,6 @@ void RawRegExp::WriteTo(SnapshotWriter* writer, writer->Write(ptr()->type_flags_); } - RawWeakProperty* WeakProperty::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -3000,7 +2862,6 @@ RawWeakProperty* WeakProperty::ReadFrom(SnapshotReader* reader, return weak_property.raw(); } - void RawWeakProperty::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -3019,7 +2880,6 @@ void RawWeakProperty::WriteTo(SnapshotWriter* writer, visitor.VisitPointers(from(), to()); } - RawMirrorReference* MirrorReference::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -3029,7 +2889,6 @@ RawMirrorReference* MirrorReference::ReadFrom(SnapshotReader* reader, return MirrorReference::null(); } - void RawMirrorReference::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, @@ -3044,7 +2903,6 @@ void RawMirrorReference::WriteTo(SnapshotWriter* writer, } } - RawUserTag* UserTag::ReadFrom(SnapshotReader* reader, intptr_t object_id, intptr_t tags, @@ -3054,7 +2912,6 @@ RawUserTag* UserTag::ReadFrom(SnapshotReader* reader, return UserTag::null(); } - void RawUserTag::WriteTo(SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind, diff --git a/runtime/vm/redundancy_elimination.cc b/runtime/vm/redundancy_elimination.cc index 06df06ab4b4..707eedc9b38 100644 --- a/runtime/vm/redundancy_elimination.cc +++ b/runtime/vm/redundancy_elimination.cc @@ -13,7 +13,6 @@ namespace dart { - DEFINE_FLAG(bool, dead_store_elimination, true, "Eliminate dead stores"); DEFINE_FLAG(bool, load_cse, true, "Use redundant load elimination."); DEFINE_FLAG(bool, @@ -24,7 +23,6 @@ DEFINE_FLAG(bool, // Quick access to the current zone. #define Z (zone()) - class CSEInstructionMap : public ValueObject { public: // Right now CSE and LICM track a single effect: possible externalization of @@ -71,7 +69,6 @@ class CSEInstructionMap : public ValueObject { Map dependent_; }; - // Place describes an abstract location (e.g. field) that IR can load // from or store to. // @@ -331,7 +328,6 @@ class Place : public ValueObject { RoundByteOffset(to, index_constant_)); } - intptr_t id() const { return id_; } Kind kind() const { return KindBits::decode(flags_); } @@ -583,7 +579,6 @@ class Place : public ValueObject { intptr_t id_; }; - class ZonePlace : public ZoneAllocated { public: explicit ZonePlace(const Place& place) : place_(place) {} @@ -594,14 +589,12 @@ class ZonePlace : public ZoneAllocated { Place place_; }; - Place* Place::Wrap(Zone* zone, const Place& place, intptr_t id) { Place* wrapped = (new (zone) ZonePlace(place))->place(); wrapped->id_ = id; return wrapped; } - // Correspondence between places connected through outgoing phi moves on the // edge that targets join. class PhiPlaceMoves : public ZoneAllocated { @@ -647,7 +640,6 @@ class PhiPlaceMoves : public ZoneAllocated { GrowableArray*> moves_; }; - // A map from aliases to a set of places sharing the alias. Additionally // carries a set of places that can be aliased by side-effects, essentially // those that are affected by calls. @@ -1136,7 +1128,6 @@ class AliasedSet : public ZoneAllocated { GrowableArray identity_rollback_; }; - static Definition* GetStoredValue(Instruction* instr) { if (instr->IsStoreIndexed()) { return instr->AsStoreIndexed()->value()->definition(); @@ -1156,14 +1147,12 @@ static Definition* GetStoredValue(Instruction* instr) { return NULL; } - static bool IsPhiDependentPlace(Place* place) { return ((place->kind() == Place::kField) || (place->kind() == Place::kVMField)) && (place->instance() != NULL) && place->instance()->IsPhi(); } - // For each place that depends on a phi ensure that equivalent places // corresponding to phi input are numbered and record outgoing phi moves // for each block which establish correspondence between phi dependent place @@ -1209,10 +1198,8 @@ static PhiPlaceMoves* ComputePhiMoves( return phi_moves; } - enum CSEMode { kOptimizeLoads, kOptimizeStores }; - static AliasedSet* NumberPlaces( FlowGraph* graph, DirectChainedHashMap >* map, @@ -1265,14 +1252,12 @@ static AliasedSet* NumberPlaces( return new (zone) AliasedSet(zone, map, places, phi_moves); } - // Load instructions handled by load elimination. static bool IsLoadEliminationCandidate(Instruction* instr) { return instr->IsLoadField() || instr->IsLoadIndexed() || instr->IsLoadStaticField(); } - static bool IsLoopInvariantLoad(ZoneGrowableArray* sets, intptr_t loop_header_index, Instruction* instr) { @@ -1281,12 +1266,10 @@ static bool IsLoopInvariantLoad(ZoneGrowableArray* sets, (*sets)[loop_header_index]->Contains(instr->place_id()); } - LICM::LICM(FlowGraph* flow_graph) : flow_graph_(flow_graph) { ASSERT(flow_graph->is_licm_allowed()); } - void LICM::Hoist(ForwardInstructionIterator* it, BlockEntryInstr* pre_header, Instruction* current) { @@ -1319,7 +1302,6 @@ void LICM::Hoist(ForwardInstructionIterator* it, current->CopyDeoptIdFrom(*last); } - void LICM::TrySpecializeSmiPhi(PhiInstr* phi, BlockEntryInstr* header, BlockEntryInstr* pre_header) { @@ -1369,7 +1351,6 @@ void LICM::TrySpecializeSmiPhi(PhiInstr* phi, phi->UpdateType(CompileType::FromCid(kSmiCid)); } - void LICM::OptimisticallySpecializeSmiPhis() { if (!flow_graph()->function().allows_hoisting_check_class() || FLAG_precompiled_mode) { @@ -1394,7 +1375,6 @@ void LICM::OptimisticallySpecializeSmiPhis() { } } - void LICM::Optimize() { if (!flow_graph()->function().allows_hoisting_check_class()) { // Do not hoist any. @@ -1443,7 +1423,6 @@ void LICM::Optimize() { } } - class LoadOptimizer : public ValueObject { public: LoadOptimizer(FlowGraph* graph, AliasedSet* aliased_set) @@ -1839,7 +1818,6 @@ class LoadOptimizer : public ValueObject { ZoneGrowableArray* block_out_values = out_values_[preorder_number]; - // If OUT set has changed then we have new values available out of // the block. Compute these values creating phi where necessary. for (BitVector::Iterator it(out_[preorder_number]); !it.Done(); @@ -2352,14 +2330,12 @@ class LoadOptimizer : public ValueObject { GrowableArray congruency_worklist_; BitVector* in_worklist_; - // True if any load was eliminated. bool forwarded_; DISALLOW_COPY_AND_ASSIGN(LoadOptimizer); }; - bool DominatorBasedCSE::Optimize(FlowGraph* graph) { bool changed = false; if (FLAG_load_cse) { @@ -2372,7 +2348,6 @@ bool DominatorBasedCSE::Optimize(FlowGraph* graph) { return changed; } - bool DominatorBasedCSE::OptimizeRecursive(FlowGraph* graph, BlockEntryInstr* block, CSEInstructionMap* map) { @@ -2419,7 +2394,6 @@ bool DominatorBasedCSE::OptimizeRecursive(FlowGraph* graph, return changed; } - class StoreOptimizer : public LivenessAnalysis { public: StoreOptimizer(FlowGraph* graph, @@ -2626,14 +2600,12 @@ class StoreOptimizer : public LivenessAnalysis { DISALLOW_COPY_AND_ASSIGN(StoreOptimizer); }; - void DeadStoreElimination::Optimize(FlowGraph* graph) { if (FLAG_dead_store_elimination) { StoreOptimizer::OptimizeGraph(graph); } } - enum SafeUseCheck { kOptimisticCheck, kStrictCheck }; // Check if the use is safe for allocation sinking. Allocation sinking @@ -2675,7 +2647,6 @@ static bool IsSafeUse(Value* use, SafeUseCheck check_type) { return false; } - // Right now we are attempting to sink allocation only into // deoptimization exit. So candidate should only be used in StoreInstanceField // instructions that write into fields of the allocated object. @@ -2696,7 +2667,6 @@ static bool IsAllocationSinkingCandidate(Definition* alloc, return true; } - // If the given use is a store into an object then return an object we are // storing into. static Definition* StoreInto(Value* use) { @@ -2708,7 +2678,6 @@ static Definition* StoreInto(Value* use) { return NULL; } - // Remove the given allocation from the graph. It is not observable. // If deoptimization occurs the object will be materialized. void AllocationSinking::EliminateAllocation(Definition* alloc) { @@ -2743,7 +2712,6 @@ void AllocationSinking::EliminateAllocation(Definition* alloc) { } } - // Find allocation instructions that can be potentially eliminated and // rematerialized at deoptimization exits if needed. See IsSafeUse // for the description of algorithm used below. @@ -2807,7 +2775,6 @@ void AllocationSinking::CollectCandidates() { candidates_.TruncateTo(j); } - // If materialization references an allocation sinking candidate then replace // this reference with a materialization which should have been computed for // this side-exit. CollectAllExits should have collected this exit. @@ -2825,7 +2792,6 @@ void AllocationSinking::NormalizeMaterializations() { } } - // We transitively insert materializations at each deoptimization exit that // might see the given allocation (see ExitsCollector). Some of this // materializations are not actually used and some fail to compute because @@ -2859,7 +2825,6 @@ void AllocationSinking::RemoveUnusedMaterializations() { materializations_.TruncateTo(j); } - // Some candidates might stop being eligible for allocation sinking after // the load forwarding because they flow into phis that load forwarding // inserts. Discover such allocations and remove them from the list @@ -2945,7 +2910,6 @@ void AllocationSinking::DiscoverFailedCandidates() { candidates_.TruncateTo(j); } - void AllocationSinking::Optimize() { CollectCandidates(); @@ -2998,7 +2962,6 @@ void AllocationSinking::Optimize() { } } - // Remove materializations from the graph. Register allocator will treat them // as part of the environment not as a real instruction. void AllocationSinking::DetachMaterializations() { @@ -3007,7 +2970,6 @@ void AllocationSinking::DetachMaterializations() { } } - // Add a field/offset to the list of fields if it is not yet present there. static bool AddSlot(ZoneGrowableArray* slots, const Object& slot) { @@ -3022,7 +2984,6 @@ static bool AddSlot(ZoneGrowableArray* slots, return true; } - // Find deoptimization exit for the given materialization assuming that all // materializations are emitted right before the instruction which is a // deoptimization exit. @@ -3033,7 +2994,6 @@ static Instruction* ExitForMaterialization(MaterializeObjectInstr* mat) { return mat->next(); } - // Given the deoptimization exit find first materialization that was inserted // before it. static Instruction* FirstMaterializationAt(Instruction* exit) { @@ -3043,7 +3003,6 @@ static Instruction* FirstMaterializationAt(Instruction* exit) { return exit; } - // Given the allocation and deoptimization exit try to find MaterializeObject // instruction corresponding to this allocation at this exit. MaterializeObjectInstr* AllocationSinking::MaterializationFor( @@ -3063,7 +3022,6 @@ MaterializeObjectInstr* AllocationSinking::MaterializationFor( return NULL; } - // Insert MaterializeObject instruction for the given allocation before // the given instruction that can deoptimize. void AllocationSinking::CreateMaterializationAt( @@ -3129,7 +3087,6 @@ void AllocationSinking::CreateMaterializationAt( materializations_.Add(mat); } - // Add given instruction to the list of the instructions if it is not yet // present there. template @@ -3143,7 +3100,6 @@ void AddInstruction(GrowableArray* list, T* value) { list->Add(value); } - // Transitively collect all deoptimization exits that might need this allocation // rematerialized. It is not enough to collect only environment uses of this // allocation because it can flow into other objects that will be @@ -3172,7 +3128,6 @@ void AllocationSinking::ExitsCollector::Collect(Definition* alloc) { } } - void AllocationSinking::ExitsCollector::CollectTransitively(Definition* alloc) { exits_.TruncateTo(0); worklist_.TruncateTo(0); @@ -3189,7 +3144,6 @@ void AllocationSinking::ExitsCollector::CollectTransitively(Definition* alloc) { } } - void AllocationSinking::InsertMaterializations(Definition* alloc) { // Collect all fields that are written for this instance. ZoneGrowableArray* slots = @@ -3224,7 +3178,6 @@ void AllocationSinking::InsertMaterializations(Definition* alloc) { } } - void TryCatchAnalyzer::Optimize(FlowGraph* flow_graph) { // For every catch-block: Iterate over all call instructions inside the // corresponding try-block and figure out for each environment value if it @@ -3297,7 +3250,6 @@ void TryCatchAnalyzer::Optimize(FlowGraph* flow_graph) { } } - // Returns true iff this definition is used in a non-phi instruction. static bool HasRealUse(Definition* def) { // Environment uses are real (non-phi) uses. @@ -3309,7 +3261,6 @@ static bool HasRealUse(Definition* def) { return false; } - void DeadCodeElimination::EliminateDeadPhis(FlowGraph* flow_graph) { GrowableArray live_phis; for (BlockIterator b = flow_graph->postorder_iterator(); !b.Done(); @@ -3382,5 +3333,4 @@ void DeadCodeElimination::EliminateDeadPhis(FlowGraph* flow_graph) { } } - } // namespace dart diff --git a/runtime/vm/redundancy_elimination.h b/runtime/vm/redundancy_elimination.h index d92ac49c024..b30ef7a918b 100644 --- a/runtime/vm/redundancy_elimination.h +++ b/runtime/vm/redundancy_elimination.h @@ -5,8 +5,8 @@ #ifndef RUNTIME_VM_REDUNDANCY_ELIMINATION_H_ #define RUNTIME_VM_REDUNDANCY_ELIMINATION_H_ -#include "vm/intermediate_language.h" #include "vm/flow_graph.h" +#include "vm/intermediate_language.h" namespace dart { @@ -79,7 +79,6 @@ class AllocationSinking : public ZoneAllocated { ExitsCollector exits_collector_; }; - // A simple common subexpression elimination based // on the dominator tree. class DominatorBasedCSE : public AllStatic { @@ -94,19 +93,16 @@ class DominatorBasedCSE : public AllStatic { CSEInstructionMap* map); }; - class DeadStoreElimination : public AllStatic { public: static void Optimize(FlowGraph* graph); }; - class DeadCodeElimination : public AllStatic { public: static void EliminateDeadPhis(FlowGraph* graph); }; - // Optimize spill stores inside try-blocks by identifying values that always // contain a single known constant at catch block entry. class TryCatchAnalyzer : public AllStatic { @@ -114,7 +110,6 @@ class TryCatchAnalyzer : public AllStatic { static void Optimize(FlowGraph* flow_graph); }; - // Loop invariant code motion. class LICM : public ValueObject { public: diff --git a/runtime/vm/regexp.cc b/runtime/vm/regexp.cc index 70af0315a4d..fbbc1b7ccbd 100644 --- a/runtime/vm/regexp.cc +++ b/runtime/vm/regexp.cc @@ -9,10 +9,10 @@ #include "vm/regexp_assembler_bytecode.h" #include "vm/regexp_assembler_ir.h" #include "vm/regexp_ast.h" -#include "vm/unibrow-inl.h" -#include "vm/unicode.h" #include "vm/symbols.h" #include "vm/thread.h" +#include "vm/unibrow-inl.h" +#include "vm/unicode.h" #define Z (zone()) @@ -196,38 +196,31 @@ ContainedInLattice AddRange(ContainedInLattice containment, // trace is not recorded in the node and so it cannot currently be reused in // the event that code generation is requested for an identical trace. - void RegExpTree::AppendToText(RegExpText* text) { UNREACHABLE(); } - void RegExpAtom::AppendToText(RegExpText* text) { text->AddElement(TextElement::Atom(this)); } - void RegExpCharacterClass::AppendToText(RegExpText* text) { text->AddElement(TextElement::CharClass(this)); } - void RegExpText::AppendToText(RegExpText* text) { for (intptr_t i = 0; i < elements()->length(); i++) text->AddElement((*elements())[i]); } - TextElement TextElement::Atom(RegExpAtom* atom) { return TextElement(ATOM, atom); } - TextElement TextElement::CharClass(RegExpCharacterClass* char_class) { return TextElement(CHAR_CLASS, char_class); } - intptr_t TextElement::length() const { switch (text_type()) { case ATOM: @@ -240,7 +233,6 @@ intptr_t TextElement::length() const { return 0; } - class FrequencyCollator : public ValueObject { public: FrequencyCollator() : total_samples_(0) { @@ -283,13 +275,11 @@ class FrequencyCollator : public ValueObject { DISALLOW_ALLOCATION(); }; - private: CharacterFrequency frequencies_[RegExpMacroAssembler::kTableSize]; intptr_t total_samples_; }; - class RegExpCompiler : public ValueObject { public: RegExpCompiler(intptr_t capture_count, bool ignore_case, bool is_one_byte); @@ -352,7 +342,6 @@ class RegExpCompiler : public ValueObject { Zone* zone_; }; - class RecursionCheck : public ValueObject { public: explicit RecursionCheck(RegExpCompiler* compiler) : compiler_(compiler) { @@ -364,12 +353,10 @@ class RecursionCheck : public ValueObject { RegExpCompiler* compiler_; }; - static RegExpEngine::CompilationResult IrregexpRegExpTooBig() { return RegExpEngine::CompilationResult("RegExp too big"); } - // Attempts to compile the regexp using an Irregexp code generator. Returns // a fixed array or a null handle depending on whether it succeeded. RegExpCompiler::RegExpCompiler(intptr_t capture_count, @@ -386,7 +373,6 @@ RegExpCompiler::RegExpCompiler(intptr_t capture_count, accept_ = new (Z) EndNode(EndNode::ACCEPT, Z); } - #if !defined(DART_PRECOMPILED_RUNTIME) RegExpEngine::CompilationResult RegExpCompiler::Assemble( IRRegExpMacroAssembler* macro_assembler, @@ -419,7 +405,6 @@ RegExpEngine::CompilationResult RegExpCompiler::Assemble( } #endif - RegExpEngine::CompilationResult RegExpCompiler::Assemble( BytecodeRegExpMacroAssembler* macro_assembler, RegExpNode* start, @@ -445,7 +430,6 @@ RegExpEngine::CompilationResult RegExpCompiler::Assemble( return RegExpEngine::CompilationResult(&bytecode, next_register_); } - bool Trace::DeferredAction::Mentions(intptr_t that) { if (action_type() == ActionNode::CLEAR_CAPTURES) { Interval range = static_cast(this)->range(); @@ -455,7 +439,6 @@ bool Trace::DeferredAction::Mentions(intptr_t that) { } } - bool Trace::mentions_reg(intptr_t reg) { for (DeferredAction* action = actions_; action != NULL; action = action->next()) { @@ -464,7 +447,6 @@ bool Trace::mentions_reg(intptr_t reg) { return false; } - bool Trace::GetStoredPosition(intptr_t reg, intptr_t* cp_offset) { ASSERT(*cp_offset == 0); for (DeferredAction* action = actions_; action != NULL; @@ -481,7 +463,6 @@ bool Trace::GetStoredPosition(intptr_t reg, intptr_t* cp_offset) { return false; } - // This is called as we come into a loop choice node and some other tricky // nodes. It normalizes the state of the code generator to ensure we can // generate generic code. @@ -502,7 +483,6 @@ intptr_t Trace::FindAffectedRegisters(OutSet* affected_registers, Zone* zone) { return max_register; } - void Trace::RestoreAffectedRegisters(RegExpMacroAssembler* assembler, intptr_t max_register, const OutSet& registers_to_pop, @@ -520,7 +500,6 @@ void Trace::RestoreAffectedRegisters(RegExpMacroAssembler* assembler, } } - void Trace::PerformDeferredActions(RegExpMacroAssembler* assembler, intptr_t max_register, const OutSet& affected_registers, @@ -635,7 +614,6 @@ void Trace::PerformDeferredActions(RegExpMacroAssembler* assembler, } } - // This is called as we come into a loop choice node and some other tricky // nodes. It normalizes the state of the code generator to ensure we can // generate generic code. @@ -692,7 +670,6 @@ void Trace::Flush(RegExpCompiler* compiler, RegExpNode* successor) { } } - void NegativeSubmatchSuccess::Emit(RegExpCompiler* compiler, Trace* trace) { RegExpMacroAssembler* assembler = compiler->macro_assembler(); @@ -719,7 +696,6 @@ void NegativeSubmatchSuccess::Emit(RegExpCompiler* compiler, Trace* trace) { assembler->Backtrack(); } - void EndNode::Emit(RegExpCompiler* compiler, Trace* trace) { if (!trace->is_trivial()) { trace->Flush(compiler, this); @@ -743,13 +719,11 @@ void EndNode::Emit(RegExpCompiler* compiler, Trace* trace) { UNIMPLEMENTED(); } - void GuardedAlternative::AddGuard(Guard* guard, Zone* zone) { if (guards_ == NULL) guards_ = new (zone) ZoneGrowableArray(1); guards_->Add(guard); } - ActionNode* ActionNode::SetRegister(intptr_t reg, intptr_t val, RegExpNode* on_success) { @@ -760,7 +734,6 @@ ActionNode* ActionNode::SetRegister(intptr_t reg, return result; } - ActionNode* ActionNode::IncrementRegister(intptr_t reg, RegExpNode* on_success) { ActionNode* result = @@ -769,7 +742,6 @@ ActionNode* ActionNode::IncrementRegister(intptr_t reg, return result; } - ActionNode* ActionNode::StorePosition(intptr_t reg, bool is_capture, RegExpNode* on_success) { @@ -780,7 +752,6 @@ ActionNode* ActionNode::StorePosition(intptr_t reg, return result; } - ActionNode* ActionNode::ClearCaptures(Interval range, RegExpNode* on_success) { ActionNode* result = new (on_success->zone()) ActionNode(CLEAR_CAPTURES, on_success); @@ -789,7 +760,6 @@ ActionNode* ActionNode::ClearCaptures(Interval range, RegExpNode* on_success) { return result; } - ActionNode* ActionNode::BeginSubmatch(intptr_t stack_reg, intptr_t position_reg, RegExpNode* on_success) { @@ -800,7 +770,6 @@ ActionNode* ActionNode::BeginSubmatch(intptr_t stack_reg, return result; } - ActionNode* ActionNode::PositiveSubmatchSuccess(intptr_t stack_reg, intptr_t position_reg, intptr_t clear_register_count, @@ -815,7 +784,6 @@ ActionNode* ActionNode::PositiveSubmatchSuccess(intptr_t stack_reg, return result; } - ActionNode* ActionNode::EmptyMatchCheck(intptr_t start_register, intptr_t repetition_register, intptr_t repetition_limit, @@ -828,22 +796,18 @@ ActionNode* ActionNode::EmptyMatchCheck(intptr_t start_register, return result; } - #define DEFINE_ACCEPT(Type) \ void Type##Node::Accept(NodeVisitor* visitor) { visitor->Visit##Type(this); } FOR_EACH_NODE_TYPE(DEFINE_ACCEPT) #undef DEFINE_ACCEPT - void LoopChoiceNode::Accept(NodeVisitor* visitor) { visitor->VisitLoopChoice(this); } - // ------------------------------------------------------------------- // Emit code. - void ChoiceNode::GenerateGuard(RegExpMacroAssembler* macro_assembler, Guard* guard, Trace* trace) { @@ -861,7 +825,6 @@ void ChoiceNode::GenerateGuard(RegExpMacroAssembler* macro_assembler, } } - // Returns the number of characters in the equivalence class, omitting those // that cannot occur in the source string because it is ASCII. static intptr_t GetCaseIndependentLetters(uint16_t character, @@ -886,7 +849,6 @@ static intptr_t GetCaseIndependentLetters(uint16_t character, return 0; } - static inline bool EmitSimpleCharacter(Zone* zone, RegExpCompiler* compiler, uint16_t c, @@ -904,7 +866,6 @@ static inline bool EmitSimpleCharacter(Zone* zone, return bound_checked; } - // Only emits non-letters (things that don't have case). Only used for case // independent matches. static inline bool EmitAtomNonLetter(Zone* zone, @@ -940,7 +901,6 @@ static inline bool EmitAtomNonLetter(Zone* zone, return checked; } - static bool ShortCutEmitCharacterPair(RegExpMacroAssembler* macro_assembler, bool one_byte, uint16_t c1, @@ -977,7 +937,6 @@ static bool ShortCutEmitCharacterPair(RegExpMacroAssembler* macro_assembler, return false; } - typedef bool EmitCharacterFunction(Zone* zone, RegExpCompiler* compiler, uint16_t c, @@ -1034,7 +993,6 @@ static inline bool EmitAtomLetter(Zone* zone, return true; } - static void EmitBoundaryTest(RegExpMacroAssembler* masm, intptr_t border, BlockLabel* fall_through, @@ -1048,7 +1006,6 @@ static void EmitBoundaryTest(RegExpMacroAssembler* masm, } } - static void EmitDoubleBoundaryTest(RegExpMacroAssembler* masm, intptr_t first, intptr_t last, @@ -1071,7 +1028,6 @@ static void EmitDoubleBoundaryTest(RegExpMacroAssembler* masm, } } - // even_label is for ranges[i] to ranges[i + 1] where i - start_index is even. // odd_label is for ranges[i] to ranges[i + 1] where i - start_index is odd. static void EmitUseLookupTable(RegExpMacroAssembler* masm, @@ -1131,7 +1087,6 @@ static void EmitUseLookupTable(RegExpMacroAssembler* masm, if (on_bit_clear != fall_through) masm->GoTo(on_bit_clear); } - static void CutOutRange(RegExpMacroAssembler* masm, ZoneGrowableArray* ranges, intptr_t start_index, @@ -1157,7 +1112,6 @@ static void CutOutRange(RegExpMacroAssembler* masm, } } - // Unicode case. Split the search space into kSize spaces that are handled // with recursion. static void SplitSearchSpace(ZoneGrowableArray* ranges, @@ -1223,7 +1177,6 @@ static void SplitSearchSpace(ZoneGrowableArray* ranges, } } - // Gets a series of segment boundaries representing a character class. If the // character is in the range between an even and an odd boundary (counting from // start_index) then go to even_label, otherwise go to odd_label. We already @@ -1344,7 +1297,6 @@ static void GenerateBranches(RegExpMacroAssembler* masm, } } - static void EmitCharClass(RegExpMacroAssembler* macro_assembler, RegExpCharacterClass* cc, bool one_byte, @@ -1410,13 +1362,11 @@ static void EmitCharClass(RegExpMacroAssembler* macro_assembler, macro_assembler->LoadCurrentCharacter(cp_offset, on_failure, check_offset); } - if (cc->is_standard() && - macro_assembler->CheckSpecialCharacterClass(cc->standard_type(), - on_failure)) { + if (cc->is_standard() && macro_assembler->CheckSpecialCharacterClass( + cc->standard_type(), on_failure)) { return; } - // A new list with ascending entries. Each entry is a code unit // where there is a boundary between code units that are part of // the class and code units that are not. Normally we insert an @@ -1454,10 +1404,8 @@ static void EmitCharClass(RegExpMacroAssembler* macro_assembler, macro_assembler->BindBlock(&fall_through); } - RegExpNode::~RegExpNode() {} - RegExpNode::LimitResult RegExpNode::LimitVersions(RegExpCompiler* compiler, Trace* trace) { // If we are generating a greedy loop then don't stop and don't reuse code. @@ -1500,7 +1448,6 @@ RegExpNode::LimitResult RegExpNode::LimitVersions(RegExpCompiler* compiler, return DONE; } - intptr_t ActionNode::EatsAtLeast(intptr_t still_to_find, intptr_t budget, bool not_at_start) { @@ -1509,7 +1456,6 @@ intptr_t ActionNode::EatsAtLeast(intptr_t still_to_find, return on_success()->EatsAtLeast(still_to_find, budget - 1, not_at_start); } - void ActionNode::FillInBMInfo(intptr_t offset, intptr_t budget, BoyerMooreLookahead* bm, @@ -1522,7 +1468,6 @@ void ActionNode::FillInBMInfo(intptr_t offset, SaveBMInfo(bm, not_at_start, offset); } - intptr_t AssertionNode::EatsAtLeast(intptr_t still_to_find, intptr_t budget, bool not_at_start) { @@ -1536,7 +1481,6 @@ intptr_t AssertionNode::EatsAtLeast(intptr_t still_to_find, return on_success()->EatsAtLeast(still_to_find, budget - 1, not_at_start); } - void AssertionNode::FillInBMInfo(intptr_t offset, intptr_t budget, BoyerMooreLookahead* bm, @@ -1547,7 +1491,6 @@ void AssertionNode::FillInBMInfo(intptr_t offset, SaveBMInfo(bm, not_at_start, offset); } - intptr_t BackReferenceNode::EatsAtLeast(intptr_t still_to_find, intptr_t budget, bool not_at_start) { @@ -1555,7 +1498,6 @@ intptr_t BackReferenceNode::EatsAtLeast(intptr_t still_to_find, return on_success()->EatsAtLeast(still_to_find, budget - 1, not_at_start); } - intptr_t TextNode::EatsAtLeast(intptr_t still_to_find, intptr_t budget, bool not_at_start) { @@ -1567,7 +1509,6 @@ intptr_t TextNode::EatsAtLeast(intptr_t still_to_find, on_success()->EatsAtLeast(still_to_find - answer, budget - 1, true); } - intptr_t NegativeLookaheadChoiceNode::EatsAtLeast(intptr_t still_to_find, intptr_t budget, bool not_at_start) { @@ -1578,7 +1519,6 @@ intptr_t NegativeLookaheadChoiceNode::EatsAtLeast(intptr_t still_to_find, return node->EatsAtLeast(still_to_find, budget - 1, not_at_start); } - void NegativeLookaheadChoiceNode::GetQuickCheckDetails( QuickCheckDetails* details, RegExpCompiler* compiler, @@ -1590,7 +1530,6 @@ void NegativeLookaheadChoiceNode::GetQuickCheckDetails( return node->GetQuickCheckDetails(details, compiler, filled_in, not_at_start); } - intptr_t ChoiceNode::EatsAtLeastHelper(intptr_t still_to_find, intptr_t budget, RegExpNode* ignore_this_node, @@ -1610,21 +1549,18 @@ intptr_t ChoiceNode::EatsAtLeastHelper(intptr_t still_to_find, return min; } - intptr_t LoopChoiceNode::EatsAtLeast(intptr_t still_to_find, intptr_t budget, bool not_at_start) { return EatsAtLeastHelper(still_to_find, budget - 1, loop_node_, not_at_start); } - intptr_t ChoiceNode::EatsAtLeast(intptr_t still_to_find, intptr_t budget, bool not_at_start) { return EatsAtLeastHelper(still_to_find, budget, NULL, not_at_start); } - // Takes the left-most 1-bit and smears it out, setting all bits to its right. static inline uint32_t SmearBitsRight(uint32_t v) { v |= v >> 1; @@ -1635,7 +1571,6 @@ static inline uint32_t SmearBitsRight(uint32_t v) { return v; } - bool QuickCheckDetails::Rationalize(bool asc) { bool found_useful_op = false; uint32_t char_mask; @@ -1659,7 +1594,6 @@ bool QuickCheckDetails::Rationalize(bool asc) { return found_useful_op; } - bool RegExpNode::EmitQuickCheck(RegExpCompiler* compiler, Trace* bounds_check_trace, Trace* trace, @@ -1690,7 +1624,6 @@ bool RegExpNode::EmitQuickCheck(RegExpCompiler* compiler, !preload_has_checked_bounds, details->characters()); } - bool need_mask = true; if (details->characters() == 1) { @@ -1732,7 +1665,6 @@ bool RegExpNode::EmitQuickCheck(RegExpCompiler* compiler, return true; } - // Here is the meat of GetQuickCheckDetails (see also the comment on the // super-class in the .h file). // @@ -1896,7 +1828,6 @@ void TextNode::GetQuickCheckDetails(QuickCheckDetails* details, } } - void QuickCheckDetails::Clear() { for (int i = 0; i < characters_; i++) { positions_[i].mask = 0; @@ -1906,7 +1837,6 @@ void QuickCheckDetails::Clear() { characters_ = 0; } - void QuickCheckDetails::Advance(intptr_t by, bool one_byte) { ASSERT(by >= 0); if (by >= characters_) { @@ -1927,7 +1857,6 @@ void QuickCheckDetails::Advance(intptr_t by, bool one_byte) { // it would gain us nothing. So there's no point. } - void QuickCheckDetails::Merge(QuickCheckDetails* other, intptr_t from_index) { ASSERT(characters_ == other->characters_); if (other->cannot_match_) { @@ -1955,7 +1884,6 @@ void QuickCheckDetails::Merge(QuickCheckDetails* other, intptr_t from_index) { } } - class VisitMarker : public ValueObject { public: explicit VisitMarker(NodeInfo* info) : info_(info) { @@ -1968,7 +1896,6 @@ class VisitMarker : public ValueObject { NodeInfo* info_; }; - RegExpNode* SeqRegExpNode::FilterOneByte(intptr_t depth, bool ignore_case) { if (info()->replacement_calculated) return replacement(); if (depth < 0) return this; @@ -1977,7 +1904,6 @@ RegExpNode* SeqRegExpNode::FilterOneByte(intptr_t depth, bool ignore_case) { return FilterSuccessor(depth - 1, ignore_case); } - RegExpNode* SeqRegExpNode::FilterSuccessor(intptr_t depth, bool ignore_case) { RegExpNode* next = on_success_->FilterOneByte(depth - 1, ignore_case); if (next == NULL) return set_replacement(NULL); @@ -1985,7 +1911,6 @@ RegExpNode* SeqRegExpNode::FilterSuccessor(intptr_t depth, bool ignore_case) { return set_replacement(this); } - // We need to check for the following characters: 0x39c 0x3bc 0x178. static inline bool RangeContainsLatin1Equivalents(CharacterRange range) { // TODO(dcarney): this could be a lot more efficient. @@ -1993,7 +1918,6 @@ static inline bool RangeContainsLatin1Equivalents(CharacterRange range) { range.Contains(0x178); } - static bool RangesContainLatin1Equivalents( ZoneGrowableArray* ranges) { for (intptr_t i = 0; i < ranges->length(); i++) { @@ -2003,7 +1927,6 @@ static bool RangesContainLatin1Equivalents( return false; } - static uint16_t ConvertNonLatin1ToLatin1(uint16_t c) { ASSERT(c > Symbols::kMaxOneCharCodeSymbol); switch (c) { @@ -2019,7 +1942,6 @@ static uint16_t ConvertNonLatin1ToLatin1(uint16_t c) { return 0; } - RegExpNode* TextNode::FilterOneByte(intptr_t depth, bool ignore_case) { if (info()->replacement_calculated) return replacement(); if (depth < 0) return this; @@ -2071,7 +1993,6 @@ RegExpNode* TextNode::FilterOneByte(intptr_t depth, bool ignore_case) { return FilterSuccessor(depth - 1, ignore_case); } - RegExpNode* LoopChoiceNode::FilterOneByte(intptr_t depth, bool ignore_case) { if (info()->replacement_calculated) return replacement(); if (depth < 0) return this; @@ -2089,7 +2010,6 @@ RegExpNode* LoopChoiceNode::FilterOneByte(intptr_t depth, bool ignore_case) { return ChoiceNode::FilterOneByte(depth - 1, ignore_case); } - RegExpNode* ChoiceNode::FilterOneByte(intptr_t depth, bool ignore_case) { if (info()->replacement_calculated) return replacement(); if (depth < 0) return this; @@ -2140,7 +2060,6 @@ RegExpNode* ChoiceNode::FilterOneByte(intptr_t depth, bool ignore_case) { return this; } - RegExpNode* NegativeLookaheadChoiceNode::FilterOneByte(intptr_t depth, bool ignore_case) { if (info()->replacement_calculated) return replacement(); @@ -2163,7 +2082,6 @@ RegExpNode* NegativeLookaheadChoiceNode::FilterOneByte(intptr_t depth, return set_replacement(this); } - void LoopChoiceNode::GetQuickCheckDetails(QuickCheckDetails* details, RegExpCompiler* compiler, intptr_t characters_filled_in, @@ -2174,7 +2092,6 @@ void LoopChoiceNode::GetQuickCheckDetails(QuickCheckDetails* details, characters_filled_in, not_at_start); } - void LoopChoiceNode::FillInBMInfo(intptr_t offset, intptr_t budget, BoyerMooreLookahead* bm, @@ -2188,7 +2105,6 @@ void LoopChoiceNode::FillInBMInfo(intptr_t offset, SaveBMInfo(bm, not_at_start, offset); } - void ChoiceNode::GetQuickCheckDetails(QuickCheckDetails* details, RegExpCompiler* compiler, intptr_t characters_filled_in, @@ -2208,7 +2124,6 @@ void ChoiceNode::GetQuickCheckDetails(QuickCheckDetails* details, } } - // Check for [0-9A-Z_a-z]. static void EmitWordCheck(RegExpMacroAssembler* assembler, BlockLabel* word, @@ -2233,7 +2148,6 @@ static void EmitWordCheck(RegExpMacroAssembler* assembler, } } - // Emit the code to check for a ^ in multiline mode (1-character lookbehind // that matches newline or the start of input). static void EmitHat(RegExpCompiler* compiler, @@ -2267,7 +2181,6 @@ static void EmitHat(RegExpCompiler* compiler, on_success->Emit(compiler, &new_trace); } - // Emit the code to handle \b and \B (word-boundary or non-word-boundary). void AssertionNode::EmitBoundaryCheck(RegExpCompiler* compiler, Trace* trace) { RegExpMacroAssembler* assembler = compiler->macro_assembler(); @@ -2322,7 +2235,6 @@ void AssertionNode::EmitBoundaryCheck(RegExpCompiler* compiler, Trace* trace) { } } - void AssertionNode::BacktrackIfPrevious( RegExpCompiler* compiler, Trace* trace, @@ -2354,7 +2266,6 @@ void AssertionNode::BacktrackIfPrevious( on_success()->Emit(compiler, &new_trace); } - void AssertionNode::GetQuickCheckDetails(QuickCheckDetails* details, RegExpCompiler* compiler, intptr_t filled_in, @@ -2367,7 +2278,6 @@ void AssertionNode::GetQuickCheckDetails(QuickCheckDetails* details, not_at_start); } - void AssertionNode::Emit(RegExpCompiler* compiler, Trace* trace) { RegExpMacroAssembler* assembler = compiler->macro_assembler(); switch (assertion_type_) { @@ -2403,21 +2313,18 @@ void AssertionNode::Emit(RegExpCompiler* compiler, Trace* trace) { on_success()->Emit(compiler, trace); } - static bool DeterminedAlready(QuickCheckDetails* quick_check, intptr_t offset) { if (quick_check == NULL) return false; if (offset >= quick_check->characters()) return false; return quick_check->positions(offset)->determines_perfectly; } - static void UpdateBoundsCheck(intptr_t index, intptr_t* checked_up_to) { if (index > *checked_up_to) { *checked_up_to = index; } } - // We call this repeatedly to generate code for each pass over the text node. // The passes are in increasing order of difficulty because we hope one // of the first passes will fail in which case we are saved the work of the @@ -2508,14 +2415,12 @@ void TextNode::TextEmitPass(RegExpCompiler* compiler, } } - intptr_t TextNode::Length() { TextElement elm = elms_->Last(); ASSERT(elm.cp_offset() >= 0); return elm.cp_offset() + elm.length(); } - bool TextNode::SkipPass(intptr_t intptr_t_pass, bool ignore_case) { TextEmitPassType pass = static_cast(intptr_t_pass); if (ignore_case) { @@ -2525,7 +2430,6 @@ bool TextNode::SkipPass(intptr_t intptr_t_pass, bool ignore_case) { } } - // This generates the code to match a text node. A text node can contain // straight character sequences (possibly to be matched in a case-independent // way) and character classes. For efficiency we do not do this in a single @@ -2577,12 +2481,10 @@ void TextNode::Emit(RegExpCompiler* compiler, Trace* trace) { on_success()->Emit(compiler, &successor_trace); } - void Trace::InvalidateCurrentCharacter() { characters_preloaded_ = 0; } - void Trace::AdvanceCurrentPositionInTrace(intptr_t by, RegExpCompiler* compiler) { ASSERT(by > 0); @@ -2603,7 +2505,6 @@ void Trace::AdvanceCurrentPositionInTrace(intptr_t by, Utils::Maximum(static_cast(0), bound_checked_up_to_ - by); } - void TextNode::MakeCaseIndependent(bool is_one_byte) { intptr_t element_count = elms_->length(); for (intptr_t i = 0; i < element_count; i++) { @@ -2622,13 +2523,11 @@ void TextNode::MakeCaseIndependent(bool is_one_byte) { } } - intptr_t TextNode::GreedyLoopTextLength() { TextElement elm = elms_->At(elms_->length() - 1); return elm.cp_offset() + elm.length(); } - RegExpNode* TextNode::GetSuccessorOfOmnivorousTextNode( RegExpCompiler* compiler) { if (elms_->length() != 1) return NULL; @@ -2652,7 +2551,6 @@ RegExpNode* TextNode::GetSuccessorOfOmnivorousTextNode( return ranges->At(0).IsEverything(max_char) ? on_success() : NULL; } - // Finds the fixed match length of a sequence of nodes that goes from // this alternative and back to this choice node. If there are variable // length nodes or other complications in the way then return a sentinel @@ -2679,21 +2577,18 @@ intptr_t ChoiceNode::GreedyLoopTextLengthForAlternative( return length; } - void LoopChoiceNode::AddLoopAlternative(GuardedAlternative alt) { ASSERT(loop_node_ == NULL); AddAlternative(alt); loop_node_ = alt.node(); } - void LoopChoiceNode::AddContinueAlternative(GuardedAlternative alt) { ASSERT(continue_node_ == NULL); AddAlternative(alt); continue_node_ = alt.node(); } - void LoopChoiceNode::Emit(RegExpCompiler* compiler, Trace* trace) { RegExpMacroAssembler* macro_assembler = compiler->macro_assembler(); if (trace->stop_node() == this) { @@ -2716,7 +2611,6 @@ void LoopChoiceNode::Emit(RegExpCompiler* compiler, Trace* trace) { ChoiceNode::Emit(compiler, trace); } - intptr_t ChoiceNode::CalculatePreloadCharacters(RegExpCompiler* compiler, intptr_t eats_at_least) { intptr_t preload_characters = @@ -2738,7 +2632,6 @@ intptr_t ChoiceNode::CalculatePreloadCharacters(RegExpCompiler* compiler, return preload_characters; } - // This structure is used when generating the alternatives in a choice node. It // records the way the alternative is being code generated. struct AlternativeGeneration { @@ -2753,7 +2646,6 @@ struct AlternativeGeneration { QuickCheckDetails quick_check_details; }; - // Creates a list of AlternativeGenerations. If the list has a reasonable // size then it is on the stack, otherwise the excess is on the heap. class AlternativeGenerationList { @@ -2783,7 +2675,6 @@ class AlternativeGenerationList { DISALLOW_ALLOCATION(); }; - // The '2' variant is inclusive from and exclusive to. // This covers \s as defined in ECMA-262 5.1, 15.10.2.12, // which include WhiteSpace (7.2) or LineTerminator (7.3) values. @@ -2804,12 +2695,10 @@ static const intptr_t kLineTerminatorRanges[] = {0x000A, 0x000B, 0x000D, 0x000E, static const intptr_t kLineTerminatorRangeCount = ARRAY_SIZE(kLineTerminatorRanges); - void BoyerMoorePositionInfo::Set(intptr_t character) { SetInterval(Interval(character, character)); } - void BoyerMoorePositionInfo::SetInterval(const Interval& interval) { s_ = AddRange(s_, kSpaceRanges, kSpaceRangeCount, interval); w_ = AddRange(w_, kWordRanges, kWordRangeCount, interval); @@ -2834,7 +2723,6 @@ void BoyerMoorePositionInfo::SetInterval(const Interval& interval) { } } - void BoyerMoorePositionInfo::SetAll() { s_ = w_ = d_ = kLatticeUnknown; if (map_count_ != kMapSize) { @@ -2844,7 +2732,6 @@ void BoyerMoorePositionInfo::SetAll() { } } - BoyerMooreLookahead::BoyerMooreLookahead(intptr_t length, RegExpCompiler* compiler, Zone* zone) @@ -2860,7 +2747,6 @@ BoyerMooreLookahead::BoyerMooreLookahead(intptr_t length, } } - // Find the longest range of lookahead that has the fewest number of different // characters that can occur at a given position. Since we are optimizing two // different parameters at once this is a tradeoff. @@ -2878,7 +2764,6 @@ bool BoyerMooreLookahead::FindWorthwhileInterval(intptr_t* from, intptr_t* to) { return true; } - // Find the highest-points range between 0 and length_ where the character // information is not too vague. 'Too vague' means that there are more than // max_number_of_chars that can occur at this position. Calculates the number @@ -2938,7 +2823,6 @@ intptr_t BoyerMooreLookahead::FindBestInterval(intptr_t max_number_of_chars, return biggest_points; } - // Take all the characters that will not prevent a successful match if they // occur in the subject string in the range between min_lookahead and // max_lookahead (inclusive) measured from the current position. If the @@ -2970,7 +2854,6 @@ intptr_t BoyerMooreLookahead::GetSkipTable( return skip; } - // See comment above on the implementation of GetSkipTable. void BoyerMooreLookahead::EmitSkipInstructions(RegExpMacroAssembler* masm) { const intptr_t kSize = RegExpMacroAssembler::kTableSize; @@ -3041,7 +2924,6 @@ void BoyerMooreLookahead::EmitSkipInstructions(RegExpMacroAssembler* masm) { return; } - /* Code generation for choice nodes. * * We generate quick checks that do a mask and compare to eliminate a @@ -3121,7 +3003,6 @@ GreedyLoopState::GreedyLoopState(bool not_at_start) { if (not_at_start) counter_backtrack_trace_.set_at_start(false); } - void ChoiceNode::AssertGuardsMentionRegisters(Trace* trace) { #ifdef DEBUG intptr_t choice_count = alternatives_->length(); @@ -3136,7 +3017,6 @@ void ChoiceNode::AssertGuardsMentionRegisters(Trace* trace) { #endif } - void ChoiceNode::SetUpPreLoad(RegExpCompiler* compiler, Trace* current_trace, PreloadState* state) { @@ -3154,7 +3034,6 @@ void ChoiceNode::SetUpPreLoad(RegExpCompiler* compiler, state->preload_has_checked_bounds_ = state->preload_is_current_; } - void ChoiceNode::Emit(RegExpCompiler* compiler, Trace* trace) { intptr_t choice_count = alternatives_->length(); @@ -3260,7 +3139,6 @@ Trace* ChoiceNode::EmitGreedyLoop(RegExpCompiler* compiler, return new_trace; } - intptr_t ChoiceNode::EmitOptimizedUnanchoredSearch(RegExpCompiler* compiler, Trace* trace) { intptr_t eats_at_least = PreloadState::kEatsAtLeastNotYetInitialized; @@ -3308,7 +3186,6 @@ intptr_t ChoiceNode::EmitOptimizedUnanchoredSearch(RegExpCompiler* compiler, return eats_at_least; } - void ChoiceNode::EmitChoices(RegExpCompiler* compiler, AlternativeGenerationList* alt_gens, intptr_t first_choice, @@ -3393,7 +3270,6 @@ void ChoiceNode::EmitChoices(RegExpCompiler* compiler, } } - void ChoiceNode::EmitOutOfLineContinuation(RegExpCompiler* compiler, Trace* trace, GuardedAlternative alternative, @@ -3433,7 +3309,6 @@ void ChoiceNode::EmitOutOfLineContinuation(RegExpCompiler* compiler, } } - void ActionNode::Emit(RegExpCompiler* compiler, Trace* trace) { RegExpMacroAssembler* assembler = compiler->macro_assembler(); LimitResult limit_result = LimitVersions(compiler, trace); @@ -3554,7 +3429,6 @@ void ActionNode::Emit(RegExpCompiler* compiler, Trace* trace) { } } - void BackReferenceNode::Emit(RegExpCompiler* compiler, Trace* trace) { RegExpMacroAssembler* assembler = compiler->macro_assembler(); if (!trace->is_trivial()) { @@ -3577,14 +3451,11 @@ void BackReferenceNode::Emit(RegExpCompiler* compiler, Trace* trace) { on_success()->Emit(compiler, trace); } - // ------------------------------------------------------------------- // Dot/dotty output - #ifdef DEBUG - class DotPrinter : public NodeVisitor { public: explicit DotPrinter(bool ignore_case) {} @@ -3597,7 +3468,6 @@ class DotPrinter : public NodeVisitor { #undef DECLARE_VISIT }; - void DotPrinter::PrintNode(const char* label, RegExpNode* node) { OS::Print("digraph G {\n graph [label=\""); for (intptr_t i = 0; label[i]; i++) { @@ -3618,20 +3488,17 @@ void DotPrinter::PrintNode(const char* label, RegExpNode* node) { OS::Print("}\n"); } - void DotPrinter::Visit(RegExpNode* node) { if (node->info()->visited) return; node->info()->visited = true; node->Accept(this); } - void DotPrinter::PrintOnFailure(RegExpNode* from, RegExpNode* on_failure) { OS::Print(" n%p -> n%p [style=dotted];\n", from, on_failure); Visit(on_failure); } - class AttributePrinter : public ValueObject { public: AttributePrinter() : first_(true) {} @@ -3657,7 +3524,6 @@ class AttributePrinter : public ValueObject { bool first_; }; - void DotPrinter::PrintAttributes(RegExpNode* that) { OS::Print( " a%p [shape=Mrecord, color=grey, fontcolor=grey, " @@ -3676,7 +3542,6 @@ void DotPrinter::PrintAttributes(RegExpNode* that) { that, that); } - void DotPrinter::VisitChoice(ChoiceNode* that) { OS::Print(" n%p [shape=Mrecord, label=\"?\"];\n", that); for (intptr_t i = 0; i < that->alternatives()->length(); i++) { @@ -3689,7 +3554,6 @@ void DotPrinter::VisitChoice(ChoiceNode* that) { } } - void DotPrinter::VisitText(TextNode* that) { OS::Print(" n%p [label=\"", that); for (intptr_t i = 0; i < that->elements()->length(); i++) { @@ -3726,7 +3590,6 @@ void DotPrinter::VisitText(TextNode* that) { Visit(that->on_success()); } - void DotPrinter::VisitBackReference(BackReferenceNode* that) { OS::Print(" n%p [label=\"$%" Pd "..$%" Pd "\", shape=doubleoctagon];\n", that, that->start_register(), that->end_register()); @@ -3735,13 +3598,11 @@ void DotPrinter::VisitBackReference(BackReferenceNode* that) { Visit(that->on_success()); } - void DotPrinter::VisitEnd(EndNode* that) { OS::Print(" n%p [style=bold, shape=point];\n", that); PrintAttributes(that); } - void DotPrinter::VisitAssertion(AssertionNode* that) { OS::Print(" n%p [", that); switch (that->assertion_type()) { @@ -3768,7 +3629,6 @@ void DotPrinter::VisitAssertion(AssertionNode* that) { Visit(successor); } - void DotPrinter::VisitAction(ActionNode* that) { OS::Print(" n%p [", that); switch (that->action_type_) { @@ -3812,7 +3672,6 @@ void DotPrinter::VisitAction(ActionNode* that) { Visit(successor); } - void RegExpEngine::DotPrint(const char* label, RegExpNode* node, bool ignore_case) { @@ -3820,10 +3679,8 @@ void RegExpEngine::DotPrint(const char* label, printer.PrintNode(label, node); } - #endif // DEBUG - // ------------------------------------------------------------------- // Tree to graph conversion @@ -3838,7 +3695,6 @@ RegExpNode* RegExpAtom::ToNode(RegExpCompiler* compiler, return new (OZ) TextNode(elms, on_success); } - RegExpNode* RegExpText::ToNode(RegExpCompiler* compiler, RegExpNode* on_success) { ZoneGrowableArray* elms = @@ -3849,7 +3705,6 @@ RegExpNode* RegExpText::ToNode(RegExpCompiler* compiler, return new (OZ) TextNode(elms, on_success); } - static bool CompareInverseRanges(ZoneGrowableArray* ranges, const intptr_t* special_class, intptr_t length) { @@ -3880,7 +3735,6 @@ static bool CompareInverseRanges(ZoneGrowableArray* ranges, return true; } - static bool CompareRanges(ZoneGrowableArray* ranges, const intptr_t* special_class, intptr_t length) { @@ -3899,7 +3753,6 @@ static bool CompareRanges(ZoneGrowableArray* ranges, return true; } - bool RegExpCharacterClass::is_standard() { // TODO(lrn): Remove need for this function, by not throwing away information // along the way. @@ -3938,13 +3791,11 @@ bool RegExpCharacterClass::is_standard() { return false; } - RegExpNode* RegExpCharacterClass::ToNode(RegExpCompiler* compiler, RegExpNode* on_success) { return new (OZ) TextNode(this, on_success); } - RegExpNode* RegExpDisjunction::ToNode(RegExpCompiler* compiler, RegExpNode* on_success) { ZoneGrowableArray* alternatives = this->alternatives(); @@ -3958,13 +3809,11 @@ RegExpNode* RegExpDisjunction::ToNode(RegExpCompiler* compiler, return result; } - RegExpNode* RegExpQuantifier::ToNode(RegExpCompiler* compiler, RegExpNode* on_success) { return ToNode(min(), max(), is_greedy(), body(), compiler, on_success); } - // Scoped object to keep track of how much we unroll quantifier loops in the // regexp graph generator. class RegExpExpansionLimiter : public ValueObject { @@ -4002,7 +3851,6 @@ class RegExpExpansionLimiter : public ValueObject { DISALLOW_IMPLICIT_CONSTRUCTORS(RegExpExpansionLimiter); }; - RegExpNode* RegExpQuantifier::ToNode(intptr_t min, intptr_t max, bool is_greedy, @@ -4139,7 +3987,6 @@ RegExpNode* RegExpQuantifier::ToNode(intptr_t min, } } - RegExpNode* RegExpAssertion::ToNode(RegExpCompiler* compiler, RegExpNode* on_success) { switch (assertion_type()) { @@ -4188,7 +4035,6 @@ RegExpNode* RegExpAssertion::ToNode(RegExpCompiler* compiler, return on_success; } - RegExpNode* RegExpBackReference::ToNode(RegExpCompiler* compiler, RegExpNode* on_success) { return new (OZ) @@ -4196,13 +4042,11 @@ RegExpNode* RegExpBackReference::ToNode(RegExpCompiler* compiler, RegExpCapture::EndRegister(index()), on_success); } - RegExpNode* RegExpEmpty::ToNode(RegExpCompiler* compiler, RegExpNode* on_success) { return on_success; } - RegExpNode* RegExpLookahead::ToNode(RegExpCompiler* compiler, RegExpNode* on_success) { intptr_t stack_pointer_register = compiler->AllocateRegister(); @@ -4246,13 +4090,11 @@ RegExpNode* RegExpLookahead::ToNode(RegExpCompiler* compiler, } } - RegExpNode* RegExpCapture::ToNode(RegExpCompiler* compiler, RegExpNode* on_success) { return ToNode(body(), index(), compiler, on_success); } - RegExpNode* RegExpCapture::ToNode(RegExpTree* body, intptr_t index, RegExpCompiler* compiler, @@ -4264,7 +4106,6 @@ RegExpNode* RegExpCapture::ToNode(RegExpTree* body, return ActionNode::StorePosition(start_reg, true, body_node); } - RegExpNode* RegExpAlternative::ToNode(RegExpCompiler* compiler, RegExpNode* on_success) { ZoneGrowableArray* children = nodes(); @@ -4275,7 +4116,6 @@ RegExpNode* RegExpAlternative::ToNode(RegExpCompiler* compiler, return current; } - static void AddClass(const intptr_t* elmv, intptr_t elmc, ZoneGrowableArray* ranges) { @@ -4287,7 +4127,6 @@ static void AddClass(const intptr_t* elmv, } } - static void AddClassNegated(const intptr_t* elmv, intptr_t elmc, ZoneGrowableArray* ranges) { @@ -4305,7 +4144,6 @@ static void AddClassNegated(const intptr_t* elmv, ranges->Add(CharacterRange(last, Utf16::kMaxCodeUnit)); } - void CharacterRange::AddClassEscape(uint16_t type, ZoneGrowableArray* ranges) { switch (type) { @@ -4346,7 +4184,6 @@ void CharacterRange::AddClassEscape(uint16_t type, } } - void CharacterRange::AddCaseEquivalents( ZoneGrowableArray* ranges, bool is_one_byte, @@ -4418,7 +4255,6 @@ void CharacterRange::AddCaseEquivalents( } } - bool CharacterRange::IsCanonical(ZoneGrowableArray* ranges) { ASSERT(ranges != NULL); intptr_t n = ranges->length(); @@ -4432,7 +4268,6 @@ bool CharacterRange::IsCanonical(ZoneGrowableArray* ranges) { return true; } - ZoneGrowableArray* CharacterSet::ranges() { if (ranges_ == NULL) { ranges_ = new ZoneGrowableArray(2); @@ -4441,7 +4276,6 @@ ZoneGrowableArray* CharacterSet::ranges() { return ranges_; } - // Move a number of elements in a zone array to another position // in the same array. Handles overlapping source and target areas. static void MoveRanges(ZoneGrowableArray* list, @@ -4460,7 +4294,6 @@ static void MoveRanges(ZoneGrowableArray* list, } } - static intptr_t InsertRangeInCanonicalList( ZoneGrowableArray* list, intptr_t count, @@ -4519,7 +4352,6 @@ static intptr_t InsertRangeInCanonicalList( return count - (end_pos - start_pos) + 1; } - void CharacterSet::Canonicalize() { // Special/default classes are always considered canonical. The result // of calling ranges() will be sorted. @@ -4527,7 +4359,6 @@ void CharacterSet::Canonicalize() { CharacterRange::Canonicalize(ranges_); } - void CharacterRange::Canonicalize( ZoneGrowableArray* character_ranges) { if (character_ranges->length() <= 1) return; @@ -4564,7 +4395,6 @@ void CharacterRange::Canonicalize( ASSERT(CharacterRange::IsCanonical(character_ranges)); } - void CharacterRange::Negate(ZoneGrowableArray* ranges, ZoneGrowableArray* negated_ranges) { ASSERT(CharacterRange::IsCanonical(ranges)); @@ -4587,11 +4417,9 @@ void CharacterRange::Negate(ZoneGrowableArray* ranges, } } - // ------------------------------------------------------------------- // Splay tree - // Workaround for the fact that ZoneGrowableArray does not have contains(). static bool ArrayContains(ZoneGrowableArray* array, unsigned value) { for (intptr_t i = 0; i < array->length(); i++) { @@ -4602,7 +4430,6 @@ static bool ArrayContains(ZoneGrowableArray* array, unsigned value) { return false; } - void OutSet::Set(unsigned value, Zone* zone) { if (value < kFirstLimit) { first_ |= (1 << value); @@ -4617,7 +4444,6 @@ void OutSet::Set(unsigned value, Zone* zone) { } } - bool OutSet::Get(unsigned value) const { if (value < kFirstLimit) { return (first_ & (1 << value)) != 0; @@ -4628,11 +4454,9 @@ bool OutSet::Get(unsigned value) const { } } - // ------------------------------------------------------------------- // Analysis - void Analysis::EnsureAnalyzed(RegExpNode* that) { if (that->info()->been_analyzed || that->info()->being_analyzed) return; that->info()->being_analyzed = true; @@ -4641,12 +4465,10 @@ void Analysis::EnsureAnalyzed(RegExpNode* that) { that->info()->been_analyzed = true; } - void Analysis::VisitEnd(EndNode* that) { // nothing to do } - void TextNode::CalculateOffsets() { intptr_t element_count = elements()->length(); // Set up the offsets of the elements relative to the start. This is a fixed @@ -4659,7 +4481,6 @@ void TextNode::CalculateOffsets() { } } - void Analysis::VisitText(TextNode* that) { if (ignore_case_) { that->MakeCaseIndependent(is_one_byte_); @@ -4670,7 +4491,6 @@ void Analysis::VisitText(TextNode* that) { } } - void Analysis::VisitAction(ActionNode* that) { RegExpNode* target = that->on_success(); EnsureAnalyzed(target); @@ -4681,7 +4501,6 @@ void Analysis::VisitAction(ActionNode* that) { } } - void Analysis::VisitChoice(ChoiceNode* that) { NodeInfo* info = that->info(); for (intptr_t i = 0; i < that->alternatives()->length(); i++) { @@ -4694,7 +4513,6 @@ void Analysis::VisitChoice(ChoiceNode* that) { } } - void Analysis::VisitLoopChoice(LoopChoiceNode* that) { NodeInfo* info = that->info(); for (intptr_t i = 0; i < that->alternatives()->length(); i++) { @@ -4713,17 +4531,14 @@ void Analysis::VisitLoopChoice(LoopChoiceNode* that) { } } - void Analysis::VisitBackReference(BackReferenceNode* that) { EnsureAnalyzed(that->on_success()); } - void Analysis::VisitAssertion(AssertionNode* that) { EnsureAnalyzed(that->on_success()); } - void BackReferenceNode::FillInBMInfo(intptr_t offset, intptr_t budget, BoyerMooreLookahead* bm, @@ -4734,11 +4549,9 @@ void BackReferenceNode::FillInBMInfo(intptr_t offset, SaveBMInfo(bm, not_at_start, offset); } - COMPILE_ASSERT(BoyerMoorePositionInfo::kMapSize == RegExpMacroAssembler::kTableSize); - void ChoiceNode::FillInBMInfo(intptr_t offset, intptr_t budget, BoyerMooreLookahead* bm, @@ -4757,7 +4570,6 @@ void ChoiceNode::FillInBMInfo(intptr_t offset, SaveBMInfo(bm, not_at_start, offset); } - void TextNode::FillInBMInfo(intptr_t initial_offset, intptr_t budget, BoyerMooreLookahead* bm, @@ -4818,7 +4630,6 @@ void TextNode::FillInBMInfo(intptr_t initial_offset, if (initial_offset == 0) set_bm_info(not_at_start, bm); } - #if !defined(DART_PRECOMPILED_RUNTIME) RegExpEngine::CompilationResult RegExpEngine::CompileIR( RegExpCompileData* data, @@ -4930,7 +4741,6 @@ RegExpEngine::CompilationResult RegExpEngine::CompileIR( } #endif // !defined(DART_PRECOMPILED_RUNTIME) - RegExpEngine::CompilationResult RegExpEngine::CompileBytecode( RegExpCompileData* data, const RegExp& regexp, @@ -5033,7 +4843,6 @@ RegExpEngine::CompilationResult RegExpEngine::CompileBytecode( return result; } - static void CreateSpecializedFunction(Thread* thread, Zone* zone, const RegExp& regexp, @@ -5081,7 +4890,6 @@ static void CreateSpecializedFunction(Thread* thread, // The function is compiled lazily during the first call. } - RawRegExp* RegExpEngine::CreateRegExp(Thread* thread, const String& pattern, bool multi_line, @@ -5120,5 +4928,4 @@ RawRegExp* RegExpEngine::CreateRegExp(Thread* thread, return regexp.raw(); } - } // namespace dart diff --git a/runtime/vm/regexp.h b/runtime/vm/regexp.h index 8d49edeb210..2577aa933b3 100644 --- a/runtime/vm/regexp.h +++ b/runtime/vm/regexp.h @@ -6,8 +6,8 @@ #define RUNTIME_VM_REGEXP_H_ #include "vm/assembler.h" -#include "vm/intermediate_language.h" #include "vm/flow_graph_compiler.h" +#include "vm/intermediate_language.h" #include "vm/object.h" #include "vm/regexp_assembler.h" @@ -20,7 +20,6 @@ class RegExpNode; class RegExpTree; class BoyerMooreLookahead; - // Represents code units in the range from from_ to to_, both ends are // inclusive. class CharacterRange { @@ -78,7 +77,6 @@ class CharacterRange { DISALLOW_ALLOCATION(); }; - // A set of unsigned integers that behaves especially well on small // integers (< 32). May do zone-allocation. class OutSet : public ZoneAllocated { @@ -107,7 +105,6 @@ class OutSet : public ZoneAllocated { friend class Trace; }; - #define FOR_EACH_NODE_TYPE(VISIT) \ VISIT(End) \ VISIT(Action) \ @@ -116,7 +113,6 @@ class OutSet : public ZoneAllocated { VISIT(Assertion) \ VISIT(Text) - #define FOR_EACH_REG_EXP_TREE_TYPE(VISIT) \ VISIT(Disjunction) \ VISIT(Alternative) \ @@ -130,12 +126,10 @@ class OutSet : public ZoneAllocated { VISIT(Empty) \ VISIT(Text) - #define FORWARD_DECLARE(Name) class RegExp##Name; FOR_EACH_REG_EXP_TREE_TYPE(FORWARD_DECLARE) #undef FORWARD_DECLARE - class TextElement { public: enum TextType { ATOM, CHAR_CLASS }; @@ -172,7 +166,6 @@ class TextElement { DISALLOW_ALLOCATION(); }; - class Trace; struct PreloadState; class GreedyLoopState; @@ -239,7 +232,6 @@ struct NodeInfo { bool replacement_calculated : 1; }; - // Details of a quick mask-compare check that can look ahead in the // input stream. class QuickCheckDetails { @@ -287,7 +279,6 @@ class QuickCheckDetails { DISALLOW_ALLOCATION(); }; - class RegExpNode : public ZoneAllocated { public: explicit RegExpNode(Zone* zone) @@ -415,7 +406,6 @@ class RegExpNode : public ZoneAllocated { Zone* zone_; }; - // A simple closed interval. class Interval { public: @@ -447,7 +437,6 @@ class Interval { DISALLOW_ALLOCATION(); }; - class SeqRegExpNode : public RegExpNode { public: explicit SeqRegExpNode(RegExpNode* on_success) @@ -470,7 +459,6 @@ class SeqRegExpNode : public RegExpNode { RegExpNode* on_success_; }; - class ActionNode : public SeqRegExpNode { public: enum ActionType { @@ -559,7 +547,6 @@ class ActionNode : public SeqRegExpNode { friend class DotPrinter; }; - class TextNode : public SeqRegExpNode { public: TextNode(ZoneGrowableArray* elms, RegExpNode* on_success) @@ -611,7 +598,6 @@ class TextNode : public SeqRegExpNode { ZoneGrowableArray* elms_; }; - class AssertionNode : public SeqRegExpNode { public: enum AssertionType { @@ -662,7 +648,6 @@ class AssertionNode : public SeqRegExpNode { AssertionType assertion_type_; }; - class BackReferenceNode : public SeqRegExpNode { public: BackReferenceNode(intptr_t start_reg, @@ -692,7 +677,6 @@ class BackReferenceNode : public SeqRegExpNode { intptr_t end_reg_; }; - class EndNode : public RegExpNode { public: enum Action { ACCEPT, BACKTRACK, NEGATIVE_SUBMATCH_SUCCESS }; @@ -724,7 +708,6 @@ class EndNode : public RegExpNode { Action action_; }; - class NegativeSubmatchSuccess : public EndNode { public: NegativeSubmatchSuccess(intptr_t stack_pointer_reg, @@ -746,7 +729,6 @@ class NegativeSubmatchSuccess : public EndNode { intptr_t clear_capture_start_; }; - class Guard : public ZoneAllocated { public: enum Relation { LT, GEQ }; @@ -762,7 +744,6 @@ class Guard : public ZoneAllocated { intptr_t value_; }; - class GuardedAlternative { public: explicit GuardedAlternative(RegExpNode* node) : node_(node), guards_(NULL) {} @@ -778,10 +759,8 @@ class GuardedAlternative { DISALLOW_ALLOCATION(); }; - struct AlternativeGeneration; - class ChoiceNode : public RegExpNode { public: explicit ChoiceNode(intptr_t expected_size, Zone* zone) @@ -861,7 +840,6 @@ class ChoiceNode : public RegExpNode { bool being_calculated_; }; - class NegativeLookaheadChoiceNode : public ChoiceNode { public: explicit NegativeLookaheadChoiceNode(GuardedAlternative this_must_fail, @@ -897,7 +875,6 @@ class NegativeLookaheadChoiceNode : public ChoiceNode { virtual RegExpNode* FilterOneByte(intptr_t depth, bool ignore_case); }; - class LoopChoiceNode : public ChoiceNode { public: explicit LoopChoiceNode(bool body_can_be_zero_length, Zone* zone) @@ -938,7 +915,6 @@ class LoopChoiceNode : public ChoiceNode { bool body_can_be_zero_length_; }; - // Improve the speed that we scan for an initial point where a non-anchored // regexp can match by using a Boyer-Moore-like table. This is done by // identifying non-greedy non-capturing loops in the nodes that eat any @@ -971,18 +947,15 @@ enum ContainedInLattice { kLatticeUnknown = 3 // Can also mean both in and out. }; - inline ContainedInLattice Combine(ContainedInLattice a, ContainedInLattice b) { return static_cast(a | b); } - ContainedInLattice AddRange(ContainedInLattice a, const intptr_t* ranges, intptr_t ranges_size, Interval new_range); - class BoyerMoorePositionInfo : public ZoneAllocated { public: explicit BoyerMoorePositionInfo(Zone* zone) @@ -1019,7 +992,6 @@ class BoyerMoorePositionInfo : public ZoneAllocated { ContainedInLattice surrogate_; // Surrogate UTF-16 code units. }; - class BoyerMooreLookahead : public ZoneAllocated { public: BoyerMooreLookahead(intptr_t length, RegExpCompiler* compiler, Zone* Zone); @@ -1079,7 +1051,6 @@ class BoyerMooreLookahead : public ZoneAllocated { intptr_t* to); }; - // There are many ways to generate code for a node. This class encapsulates // the current way we should be generating. In other words it encapsulates // the current state of the code generator. The effect of this is that we @@ -1252,7 +1223,6 @@ class Trace { DISALLOW_ALLOCATION(); }; - class GreedyLoopState { public: explicit GreedyLoopState(bool not_at_start); @@ -1265,7 +1235,6 @@ class GreedyLoopState { Trace counter_backtrack_trace_; }; - struct PreloadState { static const intptr_t kEatsAtLeastNotYetInitialized = -1; bool preload_is_current_; @@ -1277,7 +1246,6 @@ struct PreloadState { DISALLOW_ALLOCATION(); }; - class NodeVisitor : public ValueObject { public: virtual ~NodeVisitor() {} @@ -1287,7 +1255,6 @@ class NodeVisitor : public ValueObject { virtual void VisitLoopChoice(LoopChoiceNode* that) { VisitChoice(that); } }; - // Assertion propagation moves information about assertions such as // \b to the affected nodes. For instance, in /.\b./ information must // be propagated to the first '.' that whatever follows needs to know @@ -1328,7 +1295,6 @@ class Analysis : public NodeVisitor { DISALLOW_IMPLICIT_CONSTRUCTORS(Analysis); }; - struct RegExpCompileData : public ZoneAllocated { RegExpCompileData() : tree(NULL), @@ -1345,7 +1311,6 @@ struct RegExpCompileData : public ZoneAllocated { intptr_t capture_count; }; - class RegExpEngine : public AllStatic { public: struct CompilationResult { diff --git a/runtime/vm/regexp_assembler.cc b/runtime/vm/regexp_assembler.cc index e6d0f7a0297..f2570c543fb 100644 --- a/runtime/vm/regexp_assembler.cc +++ b/runtime/vm/regexp_assembler.cc @@ -66,11 +66,9 @@ BlockLabel::BlockLabel() #endif } - RegExpMacroAssembler::RegExpMacroAssembler(Zone* zone) : slow_safe_compiler_(false), global_mode_(NOT_GLOBAL), zone_(zone) {} - RegExpMacroAssembler::~RegExpMacroAssembler() {} } // namespace dart diff --git a/runtime/vm/regexp_assembler.h b/runtime/vm/regexp_assembler.h index f4a2eb5d2f4..4ca94235a10 100644 --- a/runtime/vm/regexp_assembler.h +++ b/runtime/vm/regexp_assembler.h @@ -14,7 +14,6 @@ namespace dart { // Utility function for the DotPrinter void PrintUtf16(uint16_t c); - /// Convenience wrapper around a BlockEntryInstr pointer. class BlockLabel : public ValueObject { // Used by the IR assembler. @@ -76,7 +75,6 @@ class BlockLabel : public ValueObject { intptr_t pos_; }; - class RegExpMacroAssembler : public ZoneAllocated { public: // The implementation must be able to handle at least: diff --git a/runtime/vm/regexp_assembler_bytecode.cc b/runtime/vm/regexp_assembler_bytecode.cc index 4f31fcfbbe4..01a52599e0f 100644 --- a/runtime/vm/regexp_assembler_bytecode.cc +++ b/runtime/vm/regexp_assembler_bytecode.cc @@ -4,14 +4,14 @@ #include "vm/regexp_assembler_bytecode.h" -#include "vm/regexp_assembler_bytecode_inl.h" #include "vm/exceptions.h" #include "vm/object_store.h" -#include "vm/regexp_bytecodes.h" -#include "vm/regexp_assembler.h" #include "vm/regexp.h" -#include "vm/regexp_parser.h" +#include "vm/regexp_assembler.h" +#include "vm/regexp_assembler_bytecode_inl.h" +#include "vm/regexp_bytecodes.h" #include "vm/regexp_interpreter.h" +#include "vm/regexp_parser.h" #include "vm/timeline.h" namespace dart { @@ -24,18 +24,15 @@ BytecodeRegExpMacroAssembler::BytecodeRegExpMacroAssembler( pc_(0), advance_current_end_(kInvalidPC) {} - BytecodeRegExpMacroAssembler::~BytecodeRegExpMacroAssembler() { if (backtrack_.is_linked()) backtrack_.Unuse(); } - BytecodeRegExpMacroAssembler::IrregexpImplementation BytecodeRegExpMacroAssembler::Implementation() { return kBytecodeImplementation; } - void BytecodeRegExpMacroAssembler::BindBlock(BlockLabel* l) { advance_current_end_ = kInvalidPC; ASSERT(!l->is_bound()); @@ -50,7 +47,6 @@ void BytecodeRegExpMacroAssembler::BindBlock(BlockLabel* l) { l->bind_to(pc_); } - void BytecodeRegExpMacroAssembler::EmitOrLink(BlockLabel* l) { if (l == NULL) l = &backtrack_; if (l->is_bound()) { @@ -65,21 +61,18 @@ void BytecodeRegExpMacroAssembler::EmitOrLink(BlockLabel* l) { } } - void BytecodeRegExpMacroAssembler::PopRegister(intptr_t register_index) { ASSERT(register_index >= 0); ASSERT(register_index <= kMaxRegister); Emit(BC_POP_REGISTER, register_index); } - void BytecodeRegExpMacroAssembler::PushRegister(intptr_t register_index) { ASSERT(register_index >= 0); ASSERT(register_index <= kMaxRegister); Emit(BC_PUSH_REGISTER, register_index); } - void BytecodeRegExpMacroAssembler::WriteCurrentPositionToRegister( intptr_t register_index, intptr_t cp_offset) { @@ -89,7 +82,6 @@ void BytecodeRegExpMacroAssembler::WriteCurrentPositionToRegister( Emit32(cp_offset); // Current position offset. } - void BytecodeRegExpMacroAssembler::ClearRegisters(intptr_t reg_from, intptr_t reg_to) { ASSERT(reg_from <= reg_to); @@ -98,7 +90,6 @@ void BytecodeRegExpMacroAssembler::ClearRegisters(intptr_t reg_from, } } - void BytecodeRegExpMacroAssembler::ReadCurrentPositionFromRegister( intptr_t register_index) { ASSERT(register_index >= 0); @@ -106,7 +97,6 @@ void BytecodeRegExpMacroAssembler::ReadCurrentPositionFromRegister( Emit(BC_SET_CP_TO_REGISTER, register_index); } - void BytecodeRegExpMacroAssembler::WriteStackPointerToRegister( intptr_t register_index) { ASSERT(register_index >= 0); @@ -114,7 +104,6 @@ void BytecodeRegExpMacroAssembler::WriteStackPointerToRegister( Emit(BC_SET_REGISTER_TO_SP, register_index); } - void BytecodeRegExpMacroAssembler::ReadStackPointerFromRegister( intptr_t register_index) { ASSERT(register_index >= 0); @@ -122,13 +111,11 @@ void BytecodeRegExpMacroAssembler::ReadStackPointerFromRegister( Emit(BC_SET_SP_TO_REGISTER, register_index); } - void BytecodeRegExpMacroAssembler::SetCurrentPositionFromEnd(intptr_t by) { ASSERT(Utils::IsUint(24, by)); Emit(BC_SET_CURRENT_POSITION_FROM_END, by); } - void BytecodeRegExpMacroAssembler::SetRegister(intptr_t register_index, intptr_t to) { ASSERT(register_index >= 0); @@ -137,7 +124,6 @@ void BytecodeRegExpMacroAssembler::SetRegister(intptr_t register_index, Emit32(to); } - void BytecodeRegExpMacroAssembler::AdvanceRegister(intptr_t register_index, intptr_t by) { ASSERT(register_index >= 0); @@ -146,22 +132,18 @@ void BytecodeRegExpMacroAssembler::AdvanceRegister(intptr_t register_index, Emit32(by); } - void BytecodeRegExpMacroAssembler::PopCurrentPosition() { Emit(BC_POP_CP, 0); } - void BytecodeRegExpMacroAssembler::PushCurrentPosition() { Emit(BC_PUSH_CP, 0); } - void BytecodeRegExpMacroAssembler::Backtrack() { Emit(BC_POP_BT, 0); } - void BytecodeRegExpMacroAssembler::GoTo(BlockLabel* l) { if (advance_current_end_ == pc_) { // Combine advance current and goto. @@ -176,24 +158,20 @@ void BytecodeRegExpMacroAssembler::GoTo(BlockLabel* l) { } } - void BytecodeRegExpMacroAssembler::PushBacktrack(BlockLabel* l) { Emit(BC_PUSH_BT, 0); EmitOrLink(l); } - bool BytecodeRegExpMacroAssembler::Succeed() { Emit(BC_SUCCEED, 0); return false; // Restart matching for global regexp not supported. } - void BytecodeRegExpMacroAssembler::Fail() { Emit(BC_FAIL, 0); } - void BytecodeRegExpMacroAssembler::AdvanceCurrentPosition(intptr_t by) { ASSERT(by >= kMinCPOffset); ASSERT(by <= kMaxCPOffset); @@ -203,14 +181,12 @@ void BytecodeRegExpMacroAssembler::AdvanceCurrentPosition(intptr_t by) { advance_current_end_ = pc_; } - void BytecodeRegExpMacroAssembler::CheckGreedyLoop( BlockLabel* on_tos_equals_current_position) { Emit(BC_CHECK_GREEDY, 0); EmitOrLink(on_tos_equals_current_position); } - void BytecodeRegExpMacroAssembler::LoadCurrentCharacter(intptr_t cp_offset, BlockLabel* on_failure, bool check_bounds, @@ -241,21 +217,18 @@ void BytecodeRegExpMacroAssembler::LoadCurrentCharacter(intptr_t cp_offset, if (check_bounds) EmitOrLink(on_failure); } - void BytecodeRegExpMacroAssembler::CheckCharacterLT(uint16_t limit, BlockLabel* on_less) { Emit(BC_CHECK_LT, limit); EmitOrLink(on_less); } - void BytecodeRegExpMacroAssembler::CheckCharacterGT(uint16_t limit, BlockLabel* on_greater) { Emit(BC_CHECK_GT, limit); EmitOrLink(on_greater); } - void BytecodeRegExpMacroAssembler::CheckCharacter(uint32_t c, BlockLabel* on_equal) { if (c > MAX_FIRST_ARG) { @@ -267,20 +240,17 @@ void BytecodeRegExpMacroAssembler::CheckCharacter(uint32_t c, EmitOrLink(on_equal); } - void BytecodeRegExpMacroAssembler::CheckAtStart(BlockLabel* on_at_start) { Emit(BC_CHECK_AT_START, 0); EmitOrLink(on_at_start); } - void BytecodeRegExpMacroAssembler::CheckNotAtStart( BlockLabel* on_not_at_start) { Emit(BC_CHECK_NOT_AT_START, 0); EmitOrLink(on_not_at_start); } - void BytecodeRegExpMacroAssembler::CheckNotCharacter(uint32_t c, BlockLabel* on_not_equal) { if (c > MAX_FIRST_ARG) { @@ -292,7 +262,6 @@ void BytecodeRegExpMacroAssembler::CheckNotCharacter(uint32_t c, EmitOrLink(on_not_equal); } - void BytecodeRegExpMacroAssembler::CheckCharacterAfterAnd( uint32_t c, uint32_t mask, @@ -307,7 +276,6 @@ void BytecodeRegExpMacroAssembler::CheckCharacterAfterAnd( EmitOrLink(on_equal); } - void BytecodeRegExpMacroAssembler::CheckNotCharacterAfterAnd( uint32_t c, uint32_t mask, @@ -322,7 +290,6 @@ void BytecodeRegExpMacroAssembler::CheckNotCharacterAfterAnd( EmitOrLink(on_not_equal); } - void BytecodeRegExpMacroAssembler::CheckNotCharacterAfterMinusAnd( uint16_t c, uint16_t minus, @@ -334,7 +301,6 @@ void BytecodeRegExpMacroAssembler::CheckNotCharacterAfterMinusAnd( EmitOrLink(on_not_equal); } - void BytecodeRegExpMacroAssembler::CheckCharacterInRange( uint16_t from, uint16_t to, @@ -345,7 +311,6 @@ void BytecodeRegExpMacroAssembler::CheckCharacterInRange( EmitOrLink(on_in_range); } - void BytecodeRegExpMacroAssembler::CheckCharacterNotInRange( uint16_t from, uint16_t to, @@ -356,7 +321,6 @@ void BytecodeRegExpMacroAssembler::CheckCharacterNotInRange( EmitOrLink(on_not_in_range); } - void BytecodeRegExpMacroAssembler::CheckBitInTable(const TypedData& table, BlockLabel* on_bit_set) { Emit(BC_CHECK_BIT_IN_TABLE, 0); @@ -370,7 +334,6 @@ void BytecodeRegExpMacroAssembler::CheckBitInTable(const TypedData& table, } } - void BytecodeRegExpMacroAssembler::CheckNotBackReference( intptr_t start_reg, BlockLabel* on_not_equal) { @@ -380,7 +343,6 @@ void BytecodeRegExpMacroAssembler::CheckNotBackReference( EmitOrLink(on_not_equal); } - void BytecodeRegExpMacroAssembler::CheckNotBackReferenceIgnoreCase( intptr_t start_reg, BlockLabel* on_not_equal) { @@ -390,7 +352,6 @@ void BytecodeRegExpMacroAssembler::CheckNotBackReferenceIgnoreCase( EmitOrLink(on_not_equal); } - void BytecodeRegExpMacroAssembler::IfRegisterLT(intptr_t register_index, intptr_t comparand, BlockLabel* on_less_than) { @@ -401,7 +362,6 @@ void BytecodeRegExpMacroAssembler::IfRegisterLT(intptr_t register_index, EmitOrLink(on_less_than); } - void BytecodeRegExpMacroAssembler::IfRegisterGE( intptr_t register_index, intptr_t comparand, @@ -413,7 +373,6 @@ void BytecodeRegExpMacroAssembler::IfRegisterGE( EmitOrLink(on_greater_or_equal); } - void BytecodeRegExpMacroAssembler::IfRegisterEqPos(intptr_t register_index, BlockLabel* on_eq) { ASSERT(register_index >= 0); @@ -422,7 +381,6 @@ void BytecodeRegExpMacroAssembler::IfRegisterEqPos(intptr_t register_index, EmitOrLink(on_eq); } - RawTypedData* BytecodeRegExpMacroAssembler::GetBytecode() { BindBlock(&backtrack_); Emit(BC_POP_BT, 0); @@ -437,12 +395,10 @@ RawTypedData* BytecodeRegExpMacroAssembler::GetBytecode() { return bytecode.raw(); } - intptr_t BytecodeRegExpMacroAssembler::length() { return pc_; } - void BytecodeRegExpMacroAssembler::Expand() { // BOGUS buffer_->Add(0); @@ -454,7 +410,6 @@ void BytecodeRegExpMacroAssembler::Expand() { buffer_->Add(0); } - static intptr_t Prepare(const RegExp& regexp, const String& subject, bool sticky, @@ -502,7 +457,6 @@ static intptr_t Prepare(const RegExp& regexp, (Smi::Value(regexp.num_bracket_expressions()) + 1) * 2; } - static IrregexpInterpreter::IrregexpResult ExecRaw(const RegExp& regexp, const String& subject, intptr_t index, @@ -549,7 +503,6 @@ static IrregexpInterpreter::IrregexpResult ExecRaw(const RegExp& regexp, return result; } - RawInstance* BytecodeRegExpMacroAssembler::Interpret(const RegExp& regexp, const String& subject, const Smi& start_index, @@ -599,5 +552,4 @@ RawInstance* BytecodeRegExpMacroAssembler::Interpret(const RegExp& regexp, return Instance::null(); } - } // namespace dart diff --git a/runtime/vm/regexp_assembler_bytecode.h b/runtime/vm/regexp_assembler_bytecode.h index df9e46fa2c4..81e8d3d9878 100644 --- a/runtime/vm/regexp_assembler_bytecode.h +++ b/runtime/vm/regexp_assembler_bytecode.h @@ -138,7 +138,6 @@ class BytecodeRegExpMacroAssembler : public RegExpMacroAssembler { DISALLOW_IMPLICIT_CONSTRUCTORS(BytecodeRegExpMacroAssembler); }; - } // namespace dart #endif // RUNTIME_VM_REGEXP_ASSEMBLER_BYTECODE_H_ diff --git a/runtime/vm/regexp_assembler_bytecode_inl.h b/runtime/vm/regexp_assembler_bytecode_inl.h index d2fe4769288..76e1dc16a5e 100644 --- a/runtime/vm/regexp_assembler_bytecode_inl.h +++ b/runtime/vm/regexp_assembler_bytecode_inl.h @@ -22,7 +22,6 @@ void BytecodeRegExpMacroAssembler::Emit(uint32_t byte, pc_ += 4; } - void BytecodeRegExpMacroAssembler::Emit16(uint32_t word) { ASSERT(pc_ <= buffer_->length()); if (pc_ + 1 >= buffer_->length()) { @@ -32,7 +31,6 @@ void BytecodeRegExpMacroAssembler::Emit16(uint32_t word) { pc_ += 2; } - void BytecodeRegExpMacroAssembler::Emit8(uint32_t word) { ASSERT(pc_ <= buffer_->length()); if (pc_ == buffer_->length()) { @@ -42,7 +40,6 @@ void BytecodeRegExpMacroAssembler::Emit8(uint32_t word) { pc_ += 1; } - void BytecodeRegExpMacroAssembler::Emit32(uint32_t word) { ASSERT(pc_ <= buffer_->length()); if (pc_ + 3 >= buffer_->length()) { diff --git a/runtime/vm/regexp_assembler_ir.cc b/runtime/vm/regexp_assembler_ir.cc index 3098c649d80..2d4832910c5 100644 --- a/runtime/vm/regexp_assembler_ir.cc +++ b/runtime/vm/regexp_assembler_ir.cc @@ -40,7 +40,6 @@ namespace dart { static const intptr_t kInvalidTryIndex = CatchClauseNode::kInvalidTryIndex; static const intptr_t kMinStackSize = 512; - /* * This assembler uses the following main local variables: * - stack_: A pointer to a growable list which we use as an all-purpose stack @@ -142,10 +141,8 @@ IRRegExpMacroAssembler::IRRegExpMacroAssembler( set_current_instruction(start_block_); } - IRRegExpMacroAssembler::~IRRegExpMacroAssembler() {} - void IRRegExpMacroAssembler::InitializeLocals() { // All generated functions are expected to have a current-context variable. // This variable is unused in irregexp functions. @@ -173,7 +170,6 @@ void IRRegExpMacroAssembler::InitializeLocals() { RegExpMacroAssembler::kParamStartOffsetIndex); } - void IRRegExpMacroAssembler::GenerateEntryBlock() { set_current_instruction(entry_block_->normal_entry()); TAG(); @@ -211,7 +207,6 @@ void IRRegExpMacroAssembler::GenerateEntryBlock() { current_instruction_->Goto(start_block_); } - void IRRegExpMacroAssembler::GenerateBacktrackBlock() { set_current_instruction(backtrack_block_); TAG(); @@ -240,7 +235,6 @@ void IRRegExpMacroAssembler::GenerateBacktrackBlock() { } } - void IRRegExpMacroAssembler::GenerateSuccessBlock() { set_current_instruction(success_block_); TAG(); @@ -276,7 +270,6 @@ void IRRegExpMacroAssembler::GenerateSuccessBlock() { TokenPosition::kNoSource, Bind(LoadLocal(result_)), GetNextDeoptId())); } - void IRRegExpMacroAssembler::GenerateExitBlock() { set_current_instruction(exit_block_); TAG(); @@ -286,14 +279,12 @@ void IRRegExpMacroAssembler::GenerateExitBlock() { TokenPosition::kNoSource, Bind(LoadLocal(result_)), GetNextDeoptId())); } - void IRRegExpMacroAssembler::FinalizeRegistersArray() { ASSERT(registers_count_ >= saved_registers_count_); registers_array_ = TypedData::New(kTypedDataInt32ArrayCid, registers_count_, Heap::kOld); } - #if defined(TARGET_ARCH_ARM64) || defined(TARGET_ARCH_ARM) // Disabling unaligned accesses forces the regexp engine to load characters one // by one instead of up to 4 at once, along with the associated performance hit. @@ -308,7 +299,6 @@ bool IRRegExpMacroAssembler::CanReadUnaligned() { return kEnableUnalignedAccesses && !slow_safe(); } - RawArray* IRRegExpMacroAssembler::Execute(const RegExp& regexp, const String& input, const Smi& start_offset, @@ -343,7 +333,6 @@ RawArray* IRRegExpMacroAssembler::Execute(const RegExp& regexp, return Array::Cast(retval).raw(); } - LocalVariable* IRRegExpMacroAssembler::Parameter(const String& name, intptr_t index) const { LocalVariable* local = @@ -356,7 +345,6 @@ LocalVariable* IRRegExpMacroAssembler::Parameter(const String& name, return local; } - LocalVariable* IRRegExpMacroAssembler::Local(const String& name) { LocalVariable* local = new (Z) LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource, @@ -366,30 +354,25 @@ LocalVariable* IRRegExpMacroAssembler::Local(const String& name) { return local; } - ConstantInstr* IRRegExpMacroAssembler::Int64Constant(int64_t value) const { return new (Z) ConstantInstr(Integer::ZoneHandle(Z, Integer::New(value, Heap::kOld))); } - ConstantInstr* IRRegExpMacroAssembler::Uint64Constant(uint64_t value) const { return new (Z) ConstantInstr( Integer::ZoneHandle(Z, Integer::NewFromUint64(value, Heap::kOld))); } - ConstantInstr* IRRegExpMacroAssembler::BoolConstant(bool value) const { return new (Z) ConstantInstr(value ? Bool::True() : Bool::False()); } - ConstantInstr* IRRegExpMacroAssembler::StringConstant(const char* value) const { return new (Z) ConstantInstr(String::ZoneHandle(Z, String::New(value, Heap::kOld))); } - ConstantInstr* IRRegExpMacroAssembler::WordCharacterMapConstant() const { const Library& lib = Library::Handle(Z, Library::CoreLibrary()); const Class& regexp_class = @@ -409,7 +392,6 @@ ConstantInstr* IRRegExpMacroAssembler::WordCharacterMapConstant() const { Instance::ZoneHandle(Z, word_character_field.StaticValue())); } - ComparisonInstr* IRRegExpMacroAssembler::Comparison(ComparisonKind kind, PushArgumentInstr* lhs, PushArgumentInstr* rhs) { @@ -458,7 +440,6 @@ ComparisonInstr* IRRegExpMacroAssembler::Comparison(ComparisonKind kind, return Comparison(kind, lhs_push, rhs_push); } - StaticCallInstr* IRRegExpMacroAssembler::StaticCall( const Function& function) const { ZoneGrowableArray* arguments = @@ -466,7 +447,6 @@ StaticCallInstr* IRRegExpMacroAssembler::StaticCall( return StaticCall(function, arguments); } - StaticCallInstr* IRRegExpMacroAssembler::StaticCall( const Function& function, PushArgumentInstr* arg1) const { @@ -477,7 +457,6 @@ StaticCallInstr* IRRegExpMacroAssembler::StaticCall( return StaticCall(function, arguments); } - StaticCallInstr* IRRegExpMacroAssembler::StaticCall( const Function& function, PushArgumentInstr* arg1, @@ -490,7 +469,6 @@ StaticCallInstr* IRRegExpMacroAssembler::StaticCall( return StaticCall(function, arguments); } - StaticCallInstr* IRRegExpMacroAssembler::StaticCall( const Function& function, ZoneGrowableArray* arguments) const { @@ -500,7 +478,6 @@ StaticCallInstr* IRRegExpMacroAssembler::StaticCall( ic_data_array_, GetNextDeoptId()); } - InstanceCallInstr* IRRegExpMacroAssembler::InstanceCall( const InstanceCallDescriptor& desc, PushArgumentInstr* arg1) const { @@ -511,7 +488,6 @@ InstanceCallInstr* IRRegExpMacroAssembler::InstanceCall( return InstanceCall(desc, arguments); } - InstanceCallInstr* IRRegExpMacroAssembler::InstanceCall( const InstanceCallDescriptor& desc, PushArgumentInstr* arg1, @@ -524,7 +500,6 @@ InstanceCallInstr* IRRegExpMacroAssembler::InstanceCall( return InstanceCall(desc, arguments); } - InstanceCallInstr* IRRegExpMacroAssembler::InstanceCall( const InstanceCallDescriptor& desc, PushArgumentInstr* arg1, @@ -539,7 +514,6 @@ InstanceCallInstr* IRRegExpMacroAssembler::InstanceCall( return InstanceCall(desc, arguments); } - InstanceCallInstr* IRRegExpMacroAssembler::InstanceCall( const InstanceCallDescriptor& desc, ZoneGrowableArray* arguments) const { @@ -550,22 +524,18 @@ InstanceCallInstr* IRRegExpMacroAssembler::InstanceCall( ic_data_array_, GetNextDeoptId()); } - LoadLocalInstr* IRRegExpMacroAssembler::LoadLocal(LocalVariable* local) const { return new (Z) LoadLocalInstr(*local, TokenPosition::kNoSource); } - void IRRegExpMacroAssembler::StoreLocal(LocalVariable* local, Value* value) { Do(new (Z) StoreLocalInstr(*local, value, TokenPosition::kNoSource)); } - void IRRegExpMacroAssembler::set_current_instruction(Instruction* instruction) { current_instruction_ = instruction; } - Value* IRRegExpMacroAssembler::Bind(Definition* definition) { AppendInstruction(definition); definition->set_temp_index(temp_id_.Alloc()); @@ -573,12 +543,10 @@ Value* IRRegExpMacroAssembler::Bind(Definition* definition) { return new (Z) Value(definition); } - void IRRegExpMacroAssembler::Do(Definition* definition) { AppendInstruction(definition); } - Value* IRRegExpMacroAssembler::BindLoadLocal(const LocalVariable& local) { if (local.IsConst()) { return Bind(new (Z) ConstantInstr(*local.ConstValue())); @@ -587,7 +555,6 @@ Value* IRRegExpMacroAssembler::BindLoadLocal(const LocalVariable& local) { return Bind(new (Z) LoadLocalInstr(local, TokenPosition::kNoSource)); } - // In some cases, the V8 irregexp engine generates unreachable code by emitting // a jmp not followed by a bind. We cannot do the same, since it is impossible // to append to a block following a jmp. In such cases, assume that we are doing @@ -617,7 +584,6 @@ void IRRegExpMacroAssembler::AppendInstruction(Instruction* instruction) { set_current_instruction(instruction); } - void IRRegExpMacroAssembler::CloseBlockWith(Instruction* instruction) { HANDLE_DEAD_CODE_EMISSION(); @@ -631,7 +597,6 @@ void IRRegExpMacroAssembler::CloseBlockWith(Instruction* instruction) { set_current_instruction(NULL); } - void IRRegExpMacroAssembler::GoTo(BlockLabel* to) { if (to == NULL) { Backtrack(); @@ -641,7 +606,6 @@ void IRRegExpMacroAssembler::GoTo(BlockLabel* to) { } } - // Closes the current block with a goto, and unsets current_instruction_. // BindBlock() must be called before emission can continue. void IRRegExpMacroAssembler::GoTo(JoinEntryInstr* to) { @@ -653,7 +617,6 @@ void IRRegExpMacroAssembler::GoTo(JoinEntryInstr* to) { set_current_instruction(NULL); } - PushArgumentInstr* IRRegExpMacroAssembler::PushArgument(Value* value) { arg_id_.Alloc(); PushArgumentInstr* push = new (Z) PushArgumentInstr(value); @@ -662,18 +625,15 @@ PushArgumentInstr* IRRegExpMacroAssembler::PushArgument(Value* value) { return push; } - PushArgumentInstr* IRRegExpMacroAssembler::PushLocal(LocalVariable* local) { return PushArgument(Bind(LoadLocal(local))); } - void IRRegExpMacroAssembler::Print(const char* str) { Print(PushArgument(Bind(new (Z) ConstantInstr( String::ZoneHandle(Z, String::New(str, Heap::kOld)))))); } - void IRRegExpMacroAssembler::Print(PushArgumentInstr* argument) { const Library& lib = Library::Handle(Library::CoreLibrary()); const Function& print_fn = @@ -681,19 +641,16 @@ void IRRegExpMacroAssembler::Print(PushArgumentInstr* argument) { Do(StaticCall(print_fn, argument)); } - void IRRegExpMacroAssembler::PrintBlocks() { for (intptr_t i = 0; i < blocks_.length(); i++) { FlowGraphPrinter::PrintBlock(blocks_[i], false); } } - intptr_t IRRegExpMacroAssembler::stack_limit_slack() { return 32; } - void IRRegExpMacroAssembler::AdvanceCurrentPosition(intptr_t by) { TAG(); if (by != 0) { @@ -705,7 +662,6 @@ void IRRegExpMacroAssembler::AdvanceCurrentPosition(intptr_t by) { } } - void IRRegExpMacroAssembler::AdvanceRegister(intptr_t reg, intptr_t by) { TAG(); ASSERT(reg >= 0); @@ -721,13 +677,11 @@ void IRRegExpMacroAssembler::AdvanceRegister(intptr_t reg, intptr_t by) { } } - void IRRegExpMacroAssembler::Backtrack() { TAG(); GoTo(backtrack_block_); } - // A BindBlock is analogous to assigning a label to a basic block. // If the BlockLabel does not yet contain a block, it is created. // If there is a current instruction, append a goto to the bound block. @@ -747,13 +701,11 @@ void IRRegExpMacroAssembler::BindBlock(BlockLabel* label) { PRINT(PushArgument(Bind(Uint64Constant(label->block()->block_id())))); } - intptr_t IRRegExpMacroAssembler::GetNextLocalIndex() { intptr_t id = local_id_.Alloc(); return kFirstLocalSlotFromFp - id; } - Value* IRRegExpMacroAssembler::LoadRegister(intptr_t index) { PushArgumentInstr* registers_push = PushLocal(registers_); PushArgumentInstr* index_push = PushRegisterIndex(index); @@ -768,7 +720,6 @@ void IRRegExpMacroAssembler::StoreRegister(intptr_t index, intptr_t value) { StoreRegister(registers_push, index_push, value_push); } - void IRRegExpMacroAssembler::StoreRegister(PushArgumentInstr* registers, PushArgumentInstr* index, PushArgumentInstr* value) { @@ -784,7 +735,6 @@ PushArgumentInstr* IRRegExpMacroAssembler::PushRegisterIndex(intptr_t index) { return PushArgument(Bind(Uint64Constant(index))); } - void IRRegExpMacroAssembler::CheckCharacter(uint32_t c, BlockLabel* on_equal) { TAG(); Definition* cur_char_def = LoadLocal(current_character_); @@ -793,7 +743,6 @@ void IRRegExpMacroAssembler::CheckCharacter(uint32_t c, BlockLabel* on_equal) { BranchOrBacktrack(Comparison(kEQ, cur_char_def, char_def), on_equal); } - void IRRegExpMacroAssembler::CheckCharacterGT(uint16_t limit, BlockLabel* on_greater) { TAG(); @@ -802,7 +751,6 @@ void IRRegExpMacroAssembler::CheckCharacterGT(uint16_t limit, on_greater); } - void IRRegExpMacroAssembler::CheckAtStart(BlockLabel* on_at_start) { TAG(); @@ -824,7 +772,6 @@ void IRRegExpMacroAssembler::CheckAtStart(BlockLabel* on_at_start) { BindBlock(¬_at_start); } - void IRRegExpMacroAssembler::CheckNotAtStart(BlockLabel* on_not_at_start) { TAG(); @@ -842,7 +789,6 @@ void IRRegExpMacroAssembler::CheckNotAtStart(BlockLabel* on_not_at_start) { BranchOrBacktrack(Comparison(kNE, neg_len_def, offset_def), on_not_at_start); } - void IRRegExpMacroAssembler::CheckCharacterLT(uint16_t limit, BlockLabel* on_less) { TAG(); @@ -851,7 +797,6 @@ void IRRegExpMacroAssembler::CheckCharacterLT(uint16_t limit, on_less); } - void IRRegExpMacroAssembler::CheckGreedyLoop(BlockLabel* on_equal) { TAG(); @@ -869,7 +814,6 @@ void IRRegExpMacroAssembler::CheckGreedyLoop(BlockLabel* on_equal) { BindBlock(&fallthrough); } - void IRRegExpMacroAssembler::CheckNotBackReferenceIgnoreCase( intptr_t start_reg, BlockLabel* on_no_match) { @@ -897,7 +841,6 @@ void IRRegExpMacroAssembler::CheckNotBackReferenceIgnoreCase( Comparison(kEQ, LoadLocal(capture_length_), Uint64Constant(0)), &fallthrough); - // Check that there are sufficient characters left in the input. PushArgumentInstr* pos_push = PushLocal(current_position_); PushArgumentInstr* len_push = PushLocal(capture_length_); @@ -1019,7 +962,6 @@ void IRRegExpMacroAssembler::CheckNotBackReferenceIgnoreCase( BindBlock(&fallthrough); } - void IRRegExpMacroAssembler::CheckNotBackReference(intptr_t start_reg, BlockLabel* on_no_match) { TAG(); @@ -1100,7 +1042,6 @@ void IRRegExpMacroAssembler::CheckNotBackReference(intptr_t start_reg, BindBlock(&fallthrough); } - void IRRegExpMacroAssembler::CheckNotCharacter(uint32_t c, BlockLabel* on_not_equal) { TAG(); @@ -1109,7 +1050,6 @@ void IRRegExpMacroAssembler::CheckNotCharacter(uint32_t c, on_not_equal); } - void IRRegExpMacroAssembler::CheckCharacterAfterAnd(uint32_t c, uint32_t mask, BlockLabel* on_equal) { @@ -1126,7 +1066,6 @@ void IRRegExpMacroAssembler::CheckCharacterAfterAnd(uint32_t c, BranchOrBacktrack(Comparison(kEQ, actual_def, expected_def), on_equal); } - void IRRegExpMacroAssembler::CheckNotCharacterAfterAnd( uint32_t c, uint32_t mask, @@ -1144,7 +1083,6 @@ void IRRegExpMacroAssembler::CheckNotCharacterAfterAnd( BranchOrBacktrack(Comparison(kNE, actual_def, expected_def), on_not_equal); } - void IRRegExpMacroAssembler::CheckNotCharacterAfterMinusAnd( uint16_t c, uint16_t minus, @@ -1167,7 +1105,6 @@ void IRRegExpMacroAssembler::CheckNotCharacterAfterMinusAnd( BranchOrBacktrack(Comparison(kNE, actual_def, expected_def), on_not_equal); } - void IRRegExpMacroAssembler::CheckCharacterInRange(uint16_t from, uint16_t to, BlockLabel* on_in_range) { @@ -1189,7 +1126,6 @@ void IRRegExpMacroAssembler::CheckCharacterInRange(uint16_t from, BindBlock(&on_not_in_range); } - void IRRegExpMacroAssembler::CheckCharacterNotInRange( uint16_t from, uint16_t to, @@ -1206,7 +1142,6 @@ void IRRegExpMacroAssembler::CheckCharacterNotInRange( on_not_in_range); } - void IRRegExpMacroAssembler::CheckBitInTable(const TypedData& table, BlockLabel* on_bit_set) { TAG(); @@ -1230,7 +1165,6 @@ void IRRegExpMacroAssembler::CheckBitInTable(const TypedData& table, BranchOrBacktrack(Comparison(kNE, byte_def, zero_def), on_bit_set); } - bool IRRegExpMacroAssembler::CheckSpecialCharacterClass( uint16_t type, BlockLabel* on_no_match) { @@ -1367,7 +1301,6 @@ bool IRRegExpMacroAssembler::CheckSpecialCharacterClass( } } - void IRRegExpMacroAssembler::Fail() { TAG(); ASSERT(FAILURE == 0); // Return value for failure is zero. @@ -1377,7 +1310,6 @@ void IRRegExpMacroAssembler::Fail() { GoTo(exit_block_); } - void IRRegExpMacroAssembler::IfRegisterGE(intptr_t reg, intptr_t comparand, BlockLabel* if_ge) { @@ -1387,7 +1319,6 @@ void IRRegExpMacroAssembler::IfRegisterGE(intptr_t reg, BranchOrBacktrack(Comparison(kGTE, reg_push, pos), if_ge); } - void IRRegExpMacroAssembler::IfRegisterLT(intptr_t reg, intptr_t comparand, BlockLabel* if_lt) { @@ -1397,7 +1328,6 @@ void IRRegExpMacroAssembler::IfRegisterLT(intptr_t reg, BranchOrBacktrack(Comparison(kLT, reg_push, pos), if_lt); } - void IRRegExpMacroAssembler::IfRegisterEqPos(intptr_t reg, BlockLabel* if_eq) { TAG(); PushArgumentInstr* reg_push = PushArgument(LoadRegister(reg)); @@ -1405,13 +1335,11 @@ void IRRegExpMacroAssembler::IfRegisterEqPos(intptr_t reg, BlockLabel* if_eq) { BranchOrBacktrack(Comparison(kEQ, reg_push, pos), if_eq); } - RegExpMacroAssembler::IrregexpImplementation IRRegExpMacroAssembler::Implementation() { return kIRImplementation; } - void IRRegExpMacroAssembler::LoadCurrentCharacter(intptr_t cp_offset, BlockLabel* on_end_of_input, bool check_bounds, @@ -1425,13 +1353,11 @@ void IRRegExpMacroAssembler::LoadCurrentCharacter(intptr_t cp_offset, LoadCurrentCharacterUnchecked(cp_offset, characters); } - void IRRegExpMacroAssembler::PopCurrentPosition() { TAG(); StoreLocal(current_position_, Bind(PopStack())); } - void IRRegExpMacroAssembler::PopRegister(intptr_t reg) { TAG(); ASSERT(reg < registers_count_); @@ -1441,7 +1367,6 @@ void IRRegExpMacroAssembler::PopRegister(intptr_t reg) { StoreRegister(registers_push, index_push, pop_push); } - void IRRegExpMacroAssembler::PushStack(Definition* definition) { PushArgumentInstr* stack_push = PushLocal(stack_); PushArgumentInstr* stack_pointer_push = PushLocal(stack_pointer_); @@ -1454,7 +1379,6 @@ void IRRegExpMacroAssembler::PushStack(Definition* definition) { stack_push, stack_pointer_push, value_push)); } - Definition* IRRegExpMacroAssembler::PopStack() { PushArgumentInstr* stack_push = PushLocal(stack_); PushArgumentInstr* stack_pointer_push1 = PushLocal(stack_pointer_); @@ -1465,7 +1389,6 @@ Definition* IRRegExpMacroAssembler::PopStack() { stack_push, stack_pointer_push1); } - Definition* IRRegExpMacroAssembler::PeekStack() { PushArgumentInstr* stack_push = PushLocal(stack_); PushArgumentInstr* stack_pointer_push = PushLocal(stack_pointer_); @@ -1473,7 +1396,6 @@ Definition* IRRegExpMacroAssembler::PeekStack() { stack_push, stack_pointer_push); } - // Pushes the location corresponding to label to the backtracking stack. void IRRegExpMacroAssembler::PushBacktrack(BlockLabel* label) { TAG(); @@ -1491,13 +1413,11 @@ void IRRegExpMacroAssembler::PushBacktrack(BlockLabel* label) { CheckStackLimit(); } - void IRRegExpMacroAssembler::PushCurrentPosition() { TAG(); PushStack(LoadLocal(current_position_)); } - void IRRegExpMacroAssembler::PushRegister(intptr_t reg) { TAG(); // TODO(zerny): Refactor PushStack so it can be reused here. @@ -1513,7 +1433,6 @@ void IRRegExpMacroAssembler::PushRegister(intptr_t reg) { CheckStackLimit(); } - // Checks that (stack.capacity - stack_limit_slack) > stack_pointer. // This ensures that up to stack_limit_slack stack pushes can be // done without exhausting the stack space. If the check fails the @@ -1543,7 +1462,6 @@ void IRRegExpMacroAssembler::CheckStackLimit() { BindBlock(&fallthrough); } - void IRRegExpMacroAssembler::GrowStack() { TAG(); const Library& lib = Library::Handle(Library::InternalLibrary()); @@ -1564,7 +1482,6 @@ void IRRegExpMacroAssembler::GrowStack() { stack_cell_push, index_push, stack_push)); } - void IRRegExpMacroAssembler::ReadCurrentPositionFromRegister(intptr_t reg) { TAG(); StoreLocal(current_position_, LoadRegister(reg)); @@ -1598,7 +1515,6 @@ void IRRegExpMacroAssembler::SetCurrentPositionFromEnd(intptr_t by) { BindBlock(&after_position); } - void IRRegExpMacroAssembler::SetRegister(intptr_t reg, intptr_t to) { TAG(); // Reserved for positions! @@ -1606,14 +1522,12 @@ void IRRegExpMacroAssembler::SetRegister(intptr_t reg, intptr_t to) { StoreRegister(reg, to); } - bool IRRegExpMacroAssembler::Succeed() { TAG(); GoTo(success_block_); return global(); } - void IRRegExpMacroAssembler::WriteCurrentPositionToRegister( intptr_t reg, intptr_t cp_offset) { @@ -1629,7 +1543,6 @@ void IRRegExpMacroAssembler::WriteCurrentPositionToRegister( StoreRegister(registers_push, index_push, neg_off_push); } - void IRRegExpMacroAssembler::ClearRegisters(intptr_t reg_from, intptr_t reg_to) { TAG(); @@ -1650,7 +1563,6 @@ void IRRegExpMacroAssembler::ClearRegisters(intptr_t reg_from, } } - void IRRegExpMacroAssembler::WriteStackPointerToRegister(intptr_t reg) { TAG(); @@ -1660,10 +1572,8 @@ void IRRegExpMacroAssembler::WriteStackPointerToRegister(intptr_t reg) { StoreRegister(registers_push, index_push, tip_push); } - // Private methods: - void IRRegExpMacroAssembler::CheckPosition(intptr_t cp_offset, BlockLabel* on_outside_input) { TAG(); @@ -1676,7 +1586,6 @@ void IRRegExpMacroAssembler::CheckPosition(intptr_t cp_offset, BranchOrBacktrack(Comparison(kGTE, curpos_def, cp_off_def), on_outside_input); } - void IRRegExpMacroAssembler::BranchOrBacktrack(ComparisonInstr* comparison, BlockLabel* true_successor) { if (comparison == NULL) { // No condition @@ -1707,7 +1616,6 @@ void IRRegExpMacroAssembler::BranchOrBacktrack(ComparisonInstr* comparison, BindBlock(&fallthrough); } - TargetEntryInstr* IRRegExpMacroAssembler::TargetWithJoinGoto( JoinEntryInstr* dst) { TargetEntryInstr* target = new (Z) @@ -1719,7 +1627,6 @@ TargetEntryInstr* IRRegExpMacroAssembler::TargetWithJoinGoto( return target; } - IndirectEntryInstr* IRRegExpMacroAssembler::IndirectWithJoinGoto( JoinEntryInstr* dst) { IndirectEntryInstr* target = @@ -1732,7 +1639,6 @@ IndirectEntryInstr* IRRegExpMacroAssembler::IndirectWithJoinGoto( return target; } - void IRRegExpMacroAssembler::CheckPreemption(bool is_backtrack) { TAG(); @@ -1746,19 +1652,16 @@ void IRRegExpMacroAssembler::CheckPreemption(bool is_backtrack) { : CheckStackOverflowInstr::kOsrOnly)); } - Definition* IRRegExpMacroAssembler::Add(PushArgumentInstr* lhs, PushArgumentInstr* rhs) { return InstanceCall(InstanceCallDescriptor::FromToken(Token::kADD), lhs, rhs); } - Definition* IRRegExpMacroAssembler::Sub(PushArgumentInstr* lhs, PushArgumentInstr* rhs) { return InstanceCall(InstanceCallDescriptor::FromToken(Token::kSUB), lhs, rhs); } - void IRRegExpMacroAssembler::LoadCurrentCharacterUnchecked( intptr_t cp_offset, intptr_t characters) { @@ -1789,12 +1692,10 @@ void IRRegExpMacroAssembler::LoadCurrentCharacterUnchecked( PRINT(PushLocal(current_character_)); } - Value* IRRegExpMacroAssembler::CharacterAt(LocalVariable* index) { return LoadCodeUnitsAt(index, 1); } - Value* IRRegExpMacroAssembler::LoadCodeUnitsAt(LocalVariable* index, intptr_t characters) { // Bind the pattern as the load receiver. @@ -1828,7 +1729,6 @@ Value* IRRegExpMacroAssembler::LoadCodeUnitsAt(LocalVariable* index, TokenPosition::kNoSource)); } - #undef __ } // namespace dart diff --git a/runtime/vm/regexp_assembler_ir.h b/runtime/vm/regexp_assembler_ir.h index 9945cedb205..82a2709c696 100644 --- a/runtime/vm/regexp_assembler_ir.h +++ b/runtime/vm/regexp_assembler_ir.h @@ -439,7 +439,6 @@ class IRRegExpMacroAssembler : public RegExpMacroAssembler { IdAllocator indirect_id_; }; - } // namespace dart #endif // RUNTIME_VM_REGEXP_ASSEMBLER_IR_H_ diff --git a/runtime/vm/regexp_ast.cc b/runtime/vm/regexp_ast.cc index 7e0cbc7e47f..2edfe080b7a 100644 --- a/runtime/vm/regexp_ast.cc +++ b/runtime/vm/regexp_ast.cc @@ -28,7 +28,6 @@ FOR_EACH_REG_EXP_TREE_TYPE(MAKE_TYPE_CASE) FOR_EACH_REG_EXP_TREE_TYPE(MAKE_TYPE_CASE) #undef MAKE_TYPE_CASE - static Interval ListCaptureRegisters(ZoneGrowableArray* children) { Interval result = Interval::Empty(); for (intptr_t i = 0; i < children->length(); i++) @@ -36,43 +35,35 @@ static Interval ListCaptureRegisters(ZoneGrowableArray* children) { return result; } - Interval RegExpAlternative::CaptureRegisters() const { return ListCaptureRegisters(nodes()); } - Interval RegExpDisjunction::CaptureRegisters() const { return ListCaptureRegisters(alternatives()); } - Interval RegExpLookahead::CaptureRegisters() const { return body()->CaptureRegisters(); } - Interval RegExpCapture::CaptureRegisters() const { Interval self(StartRegister(index()), EndRegister(index())); return self.Union(body()->CaptureRegisters()); } - Interval RegExpQuantifier::CaptureRegisters() const { return body()->CaptureRegisters(); } - bool RegExpAssertion::IsAnchoredAtStart() const { return assertion_type() == RegExpAssertion::START_OF_INPUT; } - bool RegExpAssertion::IsAnchoredAtEnd() const { return assertion_type() == RegExpAssertion::END_OF_INPUT; } - bool RegExpAlternative::IsAnchoredAtStart() const { ZoneGrowableArray* nodes = this->nodes(); for (intptr_t i = 0; i < nodes->length(); i++) { @@ -87,7 +78,6 @@ bool RegExpAlternative::IsAnchoredAtStart() const { return false; } - bool RegExpAlternative::IsAnchoredAtEnd() const { ZoneGrowableArray* nodes = this->nodes(); for (intptr_t i = nodes->length() - 1; i >= 0; i--) { @@ -102,7 +92,6 @@ bool RegExpAlternative::IsAnchoredAtEnd() const { return false; } - bool RegExpDisjunction::IsAnchoredAtStart() const { ZoneGrowableArray* alternatives = this->alternatives(); for (intptr_t i = 0; i < alternatives->length(); i++) { @@ -111,7 +100,6 @@ bool RegExpDisjunction::IsAnchoredAtStart() const { return true; } - bool RegExpDisjunction::IsAnchoredAtEnd() const { ZoneGrowableArray* alternatives = this->alternatives(); for (intptr_t i = 0; i < alternatives->length(); i++) { @@ -120,22 +108,18 @@ bool RegExpDisjunction::IsAnchoredAtEnd() const { return true; } - bool RegExpLookahead::IsAnchoredAtStart() const { return is_positive() && body()->IsAnchoredAtStart(); } - bool RegExpCapture::IsAnchoredAtStart() const { return body()->IsAnchoredAtStart(); } - bool RegExpCapture::IsAnchoredAtEnd() const { return body()->IsAnchoredAtEnd(); } - // Convert regular expression trees to a simple sexp representation. // This representation should be different from the input grammar // in as many cases as possible, to make it more difficult for incorrect @@ -149,7 +133,6 @@ class RegExpUnparser : public RegExpVisitor { #undef MAKE_CASE }; - void* RegExpUnparser::VisitDisjunction(RegExpDisjunction* that, void* data) { OS::Print("(|"); for (intptr_t i = 0; i < that->alternatives()->length(); i++) { @@ -160,7 +143,6 @@ void* RegExpUnparser::VisitDisjunction(RegExpDisjunction* that, void* data) { return NULL; } - void* RegExpUnparser::VisitAlternative(RegExpAlternative* that, void* data) { OS::Print("(:"); for (intptr_t i = 0; i < that->nodes()->length(); i++) { @@ -171,7 +153,6 @@ void* RegExpUnparser::VisitAlternative(RegExpAlternative* that, void* data) { return NULL; } - void RegExpUnparser::VisitCharacterRange(CharacterRange that) { PrintUtf16(that.from()); if (!that.IsSingleton()) { @@ -180,7 +161,6 @@ void RegExpUnparser::VisitCharacterRange(CharacterRange that) { } } - void* RegExpUnparser::VisitCharacterClass(RegExpCharacterClass* that, void* data) { if (that->is_negated()) OS::Print("^"); @@ -193,7 +173,6 @@ void* RegExpUnparser::VisitCharacterClass(RegExpCharacterClass* that, return NULL; } - void* RegExpUnparser::VisitAssertion(RegExpAssertion* that, void* data) { switch (that->assertion_type()) { case RegExpAssertion::START_OF_INPUT: @@ -218,7 +197,6 @@ void* RegExpUnparser::VisitAssertion(RegExpAssertion* that, void* data) { return NULL; } - void* RegExpUnparser::VisitAtom(RegExpAtom* that, void* data) { OS::Print("'"); ZoneGrowableArray* chardata = that->data(); @@ -229,7 +207,6 @@ void* RegExpUnparser::VisitAtom(RegExpAtom* that, void* data) { return NULL; } - void* RegExpUnparser::VisitText(RegExpText* that, void* data) { if (that->elements()->length() == 1) { (*that->elements())[0].tree()->Accept(this, data); @@ -244,7 +221,6 @@ void* RegExpUnparser::VisitText(RegExpText* that, void* data) { return NULL; } - void* RegExpUnparser::VisitQuantifier(RegExpQuantifier* that, void* data) { OS::Print("(# %" Pd " ", that->min()); if (that->max() == RegExpTree::kInfinity) { @@ -258,7 +234,6 @@ void* RegExpUnparser::VisitQuantifier(RegExpQuantifier* that, void* data) { return NULL; } - void* RegExpUnparser::VisitCapture(RegExpCapture* that, void* data) { OS::Print("(^ "); that->body()->Accept(this, data); @@ -266,7 +241,6 @@ void* RegExpUnparser::VisitCapture(RegExpCapture* that, void* data) { return NULL; } - void* RegExpUnparser::VisitLookahead(RegExpLookahead* that, void* data) { OS::Print("(-> %s", (that->is_positive() ? "+ " : "- ")); that->body()->Accept(this, data); @@ -274,25 +248,21 @@ void* RegExpUnparser::VisitLookahead(RegExpLookahead* that, void* data) { return NULL; } - void* RegExpUnparser::VisitBackReference(RegExpBackReference* that, void*) { OS::Print("(<- %" Pd ")", that->index()); return NULL; } - void* RegExpUnparser::VisitEmpty(RegExpEmpty*, void*) { OS::Print("%%"); return NULL; } - void RegExpTree::Print() { RegExpUnparser unparser; Accept(&unparser, NULL); } - RegExpDisjunction::RegExpDisjunction( ZoneGrowableArray* alternatives) : alternatives_(alternatives) { @@ -307,7 +277,6 @@ RegExpDisjunction::RegExpDisjunction( } } - static intptr_t IncreaseBy(intptr_t previous, intptr_t increase) { if (RegExpTree::kInfinity - previous < increase) { return RegExpTree::kInfinity; diff --git a/runtime/vm/regexp_ast.h b/runtime/vm/regexp_ast.h index 3d5601aa0ca..438dc3c3762 100644 --- a/runtime/vm/regexp_ast.h +++ b/runtime/vm/regexp_ast.h @@ -25,7 +25,6 @@ class RegExpLookahead; class RegExpQuantifier; class RegExpText; - class RegExpVisitor : public ValueObject { public: virtual ~RegExpVisitor() {} @@ -35,7 +34,6 @@ class RegExpVisitor : public ValueObject { #undef MAKE_CASE }; - class RegExpTree : public ZoneAllocated { public: static const intptr_t kInfinity = kMaxInt32; @@ -60,7 +58,6 @@ class RegExpTree : public ZoneAllocated { #undef MAKE_ASTYPE }; - class RegExpDisjunction : public RegExpTree { public: explicit RegExpDisjunction(ZoneGrowableArray* alternatives); @@ -81,7 +78,6 @@ class RegExpDisjunction : public RegExpTree { intptr_t max_match_; }; - class RegExpAlternative : public RegExpTree { public: explicit RegExpAlternative(ZoneGrowableArray* nodes); @@ -102,7 +98,6 @@ class RegExpAlternative : public RegExpTree { intptr_t max_match_; }; - class RegExpAssertion : public RegExpTree { public: enum AssertionType { @@ -128,7 +123,6 @@ class RegExpAssertion : public RegExpTree { AssertionType assertion_type_; }; - class CharacterSet : public ValueObject { public: explicit CharacterSet(uint16_t standard_set_type) @@ -154,7 +148,6 @@ class CharacterSet : public ValueObject { uint16_t standard_set_type_; }; - class RegExpCharacterClass : public RegExpTree { public: RegExpCharacterClass(ZoneGrowableArray* ranges, @@ -194,7 +187,6 @@ class RegExpCharacterClass : public RegExpTree { bool is_negated_; }; - class RegExpAtom : public RegExpTree { public: explicit RegExpAtom(ZoneGrowableArray* data) : data_(data) {} @@ -213,7 +205,6 @@ class RegExpAtom : public RegExpTree { ZoneGrowableArray* data_; }; - class RegExpText : public RegExpTree { public: RegExpText() : elements_(2), length_(0) {} @@ -236,7 +227,6 @@ class RegExpText : public RegExpTree { intptr_t length_; }; - class RegExpQuantifier : public RegExpTree { public: enum QuantifierType { GREEDY, NON_GREEDY, POSSESSIVE }; @@ -285,7 +275,6 @@ class RegExpQuantifier : public RegExpTree { QuantifierType quantifier_type_; }; - class RegExpCapture : public RegExpTree { public: explicit RegExpCapture(RegExpTree* body, intptr_t index) @@ -313,7 +302,6 @@ class RegExpCapture : public RegExpTree { intptr_t index_; }; - class RegExpLookahead : public RegExpTree { public: RegExpLookahead(RegExpTree* body, @@ -345,7 +333,6 @@ class RegExpLookahead : public RegExpTree { intptr_t capture_from_; }; - class RegExpBackReference : public RegExpTree { public: explicit RegExpBackReference(RegExpCapture* capture) : capture_(capture) {} @@ -362,7 +349,6 @@ class RegExpBackReference : public RegExpTree { RegExpCapture* capture_; }; - class RegExpEmpty : public RegExpTree { public: RegExpEmpty() {} diff --git a/runtime/vm/regexp_interpreter.cc b/runtime/vm/regexp_interpreter.cc index 956d4baea66..27cc976bbe4 100644 --- a/runtime/vm/regexp_interpreter.cc +++ b/runtime/vm/regexp_interpreter.cc @@ -6,12 +6,12 @@ #include "vm/regexp_interpreter.h" -#include "vm/regexp_bytecodes.h" -#include "vm/regexp_assembler.h" #include "vm/object.h" -#include "vm/unicode.h" -#include "vm/unibrow.h" +#include "vm/regexp_assembler.h" +#include "vm/regexp_bytecodes.h" #include "vm/unibrow-inl.h" +#include "vm/unibrow.h" +#include "vm/unicode.h" namespace dart { @@ -70,7 +70,6 @@ bool BackRefMatchesNoCase(Canonicalize* interp_canonicalize, return true; } - #ifdef DEBUG static void TraceInterpreter(const uint8_t* code_base, const uint8_t* pc, @@ -103,7 +102,6 @@ static void TraceInterpreter(const uint8_t* code_base, } } - #define BYTECODE(name) \ case BC_##name: \ TraceInterpreter(code_base, pc, \ @@ -113,19 +111,16 @@ static void TraceInterpreter(const uint8_t* code_base, #define BYTECODE(name) case BC_##name: #endif - static int32_t Load32Aligned(const uint8_t* pc) { ASSERT((reinterpret_cast(pc) & 3) == 0); return *reinterpret_cast(pc); } - static int32_t Load16Aligned(const uint8_t* pc) { ASSERT((reinterpret_cast(pc) & 1) == 0); return *reinterpret_cast(pc); } - // A simple abstraction over the backtracking stack used by the interpreter. // This backtracking stack does not grow automatically, but it ensures that the // the memory held by the stack is released or remembered in a cache if the @@ -148,7 +143,6 @@ class BacktrackStack { DISALLOW_COPY_AND_ASSIGN(BacktrackStack); }; - template static IrregexpInterpreter::IrregexpResult RawMatch(const uint8_t* code_base, const String& subject, @@ -570,7 +564,6 @@ static IrregexpInterpreter::IrregexpResult RawMatch(const uint8_t* code_base, } } - IrregexpInterpreter::IrregexpResult IrregexpInterpreter::Match( const TypedData& bytecode, const String& subject, diff --git a/runtime/vm/regexp_parser.cc b/runtime/vm/regexp_parser.cc index 257f0fee247..5d10d0872ed 100644 --- a/runtime/vm/regexp_parser.cc +++ b/runtime/vm/regexp_parser.cc @@ -2,9 +2,9 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +#include "vm/regexp_parser.h" #include "vm/longjump.h" #include "vm/object_store.h" -#include "vm/regexp_parser.h" namespace dart { @@ -27,7 +27,6 @@ RegExpBuilder::RegExpBuilder() { } - void RegExpBuilder::FlushCharacters() { pending_empty_ = false; if (characters_ != NULL) { @@ -38,7 +37,6 @@ void RegExpBuilder::FlushCharacters() { } } - void RegExpBuilder::FlushText() { FlushCharacters(); intptr_t num_text = text_.length(); @@ -55,7 +53,6 @@ void RegExpBuilder::FlushText() { text_.Clear(); } - void RegExpBuilder::AddCharacter(uint16_t c) { pending_empty_ = false; if (characters_ == NULL) { @@ -65,12 +62,10 @@ void RegExpBuilder::AddCharacter(uint16_t c) { LAST(ADD_CHAR); } - void RegExpBuilder::AddEmpty() { pending_empty_ = true; } - void RegExpBuilder::AddAtom(RegExpTree* term) { if (term->IsEmpty()) { AddEmpty(); @@ -86,19 +81,16 @@ void RegExpBuilder::AddAtom(RegExpTree* term) { LAST(ADD_ATOM); } - void RegExpBuilder::AddAssertion(RegExpTree* assert) { FlushText(); terms_.Add(assert); LAST(ADD_ASSERT); } - void RegExpBuilder::NewAlternative() { FlushTerms(); } - void RegExpBuilder::FlushTerms() { FlushText(); intptr_t num_terms = terms_.length(); @@ -120,7 +112,6 @@ void RegExpBuilder::FlushTerms() { LAST(ADD_NONE); } - RegExpTree* RegExpBuilder::ToRegExp() { FlushTerms(); intptr_t num_alternatives = alternatives_.length(); @@ -138,7 +129,6 @@ RegExpTree* RegExpBuilder::ToRegExp() { return new (Z) RegExpDisjunction(alternatives); } - void RegExpBuilder::AddQuantifierToAtom( intptr_t min, intptr_t max, @@ -215,7 +205,6 @@ RegExpParser::RegExpParser(const String& in, String* error, bool multiline) Advance(); } - uint32_t RegExpParser::Next() { if (has_next()) { return in().CharAt(next_pos_); @@ -224,7 +213,6 @@ uint32_t RegExpParser::Next() { } } - void RegExpParser::Advance() { if (next_pos_ < in().Length()) { current_ = in().CharAt(next_pos_); @@ -235,25 +223,21 @@ void RegExpParser::Advance() { } } - void RegExpParser::Reset(intptr_t pos) { next_pos_ = pos; has_more_ = (pos < in().Length()); Advance(); } - void RegExpParser::Advance(intptr_t dist) { next_pos_ += dist - 1; Advance(); } - bool RegExpParser::simple() { return simple_; } - void RegExpParser::ReportError(const char* message) { failed_ = true; *error_ = String::New(message); @@ -266,7 +250,6 @@ void RegExpParser::ReportError(const char* message) { UNREACHABLE(); } - // Pattern :: // Disjunction RegExpTree* RegExpParser::ParsePattern() { @@ -280,7 +263,6 @@ RegExpTree* RegExpParser::ParsePattern() { return result; } - // Disjunction :: // Alternative // Alternative | Disjunction @@ -632,7 +614,6 @@ RegExpTree* RegExpParser::ParseDisjunction() { } } - #ifdef DEBUG // Currently only used in an ASSERT. static bool IsSpecialClassEscape(uint32_t c) { @@ -650,7 +631,6 @@ static bool IsSpecialClassEscape(uint32_t c) { } #endif - // In order to know whether an escape is a backreference or not we have to scan // the entire regexp and find the number of capturing parentheses. However we // don't want to scan the regexp twice unless it is necessary. This mini-parser @@ -689,12 +669,10 @@ void RegExpParser::ScanForCaptures() { is_scanned_for_captures_ = true; } - static inline bool IsDecimalDigit(int32_t c) { return '0' <= c && c <= '9'; } - bool RegExpParser::ParseBackReferenceIndex(intptr_t* index_out) { ASSERT('\\' == current()); ASSERT('1' <= Next() && Next() <= '9'); @@ -731,7 +709,6 @@ bool RegExpParser::ParseBackReferenceIndex(intptr_t* index_out) { return true; } - // QuantifierPrefix :: // { DecimalDigits } // { DecimalDigits , } @@ -799,7 +776,6 @@ bool RegExpParser::ParseIntervalQuantifier(intptr_t* min_out, return true; } - uint32_t RegExpParser::ParseOctalLiteral() { ASSERT(('0' <= current() && current() <= '7') || current() == kEndMarker); // For compatibility with some other browsers (not all), we parse @@ -817,7 +793,6 @@ uint32_t RegExpParser::ParseOctalLiteral() { return value; } - // Returns the value (0 .. 15) of a hexadecimal character c. // If c is not a legal hexadecimal character, returns a value < 0. static inline intptr_t HexValue(uint32_t c) { @@ -828,7 +803,6 @@ static inline intptr_t HexValue(uint32_t c) { return -1; } - bool RegExpParser::ParseHexEscape(intptr_t length, uint32_t* value) { intptr_t start = position(); uint32_t val = 0; @@ -850,7 +824,6 @@ bool RegExpParser::ParseHexEscape(intptr_t length, uint32_t* value) { return true; } - uint32_t RegExpParser::ParseClassCharacterEscape() { ASSERT(current() == '\\'); DEBUG_ASSERT(has_next() && !IsSpecialClassEscape(Next())); @@ -936,7 +909,6 @@ uint32_t RegExpParser::ParseClassCharacterEscape() { return 0; } - CharacterRange RegExpParser::ParseClassAtom(uint16_t* char_class) { ASSERT(0 == *char_class); uint32_t first = current(); @@ -965,7 +937,6 @@ CharacterRange RegExpParser::ParseClassAtom(uint16_t* char_class) { } } - static const uint16_t kNoCharClass = 0; // Adds range or pre-defined character class to character ranges. @@ -981,7 +952,6 @@ static inline void AddRangeOrEscape(ZoneGrowableArray* ranges, } } - RegExpTree* RegExpParser::ParseCharacterClass() { static const char* kUnterminated = "Unterminated character class"; static const char* kRangeOutOfOrder = "Range out of order in character class"; @@ -1039,7 +1009,6 @@ RegExpTree* RegExpParser::ParseCharacterClass() { return new (Z) RegExpCharacterClass(ranges, is_negated); } - // ---------------------------------------------------------------------------- // The Parser interface. diff --git a/runtime/vm/regexp_parser.h b/runtime/vm/regexp_parser.h index 7b8a140c21e..6536fde8a80 100644 --- a/runtime/vm/regexp_parser.h +++ b/runtime/vm/regexp_parser.h @@ -42,7 +42,7 @@ class RegExpBuilder : public ZoneAllocated { GrowableArray text_; GrowableArray alternatives_; #ifdef DEBUG - enum { ADD_NONE, ADD_CHAR, ADD_TERM, ADD_ASSERT, ADD_ATOM } last_added_; + enum {ADD_NONE, ADD_CHAR, ADD_TERM, ADD_ASSERT, ADD_ATOM} last_added_; #define LAST(x) last_added_ = x; #else #define LAST(x) diff --git a/runtime/vm/report.cc b/runtime/vm/report.cc index ba87b5ee260..4b45c37abf2 100644 --- a/runtime/vm/report.cc +++ b/runtime/vm/report.cc @@ -85,8 +85,8 @@ RawString* Report::PrependSnippet(Kind kind, result = String::ConcatAll(strs, Heap::kOld); } else { // Token position is unknown. - result = String::NewFormatted(Heap::kOld, "'%s': %s: ", - script_url.ToCString(), message_header); + result = String::NewFormatted( + Heap::kOld, "'%s': %s: ", script_url.ToCString(), message_header); result = String::Concat(result, message, Heap::kOld); } } else { @@ -98,13 +98,11 @@ RawString* Report::PrependSnippet(Kind kind, return result.raw(); } - void Report::LongJump(const Error& error) { Thread::Current()->long_jump_base()->Jump(1, error); UNREACHABLE(); } - void Report::LongJumpF(const Error& prev_error, const Script& script, TokenPosition token_pos, @@ -117,7 +115,6 @@ void Report::LongJumpF(const Error& prev_error, UNREACHABLE(); } - void Report::LongJumpV(const Error& prev_error, const Script& script, TokenPosition token_pos, @@ -130,7 +127,6 @@ void Report::LongJumpV(const Error& prev_error, UNREACHABLE(); } - void Report::MessageF(Kind kind, const Script& script, TokenPosition token_pos, @@ -143,7 +139,6 @@ void Report::MessageF(Kind kind, va_end(args); } - void Report::MessageV(Kind kind, const Script& script, TokenPosition token_pos, diff --git a/runtime/vm/resolver.cc b/runtime/vm/resolver.cc index 4b26d5f5831..fe59e675ac6 100644 --- a/runtime/vm/resolver.cc +++ b/runtime/vm/resolver.cc @@ -30,7 +30,6 @@ RawFunction* Resolver::ResolveDynamic(const Instance& receiver, return ResolveDynamicForReceiverClass(cls, function_name, args_desc); } - RawFunction* Resolver::ResolveDynamicForReceiverClass( const Class& receiver_class, const String& function_name, @@ -61,7 +60,6 @@ RawFunction* Resolver::ResolveDynamicForReceiverClass( return function.raw(); } - RawFunction* Resolver::ResolveDynamicAnyArgs(Zone* zone, const Class& receiver_class, const String& function_name, @@ -142,7 +140,6 @@ RawFunction* Resolver::ResolveDynamicAnyArgs(Zone* zone, return function.raw(); } - RawFunction* Resolver::ResolveStatic(const Library& library, const String& class_name, const String& function_name, @@ -191,7 +188,6 @@ RawFunction* Resolver::ResolveStatic(const Library& library, return function.raw(); } - RawFunction* Resolver::ResolveStatic(const Class& cls, const String& function_name, intptr_t type_args_len, @@ -223,7 +219,6 @@ RawFunction* Resolver::ResolveStatic(const Class& cls, return function.raw(); } - RawFunction* Resolver::ResolveStaticAllowPrivate(const Class& cls, const String& function_name, intptr_t type_args_len, diff --git a/runtime/vm/resolver.h b/runtime/vm/resolver.h index 60c3e2c0e14..8c5fc1566bf 100644 --- a/runtime/vm/resolver.h +++ b/runtime/vm/resolver.h @@ -18,7 +18,6 @@ class RawFunction; class String; class ArgumentsDescriptor; - // Resolver abstracts functionality needed to resolve dart functions at // invocations. class Resolver : public AllStatic { diff --git a/runtime/vm/resolver_test.cc b/runtime/vm/resolver_test.cc index e53b08813ea..3142f13b166 100644 --- a/runtime/vm/resolver_test.cc +++ b/runtime/vm/resolver_test.cc @@ -2,13 +2,13 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +#include "vm/resolver.h" #include "platform/assert.h" #include "vm/assembler.h" #include "vm/class_finalizer.h" #include "vm/compiler.h" #include "vm/dart_entry.h" #include "vm/object.h" -#include "vm/resolver.h" #include "vm/symbols.h" #include "vm/unit_test.h" @@ -49,7 +49,6 @@ static void SetupFunction(const char* test_library_name, EXPECT(ClassFinalizer::ProcessPendingClasses()); } - // Setup a static function for invocation. static void SetupStaticFunction(const char* test_library_name, const char* test_class_name, @@ -59,7 +58,6 @@ static void SetupStaticFunction(const char* test_library_name, true); } - // Setup an instance function for invocation. static void SetupInstanceFunction(const char* test_library_name, const char* test_class_name, @@ -68,7 +66,6 @@ static void SetupInstanceFunction(const char* test_library_name, SetupFunction(test_library_name, test_class_name, test_function_name, false); } - TEST_CASE(DartStaticResolve) { const char* test_library_name = "ResolverApp"; const char* test_class_name = "A"; @@ -128,7 +125,6 @@ TEST_CASE(DartStaticResolve) { } } - TEST_CASE(DartDynamicResolve) { const char* test_library_name = "ResolverApp"; const char* test_class_name = "A"; diff --git a/runtime/vm/reusable_handles.h b/runtime/vm/reusable_handles.h index 11178d8342f..7c452bc3d5c 100644 --- a/runtime/vm/reusable_handles.h +++ b/runtime/vm/reusable_handles.h @@ -30,7 +30,6 @@ namespace dart { // } // - #if defined(DEBUG) #define REUSABLE_SCOPE(name) \ class Reusable##name##HandleScope : public ValueObject { \ diff --git a/runtime/vm/ring_buffer_test.cc b/runtime/vm/ring_buffer_test.cc index ee0894a2289..308e815e785 100644 --- a/runtime/vm/ring_buffer_test.cc +++ b/runtime/vm/ring_buffer_test.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "platform/assert.h" #include "vm/ring_buffer.h" +#include "platform/assert.h" #include "vm/unit_test.h" namespace dart { diff --git a/runtime/vm/runtime_entry.cc b/runtime/vm/runtime_entry.cc index 3504e78830f..53db05703ff 100644 --- a/runtime/vm/runtime_entry.cc +++ b/runtime/vm/runtime_entry.cc @@ -14,9 +14,9 @@ #include "vm/deopt_instructions.h" #include "vm/exceptions.h" #include "vm/flags.h" -#include "vm/object_store.h" #include "vm/message.h" #include "vm/message_handler.h" +#include "vm/object_store.h" #include "vm/parser.h" #include "vm/resolver.h" #include "vm/service_isolate.h" @@ -92,7 +92,6 @@ DEFINE_FLAG(charp, "the specified class"); #endif - #if defined(TESTING) || defined(DEBUG) void VerifyOnTransition() { Thread* thread = Thread::Current(); @@ -104,7 +103,6 @@ void VerifyOnTransition() { } #endif - // Add function to a class and that class to the class dictionary so that // frame walking can be used. const Function& RegisterFakeFunction(const char* name, const Code& code) { @@ -126,7 +124,6 @@ const Function& RegisterFakeFunction(const char* name, const Code& code) { return function; } - DEFINE_RUNTIME_ENTRY(TraceFunctionEntry, 1) { const Function& function = Function::CheckedHandle(arguments.ArgAt(0)); const String& function_name = String::Handle(function.name()); @@ -136,7 +133,6 @@ DEFINE_RUNTIME_ENTRY(TraceFunctionEntry, 1) { function_name.ToCString()); } - DEFINE_RUNTIME_ENTRY(TraceFunctionExit, 1) { const Function& function = Function::CheckedHandle(arguments.ArgAt(0)); const String& function_name = String::Handle(function.name()); @@ -146,7 +142,6 @@ DEFINE_RUNTIME_ENTRY(TraceFunctionExit, 1) { function_name.ToCString()); } - DEFINE_RUNTIME_ENTRY(RangeError, 2) { const Instance& length = Instance::CheckedHandle(arguments.ArgAt(0)); const Instance& index = Instance::CheckedHandle(arguments.ArgAt(1)); @@ -175,7 +170,6 @@ DEFINE_RUNTIME_ENTRY(RangeError, 2) { Exceptions::ThrowByType(Exceptions::kRange, args); } - // Allocation of a fixed length array of given element type. // This runtime entry is never called for allocating a List of a generic type, // because a prior run time call instantiates the element type if necessary. @@ -217,7 +211,6 @@ DEFINE_RUNTIME_ENTRY(AllocateArray, 2) { Exceptions::ThrowByType(Exceptions::kRange, args); } - // Helper returning the token position of the Dart caller. static TokenPosition GetCallerLocation() { DartFrameIterator iterator(Thread::Current(), @@ -227,7 +220,6 @@ static TokenPosition GetCallerLocation() { return caller_frame->GetTokenPos(); } - // Allocate a new object. // Arg0: class of the object that needs to be allocated. // Arg1: type arguments of the object that needs to be allocated. @@ -265,7 +257,6 @@ DEFINE_RUNTIME_ENTRY(AllocateObject, 2) { instance.SetTypeArguments(type_arguments); } - // Instantiate type. // Arg0: uninstantiated type. // Arg1: instantiator type arguments. @@ -305,7 +296,6 @@ DEFINE_RUNTIME_ENTRY(InstantiateType, 3) { arguments.SetReturn(type); } - // Instantiate type arguments. // Arg0: uninstantiated type arguments. // Arg1: instantiator type arguments. @@ -348,7 +338,6 @@ DEFINE_RUNTIME_ENTRY(InstantiateTypeArguments, 3) { arguments.SetReturn(type_arguments); } - // Allocate a new context large enough to hold the given number of variables. // Arg0: number of variables. // Return value: newly allocated context. @@ -357,7 +346,6 @@ DEFINE_RUNTIME_ENTRY(AllocateContext, 1) { arguments.SetReturn(Context::Handle(Context::New(num_variables.Value()))); } - // Make a copy of the given context, including the values of the captured // variables. // Arg0: the context to be cloned. @@ -375,7 +363,6 @@ DEFINE_RUNTIME_ENTRY(CloneContext, 1) { arguments.SetReturn(cloned_ctx); } - // Helper routine for tracing a type check. static void PrintTypeCheck(const char* message, const Instance& instance, @@ -420,7 +407,6 @@ static void PrintTypeCheck(const char* message, OS::PrintErr(" -> Function %s\n", function.ToFullyQualifiedCString()); } - // This updates the type test cache, an array containing 5-value elements // (instance class (or function if the instance is a closure), instance type // arguments, instantiator type arguments, function type arguments, @@ -570,7 +556,6 @@ static void UpdateTypeTestCache( } } - // Check that the given instance is an instance of the given type. // Tested instance may not be null, because the null test is inlined. // Arg0: instance being checked. @@ -616,7 +601,6 @@ DEFINE_RUNTIME_ENTRY(Instanceof, 5) { arguments.SetReturn(result); } - // Check that the type of the given instance is a subtype of the given type and // can therefore be assigned. // Arg0: instance being assigned. @@ -679,7 +663,6 @@ DEFINE_RUNTIME_ENTRY(TypeCheck, 6) { arguments.SetReturn(src_instance); } - // Report that the type of the given object is not bool in conditional context. // Throw assertion error if the object is null. (cf. Boolean Conversion // in language Spec.) @@ -719,7 +702,6 @@ DEFINE_RUNTIME_ENTRY(NonBoolTypeError, 1) { UNREACHABLE(); } - // Report that the type of the type check is malformed or malbounded. // Arg0: src value. // Arg1: name of destination being assigned to. @@ -738,13 +720,11 @@ DEFINE_RUNTIME_ENTRY(BadTypeError, 3) { UNREACHABLE(); } - DEFINE_RUNTIME_ENTRY(Throw, 1) { const Instance& exception = Instance::CheckedHandle(zone, arguments.ArgAt(0)); Exceptions::Throw(thread, exception); } - DEFINE_RUNTIME_ENTRY(ReThrow, 2) { const Instance& exception = Instance::CheckedHandle(zone, arguments.ArgAt(0)); const Instance& stacktrace = @@ -752,7 +732,6 @@ DEFINE_RUNTIME_ENTRY(ReThrow, 2) { Exceptions::ReThrow(thread, exception, stacktrace); } - // Patches static call in optimized code with the target's entry point. // Compiles target if necessary. DEFINE_RUNTIME_ENTRY(PatchStaticCall, 0) { @@ -783,7 +762,6 @@ DEFINE_RUNTIME_ENTRY(PatchStaticCall, 0) { arguments.SetReturn(target_code); } - // Result of an invoke may be an unhandled exception, in which case we // rethrow it. static void CheckResultError(const Object& result) { @@ -792,7 +770,6 @@ static void CheckResultError(const Object& result) { } } - #if !defined(TARGET_ARCH_DBC) // Gets called from debug stub when code reaches a breakpoint // set on a runtime stub call. @@ -830,7 +807,6 @@ DEFINE_RUNTIME_ENTRY(BreakpointRuntimeHandler, 0) { } #endif // !defined(TARGET_ARCH_DBC) - DEFINE_RUNTIME_ENTRY(SingleStepHandler, 0) { if (!FLAG_support_debugger) { UNREACHABLE(); @@ -844,7 +820,6 @@ DEFINE_RUNTIME_ENTRY(SingleStepHandler, 0) { } } - // An instance call of the form o.f(...) could not be resolved. Check if // there is a getter with the same name. If so, invoke it. If the value is // a closure, invoke it with the given arguments. If the value is a @@ -881,7 +856,6 @@ static bool ResolveCallThroughGetter(const Instance& receiver, return true; } - // Handle other invocations (implicit closures, noSuchMethod). RawFunction* InlineCacheMissHelper(const Instance& receiver, const Array& args_descriptor, @@ -910,7 +884,6 @@ RawFunction* InlineCacheMissHelper(const Instance& receiver, return result.raw(); } - // Perform the subtype and return constant function based on the result. static RawFunction* ComputeTypeCheckTarget(const Instance& receiver, const AbstractType& type, @@ -927,7 +900,6 @@ static RawFunction* ComputeTypeCheckTarget(const Instance& receiver, return target.raw(); } - static RawFunction* InlineCacheMissHandler( const GrowableArray& args, // Checked arguments only. const ICData& ic_data) { @@ -998,7 +970,6 @@ static RawFunction* InlineCacheMissHandler( return target_function.raw(); } - // Handles inline cache misses by updating the IC data array of the call site. // Arg0: Receiver object. // Arg1: IC data object. @@ -1014,7 +985,6 @@ DEFINE_RUNTIME_ENTRY(InlineCacheMissHandlerOneArg, 2) { arguments.SetReturn(result); } - // Handles inline cache misses by updating the IC data array of the call site. // Arg0: Receiver object. // Arg1: Argument after receiver. @@ -1033,7 +1003,6 @@ DEFINE_RUNTIME_ENTRY(InlineCacheMissHandlerTwoArgs, 3) { arguments.SetReturn(result); } - // Handles a static call in unoptimized code that has one argument type not // seen before. Compile the target if necessary and update the ICData. // Arg0: argument. @@ -1058,7 +1027,6 @@ DEFINE_RUNTIME_ENTRY(StaticCallMissHandlerOneArg, 2) { arguments.SetReturn(target); } - // Handles a static call in unoptimized code that has two argument types not // seen before. Compile the target if necessary and update the ICData. // Arg0: argument 0. @@ -1088,7 +1056,6 @@ DEFINE_RUNTIME_ENTRY(StaticCallMissHandlerTwoArgs, 3) { arguments.SetReturn(target); } - #if !defined(TARGET_ARCH_DBC) static bool IsSingleTarget(Isolate* isolate, Zone* zone, @@ -1114,7 +1081,6 @@ static bool IsSingleTarget(Isolate* isolate, } #endif - // Handle a miss of a single target cache. // Arg0: Receiver. // Returns: the ICData used to continue with a polymorphic call. @@ -1205,7 +1171,6 @@ DEFINE_RUNTIME_ENTRY(SingleTargetMiss, 1) { #endif } - DEFINE_RUNTIME_ENTRY(UnlinkedCall, 2) { #if defined(TARGET_ARCH_DBC) // DBC does not use switchable calls. @@ -1272,7 +1237,6 @@ DEFINE_RUNTIME_ENTRY(UnlinkedCall, 2) { #endif // !DBC } - // Handle a miss of a megamorphic cache. // Arg0: Receiver. // Returns: the ICData used to continue with a polymorphic call. @@ -1371,7 +1335,6 @@ DEFINE_RUNTIME_ENTRY(MonomorphicMiss, 1) { #endif // !defined(TARGET_ARCH_DBC) } - // Handle a miss of a megamorphic cache. // Arg0: Receiver. // Arg1: ICData or MegamorphicCache. @@ -1473,7 +1436,6 @@ DEFINE_RUNTIME_ENTRY(MegamorphicCacheMissHandler, 3) { #endif // !defined(TARGET_ARCH_DBC) } - // Invoke appropriate noSuchMethod or closure from getter. // Arg0: receiver // Arg1: ICData or MegamorphicCache @@ -1617,7 +1579,6 @@ DEFINE_RUNTIME_ENTRY(InvokeNoSuchMethodDispatcher, 4) { #undef CLOSURIZE } - // Invoke appropriate noSuchMethod function. // Arg0: receiver (closure object) // Arg1: arguments descriptor array. @@ -1639,7 +1600,6 @@ DEFINE_RUNTIME_ENTRY(InvokeClosureNoSuchMethod, 3) { arguments.SetReturn(result); } - DEFINE_RUNTIME_ENTRY(StackOverflow, 0) { #if defined(USING_SIMULATOR) uword stack_pos = Simulator::Current()->get_sp(); @@ -1828,7 +1788,6 @@ DEFINE_RUNTIME_ENTRY(StackOverflow, 0) { } } - DEFINE_RUNTIME_ENTRY(TraceICCall, 2) { const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(0)); const Function& function = Function::CheckedHandle(arguments.ArgAt(1)); @@ -1842,7 +1801,6 @@ DEFINE_RUNTIME_ENTRY(TraceICCall, 2) { ic_data.NumberOfChecks(), function.ToFullyQualifiedCString()); } - // This is called from function that needs to be optimized. // The requesting function can be already optimized (reoptimization). // Returns the Code object where to continue execution. @@ -1909,7 +1867,6 @@ DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) { #endif // !DART_PRECOMPILED_RUNTIME } - // The caller must be a static call in a Dart frame, or an entry frame. // Patch static call to point to valid code's entry point. DEFINE_RUNTIME_ENTRY(FixCallersTarget, 0) { @@ -1947,7 +1904,6 @@ DEFINE_RUNTIME_ENTRY(FixCallersTarget, 0) { arguments.SetReturn(current_target_code); } - // The caller tried to allocate an instance via an invalidated allocation // stub. DEFINE_RUNTIME_ENTRY(FixAllocationStubTarget, 0) { @@ -1991,7 +1947,6 @@ DEFINE_RUNTIME_ENTRY(FixAllocationStubTarget, 0) { #endif } - const char* DeoptReasonToCString(ICData::DeoptReasonId deopt_reason) { switch (deopt_reason) { #define DEOPT_REASON_TO_TEXT(name) \ @@ -2005,7 +1960,6 @@ const char* DeoptReasonToCString(ICData::DeoptReasonId deopt_reason) { } } - void DeoptimizeAt(const Code& optimized_code, StackFrame* frame) { ASSERT(optimized_code.is_optimized()); Thread* thread = Thread::Current(); @@ -2077,7 +2031,6 @@ void DeoptimizeAt(const Code& optimized_code, StackFrame* frame) { optimized_code.set_is_alive(false); } - // Currently checks only that all optimized frames have kDeoptIndex // and unoptimized code has the kDeoptAfter. void DeoptimizeFunctionsOnStack() { @@ -2129,7 +2082,6 @@ static void CopySavedRegisters(uword saved_registers_address, } #endif - // Copies saved registers and caller's frame into temporary buffers. // Returns the stack size of unoptimized frame. // The calling code must be optimized, but its function may not have @@ -2213,7 +2165,6 @@ DEFINE_LEAF_RUNTIME_ENTRY(intptr_t, } END_LEAF_RUNTIME_ENTRY - // The stack has been adjusted to fit all values for unoptimized frame. // Fill the unoptimized frame. DEFINE_LEAF_RUNTIME_ENTRY(void, DeoptimizeFillFrame, 1, uword last_fp) { @@ -2256,7 +2207,6 @@ DEFINE_LEAF_RUNTIME_ENTRY(void, DeoptimizeFillFrame, 1, uword last_fp) { } END_LEAF_RUNTIME_ENTRY - // This is the last step in the deoptimization, GC can occur. // Returns number of bytes to remove from the expression stack of the // bottom-most deoptimized frame. Those arguments were artificially injected @@ -2284,7 +2234,6 @@ DEFINE_RUNTIME_ENTRY(DeoptimizeMaterialize, 0) { #endif // !DART_PRECOMPILED_RUNTIME } - DEFINE_RUNTIME_ENTRY(RewindPostDeopt, 0) { #if !defined(DART_PRECOMPILED_RUNTIME) #if !defined(PRODUCT) @@ -2308,7 +2257,6 @@ DEFINE_LEAF_RUNTIME_ENTRY(intptr_t, } END_LEAF_RUNTIME_ENTRY - double DartModulo(double left, double right) { double remainder = fmod_ieee(left, right); if (remainder == 0.0) { @@ -2324,7 +2272,6 @@ double DartModulo(double left, double right) { return remainder; } - // Update global type feedback recorded for a field recording the assignment // of the given value. // Arg0: Field object; @@ -2335,7 +2282,6 @@ DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { field.RecordStore(value); } - DEFINE_RUNTIME_ENTRY(InitStaticField, 1) { const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); field.EvaluateInitializer(); diff --git a/runtime/vm/runtime_entry.h b/runtime/vm/runtime_entry.h index 12209996dfa..0eea4fb7623 100644 --- a/runtime/vm/runtime_entry.h +++ b/runtime/vm/runtime_entry.h @@ -140,12 +140,10 @@ class RuntimeEntry : public ValueObject { extern const RuntimeEntry k##name##RuntimeEntry; \ extern "C" type DLRT_##name(__VA_ARGS__); - // Declare all runtime functions here. RUNTIME_ENTRY_LIST(DECLARE_RUNTIME_ENTRY) LEAF_RUNTIME_ENTRY_LIST(DECLARE_LEAF_RUNTIME_ENTRY) - uword RuntimeEntry::AddressFromId(RuntimeFunctionId id) { switch (id) { #define DEFINE_RUNTIME_CASE(name) \ @@ -165,7 +163,6 @@ uword RuntimeEntry::AddressFromId(RuntimeFunctionId id) { return 0; } - RuntimeFunctionId RuntimeEntry::RuntimeFunctionIdFromAddress(uword address) { #define CHECK_RUNTIME_ADDRESS(name) \ if (address == k##name##RuntimeEntry.GetEntryPoint()) return k##name##Id; diff --git a/runtime/vm/runtime_entry_arm.cc b/runtime/vm/runtime_entry_arm.cc index 846b91b6edf..06955ad1537 100644 --- a/runtime/vm/runtime_entry_arm.cc +++ b/runtime/vm/runtime_entry_arm.cc @@ -15,7 +15,6 @@ namespace dart { #define __ assembler-> - uword RuntimeEntry::GetEntryPoint() const { // Compute the effective address. When running under the simulator, // this is a redirection address that forces the simulator to call @@ -37,7 +36,6 @@ uword RuntimeEntry::GetEntryPoint() const { return entry; } - // Generate code to call into the stub which will call the runtime // function. Input for the stub is as follows: // SP : points to the arguments and return value array. diff --git a/runtime/vm/runtime_entry_arm64.cc b/runtime/vm/runtime_entry_arm64.cc index 2186fc36d6e..a8e9e908937 100644 --- a/runtime/vm/runtime_entry_arm64.cc +++ b/runtime/vm/runtime_entry_arm64.cc @@ -15,7 +15,6 @@ namespace dart { #define __ assembler-> - uword RuntimeEntry::GetEntryPoint() const { // Compute the effective address. When running under the simulator, // this is a redirection address that forces the simulator to call @@ -37,7 +36,6 @@ uword RuntimeEntry::GetEntryPoint() const { return entry; } - // Generate code to call into the stub which will call the runtime // function. Input for the stub is as follows: // SP : points to the arguments and return value array. diff --git a/runtime/vm/runtime_entry_dbc.cc b/runtime/vm/runtime_entry_dbc.cc index 8e03f1aa6f6..51f93635241 100644 --- a/runtime/vm/runtime_entry_dbc.cc +++ b/runtime/vm/runtime_entry_dbc.cc @@ -13,17 +13,14 @@ namespace dart { - uword RuntimeEntry::GetEntryPoint() const { return reinterpret_cast(function()); } - void RuntimeEntry::Call(Assembler* assembler, intptr_t argument_count) const { UNIMPLEMENTED(); } - } // namespace dart #endif // defined TARGET_ARCH_DBC diff --git a/runtime/vm/runtime_entry_ia32.cc b/runtime/vm/runtime_entry_ia32.cc index fdb24640ecd..ab22a92bb0c 100644 --- a/runtime/vm/runtime_entry_ia32.cc +++ b/runtime/vm/runtime_entry_ia32.cc @@ -14,12 +14,10 @@ namespace dart { #define __ assembler-> - uword RuntimeEntry::GetEntryPoint() const { return reinterpret_cast(function()); } - // Generate code to call into the stub which will call the runtime // function. Input for the stub is as follows: // For regular runtime calls - diff --git a/runtime/vm/runtime_entry_x64.cc b/runtime/vm/runtime_entry_x64.cc index 84026eceb46..dfd0840cd77 100644 --- a/runtime/vm/runtime_entry_x64.cc +++ b/runtime/vm/runtime_entry_x64.cc @@ -14,12 +14,10 @@ namespace dart { #define __ assembler-> - uword RuntimeEntry::GetEntryPoint() const { return reinterpret_cast(function()); } - // Generate code to call into the stub which will call the runtime // function. Input for the stub is as follows: // RSP : points to the arguments and return value array. diff --git a/runtime/vm/safepoint.cc b/runtime/vm/safepoint.cc index a554a9a8f33..7dabc5a738f 100644 --- a/runtime/vm/safepoint.cc +++ b/runtime/vm/safepoint.cc @@ -23,7 +23,6 @@ SafepointOperationScope::SafepointOperationScope(Thread* T) : StackResource(T) { handler->SafepointThreads(T); } - SafepointOperationScope::~SafepointOperationScope() { Thread* T = thread(); ASSERT(T != NULL); @@ -36,7 +35,6 @@ SafepointOperationScope::~SafepointOperationScope() { handler->ResumeThreads(T); } - SafepointHandler::SafepointHandler(Isolate* isolate) : isolate_(isolate), safepoint_lock_(new Monitor()), @@ -44,7 +42,6 @@ SafepointHandler::SafepointHandler(Isolate* isolate) safepoint_operation_count_(0), owner_(NULL) {} - SafepointHandler::~SafepointHandler() { ASSERT(owner_ == NULL); ASSERT(safepoint_operation_count_ == 0); @@ -53,7 +50,6 @@ SafepointHandler::~SafepointHandler() { isolate_ = NULL; } - void SafepointHandler::SafepointThreads(Thread* T) { { // First grab the threads list lock for this isolate @@ -120,7 +116,6 @@ void SafepointHandler::SafepointThreads(Thread* T) { } } - void SafepointHandler::ResumeThreads(Thread* T) { // First resume all the threads which are blocked for the safepoint // operation. @@ -153,7 +148,6 @@ void SafepointHandler::ResumeThreads(Thread* T) { sl.NotifyAll(); } - void SafepointHandler::EnterSafepointUsingLock(Thread* T) { MonitorLocker tl(T->thread_lock()); T->SetAtSafepoint(true); @@ -165,7 +159,6 @@ void SafepointHandler::EnterSafepointUsingLock(Thread* T) { } } - void SafepointHandler::ExitSafepointUsingLock(Thread* T) { MonitorLocker tl(T->thread_lock()); ASSERT(T->IsAtSafepoint()); @@ -177,7 +170,6 @@ void SafepointHandler::ExitSafepointUsingLock(Thread* T) { T->SetAtSafepoint(false); } - void SafepointHandler::BlockForSafepoint(Thread* T) { MonitorLocker tl(T->thread_lock()); if (T->IsSafepointRequested()) { diff --git a/runtime/vm/safepoint.h b/runtime/vm/safepoint.h index 5547ce7ad86..c522ac9e255 100644 --- a/runtime/vm/safepoint.h +++ b/runtime/vm/safepoint.h @@ -23,7 +23,6 @@ class SafepointOperationScope : public StackResource { DISALLOW_COPY_AND_ASSIGN(SafepointOperationScope); }; - // Implements handling of safepoint operations for all threads in an Isolate. class SafepointHandler { public: @@ -94,7 +93,6 @@ class SafepointHandler { friend class SafepointOperationScope; }; - /* * Set of StackResource classes to track thread execution state transitions: * @@ -152,7 +150,6 @@ class TransitionSafepointState : public StackResource { DISALLOW_COPY_AND_ASSIGN(TransitionSafepointState); }; - // TransitionGeneratedToVM is used to transition the safepoint state of a // thread from "running generated code" to "running vm code" and ensures // that the state is reverted back to "running generated code" when @@ -180,7 +177,6 @@ class TransitionGeneratedToVM : public TransitionSafepointState { DISALLOW_COPY_AND_ASSIGN(TransitionGeneratedToVM); }; - // TransitionGeneratedToNative is used to transition the safepoint state of a // thread from "running generated code" to "running native code" and ensures // that the state is reverted back to "running generated code" when @@ -208,7 +204,6 @@ class TransitionGeneratedToNative : public TransitionSafepointState { DISALLOW_COPY_AND_ASSIGN(TransitionGeneratedToNative); }; - // TransitionVMToBlocked is used to transition the safepoint state of a // thread from "running vm code" to "blocked on a monitor" and ensures // that the state is reverted back to "running vm code" when @@ -233,7 +228,6 @@ class TransitionVMToBlocked : public TransitionSafepointState { DISALLOW_COPY_AND_ASSIGN(TransitionVMToBlocked); }; - // TransitionVMToNative is used to transition the safepoint state of a // thread from "running vm code" to "running native code" and ensures // that the state is reverted back to "running vm code" when @@ -258,7 +252,6 @@ class TransitionVMToNative : public TransitionSafepointState { DISALLOW_COPY_AND_ASSIGN(TransitionVMToNative); }; - // TransitionVMToGenerated is used to transition the safepoint state of a // thread from "running vm code" to "running generated code" and ensures // that the state is reverted back to "running vm code" when @@ -286,7 +279,6 @@ class TransitionVMToGenerated : public TransitionSafepointState { DISALLOW_COPY_AND_ASSIGN(TransitionVMToGenerated); }; - // TransitionNativeToVM is used to transition the safepoint state of a // thread from "running native code" to "running vm code" and ensures // that the state is reverted back to "running native code" when @@ -311,7 +303,6 @@ class TransitionNativeToVM : public TransitionSafepointState { DISALLOW_COPY_AND_ASSIGN(TransitionNativeToVM); }; - // TransitionToGenerated is used to transition the safepoint state of a // thread from "running vm code" or "running native code" to // "running generated code" and ensures that the state is reverted back @@ -346,7 +337,6 @@ class TransitionToGenerated : public TransitionSafepointState { DISALLOW_COPY_AND_ASSIGN(TransitionToGenerated); }; - // TransitionToVM is used to transition the safepoint state of a // thread from "running native code" to "running vm code" // and ensures that the state is reverted back to "running native code" diff --git a/runtime/vm/scanner.cc b/runtime/vm/scanner.cc index a34439b6ab3..1b146cb5e64 100644 --- a/runtime/vm/scanner.cc +++ b/runtime/vm/scanner.cc @@ -19,7 +19,6 @@ namespace dart { #define Z (zone()) #define T (thread()) - class ScanContext : public ZoneAllocated { public: explicit ScanContext(Scanner* scanner) @@ -43,11 +42,9 @@ class ScanContext : public ZoneAllocated { const int brace_level_; }; - Scanner::KeywordTable Scanner::keywords_[Token::kNumKeywords]; int Scanner::keywords_char_offset_[Scanner::kNumLowercaseChars]; - void Scanner::Reset() { // Non-changing newline properties. newline_token_.kind = Token::kNEWLINE; @@ -74,7 +71,6 @@ void Scanner::Reset() { ReadChar(); } - Scanner::Scanner(const String& src, const String& private_key) : source_(src), source_length_(src.Length()), @@ -86,10 +82,8 @@ Scanner::Scanner(const String& src, const String& private_key) Reset(); } - Scanner::~Scanner() {} - void Scanner::ErrorMsg(const char* msg) { current_token_.kind = Token::kERROR; current_token_.literal = &String::ZoneHandle(Z, Symbols::New(T, msg)); @@ -98,7 +92,6 @@ void Scanner::ErrorMsg(const char* msg) { current_token_.offset = lookahead_pos_; } - void Scanner::PushContext() { ScanContext* ctx = new (Z) ScanContext(this); saved_context_ = ctx; @@ -107,7 +100,6 @@ void Scanner::PushContext() { brace_level_ = 1; // Account for the opening ${ token. } - void Scanner::PopContext() { ASSERT(saved_context_ != NULL); ASSERT(brace_level_ == 0); @@ -118,49 +110,40 @@ void Scanner::PopContext() { ASSERT(string_delimiter_ != '\0'); } - void Scanner::BeginStringLiteral(const char delimiter) { string_delimiter_ = delimiter; } - void Scanner::EndStringLiteral() { string_delimiter_ = '\0'; string_is_multiline_ = false; } - bool Scanner::IsLetter(int32_t c) { return (('A' <= c) && (c <= 'Z')) || (('a' <= c) && (c <= 'z')); } - bool Scanner::IsDecimalDigit(int32_t c) { return '0' <= c && c <= '9'; } - bool Scanner::IsNumberStart(int32_t ch) { return IsDecimalDigit(ch) || ch == '.'; } - bool Scanner::IsHexDigit(int32_t c) { return IsDecimalDigit(c) || (('A' <= c) && (c <= 'F')) || (('a' <= c) && (c <= 'f')); } - bool Scanner::IsIdentStartChar(int32_t c) { return IsLetter(c) || (c == '_') || (c == '$'); } - bool Scanner::IsIdentChar(int32_t c) { return IsLetter(c) || IsDecimalDigit(c) || (c == '_') || (c == '$'); } - bool Scanner::IsIdent(const String& str) { if (!str.IsOneByteString()) { return false; @@ -176,7 +159,6 @@ bool Scanner::IsIdent(const String& str) { return true; } - // This method is used when parsing integers in Dart code. We // are reusing the Scanner's handling of number literals in that situation. bool Scanner::IsValidInteger(const String& str, @@ -209,7 +191,6 @@ bool Scanner::IsValidInteger(const String& str, return false; } - void Scanner::ReadChar() { if (lookahead_pos_ < source_length_) { if (c0_ == '\n') { @@ -233,7 +214,6 @@ void Scanner::ReadChar() { } } - // Look ahead 'how_many' characters. Returns the character, or '\0' if // the lookahead position is beyond the end of the string. Does not // normalize line end characters into '\n'. @@ -246,14 +226,12 @@ int32_t Scanner::LookaheadChar(int how_many) { return lookahead_char; } - void Scanner::ConsumeWhiteSpace() { while (c0_ == ' ' || c0_ == '\t' || c0_ == '\n') { ReadChar(); } } - void Scanner::ConsumeLineComment() { ASSERT(c0_ == '/'); while (c0_ != '\n' && c0_ != '\0') { @@ -263,7 +241,6 @@ void Scanner::ConsumeLineComment() { current_token_.kind = Token::kWHITESP; } - void Scanner::ConsumeBlockComment() { ASSERT(c0_ == '*'); ReadChar(); @@ -290,7 +267,6 @@ void Scanner::ConsumeBlockComment() { (nesting_level == 0) ? Token::kWHITESP : Token::kILLEGAL; } - void Scanner::ScanIdentChars(bool allow_dollar) { ASSERT(IsIdentStartChar(c0_)); ASSERT(allow_dollar || (c0_ != '$')); @@ -339,7 +315,6 @@ void Scanner::ScanIdentChars(bool allow_dollar) { current_token_.literal = &literal; } - // Parse integer or double number literal of format: // NUMBER = INTEGER | DOUBLE // INTEGER = D+ | (("0x" | "0X") H+) @@ -393,14 +368,12 @@ void Scanner::ScanNumber(bool dec_point_seen) { } } - void Scanner::SkipLine() { while (c0_ != '\n' && c0_ != '\0') { ReadChar(); } } - void Scanner::ScanScriptTag() { ReadChar(); ASSERT(c0_ == '!'); @@ -410,7 +383,6 @@ void Scanner::ScanScriptTag() { SkipLine(); } - void Scanner::ScanLiteralString(bool is_raw) { ASSERT(!IsScanningString()); ASSERT(c0_ == '"' || c0_ == '\''); @@ -427,7 +399,6 @@ void Scanner::ScanLiteralString(bool is_raw) { ScanLiteralStringChars(is_raw, string_is_multiline_); } - bool Scanner::ScanHexDigits(int digits, int32_t* value) { *value = 0; for (int i = 0; i < digits; ++i) { @@ -442,7 +413,6 @@ bool Scanner::ScanHexDigits(int digits, int32_t* value) { return true; } - bool Scanner::ScanHexDigits(int min_digits, int max_digits, int32_t* value) { *value = 0; ReadChar(); @@ -461,7 +431,6 @@ bool Scanner::ScanHexDigits(int min_digits, int max_digits, int32_t* value) { return true; } - void Scanner::ScanEscapedCodePoint(int32_t* code_point) { ASSERT(c0_ == 'u' || c0_ == 'x'); bool is_valid; @@ -484,7 +453,6 @@ void Scanner::ScanEscapedCodePoint(int32_t* code_point) { } } - void Scanner::ScanLiteralStringChars(bool is_raw, bool remove_whitespace) { GrowableArray string_chars(64); @@ -606,7 +574,6 @@ void Scanner::ScanLiteralStringChars(bool is_raw, bool remove_whitespace) { } } - void Scanner::Scan() { newline_seen_ = false; @@ -880,7 +847,6 @@ void Scanner::Scan() { } while (current_token_.kind == Token::kWHITESP); } - void Scanner::ScanAll(TokenCollector* collector) { Reset(); do { @@ -905,7 +871,6 @@ void Scanner::ScanAll(TokenCollector* collector) { } while (current_token_.kind != Token::kEOS); } - void Scanner::ScanTo(intptr_t token_index) { ASSERT(token_index >= 0); intptr_t index = 0; @@ -930,7 +895,6 @@ void Scanner::ScanTo(intptr_t token_index) { } while ((token_index >= index) && (current_token_.kind != Token::kEOS)); } - void Scanner::InitOnce() { ASSERT(Isolate::Current() == Dart::vm_isolate()); for (int i = 0; i < kNumLowercaseChars; i++) { diff --git a/runtime/vm/scanner.h b/runtime/vm/scanner.h index f378b11edbe..2f86c693f25 100644 --- a/runtime/vm/scanner.h +++ b/runtime/vm/scanner.h @@ -213,7 +213,6 @@ class Scanner : ValueObject { static int keywords_char_offset_[kNumLowercaseChars]; }; - } // namespace dart #endif // RUNTIME_VM_SCANNER_H_ diff --git a/runtime/vm/scanner_test.cc b/runtime/vm/scanner_test.cc index f934c540583..38ffc86d963 100644 --- a/runtime/vm/scanner_test.cc +++ b/runtime/vm/scanner_test.cc @@ -2,18 +2,16 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +#include "vm/scanner.h" #include "platform/assert.h" #include "vm/os.h" -#include "vm/scanner.h" #include "vm/token.h" #include "vm/unit_test.h" namespace dart { - typedef ZoneGrowableArray GrowableTokenStream; - static void LogTokenDesc(Scanner::TokenDescriptor token) { OS::Print("pos %2d:%d-%d token %s ", token.position.line, token.position.column, token.position.column, @@ -24,7 +22,6 @@ static void LogTokenDesc(Scanner::TokenDescriptor token) { OS::Print("\n"); } - static void LogTokenStream(const GrowableTokenStream& token_stream) { int token_index = 0; EXPECT_GT(token_stream.length(), 0); @@ -37,7 +34,6 @@ static void LogTokenStream(const GrowableTokenStream& token_stream) { EXPECT_EQ(token_stream.Last().kind, Token::kEOS); } - static void CheckKind(const GrowableTokenStream& token_stream, int index, Token::Kind kind) { @@ -48,7 +44,6 @@ static void CheckKind(const GrowableTokenStream& token_stream, EXPECT_EQ(kind, token_stream[index].kind); } - static void CheckLiteral(const GrowableTokenStream& token_stream, int index, const char* literal) { @@ -61,7 +56,6 @@ static void CheckLiteral(const GrowableTokenStream& token_stream, } } - static void CheckIdent(const GrowableTokenStream& token_stream, int index, const char* literal) { @@ -69,7 +63,6 @@ static void CheckIdent(const GrowableTokenStream& token_stream, CheckLiteral(token_stream, index, literal); } - static void CheckInteger(const GrowableTokenStream& token_stream, int index, const char* literal) { @@ -77,7 +70,6 @@ static void CheckInteger(const GrowableTokenStream& token_stream, CheckLiteral(token_stream, index, literal); } - static void CheckLineNumber(const GrowableTokenStream& token_stream, int index, int line_number) { @@ -87,7 +79,6 @@ static void CheckLineNumber(const GrowableTokenStream& token_stream, } } - static void CheckNumTokens(const GrowableTokenStream& token_stream, int index) { if (token_stream.length() != index) { OS::PrintErr("Expected %d tokens but got only %" Pd ".\n", index, @@ -95,7 +86,6 @@ static void CheckNumTokens(const GrowableTokenStream& token_stream, int index) { } } - class Collector : public Scanner::TokenCollector { public: explicit Collector(GrowableTokenStream* ts) : ts_(ts) {} @@ -109,7 +99,6 @@ class Collector : public Scanner::TokenCollector { GrowableTokenStream* ts_; }; - static const GrowableTokenStream& Scan(const char* source) { OS::Print("\nScanning: <%s>\n", source); @@ -123,7 +112,6 @@ static const GrowableTokenStream& Scan(const char* source) { return *tokens; } - static void BoringTest() { const GrowableTokenStream& tokens = Scan("x = iffy++;"); @@ -135,7 +123,6 @@ static void BoringTest() { CheckKind(tokens, 4, Token::kSEMICOLON); } - static void CommentTest() { const GrowableTokenStream& tokens = Scan( "Foo( /*block \n" @@ -151,7 +138,6 @@ static void CommentTest() { CheckLineNumber(tokens, 4, 2); } - static void GreedIsGood() { // means i++ + j const GrowableTokenStream& tokens = Scan("x=i+++j"); @@ -165,7 +151,6 @@ static void GreedIsGood() { CheckIdent(tokens, 5, "j"); } - static void StringEscapes() { // sss = "\" \\ \n\r\t \'" const GrowableTokenStream& tokens = @@ -189,7 +174,6 @@ static void StringEscapes() { EXPECT_EQ('\'', litchars[8]); } - static void InvalidStringEscapes() { const GrowableTokenStream& out_of_range_low = Scan("\"\\u{110000}\""); EXPECT_EQ(2, out_of_range_low.length()); @@ -204,7 +188,6 @@ static void InvalidStringEscapes() { CheckKind(out_of_range_high, 1, Token::kEOS); } - static void RawString() { // rs = @"\' \\" const GrowableTokenStream& tokens = Scan("rs = r\"\\\' \\\\\""); @@ -225,7 +208,6 @@ static void RawString() { EXPECT_EQ('\\', litchars[4]); } - static void MultilineString() { // |mls = ''' // |1' x @@ -253,7 +235,6 @@ static void MultilineString() { EXPECT_EQ('2', litchars[5]); } - static void EmptyString() { // es = ""; const GrowableTokenStream& tokens = Scan("es = \"\";"); @@ -280,7 +261,6 @@ static void EmptyMultilineString() { EXPECT_EQ(0, (tokens)[2].literal->Length()); } - static void NumberLiteral() { const GrowableTokenStream& tokens = Scan("5 0x5d 0.3 0.33 1E+12 .42 +5"); @@ -295,7 +275,6 @@ static void NumberLiteral() { CheckKind(tokens, 8, Token::kEOS); } - static void ScanLargeText() { const char* dart_source = "// This source is not meant to be valid Dart code. The text is used to" @@ -359,7 +338,6 @@ static void ScanLargeText() { Scan(dart_source); } - void InvalidText() { const GrowableTokenStream& tokens = Scan("\\"); @@ -368,7 +346,6 @@ void InvalidText() { CheckKind(tokens, 1, Token::kEOS); } - void NewlinesTest() { const char* source = "var es = /* a\n" @@ -401,7 +378,6 @@ void NewlinesTest() { EXPECT_EQ('\n', litchars[3]); } - TEST_CASE(Scanner_Test) { ScanLargeText(); diff --git a/runtime/vm/scavenger.cc b/runtime/vm/scavenger.cc index 81cc55d5c78..275817db8d0 100644 --- a/runtime/vm/scavenger.cc +++ b/runtime/vm/scavenger.cc @@ -9,8 +9,8 @@ #include "vm/isolate.h" #include "vm/lockers.h" #include "vm/object.h" -#include "vm/object_set.h" #include "vm/object_id_ring.h" +#include "vm/object_set.h" #include "vm/safepoint.h" #include "vm/stack_frame.h" #include "vm/store_buffer.h" @@ -42,27 +42,23 @@ enum { kForwarded = kForwardingMask, }; - static inline bool IsForwarding(uword header) { uword bits = header & kForwardingMask; ASSERT((bits == kNotForwarded) || (bits == kForwarded)); return bits == kForwarded; } - static inline uword ForwardedAddr(uword header) { ASSERT(IsForwarding(header)); return header & ~kForwardingMask; } - static inline void ForwardTo(uword original, uword target) { // Make sure forwarding can be encoded. ASSERT((target & kForwardingMask) == 0); *reinterpret_cast(original) = target | kForwarded; } - class ScavengerVisitor : public ObjectPointerVisitor { public: explicit ScavengerVisitor(Isolate* isolate, @@ -193,7 +189,6 @@ class ScavengerVisitor : public ObjectPointerVisitor { DISALLOW_COPY_AND_ASSIGN(ScavengerVisitor); }; - class ScavengerWeakVisitor : public HandleVisitor { public: ScavengerWeakVisitor(Thread* thread, Scavenger* scavenger) @@ -218,7 +213,6 @@ class ScavengerWeakVisitor : public HandleVisitor { DISALLOW_COPY_AND_ASSIGN(ScavengerWeakVisitor); }; - // Visitor used to verify that all old->new references have been added to the // StoreBuffers. class VerifyStoreBufferPointerVisitor : public ObjectPointerVisitor { @@ -241,7 +235,6 @@ class VerifyStoreBufferPointerVisitor : public ObjectPointerVisitor { DISALLOW_COPY_AND_ASSIGN(VerifyStoreBufferPointerVisitor); }; - SemiSpace::SemiSpace(VirtualMemory* reserved) : reserved_(reserved), region_(NULL, 0) { if (reserved != NULL) { @@ -249,29 +242,25 @@ SemiSpace::SemiSpace(VirtualMemory* reserved) } } - SemiSpace::~SemiSpace() { if (reserved_ != NULL) { #if defined(DEBUG) - memset(reserved_->address(), Heap::kZapByte, size_in_words() - << kWordSizeLog2); + memset(reserved_->address(), Heap::kZapByte, + size_in_words() << kWordSizeLog2); #endif // defined(DEBUG) delete reserved_; } } - Mutex* SemiSpace::mutex_ = NULL; SemiSpace* SemiSpace::cache_ = NULL; - void SemiSpace::InitOnce() { ASSERT(mutex_ == NULL); mutex_ = new Mutex(); ASSERT(mutex_ != NULL); } - SemiSpace* SemiSpace::New(intptr_t size_in_words, const char* name) { { MutexLocker locker(mutex_); @@ -300,7 +289,6 @@ SemiSpace* SemiSpace::New(intptr_t size_in_words, const char* name) { } } - void SemiSpace::Delete() { #ifdef DEBUG if (reserved_ != NULL) { @@ -317,7 +305,6 @@ void SemiSpace::Delete() { delete old_cache; } - void SemiSpace::WriteProtect(bool read_only) { if (reserved_ != NULL) { bool success = reserved_->Protect(read_only ? VirtualMemory::kReadOnly @@ -326,7 +313,6 @@ void SemiSpace::WriteProtect(bool read_only) { } } - Scavenger::Scavenger(Heap* heap, intptr_t max_semi_capacity_in_words, uword object_alignment) @@ -366,13 +352,11 @@ Scavenger::Scavenger(Heap* heap, UpdateMaxHeapUsage(); } - Scavenger::~Scavenger() { ASSERT(!scavenging_); to_->Delete(); } - intptr_t Scavenger::NewSizeInWords(intptr_t old_size_in_words) const { if (stats_history_.Size() == 0) { return old_size_in_words; @@ -386,7 +370,6 @@ intptr_t Scavenger::NewSizeInWords(intptr_t old_size_in_words) const { } } - SemiSpace* Scavenger::Prologue(Isolate* isolate, bool invoke_api_callbacks) { if (invoke_api_callbacks && (isolate->gc_prologue_callback() != NULL)) { (isolate->gc_prologue_callback())(); @@ -412,7 +395,6 @@ SemiSpace* Scavenger::Prologue(Isolate* isolate, bool invoke_api_callbacks) { return from; } - void Scavenger::Epilogue(Isolate* isolate, SemiSpace* from, bool invoke_api_callbacks) { @@ -455,7 +437,6 @@ void Scavenger::Epilogue(Isolate* isolate, } } - void Scavenger::IterateStoreBuffers(Isolate* isolate, ScavengerVisitor* visitor) { // Iterating through the store buffers. @@ -492,7 +473,6 @@ void Scavenger::IterateStoreBuffers(Isolate* isolate, visitor->VisitingOldObject(NULL); } - void Scavenger::IterateObjectIdTable(Isolate* isolate, ScavengerVisitor* visitor) { #ifndef PRODUCT @@ -509,7 +489,6 @@ void Scavenger::IterateObjectIdTable(Isolate* isolate, #endif // !PRODUCT } - void Scavenger::IterateRoots(Isolate* isolate, ScavengerVisitor* visitor) { int64_t start = OS::GetCurrentMonotonicMicros(); isolate->VisitObjectPointers(visitor, @@ -524,7 +503,6 @@ void Scavenger::IterateRoots(Isolate* isolate, ScavengerVisitor* visitor) { heap_->RecordTime(kDummyScavengeTime, 0); } - bool Scavenger::IsUnreachable(RawObject** p) { RawObject* raw_obj = *p; if (!raw_obj->IsHeapObject()) { @@ -546,12 +524,10 @@ bool Scavenger::IsUnreachable(RawObject** p) { return true; } - void Scavenger::IterateWeakRoots(Isolate* isolate, HandleVisitor* visitor) { isolate->VisitWeakPersistentHandles(visitor); } - void Scavenger::ProcessToSpace(ScavengerVisitor* visitor) { // Iterate until all work has been drained. while ((resolved_top_ < top_) || PromotedStackHasMore()) { @@ -613,7 +589,6 @@ void Scavenger::ProcessToSpace(ScavengerVisitor* visitor) { } } - void Scavenger::UpdateMaxHeapCapacity() { if (heap_ == NULL) { // Some unit tests. @@ -627,7 +602,6 @@ void Scavenger::UpdateMaxHeapCapacity() { kWordSize); } - void Scavenger::UpdateMaxHeapUsage() { if (heap_ == NULL) { // Some unit tests. @@ -640,7 +614,6 @@ void Scavenger::UpdateMaxHeapUsage() { isolate->GetHeapNewUsedMaxMetric()->SetValue(UsedInWords() * kWordSize); } - void Scavenger::EnqueueWeakProperty(RawWeakProperty* raw_weak) { ASSERT(raw_weak->IsHeapObject()); ASSERT(raw_weak->IsNewObject()); @@ -655,7 +628,6 @@ void Scavenger::EnqueueWeakProperty(RawWeakProperty* raw_weak) { delayed_weak_properties_ = raw_weak; } - uword Scavenger::ProcessWeakProperty(RawWeakProperty* raw_weak, ScavengerVisitor* visitor) { // The fate of the weak property is determined by its key. @@ -673,7 +645,6 @@ uword Scavenger::ProcessWeakProperty(RawWeakProperty* raw_weak, return raw_weak->VisitPointersNonvirtual(visitor); } - void Scavenger::ProcessWeakReferences() { // Rehash the weak tables now that we know which objects survive this cycle. for (int sel = 0; sel < Heap::kNumWeakSelectors; sel++) { @@ -729,7 +700,6 @@ void Scavenger::ProcessWeakReferences() { } } - void Scavenger::VisitObjectPointers(ObjectPointerVisitor* visitor) const { uword cur = FirstObjectStart(); while (cur < top_) { @@ -738,7 +708,6 @@ void Scavenger::VisitObjectPointers(ObjectPointerVisitor* visitor) const { } } - void Scavenger::VisitObjects(ObjectVisitor* visitor) const { uword cur = FirstObjectStart(); while (cur < top_) { @@ -748,12 +717,10 @@ void Scavenger::VisitObjects(ObjectVisitor* visitor) const { } } - void Scavenger::AddRegionsToObjectSet(ObjectSet* set) const { set->AddRegion(to_->start(), to_->end()); } - RawObject* Scavenger::FindObject(FindObjectVisitor* visitor) const { ASSERT(!scavenging_); uword cur = FirstObjectStart(); @@ -771,14 +738,12 @@ RawObject* Scavenger::FindObject(FindObjectVisitor* visitor) const { return Object::null(); } - void Scavenger::Scavenge() { // TODO(cshapiro): Add a decision procedure for determining when the // the API callbacks should be invoked. Scavenge(false); } - void Scavenger::Scavenge(bool invoke_api_callbacks) { Isolate* isolate = heap_->isolate(); // Ensure that all threads for this isolate are at a safepoint (either stopped @@ -857,13 +822,11 @@ void Scavenger::Scavenge(bool invoke_api_callbacks) { scavenging_ = false; } - void Scavenger::WriteProtect(bool read_only) { ASSERT(!scavenging_); to_->WriteProtect(read_only); } - #ifndef PRODUCT void Scavenger::PrintToJSONObject(JSONObject* object) const { if (!FLAG_support_service) { @@ -894,20 +857,17 @@ void Scavenger::PrintToJSONObject(JSONObject* object) const { } #endif // !PRODUCT - void Scavenger::AllocateExternal(intptr_t size) { ASSERT(size >= 0); external_size_ += size; } - void Scavenger::FreeExternal(intptr_t size) { ASSERT(size >= 0); external_size_ -= size; ASSERT(external_size_ >= 0); } - void Scavenger::Evacuate() { // We need a safepoint here to prevent allocation right before or right after // the scavenge. diff --git a/runtime/vm/scavenger.h b/runtime/vm/scavenger.h index fd4663de7de..82e9adc4bad 100644 --- a/runtime/vm/scavenger.h +++ b/runtime/vm/scavenger.h @@ -63,7 +63,6 @@ class SemiSpace { static Mutex* mutex_; }; - // Statistics for a particular scavenge. class ScavengeStats { public: @@ -107,7 +106,6 @@ class ScavengeStats { intptr_t promoted_in_words_; }; - class Scavenger { public: Scavenger(Heap* heap, diff --git a/runtime/vm/scavenger_test.cc b/runtime/vm/scavenger_test.cc index cd8d61060b8..e510e309368 100644 --- a/runtime/vm/scavenger_test.cc +++ b/runtime/vm/scavenger_test.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "platform/assert.h" #include "vm/scavenger.h" +#include "platform/assert.h" #include "vm/unit_test.h" #include "vm/visitor.h" diff --git a/runtime/vm/scopes.cc b/runtime/vm/scopes.cc index ed69838d920..d0f72d670b0 100644 --- a/runtime/vm/scopes.cc +++ b/runtime/vm/scopes.cc @@ -22,7 +22,6 @@ int SourceLabel::FunctionLevel() const { return owner()->function_level(); } - LocalScope::LocalScope(LocalScope* parent, int function_level, int loop_level) : parent_(parent), child_(NULL), @@ -45,7 +44,6 @@ LocalScope::LocalScope(LocalScope* parent, int function_level, int loop_level) } } - bool LocalScope::IsNestedWithin(LocalScope* scope) const { const LocalScope* current_scope = this; while (current_scope != NULL) { @@ -57,7 +55,6 @@ bool LocalScope::IsNestedWithin(LocalScope* scope) const { return false; } - bool LocalScope::AddVariable(LocalVariable* variable) { ASSERT(variable != NULL); if (LocalLookupVariable(variable->name()) != NULL) { @@ -72,7 +69,6 @@ bool LocalScope::AddVariable(LocalVariable* variable) { return true; } - bool LocalScope::InsertParameterAt(intptr_t pos, LocalVariable* parameter) { ASSERT(parameter != NULL); if (LocalLookupVariable(parameter->name()) != NULL) { @@ -85,7 +81,6 @@ bool LocalScope::InsertParameterAt(intptr_t pos, LocalVariable* parameter) { return true; } - bool LocalScope::AddLabel(SourceLabel* label) { if (LocalLookupLabel(label->name()) != NULL) { return false; @@ -99,7 +94,6 @@ bool LocalScope::AddLabel(SourceLabel* label) { return true; } - void LocalScope::MoveLabel(SourceLabel* label) { ASSERT(LocalLookupLabel(label->name()) == NULL); ASSERT(label->kind() == SourceLabel::kForward); @@ -107,7 +101,6 @@ void LocalScope::MoveLabel(SourceLabel* label) { label->set_owner(this); } - NameReference* LocalScope::FindReference(const String& name) const { ASSERT(name.IsSymbol()); intptr_t num_references = referenced_.length(); @@ -119,7 +112,6 @@ NameReference* LocalScope::FindReference(const String& name) const { return NULL; } - void LocalScope::AddReferencedName(TokenPosition token_pos, const String& name) { if (LocalLookupVariable(name) != NULL) { @@ -141,7 +133,6 @@ void LocalScope::AddReferencedName(TokenPosition token_pos, } } - TokenPosition LocalScope::PreviousReferencePos(const String& name) const { NameReference* ref = FindReference(name); if (ref != NULL) { @@ -150,7 +141,6 @@ TokenPosition LocalScope::PreviousReferencePos(const String& name) const { return TokenPosition::kNoSource; } - void LocalScope::AllocateContextVariable(LocalVariable* variable, LocalScope** context_owner) { ASSERT(variable->is_captured()); @@ -191,7 +181,6 @@ void LocalScope::AllocateContextVariable(LocalVariable* variable, variable->set_index((*context_owner)->num_context_variables_++); } - int LocalScope::AllocateVariables(int first_parameter_index, int num_parameters, int first_frame_index, @@ -266,7 +255,6 @@ int LocalScope::AllocateVariables(int first_parameter_index, return min_frame_index; } - // The parser creates internal variables that start with ":" static bool IsFilteredIdentifier(const String& str) { ASSERT(str.Length() > 0); @@ -293,7 +281,6 @@ static bool IsFilteredIdentifier(const String& str) { return str.CharAt(0) == ':'; } - RawLocalVarDescriptors* LocalScope::GetVarDescriptors( const Function& func, ZoneGrowableArray* context_level_array) { @@ -371,7 +358,6 @@ RawLocalVarDescriptors* LocalScope::GetVarDescriptors( return var_desc.raw(); } - // Add visible variables that are declared in this scope to vars, then // collect visible variables of children, followed by siblings. void LocalScope::CollectLocalVariables(GrowableArray* vars, @@ -420,7 +406,6 @@ void LocalScope::CollectLocalVariables(GrowableArray* vars, } } - SourceLabel* LocalScope::LocalLookupLabel(const String& name) const { ASSERT(name.IsSymbol()); for (intptr_t i = 0; i < labels_.length(); i++) { @@ -432,7 +417,6 @@ SourceLabel* LocalScope::LocalLookupLabel(const String& name) const { return NULL; } - LocalVariable* LocalScope::LocalLookupVariable(const String& name) const { ASSERT(name.IsSymbol()); for (intptr_t i = 0; i < variables_.length(); i++) { @@ -445,7 +429,6 @@ LocalVariable* LocalScope::LocalLookupVariable(const String& name) const { return NULL; } - LocalVariable* LocalScope::LookupVariable(const String& name, bool test_only) { LocalScope* current_scope = this; while (current_scope != NULL) { @@ -462,7 +445,6 @@ LocalVariable* LocalScope::LookupVariable(const String& name, bool test_only) { return NULL; } - void LocalScope::CaptureVariable(LocalVariable* variable) { ASSERT(variable != NULL); // The variable must exist in an enclosing scope, not necessarily in this one. @@ -488,7 +470,6 @@ void LocalScope::CaptureVariable(LocalVariable* variable) { } } - SourceLabel* LocalScope::LookupLabel(const String& name) { LocalScope* current_scope = this; while (current_scope != NULL) { @@ -501,7 +482,6 @@ SourceLabel* LocalScope::LookupLabel(const String& name) { return NULL; } - SourceLabel* LocalScope::LookupInnermostLabel(Token::Kind jump_kind) { ASSERT((jump_kind == Token::kCONTINUE) || (jump_kind == Token::kBREAK)); LocalScope* current_scope = this; @@ -521,7 +501,6 @@ SourceLabel* LocalScope::LookupInnermostLabel(Token::Kind jump_kind) { return NULL; } - LocalScope* LocalScope::LookupSwitchScope() { LocalScope* current_scope = this->parent(); int this_level = this->function_level(); @@ -541,7 +520,6 @@ LocalScope* LocalScope::LookupSwitchScope() { return NULL; } - SourceLabel* LocalScope::CheckUnresolvedLabels() { for (int i = 0; i < this->labels_.length(); i++) { SourceLabel* label = this->labels_[i]; @@ -557,7 +535,6 @@ SourceLabel* LocalScope::CheckUnresolvedLabels() { return NULL; } - int LocalScope::NumCapturedVariables() const { // It is not necessary to traverse parent scopes, since we are only interested // in the captured variables referenced in this scope. If this scope is the @@ -582,7 +559,6 @@ int LocalScope::NumCapturedVariables() const { return num_captured; } - RawContextScope* LocalScope::PreserveOuterScope( int current_context_level) const { // Since code generation for nested functions is postponed until first @@ -628,7 +604,6 @@ RawContextScope* LocalScope::PreserveOuterScope( return context_scope.raw(); } - LocalScope* LocalScope::RestoreOuterScope(const ContextScope& context_scope) { // The function level of the outer scope is one less than the function level // of the current function, which is 0. @@ -667,7 +642,6 @@ LocalScope* LocalScope::RestoreOuterScope(const ContextScope& context_scope) { return outer_scope; } - void LocalScope::CaptureLocalVariables(LocalScope* top_scope) { ASSERT(top_scope->function_level() == function_level()); LocalScope* scope = this; @@ -688,7 +662,6 @@ void LocalScope::CaptureLocalVariables(LocalScope* top_scope) { } } - RawContextScope* LocalScope::CreateImplicitClosureScope(const Function& func) { static const intptr_t kNumCapturedVars = 1; @@ -710,7 +683,6 @@ RawContextScope* LocalScope::CreateImplicitClosureScope(const Function& func) { return context_scope.raw(); } - bool LocalVariable::Equals(const LocalVariable& other) const { if (HasIndex() && other.HasIndex() && (index() == other.index())) { if (is_captured() == other.is_captured()) { @@ -725,7 +697,6 @@ bool LocalVariable::Equals(const LocalVariable& other) const { return false; } - int LocalVariable::BitIndexIn(intptr_t fixed_parameter_count) const { ASSERT(!is_captured()); // Parameters have positive indexes with the lowest index being @@ -741,5 +712,4 @@ int LocalVariable::BitIndexIn(intptr_t fixed_parameter_count) const { } } - } // namespace dart diff --git a/runtime/vm/scopes.h b/runtime/vm/scopes.h index 906603807e6..096b1d2db7c 100644 --- a/runtime/vm/scopes.h +++ b/runtime/vm/scopes.h @@ -18,7 +18,6 @@ namespace dart { class LocalScope; - class LocalVariable : public ZoneAllocated { public: LocalVariable(TokenPosition declaration_pos, @@ -132,7 +131,6 @@ class LocalVariable : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(LocalVariable); }; - class NameReference : public ZoneAllocated { public: NameReference(TokenPosition token_pos, const String& name) @@ -148,7 +146,6 @@ class NameReference : public ZoneAllocated { const String& name_; }; - class SourceLabel : public ZoneAllocated { public: enum Kind { @@ -199,7 +196,6 @@ class SourceLabel : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(SourceLabel); }; - class LocalScope : public ZoneAllocated { public: LocalScope(LocalScope* parent, int function_level, int loop_level); diff --git a/runtime/vm/scopes_test.cc b/runtime/vm/scopes_test.cc index f2171a569c7..4481b6c98ef 100644 --- a/runtime/vm/scopes_test.cc +++ b/runtime/vm/scopes_test.cc @@ -2,9 +2,9 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +#include "vm/scopes.h" #include "platform/assert.h" #include "vm/ast.h" -#include "vm/scopes.h" #include "vm/unit_test.h" namespace dart { diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc index 19ff7983b13..f528a642710 100644 --- a/runtime/vm/service.cc +++ b/runtime/vm/service.cc @@ -46,7 +46,6 @@ namespace dart { #define Z (T->zone()) - DECLARE_FLAG(bool, trace_service); DECLARE_FLAG(bool, trace_service_pause_events); DECLARE_FLAG(bool, profile_vm); @@ -68,7 +67,6 @@ DECLARE_FLAG(bool, show_kernel_isolate); // The name of this of this vm as reported by the VM service protocol. static char* vm_name = NULL; - static const char* GetVMName() { if (vm_name == NULL) { return FLAG_vm_name; @@ -76,27 +74,21 @@ static const char* GetVMName() { return vm_name; } - ServiceIdZone::ServiceIdZone() {} - ServiceIdZone::~ServiceIdZone() {} - RingServiceIdZone::RingServiceIdZone() : ring_(NULL), policy_(ObjectIdRing::kAllocateId) {} - RingServiceIdZone::~RingServiceIdZone() {} - void RingServiceIdZone::Init(ObjectIdRing* ring, ObjectIdRing::IdPolicy policy) { ring_ = ring; policy_ = policy; } - char* RingServiceIdZone::GetServiceId(const Object& obj) { ASSERT(ring_ != NULL); Thread* thread = Thread::Current(); @@ -106,14 +98,12 @@ char* RingServiceIdZone::GetServiceId(const Object& obj) { return zone->PrintToString("objects/%" Pd "", id); } - // TODO(johnmccutchan): Unify embedder service handler lists and their APIs. EmbedderServiceHandler* Service::isolate_service_handler_head_ = NULL; EmbedderServiceHandler* Service::root_service_handler_head_ = NULL; struct ServiceMethodDescriptor; const ServiceMethodDescriptor* FindMethod(const char* method_name); - // Support for streams defined in embedders. Dart_ServiceStreamListenCallback Service::stream_listen_callback_ = NULL; Dart_ServiceStreamCancelCallback Service::stream_cancel_callback_ = NULL; @@ -138,7 +128,6 @@ static StreamInfo* streams_[] = { &Service::logging_stream, &Service::extension_stream, &Service::timeline_stream, &Service::editor_stream}; - bool Service::ListenStream(const char* stream_id) { if (FLAG_trace_service) { OS::Print("vm-service: starting stream '%s'\n", stream_id); @@ -158,7 +147,6 @@ bool Service::ListenStream(const char* stream_id) { return false; } - void Service::CancelStream(const char* stream_id) { if (FLAG_trace_service) { OS::Print("vm-service: stopping stream '%s'\n", stream_id); @@ -212,7 +200,6 @@ RawObject* Service::RequestAssets() { return Api::UnwrapHandle(handle); } - static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { void* new_ptr = realloc(reinterpret_cast(ptr), new_size); if (new_ptr == NULL) { @@ -221,36 +208,30 @@ static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { return reinterpret_cast(new_ptr); } - static void PrintMissingParamError(JSONStream* js, const char* param) { js->PrintError(kInvalidParams, "%s expects the '%s' parameter", js->method(), param); } - static void PrintInvalidParamError(JSONStream* js, const char* param) { js->PrintError(kInvalidParams, "%s: invalid '%s' parameter: %s", js->method(), param, js->LookupParam(param)); } - static void PrintIllegalParamError(JSONStream* js, const char* param) { js->PrintError(kInvalidParams, "%s: illegal '%s' parameter: %s", js->method(), param, js->LookupParam(param)); } - static void PrintUnrecognizedMethodError(JSONStream* js) { js->PrintError(kMethodNotFound, NULL); } - static void PrintSuccess(JSONStream* js) { JSONObject jsobj(js); jsobj.AddProperty("type", "Success"); } - static bool GetIntegerId(const char* s, intptr_t* id, int base = 10) { if ((s == NULL) || (*s == '\0')) { // Empty string. @@ -271,7 +252,6 @@ static bool GetIntegerId(const char* s, intptr_t* id, int base = 10) { return true; } - static bool GetUnsignedIntegerId(const char* s, uintptr_t* id, int base = 10) { if ((s == NULL) || (*s == '\0')) { // Empty string. @@ -292,7 +272,6 @@ static bool GetUnsignedIntegerId(const char* s, uintptr_t* id, int base = 10) { return true; } - static bool GetInteger64Id(const char* s, int64_t* id, int base = 10) { if ((s == NULL) || (*s == '\0')) { // Empty string. @@ -313,7 +292,6 @@ static bool GetInteger64Id(const char* s, int64_t* id, int base = 10) { return true; } - // Scans the string until the '-' character. Returns pointer to string // at '-' character. Returns NULL if not found. static const char* ScanUntilDash(const char* s) { @@ -330,7 +308,6 @@ static const char* ScanUntilDash(const char* s) { return NULL; } - static bool GetCodeId(const char* s, int64_t* timestamp, uword* address) { if ((s == NULL) || (*s == '\0')) { // Empty string. @@ -357,7 +334,6 @@ static bool GetCodeId(const char* s, int64_t* timestamp, uword* address) { return true; } - // Verifies that |s| begins with |prefix| and then calls |GetIntegerId| on // the remainder of |s|. static bool GetPrefixedIntegerId(const char* s, @@ -382,7 +358,6 @@ static bool GetPrefixedIntegerId(const char* s, return GetIntegerId(s, service_id); } - static bool IsValidClassId(Isolate* isolate, intptr_t cid) { ASSERT(isolate != NULL); ClassTable* class_table = isolate->class_table(); @@ -390,7 +365,6 @@ static bool IsValidClassId(Isolate* isolate, intptr_t cid) { return class_table->IsValidIndex(cid) && class_table->HasValidClassAt(cid); } - static RawClass* GetClassForId(Isolate* isolate, intptr_t cid) { ASSERT(isolate == Isolate::Current()); ASSERT(isolate != NULL); @@ -399,7 +373,6 @@ static RawClass* GetClassForId(Isolate* isolate, intptr_t cid) { return class_table->At(cid); } - // TODO(johnmccutchan): Split into separate file and write unit tests. class MethodParameter { public: @@ -433,7 +406,6 @@ class MethodParameter { bool required_; }; - class DartStringParameter : public MethodParameter { public: DartStringParameter(const char* name, bool required) @@ -444,7 +416,6 @@ class DartStringParameter : public MethodParameter { } }; - class DartListParameter : public MethodParameter { public: DartListParameter(const char* name, bool required) @@ -455,7 +426,6 @@ class DartListParameter : public MethodParameter { } }; - class NoSuchParameter : public MethodParameter { public: explicit NoSuchParameter(const char* name) : MethodParameter(name, false) {} @@ -467,7 +437,6 @@ class NoSuchParameter : public MethodParameter { } }; - class BoolParameter : public MethodParameter { public: BoolParameter(const char* name, bool required) @@ -488,7 +457,6 @@ class BoolParameter : public MethodParameter { } }; - class UIntParameter : public MethodParameter { public: UIntParameter(const char* name, bool required) @@ -517,7 +485,6 @@ class UIntParameter : public MethodParameter { } }; - class Int64Parameter : public MethodParameter { public: Int64Parameter(const char* name, bool required) @@ -546,7 +513,6 @@ class Int64Parameter : public MethodParameter { } }; - class IdParameter : public MethodParameter { public: IdParameter(const char* name, bool required) @@ -555,7 +521,6 @@ class IdParameter : public MethodParameter { virtual bool Validate(const char* value) const { return (value != NULL); } }; - class StringParameter : public MethodParameter { public: StringParameter(const char* name, bool required) @@ -564,7 +529,6 @@ class StringParameter : public MethodParameter { virtual bool Validate(const char* value) const { return (value != NULL); } }; - class RunnableIsolateParameter : public MethodParameter { public: explicit RunnableIsolateParameter(const char* name) @@ -583,7 +547,6 @@ class RunnableIsolateParameter : public MethodParameter { } }; - #define ISOLATE_PARAMETER new IdParameter("isolateId", true) #define NO_ISOLATE_PARAMETER new NoSuchParameter("isolateId") #define RUNNABLE_ISOLATE_PARAMETER new RunnableIsolateParameter("isolateId") @@ -609,7 +572,6 @@ class EnumParameter : public MethodParameter { const char* const* enums_; }; - // If the key is not found, this function returns the last element in the // values array. This can be used to encode the default value. template @@ -625,7 +587,6 @@ T EnumMapper(const char* value, const char* const* enums, T* values) { return values[i]; } - class EnumListParameter : public MethodParameter { public: EnumListParameter(const char* name, bool required, const char* const* enums) @@ -740,17 +701,14 @@ class EnumListParameter : public MethodParameter { const char* const* enums_; }; - typedef bool (*ServiceMethodEntry)(Thread* thread, JSONStream* js); - struct ServiceMethodDescriptor { const char* name; const ServiceMethodEntry entry; const MethodParameter* const* parameters; }; - // TODO(johnmccutchan): Do we reject unexpected parameters? static bool ValidateParameters(const MethodParameter* const* parameters, JSONStream* js) { @@ -794,7 +752,6 @@ static bool ValidateParameters(const MethodParameter* const* parameters, return true; } - void Service::PostError(const String& method_name, const Array& parameter_keys, const Array& parameter_values, @@ -812,7 +769,6 @@ void Service::PostError(const String& method_name, js.PostReply(); } - RawError* Service::InvokeMethod(Isolate* I, const Array& msg, bool parameters_are_dart_objects) { @@ -924,33 +880,28 @@ RawError* Service::InvokeMethod(Isolate* I, } } - RawError* Service::HandleRootMessage(const Array& msg_instance) { Isolate* isolate = Isolate::Current(); return InvokeMethod(isolate, msg_instance); } - RawError* Service::HandleObjectRootMessage(const Array& msg_instance) { Isolate* isolate = Isolate::Current(); return InvokeMethod(isolate, msg_instance, true); } - RawError* Service::HandleIsolateMessage(Isolate* isolate, const Array& msg) { ASSERT(isolate != NULL); const Error& error = Error::Handle(InvokeMethod(isolate, msg)); return MaybePause(isolate, error); } - static void Finalizer(void* isolate_callback_data, Dart_WeakPersistentHandle handle, void* buffer) { free(buffer); } - void Service::SendEvent(const char* stream_id, const char* event_type, uint8_t* bytes, @@ -997,7 +948,6 @@ void Service::SendEvent(const char* stream_id, } } - void Service::SendEventWithData(const char* stream_id, const char* event_type, const char* metadata, @@ -1030,7 +980,6 @@ void Service::SendEventWithData(const char* stream_id, SendEvent(stream_id, event_type, message, total_bytes); } - static void ReportPauseOnConsole(ServiceEvent* event) { const char* name = event->isolate()->debugger_name(); switch (event->kind()) { @@ -1087,7 +1036,6 @@ static void ReportPauseOnConsole(ServiceEvent* event) { } } - void Service::HandleEvent(ServiceEvent* event) { if (event->stream_info() != NULL && !event->stream_info()->enabled()) { if (FLAG_warn_on_pause_with_no_debugger && event->IsPause()) { @@ -1115,7 +1063,6 @@ void Service::HandleEvent(ServiceEvent* event) { PostEvent(event->isolate(), stream_id, event->KindAsCString(), &js); } - void Service::PostEvent(Isolate* isolate, const char* stream_id, const char* kind, @@ -1159,7 +1106,6 @@ void Service::PostEvent(Isolate* isolate, Dart_PostCObject(ServiceIsolate::Port(), &list_cobj); } - class EmbedderServiceHandler { public: explicit EmbedderServiceHandler(const char* name) @@ -1190,7 +1136,6 @@ class EmbedderServiceHandler { EmbedderServiceHandler* next_; }; - void Service::EmbedderHandleMessage(EmbedderServiceHandler* handler, JSONStream* js) { ASSERT(handler != NULL); @@ -1212,7 +1157,6 @@ void Service::EmbedderHandleMessage(EmbedderServiceHandler* handler, free(const_cast(response)); } - void Service::RegisterIsolateEmbedderCallback( const char* name, Dart_ServiceRequestCallback callback, @@ -1237,7 +1181,6 @@ void Service::RegisterIsolateEmbedderCallback( isolate_service_handler_head_ = handler; } - EmbedderServiceHandler* Service::FindIsolateEmbedderHandler(const char* name) { EmbedderServiceHandler* current = isolate_service_handler_head_; while (current != NULL) { @@ -1249,7 +1192,6 @@ EmbedderServiceHandler* Service::FindIsolateEmbedderHandler(const char* name) { return NULL; } - void Service::RegisterRootEmbedderCallback(const char* name, Dart_ServiceRequestCallback callback, void* user_data) { @@ -1273,7 +1215,6 @@ void Service::RegisterRootEmbedderCallback(const char* name, root_service_handler_head_ = handler; } - void Service::SetEmbedderStreamCallbacks( Dart_ServiceStreamListenCallback listen_callback, Dart_ServiceStreamCancelCallback cancel_callback) { @@ -1281,13 +1222,11 @@ void Service::SetEmbedderStreamCallbacks( stream_cancel_callback_ = cancel_callback; } - void Service::SetGetServiceAssetsCallback( Dart_GetVMServiceAssetsArchive get_service_assets) { get_service_assets_callback_ = get_service_assets; } - EmbedderServiceHandler* Service::FindRootEmbedderHandler(const char* name) { EmbedderServiceHandler* current = root_service_handler_head_; while (current != NULL) { @@ -1299,7 +1238,6 @@ EmbedderServiceHandler* Service::FindRootEmbedderHandler(const char* name) { return NULL; } - void Service::ScheduleExtensionHandler(const Instance& handler, const String& method_name, const Array& parameter_keys, @@ -1317,23 +1255,19 @@ void Service::ScheduleExtensionHandler(const Instance& handler, parameter_values, reply_port, id); } - static const MethodParameter* get_isolate_params[] = { ISOLATE_PARAMETER, NULL, }; - static bool GetIsolate(Thread* thread, JSONStream* js) { thread->isolate()->PrintJSON(js, false); return true; } - static const MethodParameter* get_stack_params[] = { RUNNABLE_ISOLATE_PARAMETER, new BoolParameter("_full", false), NULL, }; - static bool GetStack(Thread* thread, JSONStream* js) { Isolate* isolate = thread->isolate(); if (isolate->debugger() == NULL) { @@ -1393,7 +1327,6 @@ static bool GetStack(Thread* thread, JSONStream* js) { return true; } - static bool HandleCommonEcho(JSONObject* jsobj, JSONStream* js) { jsobj->AddProperty("type", "_EchoResponse"); if (js->HasParam("text")) { @@ -1402,7 +1335,6 @@ static bool HandleCommonEcho(JSONObject* jsobj, JSONStream* js) { return true; } - void Service::SendEchoEvent(Isolate* isolate, const char* text) { JSONStream js; { @@ -1429,7 +1361,6 @@ void Service::SendEchoEvent(Isolate* isolate, const char* text) { js.buffer()->length(), data, sizeof(data)); } - static bool TriggerEchoEvent(Thread* thread, JSONStream* js) { if (Service::echo_stream.enabled()) { Service::SendEchoEvent(thread->isolate(), js->LookupParam("text")); @@ -1438,7 +1369,6 @@ static bool TriggerEchoEvent(Thread* thread, JSONStream* js) { return HandleCommonEcho(&jsobj, js); } - static bool DumpIdZone(Thread* thread, JSONStream* js) { // TODO(johnmccutchan): Respect _idZone parameter passed to RPC. For now, // always send the ObjectIdRing. @@ -1453,13 +1383,11 @@ static bool DumpIdZone(Thread* thread, JSONStream* js) { return true; } - static bool Echo(Thread* thread, JSONStream* js) { JSONObject jsobj(js); return HandleCommonEcho(&jsobj, js); } - static bool ContainsNonInstance(const Object& obj) { if (obj.IsArray()) { const Array& array = Array::Cast(obj); @@ -1486,7 +1414,6 @@ static bool ContainsNonInstance(const Object& obj) { } } - static RawObject* LookupObjectId(Thread* thread, const char* arg, ObjectIdRing::LookupResult* kind) { @@ -1519,7 +1446,6 @@ static RawObject* LookupObjectId(Thread* thread, return ring->GetObjectForId(id, kind); } - static RawObject* LookupHeapObjectLibraries(Isolate* isolate, char** parts, int num_parts) { @@ -1708,7 +1634,6 @@ static RawObject* LookupHeapObjectClasses(Thread* thread, return Object::sentinel().raw(); } - static RawObject* LookupHeapObjectTypeArguments(Thread* thread, char** parts, int num_parts) { @@ -1732,7 +1657,6 @@ static RawObject* LookupHeapObjectTypeArguments(Thread* thread, return table.At(id); } - static RawObject* LookupHeapObjectCode(Isolate* isolate, char** parts, int num_parts) { @@ -1781,7 +1705,6 @@ static RawObject* LookupHeapObjectCode(Isolate* isolate, return Object::sentinel().raw(); } - static RawObject* LookupHeapObjectMessage(Thread* thread, char** parts, int num_parts) { @@ -1806,7 +1729,6 @@ static RawObject* LookupHeapObjectMessage(Thread* thread, } } - static RawObject* LookupHeapObject(Thread* thread, const char* id_original, ObjectIdRing::LookupResult* result) { @@ -1868,14 +1790,12 @@ static RawObject* LookupHeapObject(Thread* thread, return Object::sentinel().raw(); } - enum SentinelType { kCollectedSentinel, kExpiredSentinel, kFreeSentinel, }; - static void PrintSentinel(JSONStream* js, SentinelType sentinel_type) { JSONObject jsobj(js); jsobj.AddProperty("type", "Sentinel"); @@ -1898,7 +1818,6 @@ static void PrintSentinel(JSONStream* js, SentinelType sentinel_type) { } } - static Breakpoint* LookupBreakpoint(Isolate* isolate, const char* id, ObjectIdRing::LookupResult* result) { @@ -1926,7 +1845,6 @@ static Breakpoint* LookupBreakpoint(Isolate* isolate, return NULL; } - static bool PrintInboundReferences(Thread* thread, Object* target, intptr_t limit, @@ -1979,12 +1897,10 @@ static bool PrintInboundReferences(Thread* thread, return true; } - static const MethodParameter* get_inbound_references_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; - static bool GetInboundReferences(Thread* thread, JSONStream* js) { const char* target_id = js->LookupParam("targetId"); if (target_id == NULL) { @@ -2021,7 +1937,6 @@ static bool GetInboundReferences(Thread* thread, JSONStream* js) { return PrintInboundReferences(thread, &obj, limit, js); } - static bool PrintRetainingPath(Thread* thread, Object* obj, intptr_t limit, @@ -2093,12 +2008,10 @@ static bool PrintRetainingPath(Thread* thread, return true; } - static const MethodParameter* get_retaining_path_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; - static bool GetRetainingPath(Thread* thread, JSONStream* js) { const char* target_id = js->LookupParam("targetId"); if (target_id == NULL) { @@ -2135,12 +2048,10 @@ static bool GetRetainingPath(Thread* thread, JSONStream* js) { return PrintRetainingPath(thread, &obj, limit, js); } - static const MethodParameter* get_retained_size_params[] = { RUNNABLE_ISOLATE_PARAMETER, new IdParameter("targetId", true), NULL, }; - static bool GetRetainedSize(Thread* thread, JSONStream* js) { const char* target_id = js->LookupParam("targetId"); ASSERT(target_id != NULL); @@ -2175,12 +2086,10 @@ static bool GetRetainedSize(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* get_reachable_size_params[] = { RUNNABLE_ISOLATE_PARAMETER, new IdParameter("targetId", true), NULL, }; - static bool GetReachableSize(Thread* thread, JSONStream* js) { const char* target_id = js->LookupParam("targetId"); ASSERT(target_id != NULL); @@ -2215,12 +2124,10 @@ static bool GetReachableSize(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* evaluate_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; - static bool IsAlpha(char c) { return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'); } @@ -2234,7 +2141,6 @@ static bool IsObjectIdChar(char c) { return IsAlphaNum(c) || c == '/' || c == '-' || c == '@' || c == '%'; } - // TODO(vm-service): Consider whether we should pass structured objects in // service messages instead of always flattening them to C strings. static bool ParseScope(const char* scope, @@ -2284,7 +2190,6 @@ static bool ParseScope(const char* scope, return false; } - static bool BuildScope(Thread* thread, JSONStream* js, const GrowableObjectArray& names, @@ -2327,7 +2232,6 @@ static bool BuildScope(Thread* thread, return false; } - static bool Evaluate(Thread* thread, JSONStream* js) { if (!thread->isolate()->compilation_allowed()) { js->PrintError(kFeatureDisabled, @@ -2403,13 +2307,11 @@ static bool Evaluate(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* evaluate_in_frame_params[] = { RUNNABLE_ISOLATE_PARAMETER, new UIntParameter("frameIndex", true), new MethodParameter("expression", true), NULL, }; - static bool EvaluateInFrame(Thread* thread, JSONStream* js) { Isolate* isolate = thread->isolate(); if (!isolate->compilation_allowed()) { @@ -2443,7 +2345,6 @@ static bool EvaluateInFrame(Thread* thread, JSONStream* js) { return true; } - class GetInstancesVisitor : public ObjectGraph::Visitor { public: GetInstancesVisitor(const Class& cls, const Array& storage) @@ -2475,12 +2376,10 @@ class GetInstancesVisitor : public ObjectGraph::Visitor { intptr_t count_; }; - static const MethodParameter* get_instances_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; - static bool GetInstances(Thread* thread, JSONStream* js) { const char* target_id = js->LookupParam("classId"); if (target_id == NULL) { @@ -2530,7 +2429,6 @@ static bool GetInstances(Thread* thread, JSONStream* js) { return true; } - static const char* const report_enum_names[] = { SourceReport::kCallSitesStr, SourceReport::kCoverageStr, @@ -2539,7 +2437,6 @@ static const char* const report_enum_names[] = { NULL, }; - static const MethodParameter* get_source_report_params[] = { RUNNABLE_ISOLATE_PARAMETER, new EnumListParameter("reports", true, report_enum_names), @@ -2550,7 +2447,6 @@ static const MethodParameter* get_source_report_params[] = { NULL, }; - static bool GetSourceReport(Thread* thread, JSONStream* js) { if (!thread->isolate()->compilation_allowed()) { js->PrintError( @@ -2617,7 +2513,6 @@ static bool GetSourceReport(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* reload_sources_params[] = { RUNNABLE_ISOLATE_PARAMETER, new BoolParameter("force", false), @@ -2627,7 +2522,6 @@ static const MethodParameter* reload_sources_params[] = { NULL, }; - static bool ReloadSources(Thread* thread, JSONStream* js) { Isolate* isolate = thread->isolate(); if (!isolate->compilation_allowed()) { @@ -2668,14 +2562,12 @@ static bool ReloadSources(Thread* thread, JSONStream* js) { return true; } - void Service::CheckForPause(Isolate* isolate, JSONStream* stream) { // Should we pause? isolate->set_should_pause_post_service_request( BoolParameter::Parse(stream->LookupParam("pause"), false)); } - RawError* Service::MaybePause(Isolate* isolate, const Error& error) { // Don't pause twice. if (!isolate->IsPaused()) { @@ -2692,7 +2584,6 @@ RawError* Service::MaybePause(Isolate* isolate, const Error& error) { return error.raw(); } - static bool AddBreakpointCommon(Thread* thread, JSONStream* js, const String& script_uri) { @@ -2728,7 +2619,6 @@ static bool AddBreakpointCommon(Thread* thread, return true; } - static const MethodParameter* add_breakpoint_params[] = { RUNNABLE_ISOLATE_PARAMETER, new IdParameter("scriptId", true), @@ -2737,7 +2627,6 @@ static const MethodParameter* add_breakpoint_params[] = { NULL, }; - static bool AddBreakpoint(Thread* thread, JSONStream* js) { if (!thread->isolate()->compilation_allowed()) { js->PrintError( @@ -2757,7 +2646,6 @@ static bool AddBreakpoint(Thread* thread, JSONStream* js) { return AddBreakpointCommon(thread, js, script_uri); } - static const MethodParameter* add_breakpoint_with_script_uri_params[] = { RUNNABLE_ISOLATE_PARAMETER, new IdParameter("scriptUri", true), @@ -2766,7 +2654,6 @@ static const MethodParameter* add_breakpoint_with_script_uri_params[] = { NULL, }; - static bool AddBreakpointWithScriptUri(Thread* thread, JSONStream* js) { if (!thread->isolate()->compilation_allowed()) { js->PrintError( @@ -2779,12 +2666,10 @@ static bool AddBreakpointWithScriptUri(Thread* thread, JSONStream* js) { return AddBreakpointCommon(thread, js, script_uri); } - static const MethodParameter* add_breakpoint_at_entry_params[] = { RUNNABLE_ISOLATE_PARAMETER, new IdParameter("functionId", true), NULL, }; - static bool AddBreakpointAtEntry(Thread* thread, JSONStream* js) { if (!thread->isolate()->compilation_allowed()) { js->PrintError( @@ -2811,12 +2696,10 @@ static bool AddBreakpointAtEntry(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* add_breakpoint_at_activation_params[] = { RUNNABLE_ISOLATE_PARAMETER, new IdParameter("objectId", true), NULL, }; - static bool AddBreakpointAtActivation(Thread* thread, JSONStream* js) { if (!thread->isolate()->compilation_allowed()) { js->PrintError( @@ -2842,12 +2725,10 @@ static bool AddBreakpointAtActivation(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* remove_breakpoint_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; - static bool RemoveBreakpoint(Thread* thread, JSONStream* js) { if (!thread->isolate()->compilation_allowed()) { js->PrintError( @@ -2874,7 +2755,6 @@ static bool RemoveBreakpoint(Thread* thread, JSONStream* js) { return true; } - static RawClass* GetMetricsClass(Thread* thread) { Zone* zone = thread->zone(); const Library& prof_lib = Library::Handle(zone, Library::DeveloperLibrary()); @@ -2887,7 +2767,6 @@ static RawClass* GetMetricsClass(Thread* thread) { return metrics_cls.raw(); } - static bool HandleNativeMetricsList(Thread* thread, JSONStream* js) { JSONObject obj(js); obj.AddProperty("type", "MetricList"); @@ -2902,7 +2781,6 @@ static bool HandleNativeMetricsList(Thread* thread, JSONStream* js) { return true; } - static bool HandleNativeMetric(Thread* thread, JSONStream* js, const char* id) { Metric* current = thread->isolate()->metrics_list_head(); while (current != NULL) { @@ -2918,7 +2796,6 @@ static bool HandleNativeMetric(Thread* thread, JSONStream* js, const char* id) { return true; } - static bool HandleDartMetricsList(Thread* thread, JSONStream* js) { Zone* zone = thread->zone(); const Class& metrics_cls = Class::Handle(zone, GetMetricsClass(thread)); @@ -2938,7 +2815,6 @@ static bool HandleDartMetricsList(Thread* thread, JSONStream* js) { return true; } - static bool HandleDartMetric(Thread* thread, JSONStream* js, const char* id) { Zone* zone = thread->zone(); const Class& metrics_cls = Class::Handle(zone, GetMetricsClass(thread)); @@ -2964,12 +2840,10 @@ static bool HandleDartMetric(Thread* thread, JSONStream* js, const char* id) { return true; } - static const MethodParameter* get_isolate_metric_list_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; - static bool GetIsolateMetricList(Thread* thread, JSONStream* js) { bool native_metrics = false; if (js->HasParam("type")) { @@ -2991,12 +2865,10 @@ static bool GetIsolateMetricList(Thread* thread, JSONStream* js) { return HandleDartMetricsList(thread, js); } - static const MethodParameter* get_isolate_metric_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; - static bool GetIsolateMetric(Thread* thread, JSONStream* js) { const char* metric_id = js->LookupParam("metricId"); if (metric_id == NULL) { @@ -3023,22 +2895,18 @@ static bool GetIsolateMetric(Thread* thread, JSONStream* js) { return HandleDartMetric(thread, js, id); } - static const MethodParameter* get_vm_metric_list_params[] = { NO_ISOLATE_PARAMETER, NULL, }; - static bool GetVMMetricList(Thread* thread, JSONStream* js) { return false; } - static const MethodParameter* get_vm_metric_params[] = { NO_ISOLATE_PARAMETER, NULL, }; - static bool GetVMMetric(Thread* thread, JSONStream* js) { const char* metric_id = js->LookupParam("metricId"); if (metric_id == NULL) { @@ -3062,7 +2930,6 @@ static const MethodParameter* set_vm_timeline_flags_params[] = { NULL, }; - static bool HasStream(const char** recorded_streams, const char* stream) { while (*recorded_streams != NULL) { if ((strstr(*recorded_streams, "all") != NULL) || @@ -3074,7 +2941,6 @@ static bool HasStream(const char** recorded_streams, const char* stream) { return false; } - static bool SetVMTimelineFlags(Thread* thread, JSONStream* js) { if (!FLAG_support_timeline) { PrintSuccess(js); @@ -3101,12 +2967,10 @@ static bool SetVMTimelineFlags(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* get_vm_timeline_flags_params[] = { NO_ISOLATE_PARAMETER, NULL, }; - static bool GetVMTimelineFlags(Thread* thread, JSONStream* js) { if (!FLAG_support_timeline) { JSONObject obj(js); @@ -3120,12 +2984,10 @@ static bool GetVMTimelineFlags(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* clear_vm_timeline_params[] = { NO_ISOLATE_PARAMETER, NULL, }; - static bool ClearVMTimeline(Thread* thread, JSONStream* js) { Isolate* isolate = thread->isolate(); ASSERT(isolate != NULL); @@ -3138,13 +3000,11 @@ static bool ClearVMTimeline(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* get_vm_timeline_params[] = { NO_ISOLATE_PARAMETER, new Int64Parameter("timeOriginMicros", false), new Int64Parameter("timeExtentMicros", false), NULL, }; - static bool GetVMTimeline(Thread* thread, JSONStream* js) { Isolate* isolate = thread->isolate(); ASSERT(isolate != NULL); @@ -3162,12 +3022,10 @@ static bool GetVMTimeline(Thread* thread, JSONStream* js) { return true; } - static const char* const step_enum_names[] = { "None", "Into", "Over", "Out", "Rewind", "OverAsyncSuspension", NULL, }; - static const Debugger::ResumeAction step_enum_values[] = { Debugger::kContinue, Debugger::kStepInto, Debugger::kStepOver, Debugger::kStepOut, @@ -3175,14 +3033,12 @@ static const Debugger::ResumeAction step_enum_values[] = { Debugger::kContinue, // Default value }; - static const MethodParameter* resume_params[] = { RUNNABLE_ISOLATE_PARAMETER, new EnumParameter("step", false, step_enum_names), new UIntParameter("frameIndex", false), NULL, }; - static bool Resume(Thread* thread, JSONStream* js) { const char* step_param = js->LookupParam("step"); Debugger::ResumeAction step = Debugger::kContinue; @@ -3250,12 +3106,10 @@ static bool Resume(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* pause_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; - static bool Pause(Thread* thread, JSONStream* js) { // TODO(turnidge): This interrupt message could have been sent from // the service isolate directly, but would require some special case @@ -3268,12 +3122,10 @@ static bool Pause(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* get_tag_profile_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; - static bool GetTagProfile(Thread* thread, JSONStream* js) { JSONObject miniProfile(js); miniProfile.AddProperty("type", "TagProfile"); @@ -3281,19 +3133,16 @@ static bool GetTagProfile(Thread* thread, JSONStream* js) { return true; } - static const char* const tags_enum_names[] = { "None", "UserVM", "UserOnly", "VMUser", "VMOnly", NULL, }; - static const Profile::TagOrder tags_enum_values[] = { Profile::kNoTags, Profile::kUserVM, Profile::kUser, Profile::kVMUser, Profile::kVM, Profile::kNoTags, // Default value. }; - static const MethodParameter* get_cpu_profile_params[] = { RUNNABLE_ISOLATE_PARAMETER, new EnumParameter("tags", true, tags_enum_names), @@ -3303,7 +3152,6 @@ static const MethodParameter* get_cpu_profile_params[] = { NULL, }; - // TODO(johnmccutchan): Rename this to GetCpuSamples. static bool GetCpuProfile(Thread* thread, JSONStream* js) { Profile::TagOrder tag_order = @@ -3321,7 +3169,6 @@ static bool GetCpuProfile(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* get_cpu_profile_timeline_params[] = { RUNNABLE_ISOLATE_PARAMETER, new EnumParameter("tags", true, tags_enum_names), @@ -3330,7 +3177,6 @@ static const MethodParameter* get_cpu_profile_timeline_params[] = { NULL, }; - static bool GetCpuProfileTimeline(Thread* thread, JSONStream* js) { Profile::TagOrder tag_order = EnumMapper(js->LookupParam("tags"), tags_enum_names, tags_enum_values); @@ -3343,7 +3189,6 @@ static bool GetCpuProfileTimeline(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* get_allocation_samples_params[] = { RUNNABLE_ISOLATE_PARAMETER, new EnumParameter("tags", true, tags_enum_names), @@ -3353,7 +3198,6 @@ static const MethodParameter* get_allocation_samples_params[] = { NULL, }; - static bool GetAllocationSamples(Thread* thread, JSONStream* js) { Profile::TagOrder tag_order = EnumMapper(js->LookupParam("tags"), tags_enum_names, tags_enum_values); @@ -3375,7 +3219,6 @@ static bool GetAllocationSamples(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* get_native_allocation_samples_params[] = { NO_ISOLATE_PARAMETER, new EnumParameter("tags", true, tags_enum_names), @@ -3384,7 +3227,6 @@ static const MethodParameter* get_native_allocation_samples_params[] = { NULL, }; - static bool GetNativeAllocationSamples(Thread* thread, JSONStream* js) { Profile::TagOrder tag_order = EnumMapper(js->LookupParam("tags"), tags_enum_names, tags_enum_values); @@ -3400,24 +3242,20 @@ static bool GetNativeAllocationSamples(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* clear_cpu_profile_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; - static bool ClearCpuProfile(Thread* thread, JSONStream* js) { ProfilerService::ClearSamples(); PrintSuccess(js); return true; } - static const MethodParameter* get_allocation_profile_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; - static bool GetAllocationProfile(Thread* thread, JSONStream* js) { bool should_reset_accumulator = false; bool should_collect = false; @@ -3450,7 +3288,6 @@ static bool GetAllocationProfile(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* collect_all_garbage_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -3469,12 +3306,10 @@ static bool CollectAllGarbage(Thread* thread, JSONStream* js) { } #endif // defined(DEBUG) - static const MethodParameter* get_heap_map_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; - static bool GetHeapMap(Thread* thread, JSONStream* js) { Isolate* isolate = thread->isolate(); bool should_collect = false; @@ -3493,24 +3328,20 @@ static bool GetHeapMap(Thread* thread, JSONStream* js) { return true; } - static const char* snapshot_roots_names[] = { "User", "VM", NULL, }; - static ObjectGraph::SnapshotRoots snapshot_roots_values[] = { ObjectGraph::kUser, ObjectGraph::kVM, }; - static const MethodParameter* request_heap_snapshot_params[] = { RUNNABLE_ISOLATE_PARAMETER, new EnumParameter("roots", false /* not required */, snapshot_roots_names), new BoolParameter("collectGarbage", false /* not required */), NULL, }; - static bool RequestHeapSnapshot(Thread* thread, JSONStream* js) { ObjectGraph::SnapshotRoots roots = ObjectGraph::kVM; const char* roots_arg = js->LookupParam("roots"); @@ -3527,7 +3358,6 @@ static bool RequestHeapSnapshot(Thread* thread, JSONStream* js) { return true; } - void Service::SendGraphEvent(Thread* thread, ObjectGraph::SnapshotRoots roots, bool collect_garbage) { @@ -3574,7 +3404,6 @@ void Service::SendGraphEvent(Thread* thread, } } - void Service::SendInspectEvent(Isolate* isolate, const Object& inspectee) { if (!Service::debug_stream.enabled()) { return; @@ -3584,7 +3413,6 @@ void Service::SendInspectEvent(Isolate* isolate, const Object& inspectee) { Service::HandleEvent(&event); } - void Service::SendEmbedderEvent(Isolate* isolate, const char* stream_id, const char* event_kind, @@ -3600,7 +3428,6 @@ void Service::SendEmbedderEvent(Isolate* isolate, Service::HandleEvent(&event); } - void Service::SendLogEvent(Isolate* isolate, int64_t sequence_number, int64_t timestamp, @@ -3627,7 +3454,6 @@ void Service::SendLogEvent(Isolate* isolate, Service::HandleEvent(&event); } - void Service::SendExtensionEvent(Isolate* isolate, const String& event_kind, const String& event_data) { @@ -3642,7 +3468,6 @@ void Service::SendExtensionEvent(Isolate* isolate, Service::HandleEvent(&event); } - class ContainsAddressVisitor : public FindObjectVisitor { public: explicit ContainsAddressVisitor(uword addr) : addr_(addr) {} @@ -3663,12 +3488,10 @@ class ContainsAddressVisitor : public FindObjectVisitor { uword addr_; }; - static const MethodParameter* get_object_by_address_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; - static RawObject* GetObjectHelper(Thread* thread, uword addr) { Object& object = Object::Handle(thread->zone()); @@ -3692,7 +3515,6 @@ static RawObject* GetObjectHelper(Thread* thread, uword addr) { return object.raw(); } - static bool GetObjectByAddress(Thread* thread, JSONStream* js) { const char* addr_str = js->LookupParam("address"); if (addr_str == NULL) { @@ -3717,12 +3539,10 @@ static bool GetObjectByAddress(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* get_persistent_handles_params[] = { ISOLATE_PARAMETER, NULL, }; - template class PersistentHandleVisitor : public HandleVisitor { public: @@ -3773,7 +3593,6 @@ class PersistentHandleVisitor : public HandleVisitor { JSONArray* handles_; }; - static bool GetPersistentHandles(Thread* thread, JSONStream* js) { Isolate* isolate = thread->isolate(); ASSERT(isolate != NULL); @@ -3806,19 +3625,16 @@ static bool GetPersistentHandles(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* get_ports_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; - static bool GetPorts(Thread* thread, JSONStream* js) { MessageHandler* message_handler = thread->isolate()->message_handler(); PortMap::PrintPortsForMessageHandler(message_handler, js); return true; } - static bool RespondWithMalformedJson(Thread* thread, JSONStream* js) { JSONObject jsobj(js); jsobj.AddProperty("a", "a"); @@ -3831,20 +3647,17 @@ static bool RespondWithMalformedJson(Thread* thread, JSONStream* js) { return true; } - static bool RespondWithMalformedObject(Thread* thread, JSONStream* js) { JSONObject jsobj(js); jsobj.AddProperty("bart", "simpson"); return true; } - static const MethodParameter* get_object_params[] = { RUNNABLE_ISOLATE_PARAMETER, new UIntParameter("offset", false), new UIntParameter("count", false), NULL, }; - static bool GetObject(Thread* thread, JSONStream* js) { const char* id = js->LookupParam("objectId"); if (id == NULL) { @@ -3898,24 +3711,20 @@ static bool GetObject(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* get_object_store_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; - static bool GetObjectStore(Thread* thread, JSONStream* js) { JSONObject jsobj(js); thread->isolate()->object_store()->PrintToJSONObject(&jsobj); return true; } - static const MethodParameter* get_class_list_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; - static bool GetClassList(Thread* thread, JSONStream* js) { ClassTable* table = thread->isolate()->class_table(); JSONObject jsobj(js); @@ -3923,12 +3732,10 @@ static bool GetClassList(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* get_type_arguments_list_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; - static bool GetTypeArgumentsList(Thread* thread, JSONStream* js) { bool only_with_instantiations = false; if (js->ParamIs("onlyWithInstantiations", "true")) { @@ -3961,12 +3768,10 @@ static bool GetTypeArgumentsList(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* get_version_params[] = { NO_ISOLATE_PARAMETER, NULL, }; - static bool GetVersion(Thread* thread, JSONStream* js) { JSONObject jsobj(js); jsobj.AddProperty("type", "Version"); @@ -3979,7 +3784,6 @@ static bool GetVersion(Thread* thread, JSONStream* js) { return true; } - class ServiceIsolateVisitor : public IsolateVisitor { public: explicit ServiceIsolateVisitor(JSONArray* jsarr) : jsarr_(jsarr) {} @@ -4000,12 +3804,10 @@ class ServiceIsolateVisitor : public IsolateVisitor { JSONArray* jsarr_; }; - static const MethodParameter* get_vm_params[] = { NO_ISOLATE_PARAMETER, NULL, }; - void Service::PrintJSONForVM(JSONStream* js, bool ref) { JSONObject jsobj(js); jsobj.AddProperty("type", (ref ? "@VM" : "VM")); @@ -4033,30 +3835,25 @@ void Service::PrintJSONForVM(JSONStream* js, bool ref) { } } - static bool GetVM(Thread* thread, JSONStream* js) { Service::PrintJSONForVM(js, false); return true; } - static const char* exception_pause_mode_names[] = { "All", "None", "Unhandled", NULL, }; - static Dart_ExceptionPauseInfo exception_pause_mode_values[] = { kPauseOnAllExceptions, kNoPauseOnExceptions, kPauseOnUnhandledExceptions, kInvalidExceptionPauseInfo, }; - static const MethodParameter* set_exception_pause_mode_params[] = { ISOLATE_PARAMETER, new EnumParameter("mode", true, exception_pause_mode_names), NULL, }; - static bool SetExceptionPauseMode(Thread* thread, JSONStream* js) { const char* mode = js->LookupParam("mode"); if (mode == NULL) { @@ -4079,23 +3876,19 @@ static bool SetExceptionPauseMode(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* get_flag_list_params[] = { NO_ISOLATE_PARAMETER, NULL, }; - static bool GetFlagList(Thread* thread, JSONStream* js) { Flags::PrintJSON(js); return true; } - static const MethodParameter* set_flags_params[] = { NO_ISOLATE_PARAMETER, NULL, }; - static bool SetFlag(Thread* thread, JSONStream* js) { const char* flag_name = js->LookupParam("name"); if (flag_name == NULL) { @@ -4119,13 +3912,11 @@ static bool SetFlag(Thread* thread, JSONStream* js) { } } - static const MethodParameter* set_library_debuggable_params[] = { RUNNABLE_ISOLATE_PARAMETER, new IdParameter("libraryId", true), new BoolParameter("isDebuggable", true), NULL, }; - static bool SetLibraryDebuggable(Thread* thread, JSONStream* js) { const char* lib_id = js->LookupParam("libraryId"); ObjectIdRing::LookupResult lookup_result; @@ -4150,12 +3941,10 @@ static bool SetLibraryDebuggable(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* set_name_params[] = { ISOLATE_PARAMETER, new MethodParameter("name", true), NULL, }; - static bool SetName(Thread* thread, JSONStream* js) { Isolate* isolate = thread->isolate(); isolate->set_debugger_name(js->LookupParam("name")); @@ -4167,12 +3956,10 @@ static bool SetName(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* set_vm_name_params[] = { NO_ISOLATE_PARAMETER, new MethodParameter("name", true), NULL, }; - static bool SetVMName(Thread* thread, JSONStream* js) { const char* name_param = js->LookupParam("name"); free(vm_name); @@ -4185,13 +3972,11 @@ static bool SetVMName(Thread* thread, JSONStream* js) { return true; } - static const MethodParameter* set_trace_class_allocation_params[] = { RUNNABLE_ISOLATE_PARAMETER, new IdParameter("classId", true), new BoolParameter("enable", true), NULL, }; - static bool SetTraceClassAllocation(Thread* thread, JSONStream* js) { if (!thread->isolate()->compilation_allowed()) { js->PrintError( @@ -4251,7 +4036,6 @@ static bool SendObjectToEditor(Thread* thread, JSONStream* js) { return true; } - // clang-format off static const ServiceMethodDescriptor service_methods_[] = { { "_dumpIdZone", DumpIdZone, NULL }, diff --git a/runtime/vm/service.h b/runtime/vm/service.h index e7a9430e430..e2761dd919b 100644 --- a/runtime/vm/service.h +++ b/runtime/vm/service.h @@ -63,7 +63,6 @@ class RingServiceIdZone : public ServiceIdZone { ObjectIdRing::IdPolicy policy_; }; - class StreamInfo { public: explicit StreamInfo(const char* id) : id_(id), enabled_(false) {} @@ -78,7 +77,6 @@ class StreamInfo { bool enabled_; }; - class Service : public AllStatic { public: // Handles a message which is not directed to an isolate. diff --git a/runtime/vm/service_event.cc b/runtime/vm/service_event.cc index 336d1594112..f21d8d6d30b 100644 --- a/runtime/vm/service_event.cc +++ b/runtime/vm/service_event.cc @@ -49,12 +49,10 @@ ServiceEvent::ServiceEvent(Isolate* isolate, EventKind event_kind) } } - void ServiceEvent::UpdateTimestamp() { timestamp_ = OS::GetCurrentTimeMillis(); } - const char* ServiceEvent::KindAsCString() const { switch (kind()) { case kVMUpdate: @@ -119,7 +117,6 @@ const char* ServiceEvent::KindAsCString() const { } } - const StreamInfo* ServiceEvent::stream_info() const { switch (kind()) { case kVMUpdate: @@ -173,7 +170,6 @@ const StreamInfo* ServiceEvent::stream_info() const { } } - const char* ServiceEvent::stream_id() const { const StreamInfo* stream = stream_info(); if (stream == NULL) { @@ -184,7 +180,6 @@ const char* ServiceEvent::stream_id() const { } } - void ServiceEvent::PrintJSON(JSONStream* js) const { JSONObject jsobj(js); PrintJSONHeader(&jsobj); @@ -275,7 +270,6 @@ void ServiceEvent::PrintJSON(JSONStream* js) const { } } - void ServiceEvent::PrintJSONHeader(JSONObject* jsobj) const { ASSERT(jsobj != NULL); jsobj->AddProperty("type", "Event"); diff --git a/runtime/vm/service_isolate.cc b/runtime/vm/service_isolate.cc index 0cb3cd25c11..6ceeddfcd7b 100644 --- a/runtime/vm/service_isolate.cc +++ b/runtime/vm/service_isolate.cc @@ -11,8 +11,8 @@ #include "vm/lockers.h" #include "vm/message.h" #include "vm/message_handler.h" -#include "vm/native_entry.h" #include "vm/native_arguments.h" +#include "vm/native_entry.h" #include "vm/object.h" #include "vm/object_store.h" #include "vm/port.h" @@ -25,7 +25,6 @@ namespace dart { #define Z (T->zone()) - DEFINE_FLAG(bool, trace_service, false, "Trace VM service requests."); DEFINE_FLAG(bool, trace_service_pause_events, @@ -47,7 +46,6 @@ static void malloc_deallocator(uint8_t* ptr) { free(reinterpret_cast(ptr)); } - // These must be kept in sync with service/constants.dart #define VM_SERVICE_ISOLATE_EXIT_MESSAGE_ID 0 #define VM_SERVICE_ISOLATE_STARTUP_MESSAGE_ID 1 @@ -71,7 +69,6 @@ static RawArray* MakeServiceControlMessage(Dart_Port port_id, return list.raw(); } - static RawArray* MakeServerControlMessage(const SendPort& sp, intptr_t code, bool enable = false) { @@ -83,7 +80,6 @@ static RawArray* MakeServerControlMessage(const SendPort& sp, return list.raw(); } - static RawArray* MakeServiceExitMessage() { const Array& list = Array::Handle(Array::New(1)); ASSERT(!list.IsNull()); @@ -93,7 +89,6 @@ static RawArray* MakeServiceExitMessage() { return list.raw(); } - const char* ServiceIsolate::kName = "vm-service"; Isolate* ServiceIsolate::isolate_ = NULL; Dart_Port ServiceIsolate::port_ = ILLEGAL_PORT; @@ -118,7 +113,6 @@ void ServiceIsolate::RequestServerInfo(const SendPort& sp) { PortMap::PostMessage(new Message(port_, data, len, Message::kNormalPriority)); } - void ServiceIsolate::ControlWebServer(const SendPort& sp, bool enable) { const Array& message = Array::Handle(MakeServerControlMessage( sp, VM_SERVICE_WEB_SERVER_CONTROL_MESSAGE_ID, enable)); @@ -130,7 +124,6 @@ void ServiceIsolate::ControlWebServer(const SendPort& sp, bool enable) { PortMap::PostMessage(new Message(port_, data, len, Message::kNormalPriority)); } - void ServiceIsolate::SetServerAddress(const char* address) { if (server_address_ != NULL) { free(server_address_); @@ -142,43 +135,36 @@ void ServiceIsolate::SetServerAddress(const char* address) { server_address_ = strdup(address); } - bool ServiceIsolate::NameEquals(const char* name) { ASSERT(name != NULL); return strcmp(name, kName) == 0; } - bool ServiceIsolate::Exists() { MonitorLocker ml(monitor_); return isolate_ != NULL; } - bool ServiceIsolate::IsRunning() { MonitorLocker ml(monitor_); return (port_ != ILLEGAL_PORT) && (isolate_ != NULL); } - bool ServiceIsolate::IsServiceIsolate(const Isolate* isolate) { MonitorLocker ml(monitor_); return isolate == isolate_; } - bool ServiceIsolate::IsServiceIsolateDescendant(const Isolate* isolate) { MonitorLocker ml(monitor_); return isolate->origin_id() == origin_; } - Dart_Port ServiceIsolate::Port() { MonitorLocker ml(monitor_); return port_; } - Dart_Port ServiceIsolate::WaitForLoadPort() { MonitorLocker ml(monitor_); while (initializing_ && (load_port_ == ILLEGAL_PORT)) { @@ -187,13 +173,11 @@ Dart_Port ServiceIsolate::WaitForLoadPort() { return load_port_; } - Dart_Port ServiceIsolate::LoadPort() { MonitorLocker ml(monitor_); return load_port_; } - bool ServiceIsolate::SendIsolateStartupMessage() { if (!IsRunning()) { return false; @@ -222,7 +206,6 @@ bool ServiceIsolate::SendIsolateStartupMessage() { new Message(port_, data, len, Message::kNormalPriority)); } - bool ServiceIsolate::SendIsolateShutdownMessage() { if (!IsRunning()) { return false; @@ -251,7 +234,6 @@ bool ServiceIsolate::SendIsolateShutdownMessage() { new Message(port_, data, len, Message::kNormalPriority)); } - void ServiceIsolate::SendServiceExitMessage() { if (!IsRunning()) { return; @@ -266,13 +248,11 @@ void ServiceIsolate::SendServiceExitMessage() { Message::kNormalPriority)); } - void ServiceIsolate::SetServicePort(Dart_Port port) { MonitorLocker ml(monitor_); port_ = port; } - void ServiceIsolate::SetServiceIsolate(Isolate* isolate) { MonitorLocker ml(monitor_); isolate_ = isolate; @@ -287,7 +267,6 @@ void ServiceIsolate::SetLoadPort(Dart_Port port) { load_port_ = port; } - void ServiceIsolate::MaybeMakeServiceIsolate(Isolate* I) { Thread* T = Thread::Current(); ASSERT(I == T->isolate()); @@ -304,7 +283,6 @@ void ServiceIsolate::MaybeMakeServiceIsolate(Isolate* I) { SetServiceIsolate(I); } - void ServiceIsolate::ConstructExitMessageAndCache(Isolate* I) { // Construct and cache exit message here so we can send it without needing an // isolate. @@ -325,21 +303,18 @@ void ServiceIsolate::ConstructExitMessageAndCache(Isolate* I) { ASSERT(exit_message_length_ != 0); } - void ServiceIsolate::FinishedExiting() { MonitorLocker ml(monitor_); shutting_down_ = false; ml.NotifyAll(); } - void ServiceIsolate::FinishedInitializing() { MonitorLocker ml(monitor_); initializing_ = false; ml.NotifyAll(); } - class RunServiceTask : public ThreadPool::Task { public: virtual void Run() { @@ -481,7 +456,6 @@ class RunServiceTask : public ThreadPool::Task { } }; - void ServiceIsolate::Run() { // Grab the isolate create callback here to avoid race conditions with tests // that change this after Dart_Initialize returns. @@ -489,7 +463,6 @@ void ServiceIsolate::Run() { Dart::thread_pool()->Run(new RunServiceTask()); } - void ServiceIsolate::KillServiceIsolate() { { MonitorLocker ml(monitor_); @@ -504,7 +477,6 @@ void ServiceIsolate::KillServiceIsolate() { } } - void ServiceIsolate::Shutdown() { if (IsRunning()) { { @@ -533,7 +505,6 @@ void ServiceIsolate::Shutdown() { } } - void ServiceIsolate::BootVmServiceLibrary() { Thread* thread = Thread::Current(); const Library& vmservice_library = @@ -557,7 +528,6 @@ void ServiceIsolate::BootVmServiceLibrary() { ServiceIsolate::SetServicePort(port); } - void ServiceIsolate::VisitObjectPointers(ObjectPointerVisitor* visitor) {} } // namespace dart diff --git a/runtime/vm/service_test.cc b/runtime/vm/service_test.cc index f2fb36c9cd6..7cef50b1726 100644 --- a/runtime/vm/service_test.cc +++ b/runtime/vm/service_test.cc @@ -72,7 +72,6 @@ class ServiceTestMessageHandler : public MessageHandler { char* _msg; }; - static RawArray* Eval(Dart_Handle lib, const char* expr) { const String& dummy_isolate_id = String::Handle(String::New("isolateId")); Dart_Handle expr_val = Dart_EvaluateExpr(lib, NewString(expr)); @@ -95,7 +94,6 @@ static RawArray* Eval(Dart_Handle lib, const char* expr) { return result.raw(); } - static RawArray* EvalF(Dart_Handle lib, const char* fmt, ...) { va_list args; va_start(args, fmt); @@ -111,7 +109,6 @@ static RawArray* EvalF(Dart_Handle lib, const char* fmt, ...) { return Eval(lib, buffer); } - static RawFunction* GetFunction(const Class& cls, const char* name) { const Function& result = Function::Handle( cls.LookupDynamicFunction(String::Handle(String::New(name)))); @@ -119,7 +116,6 @@ static RawFunction* GetFunction(const Class& cls, const char* name) { return result.raw(); } - static RawClass* GetClass(const Library& lib, const char* name) { const Class& cls = Class::Handle( lib.LookupClass(String::Handle(Symbols::New(Thread::Current(), name)))); @@ -127,19 +123,16 @@ static RawClass* GetClass(const Library& lib, const char* name) { return cls.raw(); } - static void HandleIsolateMessage(Isolate* isolate, const Array& msg) { TransitionNativeToVM transition(Thread::Current()); Service::HandleIsolateMessage(isolate, msg); } - static void HandleRootMessage(const Array& message) { TransitionNativeToVM transition(Thread::Current()); Service::HandleRootMessage(message); } - TEST_CASE(Service_IsolateStickyError) { const char* kScript = "main() => throw 'HI THERE STICKY';\n"; @@ -183,7 +176,6 @@ TEST_CASE(Service_IsolateStickyError) { } } - TEST_CASE(Service_IdZones) { Zone* zone = thread->zone(); Isolate* isolate = thread->isolate(); @@ -218,7 +210,6 @@ TEST_CASE(Service_IdZones) { EXPECT_STREQ("objects/5", reuse_zone.GetServiceId(test_d)); } - TEST_CASE(Service_Code) { const char* kScript = "var port;\n" // Set to our mock port by C++. @@ -336,7 +327,6 @@ TEST_CASE(Service_Code) { EXPECT_SUBSTRING("\"error\"", handler.msg()); } - TEST_CASE(Service_TokenStream) { const char* kScript = "var port;\n" // Set to our mock port by C++. @@ -386,7 +376,6 @@ TEST_CASE(Service_TokenStream) { EXPECT_SUBSTRING("\"members\":[", handler.msg()); } - TEST_CASE(Service_PcDescriptors) { const char* kScript = "var port;\n" // Set to our mock port by C++. @@ -450,7 +439,6 @@ TEST_CASE(Service_PcDescriptors) { EXPECT_SUBSTRING("\"members\":[", handler.msg()); } - TEST_CASE(Service_LocalVarDescriptors) { const char* kScript = "var port;\n" // Set to our mock port by C++. @@ -514,12 +502,10 @@ TEST_CASE(Service_LocalVarDescriptors) { EXPECT_SUBSTRING("\"members\":[", handler.msg()); } - static void WeakHandleFinalizer(void* isolate_callback_data, Dart_WeakPersistentHandle handle, void* peer) {} - TEST_CASE(Service_PersistentHandles) { const char* kScript = "var port;\n" // Set to our mock port by C++. @@ -585,7 +571,6 @@ TEST_CASE(Service_PersistentHandles) { EXPECT_NOTSUBSTRING("\"externalSize\":\"128\"", handler.msg()); } - TEST_CASE(Service_Address) { const char* kScript = "var port;\n" // Set to our mock port by C++. @@ -641,7 +626,6 @@ TEST_CASE(Service_Address) { handler.msg()); } - static bool alpha_callback(const char* name, const char** option_keys, const char** option_values, @@ -652,7 +636,6 @@ static bool alpha_callback(const char* name, return true; } - static bool beta_callback(const char* name, const char** option_keys, const char** option_values, @@ -663,7 +646,6 @@ static bool beta_callback(const char* name, return false; } - TEST_CASE(Service_EmbedderRootHandler) { const char* kScript = "var port;\n" // Set to our mock port by C++. @@ -689,7 +671,6 @@ TEST_CASE(Service_EmbedderRootHandler) { EXPECT_VALID(port); EXPECT_VALID(Dart_SetField(lib, NewString("port"), port)); - Array& service_msg = Array::Handle(); service_msg = Eval(lib, "[0, port, '\"', 'alpha', [], []]"); HandleRootMessage(service_msg); @@ -702,7 +683,6 @@ TEST_CASE(Service_EmbedderRootHandler) { EXPECT_STREQ("{\"jsonrpc\":\"2.0\", \"error\":beta,\"id\":1}", handler.msg()); } - TEST_CASE(Service_EmbedderIsolateHandler) { const char* kScript = "var port;\n" // Set to our mock port by C++. diff --git a/runtime/vm/signal_handler.h b/runtime/vm/signal_handler.h index ff02a9747c4..69e897ac173 100644 --- a/runtime/vm/signal_handler.h +++ b/runtime/vm/signal_handler.h @@ -38,7 +38,6 @@ struct sigset_t {}; #include // NOLINT #endif - // Old linux kernels on ARM might require a trampoline to // work around incorrect Thumb -> ARM transitions. See SignalHandlerTrampoline // below for more details. @@ -48,7 +47,6 @@ struct sigset_t {}; #define USE_SIGNAL_HANDLER_TRAMPOLINE #endif - namespace dart { typedef void (*SignalAction)(int signal, siginfo_t* info, void* context); @@ -113,10 +111,8 @@ class SignalHandler : public AllStatic { #endif // defined(USE_SIGNAL_HANDLER_TRAMPOLINE) }; - #undef USE_SIGNAL_HANDLER_TRAMPOLINE - } // namespace dart #endif // RUNTIME_VM_SIGNAL_HANDLER_H_ diff --git a/runtime/vm/signal_handler_android.cc b/runtime/vm/signal_handler_android.cc index e4e25b25da5..c466ebd596a 100644 --- a/runtime/vm/signal_handler_android.cc +++ b/runtime/vm/signal_handler_android.cc @@ -4,8 +4,8 @@ #include "vm/globals.h" #include "vm/instructions.h" -#include "vm/simulator.h" #include "vm/signal_handler.h" +#include "vm/simulator.h" #if defined(HOST_OS_ANDROID) namespace dart { @@ -27,7 +27,6 @@ uintptr_t SignalHandler::GetProgramCounter(const mcontext_t& mcontext) { return pc; } - uintptr_t SignalHandler::GetFramePointer(const mcontext_t& mcontext) { uintptr_t fp = 0; @@ -53,7 +52,6 @@ uintptr_t SignalHandler::GetFramePointer(const mcontext_t& mcontext) { return fp; } - uintptr_t SignalHandler::GetCStackPointer(const mcontext_t& mcontext) { uintptr_t sp = 0; @@ -71,7 +69,6 @@ uintptr_t SignalHandler::GetCStackPointer(const mcontext_t& mcontext) { return sp; } - uintptr_t SignalHandler::GetDartStackPointer(const mcontext_t& mcontext) { #if defined(TARGET_ARCH_ARM64) && !defined(USING_SIMULATOR) return static_cast(mcontext.regs[SPREG]); @@ -80,7 +77,6 @@ uintptr_t SignalHandler::GetDartStackPointer(const mcontext_t& mcontext) { #endif } - uintptr_t SignalHandler::GetLinkRegister(const mcontext_t& mcontext) { uintptr_t lr = 0; @@ -98,7 +94,6 @@ uintptr_t SignalHandler::GetLinkRegister(const mcontext_t& mcontext) { return lr; } - void SignalHandler::InstallImpl(SignalAction action) { struct sigaction act; memset(&act, 0, sizeof(act)); @@ -109,7 +104,6 @@ void SignalHandler::InstallImpl(SignalAction action) { ASSERT(r == 0); } - void SignalHandler::Remove() { // Ignore future SIGPROF signals because by default SIGPROF will terminate // the process and we may have some signals in flight. @@ -121,7 +115,6 @@ void SignalHandler::Remove() { ASSERT(r == 0); } - } // namespace dart #endif // defined(HOST_OS_ANDROID) diff --git a/runtime/vm/signal_handler_fuchsia.cc b/runtime/vm/signal_handler_fuchsia.cc index e64dc4f7c22..a0f0cf1af17 100644 --- a/runtime/vm/signal_handler_fuchsia.cc +++ b/runtime/vm/signal_handler_fuchsia.cc @@ -16,36 +16,30 @@ uintptr_t SignalHandler::GetProgramCounter(const mcontext_t& mcontext) { return 0; } - uintptr_t SignalHandler::GetFramePointer(const mcontext_t& mcontext) { UNIMPLEMENTED(); return 0; } - uintptr_t SignalHandler::GetCStackPointer(const mcontext_t& mcontext) { UNIMPLEMENTED(); return 0; } - uintptr_t SignalHandler::GetDartStackPointer(const mcontext_t& mcontext) { UNIMPLEMENTED(); return 0; } - uintptr_t SignalHandler::GetLinkRegister(const mcontext_t& mcontext) { UNIMPLEMENTED(); return 0; } - void SignalHandler::InstallImpl(SignalAction action) { UNIMPLEMENTED(); } - void SignalHandler::Remove() { UNIMPLEMENTED(); } diff --git a/runtime/vm/signal_handler_linux.cc b/runtime/vm/signal_handler_linux.cc index 7c522fd8840..3712901ceab 100644 --- a/runtime/vm/signal_handler_linux.cc +++ b/runtime/vm/signal_handler_linux.cc @@ -4,8 +4,8 @@ #include "vm/globals.h" #include "vm/instructions.h" -#include "vm/simulator.h" #include "vm/signal_handler.h" +#include "vm/simulator.h" #if defined(HOST_OS_LINUX) namespace dart { @@ -27,7 +27,6 @@ uintptr_t SignalHandler::GetProgramCounter(const mcontext_t& mcontext) { return pc; } - uintptr_t SignalHandler::GetFramePointer(const mcontext_t& mcontext) { uintptr_t fp = 0; @@ -53,7 +52,6 @@ uintptr_t SignalHandler::GetFramePointer(const mcontext_t& mcontext) { return fp; } - uintptr_t SignalHandler::GetCStackPointer(const mcontext_t& mcontext) { uintptr_t sp = 0; @@ -71,7 +69,6 @@ uintptr_t SignalHandler::GetCStackPointer(const mcontext_t& mcontext) { return sp; } - uintptr_t SignalHandler::GetDartStackPointer(const mcontext_t& mcontext) { #if defined(TARGET_ARCH_ARM64) && !defined(USING_SIMULATOR) return static_cast(mcontext.regs[SPREG]); @@ -80,7 +77,6 @@ uintptr_t SignalHandler::GetDartStackPointer(const mcontext_t& mcontext) { #endif } - uintptr_t SignalHandler::GetLinkRegister(const mcontext_t& mcontext) { uintptr_t lr = 0; @@ -98,7 +94,6 @@ uintptr_t SignalHandler::GetLinkRegister(const mcontext_t& mcontext) { return lr; } - void SignalHandler::InstallImpl(SignalAction action) { struct sigaction act; act.sa_handler = NULL; @@ -109,7 +104,6 @@ void SignalHandler::InstallImpl(SignalAction action) { ASSERT(r == 0); } - void SignalHandler::Remove() { // Ignore future SIGPROF signals because by default SIGPROF will terminate // the process and we may have some signals in flight. @@ -121,7 +115,6 @@ void SignalHandler::Remove() { ASSERT(r == 0); } - } // namespace dart #endif // defined(HOST_OS_LINUX) diff --git a/runtime/vm/signal_handler_macos.cc b/runtime/vm/signal_handler_macos.cc index addabb9eb80..8167b81bbd2 100644 --- a/runtime/vm/signal_handler_macos.cc +++ b/runtime/vm/signal_handler_macos.cc @@ -4,8 +4,8 @@ #include "vm/globals.h" #include "vm/instructions.h" -#include "vm/simulator.h" #include "vm/signal_handler.h" +#include "vm/simulator.h" #if defined(HOST_OS_MACOS) namespace dart { @@ -28,7 +28,6 @@ uintptr_t SignalHandler::GetProgramCounter(const mcontext_t& mcontext) { return pc; } - uintptr_t SignalHandler::GetFramePointer(const mcontext_t& mcontext) { uintptr_t fp = 0; @@ -47,7 +46,6 @@ uintptr_t SignalHandler::GetFramePointer(const mcontext_t& mcontext) { return fp; } - uintptr_t SignalHandler::GetCStackPointer(const mcontext_t& mcontext) { uintptr_t sp = 0; @@ -66,7 +64,6 @@ uintptr_t SignalHandler::GetCStackPointer(const mcontext_t& mcontext) { return sp; } - uintptr_t SignalHandler::GetDartStackPointer(const mcontext_t& mcontext) { #if defined(TARGET_ARCH_ARM64) && !defined(USING_SIMULATOR) return static_cast(mcontext->__ss.__x[SPREG]); @@ -75,7 +72,6 @@ uintptr_t SignalHandler::GetDartStackPointer(const mcontext_t& mcontext) { #endif } - uintptr_t SignalHandler::GetLinkRegister(const mcontext_t& mcontext) { uintptr_t lr = 0; @@ -94,7 +90,6 @@ uintptr_t SignalHandler::GetLinkRegister(const mcontext_t& mcontext) { return lr; } - void SignalHandler::InstallImpl(SignalAction action) { struct sigaction act; act.sa_handler = NULL; @@ -105,7 +100,6 @@ void SignalHandler::InstallImpl(SignalAction action) { ASSERT(r == 0); } - void SignalHandler::Remove() { // Ignore future SIGPROF signals because by default SIGPROF will terminate // the process and we may have some signals in flight. @@ -117,7 +111,6 @@ void SignalHandler::Remove() { ASSERT(r == 0); } - } // namespace dart #endif // defined(HOST_OS_MACOS) diff --git a/runtime/vm/signal_handler_win.cc b/runtime/vm/signal_handler_win.cc index 633c49e2284..f38ba71ab58 100644 --- a/runtime/vm/signal_handler_win.cc +++ b/runtime/vm/signal_handler_win.cc @@ -13,41 +13,34 @@ uintptr_t SignalHandler::GetProgramCounter(const mcontext_t& mcontext) { return 0; } - uintptr_t SignalHandler::GetFramePointer(const mcontext_t& mcontext) { UNIMPLEMENTED(); return 0; } - uintptr_t SignalHandler::GetCStackPointer(const mcontext_t& mcontext) { UNIMPLEMENTED(); return 0; } - uintptr_t SignalHandler::GetDartStackPointer(const mcontext_t& mcontext) { UNIMPLEMENTED(); return 0; } - uintptr_t SignalHandler::GetLinkRegister(const mcontext_t& mcontext) { UNIMPLEMENTED(); return 0; } - void SignalHandler::InstallImpl(SignalAction action) { UNIMPLEMENTED(); } - void SignalHandler::Remove() { UNIMPLEMENTED(); } - } // namespace dart #endif // defined(HOST_OS_WINDOWS) diff --git a/runtime/vm/simulator_arm.cc b/runtime/vm/simulator_arm.cc index 50cb88d0c5b..60c0731954b 100644 --- a/runtime/vm/simulator_arm.cc +++ b/runtime/vm/simulator_arm.cc @@ -19,8 +19,8 @@ #include "vm/disassembler.h" #include "vm/lockers.h" #include "vm/native_arguments.h" -#include "vm/stack_frame.h" #include "vm/os_thread.h" +#include "vm/stack_frame.h" namespace dart { @@ -33,14 +33,12 @@ DEFINE_FLAG(uint64_t, ULLONG_MAX, "Instruction address or instruction count to stop simulator at."); - // This macro provides a platform independent use of sscanf. The reason for // SScanF not being implemented in a platform independent way through // OS in the same way as SNPrint is that the Windows C Run-Time // Library does not provide vsscanf. #define SScanF sscanf // NOLINT - // SimulatorSetjmpBuffer are linked together, and the last created one // is referenced by the Simulator. When an exception is thrown, the exception // runtime looks at where to jump and finds the corresponding @@ -79,7 +77,6 @@ class SimulatorSetjmpBuffer { friend class Simulator; }; - // The SimulatorDebugger class is used by the simulator while debugging // simulated ARM code. class SimulatorDebugger { @@ -119,21 +116,17 @@ class SimulatorDebugger { void RedoBreakpoints(); }; - SimulatorDebugger::SimulatorDebugger(Simulator* sim) { sim_ = sim; } - SimulatorDebugger::~SimulatorDebugger() {} - void SimulatorDebugger::Stop(Instr* instr, const char* message) { OS::Print("Simulator hit %s\n", message); Debug(); } - static Register LookupCpuRegisterByName(const char* name) { static const char* kNames[] = {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", @@ -151,7 +144,6 @@ static Register LookupCpuRegisterByName(const char* name) { return kNoRegister; } - static SRegister LookupSRegisterByName(const char* name) { int reg_nr = -1; bool ok = SScanF(name, "s%d", ®_nr); @@ -161,7 +153,6 @@ static SRegister LookupSRegisterByName(const char* name) { return kNoSRegister; } - static DRegister LookupDRegisterByName(const char* name) { int reg_nr = -1; bool ok = SScanF(name, "d%d", ®_nr); @@ -171,7 +162,6 @@ static DRegister LookupDRegisterByName(const char* name) { return kNoDRegister; } - bool SimulatorDebugger::GetValue(char* desc, uint32_t* value) { Register reg = LookupCpuRegisterByName(desc); if (reg != kNoRegister) { @@ -199,7 +189,6 @@ bool SimulatorDebugger::GetValue(char* desc, uint32_t* value) { return retval; } - bool SimulatorDebugger::GetFValue(char* desc, float* value) { SRegister sreg = LookupSRegisterByName(desc); if (sreg != kNoSRegister) { @@ -219,7 +208,6 @@ bool SimulatorDebugger::GetFValue(char* desc, float* value) { return false; } - bool SimulatorDebugger::GetDValue(char* desc, double* value) { DRegister dreg = LookupDRegisterByName(desc); if (dreg != kNoDRegister) { @@ -239,7 +227,6 @@ bool SimulatorDebugger::GetDValue(char* desc, double* value) { return false; } - TokenPosition SimulatorDebugger::GetApproximateTokenIndex(const Code& code, uword pc) { TokenPosition token_pos = TokenPosition::kNoSource; @@ -257,7 +244,6 @@ TokenPosition SimulatorDebugger::GetApproximateTokenIndex(const Code& code, return token_pos; } - void SimulatorDebugger::PrintDartFrame(uword pc, uword fp, uword sp, @@ -279,7 +265,6 @@ void SimulatorDebugger::PrintDartFrame(uword pc, func_name.ToCString(), url.ToCString(), line, column); } - void SimulatorDebugger::PrintBacktrace() { StackFrameIterator frames( sim_->get_register(FP), sim_->get_register(SP), sim_->get_pc(), @@ -331,7 +316,6 @@ void SimulatorDebugger::PrintBacktrace() { } } - bool SimulatorDebugger::SetBreakpoint(Instr* breakpc) { // Check if a breakpoint can be set. If not return without any side-effects. if (sim_->break_pc_ != NULL) { @@ -346,7 +330,6 @@ bool SimulatorDebugger::SetBreakpoint(Instr* breakpc) { return true; } - bool SimulatorDebugger::DeleteBreakpoint(Instr* breakpc) { if (sim_->break_pc_ != NULL) { sim_->break_pc_->SetInstructionBits(sim_->break_instr_); @@ -357,21 +340,18 @@ bool SimulatorDebugger::DeleteBreakpoint(Instr* breakpc) { return true; } - void SimulatorDebugger::UndoBreakpoints() { if (sim_->break_pc_ != NULL) { sim_->break_pc_->SetInstructionBits(sim_->break_instr_); } } - void SimulatorDebugger::RedoBreakpoints() { if (sim_->break_pc_ != NULL) { sim_->break_pc_->SetInstructionBits(Instr::kSimulatorBreakpointInstruction); } } - void SimulatorDebugger::Debug() { intptr_t last_pc = -1; bool done = false; @@ -621,7 +601,6 @@ void SimulatorDebugger::Debug() { #undef XSTR } - char* SimulatorDebugger::ReadLine(const char* prompt) { char* result = NULL; char line_buf[256]; @@ -680,20 +659,17 @@ char* SimulatorDebugger::ReadLine(const char* prompt) { return result; } - // Synchronization primitives support. Mutex* Simulator::exclusive_access_lock_ = NULL; Simulator::AddressTag Simulator::exclusive_access_state_[kNumAddressTags] = { {NULL, 0}}; int Simulator::next_address_tag_ = 0; - void Simulator::InitOnce() { // Setup exclusive access state lock. exclusive_access_lock_ = new Mutex(); } - Simulator::Simulator() { // Setup simulator support first. Some of this information is needed to // setup the architecture state. @@ -745,7 +721,6 @@ Simulator::Simulator() { fp_v_flag_ = false; } - Simulator::~Simulator() { delete[] stack_; Isolate* isolate = Isolate::Current(); @@ -754,7 +729,6 @@ Simulator::~Simulator() { } } - // When the generated code calls an external reference we need to catch that in // the simulator. The external reference will be a function compiled for the // host architecture. We need to call that function instead of trying to @@ -829,10 +803,8 @@ class Redirection { static Redirection* list_; }; - Redirection* Redirection::list_ = NULL; - uword Simulator::RedirectExternalReference(uword function, CallKind call_kind, int argument_count) { @@ -841,12 +813,10 @@ uword Simulator::RedirectExternalReference(uword function, return redirection->address_of_svc_instruction(); } - uword Simulator::FunctionForRedirect(uword redirect) { return Redirection::FunctionForRedirect(redirect); } - // Get the active Simulator for the current isolate. Simulator* Simulator::Current() { Simulator* simulator = Isolate::Current()->simulator(); @@ -857,7 +827,6 @@ Simulator* Simulator::Current() { return simulator; } - // Sets the register in the architecture state. It will also deal with updating // Simulator internal state for special registers such as PC. void Simulator::set_register(Register reg, int32_t value) { @@ -868,7 +837,6 @@ void Simulator::set_register(Register reg, int32_t value) { registers_[reg] = value; } - // Get the register from the architecture state. This function does handle // the special case of accessing the PC register. int32_t Simulator::get_register(Register reg) const { @@ -876,20 +844,17 @@ int32_t Simulator::get_register(Register reg) const { return registers_[reg] + ((reg == PC) ? Instr::kPCReadOffset : 0); } - // Raw access to the PC register. void Simulator::set_pc(int32_t value) { pc_modified_ = true; registers_[PC] = value; } - // Raw access to the PC register without the special adjustment when reading. int32_t Simulator::get_pc() const { return registers_[PC]; } - // Accessors for VFP register state. void Simulator::set_sregister(SRegister reg, float value) { ASSERT(TargetCPUFeatures::vfp_supported()); @@ -897,28 +862,24 @@ void Simulator::set_sregister(SRegister reg, float value) { sregisters_[reg] = bit_cast(value); } - float Simulator::get_sregister(SRegister reg) const { ASSERT(TargetCPUFeatures::vfp_supported()); ASSERT((reg >= 0) && (reg < kNumberOfSRegisters)); return bit_cast(sregisters_[reg]); } - void Simulator::set_dregister(DRegister reg, double value) { ASSERT(TargetCPUFeatures::vfp_supported()); ASSERT((reg >= 0) && (reg < kNumberOfDRegisters)); dregisters_[reg] = bit_cast(value); } - double Simulator::get_dregister(DRegister reg) const { ASSERT(TargetCPUFeatures::vfp_supported()); ASSERT((reg >= 0) && (reg < kNumberOfDRegisters)); return bit_cast(dregisters_[reg]); } - void Simulator::set_qregister(QRegister reg, const simd_value_t& value) { ASSERT(TargetCPUFeatures::neon_supported()); ASSERT((reg >= 0) && (reg < kNumberOfQRegisters)); @@ -928,7 +889,6 @@ void Simulator::set_qregister(QRegister reg, const simd_value_t& value) { qregisters_[reg].data_[3] = value.data_[3]; } - void Simulator::get_qregister(QRegister reg, simd_value_t* value) const { ASSERT(TargetCPUFeatures::neon_supported()); // TODO(zra): Replace this test with an assert after we support @@ -938,35 +898,30 @@ void Simulator::get_qregister(QRegister reg, simd_value_t* value) const { } } - void Simulator::set_sregister_bits(SRegister reg, int32_t value) { ASSERT(TargetCPUFeatures::vfp_supported()); ASSERT((reg >= 0) && (reg < kNumberOfSRegisters)); sregisters_[reg] = value; } - int32_t Simulator::get_sregister_bits(SRegister reg) const { ASSERT(TargetCPUFeatures::vfp_supported()); ASSERT((reg >= 0) && (reg < kNumberOfSRegisters)); return sregisters_[reg]; } - void Simulator::set_dregister_bits(DRegister reg, int64_t value) { ASSERT(TargetCPUFeatures::vfp_supported()); ASSERT((reg >= 0) && (reg < kNumberOfDRegisters)); dregisters_[reg] = value; } - int64_t Simulator::get_dregister_bits(DRegister reg) const { ASSERT(TargetCPUFeatures::vfp_supported()); ASSERT((reg >= 0) && (reg < kNumberOfDRegisters)); return dregisters_[reg]; } - void Simulator::HandleIllegalAccess(uword addr, Instr* instr) { uword fault_pc = get_pc(); // The debugger will not be able to single step past this instruction, but @@ -981,7 +936,6 @@ void Simulator::HandleIllegalAccess(uword addr, Instr* instr) { FATAL("Cannot continue execution after illegal memory access."); } - // Processor versions prior to ARMv7 could not do unaligned reads and writes. // On some ARM platforms an interrupt is caused. On others it does a funky // rotation thing. However, from version v7, unaligned access is supported. @@ -1002,7 +956,6 @@ void Simulator::UnalignedAccess(const char* msg, uword addr, Instr* instr) { FATAL("Cannot continue execution after unaligned access."); } - void Simulator::UnimplementedInstruction(Instr* instr) { char buffer[64]; snprintf(buffer, sizeof(buffer), "Unimplemented instruction: pc=%p\n", instr); @@ -1011,7 +964,6 @@ void Simulator::UnimplementedInstruction(Instr* instr) { FATAL("Cannot continue execution after unimplemented instruction."); } - intptr_t Simulator::ReadW(uword addr, Instr* instr) { if ((addr & 3) == 0) { intptr_t* ptr = reinterpret_cast(addr); @@ -1021,7 +973,6 @@ intptr_t Simulator::ReadW(uword addr, Instr* instr) { return 0; } - void Simulator::WriteW(uword addr, intptr_t value, Instr* instr) { if ((addr & 3) == 0) { intptr_t* ptr = reinterpret_cast(addr); @@ -1031,7 +982,6 @@ void Simulator::WriteW(uword addr, intptr_t value, Instr* instr) { UnalignedAccess("write", addr, instr); } - uint16_t Simulator::ReadHU(uword addr, Instr* instr) { if ((addr & 1) == 0) { uint16_t* ptr = reinterpret_cast(addr); @@ -1041,7 +991,6 @@ uint16_t Simulator::ReadHU(uword addr, Instr* instr) { return 0; } - int16_t Simulator::ReadH(uword addr, Instr* instr) { if ((addr & 1) == 0) { int16_t* ptr = reinterpret_cast(addr); @@ -1051,7 +1000,6 @@ int16_t Simulator::ReadH(uword addr, Instr* instr) { return 0; } - void Simulator::WriteH(uword addr, uint16_t value, Instr* instr) { if ((addr & 1) == 0) { uint16_t* ptr = reinterpret_cast(addr); @@ -1061,25 +1009,21 @@ void Simulator::WriteH(uword addr, uint16_t value, Instr* instr) { UnalignedAccess("halfword write", addr, instr); } - uint8_t Simulator::ReadBU(uword addr) { uint8_t* ptr = reinterpret_cast(addr); return *ptr; } - int8_t Simulator::ReadB(uword addr) { int8_t* ptr = reinterpret_cast(addr); return *ptr; } - void Simulator::WriteB(uword addr, uint8_t value) { uint8_t* ptr = reinterpret_cast(addr); *ptr = value; } - // Synchronization primitives support. void Simulator::SetExclusiveAccess(uword addr) { Thread* thread = Thread::Current(); @@ -1103,7 +1047,6 @@ void Simulator::SetExclusiveAccess(uword addr) { exclusive_access_state_[i].addr = addr; } - bool Simulator::HasExclusiveAccessAndOpen(uword addr) { Thread* thread = Thread::Current(); ASSERT(thread != NULL); @@ -1125,21 +1068,18 @@ bool Simulator::HasExclusiveAccessAndOpen(uword addr) { return result; } - void Simulator::ClearExclusive() { MutexLocker ml(exclusive_access_lock_); // Remove the reservation for this thread. SetExclusiveAccess(0); } - intptr_t Simulator::ReadExclusiveW(uword addr, Instr* instr) { MutexLocker ml(exclusive_access_lock_); SetExclusiveAccess(addr); return ReadW(addr, instr); } - intptr_t Simulator::WriteExclusiveW(uword addr, intptr_t value, Instr* instr) { MutexLocker ml(exclusive_access_lock_); bool write_allowed = HasExclusiveAccessAndOpen(addr); @@ -1150,7 +1090,6 @@ intptr_t Simulator::WriteExclusiveW(uword addr, intptr_t value, Instr* instr) { return 1; // Failure. } - uword Simulator::CompareExchange(uword* address, uword compare_value, uword new_value) { @@ -1170,7 +1109,6 @@ uword Simulator::CompareExchange(uword* address, return value; } - uint32_t Simulator::CompareExchangeUint32(uint32_t* address, uint32_t compare_value, uint32_t new_value) { @@ -1180,7 +1118,6 @@ uint32_t Simulator::CompareExchangeUint32(uint32_t* address, static_cast(new_value)); } - // Returns the top of the stack area to enable checking for stack pointer // validity. uword Simulator::StackTop() const { @@ -1190,12 +1127,10 @@ uword Simulator::StackTop() const { (OSThread::GetSpecifiedStackSize() + OSThread::kStackSizeBuffer); } - bool Simulator::IsTracingExecution() const { return icount_ > FLAG_trace_sim_after; } - // Unsupported instructions use Format to print an error and stop execution. void Simulator::Format(Instr* instr, const char* format) { OS::Print("Simulator found unsupported instruction:\n 0x%p: %s\n", instr, @@ -1203,7 +1138,6 @@ void Simulator::Format(Instr* instr, const char* format) { UNIMPLEMENTED(); } - // Checks if the current instruction should be executed based on its // condition bits. bool Simulator::ConditionallyExecute(Instr* instr) { @@ -1244,26 +1178,22 @@ bool Simulator::ConditionallyExecute(Instr* instr) { return false; } - // Calculate and set the Negative and Zero flags. void Simulator::SetNZFlags(int32_t val) { n_flag_ = (val < 0); z_flag_ = (val == 0); } - // Set the Carry flag. void Simulator::SetCFlag(bool val) { c_flag_ = val; } - // Set the oVerflow flag. void Simulator::SetVFlag(bool val) { v_flag_ = val; } - // Calculate C flag value for additions (and subtractions with adjusted args). bool Simulator::CarryFrom(int32_t left, int32_t right, int32_t carry) { uint64_t uleft = static_cast(left); @@ -1272,14 +1202,12 @@ bool Simulator::CarryFrom(int32_t left, int32_t right, int32_t carry) { return ((uleft + uright + ucarry) >> 32) != 0; } - // Calculate V flag value for additions (and subtractions with adjusted args). bool Simulator::OverflowFrom(int32_t left, int32_t right, int32_t carry) { int64_t result = static_cast(left) + right + carry; return (result >> 31) != (result >> 32); } - // Addressing Mode 1 - Data-processing operands: // Get the value based on the shifter_operand with register. int32_t Simulator::GetShiftRm(Instr* instr, bool* carry_out) { @@ -1422,7 +1350,6 @@ int32_t Simulator::GetShiftRm(Instr* instr, bool* carry_out) { return result; } - // Addressing Mode 1 - Data-processing operands: // Get the value based on the shifter_operand with immediate. int32_t Simulator::GetImm(Instr* instr, bool* carry_out) { @@ -1433,7 +1360,6 @@ int32_t Simulator::GetImm(Instr* instr, bool* carry_out) { return imm; } - static int count_bits(int bit_vector) { int count = 0; while (bit_vector != 0) { @@ -1445,7 +1371,6 @@ static int count_bits(int bit_vector) { return count; } - // Addressing Mode 4 - Load and Store Multiple void Simulator::HandleRList(Instr* instr, bool load) { Register rn = instr->RnField(); @@ -1512,7 +1437,6 @@ void Simulator::HandleRList(Instr* instr, bool load) { } } - // Calls into the Dart runtime are based on this interface. typedef void (*SimulatorRuntimeCall)(NativeArguments arguments); @@ -1529,7 +1453,6 @@ typedef double (*SimulatorLeafFloatRuntimeCall)(double d0, double d1); typedef void (*SimulatorBootstrapNativeCall)(NativeArguments* arguments); typedef void (*SimulatorNativeCall)(NativeArguments* arguments, uword target); - void Simulator::SupervisorCall(Instr* instr) { int svc = instr->SvcField(); switch (svc) { @@ -1667,7 +1590,6 @@ void Simulator::SupervisorCall(Instr* instr) { } } - // Handle execution based on instruction types. // Instruction types 0 and 1 are both rolled into one function because they @@ -2292,7 +2214,6 @@ void Simulator::DecodeType01(Instr* instr) { } } - void Simulator::DecodeType2(Instr* instr) { Register rd = instr->RdField(); Register rn = instr->RnField(); @@ -2361,7 +2282,6 @@ void Simulator::DecodeType2(Instr* instr) { } } - void Simulator::DoDivision(Instr* instr) { const Register rd = instr->DivRdField(); const Register rn = instr->DivRnField(); @@ -2400,7 +2320,6 @@ void Simulator::DoDivision(Instr* instr) { } } - void Simulator::DecodeType3(Instr* instr) { if (instr->IsDivision()) { DoDivision(instr); @@ -2474,7 +2393,6 @@ void Simulator::DecodeType3(Instr* instr) { } } - void Simulator::DecodeType4(Instr* instr) { ASSERT(instr->Bit(22) == 0); // only allowed to be set in privileged mode if (instr->HasL()) { @@ -2486,7 +2404,6 @@ void Simulator::DecodeType4(Instr* instr) { } } - void Simulator::DecodeType5(Instr* instr) { // Format(instr, "b'l'cond 'target"); int off = (instr->SImmed24Field() << 2) + 8; @@ -2497,7 +2414,6 @@ void Simulator::DecodeType5(Instr* instr) { set_pc(pc + off); } - void Simulator::DecodeType6(Instr* instr) { if (instr->IsVFPDoubleTransfer()) { Register rd = instr->RdField(); @@ -2629,7 +2545,6 @@ void Simulator::DecodeType6(Instr* instr) { } } - void Simulator::DecodeType7(Instr* instr) { if (instr->Bit(24) == 1) { // Format(instr, "svc #'svc"); @@ -3025,7 +2940,6 @@ void Simulator::DecodeType7(Instr* instr) { } } - static float arm_reciprocal_sqrt_estimate(float a) { // From the ARM Architecture Reference Manual A2-87. if (isinf(a) || (fabs(a) >= exp2f(126))) @@ -3080,7 +2994,6 @@ static float arm_reciprocal_sqrt_estimate(float a) { return bit_cast(result_bits); } - static float arm_recip_estimate(float a) { // From the ARM Architecture Reference Manual A2-85. if (isinf(a) || (fabs(a) >= exp2f(126))) @@ -3117,7 +3030,6 @@ static float arm_recip_estimate(float a) { return bit_cast(result_bits); } - static void simd_value_swap(simd_value_t* s1, int i1, simd_value_t* s2, @@ -3128,7 +3040,6 @@ static void simd_value_swap(simd_value_t* s1, s2->data_[i2].u = tmp; } - void Simulator::DecodeSIMDDataProcessing(Instr* instr) { ASSERT(instr->ConditionField() == kSpecialCondition); @@ -3620,7 +3531,6 @@ void Simulator::DecodeSIMDDataProcessing(Instr* instr) { } } - // Executes the current instruction. void Simulator::InstructionDecode(Instr* instr) { pc_modified_ = false; @@ -3688,7 +3598,6 @@ void Simulator::InstructionDecode(Instr* instr) { } } - void Simulator::Execute() { // Get the PC to simulate. Cannot use the accessor here as we need the // raw PC value and not the one used as input to arithmetic instructions. @@ -3729,7 +3638,6 @@ void Simulator::Execute() { } } - int64_t Simulator::Call(int32_t entry, int32_t parameter0, int32_t parameter1, @@ -3891,7 +3799,6 @@ int64_t Simulator::Call(int32_t entry, return return_value; } - void Simulator::JumpToFrame(uword pc, uword sp, uword fp, Thread* thread) { // Walk over all setjmp buffers (simulated --> C++ transitions) // and try to find the setjmp associated with the simulated stack pointer. diff --git a/runtime/vm/simulator_arm64.cc b/runtime/vm/simulator_arm64.cc index 99912dfa29c..49f8635090c 100644 --- a/runtime/vm/simulator_arm64.cc +++ b/runtime/vm/simulator_arm64.cc @@ -18,8 +18,8 @@ #include "vm/disassembler.h" #include "vm/lockers.h" #include "vm/native_arguments.h" -#include "vm/stack_frame.h" #include "vm/os_thread.h" +#include "vm/stack_frame.h" namespace dart { @@ -32,14 +32,12 @@ DEFINE_FLAG(uint64_t, ULLONG_MAX, "Instruction address or instruction count to stop simulator at."); - // This macro provides a platform independent use of sscanf. The reason for // SScanF not being implemented in a platform independent way through // OS in the same way as SNPrint is that the Windows C Run-Time // Library does not provide vsscanf. #define SScanF sscanf // NOLINT - // SimulatorSetjmpBuffer are linked together, and the last created one // is referenced by the Simulator. When an exception is thrown, the exception // runtime looks at where to jump and finds the corresponding @@ -78,7 +76,6 @@ class SimulatorSetjmpBuffer { friend class Simulator; }; - // The SimulatorDebugger class is used by the simulator while debugging // simulated ARM64 code. class SimulatorDebugger { @@ -119,21 +116,17 @@ class SimulatorDebugger { void RedoBreakpoints(); }; - SimulatorDebugger::SimulatorDebugger(Simulator* sim) { sim_ = sim; } - SimulatorDebugger::~SimulatorDebugger() {} - void SimulatorDebugger::Stop(Instr* instr, const char* message) { OS::Print("Simulator hit %s\n", message); Debug(); } - static Register LookupCpuRegisterByName(const char* name) { static const char* kNames[] = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", @@ -159,7 +152,6 @@ static Register LookupCpuRegisterByName(const char* name) { return kNoRegister; } - static VRegister LookupVRegisterByName(const char* name) { int reg_nr = -1; bool ok = SScanF(name, "v%d", ®_nr); @@ -169,7 +161,6 @@ static VRegister LookupVRegisterByName(const char* name) { return kNoVRegister; } - bool SimulatorDebugger::GetValue(char* desc, uint64_t* value) { Register reg = LookupCpuRegisterByName(desc); if (reg != kNoRegister) { @@ -201,7 +192,6 @@ bool SimulatorDebugger::GetValue(char* desc, uint64_t* value) { return retval; } - bool SimulatorDebugger::GetSValue(char* desc, uint32_t* value) { VRegister vreg = LookupVRegisterByName(desc); if (vreg != kNoVRegister) { @@ -221,7 +211,6 @@ bool SimulatorDebugger::GetSValue(char* desc, uint32_t* value) { return false; } - bool SimulatorDebugger::GetDValue(char* desc, uint64_t* value) { VRegister vreg = LookupVRegisterByName(desc); if (vreg != kNoVRegister) { @@ -241,7 +230,6 @@ bool SimulatorDebugger::GetDValue(char* desc, uint64_t* value) { return false; } - bool SimulatorDebugger::GetQValue(char* desc, simd_value_t* value) { VRegister vreg = LookupVRegisterByName(desc); if (vreg != kNoVRegister) { @@ -261,7 +249,6 @@ bool SimulatorDebugger::GetQValue(char* desc, simd_value_t* value) { return false; } - TokenPosition SimulatorDebugger::GetApproximateTokenIndex(const Code& code, uword pc) { TokenPosition token_pos = TokenPosition::kNoSource; @@ -279,7 +266,6 @@ TokenPosition SimulatorDebugger::GetApproximateTokenIndex(const Code& code, return token_pos; } - void SimulatorDebugger::PrintDartFrame(uword pc, uword fp, uword sp, @@ -301,7 +287,6 @@ void SimulatorDebugger::PrintDartFrame(uword pc, func_name.ToCString(), url.ToCString(), line, column); } - void SimulatorDebugger::PrintBacktrace() { StackFrameIterator frames( sim_->get_register(FP), sim_->get_register(SP), sim_->get_pc(), @@ -353,7 +338,6 @@ void SimulatorDebugger::PrintBacktrace() { } } - bool SimulatorDebugger::SetBreakpoint(Instr* breakpc) { // Check if a breakpoint can be set. If not return without any side-effects. if (sim_->break_pc_ != NULL) { @@ -368,7 +352,6 @@ bool SimulatorDebugger::SetBreakpoint(Instr* breakpc) { return true; } - bool SimulatorDebugger::DeleteBreakpoint(Instr* breakpc) { if (sim_->break_pc_ != NULL) { sim_->break_pc_->SetInstructionBits(sim_->break_instr_); @@ -379,21 +362,18 @@ bool SimulatorDebugger::DeleteBreakpoint(Instr* breakpc) { return true; } - void SimulatorDebugger::UndoBreakpoints() { if (sim_->break_pc_ != NULL) { sim_->break_pc_->SetInstructionBits(sim_->break_instr_); } } - void SimulatorDebugger::RedoBreakpoints() { if (sim_->break_pc_ != NULL) { sim_->break_pc_->SetInstructionBits(Instr::kSimulatorBreakpointInstruction); } } - void SimulatorDebugger::Debug() { intptr_t last_pc = -1; bool done = false; @@ -668,7 +648,6 @@ void SimulatorDebugger::Debug() { #undef XSTR } - char* SimulatorDebugger::ReadLine(const char* prompt) { char* result = NULL; char line_buf[256]; @@ -727,20 +706,17 @@ char* SimulatorDebugger::ReadLine(const char* prompt) { return result; } - // Synchronization primitives support. Mutex* Simulator::exclusive_access_lock_ = NULL; Simulator::AddressTag Simulator::exclusive_access_state_[kNumAddressTags] = { {NULL, 0}}; int Simulator::next_address_tag_ = 0; - void Simulator::InitOnce() { // Setup exclusive access state lock. exclusive_access_lock_ = new Mutex(); } - Simulator::Simulator() { // Setup simulator support first. Some of this information is needed to // setup the architecture state. @@ -782,7 +758,6 @@ Simulator::Simulator() { pc_ = kBadLR; } - Simulator::~Simulator() { delete[] stack_; Isolate* isolate = Isolate::Current(); @@ -791,7 +766,6 @@ Simulator::~Simulator() { } } - // When the generated code calls an external reference we need to catch that in // the simulator. The external reference will be a function compiled for the // host architecture. We need to call that function instead of trying to @@ -867,10 +841,8 @@ class Redirection { static Redirection* list_; }; - Redirection* Redirection::list_ = NULL; - uword Simulator::RedirectExternalReference(uword function, CallKind call_kind, int argument_count) { @@ -879,12 +851,10 @@ uword Simulator::RedirectExternalReference(uword function, return redirection->address_of_hlt_instruction(); } - uword Simulator::FunctionForRedirect(uword redirect) { return Redirection::FunctionForRedirect(redirect); } - // Get the active Simulator for the current isolate. Simulator* Simulator::Current() { Simulator* simulator = Isolate::Current()->simulator(); @@ -895,7 +865,6 @@ Simulator* Simulator::Current() { return simulator; } - // Sets the register in the architecture state. void Simulator::set_register(Instr* instr, Register reg, @@ -919,7 +888,6 @@ void Simulator::set_register(Instr* instr, } } - // Get the register from the architecture state. int64_t Simulator::get_register(Register reg, R31Type r31t) const { ASSERT((reg >= 0) && (reg < kNumberOfCpuRegisters)); @@ -930,7 +898,6 @@ int64_t Simulator::get_register(Register reg, R31Type r31t) const { } } - void Simulator::set_wregister(Register reg, int32_t value, R31Type r31t) { ASSERT((reg >= 0) && (reg < kNumberOfCpuRegisters)); // When setting in W mode, clear the high bits. @@ -939,7 +906,6 @@ void Simulator::set_wregister(Register reg, int32_t value, R31Type r31t) { } } - // Get the register from the architecture state. int32_t Simulator::get_wregister(Register reg, R31Type r31t) const { ASSERT((reg >= 0) && (reg < kNumberOfCpuRegisters)); @@ -950,49 +916,42 @@ int32_t Simulator::get_wregister(Register reg, R31Type r31t) const { } } - int32_t Simulator::get_vregisters(VRegister reg, int idx) const { ASSERT((reg >= 0) && (reg < kNumberOfVRegisters)); ASSERT((idx >= 0) && (idx <= 3)); return vregisters_[reg].bits.i32[idx]; } - void Simulator::set_vregisters(VRegister reg, int idx, int32_t value) { ASSERT((reg >= 0) && (reg < kNumberOfVRegisters)); ASSERT((idx >= 0) && (idx <= 3)); vregisters_[reg].bits.i32[idx] = value; } - int64_t Simulator::get_vregisterd(VRegister reg, int idx) const { ASSERT((reg >= 0) && (reg < kNumberOfVRegisters)); ASSERT((idx == 0) || (idx == 1)); return vregisters_[reg].bits.i64[idx]; } - void Simulator::set_vregisterd(VRegister reg, int idx, int64_t value) { ASSERT((reg >= 0) && (reg < kNumberOfVRegisters)); ASSERT((idx == 0) || (idx == 1)); vregisters_[reg].bits.i64[idx] = value; } - void Simulator::get_vregister(VRegister reg, simd_value_t* value) const { ASSERT((reg >= 0) && (reg < kNumberOfVRegisters)); value->bits.i64[0] = vregisters_[reg].bits.i64[0]; value->bits.i64[1] = vregisters_[reg].bits.i64[1]; } - void Simulator::set_vregister(VRegister reg, const simd_value_t& value) { ASSERT((reg >= 0) && (reg < kNumberOfVRegisters)); vregisters_[reg].bits.i64[0] = value.bits.i64[0]; vregisters_[reg].bits.i64[1] = value.bits.i64[1]; } - // Raw access to the PC register. void Simulator::set_pc(int64_t value) { pc_modified_ = true; @@ -1000,24 +959,22 @@ void Simulator::set_pc(int64_t value) { pc_ = value; } - // Raw access to the pc. int64_t Simulator::get_pc() const { return pc_; } - int64_t Simulator::get_last_pc() const { return last_pc_; } - void Simulator::HandleIllegalAccess(uword addr, Instr* instr) { uword fault_pc = get_pc(); uword last_pc = get_last_pc(); char buffer[128]; - snprintf(buffer, sizeof(buffer), "illegal memory access at 0x%" Px - ", pc=0x%" Px ", last_pc=0x%" Px "\n", + snprintf(buffer, sizeof(buffer), + "illegal memory access at 0x%" Px ", pc=0x%" Px ", last_pc=0x%" Px + "\n", addr, fault_pc, last_pc); SimulatorDebugger dbg(this); dbg.Stop(instr, buffer); @@ -1025,7 +982,6 @@ void Simulator::HandleIllegalAccess(uword addr, Instr* instr) { FATAL("Cannot continue execution after illegal memory access."); } - // The ARMv8 manual advises that an unaligned access may generate a fault, // and if not, will likely take a number of additional cycles to execute, // so let's just not generate any. @@ -1040,7 +996,6 @@ void Simulator::UnalignedAccess(const char* msg, uword addr, Instr* instr) { FATAL("Cannot continue execution after unaligned access."); } - void Simulator::UnimplementedInstruction(Instr* instr) { char buffer[128]; snprintf(buffer, sizeof(buffer), @@ -1051,7 +1006,6 @@ void Simulator::UnimplementedInstruction(Instr* instr) { FATAL("Cannot continue execution after unimplemented instruction."); } - // Returns the top of the stack area to enable checking for stack pointer // validity. uword Simulator::StackTop() const { @@ -1061,12 +1015,10 @@ uword Simulator::StackTop() const { (OSThread::GetSpecifiedStackSize() + OSThread::kStackSizeBuffer); } - bool Simulator::IsTracingExecution() const { return icount_ > FLAG_trace_sim_after; } - intptr_t Simulator::ReadX(uword addr, Instr* instr) { if ((addr & 7) == 0) { intptr_t* ptr = reinterpret_cast(addr); @@ -1076,7 +1028,6 @@ intptr_t Simulator::ReadX(uword addr, Instr* instr) { return 0; } - void Simulator::WriteX(uword addr, intptr_t value, Instr* instr) { if ((addr & 7) == 0) { intptr_t* ptr = reinterpret_cast(addr); @@ -1086,7 +1037,6 @@ void Simulator::WriteX(uword addr, intptr_t value, Instr* instr) { UnalignedAccess("write", addr, instr); } - uint32_t Simulator::ReadWU(uword addr, Instr* instr) { if ((addr & 3) == 0) { uint32_t* ptr = reinterpret_cast(addr); @@ -1096,7 +1046,6 @@ uint32_t Simulator::ReadWU(uword addr, Instr* instr) { return 0; } - int32_t Simulator::ReadW(uword addr, Instr* instr) { if ((addr & 3) == 0) { int32_t* ptr = reinterpret_cast(addr); @@ -1106,7 +1055,6 @@ int32_t Simulator::ReadW(uword addr, Instr* instr) { return 0; } - void Simulator::WriteW(uword addr, uint32_t value, Instr* instr) { if ((addr & 3) == 0) { uint32_t* ptr = reinterpret_cast(addr); @@ -1116,7 +1064,6 @@ void Simulator::WriteW(uword addr, uint32_t value, Instr* instr) { UnalignedAccess("write single word", addr, instr); } - uint16_t Simulator::ReadHU(uword addr, Instr* instr) { if ((addr & 1) == 0) { uint16_t* ptr = reinterpret_cast(addr); @@ -1126,7 +1073,6 @@ uint16_t Simulator::ReadHU(uword addr, Instr* instr) { return 0; } - int16_t Simulator::ReadH(uword addr, Instr* instr) { if ((addr & 1) == 0) { int16_t* ptr = reinterpret_cast(addr); @@ -1136,7 +1082,6 @@ int16_t Simulator::ReadH(uword addr, Instr* instr) { return 0; } - void Simulator::WriteH(uword addr, uint16_t value, Instr* instr) { if ((addr & 1) == 0) { uint16_t* ptr = reinterpret_cast(addr); @@ -1146,25 +1091,21 @@ void Simulator::WriteH(uword addr, uint16_t value, Instr* instr) { UnalignedAccess("halfword write", addr, instr); } - uint8_t Simulator::ReadBU(uword addr) { uint8_t* ptr = reinterpret_cast(addr); return *ptr; } - int8_t Simulator::ReadB(uword addr) { int8_t* ptr = reinterpret_cast(addr); return *ptr; } - void Simulator::WriteB(uword addr, uint8_t value) { uint8_t* ptr = reinterpret_cast(addr); *ptr = value; } - // Synchronization primitives support. void Simulator::SetExclusiveAccess(uword addr) { Thread* thread = Thread::Current(); @@ -1188,7 +1129,6 @@ void Simulator::SetExclusiveAccess(uword addr) { exclusive_access_state_[i].addr = addr; } - bool Simulator::HasExclusiveAccessAndOpen(uword addr) { Thread* thread = Thread::Current(); ASSERT(thread != NULL); @@ -1210,28 +1150,24 @@ bool Simulator::HasExclusiveAccessAndOpen(uword addr) { return result; } - void Simulator::ClearExclusive() { MutexLocker ml(exclusive_access_lock_); // Remove the reservation for this thread. SetExclusiveAccess(0); } - intptr_t Simulator::ReadExclusiveX(uword addr, Instr* instr) { MutexLocker ml(exclusive_access_lock_); SetExclusiveAccess(addr); return ReadX(addr, instr); } - intptr_t Simulator::ReadExclusiveW(uword addr, Instr* instr) { MutexLocker ml(exclusive_access_lock_); SetExclusiveAccess(addr); return ReadWU(addr, instr); } - intptr_t Simulator::WriteExclusiveX(uword addr, intptr_t value, Instr* instr) { MutexLocker ml(exclusive_access_lock_); bool write_allowed = HasExclusiveAccessAndOpen(addr); @@ -1242,7 +1178,6 @@ intptr_t Simulator::WriteExclusiveX(uword addr, intptr_t value, Instr* instr) { return 1; // Failure. } - intptr_t Simulator::WriteExclusiveW(uword addr, intptr_t value, Instr* instr) { MutexLocker ml(exclusive_access_lock_); bool write_allowed = HasExclusiveAccessAndOpen(addr); @@ -1253,7 +1188,6 @@ intptr_t Simulator::WriteExclusiveW(uword addr, intptr_t value, Instr* instr) { return 1; // Failure. } - uword Simulator::CompareExchange(uword* address, uword compare_value, uword new_value) { @@ -1273,7 +1207,6 @@ uword Simulator::CompareExchange(uword* address, return value; } - uint32_t Simulator::CompareExchangeUint32(uint32_t* address, uint32_t compare_value, uint32_t new_value) { @@ -1293,7 +1226,6 @@ uint32_t Simulator::CompareExchangeUint32(uint32_t* address, return value; } - // Unsupported instructions use Format to print an error and stop execution. void Simulator::Format(Instr* instr, const char* format) { OS::Print("Simulator found unsupported instruction:\n 0x%p: %s\n", instr, @@ -1301,14 +1233,12 @@ void Simulator::Format(Instr* instr, const char* format) { UNIMPLEMENTED(); } - // Calculate and set the Negative and Zero flags. void Simulator::SetNZFlagsW(int32_t val) { n_flag_ = (val < 0); z_flag_ = (val == 0); } - // Calculate C flag value for additions (and subtractions with adjusted args). bool Simulator::CarryFromW(int32_t left, int32_t right, int32_t carry) { uint64_t uleft = static_cast(left); @@ -1317,21 +1247,18 @@ bool Simulator::CarryFromW(int32_t left, int32_t right, int32_t carry) { return ((uleft + uright + ucarry) >> 32) != 0; } - // Calculate V flag value for additions (and subtractions with adjusted args). bool Simulator::OverflowFromW(int32_t left, int32_t right, int32_t carry) { int64_t result = static_cast(left) + right + carry; return (result >> 31) != (result >> 32); } - // Calculate and set the Negative and Zero flags. void Simulator::SetNZFlagsX(int64_t val) { n_flag_ = (val < 0); z_flag_ = (val == 0); } - // Calculate C flag value for additions and subtractions. bool Simulator::CarryFromX(int64_t alu_out, int64_t left, @@ -1344,7 +1271,6 @@ bool Simulator::CarryFromX(int64_t alu_out, } } - // Calculate V flag value for additions and subtractions. bool Simulator::OverflowFromX(int64_t alu_out, int64_t left, @@ -1357,19 +1283,16 @@ bool Simulator::OverflowFromX(int64_t alu_out, } } - // Set the Carry flag. void Simulator::SetCFlag(bool val) { c_flag_ = val; } - // Set the oVerflow flag. void Simulator::SetVFlag(bool val) { v_flag_ = val; } - void Simulator::DecodeMoveWide(Instr* instr) { const Register rd = instr->RdField(); const int hw = instr->HWField(); @@ -1413,7 +1336,6 @@ void Simulator::DecodeMoveWide(Instr* instr) { } } - void Simulator::DecodeAddSubImm(Instr* instr) { const bool addition = (instr->Bit(30) == 0); // Format(instr, "addi'sf's 'rd, 'rn, 'imm12s"); @@ -1450,7 +1372,6 @@ void Simulator::DecodeAddSubImm(Instr* instr) { } } - void Simulator::DecodeLogicalImm(Instr* instr) { const int op = instr->Bits(29, 2); const bool set_flags = op == 3; @@ -1501,7 +1422,6 @@ void Simulator::DecodeLogicalImm(Instr* instr) { } } - void Simulator::DecodePCRel(Instr* instr) { const int op = instr->Bit(31); if (op == 0) { @@ -1517,7 +1437,6 @@ void Simulator::DecodePCRel(Instr* instr) { } } - void Simulator::DecodeDPImmediate(Instr* instr) { if (instr->IsMoveWideOp()) { DecodeMoveWide(instr); @@ -1532,7 +1451,6 @@ void Simulator::DecodeDPImmediate(Instr* instr) { } } - void Simulator::DecodeCompareAndBranch(Instr* instr) { const int op = instr->Bit(24); const Register rt = instr->RtField(); @@ -1553,7 +1471,6 @@ void Simulator::DecodeCompareAndBranch(Instr* instr) { } } - bool Simulator::ConditionallyExecute(Instr* instr) { Condition cond; if (instr->IsConditionalSelectOp()) { @@ -1598,7 +1515,6 @@ bool Simulator::ConditionallyExecute(Instr* instr) { return false; } - void Simulator::DecodeConditionalBranch(Instr* instr) { // Format(instr, "b'cond 'dest19"); if ((instr->Bit(24) != 0) || (instr->Bit(4) != 0)) { @@ -1611,7 +1527,6 @@ void Simulator::DecodeConditionalBranch(Instr* instr) { } } - // Calls into the Dart runtime are based on this interface. typedef void (*SimulatorRuntimeCall)(NativeArguments arguments); @@ -1639,7 +1554,6 @@ typedef double (*SimulatorLeafFloatRuntimeCall)(double d0, typedef void (*SimulatorBootstrapNativeCall)(NativeArguments* arguments); typedef void (*SimulatorNativeCall)(NativeArguments* arguments, uword target); - void Simulator::DoRedirectedCall(Instr* instr) { SimulatorSetjmpBuffer buffer(this); if (!setjmp(buffer.buffer_)) { @@ -1751,7 +1665,6 @@ void Simulator::DoRedirectedCall(Instr* instr) { } } - void Simulator::DecodeExceptionGen(Instr* instr) { if ((instr->Bits(0, 2) == 1) && (instr->Bits(2, 3) == 0) && (instr->Bits(21, 3) == 0)) { @@ -1790,7 +1703,6 @@ void Simulator::DecodeExceptionGen(Instr* instr) { } } - void Simulator::DecodeSystem(Instr* instr) { if (instr->InstructionBits() == CLREX) { // Format(instr, "clrex"); @@ -1811,7 +1723,6 @@ void Simulator::DecodeSystem(Instr* instr) { } } - void Simulator::DecodeTestAndBranch(Instr* instr) { const int op = instr->Bit(24); const int bitpos = instr->Bits(19, 4) | (instr->Bit(31) << 5); @@ -1832,7 +1743,6 @@ void Simulator::DecodeTestAndBranch(Instr* instr) { } } - void Simulator::DecodeUnconditionalBranch(Instr* instr) { const bool link = instr->Bit(31) == 1; const int64_t imm26 = instr->SImm26Field(); @@ -1844,7 +1754,6 @@ void Simulator::DecodeUnconditionalBranch(Instr* instr) { } } - void Simulator::DecodeUnconditionalBranchReg(Instr* instr) { if ((instr->Bits(0, 5) == 0) && (instr->Bits(10, 6) == 0) && (instr->Bits(16, 5) == 0x1f)) { @@ -1881,7 +1790,6 @@ void Simulator::DecodeUnconditionalBranchReg(Instr* instr) { } } - void Simulator::DecodeCompareBranch(Instr* instr) { if (instr->IsCompareAndBranchOp()) { DecodeCompareAndBranch(instr); @@ -1902,7 +1810,6 @@ void Simulator::DecodeCompareBranch(Instr* instr) { } } - void Simulator::DecodeLoadStoreReg(Instr* instr) { // Calculate the address. const Register rn = instr->RnField(); @@ -2096,7 +2003,6 @@ void Simulator::DecodeLoadStoreReg(Instr* instr) { } } - void Simulator::DecodeLoadStoreRegPair(Instr* instr) { const int32_t opc = instr->Bits(23, 3); const Register rn = instr->RnField(); @@ -2190,7 +2096,6 @@ void Simulator::DecodeLoadStoreRegPair(Instr* instr) { } } - void Simulator::DecodeLoadRegLiteral(Instr* instr) { if ((instr->Bit(31) != 0) || (instr->Bit(29) != 0) || (instr->Bits(24, 3) != 0)) { @@ -2211,7 +2116,6 @@ void Simulator::DecodeLoadRegLiteral(Instr* instr) { } } - void Simulator::DecodeLoadStoreExclusive(Instr* instr) { if ((instr->Bit(23) != 0) || (instr->Bit(21) != 0) || (instr->Bit(15) != 0)) { UNIMPLEMENTED(); @@ -2251,7 +2155,6 @@ void Simulator::DecodeLoadStoreExclusive(Instr* instr) { } } - void Simulator::DecodeLoadStore(Instr* instr) { if (instr->IsLoadStoreRegOp()) { DecodeLoadStoreReg(instr); @@ -2266,7 +2169,6 @@ void Simulator::DecodeLoadStore(Instr* instr) { } } - int64_t Simulator::ShiftOperand(uint8_t reg_size, int64_t value, Shift shift_type, @@ -2301,7 +2203,6 @@ int64_t Simulator::ShiftOperand(uint8_t reg_size, } } - int64_t Simulator::ExtendOperand(uint8_t reg_size, int64_t value, Extend extend_type, @@ -2336,7 +2237,6 @@ int64_t Simulator::ExtendOperand(uint8_t reg_size, return (value << amount) & mask; } - int64_t Simulator::DecodeShiftExtendOperand(Instr* instr) { const Register rm = instr->RmField(); const int64_t rm_val = get_register(rm, R31IsZR); @@ -2355,7 +2255,6 @@ int64_t Simulator::DecodeShiftExtendOperand(Instr* instr) { return -1; } - void Simulator::DecodeAddSubShiftExt(Instr* instr) { // Format(instr, "add'sf's 'rd, 'rn, 'shift_op"); // also, sub, cmp, etc. @@ -2392,7 +2291,6 @@ void Simulator::DecodeAddSubShiftExt(Instr* instr) { } } - void Simulator::DecodeAddSubWithCarry(Instr* instr) { // Format(instr, "adc'sf's 'rd, 'rn, 'rm"); // Format(instr, "sbc'sf's 'rd, 'rn, 'rm"); @@ -2430,7 +2328,6 @@ void Simulator::DecodeAddSubWithCarry(Instr* instr) { } } - void Simulator::DecodeLogicalShift(Instr* instr) { const int op = (instr->Bits(29, 2) << 1) | instr->Bit(21); const Register rd = instr->RdField(); @@ -2494,7 +2391,6 @@ void Simulator::DecodeLogicalShift(Instr* instr) { } } - static int64_t divide64(int64_t top, int64_t bottom, bool signd) { // ARM64 does not trap on integer division by zero. The destination register // is instead set to 0. @@ -2517,7 +2413,6 @@ static int64_t divide64(int64_t top, int64_t bottom, bool signd) { } } - static int32_t divide32(int32_t top, int32_t bottom, bool signd) { // ARM64 does not trap on integer division by zero. The destination register // is instead set to 0. @@ -2540,7 +2435,6 @@ static int32_t divide32(int32_t top, int32_t bottom, bool signd) { } } - void Simulator::DecodeMiscDP1Source(Instr* instr) { if (instr->Bit(29) != 0) { UnimplementedInstruction(instr); @@ -2577,7 +2471,6 @@ void Simulator::DecodeMiscDP1Source(Instr* instr) { } } - void Simulator::DecodeMiscDP2Source(Instr* instr) { if (instr->Bit(29) != 0) { UnimplementedInstruction(instr); @@ -2645,7 +2538,6 @@ void Simulator::DecodeMiscDP2Source(Instr* instr) { } } - void Simulator::DecodeMiscDP3Source(Instr* instr) { const Register rd = instr->RdField(); const Register rn = instr->RnField(); @@ -2726,7 +2618,6 @@ void Simulator::DecodeMiscDP3Source(Instr* instr) { } } - void Simulator::DecodeConditionalSelect(Instr* instr) { const Register rd = instr->RdField(); const Register rn = instr->RnField(); @@ -2774,7 +2665,6 @@ void Simulator::DecodeConditionalSelect(Instr* instr) { } } - void Simulator::DecodeDPRegister(Instr* instr) { if (instr->IsAddSubShiftExtOp()) { DecodeAddSubShiftExt(instr); @@ -2795,7 +2685,6 @@ void Simulator::DecodeDPRegister(Instr* instr) { } } - void Simulator::DecodeSIMDCopy(Instr* instr) { const int32_t Q = instr->Bit(30); const int32_t op = instr->Bit(29); @@ -2890,7 +2779,6 @@ void Simulator::DecodeSIMDCopy(Instr* instr) { } } - void Simulator::DecodeSIMDThreeSame(Instr* instr) { const int Q = instr->Bit(30); const int U = instr->Bit(29); @@ -3047,7 +2935,6 @@ void Simulator::DecodeSIMDThreeSame(Instr* instr) { } } - static float arm_reciprocal_sqrt_estimate(float a) { // From the ARM Architecture Reference Manual A2-87. if (isinf(a) || (fabs(a) >= exp2f(126))) @@ -3102,7 +2989,6 @@ static float arm_reciprocal_sqrt_estimate(float a) { return bit_cast(result_bits); } - static float arm_recip_estimate(float a) { // From the ARM Architecture Reference Manual A2-85. if (isinf(a) || (fabs(a) >= exp2f(126))) @@ -3139,7 +3025,6 @@ static float arm_recip_estimate(float a) { return bit_cast(result_bits); } - void Simulator::DecodeSIMDTwoReg(Instr* instr) { const int32_t Q = instr->Bit(30); const int32_t U = instr->Bit(29); @@ -3241,7 +3126,6 @@ void Simulator::DecodeSIMDTwoReg(Instr* instr) { } } - void Simulator::DecodeDPSimd1(Instr* instr) { if (instr->IsSIMDCopyOp()) { DecodeSIMDCopy(instr); @@ -3254,7 +3138,6 @@ void Simulator::DecodeDPSimd1(Instr* instr) { } } - void Simulator::DecodeFPImm(Instr* instr) { if ((instr->Bit(31) != 0) || (instr->Bit(29) != 0) || (instr->Bit(23) != 0) || (instr->Bits(5, 5) != 0)) { @@ -3274,7 +3157,6 @@ void Simulator::DecodeFPImm(Instr* instr) { } } - void Simulator::DecodeFPIntCvt(Instr* instr) { const VRegister vd = instr->VdField(); const VRegister vn = instr->VnField(); @@ -3332,7 +3214,6 @@ void Simulator::DecodeFPIntCvt(Instr* instr) { } } - void Simulator::DecodeFPOneSource(Instr* instr) { const int opc = instr->Bits(15, 6); const VRegister vd = instr->VdField(); @@ -3387,7 +3268,6 @@ void Simulator::DecodeFPOneSource(Instr* instr) { set_vregisterd(vd, 1, 0); } - void Simulator::DecodeFPTwoSource(Instr* instr) { if (instr->Bits(22, 2) != 1) { UnimplementedInstruction(instr); @@ -3427,7 +3307,6 @@ void Simulator::DecodeFPTwoSource(Instr* instr) { set_vregisterd(vd, 1, 0); } - void Simulator::DecodeFPCompare(Instr* instr) { const VRegister vn = instr->VnField(); const VRegister vm = instr->VmField(); @@ -3468,7 +3347,6 @@ void Simulator::DecodeFPCompare(Instr* instr) { } } - void Simulator::DecodeFP(Instr* instr) { if (instr->IsFPImmOp()) { DecodeFPImm(instr); @@ -3485,7 +3363,6 @@ void Simulator::DecodeFP(Instr* instr) { } } - void Simulator::DecodeDPSimd2(Instr* instr) { if (instr->IsFPOp()) { DecodeFP(instr); @@ -3494,7 +3371,6 @@ void Simulator::DecodeDPSimd2(Instr* instr) { } } - // Executes the current instruction. void Simulator::InstructionDecode(Instr* instr) { pc_modified_ = false; @@ -3530,7 +3406,6 @@ void Simulator::InstructionDecode(Instr* instr) { } } - void Simulator::Execute() { // Get the PC to simulate. Cannot use the accessor here as we need the // raw PC value and not the one used as input to arithmetic instructions. @@ -3571,7 +3446,6 @@ void Simulator::Execute() { } } - int64_t Simulator::Call(int64_t entry, int64_t parameter0, int64_t parameter1, @@ -3664,7 +3538,6 @@ int64_t Simulator::Call(int64_t entry, return return_value; } - void Simulator::JumpToFrame(uword pc, uword sp, uword fp, Thread* thread) { // Walk over all setjmp buffers (simulated --> C++ transitions) // and try to find the setjmp associated with the simulated stack pointer. diff --git a/runtime/vm/simulator_dbc.cc b/runtime/vm/simulator_dbc.cc index 053c81a3185..92b158e62c7 100644 --- a/runtime/vm/simulator_dbc.cc +++ b/runtime/vm/simulator_dbc.cc @@ -86,21 +86,17 @@ class SimulatorSetjmpBuffer { DISALLOW_COPY_AND_ASSIGN(SimulatorSetjmpBuffer); }; - DART_FORCE_INLINE static RawObject** SavedCallerFP(RawObject** FP) { return reinterpret_cast(FP[kSavedCallerFpSlotFromFp]); } - DART_FORCE_INLINE static RawObject** FrameArguments(RawObject** FP, intptr_t argc) { return FP - (kDartFrameFixedSize + argc); } - #define RAW_CAST(Type, val) (SimulatorHelpers::CastTo##Type(val)) - class SimulatorHelpers { public: #define DEFINE_CASTS(Type) \ @@ -458,7 +454,6 @@ class SimulatorHelpers { return static_cast(FP[kPcMarkerSlotFromFp]); } - DART_FORCE_INLINE static void SetFrameCode(RawObject** FP, RawCode* code) { ASSERT(GetClassId(code) == kCodeCid); FP[kPcMarkerSlotFromFp] = code; @@ -474,22 +469,18 @@ class SimulatorHelpers { } }; - DART_FORCE_INLINE static uint32_t* SavedCallerPC(RawObject** FP) { return reinterpret_cast(FP[kSavedCallerPcSlotFromFp]); } - DART_FORCE_INLINE static RawFunction* FrameFunction(RawObject** FP) { RawFunction* function = static_cast(FP[kFunctionSlotFromFp]); ASSERT(SimulatorHelpers::GetClassId(function) == kFunctionCid); return function; } - IntrinsicHandler Simulator::intrinsics_[Simulator::kIntrinsicCount]; - // Synchronization primitives support. void Simulator::InitOnce() { for (intptr_t i = 0; i < kIntrinsicCount; i++) { @@ -529,7 +520,6 @@ void Simulator::InitOnce() { SimulatorHelpers::SetAsyncThreadStackTrace; } - Simulator::Simulator() : stack_(NULL), fp_(NULL) { // Setup simulator support first. Some of this information is needed to // setup the architecture state. @@ -547,7 +537,6 @@ Simulator::Simulator() : stack_(NULL), fp_(NULL) { NOT_IN_PRODUCT(icount_ = 0;) } - Simulator::~Simulator() { delete[] stack_; Isolate* isolate = Isolate::Current(); @@ -556,7 +545,6 @@ Simulator::~Simulator() { } } - // Get the active Simulator for the current isolate. Simulator* Simulator::Current() { Simulator* simulator = Isolate::Current()->simulator(); @@ -567,7 +555,6 @@ Simulator* Simulator::Current() { return simulator; } - // Returns the top of the stack area to enable checking for stack pointer // validity. uword Simulator::StackTop() const { @@ -577,14 +564,12 @@ uword Simulator::StackTop() const { (OSThread::GetSpecifiedStackSize() + OSThread::kStackSizeBuffer); } - #if !defined(PRODUCT) // Returns true if tracing of executed instructions is enabled. DART_FORCE_INLINE bool Simulator::IsTracingExecution() const { return icount_ > FLAG_trace_sim_after; } - // Prints bytecode instruction at given pc for instruction tracing. DART_NOINLINE void Simulator::TraceInstruction(uint32_t* pc) const { THR_Print("%" Pu64 " ", icount_); @@ -597,7 +582,6 @@ DART_NOINLINE void Simulator::TraceInstruction(uint32_t* pc) const { } #endif // !defined(PRODUCT) - // Calls into the Dart runtime are based on this interface. typedef void (*SimulatorRuntimeCall)(NativeArguments arguments); @@ -614,7 +598,6 @@ typedef double (*SimulatorLeafFloatRuntimeCall)(double d0, double d1); typedef void (*SimulatorBootstrapNativeCall)(NativeArguments* arguments); typedef void (*SimulatorNativeCall)(NativeArguments* arguments, uword target); - void Simulator::Exit(Thread* thread, RawObject** base, RawObject** frame, @@ -661,7 +644,6 @@ DART_FORCE_INLINE static bool SignedAddWithOverflow(intptr_t lhs, return (res != 0); } - DART_FORCE_INLINE static bool SignedSubWithOverflow(intptr_t lhs, intptr_t rhs, intptr_t* out) { @@ -692,7 +674,6 @@ DART_FORCE_INLINE static bool SignedSubWithOverflow(intptr_t lhs, return (res != 0); } - DART_FORCE_INLINE static bool SignedMulWithOverflow(intptr_t lhs, intptr_t rhs, intptr_t* out) { @@ -737,12 +718,10 @@ DART_FORCE_INLINE static bool SignedMulWithOverflow(intptr_t lhs, return (res != 0); } - DART_FORCE_INLINE static bool AreBothSmis(intptr_t a, intptr_t b) { return ((a | b) & kHeapObjectTag) == 0; } - #define SMI_MUL(lhs, rhs, pres) SignedMulWithOverflow((lhs), (rhs) >> 1, pres) #define SMI_COND(cond, lhs, rhs, pres) \ ((*(pres) = ((lhs cond rhs) ? true_value : false_value)), false) @@ -753,7 +732,6 @@ DART_FORCE_INLINE static bool AreBothSmis(intptr_t a, intptr_t b) { #define SMI_BITAND(lhs, rhs, pres) ((*(pres) = ((lhs) & (rhs))), false) #define SMI_BITXOR(lhs, rhs, pres) ((*(pres) = ((lhs) ^ (rhs))), false) - void Simulator::CallRuntime(Thread* thread, RawObject** base, RawObject** exit_frame, @@ -767,7 +745,6 @@ void Simulator::CallRuntime(Thread* thread, reinterpret_cast(target)(native_args); } - DART_FORCE_INLINE static void EnterSyntheticFrame(RawObject*** FP, RawObject*** SP, uint32_t* pc) { @@ -779,7 +756,6 @@ DART_FORCE_INLINE static void EnterSyntheticFrame(RawObject*** FP, *SP = fp - 1; } - DART_FORCE_INLINE static void LeaveSyntheticFrame(RawObject*** FP, RawObject*** SP) { RawObject** fp = *FP; @@ -787,7 +763,6 @@ DART_FORCE_INLINE static void LeaveSyntheticFrame(RawObject*** FP, *SP = fp - kDartFrameFixedSize; } - DART_FORCE_INLINE void Simulator::Invoke(Thread* thread, RawObject** call_base, RawObject** call_top, @@ -809,7 +784,6 @@ DART_FORCE_INLINE void Simulator::Invoke(Thread* thread, *SP = *FP - 1; } - void Simulator::InlineCacheMiss(int checked_args, Thread* thread, RawICData* icdata, @@ -844,7 +818,6 @@ void Simulator::InlineCacheMiss(int checked_args, result, reinterpret_cast(handler)); } - DART_FORCE_INLINE void Simulator::InstanceCall1(Thread* thread, RawICData* icdata, RawObject** call_base, @@ -887,7 +860,6 @@ DART_FORCE_INLINE void Simulator::InstanceCall1(Thread* thread, Invoke(thread, call_base, top, pp, pc, FP, SP); } - DART_FORCE_INLINE void Simulator::InstanceCall2(Thread* thread, RawICData* icdata, RawObject** call_base, @@ -932,7 +904,6 @@ DART_FORCE_INLINE void Simulator::InstanceCall2(Thread* thread, Invoke(thread, call_base, top, pp, pc, FP, SP); } - // Note: functions below are marked DART_NOINLINE to recover performance on // ARM where inlining these functions into the interpreter loop seemed to cause // some code quality issues. @@ -952,7 +923,6 @@ static DART_NOINLINE bool InvokeRuntime(Thread* thread, } } - static DART_NOINLINE bool InvokeBootstrapNative(Thread* thread, Simulator* sim, SimulatorBootstrapNativeCall f, @@ -969,7 +939,6 @@ static DART_NOINLINE bool InvokeBootstrapNative(Thread* thread, } } - static DART_NOINLINE bool InvokeNativeNoScopeWrapper(Thread* thread, Simulator* sim, Dart_NativeFunction f, @@ -987,7 +956,6 @@ static DART_NOINLINE bool InvokeNativeNoScopeWrapper(Thread* thread, } } - static DART_NOINLINE bool InvokeNativeAutoScopeWrapper(Thread* thread, Simulator* sim, Dart_NativeFunction f, @@ -1068,7 +1036,6 @@ static DART_NOINLINE bool InvokeNativeAutoScopeWrapper(Thread* thread, USE(rD) #define DECODE_A_X rD = (static_cast(op) >> Bytecode::kDShift); - #define SMI_FASTPATH_ICDATA_INC \ do { \ ASSERT(Bytecode::IsCallOpcode(*pc)); \ @@ -1118,7 +1085,6 @@ static DART_NOINLINE bool InvokeNativeAutoScopeWrapper(Thread* thread, Func(lhs, rhs, slot); \ } - // Exception handling helper. Gets handler FP and PC from the Simulator where // they were stored by Simulator::Longjmp and proceeds to execute the handler. // Corner case: handler PC can be a fake marker that marks entry frame, which @@ -1162,7 +1128,6 @@ static DART_NOINLINE bool InvokeNativeAutoScopeWrapper(Thread* thread, #define LOAD_CONSTANT(index) (pp->data()[(index)].raw_obj_) - // Returns true if deoptimization succeeds. DART_FORCE_INLINE bool Simulator::Deoptimize(Thread* thread, RawObjectPool** pp, @@ -1219,7 +1184,6 @@ DART_FORCE_INLINE bool Simulator::Deoptimize(Thread* thread, return true; } - RawObject* Simulator::Call(const Code& code, const Array& arguments_descriptor, const Array& arguments, @@ -3904,7 +3868,6 @@ RawObject* Simulator::Call(const Code& code, return 0; } - void Simulator::JumpToFrame(uword pc, uword sp, uword fp, Thread* thread) { // Walk over all setjmp buffers (simulated --> C++ transitions) // and try to find the setjmp associated with the simulated frame pointer. diff --git a/runtime/vm/simulator_dbc.h b/runtime/vm/simulator_dbc.h index 6e9a7f177ca..d068eeecb76 100644 --- a/runtime/vm/simulator_dbc.h +++ b/runtime/vm/simulator_dbc.h @@ -34,7 +34,6 @@ typedef bool (*IntrinsicHandler)(Thread* thread, RawObject** FP, RawObject** result); - class Simulator { public: static const uword kSimulatorStackUnderflowSize = 0x80; diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc index f54a84c58a7..9bc8103c6d8 100644 --- a/runtime/vm/snapshot.cc +++ b/runtime/vm/snapshot.cc @@ -31,14 +31,12 @@ namespace dart { static const int kNumInitialReferences = 32; - static bool IsSingletonClassId(intptr_t class_id) { // Check if this is a singleton object class which is shared by all isolates. return ((class_id >= kClassCid && class_id <= kUnwindErrorCid) || (class_id >= kNullCid && class_id <= kVoidCid)); } - static bool IsObjectStoreClassId(intptr_t class_id) { // Check if this is a class which is stored in the object store. return (class_id == kObjectCid || @@ -50,13 +48,11 @@ static bool IsObjectStoreClassId(intptr_t class_id) { class_id == kNullCid); } - static bool IsObjectStoreTypeId(intptr_t index) { // Check if this is a type which is stored in the object store. return (index >= kObjectType && index <= kArrayType); } - static bool IsSplitClassId(intptr_t class_id) { // Return whether this class is serialized in two steps: first a reference, // with sufficient information to allocate a correctly sized object, and then @@ -66,21 +62,18 @@ static bool IsSplitClassId(intptr_t class_id) { RawObject::IsImplicitFieldClassId(class_id); } - static intptr_t ClassIdFromObjectId(intptr_t object_id) { ASSERT(object_id > kClassIdsOffset); intptr_t class_id = (object_id - kClassIdsOffset); return class_id; } - static intptr_t ObjectIdFromClassId(intptr_t class_id) { ASSERT((class_id > kIllegalCid) && (class_id < kNumPredefinedCids)); ASSERT(!(RawObject::IsImplicitFieldClassId(class_id))); return (class_id + kClassIdsOffset); } - static RawType* GetType(ObjectStore* object_store, intptr_t index) { switch (index) { case kObjectType: @@ -112,7 +105,6 @@ static RawType* GetType(ObjectStore* object_store, intptr_t index) { return Type::null(); } - static intptr_t GetTypeIndex(ObjectStore* object_store, const RawType* raw_type) { ASSERT(raw_type->IsHeapObject()); @@ -142,7 +134,6 @@ static intptr_t GetTypeIndex(ObjectStore* object_store, return kInvalidIndex; } - const char* Snapshot::KindToCString(Kind kind) { switch (kind) { case kFull: @@ -163,7 +154,6 @@ const char* Snapshot::KindToCString(Kind kind) { } } - // TODO(5411462): Temporary setup of snapshot for testing purposes, // the actual creation of a snapshot maybe done differently. const Snapshot* Snapshot::SetupFromBuffer(const void* raw_memory) { @@ -182,19 +172,16 @@ const Snapshot* Snapshot::SetupFromBuffer(const void* raw_memory) { return snapshot; } - RawSmi* BaseReader::ReadAsSmi() { intptr_t value = Read(); ASSERT((value & kSmiTagMask) == kSmiTag); return reinterpret_cast(value); } - intptr_t BaseReader::ReadSmiValue() { return Smi::Value(ReadAsSmi()); } - SnapshotReader::SnapshotReader(const uint8_t* buffer, intptr_t size, Snapshot::Kind kind, @@ -227,7 +214,6 @@ SnapshotReader::SnapshotReader(const uint8_t* buffer, : 0), backward_references_(backward_refs) {} - RawObject* SnapshotReader::ReadObject() { // Setup for long jump in case there is an exception while reading. LongJumpScope jump; @@ -257,7 +243,6 @@ RawObject* SnapshotReader::ReadObject() { } } - RawClass* SnapshotReader::ReadClassId(intptr_t object_id) { ASSERT(!Snapshot::IsFull(kind_)); // Read the class header information and lookup the class. @@ -288,7 +273,6 @@ RawClass* SnapshotReader::ReadClassId(intptr_t object_id) { return cls.raw(); } - RawFunction* SnapshotReader::ReadFunctionId(intptr_t object_id) { ASSERT(kind_ == Snapshot::kScript); // Read the function header information and lookup the function. @@ -325,7 +309,6 @@ RawFunction* SnapshotReader::ReadFunctionId(intptr_t object_id) { return func.raw(); } - RawObject* SnapshotReader::ReadStaticImplicitClosure(intptr_t object_id, intptr_t class_header) { ASSERT(!Snapshot::IsFull(kind_)); @@ -367,13 +350,11 @@ RawObject* SnapshotReader::ReadStaticImplicitClosure(intptr_t object_id, return obj.raw(); } - intptr_t SnapshotReader::NextAvailableObjectId() const { return backward_references_->length() + kMaxPredefinedObjectIds + max_vm_isolate_object_id_; } - void SnapshotReader::SetReadException(const char* msg) { const String& error_str = String::Handle(zone(), String::New(msg)); const Array& args = Array::Handle(zone(), Array::New(1)); @@ -388,17 +369,14 @@ void SnapshotReader::SetReadException(const char* msg) { thread()->long_jump_base()->Jump(1, error); } - RawObject* SnapshotReader::VmIsolateSnapshotObject(intptr_t index) const { return Object::vm_isolate_snapshot_object_table().At(index); } - bool SnapshotReader::is_vm_isolate() const { return isolate() == Dart::vm_isolate(); } - RawObject* SnapshotReader::ReadObjectImpl(bool as_reference, intptr_t patch_object_id, intptr_t patch_offset) { @@ -411,7 +389,6 @@ RawObject* SnapshotReader::ReadObjectImpl(bool as_reference, patch_object_id, patch_offset); } - RawObject* SnapshotReader::ReadObjectImpl(intptr_t header_value, bool as_reference, intptr_t patch_object_id, @@ -480,7 +457,6 @@ RawObject* SnapshotReader::ReadObjectImpl(intptr_t header_value, return pobj_.raw(); } - RawObject* SnapshotReader::ReadInstance(intptr_t object_id, intptr_t tags, bool as_reference) { @@ -550,7 +526,6 @@ RawObject* SnapshotReader::ReadInstance(intptr_t object_id, return result->raw(); } - void SnapshotReader::AddBackRef(intptr_t id, Object* obj, DeserializeState state, @@ -563,7 +538,6 @@ void SnapshotReader::AddBackRef(intptr_t id, backward_references_->Add(node); } - Object* SnapshotReader::GetBackRef(intptr_t id) { ASSERT(id >= kMaxPredefinedObjectIds); intptr_t index = (id - kMaxPredefinedObjectIds); @@ -575,7 +549,6 @@ Object* SnapshotReader::GetBackRef(intptr_t id) { return NULL; } - class HeapLocker : public StackResource { public: HeapLocker(Thread* thread, PageSpace* page_space) @@ -588,7 +561,6 @@ class HeapLocker : public StackResource { PageSpace* page_space_; }; - RawObject* SnapshotReader::ReadScriptSnapshot() { ASSERT(kind_ == Snapshot::kScript); @@ -614,7 +586,6 @@ RawObject* SnapshotReader::ReadScriptSnapshot() { return obj_.raw(); } - RawApiError* SnapshotReader::VerifyVersionAndFeatures(Isolate* isolate) { // If the version string doesn't match, return an error. // Note: New things are allocated only if we're going to return an error. @@ -681,7 +652,6 @@ RawApiError* SnapshotReader::VerifyVersionAndFeatures(Isolate* isolate) { return ApiError::null(); } - RawObject* SnapshotReader::NewInteger(int64_t value) { ASSERT((value & kSmiTagMask) == kSmiTag); value = value >> kSmiTagShift; @@ -691,7 +661,6 @@ RawObject* SnapshotReader::NewInteger(int64_t value) { return Mint::NewCanonical(value); } - int32_t ImageWriter::GetTextOffsetFor(RawInstructions* instructions, RawCode* code) { intptr_t heap_size = instructions->Size(); @@ -701,7 +670,6 @@ int32_t ImageWriter::GetTextOffsetFor(RawInstructions* instructions, return offset; } - int32_t ImageWriter::GetDataOffsetFor(RawObject* raw_object) { intptr_t heap_size = raw_object->Size(); intptr_t offset = next_object_offset_; @@ -710,7 +678,6 @@ int32_t ImageWriter::GetDataOffsetFor(RawObject* raw_object) { return offset; } - void ImageWriter::Write(WriteStream* clustered_stream, bool vm) { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -736,7 +703,6 @@ void ImageWriter::Write(WriteStream* clustered_stream, bool vm) { WriteText(clustered_stream, vm); } - void ImageWriter::WriteROData(WriteStream* stream) { stream->Align(OS::kMaxPreferredCodeAlignment); @@ -771,7 +737,6 @@ void ImageWriter::WriteROData(WriteStream* stream) { } } - AssemblyImageWriter::AssemblyImageWriter(uint8_t** assembly_buffer, ReAlloc alloc, intptr_t initial_size) @@ -785,14 +750,12 @@ AssemblyImageWriter::AssemblyImageWriter(uint8_t** assembly_buffer, #endif } - void AssemblyImageWriter::Finalize() { #ifdef DART_PRECOMPILER dwarf_->Write(); #endif } - static void EnsureIdentifier(char* label) { for (char c = *label; c != '\0'; c = *++label) { if (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || @@ -803,7 +766,6 @@ static void EnsureIdentifier(char* label) { } } - void AssemblyImageWriter::WriteText(WriteStream* clustered_stream, bool vm) { Zone* zone = Thread::Current()->zone(); @@ -925,7 +887,6 @@ void AssemblyImageWriter::WriteText(WriteStream* clustered_stream, bool vm) { WriteByteSequence(buffer, buffer + length); } - void AssemblyImageWriter::FrameUnwindPrologue() { // Creates DWARF's .debug_frame // CFI = Call frame information @@ -965,14 +926,14 @@ void AssemblyImageWriter::FrameUnwindPrologue() { #elif defined(TARGET_ARCH_ARM) #if defined(TARGET_OS_MACOS) || defined(TARGET_OS_MACOS_IOS) COMPILE_ASSERT(FP == R7); - assembly_stream_.Print(".cfi_def_cfa r7, 0\n"); // CFA is fp+j0 - assembly_stream_.Print(".cfi_offset r7, 0\n"); // saved fp is *(CFA+0) + assembly_stream_.Print(".cfi_def_cfa r7, 0\n"); // CFA is fp+j0 + assembly_stream_.Print(".cfi_offset r7, 0\n"); // saved fp is *(CFA+0) #else COMPILE_ASSERT(FP == R11); assembly_stream_.Print(".cfi_def_cfa r11, 0\n"); // CFA is fp+0 assembly_stream_.Print(".cfi_offset r11, 0\n"); // saved fp is *(CFA+0) #endif - assembly_stream_.Print(".cfi_offset lr, 4\n"); // saved pc is *(CFA+4) + assembly_stream_.Print(".cfi_offset lr, 4\n"); // saved pc is *(CFA+4) // saved sp is CFA+8 // Should be ".cfi_value_offset sp, 8", but requires gcc newer than late // 2016 and not supported by Android's libunwind. @@ -999,7 +960,6 @@ void AssemblyImageWriter::FrameUnwindPrologue() { #endif } - void AssemblyImageWriter::FrameUnwindEpilogue() { #if defined(TARGET_ARCH_ARM) assembly_stream_.Print(".fnend\n"); @@ -1007,7 +967,6 @@ void AssemblyImageWriter::FrameUnwindEpilogue() { assembly_stream_.Print(".cfi_endproc\n"); } - void AssemblyImageWriter::WriteByteSequence(uword start, uword end) { for (uword* cursor = reinterpret_cast(start); cursor < reinterpret_cast(end); cursor++) { @@ -1015,7 +974,6 @@ void AssemblyImageWriter::WriteByteSequence(uword start, uword end) { } } - void BlobImageWriter::WriteText(WriteStream* clustered_stream, bool vm) { // This header provides the gap to make the instructions snapshot look like a // HeapPage. @@ -1059,7 +1017,6 @@ void BlobImageWriter::WriteText(WriteStream* clustered_stream, bool vm) { } } - RawInstructions* ImageReader::GetInstructionsAt(int32_t offset) { ASSERT(Utils::IsAligned(offset, OS::PreferredCodeAlignment())); @@ -1071,7 +1028,6 @@ RawInstructions* ImageReader::GetInstructionsAt(int32_t offset) { return result; } - RawObject* ImageReader::GetObjectAt(int32_t offset) { ASSERT(Utils::IsAligned(offset, kWordSize)); @@ -1082,7 +1038,6 @@ RawObject* ImageReader::GetObjectAt(int32_t offset) { return result; } - intptr_t SnapshotReader::LookupInternalClass(intptr_t class_header) { // If the header is an object Id, lookup singleton VM classes or classes // stored in the object store. @@ -1097,7 +1052,6 @@ intptr_t SnapshotReader::LookupInternalClass(intptr_t class_header) { return class_id; } - #define READ_VM_SINGLETON_OBJ(id, obj) \ if (object_id == id) { \ return obj; \ @@ -1161,7 +1115,6 @@ RawObject* SnapshotReader::ReadVMIsolateObject(intptr_t header_value) { return Symbols::GetPredefinedSymbol(object_id); // return VM symbol. } - RawObject* SnapshotReader::ReadIndexedObject(intptr_t object_id, intptr_t patch_object_id, intptr_t patch_offset) { @@ -1181,7 +1134,6 @@ RawObject* SnapshotReader::ReadIndexedObject(intptr_t object_id, return GetBackRef(object_id)->raw(); } - void SnapshotReader::AddPatchRecord(intptr_t object_id, intptr_t patch_object_id, intptr_t patch_offset) { @@ -1196,7 +1148,6 @@ void SnapshotReader::AddPatchRecord(intptr_t object_id, } } - void SnapshotReader::ProcessDeferredCanonicalizations() { Type& typeobj = Type::Handle(); TypeArguments& typeargs = TypeArguments::Handle(); @@ -1241,7 +1192,6 @@ void SnapshotReader::ProcessDeferredCanonicalizations() { } } - void SnapshotReader::FixSubclassesAndImplementors() { Class& cls = Class::Handle(zone()); Class& supercls = Class::Handle(zone()); @@ -1272,7 +1222,6 @@ void SnapshotReader::FixSubclassesAndImplementors() { } } - void SnapshotReader::ArrayReadFrom(intptr_t object_id, const Array& result, intptr_t len, @@ -1294,7 +1243,6 @@ void SnapshotReader::ArrayReadFrom(intptr_t object_id, } } - ScriptSnapshotReader::ScriptSnapshotReader(const uint8_t* buffer, intptr_t size, Thread* thread) @@ -1304,12 +1252,10 @@ ScriptSnapshotReader::ScriptSnapshotReader(const uint8_t* buffer, new ZoneGrowableArray(kNumInitialReferences), thread) {} - ScriptSnapshotReader::~ScriptSnapshotReader() { ResetBackwardReferenceTable(); } - MessageSnapshotReader::MessageSnapshotReader(const uint8_t* buffer, intptr_t size, Thread* thread) @@ -1319,12 +1265,10 @@ MessageSnapshotReader::MessageSnapshotReader(const uint8_t* buffer, new ZoneGrowableArray(kNumInitialReferences), thread) {} - MessageSnapshotReader::~MessageSnapshotReader() { ResetBackwardReferenceTable(); } - SnapshotWriter::SnapshotWriter(Thread* thread, Snapshot::Kind kind, uint8_t** buffer, @@ -1345,18 +1289,15 @@ SnapshotWriter::SnapshotWriter(Thread* thread, ASSERT(forward_list_ != NULL); } - void SnapshotWriter::WriteObject(RawObject* rawobj) { WriteObjectImpl(rawobj, kAsInlinedObject); WriteForwardedObjects(); } - uint32_t SnapshotWriter::GetObjectTags(RawObject* raw) { return raw->ptr()->tags_; } - uword SnapshotWriter::GetObjectTagsAndHash(RawObject* raw) { uword result = raw->ptr()->tags_; #if defined(HASH_IN_OBJECT_HEADER) @@ -1365,7 +1306,6 @@ uword SnapshotWriter::GetObjectTagsAndHash(RawObject* raw) { return result; } - #define VM_OBJECT_CLASS_LIST(V) \ V(OneByteString) \ V(TwoByteString) \ @@ -1472,7 +1412,6 @@ bool SnapshotWriter::HandleVMIsolateObject(RawObject* rawobj) { #undef VM_OBJECT_WRITE - ForwardList::ForwardList(Thread* thread, intptr_t first_object_id) : thread_(thread), first_object_id_(first_object_id), @@ -1481,12 +1420,10 @@ ForwardList::ForwardList(Thread* thread, intptr_t first_object_id) ASSERT(first_object_id > 0); } - ForwardList::~ForwardList() { heap()->ResetObjectIdTable(); } - intptr_t ForwardList::AddObject(Zone* zone, RawObject* raw, SerializeState state) { @@ -1502,7 +1439,6 @@ intptr_t ForwardList::AddObject(Zone* zone, return object_id; } - intptr_t ForwardList::FindObject(RawObject* raw) { NoSafepointScope no_safepoint; intptr_t id = heap()->GetObjectId(raw); @@ -1510,7 +1446,6 @@ intptr_t ForwardList::FindObject(RawObject* raw) { return (id == 0) ? static_cast(kInvalidIndex) : id; } - bool SnapshotWriter::CheckAndWritePredefinedObject(RawObject* rawobj) { // Check if object can be written in one of the following ways: // - Smi: the Smi value is written as is (last bit is not tagged). @@ -1579,7 +1514,6 @@ bool SnapshotWriter::CheckAndWritePredefinedObject(RawObject* rawobj) { return false; } - void SnapshotWriter::WriteObjectImpl(RawObject* raw, bool as_reference) { // First check if object can be written as a simple predefined type. if (CheckAndWritePredefinedObject(raw)) { @@ -1608,7 +1542,6 @@ void SnapshotWriter::WriteObjectImpl(RawObject* raw, bool as_reference) { WriteMarkedObjectImpl(raw, tags, object_id, write_as_reference); } - void SnapshotWriter::WriteMarkedObjectImpl(RawObject* raw, intptr_t tags, intptr_t object_id, @@ -1657,7 +1590,6 @@ void SnapshotWriter::WriteMarkedObjectImpl(RawObject* raw, FATAL1("Unexpected object: %s\n", obj.ToCString()); } - class WriteInlinedObjectVisitor : public ObjectVisitor { public: explicit WriteInlinedObjectVisitor(SnapshotWriter* writer) @@ -1674,13 +1606,11 @@ class WriteInlinedObjectVisitor : public ObjectVisitor { SnapshotWriter* writer_; }; - void SnapshotWriter::WriteForwardedObjects() { WriteInlinedObjectVisitor visitor(this); forward_list_->SerializeAll(&visitor); } - void ForwardList::SerializeAll(ObjectVisitor* writer) { // Write out all objects that were added to the forward list and have // not been serialized yet. These would typically be fields of instance @@ -1706,7 +1636,6 @@ void ForwardList::SerializeAll(ObjectVisitor* writer) { first_unprocessed_object_id_ = next_object_id(); } - void SnapshotWriter::WriteClassId(RawClass* cls) { ASSERT(!Snapshot::IsFull(kind_)); int class_id = cls->ptr()->id_; @@ -1719,7 +1648,6 @@ void SnapshotWriter::WriteClassId(RawClass* cls) { WriteObjectImpl(cls->ptr()->name_, kAsInlinedObject); } - void SnapshotWriter::WriteFunctionId(RawFunction* func, bool owner_is_class) { ASSERT(kind_ == Snapshot::kScript); RawClass* cls = (owner_is_class) @@ -1736,7 +1664,6 @@ void SnapshotWriter::WriteFunctionId(RawFunction* func, bool owner_is_class) { WriteObjectImpl(func->ptr()->name_, kAsInlinedObject); } - void SnapshotWriter::WriteStaticImplicitClosure(intptr_t object_id, RawFunction* func, intptr_t tags) { @@ -1759,7 +1686,6 @@ void SnapshotWriter::WriteStaticImplicitClosure(intptr_t object_id, WriteObjectImpl(func->ptr()->name_, kAsInlinedObject); } - void SnapshotWriter::ArrayWriteTo(intptr_t object_id, intptr_t array_kind, intptr_t tags, @@ -1801,7 +1727,6 @@ void SnapshotWriter::ArrayWriteTo(intptr_t object_id, } } - RawFunction* SnapshotWriter::IsSerializableClosure(RawClosure* closure) { // Extract the function object to check if this closure // can be sent in an isolate message. @@ -1828,7 +1753,6 @@ RawFunction* SnapshotWriter::IsSerializableClosure(RawClosure* closure) { return Function::null(); } - RawClass* SnapshotWriter::GetFunctionOwner(RawFunction* func) { RawObject* owner = func->ptr()->owner_; uint32_t tags = GetObjectTags(owner); @@ -1840,7 +1764,6 @@ RawClass* SnapshotWriter::GetFunctionOwner(RawFunction* func) { return reinterpret_cast(owner)->ptr()->patched_class_; } - void SnapshotWriter::CheckForNativeFields(RawClass* cls) { if (cls->ptr()->num_native_fields_ != 0) { // We do not allow objects with native fields in an isolate message. @@ -1854,7 +1777,6 @@ void SnapshotWriter::CheckForNativeFields(RawClass* cls) { } } - void SnapshotWriter::SetWriteException(Exceptions::ExceptionType type, const char* msg) { set_exception_type(type); @@ -1863,7 +1785,6 @@ void SnapshotWriter::SetWriteException(Exceptions::ExceptionType type, thread()->long_jump_base()->Jump(1, Object::snapshot_writer_error()); } - void SnapshotWriter::WriteInstance(RawObject* raw, RawClass* cls, intptr_t tags, @@ -1918,14 +1839,12 @@ void SnapshotWriter::WriteInstance(RawObject* raw, return; } - bool SnapshotWriter::AllowObjectsInDartLibrary(RawLibrary* library) { return (library == object_store()->collection_library() || library == object_store()->core_library() || library == object_store()->typed_data_library()); } - intptr_t SnapshotWriter::FindVmSnapshotObject(RawObject* rawobj) { intptr_t length = Object::vm_isolate_snapshot_object_table().Length(); for (intptr_t i = 0; i < length; i++) { @@ -1936,7 +1855,6 @@ intptr_t SnapshotWriter::FindVmSnapshotObject(RawObject* rawobj) { return kInvalidIndex; } - void SnapshotWriter::ThrowException(Exceptions::ExceptionType type, const char* msg) { thread()->clear_sticky_error(); @@ -1951,7 +1869,6 @@ void SnapshotWriter::ThrowException(Exceptions::ExceptionType type, UNREACHABLE(); } - void SnapshotWriter::WriteVersionAndFeatures() { const char* expected_version = Version::SnapshotString(); ASSERT(expected_version != NULL); @@ -1967,7 +1884,6 @@ void SnapshotWriter::WriteVersionAndFeatures() { free(const_cast(expected_features)); } - ScriptSnapshotWriter::ScriptSnapshotWriter(uint8_t** buffer, ReAlloc alloc) : SnapshotWriter(Thread::Current(), Snapshot::kScript, @@ -1982,7 +1898,6 @@ ScriptSnapshotWriter::ScriptSnapshotWriter(uint8_t** buffer, ReAlloc alloc) ASSERT(alloc != NULL); } - void ScriptSnapshotWriter::WriteScriptSnapshot(const Library& lib) { ASSERT(kind() == Snapshot::kScript); ASSERT(isolate() != NULL); @@ -2012,7 +1927,6 @@ void ScriptSnapshotWriter::WriteScriptSnapshot(const Library& lib) { } } - void SnapshotWriterVisitor::VisitPointers(RawObject** first, RawObject** last) { for (RawObject** current = first; current <= last; current++) { RawObject* raw_obj = *current; @@ -2020,7 +1934,6 @@ void SnapshotWriterVisitor::VisitPointers(RawObject** first, RawObject** last) { } } - MessageWriter::MessageWriter(uint8_t** buffer, ReAlloc alloc, DeAlloc dealloc, @@ -2040,7 +1953,6 @@ MessageWriter::MessageWriter(uint8_t** buffer, ASSERT(alloc != NULL); } - void MessageWriter::WriteMessage(const Object& obj) { ASSERT(kind() == Snapshot::kMessage); ASSERT(isolate() != NULL); @@ -2060,5 +1972,4 @@ void MessageWriter::WriteMessage(const Object& obj) { } } - } // namespace dart diff --git a/runtime/vm/snapshot.h b/runtime/vm/snapshot.h index c0d10166108..c374c8b11c5 100644 --- a/runtime/vm/snapshot.h +++ b/runtime/vm/snapshot.h @@ -121,31 +121,25 @@ static const bool kAsReference = true; static const bool kAsInlinedObject = false; static const intptr_t kInvalidPatchIndex = -1; - class SerializedHeaderTag : public BitField { }; - class SerializedHeaderData : public BitField {}; - enum DeserializeState { kIsDeserialized = 0, kIsNotDeserialized = 1, }; - enum SerializeState { kIsSerialized = 0, kIsNotSerialized = 1, }; - #define HEAP_SPACE(kind) (kind == Snapshot::kMessage) ? Heap::kNew : Heap::kOld - // Structure capturing the raw snapshot. // // TODO(turnidge): Remove this class once the snapshot does not have a @@ -208,7 +202,6 @@ class Snapshot { DISALLOW_COPY_AND_ASSIGN(Snapshot); }; - class Image : ValueObject { public: explicit Image(const void* raw_memory) : raw_memory_(raw_memory) { @@ -233,7 +226,6 @@ class Image : ValueObject { DISALLOW_COPY_AND_ASSIGN(Image); }; - class BaseReader { public: BaseReader(const uint8_t* buffer, intptr_t size) : stream_(buffer, size) {} @@ -292,7 +284,6 @@ class BaseReader { ReadStream stream_; // input stream. }; - class BackRefNode : public ValueObject { public: BackRefNode(Object* reference, @@ -333,7 +324,6 @@ class BackRefNode : public ValueObject { ZoneGrowableArray* patch_records_; }; - class ImageReader : public ZoneAllocated { public: ImageReader(const uint8_t* instructions_buffer, const uint8_t* data_buffer) @@ -354,7 +344,6 @@ class ImageReader : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(ImageReader); }; - // Reads a snapshot into objects. class SnapshotReader : public BaseReader { public: @@ -529,7 +518,6 @@ class SnapshotReader : public BaseReader { DISALLOW_COPY_AND_ASSIGN(SnapshotReader); }; - class ScriptSnapshotReader : public SnapshotReader { public: ScriptSnapshotReader(const uint8_t* buffer, intptr_t size, Thread* thread); @@ -539,7 +527,6 @@ class ScriptSnapshotReader : public SnapshotReader { DISALLOW_COPY_AND_ASSIGN(ScriptSnapshotReader); }; - class MessageSnapshotReader : public SnapshotReader { public: MessageSnapshotReader(const uint8_t* buffer, intptr_t size, Thread* thread); @@ -549,7 +536,6 @@ class MessageSnapshotReader : public SnapshotReader { DISALLOW_COPY_AND_ASSIGN(MessageSnapshotReader); }; - class BaseWriter : public StackResource { public: // Size of the snapshot. @@ -645,7 +631,6 @@ class BaseWriter : public StackResource { DISALLOW_IMPLICIT_CONSTRUCTORS(BaseWriter); }; - class ForwardList { public: explicit ForwardList(Thread* thread, intptr_t first_object_id); @@ -700,7 +685,6 @@ class ForwardList { DISALLOW_COPY_AND_ASSIGN(ForwardList); }; - class ImageWriter : public ZoneAllocated { public: ImageWriter() @@ -761,7 +745,6 @@ class ImageWriter : public ZoneAllocated { DISALLOW_COPY_AND_ASSIGN(ImageWriter); }; - class AssemblyImageWriter : public ImageWriter { public: AssemblyImageWriter(uint8_t** assembly_buffer, @@ -795,7 +778,6 @@ class AssemblyImageWriter : public ImageWriter { DISALLOW_COPY_AND_ASSIGN(AssemblyImageWriter); }; - class BlobImageWriter : public ImageWriter { public: BlobImageWriter(uint8_t** instructions_blob_buffer, @@ -819,7 +801,6 @@ class BlobImageWriter : public ImageWriter { DISALLOW_COPY_AND_ASSIGN(BlobImageWriter); }; - class SnapshotWriter : public BaseWriter { protected: SnapshotWriter(Thread* thread, @@ -938,7 +919,6 @@ class SnapshotWriter : public BaseWriter { DISALLOW_COPY_AND_ASSIGN(SnapshotWriter); }; - class ScriptSnapshotWriter : public SnapshotWriter { public: static const intptr_t kInitialSize = 64 * KB; @@ -954,7 +934,6 @@ class ScriptSnapshotWriter : public SnapshotWriter { DISALLOW_COPY_AND_ASSIGN(ScriptSnapshotWriter); }; - class SerializedObjectBuffer : public StackResource { public: SerializedObjectBuffer() @@ -980,7 +959,6 @@ class SerializedObjectBuffer : public StackResource { intptr_t object_length_; }; - class MessageWriter : public SnapshotWriter { public: static const intptr_t kInitialSize = 512; @@ -1000,7 +978,6 @@ class MessageWriter : public SnapshotWriter { DISALLOW_COPY_AND_ASSIGN(MessageWriter); }; - // An object pointer visitor implementation which writes out // objects to a snap shot. class SnapshotWriterVisitor : public ObjectPointerVisitor { diff --git a/runtime/vm/snapshot_ids.h b/runtime/vm/snapshot_ids.h index 71ab1983cd8..3f2464a8ca4 100644 --- a/runtime/vm/snapshot_ids.h +++ b/runtime/vm/snapshot_ids.h @@ -5,8 +5,8 @@ #ifndef RUNTIME_VM_SNAPSHOT_IDS_H_ #define RUNTIME_VM_SNAPSHOT_IDS_H_ -#include "vm/raw_object.h" #include "vm/dart_entry.h" +#include "vm/raw_object.h" namespace dart { diff --git a/runtime/vm/snapshot_test.cc b/runtime/vm/snapshot_test.cc index 72e54f8065b..3897786ffd1 100644 --- a/runtime/vm/snapshot_test.cc +++ b/runtime/vm/snapshot_test.cc @@ -50,19 +50,16 @@ static bool Equals(const Object& expected, const Object& actual) { return false; } - static uint8_t* malloc_allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { return reinterpret_cast(realloc(ptr, new_size)); } - static void malloc_deallocator(uint8_t* ptr) { free(ptr); } - static uint8_t* zone_allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { @@ -70,10 +67,8 @@ static uint8_t* zone_allocator(uint8_t* ptr, return zone->Realloc(ptr, old_size, new_size); } - static void zone_deallocator(uint8_t* ptr) {} - // Compare two Dart_CObject object graphs rooted in first and // second. The second graph will be destroyed by this operation no matter // whether the graphs are equal or not. @@ -136,7 +131,6 @@ static void CompareDartCObjects(Dart_CObject* first, Dart_CObject* second) { } } - static void CheckEncodeDecodeMessage(Dart_CObject* root) { // Encode and decode the message. uint8_t* buffer = NULL; @@ -152,7 +146,6 @@ static void CheckEncodeDecodeMessage(Dart_CObject* root) { free(buffer); } - static void ExpectEncodeFail(Dart_CObject* root) { uint8_t* buffer = NULL; ApiMessageWriter writer(&buffer, &malloc_allocator); @@ -161,7 +154,6 @@ static void ExpectEncodeFail(Dart_CObject* root) { free(buffer); } - TEST_CASE(SerializeNull) { StackZone zone(thread); @@ -186,7 +178,6 @@ TEST_CASE(SerializeNull) { CheckEncodeDecodeMessage(root); } - TEST_CASE(SerializeSmi1) { StackZone zone(thread); @@ -212,7 +203,6 @@ TEST_CASE(SerializeSmi1) { CheckEncodeDecodeMessage(root); } - TEST_CASE(SerializeSmi2) { StackZone zone(thread); @@ -238,7 +228,6 @@ TEST_CASE(SerializeSmi2) { CheckEncodeDecodeMessage(root); } - Dart_CObject* SerializeAndDeserializeMint(const Mint& mint) { // Write snapshot with object content. uint8_t* buffer; @@ -264,7 +253,6 @@ Dart_CObject* SerializeAndDeserializeMint(const Mint& mint) { return root; } - void CheckMint(int64_t value) { ApiNativeScope scope; StackZone zone(Thread::Current()); @@ -290,7 +278,6 @@ void CheckMint(int64_t value) { #endif } - TEST_CASE(SerializeMints) { // Min positive mint. CheckMint(Smi::kMaxValue + 1); @@ -310,7 +297,6 @@ TEST_CASE(SerializeMints) { CheckMint(kMinInt64 + 1); } - TEST_CASE(SerializeDouble) { StackZone zone(thread); @@ -336,7 +322,6 @@ TEST_CASE(SerializeDouble) { CheckEncodeDecodeMessage(root); } - TEST_CASE(SerializeTrue) { StackZone zone(thread); @@ -364,7 +349,6 @@ TEST_CASE(SerializeTrue) { CheckEncodeDecodeMessage(root); } - TEST_CASE(SerializeFalse) { StackZone zone(thread); @@ -390,7 +374,6 @@ TEST_CASE(SerializeFalse) { CheckEncodeDecodeMessage(root); } - TEST_CASE(SerializeCapability) { // Write snapshot with object content. const Capability& capability = Capability::Handle(Capability::New(12345)); @@ -417,7 +400,6 @@ TEST_CASE(SerializeCapability) { CheckEncodeDecodeMessage(root); } - TEST_CASE(SerializeBigint) { // Write snapshot with object content. const char* cstr = "0x270FFFFFFFFFFFFFD8F0"; @@ -449,7 +431,6 @@ TEST_CASE(SerializeBigint) { CheckEncodeDecodeMessage(root); } - Dart_CObject* SerializeAndDeserializeBigint(const Bigint& bigint) { // Write snapshot with object content. uint8_t* buffer; @@ -479,7 +460,6 @@ Dart_CObject* SerializeAndDeserializeBigint(const Bigint& bigint) { return root; } - void CheckBigint(const char* bigint_value) { ApiNativeScope scope; StackZone zone(Thread::Current()); @@ -492,7 +472,6 @@ void CheckBigint(const char* bigint_value) { free(hex_value); } - TEST_CASE(SerializeBigint2) { CheckBigint("0x0"); CheckBigint("0x1"); @@ -541,7 +520,6 @@ TEST_CASE(SerializeSingletons) { free(buffer); } - static void TestString(const char* cstr) { Thread* thread = Thread::Current(); EXPECT(Utf8::IsValid(reinterpret_cast(cstr), strlen(cstr))); @@ -567,7 +545,6 @@ static void TestString(const char* cstr) { CheckEncodeDecodeMessage(root); } - TEST_CASE(SerializeString) { TestString("This string shall be serialized"); TestString("æøå"); // This file is UTF-8 encoded. @@ -583,7 +560,6 @@ TEST_CASE(SerializeString) { // TODO(sgjesse): Add tests with non-BMP characters. } - TEST_CASE(SerializeArray) { // Write snapshot with object content. const int kArrayLength = 10; @@ -618,7 +594,6 @@ TEST_CASE(SerializeArray) { CheckEncodeDecodeMessage(root); } - TEST_CASE(FailSerializeLargeArray) { Dart_CObject root; root.type = Dart_CObject_kArray; @@ -627,7 +602,6 @@ TEST_CASE(FailSerializeLargeArray) { ExpectEncodeFail(&root); } - TEST_CASE(FailSerializeLargeNestedArray) { Dart_CObject parent; Dart_CObject child; @@ -641,7 +615,6 @@ TEST_CASE(FailSerializeLargeNestedArray) { ExpectEncodeFail(&parent); } - TEST_CASE(FailSerializeLargeTypedDataInt8) { Dart_CObject root; root.type = Dart_CObject_kTypedData; @@ -651,7 +624,6 @@ TEST_CASE(FailSerializeLargeTypedDataInt8) { ExpectEncodeFail(&root); } - TEST_CASE(FailSerializeLargeTypedDataUint8) { Dart_CObject root; root.type = Dart_CObject_kTypedData; @@ -661,7 +633,6 @@ TEST_CASE(FailSerializeLargeTypedDataUint8) { ExpectEncodeFail(&root); } - TEST_CASE(FailSerializeLargeExternalTypedData) { Dart_CObject root; root.type = Dart_CObject_kExternalTypedData; @@ -670,7 +641,6 @@ TEST_CASE(FailSerializeLargeExternalTypedData) { ExpectEncodeFail(&root); } - TEST_CASE(SerializeEmptyArray) { // Write snapshot with object content. const int kArrayLength = 0; @@ -696,7 +666,6 @@ TEST_CASE(SerializeEmptyArray) { CheckEncodeDecodeMessage(root); } - TEST_CASE(SerializeByteArray) { // Write snapshot with object content. const int kTypedDataLength = 256; @@ -728,7 +697,6 @@ TEST_CASE(SerializeByteArray) { CheckEncodeDecodeMessage(root); } - #define TEST_TYPED_ARRAY(darttype, ctype) \ { \ StackZone zone(thread); \ @@ -752,7 +720,6 @@ TEST_CASE(SerializeByteArray) { } \ } - #define TEST_EXTERNAL_TYPED_ARRAY(darttype, ctype) \ { \ StackZone zone(thread); \ @@ -775,7 +742,6 @@ TEST_CASE(SerializeByteArray) { } \ } - TEST_CASE(SerializeTypedArray) { TEST_TYPED_ARRAY(Int8, int8_t); TEST_TYPED_ARRAY(Uint8, uint8_t); @@ -789,7 +755,6 @@ TEST_CASE(SerializeTypedArray) { TEST_TYPED_ARRAY(Float64, double); } - TEST_CASE(SerializeExternalTypedArray) { TEST_EXTERNAL_TYPED_ARRAY(Int8, int8_t); TEST_EXTERNAL_TYPED_ARRAY(Uint8, uint8_t); @@ -803,7 +768,6 @@ TEST_CASE(SerializeExternalTypedArray) { TEST_EXTERNAL_TYPED_ARRAY(Float64, double); } - TEST_CASE(SerializeEmptyByteArray) { // Write snapshot with object content. const int kTypedDataLength = 0; @@ -831,7 +795,6 @@ TEST_CASE(SerializeEmptyByteArray) { CheckEncodeDecodeMessage(root); } - class TestSnapshotWriter : public SnapshotWriter { public: static const intptr_t kInitialSize = 64 * KB; @@ -859,7 +822,6 @@ class TestSnapshotWriter : public SnapshotWriter { DISALLOW_COPY_AND_ASSIGN(TestSnapshotWriter); }; - static void GenerateSourceAndCheck(const Script& script) { // Check if we are able to generate the source from the token stream. // Rescan this source and compare the token stream to see if they are @@ -895,7 +857,6 @@ static void GenerateSourceAndCheck(const Script& script) { } } - TEST_CASE(SerializeScript) { const char* kScriptChars = "class A {\n" @@ -1001,7 +962,6 @@ TEST_CASE(SerializeScript) { free(buffer); } - #if !defined(PRODUCT) // Uses mirrors. VM_UNIT_TEST_CASE(CanonicalizationInScriptSnapshots) { const char* kScriptChars = @@ -1108,7 +1068,6 @@ VM_UNIT_TEST_CASE(CanonicalizationInScriptSnapshots) { } #endif - VM_UNIT_TEST_CASE(ScriptSnapshotsUpdateSubclasses) { const char* kScriptChars = "class _DebugDuration extends Duration {\n" @@ -1222,7 +1181,6 @@ VM_UNIT_TEST_CASE(ScriptSnapshotsUpdateSubclasses) { #endif } - static void IterateScripts(const Library& lib) { const Array& lib_scripts = Array::Handle(lib.LoadedScripts()); Script& script = Script::Handle(); @@ -1260,7 +1218,6 @@ ISOLATE_UNIT_TEST_CASE(GenerateSource) { stack_trace_collection_enabled); } - VM_UNIT_TEST_CASE(FullSnapshot) { const char* kScriptChars = "class Fields {\n" @@ -1334,7 +1291,6 @@ VM_UNIT_TEST_CASE(FullSnapshot) { free(isolate_snapshot_data_buffer); } - VM_UNIT_TEST_CASE(FullSnapshot1) { // This buffer has to be static for this to compile with Visual Studio. // If it is not static compilation of this file with Visual Studio takes @@ -1400,10 +1356,8 @@ VM_UNIT_TEST_CASE(FullSnapshot1) { free(isolate_snapshot_data_buffer); } - #ifndef PRODUCT - VM_UNIT_TEST_CASE(ScriptSnapshot) { const char* kLibScriptChars = "library dart_import_lib;" @@ -1538,7 +1492,6 @@ VM_UNIT_TEST_CASE(ScriptSnapshot) { free(script_snapshot); } - VM_UNIT_TEST_CASE(ScriptSnapshot1) { const char* kScriptChars = "class _SimpleNumEnumerable {" @@ -1611,7 +1564,6 @@ VM_UNIT_TEST_CASE(ScriptSnapshot1) { free(script_snapshot); } - VM_UNIT_TEST_CASE(ScriptSnapshot2) { // The snapshot of this library is always created in production mode, but // loaded and executed in both production and checked modes. @@ -1727,7 +1679,6 @@ VM_UNIT_TEST_CASE(ScriptSnapshot2) { free(script_snapshot); } - VM_UNIT_TEST_CASE(MismatchedSnapshotKinds) { const char* kScriptChars = "main() { print('Hello, world!'); }"; Dart_Handle result; @@ -1811,10 +1762,8 @@ VM_UNIT_TEST_CASE(MismatchedSnapshotKinds) { free(script_snapshot); } - #endif // !PRODUCT - TEST_CASE(IntArrayMessage) { StackZone zone(Thread::Current()); uint8_t* buffer = NULL; @@ -1839,7 +1788,6 @@ TEST_CASE(IntArrayMessage) { CheckEncodeDecodeMessage(root); } - // Helper function to call a top level Dart function and serialize the result. static uint8_t* GetSerialized(Dart_Handle lib, const char* dart_function, @@ -1857,7 +1805,6 @@ static uint8_t* GetSerialized(Dart_Handle lib, return buffer; } - // Helper function to deserialize the result into a Dart_CObject structure. static Dart_CObject* GetDeserialized(uint8_t* buffer, intptr_t buffer_len) { // Read object back from the snapshot into a C structure. @@ -1865,7 +1812,6 @@ static Dart_CObject* GetDeserialized(uint8_t* buffer, intptr_t buffer_len) { return api_reader.ReadMessage(); } - static void CheckString(Dart_Handle dart_string, const char* expected) { StackZone zone(Thread::Current()); String& str = String::Handle(); @@ -1885,7 +1831,6 @@ static void CheckString(Dart_Handle dart_string, const char* expected) { CheckEncodeDecodeMessage(root); } - static void CheckStringInvalid(Dart_Handle dart_string) { StackZone zone(Thread::Current()); String& str = String::Handle(); @@ -1903,7 +1848,6 @@ static void CheckStringInvalid(Dart_Handle dart_string) { EXPECT_EQ(Dart_CObject_kUnsupported, root->type); } - VM_UNIT_TEST_CASE(DartGeneratedMessages) { static const char* kCustomIsolateScriptChars = "getSmi() {\n" @@ -2051,7 +1995,6 @@ VM_UNIT_TEST_CASE(DartGeneratedMessages) { Dart_ShutdownIsolate(); } - VM_UNIT_TEST_CASE(DartGeneratedListMessages) { const int kArrayLength = 10; static const char* kScriptChars = @@ -2162,7 +2105,6 @@ VM_UNIT_TEST_CASE(DartGeneratedListMessages) { Dart_ShutdownIsolate(); } - VM_UNIT_TEST_CASE(DartGeneratedArrayLiteralMessages) { const int kArrayLength = 10; static const char* kScriptChars = @@ -2383,7 +2325,6 @@ VM_UNIT_TEST_CASE(DartGeneratedArrayLiteralMessages) { Dart_ShutdownIsolate(); } - VM_UNIT_TEST_CASE(DartGeneratedListMessagesWithBackref) { const int kArrayLength = 10; static const char* kScriptChars = @@ -2603,7 +2544,6 @@ VM_UNIT_TEST_CASE(DartGeneratedListMessagesWithBackref) { Dart_ShutdownIsolate(); } - VM_UNIT_TEST_CASE(DartGeneratedArrayLiteralMessagesWithBackref) { const int kArrayLength = 10; static const char* kScriptChars = @@ -2830,7 +2770,6 @@ VM_UNIT_TEST_CASE(DartGeneratedArrayLiteralMessagesWithBackref) { Dart_ShutdownIsolate(); } - static void CheckTypedData(Dart_CObject* object, Dart_TypedData_Type typed_data_type, int len) { @@ -3025,7 +2964,6 @@ VM_UNIT_TEST_CASE(DartGeneratedListMessagesWithTypedData) { Dart_ShutdownIsolate(); } - VM_UNIT_TEST_CASE(PostCObject) { // Create a native port for posting from C to Dart TestIsolateScope __test_isolate__; @@ -3121,7 +3059,6 @@ VM_UNIT_TEST_CASE(PostCObject) { Dart_ExitScope(); } - TEST_CASE(OmittedObjectEncodingLength) { StackZone zone(Thread::Current()); uint8_t* buffer; diff --git a/runtime/vm/source_report.cc b/runtime/vm/source_report.cc index 33911b10447..e703cfab97e 100644 --- a/runtime/vm/source_report.cc +++ b/runtime/vm/source_report.cc @@ -28,12 +28,10 @@ SourceReport::SourceReport(intptr_t report_set, CompileMode compile_mode) profile_(Isolate::Current()), next_script_index_(0) {} - SourceReport::~SourceReport() { ClearScriptTable(); } - void SourceReport::ClearScriptTable() { for (intptr_t i = 0; i < script_table_entries_.length(); i++) { delete script_table_entries_[i]; @@ -44,7 +42,6 @@ void SourceReport::ClearScriptTable() { next_script_index_ = 0; } - void SourceReport::Init(Thread* thread, const Script* script, TokenPosition start_pos, @@ -63,12 +60,10 @@ void SourceReport::Init(Thread* thread, } } - bool SourceReport::IsReportRequested(ReportKind report_kind) { return (report_set_ & report_kind) != 0; } - bool SourceReport::ShouldSkipFunction(const Function& func) { if (script_ != NULL && !script_->IsNull()) { if (func.script() != script_->raw()) { @@ -108,7 +103,6 @@ bool SourceReport::ShouldSkipFunction(const Function& func) { return false; } - intptr_t SourceReport::GetScriptIndex(const Script& script) { const String& url = String::Handle(zone(), script.url()); ScriptTableEntry* pair = script_table_.LookupValue(&url); @@ -128,7 +122,6 @@ intptr_t SourceReport::GetScriptIndex(const Script& script) { return tmp->index; } - #if defined(DEBUG) void SourceReport::VerifyScriptTable() { for (intptr_t i = 0; i < script_table_entries_.length(); i++) { @@ -144,7 +137,6 @@ void SourceReport::VerifyScriptTable() { } #endif - bool SourceReport::ScriptIsLoadedByLibrary(const Script& script, const Library& lib) { const Array& scripts = Array::Handle(zone(), lib.LoadedScripts()); @@ -156,7 +148,6 @@ bool SourceReport::ScriptIsLoadedByLibrary(const Script& script, return false; } - void SourceReport::PrintCallSitesData(JSONObject* jsobj, const Function& function, const Code& code) { @@ -196,7 +187,6 @@ void SourceReport::PrintCallSitesData(JSONObject* jsobj, } } - void SourceReport::PrintCoverageData(JSONObject* jsobj, const Function& function, const Code& code) { @@ -273,7 +263,6 @@ void SourceReport::PrintCoverageData(JSONObject* jsobj, } } - void SourceReport::PrintPossibleBreakpointsData(JSONObject* jsobj, const Function& func, const Code& code) { @@ -313,7 +302,6 @@ void SourceReport::PrintPossibleBreakpointsData(JSONObject* jsobj, } } - void SourceReport::PrintProfileData(JSONObject* jsobj, ProfileFunction* profile_function) { ASSERT(profile_function != NULL); @@ -364,7 +352,6 @@ void SourceReport::PrintProfileData(JSONObject* jsobj, } } - void SourceReport::PrintScriptTable(JSONArray* scripts) { for (intptr_t i = 0; i < script_table_entries_.length(); i++) { const Script* script = script_table_entries_[i]->script; @@ -372,7 +359,6 @@ void SourceReport::PrintScriptTable(JSONArray* scripts) { } } - void SourceReport::VisitFunction(JSONArray* jsarr, const Function& func) { if (ShouldSkipFunction(func)) { return; @@ -442,7 +428,6 @@ void SourceReport::VisitFunction(JSONArray* jsarr, const Function& func) { } } - void SourceReport::VisitLibrary(JSONArray* jsarr, const Library& lib) { Class& cls = Class::Handle(zone()); Array& functions = Array::Handle(zone()); @@ -485,7 +470,6 @@ void SourceReport::VisitLibrary(JSONArray* jsarr, const Library& lib) { } } - void SourceReport::VisitClosures(JSONArray* jsarr) { const GrowableObjectArray& closures = GrowableObjectArray::Handle( thread()->isolate()->object_store()->closure_functions()); @@ -499,7 +483,6 @@ void SourceReport::VisitClosures(JSONArray* jsarr) { } } - void SourceReport::PrintJSON(JSONStream* js, const Script& script, TokenPosition start_pos, diff --git a/runtime/vm/source_report_test.cc b/runtime/vm/source_report_test.cc index 1651c4f712f..7b0e05c2bd9 100644 --- a/runtime/vm/source_report_test.cc +++ b/runtime/vm/source_report_test.cc @@ -21,7 +21,6 @@ static RawObject* ExecuteScript(const char* script) { return Api::UnwrapHandle(h_lib); } - TEST_CASE(SourceReport_Coverage_NoCalls) { char buffer[1024]; const char* kScript = @@ -51,7 +50,6 @@ TEST_CASE(SourceReport_Coverage_NoCalls) { buffer); } - TEST_CASE(SourceReport_Coverage_SimpleCall) { char buffer[1024]; const char* kScript = @@ -96,7 +94,6 @@ TEST_CASE(SourceReport_Coverage_SimpleCall) { buffer); } - TEST_CASE(SourceReport_Coverage_ForceCompile) { char buffer[1024]; const char* kScript = @@ -142,7 +139,6 @@ TEST_CASE(SourceReport_Coverage_ForceCompile) { buffer); } - TEST_CASE(SourceReport_Coverage_UnusedClass_NoForceCompile) { char buffer[1024]; const char* kScript = @@ -185,7 +181,6 @@ TEST_CASE(SourceReport_Coverage_UnusedClass_NoForceCompile) { buffer); } - TEST_CASE(SourceReport_Coverage_UnusedClass_ForceCompile) { char buffer[1024]; const char* kScript = @@ -229,7 +224,6 @@ TEST_CASE(SourceReport_Coverage_UnusedClass_ForceCompile) { buffer); } - TEST_CASE(SourceReport_Coverage_UnusedClass_ForceCompileError) { char buffer[1024]; const char* kScript = @@ -276,7 +270,6 @@ TEST_CASE(SourceReport_Coverage_UnusedClass_ForceCompileError) { buffer); } - TEST_CASE(SourceReport_Coverage_NestedFunctions) { char buffer[1024]; const char* kScript = @@ -332,7 +325,6 @@ TEST_CASE(SourceReport_Coverage_NestedFunctions) { buffer); } - TEST_CASE(SourceReport_Coverage_RestrictedRange) { char buffer[1024]; const char* kScript = @@ -384,7 +376,6 @@ TEST_CASE(SourceReport_Coverage_RestrictedRange) { buffer); } - TEST_CASE(SourceReport_Coverage_AllFunctions) { const char* kScript = "helper0() {}\n" @@ -424,7 +415,6 @@ TEST_CASE(SourceReport_Coverage_AllFunctions) { EXPECT_SUBSTRING("\"scriptIndex\":2", result); } - TEST_CASE(SourceReport_Coverage_AllFunctions_ForceCompile) { const char* kScript = "helper0() {}\n" @@ -467,7 +457,6 @@ TEST_CASE(SourceReport_Coverage_AllFunctions_ForceCompile) { EXPECT_SUBSTRING("\"scriptIndex\":2", result); } - TEST_CASE(SourceReport_CallSites_SimpleCall) { char buffer[1024]; const char* kScript = @@ -588,7 +577,6 @@ TEST_CASE(SourceReport_CallSites_PolymorphicCall) { buffer); } - TEST_CASE(SourceReport_MultipleReports) { char buffer[1024]; const char* kScript = @@ -637,7 +625,6 @@ TEST_CASE(SourceReport_MultipleReports) { buffer); } - TEST_CASE(SourceReport_PossibleBreakpoints_Simple) { char buffer[1024]; const char* kScript = diff --git a/runtime/vm/stack_frame.cc b/runtime/vm/stack_frame.cc index 6bb5bd153cd..f0d0173fb9e 100644 --- a/runtime/vm/stack_frame.cc +++ b/runtime/vm/stack_frame.cc @@ -19,7 +19,6 @@ namespace dart { - bool StackFrame::IsStubFrame() const { ASSERT(!(IsEntryFrame() || IsExitFrame())); #if !defined(HOST_OS_WINDOWS) && !defined(HOST_OS_FUCHSIA) @@ -34,7 +33,6 @@ bool StackFrame::IsStubFrame() const { return cid == kNullCid || cid == kClassCid; } - const char* StackFrame::ToCString() const { ASSERT(thread_ == Thread::Current()); Zone* zone = Thread::Current()->zone(); @@ -61,12 +59,10 @@ const char* StackFrame::ToCString() const { } } - void ExitFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { // There are no objects to visit in this frame. } - void EntryFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { // Visit objects between SP and (FP - callee_save_area). ASSERT(visitor != NULL); @@ -83,7 +79,6 @@ void EntryFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { #endif } - void StackFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { ASSERT(visitor != NULL); // NOTE: This code runs while GC is in progress and runs within @@ -204,7 +199,6 @@ void StackFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { visitor->VisitPointers(first, last); } - RawFunction* StackFrame::LookupDartFunction() const { const Code& code = Code::Handle(LookupDartCode()); if (!code.IsNull()) { @@ -213,7 +207,6 @@ RawFunction* StackFrame::LookupDartFunction() const { return Function::null(); } - RawCode* StackFrame::LookupDartCode() const { // We add a no gc scope to ensure that the code below does not trigger // a GC as we are handling raw object references here. It is possible @@ -231,7 +224,6 @@ RawCode* StackFrame::LookupDartCode() const { return Code::null(); } - RawCode* StackFrame::GetCodeObject() const { const uword pc_marker = *(reinterpret_cast(fp() + (kPcMarkerSlotFromFp * kWordSize))); @@ -241,7 +233,6 @@ RawCode* StackFrame::GetCodeObject() const { return reinterpret_cast(pc_marker); } - bool StackFrame::FindExceptionHandler(Thread* thread, uword* handler_pc, bool* needs_stacktrace, @@ -291,7 +282,6 @@ bool StackFrame::FindExceptionHandler(Thread* thread, return false; } - TokenPosition StackFrame::GetTokenPos() const { const Code& code = Code::Handle(LookupDartCode()); if (code.IsNull()) { @@ -310,7 +300,6 @@ TokenPosition StackFrame::GetTokenPos() const { return TokenPosition::kNoSource; } - bool StackFrame::IsValid() const { if (IsEntryFrame() || IsExitFrame() || IsStubFrame()) { return true; @@ -318,14 +307,12 @@ bool StackFrame::IsValid() const { return (LookupDartCode() != Code::null()); } - void StackFrameIterator::SetupLastExitFrameData() { ASSERT(thread_ != NULL); uword exit_marker = thread_->top_exit_frame_info(); frames_.fp_ = exit_marker; } - void StackFrameIterator::SetupNextExitFrameData() { uword exit_address = entry_.fp() + (kExitLinkSlotFromEntryFp * kWordSize); uword exit_marker = *reinterpret_cast(exit_address); @@ -334,7 +321,6 @@ void StackFrameIterator::SetupNextExitFrameData() { frames_.pc_ = 0; } - // Tell MemorySanitizer that generated code initializes part of the stack. // TODO(koda): Limit to frames that are actually written by generated code. static void UnpoisonStack(uword fp) { @@ -343,7 +329,6 @@ static void UnpoisonStack(uword fp) { MSAN_UNPOISON(reinterpret_cast(fp - size), 2 * size); } - StackFrameIterator::StackFrameIterator(ValidationPolicy validation_policy, Thread* thread, CrossThreadPolicy cross_thread_policy) @@ -358,7 +343,6 @@ StackFrameIterator::StackFrameIterator(ValidationPolicy validation_policy, SetupLastExitFrameData(); // Setup data for last exit frame. } - StackFrameIterator::StackFrameIterator(uword last_fp, ValidationPolicy validation_policy, Thread* thread, @@ -376,7 +360,6 @@ StackFrameIterator::StackFrameIterator(uword last_fp, frames_.pc_ = 0; } - #if !defined(TARGET_ARCH_DBC) StackFrameIterator::StackFrameIterator(uword fp, uword sp, @@ -398,7 +381,6 @@ StackFrameIterator::StackFrameIterator(uword fp, } #endif - StackFrame* StackFrameIterator::NextFrame() { // When we are at the start of iteration after having created an // iterator object, current_frame_ will be NULL as we haven't seen @@ -459,7 +441,6 @@ StackFrame* StackFrameIterator::NextFrame() { return current_frame_; } - StackFrame* StackFrameIterator::FrameSetIterator::NextFrame(bool validate) { StackFrame* frame; ASSERT(HasNext()); @@ -474,7 +455,6 @@ StackFrame* StackFrameIterator::FrameSetIterator::NextFrame(bool validate) { return frame; } - ExitFrame* StackFrameIterator::NextExitFrame() { exit_.sp_ = frames_.sp_; exit_.fp_ = frames_.fp_; @@ -486,7 +466,6 @@ ExitFrame* StackFrameIterator::NextExitFrame() { return &exit_; } - EntryFrame* StackFrameIterator::NextEntryFrame() { ASSERT(!frames_.HasNext()); entry_.sp_ = frames_.sp_; @@ -497,7 +476,6 @@ EntryFrame* StackFrameIterator::NextEntryFrame() { return &entry_; } - InlinedFunctionsIterator::InlinedFunctionsIterator(const Code& code, uword pc) : index_(0), num_materializations_(0), @@ -536,7 +514,6 @@ InlinedFunctionsIterator::InlinedFunctionsIterator(const Code& code, uword pc) #endif // defined(DART_PRECOMPILED_RUNTIME) } - void InlinedFunctionsIterator::Advance() { // Iterate over the deopt instructions and determine the inlined // functions if any and iterate over them. @@ -565,7 +542,6 @@ void InlinedFunctionsIterator::Advance() { #endif // defined(DART_PRECOMPILED_RUNTIME) } - // Finds the potential offset for the current function's FP if the // current frame were to be deoptimized. intptr_t InlinedFunctionsIterator::GetDeoptFpOffset() const { @@ -587,7 +563,6 @@ intptr_t InlinedFunctionsIterator::GetDeoptFpOffset() const { return 0; } - #if defined(DEBUG) void ValidateFrames() { StackFrameIterator frames(StackFrameIterator::kValidateFrames, @@ -600,5 +575,4 @@ void ValidateFrames() { } #endif - } // namespace dart diff --git a/runtime/vm/stack_frame.h b/runtime/vm/stack_frame.h index 97373766b34..0d7d602b462 100644 --- a/runtime/vm/stack_frame.h +++ b/runtime/vm/stack_frame.h @@ -29,7 +29,6 @@ namespace dart { class ObjectPointerVisitor; class RawContext; - // Generic stack frame. class StackFrame : public ValueObject { public: @@ -150,7 +149,6 @@ class StackFrame : public ValueObject { DISALLOW_COPY_AND_ASSIGN(StackFrame); }; - // Exit frame is used to mark the transition from dart code into dart VM // runtime code. class ExitFrame : public StackFrame { @@ -173,7 +171,6 @@ class ExitFrame : public StackFrame { DISALLOW_COPY_AND_ASSIGN(ExitFrame); }; - // Entry Frame is used to mark the transition from dart VM runtime code into // dart code. class EntryFrame : public StackFrame { @@ -196,7 +193,6 @@ class EntryFrame : public StackFrame { DISALLOW_COPY_AND_ASSIGN(EntryFrame); }; - // A StackFrameIterator can be initialized with a thread other than the // current thread. Because this is generally a bad idea, it is only allowed on // Windows- where it is needed for the profiler. It is the responsibility of @@ -299,7 +295,6 @@ class StackFrameIterator : public ValueObject { DISALLOW_COPY_AND_ASSIGN(StackFrameIterator); }; - // Iterator for iterating over all dart frames (skips over exit frames, // entry frames and stub frames). // A DartFrameIterator can be initialized with an isolate other than the @@ -353,7 +348,6 @@ class DartFrameIterator : public ValueObject { DISALLOW_COPY_AND_ASSIGN(DartFrameIterator); }; - // Iterator for iterating over all inlined dart functions in an optimized // dart frame (the iteration includes the function that is inlining the // other functions). @@ -396,24 +390,20 @@ class InlinedFunctionsIterator : public ValueObject { DISALLOW_COPY_AND_ASSIGN(InlinedFunctionsIterator); }; - #if defined(DEBUG) void ValidateFrames(); #endif - #if !defined(TARGET_ARCH_DBC) DART_FORCE_INLINE static intptr_t LocalVarIndex(intptr_t fp_offset, intptr_t var_index) { return fp_offset + var_index; } - DART_FORCE_INLINE static uword ParamAddress(uword fp, intptr_t reverse_index) { return fp + (kParamEndSlotFromFp * kWordSize) + (reverse_index * kWordSize); } - DART_FORCE_INLINE static bool IsCalleeFrameOf(uword fp, uword other_fp) { return other_fp < fp; } @@ -424,12 +414,10 @@ DART_FORCE_INLINE static bool IsCalleeFrameOf(uword fp, uword other_fp) { static const uword kInterruptStackLimit = ~static_cast(0); #endif - DART_FORCE_INLINE static uword LocalVarAddress(uword fp, intptr_t index) { return fp + LocalVarIndex(0, index) * kWordSize; } - } // namespace dart #endif // RUNTIME_VM_STACK_FRAME_H_ diff --git a/runtime/vm/stack_frame_dbc.h b/runtime/vm/stack_frame_dbc.h index 9cc08ace940..a5ac2a858f0 100644 --- a/runtime/vm/stack_frame_dbc.h +++ b/runtime/vm/stack_frame_dbc.h @@ -55,7 +55,6 @@ static const int kFunctionSlotFromFp = -4; static const int kParamEndSlotFromFp = 4; // One slot past last parameter. static const int kFirstLocalSlotFromFp = -1; - DART_FORCE_INLINE static intptr_t LocalVarIndex(intptr_t fp_offset, intptr_t var_index) { ASSERT(var_index != 0); @@ -66,7 +65,6 @@ DART_FORCE_INLINE static intptr_t LocalVarIndex(intptr_t fp_offset, } } - DART_FORCE_INLINE static uword ParamAddress(uword fp, intptr_t reverse_index) { return fp - (kDartFrameFixedSize + reverse_index) * kWordSize; } diff --git a/runtime/vm/stack_frame_test.cc b/runtime/vm/stack_frame_test.cc index a76fe61b8ee..7adb82ea60c 100644 --- a/runtime/vm/stack_frame_test.cc +++ b/runtime/vm/stack_frame_test.cc @@ -2,6 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +#include "vm/stack_frame.h" #include "include/dart_api.h" #include "platform/assert.h" #include "vm/class_finalizer.h" @@ -9,7 +10,6 @@ #include "vm/dart_api_impl.h" #include "vm/dart_entry.h" #include "vm/resolver.h" -#include "vm/stack_frame.h" #include "vm/unit_test.h" #include "vm/verifier.h" #include "vm/zone.h" @@ -26,7 +26,6 @@ ISOLATE_UNIT_TEST_CASE(EmptyStackFrameIteration) { VerifyPointersVisitor::VerifyPointers(); } - // Unit test for empty dart stack frame iteration. ISOLATE_UNIT_TEST_CASE(EmptyDartStackFrameIteration) { DartFrameIterator iterator(Thread::Current(), @@ -35,11 +34,9 @@ ISOLATE_UNIT_TEST_CASE(EmptyDartStackFrameIteration) { VerifyPointersVisitor::VerifyPointers(); } - #define FUNCTION_NAME(name) StackFrame_##name #define REGISTER_FUNCTION(name, count) {"" #name, FUNCTION_NAME(name), count}, - void FUNCTION_NAME(StackFrame_equals)(Dart_NativeArguments args) { NativeArguments* arguments = reinterpret_cast(args); const Instance& expected = Instance::CheckedHandle(arguments->NativeArgAt(0)); @@ -51,7 +48,6 @@ void FUNCTION_NAME(StackFrame_equals)(Dart_NativeArguments args) { } } - void FUNCTION_NAME(StackFrame_frameCount)(Dart_NativeArguments args) { int count = 0; StackFrameIterator frames(StackFrameIterator::kValidateFrames, @@ -65,7 +61,6 @@ void FUNCTION_NAME(StackFrame_frameCount)(Dart_NativeArguments args) { arguments->SetReturn(Object::Handle(Smi::New(count))); } - void FUNCTION_NAME(StackFrame_dartFrameCount)(Dart_NativeArguments args) { int count = 0; DartFrameIterator frames(Thread::Current(), @@ -78,7 +73,6 @@ void FUNCTION_NAME(StackFrame_dartFrameCount)(Dart_NativeArguments args) { arguments->SetReturn(Object::Handle(Smi::New(count))); } - void FUNCTION_NAME(StackFrame_validateFrame)(Dart_NativeArguments args) { Thread* thread = Thread::Current(); Zone* zone = thread->zone(); @@ -121,7 +115,6 @@ void FUNCTION_NAME(StackFrame_validateFrame)(Dart_NativeArguments args) { FATAL("StackFrame_validateFrame fails, frame count < index passed in.\n"); } - // List all native functions implemented in the vm or core boot strap dart // libraries so that we can resolve the native function to it's entry // point. @@ -131,14 +124,12 @@ void FUNCTION_NAME(StackFrame_validateFrame)(Dart_NativeArguments args) { V(StackFrame_dartFrameCount, 0) \ V(StackFrame_validateFrame, 2) - static struct NativeEntries { const char* name_; Dart_NativeFunction function_; int argument_count_; } BuiltinEntries[] = {STACKFRAME_NATIVE_LIST(REGISTER_FUNCTION)}; - static Dart_NativeFunction native_lookup(Dart_Handle name, int argument_count, bool* auto_setup_scope) { @@ -159,7 +150,6 @@ static Dart_NativeFunction native_lookup(Dart_Handle name, return NULL; } - // Unit test case to verify stack frame iteration. TEST_CASE(ValidateStackFrameIteration) { const char* kScriptChars = @@ -246,7 +236,6 @@ TEST_CASE(ValidateStackFrameIteration) { EXPECT_VALID(Dart_Invoke(cls, NewString("testMain"), 0, NULL)); } - // Unit test case to verify stack frame iteration. TEST_CASE(ValidateNoSuchMethodStackFrameIteration) { const char* kScriptChars; diff --git a/runtime/vm/stack_trace.cc b/runtime/vm/stack_trace.cc index e0c77177b20..0174f5c6972 100644 --- a/runtime/vm/stack_trace.cc +++ b/runtime/vm/stack_trace.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "vm/stack_frame.h" #include "vm/stack_trace.h" +#include "vm/stack_frame.h" namespace dart { @@ -41,7 +41,6 @@ intptr_t StackTraceUtils::CountFrames(Thread* thread, return frame_count; } - intptr_t StackTraceUtils::CollectFrames(Thread* thread, const Array& code_array, const Array& pc_offset_array, @@ -76,7 +75,6 @@ intptr_t StackTraceUtils::CollectFrames(Thread* thread, return collected_frames_count; } - intptr_t StackTraceUtils::ExtractAsyncStackTraceInfo( Thread* thread, Function* async_function, diff --git a/runtime/vm/store_buffer.cc b/runtime/vm/store_buffer.cc index 95e6f96f927..7200d9acd74 100644 --- a/runtime/vm/store_buffer.cc +++ b/runtime/vm/store_buffer.cc @@ -21,32 +21,27 @@ typename BlockStack::List* BlockStack::global_empty_ = template Mutex* BlockStack::global_mutex_ = NULL; - template void BlockStack::InitOnce() { global_empty_ = new List(); global_mutex_ = new Mutex(); } - template void BlockStack::ShutDown() { delete global_empty_; delete global_mutex_; } - template BlockStack::BlockStack() : mutex_(new Mutex()) {} - template BlockStack::~BlockStack() { Reset(); delete mutex_; } - template void BlockStack::Reset() { MutexLocker local_mutex_locker(mutex_); @@ -67,7 +62,6 @@ void BlockStack::Reset() { } } - template typename BlockStack::Block* BlockStack::Blocks() { MutexLocker ml(mutex_); @@ -77,7 +71,6 @@ typename BlockStack::Block* BlockStack::Blocks() { return full_.PopAll(); } - template void BlockStack::PushBlockImpl(Block* block) { ASSERT(block->next() == NULL); // Should be just a single block. @@ -94,7 +87,6 @@ void BlockStack::PushBlockImpl(Block* block) { } } - void StoreBuffer::PushBlock(Block* block, ThresholdPolicy policy) { BlockStack::PushBlockImpl(block); if ((policy == kCheckThreshold) && Overflowed()) { @@ -108,7 +100,6 @@ void StoreBuffer::PushBlock(Block* block, ThresholdPolicy policy) { } } - template typename BlockStack::Block* BlockStack::PopNonFullBlock() { @@ -121,7 +112,6 @@ BlockStack::PopNonFullBlock() { return PopEmptyBlock(); } - template typename BlockStack::Block* BlockStack::PopEmptyBlock() { { @@ -133,7 +123,6 @@ typename BlockStack::Block* BlockStack::PopEmptyBlock() { return new Block(); } - template typename BlockStack::Block* BlockStack::PopNonEmptyBlock() { @@ -147,14 +136,12 @@ BlockStack::PopNonEmptyBlock() { } } - template bool BlockStack::IsEmpty() { MutexLocker ml(mutex_); return full_.IsEmpty() && partial_.IsEmpty(); } - template BlockStack::List::~List() { while (!IsEmpty()) { @@ -162,7 +149,6 @@ BlockStack::List::~List() { } } - template typename BlockStack::Block* BlockStack::List::Pop() { Block* result = head_; @@ -172,7 +158,6 @@ typename BlockStack::Block* BlockStack::List::Pop() { return result; } - template typename BlockStack::Block* BlockStack::List::PopAll() { Block* result = head_; @@ -181,7 +166,6 @@ typename BlockStack::Block* BlockStack::List::PopAll() { return result; } - template void BlockStack::List::Push(Block* block) { ASSERT(block->next_ == NULL); @@ -190,13 +174,11 @@ void BlockStack::List::Push(Block* block) { ++length_; } - bool StoreBuffer::Overflowed() { MutexLocker ml(mutex_); return (full_.length() + partial_.length()) > kMaxNonEmpty; } - template void BlockStack::TrimGlobalEmpty() { DEBUG_ASSERT(global_mutex_->IsOwnedByCurrentThread()); @@ -205,7 +187,6 @@ void BlockStack::TrimGlobalEmpty() { } } - template class BlockStack; template class BlockStack; diff --git a/runtime/vm/store_buffer.h b/runtime/vm/store_buffer.h index 45a0957d2bc..29cbef3283c 100644 --- a/runtime/vm/store_buffer.h +++ b/runtime/vm/store_buffer.h @@ -74,7 +74,6 @@ class PointerBlock { DISALLOW_COPY_AND_ASSIGN(PointerBlock); }; - // A synchronized collection of pointer blocks of a particular size. // This class is meant to be used as a base (note PushBlockImpl is protected). // The global list of cached empty blocks is currently per-size. @@ -139,7 +138,6 @@ class BlockStack { DISALLOW_COPY_AND_ASSIGN(BlockStack); }; - static const int kStoreBufferBlockSize = 1024; class StoreBuffer : public BlockStack { public: @@ -158,10 +156,8 @@ class StoreBuffer : public BlockStack { bool Overflowed(); }; - typedef StoreBuffer::Block StoreBufferBlock; - static const int kMarkingStackBlockSize = 64; class MarkingStack : public BlockStack { public: @@ -171,7 +167,6 @@ class MarkingStack : public BlockStack { } }; - } // namespace dart #endif // RUNTIME_VM_STORE_BUFFER_H_ diff --git a/runtime/vm/stub_code.cc b/runtime/vm/stub_code.cc index cf77f5fa4e4..dda8a2650ca 100644 --- a/runtime/vm/stub_code.cc +++ b/runtime/vm/stub_code.cc @@ -7,6 +7,7 @@ #include "platform/assert.h" #include "platform/globals.h" #include "vm/assembler.h" +#include "vm/clustered_snapshot.h" #include "vm/disassembler.h" #include "vm/flags.h" #include "vm/object_store.h" @@ -14,7 +15,6 @@ #include "vm/snapshot.h" #include "vm/virtual_memory.h" #include "vm/visitor.h" -#include "vm/clustered_snapshot.h" namespace dart { @@ -26,7 +26,6 @@ StubEntry* StubCode::entries_[kNumStubEntries] = { #undef STUB_CODE_DECLARE }; - StubEntry::StubEntry(const Code& code) : code_(code.raw()), entry_point_(code.UncheckedEntryPoint()), @@ -34,19 +33,16 @@ StubEntry::StubEntry(const Code& code) size_(code.Size()), label_(code.UncheckedEntryPoint()) {} - // Visit all object pointers. void StubEntry::VisitObjectPointers(ObjectPointerVisitor* visitor) { ASSERT(visitor != NULL); visitor->VisitPointer(reinterpret_cast(&code_)); } - #define STUB_CODE_GENERATE(name) \ code ^= Generate("_stub_" #name, StubCode::Generate##name##Stub); \ entries_[k##name##Index] = new StubEntry(code); - void StubCode::InitOnce() { #if defined(DART_PRECOMPILED_RUNTIME) // Stubs will be loaded from the snapshot. @@ -58,16 +54,12 @@ void StubCode::InitOnce() { #endif // DART_PRECOMPILED_RUNTIME } - #undef STUB_CODE_GENERATE - void StubCode::Init(Isolate* isolate) {} - void StubCode::VisitObjectPointers(ObjectPointerVisitor* visitor) {} - bool StubCode::HasBeenInitialized() { #if !defined(TARGET_ARCH_DBC) // Use JumpToHandler and InvokeDart as canaries. @@ -79,7 +71,6 @@ bool StubCode::HasBeenInitialized() { #endif } - bool StubCode::InInvocationStub(uword pc) { #if !defined(TARGET_ARCH_DBC) ASSERT(HasBeenInitialized()); @@ -93,7 +84,6 @@ bool StubCode::InInvocationStub(uword pc) { #endif } - bool StubCode::InJumpToFrameStub(uword pc) { #if !defined(TARGET_ARCH_DBC) ASSERT(HasBeenInitialized()); @@ -106,7 +96,6 @@ bool StubCode::InJumpToFrameStub(uword pc) { #endif } - RawCode* StubCode::GetAllocationStubForClass(const Class& cls) { // These stubs are not used by DBC. #if !defined(TARGET_ARCH_DBC) @@ -175,7 +164,6 @@ RawCode* StubCode::GetAllocationStubForClass(const Class& cls) { return Code::null(); } - const StubEntry* StubCode::UnoptimizedStaticCallEntry( intptr_t num_args_tested) { // These stubs are not used by DBC. @@ -196,7 +184,6 @@ const StubEntry* StubCode::UnoptimizedStaticCallEntry( #endif } - RawCode* StubCode::Generate(const char* name, void (*GenerateStub)(Assembler* assembler)) { Assembler assembler; @@ -217,7 +204,6 @@ RawCode* StubCode::Generate(const char* name, return code.raw(); } - const char* StubCode::NameOfStub(uword entry_point) { #define VM_STUB_CODE_TESTER(name) \ if ((name##_entry() != NULL) && \ diff --git a/runtime/vm/stub_code.h b/runtime/vm/stub_code.h index 533944d62d4..6dddbead8a9 100644 --- a/runtime/vm/stub_code.h +++ b/runtime/vm/stub_code.h @@ -118,7 +118,6 @@ class StubEntry { DISALLOW_COPY_AND_ASSIGN(StubEntry); }; - // class StubCode is used to maintain the lifecycle of stubs. class StubCode : public AllStatic { public: @@ -203,7 +202,6 @@ class StubCode : public AllStatic { static void GenerateOptimizedUsageCounterIncrement(Assembler* assembler); }; - enum DeoptStubKind { kLazyDeoptFromReturn, kLazyDeoptFromThrow, kEagerDeopt }; // Zap value used to indicate unused CODE_REG in deopt. diff --git a/runtime/vm/stub_code_arm.cc b/runtime/vm/stub_code_arm.cc index 14fe95c8259..c94c9a134b4 100644 --- a/runtime/vm/stub_code_arm.cc +++ b/runtime/vm/stub_code_arm.cc @@ -103,14 +103,12 @@ void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { __ Ret(); } - // Print the stop message. DEFINE_LEAF_RUNTIME_ENTRY(void, PrintStopMessage, 1, const char* message) { OS::Print("Stop message: %s\n", message); } END_LEAF_RUNTIME_ENTRY - // Input parameters: // R0 : stop message (const char*). // Must preserve all registers. @@ -122,7 +120,6 @@ void StubCode::GeneratePrintStopMessageStub(Assembler* assembler) { __ Ret(); } - // Input parameters: // LR : return address. // SP : address of return value. @@ -205,21 +202,18 @@ static void GenerateCallNativeWithWrapperStub(Assembler* assembler, __ Ret(); } - void StubCode::GenerateCallNoScopeNativeStub(Assembler* assembler) { GenerateCallNativeWithWrapperStub( assembler, Address(THR, Thread::no_scope_native_wrapper_entry_point_offset())); } - void StubCode::GenerateCallAutoScopeNativeStub(Assembler* assembler) { GenerateCallNativeWithWrapperStub( assembler, Address(THR, Thread::auto_scope_native_wrapper_entry_point_offset())); } - // Input parameters: // LR : return address. // SP : address of return value. @@ -298,7 +292,6 @@ void StubCode::GenerateCallBootstrapNativeStub(Assembler* assembler) { __ Ret(); } - // Input parameters: // R4: arguments descriptor array. void StubCode::GenerateCallStaticFunctionStub(Assembler* assembler) { @@ -319,7 +312,6 @@ void StubCode::GenerateCallStaticFunctionStub(Assembler* assembler) { __ bx(R0); } - // Called from a static call only when an invalid code has been entered // (invalid because its function was optimized or deoptimized). // R4: arguments descriptor array. @@ -345,7 +337,6 @@ void StubCode::GenerateFixCallersTargetStub(Assembler* assembler) { __ bx(R0); } - // Called from object allocate instruction when the allocation stub has been // disabled. void StubCode::GenerateFixAllocationStubTargetStub(Assembler* assembler) { @@ -368,7 +359,6 @@ void StubCode::GenerateFixAllocationStubTargetStub(Assembler* assembler) { __ bx(R0); } - // Input parameters: // R2: smi-tagged argument count, may be zero. // FP[kParamEndSlotFromFp + 1]: last argument. @@ -398,7 +388,6 @@ static void PushArgumentsArray(Assembler* assembler) { __ b(&loop, PL); } - // Used by eager and lazy deoptimization. Preserve result in R0 if necessary. // This stub translates optimized frame into unoptimized frame. The optimized // frame can contain values in registers and on stack, the unoptimized @@ -555,7 +544,6 @@ static void GenerateDeoptimizationSequence(Assembler* assembler, // The caller is responsible for emitting the return instruction. } - // R0: result, must be preserved void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) { // Push zap value instead of CODE_REG for lazy deopt. @@ -568,7 +556,6 @@ void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) { __ Ret(); } - // R0: exception, must be preserved // R1: stacktrace, must be preserved void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) { @@ -582,13 +569,11 @@ void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) { __ Ret(); } - void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { GenerateDeoptimizationSequence(assembler, kEagerDeopt); __ Ret(); } - static void GenerateDispatcherCode(Assembler* assembler, Label* call_target_function) { __ Comment("NoSuchMethodDispatch"); @@ -622,7 +607,6 @@ static void GenerateDispatcherCode(Assembler* assembler, __ Ret(); } - void StubCode::GenerateMegamorphicMissStub(Assembler* assembler) { __ EnterStubFrame(); @@ -662,7 +646,6 @@ void StubCode::GenerateMegamorphicMissStub(Assembler* assembler) { __ bx(R2); } - // Called for inline allocation of arrays. // Input parameters: // LR: return address. @@ -785,7 +768,6 @@ void StubCode::GenerateAllocateArrayStub(Assembler* assembler) { __ Ret(); } - // Called when invoking Dart code from C++ (VM code). // Input parameters: // LR : points to return address. @@ -906,7 +888,6 @@ void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) { __ Ret(); } - // Called for inline allocation of contexts. // Input: // R1: number of context variables. @@ -1028,7 +1009,6 @@ void StubCode::GenerateAllocateContextStub(Assembler* assembler) { __ Ret(); } - // Helper stub to implement Assembler::StoreIntoObject. // Input parameters: // R0: address (i.e. object) being stored into. @@ -1101,7 +1081,6 @@ void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { __ Ret(); } - // Called for inline allocation of objects. // Input parameters: // LR : return address. @@ -1238,7 +1217,6 @@ void StubCode::GenerateAllocationStubForClass(Assembler* assembler, __ Ret(); } - // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function // from the entry code of a dart function after an error in passed argument // name or number is detected. @@ -1274,7 +1252,6 @@ void StubCode::GenerateCallClosureNoSuchMethodStub(Assembler* assembler) { __ bkpt(0); } - // R8: function object. // R9: inline cache data object. // Cannot use function object from ICData as it may be the inlined @@ -1297,7 +1274,6 @@ void StubCode::GenerateOptimizedUsageCounterIncrement(Assembler* assembler) { __ str(NOTFP, FieldAddress(func_reg, Function::usage_counter_offset())); } - // Loads function into 'temp_reg'. void StubCode::GenerateUsageCounterIncrement(Assembler* assembler, Register temp_reg) { @@ -1313,7 +1289,6 @@ void StubCode::GenerateUsageCounterIncrement(Assembler* assembler, } } - // Note: R9 must be preserved. // Attempt a quick Smi operation for known operations ('kind'). The ICData // must have been primed with a Smi/Smi check that will be used for counting @@ -1377,7 +1352,6 @@ static void EmitFastSmiOp(Assembler* assembler, __ Ret(); } - // Generate inline cache check for 'num_args'. // LR: return address. // R9: inline cache data object. @@ -1552,7 +1526,6 @@ void StubCode::GenerateNArgsCheckInlineCacheStub( } } - // Use inline cache data array to invoke the target or continue in inline // cache miss handler. Stub for 1-argument check (receiver class). // LR: return address. @@ -1569,7 +1542,6 @@ void StubCode::GenerateOneArgCheckInlineCacheStub(Assembler* assembler) { assembler, 1, kInlineCacheMissHandlerOneArgRuntimeEntry, Token::kILLEGAL); } - void StubCode::GenerateTwoArgsCheckInlineCacheStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, R8); GenerateNArgsCheckInlineCacheStub(assembler, 2, @@ -1577,28 +1549,24 @@ void StubCode::GenerateTwoArgsCheckInlineCacheStub(Assembler* assembler) { Token::kILLEGAL); } - void StubCode::GenerateSmiAddInlineCacheStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, R8); GenerateNArgsCheckInlineCacheStub( assembler, 2, kInlineCacheMissHandlerTwoArgsRuntimeEntry, Token::kADD); } - void StubCode::GenerateSmiSubInlineCacheStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, R8); GenerateNArgsCheckInlineCacheStub( assembler, 2, kInlineCacheMissHandlerTwoArgsRuntimeEntry, Token::kSUB); } - void StubCode::GenerateSmiEqualInlineCacheStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, R8); GenerateNArgsCheckInlineCacheStub( assembler, 2, kInlineCacheMissHandlerTwoArgsRuntimeEntry, Token::kEQ); } - void StubCode::GenerateOneArgOptimizedCheckInlineCacheStub( Assembler* assembler) { GenerateOptimizedUsageCounterIncrement(assembler); @@ -1607,7 +1575,6 @@ void StubCode::GenerateOneArgOptimizedCheckInlineCacheStub( Token::kILLEGAL, true /* optimized */); } - void StubCode::GenerateTwoArgsOptimizedCheckInlineCacheStub( Assembler* assembler) { GenerateOptimizedUsageCounterIncrement(assembler); @@ -1616,7 +1583,6 @@ void StubCode::GenerateTwoArgsOptimizedCheckInlineCacheStub( Token::kILLEGAL, true /* optimized */); } - // Intermediary stub between a static call and its target. ICData contains // the target function and the call count. // R9: ICData @@ -1683,21 +1649,18 @@ void StubCode::GenerateZeroArgsUnoptimizedStaticCallStub(Assembler* assembler) { } } - void StubCode::GenerateOneArgUnoptimizedStaticCallStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, R8); GenerateNArgsCheckInlineCacheStub( assembler, 1, kStaticCallMissHandlerOneArgRuntimeEntry, Token::kILLEGAL); } - void StubCode::GenerateTwoArgsUnoptimizedStaticCallStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, R8); GenerateNArgsCheckInlineCacheStub( assembler, 2, kStaticCallMissHandlerTwoArgsRuntimeEntry, Token::kILLEGAL); } - // Stub for compiling a function and jumping to the compiled code. // R9: IC-Data (for methods). // R4: Arguments descriptor. @@ -1717,7 +1680,6 @@ void StubCode::GenerateLazyCompileStub(Assembler* assembler) { __ bx(R2); } - // R9: Contains an ICData. void StubCode::GenerateICCallBreakpointStub(Assembler* assembler) { __ EnterStubFrame(); @@ -1732,7 +1694,6 @@ void StubCode::GenerateICCallBreakpointStub(Assembler* assembler) { __ bx(R0); } - void StubCode::GenerateRuntimeCallBreakpointStub(Assembler* assembler) { __ EnterStubFrame(); __ LoadImmediate(R0, 0); @@ -1745,7 +1706,6 @@ void StubCode::GenerateRuntimeCallBreakpointStub(Assembler* assembler) { __ bx(R0); } - // Called only from unoptimized code. All relevant registers have been saved. void StubCode::GenerateDebugStepCheckStub(Assembler* assembler) { // Check single stepping. @@ -1764,7 +1724,6 @@ void StubCode::GenerateDebugStepCheckStub(Assembler* assembler) { __ b(&done_stepping); } - // Used to check class and type arguments. Arguments passed in registers: // LR: return address. // R0: instance (must be preserved). @@ -1850,7 +1809,6 @@ static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) { __ Ret(); } - // Used to check class and type arguments. Arguments passed in registers: // LR: return address. // R0: instance (must be preserved). @@ -1862,7 +1820,6 @@ void StubCode::GenerateSubtype1TestCacheStub(Assembler* assembler) { GenerateSubtypeNTestCacheStub(assembler, 1); } - // Used to check class and type arguments. Arguments passed in registers: // LR: return address. // R0: instance (must be preserved). @@ -1874,7 +1831,6 @@ void StubCode::GenerateSubtype2TestCacheStub(Assembler* assembler) { GenerateSubtypeNTestCacheStub(assembler, 2); } - // Used to check class and type arguments. Arguments passed in registers: // LR: return address. // R0: instance (must be preserved). @@ -1886,14 +1842,12 @@ void StubCode::GenerateSubtype4TestCacheStub(Assembler* assembler) { GenerateSubtypeNTestCacheStub(assembler, 4); } - // Return the current stack pointer address, used to do stack alignment checks. void StubCode::GenerateGetCStackPointerStub(Assembler* assembler) { __ mov(R0, Operand(SP)); __ Ret(); } - // Jump to a frame on the call stack. // LR: return address. // R0: program_counter. @@ -1904,11 +1858,11 @@ void StubCode::GenerateGetCStackPointerStub(Assembler* assembler) { void StubCode::GenerateJumpToFrameStub(Assembler* assembler) { ASSERT(kExceptionObjectReg == R0); ASSERT(kStackTraceObjectReg == R1); - __ mov(IP, Operand(R1)); // Copy Stack pointer into IP. - __ mov(LR, Operand(R0)); // Program counter. - __ mov(THR, Operand(R3)); // Thread. - __ mov(FP, Operand(R2)); // Frame_pointer. - __ mov(SP, Operand(IP)); // Set Stack pointer. + __ mov(IP, Operand(R1)); // Copy Stack pointer into IP. + __ mov(LR, Operand(R0)); // Program counter. + __ mov(THR, Operand(R3)); // Thread. + __ mov(FP, Operand(R2)); // Frame_pointer. + __ mov(SP, Operand(IP)); // Set Stack pointer. // Set the tag. __ LoadImmediate(R2, VMTag::kDartTagId); __ StoreToOffset(kWord, R2, THR, Thread::vm_tag_offset()); @@ -1921,7 +1875,6 @@ void StubCode::GenerateJumpToFrameStub(Assembler* assembler) { __ bx(LR); // Jump to continuation point. } - // Run an exception handler. Execution comes from JumpToFrame // stub or from the simulator. // @@ -1942,7 +1895,6 @@ void StubCode::GenerateRunExceptionHandlerStub(Assembler* assembler) { __ bx(LR); // Jump to the exception handler code. } - // Deoptimize a frame on the call stack before rewinding. // The arguments are stored in the Thread object. // No result. @@ -1962,7 +1914,6 @@ void StubCode::GenerateDeoptForRewindStub(Assembler* assembler) { __ bkpt(0); } - // Calls to the runtime to optimize the given function. // R8: function to be reoptimized. // R4: argument descriptor (preserved). @@ -1983,7 +1934,6 @@ void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { __ bkpt(0); } - // Does identical check (object references are equal or not equal) with special // checks for boxed numbers. // LR: return address. @@ -2050,7 +2000,6 @@ static void GenerateIdenticalWithNumberCheckStub(Assembler* assembler, __ Bind(&done); } - // Called only from unoptimized code. All relevant registers have been saved. // LR: return address. // SP + 4: left operand. @@ -2086,7 +2035,6 @@ void StubCode::GenerateUnoptimizedIdenticalWithNumberCheckStub( } } - // Called from optimized code only. // LR: return address. // SP + 4: left operand. @@ -2103,7 +2051,6 @@ void StubCode::GenerateOptimizedIdenticalWithNumberCheckStub( __ Ret(); } - // Called from megamorphic calls. // R0: receiver // R9: MegamorphicCache (preserved) @@ -2158,7 +2105,6 @@ void StubCode::GenerateMegamorphicCallStub(Assembler* assembler) { __ b(&loop); } - // Called from switchable IC calls. // R0: receiver // R9: ICData (preserved) @@ -2199,7 +2145,6 @@ void StubCode::GenerateICCallThroughFunctionStub(Assembler* assembler) { __ bx(R1); } - void StubCode::GenerateICCallThroughCodeStub(Assembler* assembler) { Label loop, found, miss; __ ldr(R4, FieldAddress(R9, ICData::arguments_descriptor_offset())); @@ -2234,7 +2179,6 @@ void StubCode::GenerateICCallThroughCodeStub(Assembler* assembler) { __ bx(R1); } - // Called from switchable IC calls. // R0: receiver // R9: UnlinkedCall @@ -2258,7 +2202,6 @@ void StubCode::GenerateUnlinkedCallStub(Assembler* assembler) { __ bx(R1); } - // Called from switchable IC calls. // R0: receiver // R9: SingleTargetCache @@ -2298,7 +2241,6 @@ void StubCode::GenerateSingleTargetCallStub(Assembler* assembler) { __ bx(R1); } - // Called from the monomorphic checked entry. // R0: receiver void StubCode::GenerateMonomorphicMissStub(Assembler* assembler) { @@ -2321,12 +2263,10 @@ void StubCode::GenerateMonomorphicMissStub(Assembler* assembler) { __ bx(R1); } - void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { __ bkpt(0); } - void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) { __ bkpt(0); } diff --git a/runtime/vm/stub_code_arm64.cc b/runtime/vm/stub_code_arm64.cc index fac4ef6be68..bc582e5f9f3 100644 --- a/runtime/vm/stub_code_arm64.cc +++ b/runtime/vm/stub_code_arm64.cc @@ -123,19 +123,16 @@ void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { __ ret(); } - // Print the stop message. DEFINE_LEAF_RUNTIME_ENTRY(void, PrintStopMessage, 1, const char* message) { OS::Print("Stop message: %s\n", message); } END_LEAF_RUNTIME_ENTRY - void StubCode::GeneratePrintStopMessageStub(Assembler* assembler) { __ Stop("GeneratePrintStopMessageStub"); } - // Input parameters: // LR : return address. // SP : address of return value. @@ -230,21 +227,18 @@ static void GenerateCallNativeWithWrapperStub(Assembler* assembler, __ ret(); } - void StubCode::GenerateCallNoScopeNativeStub(Assembler* assembler) { GenerateCallNativeWithWrapperStub( assembler, Address(THR, Thread::no_scope_native_wrapper_entry_point_offset())); } - void StubCode::GenerateCallAutoScopeNativeStub(Assembler* assembler) { GenerateCallNativeWithWrapperStub( assembler, Address(THR, Thread::auto_scope_native_wrapper_entry_point_offset())); } - // Input parameters: // LR : return address. // SP : address of return value. @@ -335,7 +329,6 @@ void StubCode::GenerateCallBootstrapNativeStub(Assembler* assembler) { __ ret(); } - // Input parameters: // R4: arguments descriptor array. void StubCode::GenerateCallStaticFunctionStub(Assembler* assembler) { @@ -356,7 +349,6 @@ void StubCode::GenerateCallStaticFunctionStub(Assembler* assembler) { __ br(R0); } - // Called from a static call only when an invalid code has been entered // (invalid because its function was optimized or deoptimized). // R4: arguments descriptor array. @@ -382,7 +374,6 @@ void StubCode::GenerateFixCallersTargetStub(Assembler* assembler) { __ br(R0); } - // Called from object allocate instruction when the allocation stub has been // disabled. void StubCode::GenerateFixAllocationStubTargetStub(Assembler* assembler) { @@ -403,7 +394,6 @@ void StubCode::GenerateFixAllocationStubTargetStub(Assembler* assembler) { __ br(R0); } - // Input parameters: // R2: smi-tagged argument count, may be zero. // FP[kParamEndSlotFromFp + 1]: last argument. @@ -435,7 +425,6 @@ static void PushArgumentsArray(Assembler* assembler) { __ Bind(&loop_exit); } - // Used by eager and lazy deoptimization. Preserve result in RAX if necessary. // This stub translates optimized frame into unoptimized frame. The optimized // frame can contain values in registers and on stack, the unoptimized @@ -576,7 +565,6 @@ static void GenerateDeoptimizationSequence(Assembler* assembler, // The caller is responsible for emitting the return instruction. } - // R0: result, must be preserved void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) { // Push zap value instead of CODE_REG for lazy deopt. @@ -589,7 +577,6 @@ void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) { __ ret(); } - // R0: exception, must be preserved // R1: stacktrace, must be preserved void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) { @@ -603,13 +590,11 @@ void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) { __ ret(); } - void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { GenerateDeoptimizationSequence(assembler, kEagerDeopt); __ ret(); } - static void GenerateDispatcherCode(Assembler* assembler, Label* call_target_function) { __ Comment("NoSuchMethodDispatch"); @@ -644,7 +629,6 @@ static void GenerateDispatcherCode(Assembler* assembler, __ ret(); } - void StubCode::GenerateMegamorphicMissStub(Assembler* assembler) { __ EnterStubFrame(); @@ -689,7 +673,6 @@ void StubCode::GenerateMegamorphicMissStub(Assembler* assembler) { __ br(R2); } - // Called for inline allocation of arrays. // Input parameters: // LR: return address. @@ -834,7 +817,6 @@ void StubCode::GenerateAllocateArrayStub(Assembler* assembler) { __ ret(); } - // Called when invoking Dart code from C++ (VM code). // Input parameters: // LR : points to return address. @@ -967,7 +949,6 @@ void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) { __ ret(); } - // Called for inline allocation of contexts. // Input: // R1: number of context variables. @@ -1082,7 +1063,6 @@ void StubCode::GenerateAllocateContextStub(Assembler* assembler) { __ ret(); } - // Helper stub to implement Assembler::StoreIntoObject. // Input parameters: // R0: Address being stored @@ -1148,7 +1128,6 @@ void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { __ ret(); } - // Called for inline allocation of objects. // Input parameters: // LR : return address. @@ -1275,7 +1254,6 @@ void StubCode::GenerateAllocationStubForClass(Assembler* assembler, __ ret(); } - // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function // from the entry code of a dart function after an error in passed argument // name or number is detected. @@ -1313,7 +1291,6 @@ void StubCode::GenerateCallClosureNoSuchMethodStub(Assembler* assembler) { __ brk(0); } - // R6: function object. // R5: inline cache data object. // Cannot use function object from ICData as it may be the inlined @@ -1338,7 +1315,6 @@ void StubCode::GenerateOptimizedUsageCounterIncrement(Assembler* assembler) { __ StoreFieldToOffset(R7, func_reg, Function::usage_counter_offset(), kWord); } - // Loads function into 'temp_reg'. void StubCode::GenerateUsageCounterIncrement(Assembler* assembler, Register temp_reg) { @@ -1356,7 +1332,6 @@ void StubCode::GenerateUsageCounterIncrement(Assembler* assembler, } } - // Note: R5 must be preserved. // Attempt a quick Smi operation for known operations ('kind'). The ICData // must have been primed with a Smi/Smi check that will be used for counting @@ -1423,7 +1398,6 @@ static void EmitFastSmiOp(Assembler* assembler, __ ret(); } - // Generate inline cache check for 'num_args'. // LR: return address. // R5: inline cache data object. @@ -1605,7 +1579,6 @@ void StubCode::GenerateNArgsCheckInlineCacheStub( } } - // Use inline cache data array to invoke the target or continue in inline // cache miss handler. Stub for 1-argument check (receiver class). // LR: return address. @@ -1622,7 +1595,6 @@ void StubCode::GenerateOneArgCheckInlineCacheStub(Assembler* assembler) { assembler, 1, kInlineCacheMissHandlerOneArgRuntimeEntry, Token::kILLEGAL); } - void StubCode::GenerateTwoArgsCheckInlineCacheStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, R6); GenerateNArgsCheckInlineCacheStub(assembler, 2, @@ -1630,28 +1602,24 @@ void StubCode::GenerateTwoArgsCheckInlineCacheStub(Assembler* assembler) { Token::kILLEGAL); } - void StubCode::GenerateSmiAddInlineCacheStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, R6); GenerateNArgsCheckInlineCacheStub( assembler, 2, kInlineCacheMissHandlerTwoArgsRuntimeEntry, Token::kADD); } - void StubCode::GenerateSmiSubInlineCacheStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, R6); GenerateNArgsCheckInlineCacheStub( assembler, 2, kInlineCacheMissHandlerTwoArgsRuntimeEntry, Token::kSUB); } - void StubCode::GenerateSmiEqualInlineCacheStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, R6); GenerateNArgsCheckInlineCacheStub( assembler, 2, kInlineCacheMissHandlerTwoArgsRuntimeEntry, Token::kEQ); } - void StubCode::GenerateOneArgOptimizedCheckInlineCacheStub( Assembler* assembler) { GenerateOptimizedUsageCounterIncrement(assembler); @@ -1660,7 +1628,6 @@ void StubCode::GenerateOneArgOptimizedCheckInlineCacheStub( Token::kILLEGAL, true /* optimized */); } - void StubCode::GenerateTwoArgsOptimizedCheckInlineCacheStub( Assembler* assembler) { GenerateOptimizedUsageCounterIncrement(assembler); @@ -1669,7 +1636,6 @@ void StubCode::GenerateTwoArgsOptimizedCheckInlineCacheStub( Token::kILLEGAL, true /* optimized */); } - void StubCode::GenerateZeroArgsUnoptimizedStaticCallStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, R6); #if defined(DEBUG) @@ -1734,21 +1700,18 @@ void StubCode::GenerateZeroArgsUnoptimizedStaticCallStub(Assembler* assembler) { } } - void StubCode::GenerateOneArgUnoptimizedStaticCallStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, R6); GenerateNArgsCheckInlineCacheStub( assembler, 1, kStaticCallMissHandlerOneArgRuntimeEntry, Token::kILLEGAL); } - void StubCode::GenerateTwoArgsUnoptimizedStaticCallStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, R6); GenerateNArgsCheckInlineCacheStub( assembler, 2, kStaticCallMissHandlerTwoArgsRuntimeEntry, Token::kILLEGAL); } - // Stub for compiling a function and jumping to the compiled code. // R5: IC-Data (for methods). // R4: Arguments descriptor. @@ -1770,7 +1733,6 @@ void StubCode::GenerateLazyCompileStub(Assembler* assembler) { __ br(R2); } - // R5: Contains an ICData. void StubCode::GenerateICCallBreakpointStub(Assembler* assembler) { __ EnterStubFrame(); @@ -1784,7 +1746,6 @@ void StubCode::GenerateICCallBreakpointStub(Assembler* assembler) { __ br(R0); } - void StubCode::GenerateRuntimeCallBreakpointStub(Assembler* assembler) { __ EnterStubFrame(); __ Push(ZR); // Space for result. @@ -1814,7 +1775,6 @@ void StubCode::GenerateDebugStepCheckStub(Assembler* assembler) { __ b(&done_stepping); } - // Used to check class and type arguments. Arguments passed in registers: // LR: return address. // R0: instance (must be preserved). @@ -1900,7 +1860,6 @@ static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) { __ ret(); } - // Used to check class and type arguments. Arguments passed on stack: // LR: return address. // R0: instance (must be preserved). @@ -1912,7 +1871,6 @@ void StubCode::GenerateSubtype1TestCacheStub(Assembler* assembler) { GenerateSubtypeNTestCacheStub(assembler, 1); } - // Used to check class and type arguments. Arguments passed in registers: // LR: return address. // R0: instance (must be preserved). @@ -1924,7 +1882,6 @@ void StubCode::GenerateSubtype2TestCacheStub(Assembler* assembler) { GenerateSubtypeNTestCacheStub(assembler, 2); } - // Used to check class and type arguments. Arguments passed on stack: // LR: return address. // R0: instance (must be preserved). @@ -1936,13 +1893,11 @@ void StubCode::GenerateSubtype4TestCacheStub(Assembler* assembler) { GenerateSubtypeNTestCacheStub(assembler, 4); } - void StubCode::GenerateGetCStackPointerStub(Assembler* assembler) { __ mov(R0, CSP); __ ret(); } - // Jump to a frame on the call stack. // LR: return address. // R0: program_counter. @@ -1968,7 +1923,6 @@ void StubCode::GenerateJumpToFrameStub(Assembler* assembler) { __ ret(); // Jump to continuation point. } - // Run an exception handler. Execution comes from JumpToFrame // stub or from the simulator. // @@ -1989,7 +1943,6 @@ void StubCode::GenerateRunExceptionHandlerStub(Assembler* assembler) { __ ret(); // Jump to the exception handler code. } - // Deoptimize a frame on the call stack before rewinding. // The arguments are stored in the Thread object. // No result. @@ -2009,7 +1962,6 @@ void StubCode::GenerateDeoptForRewindStub(Assembler* assembler) { __ brk(0); } - // Calls to the runtime to optimize the given function. // R6: function to be re-optimized. // R4: argument descriptor (preserved). @@ -2030,7 +1982,6 @@ void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { __ brk(0); } - // Does identical check (object references are equal or not equal) with special // checks for boxed numbers. // Left and right are pushed on stack. @@ -2088,7 +2039,6 @@ static void GenerateIdenticalWithNumberCheckStub(Assembler* assembler, __ Bind(&done); } - // Called only from unoptimized code. All relevant registers have been saved. // LR: return address. // SP + 4: left operand. @@ -2123,7 +2073,6 @@ void StubCode::GenerateUnoptimizedIdenticalWithNumberCheckStub( } } - // Called from optimized code only. // LR: return address. // SP + 4: left operand. @@ -2139,7 +2088,6 @@ void StubCode::GenerateOptimizedIdenticalWithNumberCheckStub( __ ret(); } - // Called from megamorphic calls. // R0: receiver // R5: MegamorphicCache (preserved) @@ -2212,7 +2160,6 @@ void StubCode::GenerateMegamorphicCallStub(Assembler* assembler) { __ b(&cid_loaded); } - // Called from switchable IC calls. // R0: receiver // R5: ICData (preserved) @@ -2253,7 +2200,6 @@ void StubCode::GenerateICCallThroughFunctionStub(Assembler* assembler) { __ br(R1); } - void StubCode::GenerateICCallThroughCodeStub(Assembler* assembler) { Label loop, found, miss; __ ldr(R4, FieldAddress(R5, ICData::arguments_descriptor_offset())); @@ -2288,7 +2234,6 @@ void StubCode::GenerateICCallThroughCodeStub(Assembler* assembler) { __ br(R1); } - // Called from switchable IC calls. // R0: receiver // R5: SingleTargetCache @@ -2311,7 +2256,6 @@ void StubCode::GenerateUnlinkedCallStub(Assembler* assembler) { __ br(R1); } - // Called from switchable IC calls. // R0: receiver // R5: SingleTargetCache @@ -2352,7 +2296,6 @@ void StubCode::GenerateSingleTargetCallStub(Assembler* assembler) { __ br(R1); } - // Called from the monomorphic checked entry. // R0: receiver void StubCode::GenerateMonomorphicMissStub(Assembler* assembler) { @@ -2374,12 +2317,10 @@ void StubCode::GenerateMonomorphicMissStub(Assembler* assembler) { __ br(R1); } - void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { __ brk(0); } - void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) { __ brk(0); } diff --git a/runtime/vm/stub_code_arm64_test.cc b/runtime/vm/stub_code_arm64_test.cc index 7112f2635be..e489ced4dca 100644 --- a/runtime/vm/stub_code_arm64_test.cc +++ b/runtime/vm/stub_code_arm64_test.cc @@ -5,8 +5,8 @@ #include "vm/globals.h" #if defined(TARGET_ARCH_ARM64) -#include "vm/isolate.h" #include "vm/dart_entry.h" +#include "vm/isolate.h" #include "vm/native_entry.h" #include "vm/native_entry_test.h" #include "vm/object.h" @@ -34,7 +34,6 @@ static Function* CreateFunction(const char* name) { return &function; } - // Test calls to stub code which calls into the runtime. static void GenerateCallToCallRuntimeStub(Assembler* assembler, int length) { const int argc = 2; @@ -51,7 +50,6 @@ static void GenerateCallToCallRuntimeStub(Assembler* assembler, int length) { __ ret(); } - TEST_CASE(CallRuntimeStubCode) { extern const Function& RegisterFakeFunction(const char* name, const Code& code); @@ -67,7 +65,6 @@ TEST_CASE(CallRuntimeStubCode) { EXPECT_EQ(length, result.Length()); } - // Test calls to stub code which calls into a leaf runtime entry. static void GenerateCallToCallLeafRuntimeStub(Assembler* assembler, const char* value1, @@ -86,7 +83,6 @@ static void GenerateCallToCallLeafRuntimeStub(Assembler* assembler, __ ret(); // Return value is in R0. } - TEST_CASE(CallLeafRuntimeStubCode) { extern const Function& RegisterFakeFunction(const char* name, const Code& code); diff --git a/runtime/vm/stub_code_arm_test.cc b/runtime/vm/stub_code_arm_test.cc index 5a79e9312b7..f3154b5273e 100644 --- a/runtime/vm/stub_code_arm_test.cc +++ b/runtime/vm/stub_code_arm_test.cc @@ -5,8 +5,8 @@ #include "vm/globals.h" #if defined(TARGET_ARCH_ARM) -#include "vm/isolate.h" #include "vm/dart_entry.h" +#include "vm/isolate.h" #include "vm/native_entry.h" #include "vm/native_entry_test.h" #include "vm/object.h" @@ -34,7 +34,6 @@ static Function* CreateFunction(const char* name) { return &function; } - // Test calls to stub code which calls into the runtime. static void GenerateCallToCallRuntimeStub(Assembler* assembler, int length) { const int argc = 2; @@ -51,7 +50,6 @@ static void GenerateCallToCallRuntimeStub(Assembler* assembler, int length) { __ Ret(); } - TEST_CASE(CallRuntimeStubCode) { extern const Function& RegisterFakeFunction(const char* name, const Code& code); @@ -67,7 +65,6 @@ TEST_CASE(CallRuntimeStubCode) { EXPECT_EQ(length, result.Length()); } - // Test calls to stub code which calls into a leaf runtime entry. static void GenerateCallToCallLeafRuntimeStub(Assembler* assembler, const char* value1, @@ -86,7 +83,6 @@ static void GenerateCallToCallLeafRuntimeStub(Assembler* assembler, __ Ret(); // Return value is in R0. } - TEST_CASE(CallLeafRuntimeStubCode) { extern const Function& RegisterFakeFunction(const char* name, const Code& code); diff --git a/runtime/vm/stub_code_dbc.cc b/runtime/vm/stub_code_dbc.cc index 4ada569f801..10db20d4bd0 100644 --- a/runtime/vm/stub_code_dbc.cc +++ b/runtime/vm/stub_code_dbc.cc @@ -33,44 +33,37 @@ void StubCode::GenerateLazyCompileStub(Assembler* assembler) { __ Compile(); } - // Not executed, but used as a stack marker when calling // DRT_OptimizeInvokedFunction. void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { __ Trap(); } - // Not executed, but used as a sentinel in Simulator::JumpToFrame. void StubCode::GenerateRunExceptionHandlerStub(Assembler* assembler) { __ Trap(); } - void StubCode::GenerateDeoptForRewindStub(Assembler* assembler) { __ DeoptRewind(); } - // TODO(vegorov) Don't generate this stub. void StubCode::GenerateFixCallersTargetStub(Assembler* assembler) { __ Trap(); } - // TODO(vegorov) Don't generate these stubs. void StubCode::GenerateAllocationStubForClass(Assembler* assembler, const Class& cls) { __ Trap(); } - // TODO(vegorov) Don't generate this stub. void StubCode::GenerateMegamorphicMissStub(Assembler* assembler) { __ Trap(); } - // These deoptimization stubs are only used to populate stack frames // with something meaningful to make sure GC can scan the stack during // the last phase of deoptimization which materializes objects. @@ -78,27 +71,22 @@ void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) { __ Trap(); } - void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) { __ Trap(); } - void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { __ Trap(); } - void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { __ Trap(); } - void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) { __ Trap(); } - // Print the stop message. DEFINE_LEAF_RUNTIME_ENTRY(void, PrintStopMessage, 1, const char* message) { OS::Print("Stop message: %s\n", message); diff --git a/runtime/vm/stub_code_ia32.cc b/runtime/vm/stub_code_ia32.cc index 240d1fd1902..1d6ee7c81e4 100644 --- a/runtime/vm/stub_code_ia32.cc +++ b/runtime/vm/stub_code_ia32.cc @@ -9,8 +9,8 @@ #include "vm/compiler.h" #include "vm/dart_entry.h" #include "vm/flow_graph_compiler.h" -#include "vm/instructions.h" #include "vm/heap.h" +#include "vm/instructions.h" #include "vm/object_store.h" #include "vm/resolver.h" #include "vm/scavenger.h" @@ -18,7 +18,6 @@ #include "vm/stub_code.h" #include "vm/tags.h" - #define __ assembler-> namespace dart { @@ -93,14 +92,12 @@ void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { __ ret(); } - // Print the stop message. DEFINE_LEAF_RUNTIME_ENTRY(void, PrintStopMessage, 1, const char* message) { OS::Print("Stop message: %s\n", message); } END_LEAF_RUNTIME_ENTRY - // Input parameters: // ESP : points to return address. // EAX : stop message (const char*). @@ -113,7 +110,6 @@ void StubCode::GeneratePrintStopMessageStub(Assembler* assembler) { __ ret(); } - // Input parameters: // ESP : points to return address. // ESP + 4 : address of return value. @@ -135,7 +131,6 @@ static void GenerateCallNativeWithWrapperStub(Assembler* assembler, __ EnterFrame(0); - // Save exit frame information to enable stack walking as we are about // to transition to dart VM code. __ movl(Address(THR, Thread::top_exit_frame_info_offset()), EBP); @@ -184,19 +179,16 @@ static void GenerateCallNativeWithWrapperStub(Assembler* assembler, __ ret(); } - void StubCode::GenerateCallNoScopeNativeStub(Assembler* assembler) { ExternalLabel wrapper(NativeEntry::NoScopeNativeCallWrapperEntry()); GenerateCallNativeWithWrapperStub(assembler, &wrapper); } - void StubCode::GenerateCallAutoScopeNativeStub(Assembler* assembler) { ExternalLabel wrapper(NativeEntry::AutoScopeNativeCallWrapperEntry()); GenerateCallNativeWithWrapperStub(assembler, &wrapper); } - // Input parameters: // ESP : points to return address. // ESP + 4 : address of return value. @@ -261,7 +253,6 @@ void StubCode::GenerateCallBootstrapNativeStub(Assembler* assembler) { __ ret(); } - // Input parameters: // EDX: arguments descriptor array. void StubCode::GenerateCallStaticFunctionStub(Assembler* assembler) { @@ -278,7 +269,6 @@ void StubCode::GenerateCallStaticFunctionStub(Assembler* assembler) { __ jmp(ECX); } - // Called from a static call only when an invalid code has been entered // (invalid because its function was optimized or deoptimized). // EDX: arguments descriptor array. @@ -297,7 +287,6 @@ void StubCode::GenerateFixCallersTargetStub(Assembler* assembler) { __ int3(); } - // Called from object allocate instruction when the allocation stub has been // disabled. void StubCode::GenerateFixAllocationStubTargetStub(Assembler* assembler) { @@ -311,7 +300,6 @@ void StubCode::GenerateFixAllocationStubTargetStub(Assembler* assembler) { __ int3(); } - // Input parameters: // EDX: smi-tagged argument count, may be zero. // EBP[kParamEndSlotFromFp + 1]: last argument. @@ -343,7 +331,6 @@ static void PushArgumentsArray(Assembler* assembler) { __ j(POSITIVE, &loop, Assembler::kNearJump); } - // Used by eager and lazy deoptimization. Preserve result in EAX if necessary. // This stub translates optimized frame into unoptimized frame. The optimized // frame can contain values in registers and on stack, the unoptimized @@ -475,7 +462,6 @@ static void GenerateDeoptimizationSequence(Assembler* assembler, // The caller is responsible for emitting the return instruction. } - // EAX: result, must be preserved void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) { // Return address for "call" to deopt stub. @@ -484,7 +470,6 @@ void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) { __ ret(); } - // EAX: exception, must be preserved // EDX: stacktrace, must be preserved void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) { @@ -494,13 +479,11 @@ void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) { __ ret(); } - void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { GenerateDeoptimizationSequence(assembler, kEagerDeopt); __ ret(); } - static void GenerateDispatcherCode(Assembler* assembler, Label* call_target_function) { __ Comment("NoSuchMethodDispatch"); @@ -539,7 +522,6 @@ static void GenerateDispatcherCode(Assembler* assembler, __ ret(); } - void StubCode::GenerateMegamorphicMissStub(Assembler* assembler) { __ EnterStubFrame(); // Load the receiver into EAX. The argument count in the arguments @@ -576,7 +558,6 @@ void StubCode::GenerateMegamorphicMissStub(Assembler* assembler) { __ jmp(EBX); } - // Called for inline allocation of arrays. // Input parameters: // EDX : Array length as Smi (must be preserved). @@ -714,7 +695,6 @@ void StubCode::GenerateAllocateArrayStub(Assembler* assembler) { __ ret(); } - // Called when invoking dart code from C++ (VM code). // Input parameters: // ESP : points to return address. @@ -824,7 +804,6 @@ void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) { __ ret(); } - // Called for inline allocation of contexts. // Input: // EDX: number of context variables. @@ -955,7 +934,6 @@ void StubCode::GenerateAllocateContextStub(Assembler* assembler) { __ ret(); } - // Helper stub to implement Assembler::StoreIntoObject. // Input parameters: // EDX: Address being stored @@ -1023,7 +1001,6 @@ void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { __ ret(); } - // Called for inline allocation of objects. // Input parameters: // ESP + 4 : type arguments object (only if class is parameterized). @@ -1151,7 +1128,6 @@ void StubCode::GenerateAllocationStubForClass(Assembler* assembler, __ ret(); } - // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function // from the entry code of a dart function after an error in passed argument // name or number is detected. @@ -1189,7 +1165,6 @@ void StubCode::GenerateCallClosureNoSuchMethodStub(Assembler* assembler) { __ int3(); } - // Cannot use function object from ICData as it may be the inlined // function and not the top-scope function. void StubCode::GenerateOptimizedUsageCounterIncrement(Assembler* assembler) { @@ -1211,7 +1186,6 @@ void StubCode::GenerateOptimizedUsageCounterIncrement(Assembler* assembler) { __ incl(FieldAddress(func_reg, Function::usage_counter_offset())); } - // Loads function into 'temp_reg'. void StubCode::GenerateUsageCounterIncrement(Assembler* assembler, Register temp_reg) { @@ -1225,7 +1199,6 @@ void StubCode::GenerateUsageCounterIncrement(Assembler* assembler, } } - // Note: ECX must be preserved. // Attempt a quick Smi operation for known operations ('kind'). The ICData // must have been primed with a Smi/Smi check that will be used for counting @@ -1299,7 +1272,6 @@ static void EmitFastSmiOp(Assembler* assembler, __ ret(); } - // Generate inline cache check for 'num_args'. // ECX: Inline cache data object. // TOS(0): return address @@ -1400,7 +1372,7 @@ void StubCode::GenerateNArgsCheckInlineCacheStub( __ movl(EDI, Address(ESP, EAX, TIMES_2, -kWordSize)); __ LoadTaggedClassIdMayBeSmi(EDI, EDI); __ cmpl(EDI, Address(EBX, kWordSize)); // Class id match? - __ j(EQUAL, &found); // Break. + __ j(EQUAL, &found); // Break. __ Bind(&update); __ addl(EBX, Immediate(entry_size)); // Next entry. @@ -1476,7 +1448,6 @@ void StubCode::GenerateNArgsCheckInlineCacheStub( } } - // Use inline cache data array to invoke the target or continue in inline // cache miss handler. Stub for 1-argument check (receiver class). // ECX: Inline cache data object. @@ -1493,7 +1464,6 @@ void StubCode::GenerateOneArgCheckInlineCacheStub(Assembler* assembler) { assembler, 1, kInlineCacheMissHandlerOneArgRuntimeEntry, Token::kILLEGAL); } - void StubCode::GenerateTwoArgsCheckInlineCacheStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, EBX); GenerateNArgsCheckInlineCacheStub(assembler, 2, @@ -1501,28 +1471,24 @@ void StubCode::GenerateTwoArgsCheckInlineCacheStub(Assembler* assembler) { Token::kILLEGAL); } - void StubCode::GenerateSmiAddInlineCacheStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, EBX); GenerateNArgsCheckInlineCacheStub( assembler, 2, kInlineCacheMissHandlerTwoArgsRuntimeEntry, Token::kADD); } - void StubCode::GenerateSmiSubInlineCacheStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, EBX); GenerateNArgsCheckInlineCacheStub( assembler, 2, kInlineCacheMissHandlerTwoArgsRuntimeEntry, Token::kSUB); } - void StubCode::GenerateSmiEqualInlineCacheStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, EBX); GenerateNArgsCheckInlineCacheStub( assembler, 2, kInlineCacheMissHandlerTwoArgsRuntimeEntry, Token::kEQ); } - // Use inline cache data array to invoke the target or continue in inline // cache miss handler. Stub for 1-argument check (receiver class). // EDI: function which counter needs to be incremented. @@ -1542,7 +1508,6 @@ void StubCode::GenerateOneArgOptimizedCheckInlineCacheStub( Token::kILLEGAL, true /* optimized */); } - void StubCode::GenerateTwoArgsOptimizedCheckInlineCacheStub( Assembler* assembler) { GenerateOptimizedUsageCounterIncrement(assembler); @@ -1551,7 +1516,6 @@ void StubCode::GenerateTwoArgsOptimizedCheckInlineCacheStub( Token::kILLEGAL, true /* optimized */); } - // Intermediary stub between a static call and its target. ICData contains // the target function and the call count. // ECX: ICData @@ -1613,21 +1577,18 @@ void StubCode::GenerateZeroArgsUnoptimizedStaticCallStub(Assembler* assembler) { } } - void StubCode::GenerateOneArgUnoptimizedStaticCallStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, EBX); GenerateNArgsCheckInlineCacheStub( assembler, 1, kStaticCallMissHandlerOneArgRuntimeEntry, Token::kILLEGAL); } - void StubCode::GenerateTwoArgsUnoptimizedStaticCallStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, EBX); GenerateNArgsCheckInlineCacheStub( assembler, 2, kStaticCallMissHandlerTwoArgsRuntimeEntry, Token::kILLEGAL); } - // Stub for compiling a function and jumping to the compiled code. // ECX: IC-Data (for methods). // EDX: Arguments descriptor. @@ -1647,7 +1608,6 @@ void StubCode::GenerateLazyCompileStub(Assembler* assembler) { __ jmp(EAX); } - // ECX: Contains an ICData. void StubCode::GenerateICCallBreakpointStub(Assembler* assembler) { __ EnterStubFrame(); @@ -1665,7 +1625,6 @@ void StubCode::GenerateICCallBreakpointStub(Assembler* assembler) { __ jmp(EAX); } - void StubCode::GenerateRuntimeCallBreakpointStub(Assembler* assembler) { __ EnterStubFrame(); // Room for result. Debugger stub returns address of the @@ -1679,7 +1638,6 @@ void StubCode::GenerateRuntimeCallBreakpointStub(Assembler* assembler) { __ jmp(EAX); } - // Called only from unoptimized code. void StubCode::GenerateDebugStepCheckStub(Assembler* assembler) { // Check single stepping. @@ -1698,7 +1656,6 @@ void StubCode::GenerateDebugStepCheckStub(Assembler* assembler) { __ jmp(&done_stepping, Assembler::kNearJump); } - // Used to check class and type arguments. Arguments passed on stack: // TOS + 0: return address. // TOS + 1: function type arguments (only if n == 4, can be raw_null). @@ -1791,7 +1748,6 @@ static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) { __ ret(); } - // Used to check class and type arguments. Arguments passed on stack: // TOS + 0: return address. // TOS + 1: raw_null. @@ -1803,7 +1759,6 @@ void StubCode::GenerateSubtype1TestCacheStub(Assembler* assembler) { GenerateSubtypeNTestCacheStub(assembler, 1); } - // Used to check class and type arguments. Arguments passed on stack: // TOS + 0: return address. // TOS + 1: raw_null. @@ -1815,7 +1770,6 @@ void StubCode::GenerateSubtype2TestCacheStub(Assembler* assembler) { GenerateSubtypeNTestCacheStub(assembler, 2); } - // Used to check class and type arguments. Arguments passed on stack: // TOS + 0: return address. // TOS + 1: function type arguments (can be raw_null). @@ -1827,7 +1781,6 @@ void StubCode::GenerateSubtype4TestCacheStub(Assembler* assembler) { GenerateSubtypeNTestCacheStub(assembler, 4); } - // Return the current stack pointer address, used to do stack alignment checks. // TOS + 0: return address // Result in EAX. @@ -1836,7 +1789,6 @@ void StubCode::GenerateGetCStackPointerStub(Assembler* assembler) { __ ret(); } - // Jump to a frame on the call stack. // TOS + 0: return address // TOS + 1: program_counter @@ -1856,7 +1808,6 @@ void StubCode::GenerateJumpToFrameStub(Assembler* assembler) { __ jmp(EBX); // Jump to the exception handler code. } - // Run an exception handler. Execution comes from JumpToFrame stub. // // The arguments are stored in the Thread object. @@ -1879,7 +1830,6 @@ void StubCode::GenerateRunExceptionHandlerStub(Assembler* assembler) { __ jmp(EBX); // Jump to continuation point. } - // Deoptimize a frame on the call stack before rewinding. // The arguments are stored in the Thread object. // No result. @@ -1895,7 +1845,6 @@ void StubCode::GenerateDeoptForRewindStub(Assembler* assembler) { __ int3(); } - // Calls to the runtime to optimize the given function. // EBX: function to be reoptimized. // EDX: argument descriptor (preserved). @@ -1915,7 +1864,6 @@ void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { __ int3(); } - // Does identical check (object references are equal or not equal) with special // checks for boxed numbers. // Return ZF set. @@ -1978,7 +1926,6 @@ static void GenerateIdenticalWithNumberCheckStub(Assembler* assembler, __ Bind(&done); } - // Called only from unoptimized code. All relevant registers have been saved. // TOS + 0: return address // TOS + 1: right argument. @@ -2013,7 +1960,6 @@ void StubCode::GenerateUnoptimizedIdenticalWithNumberCheckStub( } } - // Called from optimized code only. // TOS + 0: return address // TOS + 1: right argument. @@ -2030,7 +1976,6 @@ void StubCode::GenerateOptimizedIdenticalWithNumberCheckStub( __ ret(); } - // Called from megamorphic calls. // EBX: receiver // ECX: MegamorphicCache (preserved) @@ -2110,32 +2055,26 @@ void StubCode::GenerateICCallThroughFunctionStub(Assembler* assembler) { __ int3(); } - void StubCode::GenerateICCallThroughCodeStub(Assembler* assembler) { __ int3(); } - void StubCode::GenerateUnlinkedCallStub(Assembler* assembler) { __ int3(); } - void StubCode::GenerateSingleTargetCallStub(Assembler* assembler) { __ int3(); } - void StubCode::GenerateMonomorphicMissStub(Assembler* assembler) { __ int3(); } - void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { __ int3(); } - void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) { __ int3(); } diff --git a/runtime/vm/stub_code_ia32_test.cc b/runtime/vm/stub_code_ia32_test.cc index ed2951b434d..b70f19a85dc 100644 --- a/runtime/vm/stub_code_ia32_test.cc +++ b/runtime/vm/stub_code_ia32_test.cc @@ -5,8 +5,8 @@ #include "vm/globals.h" #if defined(TARGET_ARCH_IA32) -#include "vm/isolate.h" #include "vm/dart_entry.h" +#include "vm/isolate.h" #include "vm/native_entry.h" #include "vm/native_entry_test.h" #include "vm/object.h" @@ -34,7 +34,6 @@ static Function* CreateFunction(const char* name) { return &function; } - // Test calls to stub code which calls into the runtime. static void GenerateCallToCallRuntimeStub(Assembler* assembler, int length) { const int argc = 2; @@ -51,7 +50,6 @@ static void GenerateCallToCallRuntimeStub(Assembler* assembler, int length) { __ ret(); } - TEST_CASE(CallRuntimeStubCode) { extern const Function& RegisterFakeFunction(const char* name, const Code& code); @@ -67,7 +65,6 @@ TEST_CASE(CallRuntimeStubCode) { EXPECT_EQ(length, result.Length()); } - // Test calls to stub code which calls into a leaf runtime entry. static void GenerateCallToCallLeafRuntimeStub(Assembler* assembler, const char* value1, @@ -88,7 +85,6 @@ static void GenerateCallToCallLeafRuntimeStub(Assembler* assembler, __ ret(); // Return value is in EAX. } - TEST_CASE(CallLeafRuntimeStubCode) { extern const Function& RegisterFakeFunction(const char* name, const Code& code); diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc index 95874ca8b11..157f7662abf 100644 --- a/runtime/vm/stub_code_x64.cc +++ b/runtime/vm/stub_code_x64.cc @@ -96,14 +96,12 @@ void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { __ ret(); } - // Print the stop message. DEFINE_LEAF_RUNTIME_ENTRY(void, PrintStopMessage, 1, const char* message) { OS::Print("Stop message: %s\n", message); } END_LEAF_RUNTIME_ENTRY - // Input parameters: // RSP : points to return address. // RDI : stop message (const char*). @@ -119,7 +117,6 @@ void StubCode::GeneratePrintStopMessageStub(Assembler* assembler) { __ ret(); } - // Input parameters: // RSP : points to return address. // RSP + 8 : address of return value. @@ -192,21 +189,18 @@ static void GenerateCallNativeWithWrapperStub(Assembler* assembler, __ ret(); } - void StubCode::GenerateCallNoScopeNativeStub(Assembler* assembler) { GenerateCallNativeWithWrapperStub( assembler, Address(THR, Thread::no_scope_native_wrapper_entry_point_offset())); } - void StubCode::GenerateCallAutoScopeNativeStub(Assembler* assembler) { GenerateCallNativeWithWrapperStub( assembler, Address(THR, Thread::auto_scope_native_wrapper_entry_point_offset())); } - // Input parameters: // RSP : points to return address. // RSP + 8 : address of return value. @@ -274,7 +268,6 @@ void StubCode::GenerateCallBootstrapNativeStub(Assembler* assembler) { __ ret(); } - // Input parameters: // R10: arguments descriptor array. void StubCode::GenerateCallStaticFunctionStub(Assembler* assembler) { @@ -292,7 +285,6 @@ void StubCode::GenerateCallStaticFunctionStub(Assembler* assembler) { __ jmp(RBX); } - // Called from a static call only when an invalid code has been entered // (invalid because its function was optimized or deoptimized). // R10: arguments descriptor array. @@ -314,7 +306,6 @@ void StubCode::GenerateFixCallersTargetStub(Assembler* assembler) { __ int3(); } - // Called from object allocate instruction when the allocation stub has been // disabled. void StubCode::GenerateFixAllocationStubTargetStub(Assembler* assembler) { @@ -333,7 +324,6 @@ void StubCode::GenerateFixAllocationStubTargetStub(Assembler* assembler) { __ int3(); } - // Input parameters: // R10: smi-tagged argument count, may be zero. // RBP[kParamEndSlotFromFp + 1]: last argument. @@ -368,7 +358,6 @@ static void PushArgumentsArray(Assembler* assembler) { __ j(POSITIVE, &loop, Assembler::kNearJump); } - // Used by eager and lazy deoptimization. Preserve result in RAX if necessary. // This stub translates optimized frame into unoptimized frame. The optimized // frame can contain values in registers and on stack, the unoptimized @@ -516,7 +505,6 @@ static void GenerateDeoptimizationSequence(Assembler* assembler, // The caller is responsible for emitting the return instruction. } - // RAX: result, must be preserved void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) { // Push zap value instead of CODE_REG for lazy deopt. @@ -528,7 +516,6 @@ void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) { __ ret(); } - // RAX: exception, must be preserved // RDX: stacktrace, must be preserved void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) { @@ -541,13 +528,11 @@ void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) { __ ret(); } - void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { GenerateDeoptimizationSequence(assembler, kEagerDeopt); __ ret(); } - static void GenerateDispatcherCode(Assembler* assembler, Label* call_target_function) { __ Comment("NoSuchMethodDispatch"); @@ -584,7 +569,6 @@ static void GenerateDispatcherCode(Assembler* assembler, __ ret(); } - void StubCode::GenerateMegamorphicMissStub(Assembler* assembler) { __ EnterStubFrame(); // Load the receiver into RAX. The argument count in the arguments @@ -623,7 +607,6 @@ void StubCode::GenerateMegamorphicMissStub(Assembler* assembler) { __ jmp(RCX); } - // Called for inline allocation of arrays. // Input parameters: // R10 : Array length as Smi. @@ -756,7 +739,6 @@ void StubCode::GenerateAllocateArrayStub(Assembler* assembler) { __ ret(); } - // Called when invoking Dart code from C++ (VM code). // Input parameters: // RSP : points to return address. @@ -888,7 +870,6 @@ void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) { __ ret(); } - // Called for inline allocation of contexts. // Input: // R10: number of context variables. @@ -1018,7 +999,6 @@ void StubCode::GenerateAllocateContextStub(Assembler* assembler) { __ ret(); } - // Helper stub to implement Assembler::StoreIntoObject. // Input parameters: // RDX: Address being stored @@ -1083,7 +1063,6 @@ void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { __ ret(); } - // Called for inline allocation of objects. // Input parameters: // RSP + 8 : type arguments object (only if class is parameterized). @@ -1211,7 +1190,6 @@ void StubCode::GenerateAllocationStubForClass(Assembler* assembler, __ ret(); } - // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function // from the entry code of a dart function after an error in passed argument // name or number is detected. @@ -1248,7 +1226,6 @@ void StubCode::GenerateCallClosureNoSuchMethodStub(Assembler* assembler) { __ int3(); } - // Cannot use function object from ICData as it may be the inlined // function and not the top-scope function. void StubCode::GenerateOptimizedUsageCounterIncrement(Assembler* assembler) { @@ -1270,7 +1247,6 @@ void StubCode::GenerateOptimizedUsageCounterIncrement(Assembler* assembler) { __ incl(FieldAddress(func_reg, Function::usage_counter_offset())); } - // Loads function into 'temp_reg', preserves 'ic_reg'. void StubCode::GenerateUsageCounterIncrement(Assembler* assembler, Register temp_reg) { @@ -1284,7 +1260,6 @@ void StubCode::GenerateUsageCounterIncrement(Assembler* assembler, } } - // Note: RBX must be preserved. // Attempt a quick Smi operation for known operations ('kind'). The ICData // must have been primed with a Smi/Smi check that will be used for counting @@ -1355,7 +1330,6 @@ static void EmitFastSmiOp(Assembler* assembler, __ ret(); } - // Generate inline cache check for 'num_args'. // RBX: Inline cache data object. // TOS(0): return address @@ -1523,7 +1497,6 @@ void StubCode::GenerateNArgsCheckInlineCacheStub( } } - // Use inline cache data array to invoke the target or continue in inline // cache miss handler. Stub for 1-argument check (receiver class). // RBX: Inline cache data object. @@ -1540,7 +1513,6 @@ void StubCode::GenerateOneArgCheckInlineCacheStub(Assembler* assembler) { assembler, 1, kInlineCacheMissHandlerOneArgRuntimeEntry, Token::kILLEGAL); } - void StubCode::GenerateTwoArgsCheckInlineCacheStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, RCX); GenerateNArgsCheckInlineCacheStub(assembler, 2, @@ -1548,28 +1520,24 @@ void StubCode::GenerateTwoArgsCheckInlineCacheStub(Assembler* assembler) { Token::kILLEGAL); } - void StubCode::GenerateSmiAddInlineCacheStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, RCX); GenerateNArgsCheckInlineCacheStub( assembler, 2, kInlineCacheMissHandlerTwoArgsRuntimeEntry, Token::kADD); } - void StubCode::GenerateSmiSubInlineCacheStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, RCX); GenerateNArgsCheckInlineCacheStub( assembler, 2, kInlineCacheMissHandlerTwoArgsRuntimeEntry, Token::kSUB); } - void StubCode::GenerateSmiEqualInlineCacheStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, RCX); GenerateNArgsCheckInlineCacheStub( assembler, 2, kInlineCacheMissHandlerTwoArgsRuntimeEntry, Token::kEQ); } - // Use inline cache data array to invoke the target or continue in inline // cache miss handler. Stub for 1-argument check (receiver class). // RDI: function which counter needs to be incremented. @@ -1589,7 +1557,6 @@ void StubCode::GenerateOneArgOptimizedCheckInlineCacheStub( Token::kILLEGAL, true /* optimized */); } - void StubCode::GenerateTwoArgsOptimizedCheckInlineCacheStub( Assembler* assembler) { GenerateOptimizedUsageCounterIncrement(assembler); @@ -1598,7 +1565,6 @@ void StubCode::GenerateTwoArgsOptimizedCheckInlineCacheStub( Token::kILLEGAL, true /* optimized */); } - // Intermediary stub between a static call and its target. ICData contains // the target function and the call count. // RBX: ICData @@ -1668,21 +1634,18 @@ void StubCode::GenerateZeroArgsUnoptimizedStaticCallStub(Assembler* assembler) { } } - void StubCode::GenerateOneArgUnoptimizedStaticCallStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, RCX); GenerateNArgsCheckInlineCacheStub( assembler, 1, kStaticCallMissHandlerOneArgRuntimeEntry, Token::kILLEGAL); } - void StubCode::GenerateTwoArgsUnoptimizedStaticCallStub(Assembler* assembler) { GenerateUsageCounterIncrement(assembler, RCX); GenerateNArgsCheckInlineCacheStub( assembler, 2, kStaticCallMissHandlerTwoArgsRuntimeEntry, Token::kILLEGAL); } - // Stub for compiling a function and jumping to the compiled code. // RCX: IC-Data (for methods). // R10: Arguments descriptor. @@ -1703,7 +1666,6 @@ void StubCode::GenerateLazyCompileStub(Assembler* assembler) { __ jmp(RAX); } - // RBX: Contains an ICData. // TOS(0): return address (Dart code). void StubCode::GenerateICCallBreakpointStub(Assembler* assembler) { @@ -1719,7 +1681,6 @@ void StubCode::GenerateICCallBreakpointStub(Assembler* assembler) { __ jmp(RAX); // Jump to original stub. } - // TOS(0): return address (Dart code). void StubCode::GenerateRuntimeCallBreakpointStub(Assembler* assembler) { __ EnterStubFrame(); @@ -1732,7 +1693,6 @@ void StubCode::GenerateRuntimeCallBreakpointStub(Assembler* assembler) { __ jmp(RAX); // Jump to original stub. } - // Called only from unoptimized code. void StubCode::GenerateDebugStepCheckStub(Assembler* assembler) { // Check single stepping. @@ -1751,7 +1711,6 @@ void StubCode::GenerateDebugStepCheckStub(Assembler* assembler) { __ jmp(&done_stepping, Assembler::kNearJump); } - // Used to check class and type arguments. Arguments passed on stack: // TOS + 0: return address. // TOS + 1: function type arguments (only if n == 4, can be raw_null). @@ -1843,7 +1802,6 @@ static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) { __ ret(); } - // Used to check class and type arguments. Arguments passed on stack: // TOS + 0: return address. // TOS + 1: raw_null. @@ -1855,7 +1813,6 @@ void StubCode::GenerateSubtype1TestCacheStub(Assembler* assembler) { GenerateSubtypeNTestCacheStub(assembler, 1); } - // Used to check class and type arguments. Arguments passed on stack: // TOS + 0: return address. // TOS + 1: raw_null. @@ -1867,7 +1824,6 @@ void StubCode::GenerateSubtype2TestCacheStub(Assembler* assembler) { GenerateSubtypeNTestCacheStub(assembler, 2); } - // Used to check class and type arguments. Arguments passed on stack: // TOS + 0: return address. // TOS + 1: function type arguments (can be raw_null). @@ -1879,7 +1835,6 @@ void StubCode::GenerateSubtype4TestCacheStub(Assembler* assembler) { GenerateSubtypeNTestCacheStub(assembler, 4); } - // Return the current stack pointer address, used to stack alignment // checks. // TOS + 0: return address @@ -1889,7 +1844,6 @@ void StubCode::GenerateGetCStackPointerStub(Assembler* assembler) { __ ret(); } - // Jump to a frame on the call stack. // TOS + 0: return address // Arg1: program counter @@ -1911,7 +1865,6 @@ void StubCode::GenerateJumpToFrameStub(Assembler* assembler) { __ jmp(CallingConventions::kArg1Reg); // Jump to program counter. } - // Run an exception handler. Execution comes from JumpToFrame stub. // // The arguments are stored in the Thread object. @@ -1935,7 +1888,6 @@ void StubCode::GenerateRunExceptionHandlerStub(Assembler* assembler) { __ jmp(CallingConventions::kArg1Reg); // Jump to continuation point. } - // Deoptimize a frame on the call stack before rewinding. // The arguments are stored in the Thread object. // No result. @@ -1954,7 +1906,6 @@ void StubCode::GenerateDeoptForRewindStub(Assembler* assembler) { __ int3(); } - // Calls to the runtime to optimize the given function. // RDI: function to be reoptimized. // R10: argument descriptor (preserved). @@ -1974,7 +1925,6 @@ void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { __ int3(); } - // Does identical check (object references are equal or not equal) with special // checks for boxed numbers. // Left and right are pushed on stack. @@ -2031,7 +1981,6 @@ static void GenerateIdenticalWithNumberCheckStub(Assembler* assembler, __ Bind(&done); } - // Called only from unoptimized code. All relevant registers have been saved. // TOS + 0: return address // TOS + 1: right argument. @@ -2067,7 +2016,6 @@ void StubCode::GenerateUnoptimizedIdenticalWithNumberCheckStub( } } - // Called from optimized code only. // TOS + 0: return address // TOS + 1: right argument. @@ -2084,7 +2032,6 @@ void StubCode::GenerateOptimizedIdenticalWithNumberCheckStub( __ ret(); } - // Called from megamorphic calls. // RDI: receiver // RBX: MegamorphicCache (preserved) @@ -2155,7 +2102,6 @@ void StubCode::GenerateMegamorphicCallStub(Assembler* assembler) { __ jmp(&cid_loaded); } - // Called from switchable IC calls. // RDI: receiver // RBX: ICData (preserved) @@ -2198,7 +2144,6 @@ void StubCode::GenerateICCallThroughFunctionStub(Assembler* assembler) { __ jmp(RCX); } - void StubCode::GenerateICCallThroughCodeStub(Assembler* assembler) { Label loop, found, miss; __ movq(R13, FieldAddress(RBX, ICData::ic_data_offset())); @@ -2235,7 +2180,6 @@ void StubCode::GenerateICCallThroughCodeStub(Assembler* assembler) { __ jmp(RCX); } - // RDI: receiver // RBX: UnlinkedCall void StubCode::GenerateUnlinkedCallStub(Assembler* assembler) { @@ -2258,7 +2202,6 @@ void StubCode::GenerateUnlinkedCallStub(Assembler* assembler) { __ jmp(RCX); } - // Called from switchable IC calls. // RDI: receiver // RBX: SingleTargetCache @@ -2295,7 +2238,6 @@ void StubCode::GenerateSingleTargetCallStub(Assembler* assembler) { __ jmp(RCX); } - // Called from the monomorphic checked entry. // RDI: receiver void StubCode::GenerateMonomorphicMissStub(Assembler* assembler) { @@ -2317,12 +2259,10 @@ void StubCode::GenerateMonomorphicMissStub(Assembler* assembler) { __ jmp(RCX); } - void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { __ int3(); } - void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) { __ int3(); } diff --git a/runtime/vm/stub_code_x64_test.cc b/runtime/vm/stub_code_x64_test.cc index d217c32cf38..5a74fbc1733 100644 --- a/runtime/vm/stub_code_x64_test.cc +++ b/runtime/vm/stub_code_x64_test.cc @@ -5,8 +5,8 @@ #include "vm/globals.h" #if defined(TARGET_ARCH_X64) -#include "vm/isolate.h" #include "vm/dart_entry.h" +#include "vm/isolate.h" #include "vm/native_entry.h" #include "vm/native_entry_test.h" #include "vm/object.h" @@ -34,7 +34,6 @@ static Function* CreateFunction(const char* name) { return &function; } - // Test calls to stub code which calls into the runtime. static void GenerateCallToCallRuntimeStub(Assembler* assembler, int length) { const int argc = 2; @@ -51,7 +50,6 @@ static void GenerateCallToCallRuntimeStub(Assembler* assembler, int length) { __ ret(); } - TEST_CASE(CallRuntimeStubCode) { extern const Function& RegisterFakeFunction(const char* name, const Code& code); @@ -67,7 +65,6 @@ TEST_CASE(CallRuntimeStubCode) { EXPECT_EQ(length, result.Length()); } - // Test calls to stub code which calls into a leaf runtime entry. static void GenerateCallToCallLeafRuntimeStub(Assembler* assembler, const char* value1, @@ -86,7 +83,6 @@ static void GenerateCallToCallLeafRuntimeStub(Assembler* assembler, __ ret(); // Return value is in RAX. } - TEST_CASE(CallLeafRuntimeStubCode) { extern const Function& RegisterFakeFunction(const char* name, const Code& code); diff --git a/runtime/vm/symbols.cc b/runtime/vm/symbols.cc index 38d5520ffa8..ad8a13f4a10 100644 --- a/runtime/vm/symbols.cc +++ b/runtime/vm/symbols.cc @@ -38,17 +38,14 @@ RawString* StringFrom(const uint8_t* data, intptr_t len, Heap::Space space) { return String::FromLatin1(data, len, space); } - RawString* StringFrom(const uint16_t* data, intptr_t len, Heap::Space space) { return String::FromUTF16(data, len, space); } - RawString* StringFrom(const int32_t* data, intptr_t len, Heap::Space space) { return String::FromUTF32(data, len, space); } - template class CharArray { public: @@ -79,7 +76,6 @@ typedef CharArray Latin1Array; typedef CharArray UTF16Array; typedef CharArray UTF32Array; - class StringSlice { public: StringSlice(const String& str, intptr_t begin_index, intptr_t length) @@ -104,7 +100,6 @@ class StringSlice { intptr_t hash_; }; - RawString* StringSlice::ToSymbol() const { if (is_all() && str_.IsOld()) { str_.SetCanonical(); @@ -118,7 +113,6 @@ RawString* StringSlice::ToSymbol() const { } } - class ConcatString { public: ConcatString(const String& str1, const String& str2) @@ -139,7 +133,6 @@ class ConcatString { intptr_t hash_; }; - RawString* ConcatString::ToSymbol() const { String& result = String::Handle(String::Concat(str1_, str2_, Heap::kOld)); result.SetCanonical(); @@ -147,7 +140,6 @@ RawString* ConcatString::ToSymbol() const { return result.raw(); } - class SymbolTraits { public: static const char* Name() { return "SymbolTraits"; } @@ -198,13 +190,11 @@ class SymbolTraits { }; typedef UnorderedHashSet SymbolTable; - const char* Symbols::Name(SymbolId symbol) { ASSERT((symbol > kIllegal) && (symbol < kNullCharId)); return names[symbol]; } - const String& Symbols::Token(Token::Kind token) { const int tok_index = token; ASSERT((0 <= tok_index) && (tok_index < Token::kNumTokens)); @@ -214,7 +204,6 @@ const String& Symbols::Token(Token::Kind token) { return *symbol_handles_[token_id]; } - void Symbols::InitOnce(Isolate* vm_isolate) { // Should only be run by the vm isolate. ASSERT(Isolate::Current() == Dart::vm_isolate()); @@ -261,7 +250,6 @@ void Symbols::InitOnce(Isolate* vm_isolate) { vm_isolate->object_store()->set_symbol_table(table.Release()); } - void Symbols::InitOnceFromSnapshot(Isolate* vm_isolate) { // Should only be run by the vm isolate. ASSERT(Isolate::Current() == Dart::vm_isolate()); @@ -302,7 +290,6 @@ void Symbols::InitOnceFromSnapshot(Isolate* vm_isolate) { vm_isolate->object_store()->set_symbol_table(table.Release()); } - void Symbols::SetupSymbolTable(Isolate* isolate) { ASSERT(isolate != NULL); @@ -315,7 +302,6 @@ void Symbols::SetupSymbolTable(Isolate* isolate) { isolate->object_store()->set_symbol_table(array); } - RawArray* Symbols::UnifiedSymbolTable() { Thread* thread = Thread::Current(); Isolate* isolate = thread->isolate(); @@ -353,7 +339,6 @@ RawArray* Symbols::UnifiedSymbolTable() { return unified_table.Release().raw(); } - void Symbols::Compact(Isolate* isolate) { ASSERT(isolate != Dart::vm_isolate()); Zone* zone = Thread::Current()->zone(); @@ -397,7 +382,6 @@ void Symbols::Compact(Isolate* isolate) { isolate->object_store()->set_symbol_table(table.Release()); } - void Symbols::GetStats(Isolate* isolate, intptr_t* size, intptr_t* capacity) { ASSERT(isolate != NULL); SymbolTable table(isolate->object_store()->symbol_table()); @@ -406,14 +390,12 @@ void Symbols::GetStats(Isolate* isolate, intptr_t* size, intptr_t* capacity) { table.Release(); } - RawString* Symbols::New(Thread* thread, const char* cstr, intptr_t len) { ASSERT((cstr != NULL) && (len >= 0)); const uint8_t* utf8_array = reinterpret_cast(cstr); return Symbols::FromUTF8(thread, utf8_array, len); } - RawString* Symbols::FromUTF8(Thread* thread, const uint8_t* utf8_array, intptr_t array_len) { @@ -435,28 +417,24 @@ RawString* Symbols::FromUTF8(Thread* thread, return FromUTF16(thread, characters, len); } - RawString* Symbols::FromLatin1(Thread* thread, const uint8_t* latin1_array, intptr_t len) { return NewSymbol(thread, Latin1Array(latin1_array, len)); } - RawString* Symbols::FromUTF16(Thread* thread, const uint16_t* utf16_array, intptr_t len) { return NewSymbol(thread, UTF16Array(utf16_array, len)); } - RawString* Symbols::FromUTF32(Thread* thread, const int32_t* utf32_array, intptr_t len) { return NewSymbol(thread, UTF32Array(utf32_array, len)); } - RawString* Symbols::FromConcat(Thread* thread, const String& str1, const String& str2) { @@ -469,22 +447,18 @@ RawString* Symbols::FromConcat(Thread* thread, } } - RawString* Symbols::FromGet(Thread* thread, const String& str) { return FromConcat(thread, GetterPrefix(), str); } - RawString* Symbols::FromSet(Thread* thread, const String& str) { return FromConcat(thread, SetterPrefix(), str); } - RawString* Symbols::FromDot(Thread* thread, const String& str) { return FromConcat(thread, str, Dot()); } - // TODO(srdjan): If this becomes performance critical code, consider looking // up symbol from hash of pieces instead of concatenating them first into // a string. @@ -560,7 +534,6 @@ RawString* Symbols::FromConcatAll( } } - // StringType can be StringSlice, ConcatString, or {Latin1,UTF16,UTF32}Array. template RawString* Symbols::NewSymbol(Thread* thread, const StringType& str) { @@ -591,7 +564,6 @@ RawString* Symbols::NewSymbol(Thread* thread, const StringType& str) { return symbol.raw(); } - template RawString* Symbols::Lookup(Thread* thread, const StringType& str) { REUSABLE_OBJECT_HANDLESCOPE(thread); @@ -621,7 +593,6 @@ RawString* Symbols::Lookup(Thread* thread, const StringType& str) { return symbol.raw(); } - RawString* Symbols::LookupFromConcat(Thread* thread, const String& str1, const String& str2) { @@ -634,22 +605,18 @@ RawString* Symbols::LookupFromConcat(Thread* thread, } } - RawString* Symbols::LookupFromGet(Thread* thread, const String& str) { return LookupFromConcat(thread, GetterPrefix(), str); } - RawString* Symbols::LookupFromSet(Thread* thread, const String& str) { return LookupFromConcat(thread, SetterPrefix(), str); } - RawString* Symbols::LookupFromDot(Thread* thread, const String& str) { return LookupFromConcat(thread, str, Dot()); } - RawString* Symbols::New(Thread* thread, const String& str) { if (str.IsSymbol()) { return str.raw(); @@ -657,7 +624,6 @@ RawString* Symbols::New(Thread* thread, const String& str) { return New(thread, str, 0, str.Length()); } - RawString* Symbols::New(Thread* thread, const String& str, intptr_t begin_index, @@ -665,7 +631,6 @@ RawString* Symbols::New(Thread* thread, return NewSymbol(thread, StringSlice(str, begin_index, len)); } - RawString* Symbols::NewFormatted(Thread* thread, const char* format, ...) { va_list args; va_start(args, format); @@ -675,7 +640,6 @@ RawString* Symbols::NewFormatted(Thread* thread, const char* format, ...) { return result; } - RawString* Symbols::NewFormattedV(Thread* thread, const char* format, va_list args) { @@ -691,7 +655,6 @@ RawString* Symbols::NewFormattedV(Thread* thread, return Symbols::New(thread, buffer); } - RawString* Symbols::FromCharCode(Thread* thread, int32_t char_code) { if (char_code > kMaxOneCharCodeSymbol) { return FromUTF32(thread, &char_code, 1); @@ -699,7 +662,6 @@ RawString* Symbols::FromCharCode(Thread* thread, int32_t char_code) { return predefined_[char_code]; } - void Symbols::DumpStats(Isolate* isolate) { intptr_t size = -1; intptr_t capacity = -1; @@ -715,7 +677,6 @@ void Symbols::DumpStats(Isolate* isolate) { // in DEBUG mode. } - intptr_t Symbols::LookupPredefinedSymbol(RawObject* obj) { for (intptr_t i = 1; i < Symbols::kMaxPredefinedId; i++) { if (symbol_handles_[i]->raw() == obj) { @@ -725,7 +686,6 @@ intptr_t Symbols::LookupPredefinedSymbol(RawObject* obj) { return kInvalidIndex; } - RawObject* Symbols::GetPredefinedSymbol(intptr_t object_id) { ASSERT(IsPredefinedSymbolId(object_id)); intptr_t i = (object_id - kMaxPredefinedObjectIds); diff --git a/runtime/vm/symbols.h b/runtime/vm/symbols.h index 9d0e0ae898a..8c0ebbb2960 100644 --- a/runtime/vm/symbols.h +++ b/runtime/vm/symbols.h @@ -439,7 +439,6 @@ class ObjectPointerVisitor; V(_AsyncStarListenHelper, "_asyncStarListenHelper") \ V(GrowRegExpStack, "_growRegExpStack") - // Contains a list of frequently used strings in a canonicalized form. This // list is kept in the vm_isolate in order to share the copy across isolates // without having to maintain copies in each isolate. diff --git a/runtime/vm/tags.cc b/runtime/vm/tags.cc index 30e284c96c0..f1cd1e0901e 100644 --- a/runtime/vm/tags.cc +++ b/runtime/vm/tags.cc @@ -7,8 +7,8 @@ #include "vm/isolate.h" #include "vm/json_stream.h" #include "vm/native_entry.h" -#include "vm/runtime_entry.h" #include "vm/object.h" +#include "vm/runtime_entry.h" namespace dart { @@ -31,26 +31,21 @@ const char* VMTag::TagName(uword tag) { return entry.name; } - bool VMTag::IsNativeEntryTag(uword tag) { return (tag > kLastTagId) && !IsRuntimeEntryTag(tag); } - bool VMTag::IsDartTag(uword id) { return id == kDartTagId; } - bool VMTag::IsExitFrameTag(uword id) { return (id != 0) && !IsDartTag(id) && (id != kIdleTagId) && (id != kVMTagId) && (id != kEmbedderTagId); } - static RuntimeEntry* runtime_entry_list = NULL; - bool VMTag::IsRuntimeEntryTag(uword id) { const RuntimeEntry* current = runtime_entry_list; while (current != NULL) { @@ -62,7 +57,6 @@ bool VMTag::IsRuntimeEntryTag(uword id) { return false; } - const char* VMTag::RuntimeEntryTagName(uword id) { const RuntimeEntry* current = runtime_entry_list; while (current != NULL) { @@ -74,14 +68,12 @@ const char* VMTag::RuntimeEntryTagName(uword id) { return NULL; } - void VMTag::RegisterRuntimeEntry(RuntimeEntry* runtime_entry) { ASSERT(runtime_entry != NULL); runtime_entry->set_next(runtime_entry_list); runtime_entry_list = runtime_entry; } - VMTag::TagEntry VMTag::entries_[] = { { "InvalidTag", kInvalidTagId, @@ -92,7 +84,6 @@ VMTag::TagEntry VMTag::entries_[] = { {"kNumVMTags", kNumVMTags}, }; - VMTagScope::VMTagScope(Thread* thread, uword tag, bool conditional_set) : StackResource(thread) { ASSERT(isolate() != NULL); @@ -102,20 +93,17 @@ VMTagScope::VMTagScope(Thread* thread, uword tag, bool conditional_set) } } - VMTagScope::~VMTagScope() { ASSERT(isolate() != NULL); thread()->set_vm_tag(previous_tag_); } - VMTagCounters::VMTagCounters() { for (intptr_t i = 0; i < VMTag::kNumVMTags; i++) { counters_[i] = 0; } } - void VMTagCounters::Increment(uword tag) { if (VMTag::IsRuntimeEntryTag(tag)) { counters_[VMTag::kRuntimeTagId]++; @@ -130,14 +118,12 @@ void VMTagCounters::Increment(uword tag) { counters_[tag]++; } - int64_t VMTagCounters::count(uword tag) { ASSERT(tag != VMTag::kInvalidTagId); ASSERT(tag < VMTag::kNumVMTags); return counters_[tag]; } - #ifndef PRODUCT void VMTagCounters::PrintToJSONObject(JSONObject* obj) { if (!FLAG_support_service) { @@ -158,7 +144,6 @@ void VMTagCounters::PrintToJSONObject(JSONObject* obj) { } #endif // !PRODUCT - const char* UserTags::TagName(uword tag_id) { ASSERT(tag_id >= kUserTagIdOffset); ASSERT(tag_id < kUserTagIdOffset + kMaxUserTags); @@ -169,5 +154,4 @@ const char* UserTags::TagName(uword tag_id) { return label.ToCString(); } - } // namespace dart diff --git a/runtime/vm/tags.h b/runtime/vm/tags.h index 66ab39eee8e..42320c3f72f 100644 --- a/runtime/vm/tags.h +++ b/runtime/vm/tags.h @@ -76,7 +76,6 @@ class VMTag : public AllStatic { static TagEntry entries_[]; }; - class VMTagScope : StackResource { public: VMTagScope(Thread* thread, uword tag, bool conditional_set = true); @@ -89,7 +88,6 @@ class VMTagScope : StackResource { DISALLOW_IMPLICIT_CONSTRUCTORS(VMTagScope); }; - class VMTagCounters { public: VMTagCounters(); @@ -106,7 +104,6 @@ class VMTagCounters { int64_t counters_[VMTag::kNumVMTags]; }; - class UserTags : public AllStatic { public: // UserTag id space: [kUserTagIdOffset, kUserTagIdOffset + kMaxUserTags). @@ -120,7 +117,6 @@ class UserTags : public AllStatic { } }; - } // namespace dart #endif // RUNTIME_VM_TAGS_H_ diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc index 84ce5ad0d8c..d451975dcba 100644 --- a/runtime/vm/thread.cc +++ b/runtime/vm/thread.cc @@ -26,11 +26,9 @@ namespace dart { - DECLARE_FLAG(bool, trace_service); DECLARE_FLAG(bool, trace_service_verbose); - Thread::~Thread() { // We should cleanly exit any isolate before destruction. ASSERT(isolate_ == NULL); @@ -58,7 +56,6 @@ Thread::~Thread() { #define REUSABLE_HANDLE_INITIALIZERS(object) object##_handle_(NULL), - Thread::Thread(Isolate* isolate) : BaseThread(false), stack_limit_(0), @@ -148,7 +145,6 @@ Thread::Thread(Isolate* isolate) } } - static const struct ALIGN16 { uint64_t a; uint64_t b; @@ -187,7 +183,6 @@ static const struct ALIGN16 { uint32_t d; } float_zerow_constant = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000}; - void Thread::InitVMConstants() { #define ASSERT_VM_HEAP(type_name, member_name, init_expr, default_init_value) \ ASSERT((init_expr)->IsOldObject()); @@ -219,7 +214,6 @@ void Thread::InitVMConstants() { #undef REUSABLE_HANDLE_ALLOCATION } - #ifndef PRODUCT // Collect information about each individual zone associated with this thread. void Thread::PrintJSON(JSONStream* stream) const { @@ -233,7 +227,6 @@ void Thread::PrintJSON(JSONStream* stream) const { } #endif - RawGrowableObjectArray* Thread::pending_functions() { if (pending_functions_ == GrowableObjectArray::null()) { pending_functions_ = GrowableObjectArray::New(Heap::kOld); @@ -241,39 +234,32 @@ RawGrowableObjectArray* Thread::pending_functions() { return pending_functions_; } - void Thread::clear_pending_functions() { pending_functions_ = GrowableObjectArray::null(); } - void Thread::set_active_exception(const Object& value) { ASSERT(!value.IsNull()); active_exception_ = value.raw(); } - void Thread::set_active_stacktrace(const Object& value) { active_stacktrace_ = value.raw(); } - RawError* Thread::sticky_error() const { return sticky_error_; } - void Thread::set_sticky_error(const Error& value) { ASSERT(!value.IsNull()); sticky_error_ = value.raw(); } - void Thread::clear_sticky_error() { sticky_error_ = Error::null(); } - RawError* Thread::get_and_clear_sticky_error() { NoSafepointScope nss; RawError* return_value = sticky_error_; @@ -281,7 +267,6 @@ RawError* Thread::get_and_clear_sticky_error() { return return_value; } - const char* Thread::TaskKindToCString(TaskKind kind) { switch (kind) { case kUnknownTask: @@ -300,28 +285,23 @@ const char* Thread::TaskKindToCString(TaskKind kind) { } } - RawStackTrace* Thread::async_stack_trace() const { return async_stack_trace_; } - void Thread::set_async_stack_trace(const StackTrace& stack_trace) { ASSERT(!stack_trace.IsNull()); async_stack_trace_ = stack_trace.raw(); } - void Thread::set_raw_async_stack_trace(RawStackTrace* raw_stack_trace) { async_stack_trace_ = raw_stack_trace; } - void Thread::clear_async_stack_trace() { async_stack_trace_ = StackTrace::null(); } - bool Thread::EnterIsolate(Isolate* isolate) { const bool kIsMutatorThread = true; Thread* thread = isolate->ScheduleThread(kIsMutatorThread); @@ -334,7 +314,6 @@ bool Thread::EnterIsolate(Isolate* isolate) { return false; } - void Thread::ExitIsolate() { Thread* thread = Thread::Current(); ASSERT(thread != NULL && thread->IsMutatorThread()); @@ -355,7 +334,6 @@ void Thread::ExitIsolate() { isolate->UnscheduleThread(thread, kIsMutatorThread); } - bool Thread::EnterIsolateAsHelper(Isolate* isolate, TaskKind kind, bool bypass_safepoint) { @@ -377,7 +355,6 @@ bool Thread::EnterIsolateAsHelper(Isolate* isolate, return false; } - void Thread::ExitIsolateAsHelper(bool bypass_safepoint) { Thread* thread = Thread::Current(); ASSERT(thread != NULL); @@ -393,7 +370,6 @@ void Thread::ExitIsolateAsHelper(bool bypass_safepoint) { isolate->UnscheduleThread(thread, kIsNotMutatorThread, bypass_safepoint); } - void Thread::PrepareForGC() { ASSERT(IsAtSafepoint()); // Prevent scheduling another GC by ignoring the threshold. @@ -405,7 +381,6 @@ void Thread::PrepareForGC() { store_buffer_block_ = isolate()->store_buffer()->PopEmptyBlock(); } - void Thread::SetStackLimitFromStackBase(uword stack_base) { // Set stack limit. #if !defined(TARGET_ARCH_DBC) @@ -422,7 +397,6 @@ void Thread::SetStackLimitFromStackBase(uword stack_base) { #endif // !defined(TARGET_ARCH_DBC) } - void Thread::SetStackLimit(uword limit) { // The thread setting the stack limit is not necessarily the thread which // the stack limit is being set on. @@ -434,12 +408,10 @@ void Thread::SetStackLimit(uword limit) { saved_stack_limit_ = limit; } - void Thread::ClearStackLimit() { SetStackLimit(~static_cast(0)); } - /* static */ uword Thread::GetCurrentStackPointer() { #if !defined(TARGET_ARCH_DBC) @@ -466,13 +438,11 @@ uword Thread::GetCurrentStackPointer() { #endif } - void Thread::ScheduleInterrupts(uword interrupt_bits) { MonitorLocker ml(thread_lock_); ScheduleInterruptsLocked(interrupt_bits); } - void Thread::ScheduleInterruptsLocked(uword interrupt_bits) { ASSERT(thread_lock_->IsOwnedByCurrentThread()); ASSERT((interrupt_bits & ~kInterruptsMask) == 0); // Must fit in mask. @@ -493,7 +463,6 @@ void Thread::ScheduleInterruptsLocked(uword interrupt_bits) { stack_limit_ |= interrupt_bits; } - uword Thread::GetAndClearInterrupts() { MonitorLocker ml(thread_lock_); if (stack_limit_ == saved_stack_limit_) { @@ -504,7 +473,6 @@ uword Thread::GetAndClearInterrupts() { return interrupt_bits; } - bool Thread::ZoneIsOwnedByThread(Zone* zone) const { ASSERT(zone != NULL); Zone* current = zone_; @@ -517,7 +485,6 @@ bool Thread::ZoneIsOwnedByThread(Zone* zone) const { return false; } - void Thread::DeferOOBMessageInterrupts() { MonitorLocker ml(thread_lock_); defer_oob_messages_count_++; @@ -546,7 +513,6 @@ void Thread::DeferOOBMessageInterrupts() { } } - void Thread::RestoreOOBMessageInterrupts() { MonitorLocker ml(thread_lock_); defer_oob_messages_count_--; @@ -569,7 +535,6 @@ void Thread::RestoreOOBMessageInterrupts() { } } - RawError* Thread::HandleInterrupts() { uword interrupt_bits = GetAndClearInterrupts(); if ((interrupt_bits & kVMInterrupt) != 0) { @@ -602,20 +567,17 @@ RawError* Thread::HandleInterrupts() { return Error::null(); } - uword Thread::GetAndClearStackOverflowFlags() { uword stack_overflow_flags = stack_overflow_flags_; stack_overflow_flags_ = 0; return stack_overflow_flags; } - void Thread::StoreBufferBlockProcess(StoreBuffer::ThresholdPolicy policy) { StoreBufferRelease(policy); StoreBufferAcquire(); } - void Thread::StoreBufferAddObject(RawObject* obj) { store_buffer_block_->Push(obj); if (store_buffer_block_->IsFull()) { @@ -623,7 +585,6 @@ void Thread::StoreBufferAddObject(RawObject* obj) { } } - void Thread::StoreBufferAddObjectGC(RawObject* obj) { store_buffer_block_->Push(obj); if (store_buffer_block_->IsFull()) { @@ -631,24 +592,20 @@ void Thread::StoreBufferAddObjectGC(RawObject* obj) { } } - void Thread::StoreBufferRelease(StoreBuffer::ThresholdPolicy policy) { StoreBufferBlock* block = store_buffer_block_; store_buffer_block_ = NULL; isolate()->store_buffer()->PushBlock(block, policy); } - void Thread::StoreBufferAcquire() { store_buffer_block_ = isolate()->store_buffer()->PopNonFullBlock(); } - bool Thread::IsMutatorThread() const { return ((isolate_ != NULL) && (isolate_->mutator_thread() == this)); } - bool Thread::CanCollectGarbage() const { // We grow the heap instead of triggering a garbage collection when a // thread is at a safepoint in the following situations : @@ -659,17 +616,14 @@ bool Thread::CanCollectGarbage() const { return !IsAtSafepoint(); } - bool Thread::IsExecutingDartCode() const { return (top_exit_frame_info() == 0) && (vm_tag() == VMTag::kDartTagId); } - bool Thread::HasExitedDartCode() const { return (top_exit_frame_info() != 0) && (vm_tag() != VMTag::kDartTagId); } - template C* Thread::AllocateReusableHandle() { C* handle = reinterpret_cast(reusable_handles_.AllocateScopedHandle()); @@ -677,14 +631,12 @@ C* Thread::AllocateReusableHandle() { return handle; } - void Thread::ClearReusableHandles() { #define CLEAR_REUSABLE_HANDLE(object) *object##_handle_ = object::null(); REUSABLE_HANDLE_LIST(CLEAR_REUSABLE_HANDLE) #undef CLEAR_REUSABLE_HANDLE } - void Thread::VisitObjectPointers(ObjectPointerVisitor* visitor, bool validate_frames) { ASSERT(visitor != NULL); @@ -736,7 +688,6 @@ void Thread::VisitObjectPointers(ObjectPointerVisitor* visitor, } } - bool Thread::CanLoadFromThread(const Object& object) { #define CHECK_OBJECT(type_name, member_name, expr, default_init_value) \ if (object.raw() == expr) return true; @@ -745,7 +696,6 @@ bool Thread::CanLoadFromThread(const Object& object) { return false; } - intptr_t Thread::OffsetFromThread(const Object& object) { #define COMPUTE_OFFSET(type_name, member_name, expr, default_init_value) \ ASSERT((expr)->IsVMHeapObject()); \ @@ -756,7 +706,6 @@ intptr_t Thread::OffsetFromThread(const Object& object) { return -1; } - bool Thread::ObjectAtOffset(intptr_t offset, Object* object) { if (Isolate::Current() == Dart::vm_isolate()) { // --disassemble-stubs runs before all the references through @@ -774,7 +723,6 @@ bool Thread::ObjectAtOffset(intptr_t offset, Object* object) { return false; } - intptr_t Thread::OffsetFromThread(const RuntimeEntry* runtime_entry) { #define COMPUTE_OFFSET(name) \ if (runtime_entry->function() == k##name##RuntimeEntry.function()) { \ @@ -794,13 +742,11 @@ intptr_t Thread::OffsetFromThread(const RuntimeEntry* runtime_entry) { return -1; } - bool Thread::IsValidHandle(Dart_Handle object) const { return IsValidLocalHandle(object) || IsValidZoneHandle(object) || IsValidScopedHandle(object); } - bool Thread::IsValidLocalHandle(Dart_Handle object) const { ApiLocalScope* scope = api_top_scope_; while (scope != NULL) { @@ -812,7 +758,6 @@ bool Thread::IsValidLocalHandle(Dart_Handle object) const { return false; } - intptr_t Thread::CountLocalHandles() const { intptr_t total = 0; ApiLocalScope* scope = api_top_scope_; @@ -823,7 +768,6 @@ intptr_t Thread::CountLocalHandles() const { return total; } - bool Thread::IsValidZoneHandle(Dart_Handle object) const { Zone* zone = zone_; while (zone != NULL) { @@ -835,7 +779,6 @@ bool Thread::IsValidZoneHandle(Dart_Handle object) const { return false; } - intptr_t Thread::CountZoneHandles() const { intptr_t count = 0; Zone* zone = zone_; @@ -847,7 +790,6 @@ intptr_t Thread::CountZoneHandles() const { return count; } - bool Thread::IsValidScopedHandle(Dart_Handle object) const { Zone* zone = zone_; while (zone != NULL) { @@ -859,7 +801,6 @@ bool Thread::IsValidScopedHandle(Dart_Handle object) const { return false; } - intptr_t Thread::CountScopedHandles() const { intptr_t count = 0; Zone* zone = zone_; @@ -871,7 +812,6 @@ intptr_t Thread::CountScopedHandles() const { return count; } - int Thread::ZoneSizeInBytes() const { int total = 0; ApiLocalScope* scope = api_top_scope_; @@ -882,7 +822,6 @@ int Thread::ZoneSizeInBytes() const { return total; } - void Thread::UnwindScopes(uword stack_marker) { // Unwind all scopes using the same stack_marker, i.e. all scopes allocated // under the same top_exit_frame_info. @@ -895,22 +834,18 @@ void Thread::UnwindScopes(uword stack_marker) { } } - void Thread::EnterSafepointUsingLock() { isolate()->safepoint_handler()->EnterSafepointUsingLock(this); } - void Thread::ExitSafepointUsingLock() { isolate()->safepoint_handler()->ExitSafepointUsingLock(this); } - void Thread::BlockForSafepoint() { isolate()->safepoint_handler()->BlockForSafepoint(this); } - DisableThreadInterruptsScope::DisableThreadInterruptsScope(Thread* thread) : StackResource(thread) { if (thread != NULL) { @@ -920,7 +855,6 @@ DisableThreadInterruptsScope::DisableThreadInterruptsScope(Thread* thread) } } - DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { if (thread() != NULL) { OSThread* os_thread = thread()->os_thread(); diff --git a/runtime/vm/thread.h b/runtime/vm/thread.h index 3a226e4ee58..7a98f4542b6 100644 --- a/runtime/vm/thread.h +++ b/runtime/vm/thread.h @@ -12,8 +12,8 @@ #include "vm/globals.h" #include "vm/handles.h" #include "vm/os_thread.h" -#include "vm/store_buffer.h" #include "vm/runtime_entry_list.h" +#include "vm/store_buffer.h" namespace dart { class AbstractType; @@ -74,7 +74,6 @@ class Zone; V(TypeArguments) \ V(TypeParameter) - #if defined(TARGET_ARCH_DBC) #define CACHED_VM_STUBS_LIST(V) #else @@ -808,13 +807,11 @@ class Thread : public BaseThread { DISALLOW_COPY_AND_ASSIGN(Thread); }; - #if defined(HOST_OS_WINDOWS) // Clears the state of the current thread and frees the allocation. void WindowsThreadCleanUp(); #endif - // Disable thread interrupts. class DisableThreadInterruptsScope : public StackResource { public: diff --git a/runtime/vm/thread_barrier.h b/runtime/vm/thread_barrier.h index 020fcf68e55..0b422f7b3c9 100644 --- a/runtime/vm/thread_barrier.h +++ b/runtime/vm/thread_barrier.h @@ -6,8 +6,8 @@ #define RUNTIME_VM_THREAD_BARRIER_H_ #include "vm/globals.h" -#include "vm/os_thread.h" #include "vm/lockers.h" +#include "vm/os_thread.h" namespace dart { diff --git a/runtime/vm/thread_barrier_test.cc b/runtime/vm/thread_barrier_test.cc index d907df112ba..42bc53b67e1 100644 --- a/runtime/vm/thread_barrier_test.cc +++ b/runtime/vm/thread_barrier_test.cc @@ -2,9 +2,9 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +#include "vm/thread_barrier.h" #include "platform/assert.h" #include "vm/random.h" -#include "vm/thread_barrier.h" #include "vm/thread_pool.h" #include "vm/unit_test.h" @@ -36,7 +36,6 @@ class FuzzTask : public ThreadPool::Task { Random rng_; }; - VM_UNIT_TEST_CASE(ThreadBarrier) { static const intptr_t kNumTasks = 5; static const intptr_t kNumRounds = 500; diff --git a/runtime/vm/thread_interrupter.cc b/runtime/vm/thread_interrupter.cc index 0372f68bcf3..50276a2a5f3 100644 --- a/runtime/vm/thread_interrupter.cc +++ b/runtime/vm/thread_interrupter.cc @@ -59,7 +59,6 @@ Monitor* ThreadInterrupter::monitor_ = NULL; intptr_t ThreadInterrupter::interrupt_period_ = 1000; intptr_t ThreadInterrupter::current_wait_time_ = Monitor::kNoTimeout; - void ThreadInterrupter::InitOnce() { ASSERT(!initialized_); monitor_ = new Monitor(); @@ -67,7 +66,6 @@ void ThreadInterrupter::InitOnce() { initialized_ = true; } - void ThreadInterrupter::Startup() { ASSERT(initialized_); if (IsDebuggerAttached()) { @@ -96,7 +94,6 @@ void ThreadInterrupter::Startup() { } } - void ThreadInterrupter::Shutdown() { { MonitorLocker shutdown_ml(monitor_); @@ -123,7 +120,6 @@ void ThreadInterrupter::Shutdown() { } } - // Delay between interrupts. void ThreadInterrupter::SetInterruptPeriod(intptr_t period) { if (shutdown_) { @@ -134,7 +130,6 @@ void ThreadInterrupter::SetInterruptPeriod(intptr_t period) { interrupt_period_ = period; } - void ThreadInterrupter::WakeUp() { if (!initialized_) { // Early call. @@ -153,7 +148,6 @@ void ThreadInterrupter::WakeUp() { } } - void ThreadInterrupter::ThreadMain(uword parameters) { ASSERT(initialized_); InstallSignalHandler(); diff --git a/runtime/vm/thread_interrupter.h b/runtime/vm/thread_interrupter.h index a2e54ad7e40..204f824374d 100644 --- a/runtime/vm/thread_interrupter.h +++ b/runtime/vm/thread_interrupter.h @@ -6,8 +6,8 @@ #define RUNTIME_VM_THREAD_INTERRUPTER_H_ #include "vm/allocation.h" -#include "vm/signal_handler.h" #include "vm/os_thread.h" +#include "vm/signal_handler.h" #include "vm/thread.h" namespace dart { @@ -20,7 +20,6 @@ struct InterruptedThreadState { uintptr_t lr; }; - class ThreadInterrupter : public AllStatic { public: static void InitOnce(); diff --git a/runtime/vm/thread_interrupter_android.cc b/runtime/vm/thread_interrupter_android.cc index e4c38176387..598784610b5 100644 --- a/runtime/vm/thread_interrupter_android.cc +++ b/runtime/vm/thread_interrupter_android.cc @@ -5,8 +5,8 @@ #include "platform/globals.h" #if defined(HOST_OS_ANDROID) -#include // NOLINT #include // NOLINT +#include // NOLINT #include "vm/flags.h" #include "vm/os.h" @@ -46,12 +46,10 @@ class ThreadInterrupterAndroid : public AllStatic { } }; - bool ThreadInterrupter::IsDebuggerAttached() { return false; } - void ThreadInterrupter::InterruptThread(OSThread* thread) { if (FLAG_trace_thread_interrupter) { OS::PrintErr("ThreadInterrupter interrupting %p\n", @@ -61,13 +59,11 @@ void ThreadInterrupter::InterruptThread(OSThread* thread) { ASSERT((result == 0) || (result == ESRCH)); } - void ThreadInterrupter::InstallSignalHandler() { SignalHandler::Install< ThreadInterrupterAndroid::ThreadInterruptSignalHandler>(); } - void ThreadInterrupter::RemoveSignalHandler() { SignalHandler::Remove(); } diff --git a/runtime/vm/thread_interrupter_fuchsia.cc b/runtime/vm/thread_interrupter_fuchsia.cc index 10f93ba0dc3..16ac1e258fb 100644 --- a/runtime/vm/thread_interrupter_fuchsia.cc +++ b/runtime/vm/thread_interrupter_fuchsia.cc @@ -231,12 +231,10 @@ class ThreadInterrupterFuchsia : public AllStatic { } }; - bool ThreadInterrupter::IsDebuggerAttached() { return false; } - void ThreadInterrupter::InterruptThread(OSThread* thread) { if (FLAG_trace_thread_interrupter) { OS::PrintErr("ThreadInterrupter suspending %p\n", @@ -249,12 +247,10 @@ void ThreadInterrupter::InterruptThread(OSThread* thread) { } } - void ThreadInterrupter::InstallSignalHandler() { // Nothing to do on Fuchsia. } - void ThreadInterrupter::RemoveSignalHandler() { // Nothing to do on Fuchsia. } diff --git a/runtime/vm/thread_interrupter_linux.cc b/runtime/vm/thread_interrupter_linux.cc index 8fe7265c54b..21945a8cccd 100644 --- a/runtime/vm/thread_interrupter_linux.cc +++ b/runtime/vm/thread_interrupter_linux.cc @@ -45,12 +45,10 @@ class ThreadInterrupterLinux : public AllStatic { } }; - bool ThreadInterrupter::IsDebuggerAttached() { return false; } - void ThreadInterrupter::InterruptThread(OSThread* thread) { if (FLAG_trace_thread_interrupter) { OS::PrintErr("ThreadInterrupter interrupting %p\n", @@ -60,13 +58,11 @@ void ThreadInterrupter::InterruptThread(OSThread* thread) { ASSERT((result == 0) || (result == ESRCH)); } - void ThreadInterrupter::InstallSignalHandler() { SignalHandler::Install< ThreadInterrupterLinux::ThreadInterruptSignalHandler>(); } - void ThreadInterrupter::RemoveSignalHandler() { SignalHandler::Remove(); } diff --git a/runtime/vm/thread_interrupter_macos.cc b/runtime/vm/thread_interrupter_macos.cc index 746c1a2a8a6..c8108aab9f7 100644 --- a/runtime/vm/thread_interrupter_macos.cc +++ b/runtime/vm/thread_interrupter_macos.cc @@ -5,12 +5,12 @@ #include "platform/globals.h" #if defined(HOST_OS_MACOS) -#include // NOLINT #include // NOLINT +#include // NOLINT #include // NOLINT +#include // NOLINT #include // NOLINT #include // NOLINT -#include // NOLINT #include "vm/flags.h" #include "vm/os.h" @@ -71,7 +71,6 @@ class ThreadInterrupterMacOS : public AllStatic { } }; - void ThreadInterrupter::InterruptThread(OSThread* thread) { if (FLAG_trace_thread_interrupter) { OS::PrintErr("ThreadInterrupter interrupting %p\n", thread->id()); @@ -80,13 +79,11 @@ void ThreadInterrupter::InterruptThread(OSThread* thread) { ASSERT((result == 0) || (result == ESRCH)); } - void ThreadInterrupter::InstallSignalHandler() { SignalHandler::Install< ThreadInterrupterMacOS::ThreadInterruptSignalHandler>(); } - void ThreadInterrupter::RemoveSignalHandler() { SignalHandler::Remove(); } diff --git a/runtime/vm/thread_interrupter_win.cc b/runtime/vm/thread_interrupter_win.cc index 4342f2b1f5d..9963983e0ea 100644 --- a/runtime/vm/thread_interrupter_win.cc +++ b/runtime/vm/thread_interrupter_win.cc @@ -53,7 +53,6 @@ class ThreadInterrupterWin : public AllStatic { return false; } - static void Interrupt(OSThread* os_thread) { ASSERT(!OSThread::Compare(GetCurrentThreadId(), os_thread->id())); HANDLE handle = OpenThread( @@ -92,12 +91,10 @@ class ThreadInterrupterWin : public AllStatic { } }; - bool ThreadInterrupter::IsDebuggerAttached() { return false; } - void ThreadInterrupter::InterruptThread(OSThread* thread) { if (FLAG_trace_thread_interrupter) { OS::PrintErr("ThreadInterrupter suspending %p\n", @@ -110,12 +107,10 @@ void ThreadInterrupter::InterruptThread(OSThread* thread) { } } - void ThreadInterrupter::InstallSignalHandler() { // Nothing to do on Windows. } - void ThreadInterrupter::RemoveSignalHandler() { // Nothing to do on Windows. } diff --git a/runtime/vm/thread_pool.cc b/runtime/vm/thread_pool.cc index 4c73446f0c5..89fa33a0912 100644 --- a/runtime/vm/thread_pool.cc +++ b/runtime/vm/thread_pool.cc @@ -26,12 +26,10 @@ ThreadPool::ThreadPool() shutting_down_workers_(NULL), join_list_(NULL) {} - ThreadPool::~ThreadPool() { Shutdown(); } - bool ThreadPool::Run(Task* task) { Worker* worker = NULL; bool new_worker = false; @@ -73,7 +71,6 @@ bool ThreadPool::Run(Task* task) { return true; } - void ThreadPool::Shutdown() { Worker* saved = NULL; { @@ -144,7 +141,6 @@ void ThreadPool::Shutdown() { #endif } - bool ThreadPool::IsIdle(Worker* worker) { ASSERT(worker != NULL && worker->owned_); for (Worker* current = idle_workers_; current != NULL; @@ -156,7 +152,6 @@ bool ThreadPool::IsIdle(Worker* worker) { return false; } - bool ThreadPool::RemoveWorkerFromIdleList(Worker* worker) { ASSERT(worker != NULL && worker->owned_); if (idle_workers_ == NULL) { @@ -181,7 +176,6 @@ bool ThreadPool::RemoveWorkerFromIdleList(Worker* worker) { return false; } - bool ThreadPool::RemoveWorkerFromAllList(Worker* worker) { ASSERT(worker != NULL && worker->owned_); if (all_workers_ == NULL) { @@ -209,7 +203,6 @@ bool ThreadPool::RemoveWorkerFromAllList(Worker* worker) { return false; } - void ThreadPool::SetIdleLocked(Worker* worker) { ASSERT(mutex_.IsOwnedByCurrentThread()); ASSERT(worker->owned_ && !IsIdle(worker)); @@ -219,7 +212,6 @@ void ThreadPool::SetIdleLocked(Worker* worker) { count_running_--; } - void ThreadPool::SetIdleAndReapExited(Worker* worker) { JoinList* list = NULL; { @@ -248,7 +240,6 @@ void ThreadPool::SetIdleAndReapExited(Worker* worker) { } } - bool ThreadPool::ReleaseIdleWorker(Worker* worker) { MutexLocker ml(&mutex_); if (shutting_down_) { @@ -273,7 +264,6 @@ bool ThreadPool::ReleaseIdleWorker(Worker* worker) { return true; } - // Only call while holding the exit_monitor_ void ThreadPool::AddWorkerToShutdownList(Worker* worker) { ASSERT(exit_monitor_.IsOwnedByCurrentThread()); @@ -281,7 +271,6 @@ void ThreadPool::AddWorkerToShutdownList(Worker* worker) { shutting_down_workers_ = worker; } - // Only call while holding the exit_monitor_ bool ThreadPool::RemoveWorkerFromShutdownList(Worker* worker) { ASSERT(worker != NULL); @@ -306,12 +295,10 @@ bool ThreadPool::RemoveWorkerFromShutdownList(Worker* worker) { return false; } - void ThreadPool::JoinList::AddLocked(ThreadJoinId id, JoinList** list) { *list = new JoinList(id, *list); } - void ThreadPool::JoinList::Join(JoinList** list) { while (*list != NULL) { JoinList* current = *list; @@ -321,13 +308,10 @@ void ThreadPool::JoinList::Join(JoinList** list) { } } - ThreadPool::Task::Task() {} - ThreadPool::Task::~Task() {} - ThreadPool::Worker::Worker(ThreadPool* pool) : pool_(pool), task_(NULL), @@ -338,13 +322,11 @@ ThreadPool::Worker::Worker(ThreadPool* pool) idle_next_(NULL), shutdown_next_(NULL) {} - ThreadId ThreadPool::Worker::id() { MonitorLocker ml(&monitor_); return id_; } - void ThreadPool::Worker::StartThread() { #if defined(DEBUG) // Must call SetTask before StartThread. @@ -360,7 +342,6 @@ void ThreadPool::Worker::StartThread() { } } - void ThreadPool::Worker::SetTask(Task* task) { MonitorLocker ml(&monitor_); ASSERT(task_ == NULL); @@ -368,7 +349,6 @@ void ThreadPool::Worker::SetTask(Task* task) { ml.Notify(); } - static int64_t ComputeTimeout(int64_t idle_start) { int64_t worker_timeout_micros = FLAG_worker_timeout_millis * kMicrosecondsPerMillisecond; @@ -388,7 +368,6 @@ static int64_t ComputeTimeout(int64_t idle_start) { } } - bool ThreadPool::Worker::Loop() { MonitorLocker ml(&monitor_); int64_t idle_start; @@ -430,14 +409,12 @@ bool ThreadPool::Worker::Loop() { return false; } - void ThreadPool::Worker::Shutdown() { MonitorLocker ml(&monitor_); done_ = true; ml.Notify(); } - // static void ThreadPool::Worker::Main(uword args) { Worker* worker = reinterpret_cast(args); diff --git a/runtime/vm/thread_pool_test.cc b/runtime/vm/thread_pool_test.cc index 7d5e82fb72c..1706a99c3bb 100644 --- a/runtime/vm/thread_pool_test.cc +++ b/runtime/vm/thread_pool_test.cc @@ -2,21 +2,19 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "vm/os.h" -#include "vm/lockers.h" #include "vm/thread_pool.h" +#include "vm/lockers.h" +#include "vm/os.h" #include "vm/unit_test.h" namespace dart { DECLARE_FLAG(int, worker_timeout_millis); - VM_UNIT_TEST_CASE(ThreadPool_Create) { ThreadPool thread_pool; } - class TestTask : public ThreadPool::Task { public: TestTask(Monitor* sync, bool* done) : sync_(sync), done_(done) {} @@ -42,7 +40,6 @@ class TestTask : public ThreadPool::Task { bool* done_; }; - VM_UNIT_TEST_CASE(ThreadPool_RunOne) { ThreadPool thread_pool; Monitor sync; @@ -63,7 +60,6 @@ VM_UNIT_TEST_CASE(ThreadPool_RunOne) { EXPECT_EQ(0U, thread_pool.workers_stopped()); } - VM_UNIT_TEST_CASE(ThreadPool_RunMany) { const int kTaskCount = 100; ThreadPool thread_pool; @@ -85,7 +81,6 @@ VM_UNIT_TEST_CASE(ThreadPool_RunMany) { } } - class SleepTask : public ThreadPool::Task { public: SleepTask(Monitor* sync, int* started_count, int* slept_count, int millis) @@ -118,7 +113,6 @@ class SleepTask : public ThreadPool::Task { int millis_; }; - VM_UNIT_TEST_CASE(ThreadPool_WorkerShutdown) { const int kTaskCount = 10; Monitor sync; @@ -156,7 +150,6 @@ VM_UNIT_TEST_CASE(ThreadPool_WorkerShutdown) { EXPECT_EQ(kTaskCount, final_count); } - VM_UNIT_TEST_CASE(ThreadPool_WorkerTimeout) { // Adjust the worker timeout so that we timeout quickly. int saved_timeout = FLAG_worker_timeout_millis; @@ -193,7 +186,6 @@ VM_UNIT_TEST_CASE(ThreadPool_WorkerTimeout) { FLAG_worker_timeout_millis = saved_timeout; } - class SpawnTask : public ThreadPool::Task { public: SpawnTask(ThreadPool* pool, Monitor* sync, int todo, int total, int* done) @@ -229,7 +221,6 @@ class SpawnTask : public ThreadPool::Task { int* done_; }; - VM_UNIT_TEST_CASE(ThreadPool_RecursiveSpawn) { ThreadPool thread_pool; Monitor sync; diff --git a/runtime/vm/thread_registry.cc b/runtime/vm/thread_registry.cc index 50856427bb1..c3888403c59 100644 --- a/runtime/vm/thread_registry.cc +++ b/runtime/vm/thread_registry.cc @@ -31,7 +31,6 @@ ThreadRegistry::~ThreadRegistry() { delete threads_lock_; } - // Gets a free Thread structure, we special case the mutator thread // by reusing the cached structure, see comment in 'thread_registry.h'. Thread* ThreadRegistry::GetFreeThreadLocked(Isolate* isolate, bool is_mutator) { @@ -51,7 +50,6 @@ Thread* ThreadRegistry::GetFreeThreadLocked(Isolate* isolate, bool is_mutator) { return thread; } - void ThreadRegistry::ReturnThreadLocked(bool is_mutator, Thread* thread) { ASSERT(threads_lock()->IsOwnedByCurrentThread()); // Remove thread from the active list for the isolate. @@ -61,7 +59,6 @@ void ThreadRegistry::ReturnThreadLocked(bool is_mutator, Thread* thread) { } } - void ThreadRegistry::VisitObjectPointers(ObjectPointerVisitor* visitor, bool validate_frames) { MonitorLocker ml(threads_lock()); @@ -81,7 +78,6 @@ void ThreadRegistry::VisitObjectPointers(ObjectPointerVisitor* visitor, } } - void ThreadRegistry::PrepareForGC() { MonitorLocker ml(threads_lock()); Thread* thread = active_list_; @@ -91,7 +87,6 @@ void ThreadRegistry::PrepareForGC() { } } - #ifndef PRODUCT void ThreadRegistry::PrintJSON(JSONStream* stream) const { MonitorLocker ml(threads_lock()); @@ -104,7 +99,6 @@ void ThreadRegistry::PrintJSON(JSONStream* stream) const { } #endif - intptr_t ThreadRegistry::CountZoneHandles() const { MonitorLocker ml(threads_lock()); intptr_t count = 0; @@ -116,7 +110,6 @@ intptr_t ThreadRegistry::CountZoneHandles() const { return count; } - intptr_t ThreadRegistry::CountScopedHandles() const { MonitorLocker ml(threads_lock()); intptr_t count = 0; @@ -128,7 +121,6 @@ intptr_t ThreadRegistry::CountScopedHandles() const { return count; } - void ThreadRegistry::AddToActiveListLocked(Thread* thread) { ASSERT(thread != NULL); ASSERT(threads_lock()->IsOwnedByCurrentThread()); @@ -136,7 +128,6 @@ void ThreadRegistry::AddToActiveListLocked(Thread* thread) { active_list_ = thread; } - void ThreadRegistry::RemoveFromActiveListLocked(Thread* thread) { ASSERT(thread != NULL); ASSERT(threads_lock()->IsOwnedByCurrentThread()); @@ -156,7 +147,6 @@ void ThreadRegistry::RemoveFromActiveListLocked(Thread* thread) { } } - Thread* ThreadRegistry::GetFromFreelistLocked(Isolate* isolate) { ASSERT(threads_lock()->IsOwnedByCurrentThread()); Thread* thread = NULL; @@ -170,7 +160,6 @@ Thread* ThreadRegistry::GetFromFreelistLocked(Isolate* isolate) { return thread; } - void ThreadRegistry::ReturnToFreelistLocked(Thread* thread) { ASSERT(thread != NULL); ASSERT(thread->os_thread_ == NULL); diff --git a/runtime/vm/thread_test.cc b/runtime/vm/thread_test.cc index c20f19ef860..befe7a8ac62 100644 --- a/runtime/vm/thread_test.cc +++ b/runtime/vm/thread_test.cc @@ -5,11 +5,11 @@ #include "platform/assert.h" #include "vm/isolate.h" #include "vm/lockers.h" -#include "vm/unit_test.h" #include "vm/profiler.h" #include "vm/safepoint.h" #include "vm/stack_frame.h" #include "vm/thread_pool.h" +#include "vm/unit_test.h" namespace dart { @@ -34,7 +34,6 @@ VM_UNIT_TEST_CASE(Mutex) { delete mutex; } - VM_UNIT_TEST_CASE(Monitor) { // This unit test case needs a running isolate. Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data, @@ -81,7 +80,6 @@ VM_UNIT_TEST_CASE(Monitor) { delete monitor; } - class ObjectCounter : public ObjectPointerVisitor { public: explicit ObjectCounter(Isolate* isolate, const Object* obj) @@ -102,7 +100,6 @@ class ObjectCounter : public ObjectPointerVisitor { intptr_t count_; }; - class TaskWithZoneAllocation : public ThreadPool::Task { public: TaskWithZoneAllocation(Isolate* isolate, @@ -172,7 +169,6 @@ class TaskWithZoneAllocation : public ThreadPool::Task { intptr_t id_; }; - ISOLATE_UNIT_TEST_CASE(ManyTasksWithZones) { const int kTaskCount = 100; Monitor sync[kTaskCount]; @@ -204,7 +200,6 @@ ISOLATE_UNIT_TEST_CASE(ManyTasksWithZones) { } } - #ifndef PRODUCT class SimpleTaskWithZoneAllocation : public ThreadPool::Task { public: @@ -286,7 +281,6 @@ class SimpleTaskWithZoneAllocation : public ThreadPool::Task { bool* wait_; }; - TEST_CASE(ManySimpleTasksWithZones) { const int kTaskCount = 10; Monitor monitor; @@ -359,7 +353,6 @@ TEST_CASE(ManySimpleTasksWithZones) { } #endif - TEST_CASE(ThreadRegistry) { Isolate* orig = Thread::Current()->isolate(); Zone* orig_zone = Thread::Current()->zone(); @@ -388,7 +381,6 @@ TEST_CASE(ThreadRegistry) { EXPECT_STREQ("foo", orig_str); } - // A helper thread that alternatingly cooperates and organizes // safepoint rendezvous. At rendezvous, it explicitly visits the // stacks looking for a specific marker (Smi) to verify that the expected @@ -478,10 +470,8 @@ class SafepointTestTask : public ThreadPool::Task { bool local_done_; // this task has successfully safepointed >= once. }; - const intptr_t SafepointTestTask::kTaskCount = 5; - // Test rendezvous of: // - helpers in VM code, // - main thread in pure Dart, @@ -533,7 +523,6 @@ TEST_CASE(SafepointTestDart) { } } - // Test rendezvous of: // - helpers in VM code, and // - main thread in VM code, @@ -558,7 +547,6 @@ ISOLATE_UNIT_TEST_CASE(SafepointTestVM) { } } - // Test case for recursive safepoint operations. ISOLATE_UNIT_TEST_CASE(RecursiveSafepointTest1) { intptr_t count = 0; @@ -577,7 +565,6 @@ ISOLATE_UNIT_TEST_CASE(RecursiveSafepointTest1) { EXPECT(count == 3); } - ISOLATE_UNIT_TEST_CASE(ThreadIterator_Count) { intptr_t thread_count_0 = 0; intptr_t thread_count_1 = 0; @@ -605,20 +592,17 @@ ISOLATE_UNIT_TEST_CASE(ThreadIterator_Count) { EXPECT(thread_count_0 >= thread_count_1); } - ISOLATE_UNIT_TEST_CASE(ThreadIterator_FindSelf) { OSThread* current = OSThread::Current(); EXPECT(OSThread::IsThreadInList(current->id())); } - struct ThreadIteratorTestParams { ThreadId spawned_thread_id; ThreadJoinId spawned_thread_join_id; Monitor* monitor; }; - void ThreadIteratorTestMain(uword parameter) { ThreadIteratorTestParams* params = reinterpret_cast(parameter); @@ -633,7 +617,6 @@ void ThreadIteratorTestMain(uword parameter) { ml.Notify(); } - // NOTE: This test case also verifies that known TLS destructors are called // on Windows. See |OnDartThreadExit| in os_thread_win.cc for more details. TEST_CASE(ThreadIterator_AddFindRemove) { @@ -660,7 +643,6 @@ TEST_CASE(ThreadIterator_AddFindRemove) { delete params.monitor; } - // Test rendezvous of: // - helpers in VM code, and // - main thread in VM code, @@ -696,7 +678,6 @@ ISOLATE_UNIT_TEST_CASE(SafepointTestVM2) { } } - // Test recursive safepoint operation scopes with other threads trying // to also start a safepoint operation scope. ISOLATE_UNIT_TEST_CASE(RecursiveSafepointTest2) { @@ -736,7 +717,6 @@ ISOLATE_UNIT_TEST_CASE(RecursiveSafepointTest2) { } while (!all_exited); } - class AllocAndGCTask : public ThreadPool::Task { public: AllocAndGCTask(Isolate* isolate, Monitor* done_monitor, bool* done) @@ -769,7 +749,6 @@ class AllocAndGCTask : public ThreadPool::Task { bool* done_; }; - ISOLATE_UNIT_TEST_CASE(HelperAllocAndGC) { Monitor done_monitor; bool done = false; diff --git a/runtime/vm/timeline.cc b/runtime/vm/timeline.cc index fd2c43927ca..86256661d2b 100644 --- a/runtime/vm/timeline.cc +++ b/runtime/vm/timeline.cc @@ -100,7 +100,6 @@ DEFINE_FLAG(charp, // |TimelineEventRecorder::lock_| // - static TimelineEventRecorder* CreateTimelineRecorder() { // Some flags require that we use the endless recorder. const bool use_endless_recorder = @@ -150,7 +149,6 @@ static TimelineEventRecorder* CreateTimelineRecorder() { return new TimelineEventRingRecorder(); } - // Returns a caller freed array of stream names in FLAG_timeline_streams. static MallocGrowableArray* GetEnabledByDefaultTimelineStreams() { MallocGrowableArray* result = new MallocGrowableArray(); @@ -170,7 +168,6 @@ static MallocGrowableArray* GetEnabledByDefaultTimelineStreams() { return result; } - // Frees the result of |GetEnabledByDefaultTimelineStreams|. static void FreeEnabledByDefaultTimelineStreams( MallocGrowableArray* streams) { @@ -183,7 +180,6 @@ static void FreeEnabledByDefaultTimelineStreams( delete streams; } - // Returns true if |streams| contains |stream| or "all". Not case sensitive. static bool HasStream(MallocGrowableArray* streams, const char* stream) { if ((FLAG_timeline_dir != NULL) || FLAG_timing || FLAG_complete_timeline || @@ -200,7 +196,6 @@ static bool HasStream(MallocGrowableArray* streams, const char* stream) { return false; } - void Timeline::InitOnce() { ASSERT(recorder_ == NULL); recorder_ = CreateTimelineRecorder(); @@ -218,7 +213,6 @@ void Timeline::InitOnce() { } } - void Timeline::StreamStateChange(const char* stream_name, bool prev, bool curr) { @@ -234,7 +228,6 @@ void Timeline::StreamStateChange(const char* stream_name, } } - void Timeline::Shutdown() { ASSERT(recorder_ != NULL); @@ -260,12 +253,10 @@ void Timeline::Shutdown() { } } - TimelineEventRecorder* Timeline::recorder() { return recorder_; } - void Timeline::ReclaimCachedBlocksFromThreads() { TimelineEventRecorder* recorder = Timeline::recorder(); if (recorder == NULL) { @@ -287,7 +278,6 @@ void Timeline::ReclaimCachedBlocksFromThreads() { } } - void Timeline::PrintFlagsToJSON(JSONStream* js) { JSONObject obj(js); obj.AddProperty("type", "TimelineFlags"); @@ -314,7 +304,6 @@ void Timeline::PrintFlagsToJSON(JSONStream* js) { } } - void Timeline::Clear() { TimelineEventRecorder* recorder = Timeline::recorder(); if (recorder == NULL) { @@ -324,7 +313,6 @@ void Timeline::Clear() { recorder->Clear(); } - TimelineEventRecorder* Timeline::recorder_ = NULL; MallocGrowableArray* Timeline::enabled_streams_ = NULL; Dart_EmbedderTimelineStartRecording Timeline::start_recording_cb_ = NULL; @@ -348,12 +336,10 @@ TimelineEvent::TimelineEvent() thread_(OSThread::kInvalidThreadId), isolate_id_(ILLEGAL_PORT) {} - TimelineEvent::~TimelineEvent() { Reset(); } - void TimelineEvent::Reset() { if (owns_label() && label_ != NULL) { free(const_cast(label_)); @@ -369,7 +355,6 @@ void TimelineEvent::Reset() { set_owns_label(false); } - void TimelineEvent::AsyncBegin(const char* label, int64_t async_id, int64_t micros) { @@ -379,7 +364,6 @@ void TimelineEvent::AsyncBegin(const char* label, set_timestamp1(async_id); } - void TimelineEvent::AsyncInstant(const char* label, int64_t async_id, int64_t micros) { @@ -389,7 +373,6 @@ void TimelineEvent::AsyncInstant(const char* label, set_timestamp1(async_id); } - void TimelineEvent::AsyncEnd(const char* label, int64_t async_id, int64_t micros) { @@ -399,7 +382,6 @@ void TimelineEvent::AsyncEnd(const char* label, set_timestamp1(async_id); } - void TimelineEvent::DurationBegin(const char* label, int64_t micros, int64_t thread_micros) { @@ -408,20 +390,17 @@ void TimelineEvent::DurationBegin(const char* label, set_thread_timestamp0(thread_micros); } - void TimelineEvent::DurationEnd(int64_t micros, int64_t thread_micros) { ASSERT(timestamp1_ == 0); set_timestamp1(micros); set_thread_timestamp1(thread_micros); } - void TimelineEvent::Instant(const char* label, int64_t micros) { Init(kInstant, label); set_timestamp0(micros); } - void TimelineEvent::Duration(const char* label, int64_t start_micros, int64_t end_micros, @@ -434,7 +413,6 @@ void TimelineEvent::Duration(const char* label, set_thread_timestamp1(thread_end_micros); } - void TimelineEvent::Begin(const char* label, int64_t micros, int64_t thread_micros) { @@ -443,7 +421,6 @@ void TimelineEvent::Begin(const char* label, set_thread_timestamp0(thread_micros); } - void TimelineEvent::End(const char* label, int64_t micros, int64_t thread_micros) { @@ -452,13 +429,11 @@ void TimelineEvent::End(const char* label, set_thread_timestamp0(thread_micros); } - void TimelineEvent::Counter(const char* label, int64_t micros) { Init(kCounter, label); set_timestamp0(micros); } - void TimelineEvent::FlowBegin(const char* label, int64_t async_id, int64_t micros) { @@ -468,7 +443,6 @@ void TimelineEvent::FlowBegin(const char* label, set_timestamp1(async_id); } - void TimelineEvent::FlowStep(const char* label, int64_t async_id, int64_t micros) { @@ -478,7 +452,6 @@ void TimelineEvent::FlowStep(const char* label, set_timestamp1(async_id); } - void TimelineEvent::FlowEnd(const char* label, int64_t async_id, int64_t micros) { @@ -488,13 +461,11 @@ void TimelineEvent::FlowEnd(const char* label, set_timestamp1(async_id); } - void TimelineEvent::Metadata(const char* label, int64_t micros) { Init(kMetadata, label); set_timestamp0(micros); } - void TimelineEvent::CompleteWithPreSerializedJSON(const char* json) { set_pre_serialized_json(true); SetNumArguments(1); @@ -502,7 +473,6 @@ void TimelineEvent::CompleteWithPreSerializedJSON(const char* json) { Complete(); } - void TimelineEvent::SetNumArguments(intptr_t length) { // Cannot call this twice. ASSERT(arguments_ == NULL); @@ -515,7 +485,6 @@ void TimelineEvent::SetNumArguments(intptr_t length) { calloc(sizeof(TimelineEventArgument), length)); } - void TimelineEvent::SetArgument(intptr_t i, const char* name, char* argument) { ASSERT(i >= 0); ASSERT(i < arguments_length_); @@ -523,7 +492,6 @@ void TimelineEvent::SetArgument(intptr_t i, const char* name, char* argument) { arguments_[i].value = argument; } - void TimelineEvent::FormatArgument(intptr_t i, const char* name, const char* fmt, @@ -544,23 +512,19 @@ void TimelineEvent::FormatArgument(intptr_t i, SetArgument(i, name, buffer); } - void TimelineEvent::CopyArgument(intptr_t i, const char* name, const char* argument) { SetArgument(i, name, strdup(argument)); } - void TimelineEvent::StealArguments(intptr_t arguments_length, TimelineEventArgument* arguments) { arguments_length_ = arguments_length; arguments_ = arguments; } - #if defined(HOST_OS_FUCHSIA) - // TODO(zra): The functions below emit Dart's timeline events all as category // "dart". Instead, we could have finer-grained categories that make use of // the name of the timeline stream, e.g. "VM", "GC", etc. @@ -616,7 +580,6 @@ FUCHSIA_EVENT_ARGS_LIST(EMIT_FUCHSIA_EVENT) FUCHSIA_EVENT_ID_ARGS_LIST(EMIT_FUCHSIA_EVENT) #undef EMIT_FUCHSIA_EVENT - void TimelineEvent::EmitFuchsiaEvent() { switch (event_type()) { case kBegin: @@ -660,7 +623,6 @@ void TimelineEvent::EmitFuchsiaEvent() { } #endif - intptr_t TimelineEvent::PrintSystrace(char* buffer, intptr_t buffer_size) { ASSERT(buffer != NULL); ASSERT(buffer_size > 0); @@ -688,7 +650,6 @@ intptr_t TimelineEvent::PrintSystrace(char* buffer, intptr_t buffer_size) { return length; } - void TimelineEvent::Complete() { TimelineEventRecorder* recorder = Timeline::recorder(); if (recorder != NULL) { @@ -696,7 +657,6 @@ void TimelineEvent::Complete() { } } - void TimelineEvent::FreeArguments() { if (arguments_ == NULL) { return; @@ -709,7 +669,6 @@ void TimelineEvent::FreeArguments() { arguments_length_ = 0; } - void TimelineEvent::StreamInit(TimelineStream* stream) { if (stream != NULL) { category_ = stream->name(); @@ -718,7 +677,6 @@ void TimelineEvent::StreamInit(TimelineStream* stream) { } } - void TimelineEvent::Init(EventType event_type, const char* label) { ASSERT(label != NULL); state_ = 0; @@ -742,7 +700,6 @@ void TimelineEvent::Init(EventType event_type, const char* label) { set_owns_label(false); } - bool TimelineEvent::Within(int64_t time_origin_micros, int64_t time_extent_micros) { if ((time_origin_micros == -1) || (time_extent_micros == -1)) { @@ -764,7 +721,6 @@ bool TimelineEvent::Within(int64_t time_origin_micros, return (delta >= 0) && (delta <= time_extent_micros); } - const char* TimelineEvent::GetSerializedJSON() const { ASSERT(pre_serialized_json()); ASSERT(arguments_length_ == 1); @@ -772,7 +728,6 @@ const char* TimelineEvent::GetSerializedJSON() const { return arguments_[0].value; } - void TimelineEvent::PrintJSON(JSONStream* stream) const { if (!FLAG_support_service) { return; @@ -860,22 +815,18 @@ void TimelineEvent::PrintJSON(JSONStream* stream) const { } } - int64_t TimelineEvent::TimeOrigin() const { return timestamp0_; } - int64_t TimelineEvent::AsyncId() const { return timestamp1_; } - int64_t TimelineEvent::LowTime() const { return timestamp0_; } - int64_t TimelineEvent::HighTime() const { if (event_type() == kDuration) { return timestamp1_; @@ -884,7 +835,6 @@ int64_t TimelineEvent::HighTime() const { } } - int64_t TimelineEvent::TimeDuration() const { if (timestamp1_ == 0) { // This duration is still open, use current time as end. @@ -893,18 +843,15 @@ int64_t TimelineEvent::TimeDuration() const { return timestamp1_ - timestamp0_; } - bool TimelineEvent::HasThreadCPUTime() const { return (thread_timestamp0_ != -1); } - int64_t TimelineEvent::ThreadCPUTimeOrigin() const { ASSERT(HasThreadCPUTime()); return thread_timestamp0_; } - int64_t TimelineEvent::ThreadCPUTimeDuration() const { ASSERT(HasThreadCPUTime()); if (thread_timestamp1_ == -1) { @@ -914,16 +861,13 @@ int64_t TimelineEvent::ThreadCPUTimeDuration() const { return thread_timestamp1_ - thread_timestamp0_; } - TimelineStream::TimelineStream() : name_(NULL), enabled_(false) {} - void TimelineStream::Init(const char* name, bool enabled) { name_ = name; enabled_ = enabled; } - TimelineEvent* TimelineStream::StartEvent() { TimelineEventRecorder* recorder = Timeline::recorder(); if (!enabled() || (recorder == NULL)) { @@ -937,7 +881,6 @@ TimelineEvent* TimelineStream::StartEvent() { return event; } - TimelineEventScope::TimelineEventScope(TimelineStream* stream, const char* label) : StackResource(reinterpret_cast(NULL)), @@ -949,7 +892,6 @@ TimelineEventScope::TimelineEventScope(TimelineStream* stream, Init(); } - TimelineEventScope::TimelineEventScope(Thread* thread, TimelineStream* stream, const char* label) @@ -962,12 +904,10 @@ TimelineEventScope::TimelineEventScope(Thread* thread, Init(); } - TimelineEventScope::~TimelineEventScope() { FreeArguments(); } - void TimelineEventScope::Init() { ASSERT(enabled_ == false); ASSERT(label_ != NULL); @@ -979,7 +919,6 @@ void TimelineEventScope::Init() { enabled_ = true; } - void TimelineEventScope::SetNumArguments(intptr_t length) { if (!enabled()) { return; @@ -994,7 +933,6 @@ void TimelineEventScope::SetNumArguments(intptr_t length) { calloc(sizeof(TimelineEventArgument), length)); } - // |name| must be a compile time constant. Takes ownership of |argumentp|. void TimelineEventScope::SetArgument(intptr_t i, const char* name, @@ -1008,7 +946,6 @@ void TimelineEventScope::SetArgument(intptr_t i, arguments_[i].value = argument; } - // |name| must be a compile time constant. Copies |argument|. void TimelineEventScope::CopyArgument(intptr_t i, const char* name, @@ -1019,7 +956,6 @@ void TimelineEventScope::CopyArgument(intptr_t i, SetArgument(i, name, strdup(argument)); } - void TimelineEventScope::FormatArgument(intptr_t i, const char* name, const char* fmt, @@ -1041,7 +977,6 @@ void TimelineEventScope::FormatArgument(intptr_t i, SetArgument(i, name, buffer); } - void TimelineEventScope::FreeArguments() { if (arguments_ == NULL) { return; @@ -1054,7 +989,6 @@ void TimelineEventScope::FreeArguments() { arguments_length_ = 0; } - void TimelineEventScope::StealArguments(TimelineEvent* event) { if (event == NULL) { return; @@ -1064,7 +998,6 @@ void TimelineEventScope::StealArguments(TimelineEvent* event) { arguments_ = NULL; } - TimelineDurationScope::TimelineDurationScope(TimelineStream* stream, const char* label) : TimelineEventScope(stream, label) { @@ -1079,7 +1012,6 @@ TimelineDurationScope::TimelineDurationScope(TimelineStream* stream, #endif } - TimelineDurationScope::TimelineDurationScope(Thread* thread, TimelineStream* stream, const char* label) @@ -1095,7 +1027,6 @@ TimelineDurationScope::TimelineDurationScope(Thread* thread, #endif } - TimelineDurationScope::~TimelineDurationScope() { if (!FLAG_support_timeline) { return; @@ -1120,7 +1051,6 @@ TimelineDurationScope::~TimelineDurationScope() { #endif } - TimelineBeginEndScope::TimelineBeginEndScope(TimelineStream* stream, const char* label) : TimelineEventScope(stream, label) { @@ -1130,7 +1060,6 @@ TimelineBeginEndScope::TimelineBeginEndScope(TimelineStream* stream, EmitBegin(); } - TimelineBeginEndScope::TimelineBeginEndScope(Thread* thread, TimelineStream* stream, const char* label) @@ -1141,7 +1070,6 @@ TimelineBeginEndScope::TimelineBeginEndScope(Thread* thread, EmitBegin(); } - TimelineBeginEndScope::~TimelineBeginEndScope() { if (!FLAG_support_timeline) { return; @@ -1149,7 +1077,6 @@ TimelineBeginEndScope::~TimelineBeginEndScope() { EmitEnd(); } - void TimelineBeginEndScope::EmitBegin() { if (!FLAG_support_timeline) { return; @@ -1169,7 +1096,6 @@ void TimelineBeginEndScope::EmitBegin() { event->Complete(); } - void TimelineBeginEndScope::EmitEnd() { if (!FLAG_support_timeline) { return; @@ -1190,7 +1116,6 @@ void TimelineBeginEndScope::EmitEnd() { event->Complete(); } - TimelineEventFilter::TimelineEventFilter(int64_t time_origin_micros, int64_t time_extent_micros) : time_origin_micros_(time_origin_micros), @@ -1199,10 +1124,8 @@ TimelineEventFilter::TimelineEventFilter(int64_t time_origin_micros, ASSERT(time_extent_micros_ >= -1); } - TimelineEventFilter::~TimelineEventFilter() {} - IsolateTimelineEventFilter::IsolateTimelineEventFilter( Dart_Port isolate_id, int64_t time_origin_micros, @@ -1210,11 +1133,9 @@ IsolateTimelineEventFilter::IsolateTimelineEventFilter( : TimelineEventFilter(time_origin_micros, time_extent_micros), isolate_id_(isolate_id) {} - TimelineEventRecorder::TimelineEventRecorder() : async_id_(0), time_low_micros_(0), time_high_micros_(0) {} - void TimelineEventRecorder::PrintJSONMeta(JSONArray* events) const { if (!FLAG_support_service) { return; @@ -1241,7 +1162,6 @@ void TimelineEventRecorder::PrintJSONMeta(JSONArray* events) const { } } - TimelineEvent* TimelineEventRecorder::ThreadBlockStartEvent() { // Grab the current thread. OSThread* thread = OSThread::Current(); @@ -1290,13 +1210,11 @@ TimelineEvent* TimelineEventRecorder::ThreadBlockStartEvent() { return NULL; } - void TimelineEventRecorder::ResetTimeTracking() { time_high_micros_ = 0; time_low_micros_ = kMaxInt64; } - void TimelineEventRecorder::ReportTime(int64_t micros) { if (time_high_micros_ < micros) { time_high_micros_ = micros; @@ -1306,7 +1224,6 @@ void TimelineEventRecorder::ReportTime(int64_t micros) { } } - int64_t TimelineEventRecorder::TimeOriginMicros() const { if (time_high_micros_ == 0) { return 0; @@ -1314,7 +1231,6 @@ int64_t TimelineEventRecorder::TimeOriginMicros() const { return time_low_micros_; } - int64_t TimelineEventRecorder::TimeExtentMicros() const { if (time_high_micros_ == 0) { return 0; @@ -1322,7 +1238,6 @@ int64_t TimelineEventRecorder::TimeExtentMicros() const { return time_high_micros_ - time_low_micros_; } - void TimelineEventRecorder::ThreadBlockCompleteEvent(TimelineEvent* event) { if (event == NULL) { return; @@ -1342,7 +1257,6 @@ void TimelineEventRecorder::ThreadBlockCompleteEvent(TimelineEvent* event) { thread_block_lock->Unlock(); } - void TimelineEventRecorder::WriteTo(const char* directory) { if (!FLAG_support_service) { return; @@ -1382,7 +1296,6 @@ void TimelineEventRecorder::WriteTo(const char* directory) { return; } - int64_t TimelineEventRecorder::GetNextAsyncId() { // TODO(johnmccutchan): Gracefully handle wrap around. // TODO(rmacnak): Use TRACE_NONCE() on Fuchsia? @@ -1391,7 +1304,6 @@ int64_t TimelineEventRecorder::GetNextAsyncId() { return static_cast(next); } - void TimelineEventRecorder::FinishBlock(TimelineEventBlock* block) { if (block == NULL) { return; @@ -1400,13 +1312,11 @@ void TimelineEventRecorder::FinishBlock(TimelineEventBlock* block) { block->Finish(); } - TimelineEventBlock* TimelineEventRecorder::GetNewBlock() { MutexLocker ml(&lock_); return GetNewBlockLocked(); } - TimelineEventFixedBufferRecorder::TimelineEventFixedBufferRecorder( intptr_t capacity) : blocks_(NULL), capacity_(capacity), num_blocks_(0), block_cursor_(0) { @@ -1426,7 +1336,6 @@ TimelineEventFixedBufferRecorder::TimelineEventFixedBufferRecorder( } } - TimelineEventFixedBufferRecorder::~TimelineEventFixedBufferRecorder() { // Delete all blocks. for (intptr_t i = 0; i < num_blocks_; i++) { @@ -1436,7 +1345,6 @@ TimelineEventFixedBufferRecorder::~TimelineEventFixedBufferRecorder() { free(blocks_); } - void TimelineEventFixedBufferRecorder::PrintJSONEvents( JSONArray* events, TimelineEventFilter* filter) { @@ -1469,7 +1377,6 @@ void TimelineEventFixedBufferRecorder::PrintJSONEvents( } } - void TimelineEventFixedBufferRecorder::PrintJSON(JSONStream* js, TimelineEventFilter* filter) { if (!FLAG_support_service) { @@ -1486,7 +1393,6 @@ void TimelineEventFixedBufferRecorder::PrintJSON(JSONStream* js, topLevel.AddPropertyTimeMicros("timeExtentMicros", TimeExtentMicros()); } - void TimelineEventFixedBufferRecorder::PrintTraceEvent( JSONStream* js, TimelineEventFilter* filter) { @@ -1498,12 +1404,10 @@ void TimelineEventFixedBufferRecorder::PrintTraceEvent( PrintJSONEvents(&events, filter); } - TimelineEventBlock* TimelineEventFixedBufferRecorder::GetHeadBlockLocked() { return blocks_[0]; } - void TimelineEventFixedBufferRecorder::Clear() { MutexLocker ml(&lock_); for (intptr_t i = 0; i < num_blocks_; i++) { @@ -1512,7 +1416,6 @@ void TimelineEventFixedBufferRecorder::Clear() { } } - intptr_t TimelineEventFixedBufferRecorder::FindOldestBlockIndex() const { int64_t earliest_time = kMaxInt64; intptr_t earliest_index = -1; @@ -1530,12 +1433,10 @@ intptr_t TimelineEventFixedBufferRecorder::FindOldestBlockIndex() const { return earliest_index; } - TimelineEvent* TimelineEventFixedBufferRecorder::StartEvent() { return ThreadBlockStartEvent(); } - void TimelineEventFixedBufferRecorder::CompleteEvent(TimelineEvent* event) { if (event == NULL) { return; @@ -1543,7 +1444,6 @@ void TimelineEventFixedBufferRecorder::CompleteEvent(TimelineEvent* event) { ThreadBlockCompleteEvent(event); } - TimelineEventSystraceRecorder::TimelineEventSystraceRecorder(intptr_t capacity) : TimelineEventFixedBufferRecorder(capacity), systrace_fd_(-1) { #if defined(HOST_OS_ANDROID) || defined(HOST_OS_LINUX) @@ -1560,7 +1460,6 @@ TimelineEventSystraceRecorder::TimelineEventSystraceRecorder(intptr_t capacity) #endif } - TimelineEventSystraceRecorder::~TimelineEventSystraceRecorder() { #if defined(HOST_OS_ANDROID) || defined(HOST_OS_LINUX) if (systrace_fd_ >= 0) { @@ -1569,7 +1468,6 @@ TimelineEventSystraceRecorder::~TimelineEventSystraceRecorder() { #endif } - TimelineEventBlock* TimelineEventSystraceRecorder::GetNewBlockLocked() { // TODO(johnmccutchan): This function should only hand out blocks // which have been marked as finished. @@ -1582,7 +1480,6 @@ TimelineEventBlock* TimelineEventSystraceRecorder::GetNewBlockLocked() { return block; } - void TimelineEventSystraceRecorder::CompleteEvent(TimelineEvent* event) { if (event == NULL) { return; @@ -1606,7 +1503,6 @@ void TimelineEventSystraceRecorder::CompleteEvent(TimelineEvent* event) { ThreadBlockCompleteEvent(event); } - #if defined(HOST_OS_FUCHSIA) TimelineEventFuchsiaRecorder::TimelineEventFuchsiaRecorder(intptr_t capacity) : TimelineEventFixedBufferRecorder(capacity) {} @@ -1624,7 +1520,6 @@ TimelineEventBlock* TimelineEventFuchsiaRecorder::GetNewBlockLocked() { return block; } - void TimelineEventFuchsiaRecorder::CompleteEvent(TimelineEvent* event) { if (event == NULL) { return; @@ -1634,7 +1529,6 @@ void TimelineEventFuchsiaRecorder::CompleteEvent(TimelineEvent* event) { } #endif // defined(HOST_OS_FUCHSIA) - TimelineEventBlock* TimelineEventRingRecorder::GetNewBlockLocked() { // TODO(johnmccutchan): This function should only hand out blocks // which have been marked as finished. @@ -1647,7 +1541,6 @@ TimelineEventBlock* TimelineEventRingRecorder::GetNewBlockLocked() { return block; } - TimelineEventBlock* TimelineEventStartupRecorder::GetNewBlockLocked() { if (block_cursor_ == num_blocks_) { return NULL; @@ -1658,13 +1551,10 @@ TimelineEventBlock* TimelineEventStartupRecorder::GetNewBlockLocked() { return block; } - TimelineEventCallbackRecorder::TimelineEventCallbackRecorder() {} - TimelineEventCallbackRecorder::~TimelineEventCallbackRecorder() {} - void TimelineEventCallbackRecorder::PrintJSON(JSONStream* js, TimelineEventFilter* filter) { if (!FLAG_support_service) { @@ -1678,7 +1568,6 @@ void TimelineEventCallbackRecorder::PrintJSON(JSONStream* js, } } - void TimelineEventCallbackRecorder::PrintTraceEvent( JSONStream* js, TimelineEventFilter* filter) { @@ -1688,19 +1577,16 @@ void TimelineEventCallbackRecorder::PrintTraceEvent( JSONArray events(js); } - TimelineEvent* TimelineEventCallbackRecorder::StartEvent() { TimelineEvent* event = new TimelineEvent(); return event; } - void TimelineEventCallbackRecorder::CompleteEvent(TimelineEvent* event) { OnEvent(event); delete event; } - TimelineEventEndlessRecorder::TimelineEventEndlessRecorder() : head_(NULL), block_index_(0) {} @@ -1731,7 +1617,6 @@ void TimelineEventEndlessRecorder::PrintJSON(JSONStream* js, topLevel.AddPropertyTimeMicros("timeExtentMicros", TimeExtentMicros()); } - void TimelineEventEndlessRecorder::PrintTraceEvent( JSONStream* js, TimelineEventFilter* filter) { @@ -1743,17 +1628,14 @@ void TimelineEventEndlessRecorder::PrintTraceEvent( PrintJSONEvents(&events, filter); } - TimelineEventBlock* TimelineEventEndlessRecorder::GetHeadBlockLocked() { return head_; } - TimelineEvent* TimelineEventEndlessRecorder::StartEvent() { return ThreadBlockStartEvent(); } - void TimelineEventEndlessRecorder::CompleteEvent(TimelineEvent* event) { if (event == NULL) { return; @@ -1761,7 +1643,6 @@ void TimelineEventEndlessRecorder::CompleteEvent(TimelineEvent* event) { ThreadBlockCompleteEvent(event); } - TimelineEventBlock* TimelineEventEndlessRecorder::GetNewBlockLocked() { TimelineEventBlock* block = new TimelineEventBlock(block_index_++); block->set_next(head_); @@ -1778,7 +1659,6 @@ static int TimelineEventBlockCompare(TimelineEventBlock* const* a, return (*a)->LowerTimeBound() - (*b)->LowerTimeBound(); } - void TimelineEventEndlessRecorder::PrintJSONEvents( JSONArray* events, TimelineEventFilter* filter) { @@ -1820,7 +1700,6 @@ void TimelineEventEndlessRecorder::PrintJSONEvents( } } - void TimelineEventEndlessRecorder::Clear() { TimelineEventBlock* current = head_; while (current != NULL) { @@ -1834,7 +1713,6 @@ void TimelineEventEndlessRecorder::Clear() { thread->set_timeline_block(NULL); } - TimelineEventBlock::TimelineEventBlock(intptr_t block_index) : next_(NULL), length_(0), @@ -1842,12 +1720,10 @@ TimelineEventBlock::TimelineEventBlock(intptr_t block_index) thread_id_(OSThread::kInvalidThreadId), in_use_(false) {} - TimelineEventBlock::~TimelineEventBlock() { Reset(); } - void TimelineEventBlock::PrintJSON(JSONStream* js) const { ASSERT(!in_use()); JSONArray events(js); @@ -1857,7 +1733,6 @@ void TimelineEventBlock::PrintJSON(JSONStream* js) const { } } - TimelineEvent* TimelineEventBlock::StartEvent() { ASSERT(!IsFull()); if (FLAG_trace_timeline) { @@ -1869,7 +1744,6 @@ TimelineEvent* TimelineEventBlock::StartEvent() { return &events_[length_++]; } - int64_t TimelineEventBlock::LowerTimeBound() const { if (length_ == 0) { return kMaxInt64; @@ -1878,7 +1752,6 @@ int64_t TimelineEventBlock::LowerTimeBound() const { return events_[0].TimeOrigin(); } - bool TimelineEventBlock::CheckBlock() { if (length() == 0) { return true; @@ -1902,7 +1775,6 @@ bool TimelineEventBlock::CheckBlock() { return true; } - void TimelineEventBlock::Reset() { for (intptr_t i = 0; i < kBlockSize; i++) { // Clear any extra data. @@ -1913,7 +1785,6 @@ void TimelineEventBlock::Reset() { in_use_ = false; } - void TimelineEventBlock::Open() { OSThread* os_thread = OSThread::Current(); ASSERT(os_thread != NULL); @@ -1921,7 +1792,6 @@ void TimelineEventBlock::Open() { in_use_ = true; } - void TimelineEventBlock::Finish() { if (FLAG_trace_timeline) { OS::Print("Finish block %p\n", this); @@ -1934,19 +1804,16 @@ void TimelineEventBlock::Finish() { } } - TimelineEventBlockIterator::TimelineEventBlockIterator( TimelineEventRecorder* recorder) : current_(NULL), recorder_(NULL) { Reset(recorder); } - TimelineEventBlockIterator::~TimelineEventBlockIterator() { Reset(NULL); } - void TimelineEventBlockIterator::Reset(TimelineEventRecorder* recorder) { // Clear current. current_ = NULL; @@ -1964,12 +1831,10 @@ void TimelineEventBlockIterator::Reset(TimelineEventRecorder* recorder) { current_ = recorder_->GetHeadBlockLocked(); } - bool TimelineEventBlockIterator::HasNext() const { return current_ != NULL; } - TimelineEventBlock* TimelineEventBlockIterator::Next() { ASSERT(current_ != NULL); TimelineEventBlock* r = current_; diff --git a/runtime/vm/timeline.h b/runtime/vm/timeline.h index 34e169f0dd9..d1954510dee 100644 --- a/runtime/vm/timeline.h +++ b/runtime/vm/timeline.h @@ -137,13 +137,11 @@ class Timeline : public AllStatic { friend class ReclaimBlocksIsolateVisitor; }; - struct TimelineEventArgument { const char* name; char* value; }; - // You should get a |TimelineEvent| from a |TimelineStream|. class TimelineEvent { public: @@ -409,7 +407,6 @@ class TimelineEvent { DISALLOW_COPY_AND_ASSIGN(TimelineEvent); }; - #ifndef PRODUCT #define TIMELINE_FUNCTION_COMPILATION_DURATION(thread, name, function) \ TimelineDurationScope tds(thread, Timeline::GetCompilerStream(), name); \ @@ -474,7 +471,6 @@ class TimelineEventScope : public StackResource { DISALLOW_COPY_AND_ASSIGN(TimelineEventScope); }; - class TimelineDurationScope : public TimelineEventScope { public: TimelineDurationScope(TimelineStream* stream, const char* label); @@ -492,7 +488,6 @@ class TimelineDurationScope : public TimelineEventScope { DISALLOW_COPY_AND_ASSIGN(TimelineDurationScope); }; - class TimelineBeginEndScope : public TimelineEventScope { public: TimelineBeginEndScope(TimelineStream* stream, const char* label); @@ -510,7 +505,6 @@ class TimelineBeginEndScope : public TimelineEventScope { DISALLOW_COPY_AND_ASSIGN(TimelineBeginEndScope); }; - // A block of |TimelineEvent|s. Not thread safe. class TimelineEventBlock { public: @@ -590,7 +584,6 @@ class TimelineEventBlock { DISALLOW_COPY_AND_ASSIGN(TimelineEventBlock); }; - class TimelineEventFilter : public ValueObject { public: TimelineEventFilter(int64_t time_origin_micros = -1, @@ -622,7 +615,6 @@ class TimelineEventFilter : public ValueObject { int64_t time_extent_micros_; }; - class IsolateTimelineEventFilter : public TimelineEventFilter { public: explicit IsolateTimelineEventFilter(Dart_Port isolate_id, @@ -645,7 +637,6 @@ class IsolateTimelineEventFilter : public TimelineEventFilter { Dart_Port isolate_id_; }; - // Recorder of |TimelineEvent|s. class TimelineEventRecorder { public: @@ -697,7 +688,6 @@ class TimelineEventRecorder { DISALLOW_COPY_AND_ASSIGN(TimelineEventRecorder); }; - // An abstract recorder that stores events in a buffer of fixed capacity. class TimelineEventFixedBufferRecorder : public TimelineEventRecorder { public: @@ -724,7 +714,6 @@ class TimelineEventFixedBufferRecorder : public TimelineEventRecorder { intptr_t block_cursor_; }; - // A recorder that stores events in a buffer of fixed capacity. When the buffer // is full, new events overwrite old events. class TimelineEventRingRecorder : public TimelineEventFixedBufferRecorder { @@ -739,7 +728,6 @@ class TimelineEventRingRecorder : public TimelineEventFixedBufferRecorder { TimelineEventBlock* GetNewBlockLocked(); }; - // A recorder that writes events to Android Systrace. Events are also stored in // a buffer of fixed capacity. When the buffer is full, new events overwrite // old events. @@ -757,7 +745,6 @@ class TimelineEventSystraceRecorder : public TimelineEventFixedBufferRecorder { int systrace_fd_; }; - #if defined(HOST_OS_FUCHSIA) // A recorder that sends events to Fuchsia's tracing app. Events are also stored // in a buffer of fixed capacity. When the buffer is full, new events overwrite @@ -776,7 +763,6 @@ class TimelineEventFuchsiaRecorder : public TimelineEventFixedBufferRecorder { }; #endif // defined(HOST_OS_FUCHSIA) - // A recorder that stores events in a buffer of fixed capacity. When the buffer // is full, new events are dropped. class TimelineEventStartupRecorder : public TimelineEventFixedBufferRecorder { @@ -791,7 +777,6 @@ class TimelineEventStartupRecorder : public TimelineEventFixedBufferRecorder { TimelineEventBlock* GetNewBlockLocked(); }; - // An abstract recorder that calls |OnEvent| whenever an event is complete. // This should only be used for testing. class TimelineEventCallbackRecorder : public TimelineEventRecorder { @@ -816,7 +801,6 @@ class TimelineEventCallbackRecorder : public TimelineEventRecorder { void CompleteEvent(TimelineEvent* event); }; - // A recorder that stores events in chains of blocks of events. // NOTE: This recorder will continue to allocate blocks until it exhausts // memory. @@ -845,7 +829,6 @@ class TimelineEventEndlessRecorder : public TimelineEventRecorder { friend class TimelineTestHelper; }; - // An iterator for blocks. class TimelineEventBlockIterator { public: @@ -865,7 +848,6 @@ class TimelineEventBlockIterator { TimelineEventRecorder* recorder_; }; - } // namespace dart #endif // RUNTIME_VM_TIMELINE_H_ diff --git a/runtime/vm/timeline_analysis.cc b/runtime/vm/timeline_analysis.cc index 57738ca177f..b0b0e3f325b 100644 --- a/runtime/vm/timeline_analysis.cc +++ b/runtime/vm/timeline_analysis.cc @@ -18,15 +18,12 @@ DECLARE_FLAG(bool, timing); TimelineAnalysisThread::TimelineAnalysisThread(ThreadId id) : id_(id) {} - TimelineAnalysisThread::~TimelineAnalysisThread() {} - void TimelineAnalysisThread::AddBlock(TimelineEventBlock* block) { blocks_.Add(block); } - static int CompareBlocksLowerTimeBound(TimelineEventBlock* const* a, TimelineEventBlock* const* b) { ASSERT(a != NULL); @@ -36,7 +33,6 @@ static int CompareBlocksLowerTimeBound(TimelineEventBlock* const* a, return (*a)->LowerTimeBound() - (*b)->LowerTimeBound(); } - void TimelineAnalysisThread::Finalize() { blocks_.Sort(CompareBlocksLowerTimeBound); if (FLAG_trace_timeline_analysis) { @@ -45,18 +41,15 @@ void TimelineAnalysisThread::Finalize() { } } - TimelineAnalysisThreadEventIterator::TimelineAnalysisThreadEventIterator( TimelineAnalysisThread* thread) { Reset(thread); } - TimelineAnalysisThreadEventIterator::~TimelineAnalysisThreadEventIterator() { Reset(NULL); } - void TimelineAnalysisThreadEventIterator::Reset( TimelineAnalysisThread* thread) { current_ = NULL; @@ -74,12 +67,10 @@ void TimelineAnalysisThreadEventIterator::Reset( current_ = block->At(event_cursor_++); } - bool TimelineAnalysisThreadEventIterator::HasNext() const { return current_ != NULL; } - TimelineEvent* TimelineAnalysisThreadEventIterator::Next() { ASSERT(current_ != NULL); TimelineEvent* r = current_; @@ -102,7 +93,6 @@ TimelineEvent* TimelineAnalysisThreadEventIterator::Next() { return r; } - TimelineAnalysis::TimelineAnalysis(Zone* zone, Isolate* isolate, TimelineEventRecorder* recorder) @@ -116,16 +106,13 @@ TimelineAnalysis::TimelineAnalysis(Zone* zone, ASSERT(recorder_ != NULL); } - TimelineAnalysis::~TimelineAnalysis() {} - void TimelineAnalysis::BuildThreads() { DiscoverThreads(); FinalizeThreads(); } - TimelineAnalysisThread* TimelineAnalysis::GetThread(ThreadId tid) { // Linear lookup because we expect N (# of threads in an isolate) to be small. for (intptr_t i = 0; i < threads_.length(); i++) { @@ -138,7 +125,6 @@ TimelineAnalysisThread* TimelineAnalysis::GetThread(ThreadId tid) { return NULL; } - TimelineAnalysisThread* TimelineAnalysis::GetOrAddThread(ThreadId tid) { TimelineAnalysisThread* thread = GetThread(tid); if (thread != NULL) { @@ -150,7 +136,6 @@ TimelineAnalysisThread* TimelineAnalysis::GetOrAddThread(ThreadId tid) { return thread; } - void TimelineAnalysis::DiscoverThreads() { TimelineEventBlockIterator it(recorder_); while (it.HasNext()) { @@ -179,7 +164,6 @@ void TimelineAnalysis::DiscoverThreads() { } } - void TimelineAnalysis::FinalizeThreads() { for (intptr_t i = 0; i < threads_.length(); i++) { TimelineAnalysisThread* thread = threads_.At(i); @@ -188,7 +172,6 @@ void TimelineAnalysis::FinalizeThreads() { } } - void TimelineAnalysis::SetError(const char* format, ...) { ASSERT(!has_error_); ASSERT(error_msg_ == NULL); @@ -202,7 +185,6 @@ void TimelineAnalysis::SetError(const char* format, ...) { } } - TimelineLabelPauseInfo::TimelineLabelPauseInfo(const char* name) : name_(name), inclusive_micros_(0), @@ -212,17 +194,14 @@ TimelineLabelPauseInfo::TimelineLabelPauseInfo(const char* name) ASSERT(name_ != NULL); } - void TimelineLabelPauseInfo::OnPush(int64_t micros, bool already_on_stack) { UpdateInclusiveMicros(micros, already_on_stack); } - void TimelineLabelPauseInfo::OnPop(int64_t exclusive_micros) { UpdateExclusiveMicros(exclusive_micros); } - void TimelineLabelPauseInfo::OnBeginPop(int64_t inclusive_micros, int64_t exclusive_micros, bool already_on_stack) { @@ -230,7 +209,6 @@ void TimelineLabelPauseInfo::OnBeginPop(int64_t inclusive_micros, UpdateExclusiveMicros(exclusive_micros); } - void TimelineLabelPauseInfo::UpdateInclusiveMicros(int64_t inclusive_micros, bool already_on_stack) { if (!already_on_stack) { @@ -242,7 +220,6 @@ void TimelineLabelPauseInfo::UpdateInclusiveMicros(int64_t inclusive_micros, } } - void TimelineLabelPauseInfo::UpdateExclusiveMicros(int64_t exclusive_micros) { add_exclusive_micros(exclusive_micros); if (exclusive_micros > max_exclusive_micros_) { @@ -250,7 +227,6 @@ void TimelineLabelPauseInfo::UpdateExclusiveMicros(int64_t exclusive_micros) { } } - void TimelineLabelPauseInfo::Aggregate( const TimelineLabelPauseInfo* thread_pause_info) { ASSERT(thread_pause_info != NULL); @@ -264,18 +240,15 @@ void TimelineLabelPauseInfo::Aggregate( } } - TimelinePauses::TimelinePauses(Zone* zone, Isolate* isolate, TimelineEventRecorder* recorder) : TimelineAnalysis(zone, isolate, recorder) {} - void TimelinePauses::Setup() { BuildThreads(); } - void TimelinePauses::CalculatePauseTimesForThread(ThreadId tid) { if (has_error()) { return; @@ -288,7 +261,6 @@ void TimelinePauses::CalculatePauseTimesForThread(ThreadId tid) { ProcessThread(thread); } - TimelineLabelPauseInfo* TimelinePauses::GetLabelPauseInfo( const char* name) const { ASSERT(name != NULL); @@ -302,35 +274,30 @@ TimelineLabelPauseInfo* TimelinePauses::GetLabelPauseInfo( return NULL; } - int64_t TimelinePauses::InclusiveTime(const char* name) const { TimelineLabelPauseInfo* pause_info = GetLabelPauseInfo(name); ASSERT(pause_info != NULL); return pause_info->inclusive_micros(); } - int64_t TimelinePauses::ExclusiveTime(const char* name) const { TimelineLabelPauseInfo* pause_info = GetLabelPauseInfo(name); ASSERT(pause_info != NULL); return pause_info->exclusive_micros(); } - int64_t TimelinePauses::MaxInclusiveTime(const char* name) const { TimelineLabelPauseInfo* pause_info = GetLabelPauseInfo(name); ASSERT(pause_info != NULL); return pause_info->max_inclusive_micros(); } - int64_t TimelinePauses::MaxExclusiveTime(const char* name) const { TimelineLabelPauseInfo* pause_info = GetLabelPauseInfo(name); ASSERT(pause_info != NULL); return pause_info->max_exclusive_micros(); } - void TimelinePauses::ProcessThread(TimelineAnalysisThread* thread) { ASSERT(thread != NULL); stack_.Clear(); @@ -379,7 +346,6 @@ void TimelinePauses::ProcessThread(TimelineAnalysisThread* thread) { } } - // Verify that |event| is contained within all parent events on the stack. bool TimelinePauses::CheckStack(TimelineEvent* event) { ASSERT(event != NULL); @@ -399,7 +365,6 @@ bool TimelinePauses::CheckStack(TimelineEvent* event) { return true; } - void TimelinePauses::PopFinishedDurations(int64_t start) { while (stack_.length() > 0) { const StackItem& top = stack_.Last(); @@ -417,7 +382,6 @@ void TimelinePauses::PopFinishedDurations(int64_t start) { } } - void TimelinePauses::PopBegin(const char* label, int64_t end) { if (stack_.length() == 0) { SetError("PopBegin(%s, ...) called with empty stack.", label); @@ -460,7 +424,6 @@ void TimelinePauses::PopBegin(const char* label, int64_t end) { } } - void TimelinePauses::Push(TimelineEvent* event) { TimelineLabelPauseInfo* pause_info = GetOrAddLabelPauseInfo(event->label()); ASSERT(pause_info != NULL); @@ -494,7 +457,6 @@ void TimelinePauses::Push(TimelineEvent* event) { } } - bool TimelinePauses::IsLabelOnStack(const char* label) const { ASSERT(label != NULL); for (intptr_t i = 0; i < stack_.length(); i++) { @@ -506,18 +468,15 @@ bool TimelinePauses::IsLabelOnStack(const char* label) const { return false; } - intptr_t TimelinePauses::StackDepth() const { return stack_.length(); } - TimelinePauses::StackItem& TimelinePauses::GetStackTop() { ASSERT(stack_.length() > 0); return stack_.Last(); } - TimelineLabelPauseInfo* TimelinePauses::GetOrAddLabelPauseInfo( const char* name) { ASSERT(name != NULL); @@ -531,13 +490,10 @@ TimelineLabelPauseInfo* TimelinePauses::GetOrAddLabelPauseInfo( return pause_info; } - TimelinePauseTrace::TimelinePauseTrace() {} - TimelinePauseTrace::~TimelinePauseTrace() {} - void TimelinePauseTrace::Print() { Thread* thread = Thread::Current(); ASSERT(thread != NULL); @@ -576,7 +532,6 @@ void TimelinePauseTrace::Print() { THR_Print("\n"); } - TimelineLabelPauseInfo* TimelinePauseTrace::GetOrAddLabelPauseInfo( const char* name) { ASSERT(name != NULL); @@ -593,7 +548,6 @@ TimelineLabelPauseInfo* TimelinePauseTrace::GetOrAddLabelPauseInfo( return pause_info; } - void TimelinePauseTrace::Aggregate( const TimelineLabelPauseInfo* thread_pause_info) { ASSERT(thread_pause_info != NULL); @@ -603,7 +557,6 @@ void TimelinePauseTrace::Aggregate( isolate_pause_info->Aggregate(thread_pause_info); } - void TimelinePauseTrace::PrintPauseInfo( const TimelineLabelPauseInfo* pause_info) { ASSERT(pause_info != NULL); diff --git a/runtime/vm/timeline_analysis.h b/runtime/vm/timeline_analysis.h index ca1424b4d65..a4700843fb8 100644 --- a/runtime/vm/timeline_analysis.h +++ b/runtime/vm/timeline_analysis.h @@ -31,7 +31,6 @@ class TimelineAnalysisThread : public ZoneAllocated { friend class TimelineAnalysis; }; - class TimelineAnalysisThreadEventIterator : public ValueObject { public: explicit TimelineAnalysisThreadEventIterator(TimelineAnalysisThread* thread); @@ -50,7 +49,6 @@ class TimelineAnalysisThreadEventIterator : public ValueObject { intptr_t event_cursor_; }; - // Base of all timeline analysis classes. Base functionality: // - discovery of all thread ids in a recording. // - collecting all ThreadEventBlocks by thread id. @@ -90,7 +88,6 @@ class TimelineAnalysis : public ValueObject { ZoneGrowableArray threads_; }; - class TimelineLabelPauseInfo : public ZoneAllocated { public: explicit TimelineLabelPauseInfo(const char* name); @@ -147,7 +144,6 @@ class TimelineLabelPauseInfo : public ZoneAllocated { friend class TimelinePauseTrace; }; - class TimelinePauses : public TimelineAnalysis { public: TimelinePauses(Zone* zone, Isolate* isolate, TimelineEventRecorder* recorder); @@ -190,7 +186,6 @@ class TimelinePauses : public TimelineAnalysis { ZoneGrowableArray labels_; }; - class TimelinePauseTrace : public ValueObject { public: TimelinePauseTrace(); diff --git a/runtime/vm/timeline_test.cc b/runtime/vm/timeline_test.cc index aa2972facc1..1cec65b8e05 100644 --- a/runtime/vm/timeline_test.cc +++ b/runtime/vm/timeline_test.cc @@ -30,7 +30,6 @@ class TimelineRecorderOverride : public ValueObject { TimelineEventRecorder* recorder_; }; - class TimelineTestHelper : public AllStatic { public: static void SetStream(TimelineEvent* event, TimelineStream* stream) { @@ -99,7 +98,6 @@ class TimelineTestHelper : public AllStatic { static void FinishBlock(TimelineEventBlock* block) { block->Finish(); } }; - TEST_CASE(TimelineEventIsValid) { // Create a test stream. TimelineStream stream; @@ -120,7 +118,6 @@ TEST_CASE(TimelineEventIsValid) { EXPECT(!event.IsValid()); } - TEST_CASE(TimelineEventDuration) { // Create a test stream. TimelineStream stream; @@ -137,7 +134,6 @@ TEST_CASE(TimelineEventDuration) { EXPECT_GE(event.TimeDuration(), current_duration); } - TEST_CASE(TimelineEventDurationPrintJSON) { // Create a test stream. TimelineStream stream; @@ -165,7 +161,6 @@ TEST_CASE(TimelineEventDurationPrintJSON) { event.DurationEnd(); } - TEST_CASE(TimelineEventPrintSystrace) { const intptr_t kBufferLength = 1024; char buffer[kBufferLength]; @@ -209,7 +204,6 @@ TEST_CASE(TimelineEventPrintSystrace) { EXPECT_STREQ("", buffer); } - TEST_CASE(TimelineEventArguments) { // Create a test stream. TimelineStream stream; @@ -231,7 +225,6 @@ TEST_CASE(TimelineEventArguments) { event.DurationEnd(); } - TEST_CASE(TimelineEventArgumentsPrintJSON) { // Create a test stream. TimelineStream stream; @@ -258,7 +251,6 @@ TEST_CASE(TimelineEventArgumentsPrintJSON) { } } - TEST_CASE(TimelineEventBufferPrintJSON) { TimelineEventRecorder* recorder = Timeline::recorder(); JSONStream js; @@ -270,7 +262,6 @@ TEST_CASE(TimelineEventBufferPrintJSON) { EXPECT_SUBSTRING("\"traceEvents\":[", js.ToCString()); } - // Count the number of each event type seen. class EventCounterRecorder : public TimelineEventCallbackRecorder { public: @@ -288,7 +279,6 @@ class EventCounterRecorder : public TimelineEventCallbackRecorder { intptr_t counts_[TimelineEvent::kNumEventTypes]; }; - TEST_CASE(TimelineEventCallbackRecorderBasic) { EventCounterRecorder* recorder = new EventCounterRecorder(); TimelineRecorderOverride override(recorder); @@ -347,13 +337,11 @@ TEST_CASE(TimelineEventCallbackRecorderBasic) { delete recorder; } - static bool LabelMatch(TimelineEvent* event, const char* label) { ASSERT(event != NULL); return strcmp(event->label(), label) == 0; } - TEST_CASE(TimelineAnalysis_ThreadBlockCount) { TimelineEventEndlessRecorder* recorder = new TimelineEventEndlessRecorder(); ASSERT(recorder != NULL); @@ -473,7 +461,6 @@ TEST_CASE(TimelineAnalysis_ThreadBlockCount) { delete recorder; } - TEST_CASE(TimelineRingRecorderJSONOrder) { TimelineStream stream; stream.Init("testStream", true); @@ -512,7 +499,6 @@ TEST_CASE(TimelineRingRecorderJSONOrder) { delete recorder; } - TEST_CASE(TimelinePauses_Basic) { TimelineEventEndlessRecorder* recorder = new TimelineEventEndlessRecorder(); ASSERT(recorder != NULL); @@ -686,7 +672,6 @@ TEST_CASE(TimelinePauses_Basic) { delete recorder; } - TEST_CASE(TimelinePauses_BeginEnd) { TimelineEventEndlessRecorder* recorder = new TimelineEventEndlessRecorder(); ASSERT(recorder != NULL); diff --git a/runtime/vm/timer.cc b/runtime/vm/timer.cc index 94835e9e462..4757a5e5a00 100644 --- a/runtime/vm/timer.cc +++ b/runtime/vm/timer.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "platform/globals.h" #include "vm/timer.h" +#include "platform/globals.h" #include "vm/json_stream.h" namespace dart {} // namespace dart diff --git a/runtime/vm/timer.h b/runtime/vm/timer.h index ac2e7a097e3..2f5ce4699f8 100644 --- a/runtime/vm/timer.h +++ b/runtime/vm/timer.h @@ -98,7 +98,6 @@ class Timer : public ValueObject { DISALLOW_COPY_AND_ASSIGN(Timer); }; - // The class TimerScope is used to start and stop a timer within a scope. // It is used as follows: // { @@ -139,7 +138,6 @@ class TimerScope : public StackResource { DISALLOW_COPY_AND_ASSIGN(TimerScope); }; - class PauseTimerScope : public StackResource { public: PauseTimerScope(bool flag, Timer* timer, Thread* thread = NULL) @@ -168,7 +166,6 @@ class PauseTimerScope : public StackResource { DISALLOW_COPY_AND_ASSIGN(PauseTimerScope); }; - } // namespace dart #endif // RUNTIME_VM_TIMER_H_ diff --git a/runtime/vm/token.cc b/runtime/vm/token.cc index 5109177efba..303848612bd 100644 --- a/runtime/vm/token.cc +++ b/runtime/vm/token.cc @@ -28,7 +28,6 @@ const Token::Attribute Token::attributes_[] = { DART_TOKEN_LIST(TOKEN_ATTRIBUTE) DART_KEYWORD_LIST(TOKEN_ATTRIBUTE)}; #undef TOKEN_ATTRIBUTE - bool Token::IsBinaryOperator(Token::Kind token) { switch (token) { case Token::kOR: @@ -39,12 +38,10 @@ bool Token::IsBinaryOperator(Token::Kind token) { } } - bool Token::IsUnaryOperator(Token::Kind token) { return (token == kNOT) || IsUnaryArithmeticOperator(token); } - bool Token::IsBinaryArithmeticOperator(Token::Kind token) { switch (token) { case Token::kADD: @@ -64,12 +61,10 @@ bool Token::IsBinaryArithmeticOperator(Token::Kind token) { } } - bool Token::IsUnaryArithmeticOperator(Token::Kind token) { return (token == kBIT_NOT) || (token == kNEGATE); } - bool Token::IsBinaryBitwiseOperator(Token::Kind token) { switch (token) { case Token::kBIT_OR: diff --git a/runtime/vm/token.h b/runtime/vm/token.h index a10879651fc..fc4eccab66c 100644 --- a/runtime/vm/token.h +++ b/runtime/vm/token.h @@ -27,7 +27,6 @@ namespace dart { // 2 assignment = *= /= ~/= %= += -= <<= >>= &= ^= |= ??= // 1 comma , - // Token definitions. // Some operator tokens appear in blocks, e.g. assignment operators. // There is code that depends on the values within a block to be diff --git a/runtime/vm/token_position.cc b/runtime/vm/token_position.cc index cfda6af70b0..b94ddffddf3 100644 --- a/runtime/vm/token_position.cc +++ b/runtime/vm/token_position.cc @@ -8,17 +8,14 @@ namespace dart { - TokenPosition TokenPosition::SnapshotDecode(int32_t value) { return TokenPosition(static_cast(value)); } - int32_t TokenPosition::SnapshotEncode() { return static_cast(value_); } - bool TokenPosition::IsSynthetic() const { if (value_ >= kMinSourcePos) { return false; @@ -29,7 +26,6 @@ bool TokenPosition::IsSynthetic() const { return false; } - #define DEFINE_VALUES(name, value) \ const TokenPosition TokenPosition::k##name = TokenPosition(value); SENTINEL_TOKEN_DESCRIPTORS(DEFINE_VALUES); @@ -38,7 +34,6 @@ const TokenPosition TokenPosition::kMinSource = TokenPosition(kMinSourcePos); const TokenPosition TokenPosition::kMaxSource = TokenPosition(kMaxSourcePos); - const char* TokenPosition::ToCString() const { switch (value_) { #define DEFINE_CASE(name, value) \ diff --git a/runtime/vm/type_table.h b/runtime/vm/type_table.h index 6541d20183f..518491b758e 100644 --- a/runtime/vm/type_table.h +++ b/runtime/vm/type_table.h @@ -22,7 +22,6 @@ class CanonicalTypeKey { DISALLOW_ALLOCATION(); }; - // Traits for looking up Canonical Type based on it's hash. class CanonicalTypeTraits { public: @@ -51,7 +50,6 @@ class CanonicalTypeTraits { }; typedef UnorderedHashSet CanonicalTypeSet; - class CanonicalTypeArgumentsKey { public: explicit CanonicalTypeArgumentsKey(const TypeArguments& key) : key_(key) {} @@ -65,7 +63,6 @@ class CanonicalTypeArgumentsKey { DISALLOW_ALLOCATION(); }; - // Traits for looking up Canonical TypeArguments based on its hash. class CanonicalTypeArgumentsTraits { public: diff --git a/runtime/vm/unibrow.cc b/runtime/vm/unibrow.cc index e39a6d3b96b..4dbb507ad34 100644 --- a/runtime/vm/unibrow.cc +++ b/runtime/vm/unibrow.cc @@ -4,8 +4,8 @@ // // This file was generated at 2014-10-08 15:25:47.940335 (in v8, copied to dart) -#include "vm/unibrow-inl.h" #include "vm/unibrow.h" +#include "vm/unibrow-inl.h" #include #include @@ -27,17 +27,14 @@ static inline int32_t TableGet(const int32_t* table, intptr_t index) { return table[D * index]; } - static inline int32_t GetEntry(int32_t entry) { return entry & (kStartBit - 1); } - static inline bool IsStart(int32_t entry) { return (entry & kStartBit) != 0; } - /** * Look up a character in the unicode table using a mix of binary and * interpolation search. For a uniformly distributed array @@ -84,7 +81,6 @@ struct MultiCharacterSpecialCase { int32_t chars[kW]; }; - // Look up the mapping for the given character in the specified table, // which is of the specified length and uses the specified special case // mapping for multi-char mappings. The next parameter is the character @@ -186,7 +182,6 @@ static intptr_t LookupMapping(const int32_t* table, } } - // Letter: point.category in ['Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl'] // clang-format off static const uint16_t kLetterTable0Size = 431; diff --git a/runtime/vm/unicode.cc b/runtime/vm/unicode.cc index f2715747a0d..e9cd1010260 100644 --- a/runtime/vm/unicode.cc +++ b/runtime/vm/unicode.cc @@ -35,13 +35,11 @@ const uint32_t Utf8::kMagicBits[7] = {0, // Padding. 0x00000000, 0x00003080, 0x000E2080, 0x03C82080, 0xFA082080, 0x82082080}; - // Minimum values of code points used to check shortest form. const uint32_t Utf8::kOverlongMinimum[7] = {0, // Padding. 0x0, 0x80, 0x800, 0x10000, 0xFFFFFFFF, 0xFFFFFFFF}; - // Returns the most restricted coding form in which the sequence of utf8 // characters in 'utf8_array' can be represented in, and the number of // code units needed in that form. @@ -68,7 +66,6 @@ intptr_t Utf8::CodeUnitCount(const uint8_t* utf8_array, return len; } - // Returns true if str is a valid NUL-terminated UTF-8 string. bool Utf8::IsValid(const uint8_t* utf8_array, intptr_t array_len) { intptr_t i = 0; @@ -98,7 +95,6 @@ bool Utf8::IsValid(const uint8_t* utf8_array, intptr_t array_len) { return true; } - intptr_t Utf8::Length(int32_t ch) { if (ch <= kMaxOneByteChar) { return 1; @@ -111,7 +107,6 @@ intptr_t Utf8::Length(int32_t ch) { return 4; } - intptr_t Utf8::Length(const String& str) { intptr_t length = 0; String::CodePointIterator it(str); @@ -122,7 +117,6 @@ intptr_t Utf8::Length(const String& str) { return length; } - intptr_t Utf8::Encode(int32_t ch, char* dst) { static const int kMask = ~(1 << 6); if (ch <= kMaxOneByteChar) { @@ -148,7 +142,6 @@ intptr_t Utf8::Encode(int32_t ch, char* dst) { return 4; } - intptr_t Utf8::Encode(const String& src, char* dst, intptr_t len) { intptr_t pos = 0; String::CodePointIterator it(src); @@ -164,7 +157,6 @@ intptr_t Utf8::Encode(const String& src, char* dst, intptr_t len) { return pos; } - intptr_t Utf8::Decode(const uint8_t* utf8_array, intptr_t array_len, int32_t* dst) { @@ -194,7 +186,6 @@ intptr_t Utf8::Decode(const uint8_t* utf8_array, return i; } - bool Utf8::DecodeToLatin1(const uint8_t* utf8_array, intptr_t array_len, uint8_t* dst, @@ -218,7 +209,6 @@ bool Utf8::DecodeToLatin1(const uint8_t* utf8_array, return true; // Success. } - bool Utf8::DecodeToUTF16(const uint8_t* utf8_array, intptr_t array_len, uint16_t* dst, @@ -246,7 +236,6 @@ bool Utf8::DecodeToUTF16(const uint8_t* utf8_array, return true; // Success. } - bool Utf8::DecodeToUTF32(const uint8_t* utf8_array, intptr_t array_len, int32_t* dst, @@ -268,7 +257,6 @@ bool Utf8::DecodeToUTF32(const uint8_t* utf8_array, return true; // Success. } - bool Utf8::DecodeCStringToUTF32(const char* str, int32_t* dst, intptr_t len) { ASSERT(str != NULL); intptr_t array_len = strlen(str); @@ -276,7 +264,6 @@ bool Utf8::DecodeCStringToUTF32(const char* str, int32_t* dst, intptr_t len) { return Utf8::DecodeToUTF32(utf8_array, array_len, dst, len); } - void Utf16::Encode(int32_t codepoint, uint16_t* dst) { ASSERT(codepoint > Utf16::kMaxCodeUnit); ASSERT(dst != NULL); diff --git a/runtime/vm/unicode.h b/runtime/vm/unicode.h index 511686381f0..23b64b7bac5 100644 --- a/runtime/vm/unicode.h +++ b/runtime/vm/unicode.h @@ -34,7 +34,6 @@ class Utf : AllStatic { } }; - class Utf8 : AllStatic { public: enum Type { @@ -106,7 +105,6 @@ class Utf8 : AllStatic { static const uint32_t kOverlongMinimum[]; }; - class Utf16 : AllStatic { public: // Returns the length of the code point in UTF-16 code units. @@ -158,7 +156,6 @@ class Utf16 : AllStatic { static const int32_t kSurrogateOffset = (0x10000 - (0xD800 << 10) - 0xDC00); }; - class CaseMapping : AllStatic { public: // Maps a code point to uppercase. diff --git a/runtime/vm/unicode_test.cc b/runtime/vm/unicode_test.cc index c8f6a26bf1b..f2ce998d646 100644 --- a/runtime/vm/unicode_test.cc +++ b/runtime/vm/unicode_test.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "vm/globals.h" #include "vm/unicode.h" +#include "vm/globals.h" #include "vm/unit_test.h" namespace dart { diff --git a/runtime/vm/unit_test.cc b/runtime/vm/unit_test.cc index 4c25bc823dc..ebf5fb2e197 100644 --- a/runtime/vm/unit_test.cc +++ b/runtime/vm/unit_test.cc @@ -33,7 +33,6 @@ DECLARE_FLAG(bool, use_dart_frontend); TestCaseBase* TestCaseBase::first_ = NULL; TestCaseBase* TestCaseBase::tail_ = NULL; - TestCaseBase::TestCaseBase(const char* name) : raw_test_(false), next_(NULL), name_(name) { if (first_ == NULL) { @@ -44,7 +43,6 @@ TestCaseBase::TestCaseBase(const char* name) tail_ = this; } - void TestCaseBase::RunAllRaw() { TestCaseBase* test = first_; while (test != NULL) { @@ -55,7 +53,6 @@ void TestCaseBase::RunAllRaw() { } } - void TestCaseBase::RunAll() { TestCaseBase* test = first_; while (test != NULL) { @@ -66,7 +63,6 @@ void TestCaseBase::RunAll() { } } - Dart_Isolate TestCase::CreateIsolate(const uint8_t* buffer, const char* name) { char* err; Dart_Isolate isolate = @@ -79,25 +75,20 @@ Dart_Isolate TestCase::CreateIsolate(const uint8_t* buffer, const char* name) { return isolate; } - static const char* kPackageScheme = "package:"; - static bool IsPackageSchemeURL(const char* url_name) { static const intptr_t kPackageSchemeLen = strlen(kPackageScheme); return (strncmp(url_name, kPackageScheme, kPackageSchemeLen) == 0); } - struct TestLibEntry { const char* url; const char* source; }; - static MallocGrowableArray* test_libs_ = NULL; - void TestCase::AddTestLib(const char* url, const char* source) { if (test_libs_ == NULL) { test_libs_ = new MallocGrowableArray(); @@ -115,7 +106,6 @@ void TestCase::AddTestLib(const char* url, const char* source) { test_libs_->Add(entry); } - const char* TestCase::GetTestLib(const char* url) { if (test_libs_ == NULL) { return NULL; @@ -137,18 +127,15 @@ static bool IsIsolateReloadTestLib(const char* url_name) { kIsolateReloadTestLibUriLen) == 0); } - static Dart_Handle IsolateReloadTestLibSource() { // Special library with one function. return DartUtils::NewString("void reloadTest() native 'Reload_Test';\n"); } - static void ReloadTest(Dart_NativeArguments native_args) { DART_CHECK_VALID(TestCase::TriggerReload()); } - static Dart_NativeFunction IsolateReloadTestNativeResolver( Dart_Handle name, int num_of_arguments, @@ -157,7 +144,6 @@ static Dart_NativeFunction IsolateReloadTestNativeResolver( } #endif // !PRODUCT - static Dart_Handle ResolvePackageUri(const char* uri_chars) { const int kNumArgs = 1; Dart_Handle dart_args[kNumArgs]; @@ -167,7 +153,6 @@ static Dart_Handle ResolvePackageUri(const char* uri_chars) { dart_args); } - static ThreadLocalKey script_reload_key = kUnsetThreadLocalKey; static char* CompileTestScriptWithDFE(const char* url, @@ -369,7 +354,6 @@ Dart_Handle TestCase::LoadTestScript(const char* script, #ifndef PRODUCT - void TestCase::SetReloadTestScript(const char* script) { if (script_reload_key == kUnsetThreadLocalKey) { script_reload_key = OSThread::CreateThreadLocal(); @@ -380,7 +364,6 @@ void TestCase::SetReloadTestScript(const char* script) { OSThread::SetThreadLocal(script_reload_key, reinterpret_cast(script)); } - Dart_Handle TestCase::TriggerReload() { Isolate* isolate = Isolate::Current(); JSONStream js; @@ -401,7 +384,6 @@ Dart_Handle TestCase::TriggerReload() { } } - Dart_Handle TestCase::GetReloadErrorOrRootLibrary() { Isolate* isolate = Isolate::Current(); @@ -414,7 +396,6 @@ Dart_Handle TestCase::GetReloadErrorOrRootLibrary() { return Dart_RootLibrary(); } - Dart_Handle TestCase::ReloadTestScript(const char* script) { SetReloadTestScript(script); @@ -437,16 +418,13 @@ Dart_Handle TestCase::ReloadTestScript(const char* script) { return result; } - #endif // !PRODUCT - Dart_Handle TestCase::LoadCoreTestScript(const char* script, Dart_NativeEntryResolver resolver) { return LoadTestScript(script, resolver, CORELIB_TEST_URI); } - Dart_Handle TestCase::lib() { Dart_Handle url = NewString(TestCase::url()); Dart_Handle lib = Dart_LookupLibrary(url); @@ -455,7 +433,6 @@ Dart_Handle TestCase::lib() { return lib; } - Dart_Handle TestCase::library_handler(Dart_LibraryTag tag, Dart_Handle library, Dart_Handle url) { @@ -465,12 +442,10 @@ Dart_Handle TestCase::library_handler(Dart_LibraryTag tag, return Api::Success(); } - char* TestCase::BigintToHexValue(Dart_CObject* bigint) { return bin::CObject::BigintToHexValue(bigint); } - void AssemblerTest::Assemble() { const String& function_name = String::ZoneHandle(Symbols::New(Thread::Current(), name_)); @@ -503,7 +478,6 @@ void AssemblerTest::Assemble() { #endif // !PRODUCT } - CodeGenTest::CodeGenTest(const char* name) : function_(Function::ZoneHandle()), node_sequence_(new SequenceNode(TokenPosition::kMinSource, @@ -527,7 +501,6 @@ CodeGenTest::CodeGenTest(const char* name) lib.AddClass(cls); } - void CodeGenTest::Compile() { if (function_.HasCode()) return; ParsedFunction* parsed_function = @@ -543,7 +516,6 @@ void CodeGenTest::Compile() { EXPECT(error.IsNull()); } - bool CompilerTest::TestCompileScript(const Library& library, const Script& script) { Isolate* isolate = Isolate::Current(); @@ -555,7 +527,6 @@ bool CompilerTest::TestCompileScript(const Library& library, return error.IsNull(); } - bool CompilerTest::TestCompileFunction(const Function& function) { Thread* thread = Thread::Current(); ASSERT(thread != NULL); @@ -565,7 +536,6 @@ bool CompilerTest::TestCompileFunction(const Function& function) { return result.IsCode(); } - void ElideJSONSubstring(const char* prefix, const char* in, char* out) { const char* pos = strstr(in, prefix); while (pos != NULL) { @@ -585,5 +555,4 @@ void ElideJSONSubstring(const char* prefix, const char* in, char* out) { *out = '\0'; } - } // namespace dart diff --git a/runtime/vm/unit_test.h b/runtime/vm/unit_test.h index bb275c231e0..ab2d1fecc1b 100644 --- a/runtime/vm/unit_test.h +++ b/runtime/vm/unit_test.h @@ -104,7 +104,6 @@ static void CodeGenTestGenerate##name(const Function& function, \ CodeGenTest* test) - // Pass the name of test and the expected results as RawObject. #define CODEGEN_TEST_RUN(name, expected) \ static void CodeGenTestRun##name(const Function& function); \ @@ -123,7 +122,6 @@ EXPECT(actual.CanonicalizeEquals(Instance::Handle(expected))); \ } - // Pass the name of test, and use the generated function to call it // and evaluate its result. #define CODEGEN_TEST_RAW_RUN(name, function) \ @@ -136,7 +134,6 @@ } \ static void CodeGenTestRun##name(const Function& function) - // Generate code for two sequences of AST nodes and execute the first one. // The first one may reference the Function object generated by the second one. #define CODEGEN_TEST2_RUN(name1, name2, expected) \ @@ -161,7 +158,6 @@ EXPECT(actual.CanonicalizeEquals(Instance::Handle(expected))); \ } - #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_ARM64) #if defined(HOST_ARCH_ARM) || defined(HOST_ARCH_ARM64) // Running on actual ARM hardware, execute code natively. @@ -233,12 +229,10 @@ #endif // defined(HOST_ARCH_ARM) #endif // defined(TARGET_ARCH_{ARM, ARM64}) - inline Dart_Handle NewString(const char* str) { return Dart_NewStringFromCString(str); } - namespace dart { // Forward declarations. @@ -246,15 +240,13 @@ class Assembler; class CodeGenerator; class VirtualMemory; - namespace bin { // Snapshot pieces if we link in a snapshot, otherwise initialized to NULL. extern const uint8_t* vm_snapshot_data; extern const uint8_t* vm_snapshot_instructions; extern const uint8_t* core_isolate_snapshot_data; extern const uint8_t* core_isolate_snapshot_instructions; -} - +} // namespace bin class TestCaseBase { public: @@ -332,7 +324,6 @@ class TestCase : TestCaseBase { RunEntry* const run_; }; - class RawTestCase : TestCaseBase { public: typedef void(RunEntry)(); @@ -346,7 +337,6 @@ class RawTestCase : TestCaseBase { RunEntry* const run_; }; - class TestIsolateScope { public: TestIsolateScope() { @@ -367,31 +357,26 @@ class TestIsolateScope { DISALLOW_COPY_AND_ASSIGN(TestIsolateScope); }; - template struct is_void { static const bool value = false; }; - template <> struct is_void { static const bool value = true; }; - template struct is_double { static const bool value = false; }; - template <> struct is_double { static const bool value = true; }; - class AssemblerTest { public: AssemblerTest(const char* name, Assembler* assembler) @@ -524,7 +509,6 @@ class AssemblerTest { DISALLOW_COPY_AND_ASSIGN(AssemblerTest); }; - class CodeGenTest { public: explicit CodeGenTest(const char* name); @@ -550,7 +534,6 @@ class CodeGenTest { DISALLOW_COPY_AND_ASSIGN(CodeGenTest); }; - class CompilerTest : public AllStatic { public: // Test the Compiler::CompileScript functionality by checking the return @@ -613,7 +596,6 @@ class CompilerTest : public AllStatic { } \ } while (0) - // Elide a substring which starts with some prefix and ends with a ". // // This is used to remove non-deterministic or fragile substrings from @@ -630,7 +612,6 @@ class CompilerTest : public AllStatic { // void ElideJSONSubstring(const char* prefix, const char* in, char* out); - template class SetFlagScope : public ValueObject { public: diff --git a/runtime/vm/uri.cc b/runtime/vm/uri.cc index 6b8c9c47fbc..0e93b570b86 100644 --- a/runtime/vm/uri.cc +++ b/runtime/vm/uri.cc @@ -14,7 +14,6 @@ static bool IsUnreservedChar(intptr_t value) { value == '_' || value == '~'); } - static bool IsDelimiter(intptr_t value) { switch (value) { case ':': @@ -41,13 +40,11 @@ static bool IsDelimiter(intptr_t value) { } } - static bool IsHexDigit(char value) { return ((value >= '0' && value <= '9') || (value >= 'A' && value <= 'F') || (value >= 'a' && value <= 'f')); } - static int HexValue(char digit) { if ((digit >= '0' && digit <= '9')) { return digit - '0'; @@ -62,7 +59,6 @@ static int HexValue(char digit) { return 0; } - static int GetEscapedValue(const char* str, intptr_t pos, intptr_t len) { if (pos + 2 >= len) { // Not enough room for a valid escape sequence. @@ -82,7 +78,6 @@ static int GetEscapedValue(const char* str, intptr_t pos, intptr_t len) { return HexValue(digit1) * 16 + HexValue(digit2); } - static char* NormalizeEscapes(const char* str, intptr_t len) { // Allocate the buffer. Zone* zone = Thread::Current()->zone(); @@ -129,7 +124,6 @@ static char* NormalizeEscapes(const char* str, intptr_t len) { return buffer; } - // Lower-case a string in place. static void StringLower(char* str) { const intptr_t len = strlen(str); @@ -151,7 +145,6 @@ static void StringLower(char* str) { } } - static void ClearParsedUri(ParsedUri* parsed_uri) { parsed_uri->scheme = NULL; parsed_uri->userinfo = NULL; @@ -162,7 +155,6 @@ static void ClearParsedUri(ParsedUri* parsed_uri) { parsed_uri->fragment = NULL; } - static intptr_t ParseAuthority(const char* authority, ParsedUri* parsed_uri) { Zone* zone = Thread::Current()->zone(); const char* current = authority; @@ -196,7 +188,6 @@ static intptr_t ParseAuthority(const char* authority, ParsedUri* parsed_uri) { return len; } - // Performs a simple parse of a uri into its components. // See RFC 3986 Section 3: Syntax. bool ParseUri(const char* uri, ParsedUri* parsed_uri) { @@ -259,7 +250,6 @@ bool ParseUri(const char* uri, ParsedUri* parsed_uri) { return true; } - static char* RemoveLastSegment(char* current, char* base) { if (current == base) { return current; @@ -275,7 +265,6 @@ static char* RemoveLastSegment(char* current, char* base) { return current; } - static intptr_t SegmentLength(const char* input) { const char* cp = input; @@ -289,7 +278,6 @@ static intptr_t SegmentLength(const char* input) { return cp - input; } - // See RFC 3986 Section 5.2.4: Remove Dot Segments. static const char* RemoveDotSegments(const char* path) { const char* input = path; @@ -352,7 +340,6 @@ static const char* RemoveDotSegments(const char* path) { return buffer; } - // See RFC 3986 Section 5.2.3: Merge Paths. static const char* MergePaths(const char* base_path, const char* ref_path) { Zone* zone = Thread::Current()->zone(); @@ -390,7 +377,6 @@ static const char* MergePaths(const char* base_path, const char* ref_path) { return buffer; } - static char* BuildUri(const ParsedUri& uri) { Zone* zone = Thread::Current()->zone(); ASSERT(uri.path != NULL); @@ -436,7 +422,6 @@ static char* BuildUri(const ParsedUri& uri) { fragment); } - // See RFC 3986 Section 5: Reference Resolution bool ResolveUri(const char* ref_uri, const char* base_uri, diff --git a/runtime/vm/uri_test.cc b/runtime/vm/uri_test.cc index 14f26fbb444..6c2bdd0a063 100644 --- a/runtime/vm/uri_test.cc +++ b/runtime/vm/uri_test.cc @@ -19,7 +19,6 @@ TEST_CASE(ParseUri_WithScheme_NoQueryNoUser) { EXPECT(uri.fragment == NULL); } - TEST_CASE(ParseUri_WithScheme_WithQuery) { ParsedUri uri; EXPECT(ParseUri("foo://example.com:8042/over/there?name=ferret", &uri)); @@ -32,7 +31,6 @@ TEST_CASE(ParseUri_WithScheme_WithQuery) { EXPECT(uri.fragment == NULL); } - TEST_CASE(ParseUri_WithScheme_WithFragment) { ParsedUri uri; EXPECT(ParseUri("foo://example.com:8042/over/there#fragment", &uri)); @@ -45,7 +43,6 @@ TEST_CASE(ParseUri_WithScheme_WithFragment) { EXPECT_STREQ("fragment", uri.fragment); } - TEST_CASE(ParseUri_WithScheme_WithQueryWithFragment) { ParsedUri uri; EXPECT( @@ -59,7 +56,6 @@ TEST_CASE(ParseUri_WithScheme_WithQueryWithFragment) { EXPECT_STREQ("fragment", uri.fragment); } - TEST_CASE(ParseUri_WithScheme_WithUser) { ParsedUri uri; EXPECT(ParseUri("foo://user@example.com:8042/over/there", &uri)); @@ -72,7 +68,6 @@ TEST_CASE(ParseUri_WithScheme_WithUser) { EXPECT(uri.fragment == NULL); } - TEST_CASE(ParseUri_WithScheme_ShortPath) { ParsedUri uri; EXPECT(ParseUri("foo://example.com:8042/", &uri)); @@ -85,7 +80,6 @@ TEST_CASE(ParseUri_WithScheme_ShortPath) { EXPECT(uri.fragment == NULL); } - TEST_CASE(ParseUri_WithScheme_EmptyPath) { ParsedUri uri; EXPECT(ParseUri("foo://example.com:8042", &uri)); @@ -98,7 +92,6 @@ TEST_CASE(ParseUri_WithScheme_EmptyPath) { EXPECT(uri.fragment == NULL); } - TEST_CASE(ParseUri_WithScheme_Rootless1) { ParsedUri uri; EXPECT(ParseUri("foo:here", &uri)); @@ -111,7 +104,6 @@ TEST_CASE(ParseUri_WithScheme_Rootless1) { EXPECT(uri.fragment == NULL); } - TEST_CASE(ParseUri_WithScheme_Rootless2) { ParsedUri uri; EXPECT(ParseUri("foo:or/here", &uri)); @@ -124,7 +116,6 @@ TEST_CASE(ParseUri_WithScheme_Rootless2) { EXPECT(uri.fragment == NULL); } - TEST_CASE(ParseUri_NoScheme_AbsPath_WithAuthority) { ParsedUri uri; EXPECT(ParseUri("//example.com:8042/over/there", &uri)); @@ -137,7 +128,6 @@ TEST_CASE(ParseUri_NoScheme_AbsPath_WithAuthority) { EXPECT(uri.fragment == NULL); } - TEST_CASE(ParseUri_NoScheme_AbsPath_NoAuthority) { ParsedUri uri; EXPECT(ParseUri("/over/there", &uri)); @@ -150,7 +140,6 @@ TEST_CASE(ParseUri_NoScheme_AbsPath_NoAuthority) { EXPECT(uri.fragment == NULL); } - // Colons are permitted in path segments, in many cases. TEST_CASE(ParseUri_NoScheme_AbsPath_StrayColon) { ParsedUri uri; @@ -163,7 +152,6 @@ TEST_CASE(ParseUri_NoScheme_AbsPath_StrayColon) { EXPECT(uri.query == NULL); } - TEST_CASE(ParseUri_NoScheme_Rootless1) { ParsedUri uri; EXPECT(ParseUri("here", &uri)); @@ -176,7 +164,6 @@ TEST_CASE(ParseUri_NoScheme_Rootless1) { EXPECT(uri.fragment == NULL); } - TEST_CASE(ParseUri_NoScheme_Rootless2) { ParsedUri uri; EXPECT(ParseUri("or/here", &uri)); @@ -189,7 +176,6 @@ TEST_CASE(ParseUri_NoScheme_Rootless2) { EXPECT(uri.fragment == NULL); } - TEST_CASE(ParseUri_NoScheme_Empty) { ParsedUri uri; EXPECT(ParseUri("", &uri)); @@ -202,7 +188,6 @@ TEST_CASE(ParseUri_NoScheme_Empty) { EXPECT(uri.fragment == NULL); } - TEST_CASE(ParseUri_NoScheme_QueryOnly) { ParsedUri uri; EXPECT(ParseUri("?name=ferret", &uri)); @@ -215,7 +200,6 @@ TEST_CASE(ParseUri_NoScheme_QueryOnly) { EXPECT(uri.fragment == NULL); } - TEST_CASE(ParseUri_NoScheme_FragmentOnly) { ParsedUri uri; EXPECT(ParseUri("#fragment", &uri)); @@ -228,7 +212,6 @@ TEST_CASE(ParseUri_NoScheme_FragmentOnly) { EXPECT_STREQ("fragment", uri.fragment); } - TEST_CASE(ParseUri_LowerCaseScheme) { ParsedUri uri; EXPECT(ParseUri("ScHeMe:path", &uri)); @@ -241,7 +224,6 @@ TEST_CASE(ParseUri_LowerCaseScheme) { EXPECT(uri.fragment == NULL); } - TEST_CASE(ParseUri_NormalizeEscapes_PathQueryFragment) { ParsedUri uri; EXPECT(ParseUri("scheme:/This%09Is A P%61th?This%09Is A Qu%65ry#A Fr%61gment", @@ -255,7 +237,6 @@ TEST_CASE(ParseUri_NormalizeEscapes_PathQueryFragment) { EXPECT_STREQ("A%20Fragment", uri.fragment); } - TEST_CASE(ParseUri_NormalizeEscapes_UppercaseEscapesPreferred) { ParsedUri uri; EXPECT(ParseUri("scheme:/%1b%1B", &uri)); @@ -268,7 +249,6 @@ TEST_CASE(ParseUri_NormalizeEscapes_UppercaseEscapesPreferred) { EXPECT(uri.fragment == NULL); } - TEST_CASE(ParseUri_NormalizeEscapes_Authority) { ParsedUri uri; EXPECT(ParseUri("scheme://UsEr N%61%4de@h%4FsT.c%6fm:80/", &uri)); @@ -281,7 +261,6 @@ TEST_CASE(ParseUri_NormalizeEscapes_Authority) { EXPECT(uri.fragment == NULL); } - TEST_CASE(ParseUri_NormalizeEscapes_UppercaseEscapeInHost) { ParsedUri uri; EXPECT(ParseUri("scheme://tEst%1b/", &uri)); @@ -294,7 +273,6 @@ TEST_CASE(ParseUri_NormalizeEscapes_UppercaseEscapeInHost) { EXPECT(uri.fragment == NULL); } - TEST_CASE(ParseUri_BrokenEscapeSequence) { ParsedUri uri; EXPECT(ParseUri("scheme:/%1g", &uri)); @@ -307,7 +285,6 @@ TEST_CASE(ParseUri_BrokenEscapeSequence) { EXPECT(uri.fragment == NULL); } - TEST_CASE(ResolveUri_WithScheme_NoAuthorityNoQuery) { const char* target_uri; EXPECT(ResolveUri("rscheme:/ref/path", @@ -316,7 +293,6 @@ TEST_CASE(ResolveUri_WithScheme_NoAuthorityNoQuery) { EXPECT_STREQ("rscheme:/ref/path", target_uri); } - TEST_CASE(ResolveUri_WithScheme_WithAuthorityWithQuery) { const char* target_uri; EXPECT(ResolveUri("rscheme://ruser@rhost:22/ref/path?refQuery", @@ -325,7 +301,6 @@ TEST_CASE(ResolveUri_WithScheme_WithAuthorityWithQuery) { EXPECT_STREQ("rscheme://ruser@rhost:22/ref/path?refQuery", target_uri); } - TEST_CASE(ResolveUri_NoScheme_WithAuthority) { const char* target_uri; EXPECT(ResolveUri("//ruser@rhost:22/ref/path", @@ -334,7 +309,6 @@ TEST_CASE(ResolveUri_NoScheme_WithAuthority) { EXPECT_STREQ("bscheme://ruser@rhost:22/ref/path", target_uri); } - TEST_CASE(ResolveUri_NoSchemeNoAuthority_AbsolutePath) { const char* target_uri; EXPECT(ResolveUri("/ref/path", "bscheme://buser@bhost:11/base/path?baseQuery", @@ -342,7 +316,6 @@ TEST_CASE(ResolveUri_NoSchemeNoAuthority_AbsolutePath) { EXPECT_STREQ("bscheme://buser@bhost:11/ref/path", target_uri); } - TEST_CASE(ResolveUri_NoSchemeNoAuthority_RelativePath) { const char* target_uri; EXPECT(ResolveUri("ref/path", "bscheme://buser@bhost:11/base/path?baseQuery", @@ -350,21 +323,18 @@ TEST_CASE(ResolveUri_NoSchemeNoAuthority_RelativePath) { EXPECT_STREQ("bscheme://buser@bhost:11/base/ref/path", target_uri); } - TEST_CASE(ResolveUri_NoSchemeNoAuthority_RelativePathEmptyBasePath) { const char* target_uri; EXPECT(ResolveUri("ref/path", "bscheme://buser@bhost:11", &target_uri)); EXPECT_STREQ("bscheme://buser@bhost:11/ref/path", target_uri); } - TEST_CASE(ResolveUri_NoSchemeNoAuthority_RelativePathWeirdBasePath) { const char* target_uri; EXPECT(ResolveUri("ref/path", "bscheme:base", &target_uri)); EXPECT_STREQ("bscheme:ref/path", target_uri); } - TEST_CASE(ResolveUri_NoSchemeNoAuthority_EmptyPath) { const char* target_uri; EXPECT(ResolveUri("", @@ -374,7 +344,6 @@ TEST_CASE(ResolveUri_NoSchemeNoAuthority_EmptyPath) { EXPECT_STREQ("bscheme://buser@bhost:11/base/path?baseQuery", target_uri); } - TEST_CASE(ResolveUri_NoSchemeNoAuthority_EmptyPathWithQuery) { const char* target_uri; EXPECT(ResolveUri("?refQuery", @@ -383,7 +352,6 @@ TEST_CASE(ResolveUri_NoSchemeNoAuthority_EmptyPathWithQuery) { EXPECT_STREQ("bscheme://buser@bhost:11/base/path?refQuery", target_uri); } - TEST_CASE(ResolveUri_NoSchemeNoAuthority_EmptyPathWithFragment) { const char* target_uri; EXPECT(ResolveUri("#rfragment", @@ -393,35 +361,30 @@ TEST_CASE(ResolveUri_NoSchemeNoAuthority_EmptyPathWithFragment) { target_uri); } - TEST_CASE(ResolveUri_RemoveDots_RemoveOneDotSegment) { const char* target_uri; EXPECT(ResolveUri("./refpath", "scheme://auth/a/b/c/d", &target_uri)); EXPECT_STREQ("scheme://auth/a/b/c/refpath", target_uri); } - TEST_CASE(ResolveUri_RemoveDots_RemoveTwoDotSegments) { const char* target_uri; EXPECT(ResolveUri("././refpath", "scheme://auth/a/b/c/d", &target_uri)); EXPECT_STREQ("scheme://auth/a/b/c/refpath", target_uri); } - TEST_CASE(ResolveUri_RemoveDots_RemoveOneDotDotSegment) { const char* target_uri; EXPECT(ResolveUri("../refpath", "scheme://auth/a/b/c/d", &target_uri)); EXPECT_STREQ("scheme://auth/a/b/refpath", target_uri); } - TEST_CASE(ResolveUri_RemoveDots_RemoveTwoDotDotSegments) { const char* target_uri; EXPECT(ResolveUri("../../refpath", "scheme://auth/a/b/c/d", &target_uri)); EXPECT_STREQ("scheme://auth/a/refpath", target_uri); } - TEST_CASE(ResolveUri_RemoveDots_RemoveTooManyDotDotSegments) { const char* target_uri; EXPECT(ResolveUri("../../../../../../../../../refpath", @@ -429,28 +392,24 @@ TEST_CASE(ResolveUri_RemoveDots_RemoveTooManyDotDotSegments) { EXPECT_STREQ("scheme://auth/refpath", target_uri); } - TEST_CASE(ResolveUri_RemoveDots_RemoveDotSegmentsNothingLeft1) { const char* target_uri; EXPECT(ResolveUri("../../../../..", "scheme://auth/a/b/c/d", &target_uri)); EXPECT_STREQ("scheme://auth/", target_uri); } - TEST_CASE(ResolveUri_RemoveDots_RemoveDotSegmentsNothingLeft2) { const char* target_uri; EXPECT(ResolveUri(".", "scheme://auth/", &target_uri)); EXPECT_STREQ("scheme://auth/", target_uri); } - TEST_CASE(ResolveUri_RemoveDots_RemoveDotSegmentsInitialPrefix) { const char* target_uri; EXPECT(ResolveUri("../../../../refpath", "scheme://auth", &target_uri)); EXPECT_STREQ("scheme://auth/refpath", target_uri); } - TEST_CASE(ResolveUri_RemoveDots_RemoveDotSegmentsMixed) { const char* target_uri; EXPECT(ResolveUri("../../1/./2/../3/4/../5/././6/../7", @@ -458,7 +417,6 @@ TEST_CASE(ResolveUri_RemoveDots_RemoveDotSegmentsMixed) { EXPECT_STREQ("scheme://auth/a/b/1/3/5/7", target_uri); } - TEST_CASE(ResolveUri_NormalizeEscapes_PathQueryFragment) { const char* target_uri; EXPECT(ResolveUri("#A Fr%61gment", @@ -469,14 +427,12 @@ TEST_CASE(ResolveUri_NormalizeEscapes_PathQueryFragment) { target_uri); } - TEST_CASE(ResolveUri_NormalizeEscapes_UppercaseHexPreferred) { const char* target_uri; EXPECT(ResolveUri("", "scheme:/%1b%1B", &target_uri)); EXPECT_STREQ("scheme:/%1B%1B", target_uri); } - TEST_CASE(ResolveUri_NormalizeEscapes_Authority) { const char* target_uri; EXPECT( @@ -486,7 +442,6 @@ TEST_CASE(ResolveUri_NormalizeEscapes_Authority) { EXPECT_STREQ("scheme://UsEr%20NaMe@host.com:80/", target_uri); } - TEST_CASE(ResolveUri_NormalizeEscapes_BrokenEscapeSequence) { const char* target_uri; EXPECT(ResolveUri("", "scheme:/%1g", &target_uri)); @@ -494,7 +449,6 @@ TEST_CASE(ResolveUri_NormalizeEscapes_BrokenEscapeSequence) { EXPECT_STREQ("scheme:/%1g", target_uri); } - TEST_CASE(ResolveUri_DataUri) { const char* data_uri = "data:application/" @@ -548,14 +502,12 @@ TEST_CASE(ResolveUri_RelativeBase_NotImplemented) { EXPECT(target_uri == NULL); } - static const char* TestResolve(const char* base_uri, const char* uri) { const char* target_uri; EXPECT(ResolveUri(uri, base_uri, &target_uri)); return target_uri; } - // This test is ported from sdk/tests/corelib/uri_test.dart (testUriPerRFCs). TEST_CASE(ResolveUri_TestUriPerRFCs) { const char* base = "http://a/b/c/d;p?q"; @@ -611,7 +563,6 @@ TEST_CASE(ResolveUri_TestUriPerRFCs) { EXPECT_STREQ("s:/c", TestResolve(base, "../c")); } - // This test is ported from sdk/tests/corelib/uri_test.dart (testResolvePath). TEST_CASE(ResolveUri_MoreDotSegmentTests) { const char* base = "/"; diff --git a/runtime/vm/utils_test.cc b/runtime/vm/utils_test.cc index 7a90388a40d..a771610c0fc 100644 --- a/runtime/vm/utils_test.cc +++ b/runtime/vm/utils_test.cc @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "platform/assert.h" #include "platform/utils.h" +#include "platform/assert.h" #include "vm/unit_test.h" namespace dart { @@ -22,7 +22,6 @@ VM_UNIT_TEST_CASE(Minimum) { EXPECT_EQ(-2, Utils::Minimum(-2, -1)); } - VM_UNIT_TEST_CASE(Maximum) { EXPECT_EQ(1, Utils::Maximum(0, 1)); EXPECT_EQ(1, Utils::Maximum(1, 0)); @@ -37,7 +36,6 @@ VM_UNIT_TEST_CASE(Maximum) { EXPECT_EQ(-1, Utils::Maximum(-2, -1)); } - VM_UNIT_TEST_CASE(IsPowerOfTwo) { EXPECT(!Utils::IsPowerOfTwo(0)); EXPECT(Utils::IsPowerOfTwo(1)); @@ -50,14 +48,12 @@ VM_UNIT_TEST_CASE(IsPowerOfTwo) { EXPECT(!Utils::IsPowerOfTwo(-2)); } - VM_UNIT_TEST_CASE(ShiftForPowerOfTwo) { EXPECT_EQ(1, Utils::ShiftForPowerOfTwo(2)); EXPECT_EQ(2, Utils::ShiftForPowerOfTwo(4)); EXPECT_EQ(8, Utils::ShiftForPowerOfTwo(256)); } - VM_UNIT_TEST_CASE(IsAligned) { EXPECT(Utils::IsAligned(0, 1)); EXPECT(Utils::IsAligned(1, 1)); @@ -71,7 +67,6 @@ VM_UNIT_TEST_CASE(IsAligned) { EXPECT(Utils::IsAligned(40, 8)); } - VM_UNIT_TEST_CASE(RoundDown) { EXPECT_EQ(0, Utils::RoundDown(22, 32)); EXPECT_EQ(32, Utils::RoundDown(33, 32)); @@ -81,7 +76,6 @@ VM_UNIT_TEST_CASE(RoundDown) { EXPECT_EQ(rounddown_address, Utils::RoundDown(address, 32)); } - VM_UNIT_TEST_CASE(RoundUp) { EXPECT_EQ(32, Utils::RoundUp(22, 32)); EXPECT_EQ(64, Utils::RoundUp(33, 32)); @@ -91,7 +85,6 @@ VM_UNIT_TEST_CASE(RoundUp) { EXPECT_EQ(roundup_address, Utils::RoundUp(address, 32)); } - VM_UNIT_TEST_CASE(RoundUpToPowerOfTwo) { EXPECT_EQ(0U, Utils::RoundUpToPowerOfTwo(0)); EXPECT_EQ(1U, Utils::RoundUpToPowerOfTwo(1)); @@ -105,7 +98,6 @@ VM_UNIT_TEST_CASE(RoundUpToPowerOfTwo) { EXPECT_EQ(0x10000000U, Utils::RoundUpToPowerOfTwo(0x08765432)); } - VM_UNIT_TEST_CASE(CountOneBits) { EXPECT_EQ(0, Utils::CountOneBits(0)); EXPECT_EQ(1, Utils::CountOneBits(0x00000010)); @@ -116,7 +108,6 @@ VM_UNIT_TEST_CASE(CountOneBits) { EXPECT_EQ(32, Utils::CountOneBits(0xFFFFFFFF)); } - VM_UNIT_TEST_CASE(CountZeros) { EXPECT_EQ(0, Utils::CountTrailingZeros(0x1)); EXPECT_EQ(kBitsPerWord - 1, Utils::CountLeadingZeros(0x1)); @@ -133,7 +124,6 @@ VM_UNIT_TEST_CASE(CountZeros) { EXPECT_EQ(0, Utils::CountLeadingZeros(kTopBit)); } - VM_UNIT_TEST_CASE(IsInt) { EXPECT(Utils::IsInt(8, 16)); EXPECT(Utils::IsInt(8, 127)); @@ -149,7 +139,6 @@ VM_UNIT_TEST_CASE(IsInt) { EXPECT(!Utils::IsInt(32, 4294967295LL)); } - VM_UNIT_TEST_CASE(IsUint) { EXPECT(Utils::IsUint(8, 16)); EXPECT(Utils::IsUint(8, 0)); @@ -165,7 +154,6 @@ VM_UNIT_TEST_CASE(IsUint) { EXPECT(!Utils::IsUint(32, 4294967296LL)); } - VM_UNIT_TEST_CASE(IsAbsoluteUint) { EXPECT(Utils::IsAbsoluteUint(8, 16)); EXPECT(Utils::IsAbsoluteUint(8, 0)); @@ -184,7 +172,6 @@ VM_UNIT_TEST_CASE(IsAbsoluteUint) { EXPECT(!Utils::IsAbsoluteUint(32, 4294967296LL)); } - VM_UNIT_TEST_CASE(LowBits) { EXPECT_EQ(0xff00, Utils::Low16Bits(0xffff00)); EXPECT_EQ(0xff, Utils::High16Bits(0xffff00)); @@ -193,7 +180,6 @@ VM_UNIT_TEST_CASE(LowBits) { EXPECT_EQ(0x00ff0000ff00LL, Utils::LowHighTo64Bits(0xff00, 0x00ff)); } - VM_UNIT_TEST_CASE(Endianity) { uint16_t value16be = Utils::HostToBigEndian16(0xf1); EXPECT_EQ(0x0, reinterpret_cast(&value16be)[0]); @@ -236,7 +222,6 @@ VM_UNIT_TEST_CASE(Endianity) { EXPECT_EQ(0x0, reinterpret_cast(&value64le)[7]); } - VM_UNIT_TEST_CASE(DoublesBitEqual) { EXPECT(Utils::DoublesBitEqual(1.0, 1.0)); EXPECT(!Utils::DoublesBitEqual(1.0, -1.0)); diff --git a/runtime/vm/verified_memory_test.cc b/runtime/vm/verified_memory_test.cc index 4ba1bdfb109..a78fe5dc193 100644 --- a/runtime/vm/verified_memory_test.cc +++ b/runtime/vm/verified_memory_test.cc @@ -2,9 +2,9 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +#include "vm/verified_memory.h" #include "platform/assert.h" #include "vm/unit_test.h" -#include "vm/verified_memory.h" namespace dart { @@ -14,7 +14,6 @@ void Init() { #endif } - void Shutdown() { #if defined(DEBUG) // We must reset this to false to avoid checking some assumptions in @@ -23,7 +22,6 @@ void Shutdown() { #endif } - VM_UNIT_TEST_CASE(VerifiedMemoryReserve) { Init(); const intptr_t kReservationSize = 64 * KB; @@ -33,7 +31,6 @@ VM_UNIT_TEST_CASE(VerifiedMemoryReserve) { Shutdown(); } - VM_UNIT_TEST_CASE(VerifiedMemoryCommit) { Init(); const intptr_t kReservationSize = 64 * KB; @@ -44,7 +41,6 @@ VM_UNIT_TEST_CASE(VerifiedMemoryCommit) { Shutdown(); } - VM_UNIT_TEST_CASE(VerifiedMemoryBasic) { Init(); const intptr_t kReservationSize = 64 * KB; @@ -67,7 +63,6 @@ VM_UNIT_TEST_CASE(VerifiedMemoryBasic) { Shutdown(); } - VM_UNIT_TEST_CASE(VerifiedMemoryAccept) { Init(); const intptr_t kReservationSize = 64 * KB; @@ -87,7 +82,6 @@ VM_UNIT_TEST_CASE(VerifiedMemoryAccept) { Shutdown(); } - // Negative tests below. VM_UNIT_TEST_CASE(VerifyImplicit_Crash) { @@ -102,7 +96,6 @@ VM_UNIT_TEST_CASE(VerifyImplicit_Crash) { Shutdown(); } - VM_UNIT_TEST_CASE(VerifyExplicit_Crash) { Init(); const intptr_t kReservationSize = 64 * KB; diff --git a/runtime/vm/verifier.cc b/runtime/vm/verifier.cc index fc1186764e5..3d4d54428c4 100644 --- a/runtime/vm/verifier.cc +++ b/runtime/vm/verifier.cc @@ -45,7 +45,6 @@ void VerifyObjectVisitor::VisitObject(RawObject* raw_obj) { raw_obj->Validate(isolate_); } - void VerifyPointersVisitor::VisitPointers(RawObject** first, RawObject** last) { for (RawObject** current = first; current <= last; current++) { RawObject* raw_obj = *current; @@ -58,7 +57,6 @@ void VerifyPointersVisitor::VisitPointers(RawObject** first, RawObject** last) { } } - void VerifyWeakPointersVisitor::VisitHandle(uword addr) { FinalizablePersistentHandle* handle = reinterpret_cast(addr); @@ -66,7 +64,6 @@ void VerifyWeakPointersVisitor::VisitHandle(uword addr) { visitor_->VisitPointer(&raw_obj); } - void VerifyPointersVisitor::VerifyPointers(MarkExpectation mark_expectation) { NoSafepointScope no_safepoint; Thread* thread = Thread::Current(); @@ -82,12 +79,10 @@ void VerifyPointersVisitor::VerifyPointers(MarkExpectation mark_expectation) { isolate->VisitWeakPersistentHandles(&weak_visitor); } - #if defined(DEBUG) VerifyCanonicalVisitor::VerifyCanonicalVisitor(Thread* thread) : thread_(thread), instanceHandle_(Instance::Handle(thread->zone())) {} - void VerifyCanonicalVisitor::VisitObject(RawObject* obj) { if (obj->GetClassId() >= kInstanceCid) { if (obj->IsCanonical()) { diff --git a/runtime/vm/verifier.h b/runtime/vm/verifier.h index e9497385463..57b374b0d89 100644 --- a/runtime/vm/verifier.h +++ b/runtime/vm/verifier.h @@ -17,10 +17,8 @@ class Isolate; class ObjectSet; class RawObject; - enum MarkExpectation { kForbidMarked, kAllowMarked, kRequireMarked }; - class VerifyObjectVisitor : public ObjectVisitor { public: VerifyObjectVisitor(Isolate* isolate, @@ -72,7 +70,6 @@ class VerifyWeakPointersVisitor : public HandleVisitor { DISALLOW_COPY_AND_ASSIGN(VerifyWeakPointersVisitor); }; - #if defined(DEBUG) class VerifyCanonicalVisitor : public ObjectVisitor { public: diff --git a/runtime/vm/version_in.cc b/runtime/vm/version_in.cc index 1857ce9b40c..8b46bcd92b0 100644 --- a/runtime/vm/version_in.cc +++ b/runtime/vm/version_in.cc @@ -21,12 +21,10 @@ const char* Version::String() { return formatted_version; } - const char* Version::SnapshotString() { return snapshot_hash_; } - const char* Version::CommitString() { return commit_; } diff --git a/runtime/vm/virtual_memory.cc b/runtime/vm/virtual_memory.cc index 38bb4b3fd37..facf4420944 100644 --- a/runtime/vm/virtual_memory.cc +++ b/runtime/vm/virtual_memory.cc @@ -14,7 +14,6 @@ bool VirtualMemory::InSamePage(uword address0, uword address1) { Utils::RoundDown(address1, PageSize())); } - void VirtualMemory::Truncate(intptr_t new_size, bool try_unmap) { ASSERT((new_size & (PageSize() - 1)) == 0); ASSERT(new_size <= size()); @@ -27,7 +26,6 @@ void VirtualMemory::Truncate(intptr_t new_size, bool try_unmap) { region_.Subregion(region_, 0, new_size); } - VirtualMemory* VirtualMemory::ForImagePage(void* pointer, uword size) { // Memory for precompilated instructions was allocated by the embedder, so // create a VirtualMemory without allocating. diff --git a/runtime/vm/virtual_memory_android.cc b/runtime/vm/virtual_memory_android.cc index 64532935c95..d1606026bab 100644 --- a/runtime/vm/virtual_memory_android.cc +++ b/runtime/vm/virtual_memory_android.cc @@ -24,12 +24,10 @@ namespace dart { uword VirtualMemory::page_size_ = 0; - void VirtualMemory::InitOnce() { page_size_ = getpagesize(); } - VirtualMemory* VirtualMemory::ReserveInternal(intptr_t size) { // TODO(4408): use ashmem instead of anonymous memory. void* address = mmap(NULL, size, PROT_NONE, @@ -41,7 +39,6 @@ VirtualMemory* VirtualMemory::ReserveInternal(intptr_t size) { return new VirtualMemory(region); } - static void unmap(void* address, intptr_t size) { if (size == 0) { return; @@ -52,14 +49,12 @@ static void unmap(void* address, intptr_t size) { } } - VirtualMemory::~VirtualMemory() { if (vm_owns_region()) { unmap(address(), reserved_size_); } } - bool VirtualMemory::FreeSubSegment(int32_t handle, void* address, intptr_t size) { @@ -67,7 +62,6 @@ bool VirtualMemory::FreeSubSegment(int32_t handle, return true; } - bool VirtualMemory::Commit(uword addr, intptr_t size, bool executable, @@ -83,7 +77,6 @@ bool VirtualMemory::Commit(uword addr, return true; } - bool VirtualMemory::Protect(void* address, intptr_t size, Protection mode) { ASSERT(Thread::Current()->IsMutatorThread() || Isolate::Current()->mutator_thread()->IsAtSafepoint()); diff --git a/runtime/vm/virtual_memory_fuchsia.cc b/runtime/vm/virtual_memory_fuchsia.cc index db6504f2420..6688c543122 100644 --- a/runtime/vm/virtual_memory_fuchsia.cc +++ b/runtime/vm/virtual_memory_fuchsia.cc @@ -90,7 +90,6 @@ void VmarList::AddVmar(mx_handle_t vmar, uword addr, intptr_t size) { vmar_array_.InsertAt(idx, new_mapping); } - intptr_t VmarList::LookupVmarIndexLocked(uword addr) { // Binary search for the vmar containing addr. intptr_t imin = 0; @@ -109,7 +108,6 @@ intptr_t VmarList::LookupVmarIndexLocked(uword addr) { return -1; } - mx_handle_t VmarList::LookupVmar(uword addr) { MutexLocker ml(vmar_array_lock_); LOG_INFO("LookupVmar(%lx)\n", addr); @@ -122,7 +120,6 @@ mx_handle_t VmarList::LookupVmar(uword addr) { return vmar_array_[idx].vmar; } - void VmarList::RemoveVmar(uword addr) { MutexLocker ml(vmar_array_lock_); LOG_INFO("RemoveVmar(%lx)\n", addr); @@ -143,15 +140,12 @@ void VmarList::RemoveVmar(uword addr) { vmar_array_.RemoveLast(); } - uword VirtualMemory::page_size_ = 0; - void VirtualMemory::InitOnce() { page_size_ = getpagesize(); } - VirtualMemory* VirtualMemory::ReserveInternal(intptr_t size) { ASSERT(Utils::IsAligned(size, page_size_)); mx_handle_t vmar = MX_HANDLE_INVALID; @@ -171,7 +165,6 @@ VirtualMemory* VirtualMemory::ReserveInternal(intptr_t size) { return new VirtualMemory(region, vmar); } - VirtualMemory::~VirtualMemory() { if (vm_owns_region()) { mx_handle_t vmar = static_cast(handle()); @@ -187,7 +180,6 @@ VirtualMemory::~VirtualMemory() { } } - bool VirtualMemory::FreeSubSegment(int32_t handle, void* address, intptr_t size) { @@ -201,7 +193,6 @@ bool VirtualMemory::FreeSubSegment(int32_t handle, return true; } - bool VirtualMemory::Commit(uword addr, intptr_t size, bool executable, @@ -245,7 +236,6 @@ bool VirtualMemory::Commit(uword addr, return true; } - bool VirtualMemory::Protect(void* address, intptr_t size, Protection mode) { ASSERT(Thread::Current()->IsMutatorThread() || Isolate::Current()->mutator_thread()->IsAtSafepoint()); diff --git a/runtime/vm/virtual_memory_linux.cc b/runtime/vm/virtual_memory_linux.cc index 47587524b9a..fa14d59eedd 100644 --- a/runtime/vm/virtual_memory_linux.cc +++ b/runtime/vm/virtual_memory_linux.cc @@ -24,12 +24,10 @@ namespace dart { uword VirtualMemory::page_size_ = 0; - void VirtualMemory::InitOnce() { page_size_ = getpagesize(); } - VirtualMemory* VirtualMemory::ReserveInternal(intptr_t size) { void* address = mmap(NULL, size, PROT_NONE, MAP_PRIVATE | MAP_ANON | MAP_NORESERVE, -1, 0); @@ -40,7 +38,6 @@ VirtualMemory* VirtualMemory::ReserveInternal(intptr_t size) { return new VirtualMemory(region); } - static void unmap(void* address, intptr_t size) { if (size == 0) { return; @@ -51,14 +48,12 @@ static void unmap(void* address, intptr_t size) { } } - VirtualMemory::~VirtualMemory() { if (vm_owns_region()) { unmap(address(), reserved_size_); } } - bool VirtualMemory::FreeSubSegment(int32_t handle, void* address, intptr_t size) { @@ -66,7 +61,6 @@ bool VirtualMemory::FreeSubSegment(int32_t handle, return true; } - bool VirtualMemory::Commit(uword addr, intptr_t size, bool executable, @@ -82,7 +76,6 @@ bool VirtualMemory::Commit(uword addr, return true; } - bool VirtualMemory::Protect(void* address, intptr_t size, Protection mode) { ASSERT(Thread::Current()->IsMutatorThread() || Isolate::Current()->mutator_thread()->IsAtSafepoint()); @@ -111,7 +104,6 @@ bool VirtualMemory::Protect(void* address, intptr_t size, Protection mode) { end_address - page_address, prot) == 0); } - } // namespace dart #endif // defined(HOST_OS_LINUX) diff --git a/runtime/vm/virtual_memory_macos.cc b/runtime/vm/virtual_memory_macos.cc index 25236da65a5..675afeb3cfb 100644 --- a/runtime/vm/virtual_memory_macos.cc +++ b/runtime/vm/virtual_memory_macos.cc @@ -24,12 +24,10 @@ namespace dart { uword VirtualMemory::page_size_ = 0; - void VirtualMemory::InitOnce() { page_size_ = getpagesize(); } - VirtualMemory* VirtualMemory::ReserveInternal(intptr_t size) { ASSERT((size & (PageSize() - 1)) == 0); void* address = mmap(NULL, size, PROT_NONE, @@ -41,7 +39,6 @@ VirtualMemory* VirtualMemory::ReserveInternal(intptr_t size) { return new VirtualMemory(region); } - static void unmap(void* address, intptr_t size) { if (size == 0) { return; @@ -52,14 +49,12 @@ static void unmap(void* address, intptr_t size) { } } - VirtualMemory::~VirtualMemory() { if (vm_owns_region()) { unmap(address(), reserved_size_); } } - bool VirtualMemory::FreeSubSegment(int32_t handle, void* address, intptr_t size) { @@ -67,7 +62,6 @@ bool VirtualMemory::FreeSubSegment(int32_t handle, return true; } - bool VirtualMemory::Commit(uword addr, intptr_t size, bool executable, @@ -83,7 +77,6 @@ bool VirtualMemory::Commit(uword addr, return true; } - bool VirtualMemory::Protect(void* address, intptr_t size, Protection mode) { ASSERT(Thread::Current()->IsMutatorThread() || Isolate::Current()->mutator_thread()->IsAtSafepoint()); diff --git a/runtime/vm/virtual_memory_test.cc b/runtime/vm/virtual_memory_test.cc index a4c68d2f61a..57a06be5341 100644 --- a/runtime/vm/virtual_memory_test.cc +++ b/runtime/vm/virtual_memory_test.cc @@ -2,9 +2,9 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +#include "vm/virtual_memory.h" #include "platform/assert.h" #include "vm/unit_test.h" -#include "vm/virtual_memory.h" namespace dart { @@ -17,7 +17,6 @@ bool IsZero(char* begin, char* end) { return true; } - VM_UNIT_TEST_CASE(AllocateVirtualMemory) { const intptr_t kVirtualMemoryBlockSize = 64 * KB; VirtualMemory* vm = VirtualMemory::Reserve(kVirtualMemoryBlockSize); @@ -51,7 +50,6 @@ VM_UNIT_TEST_CASE(AllocateVirtualMemory) { delete vm; } - VM_UNIT_TEST_CASE(FreeVirtualMemory) { // Reservations should always be handed back to OS upon destruction. const intptr_t kVirtualMemoryBlockSize = 10 * MB; @@ -88,7 +86,6 @@ VM_UNIT_TEST_CASE(FreeVirtualMemory) { } } - VM_UNIT_TEST_CASE(VirtualMemoryCommitPartial) { const intptr_t kVirtualMemoryBlockSize = 3 * MB; VirtualMemory* vm = VirtualMemory::Reserve(kVirtualMemoryBlockSize); diff --git a/runtime/vm/virtual_memory_win.cc b/runtime/vm/virtual_memory_win.cc index ad44df43099..42c4ff121ab 100644 --- a/runtime/vm/virtual_memory_win.cc +++ b/runtime/vm/virtual_memory_win.cc @@ -16,14 +16,12 @@ namespace dart { uword VirtualMemory::page_size_ = 0; - void VirtualMemory::InitOnce() { SYSTEM_INFO info; GetSystemInfo(&info); page_size_ = info.dwPageSize; } - VirtualMemory* VirtualMemory::ReserveInternal(intptr_t size) { void* address = VirtualAlloc(NULL, size, MEM_RESERVE, PAGE_NOACCESS); if (address == NULL) { @@ -33,7 +31,6 @@ VirtualMemory* VirtualMemory::ReserveInternal(intptr_t size) { return new VirtualMemory(region); } - VirtualMemory::~VirtualMemory() { if (!vm_owns_region() || (reserved_size_ == 0)) { return; @@ -43,7 +40,6 @@ VirtualMemory::~VirtualMemory() { } } - bool VirtualMemory::FreeSubSegment(int32_t handle, void* address, intptr_t size) { @@ -53,7 +49,6 @@ bool VirtualMemory::FreeSubSegment(int32_t handle, return false; } - bool VirtualMemory::Commit(uword addr, intptr_t size, bool executable, @@ -68,7 +63,6 @@ bool VirtualMemory::Commit(uword addr, return true; } - bool VirtualMemory::Protect(void* address, intptr_t size, Protection mode) { ASSERT(Thread::Current()->IsMutatorThread() || Isolate::Current()->mutator_thread()->IsAtSafepoint()); diff --git a/runtime/vm/visitor.h b/runtime/vm/visitor.h index 11d3404560a..424f4864b88 100644 --- a/runtime/vm/visitor.h +++ b/runtime/vm/visitor.h @@ -43,7 +43,6 @@ class ObjectPointerVisitor { DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectPointerVisitor); }; - // An object visitor interface. class ObjectVisitor { public: @@ -58,7 +57,6 @@ class ObjectVisitor { DISALLOW_COPY_AND_ASSIGN(ObjectVisitor); }; - // An object finder visitor interface. class FindObjectVisitor { public: diff --git a/runtime/vm/weak_code.cc b/runtime/vm/weak_code.cc index 7f2f4064ff3..c750d94155b 100644 --- a/runtime/vm/weak_code.cc +++ b/runtime/vm/weak_code.cc @@ -17,7 +17,6 @@ bool WeakCodeReferences::HasCodes() const { return !array_.IsNull() && (array_.Length() > 0); } - void WeakCodeReferences::Register(const Code& value) { if (!array_.IsNull()) { // Try to find and reuse cleared WeakProperty to avoid allocating new one. @@ -43,7 +42,6 @@ void WeakCodeReferences::Register(const Code& value) { UpdateArrayTo(new_array); } - bool WeakCodeReferences::IsOptimizedCode(const Array& dependent_code, const Code& code) { if (!code.is_optimized()) { @@ -59,7 +57,6 @@ bool WeakCodeReferences::IsOptimizedCode(const Array& dependent_code, return false; } - void WeakCodeReferences::DisableCode() { Thread* thread = Thread::Current(); const Array& code_objects = Array::Handle(thread->zone(), array_.raw()); diff --git a/runtime/vm/weak_table.cc b/runtime/vm/weak_table.cc index a9e8c11be4a..17acba46b90 100644 --- a/runtime/vm/weak_table.cc +++ b/runtime/vm/weak_table.cc @@ -29,7 +29,6 @@ intptr_t WeakTable::SizeFor(intptr_t count, intptr_t size) { return result; } - void WeakTable::SetValue(RawObject* key, intptr_t val) { intptr_t mask = size() - 1; intptr_t idx = Hash(key) & mask; @@ -75,7 +74,6 @@ void WeakTable::SetValue(RawObject* key, intptr_t val) { } } - void WeakTable::Reset() { intptr_t* old_data = data_; used_ = 0; @@ -85,7 +83,6 @@ void WeakTable::Reset() { free(old_data); } - void WeakTable::Rehash() { intptr_t old_size = size(); intptr_t* old_data = data_; diff --git a/runtime/vm/zone.cc b/runtime/vm/zone.cc index 9bbc8eb6b3e..ef35be17a87 100644 --- a/runtime/vm/zone.cc +++ b/runtime/vm/zone.cc @@ -43,7 +43,6 @@ class Zone::Segment { DISALLOW_IMPLICIT_CONSTRUCTORS(Segment); }; - Zone::Segment* Zone::Segment::New(intptr_t size, Zone::Segment* next) { ASSERT(size >= 0); Segment* result = reinterpret_cast(malloc(size)); @@ -61,7 +60,6 @@ Zone::Segment* Zone::Segment::New(intptr_t size, Zone::Segment* next) { return result; } - void Zone::Segment::DeleteSegmentList(Segment* head) { Segment* current = head; while (current != NULL) { @@ -76,7 +74,6 @@ void Zone::Segment::DeleteSegmentList(Segment* head) { } } - void Zone::Segment::IncrementMemoryCapacity(uintptr_t size) { Thread* current_thread = Thread::Current(); if (current_thread != NULL) { @@ -87,7 +84,6 @@ void Zone::Segment::IncrementMemoryCapacity(uintptr_t size) { } } - void Zone::Segment::DecrementMemoryCapacity(uintptr_t size) { Thread* current_thread = Thread::Current(); if (current_thread != NULL) { @@ -98,7 +94,6 @@ void Zone::Segment::DecrementMemoryCapacity(uintptr_t size) { } } - // TODO(bkonyi): We need to account for the initial chunk size when a new zone // is created within a new thread or ApiNativeScope when calculating high // watermarks or memory consumption. @@ -119,7 +114,6 @@ Zone::Zone() #endif } - Zone::~Zone() { if (FLAG_trace_zones) { DumpZoneSizes(); @@ -128,7 +122,6 @@ Zone::~Zone() { Segment::DecrementMemoryCapacity(kInitialChunkSize); } - void Zone::DeleteAll() { // Traverse the chained list of segments, zapping (in debug mode) // and freeing every zone segment. @@ -150,7 +143,6 @@ void Zone::DeleteAll() { handles_.Reset(); } - uintptr_t Zone::SizeInBytes() const { uintptr_t size = 0; for (Segment* s = large_segments_; s != NULL; s = s->next()) { @@ -166,7 +158,6 @@ uintptr_t Zone::SizeInBytes() const { return size + (position_ - head_->start()); } - uintptr_t Zone::CapacityInBytes() const { uintptr_t size = 0; for (Segment* s = large_segments_; s != NULL; s = s->next()) { @@ -182,7 +173,6 @@ uintptr_t Zone::CapacityInBytes() const { return size; } - uword Zone::AllocateExpand(intptr_t size) { ASSERT(size >= 0); if (FLAG_trace_zones) { @@ -215,7 +205,6 @@ uword Zone::AllocateExpand(intptr_t size) { return result; } - uword Zone::AllocateLargeSegment(intptr_t size) { ASSERT(size >= 0); // Make sure the requested size is already properly aligned and that @@ -233,7 +222,6 @@ uword Zone::AllocateLargeSegment(intptr_t size) { return result; } - char* Zone::MakeCopyOfString(const char* str) { intptr_t len = strlen(str) + 1; // '\0'-terminated. char* copy = Alloc(len); @@ -241,7 +229,6 @@ char* Zone::MakeCopyOfString(const char* str) { return copy; } - char* Zone::MakeCopyOfStringN(const char* str, intptr_t len) { ASSERT(len >= 0); for (intptr_t i = 0; i < len; i++) { @@ -256,7 +243,6 @@ char* Zone::MakeCopyOfStringN(const char* str, intptr_t len) { return copy; } - char* Zone::ConcatStrings(const char* a, const char* b, char join) { intptr_t a_len = (a == NULL) ? 0 : strlen(a); const intptr_t b_len = strlen(b) + 1; // '\0'-terminated. @@ -271,7 +257,6 @@ char* Zone::ConcatStrings(const char* a, const char* b, char join) { return copy; } - void Zone::DumpZoneSizes() { intptr_t size = 0; for (Segment* s = large_segments_; s != NULL; s = s->next()) { @@ -283,7 +268,6 @@ void Zone::DumpZoneSizes() { reinterpret_cast(this), SizeInBytes(), size); } - void Zone::VisitObjectPointers(ObjectPointerVisitor* visitor) { Zone* zone = this; while (zone != NULL) { @@ -292,7 +276,6 @@ void Zone::VisitObjectPointers(ObjectPointerVisitor* visitor) { } } - char* Zone::PrintToString(const char* format, ...) { va_list args; va_start(args, format); @@ -301,12 +284,10 @@ char* Zone::PrintToString(const char* format, ...) { return buffer; } - char* Zone::VPrint(const char* format, va_list args) { return OS::VSCreate(this, format, args); } - StackZone::StackZone(Thread* thread) : StackResource(thread), zone_() { if (FLAG_trace_zones) { OS::PrintErr("*** Starting a new Stack zone 0x%" Px "(0x%" Px ")\n", @@ -317,7 +298,6 @@ StackZone::StackZone(Thread* thread) : StackResource(thread), zone_() { thread->set_zone(&zone_); } - StackZone::~StackZone() { ASSERT(thread()->zone() == &zone_); thread()->set_zone(zone_.previous_); diff --git a/runtime/vm/zone.h b/runtime/vm/zone.h index 34916819482..b65d2df16c4 100644 --- a/runtime/vm/zone.h +++ b/runtime/vm/zone.h @@ -9,8 +9,8 @@ #include "vm/allocation.h" #include "vm/handles.h" #include "vm/json_stream.h" -#include "vm/thread.h" #include "vm/memory_region.h" +#include "vm/thread.h" namespace dart { @@ -42,7 +42,6 @@ class Zone { // responsible for avoiding integer overflow yourself. inline uword AllocUnsafe(intptr_t size); - // Make a copy of the string in the zone allocated area. char* MakeCopyOfString(const char* str); @@ -165,7 +164,6 @@ class Zone { DISALLOW_COPY_AND_ASSIGN(Zone); }; - class StackZone : public StackResource { public: // Create an empty zone and set is at the current zone for the Thread. @@ -217,7 +215,6 @@ inline uword Zone::AllocUnsafe(intptr_t size) { return result; } - template inline void Zone::CheckLength(intptr_t len) { const intptr_t kElementSize = sizeof(ElementType); @@ -227,7 +224,6 @@ inline void Zone::CheckLength(intptr_t len) { } } - template inline ElementType* Zone::Alloc(intptr_t len) { CheckLength(len); diff --git a/runtime/vm/zone_test.cc b/runtime/vm/zone_test.cc index b151d2d7957..4a3aeacea89 100644 --- a/runtime/vm/zone_test.cc +++ b/runtime/vm/zone_test.cc @@ -2,11 +2,11 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +#include "vm/zone.h" #include "platform/assert.h" #include "vm/dart.h" #include "vm/isolate.h" #include "vm/unit_test.h" -#include "vm/zone.h" namespace dart { @@ -71,7 +71,6 @@ VM_UNIT_TEST_CASE(AllocateZone) { Dart_ShutdownIsolate(); } - VM_UNIT_TEST_CASE(AllocGeneric_Success) { #if defined(DEBUG) FLAG_trace_zones = true; @@ -94,7 +93,6 @@ VM_UNIT_TEST_CASE(AllocGeneric_Success) { Dart_ShutdownIsolate(); } - // This test is expected to crash. VM_UNIT_TEST_CASE(AllocGeneric_Overflow) { #if defined(DEBUG) @@ -114,7 +112,6 @@ VM_UNIT_TEST_CASE(AllocGeneric_Overflow) { Dart_ShutdownIsolate(); } - VM_UNIT_TEST_CASE(ZoneAllocated) { #if defined(DEBUG) FLAG_trace_zones = true; @@ -162,14 +159,12 @@ VM_UNIT_TEST_CASE(ZoneAllocated) { Dart_ShutdownIsolate(); } - TEST_CASE(PrintToString) { StackZone zone(Thread::Current()); const char* result = zone.GetZone()->PrintToString("Hello %s!", "World"); EXPECT_STREQ("Hello World!", result); } - VM_UNIT_TEST_CASE(NativeScopeZoneAllocation) { ASSERT(ApiNativeScope::Current() == NULL); ASSERT(Thread::Current() == NULL); diff --git a/runtime/vm/zone_text_buffer.cc b/runtime/vm/zone_text_buffer.cc index 17294030303..43a90e74e3c 100644 --- a/runtime/vm/zone_text_buffer.cc +++ b/runtime/vm/zone_text_buffer.cc @@ -20,7 +20,6 @@ ZoneTextBuffer::ZoneTextBuffer(Zone* zone, intptr_t initial_capacity) buffer_[length_] = '\0'; } - intptr_t ZoneTextBuffer::Printf(const char* format, ...) { va_list args; va_start(args, format); @@ -43,12 +42,10 @@ intptr_t ZoneTextBuffer::Printf(const char* format, ...) { return len; } - void ZoneTextBuffer::AddString(const char* s) { Printf("%s", s); } - void ZoneTextBuffer::EnsureCapacity(intptr_t len) { intptr_t remaining = capacity_ - length_; if (remaining <= len) {