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 int feedback_slot_index = feedback_index(expr->CallFeedbackICSlot()); |
2526 feedback_index(expr->CallFeedbackICSlot()), | 2526 if (expr->CallFeedbackICSlot().IsInvalid()) { |
2527 DCHECK(call_type == Call::POSSIBLY_EVAL_CALL); | |
2528 // Valid type feedback slots can only be greater than kReservedIndexCount. | |
2529 // We use 0 to indicate an invalid slot it. Statically assert that 0 cannot | |
2530 // be a valid slot id. | |
2531 STATIC_ASSERT(TypeFeedbackVector::kReservedIndexCount > 0); | |
2532 feedback_slot_index = 0; | |
mythria
2016/07/12 09:01:34
@mvstanton, this is where we pass 0 for invalid sl
rmcilroy
2016/07/12 09:36:20
I think feedback_slot_index will already be zero f
mvstanton
2016/07/12 13:25:22
Sounds good.
mythria
2016/07/12 15:20:35
As discussed offline, it will be 0 but it is depen
| |
2533 } | |
2534 builder()->Call(callee, receiver, 1 + args->length(), feedback_slot_index, | |
2527 expr->tail_call_mode()); | 2535 expr->tail_call_mode()); |
2528 execution_result()->SetResultInAccumulator(); | 2536 execution_result()->SetResultInAccumulator(); |
2529 } | 2537 } |
2530 | 2538 |
2531 void BytecodeGenerator::VisitCallSuper(Call* expr) { | 2539 void BytecodeGenerator::VisitCallSuper(Call* expr) { |
2532 RegisterAllocationScope register_scope(this); | 2540 RegisterAllocationScope register_scope(this); |
2533 SuperCallReference* super = expr->expression()->AsSuperCallReference(); | 2541 SuperCallReference* super = expr->expression()->AsSuperCallReference(); |
2534 | 2542 |
2535 // Prepare the constructor to the super call. | 2543 // Prepare the constructor to the super call. |
2536 Register this_function = register_allocator()->NewRegister(); | 2544 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(); | 3175 return execution_context()->scope()->language_mode(); |
3168 } | 3176 } |
3169 | 3177 |
3170 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 3178 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
3171 return TypeFeedbackVector::GetIndex(slot); | 3179 return TypeFeedbackVector::GetIndex(slot); |
3172 } | 3180 } |
3173 | 3181 |
3174 } // namespace interpreter | 3182 } // namespace interpreter |
3175 } // namespace internal | 3183 } // namespace internal |
3176 } // namespace v8 | 3184 } // namespace v8 |
OLD | NEW |