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/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
925 NewNode(op, receiver, key, value); | 925 NewNode(op, receiver, key, value); |
926 break; | 926 break; |
927 } | 927 } |
928 } | 928 } |
929 | 929 |
930 // TODO(mstarzinger): This is temporary to make "super" work and replicates | 930 // TODO(mstarzinger): This is temporary to make "super" work and replicates |
931 // the existing FullCodeGenerator::NeedsHomeObject predicate. | 931 // the existing FullCodeGenerator::NeedsHomeObject predicate. |
932 if (FunctionLiteral::NeedsHomeObject(property->value())) { | 932 if (FunctionLiteral::NeedsHomeObject(property->value())) { |
933 Unique<Name> name = | 933 Unique<Name> name = |
934 MakeUnique(isolate()->factory()->home_object_symbol()); | 934 MakeUnique(isolate()->factory()->home_object_symbol()); |
935 NewNode(javascript()->StoreNamed(strict_mode(), name), value, receiver); | 935 Node* store = NewNode(javascript()->StoreNamed(strict_mode(), name), |
| 936 value, receiver); |
| 937 PrepareFrameState(store, BailoutId::None()); |
936 } | 938 } |
937 } | 939 } |
938 | 940 |
939 // Transform both the class literal and the prototype to fast properties. | 941 // Transform both the class literal and the prototype to fast properties. |
940 const Operator* op = javascript()->CallRuntime(Runtime::kToFastProperties, 1); | 942 const Operator* op = javascript()->CallRuntime(Runtime::kToFastProperties, 1); |
941 NewNode(op, environment()->Pop()); // prototype | 943 NewNode(op, environment()->Pop()); // prototype |
942 NewNode(op, environment()->Pop()); // literal | 944 NewNode(op, environment()->Pop()); // literal |
943 | 945 |
944 // Assign to class variable. | 946 // Assign to class variable. |
945 if (expr->scope() != NULL) { | 947 if (expr->scope() != NULL) { |
946 DCHECK_NOT_NULL(expr->class_variable_proxy()); | 948 DCHECK_NOT_NULL(expr->class_variable_proxy()); |
947 Variable* var = expr->class_variable_proxy()->var(); | 949 Variable* var = expr->class_variable_proxy()->var(); |
948 BuildVariableAssignment(var, literal, Token::INIT_CONST, BailoutId::None()); | 950 BuildVariableAssignment(var, literal, Token::INIT_CONST, BailoutId::None()); |
949 } | 951 } |
950 | 952 |
| 953 PrepareFrameState(literal, expr->id(), ast_context()->GetStateCombine()); |
951 ast_context()->ProduceValue(literal); | 954 ast_context()->ProduceValue(literal); |
952 } | 955 } |
953 | 956 |
954 | 957 |
955 void AstGraphBuilder::VisitNativeFunctionLiteral(NativeFunctionLiteral* expr) { | 958 void AstGraphBuilder::VisitNativeFunctionLiteral(NativeFunctionLiteral* expr) { |
956 UNREACHABLE(); | 959 UNREACHABLE(); |
957 } | 960 } |
958 | 961 |
959 | 962 |
960 void AstGraphBuilder::VisitConditional(Conditional* expr) { | 963 void AstGraphBuilder::VisitConditional(Conditional* expr) { |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1454 } | 1457 } |
1455 PrepareFrameState(callee_value, property->LoadId(), | 1458 PrepareFrameState(callee_value, property->LoadId(), |
1456 OutputFrameStateCombine::Push()); | 1459 OutputFrameStateCombine::Push()); |
1457 receiver_value = environment()->Pop(); | 1460 receiver_value = environment()->Pop(); |
1458 // Note that a PROPERTY_CALL requires the receiver to be wrapped into an | 1461 // Note that a PROPERTY_CALL requires the receiver to be wrapped into an |
1459 // object for sloppy callees. This could also be modeled explicitly here, | 1462 // object for sloppy callees. This could also be modeled explicitly here, |
1460 // thereby obsoleting the need for a flag to the call operator. | 1463 // thereby obsoleting the need for a flag to the call operator. |
1461 flags = CALL_AS_METHOD; | 1464 flags = CALL_AS_METHOD; |
1462 break; | 1465 break; |
1463 } | 1466 } |
1464 case Call::SUPER_CALL: { | 1467 case Call::SUPER_CALL: |
1465 // TODO(dslomov): Implement super calls. | 1468 // TODO(dslomov): Implement super calls. |
1466 UNIMPLEMENTED(); | 1469 callee_value = jsgraph()->UndefinedConstant(); |
| 1470 receiver_value = jsgraph()->UndefinedConstant(); |
| 1471 SetStackOverflow(); |
1467 break; | 1472 break; |
1468 } | |
1469 case Call::POSSIBLY_EVAL_CALL: | 1473 case Call::POSSIBLY_EVAL_CALL: |
1470 possibly_eval = true; | 1474 possibly_eval = true; |
1471 // Fall through. | 1475 // Fall through. |
1472 case Call::OTHER_CALL: | 1476 case Call::OTHER_CALL: |
1473 VisitForValue(callee); | 1477 VisitForValue(callee); |
1474 callee_value = environment()->Pop(); | 1478 callee_value = environment()->Pop(); |
1475 receiver_value = jsgraph()->UndefinedConstant(); | 1479 receiver_value = jsgraph()->UndefinedConstant(); |
1476 break; | 1480 break; |
1477 } | 1481 } |
1478 | 1482 |
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2427 | 2431 |
2428 BitVector* AstGraphBuilder::GetVariablesAssignedInLoop( | 2432 BitVector* AstGraphBuilder::GetVariablesAssignedInLoop( |
2429 IterationStatement* stmt) { | 2433 IterationStatement* stmt) { |
2430 if (loop_assignment_analysis_ == NULL) return NULL; | 2434 if (loop_assignment_analysis_ == NULL) return NULL; |
2431 return loop_assignment_analysis_->GetVariablesAssignedInLoop(stmt); | 2435 return loop_assignment_analysis_->GetVariablesAssignedInLoop(stmt); |
2432 } | 2436 } |
2433 | 2437 |
2434 } // namespace compiler | 2438 } // namespace compiler |
2435 } // namespace internal | 2439 } // namespace internal |
2436 } // namespace v8 | 2440 } // namespace v8 |
OLD | NEW |