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

Side by Side Diff: runtime/vm/instructions_x64_test.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.cc ('k') | runtime/vm/intermediate_language.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" 5 #include "vm/globals.h"
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/instructions.h" 9 #include "vm/instructions.h"
10 #include "vm/stub_code.h" 10 #include "vm/stub_code.h"
(...skipping 17 matching lines...) Expand all
28 __ pushq(PP); 28 __ pushq(PP);
29 __ LoadPoolPointer(); 29 __ LoadPoolPointer();
30 prologue_code_size = assembler->CodeSize(); 30 prologue_code_size = assembler->CodeSize();
31 __ JmpPatchable(*StubCode::InvokeDartCode_entry(), PP); 31 __ JmpPatchable(*StubCode::InvokeDartCode_entry(), PP);
32 __ JmpPatchable(*StubCode::AllocateArray_entry(), PP); 32 __ JmpPatchable(*StubCode::AllocateArray_entry(), PP);
33 __ popq(PP); 33 __ popq(PP);
34 __ ret(); 34 __ ret();
35 } 35 }
36 36
37 37
38 ASSEMBLER_TEST_RUN(Jump, test) {
39 ASSERT(prologue_code_size != -1);
40 const Code& code = test->code();
41 const Instructions& instrs = Instructions::Handle(code.instructions());
42 bool status =
43 VirtualMemory::Protect(reinterpret_cast<void*>(instrs.EntryPoint()),
44 instrs.size(),
45 VirtualMemory::kReadWrite);
46 EXPECT(status);
47 JumpPattern jump1(test->entry() + prologue_code_size, test->code());
48 jump1.IsValid();
49 EXPECT_EQ(StubCode::InvokeDartCode_entry()->label().address(),
50 jump1.TargetAddress());
51 JumpPattern jump2((test->entry() +
52 jump1.pattern_length_in_bytes() + prologue_code_size),
53 test->code());
54 const Code& array_stub =
55 Code::Handle(StubCode::AllocateArray_entry()->code());
56 EXPECT_EQ(array_stub.EntryPoint(), jump2.TargetAddress());
57 uword target1 = jump1.TargetAddress();
58 uword target2 = jump2.TargetAddress();
59 jump1.SetTargetAddress(target2);
60 jump2.SetTargetAddress(target1);
61 EXPECT_EQ(array_stub.EntryPoint(), jump1.TargetAddress());
62 EXPECT_EQ(StubCode::InvokeDartCode_entry()->label().address(),
63 jump2.TargetAddress());
64 }
65
66 } // namespace dart 38 } // namespace dart
67 39
68 #endif // defined TARGET_ARCH_X64 40 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/instructions_x64.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698