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

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

Issue 12439005: Implement leaf runtime call stub on ARM and corresponding call redirection (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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/instructions_mips.cc ('k') | runtime/vm/runtime_entry_arm.cc » ('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/cpu.h"
8 #include "vm/instructions.h" 9 #include "vm/instructions.h"
9 #include "vm/object.h" 10 #include "vm/object.h"
10 11
11 namespace dart { 12 namespace dart {
12 13
13 bool InstructionPattern::TestBytesWith(const int* data, int num_bytes) const { 14 bool InstructionPattern::TestBytesWith(const int* data, int num_bytes) const {
14 ASSERT(data != NULL); 15 ASSERT(data != NULL);
15 const uint8_t* byte_array = reinterpret_cast<const uint8_t*>(start_); 16 const uint8_t* byte_array = reinterpret_cast<const uint8_t*>(start_);
16 for (int i = 0; i < num_bytes; i++) { 17 for (int i = 0; i < num_bytes; i++) {
17 // Skip comparison for data[i] < 0. 18 // Skip comparison for data[i] < 0.
18 if ((data[i] >= 0) && (byte_array[i] != (0xFF & data[i]))) { 19 if ((data[i] >= 0) && (byte_array[i] != (0xFF & data[i]))) {
19 return false; 20 return false;
20 } 21 }
21 } 22 }
22 return true; 23 return true;
23 } 24 }
24 25
25 26
26 uword CallOrJumpPattern::TargetAddress() const { 27 uword CallOrJumpPattern::TargetAddress() const {
27 ASSERT(IsValid()); 28 ASSERT(IsValid());
28 return *reinterpret_cast<uword*>(start() + 2); 29 return *reinterpret_cast<uword*>(start() + 2);
29 } 30 }
30 31
31 32
32 void CallOrJumpPattern::SetTargetAddress(uword target) const { 33 void CallOrJumpPattern::SetTargetAddress(uword target) const {
33 ASSERT(IsValid()); 34 ASSERT(IsValid());
34 *reinterpret_cast<uword*>(start() + 2) = target; 35 *reinterpret_cast<uword*>(start() + 2) = target;
36 CPU::FlushICache(start() + 2, kWordSize);
35 } 37 }
36 38
37 39
38 const int* CallPattern::pattern() const { 40 const int* CallPattern::pattern() const {
39 // movq $target, TMP 41 // movq $target, TMP
40 // callq *TMP 42 // callq *TMP
41 static const int kCallPattern[kLengthInBytes] = 43 static const int kCallPattern[kLengthInBytes] =
42 {0x49, 0xBB, -1, -1, -1, -1, -1, -1, -1, -1, 0x41, 0xFF, 0xD3}; 44 {0x49, 0xBB, -1, -1, -1, -1, -1, -1, -1, -1, 0x41, 0xFF, 0xD3};
43 return kCallPattern; 45 return kCallPattern;
44 } 46 }
45 47
46 48
47 const int* JumpPattern::pattern() const { 49 const int* JumpPattern::pattern() const {
48 // movq $target, TMP 50 // movq $target, TMP
49 // jmpq TMP 51 // jmpq TMP
50 static const int kJumpPattern[kLengthInBytes] = 52 static const int kJumpPattern[kLengthInBytes] =
51 {0x49, 0xBB, -1, -1, -1, -1, -1, -1, -1, -1, 0x41, 0xFF, 0xE3}; 53 {0x49, 0xBB, -1, -1, -1, -1, -1, -1, -1, -1, 0x41, 0xFF, 0xE3};
52 return kJumpPattern; 54 return kJumpPattern;
53 } 55 }
54 56
55 57
56 void ShortCallPattern::SetTargetAddress(uword target) const { 58 void ShortCallPattern::SetTargetAddress(uword target) const {
57 ASSERT(IsValid()); 59 ASSERT(IsValid());
58 *reinterpret_cast<uint32_t*>(start() + 1) = target - start() - kLengthInBytes; 60 *reinterpret_cast<uint32_t*>(start() + 1) = target - start() - kLengthInBytes;
61 CPU::FlushICache(start() + 1, kWordSize);
59 } 62 }
60 63
61 64
62 const int* ShortCallPattern::pattern() const { 65 const int* ShortCallPattern::pattern() const {
63 static const int kCallPattern[kLengthInBytes] = {0xE8, -1, -1, -1, -1}; 66 static const int kCallPattern[kLengthInBytes] = {0xE8, -1, -1, -1, -1};
64 return kCallPattern; 67 return kCallPattern;
65 } 68 }
66 69
67 } // namespace dart 70 } // namespace dart
68 71
69 #endif // defined TARGET_ARCH_X64 72 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/instructions_mips.cc ('k') | runtime/vm/runtime_entry_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698