| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/hydrogen.h" | 5 #include "src/hydrogen.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "src/v8.h" | 10 #include "src/v8.h" |
| (...skipping 8977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8988 return true; | 8988 return true; |
| 8989 } | 8989 } |
| 8990 | 8990 |
| 8991 | 8991 |
| 8992 bool HOptimizedGraphBuilder::TryHandleArrayCallNew(CallNew* expr, | 8992 bool HOptimizedGraphBuilder::TryHandleArrayCallNew(CallNew* expr, |
| 8993 HValue* function) { | 8993 HValue* function) { |
| 8994 if (!array_function().is_identical_to(expr->target())) { | 8994 if (!array_function().is_identical_to(expr->target())) { |
| 8995 return false; | 8995 return false; |
| 8996 } | 8996 } |
| 8997 | 8997 |
| 8998 // Special handling for array construction only makes sense if we are |
| 8999 // using allocation sites. |
| 9000 if (!FLAG_allocation_site_transitioning) { |
| 9001 return false; |
| 9002 } |
| 9003 |
| 8998 BuildArrayCall(expr, | 9004 BuildArrayCall(expr, |
| 8999 expr->arguments()->length(), | 9005 expr->arguments()->length(), |
| 9000 function, | 9006 function, |
| 9001 expr->allocation_site()); | 9007 expr->allocation_site()); |
| 9002 return true; | 9008 return true; |
| 9003 } | 9009 } |
| 9004 | 9010 |
| 9005 | 9011 |
| 9006 void HOptimizedGraphBuilder::VisitCall(Call* expr) { | 9012 void HOptimizedGraphBuilder::VisitCall(Call* expr) { |
| 9007 DCHECK(!HasStackOverflow()); | 9013 DCHECK(!HasStackOverflow()); |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9238 } | 9244 } |
| 9239 | 9245 |
| 9240 | 9246 |
| 9241 bool HOptimizedGraphBuilder::IsCallArrayInlineable( | 9247 bool HOptimizedGraphBuilder::IsCallArrayInlineable( |
| 9242 int argument_count, | 9248 int argument_count, |
| 9243 Handle<AllocationSite> site) { | 9249 Handle<AllocationSite> site) { |
| 9244 Handle<JSFunction> caller = current_info()->closure(); | 9250 Handle<JSFunction> caller = current_info()->closure(); |
| 9245 Handle<JSFunction> target = array_function(); | 9251 Handle<JSFunction> target = array_function(); |
| 9246 // We should have the function plus array arguments on the environment stack. | 9252 // We should have the function plus array arguments on the environment stack. |
| 9247 DCHECK(environment()->length() >= (argument_count + 1)); | 9253 DCHECK(environment()->length() >= (argument_count + 1)); |
| 9248 DCHECK(!site.is_null()); | |
| 9249 | 9254 |
| 9250 bool inline_ok = false; | 9255 bool inline_ok = false; |
| 9251 if (site->CanInlineCall()) { | 9256 if (!site.is_null() && site->CanInlineCall()) { |
| 9252 // We also want to avoid inlining in certain 1 argument scenarios. | 9257 // We also want to avoid inlining in certain 1 argument scenarios. |
| 9253 if (argument_count == 1) { | 9258 if (argument_count == 1) { |
| 9254 HValue* argument = Top(); | 9259 HValue* argument = Top(); |
| 9255 if (argument->IsConstant()) { | 9260 if (argument->IsConstant()) { |
| 9256 // Do not inline if the constant length argument is not a smi or | 9261 // Do not inline if the constant length argument is not a smi or |
| 9257 // outside the valid range for unrolled loop initialization. | 9262 // outside the valid range for unrolled loop initialization. |
| 9258 HConstant* constant_argument = HConstant::cast(argument); | 9263 HConstant* constant_argument = HConstant::cast(argument); |
| 9259 if (constant_argument->HasSmiValue()) { | 9264 if (constant_argument->HasSmiValue()) { |
| 9260 int value = constant_argument->Integer32Value(); | 9265 int value = constant_argument->Integer32Value(); |
| 9261 inline_ok = value >= 0 && value <= kElementLoopUnrollThreshold; | 9266 inline_ok = value >= 0 && value <= kElementLoopUnrollThreshold; |
| (...skipping 3279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12541 if (ShouldProduceTraceOutput()) { | 12546 if (ShouldProduceTraceOutput()) { |
| 12542 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12547 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 12543 } | 12548 } |
| 12544 | 12549 |
| 12545 #ifdef DEBUG | 12550 #ifdef DEBUG |
| 12546 graph_->Verify(false); // No full verify. | 12551 graph_->Verify(false); // No full verify. |
| 12547 #endif | 12552 #endif |
| 12548 } | 12553 } |
| 12549 | 12554 |
| 12550 } } // namespace v8::internal | 12555 } } // namespace v8::internal |
| OLD | NEW |