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

Side by Side Diff: test/cctest/test-code-stub-assembler.cc

Issue 2436893003: [stubs] Cleanup CSA::BitFieldDecode() and friends. (Closed)
Patch Set: Addressing comments Created 4 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
« no previous file with comments | « src/interpreter/interpreter.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/base/utils/random-number-generator.h" 5 #include "src/base/utils/random-number-generator.h"
6 #include "src/code-factory.h" 6 #include "src/code-factory.h"
7 #include "src/code-stub-assembler.h" 7 #include "src/code-stub-assembler.h"
8 #include "src/compiler/node.h" 8 #include "src/compiler/node.h"
9 #include "src/ic/stub-cache.h" 9 #include "src/ic/stub-cache.h"
10 #include "src/isolate.h" 10 #include "src/isolate.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 CodeStubAssemblerTester m(isolate, descriptor); 54 CodeStubAssemblerTester m(isolate, descriptor);
55 Handle<HeapObject> undefined = isolate->factory()->undefined_value(); 55 Handle<HeapObject> undefined = isolate->factory()->undefined_value();
56 m.Return(m.SmiTag(m.LoadInstanceType(m.HeapConstant(undefined)))); 56 m.Return(m.SmiTag(m.LoadInstanceType(m.HeapConstant(undefined))));
57 Handle<Code> code = m.GenerateCode(); 57 Handle<Code> code = m.GenerateCode();
58 FunctionTester ft(descriptor, code); 58 FunctionTester ft(descriptor, code);
59 MaybeHandle<Object> result = ft.Call(); 59 MaybeHandle<Object> result = ft.Call();
60 CHECK_EQ(InstanceType::ODDBALL_TYPE, 60 CHECK_EQ(InstanceType::ODDBALL_TYPE,
61 Handle<Smi>::cast(result.ToHandleChecked())->value()); 61 Handle<Smi>::cast(result.ToHandleChecked())->value());
62 } 62 }
63 63
64 TEST(BitFieldDecode) { 64 TEST(DecodeWordFromWord32) {
65 Isolate* isolate(CcTest::InitIsolateOnce()); 65 Isolate* isolate(CcTest::InitIsolateOnce());
66 VoidDescriptor descriptor(isolate); 66 VoidDescriptor descriptor(isolate);
67 CodeStubAssemblerTester m(isolate, descriptor); 67 CodeStubAssemblerTester m(isolate, descriptor);
68 68
69 class TestBitField : public BitField<unsigned, 3, 3> {}; 69 class TestBitField : public BitField<unsigned, 3, 3> {};
70 m.Return(m.SmiTag(m.BitFieldDecode<TestBitField>(m.Int32Constant(0x2f)))); 70 m.Return(
71 m.SmiTag(m.DecodeWordFromWord32<TestBitField>(m.Int32Constant(0x2f))));
71 Handle<Code> code = m.GenerateCode(); 72 Handle<Code> code = m.GenerateCode();
72 FunctionTester ft(descriptor, code); 73 FunctionTester ft(descriptor, code);
73 MaybeHandle<Object> result = ft.Call(); 74 MaybeHandle<Object> result = ft.Call();
74 // value = 00101111 75 // value = 00101111
75 // mask = 00111000 76 // mask = 00111000
76 // result = 101 77 // result = 101
77 CHECK_EQ(5, Handle<Smi>::cast(result.ToHandleChecked())->value()); 78 CHECK_EQ(5, Handle<Smi>::cast(result.ToHandleChecked())->value());
78 } 79 }
79 80
80 TEST(JSFunction) { 81 TEST(JSFunction) {
(...skipping 1541 matching lines...) Expand 10 before | Expand all | Expand 10 after
1622 .ToHandleChecked()); 1623 .ToHandleChecked());
1623 VERIFY(result, object->map(), object->properties(), object->elements()); 1624 VERIFY(result, object->map(), object->properties(), object->elements());
1624 #ifdef VERIFY_HEAP 1625 #ifdef VERIFY_HEAP
1625 isolate->heap()->Verify(); 1626 isolate->heap()->Verify();
1626 #endif 1627 #endif
1627 } 1628 }
1628 } 1629 }
1629 1630
1630 } // namespace internal 1631 } // namespace internal
1631 } // namespace v8 1632 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/interpreter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698