OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 // ES6 section 7.2.11 Abstract Relational Comparison step 6. | 278 // ES6 section 7.2.11 Abstract Relational Comparison step 6. |
279 if (!Object::ToNumber(x).ToHandle(&x) || !Object::ToNumber(y).ToHandle(&y)) { | 279 if (!Object::ToNumber(x).ToHandle(&x) || !Object::ToNumber(y).ToHandle(&y)) { |
280 return Nothing<ComparisonResult>(); | 280 return Nothing<ComparisonResult>(); |
281 } | 281 } |
282 return Just(NumberCompare(x->Number(), y->Number())); | 282 return Just(NumberCompare(x->Number(), y->Number())); |
283 } | 283 } |
284 | 284 |
285 | 285 |
286 // static | 286 // static |
287 Maybe<bool> Object::Equals(Handle<Object> x, Handle<Object> y) { | 287 Maybe<bool> Object::Equals(Handle<Object> x, Handle<Object> y) { |
| 288 // This is the generic version of Abstract Equality Comparison; a version in |
| 289 // JavaScript land is available in the EqualStub and NotEqualStub. Whenever |
| 290 // you change something functionality wise in here, remember to update the |
| 291 // TurboFan code stubs as well. |
288 while (true) { | 292 while (true) { |
289 if (x->IsNumber()) { | 293 if (x->IsNumber()) { |
290 if (y->IsNumber()) { | 294 if (y->IsNumber()) { |
291 return Just(NumberEquals(x, y)); | 295 return Just(NumberEquals(x, y)); |
292 } else if (y->IsBoolean()) { | 296 } else if (y->IsBoolean()) { |
293 return Just(NumberEquals(*x, Handle<Oddball>::cast(y)->to_number())); | 297 return Just(NumberEquals(*x, Handle<Oddball>::cast(y)->to_number())); |
294 } else if (y->IsString()) { | 298 } else if (y->IsString()) { |
295 return Just(NumberEquals(x, String::ToNumber(Handle<String>::cast(y)))); | 299 return Just(NumberEquals(x, String::ToNumber(Handle<String>::cast(y)))); |
296 } else if (y->IsJSReceiver()) { | 300 } else if (y->IsJSReceiver()) { |
297 if (!JSReceiver::ToPrimitive(Handle<JSReceiver>::cast(y)) | 301 if (!JSReceiver::ToPrimitive(Handle<JSReceiver>::cast(y)) |
(...skipping 19473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19771 if (cell->value() != *new_value) { | 19775 if (cell->value() != *new_value) { |
19772 cell->set_value(*new_value); | 19776 cell->set_value(*new_value); |
19773 Isolate* isolate = cell->GetIsolate(); | 19777 Isolate* isolate = cell->GetIsolate(); |
19774 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19778 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
19775 isolate, DependentCode::kPropertyCellChangedGroup); | 19779 isolate, DependentCode::kPropertyCellChangedGroup); |
19776 } | 19780 } |
19777 } | 19781 } |
19778 | 19782 |
19779 } // namespace internal | 19783 } // namespace internal |
19780 } // namespace v8 | 19784 } // namespace v8 |
OLD | NEW |