| 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/compiler/code-assembler.h" | 5 #include "src/compiler/code-assembler.h" |
| 6 #include "src/isolate.h" | 6 #include "src/isolate.h" |
| 7 #include "test/cctest/compiler/code-assembler-tester.h" | 7 #include "test/cctest/compiler/code-assembler-tester.h" |
| 8 #include "test/cctest/compiler/function-tester.h" | 8 #include "test/cctest/compiler/function-tester.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| 11 namespace internal { | 11 namespace internal { |
| 12 namespace compiler { | 12 namespace compiler { |
| 13 | 13 |
| 14 typedef CodeAssemblerTesterImpl<CodeAssembler> CodeAssemblerTester; | 14 typedef CodeAssemblerTesterImpl<CodeAssembler> CodeAssemblerTester; |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 Node* SmiTag(CodeAssemblerTester& m, Node* value) { | 18 Node* SmiTag(CodeAssemblerTester& m, Node* value) { |
| 19 int32_t constant_value; | 19 int32_t constant_value; |
| 20 if (m.ToInt32Constant(value, constant_value) && | 20 if (m.ToInt32Constant(value, constant_value) && |
| 21 Smi::IsValid(constant_value)) { | 21 Smi::IsValid(constant_value)) { |
| 22 return m.SmiConstant(Smi::FromInt(constant_value)); | 22 return m.SmiConstant(Smi::FromInt(constant_value)); |
| 23 } | 23 } |
| 24 return m.WordShl(value, m.SmiShiftBitsConstant()); | 24 return m.WordShl(value, m.IntPtrConstant(kSmiShiftSize + kSmiTagSize)); |
| 25 } | 25 } |
| 26 | 26 |
| 27 Node* UndefinedConstant(CodeAssemblerTester& m) { | 27 Node* UndefinedConstant(CodeAssemblerTester& m) { |
| 28 return m.LoadRoot(Heap::kUndefinedValueRootIndex); | 28 return m.LoadRoot(Heap::kUndefinedValueRootIndex); |
| 29 } | 29 } |
| 30 | 30 |
| 31 Node* LoadObjectField(CodeAssemblerTester& m, Node* object, int offset, | 31 Node* LoadObjectField(CodeAssemblerTester& m, Node* object, int offset, |
| 32 MachineType rep = MachineType::AnyTagged()) { | 32 MachineType rep = MachineType::AnyTagged()) { |
| 33 return m.Load(rep, object, m.IntPtrConstant(offset - kHeapObjectTag)); | 33 return m.Load(rep, object, m.IntPtrConstant(offset - kHeapObjectTag)); |
| 34 } | 34 } |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 var_object.Bind(m.IntPtrConstant(66)); | 429 var_object.Bind(m.IntPtrConstant(66)); |
| 430 m.Goto(&block1); | 430 m.Goto(&block1); |
| 431 } | 431 } |
| 432 m.Bind(&block1); | 432 m.Bind(&block1); |
| 433 CHECK(!m.GenerateCode().is_null()); | 433 CHECK(!m.GenerateCode().is_null()); |
| 434 } | 434 } |
| 435 | 435 |
| 436 } // namespace compiler | 436 } // namespace compiler |
| 437 } // namespace internal | 437 } // namespace internal |
| 438 } // namespace v8 | 438 } // namespace v8 |
| OLD | NEW |