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

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

Issue 1489863002: [Interpreter] Add support for context slot loads / stores to BytecodeGraphBuilder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. Created 5 years 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/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 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 int depth = execution_context()->ContextChainDepth(variable->scope()); 1321 int depth = execution_context()->ContextChainDepth(variable->scope());
1322 ContextScope* context = execution_context()->Previous(depth); 1322 ContextScope* context = execution_context()->Previous(depth);
1323 Register context_reg; 1323 Register context_reg;
1324 if (context) { 1324 if (context) {
1325 context_reg = context->reg(); 1325 context_reg = context->reg();
1326 } else { 1326 } else {
1327 context_reg = execution_result()->NewRegister(); 1327 context_reg = execution_result()->NewRegister();
1328 // Walk the context chain to find the context at the given depth. 1328 // Walk the context chain to find the context at the given depth.
1329 // TODO(rmcilroy): Perform this work in a bytecode handler once we have 1329 // TODO(rmcilroy): Perform this work in a bytecode handler once we have
1330 // a generic mechanism for performing jumps in interpreter.cc. 1330 // a generic mechanism for performing jumps in interpreter.cc.
1331 // TODO(mythria): Also update bytecode graph builder with correct depth
1332 // when this changes.
1331 builder() 1333 builder()
1332 ->LoadAccumulatorWithRegister(execution_context()->reg()) 1334 ->LoadAccumulatorWithRegister(execution_context()->reg())
1333 .StoreAccumulatorInRegister(context_reg); 1335 .StoreAccumulatorInRegister(context_reg);
1334 for (int i = 0; i < depth; ++i) { 1336 for (int i = 0; i < depth; ++i) {
1335 builder() 1337 builder()
1336 ->LoadContextSlot(context_reg, Context::PREVIOUS_INDEX) 1338 ->LoadContextSlot(context_reg, Context::PREVIOUS_INDEX)
1337 .StoreAccumulatorInRegister(context_reg); 1339 .StoreAccumulatorInRegister(context_reg);
1338 } 1340 }
1339 } 1341 }
1340 builder()->LoadContextSlot(context_reg, variable->index()); 1342 builder()->LoadContextSlot(context_reg, variable->index());
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 ContextScope* context = execution_context()->Previous(depth); 1399 ContextScope* context = execution_context()->Previous(depth);
1398 Register context_reg; 1400 Register context_reg;
1399 if (context) { 1401 if (context) {
1400 context_reg = context->reg(); 1402 context_reg = context->reg();
1401 } else { 1403 } else {
1402 Register value_temp = execution_result()->NewRegister(); 1404 Register value_temp = execution_result()->NewRegister();
1403 context_reg = execution_result()->NewRegister(); 1405 context_reg = execution_result()->NewRegister();
1404 // Walk the context chain to find the context at the given depth. 1406 // Walk the context chain to find the context at the given depth.
1405 // TODO(rmcilroy): Perform this work in a bytecode handler once we have 1407 // TODO(rmcilroy): Perform this work in a bytecode handler once we have
1406 // a generic mechanism for performing jumps in interpreter.cc. 1408 // a generic mechanism for performing jumps in interpreter.cc.
1409 // TODO(mythria): Also update bytecode graph builder with correct depth
1410 // when this changes.
1407 builder() 1411 builder()
1408 ->StoreAccumulatorInRegister(value_temp) 1412 ->StoreAccumulatorInRegister(value_temp)
1409 .LoadAccumulatorWithRegister(execution_context()->reg()) 1413 .LoadAccumulatorWithRegister(execution_context()->reg())
1410 .StoreAccumulatorInRegister(context_reg); 1414 .StoreAccumulatorInRegister(context_reg);
1411 for (int i = 0; i < depth; ++i) { 1415 for (int i = 0; i < depth; ++i) {
1412 builder() 1416 builder()
1413 ->LoadContextSlot(context_reg, Context::PREVIOUS_INDEX) 1417 ->LoadContextSlot(context_reg, Context::PREVIOUS_INDEX)
1414 .StoreAccumulatorInRegister(context_reg); 1418 .StoreAccumulatorInRegister(context_reg);
1415 } 1419 }
1416 builder()->LoadAccumulatorWithRegister(value_temp); 1420 builder()->LoadAccumulatorWithRegister(value_temp);
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
2228 } 2232 }
2229 2233
2230 2234
2231 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 2235 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
2232 return info()->feedback_vector()->GetIndex(slot); 2236 return info()->feedback_vector()->GetIndex(slot);
2233 } 2237 }
2234 2238
2235 } // namespace interpreter 2239 } // namespace interpreter
2236 } // namespace internal 2240 } // namespace internal
2237 } // namespace v8 2241 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/bytecode-graph-builder.cc ('k') | test/cctest/compiler/test-run-bytecode-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698