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

Unified Diff: runtime/vm/code_patcher_ia32.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
Index: runtime/vm/code_patcher_ia32.cc
===================================================================
--- runtime/vm/code_patcher_ia32.cc (revision 24288)
+++ runtime/vm/code_patcher_ia32.cc (working copy)
@@ -15,13 +15,13 @@
namespace dart {
-// The expected pattern of a dart instance call:
+// The expected pattern of a Dart unoptimized call (static and instance):
// mov ECX, ic-data
-// call target_address
+// call target_address (stub)
// <- return address
-class InstanceCall : public ValueObject {
+class UnoptimizedCall : public ValueObject {
public:
- explicit InstanceCall(uword return_address)
+ explicit UnoptimizedCall(uword return_address)
: start_(return_address - (kNumInstructions * kInstructionSize)) {
ASSERT(IsValid(return_address));
ASSERT(kInstructionSize == Assembler::kCallExternalLabelSize);
@@ -64,10 +64,42 @@
}
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 EDX, arguments_descriptor_array (optional in polymorphic calls)
// call target_address
@@ -211,6 +243,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);
+}
+
+
intptr_t CodePatcher::InstanceCallSizeInBytes() {
return InstanceCall::kNumInstructions * InstanceCall::kInstructionSize;
}

Powered by Google App Engine
This is Rietveld 408576698