| 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/v8.h" | 5 #include "src/v8.h" |
| 6 #include "test/cctest/cctest.h" | 6 #include "test/cctest/cctest.h" |
| 7 | 7 |
| 8 #include "src/compiler/graph-inl.h" | 8 #include "src/compiler/graph-inl.h" |
| 9 #include "src/compiler/js-typed-lowering.h" | 9 #include "src/compiler/js-typed-lowering.h" |
| 10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties-inl.h" |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 { // ToBoolean(ordered-number) | 501 { // ToBoolean(ordered-number) |
| 502 Node* r = R.ReduceUnop(op, Type::OrderedNumber()); | 502 Node* r = R.ReduceUnop(op, Type::OrderedNumber()); |
| 503 CHECK_EQ(IrOpcode::kBooleanNot, r->opcode()); | 503 CHECK_EQ(IrOpcode::kBooleanNot, r->opcode()); |
| 504 Node* i = r->InputAt(0); | 504 Node* i = r->InputAt(0); |
| 505 CHECK_EQ(IrOpcode::kNumberEqual, i->opcode()); | 505 CHECK_EQ(IrOpcode::kNumberEqual, i->opcode()); |
| 506 // ToBoolean(x:ordered-number) => BooleanNot(NumberEqual(x, #0)) | 506 // ToBoolean(x:ordered-number) => BooleanNot(NumberEqual(x, #0)) |
| 507 } | 507 } |
| 508 | 508 |
| 509 { // ToBoolean(string) | 509 { // ToBoolean(string) |
| 510 Node* r = R.ReduceUnop(op, Type::String()); | 510 Node* r = R.ReduceUnop(op, Type::String()); |
| 511 // TODO(titzer): test will break with better js-typed-lowering | 511 CHECK_EQ(IrOpcode::kBooleanNot, r->opcode()); |
| 512 CHECK_EQ(IrOpcode::kJSToBoolean, r->opcode()); | 512 Node* i = r->InputAt(0); |
| 513 CHECK_EQ(IrOpcode::kNumberEqual, i->opcode()); |
| 514 Node* j = i->InputAt(0); |
| 515 CHECK_EQ(IrOpcode::kLoadField, j->opcode()); |
| 516 // ToBoolean(x:string) => BooleanNot(NumberEqual(x.length, #0)) |
| 513 } | 517 } |
| 514 | 518 |
| 515 { // ToBoolean(object) | 519 { // ToBoolean(object) |
| 516 Node* r = R.ReduceUnop(op, Type::DetectableObject()); | 520 Node* r = R.ReduceUnop(op, Type::DetectableObject()); |
| 517 R.CheckTrue(r); | 521 R.CheckTrue(r); |
| 518 } | 522 } |
| 519 | 523 |
| 520 { // ToBoolean(undetectable) | 524 { // ToBoolean(undetectable) |
| 521 Node* r = R.ReduceUnop(op, Type::Undetectable()); | 525 Node* r = R.ReduceUnop(op, Type::Undetectable()); |
| 522 R.CheckFalse(r); | 526 R.CheckFalse(r); |
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 CHECK_EQ(p1, r->InputAt(0)); | 1339 CHECK_EQ(p1, r->InputAt(0)); |
| 1336 CHECK_EQ(p0, r->InputAt(1)); | 1340 CHECK_EQ(p0, r->InputAt(1)); |
| 1337 } else { | 1341 } else { |
| 1338 CHECK_EQ(p0, r->InputAt(0)); | 1342 CHECK_EQ(p0, r->InputAt(0)); |
| 1339 CHECK_EQ(p1, r->InputAt(1)); | 1343 CHECK_EQ(p1, r->InputAt(1)); |
| 1340 } | 1344 } |
| 1341 } | 1345 } |
| 1342 } | 1346 } |
| 1343 } | 1347 } |
| 1344 } | 1348 } |
| OLD | NEW |