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 430503007: Rename ASSERT* to DCHECK*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE and fixes Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « src/regexp-stack.h ('k') | src/runtime.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/rewriter.h" 7 #include "src/rewriter.h"
8 8
9 #include "src/ast.h" 9 #include "src/ast.h"
10 #include "src/compiler.h" 10 #include "src/compiler.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 #define DEF_VISIT(type) \ 222 #define DEF_VISIT(type) \
223 void Processor::Visit##type(type* expr) { UNREACHABLE(); } 223 void Processor::Visit##type(type* expr) { UNREACHABLE(); }
224 EXPRESSION_NODE_LIST(DEF_VISIT) 224 EXPRESSION_NODE_LIST(DEF_VISIT)
225 #undef DEF_VISIT 225 #undef DEF_VISIT
226 226
227 227
228 // Assumes code has been parsed. Mutates the AST, so the AST should not 228 // Assumes code has been parsed. Mutates the AST, so the AST should not
229 // continue to be used in the case of failure. 229 // continue to be used in the case of failure.
230 bool Rewriter::Rewrite(CompilationInfo* info) { 230 bool Rewriter::Rewrite(CompilationInfo* info) {
231 FunctionLiteral* function = info->function(); 231 FunctionLiteral* function = info->function();
232 ASSERT(function != NULL); 232 DCHECK(function != NULL);
233 Scope* scope = function->scope(); 233 Scope* scope = function->scope();
234 ASSERT(scope != NULL); 234 DCHECK(scope != NULL);
235 if (!scope->is_global_scope() && !scope->is_eval_scope()) return true; 235 if (!scope->is_global_scope() && !scope->is_eval_scope()) return true;
236 236
237 ZoneList<Statement*>* body = function->body(); 237 ZoneList<Statement*>* body = function->body();
238 if (!body->is_empty()) { 238 if (!body->is_empty()) {
239 Variable* result = 239 Variable* result =
240 scope->NewTemporary(info->ast_value_factory()->dot_result_string()); 240 scope->NewTemporary(info->ast_value_factory()->dot_result_string());
241 // The name string must be internalized at this point. 241 // The name string must be internalized at this point.
242 ASSERT(!result->name().is_null()); 242 DCHECK(!result->name().is_null());
243 Processor processor(result, info->zone()); 243 Processor processor(result, info->zone());
244 processor.Process(body); 244 processor.Process(body);
245 if (processor.HasStackOverflow()) return false; 245 if (processor.HasStackOverflow()) return false;
246 246
247 if (processor.result_assigned()) { 247 if (processor.result_assigned()) {
248 ASSERT(function->end_position() != RelocInfo::kNoPosition); 248 DCHECK(function->end_position() != RelocInfo::kNoPosition);
249 // Set the position of the assignment statement one character past the 249 // Set the position of the assignment statement one character past the
250 // source code, such that it definitely is not in the source code range 250 // source code, such that it definitely is not in the source code range
251 // of an immediate inner scope. For example in 251 // of an immediate inner scope. For example in
252 // eval('with ({x:1}) x = 1'); 252 // eval('with ({x:1}) x = 1');
253 // the end position of the function generated for executing the eval code 253 // the end position of the function generated for executing the eval code
254 // coincides with the end of the with scope which is the position of '1'. 254 // coincides with the end of the with scope which is the position of '1'.
255 int pos = function->end_position(); 255 int pos = function->end_position();
256 VariableProxy* result_proxy = processor.factory()->NewVariableProxy( 256 VariableProxy* result_proxy = processor.factory()->NewVariableProxy(
257 result->raw_name(), false, result->interface(), pos); 257 result->raw_name(), false, result->interface(), pos);
258 result_proxy->BindTo(result); 258 result_proxy->BindTo(result);
259 Statement* result_statement = 259 Statement* result_statement =
260 processor.factory()->NewReturnStatement(result_proxy, pos); 260 processor.factory()->NewReturnStatement(result_proxy, pos);
261 body->Add(result_statement, info->zone()); 261 body->Add(result_statement, info->zone());
262 } 262 }
263 } 263 }
264 264
265 return true; 265 return true;
266 } 266 }
267 267
268 268
269 } } // namespace v8::internal 269 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/regexp-stack.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698