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

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

Issue 1659023002: [interpreter] Unify meaning of register count operands. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 10 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 | « src/interpreter/bytecode-array-iterator.cc ('k') | src/interpreter/interpreter.cc » ('j') | no next file with comments »
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/bytecode-register-allocator.h" 9 #include "src/interpreter/bytecode-register-allocator.h"
10 #include "src/interpreter/control-flow-builders.h" 10 #include "src/interpreter/control-flow-builders.h"
(...skipping 1938 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 Smi::FromInt(execution_context()->scope()->start_position())) 1949 Smi::FromInt(execution_context()->scope()->start_position()))
1950 .StoreAccumulatorInRegister(position); 1950 .StoreAccumulatorInRegister(position);
1951 1951
1952 // Call ResolvePossiblyDirectEval and modify the callee. 1952 // Call ResolvePossiblyDirectEval and modify the callee.
1953 builder() 1953 builder()
1954 ->CallRuntime(Runtime::kResolvePossiblyDirectEval, callee_for_eval, 5) 1954 ->CallRuntime(Runtime::kResolvePossiblyDirectEval, callee_for_eval, 5)
1955 .StoreAccumulatorInRegister(callee); 1955 .StoreAccumulatorInRegister(callee);
1956 } 1956 }
1957 1957
1958 // TODO(rmcilroy): Use CallIC to allow call type feedback. 1958 // TODO(rmcilroy): Use CallIC to allow call type feedback.
1959 builder()->Call(callee, receiver, args->length(), 1959 builder()->Call(callee, receiver, 1 + args->length(),
1960 feedback_index(expr->CallFeedbackICSlot())); 1960 feedback_index(expr->CallFeedbackICSlot()));
1961 execution_result()->SetResultInAccumulator(); 1961 execution_result()->SetResultInAccumulator();
1962 } 1962 }
1963 1963
1964 1964
1965 void BytecodeGenerator::VisitCallNew(CallNew* expr) { 1965 void BytecodeGenerator::VisitCallNew(CallNew* expr) {
1966 Register constructor = register_allocator()->NewRegister(); 1966 Register constructor = register_allocator()->NewRegister();
1967 VisitForAccumulatorValue(expr->expression()); 1967 VisitForAccumulatorValue(expr->expression());
1968 builder()->StoreAccumulatorInRegister(constructor); 1968 builder()->StoreAccumulatorInRegister(constructor);
1969 1969
1970 ZoneList<Expression*>* args = expr->arguments(); 1970 ZoneList<Expression*>* args = expr->arguments();
1971 Register first_arg = VisitArguments(args); 1971 Register first_arg = VisitArguments(args);
1972 builder()->New(constructor, first_arg, args->length()); 1972 builder()->New(constructor, first_arg, args->length());
1973 execution_result()->SetResultInAccumulator(); 1973 execution_result()->SetResultInAccumulator();
1974 } 1974 }
1975 1975
1976 1976
1977 void BytecodeGenerator::VisitCallRuntime(CallRuntime* expr) { 1977 void BytecodeGenerator::VisitCallRuntime(CallRuntime* expr) {
1978 ZoneList<Expression*>* args = expr->arguments(); 1978 ZoneList<Expression*>* args = expr->arguments();
1979 Register receiver;
1980 if (expr->is_jsruntime()) { 1979 if (expr->is_jsruntime()) {
1981 // Allocate a register for the receiver and load it with undefined. 1980 // Allocate a register for the receiver and load it with undefined.
1982 register_allocator()->PrepareForConsecutiveAllocations(args->length() + 1); 1981 register_allocator()->PrepareForConsecutiveAllocations(1 + args->length());
1983 receiver = register_allocator()->NextConsecutiveRegister(); 1982 Register receiver = register_allocator()->NextConsecutiveRegister();
1984 builder()->LoadUndefined().StoreAccumulatorInRegister(receiver); 1983 builder()->LoadUndefined().StoreAccumulatorInRegister(receiver);
1985 } 1984 Register first_arg = VisitArguments(args);
1986 // Evaluate all arguments to the runtime call. 1985 CHECK(args->length() == 0 || first_arg.index() == receiver.index() + 1);
1987 Register first_arg = VisitArguments(args); 1986 builder()->CallJSRuntime(expr->context_index(), receiver,
1988 1987 1 + args->length());
1989 if (expr->is_jsruntime()) {
1990 DCHECK(args->length() == 0 || first_arg.index() == receiver.index() + 1);
1991 builder()->CallJSRuntime(expr->context_index(), receiver, args->length());
1992 } else { 1988 } else {
1989 // Evaluate all arguments to the runtime call.
1990 Register first_arg = VisitArguments(args);
1993 Runtime::FunctionId function_id = expr->function()->function_id; 1991 Runtime::FunctionId function_id = expr->function()->function_id;
1994 builder()->CallRuntime(function_id, first_arg, args->length()); 1992 builder()->CallRuntime(function_id, first_arg, args->length());
1995 } 1993 }
1996 execution_result()->SetResultInAccumulator(); 1994 execution_result()->SetResultInAccumulator();
1997 } 1995 }
1998 1996
1999 1997
2000 void BytecodeGenerator::VisitVoid(UnaryOperation* expr) { 1998 void BytecodeGenerator::VisitVoid(UnaryOperation* expr) {
2001 VisitForEffect(expr->expression()); 1999 VisitForEffect(expr->expression());
2002 builder()->LoadUndefined(); 2000 builder()->LoadUndefined();
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
2542 } 2540 }
2543 2541
2544 2542
2545 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 2543 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
2546 return info()->feedback_vector()->GetIndex(slot); 2544 return info()->feedback_vector()->GetIndex(slot);
2547 } 2545 }
2548 2546
2549 } // namespace interpreter 2547 } // namespace interpreter
2550 } // namespace internal 2548 } // namespace internal
2551 } // namespace v8 2549 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-iterator.cc ('k') | src/interpreter/interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698