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/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 3202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3213 | 3213 |
3214 VisitFunctionClosureForContext(); | 3214 VisitFunctionClosureForContext(); |
3215 | 3215 |
3216 builder()->CreateBlockContext(scope->GetScopeInfo(isolate())); | 3216 builder()->CreateBlockContext(scope->GetScopeInfo(isolate())); |
3217 execution_result()->SetResultInAccumulator(); | 3217 execution_result()->SetResultInAccumulator(); |
3218 } | 3218 } |
3219 | 3219 |
3220 void BytecodeGenerator::VisitNewLocalWithContext() { | 3220 void BytecodeGenerator::VisitNewLocalWithContext() { |
3221 AccumulatorResultScope accumulator_execution_result(this); | 3221 AccumulatorResultScope accumulator_execution_result(this); |
3222 | 3222 |
3223 register_allocator()->PrepareForConsecutiveAllocations(2); | 3223 Register extension_object = register_allocator()->NewRegister(); |
3224 Register extension_object = register_allocator()->NextConsecutiveRegister(); | |
3225 Register closure = register_allocator()->NextConsecutiveRegister(); | |
3226 | 3224 |
3227 builder()->CastAccumulatorToJSObject(extension_object); | 3225 builder()->CastAccumulatorToJSObject(extension_object); |
3228 VisitFunctionClosureForContext(); | 3226 VisitFunctionClosureForContext(); |
3229 builder()->StoreAccumulatorInRegister(closure).CallRuntime( | 3227 builder()->CreateWithContext(extension_object); |
3230 Runtime::kPushWithContext, extension_object, 2); | |
3231 execution_result()->SetResultInAccumulator(); | 3228 execution_result()->SetResultInAccumulator(); |
3232 } | 3229 } |
3233 | 3230 |
3234 void BytecodeGenerator::VisitNewLocalCatchContext(Variable* variable) { | 3231 void BytecodeGenerator::VisitNewLocalCatchContext(Variable* variable) { |
3235 AccumulatorResultScope accumulator_execution_result(this); | 3232 AccumulatorResultScope accumulator_execution_result(this); |
3236 DCHECK(variable->IsContextSlot()); | 3233 DCHECK(variable->IsContextSlot()); |
3237 | 3234 |
3238 // Allocate a new local block context. | 3235 // Allocate a new local block context. |
3239 register_allocator()->PrepareForConsecutiveAllocations(3); | 3236 register_allocator()->PrepareForConsecutiveAllocations(3); |
3240 Register name = register_allocator()->NextConsecutiveRegister(); | 3237 Register name = register_allocator()->NextConsecutiveRegister(); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3422 return execution_context()->scope()->language_mode(); | 3419 return execution_context()->scope()->language_mode(); |
3423 } | 3420 } |
3424 | 3421 |
3425 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 3422 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
3426 return TypeFeedbackVector::GetIndex(slot); | 3423 return TypeFeedbackVector::GetIndex(slot); |
3427 } | 3424 } |
3428 | 3425 |
3429 } // namespace interpreter | 3426 } // namespace interpreter |
3430 } // namespace internal | 3427 } // namespace internal |
3431 } // namespace v8 | 3428 } // namespace v8 |
OLD | NEW |