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

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

Issue 63093003: Fix for issue 14790 - Crash when using dartium devtools (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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/flow_graph_compiler_x64.cc ('k') | runtime/vm/object_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" 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"
11 #include "vm/unit_test.h" 11 #include "vm/unit_test.h"
12 12
13 namespace dart { 13 namespace dart {
14 14
15 #define __ assembler-> 15 #define __ assembler->
16 16
17 ASSEMBLER_TEST_GENERATE(Call, assembler) { 17 ASSEMBLER_TEST_GENERATE(Call, assembler) {
18 __ call(&StubCode::InstanceFunctionLookupLabel()); 18 __ call(&StubCode::InstanceFunctionLookupLabel());
19 __ ret(); 19 __ ret();
20 } 20 }
21 21
22 22
23 ASSEMBLER_TEST_RUN(Call, test) { 23 ASSEMBLER_TEST_RUN(Call, test) {
24 CallPattern call(test->entry(), test->code()); 24 CallPattern call(test->entry(), test->code());
25 EXPECT_EQ(StubCode::InstanceFunctionLookupLabel().address(), 25 EXPECT_EQ(StubCode::InstanceFunctionLookupLabel().address(),
26 call.TargetAddress()); 26 call.TargetAddress());
27 } 27 }
28 28
29 29
30 static intptr_t prologue_code_size = -1;
31
32
30 ASSEMBLER_TEST_GENERATE(Jump, assembler) { 33 ASSEMBLER_TEST_GENERATE(Jump, assembler) {
31 __ EnterDartFrame(0); // 20 bytes 34 ASSERT(assembler->CodeSize() == 0);
35 __ pushq(PP);
36 __ LoadPoolPointer(PP);
37 prologue_code_size = assembler->CodeSize();
32 __ JmpPatchable(&StubCode::InstanceFunctionLookupLabel(), PP); 38 __ JmpPatchable(&StubCode::InstanceFunctionLookupLabel(), PP);
33 __ JmpPatchable(&StubCode::AllocateArrayLabel(), PP); 39 __ JmpPatchable(&StubCode::AllocateArrayLabel(), PP);
34 __ LeaveFrameWithPP(); 40 __ popq(PP);
35 __ ret(); 41 __ ret();
36 } 42 }
37 43
38 44
39 ASSEMBLER_TEST_RUN(Jump, test) { 45 ASSEMBLER_TEST_RUN(Jump, test) {
40 JumpPattern jump1(test->entry() + 20, test->code()); 46 ASSERT(prologue_code_size != -1);
47 JumpPattern jump1(test->entry() + prologue_code_size, test->code());
41 jump1.IsValid(); 48 jump1.IsValid();
42 EXPECT_EQ(StubCode::InstanceFunctionLookupLabel().address(), 49 EXPECT_EQ(StubCode::InstanceFunctionLookupLabel().address(),
43 jump1.TargetAddress()); 50 jump1.TargetAddress());
44 JumpPattern jump2(test->entry() + jump1.pattern_length_in_bytes() + 20, 51 JumpPattern jump2((test->entry() +
52 jump1.pattern_length_in_bytes() + prologue_code_size),
45 test->code()); 53 test->code());
46 EXPECT_EQ(StubCode::AllocateArrayLabel().address(), 54 EXPECT_EQ(StubCode::AllocateArrayLabel().address(),
47 jump2.TargetAddress()); 55 jump2.TargetAddress());
48 uword target1 = jump1.TargetAddress(); 56 uword target1 = jump1.TargetAddress();
49 uword target2 = jump2.TargetAddress(); 57 uword target2 = jump2.TargetAddress();
50 jump1.SetTargetAddress(target2); 58 jump1.SetTargetAddress(target2);
51 jump2.SetTargetAddress(target1); 59 jump2.SetTargetAddress(target1);
52 EXPECT_EQ(StubCode::AllocateArrayLabel().address(), 60 EXPECT_EQ(StubCode::AllocateArrayLabel().address(),
53 jump1.TargetAddress()); 61 jump1.TargetAddress());
54 EXPECT_EQ(StubCode::InstanceFunctionLookupLabel().address(), 62 EXPECT_EQ(StubCode::InstanceFunctionLookupLabel().address(),
55 jump2.TargetAddress()); 63 jump2.TargetAddress());
56 } 64 }
57 65
58 } // namespace dart 66 } // namespace dart
59 67
60 #endif // defined TARGET_ARCH_X64 68 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/object_x64_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698