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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 // 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 |
82 // 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 |
83 // IllegalOperation and return. | 83 // IllegalOperation and return. |
84 #define CONVERT_INT32_ARG_CHECKED(name, index) \ | 84 #define CONVERT_INT32_ARG_CHECKED(name, index) \ |
85 RUNTIME_ASSERT(args[index]->IsNumber()); \ | 85 RUNTIME_ASSERT(args[index]->IsNumber()); \ |
86 int32_t name = 0; \ | 86 int32_t name = 0; \ |
87 RUNTIME_ASSERT(args[index]->ToInt32(&name)); | 87 RUNTIME_ASSERT(args[index]->ToInt32(&name)); |
88 | 88 |
89 | 89 |
| 90 // Cast the given argument to PropertyAttributes and store its value in a |
| 91 // variable with the given name. If the argument is not a Smi call or the |
| 92 // enum value is out of range, call IllegalOperation and return. |
| 93 #define CONVERT_PROPERTY_ATTRIBUTES_CHECKED(name, index) \ |
| 94 RUNTIME_ASSERT(args[index]->IsSmi()); \ |
| 95 RUNTIME_ASSERT( \ |
| 96 (args.smi_at(index) & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); \ |
| 97 PropertyAttributes name = static_cast<PropertyAttributes>(args.smi_at(index)); |
| 98 |
| 99 |
90 // A mechanism to return a pair of Object pointers in registers (if possible). | 100 // A mechanism to return a pair of Object pointers in registers (if possible). |
91 // How this is achieved is calling convention-dependent. | 101 // How this is achieved is calling convention-dependent. |
92 // All currently supported x86 compiles uses calling conventions that are cdecl | 102 // All currently supported x86 compiles uses calling conventions that are cdecl |
93 // variants where a 64-bit value is returned in two 32-bit registers | 103 // variants where a 64-bit value is returned in two 32-bit registers |
94 // (edx:eax on ia32, r1:r0 on ARM). | 104 // (edx:eax on ia32, r1:r0 on ARM). |
95 // In AMD-64 calling convention a struct of two pointers is returned in rdx:rax. | 105 // In AMD-64 calling convention a struct of two pointers is returned in rdx:rax. |
96 // In Win64 calling convention, a struct of two pointers is returned in memory, | 106 // In Win64 calling convention, a struct of two pointers is returned in memory, |
97 // allocated by the caller, and passed as a pointer in a hidden first parameter. | 107 // allocated by the caller, and passed as a pointer in a hidden first parameter. |
98 #ifdef V8_HOST_ARCH_64_BIT | 108 #ifdef V8_HOST_ARCH_64_BIT |
99 struct ObjectPair { | 109 struct ObjectPair { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 #else | 147 #else |
138 #error Unknown endianness | 148 #error Unknown endianness |
139 #endif | 149 #endif |
140 } | 150 } |
141 #endif | 151 #endif |
142 | 152 |
143 } | 153 } |
144 } // namespace v8::internal | 154 } // namespace v8::internal |
145 | 155 |
146 #endif // V8_RUNTIME_RUNTIME_UTILS_H_ | 156 #endif // V8_RUNTIME_RUNTIME_UTILS_H_ |
OLD | NEW |