Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1075)

Side by Side Diff: src/runtime/runtime-utils.h

Issue 2137993003: [wasm] Adding feature to JIT a wasm function at runtime and hook up the compiled code into the indi… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Changed casting Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 RUNTIME_ASSERT(args[index]->Is##Type()); \ 43 RUNTIME_ASSERT(args[index]->Is##Type()); \
44 Handle<Type> name = args.at<Type>(index); 44 Handle<Type> name = args.at<Type>(index);
45 45
46 #define CONVERT_NUMBER_ARG_HANDLE_CHECKED(name, index) \ 46 #define CONVERT_NUMBER_ARG_HANDLE_CHECKED(name, index) \
47 RUNTIME_ASSERT(args[index]->IsNumber()); \ 47 RUNTIME_ASSERT(args[index]->IsNumber()); \
48 Handle<Object> name = args.at<Object>(index); 48 Handle<Object> name = args.at<Object>(index);
49 49
50 // Cast the given object to a boolean and store it in a variable with 50 // Cast the given object to a boolean and store it in a variable with
51 // the given name. If the object is not a boolean call IllegalOperation 51 // the given name. If the object is not a boolean call IllegalOperation
52 // and return. 52 // and return.
53 #define CONVERT_INTPTR_ARG_CHECKED(name, index) \
Mircea Trofin 2016/07/12 02:49:13 Is the comment above still pertinent?
54 RUNTIME_ASSERT(args[index]->IsNumber()); \
55 intptr_t name = static_cast<intptr_t>(args.number_at(index));
56
57 // Cast the given object to a boolean and store it in a variable with
58 // the given name. If the object is not a boolean call IllegalOperation
59 // and return.
53 #define CONVERT_BOOLEAN_ARG_CHECKED(name, index) \ 60 #define CONVERT_BOOLEAN_ARG_CHECKED(name, index) \
54 RUNTIME_ASSERT(args[index]->IsBoolean()); \ 61 RUNTIME_ASSERT(args[index]->IsBoolean()); \
55 bool name = args[index]->IsTrue(isolate); 62 bool name = args[index]->IsTrue(isolate);
56 63
57 // Cast the given argument to a Smi and store its value in an int variable 64 // Cast the given argument to a Smi and store its value in an int variable
58 // with the given name. If the argument is not a Smi call IllegalOperation 65 // with the given name. If the argument is not a Smi call IllegalOperation
59 // and return. 66 // and return.
60 #define CONVERT_SMI_ARG_CHECKED(name, index) \ 67 #define CONVERT_SMI_ARG_CHECKED(name, index) \
61 RUNTIME_ASSERT(args[index]->IsSmi()); \ 68 RUNTIME_ASSERT(args[index]->IsSmi()); \
62 int name = args.smi_at(index); 69 int name = args.smi_at(index);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 111
105 112
106 // Assert that the given argument is a number within the Int32 range 113 // Assert that the given argument is a number within the Int32 range
107 // and convert it to int32_t. If the argument is not an Int32 call 114 // and convert it to int32_t. If the argument is not an Int32 call
108 // IllegalOperation and return. 115 // IllegalOperation and return.
109 #define CONVERT_INT32_ARG_CHECKED(name, index) \ 116 #define CONVERT_INT32_ARG_CHECKED(name, index) \
110 RUNTIME_ASSERT(args[index]->IsNumber()); \ 117 RUNTIME_ASSERT(args[index]->IsNumber()); \
111 int32_t name = 0; \ 118 int32_t name = 0; \
112 RUNTIME_ASSERT(args[index]->ToInt32(&name)); 119 RUNTIME_ASSERT(args[index]->ToInt32(&name));
113 120
121 // Assert that the given argument is a number within the Uint32 range
122 // and convert it to uint32_t. If the argument is not an Uint32 call
123 // IllegalOperation and return.
124 #define CONVERT_UINT32_ARG_CHECKED(name, index) \
125 RUNTIME_ASSERT(args[index]->IsNumber()); \
126 uint32_t name = 0; \
127 RUNTIME_ASSERT(args[index]->ToUint32(&name));
114 128
115 // Cast the given argument to PropertyAttributes and store its value in a 129 // Cast the given argument to PropertyAttributes and store its value in a
116 // variable with the given name. If the argument is not a Smi call or the 130 // variable with the given name. If the argument is not a Smi call or the
117 // enum value is out of range, call IllegalOperation and return. 131 // enum value is out of range, call IllegalOperation and return.
118 #define CONVERT_PROPERTY_ATTRIBUTES_CHECKED(name, index) \ 132 #define CONVERT_PROPERTY_ATTRIBUTES_CHECKED(name, index) \
119 RUNTIME_ASSERT(args[index]->IsSmi()); \ 133 RUNTIME_ASSERT(args[index]->IsSmi()); \
120 RUNTIME_ASSERT( \ 134 RUNTIME_ASSERT( \
121 (args.smi_at(index) & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); \ 135 (args.smi_at(index) & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); \
122 PropertyAttributes name = static_cast<PropertyAttributes>(args.smi_at(index)); 136 PropertyAttributes name = static_cast<PropertyAttributes>(args.smi_at(index));
123 137
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 static inline ObjectTriple MakeTriple(Object* x, Object* y, Object* z) { 202 static inline ObjectTriple MakeTriple(Object* x, Object* y, Object* z) {
189 ObjectTriple result = {x, y, z}; 203 ObjectTriple result = {x, y, z};
190 // ObjectTriple is assigned to a hidden first argument. 204 // ObjectTriple is assigned to a hidden first argument.
191 return result; 205 return result;
192 } 206 }
193 207
194 } // namespace internal 208 } // namespace internal
195 } // namespace v8 209 } // namespace v8
196 210
197 #endif // V8_RUNTIME_RUNTIME_UTILS_H_ 211 #endif // V8_RUNTIME_RUNTIME_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698