| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef V8_BUILTINS_BUILTINS_UTILS_H_ | 5 #ifndef V8_BUILTINS_BUILTINS_UTILS_H_ |
| 6 #define V8_BUILTINS_BUILTINS_UTILS_H_ | 6 #define V8_BUILTINS_BUILTINS_UTILS_H_ |
| 7 | 7 |
| 8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
| 9 #include "src/base/logging.h" | 9 #include "src/base/logging.h" |
| 10 #include "src/builtins/builtins.h" | 10 #include "src/builtins/builtins.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 } | 41 } |
| 42 | 42 |
| 43 Handle<Object> receiver() { return Arguments::at<Object>(0); } | 43 Handle<Object> receiver() { return Arguments::at<Object>(0); } |
| 44 | 44 |
| 45 static const int kNewTargetOffset = 0; | 45 static const int kNewTargetOffset = 0; |
| 46 static const int kTargetOffset = 1; | 46 static const int kTargetOffset = 1; |
| 47 static const int kArgcOffset = 2; | 47 static const int kArgcOffset = 2; |
| 48 static const int kNumExtraArgs = 3; | 48 static const int kNumExtraArgs = 3; |
| 49 static const int kNumExtraArgsWithReceiver = 4; | 49 static const int kNumExtraArgsWithReceiver = 4; |
| 50 | 50 |
| 51 template <class S> | 51 Handle<JSFunction> target() { |
| 52 Handle<S> target() { | 52 return Arguments::at<JSFunction>(Arguments::length() - 1 - kTargetOffset); |
| 53 return Arguments::at<S>(Arguments::length() - 1 - kTargetOffset); | |
| 54 } | 53 } |
| 55 Handle<HeapObject> new_target() { | 54 Handle<HeapObject> new_target() { |
| 56 return Arguments::at<HeapObject>(Arguments::length() - 1 - | 55 return Arguments::at<HeapObject>(Arguments::length() - 1 - |
| 57 kNewTargetOffset); | 56 kNewTargetOffset); |
| 58 } | 57 } |
| 59 | 58 |
| 60 // Gets the total number of arguments including the receiver (but | 59 // Gets the total number of arguments including the receiver (but |
| 61 // excluding extra arguments). | 60 // excluding extra arguments). |
| 62 int length() const { return Arguments::length() - kNumExtraArgs; } | 61 int length() const { return Arguments::length() - kNumExtraArgs; } |
| 63 }; | 62 }; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 isolate->factory()->NewStringFromAsciiChecked(method))); \ | 126 isolate->factory()->NewStringFromAsciiChecked(method))); \ |
| 128 } \ | 127 } \ |
| 129 Handle<String> name; \ | 128 Handle<String> name; \ |
| 130 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( \ | 129 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( \ |
| 131 isolate, name, Object::ToString(isolate, args.receiver())) | 130 isolate, name, Object::ToString(isolate, args.receiver())) |
| 132 | 131 |
| 133 } // namespace internal | 132 } // namespace internal |
| 134 } // namespace v8 | 133 } // namespace v8 |
| 135 | 134 |
| 136 #endif // V8_BUILTINS_BUILTINS_UTILS_H_ | 135 #endif // V8_BUILTINS_BUILTINS_UTILS_H_ |
| OLD | NEW |