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

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

Issue 26345002: Last cleanup int -> intptr_t. Also removed a hack. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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/code_descriptors.cc ('k') | runtime/vm/simulator_arm.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/globals.h" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/code_patcher.h" 9 #include "vm/code_patcher.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 25 matching lines...) Expand all
36 reinterpret_cast<uint8_t*>(return_address - kCallPatternSize); 36 reinterpret_cast<uint8_t*>(return_address - kCallPatternSize);
37 return (code_bytes[0] == 0x49) && (code_bytes[1] == 0x8B) && 37 return (code_bytes[0] == 0x49) && (code_bytes[1] == 0x8B) &&
38 (code_bytes[2] == 0x9F) && 38 (code_bytes[2] == 0x9F) &&
39 (code_bytes[7] == 0x4D) && (code_bytes[8] == 0x8B) && 39 (code_bytes[7] == 0x4D) && (code_bytes[8] == 0x8B) &&
40 (code_bytes[9] == 0x9F) && 40 (code_bytes[9] == 0x9F) &&
41 (code_bytes[14] == 0x41) && (code_bytes[15] == 0xFF) && 41 (code_bytes[14] == 0x41) && (code_bytes[15] == 0xFF) &&
42 (code_bytes[16] == 0xD3); 42 (code_bytes[16] == 0xD3);
43 } 43 }
44 44
45 RawObject* ic_data() const { 45 RawObject* ic_data() const {
46 int index = InstructionPattern::IndexFromPPLoad(start_ + 3); 46 intptr_t index = InstructionPattern::IndexFromPPLoad(start_ + 3);
47 return object_pool_.At(index); 47 return object_pool_.At(index);
48 } 48 }
49 49
50 uword target() const { 50 uword target() const {
51 int index = InstructionPattern::IndexFromPPLoad(start_ + 10); 51 intptr_t index = InstructionPattern::IndexFromPPLoad(start_ + 10);
52 return reinterpret_cast<uword>(object_pool_.At(index)); 52 return reinterpret_cast<uword>(object_pool_.At(index));
53 } 53 }
54 54
55 void set_target(uword target) const { 55 void set_target(uword target) const {
56 int index = InstructionPattern::IndexFromPPLoad(start_ + 10); 56 intptr_t index = InstructionPattern::IndexFromPPLoad(start_ + 10);
57 const Smi& smi = Smi::Handle(reinterpret_cast<RawSmi*>(target)); 57 const Smi& smi = Smi::Handle(reinterpret_cast<RawSmi*>(target));
58 object_pool_.SetAt(index, smi); 58 object_pool_.SetAt(index, smi);
59 // No need to flush the instruction cache, since the code is not modified. 59 // No need to flush the instruction cache, since the code is not modified.
60 } 60 }
61 61
62 private: 62 private:
63 uword start_; 63 uword start_;
64 const Array& object_pool_; 64 const Array& object_pool_;
65 DISALLOW_IMPLICIT_CONSTRUCTORS(UnoptimizedCall); 65 DISALLOW_IMPLICIT_CONSTRUCTORS(UnoptimizedCall);
66 }; 66 };
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 static bool IsValid(uword return_address) { 117 static bool IsValid(uword return_address) {
118 uint8_t* code_bytes = 118 uint8_t* code_bytes =
119 reinterpret_cast<uint8_t*>(return_address - kCallPatternSize); 119 reinterpret_cast<uint8_t*>(return_address - kCallPatternSize);
120 return (code_bytes[0] == 0x4D) && (code_bytes[1] == 0x8B) && 120 return (code_bytes[0] == 0x4D) && (code_bytes[1] == 0x8B) &&
121 (code_bytes[2] == 0x9F) && 121 (code_bytes[2] == 0x9F) &&
122 (code_bytes[7] == 0x41) && (code_bytes[8] == 0xFF) && 122 (code_bytes[7] == 0x41) && (code_bytes[8] == 0xFF) &&
123 (code_bytes[9] == 0xD3); 123 (code_bytes[9] == 0xD3);
124 } 124 }
125 125
126 uword target() const { 126 uword target() const {
127 int index = InstructionPattern::IndexFromPPLoad(start_ + 3); 127 intptr_t index = InstructionPattern::IndexFromPPLoad(start_ + 3);
128 return reinterpret_cast<uword>(object_pool_.At(index)); 128 return reinterpret_cast<uword>(object_pool_.At(index));
129 } 129 }
130 130
131 void set_target(uword target) const { 131 void set_target(uword target) const {
132 int index = InstructionPattern::IndexFromPPLoad(start_ + 3); 132 intptr_t index = InstructionPattern::IndexFromPPLoad(start_ + 3);
133 const Smi& smi = Smi::Handle(reinterpret_cast<RawSmi*>(target)); 133 const Smi& smi = Smi::Handle(reinterpret_cast<RawSmi*>(target));
134 object_pool_.SetAt(index, smi); 134 object_pool_.SetAt(index, smi);
135 // No need to flush the instruction cache, since the code is not modified. 135 // No need to flush the instruction cache, since the code is not modified.
136 } 136 }
137 137
138 private: 138 private:
139 uword start_; 139 uword start_;
140 const Array& object_pool_; 140 const Array& object_pool_;
141 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticCall); 141 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticCall);
142 }; 142 };
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 280
281 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) { 281 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) {
282 ASSERT(code.ContainsInstructionAt(pc)); 282 ASSERT(code.ContainsInstructionAt(pc));
283 EdgeCounter counter(pc, code); 283 EdgeCounter counter(pc, code);
284 return counter.edge_counter(); 284 return counter.edge_counter();
285 } 285 }
286 286
287 } // namespace dart 287 } // namespace dart
288 288
289 #endif // defined TARGET_ARCH_X64 289 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/code_descriptors.cc ('k') | runtime/vm/simulator_arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698