From c7339e6ee4c63b6fe5041d9073e67a951a788cbc Mon Sep 17 00:00:00 2001 From: "baptiste.afsa" Date: Mon, 29 Feb 2016 02:51:28 -0800 Subject: [PATCH] [arm64] Make sure that memory allocated for assembler tests is executable. Fix some crashes when tests are run on real hardware. R=bmeurer@chromium.org Review URL: https://codereview.chromium.org/1748603002 Cr-Commit-Position: refs/heads/master@{#34355} --- test/cctest/test-assembler-arm64.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/cctest/test-assembler-arm64.cc b/test/cctest/test-assembler-arm64.cc index d930173937..c2c5b782dc 100644 --- a/test/cctest/test-assembler-arm64.cc +++ b/test/cctest/test-assembler-arm64.cc @@ -37,6 +37,7 @@ #include "src/arm64/disasm-arm64.h" #include "src/arm64/simulator-arm64.h" #include "src/arm64/utils-arm64.h" +#include "src/base/platform/platform.h" #include "src/base/utils/random-number-generator.h" #include "src/macro-assembler.h" #include "test/cctest/cctest.h" @@ -173,8 +174,10 @@ static void InitializeVM() { Isolate* isolate = CcTest::i_isolate(); \ HandleScope scope(isolate); \ CHECK(isolate != NULL); \ - byte* buf = new byte[buf_size]; \ - MacroAssembler masm(isolate, buf, buf_size, \ + size_t actual_size; \ + byte* buf = static_cast( \ + v8::base::OS::Allocate(buf_size, &actual_size, true)); \ + MacroAssembler masm(isolate, buf, actual_size, \ v8::internal::CodeObjectRequired::kYes); \ RegisterDump core; @@ -208,7 +211,7 @@ static void InitializeVM() { __ GetCode(NULL); #define TEARDOWN() \ - delete[] buf; + v8::base::OS::Free(buf, actual_size); #endif // ifdef USE_SIMULATOR.