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

Unified Diff: runtime/vm/unit_test.h

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/thread.h ('k') | runtime/vm/weak_code.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/unit_test.h
diff --git a/runtime/vm/unit_test.h b/runtime/vm/unit_test.h
index d4853e4ca1e3f5f17f0db309d32bcab46b141eb4..6e1ca5c04dcb0e500327897dbb102fc8a0982a38 100644
--- a/runtime/vm/unit_test.h
+++ b/runtime/vm/unit_test.h
@@ -360,34 +360,36 @@ class AssemblerTest {
uword entry() const { return code_.EntryPoint(); }
- // Invoke is used to call assembler test functions using the ABI calling
- // convention.
+ // Invoke/InvokeWithCode is used to call assembler test functions using the
+ // ABI calling convention.
// ResultType is the return type of the assembler test function.
// ArgNType is the type of the Nth argument.
#if defined(USING_SIMULATOR)
#if defined(ARCH_IS_64_BIT)
- // TODO(fschneider): Make Invoke<> more general and work on 32-bit platforms.
+ // TODO(fschneider): Make InvokeWithCode<> more general and work on 32-bit.
// Since Simulator::Call always return a int64_t, bit_cast does not work
// on 32-bit platforms when returning an int32_t. Since template functions
// don't support partial specialization, we'd need to introduce a helper
// class to support 32-bit return types.
- template<typename ResultType> ResultType Invoke() {
+ template<typename ResultType> ResultType InvokeWithCode() {
const bool fp_return = is_double<ResultType>::value;
const bool fp_args = false;
return bit_cast<ResultType, int64_t>(Simulator::Current()->Call(
- bit_cast<intptr_t, uword>(entry()), 0, 0, 0, 0, fp_return, fp_args));
+ bit_cast<intptr_t, uword>(entry()),
+ reinterpret_cast<intptr_t>(&code_), 0, 0, 0, fp_return, fp_args));
}
template<typename ResultType, typename Arg1Type>
- ResultType Invoke(Arg1Type arg1) {
+ ResultType InvokeWithCode(Arg1Type arg1) {
const bool fp_return = is_double<ResultType>::value;
const bool fp_args = is_double<Arg1Type>::value;
// TODO(fschneider): Support double arguments for simulator calls.
COMPILE_ASSERT(!fp_args);
return bit_cast<ResultType, int64_t>(Simulator::Current()->Call(
bit_cast<intptr_t, uword>(entry()),
+ reinterpret_cast<intptr_t>(&code_),
reinterpret_cast<intptr_t>(arg1),
- 0, 0, 0, fp_return, fp_args));
+ 0, 0, fp_return, fp_args));
}
#endif // ARCH_IS_64_BIT
@@ -411,15 +413,15 @@ class AssemblerTest {
0, fp_return, fp_args);
}
#else
- template<typename ResultType> ResultType Invoke() {
- typedef ResultType (*FunctionType) ();
- return reinterpret_cast<FunctionType>(entry())();
+ template<typename ResultType> ResultType InvokeWithCode() {
+ typedef ResultType (*FunctionType) (const Code&);
+ return reinterpret_cast<FunctionType>(entry())(code_);
}
template<typename ResultType, typename Arg1Type>
- ResultType Invoke(Arg1Type arg1) {
- typedef ResultType (*FunctionType) (Arg1Type);
- return reinterpret_cast<FunctionType>(entry())(arg1);
+ ResultType InvokeWithCode(Arg1Type arg1) {
+ typedef ResultType (*FunctionType) (const Code&, Arg1Type);
+ return reinterpret_cast<FunctionType>(entry())(code_, arg1);
}
template<typename ResultType,
« no previous file with comments | « runtime/vm/thread.h ('k') | runtime/vm/weak_code.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698