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

Unified Diff: runtime/vm/code_patcher_ia32.cc

Issue 8351019: Code patching support and tests for new inline caches. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 2 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.h ('k') | runtime/vm/code_patcher_ia32_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_patcher_ia32.cc
===================================================================
--- runtime/vm/code_patcher_ia32.cc (revision 655)
+++ runtime/vm/code_patcher_ia32.cc (working copy)
@@ -21,10 +21,6 @@
// 3: call target_address
// <- return_address
class DartCallPattern : public ValueObject {
- private:
- static const int kNumInstructions = 3;
- static const int kInstructionSize = 5; // All instructions have same length.
-
public:
explicit DartCallPattern(uword return_address)
: start_(return_address - (kNumInstructions * kInstructionSize)) {
@@ -50,6 +46,12 @@
return *reinterpret_cast<uint32_t*>(start_ + 1);
}
+ void set_immediate_one(uint32_t value) {
+ uint32_t* target_addr = reinterpret_cast<uint32_t*>(start_ + 1);
+ *target_addr = value;
+ CPU::FlushICache(call_address(), kInstructionSize);
+ }
+
uint32_t immediate_two() const {
return *reinterpret_cast<uint32_t*>(start_ + kInstructionSize + 1);
}
@@ -72,6 +74,9 @@
return num_args.Value() - num_pos_args.Value();
}
+ static const int kNumInstructions = 3;
+ static const int kInstructionSize = 5; // All instructions have same length.
+
private:
uword return_address() const {
return start_ + kNumInstructions * kInstructionSize;
@@ -123,6 +128,10 @@
return array.raw();
}
+ void SetIcData(const Array& value) {
+ set_immediate_one(reinterpret_cast<int32_t>(value.raw()));
+ }
+
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceCall);
};
@@ -255,6 +264,24 @@
call.set_target(new_target);
}
+
+RawArray* CodePatcher::GetInstanceCallIcDataAt(uword return_address) {
+ InstanceCall call(return_address);
+ return call.ic_data();
+}
+
+
+void CodePatcher::SetInstanceCallIcDataAt(uword return_address,
+ const Array& ic_data) {
+ InstanceCall call(return_address);
+ call.SetIcData(ic_data);
+}
+
+
+intptr_t CodePatcher::InstanceCallSizeInBytes() {
+ return DartCallPattern::kNumInstructions * DartCallPattern::kInstructionSize;
+}
+
} // namespace dart
#endif // defined TARGET_ARCH_IA32
« no previous file with comments | « runtime/vm/code_patcher.h ('k') | runtime/vm/code_patcher_ia32_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698