OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // Open a frame scope to indicate that there is a frame on the stack. The | 150 // Open a frame scope to indicate that there is a frame on the stack. The |
151 // MANUAL indicates that the scope shouldn't actually generate code to set up | 151 // MANUAL indicates that the scope shouldn't actually generate code to set up |
152 // the frame (that is done below). | 152 // the frame (that is done below). |
153 FrameScope frame_scope(masm_, StackFrame::MANUAL); | 153 FrameScope frame_scope(masm_, StackFrame::MANUAL); |
154 | 154 |
155 info->set_prologue_offset(masm_->pc_offset()); | 155 info->set_prologue_offset(masm_->pc_offset()); |
156 __ push(rbp); // Caller's frame pointer. | 156 __ push(rbp); // Caller's frame pointer. |
157 __ movq(rbp, rsp); | 157 __ movq(rbp, rsp); |
158 __ push(rsi); // Callee's context. | 158 __ push(rsi); // Callee's context. |
159 __ push(rdi); // Callee's JS Function. | 159 __ push(rdi); // Callee's JS Function. |
| 160 info->AddNoFrameRange(0, masm_->pc_offset()); |
160 | 161 |
161 { Comment cmnt(masm_, "[ Allocate locals"); | 162 { Comment cmnt(masm_, "[ Allocate locals"); |
162 int locals_count = info->scope()->num_stack_slots(); | 163 int locals_count = info->scope()->num_stack_slots(); |
163 // Generators allocate locals, if any, in context slots. | 164 // Generators allocate locals, if any, in context slots. |
164 ASSERT(!info->function()->is_generator() || locals_count == 0); | 165 ASSERT(!info->function()->is_generator() || locals_count == 0); |
165 if (locals_count == 1) { | 166 if (locals_count == 1) { |
166 __ PushRoot(Heap::kUndefinedValueRootIndex); | 167 __ PushRoot(Heap::kUndefinedValueRootIndex); |
167 } else if (locals_count > 1) { | 168 } else if (locals_count > 1) { |
168 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex); | 169 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex); |
169 for (int i = 0; i < locals_count; i++) { | 170 for (int i = 0; i < locals_count; i++) { |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 // Add a label for checking the size of the code used for returning. | 400 // Add a label for checking the size of the code used for returning. |
400 Label check_exit_codesize; | 401 Label check_exit_codesize; |
401 masm_->bind(&check_exit_codesize); | 402 masm_->bind(&check_exit_codesize); |
402 #endif | 403 #endif |
403 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); | 404 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); |
404 __ RecordJSReturn(); | 405 __ RecordJSReturn(); |
405 // Do not use the leave instruction here because it is too short to | 406 // Do not use the leave instruction here because it is too short to |
406 // patch with the code required by the debugger. | 407 // patch with the code required by the debugger. |
407 __ movq(rsp, rbp); | 408 __ movq(rsp, rbp); |
408 __ pop(rbp); | 409 __ pop(rbp); |
| 410 int no_frame_start = masm_->pc_offset(); |
409 | 411 |
410 int arguments_bytes = (info_->scope()->num_parameters() + 1) * kPointerSize; | 412 int arguments_bytes = (info_->scope()->num_parameters() + 1) * kPointerSize; |
411 __ Ret(arguments_bytes, rcx); | 413 __ Ret(arguments_bytes, rcx); |
412 | 414 |
413 #ifdef ENABLE_DEBUGGER_SUPPORT | 415 #ifdef ENABLE_DEBUGGER_SUPPORT |
414 // Add padding that will be overwritten by a debugger breakpoint. We | 416 // Add padding that will be overwritten by a debugger breakpoint. We |
415 // have just generated at least 7 bytes: "movq rsp, rbp; pop rbp; ret k" | 417 // have just generated at least 7 bytes: "movq rsp, rbp; pop rbp; ret k" |
416 // (3 + 1 + 3). | 418 // (3 + 1 + 3). |
417 const int kPadding = Assembler::kJSReturnSequenceLength - 7; | 419 const int kPadding = Assembler::kJSReturnSequenceLength - 7; |
418 for (int i = 0; i < kPadding; ++i) { | 420 for (int i = 0; i < kPadding; ++i) { |
419 masm_->int3(); | 421 masm_->int3(); |
420 } | 422 } |
421 // Check that the size of the code used for returning is large enough | 423 // Check that the size of the code used for returning is large enough |
422 // for the debugger's requirements. | 424 // for the debugger's requirements. |
423 ASSERT(Assembler::kJSReturnSequenceLength <= | 425 ASSERT(Assembler::kJSReturnSequenceLength <= |
424 masm_->SizeOfCodeGeneratedSince(&check_exit_codesize)); | 426 masm_->SizeOfCodeGeneratedSince(&check_exit_codesize)); |
425 #endif | 427 #endif |
| 428 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); |
426 } | 429 } |
427 } | 430 } |
428 | 431 |
429 | 432 |
430 void FullCodeGenerator::EffectContext::Plug(Variable* var) const { | 433 void FullCodeGenerator::EffectContext::Plug(Variable* var) const { |
431 ASSERT(var->IsStackAllocated() || var->IsContextSlot()); | 434 ASSERT(var->IsStackAllocated() || var->IsContextSlot()); |
432 } | 435 } |
433 | 436 |
434 | 437 |
435 void FullCodeGenerator::AccumulatorValueContext::Plug(Variable* var) const { | 438 void FullCodeGenerator::AccumulatorValueContext::Plug(Variable* var) const { |
(...skipping 4376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4812 *context_length = 0; | 4815 *context_length = 0; |
4813 return previous_; | 4816 return previous_; |
4814 } | 4817 } |
4815 | 4818 |
4816 | 4819 |
4817 #undef __ | 4820 #undef __ |
4818 | 4821 |
4819 } } // namespace v8::internal | 4822 } } // namespace v8::internal |
4820 | 4823 |
4821 #endif // V8_TARGET_ARCH_X64 | 4824 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |