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 2992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3003 Register closure = register_allocator()->NewRegister(); | 3003 Register closure = register_allocator()->NewRegister(); |
3004 Register scope_info = register_allocator()->NewRegister(); | 3004 Register scope_info = register_allocator()->NewRegister(); |
3005 DCHECK(Register::AreContiguous(closure, scope_info)); | 3005 DCHECK(Register::AreContiguous(closure, scope_info)); |
3006 builder() | 3006 builder() |
3007 ->LoadAccumulatorWithRegister(Register::function_closure()) | 3007 ->LoadAccumulatorWithRegister(Register::function_closure()) |
3008 .StoreAccumulatorInRegister(closure) | 3008 .StoreAccumulatorInRegister(closure) |
3009 .LoadLiteral(scope->GetScopeInfo(isolate())) | 3009 .LoadLiteral(scope->GetScopeInfo(isolate())) |
3010 .StoreAccumulatorInRegister(scope_info) | 3010 .StoreAccumulatorInRegister(scope_info) |
3011 .CallRuntime(Runtime::kNewScriptContext, closure, 2); | 3011 .CallRuntime(Runtime::kNewScriptContext, closure, 2); |
3012 } else { | 3012 } else { |
3013 builder()->CallRuntime(Runtime::kNewFunctionContext, | 3013 builder()->CreateFunctionContext( |
3014 Register::function_closure(), 1); | 3014 scope->GetScopeInfo(isolate())->ContextLength()); |
Michael Starzinger
2016/08/02 11:58:41
Using the {ScopeInfo} here looks dangerous. The sl
klaasb
2016/08/02 13:02:25
Fixed.
| |
3015 } | 3015 } |
3016 execution_result()->SetResultInAccumulator(); | 3016 execution_result()->SetResultInAccumulator(); |
3017 } | 3017 } |
3018 | 3018 |
3019 void BytecodeGenerator::VisitBuildLocalActivationContext() { | 3019 void BytecodeGenerator::VisitBuildLocalActivationContext() { |
3020 Scope* scope = this->scope(); | 3020 Scope* scope = this->scope(); |
3021 | 3021 |
3022 if (scope->has_this_declaration() && scope->receiver()->IsContextSlot()) { | 3022 if (scope->has_this_declaration() && scope->receiver()->IsContextSlot()) { |
3023 Variable* variable = scope->receiver(); | 3023 Variable* variable = scope->receiver(); |
3024 Register receiver(builder()->Parameter(0)); | 3024 Register receiver(builder()->Parameter(0)); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3237 return execution_context()->scope()->language_mode(); | 3237 return execution_context()->scope()->language_mode(); |
3238 } | 3238 } |
3239 | 3239 |
3240 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 3240 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
3241 return TypeFeedbackVector::GetIndex(slot); | 3241 return TypeFeedbackVector::GetIndex(slot); |
3242 } | 3242 } |
3243 | 3243 |
3244 } // namespace interpreter | 3244 } // namespace interpreter |
3245 } // namespace internal | 3245 } // namespace internal |
3246 } // namespace v8 | 3246 } // namespace v8 |
OLD | NEW |