| 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/js-intrinsic-lowering.h" | 5 #include "src/compiler/js-intrinsic-lowering.h" |
| 6 | 6 |
| 7 #include <stack> | 7 #include <stack> |
| 8 | 8 |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/compiler/access-builder.h" | 10 #include "src/compiler/access-builder.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 case Runtime::kInlineCall: | 79 case Runtime::kInlineCall: |
| 80 return ReduceCall(node); | 80 return ReduceCall(node); |
| 81 case Runtime::kInlineGetSuperConstructor: | 81 case Runtime::kInlineGetSuperConstructor: |
| 82 return ReduceGetSuperConstructor(node); | 82 return ReduceGetSuperConstructor(node); |
| 83 case Runtime::kInlineArrayBufferViewGetByteLength: | 83 case Runtime::kInlineArrayBufferViewGetByteLength: |
| 84 return ReduceArrayBufferViewField( | 84 return ReduceArrayBufferViewField( |
| 85 node, AccessBuilder::ForJSArrayBufferViewByteLength()); | 85 node, AccessBuilder::ForJSArrayBufferViewByteLength()); |
| 86 case Runtime::kInlineArrayBufferViewGetByteOffset: | 86 case Runtime::kInlineArrayBufferViewGetByteOffset: |
| 87 return ReduceArrayBufferViewField( | 87 return ReduceArrayBufferViewField( |
| 88 node, AccessBuilder::ForJSArrayBufferViewByteOffset()); | 88 node, AccessBuilder::ForJSArrayBufferViewByteOffset()); |
| 89 case Runtime::kInlineArrayBufferViewWasNeutered: | |
| 90 return ReduceArrayBufferViewWasNeutered(node); | |
| 91 case Runtime::kInlineMaxSmi: | 89 case Runtime::kInlineMaxSmi: |
| 92 return ReduceMaxSmi(node); | 90 return ReduceMaxSmi(node); |
| 93 case Runtime::kInlineTypedArrayGetLength: | 91 case Runtime::kInlineTypedArrayGetLength: |
| 94 return ReduceArrayBufferViewField(node, | 92 return ReduceArrayBufferViewField(node, |
| 95 AccessBuilder::ForJSTypedArrayLength()); | 93 AccessBuilder::ForJSTypedArrayLength()); |
| 96 case Runtime::kInlineTypedArrayMaxSizeInHeap: | 94 case Runtime::kInlineTypedArrayMaxSizeInHeap: |
| 97 return ReduceTypedArrayMaxSizeInHeap(node); | 95 return ReduceTypedArrayMaxSizeInHeap(node); |
| 98 case Runtime::kInlineJSCollectionGetTable: | 96 case Runtime::kInlineJSCollectionGetTable: |
| 99 return ReduceJSCollectionGetTable(node); | 97 return ReduceJSCollectionGetTable(node); |
| 100 case Runtime::kInlineStringGetRawHashField: | 98 case Runtime::kInlineStringGetRawHashField: |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 367 |
| 370 // Default to zero if the {receiver}s buffer was neutered. | 368 // Default to zero if the {receiver}s buffer was neutered. |
| 371 value = graph()->NewNode( | 369 value = graph()->NewNode( |
| 372 common()->Select(MachineRepresentation::kTagged, BranchHint::kFalse), | 370 common()->Select(MachineRepresentation::kTagged, BranchHint::kFalse), |
| 373 check, jsgraph()->ZeroConstant(), value); | 371 check, jsgraph()->ZeroConstant(), value); |
| 374 | 372 |
| 375 ReplaceWithValue(node, value, effect, control); | 373 ReplaceWithValue(node, value, effect, control); |
| 376 return Replace(value); | 374 return Replace(value); |
| 377 } | 375 } |
| 378 | 376 |
| 379 Reduction JSIntrinsicLowering::ReduceArrayBufferViewWasNeutered(Node* node) { | |
| 380 Node* receiver = NodeProperties::GetValueInput(node, 0); | |
| 381 Node* effect = NodeProperties::GetEffectInput(node); | |
| 382 Node* control = NodeProperties::GetControlInput(node); | |
| 383 | |
| 384 // Check if the {receiver}s buffer was neutered. | |
| 385 Node* receiver_buffer = effect = graph()->NewNode( | |
| 386 simplified()->LoadField(AccessBuilder::ForJSArrayBufferViewBuffer()), | |
| 387 receiver, effect, control); | |
| 388 Node* value = effect = graph()->NewNode( | |
| 389 simplified()->ArrayBufferWasNeutered(), receiver_buffer, effect, control); | |
| 390 | |
| 391 ReplaceWithValue(node, value, effect, control); | |
| 392 return Replace(value); | |
| 393 } | |
| 394 | |
| 395 Reduction JSIntrinsicLowering::ReduceMaxSmi(Node* node) { | 377 Reduction JSIntrinsicLowering::ReduceMaxSmi(Node* node) { |
| 396 Node* value = jsgraph()->Constant(Smi::kMaxValue); | 378 Node* value = jsgraph()->Constant(Smi::kMaxValue); |
| 397 ReplaceWithValue(node, value); | 379 ReplaceWithValue(node, value); |
| 398 return Replace(value); | 380 return Replace(value); |
| 399 } | 381 } |
| 400 | 382 |
| 401 Reduction JSIntrinsicLowering::ReduceTypedArrayMaxSizeInHeap(Node* node) { | 383 Reduction JSIntrinsicLowering::ReduceTypedArrayMaxSizeInHeap(Node* node) { |
| 402 Node* value = jsgraph()->Constant(FLAG_typed_array_max_size_in_heap); | 384 Node* value = jsgraph()->Constant(FLAG_typed_array_max_size_in_heap); |
| 403 ReplaceWithValue(node, value); | 385 ReplaceWithValue(node, value); |
| 404 return Replace(value); | 386 return Replace(value); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 return jsgraph_->javascript(); | 479 return jsgraph_->javascript(); |
| 498 } | 480 } |
| 499 | 481 |
| 500 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { | 482 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { |
| 501 return jsgraph()->simplified(); | 483 return jsgraph()->simplified(); |
| 502 } | 484 } |
| 503 | 485 |
| 504 } // namespace compiler | 486 } // namespace compiler |
| 505 } // namespace internal | 487 } // namespace internal |
| 506 } // namespace v8 | 488 } // namespace v8 |
| OLD | NEW |