OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include <string.h> | 30 #include <string.h> |
31 #include <cmath> | 31 #include <cmath> |
32 #include <limits> | 32 #include <limits> |
33 | 33 |
34 #include "src/v8.h" | 34 #include "src/v8.h" |
35 | 35 |
36 #include "src/arm64/decoder-arm64-inl.h" | 36 #include "src/arm64/decoder-arm64-inl.h" |
37 #include "src/arm64/disasm-arm64.h" | 37 #include "src/arm64/disasm-arm64.h" |
38 #include "src/arm64/simulator-arm64.h" | 38 #include "src/arm64/simulator-arm64.h" |
39 #include "src/arm64/utils-arm64.h" | 39 #include "src/arm64/utils-arm64.h" |
| 40 #include "src/base/platform/platform.h" |
40 #include "src/base/utils/random-number-generator.h" | 41 #include "src/base/utils/random-number-generator.h" |
41 #include "src/macro-assembler.h" | 42 #include "src/macro-assembler.h" |
42 #include "test/cctest/cctest.h" | 43 #include "test/cctest/cctest.h" |
43 #include "test/cctest/test-utils-arm64.h" | 44 #include "test/cctest/test-utils-arm64.h" |
44 | 45 |
45 using namespace v8::internal; | 46 using namespace v8::internal; |
46 | 47 |
47 // Test infrastructure. | 48 // Test infrastructure. |
48 // | 49 // |
49 // Tests are functions which accept no parameters and have no return values. | 50 // Tests are functions which accept no parameters and have no return values. |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 #define TEARDOWN() \ | 167 #define TEARDOWN() \ |
167 delete pdis; \ | 168 delete pdis; \ |
168 delete[] buf; | 169 delete[] buf; |
169 | 170 |
170 #else // ifdef USE_SIMULATOR. | 171 #else // ifdef USE_SIMULATOR. |
171 // Run the test on real hardware or models. | 172 // Run the test on real hardware or models. |
172 #define SETUP_SIZE(buf_size) \ | 173 #define SETUP_SIZE(buf_size) \ |
173 Isolate* isolate = CcTest::i_isolate(); \ | 174 Isolate* isolate = CcTest::i_isolate(); \ |
174 HandleScope scope(isolate); \ | 175 HandleScope scope(isolate); \ |
175 CHECK(isolate != NULL); \ | 176 CHECK(isolate != NULL); \ |
176 byte* buf = new byte[buf_size]; \ | 177 size_t actual_size; \ |
177 MacroAssembler masm(isolate, buf, buf_size, \ | 178 byte* buf = static_cast<byte*>( \ |
| 179 v8::base::OS::Allocate(buf_size, &actual_size, true)); \ |
| 180 MacroAssembler masm(isolate, buf, actual_size, \ |
178 v8::internal::CodeObjectRequired::kYes); \ | 181 v8::internal::CodeObjectRequired::kYes); \ |
179 RegisterDump core; | 182 RegisterDump core; |
180 | 183 |
181 #define RESET() \ | 184 #define RESET() \ |
182 __ Reset(); \ | 185 __ Reset(); \ |
183 /* Reset the machine state (like simulator.ResetState()). */ \ | 186 /* Reset the machine state (like simulator.ResetState()). */ \ |
184 __ Msr(NZCV, xzr); \ | 187 __ Msr(NZCV, xzr); \ |
185 __ Msr(FPCR, xzr); | 188 __ Msr(FPCR, xzr); |
186 | 189 |
187 | 190 |
(...skipping 13 matching lines...) Expand all Loading... |
201 test_function(); \ | 204 test_function(); \ |
202 } | 205 } |
203 | 206 |
204 #define END() \ | 207 #define END() \ |
205 core.Dump(&masm); \ | 208 core.Dump(&masm); \ |
206 __ PopCalleeSavedRegisters(); \ | 209 __ PopCalleeSavedRegisters(); \ |
207 __ Ret(); \ | 210 __ Ret(); \ |
208 __ GetCode(NULL); | 211 __ GetCode(NULL); |
209 | 212 |
210 #define TEARDOWN() \ | 213 #define TEARDOWN() \ |
211 delete[] buf; | 214 v8::base::OS::Free(buf, actual_size); |
212 | 215 |
213 #endif // ifdef USE_SIMULATOR. | 216 #endif // ifdef USE_SIMULATOR. |
214 | 217 |
215 #define CHECK_EQUAL_NZCV(expected) \ | 218 #define CHECK_EQUAL_NZCV(expected) \ |
216 CHECK(EqualNzcv(expected, core.flags_nzcv())) | 219 CHECK(EqualNzcv(expected, core.flags_nzcv())) |
217 | 220 |
218 #define CHECK_EQUAL_REGISTERS(expected) \ | 221 #define CHECK_EQUAL_REGISTERS(expected) \ |
219 CHECK(EqualRegisters(&expected, &core)) | 222 CHECK(EqualRegisters(&expected, &core)) |
220 | 223 |
221 #define CHECK_EQUAL_32(expected, result) \ | 224 #define CHECK_EQUAL_32(expected, result) \ |
(...skipping 11050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11272 __ Mov(x0, 1); | 11275 __ Mov(x0, 1); |
11273 | 11276 |
11274 END(); | 11277 END(); |
11275 | 11278 |
11276 RUN(); | 11279 RUN(); |
11277 | 11280 |
11278 CHECK_EQUAL_64(0x1, x0); | 11281 CHECK_EQUAL_64(0x1, x0); |
11279 | 11282 |
11280 TEARDOWN(); | 11283 TEARDOWN(); |
11281 } | 11284 } |
OLD | NEW |