| 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/ast-numbering.h" | 7 #include "src/ast/ast-numbering.h" |
| 8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
| 10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
| (...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 void FullCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) { | 1107 void FullCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) { |
| 1108 Comment cmnt(masm_, "[ ReturnStatement"); | 1108 Comment cmnt(masm_, "[ ReturnStatement"); |
| 1109 SetStatementPosition(stmt); | 1109 SetStatementPosition(stmt); |
| 1110 Expression* expr = stmt->expression(); | 1110 Expression* expr = stmt->expression(); |
| 1111 VisitForAccumulatorValue(expr); | 1111 VisitForAccumulatorValue(expr); |
| 1112 EmitUnwindAndReturn(); | 1112 EmitUnwindAndReturn(); |
| 1113 } | 1113 } |
| 1114 | 1114 |
| 1115 | 1115 |
| 1116 void FullCodeGenerator::VisitWithStatement(WithStatement* stmt) { | 1116 void FullCodeGenerator::VisitWithStatement(WithStatement* stmt) { |
| 1117 Comment cmnt(masm_, "[ WithStatement"); | 1117 // Dynamic scoping is not supported. |
| 1118 SetStatementPosition(stmt); | 1118 UNREACHABLE(); |
| 1119 | |
| 1120 VisitForAccumulatorValue(stmt->expression()); | |
| 1121 Callable callable = CodeFactory::ToObject(isolate()); | |
| 1122 __ Move(callable.descriptor().GetRegisterParameter(0), result_register()); | |
| 1123 __ Call(callable.code(), RelocInfo::CODE_TARGET); | |
| 1124 RestoreContext(); | |
| 1125 PrepareForBailoutForId(stmt->ToObjectId(), BailoutState::TOS_REGISTER); | |
| 1126 PushOperand(result_register()); | |
| 1127 PushOperand(stmt->scope()->scope_info()); | |
| 1128 PushFunctionArgumentForContextAllocation(); | |
| 1129 CallRuntimeWithOperands(Runtime::kPushWithContext); | |
| 1130 StoreToFrameField(StandardFrameConstants::kContextOffset, context_register()); | |
| 1131 PrepareForBailoutForId(stmt->EntryId(), BailoutState::NO_REGISTERS); | |
| 1132 | |
| 1133 Scope* saved_scope = scope(); | |
| 1134 scope_ = stmt->scope(); | |
| 1135 { WithOrCatch body(this); | |
| 1136 Visit(stmt->statement()); | |
| 1137 } | |
| 1138 scope_ = saved_scope; | |
| 1139 | |
| 1140 // Pop context. | |
| 1141 LoadContextField(context_register(), Context::PREVIOUS_INDEX); | |
| 1142 // Update local stack frame context field. | |
| 1143 StoreToFrameField(StandardFrameConstants::kContextOffset, context_register()); | |
| 1144 } | 1119 } |
| 1145 | 1120 |
| 1146 | 1121 |
| 1147 void FullCodeGenerator::VisitDoWhileStatement(DoWhileStatement* stmt) { | 1122 void FullCodeGenerator::VisitDoWhileStatement(DoWhileStatement* stmt) { |
| 1148 Comment cmnt(masm_, "[ DoWhileStatement"); | 1123 Comment cmnt(masm_, "[ DoWhileStatement"); |
| 1149 // Do not insert break location as we do that below. | 1124 // Do not insert break location as we do that below. |
| 1150 SetStatementPosition(stmt, SKIP_BREAK); | 1125 SetStatementPosition(stmt, SKIP_BREAK); |
| 1151 | 1126 |
| 1152 Label body, book_keeping; | 1127 Label body, book_keeping; |
| 1153 | 1128 |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1662 return info_->has_simple_parameters(); | 1637 return info_->has_simple_parameters(); |
| 1663 } | 1638 } |
| 1664 | 1639 |
| 1665 FunctionLiteral* FullCodeGenerator::literal() const { return info_->literal(); } | 1640 FunctionLiteral* FullCodeGenerator::literal() const { return info_->literal(); } |
| 1666 | 1641 |
| 1667 #undef __ | 1642 #undef __ |
| 1668 | 1643 |
| 1669 | 1644 |
| 1670 } // namespace internal | 1645 } // namespace internal |
| 1671 } // namespace v8 | 1646 } // namespace v8 |
| OLD | NEW |