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

Side by Side Diff: src/interpreter/bytecode-generator.cc

Issue 2314483002: Store the ScopeInfo in WithContexts (Closed)
Patch Set: updates Created 4 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
« no previous file with comments | « src/interpreter/bytecode-generator.h ('k') | src/interpreter/bytecodes.h » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/interpreter/bytecode-generator.h" 5 #include "src/interpreter/bytecode-generator.h"
6 6
7 #include "src/ast/compile-time-value.h" 7 #include "src/ast/compile-time-value.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/compilation-info.h" 10 #include "src/compilation-info.h"
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 1086
1087 void BytecodeGenerator::VisitReturnStatement(ReturnStatement* stmt) { 1087 void BytecodeGenerator::VisitReturnStatement(ReturnStatement* stmt) {
1088 builder()->SetStatementPosition(stmt); 1088 builder()->SetStatementPosition(stmt);
1089 VisitForAccumulatorValue(stmt->expression()); 1089 VisitForAccumulatorValue(stmt->expression());
1090 execution_control()->ReturnAccumulator(); 1090 execution_control()->ReturnAccumulator();
1091 } 1091 }
1092 1092
1093 void BytecodeGenerator::VisitWithStatement(WithStatement* stmt) { 1093 void BytecodeGenerator::VisitWithStatement(WithStatement* stmt) {
1094 builder()->SetStatementPosition(stmt); 1094 builder()->SetStatementPosition(stmt);
1095 VisitForAccumulatorValue(stmt->expression()); 1095 VisitForAccumulatorValue(stmt->expression());
1096 VisitNewLocalWithContext(); 1096 VisitNewLocalWithContext(stmt->scope());
1097 VisitInScope(stmt->statement(), stmt->scope()); 1097 VisitInScope(stmt->statement(), stmt->scope());
1098 } 1098 }
1099 1099
1100 void BytecodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { 1100 void BytecodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) {
1101 // We need this scope because we visit for register values. We have to 1101 // We need this scope because we visit for register values. We have to
1102 // maintain a execution result scope where registers can be allocated. 1102 // maintain a execution result scope where registers can be allocated.
1103 ZoneList<CaseClause*>* clauses = stmt->cases(); 1103 ZoneList<CaseClause*>* clauses = stmt->cases();
1104 SwitchBuilder switch_builder(builder(), clauses->length()); 1104 SwitchBuilder switch_builder(builder(), clauses->length());
1105 ControlScopeForBreakable scope(this, stmt, &switch_builder); 1105 ControlScopeForBreakable scope(this, stmt, &switch_builder);
1106 int default_index = -1; 1106 int default_index = -1;
(...skipping 2085 matching lines...) Expand 10 before | Expand all | Expand 10 after
3192 3192
3193 void BytecodeGenerator::VisitNewLocalBlockContext(Scope* scope) { 3193 void BytecodeGenerator::VisitNewLocalBlockContext(Scope* scope) {
3194 AccumulatorResultScope accumulator_execution_result(this); 3194 AccumulatorResultScope accumulator_execution_result(this);
3195 DCHECK(scope->is_block_scope()); 3195 DCHECK(scope->is_block_scope());
3196 3196
3197 VisitFunctionClosureForContext(); 3197 VisitFunctionClosureForContext();
3198 builder()->CreateBlockContext(scope->scope_info()); 3198 builder()->CreateBlockContext(scope->scope_info());
3199 execution_result()->SetResultInAccumulator(); 3199 execution_result()->SetResultInAccumulator();
3200 } 3200 }
3201 3201
3202 void BytecodeGenerator::VisitNewLocalWithContext() { 3202 void BytecodeGenerator::VisitNewLocalWithContext(Scope* scope) {
3203 AccumulatorResultScope accumulator_execution_result(this); 3203 AccumulatorResultScope accumulator_execution_result(this);
3204 3204
3205 Register extension_object = register_allocator()->NewRegister(); 3205 Register extension_object = register_allocator()->NewRegister();
3206 3206
3207 builder()->ConvertAccumulatorToObject(extension_object); 3207 builder()->ConvertAccumulatorToObject(extension_object);
3208 VisitFunctionClosureForContext(); 3208 VisitFunctionClosureForContext();
3209 builder()->CreateWithContext(extension_object); 3209 builder()->CreateWithContext(extension_object, scope->scope_info());
3210 execution_result()->SetResultInAccumulator(); 3210 execution_result()->SetResultInAccumulator();
3211 } 3211 }
3212 3212
3213 void BytecodeGenerator::VisitNewLocalCatchContext(Variable* variable, 3213 void BytecodeGenerator::VisitNewLocalCatchContext(Variable* variable,
3214 Scope* scope) { 3214 Scope* scope) {
3215 AccumulatorResultScope accumulator_execution_result(this); 3215 AccumulatorResultScope accumulator_execution_result(this);
3216 DCHECK(variable->IsContextSlot()); 3216 DCHECK(variable->IsContextSlot());
3217 3217
3218 Register exception = register_allocator()->NewRegister(); 3218 Register exception = register_allocator()->NewRegister();
3219 builder()->StoreAccumulatorInRegister(exception); 3219 builder()->StoreAccumulatorInRegister(exception);
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
3394 return execution_context()->scope()->language_mode(); 3394 return execution_context()->scope()->language_mode();
3395 } 3395 }
3396 3396
3397 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 3397 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
3398 return TypeFeedbackVector::GetIndex(slot); 3398 return TypeFeedbackVector::GetIndex(slot);
3399 } 3399 }
3400 3400
3401 } // namespace interpreter 3401 } // namespace interpreter
3402 } // namespace internal 3402 } // namespace internal
3403 } // namespace v8 3403 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-generator.h ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698