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/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/compilation-info.h" | 9 #include "src/compilation-info.h" |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1352 Node* value = jsgraph()->Constant(expr->value()); | 1352 Node* value = jsgraph()->Constant(expr->value()); |
1353 ast_context()->ProduceValue(expr, value); | 1353 ast_context()->ProduceValue(expr, value); |
1354 } | 1354 } |
1355 | 1355 |
1356 | 1356 |
1357 void AstGraphBuilder::VisitRegExpLiteral(RegExpLiteral* expr) { | 1357 void AstGraphBuilder::VisitRegExpLiteral(RegExpLiteral* expr) { |
1358 Node* closure = GetFunctionClosure(); | 1358 Node* closure = GetFunctionClosure(); |
1359 | 1359 |
1360 // Create node to materialize a regular expression literal. | 1360 // Create node to materialize a regular expression literal. |
1361 const Operator* op = javascript()->CreateLiteralRegExp( | 1361 const Operator* op = javascript()->CreateLiteralRegExp( |
1362 expr->pattern(), expr->flags(), expr->literal_index()); | 1362 expr->pattern(), expr->flags(), |
| 1363 TypeFeedbackVector::GetIndex(expr->literal_slot())); |
1363 Node* literal = NewNode(op, closure); | 1364 Node* literal = NewNode(op, closure); |
1364 PrepareFrameState(literal, expr->id(), ast_context()->GetStateCombine()); | 1365 PrepareFrameState(literal, expr->id(), ast_context()->GetStateCombine()); |
1365 ast_context()->ProduceValue(expr, literal); | 1366 ast_context()->ProduceValue(expr, literal); |
1366 } | 1367 } |
1367 | 1368 |
1368 | 1369 |
1369 void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { | 1370 void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { |
1370 Node* closure = GetFunctionClosure(); | 1371 Node* closure = GetFunctionClosure(); |
1371 | 1372 |
1372 // Create node to deep-copy the literal boilerplate. | 1373 // Create node to deep-copy the literal boilerplate. |
1373 const Operator* op = javascript()->CreateLiteralObject( | 1374 const Operator* op = javascript()->CreateLiteralObject( |
1374 expr->GetOrBuildConstantProperties(isolate()), expr->ComputeFlags(true), | 1375 expr->GetOrBuildConstantProperties(isolate()), expr->ComputeFlags(true), |
1375 expr->literal_index(), expr->properties_count()); | 1376 TypeFeedbackVector::GetIndex(expr->literal_slot()), |
| 1377 expr->properties_count()); |
1376 Node* literal = NewNode(op, closure); | 1378 Node* literal = NewNode(op, closure); |
1377 PrepareFrameState(literal, expr->CreateLiteralId(), | 1379 PrepareFrameState(literal, expr->CreateLiteralId(), |
1378 OutputFrameStateCombine::Push()); | 1380 OutputFrameStateCombine::Push()); |
1379 | 1381 |
1380 // The object is expected on the operand stack during computation of the | 1382 // The object is expected on the operand stack during computation of the |
1381 // property values and is the value of the entire expression. | 1383 // property values and is the value of the entire expression. |
1382 environment()->Push(literal); | 1384 environment()->Push(literal); |
1383 | 1385 |
1384 // Create nodes to store computed values into the literal. | 1386 // Create nodes to store computed values into the literal. |
1385 AccessorTable accessor_table(local_zone()); | 1387 AccessorTable accessor_table(local_zone()); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1494 } | 1496 } |
1495 } | 1497 } |
1496 | 1498 |
1497 | 1499 |
1498 void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { | 1500 void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { |
1499 Node* closure = GetFunctionClosure(); | 1501 Node* closure = GetFunctionClosure(); |
1500 | 1502 |
1501 // Create node to deep-copy the literal boilerplate. | 1503 // Create node to deep-copy the literal boilerplate. |
1502 const Operator* op = javascript()->CreateLiteralArray( | 1504 const Operator* op = javascript()->CreateLiteralArray( |
1503 expr->GetOrBuildConstantElements(isolate()), expr->ComputeFlags(true), | 1505 expr->GetOrBuildConstantElements(isolate()), expr->ComputeFlags(true), |
1504 expr->literal_index(), expr->values()->length()); | 1506 TypeFeedbackVector::GetIndex(expr->literal_slot()), |
| 1507 expr->values()->length()); |
1505 Node* literal = NewNode(op, closure); | 1508 Node* literal = NewNode(op, closure); |
1506 PrepareFrameState(literal, expr->CreateLiteralId(), | 1509 PrepareFrameState(literal, expr->CreateLiteralId(), |
1507 OutputFrameStateCombine::Push()); | 1510 OutputFrameStateCombine::Push()); |
1508 | 1511 |
1509 // The array is expected on the operand stack during computation of the | 1512 // The array is expected on the operand stack during computation of the |
1510 // element values. | 1513 // element values. |
1511 environment()->Push(literal); | 1514 environment()->Push(literal); |
1512 | 1515 |
1513 // Create nodes to evaluate all the non-constant subexpressions and to store | 1516 // Create nodes to evaluate all the non-constant subexpressions and to store |
1514 // them into the newly cloned array. | 1517 // them into the newly cloned array. |
(...skipping 1792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3307 float invocation_frequency, LoopAssignmentAnalysis* loop_assignment, | 3310 float invocation_frequency, LoopAssignmentAnalysis* loop_assignment, |
3308 SourcePositionTable* source_positions, int inlining_id) | 3311 SourcePositionTable* source_positions, int inlining_id) |
3309 : AstGraphBuilder(local_zone, info, jsgraph, invocation_frequency, | 3312 : AstGraphBuilder(local_zone, info, jsgraph, invocation_frequency, |
3310 loop_assignment), | 3313 loop_assignment), |
3311 source_positions_(source_positions), | 3314 source_positions_(source_positions), |
3312 start_position_(info->shared_info()->start_position(), inlining_id) {} | 3315 start_position_(info->shared_info()->start_position(), inlining_id) {} |
3313 | 3316 |
3314 } // namespace compiler | 3317 } // namespace compiler |
3315 } // namespace internal | 3318 } // namespace internal |
3316 } // namespace v8 | 3319 } // namespace v8 |
OLD | NEW |