OLD | NEW |
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/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/interpreter/control-flow-builders.h" | 9 #include "src/interpreter/control-flow-builders.h" |
10 #include "src/objects.h" | 10 #include "src/objects.h" |
(...skipping 2056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2067 } | 2067 } |
2068 } | 2068 } |
2069 | 2069 |
2070 | 2070 |
2071 void BytecodeGenerator::VisitNewLocalBlockContext(Scope* scope) { | 2071 void BytecodeGenerator::VisitNewLocalBlockContext(Scope* scope) { |
2072 AccumulatorResultScope accumulator_execution_result(this); | 2072 AccumulatorResultScope accumulator_execution_result(this); |
2073 DCHECK(scope->is_block_scope()); | 2073 DCHECK(scope->is_block_scope()); |
2074 | 2074 |
2075 // Allocate a new local block context. | 2075 // Allocate a new local block context. |
2076 TemporaryRegisterScope temporary_register_scope(builder()); | 2076 TemporaryRegisterScope temporary_register_scope(builder()); |
2077 Register scope_info = temporary_register_scope.NewRegister(); | 2077 temporary_register_scope.PrepareForConsecutiveAllocations(2); |
2078 Register closure = temporary_register_scope.NewRegister(); | 2078 Register scope_info = temporary_register_scope.NextConsecutiveRegister(); |
2079 DCHECK(Register::AreContiguous(scope_info, closure)); | 2079 Register closure = temporary_register_scope.NextConsecutiveRegister(); |
| 2080 |
2080 builder() | 2081 builder() |
2081 ->LoadLiteral(scope->GetScopeInfo(isolate())) | 2082 ->LoadLiteral(scope->GetScopeInfo(isolate())) |
2082 .StoreAccumulatorInRegister(scope_info); | 2083 .StoreAccumulatorInRegister(scope_info); |
2083 VisitFunctionClosureForContext(); | 2084 VisitFunctionClosureForContext(); |
2084 builder() | 2085 builder() |
2085 ->StoreAccumulatorInRegister(closure) | 2086 ->StoreAccumulatorInRegister(closure) |
2086 .CallRuntime(Runtime::kPushBlockContext, scope_info, 2); | 2087 .CallRuntime(Runtime::kPushBlockContext, scope_info, 2); |
2087 execution_result()->SetResultInAccumulator(); | 2088 execution_result()->SetResultInAccumulator(); |
2088 } | 2089 } |
2089 | 2090 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2216 } | 2217 } |
2217 | 2218 |
2218 | 2219 |
2219 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 2220 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
2220 return info()->feedback_vector()->GetIndex(slot); | 2221 return info()->feedback_vector()->GetIndex(slot); |
2221 } | 2222 } |
2222 | 2223 |
2223 } // namespace interpreter | 2224 } // namespace interpreter |
2224 } // namespace internal | 2225 } // namespace internal |
2225 } // namespace v8 | 2226 } // namespace v8 |
OLD | NEW |