| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 { Comment cmnt(masm_, "[ Body"); | 181 { Comment cmnt(masm_, "[ Body"); |
| 182 ASSERT(loop_depth() == 0); | 182 ASSERT(loop_depth() == 0); |
| 183 VisitStatements(function()->body()); | 183 VisitStatements(function()->body()); |
| 184 ASSERT(loop_depth() == 0); | 184 ASSERT(loop_depth() == 0); |
| 185 } | 185 } |
| 186 | 186 |
| 187 { Comment cmnt(masm_, "[ return <undefined>;"); | 187 { Comment cmnt(masm_, "[ return <undefined>;"); |
| 188 // Emit a 'return undefined' in case control fell off the end of the body. | 188 // Emit a 'return undefined' in case control fell off the end of the body. |
| 189 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); | 189 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); |
| 190 EmitReturnSequence(function()->end_position()); | 190 EmitReturnSequence(); |
| 191 } | 191 } |
| 192 } | 192 } |
| 193 | 193 |
| 194 | 194 |
| 195 void FullCodeGenerator::EmitReturnSequence(int position) { | 195 void FullCodeGenerator::EmitReturnSequence() { |
| 196 Comment cmnt(masm_, "[ Return sequence"); | 196 Comment cmnt(masm_, "[ Return sequence"); |
| 197 if (return_label_.is_bound()) { | 197 if (return_label_.is_bound()) { |
| 198 __ jmp(&return_label_); | 198 __ jmp(&return_label_); |
| 199 } else { | 199 } else { |
| 200 __ bind(&return_label_); | 200 __ bind(&return_label_); |
| 201 if (FLAG_trace) { | 201 if (FLAG_trace) { |
| 202 __ push(rax); | 202 __ push(rax); |
| 203 __ CallRuntime(Runtime::kTraceExit, 1); | 203 __ CallRuntime(Runtime::kTraceExit, 1); |
| 204 } | 204 } |
| 205 #ifdef DEBUG | 205 #ifdef DEBUG |
| 206 // Add a label for checking the size of the code used for returning. | 206 // Add a label for checking the size of the code used for returning. |
| 207 Label check_exit_codesize; | 207 Label check_exit_codesize; |
| 208 masm_->bind(&check_exit_codesize); | 208 masm_->bind(&check_exit_codesize); |
| 209 #endif | 209 #endif |
| 210 CodeGenerator::RecordPositions(masm_, position); | 210 CodeGenerator::RecordPositions(masm_, function()->end_position()); |
| 211 __ RecordJSReturn(); | 211 __ RecordJSReturn(); |
| 212 // Do not use the leave instruction here because it is too short to | 212 // Do not use the leave instruction here because it is too short to |
| 213 // patch with the code required by the debugger. | 213 // patch with the code required by the debugger. |
| 214 __ movq(rsp, rbp); | 214 __ movq(rsp, rbp); |
| 215 __ pop(rbp); | 215 __ pop(rbp); |
| 216 __ ret((scope()->num_parameters() + 1) * kPointerSize); | 216 __ ret((scope()->num_parameters() + 1) * kPointerSize); |
| 217 #ifdef ENABLE_DEBUGGER_SUPPORT | 217 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 218 // Add padding that will be overwritten by a debugger breakpoint. We | 218 // Add padding that will be overwritten by a debugger breakpoint. We |
| 219 // have just generated "movq rsp, rbp; pop rbp; ret k" with length 7 | 219 // have just generated "movq rsp, rbp; pop rbp; ret k" with length 7 |
| 220 // (3 + 1 + 3). | 220 // (3 + 1 + 3). |
| (...skipping 2993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3214 __ ret(0); | 3214 __ ret(0); |
| 3215 } | 3215 } |
| 3216 | 3216 |
| 3217 | 3217 |
| 3218 #undef __ | 3218 #undef __ |
| 3219 | 3219 |
| 3220 | 3220 |
| 3221 } } // namespace v8::internal | 3221 } } // namespace v8::internal |
| 3222 | 3222 |
| 3223 #endif // V8_TARGET_ARCH_X64 | 3223 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |