Chromium Code Reviews| Index: src/x64/codegen-x64.cc |
| diff --git a/src/x64/codegen-x64.cc b/src/x64/codegen-x64.cc |
| index 3112ecc1262a034db63729e72031397ec1871ef8..4c2ae7a65e19827324541cb5abcaccfb070cea5b 100644 |
| --- a/src/x64/codegen-x64.cc |
| +++ b/src/x64/codegen-x64.cc |
| @@ -3421,6 +3421,16 @@ void CodeGenerator::GenerateObjectEquals(ZoneList<Expression*>* args) { |
| } |
| +void CodeGenerator::GenerateGetFramePointer(ZoneList<Expression*>* args) { |
| + ASSERT(args->length() == 0); |
| + ASSERT(kSmiTag == 0); // RBP value is aligned, so it should look like Smi. |
| + Result rbp_as_smi = allocator_->Allocate(); |
| + ASSERT(rbp_as_smi.is_valid()); |
| + __ movq(rbp_as_smi.reg(), rbp); |
| + frame_->Push(&rbp_as_smi); |
| +} |
| + |
| + |
| void CodeGenerator::GenerateRandomPositiveSmi(ZoneList<Expression*>* args) { |
| ASSERT(args->length() == 0); |
| frame_->SpillAll(); |
| @@ -6570,6 +6580,9 @@ void CEntryStub::GenerateBody(MacroAssembler* masm, bool is_debug_break) { |
| void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { |
| Label invoke, exit; |
| +#ifdef ENABLE_LOGGING_AND_PROFILING |
| + Label not_outermost_js, not_outermost_js_2; |
| +#endif |
| // Setup frame. |
| __ push(rbp); |
| @@ -6595,6 +6608,17 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { |
| __ load_rax(c_entry_fp); |
| __ push(rax); |
| +#ifdef ENABLE_LOGGING_AND_PROFILING |
| + // If this is the outermost JS call, set js_entry_sp value. |
| + ExternalReference js_entry_sp(Top::k_js_entry_sp_address); |
| + __ load_rax(js_entry_sp); |
| + __ testq(rax, rax); |
| + __ j(NegateCondition(zero), ¬_outermost_js); |
|
William Hesse
2009/07/31 10:00:12
What is the difference between not_zero and Negate
Mikhail Naganov
2009/07/31 11:06:05
Thanks. I rarely touch code generation, so I'm not
|
| + __ movq(rax, rbp); |
| + __ store_rax(js_entry_sp); |
| + __ bind(¬_outermost_js); |
| +#endif |
| + |
| // Call a faked try-block that does the invoke. |
| __ call(&invoke); |
| @@ -6637,6 +6661,16 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { |
| // Pop next_sp. |
| __ addq(rsp, Immediate(StackHandlerConstants::kSize - kPointerSize)); |
| +#ifdef ENABLE_LOGGING_AND_PROFILING |
| + // If current EBP value is the same as js_entry_sp value, it means that |
| + // the current function is the outermost. |
| + __ movq(kScratchRegister, js_entry_sp); |
| + __ cmpq(rbp, Operand(kScratchRegister, 0)); |
| + __ j(NegateCondition(equal), ¬_outermost_js_2); |
| + __ movq(Operand(kScratchRegister, 0), Immediate(0)); |
| + __ bind(¬_outermost_js_2); |
| +#endif |
| + |
| // Restore the top frame descriptor from the stack. |
| __ bind(&exit); |
| __ movq(kScratchRegister, ExternalReference(Top::k_c_entry_fp_address)); |