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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 __ bind(&return_label_); | 326 __ bind(&return_label_); |
327 if (FLAG_trace) { | 327 if (FLAG_trace) { |
328 __ push(rax); | 328 __ push(rax); |
329 __ CallRuntime(Runtime::kTraceExit, 1); | 329 __ CallRuntime(Runtime::kTraceExit, 1); |
330 } | 330 } |
331 #ifdef DEBUG | 331 #ifdef DEBUG |
332 // Add a label for checking the size of the code used for returning. | 332 // Add a label for checking the size of the code used for returning. |
333 Label check_exit_codesize; | 333 Label check_exit_codesize; |
334 masm_->bind(&check_exit_codesize); | 334 masm_->bind(&check_exit_codesize); |
335 #endif | 335 #endif |
336 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); | 336 Scope* scope = function()->scope(); |
| 337 if (scope->is_function_scope()) { |
| 338 // Set the source position of the return sequence to the position |
| 339 // of the closing brace '}'. |
| 340 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); |
| 341 } else { |
| 342 ASSERT(scope->is_global_scope() || scope->is_eval_scope()); |
| 343 // Set the source position to one character past the source code, such |
| 344 // that it definitely is not in the source code range of an immediate |
| 345 // inner scope. For example in |
| 346 // eval('with ({x:1}) x = 1'); |
| 347 // the end position of the function generated for executing the eval code |
| 348 // coincides with the end of the with scope which is the position of '1'. |
| 349 CodeGenerator::RecordPositions(masm_, function()->end_position()); |
| 350 } |
337 __ RecordJSReturn(); | 351 __ RecordJSReturn(); |
338 // Do not use the leave instruction here because it is too short to | 352 // Do not use the leave instruction here because it is too short to |
339 // patch with the code required by the debugger. | 353 // patch with the code required by the debugger. |
340 __ movq(rsp, rbp); | 354 __ movq(rsp, rbp); |
341 __ pop(rbp); | 355 __ pop(rbp); |
342 | 356 |
343 int arguments_bytes = (info_->scope()->num_parameters() + 1) * kPointerSize; | 357 int arguments_bytes = (info_->scope()->num_parameters() + 1) * kPointerSize; |
344 __ Ret(arguments_bytes, rcx); | 358 __ Ret(arguments_bytes, rcx); |
345 | 359 |
346 #ifdef ENABLE_DEBUGGER_SUPPORT | 360 #ifdef ENABLE_DEBUGGER_SUPPORT |
(...skipping 3960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4307 *context_length = 0; | 4321 *context_length = 0; |
4308 return previous_; | 4322 return previous_; |
4309 } | 4323 } |
4310 | 4324 |
4311 | 4325 |
4312 #undef __ | 4326 #undef __ |
4313 | 4327 |
4314 } } // namespace v8::internal | 4328 } } // namespace v8::internal |
4315 | 4329 |
4316 #endif // V8_TARGET_ARCH_X64 | 4330 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |