Index: src/x64/macro-assembler-x64.h |
diff --git a/src/x64/macro-assembler-x64.h b/src/x64/macro-assembler-x64.h |
index 8352518323d44d9f872a02a5a4e55cd1d0dc2ce3..845de57cda4e849d44c5cfb49c015b9c1ce23dbd 100644 |
--- a/src/x64/macro-assembler-x64.h |
+++ b/src/x64/macro-assembler-x64.h |
@@ -58,6 +58,7 @@ typedef Operand MemOperand; |
// Forward declaration. |
class JumpTarget; |
+class PostCallGenerator; |
struct SmiIndex { |
SmiIndex(Register index_register, ScaleFactor scale) |
@@ -183,27 +184,33 @@ class MacroAssembler: public Assembler { |
void InvokeCode(Register code, |
const ParameterCount& expected, |
const ParameterCount& actual, |
- InvokeFlag flag); |
+ InvokeFlag flag, |
+ PostCallGenerator* post_call_generator = NULL); |
void InvokeCode(Handle<Code> code, |
const ParameterCount& expected, |
const ParameterCount& actual, |
RelocInfo::Mode rmode, |
- InvokeFlag flag); |
+ InvokeFlag flag, |
+ PostCallGenerator* post_call_generator = NULL); |
// Invoke the JavaScript function in the given register. Changes the |
// current context to the context in the function before invoking. |
void InvokeFunction(Register function, |
const ParameterCount& actual, |
- InvokeFlag flag); |
+ InvokeFlag flag, |
+ PostCallGenerator* post_call_generator = NULL); |
void InvokeFunction(JSFunction* function, |
const ParameterCount& actual, |
- InvokeFlag flag); |
+ InvokeFlag flag, |
+ PostCallGenerator* post_call_generator = NULL); |
// Invoke specified builtin JavaScript function. Adds an entry to |
// the unresolved list if the name does not resolve. |
- void InvokeBuiltin(Builtins::JavaScript id, InvokeFlag flag); |
+ void InvokeBuiltin(Builtins::JavaScript id, |
+ InvokeFlag flag, |
+ PostCallGenerator* post_call_generator = NULL); |
// Store the function for the given builtin in the target register. |
void GetBuiltinFunction(Register target, Builtins::JavaScript id); |
@@ -996,7 +1003,8 @@ class MacroAssembler: public Assembler { |
Handle<Code> code_constant, |
Register code_register, |
LabelType* done, |
- InvokeFlag flag); |
+ InvokeFlag flag, |
+ PostCallGenerator* post_call_generator); |
// Activation support. |
void EnterFrame(StackFrame::Type type); |
@@ -1050,6 +1058,17 @@ class CodePatcher { |
}; |
+// Helper class for generating code or data associated with the code |
+// right after a call instruction. As an example this can be used to |
+// generate safepoint data after calls for crankshaft. |
+class PostCallGenerator { |
+ public: |
+ PostCallGenerator() { } |
+ virtual ~PostCallGenerator() { } |
+ virtual void Generate() = 0; |
+}; |
+ |
+ |
// ----------------------------------------------------------------------------- |
// Static helper functions. |
@@ -1756,7 +1775,8 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
Handle<Code> code_constant, |
Register code_register, |
LabelType* done, |
- InvokeFlag flag) { |
+ InvokeFlag flag, |
+ PostCallGenerator* post_call_generator) { |
bool definitely_matches = false; |
NearLabel invoke; |
if (expected.is_immediate()) { |
@@ -1807,6 +1827,7 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
if (flag == CALL_FUNCTION) { |
Call(adaptor, RelocInfo::CODE_TARGET); |
+ if (post_call_generator != NULL) post_call_generator->Generate(); |
jmp(done); |
} else { |
Jump(adaptor, RelocInfo::CODE_TARGET); |