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 if (is_uint16(arguments_bytes)) { | |
Mads Ager (chromium)
2011/02/08 17:34:36
You could make this a Ret macro assembler instruct
| |
303 __ ret(arguments_bytes); | |
304 } else { | |
305 __ pop(rcx); | |
306 __ addq(rsp, Immediate(arguments_bytes)); | |
307 __ push(rcx); | |
308 __ ret(0); | |
309 } | |
310 | |
301 #ifdef ENABLE_DEBUGGER_SUPPORT | 311 #ifdef ENABLE_DEBUGGER_SUPPORT |
302 // Add padding that will be overwritten by a debugger breakpoint. We | 312 // 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 | 313 // have just generated "movq rsp, rbp; pop rbp; ret k" with length 7 |
304 // (3 + 1 + 3). | 314 // (3 + 1 + 3). |
305 const int kPadding = Assembler::kJSReturnSequenceLength - 7; | 315 const int kPadding = Assembler::kJSReturnSequenceLength - 7; |
306 for (int i = 0; i < kPadding; ++i) { | 316 for (int i = 0; i < kPadding; ++i) { |
307 masm_->int3(); | 317 masm_->int3(); |
308 } | 318 } |
309 // Check that the size of the code used for returning matches what is | 319 // Check that the size of the code used for returning matches what is |
310 // expected by the debugger. | 320 // expected by the debugger. |
311 ASSERT_EQ(Assembler::kJSReturnSequenceLength, | 321 ASSERT(Assembler::kJSReturnSequenceLength <= |
312 masm_->SizeOfCodeGeneratedSince(&check_exit_codesize)); | 322 masm_->SizeOfCodeGeneratedSince(&check_exit_codesize)); |
313 #endif | 323 #endif |
314 } | 324 } |
315 } | 325 } |
316 | 326 |
317 | 327 |
318 FullCodeGenerator::ConstantOperand FullCodeGenerator::GetConstantOperand( | 328 FullCodeGenerator::ConstantOperand FullCodeGenerator::GetConstantOperand( |
319 Token::Value op, Expression* left, Expression* right) { | 329 Token::Value op, Expression* left, Expression* right) { |
320 ASSERT(ShouldInlineSmiCase(op)); | 330 ASSERT(ShouldInlineSmiCase(op)); |
321 return kNoConstants; | 331 return kNoConstants; |
322 } | 332 } |
(...skipping 3408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3731 __ ret(0); | 3741 __ ret(0); |
3732 } | 3742 } |
3733 | 3743 |
3734 | 3744 |
3735 #undef __ | 3745 #undef __ |
3736 | 3746 |
3737 | 3747 |
3738 } } // namespace v8::internal | 3748 } } // namespace v8::internal |
3739 | 3749 |
3740 #endif // V8_TARGET_ARCH_X64 | 3750 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |