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

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

Issue 1192103004: VM: New calling convention for generated code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fixed comments Created 5 years, 3 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
« no previous file with comments | « runtime/vm/instructions_x64.h ('k') | runtime/vm/instructions_x64_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) 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/cpu.h"
9 #include "vm/instructions.h" 9 #include "vm/instructions.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
11 11
12 namespace dart { 12 namespace dart {
13 13
14 intptr_t IndexFromPPLoad(uword start) {
15 int32_t offset = *reinterpret_cast<int32_t*>(start);
16 return ObjectPool::IndexFromOffset(offset);
17 }
18
19
20 uword JumpPattern::TargetAddress() const {
21 ASSERT(IsValid());
22 int index = IndexFromPPLoad(start() + 3);
23 return object_pool_.RawValueAt(index);
24 }
25
26
27 void JumpPattern::SetTargetAddress(uword target) const {
28 ASSERT(IsValid());
29 int index = IndexFromPPLoad(start() + 3);
30 object_pool_.SetRawValueAt(index, target);
31 // No need to flush the instruction cache, since the code is not modified.
32 }
33
34
35 void ShortCallPattern::SetTargetAddress(uword target) const { 14 void ShortCallPattern::SetTargetAddress(uword target) const {
36 ASSERT(IsValid()); 15 ASSERT(IsValid());
37 *reinterpret_cast<uint32_t*>(start() + 1) = target - start() - kLengthInBytes; 16 *reinterpret_cast<uint32_t*>(start() + 1) = target - start() - kLengthInBytes;
38 CPU::FlushICache(start() + 1, kWordSize); 17 CPU::FlushICache(start() + 1, kWordSize);
39 } 18 }
40 19
41 20
42 } // namespace dart 21 } // namespace dart
43 22
44 #endif // defined TARGET_ARCH_X64 23 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/instructions_x64.h ('k') | runtime/vm/instructions_x64_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698