OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/full-codegen/full-codegen.h" | 5 #include "src/full-codegen/full-codegen.h" |
6 | 6 |
7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
8 #include "src/ast/ast-numbering.h" | 8 #include "src/ast/ast-numbering.h" |
9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
10 #include "src/ast/scopeinfo.h" | 10 #include "src/ast/scopeinfo.h" |
(...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1622 EmitCall(expr); | 1622 EmitCall(expr); |
1623 break; | 1623 break; |
1624 } | 1624 } |
1625 | 1625 |
1626 #ifdef DEBUG | 1626 #ifdef DEBUG |
1627 // RecordJSReturnSite should have been called. | 1627 // RecordJSReturnSite should have been called. |
1628 DCHECK(expr->return_is_recorded_); | 1628 DCHECK(expr->return_is_recorded_); |
1629 #endif | 1629 #endif |
1630 } | 1630 } |
1631 | 1631 |
| 1632 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
| 1633 ZoneList<Expression*>* args = expr->arguments(); |
| 1634 int arg_count = args->length(); |
| 1635 |
| 1636 if (expr->is_jsruntime()) { |
| 1637 Comment cmnt(masm_, "[ CallRuntime"); |
| 1638 EmitLoadJSRuntimeFunction(expr); |
| 1639 |
| 1640 // Push the arguments ("left-to-right"). |
| 1641 for (int i = 0; i < arg_count; i++) { |
| 1642 VisitForStackValue(args->at(i)); |
| 1643 } |
| 1644 |
| 1645 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); |
| 1646 EmitCallJSRuntimeFunction(expr); |
| 1647 context()->DropAndPlug(1, result_register()); |
| 1648 |
| 1649 } else { |
| 1650 const Runtime::Function* function = expr->function(); |
| 1651 switch (function->function_id) { |
| 1652 #define CALL_INTRINSIC_GENERATOR(Name) \ |
| 1653 case Runtime::kInline##Name: { \ |
| 1654 Comment cmnt(masm_, "[ Inline" #Name); \ |
| 1655 return Emit##Name(expr); \ |
| 1656 } |
| 1657 FOR_EACH_FULL_CODE_INTRINSIC(CALL_INTRINSIC_GENERATOR) |
| 1658 #undef CALL_INTRINSIC_GENERATOR |
| 1659 default: { |
| 1660 Comment cmnt(masm_, "[ CallRuntime for unhandled intrinsic"); |
| 1661 // Push the arguments ("left-to-right"). |
| 1662 for (int i = 0; i < arg_count; i++) { |
| 1663 VisitForStackValue(args->at(i)); |
| 1664 } |
| 1665 |
| 1666 // Call the C runtime function. |
| 1667 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); |
| 1668 __ CallRuntime(expr->function(), arg_count); |
| 1669 OperandStackDepthDecrement(arg_count); |
| 1670 context()->Plug(result_register()); |
| 1671 } |
| 1672 } |
| 1673 } |
| 1674 } |
1632 | 1675 |
1633 void FullCodeGenerator::VisitSpread(Spread* expr) { UNREACHABLE(); } | 1676 void FullCodeGenerator::VisitSpread(Spread* expr) { UNREACHABLE(); } |
1634 | 1677 |
1635 | 1678 |
1636 void FullCodeGenerator::VisitEmptyParentheses(EmptyParentheses* expr) { | 1679 void FullCodeGenerator::VisitEmptyParentheses(EmptyParentheses* expr) { |
1637 UNREACHABLE(); | 1680 UNREACHABLE(); |
1638 } | 1681 } |
1639 | 1682 |
1640 | 1683 |
1641 void FullCodeGenerator::VisitRewritableExpression(RewritableExpression* expr) { | 1684 void FullCodeGenerator::VisitRewritableExpression(RewritableExpression* expr) { |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1905 return var->mode() == CONST_LEGACY || var->scope()->is_nonlinear() || | 1948 return var->mode() == CONST_LEGACY || var->scope()->is_nonlinear() || |
1906 var->initializer_position() >= proxy->position(); | 1949 var->initializer_position() >= proxy->position(); |
1907 } | 1950 } |
1908 | 1951 |
1909 | 1952 |
1910 #undef __ | 1953 #undef __ |
1911 | 1954 |
1912 | 1955 |
1913 } // namespace internal | 1956 } // namespace internal |
1914 } // namespace v8 | 1957 } // namespace v8 |
OLD | NEW |