OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/compiler/ast-graph-builder.h" | 5 #include "src/compiler/ast-graph-builder.h" |
6 | 6 |
7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
8 #include "src/compiler/ast-loop-assignment-analyzer.h" | 8 #include "src/compiler/ast-loop-assignment-analyzer.h" |
9 #include "src/compiler/control-builders.h" | 9 #include "src/compiler/control-builders.h" |
10 #include "src/compiler/js-type-feedback.h" | 10 #include "src/compiler/js-type-feedback.h" |
(...skipping 1645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1656 NewNode(javascript()->CallRuntime(Runtime::kObjectFreeze, 1), literal); | 1656 NewNode(javascript()->CallRuntime(Runtime::kObjectFreeze, 1), literal); |
1657 // Freezing the constructor should never deopt. | 1657 // Freezing the constructor should never deopt. |
1658 PrepareFrameState(literal, BailoutId::None()); | 1658 PrepareFrameState(literal, BailoutId::None()); |
1659 } | 1659 } |
1660 | 1660 |
1661 // Assign to class variable. | 1661 // Assign to class variable. |
1662 if (expr->scope() != NULL) { | 1662 if (expr->scope() != NULL) { |
1663 DCHECK_NOT_NULL(expr->class_variable_proxy()); | 1663 DCHECK_NOT_NULL(expr->class_variable_proxy()); |
1664 Variable* var = expr->class_variable_proxy()->var(); | 1664 Variable* var = expr->class_variable_proxy()->var(); |
1665 FrameStateBeforeAndAfter states(this, BailoutId::None()); | 1665 FrameStateBeforeAndAfter states(this, BailoutId::None()); |
1666 VectorSlotPair feedback = CreateVectorSlotPair( | 1666 VectorSlotPair feedback = |
1667 FLAG_vector_stores ? expr->GetNthSlot(store_slot_index++) | 1667 CreateVectorSlotPair(FLAG_vector_stores && var->IsUnallocated() |
1668 : FeedbackVectorICSlot::Invalid()); | 1668 ? expr->GetNthSlot(store_slot_index++) |
| 1669 : FeedbackVectorICSlot::Invalid()); |
1669 BuildVariableAssignment(var, literal, Token::INIT_CONST, feedback, | 1670 BuildVariableAssignment(var, literal, Token::INIT_CONST, feedback, |
1670 BailoutId::None(), states); | 1671 BailoutId::None(), states); |
1671 } | 1672 } |
1672 ast_context()->ProduceValue(literal); | 1673 ast_context()->ProduceValue(literal); |
1673 } | 1674 } |
1674 | 1675 |
1675 | 1676 |
1676 void AstGraphBuilder::VisitNativeFunctionLiteral(NativeFunctionLiteral* expr) { | 1677 void AstGraphBuilder::VisitNativeFunctionLiteral(NativeFunctionLiteral* expr) { |
1677 UNREACHABLE(); | 1678 UNREACHABLE(); |
1678 } | 1679 } |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1965 for (; array_index < expr->values()->length(); array_index++) { | 1966 for (; array_index < expr->values()->length(); array_index++) { |
1966 Expression* subexpr = expr->values()->at(array_index); | 1967 Expression* subexpr = expr->values()->at(array_index); |
1967 if (subexpr->IsSpread()) break; | 1968 if (subexpr->IsSpread()) break; |
1968 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; | 1969 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; |
1969 | 1970 |
1970 VisitForValue(subexpr); | 1971 VisitForValue(subexpr); |
1971 { | 1972 { |
1972 FrameStateBeforeAndAfter states(this, subexpr->id()); | 1973 FrameStateBeforeAndAfter states(this, subexpr->id()); |
1973 Node* value = environment()->Pop(); | 1974 Node* value = environment()->Pop(); |
1974 Node* index = jsgraph()->Constant(array_index); | 1975 Node* index = jsgraph()->Constant(array_index); |
| 1976 // TODO(turbofan): More efficient code could be generated here. Consider |
| 1977 // that the store will be generic because we don't have a feedback vector |
| 1978 // slot. |
1975 Node* store = BuildKeyedStore(literal, index, value, VectorSlotPair(), | 1979 Node* store = BuildKeyedStore(literal, index, value, VectorSlotPair(), |
1976 TypeFeedbackId::None()); | 1980 TypeFeedbackId::None()); |
1977 states.AddToNode(store, expr->GetIdForElement(array_index), | 1981 states.AddToNode(store, expr->GetIdForElement(array_index), |
1978 OutputFrameStateCombine::Ignore()); | 1982 OutputFrameStateCombine::Ignore()); |
1979 } | 1983 } |
1980 } | 1984 } |
1981 | 1985 |
1982 // In case the array literal contains spread expressions it has two parts. The | 1986 // In case the array literal contains spread expressions it has two parts. The |
1983 // first part is the "static" array which has a literal index is handled | 1987 // first part is the "static" array which has a literal index is handled |
1984 // above. The second part is the part after the first spread expression | 1988 // above. The second part is the part after the first spread expression |
(...skipping 2327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4312 // Phi does not exist yet, introduce one. | 4316 // Phi does not exist yet, introduce one. |
4313 value = NewPhi(inputs, value, control); | 4317 value = NewPhi(inputs, value, control); |
4314 value->ReplaceInput(inputs - 1, other); | 4318 value->ReplaceInput(inputs - 1, other); |
4315 } | 4319 } |
4316 return value; | 4320 return value; |
4317 } | 4321 } |
4318 | 4322 |
4319 } // namespace compiler | 4323 } // namespace compiler |
4320 } // namespace internal | 4324 } // namespace internal |
4321 } // namespace v8 | 4325 } // namespace v8 |
OLD | NEW |