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

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: regenerate golden files 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
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 size_t scope_info = builder()->AllocateConstantPoolEntry();
3215 register_allocator()->PrepareForConsecutiveAllocations(2); 3215 builder()->InsertConstantPoolEntryAt(scope_info,
3216 Register scope_info = register_allocator()->NextConsecutiveRegister(); 3216 scope->GetScopeInfo(isolate()));
rmcilroy 2016/08/15 16:01:04 Don't use AllocateConstantPoolEntry() (That's only
klaasb 2016/08/16 10:40:09 Done.
3217 Register closure = register_allocator()->NextConsecutiveRegister(); 3217 VisitFunctionClosureForContext();
3218 3218
3219 builder() 3219 builder()->CreateBlockContext(scope_info);
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(); 3220 execution_result()->SetResultInAccumulator();
3227 } 3221 }
3228 3222
3229 void BytecodeGenerator::VisitNewLocalWithContext() { 3223 void BytecodeGenerator::VisitNewLocalWithContext() {
3230 AccumulatorResultScope accumulator_execution_result(this); 3224 AccumulatorResultScope accumulator_execution_result(this);
3231 3225
3232 register_allocator()->PrepareForConsecutiveAllocations(2); 3226 register_allocator()->PrepareForConsecutiveAllocations(2);
3233 Register extension_object = register_allocator()->NextConsecutiveRegister(); 3227 Register extension_object = register_allocator()->NextConsecutiveRegister();
3234 Register closure = register_allocator()->NextConsecutiveRegister(); 3228 Register closure = register_allocator()->NextConsecutiveRegister();
3235 3229
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
3431 return execution_context()->scope()->language_mode(); 3425 return execution_context()->scope()->language_mode();
3432 } 3426 }
3433 3427
3434 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 3428 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
3435 return TypeFeedbackVector::GetIndex(slot); 3429 return TypeFeedbackVector::GetIndex(slot);
3436 } 3430 }
3437 3431
3438 } // namespace interpreter 3432 } // namespace interpreter
3439 } // namespace internal 3433 } // namespace internal
3440 } // namespace v8 3434 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698