Index: src/x64/macro-assembler-x64.cc |
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc |
index b468e82f9545d65508f3f0f69cd7cc1a922717e9..c6829c5bfb971d0a8398425caba303230736386f 100644 |
--- a/src/x64/macro-assembler-x64.cc |
+++ b/src/x64/macro-assembler-x64.cc |
@@ -638,7 +638,7 @@ MaybeObject* MacroAssembler::TryJumpToExternalReference( |
void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, |
InvokeFlag flag, |
- PostCallGenerator* post_call_generator) { |
+ CallWrapper* call_wrapper) { |
// Calls are not allowed in some stubs. |
ASSERT(flag == JUMP_FUNCTION || allow_stub_calls()); |
@@ -647,7 +647,7 @@ void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, |
// parameter count to avoid emitting code to do the check. |
ParameterCount expected(0); |
GetBuiltinEntry(rdx, id); |
- InvokeCode(rdx, expected, expected, flag, post_call_generator); |
+ InvokeCode(rdx, expected, expected, flag, call_wrapper); |
} |
@@ -1424,20 +1424,41 @@ void MacroAssembler::Jump(Handle<Code> code_object, RelocInfo::Mode rmode) { |
void MacroAssembler::Call(ExternalReference ext) { |
+#ifdef DEBUG |
+ int pre_position = pc_offset(); |
+#endif |
movq(kScratchRegister, ext); |
call(kScratchRegister); |
+#ifdef DEBUG |
+ int post_position = pc_offset(); |
+ CHECK_EQ(pre_position + CallSize(ext), post_position); |
+#endif |
} |
void MacroAssembler::Call(Address destination, RelocInfo::Mode rmode) { |
+#ifdef DEBUG |
+ int pre_position = pc_offset(); |
+#endif |
movq(kScratchRegister, destination, rmode); |
call(kScratchRegister); |
+#ifdef DEBUG |
+ int post_position = pc_offset(); |
+ CHECK_EQ(pre_position + CallSize(destination, rmode), post_position); |
+#endif |
} |
void MacroAssembler::Call(Handle<Code> code_object, RelocInfo::Mode rmode) { |
+#ifdef DEBUG |
+ int pre_position = pc_offset(); |
+#endif |
ASSERT(RelocInfo::IsCodeTarget(rmode)); |
call(code_object, rmode); |
+#ifdef DEBUG |
+ int post_position = pc_offset(); |
+ CHECK_EQ(pre_position + CallSize(code_object), post_position); |
+#endif |
} |
@@ -1868,7 +1889,7 @@ void MacroAssembler::InvokeCode(Register code, |
const ParameterCount& expected, |
const ParameterCount& actual, |
InvokeFlag flag, |
- PostCallGenerator* post_call_generator) { |
+ CallWrapper* call_wrapper) { |
NearLabel done; |
InvokePrologue(expected, |
actual, |
@@ -1876,10 +1897,11 @@ void MacroAssembler::InvokeCode(Register code, |
code, |
&done, |
flag, |
- post_call_generator); |
+ call_wrapper); |
if (flag == CALL_FUNCTION) { |
+ if (call_wrapper != NULL) call_wrapper->BeforeCall(CallSize(code)); |
call(code); |
- if (post_call_generator != NULL) post_call_generator->Generate(); |
+ if (call_wrapper != NULL) call_wrapper->AfterCall(); |
} else { |
ASSERT(flag == JUMP_FUNCTION); |
jmp(code); |
@@ -1893,7 +1915,7 @@ void MacroAssembler::InvokeCode(Handle<Code> code, |
const ParameterCount& actual, |
RelocInfo::Mode rmode, |
InvokeFlag flag, |
- PostCallGenerator* post_call_generator) { |
+ CallWrapper* call_wrapper) { |
NearLabel done; |
Register dummy = rax; |
InvokePrologue(expected, |
@@ -1902,10 +1924,11 @@ void MacroAssembler::InvokeCode(Handle<Code> code, |
dummy, |
&done, |
flag, |
- post_call_generator); |
+ call_wrapper); |
if (flag == CALL_FUNCTION) { |
+ if (call_wrapper != NULL) call_wrapper->BeforeCall(CallSize(code)); |
Call(code, rmode); |
- if (post_call_generator != NULL) post_call_generator->Generate(); |
+ if (call_wrapper != NULL) call_wrapper->AfterCall(); |
} else { |
ASSERT(flag == JUMP_FUNCTION); |
Jump(code, rmode); |
@@ -1917,7 +1940,7 @@ void MacroAssembler::InvokeCode(Handle<Code> code, |
void MacroAssembler::InvokeFunction(Register function, |
const ParameterCount& actual, |
InvokeFlag flag, |
- PostCallGenerator* post_call_generator) { |
+ CallWrapper* call_wrapper) { |
ASSERT(function.is(rdi)); |
movq(rdx, FieldOperand(function, JSFunction::kSharedFunctionInfoOffset)); |
movq(rsi, FieldOperand(function, JSFunction::kContextOffset)); |
@@ -1928,14 +1951,14 @@ void MacroAssembler::InvokeFunction(Register function, |
movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); |
ParameterCount expected(rbx); |
- InvokeCode(rdx, expected, actual, flag, post_call_generator); |
+ InvokeCode(rdx, expected, actual, flag, call_wrapper); |
} |
void MacroAssembler::InvokeFunction(JSFunction* function, |
const ParameterCount& actual, |
InvokeFlag flag, |
- PostCallGenerator* post_call_generator) { |
+ CallWrapper* call_wrapper) { |
ASSERT(function->is_compiled()); |
// Get the function and setup the context. |
Move(rdi, Handle<JSFunction>(function)); |
@@ -1946,7 +1969,7 @@ void MacroAssembler::InvokeFunction(JSFunction* function, |
// the Code object every time we call the function. |
movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); |
ParameterCount expected(function->shared()->formal_parameter_count()); |
- InvokeCode(rdx, expected, actual, flag, post_call_generator); |
+ InvokeCode(rdx, expected, actual, flag, call_wrapper); |
} else { |
// Invoke the cached code. |
Handle<Code> code(function->code()); |
@@ -1956,7 +1979,7 @@ void MacroAssembler::InvokeFunction(JSFunction* function, |
actual, |
RelocInfo::CODE_TARGET, |
flag, |
- post_call_generator); |
+ call_wrapper); |
} |
} |