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 | |
4748 namespace { | 4736 namespace { |
4749 | 4737 |
4750 class RelocatableArguments : public BuiltinArguments, public Relocatable { | 4738 class RelocatableArguments : public BuiltinArguments, public Relocatable { |
4751 public: | 4739 public: |
4752 RelocatableArguments(Isolate* isolate, int length, Object** arguments) | 4740 RelocatableArguments(Isolate* isolate, int length, Object** arguments) |
4753 : BuiltinArguments(length, arguments), Relocatable(isolate) {} | 4741 : BuiltinArguments(length, arguments), Relocatable(isolate) {} |
4754 | 4742 |
4755 virtual inline void IterateInstance(ObjectVisitor* v) { | 4743 virtual inline void IterateInstance(ObjectVisitor* v) { |
4756 if (length() == 0) return; | 4744 if (length() == 0) return; |
4757 v->VisitPointers(lowest_address(), highest_address() + 1); | 4745 v->VisitPointers(lowest_address(), highest_address() + 1); |
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5843 return Generate_InterpreterPushArgsAndCallImpl(masm, TailCallMode::kDisallow, | 5831 return Generate_InterpreterPushArgsAndCallImpl(masm, TailCallMode::kDisallow, |
5844 CallableType::kJSFunction); | 5832 CallableType::kJSFunction); |
5845 } | 5833 } |
5846 | 5834 |
5847 void Builtins::Generate_InterpreterPushArgsAndTailCallFunction( | 5835 void Builtins::Generate_InterpreterPushArgsAndTailCallFunction( |
5848 MacroAssembler* masm) { | 5836 MacroAssembler* masm) { |
5849 return Generate_InterpreterPushArgsAndCallImpl(masm, TailCallMode::kAllow, | 5837 return Generate_InterpreterPushArgsAndCallImpl(masm, TailCallMode::kAllow, |
5850 CallableType::kJSFunction); | 5838 CallableType::kJSFunction); |
5851 } | 5839 } |
5852 | 5840 |
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 | |
5863 void Builtins::Generate_MathMax(MacroAssembler* masm) { | 5841 void Builtins::Generate_MathMax(MacroAssembler* masm) { |
5864 Generate_MathMaxMin(masm, MathMaxMinKind::kMax); | 5842 Generate_MathMaxMin(masm, MathMaxMinKind::kMax); |
5865 } | 5843 } |
5866 | 5844 |
5867 void Builtins::Generate_MathMin(MacroAssembler* masm) { | 5845 void Builtins::Generate_MathMin(MacroAssembler* masm) { |
5868 Generate_MathMaxMin(masm, MathMaxMinKind::kMin); | 5846 Generate_MathMaxMin(masm, MathMaxMinKind::kMin); |
5869 } | 5847 } |
5870 | 5848 |
5871 #define DEFINE_BUILTIN_ACCESSOR(Name, ...) \ | 5849 #define DEFINE_BUILTIN_ACCESSOR(Name, ...) \ |
5872 Handle<Code> Builtins::Name() { \ | 5850 Handle<Code> Builtins::Name() { \ |
5873 Code** code_address = reinterpret_cast<Code**>(builtin_address(k##Name)); \ | 5851 Code** code_address = reinterpret_cast<Code**>(builtin_address(k##Name)); \ |
5874 return Handle<Code>(code_address); \ | 5852 return Handle<Code>(code_address); \ |
5875 } | 5853 } |
5876 BUILTIN_LIST_ALL(DEFINE_BUILTIN_ACCESSOR) | 5854 BUILTIN_LIST_ALL(DEFINE_BUILTIN_ACCESSOR) |
5877 #undef DEFINE_BUILTIN_ACCESSOR | 5855 #undef DEFINE_BUILTIN_ACCESSOR |
5878 | 5856 |
5879 } // namespace internal | 5857 } // namespace internal |
5880 } // namespace v8 | 5858 } // namespace v8 |
OLD | NEW |