| 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/effect-control-linearizer.h" | 5 #include "src/compiler/effect-control-linearizer.h" |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/compiler/access-builder.h" | 8 #include "src/compiler/access-builder.h" |
| 9 #include "src/compiler/compiler-source-position-table.h" | 9 #include "src/compiler/compiler-source-position-table.h" |
| 10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
| (...skipping 2261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2272 Node* EffectControlLinearizer::LowerMaybeGrowFastElements(Node* node, | 2272 Node* EffectControlLinearizer::LowerMaybeGrowFastElements(Node* node, |
| 2273 Node* frame_state) { | 2273 Node* frame_state) { |
| 2274 GrowFastElementsFlags flags = GrowFastElementsFlagsOf(node->op()); | 2274 GrowFastElementsFlags flags = GrowFastElementsFlagsOf(node->op()); |
| 2275 Node* object = node->InputAt(0); | 2275 Node* object = node->InputAt(0); |
| 2276 Node* elements = node->InputAt(1); | 2276 Node* elements = node->InputAt(1); |
| 2277 Node* index = node->InputAt(2); | 2277 Node* index = node->InputAt(2); |
| 2278 Node* length = node->InputAt(3); | 2278 Node* length = node->InputAt(3); |
| 2279 | 2279 |
| 2280 auto done = __ MakeLabel<2>(MachineRepresentation::kTagged); | 2280 auto done = __ MakeLabel<2>(MachineRepresentation::kTagged); |
| 2281 auto done_grow = __ MakeLabel<2>(MachineRepresentation::kTagged); | 2281 auto done_grow = __ MakeLabel<2>(MachineRepresentation::kTagged); |
| 2282 auto if_grow = __ MakeDeferredLabel<1>(); |
| 2282 auto if_not_grow = __ MakeLabel<1>(); | 2283 auto if_not_grow = __ MakeLabel<1>(); |
| 2283 auto if_not_grow_backing_store = __ MakeLabel<1>(); | |
| 2284 | 2284 |
| 2285 Node* check0 = (flags & GrowFastElementsFlag::kHoleyElements) | 2285 Node* check0 = (flags & GrowFastElementsFlag::kHoleyElements) |
| 2286 ? __ Uint32LessThanOrEqual(length, index) | 2286 ? __ Uint32LessThanOrEqual(length, index) |
| 2287 : __ Word32Equal(length, index); | 2287 : __ Word32Equal(length, index); |
| 2288 __ GotoUnless(check0, &if_not_grow); | 2288 __ GotoUnless(check0, &if_not_grow); |
| 2289 { | 2289 { |
| 2290 // Load the length of the {elements} backing store. | 2290 // Load the length of the {elements} backing store. |
| 2291 Node* elements_length = | 2291 Node* elements_length = |
| 2292 __ LoadField(AccessBuilder::ForFixedArrayLength(), elements); | 2292 __ LoadField(AccessBuilder::ForFixedArrayLength(), elements); |
| 2293 elements_length = ChangeSmiToInt32(elements_length); | 2293 elements_length = ChangeSmiToInt32(elements_length); |
| 2294 | 2294 |
| 2295 // Check if we need to grow the {elements} backing store. | 2295 // Check if we need to grow the {elements} backing store. |
| 2296 Node* check1 = __ Uint32LessThan(index, elements_length); | 2296 Node* check1 = __ Uint32LessThan(index, elements_length); |
| 2297 __ GotoUnless(check1, &if_not_grow_backing_store); | 2297 __ GotoUnless(check1, &if_grow); |
| 2298 __ Goto(&done_grow, elements); | 2298 __ Goto(&done_grow, elements); |
| 2299 | 2299 |
| 2300 __ Bind(&if_not_grow_backing_store); | 2300 __ Bind(&if_grow); |
| 2301 // We need to grow the {elements} for {object}. | 2301 // We need to grow the {elements} for {object}. |
| 2302 Operator::Properties properties = Operator::kEliminatable; | 2302 Operator::Properties properties = Operator::kEliminatable; |
| 2303 Callable callable = | 2303 Callable callable = |
| 2304 (flags & GrowFastElementsFlag::kDoubleElements) | 2304 (flags & GrowFastElementsFlag::kDoubleElements) |
| 2305 ? CodeFactory::GrowFastDoubleElements(isolate()) | 2305 ? CodeFactory::GrowFastDoubleElements(isolate()) |
| 2306 : CodeFactory::GrowFastSmiOrObjectElements(isolate()); | 2306 : CodeFactory::GrowFastSmiOrObjectElements(isolate()); |
| 2307 CallDescriptor::Flags call_flags = CallDescriptor::kNoFlags; | 2307 CallDescriptor::Flags call_flags = CallDescriptor::kNoFlags; |
| 2308 CallDescriptor const* const desc = Linkage::GetStubCallDescriptor( | 2308 CallDescriptor const* const desc = Linkage::GetStubCallDescriptor( |
| 2309 isolate(), graph()->zone(), callable.descriptor(), 0, call_flags, | 2309 isolate(), graph()->zone(), callable.descriptor(), 0, call_flags, |
| 2310 properties); | 2310 properties); |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2766 return isolate()->factory(); | 2766 return isolate()->factory(); |
| 2767 } | 2767 } |
| 2768 | 2768 |
| 2769 Isolate* EffectControlLinearizer::isolate() const { | 2769 Isolate* EffectControlLinearizer::isolate() const { |
| 2770 return jsgraph()->isolate(); | 2770 return jsgraph()->isolate(); |
| 2771 } | 2771 } |
| 2772 | 2772 |
| 2773 } // namespace compiler | 2773 } // namespace compiler |
| 2774 } // namespace internal | 2774 } // namespace internal |
| 2775 } // namespace v8 | 2775 } // namespace v8 |
| OLD | NEW |