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

Side by Side Diff: test/cctest/compiler/test-js-typed-lowering.cc

Issue 1428243003: [turbofan] Add support for relevant ES6 type conversion intrinsics. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixes Created 5 years, 1 month 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 // TODO(jochen): Remove this after the setting is turned on globally. 5 // TODO(jochen): Remove this after the setting is turned on globally.
6 #define V8_IMMINENT_DEPRECATION_WARNINGS 6 #define V8_IMMINENT_DEPRECATION_WARNINGS
7 7
8 #include "src/compiler/js-graph.h" 8 #include "src/compiler/js-graph.h"
9 #include "src/compiler/js-typed-lowering.h" 9 #include "src/compiler/js-typed-lowering.h"
10 #include "src/compiler/machine-operator.h" 10 #include "src/compiler/machine-operator.h"
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 R.CheckHandle(R.isolate->factory()->undefined_string(), r); 537 R.CheckHandle(R.isolate->factory()->undefined_string(), r);
538 } 538 }
539 539
540 { // ToString(null) => "null" 540 { // ToString(null) => "null"
541 Node* r = R.ReduceUnop(op, Type::Null()); 541 Node* r = R.ReduceUnop(op, Type::Null());
542 R.CheckHandle(R.isolate->factory()->null_string(), r); 542 R.CheckHandle(R.isolate->factory()->null_string(), r);
543 } 543 }
544 544
545 { // ToString(boolean) 545 { // ToString(boolean)
546 Node* r = R.ReduceUnop(op, Type::Boolean()); 546 Node* r = R.ReduceUnop(op, Type::Boolean());
547 // TODO(titzer): could be a branch 547 CHECK_EQ(IrOpcode::kSelect, r->opcode());
548 CHECK_EQ(IrOpcode::kJSToString, r->opcode());
549 } 548 }
550 549
551 { // ToString(number) 550 { // ToString(number)
552 Node* r = R.ReduceUnop(op, Type::Number()); 551 Node* r = R.ReduceUnop(op, Type::Number());
553 // TODO(titzer): could remove effects 552 // TODO(titzer): could remove effects
554 CHECK_EQ(IrOpcode::kJSToString, r->opcode()); 553 CHECK_EQ(IrOpcode::kJSToString, r->opcode());
555 } 554 }
556 555
557 { // ToString(string) 556 { // ToString(string)
558 Node* r = R.ReduceUnop(op, Type::String()); 557 Node* r = R.ReduceUnop(op, Type::String());
559 CHECK_EQ(IrOpcode::kParameter, r->opcode()); // No-op 558 CHECK_EQ(IrOpcode::kParameter, r->opcode()); // No-op
560 } 559 }
561 560
562 { // ToString(object) 561 { // ToString(object)
563 Node* r = R.ReduceUnop(op, Type::Object()); 562 Node* r = R.ReduceUnop(op, Type::Object());
564 CHECK_EQ(IrOpcode::kJSToString, r->opcode()); // No reduction. 563 CHECK_EQ(IrOpcode::kJSToString, r->opcode()); // No reduction.
565 } 564 }
566 } 565 }
567 566
568 567
569 TEST(JSToString_replacement) { 568 TEST(JSToString_replacement) {
570 JSTypedLoweringTester R; 569 JSTypedLoweringTester R;
571 570
572 Type* types[] = {Type::Null(), Type::Undefined(), Type::String()}; 571 Type* types[] = {Type::Null(), Type::Undefined(), Type::String()};
573 572
574 for (size_t i = 0; i < arraysize(types); i++) { 573 for (size_t i = 0; i < arraysize(types); i++) {
575 Node* n = R.Parameter(types[i]); 574 Node* n = R.Parameter(types[i]);
576 Node* c = R.graph.NewNode(R.javascript.ToString(), n, R.context(), 575 Node* c =
577 R.start(), R.start()); 576 R.graph.NewNode(R.javascript.ToString(), n, R.context(),
577 R.EmptyFrameState(R.context()), R.start(), R.start());
578 Node* effect_use = R.UseForEffect(c); 578 Node* effect_use = R.UseForEffect(c);
579 Node* add = R.graph.NewNode(R.simplified.ReferenceEqual(Type::Any()), n, c); 579 Node* add = R.graph.NewNode(R.simplified.ReferenceEqual(Type::Any()), n, c);
580 580
581 R.CheckEffectInput(c, effect_use); 581 R.CheckEffectInput(c, effect_use);
582 Node* r = R.reduce(c); 582 Node* r = R.reduce(c);
583 583
584 if (types[i]->Is(Type::String())) { 584 if (types[i]->Is(Type::String())) {
585 CHECK_EQ(n, r); 585 CHECK_EQ(n, r);
586 } else { 586 } else {
587 CHECK_EQ(IrOpcode::kHeapConstant, r->opcode()); 587 CHECK_EQ(IrOpcode::kHeapConstant, r->opcode());
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 CHECK_EQ(p1, r->InputAt(1)); 1260 CHECK_EQ(p1, r->InputAt(1));
1261 } 1261 }
1262 } 1262 }
1263 } 1263 }
1264 } 1264 }
1265 } 1265 }
1266 1266
1267 } // namespace compiler 1267 } // namespace compiler
1268 } // namespace internal 1268 } // namespace internal
1269 } // namespace v8 1269 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698