| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/ast.h" | 7 #include "src/ast.h" |
| 8 #include "src/ast-numbering.h" | 8 #include "src/ast-numbering.h" |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 } | 875 } |
| 876 | 876 |
| 877 | 877 |
| 878 void FullCodeGenerator::SetSourcePosition(int pos) { | 878 void FullCodeGenerator::SetSourcePosition(int pos) { |
| 879 if (pos != RelocInfo::kNoPosition) { | 879 if (pos != RelocInfo::kNoPosition) { |
| 880 masm_->positions_recorder()->RecordPosition(pos); | 880 masm_->positions_recorder()->RecordPosition(pos); |
| 881 } | 881 } |
| 882 } | 882 } |
| 883 | 883 |
| 884 | 884 |
| 885 // Lookup table for code generators for special runtime calls which are | |
| 886 // generated inline. | |
| 887 #define INLINE_FUNCTION_GENERATOR_ADDRESS(Name, argc, ressize) \ | |
| 888 &FullCodeGenerator::Emit##Name, | |
| 889 | |
| 890 const FullCodeGenerator::InlineFunctionGenerator | |
| 891 FullCodeGenerator::kInlineFunctionGenerators[] = { | |
| 892 INLINE_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_ADDRESS) | |
| 893 }; | |
| 894 #undef INLINE_FUNCTION_GENERATOR_ADDRESS | |
| 895 | |
| 896 | |
| 897 FullCodeGenerator::InlineFunctionGenerator | |
| 898 FullCodeGenerator::FindInlineFunctionGenerator(CallRuntime* expr) { | |
| 899 const Runtime::Function* function = expr->function(); | |
| 900 if (function == nullptr || function->intrinsic_type != Runtime::INLINE) { | |
| 901 return nullptr; | |
| 902 } | |
| 903 Runtime::FunctionId id = function->function_id; | |
| 904 if (id < Runtime::kFirstInlineFunction || Runtime::kLastInlineFunction < id) { | |
| 905 return nullptr; | |
| 906 } | |
| 907 return kInlineFunctionGenerators[static_cast<int>(id) - | |
| 908 static_cast<int>( | |
| 909 Runtime::kFirstInlineFunction)]; | |
| 910 } | |
| 911 | |
| 912 | |
| 913 void FullCodeGenerator::EmitInlineRuntimeCall( | |
| 914 CallRuntime* expr, InlineFunctionGenerator generator) { | |
| 915 ((*this).*(generator))(expr); | |
| 916 } | |
| 917 | |
| 918 | |
| 919 void FullCodeGenerator::EmitGeneratorNext(CallRuntime* expr) { | 885 void FullCodeGenerator::EmitGeneratorNext(CallRuntime* expr) { |
| 920 ZoneList<Expression*>* args = expr->arguments(); | 886 ZoneList<Expression*>* args = expr->arguments(); |
| 921 DCHECK(args->length() == 2); | 887 DCHECK(args->length() == 2); |
| 922 EmitGeneratorResume(args->at(0), args->at(1), JSGeneratorObject::NEXT); | 888 EmitGeneratorResume(args->at(0), args->at(1), JSGeneratorObject::NEXT); |
| 923 } | 889 } |
| 924 | 890 |
| 925 | 891 |
| 926 void FullCodeGenerator::EmitGeneratorThrow(CallRuntime* expr) { | 892 void FullCodeGenerator::EmitGeneratorThrow(CallRuntime* expr) { |
| 927 ZoneList<Expression*>* args = expr->arguments(); | 893 ZoneList<Expression*>* args = expr->arguments(); |
| 928 DCHECK(args->length() == 2); | 894 DCHECK(args->length() == 2); |
| (...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1818 } | 1784 } |
| 1819 codegen_->PrepareForBailoutForId(exit_id_, NO_REGISTERS); | 1785 codegen_->PrepareForBailoutForId(exit_id_, NO_REGISTERS); |
| 1820 codegen_->scope_ = saved_scope_; | 1786 codegen_->scope_ = saved_scope_; |
| 1821 } | 1787 } |
| 1822 | 1788 |
| 1823 | 1789 |
| 1824 #undef __ | 1790 #undef __ |
| 1825 | 1791 |
| 1826 | 1792 |
| 1827 } } // namespace v8::internal | 1793 } } // namespace v8::internal |
| OLD | NEW |