| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 179 |
| 180 { Comment cmnt(masm_, "[ Body"); | 180 { Comment cmnt(masm_, "[ Body"); |
| 181 ASSERT(loop_depth() == 0); | 181 ASSERT(loop_depth() == 0); |
| 182 VisitStatements(function()->body()); | 182 VisitStatements(function()->body()); |
| 183 ASSERT(loop_depth() == 0); | 183 ASSERT(loop_depth() == 0); |
| 184 } | 184 } |
| 185 | 185 |
| 186 { Comment cmnt(masm_, "[ return <undefined>;"); | 186 { Comment cmnt(masm_, "[ return <undefined>;"); |
| 187 // Emit a 'return undefined' in case control fell off the end of the body. | 187 // Emit a 'return undefined' in case control fell off the end of the body. |
| 188 __ mov(eax, Factory::undefined_value()); | 188 __ mov(eax, Factory::undefined_value()); |
| 189 EmitReturnSequence(function()->end_position()); | 189 EmitReturnSequence(); |
| 190 } | 190 } |
| 191 } | 191 } |
| 192 | 192 |
| 193 | 193 |
| 194 void FullCodeGenerator::EmitReturnSequence(int position) { | 194 void FullCodeGenerator::EmitReturnSequence() { |
| 195 Comment cmnt(masm_, "[ Return sequence"); | 195 Comment cmnt(masm_, "[ Return sequence"); |
| 196 if (return_label_.is_bound()) { | 196 if (return_label_.is_bound()) { |
| 197 __ jmp(&return_label_); | 197 __ jmp(&return_label_); |
| 198 } else { | 198 } else { |
| 199 // Common return label | 199 // Common return label |
| 200 __ bind(&return_label_); | 200 __ bind(&return_label_); |
| 201 if (FLAG_trace) { | 201 if (FLAG_trace) { |
| 202 __ push(eax); | 202 __ push(eax); |
| 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 __ mov(esp, ebp); | 214 __ mov(esp, ebp); |
| 215 __ pop(ebp); | 215 __ pop(ebp); |
| 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 // Check that the size of the code used for returning matches what is | 218 // Check that the size of the code used for returning matches what is |
| 219 // expected by the debugger. | 219 // expected by the debugger. |
| 220 ASSERT_EQ(Assembler::kJSReturnSequenceLength, | 220 ASSERT_EQ(Assembler::kJSReturnSequenceLength, |
| (...skipping 3030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3251 // And return. | 3251 // And return. |
| 3252 __ ret(0); | 3252 __ ret(0); |
| 3253 } | 3253 } |
| 3254 | 3254 |
| 3255 | 3255 |
| 3256 #undef __ | 3256 #undef __ |
| 3257 | 3257 |
| 3258 } } // namespace v8::internal | 3258 } } // namespace v8::internal |
| 3259 | 3259 |
| 3260 #endif // V8_TARGET_ARCH_IA32 | 3260 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |