Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(475)

Unified Diff: src/ia32/full-codegen-ia32.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. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/ia32/full-codegen-ia32.cc
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
index 74616d0756cb9321adf6b7c420f053108250f71c..7362a6d6fa2f58627e458b48bca32a4868d376b5 100644
--- a/src/ia32/full-codegen-ia32.cc
+++ b/src/ia32/full-codegen-ia32.cc
@@ -349,7 +349,23 @@ void FullCodeGenerator::EmitReturnSequence() {
Label check_exit_codesize;
masm_->bind(&check_exit_codesize);
#endif
- SetSourcePosition(function()->end_position() - 1);
+ if (scope()->is_global_scope() || scope()->is_eval_scope()) {
+ // Set the source and statement position to one character past the source
+ // code, so that they definitely are 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'. However for the ScopeIterator we want to have positions for the
+ // return sequence outside of the with scope.
+ SetStatementPosition(function()->end_position());
+ SetSourcePosition(function()->end_position());
+ } else {
+ // Set the statement position of the return sequence to the last character
+ // of the current scope.
+ SetStatementPosition(scope()->end_position() - 1);
+ SetSourcePosition(function()->end_position() - 1);
Lasse Reichstein 2011/11/21 10:16:40 Can't the final character coincide with another sc
Steven 2011/11/24 13:23:31 This is not important anymore. I added special han
+ }
__ 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
This is Rietveld 408576698