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

Side by Side Diff: runtime/vm/assembler_arm.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_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/longjump.h" 10 #include "vm/longjump.h"
11 #include "vm/runtime_entry.h" 11 #include "vm/runtime_entry.h"
12 #include "vm/simulator.h" 12 #include "vm/simulator.h"
13 #include "vm/stack_frame.h" 13 #include "vm/stack_frame.h"
14 #include "vm/stub_code.h" 14 #include "vm/stub_code.h"
15 15
16 // An extra check since we are assuming the existence of /proc/cpuinfo below. 16 // An extra check since we are assuming the existence of /proc/cpuinfo below.
17 #if !defined(USING_SIMULATOR) && !defined(__linux__) && !defined(ANDROID) && \ 17 #if !defined(USING_SIMULATOR) && !defined(__linux__) && !defined(ANDROID) && \
18 !TARGET_OS_IOS 18 !TARGET_OS_IOS
19 #error ARM cross-compile only supported on Linux 19 #error ARM cross-compile only supported on Linux
20 #endif 20 #endif
21 21
22 namespace dart { 22 namespace dart {
23 23
24 DECLARE_FLAG(bool, allow_absolute_addresses); 24 DECLARE_FLAG(bool, allow_absolute_addresses);
25 DECLARE_FLAG(bool, check_code_pointer);
26 DECLARE_FLAG(bool, inline_alloc);
27
25 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); 28 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message.");
26 DECLARE_FLAG(bool, inline_alloc);
27 29
28 uint32_t Address::encoding3() const { 30 uint32_t Address::encoding3() const {
29 if (kind_ == Immediate) { 31 if (kind_ == Immediate) {
30 uint32_t offset = encoding_ & kOffset12Mask; 32 uint32_t offset = encoding_ & kOffset12Mask;
31 ASSERT(offset < 256); 33 ASSERT(offset < 256);
32 return (encoding_ & ~kOffset12Mask) | B22 | 34 return (encoding_ & ~kOffset12Mask) | B22 |
33 ((offset & 0xf0) << 4) | (offset & 0xf); 35 ((offset & 0xf0) << 4) | (offset & 0xf);
34 } 36 }
35 ASSERT(kind_ == IndexRegister); 37 ASSERT(kind_ == IndexRegister);
36 return encoding_; 38 return encoding_;
(...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after
1511 } else { 1513 } else {
1512 LoadImmediate(rd, offset_hi, cond); 1514 LoadImmediate(rd, offset_hi, cond);
1513 add(rd, pp, Operand(rd), cond); 1515 add(rd, pp, Operand(rd), cond);
1514 } 1516 }
1515 ldr(rd, Address(rd, offset_lo), cond); 1517 ldr(rd, Address(rd, offset_lo), cond);
1516 } 1518 }
1517 } 1519 }
1518 1520
1519 void Assembler::CheckCodePointer() { 1521 void Assembler::CheckCodePointer() {
1520 #ifdef DEBUG 1522 #ifdef DEBUG
1523 if (!FLAG_check_code_pointer) {
1524 return;
1525 }
1521 Comment("CheckCodePointer"); 1526 Comment("CheckCodePointer");
1522 Label cid_ok, instructions_ok; 1527 Label cid_ok, instructions_ok;
1523 Push(R0); 1528 Push(R0);
1524 Push(IP); 1529 Push(IP);
1525 CompareClassId(CODE_REG, kCodeCid, R0); 1530 CompareClassId(CODE_REG, kCodeCid, R0);
1526 b(&cid_ok, EQ); 1531 b(&cid_ok, EQ);
1527 bkpt(0); 1532 bkpt(0);
1528 Bind(&cid_ok); 1533 Bind(&cid_ok);
1529 1534
1530 const intptr_t offset = CodeSize() + Instr::kPCReadOffset + 1535 const intptr_t offset = CodeSize() + Instr::kPCReadOffset +
(...skipping 2131 matching lines...) Expand 10 before | Expand all | Expand 10 after
3662 3667
3663 3668
3664 const char* Assembler::FpuRegisterName(FpuRegister reg) { 3669 const char* Assembler::FpuRegisterName(FpuRegister reg) {
3665 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); 3670 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters));
3666 return fpu_reg_names[reg]; 3671 return fpu_reg_names[reg];
3667 } 3672 }
3668 3673
3669 } // namespace dart 3674 } // namespace dart
3670 3675
3671 #endif // defined TARGET_ARCH_ARM 3676 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698