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

Side by Side Diff: src/runtime/runtime-operators.cc

Issue 1693833002: Remove strong mode support from binary operations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. Created 4 years, 10 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 #include "src/arguments.h" 5 #include "src/arguments.h"
6 #include "src/isolate-inl.h" 6 #include "src/isolate-inl.h"
7 #include "src/runtime/runtime-utils.h" 7 #include "src/runtime/runtime-utils.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
11 11
12 RUNTIME_FUNCTION(Runtime_Multiply) { 12 RUNTIME_FUNCTION(Runtime_Multiply) {
13 HandleScope scope(isolate); 13 HandleScope scope(isolate);
14 DCHECK_EQ(2, args.length()); 14 DCHECK_EQ(2, args.length());
15 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0); 15 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
16 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1); 16 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
17 Handle<Object> result; 17 Handle<Object> result;
18 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 18 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
19 Object::Multiply(isolate, lhs, rhs)); 19 Object::Multiply(isolate, lhs, rhs));
20 return *result; 20 return *result;
21 } 21 }
22 22
23 23
24 RUNTIME_FUNCTION(Runtime_Multiply_Strong) {
25 HandleScope scope(isolate);
26 DCHECK_EQ(2, args.length());
27 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
28 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
29 Handle<Object> result;
30 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
31 isolate, result, Object::Multiply(isolate, lhs, rhs, Strength::STRONG));
32 return *result;
33 }
34
35
36 RUNTIME_FUNCTION(Runtime_Divide) { 24 RUNTIME_FUNCTION(Runtime_Divide) {
37 HandleScope scope(isolate); 25 HandleScope scope(isolate);
38 DCHECK_EQ(2, args.length()); 26 DCHECK_EQ(2, args.length());
39 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0); 27 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
40 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1); 28 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
41 Handle<Object> result; 29 Handle<Object> result;
42 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 30 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
43 Object::Divide(isolate, lhs, rhs)); 31 Object::Divide(isolate, lhs, rhs));
44 return *result; 32 return *result;
45 } 33 }
46 34
47 35
48 RUNTIME_FUNCTION(Runtime_Divide_Strong) {
49 HandleScope scope(isolate);
50 DCHECK_EQ(2, args.length());
51 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
52 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
53 Handle<Object> result;
54 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
55 isolate, result, Object::Divide(isolate, lhs, rhs, Strength::STRONG));
56 return *result;
57 }
58
59
60 RUNTIME_FUNCTION(Runtime_Modulus) { 36 RUNTIME_FUNCTION(Runtime_Modulus) {
61 HandleScope scope(isolate); 37 HandleScope scope(isolate);
62 DCHECK_EQ(2, args.length()); 38 DCHECK_EQ(2, args.length());
63 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0); 39 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
64 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1); 40 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
65 Handle<Object> result; 41 Handle<Object> result;
66 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 42 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
67 Object::Modulus(isolate, lhs, rhs)); 43 Object::Modulus(isolate, lhs, rhs));
68 return *result; 44 return *result;
69 } 45 }
70 46
71 47
72 RUNTIME_FUNCTION(Runtime_Modulus_Strong) {
73 HandleScope scope(isolate);
74 DCHECK_EQ(2, args.length());
75 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
76 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
77 Handle<Object> result;
78 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
79 isolate, result, Object::Modulus(isolate, lhs, rhs, Strength::STRONG));
80 return *result;
81 }
82
83
84 RUNTIME_FUNCTION(Runtime_Add) { 48 RUNTIME_FUNCTION(Runtime_Add) {
85 HandleScope scope(isolate); 49 HandleScope scope(isolate);
86 DCHECK_EQ(2, args.length()); 50 DCHECK_EQ(2, args.length());
87 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0); 51 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
88 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1); 52 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
89 Handle<Object> result; 53 Handle<Object> result;
90 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 54 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
91 Object::Add(isolate, lhs, rhs)); 55 Object::Add(isolate, lhs, rhs));
92 return *result; 56 return *result;
93 } 57 }
94 58
95 59
96 RUNTIME_FUNCTION(Runtime_Add_Strong) {
97 HandleScope scope(isolate);
98 DCHECK_EQ(2, args.length());
99 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
100 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
101 Handle<Object> result;
102 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
103 isolate, result, Object::Add(isolate, lhs, rhs, Strength::STRONG));
104 return *result;
105 }
106
107
108 RUNTIME_FUNCTION(Runtime_Subtract) { 60 RUNTIME_FUNCTION(Runtime_Subtract) {
109 HandleScope scope(isolate); 61 HandleScope scope(isolate);
110 DCHECK_EQ(2, args.length()); 62 DCHECK_EQ(2, args.length());
111 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0); 63 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
112 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1); 64 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
113 Handle<Object> result; 65 Handle<Object> result;
114 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 66 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
115 Object::Subtract(isolate, lhs, rhs)); 67 Object::Subtract(isolate, lhs, rhs));
116 return *result; 68 return *result;
117 } 69 }
118 70
119 71
120 RUNTIME_FUNCTION(Runtime_Subtract_Strong) {
121 HandleScope scope(isolate);
122 DCHECK_EQ(2, args.length());
123 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
124 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
125 Handle<Object> result;
126 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
127 isolate, result, Object::Subtract(isolate, lhs, rhs, Strength::STRONG));
128 return *result;
129 }
130
131
132 RUNTIME_FUNCTION(Runtime_ShiftLeft) { 72 RUNTIME_FUNCTION(Runtime_ShiftLeft) {
133 HandleScope scope(isolate); 73 HandleScope scope(isolate);
134 DCHECK_EQ(2, args.length()); 74 DCHECK_EQ(2, args.length());
135 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0); 75 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
136 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1); 76 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
137 Handle<Object> result; 77 Handle<Object> result;
138 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 78 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
139 Object::ShiftLeft(isolate, lhs, rhs)); 79 Object::ShiftLeft(isolate, lhs, rhs));
140 return *result; 80 return *result;
141 } 81 }
142 82
143 83
144 RUNTIME_FUNCTION(Runtime_ShiftLeft_Strong) {
145 HandleScope scope(isolate);
146 DCHECK_EQ(2, args.length());
147 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
148 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
149 Handle<Object> result;
150 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
151 isolate, result, Object::ShiftLeft(isolate, lhs, rhs, Strength::STRONG));
152 return *result;
153 }
154
155
156 RUNTIME_FUNCTION(Runtime_ShiftRight) { 84 RUNTIME_FUNCTION(Runtime_ShiftRight) {
157 HandleScope scope(isolate); 85 HandleScope scope(isolate);
158 DCHECK_EQ(2, args.length()); 86 DCHECK_EQ(2, args.length());
159 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0); 87 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
160 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1); 88 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
161 Handle<Object> result; 89 Handle<Object> result;
162 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 90 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
163 Object::ShiftRight(isolate, lhs, rhs)); 91 Object::ShiftRight(isolate, lhs, rhs));
164 return *result; 92 return *result;
165 } 93 }
166 94
167 95
168 RUNTIME_FUNCTION(Runtime_ShiftRight_Strong) {
169 HandleScope scope(isolate);
170 DCHECK_EQ(2, args.length());
171 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
172 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
173 Handle<Object> result;
174 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
175 isolate, result, Object::ShiftRight(isolate, lhs, rhs, Strength::STRONG));
176 return *result;
177 }
178
179
180 RUNTIME_FUNCTION(Runtime_ShiftRightLogical) { 96 RUNTIME_FUNCTION(Runtime_ShiftRightLogical) {
181 HandleScope scope(isolate); 97 HandleScope scope(isolate);
182 DCHECK_EQ(2, args.length()); 98 DCHECK_EQ(2, args.length());
183 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0); 99 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
184 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1); 100 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
185 Handle<Object> result; 101 Handle<Object> result;
186 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 102 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
187 isolate, result, Object::ShiftRightLogical(isolate, lhs, rhs)); 103 isolate, result, Object::ShiftRightLogical(isolate, lhs, rhs));
188 return *result; 104 return *result;
189 } 105 }
190 106
191 107
192 RUNTIME_FUNCTION(Runtime_ShiftRightLogical_Strong) {
193 HandleScope scope(isolate);
194 DCHECK_EQ(2, args.length());
195 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
196 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
197 Handle<Object> result;
198 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
199 isolate, result,
200 Object::ShiftRightLogical(isolate, lhs, rhs, Strength::STRONG));
201 return *result;
202 }
203
204
205 RUNTIME_FUNCTION(Runtime_BitwiseAnd) { 108 RUNTIME_FUNCTION(Runtime_BitwiseAnd) {
206 HandleScope scope(isolate); 109 HandleScope scope(isolate);
207 DCHECK_EQ(2, args.length()); 110 DCHECK_EQ(2, args.length());
208 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0); 111 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
209 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1); 112 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
210 Handle<Object> result; 113 Handle<Object> result;
211 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 114 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
212 Object::BitwiseAnd(isolate, lhs, rhs)); 115 Object::BitwiseAnd(isolate, lhs, rhs));
213 return *result; 116 return *result;
214 } 117 }
215 118
216 119
217 RUNTIME_FUNCTION(Runtime_BitwiseAnd_Strong) {
218 HandleScope scope(isolate);
219 DCHECK_EQ(2, args.length());
220 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
221 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
222 Handle<Object> result;
223 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
224 isolate, result, Object::BitwiseAnd(isolate, lhs, rhs, Strength::STRONG));
225 return *result;
226 }
227
228
229 RUNTIME_FUNCTION(Runtime_BitwiseOr) { 120 RUNTIME_FUNCTION(Runtime_BitwiseOr) {
230 HandleScope scope(isolate); 121 HandleScope scope(isolate);
231 DCHECK_EQ(2, args.length()); 122 DCHECK_EQ(2, args.length());
232 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0); 123 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
233 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1); 124 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
234 Handle<Object> result; 125 Handle<Object> result;
235 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 126 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
236 Object::BitwiseOr(isolate, lhs, rhs)); 127 Object::BitwiseOr(isolate, lhs, rhs));
237 return *result; 128 return *result;
238 } 129 }
239 130
240 131
241 RUNTIME_FUNCTION(Runtime_BitwiseOr_Strong) {
242 HandleScope scope(isolate);
243 DCHECK_EQ(2, args.length());
244 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
245 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
246 Handle<Object> result;
247 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
248 isolate, result, Object::BitwiseOr(isolate, lhs, rhs, Strength::STRONG));
249 return *result;
250 }
251
252
253 RUNTIME_FUNCTION(Runtime_BitwiseXor) { 132 RUNTIME_FUNCTION(Runtime_BitwiseXor) {
254 HandleScope scope(isolate); 133 HandleScope scope(isolate);
255 DCHECK_EQ(2, args.length()); 134 DCHECK_EQ(2, args.length());
256 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0); 135 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
257 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1); 136 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
258 Handle<Object> result; 137 Handle<Object> result;
259 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 138 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
260 Object::BitwiseXor(isolate, lhs, rhs)); 139 Object::BitwiseXor(isolate, lhs, rhs));
261 return *result; 140 return *result;
262 } 141 }
263 142
264
265 RUNTIME_FUNCTION(Runtime_BitwiseXor_Strong) {
266 HandleScope scope(isolate);
267 DCHECK_EQ(2, args.length());
268 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
269 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
270 Handle<Object> result;
271 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
272 isolate, result, Object::BitwiseXor(isolate, lhs, rhs, Strength::STRONG));
273 return *result;
274 }
275
276 } // namespace internal 143 } // namespace internal
277 } // namespace v8 144 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698