OLD | NEW |
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/full-codegen/full-codegen.h" | 5 #include "src/full-codegen/full-codegen.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/ast-numbering.h" | 8 #include "src/ast-numbering.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 return masm->positions_recorder()->WriteRecordedPositions(); | 553 return masm->positions_recorder()->WriteRecordedPositions(); |
554 } | 554 } |
555 | 555 |
556 | 556 |
557 void FullCodeGenerator::SetFunctionPosition(FunctionLiteral* fun) { | 557 void FullCodeGenerator::SetFunctionPosition(FunctionLiteral* fun) { |
558 RecordPosition(masm_, fun->start_position()); | 558 RecordPosition(masm_, fun->start_position()); |
559 } | 559 } |
560 | 560 |
561 | 561 |
562 void FullCodeGenerator::SetReturnPosition(FunctionLiteral* fun) { | 562 void FullCodeGenerator::SetReturnPosition(FunctionLiteral* fun) { |
563 RecordStatementPosition(masm_, fun->end_position() - 1); | 563 // For default constructors, start position equals end position, and there |
| 564 // is no source code besides the class literal. |
| 565 int pos = std::max(fun->start_position(), fun->end_position() - 1); |
| 566 RecordStatementPosition(masm_, pos); |
564 if (info_->is_debug()) { | 567 if (info_->is_debug()) { |
565 // Always emit a debug break slot before a return. | 568 // Always emit a debug break slot before a return. |
566 DebugCodegen::GenerateSlot(masm_, RelocInfo::DEBUG_BREAK_SLOT_AT_RETURN); | 569 DebugCodegen::GenerateSlot(masm_, RelocInfo::DEBUG_BREAK_SLOT_AT_RETURN); |
567 } | 570 } |
568 } | 571 } |
569 | 572 |
570 | 573 |
571 void FullCodeGenerator::SetStatementPosition( | 574 void FullCodeGenerator::SetStatementPosition( |
572 Statement* stmt, FullCodeGenerator::InsertBreak insert_break) { | 575 Statement* stmt, FullCodeGenerator::InsertBreak insert_break) { |
573 if (stmt->position() == RelocInfo::kNoPosition) return; | 576 if (stmt->position() == RelocInfo::kNoPosition) return; |
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1673 return var->mode() == CONST_LEGACY || var->scope()->is_nonlinear() || | 1676 return var->mode() == CONST_LEGACY || var->scope()->is_nonlinear() || |
1674 var->initializer_position() >= proxy->position(); | 1677 var->initializer_position() >= proxy->position(); |
1675 } | 1678 } |
1676 | 1679 |
1677 | 1680 |
1678 #undef __ | 1681 #undef __ |
1679 | 1682 |
1680 | 1683 |
1681 } // namespace internal | 1684 } // namespace internal |
1682 } // namespace v8 | 1685 } // namespace v8 |
OLD | NEW |