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

Unified Diff: runtime/vm/code_patcher_x64.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/code_patcher_mips_test.cc ('k') | runtime/vm/code_patcher_x64_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_patcher_x64.cc
===================================================================
--- runtime/vm/code_patcher_x64.cc (revision 24306)
+++ runtime/vm/code_patcher_x64.cc (working copy)
@@ -15,15 +15,14 @@
namespace dart {
-// A Dart instance call passes the ic-data in RBX.
-// The expected pattern of a dart instance call:
+// The expected pattern of a Dart unoptimized call (static and instance):
// 00: 48 bb imm64 mov RBX, ic-data
// 10: 49 bb imm64 mov R11, target_address
// 20: 41 ff d3 call R11
// 23 <- return address
-class InstanceCall : public ValueObject {
+class UnoptimizedCall : public ValueObject {
public:
- explicit InstanceCall(uword return_address)
+ explicit UnoptimizedCall(uword return_address)
: start_(return_address - kCallPatternSize) {
ASSERT(IsValid(return_address));
ASSERT((kCallPatternSize - 10) == Assembler::kCallExternalLabelSize);
@@ -56,10 +55,42 @@
private:
uword start_;
+ DISALLOW_IMPLICIT_CONSTRUCTORS(UnoptimizedCall);
+};
+
+
+class InstanceCall : public UnoptimizedCall {
+ public:
+ explicit InstanceCall(uword return_address)
+ : UnoptimizedCall(return_address) {
+#if defined(DEBUG)
+ ICData& test_ic_data = ICData::Handle();
+ test_ic_data ^= ic_data();
+ ASSERT(test_ic_data.num_args_tested() > 0);
+#endif // DEBUG
+ }
+
+ private:
DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceCall);
};
+class UnoptimizedStaticCall : public UnoptimizedCall {
+ public:
+ explicit UnoptimizedStaticCall(uword return_address)
+ : UnoptimizedCall(return_address) {
+#if defined(DEBUG)
+ ICData& test_ic_data = ICData::Handle();
+ test_ic_data ^= ic_data();
+ ASSERT(test_ic_data.num_args_tested() == 0);
+#endif // DEBUG
+ }
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(UnoptimizedStaticCall);
+};
+
+
// The expected pattern of a dart static call:
// mov R10, arguments_descriptor_array (10 bytes) (optional in polym. calls)
// mov R11, target_address (10 bytes)
@@ -183,6 +214,16 @@
}
+RawFunction* CodePatcher::GetUnoptimizedStaticCallTargetAt(
+ uword return_address, const Code& code) {
+ ASSERT(code.ContainsInstructionAt(return_address));
+ UnoptimizedStaticCall static_call(return_address);
+ ICData& ic_data = ICData::Handle();
+ ic_data ^= static_call.ic_data();
+ return ic_data.GetTargetAt(0);
+}
+
+
void CodePatcher::InsertCallAt(uword start, uword target) {
// The inserted call should not overlap the lazy deopt jump code.
ASSERT(start + ShortCallPattern::InstructionLength() <= target);
« no previous file with comments | « runtime/vm/code_patcher_mips_test.cc ('k') | runtime/vm/code_patcher_x64_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698