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

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

Issue 975443003: Catch corrupted pointers earlier. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/disassembler_ia32.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/disassembler.h" 5 #include "vm/disassembler.h"
6 6
7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. 7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
8 #if defined(TARGET_ARCH_X64) 8 #if defined(TARGET_ARCH_X64)
9 #include "platform/utils.h" 9 #include "platform/utils.h"
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 OS::SNPrint(chars, len, format, full_class_name); 802 OS::SNPrint(chars, len, format, full_class_name);
803 return chars; 803 return chars;
804 } 804 }
805 805
806 806
807 void DisassemblerX64::AppendAddressToBuffer(uint8_t* addr_byte_ptr) { 807 void DisassemblerX64::AppendAddressToBuffer(uint8_t* addr_byte_ptr) {
808 uword addr = reinterpret_cast<uword>(addr_byte_ptr); 808 uword addr = reinterpret_cast<uword>(addr_byte_ptr);
809 AppendToBuffer("%#" Px "", addr); 809 AppendToBuffer("%#" Px "", addr);
810 // Try to print as heap object or stub name 810 // Try to print as heap object or stub name
811 if (((addr & kSmiTagMask) == kHeapObjectTag) && 811 if (((addr & kSmiTagMask) == kHeapObjectTag) &&
812 reinterpret_cast<RawObject*>(addr)->IsWellFormed() &&
812 reinterpret_cast<RawObject*>(addr)->IsOldObject() && 813 reinterpret_cast<RawObject*>(addr)->IsOldObject() &&
813 !Isolate::Current()->heap()->CodeContains(addr) && 814 !Isolate::Current()->heap()->CodeContains(addr) &&
814 Disassembler::CanFindOldObject(addr)) { 815 Disassembler::CanFindOldObject(addr)) {
815 NoGCScope no_gc; 816 NoGCScope no_gc;
816 const Object& obj = Object::Handle(reinterpret_cast<RawObject*>(addr)); 817 const Object& obj = Object::Handle(reinterpret_cast<RawObject*>(addr));
817 if (obj.IsArray()) { 818 if (obj.IsArray()) {
818 const Array& arr = Array::Cast(obj); 819 const Array& arr = Array::Cast(obj);
819 intptr_t len = arr.Length(); 820 intptr_t len = arr.Length();
820 if (len > 5) len = 5; // Print a max of 5 elements. 821 if (len > 5) len = 5; // Print a max of 5 elements.
821 AppendToBuffer(" Array["); 822 AppendToBuffer(" Array[");
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1945 } 1946 }
1946 hex_buffer[hex_index] = '\0'; 1947 hex_buffer[hex_index] = '\0';
1947 if (out_instr_len) { 1948 if (out_instr_len) {
1948 *out_instr_len = instruction_length; 1949 *out_instr_len = instruction_length;
1949 } 1950 }
1950 } 1951 }
1951 1952
1952 } // namespace dart 1953 } // namespace dart
1953 1954
1954 #endif // defined TARGET_ARCH_X64 1955 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/disassembler_ia32.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698