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

Side by Side Diff: src/compiler/instruction-selector-unittest.cc

Issue 600383002: [turbofan] Add backend support for Float32Constant. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add InstructionSelector unit test. Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/instruction-selector-unittest.h ('k') | src/compiler/raw-machine-assembler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/compiler/instruction-selector-unittest.h" 5 #include "src/compiler/instruction-selector-unittest.h"
6 6
7 #include "src/compiler/compiler-test-utils.h" 7 #include "src/compiler/compiler-test-utils.h"
8 #include "src/flags.h" 8 #include "src/flags.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 InstructionSequence::StateId::FromInt(i))); 106 InstructionSequence::StateId::FromInt(i)));
107 } 107 }
108 return s; 108 return s;
109 } 109 }
110 110
111 111
112 // ----------------------------------------------------------------------------- 112 // -----------------------------------------------------------------------------
113 // Return. 113 // Return.
114 114
115 115
116 TARGET_TEST_F(InstructionSelectorTest, ReturnFloat32Constant) {
117 const float kValue = 4.2f;
118 StreamBuilder m(this, kMachFloat32);
119 m.Return(m.Float32Constant(kValue));
120 Stream s = m.Build(kAllInstructions);
121 ASSERT_EQ(2U, s.size());
122 EXPECT_EQ(kArchNop, s[0]->arch_opcode());
123 ASSERT_EQ(InstructionOperand::CONSTANT, s[0]->OutputAt(0)->kind());
124 EXPECT_FLOAT_EQ(kValue, s.ToFloat32(s[0]->OutputAt(0)));
125 EXPECT_EQ(kArchRet, s[1]->arch_opcode());
126 EXPECT_EQ(1U, s[1]->InputCount());
127 }
128
129
116 TARGET_TEST_F(InstructionSelectorTest, ReturnParameter) { 130 TARGET_TEST_F(InstructionSelectorTest, ReturnParameter) {
117 StreamBuilder m(this, kMachInt32, kMachInt32); 131 StreamBuilder m(this, kMachInt32, kMachInt32);
118 m.Return(m.Parameter(0)); 132 m.Return(m.Parameter(0));
119 Stream s = m.Build(kAllInstructions); 133 Stream s = m.Build(kAllInstructions);
120 ASSERT_EQ(2U, s.size()); 134 ASSERT_EQ(2U, s.size());
121 EXPECT_EQ(kArchNop, s[0]->arch_opcode()); 135 EXPECT_EQ(kArchNop, s[0]->arch_opcode());
122 ASSERT_EQ(1U, s[0]->OutputCount()); 136 ASSERT_EQ(1U, s[0]->OutputCount());
123 EXPECT_EQ(kArchRet, s[1]->arch_opcode()); 137 EXPECT_EQ(kArchRet, s[1]->arch_opcode());
124 EXPECT_EQ(1U, s[1]->InputCount()); 138 EXPECT_EQ(1U, s[1]->InputCount());
125 } 139 }
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 const Instruction* i2 = s2[i]; 295 const Instruction* i2 = s2[i];
282 EXPECT_EQ(i1->arch_opcode(), i2->arch_opcode()); 296 EXPECT_EQ(i1->arch_opcode(), i2->arch_opcode());
283 EXPECT_EQ(i1->InputCount(), i2->InputCount()); 297 EXPECT_EQ(i1->InputCount(), i2->InputCount());
284 EXPECT_EQ(i1->OutputCount(), i2->OutputCount()); 298 EXPECT_EQ(i1->OutputCount(), i2->OutputCount());
285 } 299 }
286 } 300 }
287 301
288 302
289 // ----------------------------------------------------------------------------- 303 // -----------------------------------------------------------------------------
290 // Calls with deoptimization. 304 // Calls with deoptimization.
305
306
291 TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) { 307 TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) {
292 StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged, 308 StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged,
293 kMachAnyTagged); 309 kMachAnyTagged);
294 310
295 BailoutId bailout_id(42); 311 BailoutId bailout_id(42);
296 312
297 Node* function_node = m.Parameter(0); 313 Node* function_node = m.Parameter(0);
298 Node* receiver = m.Parameter(1); 314 Node* receiver = m.Parameter(1);
299 Node* context = m.Parameter(2); 315 Node* context = m.Parameter(2);
300 316
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 EXPECT_EQ(context2->id(), s.ToVreg(call_instr->InputAt(11))); 503 EXPECT_EQ(context2->id(), s.ToVreg(call_instr->InputAt(11)));
488 // Continuation. 504 // Continuation.
489 505
490 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); 506 EXPECT_EQ(kArchRet, s[index++]->arch_opcode());
491 EXPECT_EQ(index, s.size()); 507 EXPECT_EQ(index, s.size());
492 } 508 }
493 509
494 } // namespace compiler 510 } // namespace compiler
495 } // namespace internal 511 } // namespace internal
496 } // namespace v8 512 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction-selector-unittest.h ('k') | src/compiler/raw-machine-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698