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

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

Issue 2248633002: [interpreter] Add CreateBlockContext bytecode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: comments Created 4 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
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('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/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/interpreter/bytecode-flags.h" 10 #include "src/interpreter/bytecode-flags.h"
(...skipping 3193 matching lines...) Expand 10 before | Expand all | Expand 10 after
3204 DCHECK_EQ(0, scope->ContextChainLength(variable->scope())); 3204 DCHECK_EQ(0, scope->ContextChainLength(variable->scope()));
3205 builder()->LoadAccumulatorWithRegister(parameter) 3205 builder()->LoadAccumulatorWithRegister(parameter)
3206 .StoreContextSlot(execution_context()->reg(), variable->index()); 3206 .StoreContextSlot(execution_context()->reg(), variable->index());
3207 } 3207 }
3208 } 3208 }
3209 3209
3210 void BytecodeGenerator::VisitNewLocalBlockContext(Scope* scope) { 3210 void BytecodeGenerator::VisitNewLocalBlockContext(Scope* scope) {
3211 AccumulatorResultScope accumulator_execution_result(this); 3211 AccumulatorResultScope accumulator_execution_result(this);
3212 DCHECK(scope->is_block_scope()); 3212 DCHECK(scope->is_block_scope());
3213 3213
3214 // Allocate a new local block context. 3214 VisitFunctionClosureForContext();
3215 register_allocator()->PrepareForConsecutiveAllocations(2);
3216 Register scope_info = register_allocator()->NextConsecutiveRegister();
3217 Register closure = register_allocator()->NextConsecutiveRegister();
3218 3215
3219 builder() 3216 builder()->CreateBlockContext(scope->GetScopeInfo(isolate()));
3220 ->LoadLiteral(scope->GetScopeInfo(isolate()))
3221 .StoreAccumulatorInRegister(scope_info);
3222 VisitFunctionClosureForContext();
3223 builder()
3224 ->StoreAccumulatorInRegister(closure)
3225 .CallRuntime(Runtime::kPushBlockContext, scope_info, 2);
3226 execution_result()->SetResultInAccumulator(); 3217 execution_result()->SetResultInAccumulator();
3227 } 3218 }
3228 3219
3229 void BytecodeGenerator::VisitNewLocalWithContext() { 3220 void BytecodeGenerator::VisitNewLocalWithContext() {
3230 AccumulatorResultScope accumulator_execution_result(this); 3221 AccumulatorResultScope accumulator_execution_result(this);
3231 3222
3232 register_allocator()->PrepareForConsecutiveAllocations(2); 3223 register_allocator()->PrepareForConsecutiveAllocations(2);
3233 Register extension_object = register_allocator()->NextConsecutiveRegister(); 3224 Register extension_object = register_allocator()->NextConsecutiveRegister();
3234 Register closure = register_allocator()->NextConsecutiveRegister(); 3225 Register closure = register_allocator()->NextConsecutiveRegister();
3235 3226
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
3431 return execution_context()->scope()->language_mode(); 3422 return execution_context()->scope()->language_mode();
3432 } 3423 }
3433 3424
3434 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 3425 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
3435 return TypeFeedbackVector::GetIndex(slot); 3426 return TypeFeedbackVector::GetIndex(slot);
3436 } 3427 }
3437 3428
3438 } // namespace interpreter 3429 } // namespace interpreter
3439 } // namespace internal 3430 } // namespace internal
3440 } // namespace v8 3431 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698