Chromium Code Reviews

Unified Diff: src/x64/full-codegen-x64.cc

Issue 8585001: Adapt source position recording and fix ScopeIterator. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Statement positions for return sequences. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: src/x64/full-codegen-x64.cc
diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc
index 587f73b882fac02bb5346e500922f4191e3cbddc..9091a54d8df93d681532280ac55dd2db52bf3c18 100644
--- a/src/x64/full-codegen-x64.cc
+++ b/src/x64/full-codegen-x64.cc
@@ -333,7 +333,21 @@ void FullCodeGenerator::EmitReturnSequence() {
Label check_exit_codesize;
masm_->bind(&check_exit_codesize);
#endif
- CodeGenerator::RecordPositions(masm_, function()->end_position() - 1);
+ Scope* scope = function()->scope();
+ if (scope->is_function_scope()) {
+ // Set the source position of the return sequence to the position
+ // of the closing brace '}'.
+ CodeGenerator::RecordPositions(masm_, function()->end_position() - 1);
+ } else {
+ ASSERT(scope->is_global_scope() || scope->is_eval_scope());
+ // Set the source position to one character past the source code, such
+ // that it definitely is not in the source code range of an immediate
+ // inner scope. For example in
+ // eval('with ({x:1}) x = 1');
+ // the end position of the function generated for executing the eval code
+ // coincides with the end of the with scope which is the position of '1'.
+ CodeGenerator::RecordPositions(masm_, function()->end_position());
+ }
__ RecordJSReturn();
// Do not use the leave instruction here because it is too short to
// patch with the code required by the debugger.

Powered by Google App Engine