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/builtins/builtins.h" | 5 #include "src/builtins/builtins.h" |
6 #include "src/builtins/builtins-utils.h" | 6 #include "src/builtins/builtins-utils.h" |
7 | 7 |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/api-natives.h" | 9 #include "src/api-natives.h" |
10 #include "src/base/ieee754.h" | 10 #include "src/base/ieee754.h" |
(...skipping 4715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4726 if (function_type == CallableType::kJSFunction) { | 4726 if (function_type == CallableType::kJSFunction) { |
4727 return InterpreterPushArgsAndTailCallFunction(); | 4727 return InterpreterPushArgsAndTailCallFunction(); |
4728 } else { | 4728 } else { |
4729 return InterpreterPushArgsAndTailCall(); | 4729 return InterpreterPushArgsAndTailCall(); |
4730 } | 4730 } |
4731 } | 4731 } |
4732 UNREACHABLE(); | 4732 UNREACHABLE(); |
4733 return Handle<Code>::null(); | 4733 return Handle<Code>::null(); |
4734 } | 4734 } |
4735 | 4735 |
| 4736 Handle<Code> Builtins::InterpreterPushArgsAndConstruct( |
| 4737 CallableType function_type) { |
| 4738 switch (function_type) { |
| 4739 case CallableType::kJSFunction: |
| 4740 return InterpreterPushArgsAndConstructFunction(); |
| 4741 case CallableType::kAny: |
| 4742 return InterpreterPushArgsAndConstruct(); |
| 4743 } |
| 4744 UNREACHABLE(); |
| 4745 return Handle<Code>::null(); |
| 4746 } |
| 4747 |
4736 namespace { | 4748 namespace { |
4737 | 4749 |
4738 class RelocatableArguments : public BuiltinArguments, public Relocatable { | 4750 class RelocatableArguments : public BuiltinArguments, public Relocatable { |
4739 public: | 4751 public: |
4740 RelocatableArguments(Isolate* isolate, int length, Object** arguments) | 4752 RelocatableArguments(Isolate* isolate, int length, Object** arguments) |
4741 : BuiltinArguments(length, arguments), Relocatable(isolate) {} | 4753 : BuiltinArguments(length, arguments), Relocatable(isolate) {} |
4742 | 4754 |
4743 virtual inline void IterateInstance(ObjectVisitor* v) { | 4755 virtual inline void IterateInstance(ObjectVisitor* v) { |
4744 if (length() == 0) return; | 4756 if (length() == 0) return; |
4745 v->VisitPointers(lowest_address(), highest_address() + 1); | 4757 v->VisitPointers(lowest_address(), highest_address() + 1); |
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5831 return Generate_InterpreterPushArgsAndCallImpl(masm, TailCallMode::kDisallow, | 5843 return Generate_InterpreterPushArgsAndCallImpl(masm, TailCallMode::kDisallow, |
5832 CallableType::kJSFunction); | 5844 CallableType::kJSFunction); |
5833 } | 5845 } |
5834 | 5846 |
5835 void Builtins::Generate_InterpreterPushArgsAndTailCallFunction( | 5847 void Builtins::Generate_InterpreterPushArgsAndTailCallFunction( |
5836 MacroAssembler* masm) { | 5848 MacroAssembler* masm) { |
5837 return Generate_InterpreterPushArgsAndCallImpl(masm, TailCallMode::kAllow, | 5849 return Generate_InterpreterPushArgsAndCallImpl(masm, TailCallMode::kAllow, |
5838 CallableType::kJSFunction); | 5850 CallableType::kJSFunction); |
5839 } | 5851 } |
5840 | 5852 |
| 5853 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
| 5854 return Generate_InterpreterPushArgsAndConstructImpl(masm, CallableType::kAny); |
| 5855 } |
| 5856 |
| 5857 void Builtins::Generate_InterpreterPushArgsAndConstructFunction( |
| 5858 MacroAssembler* masm) { |
| 5859 return Generate_InterpreterPushArgsAndConstructImpl( |
| 5860 masm, CallableType::kJSFunction); |
| 5861 } |
| 5862 |
5841 void Builtins::Generate_MathMax(MacroAssembler* masm) { | 5863 void Builtins::Generate_MathMax(MacroAssembler* masm) { |
5842 Generate_MathMaxMin(masm, MathMaxMinKind::kMax); | 5864 Generate_MathMaxMin(masm, MathMaxMinKind::kMax); |
5843 } | 5865 } |
5844 | 5866 |
5845 void Builtins::Generate_MathMin(MacroAssembler* masm) { | 5867 void Builtins::Generate_MathMin(MacroAssembler* masm) { |
5846 Generate_MathMaxMin(masm, MathMaxMinKind::kMin); | 5868 Generate_MathMaxMin(masm, MathMaxMinKind::kMin); |
5847 } | 5869 } |
5848 | 5870 |
5849 #define DEFINE_BUILTIN_ACCESSOR(Name, ...) \ | 5871 #define DEFINE_BUILTIN_ACCESSOR(Name, ...) \ |
5850 Handle<Code> Builtins::Name() { \ | 5872 Handle<Code> Builtins::Name() { \ |
5851 Code** code_address = reinterpret_cast<Code**>(builtin_address(k##Name)); \ | 5873 Code** code_address = reinterpret_cast<Code**>(builtin_address(k##Name)); \ |
5852 return Handle<Code>(code_address); \ | 5874 return Handle<Code>(code_address); \ |
5853 } | 5875 } |
5854 BUILTIN_LIST_ALL(DEFINE_BUILTIN_ACCESSOR) | 5876 BUILTIN_LIST_ALL(DEFINE_BUILTIN_ACCESSOR) |
5855 #undef DEFINE_BUILTIN_ACCESSOR | 5877 #undef DEFINE_BUILTIN_ACCESSOR |
5856 | 5878 |
5857 } // namespace internal | 5879 } // namespace internal |
5858 } // namespace v8 | 5880 } // namespace v8 |
OLD | NEW |