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/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1689 void AstGraphBuilder::VisitLiteral(Literal* expr) { | 1689 void AstGraphBuilder::VisitLiteral(Literal* expr) { |
1690 Node* value = jsgraph()->Constant(expr->value()); | 1690 Node* value = jsgraph()->Constant(expr->value()); |
1691 ast_context()->ProduceValue(value); | 1691 ast_context()->ProduceValue(value); |
1692 } | 1692 } |
1693 | 1693 |
1694 | 1694 |
1695 void AstGraphBuilder::VisitRegExpLiteral(RegExpLiteral* expr) { | 1695 void AstGraphBuilder::VisitRegExpLiteral(RegExpLiteral* expr) { |
1696 Node* closure = GetFunctionClosure(); | 1696 Node* closure = GetFunctionClosure(); |
1697 | 1697 |
1698 // Create node to materialize a regular expression literal. | 1698 // Create node to materialize a regular expression literal. |
1699 Node* literals_array = | |
1700 BuildLoadObjectField(closure, JSFunction::kLiteralsOffset); | |
1701 Node* literal_index = jsgraph()->Constant(expr->literal_index()); | 1699 Node* literal_index = jsgraph()->Constant(expr->literal_index()); |
1702 Node* pattern = jsgraph()->Constant(expr->pattern()); | 1700 Node* pattern = jsgraph()->Constant(expr->pattern()); |
1703 Node* flags = jsgraph()->Constant(expr->flags()); | 1701 Node* flags = jsgraph()->Constant(expr->flags()); |
1704 const Operator* op = | 1702 const Operator* op = |
1705 javascript()->CallRuntime(Runtime::kMaterializeRegExpLiteral, 4); | 1703 javascript()->CallRuntime(Runtime::kCreateRegExpLiteral, 4); |
1706 Node* literal = NewNode(op, literals_array, literal_index, pattern, flags); | 1704 Node* literal = NewNode(op, closure, literal_index, pattern, flags); |
1707 PrepareFrameState(literal, expr->id(), ast_context()->GetStateCombine()); | 1705 PrepareFrameState(literal, expr->id(), ast_context()->GetStateCombine()); |
1708 ast_context()->ProduceValue(literal); | 1706 ast_context()->ProduceValue(literal); |
1709 } | 1707 } |
1710 | 1708 |
1711 | 1709 |
1712 void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { | 1710 void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { |
1713 Node* closure = GetFunctionClosure(); | 1711 Node* closure = GetFunctionClosure(); |
1714 | 1712 |
1715 // Create node to deep-copy the literal boilerplate. | 1713 // Create node to deep-copy the literal boilerplate. |
1716 const Operator* op = javascript()->CreateLiteralObject( | 1714 const Operator* op = javascript()->CreateLiteralObject( |
(...skipping 2593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4310 // Phi does not exist yet, introduce one. | 4308 // Phi does not exist yet, introduce one. |
4311 value = NewPhi(inputs, value, control); | 4309 value = NewPhi(inputs, value, control); |
4312 value->ReplaceInput(inputs - 1, other); | 4310 value->ReplaceInput(inputs - 1, other); |
4313 } | 4311 } |
4314 return value; | 4312 return value; |
4315 } | 4313 } |
4316 | 4314 |
4317 } // namespace compiler | 4315 } // namespace compiler |
4318 } // namespace internal | 4316 } // namespace internal |
4319 } // namespace v8 | 4317 } // namespace v8 |
OLD | NEW |