| OLD | NEW |
| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 ~JSTypedLoweringTest() OVERRIDE {} | 73 ~JSTypedLoweringTest() OVERRIDE {} |
| 74 | 74 |
| 75 protected: | 75 protected: |
| 76 Reduction Reduce(Node* node) { | 76 Reduction Reduce(Node* node) { |
| 77 MachineOperatorBuilder machine(zone()); | 77 MachineOperatorBuilder machine(zone()); |
| 78 JSGraph jsgraph(graph(), common(), javascript(), &machine); | 78 JSGraph jsgraph(graph(), common(), javascript(), &machine); |
| 79 JSTypedLowering reducer(&jsgraph, zone()); | 79 JSTypedLowering reducer(&jsgraph, zone()); |
| 80 return reducer.Reduce(node); | 80 return reducer.Reduce(node); |
| 81 } | 81 } |
| 82 | 82 |
| 83 Node* EmptyFrameState() { |
| 84 MachineOperatorBuilder machine(zone()); |
| 85 JSGraph jsgraph(graph(), common(), javascript(), &machine); |
| 86 return jsgraph.EmptyFrameState(); |
| 87 } |
| 88 |
| 83 Handle<JSArrayBuffer> NewArrayBuffer(void* bytes, size_t byte_length) { | 89 Handle<JSArrayBuffer> NewArrayBuffer(void* bytes, size_t byte_length) { |
| 84 Handle<JSArrayBuffer> buffer = factory()->NewJSArrayBuffer(); | 90 Handle<JSArrayBuffer> buffer = factory()->NewJSArrayBuffer(); |
| 85 Runtime::SetupArrayBuffer(isolate(), buffer, true, bytes, byte_length); | 91 Runtime::SetupArrayBuffer(isolate(), buffer, true, bytes, byte_length); |
| 86 return buffer; | 92 return buffer; |
| 87 } | 93 } |
| 88 | 94 |
| 89 Matcher<Node*> IsIntPtrConstant(intptr_t value) { | 95 Matcher<Node*> IsIntPtrConstant(intptr_t value) { |
| 90 return sizeof(value) == 4 ? IsInt32Constant(static_cast<int32_t>(value)) | 96 return sizeof(value) == 4 ? IsInt32Constant(static_cast<int32_t>(value)) |
| 91 : IsInt64Constant(static_cast<int64_t>(value)); | 97 : IsInt64Constant(static_cast<int64_t>(value)); |
| 92 } | 98 } |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 | 368 |
| 363 // ----------------------------------------------------------------------------- | 369 // ----------------------------------------------------------------------------- |
| 364 // JSToNumber | 370 // JSToNumber |
| 365 | 371 |
| 366 | 372 |
| 367 TEST_F(JSTypedLoweringTest, JSToNumberWithPlainPrimitive) { | 373 TEST_F(JSTypedLoweringTest, JSToNumberWithPlainPrimitive) { |
| 368 Node* const input = Parameter(Type::PlainPrimitive(), 0); | 374 Node* const input = Parameter(Type::PlainPrimitive(), 0); |
| 369 Node* const context = Parameter(Type::Any(), 1); | 375 Node* const context = Parameter(Type::Any(), 1); |
| 370 Node* const effect = graph()->start(); | 376 Node* const effect = graph()->start(); |
| 371 Node* const control = graph()->start(); | 377 Node* const control = graph()->start(); |
| 372 Reduction r = Reduce(graph()->NewNode(javascript()->ToNumber(), input, | 378 Reduction r = |
| 373 context, effect, control)); | 379 FLAG_turbo_deoptimization |
| 380 ? Reduce(graph()->NewNode(javascript()->ToNumber(), input, context, |
| 381 EmptyFrameState(), effect, control)) |
| 382 : Reduce(graph()->NewNode(javascript()->ToNumber(), input, context, |
| 383 effect, control)); |
| 374 ASSERT_TRUE(r.Changed()); | 384 ASSERT_TRUE(r.Changed()); |
| 375 EXPECT_THAT(r.replacement(), IsToNumber(input, IsNumberConstant(BitEq(0.0)), | 385 EXPECT_THAT(r.replacement(), IsToNumber(input, IsNumberConstant(BitEq(0.0)), |
| 376 graph()->start(), control)); | 386 graph()->start(), control)); |
| 377 } | 387 } |
| 378 | 388 |
| 379 | 389 |
| 380 // ----------------------------------------------------------------------------- | 390 // ----------------------------------------------------------------------------- |
| 381 // JSStrictEqual | 391 // JSStrictEqual |
| 382 | 392 |
| 383 | 393 |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 IsStoreElement( | 809 IsStoreElement( |
| 800 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), | 810 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), |
| 801 key, value, effect, control)); | 811 key, value, effect, control)); |
| 802 } | 812 } |
| 803 } | 813 } |
| 804 } | 814 } |
| 805 | 815 |
| 806 } // namespace compiler | 816 } // namespace compiler |
| 807 } // namespace internal | 817 } // namespace internal |
| 808 } // namespace v8 | 818 } // namespace v8 |
| OLD | NEW |