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/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/interpreter/bytecode-register-allocator.h" | 10 #include "src/interpreter/bytecode-register-allocator.h" |
(...skipping 2504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2515 .LoadLiteral(Smi::FromInt(expr->position())) | 2515 .LoadLiteral(Smi::FromInt(expr->position())) |
2516 .StoreAccumulatorInRegister(eval_position); | 2516 .StoreAccumulatorInRegister(eval_position); |
2517 | 2517 |
2518 // Call ResolvePossiblyDirectEval and modify the callee. | 2518 // Call ResolvePossiblyDirectEval and modify the callee. |
2519 builder() | 2519 builder() |
2520 ->CallRuntime(Runtime::kResolvePossiblyDirectEval, callee_for_eval, 6) | 2520 ->CallRuntime(Runtime::kResolvePossiblyDirectEval, callee_for_eval, 6) |
2521 .StoreAccumulatorInRegister(callee); | 2521 .StoreAccumulatorInRegister(callee); |
2522 } | 2522 } |
2523 | 2523 |
2524 builder()->SetExpressionPosition(expr); | 2524 builder()->SetExpressionPosition(expr); |
2525 builder()->Call(callee, receiver, 1 + args->length(), | 2525 |
2526 feedback_index(expr->CallFeedbackICSlot()), | 2526 int feedback_slot_index; |
| 2527 if (expr->CallFeedbackICSlot().IsInvalid()) { |
| 2528 DCHECK(call_type == Call::POSSIBLY_EVAL_CALL); |
| 2529 // Valid type feedback slots can only be greater than kReservedIndexCount. |
| 2530 // We use 0 to indicate an invalid slot it. Statically assert that 0 cannot |
| 2531 // be a valid slot id. |
| 2532 STATIC_ASSERT(TypeFeedbackVector::kReservedIndexCount > 0); |
| 2533 feedback_slot_index = 0; |
| 2534 } else { |
| 2535 feedback_slot_index = feedback_index(expr->CallFeedbackICSlot()); |
| 2536 } |
| 2537 builder()->Call(callee, receiver, 1 + args->length(), feedback_slot_index, |
2527 expr->tail_call_mode()); | 2538 expr->tail_call_mode()); |
2528 execution_result()->SetResultInAccumulator(); | 2539 execution_result()->SetResultInAccumulator(); |
2529 } | 2540 } |
2530 | 2541 |
2531 void BytecodeGenerator::VisitCallSuper(Call* expr) { | 2542 void BytecodeGenerator::VisitCallSuper(Call* expr) { |
2532 RegisterAllocationScope register_scope(this); | 2543 RegisterAllocationScope register_scope(this); |
2533 SuperCallReference* super = expr->expression()->AsSuperCallReference(); | 2544 SuperCallReference* super = expr->expression()->AsSuperCallReference(); |
2534 | 2545 |
2535 // Prepare the constructor to the super call. | 2546 // Prepare the constructor to the super call. |
2536 Register this_function = register_allocator()->NewRegister(); | 2547 Register this_function = register_allocator()->NewRegister(); |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3167 return execution_context()->scope()->language_mode(); | 3178 return execution_context()->scope()->language_mode(); |
3168 } | 3179 } |
3169 | 3180 |
3170 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 3181 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
3171 return TypeFeedbackVector::GetIndex(slot); | 3182 return TypeFeedbackVector::GetIndex(slot); |
3172 } | 3183 } |
3173 | 3184 |
3174 } // namespace interpreter | 3185 } // namespace interpreter |
3175 } // namespace internal | 3186 } // namespace internal |
3176 } // namespace v8 | 3187 } // namespace v8 |
OLD | NEW |