| 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 12 matching lines...) Expand all Loading... |
| 23 : Arguments(length, arguments) { | 23 : Arguments(length, arguments) { |
| 24 // Check we have at least the receiver. | 24 // Check we have at least the receiver. |
| 25 DCHECK_LE(1, this->length()); | 25 DCHECK_LE(1, this->length()); |
| 26 } | 26 } |
| 27 | 27 |
| 28 Object*& operator[](int index) { | 28 Object*& operator[](int index) { |
| 29 DCHECK_LT(index, length()); | 29 DCHECK_LT(index, length()); |
| 30 return Arguments::operator[](index); | 30 return Arguments::operator[](index); |
| 31 } | 31 } |
| 32 | 32 |
| 33 template <class S> | 33 template <class S = Object> |
| 34 Handle<S> at(int index) { | 34 Handle<S> at(int index) { |
| 35 DCHECK_LT(index, length()); | 35 DCHECK_LT(index, length()); |
| 36 return Arguments::at<S>(index); | 36 return Arguments::at<S>(index); |
| 37 } | 37 } |
| 38 | 38 |
| 39 Handle<Object> atOrUndefined(Isolate* isolate, int index) { | 39 Handle<Object> atOrUndefined(Isolate* isolate, int index) { |
| 40 if (index >= length()) { | 40 if (index >= length()) { |
| 41 return isolate->factory()->undefined_value(); | 41 return isolate->factory()->undefined_value(); |
| 42 } | 42 } |
| 43 return at<Object>(index); | 43 return at<Object>(index); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 isolate->factory()->NewStringFromAsciiChecked(method))); \ | 153 isolate->factory()->NewStringFromAsciiChecked(method))); \ |
| 154 } \ | 154 } \ |
| 155 Handle<String> name; \ | 155 Handle<String> name; \ |
| 156 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( \ | 156 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( \ |
| 157 isolate, name, Object::ToString(isolate, args.receiver())) | 157 isolate, name, Object::ToString(isolate, args.receiver())) |
| 158 | 158 |
| 159 } // namespace internal | 159 } // namespace internal |
| 160 } // namespace v8 | 160 } // namespace v8 |
| 161 | 161 |
| 162 #endif // V8_BUILTINS_BUILTINS_UTILS_H_ | 162 #endif // V8_BUILTINS_BUILTINS_UTILS_H_ |
| OLD | NEW |