5 #ifndef V8_ARGUMENTS_H_ 6 #define V8_ARGUMENTS_H_ 8 #include "src/allocation.h" 9 #include "src/handles.h" 10 #include "src/objects.h" 11 #include "src/objects/slots.h" 12 #include "src/tracing/trace-event.h" 35 : length_(length), arguments_(arguments) {
36 DCHECK_GE(length_, 0);
40 return ObjectPtr(*address_of_arg_at(index));
43 template <
class S = Object>
46 inline int smi_at(
int index);
48 inline double number_at(
int index);
50 inline void set_at(
int index,
Object* value) {
51 *address_of_arg_at(index) = value->ptr();
58 inline Address* address_of_arg_at(
int index) {
60 DCHECK_LT(static_cast<uint32_t>(index), static_cast<uint32_t>(length_));
61 return reinterpret_cast<Address*
>(
reinterpret_cast<Address>(arguments_) -
62 index * kPointerSize);
66 int length()
const {
return static_cast<int>(length_); }
69 ObjectSlot first_slot() {
return slot_at(length() - 1); }
82 double ClobberDoubleRegisters(
double x1,
double x2,
double x3,
double x4);
85 #define CLOBBER_DOUBLE_REGISTERS() ClobberDoubleRegisters(1, 2, 3, 4); 87 #define CLOBBER_DOUBLE_REGISTERS() 92 #define RUNTIME_FUNCTION_RETURNS_TYPE(Type, Name) \ 93 static V8_INLINE Type __RT_impl_##Name(Arguments args, Isolate* isolate); \ 95 V8_NOINLINE static Type Stats_##Name(int args_length, Address* args_object, \ 97 RuntimeCallTimerScope timer(isolate, RuntimeCallCounterId::k##Name); \ 98 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.runtime"), \ 99 "V8.Runtime_" #Name); \ 100 Arguments args(args_length, args_object); \ 101 return __RT_impl_##Name(args, isolate); \ 104 Type Name(int args_length, Address* args_object, Isolate* isolate) { \ 105 DCHECK(isolate->context().is_null() || isolate->context()->IsContext()); \ 106 CLOBBER_DOUBLE_REGISTERS(); \ 107 if (V8_UNLIKELY(FLAG_runtime_stats)) { \ 108 return Stats_##Name(args_length, args_object, isolate); \ 110 Arguments args(args_length, args_object); \ 111 return __RT_impl_##Name(args, isolate); \ 114 static Type __RT_impl_##Name(Arguments args, Isolate* isolate) 116 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name) 117 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \ 118 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name) 123 #endif // V8_ARGUMENTS_H_