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 #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 { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 HandleScope scope(isolate); | 133 HandleScope scope(isolate); |
134 DCHECK_EQ(2, args.length()); | 134 DCHECK_EQ(2, args.length()); |
135 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0); | 135 CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0); |
136 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1); | 136 CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1); |
137 Handle<Object> result; | 137 Handle<Object> result; |
138 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | 138 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
139 Object::BitwiseXor(isolate, lhs, rhs)); | 139 Object::BitwiseXor(isolate, lhs, rhs)); |
140 return *result; | 140 return *result; |
141 } | 141 } |
142 | 142 |
143 RUNTIME_FUNCTION(Runtime_Equals) { | 143 RUNTIME_FUNCTION(Runtime_Equal) { |
144 HandleScope scope(isolate); | 144 HandleScope scope(isolate); |
145 DCHECK_EQ(2, args.length()); | 145 DCHECK_EQ(2, args.length()); |
146 CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); | 146 CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); |
147 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); | 147 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); |
148 Maybe<bool> result = Object::Equals(x, y); | 148 Maybe<bool> result = Object::Equals(x, y); |
149 if (!result.IsJust()) return isolate->heap()->exception(); | 149 if (!result.IsJust()) return isolate->heap()->exception(); |
150 return isolate->heap()->ToBoolean(result.FromJust()); | 150 return isolate->heap()->ToBoolean(result.FromJust()); |
151 } | 151 } |
152 | 152 |
153 RUNTIME_FUNCTION(Runtime_NotEquals) { | 153 RUNTIME_FUNCTION(Runtime_NotEqual) { |
154 HandleScope scope(isolate); | 154 HandleScope scope(isolate); |
155 DCHECK_EQ(2, args.length()); | 155 DCHECK_EQ(2, args.length()); |
156 CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); | 156 CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); |
157 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); | 157 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); |
158 Maybe<bool> result = Object::Equals(x, y); | 158 Maybe<bool> result = Object::Equals(x, y); |
159 if (!result.IsJust()) return isolate->heap()->exception(); | 159 if (!result.IsJust()) return isolate->heap()->exception(); |
160 return isolate->heap()->ToBoolean(!result.FromJust()); | 160 return isolate->heap()->ToBoolean(!result.FromJust()); |
161 } | 161 } |
162 | 162 |
163 RUNTIME_FUNCTION(Runtime_StrictEquals) { | 163 RUNTIME_FUNCTION(Runtime_StrictEqual) { |
164 SealHandleScope scope(isolate); | 164 SealHandleScope scope(isolate); |
165 DCHECK_EQ(2, args.length()); | 165 DCHECK_EQ(2, args.length()); |
166 CONVERT_ARG_CHECKED(Object, x, 0); | 166 CONVERT_ARG_CHECKED(Object, x, 0); |
167 CONVERT_ARG_CHECKED(Object, y, 1); | 167 CONVERT_ARG_CHECKED(Object, y, 1); |
168 return isolate->heap()->ToBoolean(x->StrictEquals(y)); | 168 return isolate->heap()->ToBoolean(x->StrictEquals(y)); |
169 } | 169 } |
170 | 170 |
171 RUNTIME_FUNCTION(Runtime_StrictNotEquals) { | 171 RUNTIME_FUNCTION(Runtime_StrictNotEqual) { |
172 SealHandleScope scope(isolate); | 172 SealHandleScope scope(isolate); |
173 DCHECK_EQ(2, args.length()); | 173 DCHECK_EQ(2, args.length()); |
174 CONVERT_ARG_CHECKED(Object, x, 0); | 174 CONVERT_ARG_CHECKED(Object, x, 0); |
175 CONVERT_ARG_CHECKED(Object, y, 1); | 175 CONVERT_ARG_CHECKED(Object, y, 1); |
176 return isolate->heap()->ToBoolean(!x->StrictEquals(y)); | 176 return isolate->heap()->ToBoolean(!x->StrictEquals(y)); |
177 } | 177 } |
178 | 178 |
| 179 RUNTIME_FUNCTION(Runtime_LessThan) { |
| 180 HandleScope scope(isolate); |
| 181 DCHECK_EQ(2, args.length()); |
| 182 CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); |
| 183 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); |
| 184 Maybe<bool> result = Object::LessThan(x, y); |
| 185 if (!result.IsJust()) return isolate->heap()->exception(); |
| 186 return isolate->heap()->ToBoolean(result.FromJust()); |
| 187 } |
| 188 |
| 189 RUNTIME_FUNCTION(Runtime_GreaterThan) { |
| 190 HandleScope scope(isolate); |
| 191 DCHECK_EQ(2, args.length()); |
| 192 CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); |
| 193 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); |
| 194 Maybe<bool> result = Object::GreaterThan(x, y); |
| 195 if (!result.IsJust()) return isolate->heap()->exception(); |
| 196 return isolate->heap()->ToBoolean(result.FromJust()); |
| 197 } |
| 198 |
| 199 RUNTIME_FUNCTION(Runtime_LessThanOrEqual) { |
| 200 HandleScope scope(isolate); |
| 201 DCHECK_EQ(2, args.length()); |
| 202 CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); |
| 203 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); |
| 204 Maybe<bool> result = Object::LessThanOrEqual(x, y); |
| 205 if (!result.IsJust()) return isolate->heap()->exception(); |
| 206 return isolate->heap()->ToBoolean(result.FromJust()); |
| 207 } |
| 208 |
| 209 RUNTIME_FUNCTION(Runtime_GreaterThanOrEqual) { |
| 210 HandleScope scope(isolate); |
| 211 DCHECK_EQ(2, args.length()); |
| 212 CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); |
| 213 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); |
| 214 Maybe<bool> result = Object::GreaterThanOrEqual(x, y); |
| 215 if (!result.IsJust()) return isolate->heap()->exception(); |
| 216 return isolate->heap()->ToBoolean(result.FromJust()); |
| 217 } |
| 218 |
179 } // namespace internal | 219 } // namespace internal |
180 } // namespace v8 | 220 } // namespace v8 |
OLD | NEW |