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

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

Issue 11418046: First part of static call cleanup: store static call targets into code object, referenced by code-o… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
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/native_entry_test.h" 5 #include "vm/native_entry_test.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/code_patcher.h" 8 #include "vm/code_patcher.h"
9 #include "vm/native_entry.h" 9 #include "vm/native_entry.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 result += arg_value; 51 result += arg_value;
52 } 52 }
53 Dart_SetReturnValue(args, Dart_NewInteger(result)); 53 Dart_SetReturnValue(args, Dart_NewInteger(result));
54 Dart_ExitScope(); 54 Dart_ExitScope();
55 } 55 }
56 56
57 57
58 // Test code patching. 58 // Test code patching.
59 void TestStaticCallPatching(Dart_NativeArguments args) { 59 void TestStaticCallPatching(Dart_NativeArguments args) {
60 Dart_EnterScope(); 60 Dart_EnterScope();
61 uword target_address = 0;
62 Function& target_function = Function::Handle(); 61 Function& target_function = Function::Handle();
63 DartFrameIterator iterator; 62 DartFrameIterator iterator;
64 iterator.NextFrame(); // Skip native call. 63 iterator.NextFrame(); // Skip native call.
65 StackFrame* static_caller_frame = iterator.NextFrame(); 64 StackFrame* static_caller_frame = iterator.NextFrame();
65 uword target_address = 0;
siva 2012/11/16 23:15:23 TODO that you will replace GetStaticCallAt with Co
srdjan 2012/11/17 00:47:24 Addressed as discussed
66 CodePatcher::GetStaticCallAt(static_caller_frame->pc(), 66 CodePatcher::GetStaticCallAt(static_caller_frame->pc(),
67 &target_function, 67 &target_function,
68 &target_address); 68 &target_address);
69 const Function& target_function_2 =
70 Function::Handle(Code::GetStaticCallTargetAt(static_caller_frame->pc()));
71 EXPECT(!target_function_2.IsNull());
72 EXPECT_EQ(target_function_2.raw(), target_function.raw());
69 EXPECT(String::Handle(target_function.name()). 73 EXPECT(String::Handle(target_function.name()).
70 Equals(String::Handle(String::New("NativePatchStaticCall")))); 74 Equals(String::Handle(String::New("NativePatchStaticCall"))));
71 const uword function_entry_address = 75 const uword function_entry_address =
72 Code::Handle(target_function.CurrentCode()).EntryPoint(); 76 Code::Handle(target_function.CurrentCode()).EntryPoint();
73 EXPECT_EQ(function_entry_address, target_address); 77 EXPECT_EQ(function_entry_address, target_address);
74 Dart_ExitScope(); 78 Dart_ExitScope();
75 } 79 }
76 80
77 } // namespace dart 81 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698