| OLD | NEW |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 Isolate* isolate = CcTest::i_isolate(); | 181 Isolate* isolate = CcTest::i_isolate(); |
| 182 HandleScope scope(isolate); | 182 HandleScope scope(isolate); |
| 183 MacroAssembler masm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); | 183 MacroAssembler masm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); |
| 184 | 184 |
| 185 AssembleLoadExcl(&masm, access1, w1, x1); | 185 AssembleLoadExcl(&masm, access1, w1, x1); |
| 186 AssembleMemoryAccess(&masm, access2, w3, w2, x1); | 186 AssembleMemoryAccess(&masm, access2, w3, w2, x1); |
| 187 AssembleStoreExcl(&masm, access3, w0, w3, x1); | 187 AssembleStoreExcl(&masm, access3, w0, w3, x1); |
| 188 __ br(lr); | 188 __ br(lr); |
| 189 | 189 |
| 190 CodeDesc desc; | 190 CodeDesc desc; |
| 191 masm.GetCode(&desc); | 191 masm.GetCode(isolate, &desc); |
| 192 Handle<Code> code = isolate->factory()->NewCode( | 192 Handle<Code> code = isolate->factory()->NewCode( |
| 193 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 193 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 194 TestData t = initial_data; | 194 TestData t = initial_data; |
| 195 Simulator::CallArgument args[] = { | 195 Simulator::CallArgument args[] = { |
| 196 Simulator::CallArgument(reinterpret_cast<uintptr_t>(&t)), | 196 Simulator::CallArgument(reinterpret_cast<uintptr_t>(&t)), |
| 197 Simulator::CallArgument::End()}; | 197 Simulator::CallArgument::End()}; |
| 198 Simulator::current(isolate)->CallVoid(code->entry(), args); | 198 Simulator::current(isolate)->CallVoid(code->entry(), args); |
| 199 int res = Simulator::current(isolate)->wreg(0); | 199 int res = Simulator::current(isolate)->wreg(0); |
| 200 | 200 |
| 201 CHECK_EQ(expected_res, res); | 201 CHECK_EQ(expected_res, res); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 } | 251 } |
| 252 | 252 |
| 253 static int ExecuteMemoryAccess(Isolate* isolate, TestData* test_data, | 253 static int ExecuteMemoryAccess(Isolate* isolate, TestData* test_data, |
| 254 MemoryAccess access) { | 254 MemoryAccess access) { |
| 255 HandleScope scope(isolate); | 255 HandleScope scope(isolate); |
| 256 MacroAssembler masm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); | 256 MacroAssembler masm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); |
| 257 AssembleMemoryAccess(&masm, access, w0, w2, x1); | 257 AssembleMemoryAccess(&masm, access, w0, w2, x1); |
| 258 __ br(lr); | 258 __ br(lr); |
| 259 | 259 |
| 260 CodeDesc desc; | 260 CodeDesc desc; |
| 261 masm.GetCode(&desc); | 261 masm.GetCode(isolate, &desc); |
| 262 Handle<Code> code = isolate->factory()->NewCode( | 262 Handle<Code> code = isolate->factory()->NewCode( |
| 263 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 263 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 264 Simulator::CallArgument args[] = { | 264 Simulator::CallArgument args[] = { |
| 265 Simulator::CallArgument(reinterpret_cast<uintptr_t>(test_data)), | 265 Simulator::CallArgument(reinterpret_cast<uintptr_t>(test_data)), |
| 266 Simulator::CallArgument::End()}; | 266 Simulator::CallArgument::End()}; |
| 267 Simulator::current(isolate)->CallVoid(code->entry(), args); | 267 Simulator::current(isolate)->CallVoid(code->entry(), args); |
| 268 return Simulator::current(isolate)->wreg(0); | 268 return Simulator::current(isolate)->wreg(0); |
| 269 } | 269 } |
| 270 | 270 |
| 271 class MemoryAccessThread : public v8::base::Thread { | 271 class MemoryAccessThread : public v8::base::Thread { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 CHECK_EQ(1, ExecuteMemoryAccess(isolate, &test_data, stlxr_w)); | 375 CHECK_EQ(1, ExecuteMemoryAccess(isolate, &test_data, stlxr_w)); |
| 376 CHECK_EQ(1, test_data.w); | 376 CHECK_EQ(1, test_data.w); |
| 377 | 377 |
| 378 thread.Finish(); | 378 thread.Finish(); |
| 379 thread.Join(); | 379 thread.Join(); |
| 380 } | 380 } |
| 381 | 381 |
| 382 #undef __ | 382 #undef __ |
| 383 | 383 |
| 384 #endif // USE_SIMULATOR | 384 #endif // USE_SIMULATOR |
| OLD | NEW |