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

Side by Side Diff: src/full-codegen.cc

Issue 23597037: Unify handling of position info in AST, part 2 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Simplify SetExpressionPosition Created 7 years, 3 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/full-codegen.h ('k') | src/parser.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 // 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 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 if (position_recorded) { 842 if (position_recorded) {
843 Debug::GenerateSlot(masm_); 843 Debug::GenerateSlot(masm_);
844 } 844 }
845 } 845 }
846 #else 846 #else
847 CodeGenerator::RecordPositions(masm_, stmt->position()); 847 CodeGenerator::RecordPositions(masm_, stmt->position());
848 #endif 848 #endif
849 } 849 }
850 850
851 851
852 void FullCodeGenerator::SetExpressionPosition(Expression* expr, int pos) { 852 void FullCodeGenerator::SetExpressionPosition(Expression* expr) {
853 #ifdef ENABLE_DEBUGGER_SUPPORT 853 #ifdef ENABLE_DEBUGGER_SUPPORT
854 if (!isolate()->debugger()->IsDebuggerActive()) { 854 if (!isolate()->debugger()->IsDebuggerActive()) {
855 CodeGenerator::RecordPositions(masm_, pos); 855 CodeGenerator::RecordPositions(masm_, expr->position());
856 } else { 856 } else {
857 // Check if the expression will be breakable without adding a debug break 857 // Check if the expression will be breakable without adding a debug break
858 // slot. 858 // slot.
859 BreakableStatementChecker checker(isolate()); 859 BreakableStatementChecker checker(isolate());
860 checker.Check(expr); 860 checker.Check(expr);
861 // Record a statement position right here if the expression is not 861 // Record a statement position right here if the expression is not
862 // breakable. For breakable expressions the actual recording of the 862 // breakable. For breakable expressions the actual recording of the
863 // position will be postponed to the breakable code (typically an IC). 863 // position will be postponed to the breakable code (typically an IC).
864 // NOTE this will record a statement position for something which might 864 // NOTE this will record a statement position for something which might
865 // not be a statement. As stepping in the debugger will only stop at 865 // not be a statement. As stepping in the debugger will only stop at
866 // statement positions this is used for e.g. the condition expression of 866 // statement positions this is used for e.g. the condition expression of
867 // a do while loop. 867 // a do while loop.
868 bool position_recorded = CodeGenerator::RecordPositions( 868 bool position_recorded = CodeGenerator::RecordPositions(
869 masm_, pos, !checker.is_breakable()); 869 masm_, expr->position(), !checker.is_breakable());
870 // If the position recording did record a new position generate a debug 870 // If the position recording did record a new position generate a debug
871 // break slot to make the statement breakable. 871 // break slot to make the statement breakable.
872 if (position_recorded) { 872 if (position_recorded) {
873 Debug::GenerateSlot(masm_); 873 Debug::GenerateSlot(masm_);
874 } 874 }
875 } 875 }
876 #else 876 #else
877 CodeGenerator::RecordPositions(masm_, pos); 877 CodeGenerator::RecordPositions(masm_, pos);
878 #endif 878 #endif
879 } 879 }
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 Iteration loop_statement(this, stmt); 1286 Iteration loop_statement(this, stmt);
1287 increment_loop_depth(); 1287 increment_loop_depth();
1288 1288
1289 __ bind(&body); 1289 __ bind(&body);
1290 Visit(stmt->body()); 1290 Visit(stmt->body());
1291 1291
1292 // Record the position of the do while condition and make sure it is 1292 // Record the position of the do while condition and make sure it is
1293 // possible to break on the condition. 1293 // possible to break on the condition.
1294 __ bind(loop_statement.continue_label()); 1294 __ bind(loop_statement.continue_label());
1295 PrepareForBailoutForId(stmt->ContinueId(), NO_REGISTERS); 1295 PrepareForBailoutForId(stmt->ContinueId(), NO_REGISTERS);
1296 SetExpressionPosition(stmt->cond(), stmt->condition_position()); 1296 SetExpressionPosition(stmt->cond());
1297 VisitForControl(stmt->cond(), 1297 VisitForControl(stmt->cond(),
1298 &book_keeping, 1298 &book_keeping,
1299 loop_statement.break_label(), 1299 loop_statement.break_label(),
1300 &book_keeping); 1300 &book_keeping);
1301 1301
1302 // Check stack before looping. 1302 // Check stack before looping.
1303 PrepareForBailoutForId(stmt->BackEdgeId(), NO_REGISTERS); 1303 PrepareForBailoutForId(stmt->BackEdgeId(), NO_REGISTERS);
1304 __ bind(&book_keeping); 1304 __ bind(&book_keeping);
1305 EmitBackEdgeBookkeeping(stmt, &body); 1305 EmitBackEdgeBookkeeping(stmt, &body);
1306 __ jmp(&body); 1306 __ jmp(&body);
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1515 } 1515 }
1516 1516
1517 1517
1518 void FullCodeGenerator::VisitConditional(Conditional* expr) { 1518 void FullCodeGenerator::VisitConditional(Conditional* expr) {
1519 Comment cmnt(masm_, "[ Conditional"); 1519 Comment cmnt(masm_, "[ Conditional");
1520 Label true_case, false_case, done; 1520 Label true_case, false_case, done;
1521 VisitForControl(expr->condition(), &true_case, &false_case, &true_case); 1521 VisitForControl(expr->condition(), &true_case, &false_case, &true_case);
1522 1522
1523 PrepareForBailoutForId(expr->ThenId(), NO_REGISTERS); 1523 PrepareForBailoutForId(expr->ThenId(), NO_REGISTERS);
1524 __ bind(&true_case); 1524 __ bind(&true_case);
1525 SetExpressionPosition(expr->then_expression(), 1525 SetExpressionPosition(expr->then_expression());
1526 expr->then_expression_position());
1527 if (context()->IsTest()) { 1526 if (context()->IsTest()) {
1528 const TestContext* for_test = TestContext::cast(context()); 1527 const TestContext* for_test = TestContext::cast(context());
1529 VisitForControl(expr->then_expression(), 1528 VisitForControl(expr->then_expression(),
1530 for_test->true_label(), 1529 for_test->true_label(),
1531 for_test->false_label(), 1530 for_test->false_label(),
1532 NULL); 1531 NULL);
1533 } else { 1532 } else {
1534 VisitInDuplicateContext(expr->then_expression()); 1533 VisitInDuplicateContext(expr->then_expression());
1535 __ jmp(&done); 1534 __ jmp(&done);
1536 } 1535 }
1537 1536
1538 PrepareForBailoutForId(expr->ElseId(), NO_REGISTERS); 1537 PrepareForBailoutForId(expr->ElseId(), NO_REGISTERS);
1539 __ bind(&false_case); 1538 __ bind(&false_case);
1540 SetExpressionPosition(expr->else_expression(), 1539 SetExpressionPosition(expr->else_expression());
1541 expr->else_expression_position());
1542 VisitInDuplicateContext(expr->else_expression()); 1540 VisitInDuplicateContext(expr->else_expression());
1543 // If control flow falls through Visit, merge it with true case here. 1541 // If control flow falls through Visit, merge it with true case here.
1544 if (!context()->IsTest()) { 1542 if (!context()->IsTest()) {
1545 __ bind(&done); 1543 __ bind(&done);
1546 } 1544 }
1547 } 1545 }
1548 1546
1549 1547
1550 void FullCodeGenerator::VisitLiteral(Literal* expr) { 1548 void FullCodeGenerator::VisitLiteral(Literal* expr) {
1551 Comment cmnt(masm_, "[ Literal"); 1549 Comment cmnt(masm_, "[ Literal");
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1612 } 1610 }
1613 1611
1614 return false; 1612 return false;
1615 } 1613 }
1616 1614
1617 1615
1618 #undef __ 1616 #undef __
1619 1617
1620 1618
1621 } } // namespace v8::internal 1619 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/full-codegen.h ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698