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/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 1920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1931 .LoadLiteral( | 1931 .LoadLiteral( |
1932 Smi::FromInt(execution_context()->scope()->start_position())) | 1932 Smi::FromInt(execution_context()->scope()->start_position())) |
1933 .StoreAccumulatorInRegister(position); | 1933 .StoreAccumulatorInRegister(position); |
1934 | 1934 |
1935 // Call ResolvePossiblyDirectEval and modify the callee. | 1935 // Call ResolvePossiblyDirectEval and modify the callee. |
1936 builder() | 1936 builder() |
1937 ->CallRuntime(Runtime::kResolvePossiblyDirectEval, callee_for_eval, 5) | 1937 ->CallRuntime(Runtime::kResolvePossiblyDirectEval, callee_for_eval, 5) |
1938 .StoreAccumulatorInRegister(callee); | 1938 .StoreAccumulatorInRegister(callee); |
1939 } | 1939 } |
1940 | 1940 |
| 1941 builder()->SetExpressionPosition(expr); |
1941 // TODO(rmcilroy): Use CallIC to allow call type feedback. | 1942 // TODO(rmcilroy): Use CallIC to allow call type feedback. |
1942 builder()->Call(callee, receiver, args->length(), | 1943 builder()->Call(callee, receiver, args->length(), |
1943 feedback_index(expr->CallFeedbackICSlot())); | 1944 feedback_index(expr->CallFeedbackICSlot())); |
1944 execution_result()->SetResultInAccumulator(); | 1945 execution_result()->SetResultInAccumulator(); |
1945 } | 1946 } |
1946 | 1947 |
1947 | 1948 |
1948 void BytecodeGenerator::VisitCallNew(CallNew* expr) { | 1949 void BytecodeGenerator::VisitCallNew(CallNew* expr) { |
1949 Register constructor = register_allocator()->NewRegister(); | 1950 Register constructor = register_allocator()->NewRegister(); |
1950 VisitForAccumulatorValue(expr->expression()); | 1951 VisitForAccumulatorValue(expr->expression()); |
1951 builder()->StoreAccumulatorInRegister(constructor); | 1952 builder()->StoreAccumulatorInRegister(constructor); |
1952 | 1953 |
1953 ZoneList<Expression*>* args = expr->arguments(); | 1954 ZoneList<Expression*>* args = expr->arguments(); |
1954 Register first_arg = VisitArguments(args); | 1955 Register first_arg = VisitArguments(args); |
| 1956 builder()->SetExpressionPosition(expr); |
1955 builder()->New(constructor, first_arg, args->length()); | 1957 builder()->New(constructor, first_arg, args->length()); |
1956 execution_result()->SetResultInAccumulator(); | 1958 execution_result()->SetResultInAccumulator(); |
1957 } | 1959 } |
1958 | 1960 |
1959 | 1961 |
1960 void BytecodeGenerator::VisitCallRuntime(CallRuntime* expr) { | 1962 void BytecodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
1961 ZoneList<Expression*>* args = expr->arguments(); | 1963 ZoneList<Expression*>* args = expr->arguments(); |
1962 Register receiver; | 1964 Register receiver; |
1963 if (expr->is_jsruntime()) { | 1965 if (expr->is_jsruntime()) { |
1964 // Allocate a register for the receiver and load it with undefined. | 1966 // Allocate a register for the receiver and load it with undefined. |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2506 } | 2508 } |
2507 | 2509 |
2508 | 2510 |
2509 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 2511 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
2510 return info()->feedback_vector()->GetIndex(slot); | 2512 return info()->feedback_vector()->GetIndex(slot); |
2511 } | 2513 } |
2512 | 2514 |
2513 } // namespace interpreter | 2515 } // namespace interpreter |
2514 } // namespace internal | 2516 } // namespace internal |
2515 } // namespace v8 | 2517 } // namespace v8 |
OLD | NEW |