Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: runtime/vm/assembler_mips.cc

Issue 1574993003: Add --check-code-pointer flag for debug builds (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // NOLINT 5 #include "vm/globals.h" // NOLINT
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/longjump.h" 9 #include "vm/longjump.h"
10 #include "vm/runtime_entry.h" 10 #include "vm/runtime_entry.h"
11 #include "vm/simulator.h" 11 #include "vm/simulator.h"
12 #include "vm/stack_frame.h" 12 #include "vm/stack_frame.h"
13 #include "vm/stub_code.h" 13 #include "vm/stub_code.h"
14 14
15 namespace dart { 15 namespace dart {
16 16
17 DECLARE_FLAG(bool, allow_absolute_addresses);
18 DECLARE_FLAG(bool, check_code_pointer);
19 DECLARE_FLAG(bool, inline_alloc);
17 #if defined(USING_SIMULATOR) 20 #if defined(USING_SIMULATOR)
18 DECLARE_FLAG(int, trace_sim_after); 21 DECLARE_FLAG(int, trace_sim_after);
19 #endif 22 #endif
20 DECLARE_FLAG(bool, allow_absolute_addresses); 23
21 DEFINE_FLAG(bool, print_stop_message, false, "Print stop message."); 24 DEFINE_FLAG(bool, print_stop_message, false, "Print stop message.");
22 DECLARE_FLAG(bool, inline_alloc);
23 25
24 void Assembler::InitializeMemoryWithBreakpoints(uword data, intptr_t length) { 26 void Assembler::InitializeMemoryWithBreakpoints(uword data, intptr_t length) {
25 ASSERT(Utils::IsAligned(data, 4)); 27 ASSERT(Utils::IsAligned(data, 4));
26 ASSERT(Utils::IsAligned(length, 4)); 28 ASSERT(Utils::IsAligned(length, 4));
27 const uword end = data + length; 29 const uword end = data + length;
28 while (data < end) { 30 while (data < end) {
29 *reinterpret_cast<int32_t*>(data) = Instr::kBreakPointInstruction; 31 *reinterpret_cast<int32_t*>(data) = Instr::kBreakPointInstruction;
30 data += 4; 32 data += 4;
31 } 33 }
32 } 34 }
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 subu(rd, rs, rt); 456 subu(rd, rs, rt);
455 xor_(ro, rd, rs); 457 xor_(ro, rd, rs);
456 xor_(TMP, rs, rt); 458 xor_(TMP, rs, rt);
457 and_(ro, TMP, ro); 459 and_(ro, TMP, ro);
458 } 460 }
459 } 461 }
460 462
461 463
462 void Assembler::CheckCodePointer() { 464 void Assembler::CheckCodePointer() {
463 #ifdef DEBUG 465 #ifdef DEBUG
466 if (!FLAG_check_code_pointer) {
467 return;
468 }
464 Comment("CheckCodePointer"); 469 Comment("CheckCodePointer");
465 Label cid_ok, instructions_ok; 470 Label cid_ok, instructions_ok;
466 Push(CMPRES1); 471 Push(CMPRES1);
467 Push(CMPRES2); 472 Push(CMPRES2);
468 LoadClassId(CMPRES1, CODE_REG); 473 LoadClassId(CMPRES1, CODE_REG);
469 BranchEqual(CMPRES1, Immediate(kCodeCid), &cid_ok); 474 BranchEqual(CMPRES1, Immediate(kCodeCid), &cid_ok);
470 break_(0); 475 break_(0);
471 Bind(&cid_ok); 476 Bind(&cid_ok);
472 GetNextPC(CMPRES1, TMP); 477 GetNextPC(CMPRES1, TMP);
473 const intptr_t entry_offset = CodeSize() - Instr::kInstrSize + 478 const intptr_t entry_offset = CodeSize() - Instr::kInstrSize +
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 Label stop; 1341 Label stop;
1337 b(&stop); 1342 b(&stop);
1338 Emit(reinterpret_cast<int32_t>(message)); 1343 Emit(reinterpret_cast<int32_t>(message));
1339 Bind(&stop); 1344 Bind(&stop);
1340 break_(Instr::kStopMessageCode); 1345 break_(Instr::kStopMessageCode);
1341 } 1346 }
1342 1347
1343 } // namespace dart 1348 } // namespace dart
1344 1349
1345 #endif // defined TARGET_ARCH_MIPS 1350 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698