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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 return_value->ToRegister(rax); | 348 return_value->ToRegister(rax); |
349 | 349 |
350 // Add a label for checking the size of the code used for returning. | 350 // Add a label for checking the size of the code used for returning. |
351 Label check_exit_codesize; | 351 Label check_exit_codesize; |
352 masm_->bind(&check_exit_codesize); | 352 masm_->bind(&check_exit_codesize); |
353 | 353 |
354 // Leave the frame and return popping the arguments and the | 354 // Leave the frame and return popping the arguments and the |
355 // receiver. | 355 // receiver. |
356 frame_->Exit(); | 356 frame_->Exit(); |
357 masm_->ret((scope_->num_parameters() + 1) * kPointerSize); | 357 masm_->ret((scope_->num_parameters() + 1) * kPointerSize); |
| 358 // Add padding that will be overwritten by a debugger breakpoint. |
| 359 // frame_->Exit() generates "movq rsp, rbp; pop rbp" length 5. |
| 360 // "ret k" has length 2. |
| 361 const int kPadding = kX64JSReturnSequenceLength - 5 - 2; |
| 362 for (int i = 0; i < kPadding; ++i) { |
| 363 masm_->int3(); |
| 364 } |
358 DeleteFrame(); | 365 DeleteFrame(); |
359 | 366 |
360 // TODO(x64): introduce kX64JSReturnSequenceLength and enable assert. | |
361 | |
362 // Check that the size of the code used for returning matches what is | 367 // Check that the size of the code used for returning matches what is |
363 // expected by the debugger. | 368 // expected by the debugger. |
364 // ASSERT_EQ(Debug::kIa32JSReturnSequenceLength, | 369 ASSERT_EQ(Debug::kX64JSReturnSequenceLength, |
365 // masm_->SizeOfCodeGeneratedSince(&check_exit_codesize)); | 370 masm_->SizeOfCodeGeneratedSince(&check_exit_codesize)); |
366 } | 371 } |
367 | 372 |
368 | 373 |
369 #ifdef DEBUG | 374 #ifdef DEBUG |
370 bool CodeGenerator::HasValidEntryRegisters() { | 375 bool CodeGenerator::HasValidEntryRegisters() { |
371 return (allocator()->count(rax) == (frame()->is_used(rax) ? 1 : 0)) | 376 return (allocator()->count(rax) == (frame()->is_used(rax) ? 1 : 0)) |
372 && (allocator()->count(rbx) == (frame()->is_used(rbx) ? 1 : 0)) | 377 && (allocator()->count(rbx) == (frame()->is_used(rbx) ? 1 : 0)) |
373 && (allocator()->count(rcx) == (frame()->is_used(rcx) ? 1 : 0)) | 378 && (allocator()->count(rcx) == (frame()->is_used(rcx) ? 1 : 0)) |
374 && (allocator()->count(rdx) == (frame()->is_used(rdx) ? 1 : 0)) | 379 && (allocator()->count(rdx) == (frame()->is_used(rdx) ? 1 : 0)) |
375 && (allocator()->count(rdi) == (frame()->is_used(rdi) ? 1 : 0)) | 380 && (allocator()->count(rdi) == (frame()->is_used(rdi) ? 1 : 0)) |
(...skipping 6560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6936 int CompareStub::MinorKey() { | 6941 int CompareStub::MinorKey() { |
6937 // Encode the two parameters in a unique 16 bit value. | 6942 // Encode the two parameters in a unique 16 bit value. |
6938 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); | 6943 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); |
6939 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); | 6944 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); |
6940 } | 6945 } |
6941 | 6946 |
6942 | 6947 |
6943 #undef __ | 6948 #undef __ |
6944 | 6949 |
6945 } } // namespace v8::internal | 6950 } } // namespace v8::internal |
OLD | NEW |