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

Side by Side Diff: runtime/vm/assembler_arm64.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
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 ARM64 cross-compile only supported on Linux 19 #error ARM64 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, use_far_branches, false, "Always use far branches"); 28 DEFINE_FLAG(bool, use_far_branches, false, "Always use far branches");
26 DEFINE_FLAG(bool, print_stop_message, false, "Print stop message."); 29 DEFINE_FLAG(bool, print_stop_message, false, "Print stop message.");
27 DECLARE_FLAG(bool, inline_alloc);
28 30
29 31
30 Assembler::Assembler(bool use_far_branches) 32 Assembler::Assembler(bool use_far_branches)
31 : buffer_(), 33 : buffer_(),
32 prologue_offset_(-1), 34 prologue_offset_(-1),
33 use_far_branches_(use_far_branches), 35 use_far_branches_(use_far_branches),
34 comments_(), 36 comments_(),
35 constant_pool_allowed_(false) { 37 constant_pool_allowed_(false) {
36 } 38 }
37 39
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 1076
1075 1077
1076 void Assembler::RestoreCodePointer() { 1078 void Assembler::RestoreCodePointer() {
1077 ldr(CODE_REG, Address(FP, kPcMarkerSlotFromFp * kWordSize)); 1079 ldr(CODE_REG, Address(FP, kPcMarkerSlotFromFp * kWordSize));
1078 CheckCodePointer(); 1080 CheckCodePointer();
1079 } 1081 }
1080 1082
1081 1083
1082 void Assembler::CheckCodePointer() { 1084 void Assembler::CheckCodePointer() {
1083 #ifdef DEBUG 1085 #ifdef DEBUG
1086 if (!FLAG_check_code_pointer) {
1087 return;
1088 }
1084 Comment("CheckCodePointer"); 1089 Comment("CheckCodePointer");
1085 Label cid_ok, instructions_ok; 1090 Label cid_ok, instructions_ok;
1086 Push(R0); 1091 Push(R0);
1087 CompareClassId(CODE_REG, kCodeCid); 1092 CompareClassId(CODE_REG, kCodeCid);
1088 b(&cid_ok, EQ); 1093 b(&cid_ok, EQ);
1089 brk(0); 1094 brk(0);
1090 Bind(&cid_ok); 1095 Bind(&cid_ok);
1091 1096
1092 const intptr_t entry_offset = 1097 const intptr_t entry_offset =
1093 CodeSize() + Instructions::HeaderSize() - kHeapObjectTag; 1098 CodeSize() + Instructions::HeaderSize() - kHeapObjectTag;
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 add(base, array, Operand(index, LSL, shift)); 1472 add(base, array, Operand(index, LSL, shift));
1468 } 1473 }
1469 const OperandSize size = Address::OperandSizeFor(cid); 1474 const OperandSize size = Address::OperandSizeFor(cid);
1470 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); 1475 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size));
1471 return Address(base, offset, Address::Offset, size); 1476 return Address(base, offset, Address::Offset, size);
1472 } 1477 }
1473 1478
1474 } // namespace dart 1479 } // namespace dart
1475 1480
1476 #endif // defined TARGET_ARCH_ARM64 1481 #endif // defined TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698