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

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

Issue 17554003: Change static calls in unoptimized code to always call via a stub. Using ICData, the call count of … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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
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/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/native_entry.h" 10 #include "vm/native_entry.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 EXPECT_VALID(Dart_IntegerToInt64(arg, &arg_value)); 80 EXPECT_VALID(Dart_IntegerToInt64(arg, &arg_value));
81 EXPECT_EQ(arg_value, argument.AsInt64Value()); 81 EXPECT_EQ(arg_value, argument.AsInt64Value());
82 // Ignoring overflow in the addition below. 82 // Ignoring overflow in the addition below.
83 result += arg_value; 83 result += arg_value;
84 } 84 }
85 } 85 }
86 Dart_SetReturnValue(args, Dart_NewInteger(result)); 86 Dart_SetReturnValue(args, Dart_NewInteger(result));
87 Dart_ExitScope(); 87 Dart_ExitScope();
88 } 88 }
89 89
90
91 // Test code patching.
92 void TestStaticCallPatching(Dart_NativeArguments args) {
93 Dart_EnterScope();
94 DartFrameIterator iterator;
95 iterator.NextFrame(); // Skip native call.
96 StackFrame* static_caller_frame = iterator.NextFrame();
97 const Code& code = Code::Handle(static_caller_frame->LookupDartCode());
98 uword target_address =
99 CodePatcher::GetStaticCallTargetAt(static_caller_frame->pc(), code);
100 const Function& target_function =
101 Function::Handle(code.GetStaticCallTargetFunctionAt(
102 static_caller_frame->pc()));
103 EXPECT(String::Handle(target_function.name()).
104 Equals(String::Handle(String::New("NativePatchStaticCall"))));
105 const uword function_entry_address =
106 Code::Handle(target_function.CurrentCode()).EntryPoint();
107 EXPECT_EQ(function_entry_address, target_address);
108 Dart_ExitScope();
109 }
110
111 } // namespace dart 90 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/native_entry_test.h ('k') | runtime/vm/object.h » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698