OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_RUNTIME_RUNTIME_UTILS_H_ | 5 #ifndef V8_RUNTIME_RUNTIME_UTILS_H_ |
6 #define V8_RUNTIME_RUNTIME_UTILS_H_ | 6 #define V8_RUNTIME_RUNTIME_UTILS_H_ |
7 | 7 |
8 #include "src/base/logging.h" | 8 #include "src/base/logging.h" |
9 #include "src/runtime/runtime.h" | 9 #include "src/runtime/runtime.h" |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #define CONVERT_DOUBLE_ARG_CHECKED(name, index) \ | 44 #define CONVERT_DOUBLE_ARG_CHECKED(name, index) \ |
45 CHECK(args[index]->IsNumber()); \ | 45 CHECK(args[index]->IsNumber()); \ |
46 double name = args.number_at(index); | 46 double name = args.number_at(index); |
47 | 47 |
48 // Cast the given argument to a size_t and store its value in a variable with | 48 // Cast the given argument to a size_t and store its value in a variable with |
49 // the given name. If the argument is not a size_t we crash safely. | 49 // the given name. If the argument is not a size_t we crash safely. |
50 #define CONVERT_SIZE_ARG_CHECKED(name, index) \ | 50 #define CONVERT_SIZE_ARG_CHECKED(name, index) \ |
51 CHECK(args[index]->IsNumber()); \ | 51 CHECK(args[index]->IsNumber()); \ |
52 Handle<Object> name##_object = args.at<Object>(index); \ | 52 Handle<Object> name##_object = args.at<Object>(index); \ |
53 size_t name = 0; \ | 53 size_t name = 0; \ |
54 CHECK(TryNumberToSize(isolate, *name##_object, &name)); | 54 CHECK(TryNumberToSize(*name##_object, &name)); |
55 | 55 |
56 // Call the specified converter on the object *comand store the result in | 56 // Call the specified converter on the object *comand store the result in |
57 // a variable of the specified type with the given name. If the | 57 // a variable of the specified type with the given name. If the |
58 // object is not a Number we crash safely. | 58 // object is not a Number we crash safely. |
59 #define CONVERT_NUMBER_CHECKED(type, name, Type, obj) \ | 59 #define CONVERT_NUMBER_CHECKED(type, name, Type, obj) \ |
60 CHECK(obj->IsNumber()); \ | 60 CHECK(obj->IsNumber()); \ |
61 type name = NumberTo##Type(obj); | 61 type name = NumberTo##Type(obj); |
62 | 62 |
63 // Cast the given argument to PropertyDetails and store its value in a | 63 // Cast the given argument to PropertyDetails and store its value in a |
64 // variable with the given name. If the argument is not a Smi we crash safely. | 64 // variable with the given name. If the argument is not a Smi we crash safely. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 static inline ObjectTriple MakeTriple(Object* x, Object* y, Object* z) { | 162 static inline ObjectTriple MakeTriple(Object* x, Object* y, Object* z) { |
163 ObjectTriple result = {x, y, z}; | 163 ObjectTriple result = {x, y, z}; |
164 // ObjectTriple is assigned to a hidden first argument. | 164 // ObjectTriple is assigned to a hidden first argument. |
165 return result; | 165 return result; |
166 } | 166 } |
167 | 167 |
168 } // namespace internal | 168 } // namespace internal |
169 } // namespace v8 | 169 } // namespace v8 |
170 | 170 |
171 #endif // V8_RUNTIME_RUNTIME_UTILS_H_ | 171 #endif // V8_RUNTIME_RUNTIME_UTILS_H_ |
OLD | NEW |