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 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 | 64 |
65 // Cast the given argument to PropertyDetails and store its value in a | 65 // Cast the given argument to PropertyDetails and store its value in a |
66 // variable with the given name. If the argument is not a Smi call | 66 // variable with the given name. If the argument is not a Smi call |
67 // IllegalOperation and return. | 67 // IllegalOperation and return. |
68 #define CONVERT_PROPERTY_DETAILS_CHECKED(name, index) \ | 68 #define CONVERT_PROPERTY_DETAILS_CHECKED(name, index) \ |
69 RUNTIME_ASSERT(args[index]->IsSmi()); \ | 69 RUNTIME_ASSERT(args[index]->IsSmi()); \ |
70 PropertyDetails name = PropertyDetails(Smi::cast(args[index])); | 70 PropertyDetails name = PropertyDetails(Smi::cast(args[index])); |
71 | 71 |
72 | 72 |
73 // Assert that the given argument has a valid value for a StrictMode | 73 // Assert that the given argument has a valid value for a LanguageMode |
74 // and store it in a StrictMode variable with the given name. | 74 // and store it in a LanguageMode variable with the given name. |
75 #define CONVERT_STRICT_MODE_ARG_CHECKED(name, index) \ | 75 #define CONVERT_LANGUAGE_MODE_ARG_CHECKED(name, index) \ |
76 RUNTIME_ASSERT(args[index]->IsSmi()); \ | 76 RUNTIME_ASSERT(args[index]->IsSmi()); \ |
77 RUNTIME_ASSERT(args.smi_at(index) == STRICT || \ | 77 RUNTIME_ASSERT(is_valid_language_mode(args.smi_at(index))); \ |
78 args.smi_at(index) == SLOPPY); \ | 78 LanguageMode name = static_cast<LanguageMode>(args.smi_at(index)); |
79 StrictMode name = static_cast<StrictMode>(args.smi_at(index)); | |
80 | 79 |
81 | 80 |
82 // Assert that the given argument is a number within the Int32 range | 81 // Assert that the given argument is a number within the Int32 range |
83 // and convert it to int32_t. If the argument is not an Int32 call | 82 // and convert it to int32_t. If the argument is not an Int32 call |
84 // IllegalOperation and return. | 83 // IllegalOperation and return. |
85 #define CONVERT_INT32_ARG_CHECKED(name, index) \ | 84 #define CONVERT_INT32_ARG_CHECKED(name, index) \ |
86 RUNTIME_ASSERT(args[index]->IsNumber()); \ | 85 RUNTIME_ASSERT(args[index]->IsNumber()); \ |
87 int32_t name = 0; \ | 86 int32_t name = 0; \ |
88 RUNTIME_ASSERT(args[index]->ToInt32(&name)); | 87 RUNTIME_ASSERT(args[index]->ToInt32(&name)); |
89 | 88 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 #else | 137 #else |
139 #error Unknown endianness | 138 #error Unknown endianness |
140 #endif | 139 #endif |
141 } | 140 } |
142 #endif | 141 #endif |
143 | 142 |
144 } | 143 } |
145 } // namespace v8::internal | 144 } // namespace v8::internal |
146 | 145 |
147 #endif // V8_RUNTIME_RUNTIME_UTILS_H_ | 146 #endif // V8_RUNTIME_RUNTIME_UTILS_H_ |
OLD | NEW |