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 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1677 receiver = execution_result()->NextConsecutiveRegister(); | 1677 receiver = execution_result()->NextConsecutiveRegister(); |
1678 builder()->LoadUndefined().StoreAccumulatorInRegister(receiver); | 1678 builder()->LoadUndefined().StoreAccumulatorInRegister(receiver); |
1679 } | 1679 } |
1680 // Evaluate all arguments to the runtime call. | 1680 // Evaluate all arguments to the runtime call. |
1681 Register first_arg = VisitArguments(args); | 1681 Register first_arg = VisitArguments(args); |
1682 | 1682 |
1683 if (expr->is_jsruntime()) { | 1683 if (expr->is_jsruntime()) { |
1684 DCHECK(args->length() == 0 || first_arg.index() == receiver.index() + 1); | 1684 DCHECK(args->length() == 0 || first_arg.index() == receiver.index() + 1); |
1685 builder()->CallJSRuntime(expr->context_index(), receiver, args->length()); | 1685 builder()->CallJSRuntime(expr->context_index(), receiver, args->length()); |
1686 } else { | 1686 } else { |
1687 // TODO(rmcilroy): support multiple return values. | |
1688 DCHECK_LE(expr->function()->result_size, 1); | |
1689 Runtime::FunctionId function_id = expr->function()->function_id; | 1687 Runtime::FunctionId function_id = expr->function()->function_id; |
1690 builder()->CallRuntime(function_id, first_arg, args->length()); | 1688 builder()->CallRuntime(function_id, first_arg, args->length()); |
1691 } | 1689 } |
1692 execution_result()->SetResultInAccumulator(); | 1690 execution_result()->SetResultInAccumulator(); |
1693 } | 1691 } |
1694 | 1692 |
1695 | 1693 |
1696 void BytecodeGenerator::VisitVoid(UnaryOperation* expr) { | 1694 void BytecodeGenerator::VisitVoid(UnaryOperation* expr) { |
1697 VisitForEffect(expr->expression()); | 1695 VisitForEffect(expr->expression()); |
1698 builder()->LoadUndefined(); | 1696 builder()->LoadUndefined(); |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2217 } | 2215 } |
2218 | 2216 |
2219 | 2217 |
2220 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 2218 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
2221 return info()->feedback_vector()->GetIndex(slot); | 2219 return info()->feedback_vector()->GetIndex(slot); |
2222 } | 2220 } |
2223 | 2221 |
2224 } // namespace interpreter | 2222 } // namespace interpreter |
2225 } // namespace internal | 2223 } // namespace internal |
2226 } // namespace v8 | 2224 } // namespace v8 |
OLD | NEW |