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

Side by Side Diff: vm/instructions_ia32.cc

Issue 8379013: Implement new inline cache. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 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 | « vm/instructions_ia32.h ('k') | vm/instructions_ia32_test.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/instructions.h" 8 #include "vm/instructions.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 10
11 namespace dart { 11 namespace dart {
12 12
13 bool Instruction::TestBytesWith(const int* data, int num_bytes) const { 13 bool Instruction::TestBytesWith(const int* data, int num_bytes) const {
14 ASSERT(data != NULL); 14 ASSERT(data != NULL);
15 const uint8_t* byte_array = reinterpret_cast<const uint8_t*>(start_); 15 const uint8_t* byte_array = reinterpret_cast<const uint8_t*>(start_);
16 for (int i = 0; i < num_bytes; i++) { 16 for (int i = 0; i < num_bytes; i++) {
17 // Skip comparison for data[i] < 0. 17 // Skip comparison for data[i] < 0.
18 if ((data[i] >= 0) && (byte_array[i] != (0xFF & data[i]))) { 18 if ((data[i] >= 0) && (byte_array[i] != (0xFF & data[i]))) {
19 return false; 19 return false;
20 } 20 }
21 } 21 }
22 return true; 22 return true;
23 } 23 }
24 24
25 25
26 const int* ICLoadReceiver::pattern() const {
27 static const int kLoadReceiverPattern[kLengthInBytes] =
28 {0x8b, 0x42, 0x0b, 0x8b, 0x04, 0x44};
29 return kLoadReceiverPattern;
30 }
31
32
33 uword JumpIfZero::TargetAddress() const {
34 ASSERT(IsValid());
35 return start() + kLengthInBytes + *reinterpret_cast<uword*>(start() + 2);
36 }
37
38
39 void JumpIfZero::SetTargetAddress(uword pc) {
40 ASSERT(IsValid());
41 *reinterpret_cast<uword*>(start() + 2) = pc - start() - kLengthInBytes;
42 }
43
44
45 const int* JumpIfZero::pattern() const {
46 static const int kJzPattern[kLengthInBytes] = {0x0f, 0x84, -1, -1, -1, -1};
47 return kJzPattern;
48 }
49
50
51 const int* CmpEaxWithImmediate::pattern() const {
52 static const int kCmpWithImmediate[kLengthInBytes] = {0x3d, -1, -1, -1, -1};
53 return kCmpWithImmediate;
54 }
55
56
57 const int* TestEaxIsSmi::pattern() const {
58 static const int
59 kTestSmiTag[kTestLengthInBytes + JumpIfZero::kLengthInBytes] =
60 { 0xa8, 0x01, -1, -1, -1, -1, -1, -1};
61 return kTestSmiTag;
62 }
63
64
65 const int* ICCheckReceiverClass::pattern() const {
66 static const int kTestClass[kTestLengthInBytes + JumpIfZero::kLengthInBytes] =
67 {0x81, 0xfb, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
68 return kTestClass;
69 }
70
71
72 RawClass* ICCheckReceiverClass::TestClass() const {
73 ASSERT(IsValid());
74 Class& cls = Class::Handle();
75 cls ^= *reinterpret_cast<RawObject**>(start() + 2);
76 return cls.raw();
77 }
78
79
80 const int* LoadObjectClass::pattern() const {
81 static const int kTestClass[kLoadObjectClassLengthInBytes] =
82 {0x8b, 0x58, 0xff};
83 return kTestClass;
84 }
85
86 uword CallOrJump::TargetAddress() const { 26 uword CallOrJump::TargetAddress() const {
87 ASSERT(IsValid()); 27 ASSERT(IsValid());
88 return start() + kLengthInBytes + *reinterpret_cast<uword*>(start() + 1); 28 return start() + kLengthInBytes + *reinterpret_cast<uword*>(start() + 1);
89 } 29 }
90 30
91 31
92 void CallOrJump::SetTargetAddress(uword target) const { 32 void CallOrJump::SetTargetAddress(uword target) const {
93 ASSERT(IsValid()); 33 ASSERT(IsValid());
94 *reinterpret_cast<uword*>(start() + 1) = target - start() - kLengthInBytes; 34 *reinterpret_cast<uword*>(start() + 1) = target - start() - kLengthInBytes;
95 } 35 }
96 36
97 37
98 const int* Call::pattern() const { 38 const int* Call::pattern() const {
99 static const int kCallPattern[kLengthInBytes] = {0xE8, -1, -1, -1, -1}; 39 static const int kCallPattern[kLengthInBytes] = {0xE8, -1, -1, -1, -1};
100 return kCallPattern; 40 return kCallPattern;
101 } 41 }
102 42
103 43
104 const int* Jump::pattern() const { 44 const int* Jump::pattern() const {
105 static const int kJumpPattern[kLengthInBytes] = {0xE9, -1, -1, -1, -1}; 45 static const int kJumpPattern[kLengthInBytes] = {0xE9, -1, -1, -1, -1};
106 return kJumpPattern; 46 return kJumpPattern;
107 } 47 }
108 48
109 49
110 } // namespace dart 50 } // namespace dart
111 51
112 #endif // defined TARGET_ARCH_IA32 52 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « vm/instructions_ia32.h ('k') | vm/instructions_ia32_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698