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

Unified Diff: runtime/vm/code_patcher_ia32.cc

Issue 8588014: Addition to CodePatcher (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month 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_arm.cc ('k') | runtime/vm/code_patcher_x64.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 1620)
+++ runtime/vm/code_patcher_ia32.cc (working copy)
@@ -24,12 +24,19 @@
public:
explicit DartCallPattern(uword return_address)
: start_(return_address - (kNumInstructions * kInstructionSize)) {
- ASSERT(*reinterpret_cast<uint8_t*>(start_) == 0xB9);
- ASSERT(*reinterpret_cast<uint8_t*>(start_ + 1 * kInstructionSize) == 0xBA);
- ASSERT(*reinterpret_cast<uint8_t*>(start_ + 2 * kInstructionSize) == 0xE8);
+ ASSERT(IsValid(return_address));
ASSERT(kInstructionSize == Assembler::kCallExternalLabelSize);
}
+ static bool IsValid(uword return_address) {
+ uint8_t* code_bytes =
+ reinterpret_cast<uint8_t*>(
+ return_address - (kNumInstructions * kInstructionSize));
+ return (code_bytes[0] == 0xB9) &&
+ (code_bytes[kInstructionSize] == 0xBA) &&
+ (code_bytes[2 * kInstructionSize] == 0xE8);
+ }
+
uword target() const {
const uword offset = *reinterpret_cast<uword*>(call_address() + 1);
return return_address() + offset;
@@ -217,6 +224,11 @@
}
+bool CodePatcher::IsDartCall(uword return_address) {
+ return DartCallPattern::IsValid(return_address);
+}
+
+
void CodePatcher::GetInstanceCallAt(uword return_address,
String* function_name,
int* num_arguments,
« no previous file with comments | « runtime/vm/code_patcher_arm.cc ('k') | runtime/vm/code_patcher_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698