| 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/ast/scopes.h" | 7 #include "src/ast/scopes.h" | 
| 8 #include "src/compiler.h" | 8 #include "src/compiler.h" | 
| 9 #include "src/compiler/ast-loop-assignment-analyzer.h" | 9 #include "src/compiler/ast-loop-assignment-analyzer.h" | 
| 10 #include "src/compiler/control-builders.h" | 10 #include "src/compiler/control-builders.h" | 
| (...skipping 1898 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1909     environment()->Push(name); | 1909     environment()->Push(name); | 
| 1910     VisitForValue(property->value()); | 1910     VisitForValue(property->value()); | 
| 1911     Node* value = environment()->Pop(); | 1911     Node* value = environment()->Pop(); | 
| 1912     Node* key = environment()->Pop(); | 1912     Node* key = environment()->Pop(); | 
| 1913     Node* receiver = environment()->Pop(); | 1913     Node* receiver = environment()->Pop(); | 
| 1914     BuildSetHomeObject(value, receiver, property); | 1914     BuildSetHomeObject(value, receiver, property); | 
| 1915     switch (property->kind()) { | 1915     switch (property->kind()) { | 
| 1916       case ObjectLiteral::Property::CONSTANT: | 1916       case ObjectLiteral::Property::CONSTANT: | 
| 1917       case ObjectLiteral::Property::COMPUTED: | 1917       case ObjectLiteral::Property::COMPUTED: | 
| 1918       case ObjectLiteral::Property::MATERIALIZED_LITERAL: { | 1918       case ObjectLiteral::Property::MATERIALIZED_LITERAL: { | 
|  | 1919         if (!property->emit_store()) continue; | 
| 1919         Node* attr = jsgraph()->Constant(NONE); | 1920         Node* attr = jsgraph()->Constant(NONE); | 
| 1920         Node* set_function_name = | 1921         Node* set_function_name = | 
| 1921             jsgraph()->Constant(property->NeedsSetFunctionName()); | 1922             jsgraph()->Constant(property->NeedsSetFunctionName()); | 
| 1922         const Operator* op = | 1923         const Operator* op = | 
| 1923             javascript()->CallRuntime(Runtime::kDefineDataPropertyInLiteral); | 1924             javascript()->CallRuntime(Runtime::kDefineDataPropertyInLiteral); | 
| 1924         Node* call = NewNode(op, receiver, key, value, attr, set_function_name); | 1925         Node* call = NewNode(op, receiver, key, value, attr, set_function_name); | 
| 1925         PrepareFrameState(call, expr->GetIdForPropertySet(property_index)); | 1926         PrepareFrameState(call, expr->GetIdForPropertySet(property_index)); | 
| 1926         break; | 1927         break; | 
| 1927       } | 1928       } | 
| 1928       case ObjectLiteral::Property::PROTOTYPE: | 1929       case ObjectLiteral::Property::PROTOTYPE: | 
| (...skipping 2101 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4030         environment()->stack_height(), info()->osr_expr_stack_height())); | 4031         environment()->stack_height(), info()->osr_expr_stack_height())); | 
| 4031     return true; | 4032     return true; | 
| 4032   } | 4033   } | 
| 4033   return false; | 4034   return false; | 
| 4034 } | 4035 } | 
| 4035 | 4036 | 
| 4036 | 4037 | 
| 4037 void AstGraphBuilder::PrepareFrameState(Node* node, BailoutId ast_id, | 4038 void AstGraphBuilder::PrepareFrameState(Node* node, BailoutId ast_id, | 
| 4038                                         OutputFrameStateCombine combine) { | 4039                                         OutputFrameStateCombine combine) { | 
| 4039   if (OperatorProperties::GetFrameStateInputCount(node->op()) > 0) { | 4040   if (OperatorProperties::GetFrameStateInputCount(node->op()) > 0) { | 
|  | 4041     DCHECK(ast_id.IsNone() || info()->shared_info()->VerifyBailoutId(ast_id)); | 
| 4040     DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op())); | 4042     DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op())); | 
| 4041 |  | 
| 4042     DCHECK_EQ(IrOpcode::kDead, | 4043     DCHECK_EQ(IrOpcode::kDead, | 
| 4043               NodeProperties::GetFrameStateInput(node, 0)->opcode()); | 4044               NodeProperties::GetFrameStateInput(node, 0)->opcode()); | 
| 4044     bool node_has_exception = NodeProperties::IsExceptionalCall(node); | 4045     bool has_exception = NodeProperties::IsExceptionalCall(node); | 
| 4045     NodeProperties::ReplaceFrameStateInput( | 4046     Node* state = environment()->Checkpoint(ast_id, combine, has_exception); | 
| 4046         node, 0, | 4047     NodeProperties::ReplaceFrameStateInput(node, 0, state); | 
| 4047         environment()->Checkpoint(ast_id, combine, node_has_exception)); |  | 
| 4048   } | 4048   } | 
| 4049 } | 4049 } | 
| 4050 | 4050 | 
| 4051 void AstGraphBuilder::PrepareEagerCheckpoint(BailoutId ast_id) { | 4051 void AstGraphBuilder::PrepareEagerCheckpoint(BailoutId ast_id) { | 
| 4052   if (environment()->GetEffectDependency()->opcode() == IrOpcode::kCheckpoint) { | 4052   if (environment()->GetEffectDependency()->opcode() == IrOpcode::kCheckpoint) { | 
| 4053     // We skip preparing a checkpoint if there already is one the current effect | 4053     // We skip preparing a checkpoint if there already is one the current effect | 
| 4054     // dependency. This is just an optimization and not need for correctness. | 4054     // dependency. This is just an optimization and not need for correctness. | 
| 4055     return; | 4055     return; | 
| 4056   } | 4056   } | 
| 4057   if (ast_id != BailoutId::None()) { | 4057   if (ast_id != BailoutId::None()) { | 
| 4058     DCHECK(info()->shared_info()->VerifyBailoutId(ast_id)); | 4058     DCHECK(info()->shared_info()->VerifyBailoutId(ast_id)); | 
| 4059     Node* node = NewNode(common()->Checkpoint()); | 4059     Node* node = NewNode(common()->Checkpoint()); | 
| 4060     DCHECK_EQ(IrOpcode::kDead, | 4060     DCHECK_EQ(IrOpcode::kDead, | 
| 4061               NodeProperties::GetFrameStateInput(node, 0)->opcode()); | 4061               NodeProperties::GetFrameStateInput(node, 0)->opcode()); | 
| 4062     NodeProperties::ReplaceFrameStateInput(node, 0, | 4062     Node* state = environment()->Checkpoint(ast_id); | 
| 4063                                            environment()->Checkpoint(ast_id)); | 4063     NodeProperties::ReplaceFrameStateInput(node, 0, state); | 
| 4064   } | 4064   } | 
| 4065 } | 4065 } | 
| 4066 | 4066 | 
| 4067 BitVector* AstGraphBuilder::GetVariablesAssignedInLoop( | 4067 BitVector* AstGraphBuilder::GetVariablesAssignedInLoop( | 
| 4068     IterationStatement* stmt) { | 4068     IterationStatement* stmt) { | 
| 4069   if (loop_assignment_analysis_ == nullptr) return nullptr; | 4069   if (loop_assignment_analysis_ == nullptr) return nullptr; | 
| 4070   return loop_assignment_analysis_->GetVariablesAssignedInLoop(stmt); | 4070   return loop_assignment_analysis_->GetVariablesAssignedInLoop(stmt); | 
| 4071 } | 4071 } | 
| 4072 | 4072 | 
| 4073 | 4073 | 
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4367     // Phi does not exist yet, introduce one. | 4367     // Phi does not exist yet, introduce one. | 
| 4368     value = NewPhi(inputs, value, control); | 4368     value = NewPhi(inputs, value, control); | 
| 4369     value->ReplaceInput(inputs - 1, other); | 4369     value->ReplaceInput(inputs - 1, other); | 
| 4370   } | 4370   } | 
| 4371   return value; | 4371   return value; | 
| 4372 } | 4372 } | 
| 4373 | 4373 | 
| 4374 }  // namespace compiler | 4374 }  // namespace compiler | 
| 4375 }  // namespace internal | 4375 }  // namespace internal | 
| 4376 }  // namespace v8 | 4376 }  // namespace v8 | 
| OLD | NEW | 
|---|