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/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 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1683 receiver = execution_result()->NextConsecutiveRegister(); | 1683 receiver = execution_result()->NextConsecutiveRegister(); |
1684 builder()->LoadUndefined().StoreAccumulatorInRegister(receiver); | 1684 builder()->LoadUndefined().StoreAccumulatorInRegister(receiver); |
1685 } | 1685 } |
1686 // Evaluate all arguments to the runtime call. | 1686 // Evaluate all arguments to the runtime call. |
1687 Register first_arg = VisitArguments(args); | 1687 Register first_arg = VisitArguments(args); |
1688 | 1688 |
1689 if (expr->is_jsruntime()) { | 1689 if (expr->is_jsruntime()) { |
1690 DCHECK(args->length() == 0 || first_arg.index() == receiver.index() + 1); | 1690 DCHECK(args->length() == 0 || first_arg.index() == receiver.index() + 1); |
1691 builder()->CallJSRuntime(expr->context_index(), receiver, args->length()); | 1691 builder()->CallJSRuntime(expr->context_index(), receiver, args->length()); |
1692 } else { | 1692 } else { |
1693 // TODO(rmcilroy): support multiple return values. | |
1694 DCHECK_LE(expr->function()->result_size, 1); | |
1695 Runtime::FunctionId function_id = expr->function()->function_id; | 1693 Runtime::FunctionId function_id = expr->function()->function_id; |
1696 builder()->CallRuntime(function_id, first_arg, args->length()); | 1694 builder()->CallRuntime(function_id, first_arg, args->length()); |
1697 } | 1695 } |
1698 execution_result()->SetResultInAccumulator(); | 1696 execution_result()->SetResultInAccumulator(); |
1699 } | 1697 } |
1700 | 1698 |
1701 | 1699 |
1702 void BytecodeGenerator::VisitVoid(UnaryOperation* expr) { | 1700 void BytecodeGenerator::VisitVoid(UnaryOperation* expr) { |
1703 VisitForEffect(expr->expression()); | 1701 VisitForEffect(expr->expression()); |
1704 builder()->LoadUndefined(); | 1702 builder()->LoadUndefined(); |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2227 } | 2225 } |
2228 | 2226 |
2229 | 2227 |
2230 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 2228 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
2231 return info()->feedback_vector()->GetIndex(slot); | 2229 return info()->feedback_vector()->GetIndex(slot); |
2232 } | 2230 } |
2233 | 2231 |
2234 } // namespace interpreter | 2232 } // namespace interpreter |
2235 } // namespace internal | 2233 } // namespace internal |
2236 } // namespace v8 | 2234 } // namespace v8 |
OLD | NEW |