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/control-builders.h" | 8 #include "src/compiler/control-builders.h" |
9 #include "src/compiler/machine-operator.h" | 9 #include "src/compiler/machine-operator.h" |
10 #include "src/compiler/node-properties.h" | 10 #include "src/compiler/node-properties.h" |
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
949 it != accessor_table.end(); ++it) { | 949 it != accessor_table.end(); ++it) { |
950 VisitForValue(it->first); | 950 VisitForValue(it->first); |
951 VisitForValueOrNull(it->second->getter); | 951 VisitForValueOrNull(it->second->getter); |
952 VisitForValueOrNull(it->second->setter); | 952 VisitForValueOrNull(it->second->setter); |
953 Node* setter = environment()->Pop(); | 953 Node* setter = environment()->Pop(); |
954 Node* getter = environment()->Pop(); | 954 Node* getter = environment()->Pop(); |
955 Node* name = environment()->Pop(); | 955 Node* name = environment()->Pop(); |
956 Node* attr = jsgraph()->Constant(NONE); | 956 Node* attr = jsgraph()->Constant(NONE); |
957 const Operator* op = | 957 const Operator* op = |
958 javascript()->Runtime(Runtime::kDefineAccessorPropertyUnchecked, 5); | 958 javascript()->Runtime(Runtime::kDefineAccessorPropertyUnchecked, 5); |
959 NewNode(op, literal, name, getter, setter, attr); | 959 Node* call = NewNode(op, literal, name, getter, setter, attr); |
| 960 PrepareFrameState(call, it->first->id()); |
960 } | 961 } |
961 | 962 |
962 // Transform literals that contain functions to fast properties. | 963 // Transform literals that contain functions to fast properties. |
963 if (expr->has_function()) { | 964 if (expr->has_function()) { |
964 const Operator* op = javascript()->Runtime(Runtime::kToFastProperties, 1); | 965 const Operator* op = javascript()->Runtime(Runtime::kToFastProperties, 1); |
965 NewNode(op, literal); | 966 NewNode(op, literal); |
966 } | 967 } |
967 | 968 |
968 ast_context()->ProduceValue(environment()->Pop()); | 969 ast_context()->ProduceValue(environment()->Pop()); |
969 } | 970 } |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1414 Node* value = | 1415 Node* value = |
1415 BuildBinaryOp(old_value, jsgraph()->OneConstant(), expr->binary_op()); | 1416 BuildBinaryOp(old_value, jsgraph()->OneConstant(), expr->binary_op()); |
1416 // TODO(jarin) Insert proper bailout id here (will need to change | 1417 // TODO(jarin) Insert proper bailout id here (will need to change |
1417 // full code generator). | 1418 // full code generator). |
1418 PrepareFrameState(value, BailoutId::None()); | 1419 PrepareFrameState(value, BailoutId::None()); |
1419 | 1420 |
1420 // Store the value. | 1421 // Store the value. |
1421 switch (assign_type) { | 1422 switch (assign_type) { |
1422 case VARIABLE: { | 1423 case VARIABLE: { |
1423 Variable* variable = expr->expression()->AsVariableProxy()->var(); | 1424 Variable* variable = expr->expression()->AsVariableProxy()->var(); |
| 1425 environment()->Push(value); |
1424 BuildVariableAssignment(variable, value, expr->op(), | 1426 BuildVariableAssignment(variable, value, expr->op(), |
1425 expr->AssignmentId()); | 1427 expr->AssignmentId()); |
| 1428 environment()->Pop(); |
1426 break; | 1429 break; |
1427 } | 1430 } |
1428 case NAMED_PROPERTY: { | 1431 case NAMED_PROPERTY: { |
1429 Node* object = environment()->Pop(); | 1432 Node* object = environment()->Pop(); |
1430 Unique<Name> name = | 1433 Unique<Name> name = |
1431 MakeUnique(property->key()->AsLiteral()->AsPropertyName()); | 1434 MakeUnique(property->key()->AsLiteral()->AsPropertyName()); |
1432 Node* store = | 1435 Node* store = |
1433 NewNode(javascript()->StoreNamed(strict_mode(), name), object, value); | 1436 NewNode(javascript()->StoreNamed(strict_mode(), name), object, value); |
| 1437 environment()->Push(value); |
1434 PrepareFrameState(store, expr->AssignmentId()); | 1438 PrepareFrameState(store, expr->AssignmentId()); |
| 1439 environment()->Pop(); |
1435 break; | 1440 break; |
1436 } | 1441 } |
1437 case KEYED_PROPERTY: { | 1442 case KEYED_PROPERTY: { |
1438 Node* key = environment()->Pop(); | 1443 Node* key = environment()->Pop(); |
1439 Node* object = environment()->Pop(); | 1444 Node* object = environment()->Pop(); |
1440 Node* store = NewNode(javascript()->StoreProperty(strict_mode()), object, | 1445 Node* store = NewNode(javascript()->StoreProperty(strict_mode()), object, |
1441 key, value); | 1446 key, value); |
| 1447 environment()->Push(value); |
1442 PrepareFrameState(store, expr->AssignmentId()); | 1448 PrepareFrameState(store, expr->AssignmentId()); |
| 1449 environment()->Pop(); |
1443 break; | 1450 break; |
1444 } | 1451 } |
1445 } | 1452 } |
1446 | 1453 |
1447 // Restore old value for postfix expressions. | 1454 // Restore old value for postfix expressions. |
1448 if (is_postfix) value = environment()->Pop(); | 1455 if (is_postfix) value = environment()->Pop(); |
1449 | 1456 |
1450 ast_context()->ProduceValue(value); | 1457 ast_context()->ProduceValue(value); |
1451 } | 1458 } |
1452 | 1459 |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2013 DCHECK(node->InputAt(frame_state_index)->op()->opcode() == IrOpcode::kDead); | 2020 DCHECK(node->InputAt(frame_state_index)->op()->opcode() == IrOpcode::kDead); |
2014 | 2021 |
2015 Node* frame_state_node = environment()->Checkpoint(ast_id, combine); | 2022 Node* frame_state_node = environment()->Checkpoint(ast_id, combine); |
2016 node->ReplaceInput(frame_state_index, frame_state_node); | 2023 node->ReplaceInput(frame_state_index, frame_state_node); |
2017 } | 2024 } |
2018 } | 2025 } |
2019 | 2026 |
2020 } | 2027 } |
2021 } | 2028 } |
2022 } // namespace v8::internal::compiler | 2029 } // namespace v8::internal::compiler |
OLD | NEW |