| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 __ movq(rbp, rsp); | 60 __ movq(rbp, rsp); |
| 61 __ push(rsi); | 61 __ push(rsi); |
| 62 __ push(rdi); | 62 __ push(rdi); |
| 63 if (local_count_ > 0) { | 63 if (local_count_ > 0) { |
| 64 __ movq(kScratchRegister, Factory::undefined_value(), | 64 __ movq(kScratchRegister, Factory::undefined_value(), |
| 65 RelocInfo::EMBEDDED_OBJECT); | 65 RelocInfo::EMBEDDED_OBJECT); |
| 66 for (int i = 0; i < local_count_; i++) { | 66 for (int i = 0; i < local_count_; i++) { |
| 67 __ push(kScratchRegister); | 67 __ push(kScratchRegister); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 if (FLAG_trace) { |
| 71 __ CallRuntime(Runtime::kTraceEnter, 0); |
| 72 } |
| 70 if (FLAG_check_stack) { | 73 if (FLAG_check_stack) { |
| 71 ExternalReference stack_limit = | 74 ExternalReference stack_limit = |
| 72 ExternalReference::address_of_stack_guard_limit(); | 75 ExternalReference::address_of_stack_guard_limit(); |
| 73 __ movq(kScratchRegister, stack_limit); | 76 __ movq(kScratchRegister, stack_limit); |
| 74 __ cmpq(rsp, Operand(kScratchRegister, 0)); | 77 __ cmpq(rsp, Operand(kScratchRegister, 0)); |
| 75 __ j(below, &deferred_enter); | 78 __ j(below, &deferred_enter); |
| 76 __ bind(&deferred_exit); | 79 __ bind(&deferred_exit); |
| 77 } | 80 } |
| 78 } | 81 } |
| 79 successor_->Compile(masm); | 82 successor_->Compile(masm); |
| 80 if (FLAG_check_stack) { | 83 if (FLAG_check_stack) { |
| 81 __ bind(&deferred_enter); | 84 __ bind(&deferred_enter); |
| 82 StackCheckStub stub; | 85 StackCheckStub stub; |
| 83 __ CallStub(&stub); | 86 __ CallStub(&stub); |
| 84 __ jmp(&deferred_exit); | 87 __ jmp(&deferred_exit); |
| 85 } | 88 } |
| 86 } | 89 } |
| 87 | 90 |
| 88 | 91 |
| 89 void ExitNode::Compile(MacroAssembler* masm) { | 92 void ExitNode::Compile(MacroAssembler* masm) { |
| 90 ASSERT(!is_marked()); | 93 ASSERT(!is_marked()); |
| 91 is_marked_ = true; | 94 is_marked_ = true; |
| 92 | 95 |
| 93 Comment cmnt(masm, "[ ExitNode"); | 96 Comment cmnt(masm, "[ ExitNode"); |
| 97 if (FLAG_trace) { |
| 98 __ push(rax); |
| 99 __ CallRuntime(Runtime::kTraceExit, 1); |
| 100 } |
| 94 __ RecordJSReturn(); | 101 __ RecordJSReturn(); |
| 95 __ movq(rsp, rbp); | 102 __ movq(rsp, rbp); |
| 96 __ pop(rbp); | 103 __ pop(rbp); |
| 97 __ ret((parameter_count_ + 1) * kPointerSize); | 104 __ ret((parameter_count_ + 1) * kPointerSize); |
| 98 // Add padding that will be overwritten by a debugger breakpoint. | 105 // Add padding that will be overwritten by a debugger breakpoint. |
| 99 // "movq rsp, rbp; pop rbp" has length 5. "ret k" has length 2. | 106 // "movq rsp, rbp; pop rbp" has length 5. "ret k" has length 2. |
| 100 const int kPadding = Debug::kX64JSReturnSequenceLength - 5 - 2; | 107 const int kPadding = Debug::kX64JSReturnSequenceLength - 5 - 2; |
| 101 for (int i = 0; i < kPadding; ++i) { | 108 for (int i = 0; i < kPadding; ++i) { |
| 102 __ int3(); | 109 __ int3(); |
| 103 } | 110 } |
| 104 } | 111 } |
| 105 | 112 |
| 106 | 113 |
| 107 void ReturnInstr::Compile(MacroAssembler* masm) { | 114 void ReturnInstr::Compile(MacroAssembler* masm) { |
| 108 Comment cmnt(masm, "[ ReturnInstr"); | 115 Comment cmnt(masm, "[ ReturnInstr"); |
| 109 value_->ToRegister(masm, rax); | 116 value_->ToRegister(masm, rax); |
| 110 } | 117 } |
| 111 | 118 |
| 112 | 119 |
| 113 void Constant::ToRegister(MacroAssembler* masm, Register reg) { | 120 void Constant::ToRegister(MacroAssembler* masm, Register reg) { |
| 114 __ Move(reg, handle_); | 121 __ Move(reg, handle_); |
| 115 } | 122 } |
| 116 | 123 |
| 117 #undef __ | 124 #undef __ |
| 118 | 125 |
| 119 } } // namespace v8::internal | 126 } } // namespace v8::internal |
| OLD | NEW |