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

Side by Side Diff: src/rewriter.cc

Issue 1137683003: Only record one in n line endings to save space. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix false detection of exotic newlines Created 5 years, 6 months 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 unified diff | Download patch
« no previous file with comments | « src/objects.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/ast.h" 7 #include "src/ast.h"
8 #include "src/parser.h" 8 #include "src/parser.h"
9 #include "src/rewriter.h" 9 #include "src/rewriter.h"
10 #include "src/scopes.h" 10 #include "src/scopes.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 if (processor.HasStackOverflow()) return false; 228 if (processor.HasStackOverflow()) return false;
229 229
230 if (processor.result_assigned()) { 230 if (processor.result_assigned()) {
231 DCHECK(function->end_position() != RelocInfo::kNoPosition); 231 DCHECK(function->end_position() != RelocInfo::kNoPosition);
232 // Set the position of the assignment statement one character past the 232 // Set the position of the assignment statement one character past the
233 // source code, such that it definitely is not in the source code range 233 // source code, such that it definitely is not in the source code range
234 // of an immediate inner scope. For example in 234 // of an immediate inner scope. For example in
235 // eval('with ({x:1}) x = 1'); 235 // eval('with ({x:1}) x = 1');
236 // the end position of the function generated for executing the eval code 236 // the end position of the function generated for executing the eval code
237 // coincides with the end of the with scope which is the position of '1'. 237 // coincides with the end of the with scope which is the position of '1'.
238 // Note that this may mean the position is outside the source code
239 // completely if there is no terminal newline, curly brace, or semicolon,
240 // often the case for 'eval'.
238 int pos = function->end_position(); 241 int pos = function->end_position();
239 VariableProxy* result_proxy = 242 VariableProxy* result_proxy =
240 processor.factory()->NewVariableProxy(result, pos); 243 processor.factory()->NewVariableProxy(result, pos);
241 Statement* result_statement = 244 Statement* result_statement =
242 processor.factory()->NewReturnStatement(result_proxy, pos); 245 processor.factory()->NewReturnStatement(result_proxy, pos);
243 body->Add(result_statement, info->zone()); 246 body->Add(result_statement, info->zone());
244 } 247 }
245 } 248 }
246 249
247 return true; 250 return true;
248 } 251 }
249 252
250 253
251 } // namespace internal 254 } // namespace internal
252 } // namespace v8 255 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698