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

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

Issue 819103002: [turbofan] Minor cleanup to reduce code duplication. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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 #include "src/compiler/access-builder.h" 5 #include "src/compiler/access-builder.h"
6 #include "src/compiler/js-graph.h" 6 #include "src/compiler/js-graph.h"
7 #include "src/compiler/js-operator.h" 7 #include "src/compiler/js-operator.h"
8 #include "src/compiler/js-typed-lowering.h" 8 #include "src/compiler/js-typed-lowering.h"
9 #include "src/compiler/machine-operator.h" 9 #include "src/compiler/machine-operator.h"
10 #include "src/compiler/node-properties-inl.h" 10 #include "src/compiler/node-properties-inl.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 ~JSTypedLoweringTest() OVERRIDE {} 43 ~JSTypedLoweringTest() OVERRIDE {}
44 44
45 protected: 45 protected:
46 Reduction Reduce(Node* node) { 46 Reduction Reduce(Node* node) {
47 MachineOperatorBuilder machine(zone()); 47 MachineOperatorBuilder machine(zone());
48 JSGraph jsgraph(graph(), common(), javascript(), &machine); 48 JSGraph jsgraph(graph(), common(), javascript(), &machine);
49 JSTypedLowering reducer(&jsgraph, zone()); 49 JSTypedLowering reducer(&jsgraph, zone());
50 return reducer.Reduce(node); 50 return reducer.Reduce(node);
51 } 51 }
52 52
53 Node* Parameter(Type* type, int index = 0) {
54 Node* node = graph()->NewNode(common()->Parameter(index), graph()->start());
55 NodeProperties::SetBounds(node, Bounds(Type::None(), type));
56 return node;
57 }
58
59 Handle<JSArrayBuffer> NewArrayBuffer(void* bytes, size_t byte_length) { 53 Handle<JSArrayBuffer> NewArrayBuffer(void* bytes, size_t byte_length) {
60 Handle<JSArrayBuffer> buffer = factory()->NewJSArrayBuffer(); 54 Handle<JSArrayBuffer> buffer = factory()->NewJSArrayBuffer();
61 Runtime::SetupArrayBuffer(isolate(), buffer, true, bytes, byte_length); 55 Runtime::SetupArrayBuffer(isolate(), buffer, true, bytes, byte_length);
62 return buffer; 56 return buffer;
63 } 57 }
64 58
65 Matcher<Node*> IsIntPtrConstant(intptr_t value) { 59 Matcher<Node*> IsIntPtrConstant(intptr_t value) {
66 return sizeof(value) == 4 ? IsInt32Constant(static_cast<int32_t>(value)) 60 return sizeof(value) == 4 ? IsInt32Constant(static_cast<int32_t>(value))
67 : IsInt64Constant(static_cast<int64_t>(value)); 61 : IsInt64Constant(static_cast<int64_t>(value));
68 } 62 }
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 IsStoreElement( 626 IsStoreElement(
633 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), 627 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])),
634 key, value, effect, control)); 628 key, value, effect, control));
635 } 629 }
636 } 630 }
637 } 631 }
638 632
639 } // namespace compiler 633 } // namespace compiler
640 } // namespace internal 634 } // namespace internal
641 } // namespace v8 635 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698