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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. |
65 #define CONVERT_PROPERTY_DETAILS_CHECKED(name, index) \ | 65 #define CONVERT_PROPERTY_DETAILS_CHECKED(name, index) \ |
66 CHECK(args[index]->IsSmi()); \ | 66 CHECK(args[index]->IsSmi()); \ |
67 PropertyDetails name = PropertyDetails(Smi::cast(args[index])); | 67 PropertyDetails name = PropertyDetails(Smi::cast(args[index])); |
68 | 68 |
69 // Assert that the given argument has a valid value for a LanguageMode | 69 // Assert that the given argument has a valid value for a LanguageMode |
70 // and store it in a LanguageMode variable with the given name. | 70 // and store it in a LanguageMode variable with the given name. |
71 #define CONVERT_LANGUAGE_MODE_ARG_CHECKED(name, index) \ | 71 #define CONVERT_LANGUAGE_MODE_ARG_CHECKED(name, index) \ |
72 CHECK(args[index]->IsSmi()); \ | 72 CHECK(args[index]->IsNumber()); \ |
73 CHECK(is_valid_language_mode(args.smi_at(index))); \ | 73 int32_t __tmp_##name = 0; \ |
74 LanguageMode name = static_cast<LanguageMode>(args.smi_at(index)); | 74 CHECK(args[index]->ToInt32(&__tmp_##name)); \ |
| 75 CHECK(is_valid_language_mode(__tmp_##name)); \ |
| 76 LanguageMode name = static_cast<LanguageMode>(__tmp_##name); |
75 | 77 |
76 // Assert that the given argument is a number within the Int32 range | 78 // Assert that the given argument is a number within the Int32 range |
77 // and convert it to int32_t. If the argument is not an Int32 we crash safely. | 79 // and convert it to int32_t. If the argument is not an Int32 we crash safely. |
78 #define CONVERT_INT32_ARG_CHECKED(name, index) \ | 80 #define CONVERT_INT32_ARG_CHECKED(name, index) \ |
79 CHECK(args[index]->IsNumber()); \ | 81 CHECK(args[index]->IsNumber()); \ |
80 int32_t name = 0; \ | 82 int32_t name = 0; \ |
81 CHECK(args[index]->ToInt32(&name)); | 83 CHECK(args[index]->ToInt32(&name)); |
82 | 84 |
83 // Assert that the given argument is a number within the Uint32 range | 85 // Assert that the given argument is a number within the Uint32 range |
84 // and convert it to uint32_t. If the argument is not an Uint32 call | 86 // and convert it to uint32_t. If the argument is not an Uint32 call |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 static inline ObjectTriple MakeTriple(Object* x, Object* y, Object* z) { | 164 static inline ObjectTriple MakeTriple(Object* x, Object* y, Object* z) { |
163 ObjectTriple result = {x, y, z}; | 165 ObjectTriple result = {x, y, z}; |
164 // ObjectTriple is assigned to a hidden first argument. | 166 // ObjectTriple is assigned to a hidden first argument. |
165 return result; | 167 return result; |
166 } | 168 } |
167 | 169 |
168 } // namespace internal | 170 } // namespace internal |
169 } // namespace v8 | 171 } // namespace v8 |
170 | 172 |
171 #endif // V8_RUNTIME_RUNTIME_UTILS_H_ | 173 #endif // V8_RUNTIME_RUNTIME_UTILS_H_ |
OLD | NEW |