From 0ab5bc2942dc176dbe06453d247ed824a38f8a75 Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Mon, 14 Sep 2015 12:09:39 -0700 Subject: [PATCH] Add missing arity check for native entry in arm64 and mips simulators. R=fschneider@google.com Review URL: https://codereview.chromium.org//1341623002 . --- runtime/vm/native_entry.cc | 6 ++---- runtime/vm/simulator_arm64.cc | 1 + runtime/vm/simulator_mips.cc | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/vm/native_entry.cc b/runtime/vm/native_entry.cc index ad351c813e7..5f373dfa007 100644 --- a/runtime/vm/native_entry.cc +++ b/runtime/vm/native_entry.cc @@ -184,7 +184,6 @@ void NativeEntry::LinkNativeCall(Dart_NativeArguments args) { bool call_through_wrapper = false; #ifdef USING_SIMULATOR bool is_native_auto_setup_scope = false; - intptr_t num_parameters = -1; #endif { @@ -197,7 +196,6 @@ void NativeEntry::LinkNativeCall(Dart_NativeArguments args) { const Function& func = Function::Handle(code.function()); #ifdef USING_SIMULATOR is_native_auto_setup_scope = func.IsNativeAutoSetupScope(); - num_parameters = func.NumParameters(); #endif if (FLAG_trace_natives) { @@ -225,7 +223,7 @@ void NativeEntry::LinkNativeCall(Dart_NativeArguments args) { Simulator::RedirectExternalReference( reinterpret_cast(LinkNativeCall), Simulator::kBootstrapNativeCall, - func.NumParameters()))); + NativeEntry::kNumArguments))); #endif ASSERT(current_trampoline == StubCode::CallBootstrapCFunction_entry()->EntryPoint()); @@ -248,7 +246,7 @@ void NativeEntry::LinkNativeCall(Dart_NativeArguments args) { patch_target_function = reinterpret_cast( Simulator::RedirectExternalReference( reinterpret_cast(patch_target_function), - Simulator::kBootstrapNativeCall, num_parameters)); + Simulator::kBootstrapNativeCall, NativeEntry::kNumArguments)); } #endif diff --git a/runtime/vm/simulator_arm64.cc b/runtime/vm/simulator_arm64.cc index 9663fdca21d..3c7b99d1610 100644 --- a/runtime/vm/simulator_arm64.cc +++ b/runtime/vm/simulator_arm64.cc @@ -1626,6 +1626,7 @@ void Simulator::DoRedirectedCall(Instr* instr) { set_vregisterd(V0, 0, bit_cast(res)); set_vregisterd(V0, 1, 0); } else if (redirection->call_kind() == kBootstrapNativeCall) { + ASSERT(redirection->argument_count() == 1); NativeArguments* arguments; arguments = reinterpret_cast(get_register(R0)); SimulatorBootstrapNativeCall target = diff --git a/runtime/vm/simulator_mips.cc b/runtime/vm/simulator_mips.cc index fdcdcf2ff71..f8da783b815 100644 --- a/runtime/vm/simulator_mips.cc +++ b/runtime/vm/simulator_mips.cc @@ -1268,6 +1268,7 @@ void Simulator::DoBreak(Instr *instr) { d0 = target(d6, d7); set_fregister_double(F0, d0); } else if (redirection->call_kind() == kBootstrapNativeCall) { + ASSERT(redirection->argument_count() == 1); NativeArguments* arguments; arguments = reinterpret_cast(get_register(A0)); SimulatorBootstrapNativeCall target =