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/compile-time-value.h" | 7 #include "src/ast/compile-time-value.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compilation-info.h" | 10 #include "src/compilation-info.h" |
(...skipping 2483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2494 RegisterList args = | 2494 RegisterList args = |
2495 register_allocator()->NewRegisterList(expr->arguments()->length()); | 2495 register_allocator()->NewRegisterList(expr->arguments()->length()); |
2496 VisitArguments(expr->arguments(), args); | 2496 VisitArguments(expr->arguments(), args); |
2497 | 2497 |
2498 // The new target is loaded into the accumulator from the | 2498 // The new target is loaded into the accumulator from the |
2499 // {new.target} variable. | 2499 // {new.target} variable. |
2500 VisitForAccumulatorValue(super->new_target_var()); | 2500 VisitForAccumulatorValue(super->new_target_var()); |
2501 | 2501 |
2502 // Call construct. | 2502 // Call construct. |
2503 builder()->SetExpressionPosition(expr); | 2503 builder()->SetExpressionPosition(expr); |
2504 // Valid type feedback slots can only be greater than kReservedIndexCount. | 2504 // TODO(turbofan): For now we do gather feedback on super constructor |
2505 // Assert that 0 cannot be valid a valid slot id. | 2505 // calls, utilizing the existing machinery to inline the actual call |
2506 STATIC_ASSERT(TypeFeedbackVector::kReservedIndexCount > 0); | 2506 // target and the JSCreate for the implicit receiver allocation. This |
2507 // Type feedback is not necessary for super constructor calls. The type | 2507 // is not an ideal solution for super constructor calls, but it gets |
2508 // information can be inferred in most cases. Slot id 0 indicates type | 2508 // the job done for now. In the long run we might want to revisit this |
2509 // feedback is not required. | 2509 // and come up with a better way. |
2510 builder()->New(constructor, args, 0); | 2510 int const feedback_slot_index = feedback_index(expr->CallFeedbackICSlot()); |
| 2511 builder()->New(constructor, args, feedback_slot_index); |
2511 } | 2512 } |
2512 | 2513 |
2513 void BytecodeGenerator::VisitCallNew(CallNew* expr) { | 2514 void BytecodeGenerator::VisitCallNew(CallNew* expr) { |
2514 Register constructor = VisitForRegisterValue(expr->expression()); | 2515 Register constructor = VisitForRegisterValue(expr->expression()); |
2515 RegisterList args = | 2516 RegisterList args = |
2516 register_allocator()->NewRegisterList(expr->arguments()->length()); | 2517 register_allocator()->NewRegisterList(expr->arguments()->length()); |
2517 VisitArguments(expr->arguments(), args); | 2518 VisitArguments(expr->arguments(), args); |
2518 | 2519 |
2519 builder()->SetExpressionPosition(expr); | 2520 builder()->SetExpressionPosition(expr); |
2520 // The accumulator holds new target which is the same as the | 2521 // The accumulator holds new target which is the same as the |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3186 } | 3187 } |
3187 | 3188 |
3188 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { | 3189 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { |
3189 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict | 3190 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict |
3190 : Runtime::kStoreKeyedToSuper_Sloppy; | 3191 : Runtime::kStoreKeyedToSuper_Sloppy; |
3191 } | 3192 } |
3192 | 3193 |
3193 } // namespace interpreter | 3194 } // namespace interpreter |
3194 } // namespace internal | 3195 } // namespace internal |
3195 } // namespace v8 | 3196 } // namespace v8 |
OLD | NEW |