Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 263 return (bytes[0] == 0x49) && (bytes[1] == 0x8b) && (bytes[2] == 0x87); | 263 return (bytes[0] == 0x49) && (bytes[1] == 0x8b) && (bytes[2] == 0x87); |
| 264 } | 264 } |
| 265 | 265 |
| 266 RawObject* edge_counter() const { | 266 RawObject* edge_counter() const { |
| 267 return object_pool_.At(InstructionPattern::IndexFromPPLoad(end_ - 4)); | 267 return object_pool_.At(InstructionPattern::IndexFromPPLoad(end_ - 4)); |
| 268 } | 268 } |
| 269 | 269 |
| 270 private: | 270 private: |
| 271 // The edge counter load is followed by the fixed-size edge counter | 271 // The edge counter load is followed by the fixed-size edge counter |
| 272 // incrementing code: | 272 // incrementing code: |
| 273 // 49 c7 c3 02 00 00 00 movq r11,0x2 | 273 // 48 83 40 17 02 addq [rax+0x17],0x2 |
|
Florian Schneider
2013/10/01 11:11:05
How about using incq to save one more byte?
| |
| 274 // 4c 01 58 17 addq [rax+0x17],r11 | 274 static const intptr_t kAdjust = 5; |
| 275 static const intptr_t kAdjust = 11; | |
| 276 | 275 |
| 277 uword end_; | 276 uword end_; |
| 278 const Array& object_pool_; | 277 const Array& object_pool_; |
| 279 }; | 278 }; |
| 280 | 279 |
| 281 | 280 |
| 282 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) { | 281 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) { |
| 283 ASSERT(code.ContainsInstructionAt(pc)); | 282 ASSERT(code.ContainsInstructionAt(pc)); |
| 284 EdgeCounter counter(pc, code); | 283 EdgeCounter counter(pc, code); |
| 285 return counter.edge_counter(); | 284 return counter.edge_counter(); |
| 286 } | 285 } |
| 287 | 286 |
| 288 } // namespace dart | 287 } // namespace dart |
| 289 | 288 |
| 290 #endif // defined TARGET_ARCH_X64 | 289 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |