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