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

Side by Side Diff: src/interpreter/bytecode-generator.cc

Issue 2187523002: [interpreter] Add CreateFunctionContext bytecode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@fncontextstubslotparam
Patch Set: fix bytecode-generator 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 2992 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 int slot_count = scope->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
3014 Register::function_closure(), 1); 3014 builder()->CreateFunctionContext(slot_count);
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698