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

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

Issue 1558153002: [Interpreter] Pass correct closure argument when creating block context. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixes test262.status with failing tests on bots Created 4 years, 11 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
« no previous file with comments | « no previous file | test/test262/test262.status » ('j') | test/test262/test262.status » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 2138 matching lines...) Expand 10 before | Expand all | Expand 10 after
2149 } 2149 }
2150 2150
2151 2151
2152 void BytecodeGenerator::VisitFunctionClosureForContext() { 2152 void BytecodeGenerator::VisitFunctionClosureForContext() {
2153 AccumulatorResultScope accumulator_execution_result(this); 2153 AccumulatorResultScope accumulator_execution_result(this);
2154 Scope* closure_scope = execution_context()->scope()->ClosureScope(); 2154 Scope* closure_scope = execution_context()->scope()->ClosureScope();
2155 if (closure_scope->is_script_scope() || 2155 if (closure_scope->is_script_scope() ||
2156 closure_scope->is_module_scope()) { 2156 closure_scope->is_module_scope()) {
2157 // Contexts nested in the native context have a canonical empty function as 2157 // Contexts nested in the native context have a canonical empty function as
2158 // their closure, not the anonymous closure containing the global code. 2158 // their closure, not the anonymous closure containing the global code.
2159 // Pass a SMI sentinel and let the runtime look up the empty function. 2159 Register native_context = execution_result()->NewRegister();
2160 builder()->LoadLiteral(Smi::FromInt(0)); 2160 builder()
2161 ->LoadContextSlot(execution_context()->reg(),
2162 Context::NATIVE_CONTEXT_INDEX)
2163 .StoreAccumulatorInRegister(native_context)
2164 .LoadContextSlot(native_context, Context::CLOSURE_INDEX);
2161 } else { 2165 } else {
2162 DCHECK(closure_scope->is_function_scope()); 2166 DCHECK(closure_scope->is_function_scope());
2163 builder()->LoadAccumulatorWithRegister(Register::function_closure()); 2167 builder()->LoadAccumulatorWithRegister(Register::function_closure());
2164 } 2168 }
2165 execution_result()->SetResultInAccumulator(); 2169 execution_result()->SetResultInAccumulator();
2166 } 2170 }
2167 2171
2168 2172
2169 // Visits the expression |expr| and places the result in the accumulator. 2173 // Visits the expression |expr| and places the result in the accumulator.
2170 void BytecodeGenerator::VisitForAccumulatorValue(Expression* expr) { 2174 void BytecodeGenerator::VisitForAccumulatorValue(Expression* expr) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2217 } 2221 }
2218 2222
2219 2223
2220 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 2224 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
2221 return info()->feedback_vector()->GetIndex(slot); 2225 return info()->feedback_vector()->GetIndex(slot);
2222 } 2226 }
2223 2227
2224 } // namespace interpreter 2228 } // namespace interpreter
2225 } // namespace internal 2229 } // namespace internal
2226 } // namespace v8 2230 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/test262/test262.status » ('j') | test/test262/test262.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698