OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 // Add a label for checking the size of the code used for returning. | 290 // Add a label for checking the size of the code used for returning. |
291 Label check_exit_codesize; | 291 Label check_exit_codesize; |
292 masm_->bind(&check_exit_codesize); | 292 masm_->bind(&check_exit_codesize); |
293 #endif | 293 #endif |
294 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); | 294 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); |
295 __ RecordJSReturn(); | 295 __ RecordJSReturn(); |
296 // Do not use the leave instruction here because it is too short to | 296 // Do not use the leave instruction here because it is too short to |
297 // patch with the code required by the debugger. | 297 // patch with the code required by the debugger. |
298 __ movq(rsp, rbp); | 298 __ movq(rsp, rbp); |
299 __ pop(rbp); | 299 __ pop(rbp); |
300 __ ret((scope()->num_parameters() + 1) * kPointerSize); | 300 |
| 301 int arguments_bytes = (scope()->num_parameters() + 1) * kPointerSize; |
| 302 __ Ret(arguments_bytes, rcx); |
| 303 |
301 #ifdef ENABLE_DEBUGGER_SUPPORT | 304 #ifdef ENABLE_DEBUGGER_SUPPORT |
302 // Add padding that will be overwritten by a debugger breakpoint. We | 305 // Add padding that will be overwritten by a debugger breakpoint. We |
303 // have just generated "movq rsp, rbp; pop rbp; ret k" with length 7 | 306 // have just generated at least 7 bytes: "movq rsp, rbp; pop rbp; ret k" |
304 // (3 + 1 + 3). | 307 // (3 + 1 + 3). |
305 const int kPadding = Assembler::kJSReturnSequenceLength - 7; | 308 const int kPadding = Assembler::kJSReturnSequenceLength - 7; |
306 for (int i = 0; i < kPadding; ++i) { | 309 for (int i = 0; i < kPadding; ++i) { |
307 masm_->int3(); | 310 masm_->int3(); |
308 } | 311 } |
309 // Check that the size of the code used for returning matches what is | 312 // Check that the size of the code used for returning is large enough |
310 // expected by the debugger. | 313 // for the debugger's requirements. |
311 ASSERT_EQ(Assembler::kJSReturnSequenceLength, | 314 ASSERT(Assembler::kJSReturnSequenceLength <= |
312 masm_->SizeOfCodeGeneratedSince(&check_exit_codesize)); | 315 masm_->SizeOfCodeGeneratedSince(&check_exit_codesize)); |
313 #endif | 316 #endif |
314 } | 317 } |
315 } | 318 } |
316 | 319 |
317 | 320 |
318 FullCodeGenerator::ConstantOperand FullCodeGenerator::GetConstantOperand( | 321 FullCodeGenerator::ConstantOperand FullCodeGenerator::GetConstantOperand( |
319 Token::Value op, Expression* left, Expression* right) { | 322 Token::Value op, Expression* left, Expression* right) { |
320 ASSERT(ShouldInlineSmiCase(op)); | 323 ASSERT(ShouldInlineSmiCase(op)); |
321 return kNoConstants; | 324 return kNoConstants; |
322 } | 325 } |
(...skipping 3414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3737 __ ret(0); | 3740 __ ret(0); |
3738 } | 3741 } |
3739 | 3742 |
3740 | 3743 |
3741 #undef __ | 3744 #undef __ |
3742 | 3745 |
3743 | 3746 |
3744 } } // namespace v8::internal | 3747 } } // namespace v8::internal |
3745 | 3748 |
3746 #endif // V8_TARGET_ARCH_X64 | 3749 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |