| 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 3150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3161 Register scope_info = register_allocator()->NewRegister(); | 3161 Register scope_info = register_allocator()->NewRegister(); |
| 3162 DCHECK(Register::AreContiguous(closure, scope_info)); | 3162 DCHECK(Register::AreContiguous(closure, scope_info)); |
| 3163 builder() | 3163 builder() |
| 3164 ->LoadAccumulatorWithRegister(Register::function_closure()) | 3164 ->LoadAccumulatorWithRegister(Register::function_closure()) |
| 3165 .StoreAccumulatorInRegister(closure) | 3165 .StoreAccumulatorInRegister(closure) |
| 3166 .LoadLiteral(scope->scope_info()) | 3166 .LoadLiteral(scope->scope_info()) |
| 3167 .StoreAccumulatorInRegister(scope_info) | 3167 .StoreAccumulatorInRegister(scope_info) |
| 3168 .CallRuntime(Runtime::kNewScriptContext, closure, 2); | 3168 .CallRuntime(Runtime::kNewScriptContext, closure, 2); |
| 3169 } else { | 3169 } else { |
| 3170 int slot_count = scope->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 3170 int slot_count = scope->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
| 3171 builder()->CreateFunctionContext(slot_count); | 3171 if (slot_count <= FastNewFunctionContextStub::kMaximumSlots) { |
| 3172 builder()->CreateFunctionContext(slot_count); |
| 3173 } else { |
| 3174 builder()->CallRuntime(Runtime::kNewFunctionContext, |
| 3175 Register::function_closure(), 1); |
| 3176 } |
| 3172 } | 3177 } |
| 3173 execution_result()->SetResultInAccumulator(); | 3178 execution_result()->SetResultInAccumulator(); |
| 3174 } | 3179 } |
| 3175 | 3180 |
| 3176 void BytecodeGenerator::VisitBuildLocalActivationContext() { | 3181 void BytecodeGenerator::VisitBuildLocalActivationContext() { |
| 3177 DeclarationScope* scope = this->scope(); | 3182 DeclarationScope* scope = this->scope(); |
| 3178 | 3183 |
| 3179 if (scope->has_this_declaration() && scope->receiver()->IsContextSlot()) { | 3184 if (scope->has_this_declaration() && scope->receiver()->IsContextSlot()) { |
| 3180 Variable* variable = scope->receiver(); | 3185 Variable* variable = scope->receiver(); |
| 3181 Register receiver(builder()->Parameter(0)); | 3186 Register receiver(builder()->Parameter(0)); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3403 return execution_context()->scope()->language_mode(); | 3408 return execution_context()->scope()->language_mode(); |
| 3404 } | 3409 } |
| 3405 | 3410 |
| 3406 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 3411 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
| 3407 return TypeFeedbackVector::GetIndex(slot); | 3412 return TypeFeedbackVector::GetIndex(slot); |
| 3408 } | 3413 } |
| 3409 | 3414 |
| 3410 } // namespace interpreter | 3415 } // namespace interpreter |
| 3411 } // namespace internal | 3416 } // namespace internal |
| 3412 } // namespace v8 | 3417 } // namespace v8 |
| OLD | NEW |